Wednesday, February 16, 2005

Controlling Serailzation of Arrays

Just a quick note on controlling serialization of Arrays... Arrays' serialization is done in a little different way than any other standard datatypes.. There are special attributes available in System.Xml.Serialization which can be used for Arrays.

Generally we are used to using <XmlElement("tagName")> {VB} or [XmlElement("tagName")]{C#} on properties/members of our class... If these properties/members are arrays then the XmlElement attribute will remove the tree structure and convert it into a flat list...

eg.
<tagName>Value1</tagName>
<tagName>Value2</tagName>

instead of
<tagName>
<itemTag>Value1</itemTag>
<itemTag>Value2</itemTag>
</tagName>

If you would want to get the above structure for your Xml serialization, you would have to use following Attributes

<XmlArray("tagName"), XmlArrayItem("itemTag")> {VB} or [XmlArray("tagName"), XmlArrayItem("itemTag")] {C#}

There are many other small details related to attributes etc which you can find at MSDN... Click Here

Thursday, February 03, 2005

Link Shortcuts for IE address bar

There is a cool discovery (not by me :-)) which I would like to share with you all...

If you modify the registry settings of Internet Explorer then you can achieve the following results...

eg. If you want to search for "Vishal Joshi" on google then simply in the IE address bar you can type

g "Vishal Joshi"

or if you want to search the meaning of smother in dictionary you can do some setting like

d smother

Now have a quick look at the settings that you will have to do in the registry... For ease I am pasing my exported registry... Copy paste the below text in a notepad and save it as "IEQuickLaunch.reg"... After saving it double click on the file which will import the settings to the registry... Do note that you will have to be the admin of your machine to change the registry settings...



Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchUrl]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchUrl\d]
@="http://dictionary.reference.com/search?q=%s"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchUrl\g]
@="http://www.google.com/search?hl=en&lr=&q=%s"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchUrl\msdn]
@="http://search.microsoft.com/search/results.aspx?qu=%s"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchUrl\vishal]
@="http://www.google.com/search?q=%s&ie=UTF-8&sitesearch=vishaljoshi.blogspot.com&x=27&y=9"


The above settings will get you the following shortcuts, you can then add your own...

1.) g searchword [will search google with search word]
2.) d searchword [will search dictionary with search word]
3.) msdn searchword [will search msdn with search word]
4.) vishal searchword [will search my blog with search word]

Tuesday, February 01, 2005

AJAX

In our project one of my collegue (Jason Reis) suggested to implement "Google Suggest" kind of feature for our ASP.Net website... It was indeed a very beautiful idea and I am sure this will really add a lot of value to our web site...
I wonder many would like this kind of feature in their sites and below three links should help a lot of people in achieving the same...

Dino Esposito's Article on MSDN mag....

Anders NorĂ¥s's blog article on DotNet Junkies...

MSDN Webservice Behavior article...

PS: Thanks Jason for bringing this up...