<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Coding Mode</title>
	<atom:link href="http://codingmode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingmode.com</link>
	<description>blog by Harish Mathanan</description>
	<lastBuildDate>Wed, 25 Jan 2012 01:35:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codingmode.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/05ebde8aebcc8e0baed528679010bbbf?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Coding Mode</title>
		<link>http://codingmode.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codingmode.com/osd.xml" title="Coding Mode" />
	<atom:link rel='hub' href='http://codingmode.com/?pushpress=hub'/>
		<item>
		<title>SharePoint Web Part Debugging</title>
		<link>http://codingmode.com/2012/01/20/sharepoint-web-part-debugging/</link>
		<comments>http://codingmode.com/2012/01/20/sharepoint-web-part-debugging/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 01:45:58 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Web Part]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=435</guid>
		<description><![CDATA[NOTE: This applies to going through the steps manually using Visual Studio 2010. And the issue in concern, is breakpoints not being hit. Debugging web parts in SharePoint are not difficult, but they can be annoying. This article on MSDN, (albeit an old one) describes how this can be achieved. Essentially, ensure that the web [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=435&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: </strong><strong>This applies to going through the steps manually using Visual Studio 2010. And t</strong><strong>he issue in concern, is breakpoints not being hit.</strong></p>
<p>Debugging web parts in SharePoint are not difficult, but they can be annoying. This <a href="http://msdn.microsoft.com/en-us/library/dd583380(v=office.11).aspx">article</a> on MSDN, (albeit an old one) describes how this can be achieved.</p>
<p>Essentially, ensure that the web part assembly is part of your web.config safe control list. Then, from Visual Studio, select Debug –&gt; Attach to Process. This is where you will need to select the application pool IIS Process, which will be w3wp.exe.</p>
<p>Now you can set your breakpoint and begin debugging….right? Well not exactly, chances are you will run into a problem in which, the <strong>breakpoint will currently not be hit</strong>. </p>
<p>This is because we are trusting Visual Studio 2010 to determine the type of code being debugged. We’ll have to change this, by selecting Debug –&gt; Attach to Process, then under Attach To, click Select.</p>
<p>Note the option, Automatically determine the type of code to debug</p>
<p><a href="http://harishmathanan.files.wordpress.com/2012/01/image.png"><img style="border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0 0 5px;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2012/01/image_thumb.png?w=403&#038;h=215" width="403" height="215"></a></p>
<p>Click and Select Debug these code types option. The tick and select Managed (v2.0, v1.1, v1.0), click on OK, then attach the w3wp.exe process. </p>
<p><a href="http://harishmathanan.files.wordpress.com/2012/01/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2012/01/image_thumb1.png?w=404&#038;h=210" width="404" height="210"></a></p>
<p>Now set you breakpoint and begin debugging your web part. The issue of not hitting a breakpoint will not occur again.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/435/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/435/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/435/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=435&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2012/01/20/sharepoint-web-part-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2012/01/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2012/01/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Working with Timer Object</title>
		<link>http://codingmode.com/2012/01/13/working-with-timer-object/</link>
		<comments>http://codingmode.com/2012/01/13/working-with-timer-object/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 04:41:20 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=427</guid>
		<description><![CDATA[A timer object can be really helpful when there is a need of some form of scheduling. For example, writing entries into a log file hourly. MSDN defines the Timer class as an object that generates recurring events in an application. The code snippet below shows a simple example using Timer to write out a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=427&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A timer object can be really helpful when there is a need of some form of scheduling. For example, writing entries into a log file hourly. MSDN defines the <a href="http://msdn.microsoft.com/en-us/library/system.timers.timer(v=VS.100).aspx">Timer</a> class as an object that generates recurring events in an application.</p>
<p>The code snippet below shows a simple example using Timer to write out a line every 5 seconds (console application).</p>
<div style="border-bottom:silver 1px solid;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#0000ff;">using</span> System.Timers;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     BeginSchedule();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     Console.ReadKey();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> BeginSchedule()</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     var timer = <span style="color:#0000ff;">new</span> Timer</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>                     {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>                         <span style="color:#008000;">// Gap between each event execution</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>                         <span style="color:#008000;">// set to 5 seconds in miliseconds.</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>                         <span style="color:#008000;">// Then timer is started.</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>                         Interval = 5000,</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>                         Enabled = <span style="color:#0000ff;">true</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>                     };</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     <span style="color:#008000;">// Event that is called after each timer interval.</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     timer.Elapsed += <span style="color:#0000ff;">new</span> ElapsedEventHandler(TimerElapsedEvent);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span> }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> TimerElapsedEvent(<span style="color:#0000ff;">object</span> sender, ElapsedEventArgs e)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>     Console.WriteLine(<span style="color:#006080;">"5 seconds later."</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Code well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/427/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/427/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=427&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2012/01/13/working-with-timer-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Creating a CSV File</title>
		<link>http://codingmode.com/2012/01/13/creating-a-csv-file/</link>
		<comments>http://codingmode.com/2012/01/13/creating-a-csv-file/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 03:49:29 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=423</guid>
		<description><![CDATA[If you need to create a comma-separated values (CSV) file, then the code snippet below shows you how, quickly and easily. 1: using System; 2: using System.Collections.Generic; 3: using System.IO; 4: using System.Text; 5:&#160; 6: private static void CreateCsvFile() 7: { 8: var filePath = @"C:\Books.csv"; 9:&#160; 10: // Initialise stream object with file 11: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=423&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you need to create a comma-separated values (CSV) file, then the code snippet below shows you how, quickly and easily.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#0000ff;">using</span> System.IO;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#0000ff;">using</span> System.Text;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> CreateCsvFile()</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     var filePath = <span style="color:#006080;">@"C:\Books.csv"</span>;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     <span style="color:#008000;">// Initialise stream object with file</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     <span style="color:#0000ff;">using</span> (var wr = <span style="color:#0000ff;">new</span> StreamWriter(filePath, <span style="color:#0000ff;">true</span>))</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>         <span style="color:#008000;">// Collection of book titles</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>         var row = <span style="color:#0000ff;">new</span> List&lt;<span style="color:#0000ff;">string</span>&gt; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>             {<span style="color:#006080;">"A Game of Thrones"</span>, <span style="color:#006080;">"A Clash of Swords"</span>, <span style="color:#006080;">"A Feast for Crows"</span>, <span style="color:#006080;">"A Dance with Dragons"</span>};</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>         var sb = <span style="color:#0000ff;">new</span> StringBuilder();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>         <span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">string</span> <span style="color:#0000ff;">value</span> <span style="color:#0000ff;">in</span> row)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>         {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>             <span style="color:#008000;">// Add a comma before each string</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>             <span style="color:#008000;">// this adds a comma before the book title</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>             <span style="color:#0000ff;">if</span> (sb.Length &gt; 0)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>                 sb.Append(<span style="color:#006080;">","</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>             sb.Append(<span style="color:#0000ff;">value</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>         }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>         <span style="color:#008000;">// write output to file</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>         wr.WriteLine(sb.ToString());</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>     }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Hope this helps, happy coding.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=423&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2012/01/13/creating-a-csv-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Sending and Receiving Information through URL</title>
		<link>http://codingmode.com/2012/01/11/sending-receiving-information-through-url/</link>
		<comments>http://codingmode.com/2012/01/11/sending-receiving-information-through-url/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 12:26:41 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=419</guid>
		<description><![CDATA[Imagine if you had an application that is not a web application but interacts with one. If this is your scenario, then we can use the WebClient class. As it states on MSDN, this class provides common methods for sending data to and receiving data from a resource identified by a URI. Code snippet below [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=419&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Imagine if you had an application that is <strong>not a web application but interacts with one</strong>. If this is your scenario, then we can use the <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient(v=VS.90).aspx">WebClient</a> class. As it states on MSDN, this class provides common methods for sending data to and receiving data from a resource identified by a URI.</p>
<p>Code snippet below shows a very basic example in accomplishing this.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">using</span> System.IO;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#0000ff;">using</span> System.Net;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">// Initialise new WebClient object to send request</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     var client = <span style="color:#0000ff;">new</span> WebClient();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     <span style="color:#008000;">// Add the QueryString parameters as Name Value Collections</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     <span style="color:#008000;">// that need to go with the HTTP request, the data being sent</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     client.QueryString.Add(<span style="color:#006080;">"id"</span>, <span style="color:#006080;">"00001"</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     client.QueryString.Add(<span style="color:#006080;">"author"</span>, <span style="color:#006080;">"Harish Mathanan"</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     client.QueryString.Add(<span style="color:#006080;">"tag"</span>, <span style="color:#006080;">"Programming"</span>);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     <span style="color:#008000;">// Prepare the URL to send the request to</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#0000ff;">string</span> url = <span style="color:#006080;">"http://somerandomsite.com"</span>;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     <span style="color:#008000;">// Send the request and read the response</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     var stream = client.OpenRead(url);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     var reader = <span style="color:#0000ff;">new</span> StreamReader(stream);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     var response = reader.ReadToEnd().Trim();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>     <span style="color:#008000;">// Clean up the stream and HTTP connection</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     stream.Close();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>     reader.Close();</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span> }</pre>
<p><!--CRLF--></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/419/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/419/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=419&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2012/01/11/sending-receiving-information-through-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>2011 in review</title>
		<link>http://codingmode.com/2012/01/01/2011-in-review/</link>
		<comments>http://codingmode.com/2012/01/01/2011-in-review/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 01:54:31 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://heroesmode.com/?p=414</guid>
		<description><![CDATA[The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog. Here&#8217;s an excerpt: The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 14,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 5 sold-out performances for that many [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=414&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.</p>
<div style="background:url('/wp-content/mu-plugins/annual-reports/img/emailteaser.jpg') no-repeat center center;height:300px;"></div>
<p>Here&#8217;s an excerpt:</p>
</p>
<blockquote><p>The concert hall at the Syndey Opera House holds 2,700 people.  This blog was viewed about <strong>14,000</strong> times in 2011.  If it were a concert at Sydney Opera House, it would take about 5 sold-out performances for that many people to see it.</p></blockquote>
<p><a href="/2011/annual-report/">Click here to see the complete report.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=414&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2012/01/01/2011-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Reading XML Files</title>
		<link>http://codingmode.com/2011/12/19/c-reading-xml-files/</link>
		<comments>http://codingmode.com/2011/12/19/c-reading-xml-files/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 05:36:02 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=412</guid>
		<description><![CDATA[This post is written with the intention of showing you very quickly how to read an XML document through code. Listed below is my XML file that I will be working on, filled with fictional data. It’s essentially a listing of books, with their Title, Publisher and Author. 1: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; 2: &#60;!-- [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=412&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post is written with the intention of showing you very quickly how to read an XML document through code.</p>
<p>Listed below is my XML file that I will be working on, filled with fictional data. It’s essentially a listing of books, with their Title, Publisher and Author.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> &lt;?xml version=<span style="color:#006080;">&quot;1.0&quot;</span> encoding=<span style="color:#006080;">&quot;utf-8&quot;</span> ?&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> &lt;!-- Listing of all Books --&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> &lt;Books&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>   &lt;Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     &lt;Title&gt;Master ASP.NET Development&lt;/Title&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     &lt;Publisher&gt;MS Press&lt;/Publisher&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     &lt;Author&gt;Scott Guthrie&lt;/Author&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>   &lt;/Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>   &lt;Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     &lt;Title&gt;Deep Dive Web Programming&lt;/Title&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     &lt;Publisher&gt;MS Press&lt;/Publisher&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     &lt;Author&gt;Scott Hanselman&lt;/Author&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>   &lt;/Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>   &lt;Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     &lt;Title&gt;ASP.NET Good Sense&lt;/Title&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     &lt;Publisher&gt;MS Press&lt;/Publisher&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     &lt;Author&gt;Jon Galloway&lt;/Author&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>   &lt;/Book&gt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span> &lt;/Books&gt;</pre>
<p><!--CRLF--></div>
</div>
<p>The simplest approach to reading this file would be to use the XmlTextReader class (part of the System.Xml namespace). The code snippet below shows you how to put this class into action.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#008000;">// Initialise object by passing in a known path to XML file.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#008000;">// This can also be an URL.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> XmlTextReader xml = <span style="color:#0000ff;">new</span> XmlTextReader(<span style="color:#006080;">@&quot;C:\Projects\ConsoleReadXML\ConsoleReadXML\Books.xml&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> <span style="color:#0000ff;">while</span> (xml.Read()) <span style="color:#008000;">// Ensure there is content.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#0000ff;">if</span> (xml.NodeType.Equals(XmlNodeType.Element)) <span style="color:#008000;">// Find all nodes that are elements.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>         <span style="color:#0000ff;">switch</span> (xml.Name) <span style="color:#008000;">// Evaluates each element by its name.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>             <span style="color:#0000ff;">case</span> <span style="color:#006080;">&quot;Title&quot;</span>:</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>                 Console.WriteLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>                 Console.WriteLine(xml.ReadElementString(<span style="color:#006080;">&quot;Title&quot;</span>)); <span style="color:#008000;">// Reads the value of the element.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>                 <span style="color:#0000ff;">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>             <span style="color:#0000ff;">case</span> <span style="color:#006080;">&quot;Publisher&quot;</span>:</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>                 Console.WriteLine(xml.ReadElementString(<span style="color:#006080;">&quot;Publisher&quot;</span>)); <span style="color:#008000;">// Reads the value of the element.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>                 <span style="color:#0000ff;">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>             <span style="color:#0000ff;">case</span> <span style="color:#006080;">&quot;Author&quot;</span>:</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>                 Console.WriteLine(xml.ReadElementString(<span style="color:#006080;">&quot;Author&quot;</span>)); <span style="color:#008000;">// Reads the value of the element.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>                 <span style="color:#0000ff;">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>             <span style="color:#0000ff;">default</span>:</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>                 <span style="color:#0000ff;">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>My output for the above would be as below:</p>
<p><font size="1"><sup><font color="#666666" size="1">Master ASP.NET Development<br />
        <br />MS Press</p>
<p>Scott Guthrie</font></sup></font></p>
<p><sup><font color="#666666" size="1">Deep Dive Web Programming<br />
      <br />MS Press</p>
<p>Scott Hanselman</font></sup></p>
<p><sup><font color="#666666" size="1">ASP.NET Good Sense<br />
      <br />MS Press</p>
<p>Jon Galloway</p>
<p>Press any key to continue . . .</font></sup></p>
<p>Note, in the snippet above, I’ve used a pre-defined path to my XML document. The use the ReadElementString() method to get the value of the elements.</p>
<p>Although this approach is quick, there is a small annoyance with it. For example, what if I have a&#160; I would like to enumerate through all elements that belong to each book element? You could still achieve this but it’s gets messy, especially when you need to used the data from each book element.</p>
<p>The code snippet below shows you how to achieve this by using the XmlDocument class instead.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#008000;">// Initialise and load Xml document from pre-defined path.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> XmlDocument xml = <span style="color:#0000ff;">new</span> XmlDocument();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> xml.Load(<span style="color:#006080;">@&quot;C:\Projects\ConsoleReadXML\ConsoleReadXML\Books.xml&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> <span style="color:#008000;">// Retrieve the parent node of the document &lt;Book&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> XmlElement parent = xml.DocumentElement;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> XmlNodeList children = parent.ChildNodes;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> <span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">int</span> i = 0; i &lt; children.Count; i++)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     <span style="color:#008000;">// Retrieve child nodes under parent</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     <span style="color:#008000;">// as defined in xml document.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     XmlNode title = children[i].FirstChild;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     XmlNode publisher = title.NextSibling;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     XmlNode author = publisher.NextSibling;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     Console.WriteLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     Console.WriteLine(title.InnerText);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     Console.WriteLine(publisher.InnerText);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     Console.WriteLine(author.InnerText);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The output for the above will remain the same. Note however, I am looking for all elements within a parent element, in this case &lt;Book&gt; then listing them out. The reason I’ve used the XmlNode object is simply to keep things clean. </p>
<p>Why didn’t I just used NextSibling? Things would have got quite silly if I have more child elements involved. Imagine having something like this:</p>
<p>children[i].NextSibling.NextSibling.NextSibling.NextSibling.InnerText</p>
<p>You get the picture.</p>
<p>Happy coding.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=412&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2011/12/19/c-reading-xml-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>SPField Determining a Field Type</title>
		<link>http://codingmode.com/2011/12/12/spfield-determining-a-field-type/</link>
		<comments>http://codingmode.com/2011/12/12/spfield-determining-a-field-type/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 03:39:32 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SPField]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=409</guid>
		<description><![CDATA[What if you needed to find all “People or Group” field from a particular list? The code snippet below shows you how easily. 1: using (SPSite oSite = new SPSite(&#34;http://mysitecollection&#34;)) 2: { 3: using (SPWeb oWeb = oSite.AllWebs[&#34;myweb&#34;]) 4: { 5: SPList oList = oWeb.Lists[&#34;mylist&#34;]; 6:&#160; 7: foreach (SPField oField in oList.Fields) 8: { 9: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=409&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What if you needed to find all “People or Group” field from a particular list? The code snippet below shows you how easily.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">using</span> (SPSite oSite = <span style="color:#0000ff;">new</span> SPSite(<span style="color:#006080;">&quot;http://mysitecollection&quot;</span>))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">using</span> (SPWeb oWeb = oSite.AllWebs[<span style="color:#006080;">&quot;myweb&quot;</span>])</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>         SPList oList = oWeb.Lists[<span style="color:#006080;">&quot;mylist&quot;</span>];</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>         <span style="color:#0000ff;">foreach</span> (SPField oField <span style="color:#0000ff;">in</span> oList.Fields)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>             <span style="color:#0000ff;">if</span> (oField.TypeDisplayName.ToString() == <span style="color:#006080;">&quot;Person or Group&quot;</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>                 Console.WriteLine(oField.Title);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>                 Console.WriteLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Note the bit where I used the <strong>TypeDisplayName</strong> property, this is where I specify the field type I want, and in this case it’s “People or Group”. If I wanted the “Date and Time” field, I’ll just specify “Date and Time”. </p>
<p>How do I get these values? When you create a new column they are listed under Name and Type.</p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/12/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;margin:0 0 5px;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2011/12/image_thumb.png?w=288&#038;h=373" width="288" height="373" /></a></p>
<p>Hope this helps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/409/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/409/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/409/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=409&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2011/12/12/spfield-determining-a-field-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/12/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Understanding IsPostback</title>
		<link>http://codingmode.com/2011/11/17/understanding-ispostback/</link>
		<comments>http://codingmode.com/2011/11/17/understanding-ispostback/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 03:53:34 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/?p=404</guid>
		<description><![CDATA[The IsPostback is probably one of the most commonly used property in ASP.NET development. But what is it exactly? It is a property that belongs to the Page class under the System.Web.UI namespace. Essentially it returns a boolean value indicating if a page is being requested for the first time or if is being loaded [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=404&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The IsPostback is probably one of the most commonly used property in ASP.NET development. </p>
<p><strong>But what is it exactly? </strong></p>
<p>It is a property that belongs to the <a href="http://msdn.microsoft.com/en-us/library/dfbt9et1(v=VS.90).aspx">Page</a> class under the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui(v=VS.90).aspx">System.Web.UI</a> namespace. Essentially it returns a boolean value indicating if a page is being requested for the first time or if is being loaded in respond to a postback.</p>
<p><strong>Please elaborate?</strong></p>
<p>Well, when we talk on the web, we use the <a href="http://www.w3.org/Protocols/">HTTP</a> protocol. The communication or exchange of information between a client (web browser) and an application or site (web browser) is initiated when we type in a site URL or click on a hyperlink. This is known as a <em>Request</em> (GET), the site or application then <em>Responds</em> to the client. This process is known as a round-trip.</p>
<p>However, we the client, also interact with a site or application through the execution of a particular web control (such as a button click). This is when data is sent to the site or application, a POST is made, and this process is known as a postback.</p>
<p><font color="#ff0000"><strong>Important!</strong></font> – We can send data back using a GET as well, but this is not discussed here.</p>
<p>So, the IsPostback property on a ASP.NET page essentially checks if the request is either a GET or POST.</p>
<p><strong>Example</strong></p>
<p>The code snippet below basically shows an array is bound to a drop-down list when a page loaded.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">string</span> arrPets = <span style="color:#0000ff;">new</span> <span style="color:#0000ff;">string</span>[] {<span style="color:#006080;">&quot;Dog&quot;</span>, <span style="color:#006080;">&quot;Cat&quot;</span>, <span style="color:#006080;">&quot;Bird&quot;</span>, <span style="color:#006080;">&quot;Fish&quot;</span>};</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> Page_Load(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     <span style="color:#008000;">// The pet values from the array is not bound here.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">// This is because the when the page is requested</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#008000;">// for the first time, it is not a postback</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#008000;">// There will be no values on the drop-down</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     <span style="color:#008000;">// list control.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     <span style="color:#008000;">// =================================================</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     <span style="color:#008000;">// COMMENTED OUT</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     <span style="color:#008000;">//if(this.Page.IsPostback)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     <span style="color:#008000;">//{</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>         <span style="color:#008000;">//this.dropDownList.DataSource = arrPets;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>         <span style="color:#008000;">//this.dropDownList.DataBind();</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#008000;">//}</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>     <span style="color:#008000;">// The pet values from the array will be bound here.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>     <span style="color:#008000;">// The values will be available on the drop-down</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>     <span style="color:#008000;">// list control.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>     <span style="color:#008000;">// ====================================================</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>     <span style="color:#0000ff;">if</span>(!<span style="color:#0000ff;">this</span>.Page.IsPostback)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>         <span style="color:#0000ff;">this</span>.drownDownList.DataSource = arrPets;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>         <span style="color:#0000ff;">this</span>.dropDownList.DataBind();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span> }</pre>
<p><!--CRLF--></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=404&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2011/11/17/understanding-ispostback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Saving and Retrieving Image from Database</title>
		<link>http://codingmode.com/2011/11/14/c-saving-and-retrieving-image-from-database/</link>
		<comments>http://codingmode.com/2011/11/14/c-saving-and-retrieving-image-from-database/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 06:48:48 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/2011/11/14/c-saving-and-retrieving-image-from-database/</guid>
		<description><![CDATA[This post simplifies the whole approach to saving and retrieving of images from a database. In the real-world, it is highly recommended that your application be separated into separate layers and that validation be implemented for incoming and outgoing data. The User Interface A simple markup for uploading the image and displaying the image. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=401&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post simplifies the whole approach to saving and retrieving of images from a database. In the real-world, it is highly recommended that your application be separated into separate layers and that validation be implemented for incoming and outgoing data.</p>
<p><strong><font size="3">The User Interface</font></strong></p>
<p>A simple markup for uploading the image and displaying the image.</p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2011/11/image_thumb2.png?w=630&#038;h=148" width="630" height="148" /></a></p>
<p><strong><font size="3">The Database</font></strong></p>
<p>A table to store the image using the <strong>image sql db type</strong>.</p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/dbsave.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="dbsave" border="0" alt="dbsave" src="http://harishmathanan.files.wordpress.com/2011/11/dbsave_thumb.png?w=349&#038;h=104" width="349" height="104" /></a></p>
<p>2 stored procedures, one for Inserting a new image. And another for selecting an existing image based on it’s id.</p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/photo002.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="photo002" border="0" alt="photo002" src="http://harishmathanan.files.wordpress.com/2011/11/photo002_thumb.png?w=509&#038;h=177" width="509" height="177" /></a></p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/photo005.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 5px;" title="photo005" border="0" alt="photo005" src="http://harishmathanan.files.wordpress.com/2011/11/photo005_thumb.png?w=501&#038;h=191" width="501" height="191" /></a></p>
<p><strong><font size="3">The Code</font></strong></p>
<p>I have my database connection string stored in my web.config with the name “SampleDB”. </p>
<p>Saving the image to the database is performed on the Upload button click event <strong>btnUpload_Click</strong>.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> btnUpload_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">string</span> conn = ConfigurationManager.ConnectionStrings[<span style="color:#006080;">&quot;SampleDB&quot;</span>].ConnectionString;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     <span style="color:#008000;">// FIRST PART: </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">// get the uploded picture into a byte[] array</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>     <span style="color:#008000;">// from the FileUpload control (photoUpload)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>     <span style="color:#0000ff;">byte</span>[] content = <span style="color:#0000ff;">new</span> <span style="color:#0000ff;">byte</span>[<span style="color:#0000ff;">this</span>.photoUpload.PostedFile.InputStream.Length];</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     <span style="color:#0000ff;">this</span>.photoUpload.PostedFile.InputStream.Read(content, 0, content.Length);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     <span style="color:#008000;">// SECOND PART:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     <span style="color:#008000;">// save the byte[] into the database image type</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     <span style="color:#0000ff;">using</span> (SqlConnection dbConn = <span style="color:#0000ff;">new</span> SqlConnection(conn))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>         dbConn.Open();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>         <span style="color:#0000ff;">using</span> (SqlCommand cmd = <span style="color:#0000ff;">new</span> SqlCommand(<span style="color:#006080;">&quot;InsertNewPhoto&quot;</span>, dbConn))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>             cmd.CommandType = CommandType.StoredProcedure;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>             cmd.Parameters.Add(<span style="color:#006080;">&quot;@photo&quot;</span>, SqlDbType.Image);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>             cmd.Parameters[<span style="color:#006080;">&quot;@photo&quot;</span>].Value = content;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>             cmd.ExecuteNonQuery();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Retrieving the image from the database is performed on the <strong>Page_Load</strong> event through the use of a Generic HTTP Handler created <strong>Photo.ashx</strong></p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Page_Load(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#0000ff;">if</span> (!<span style="color:#0000ff;">this</span>.Page.IsPostBack)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>         <span style="color:#0000ff;">this</span>.photoImage.ImageUrl = <span style="color:#006080;">&quot;Photo.ashx&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p><strong>ProcessRequest</strong> method modified on the <strong>Photo.ashx</strong> Generic HTTP Handler.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#039;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> ProcessRequest(HttpContext context)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     <span style="color:#008000;">// REAL WORLD:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     <span style="color:#008000;">// Retrieve an id that has been passed into a querystring.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     <span style="color:#008000;">// the id is then passed to the database to retrieve the relevant</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#008000;">// photo.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>     <span style="color:#008000;">// This example passes in just the one particular value all the time.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     <span style="color:#0000ff;">byte</span>[] content = <span style="color:#0000ff;">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>     context.Response.ContentType = <span style="color:#006080;">&quot;image/jpeg&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>     context.Response.Clear();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>     <span style="color:#0000ff;">string</span> conn = ConfigurationManager.ConnectionStrings[<span style="color:#006080;">&quot;SampleDB&quot;</span>].ConnectionString;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>     <span style="color:#0000ff;">using</span> (SqlConnection dbConn = <span style="color:#0000ff;">new</span> SqlConnection(conn))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>         dbConn.Open();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>         <span style="color:#0000ff;">using</span> (SqlCommand cmd = <span style="color:#0000ff;">new</span> SqlCommand(<span style="color:#006080;">&quot;SelectPhotoById&quot;</span>, dbConn))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>             cmd.CommandType = CommandType.StoredProcedure;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>             cmd.Parameters.Add(<span style="color:#006080;">&quot;@photoId&quot;</span>, SqlDbType.Int);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>             cmd.Parameters[<span style="color:#006080;">&quot;@photoId&quot;</span>].Value = 1; <span style="color:#008000;">// constant value being passed in</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>             <span style="color:#0000ff;">using</span> (SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleResult))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>                 <span style="color:#0000ff;">while</span> (rdr.Read())</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>                     content = (<span style="color:#0000ff;">byte</span>[])rdr[<span style="color:#006080;">&quot;Photo&quot;</span>];</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>     context.Response.BinaryWrite(content);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#039;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p />
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/401/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=401&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2011/11/14/c-saving-and-retrieving-image-from-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/dbsave_thumb.png" medium="image">
			<media:title type="html">dbsave</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/photo002_thumb.png" medium="image">
			<media:title type="html">photo002</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/photo005_thumb.png" medium="image">
			<media:title type="html">photo005</media:title>
		</media:content>
	</item>
		<item>
		<title>Easy Progress Indicator using jQuery</title>
		<link>http://codingmode.com/2011/11/11/easy-progress-indicator-using-jquery/</link>
		<comments>http://codingmode.com/2011/11/11/easy-progress-indicator-using-jquery/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 12:45:38 +0000</pubDate>
		<dc:creator>Harish Mathanan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">https://harishmathanan.wordpress.com/2011/11/11/easy-progress-indicator-using-jquery/</guid>
		<description><![CDATA[This is a truly simplified approach to providing end-users with an indicator that an operation is in progress. The page markup: The script:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=392&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a truly simplified approach to providing end-users with an indicator that an operation is in progress. </p>
<p><strong>The page markup:</strong></p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2011/11/image_thumb.png?w=657&#038;h=163" width="657" height="163" /></a>    </p>
<p><strong>The script:</strong></p>
<p><a href="http://harishmathanan.files.wordpress.com/2011/11/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://harishmathanan.files.wordpress.com/2011/11/image_thumb1.png?w=317&#038;h=167" width="317" height="167" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/harishmathanan.wordpress.com/392/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/harishmathanan.wordpress.com/392/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/harishmathanan.wordpress.com/392/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codingmode.com&amp;blog=10058827&amp;post=392&amp;subd=harishmathanan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codingmode.com/2011/11/11/easy-progress-indicator-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dfc3cebd7faac25d5f7ca66dfc04ea9d?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">harishmathanan</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://harishmathanan.files.wordpress.com/2011/11/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
