Monday, March 7, 2011

.NETand Java: Dictionary Object in both platforms.

While coding, we often feel the need for getting a value depending upon a key value. This can be accomplished through dictionary object. Thankfully C# came with dictionary object. A small example on how to use dictionary object can be found here:

http://www.dotnetperls.com/dictionary-keys


I searched through Java. They had this dictionary object before, but they have deprecated it for some reason. They have recommended using MAP object which works pretty much the same way a dictionary object works. A quick code snippet to know how Java Map object works can be found here:

http://www.easywayserver.com/blog/java-map-example/


** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

ASP.Net : Load XML from String

If you are interested to know how to load XML from a string rather than from a file, then this tutorial says it all:

http://www.xmlplease.com/create-xml-parse#s2.

The first line is very important, don't miss it.

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Friday, March 4, 2011

ASP.Net: Printing raw xml .

I was trying to print a raw xml string. Browser was omitting the xml tags at the time of display. Then I searched through the internet and found that ASP.Net has a pretty cool widget named Literal. Using this widget, it is very simple to print xml string without the xml tags omitted by the browser. Here is an example code snippet:

1) Add the literal object.

2) Then just use this literal object like a label:

Literal1.Text = XMLString;

Is not it cool!!!

Thursday, March 3, 2011

ASP.net : Post data to another page programmatically without a form submit button.

I was working on a project where I had to pass some value securely to a php script from an ASP.NET page. I found that .NET web request and web response class is there to do this task. Here is the MSDN provided tutorial on how to use these two classes to sent the data through post method and get the response.

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

In the receiving page, I need to write the data through Response.write (for ASP.net) or echo(for php). The response is automatically sent to the requesting page.

Is not it cool!!

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**