Saturday, April 26, 2008

Error parsing XML file in asp.net

If you have installed VS2005 before configuring IIS Server and then try to run an asp.net application on the IIS Server then it will give error:

Error parsing XML file. At line number 1

To rectify this error, we need to install a utility named aspnet_regiis –i (ASP.NET IIS Registration Tool) from the command prompt. It can be found here: %windir%\Microsoft.NET\Framework\v2.0.5027.


Post a Comment(0 comments)

Friday, April 25, 2008

TIPS ON HOW TO IMPROVE WORK ENVOIRMENT

Your comfort zone-Your working environment should be organised according to your needs.

Free yourself of clutter-Make sure you take a moment to remove any unnecessary bits and pieces from your desk.

Limit outside distractions.

Find the things that help you work.

Don't forget the technical things-Is your computer really slow? Do you need a bigger monitor? Mouse or keyboard not working too well? You might be surprised how much difference you'll see if you replace some of your old and broken stuff.

Take breaks when you need to-Sometimes I just can't get into the swing of things so I take a short break and do something else. Sometimes I work flat out for hours and have to force myself to take a break for things like food and drink!

Labels:

Post a Comment(0 comments)

Saturday, April 19, 2008

Writing HTML text in Asp.Net


The .NET framework throws error when we try to enter text which looks like an HTML statement . The text doesn't need to contain valid HTML, just anything with opening and closing angled brackets ("<...>").

The reason behind the error is as a security precaution. Developers need to be aware that users might try to inject HTML (or even a script) into a text box which may affect how the form is rendered

This checking was not performed in the .NET 1.0 framework and was introduced with the .NET 1.1 framework.

Remedy:

The remedy is in two parts and you MUST action both:

  1. To disable request validation on a page add the following directive to the existing "page" directive in the file - you will need to switch to the HTML view for this:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm" ValidateRequest="false"%>

Alternately, you can globally turn request validation off (but in which case be sure to implement item two below). To globally turn request validation off add the following to your web.config file:

this should go within the section. This will turn off request validation for every page in your application.

Warning

With request validation turned off, users will be able to enter html into text boxes on the page. For example entering:

will be rendered by the browser (when the form is updated and the contents redisplayed) as JavaScript and a message box will appear with the message "Hi Amit". This is generally considered to be undesirable!

Unless you actually need users to be able to enter HTML you must convert the string to its html encoding equivalent - basically this means that certain characters (like "<") are converted to codes (so "<" is converted to "<"). To perform this conversion use HttpUtility.HtmlEncode, for example:

MyTextBox.Text = HttpUtility.HtmlEncode(MyTextBox.Text);

You only need to consider this for any text that will be rendered in the browser.

Post a Comment(0 comments)

Tuesday, April 15, 2008

IzzyMenu - Create dynamic Menu in seconds




Create professional looking CSS menus for your Website as easy as never before!
Build your cool menu online, without writing a single line of code!
What is IzzyMenu - it's easy to use Menu Builder, which allows you to build your CSS & DHTML menu in minutes.
Choose from dozens ready styles or create your own menu style. IzzyMenu, online menu generator is the best solution for amateurs and professionals!

Labels: ,

Post a Comment(0 comments)

Saturday, April 12, 2008

Make web 2.0 icons (Like ur Name ) in photoshop

Well this is the latest trend, most of the well known sites has web 2.0 icons. Like many people, I am amazed at look of these icons. These icons generally have glass effect with tinge of 3D shadow.


Here is my step by step guide of making a cool icon for your website or blog my self Sushil Kumar



Step - 1:Decide on the dimension of an icon. This depends on the structure of the template your are using. I use 376px X 105px, Open Photoshop and and type the text for the icon. Then jazz it up with some stylish font type, I used ‘Forte’ size - 43pt

You can download and install font from the Google or other. To install a font: go to Control Panel, fonts folder, then click on File, click on install new fonts, than give path ur download folder,

Step - 2: Select your text layer and press ctrl+j for duplicate layer, and come down it to your first leayer.Then go to edit->Transform -> Filip vertical, and adjust like this.
Post a Comment(0 comments)

How to get distinct rows from a datatable in ASP.Net

If you want to get distinct rows from a datatable you can write this three lines of code andyou are done with it

DataTable dt = ds.Tables[2];

DataView dv = dt.DefaultView;

// true for getting distinct rows

dt=dv.ToTable(true, “ColumnName”);

or you can use this two functions

//Calling from some function

dt = SelectDistinct(dt, "coloumName");

///////////////////////

public DataTable SelectDistinct( DataTable SourceTable, string FieldName)

{

DataTable dt = new DataTable();

dt.Columns.Add(FieldName, SourceTable.Columns[FieldName].DataType);

object LastValue = null;

foreach (DataRow dr in SourceTable.Rows)

{

if (LastValue == null || !(ColumnEqual(LastValue, dr[FieldName])))

{

LastValue = dr[FieldName];

dt.Rows.Add(new object[] { LastValue });

}

}

return dt;

}

private bool ColumnEqual(object A, object B)

{

if (A == DBNull.Value && B == DBNull.Value) // both are DBNull.Value

return true;

if (A == DBNull.Value || B == DBNull.Value) // only one is DBNull.Value

return false;

return (A.Equals(B)); // value type standard comparison

}

Post a Comment(0 comments)

Writing on a file in asp.net application

I have written an application in asp.net where I have to write an Xml file through IIS server but I was getting this error:

Access to the path "C:\.... \viewRss.xml" is denied.

Exception Details:
System.UnauthorizedAccessException: Access to the
path " C:\.... \viewRss.xml " is denied.

And the solution given by the MS on the error page was:

ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS
5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via impersonate="true"/>, the identity will be the anonymous user
(typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in
Explorer, choose "Properties" and select the Security tab. Click "Add"
to add the appropriate user or group. Highlight the ASP.NET account,
and check the boxes for the desired access.

I have tried all this but was unable to write on the file.

The solution I got was with the help of my friend (Ravi) was :

  • Right click on the virtual directory
  • Click on properties
  • Click on Directory Security, onthis tab click on Edit button
  • Check mark on Anonymous User and give the name of the computer like this IUSR_ComputerName
  • Check mark on Integrated Windows authentication and click Ok.
  • And in the Web config file of Asp.Net Application Add this lines between system.web tags
    • <identity impersonate="true" />

After this I was able to write on the xml file.

Post a Comment(1 comments)

What are the security concern when you give access anonymously?

Friday, April 11, 2008

ExtJS with C#

http://code.google.com/p/extsharp/




"I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier."

Labels: , ,

Post a Comment(0 comments)

Tuesday, April 8, 2008

Google launches Amazon like web services for FREE

http://code.google.com/appengine/

This is really awesome.





I am big fan of Amazon Web services but after looking at this from google, I am quite amazed about how the Web 2.0 is reframing the development methodology and internet usage. Google is a very much internet company who already have a server farmhouse to handle various google services. I believe that google has more experience on doing these stuff then Amazon.

Well now I am more excited to see what Microsoft come up with to answer google and Amazon web services.

"Google App Engine lets you run your web applications on Google's infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs grow. With App Engine, there are no servers to maintain: You just upload your application, and it's ready to serve your users.

You can serve your app using a free domain name on the appspot.com domain, or use Google Apps to serve it from your own domain. You can share your application with the world, or limit access to members of your organization.

App Engine costs nothing to get started. Sign up for a free account, and you can develop and publish your application for the world to see, at no charge and with no obligation. A free account can use up to 500MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month."

Labels: , ,

Post a Comment(0 comments)

Monday, April 7, 2008

Flexgrid - using jquery




This one's UI looks cool like ExtJS.

Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml based data source using Ajax to load the content.

Similar in concept with the Ext Grid only its pure jQuery love, which makes it light weight and follows the jQuery mantra of running with the least amount of configuration.

Features

* Resizable columns
* Resizable height and width
* Sortable column headers
* Cool theme
* Can convert an ordinary table
* Ability to connect to an ajax data source (XML and JSON[new])
* Paging
* Show/hide columns
* Toolbar (new)
* Search (new)
* Accessible API
* Many more

Labels: ,

Post a Comment(0 comments)

Sunday, April 6, 2008

Audio Recording in browser

I have researched and found various options to do sound recording. Here are the details about each option:

Flash Audio Recording

Requirement:
Server
Flash Media Server - http://www.adobe.com/products/flashmediaserver/
Nelly2PCM Decoder - http://code.google.com/p/nelly2pcm/

Client
Flash player

1. Flash Audio/Video(or both) recording works on client server architecture. Client is the Flash player on the client browser whereas server is the Flash Media Server.
2. Client streams the live audio/video(or both) to the FMS server.
3. FMS server can record the streaming and store it in the *.flv type file.
4. FMS internally use Nellymoser(audio/video encoding technique) to encode stream to the FLV file.
5. Once the FLV file is located on the server then you will need a decoder to converted flv to MP3(in our case). Nellymoser provides decoder for $7500(which is too expensive in open source market).
6. I tried some more of the flv to mp3 convertor to convert the nellymoser flv to mp3 but had no luck initially.
7. One of the conversion program that worked creating AMR from nellymore encoding flv file was Total Video Convertor. I used GUI tool to convert flv to AMR. They have command line utility available for $350. http://www.effectmatrix.com/total-video-converter/
8. Finally I found this, Nelly2PCM convertor http://code.google.com/p/nelly2pcm/downloads/list which was able to convert FLV file generated by FLASH to PCM. JACKPOT !!
9. I converted flv to PCM and now PCM to WAV to MP3 using SOX and LAME.
10. Now I know the route to complete the flash recording using all above steps, I just need to code it for our need.


Red5 (Open Source Flash Server) -http://osflash.org/red5
Another option to do the same job without using ADOBE flash was RED5. It does the same job of FLASH MEDIA SERVER. The good part is it is open source . That means streaming and recording streaming data to FLV file. Although it also generate the streaming data to FLV only.
I didn't tried this server yet.

ViMas Technology (Mp3 Recording) using Java Applets http://www.vimas.com/index.php
Requirements
Server-
Java
JAVA applet object

Client
Java
JavaScript to communicate with server object

1. This thing works perfectly on different browser and platform including mac and pc
It support
Target OS Platform: Windows 98/NT/2000/ME/XP/2003, Mac OS X.
Target browsers: Windows: Microsoft IE 4.0 and up, Netscape 7, Opera, Mozilla, Firefox.
Mac : Safari, Opera.
Java versions: Microsoft Java 1.1 and Sun Java plug-in 1.4 -1.6.
2. It can generate MP3 directly and can upload to a server. It can also be used to store it on the local hard drive.
3. The only limitation is JAVA in this case.
4. This is a ready to use solution if we want to start recording from web.
5. We can use there demo version which currently allow 20 sec of recording. Otherwise they are priced at $399

MFC Application
1. I created an MFC app that can record sound on the desktop.
2. It can record the sound from the local computer microphone.
3. It currently stores the file to the local machine in WAV format.
4. But in next update we can make it upload to the server.
5. Once done then we can make it as a browser plugin to record sound.


By the way, I also learned about Ogg Vorbis format which an open source royalty free formats used to store and play digital music.
http://www.vorbis.com/faq/#what

Labels: ,

Post a Comment(0 comments)

Thursday, April 3, 2008

How to Install the server on Linux

First of all install the following dependency as they may be required:
  1. yum install seamonkey-nspr.i386
  2. yum install compat-libstdc++-33.i386
  3. yum install libstdc++.so.5

Then

  1. Log in as a root user (required to install Flash Media Server).
  2. Locate the installation file, FlashMediaServer3.tar.gz.
  3. Open a shell window and switch to the directory with the installation file.
  4. Untar the installation file:

i. tar -xzf FlashMediaServer3.tar.gz

  1. A directory with the installation program is created.
  2. At the shell prompt, enter cd and navigate to the directory created in step 5.
  3. Start the installation program with the following command:

i. ./installFMS

  1. The installation program starts and displays a welcome message.
  2. Press Enter to start the installation.
  3. By default, Flash Media Server is installed to the /opt/adobe/fms directory.
  4. Follow the installation instructions on your screen.
  5. Enter a user for Flash Media Server processes to run as. The default is the “nobody” user. (The user you select is also the owner of the Flash Media Server files.)
  6. You will be asked to enter a serial numberYou can leave it blank
  7. The installation is complete. If you configured it to start automatically, the Flash Media Server service starts.
  8. To start the server manually enter

i. ./fmsmgr server fms start.

that's all

Post a Comment(1 comments)

The only problem I went into was that libfms.so.1 was not in the file path so the command ./fmsadmin ?console was giving error. THen I copied the file to the /usr/lib directory and it worked.