Monday, March 15, 2010

Browser Sandbox - Run any browser from the web

As a developer sometimes we face problems with compatibility issues on few versions of browsers, for that we need to test them on those browsers. So some times we need to have them installed on our system. I have found a wonderful utility to test my applications in all versions browsers in my machine without having them installed. This is a great utility for all the developers to test their applications to resolve browser compatibility issues.

Download and install this plug-in.

I personally found this very helpful. Hope this is useful for you.

DropdownList not appearing while using Modalpopup IE6

I add this problem, i found few interesting blogs for this

http://vincexu.blogspot.com/2009/05/ajaxcontroltoolkit-combobox-not.html

http://forums.asp.net/t/1105102.aspx#2449650

Sunday, March 14, 2010

How to read and write a DataSet from and to XML (C#)

private DataSet ReadDataSet(string dataPath)
{
    DataSet ds = new DataSet();
    ds.ReadXml(dataPath, XmlReadMode.ReadSchema);
    return ds;
}
private void WriteDataSet(DataSet ds, string path)
{
    ds.WriteXml(path, XmlWriteMode.WriteSchema);
}

How to convert a comma seperated file (.csv) into a dataset (C#)

A small program to convert .csv file into a dataset which returns a dataset.

public DataSet CSVFileParser( string fileName)
{
     string pathName = System.IO.Path.GetDirectoryName(fileName);
     string file = System.IO.Path.GetFileName(fileName);
     OleDbConnection excelConnection = new OleDbConnection
     (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ pathName + ";Extended Properties=Text;");
     OleDbCommand excelCommand = newOleDbCommand(@"SELECT * FROM "+ file, excelConnection);
     OleDbDataAdapter excelAdapter = newOleDbDataAdapter(excelCommand);
     excelConnection.Open();
     DataSet ds = new DataSet();
     excelAdapter.Fill(ds);
     excelConnection.Close();
     return ds;
}

Hope this is helpful. Happy coding!

Friday, March 12, 2010

URL Escape Characters

What is the % Code in My URL?

In order to prevent the misinterpretation of special characters such as a space, bracket (< and >), or % in the URL (which stands for Uniform Resource Locator - it is the address you see in your browser's address bar indicating the location of the website you are visiting), browsers parse certain special characters using URL escape characters.

Table of URL Escape Characters
Character Escape Character Character Escape Character
Space %20 # %23
$ %24 % %25
& %26 @ %40
' %60 / %2F
: %3A ; %3B
< %3C = %3D
> %3E ? %3F
[ %5B \ %5C
] %5D ^ %5E
{ %7B | %7C
} %7D ~ %7E

 

Good Coding Practice

It is good coding practice to avoid the need for URL escape characters. As a rule of thumb, avoid using the special characters above when formulating a URI string (filename), and I recommend using the hyphen (-) instead of the underscore (_) (as all search engines recognize the hyphen as a space separator, but the same is not true for the underscore; and older browsers do not correctly interpret the underscore in CSS). If you must use the above characters make sure to escape them using the above escape characters so when the browser parses your code it will not misinterpret the link. It's important to note that these URL escape characters differ from HTML escape characters.