<?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>Ashutosh Vyas's Blog</title>
	<atom:link href="http://ashutoshvyas.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ashutoshvyas.wordpress.com</link>
	<description>My day to day interaction with .NET and C#</description>
	<lastBuildDate>Thu, 30 Aug 2007 10:58:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ashutoshvyas.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ashutosh Vyas's Blog</title>
		<link>http://ashutoshvyas.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ashutoshvyas.wordpress.com/osd.xml" title="Ashutosh Vyas&#039;s Blog" />
	<atom:link rel='hub' href='http://ashutoshvyas.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Moved from Blogger to WordPress</title>
		<link>http://ashutoshvyas.wordpress.com/2007/08/30/moved-from-blogger-to-wordpress/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/08/30/moved-from-blogger-to-wordpress/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 09:56:44 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/08/30/moved-from-blogger-to-wordpress/</guid>
		<description><![CDATA[I found a bit more convenient environment moving on to the WordPress. Although its not that much sophesticated and advanced as it was on blogger, but I can see a few more functionalities that I required in WordPress that were not present in Blogger.  Hope you would enjoy here as well. I would try and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=3&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>I found a bit more convenient environment moving on to the WordPress.</pre>
<pre>Although its not that much sophesticated and advanced as it was on blogger,</pre>
<pre>but I can see a few more functionalities that I required in WordPress that were not present in Blogger. </pre>
<pre>Hope you would enjoy here as well.
 I would try and keep both the blogs updated and alive. 

  

Thanks 

-- Ashutosh Vyas</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=3&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/08/30/moved-from-blogger-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>SecureString in c#</title>
		<link>http://ashutoshvyas.wordpress.com/2007/08/22/securestring-in-c/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/08/22/securestring-in-c/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 10:33:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/08/22/securestring-in-c/</guid>
		<description><![CDATA[System.Security.SecureString Per MSDN: Represents text that should be kept confidential. The text is encrypted for privacy when being used, and deleted from computer memory when no longer needed. This class cannot be inherited. Storing any sensitive data like passwords etc in the standard System.String can be a potential threat to the data for the following [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=33&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:85%;color:#ff0000;font-family:verdana;">System.Security.SecureString</span></strong></p>
<p><strong><span style="font-size:85%;color:#ff0000;font-family:verdana;"></span></strong></p>
<p><span style="font-size:85%;color:#000000;font-family:verdana;"><u>Per MSDN:</u></span></p>
<p><span style="font-size:85%;color:#000000;font-family:verdana;">Represents text that should be kept confidential. The text is encrypted for privacy when being used, and deleted from computer memory when no longer needed. This class cannot be inherited. </span></p>
<p><span style="font-size:85%;font-family:verdana;"></span></p>
<p><span style="font-size:85%;font-family:verdana;">Storing any sensitive data like passwords etc in the standard <strong>System.String </strong>can be a potential threat to the data for the following reasons:</span></p>
<ul><span style="font-family:verdana;"><br />
<span style="font-size:85%;"></span></span></ul>
<blockquote><p><span style="font-family:verdana;"><span style="font-size:85%;"><strong>&gt;&gt;</strong> It is stored on the Managed Heap and is not pinned in the memory, so the garbage collector can move it around at will leaving several copies in memory. The code will not know that this has happened, and even if it could figure out that the string was moved, there is no way to clear out the other copies. Instead we have to wait for the CLR to allocate another object where the sensitive data is so that the memory gets erased. </span></span></p>
<p><span style="font-family:verdana;"><span style="font-size:85%;"><strong>&gt;&gt;</strong> It&#8217;s not encrypted, so anyone who can read process&#8217;s memory will be able to see the value of the string easily. Also, if the process gets swapped out to disk, the unencrypted contents of the string will be written to the swap file.</span></span></p>
<p><span style="font-family:verdana;"><span style="font-size:85%;"><strong>&gt;&gt;</strong> It&#8217;s not mutable, so whenever it is modified, there will be the old version and the new version both in memory </span></span></p>
<p><span style="font-family:verdana;"><span style="font-size:85%;"><strong>&gt;&gt;</strong> Since it&#8217;s not mutable, there&#8217;s no effective way to clear it out when you&#8217;re done using it</span></span></p></blockquote>
<p><span style="font-size:85%;font-family:verdana;"></span></p>
<p><span style="font-size:85%;font-family:verdana;">Hence, .NET 2.0 introduced a new class under <strong>System.Security </strong>namespace called <strong>SecureString,</strong> that can be used in place of standard Strings to store sensitive values.</span></p>
<p><span style="font-size:85%;font-family:verdana;">Using SecureString eliminates the above mentioned issues as:</span></p>
<p><span style="font-size:85%;font-family:verdana;"><br />
</span><span style="font-size:85%;font-family:verdana;"></p>
<blockquote><p><span style="font-size:85%;font-family:verdana;"><strong>&gt;&gt; </strong>The SecureString is not stored in the managed heap while standard strings are and therefore it will not be replicated to multiple locations in memory. </span></p>
<p><span style="font-size:85%;font-family:verdana;"><strong>&gt;&gt; </strong>SecureStrings are stored in an encrypted form. They need to be decrypted when they are used. this period of decryption can be kept as small as possible. So even if the process is swapped out to disk while the string is encrypted, the plaintext will not end up in the swap file.</span></p>
<p><span style="font-size:85%;font-family:verdana;"><strong>&gt;&gt; </strong>The keys used to encrypt the string are tied to the user, logon session, and process. This means that any minidumps taken of the process will contain secure strings which are not decryptable. </span></p>
<p><span style="font-size:85%;font-family:verdana;"><strong>&gt;&gt; </strong>SecureStrings are securely zeroed out when they&#8217;re disposed of. System.Strings are immutable and cannot be cleared when you&#8217;ve finished with the sensitive data</span></p></blockquote>
<p></span><span style="font-family:verdana;"><span style="font-size:85%;">create a SecureString, you append one character at a time: </span></span><span style="font-family:verdana;"><span style="font-size:85%;"></p>
<blockquote><p>System.Security.SecureString secString = new System.Security.SecureString();<br />
secString.AppendChar(p);<br />
secString.AppendChar(&#8216;a&#8217;);<br />
secString.AppendChar(&#8216;s&#8217;);<br />
secString.AppendChar(&#8216;s&#8217;);<br />
secString.AppendChar(&#8216;w&#8217;);<br />
secString.AppendChar(&#8216;d&#8217;);</p></blockquote>
<p>When the string contains the data you want, you can make it immutable and uncopyable by calling the <em><strong>MakeReadOnly</strong></em> method:</p>
<blockquote><p>secString.MakeReadOnly();</p></blockquote>
<p>To read the secure value, use the <strong><em>SecureStringToBSTR()</em></strong> method as follows:</p>
<blockquote><p>IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(secString);<br />
string sDecrypString = System.Runtime.InteropServices.Marshal.PtrToStringUni(ptr);</p></blockquote>
<p>The garbage collector will remove SecureStrings when they&#8217;re no longer referenced, but you<br />
can dispose of a SecureString by using the Dispose() method:</p>
<blockquote><p>secString.Dispose();</p></blockquote>
<p></span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=33&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/08/22/securestring-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>An ATOM feed ticker (scrolling one)</title>
		<link>http://ashutoshvyas.wordpress.com/2007/08/16/an-atom-feed-ticker-scrolling-one/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/08/16/an-atom-feed-ticker-scrolling-one/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 12:29:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[References]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/08/16/an-atom-feed-ticker-scrolling-one/</guid>
		<description><![CDATA[Just during my leisure time, while I had a small break from work, I gave a look to my blog that looked quite ugly and out came a thought to beautify it and in the process learn new things.The best part of it was creating an ATOM feed reader for my blog. I finally succeeded [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=32&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Just during my leisure time, while I had a small break from work, I gave a look to my blog that looked quite ugly and out came a thought to beautify it and in the process learn new things.</span><span style="font-size:85%;font-family:verdana;">The best part of it was creating an ATOM feed reader for my blog. I finally succeeded in creating one using the idea from </span><a href="http://www.dynamicdrive.com/"><span style="font-size:85%;font-family:verdana;">Dynamic Drive</span></a><span style="font-size:85%;font-family:verdana;">.</span><span style="font-size:85%;font-family:verdana;">Here I could create a ATOM Feed scroller which would show all the posts on the blog and also give a pause at each and every post with a link to the original post on my blog.</p>
<p>A sample could be seen on </span><a href="http://ashutosh9910-1.at.vwdhosting.net/MyWorld/"><span style="font-size:85%;font-family:verdana;">THIS SITE</span></a><span style="font-size:85%;font-family:verdana;"> where I have hosted it (This is a trial and hense would only be available to me till September 12 2007) <strong><span style="color:#ff0000;">as well as on the top of this blog</span></strong>.</span><span style="font-size:85%;font-family:verdana;">By that time I would be looking to modify it so that it just required the client side code and no server side coding is involved.</p>
<p>Currently it uses an aspx page to display the posts as there is a bit of server side code involved in it. I would try to eliminate that ASAP.</p>
<p>Once done, I would make this a portable widget that could be used to display any ATOM feed providing its URL.</p>
<p>&#8211;Ashutosh</p>
<p></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=32&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/08/16/an-atom-feed-ticker-scrolling-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>SelectSingleNode not selecting the node.</title>
		<link>http://ashutoshvyas.wordpress.com/2007/08/10/selectsinglenode-not-selecting-the-node/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/08/10/selectsinglenode-not-selecting-the-node/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 10:36:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/08/10/selectsinglenode-not-selecting-the-node/</guid>
		<description><![CDATA[Recently I was working on creating an ATOM feed reader. Obtained the JS from DynamicDrive and coded the control to take up the URL and return back the posts from it.It required XML reading and playing around with the nodes. Strange enough, looked easier to work, I had a hard time getting the node required [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=31&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Recently I was working on creating an ATOM feed reader. Obtained the JS from <a href="http://www.dynamicdrive.com/">DynamicDrive</a> and coded the control to take up the URL and return back the posts from it.</span><span style="font-size:85%;font-family:verdana;">It required XML reading and playing around with the nodes. Strange enough, looked easier to work, I had a hard time getting the node required to display the things out.<br />
Below is the format that an ATOM xml uses:</p>
<blockquote><p><span style="font-size:85%;font-family:verdana;">&lt;?xml version=&#8217;1.0&#8242;<br />
encoding=&#8217;UTF-8&#8242;?&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;?xml-stylesheet<br />
href=&#8221;http://www.blogger.com/styles/atom.css&#8221; mce_href=&#8221;http://www.blogger.com/styles/atom.css&#8221;<br />
type=&#8221;text/css&#8221;?&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;feed xmlns=&#8217;http://www.w3.org/2005/Atom&#8217;<br />
xmlns:openSearch=&#8217;http://a9.com/-/spec/opensearchrss/1.0/&#8217;&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;id&gt;tag:blogger.com,1999:blog-36333526&lt;/id&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;updated&gt;2007-08-08T16:18:29.608+05:30&lt;/updated&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;title type=&#8217;text&#8217;&gt;Ashutosh Vyas&#8217;s<br />
Blog&lt;/title&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;author&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;name&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">Ashu</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/name&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/author&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;generator version=&#8217;7.00&#8242;<br />
uri=&#8217;http://www.blogger.com&#8217;&gt;</span><span style="font-size:85%;font-family:verdana;">Blogger</span><span style="font-size:85%;font-family:verdana;">&lt;/generator&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;openSearch:totalResults&gt;22&lt;/openSearch:totalResults&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;openSearch:startIndex&gt;1&lt;/openSearch:startIndex&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;openSearch:itemsPerPage&gt;25&lt;/openSearch:itemsPerPage&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;entry&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;id&gt;tag:blogger.com,1999:blog-36333526.post-3860689405428340431&lt;/id&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;published&gt;2007-08-02T14:47:00.000+05:30&lt;/published&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;updated&gt;2007-08-02T14:54:53.163+05:30&lt;/updated&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;title type=&#8217;text&#8217;&gt;Asynchronous<br />
Page Concept in ASP.NET&lt;/title&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;content type=&#8217;html&#8217;&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;link rel=&#8217;replies&#8217;<br />
type=&#8217;application/atom+xml&#8217;&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;link rel=&#8217;self&#8217;<br />
type=&#8217;application/atom+xml&#8217; </span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&#8230;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;author&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;name&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">Ashu</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/name&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/author&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/entry&gt;</span></p></blockquote>
<p></span><span style="font-size:85%;font-family:verdana;"></span><span style="font-size:85%;font-family:verdana;">Now all I needed was to find out the root node and traverse to the Node &#8220;feed/title&#8221; to find out the title of the blog to display on the top of the scroller.</p>
<p>To my knowledge, it was as easy as<br />
rssDoc.SelectSingleNode(&#8220;feed/title&#8221;).InnerText;<br />
But that did not happen to be the case. It always returned me null.<br />
I tried grabbing out the root node (feed) using<br />
rssDoc.SelectSingleNode(&#8220;feed/title&#8221;).InnerText;<br />
but this would again return me the same NULL.<br />
Strange for me, doing a rssDoc.DocumentElement() would most certainly return me the required feed node.<br />
After a bit of help from MSDN and other group, I discovered what I did not knew till now and I suspect many ppl do not because of lack of use.<br />
You require a NAMESPACEMANAGER to get those nodes out.<br />
So to dig out something from</p>
<p></span><span style="font-size:85%;font-family:verdana;"><br />
</span><span style="font-size:85%;font-family:verdana;"></p>
<blockquote><p><span style="font-size:85%;font-family:verdana;">&lt;feed&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;title&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/feed&gt;</span><br />
<span style="font-size:85%;font-family:verdana;">&lt;/feed&gt;</span></p></blockquote>
<p><span style="font-size:85%;font-family:verdana;"><br />
</span><span style="font-size:85%;font-family:verdana;">we need the following code.</span></p>
<p></span><span style="font-size:85%;font-family:verdana;"><br />
</span><span style="font-size:85%;font-family:verdana;"></p>
<blockquote><p>XmlNode feedNode = rssDoc.DocumentElement;</p>
<p>XmlNamespaceManager nsMgr = new XmlNamespaceManager(rssDoc.NameTable);</p>
<p>nsMgr.AddNamespace(&#8220;prefix&#8221;, <a href="http://www.w3.org/2005/Atom">http://www.w3.org/2005/Atom</a>);</p>
<p>String feedTitle = feedNode.SelectSingleNode(&#8220;prefix:title&#8221;,nsMgr).InnerText;</p></blockquote>
<p>&#8211; Ashutosh<br />
</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=31&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/08/10/selectsinglenode-not-selecting-the-node/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>Asynchronous Page Concept in ASP.NET</title>
		<link>http://ashutoshvyas.wordpress.com/2007/08/02/asynchronous-page-concept-in-aspnet/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/08/02/asynchronous-page-concept-in-aspnet/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 09:47:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/08/02/asynchronous-page-concept-in-aspnet/</guid>
		<description><![CDATA[Server Unavailable. This is the error most of us have faced without a clue asto what leads to this error and server being unavailable.Heres the reason: ASP.NET uses threads from a common language runtime (CLR) thread pool to process requests. As long as there are threads available in the thread pool, ASP.NET has no trouble [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=29&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;"><strong>Server Unavailable.<br />
</strong></span><br />
<span style="font-size:85%;font-family:verdana;">This is the error most of us have faced without a clue asto what leads to this error and server being unavailable.Heres the reason:<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">ASP.NET uses threads from a common language runtime (CLR) thread pool to process requests. As long as there are threads available in the thread pool, ASP.NET has no trouble dispatching incoming requests. But once the thread pool becomes saturated, i.e. all the threads inside it are busy processing requests and no free threads remain, new requests have to wait for threads to become free. If the logjam becomes severe enough and the queue fills to capacity, ASP.NET throws this error stating that Server is Unavailable.<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">SO whats the solution: Well the easiest way is to increase the maximum size of the thread pool, allowing more threads to be created. That&#8217;s the course developers often take when repeated &#8220;Server unavailable&#8221; errors are reported. Another common course of action is adding more servers to the Web farm. But increasing the thread count-or the server count-doesn&#8217;t solve the issue. It just provides temporary relief to the problem.<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">One solution to this implemented in ASP.NET 2.0 is the use of <strong>ASYNCHRONOUS PAGES</strong>. </span><br />
<span style="font-size:85%;font-family:verdana;"><br />
When ASP.NET receives a request for a page, it grabs a thread from a thread pool and assigns that request to the thread. A normal, or synchronous, page holds onto the thread for the duration of the request, preventing the thread from being used to process other requests. If a synchronous request becomes I/O bound—for example, if it calls out to a remote Web service or queries a remote database and waits for the call to come back—then the thread assigned to the request is stuck doing nothing until the call returns. That impedes scalability because the thread pool has a finite number of threads available. If all request-processing threads are blocked waiting for I/O operations to complete, additional requests get queued up waiting for threads to be free. At best, throughput decreases because requests wait longer to be processed. At worst, the queue fills up and ASP.NET fails subsequent requests with 503 &#8220;Server Unavailable&#8221; errors.<br />
</span><br />
<span style="font-size:85%;font-family:verdana;"><strong>Asynchronous pages </strong>offer a neat solution to the problems caused by I/O-bound requests. Page processing begins on a thread-pool thread, but that thread is returned to the thread pool once an asynchronous I/O operation begins in response to a signal from ASP.NET. When the operation completes, ASP.NET grabs another thread from the thread pool and finishes processing the request. Scalability increases because thread-pool threads are used more efficiently. Threads that would otherwise be stuck waiting for I/O to complete can now be used to service other requests. The direct beneficiaries are requests that don&#8217;t perform lengthy I/O operations and can therefore get in and out of the pipeline quickly. Long waits to get into the pipeline have a disproportionately negative impact on the performance of such requests<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">The concept of Asynchronous Pages is available only in ASP.NET 2.0 but it could be implemented in ASP.NET 1.x in a way outlined in the below mentioned link.<br />
</span><a href="http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/"><span style="font-size:85%;font-family:verdana;">http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/</span></a><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">The trick here is to implement IHttpAsyncHandler in a page&#8217;s codebehind class, prompting ASP.NET to process requests not by calling the page&#8217;s IHttpHandler.ProcessRequest method, but by calling IHttpAsyncHandler.BeginProcessRequest instead.<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">ASP.NET 2.0 vastly simplifies the way you build asynchronous pages. You begin by including an Async=&#8221;true&#8221; attribute in the page&#8217;s @ Page directive, like so:<br />
</span><br />
<span style="font-size:85%;font-family:verdana;"><br />
</span><br />
<span style="font-size:85%;font-family:verdana;">This property set to true, says the page to implement the IHttpAsyncHandler. Regarding this, you need to register the Begin method and End method of to the Page.AddOnPreRenderCompleteAsync.<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">// Register async methods</span><br />
<span style="font-size:85%;font-family:verdana;">AddOnPreRenderCompleteAsync</span><br />
<span style="font-size:85%;font-family:verdana;">( </span><br />
<span style="font-size:85%;font-family:verdana;">new BeginEventHandler(BeginAsyncOperation), </span><br />
<span style="font-size:85%;font-family:verdana;">new EndEventHandler(EndAsyncOperation)</span><br />
<span style="font-size:85%;font-family:verdana;">);<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">By these actions, the starts its normal life cycle, until the end of the OnPreRender event invocation. At this point the ASP.NET calls the Begin method that we registered earlier and the operation begins (calling the database etc&#8230;), meanwhile, the thread that has been assigned to the request goeas back to the thread pool. At the end of the Begin method, an IAsyncResult is being sent automatically to the ASP.NET and let it determine in the operation had completed, a new thread is being called from the thread pool and there is call to the End method (that we registered earlier, remmember?).<br />
</span><br />
<span style="font-size:85%;font-family:verdana;">Jeff Prosise explains it all in<br />
</span><br />
<a href="http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/"><span style="font-size:85%;font-family:verdana;">http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/</span></a></p>
<p><span style="font-size:85%;font-family:verdana;">&#8211; Ashutosh</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=29&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/08/02/asynchronous-page-concept-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>FOR v/s FOREACH: Different Perspectives.</title>
		<link>http://ashutoshvyas.wordpress.com/2007/07/06/for-vs-foreach-different-perspectives/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/07/06/for-vs-foreach-different-perspectives/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 08:44:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/07/06/for-vs-foreach-different-perspectives/</guid>
		<description><![CDATA[Over the years I have been coding just to get the work done. Now since last few months, I realized the importance of every single step taken to improve the performance and writing the code that is optimized. But during this process of optimization, at times I felt if Approach 1 was more optimized or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=27&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Over the years I have been coding just to get the work done. Now since last few months, I realized the importance of every single step taken to improve the performance and writing the code that is optimized.</span><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">But during this process of optimization, at times I felt if Approach 1 was more optimized or Approach 2.</span><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">One such condition was when I used For loops to iterate through the items of collection.</span><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">Now heres the theory:</span><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<strong><span style="font-size:85%;font-family:verdana;">FOR LOOP:</span></strong><br />
<strong><span style="font-size:85%;font-family:Verdana;"></span></strong><br />
<span style="font-size:85%;font-family:verdana;">int[] indexArray = new int[5];</span><br />
<span style="font-size:85%;font-family:verdana;">int total = 0;</span><br />
<span style="font-size:85%;font-family:verdana;">for(int i = 0; i &lt; indexArray.Length; i++)<br />
<span style="font-size:85%;font-family:verdana;">{ </span><br />
<span style="font-size:85%;font-family:verdana;">total += indexArray[i];</span><br />
<span style="font-size:85%;font-family:verdana;">}</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"><strong>FOREACH LOOP:</strong></span><br />
<strong><span style="font-size:85%;font-family:Verdana;"></span></strong><br />
<span style="font-size:85%;font-family:verdana;">int[] indexArray = new int[5];</span><br />
<span style="font-size:85%;font-family:verdana;">int total = 0;</span><br />
<span style="font-size:85%;font-family:verdana;">foreach(int i in indexArray) </span><br />
<span style="font-size:85%;font-family:verdana;">{ </span><br />
<span style="font-size:85%;font-family:verdana;">total += i;</span><br />
<span style="font-size:85%;font-family:verdana;">}</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">The advantage of a foreach loop over a for loop is that it is not al all necessary to know the number of items within the collection when an iteration starts. This avoids iterating off the end of the collection using an index that is not available. <strong>A </strong></span><span style="font-size:85%;font-family:verdana;"><strong>foreach loop also allows code to iterate over a collection without first loading the collection in entirety into memory</strong>. </span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">So herein we can safely assume that using foreach is an optimized approach rather than using a for loop.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"><strong>NOW LETS MOVE TO THE OTHER SIDE OF IT:</strong></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">If we closely look at the IL Code for the above two constructs:</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"><strong>FOR LOOP:</strong></span><br />
<strong><span style="font-size:85%;font-family:Verdana;"></span></strong><br />
<span style="font-size:85%;font-family:verdana;">Instruction </span><br />
<span style="font-size:85%;font-family:verdana;">cmp dword ptr [eax+4],0 </span><br />
<span style="font-size:85%;font-family:verdana;">jle 0000000F</span><br />
<span style="font-size:85%;font-family:verdana;">mov ecx,dword ptr [eax+edx*4+8] </span><br />
<span style="font-size:85%;font-family:verdana;">inc edx </span><br />
<span style="font-size:85%;font-family:verdana;">++icmp esi,dword ptr [eax+4] </span><br />
<span style="font-size:85%;font-family:verdana;">jl FFFFFFF8</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Here, the comparision is done at two stages:</span><br />
<span style="font-size:85%;font-family:Verdana;">1. For the first run it is done only once to check if the counter is good to continue into the loop.</span><br />
<span style="font-size:85%;font-family:Verdana;">2. Inside the loop where it is exactly comparing and recalling the code.</span><br />
<span style="font-size:85%;font-family:verdana;">This is very well optimized in the loop.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"><strong>FOREACH LOOP:</strong></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">Instruction</span><br />
<span style="font-size:85%;font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">cmp esi,dword ptr [ebx+4] </span><br />
<span style="font-size:85%;font-family:verdana;">jl FFFFFFE3</span><br />
<span style="font-size:85%;font-family:verdana;">cmp esi,dword ptr [ebx+4] </span><br />
<span style="font-size:85%;font-family:verdana;">jb 00000009</span><br />
<span style="font-size:85%;font-family:verdana;">mov eax,dword ptr [ebx+esi*4+8] </span><br />
<span style="font-size:85%;font-family:verdana;">mov dword ptr [ebp-0Ch],eax </span><br />
<span style="font-size:85%;font-family:verdana;">mov eax,dword ptr [ebp-0Ch]</span><br />
<span style="font-size:85%;font-family:verdana;">add dword ptr [ebp-8],eax </span><br />
<span style="font-size:85%;font-family:verdana;">inc esi </span><br />
<span style="font-size:85%;font-family:verdana;">cmp esi,dword ptr [ebx+4] </span><br />
<span style="font-size:85%;font-family:verdana;">jl FFFFFFE3</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Clearly the two syntaxes are different. There are some unwanted comparisions and some moves that are exactly not required. Thats because foreach treats everything as a collection and hence uses the code for the same which reduces the performance if it is not a collection and is a simple array only.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">So still I am at indecision whether For is an optimized version or ForEach is??&#8230;&#8230;&#8230;&#8230;.. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">&#8211;Ashutosh</span><br />
</span><span style="font-size:85%;font-family:verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=27&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/07/06/for-vs-foreach-different-perspectives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>Difference Between VB.NET and C# (A comparision)</title>
		<link>http://ashutoshvyas.wordpress.com/2007/05/23/difference-between-vbnet-and-c-a-comparision/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/05/23/difference-between-vbnet-and-c-a-comparision/#comments</comments>
		<pubDate>Wed, 23 May 2007 08:53:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>
		<category><![CDATA[References]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/05/23/difference-between-vbnet-and-c-a-comparision/</guid>
		<description><![CDATA[Below is a very good article describing the almost complete list of difference that VB.NET has with C#.It basically compares one to one keywords and functions for both the languages. It could be extremely useful for people who find it difficult to transit from VB.NET to C# http://www.codeproject.com/dotnet/vbnet_c__difference.asp&#8211;Ashutosh<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=25&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Below is a very good article describing the almost complete list of difference that VB.NET has with C#.</span><span style="font-size:85%;font-family:verdana;">It basically compares one to one keywords and functions for both the languages.</p>
<p>It could be extremely useful for people who find it difficult to transit from VB.NET to C#</p>
<p></span><a href="http://www.codeproject.com/dotnet/vbnet_c__difference.asp"><span style="font-size:85%;font-family:verdana;">http://www.codeproject.com/dotnet/vbnet_c__difference.asp</span></a><span style="font-size:85%;font-family:verdana;"></span><span style="font-size:85%;font-family:verdana;">&#8211;Ashutosh</p>
<p></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=25&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/05/23/difference-between-vbnet-and-c-a-comparision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>Providing Custom Intellisense in VS.NET IDE (Thanks to Mikhail Arkhipov)</title>
		<link>http://ashutoshvyas.wordpress.com/2007/05/08/providing-custom-intellisense-in-vsnet-ide-thanks-to-mikhail-arkhipov/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/05/08/providing-custom-intellisense-in-vsnet-ide-thanks-to-mikhail-arkhipov/#comments</comments>
		<pubDate>Tue, 08 May 2007 05:12:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/05/08/providing-custom-intellisense-in-vsnet-ide-thanks-to-mikhail-arkhipov/</guid>
		<description><![CDATA[In the previous post I tried to validate my HTML in the VS.NET designer for HTML usingmy own custom validations. While this proved quite helpful, I felt a deep need of intellisense in VS.NET for my objects and hense decided to implement the same. After a bit of googling and researching, I could find a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=23&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">In the previous post I tried to validate my HTML in the VS.NET designer for HTML usingmy own custom validations.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">While this proved quite helpful, I felt a deep need of intellisense in VS.NET for my objects and hense decided to implement the same.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">After a bit of googling and researching, I could find a possible way of implementing the same.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Here&#8217;s how it goes.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">As we all know, VS 2005 implements Intellisense using the XSD files. So the idea was to provide VS IDE with my own XSD so that it could use that XSD instead of the default one.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">The process involved the following steps:</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;color:#3333ff;font-family:Verdana;"><strong>1. Create your custom XSD:</strong></span><br />
<strong><span style="font-size:85%;color:#3333ff;font-family:Verdana;">2. Make this XSD available to VS.NET IDE</span></strong><br />
<strong><span style="font-size:85%;color:#3333ff;font-family:Verdana;">3. Using the custom XSD</span></strong><br />
<strong><span style="font-size:85%;color:#3333ff;font-family:Verdana;"></span></strong></p>
<p><strong><span style="font-size:85%;color:#3333ff;font-family:Verdana;">1. Create your custom XSD:</span></strong><br />
<span style="font-size:85%;color:#000000;font-family:Verdana;">Since I was creating intellisense for HTML, I always required the default HTML intellisense and a few of my own. So I decided to use the XSD that VS IDE uses to provide intellisense in HTML view. Those XSDs could be found located at </span></p>
<p align="center"><span style="font-size:85%;color:#000000;font-family:Verdana;"><strong>&#8220;%vsInstallDir%\Common7\Packages\schemas\html&#8221;</strong></span></p>
<p align="center"><strong><span style="font-size:85%;font-family:Verdana;"></span></strong></p>
<p align="justify"><span style="font-size:85%;font-family:Verdana;">Here, since my IDE was using IE6_0.XSD, I decided to make a copy of it and make my own XSD out of it, so that I could get all the custom HTML intellisense. So I copied IE6_0.XSD and created &#8220;MyCustom.XSD&#8221;</span></p>
<p align="justify"><span style="font-size:85%;font-family:Verdana;">Now to that XSD I made some changes that I required. For example, when you have a <strong>TD</strong> tag in the HTML, you do not have an attribute called <strong>TYPE. </strong>I required an attribute <strong>TYPE </strong>which could have two possible values: <strong>DATA / AGGREGATE.</strong></span></p>
<p align="justify"><strong><span style="font-size:85%;font-family:Verdana;"></span></strong></p>
<p align="justify"><span style="font-size:85%;font-family:Verdana;">So basically I required my TDs to be somewhat like :</span></p>
<p align="justify"><span style="font-size:85%;font-family:Verdana;"><span style="color:#3366ff;">&lt;TD type=&#8221;Data&#8221;/&gt;</span> OR <span style="color:#3366ff;">&lt;TD type=&#8221;Aggregate&#8221;/&gt;</span></span></p>
<p align="justify"><span style="font-size:85%;color:#3366ff;font-family:Verdana;"></span></p>
<p align="justify"><span style="font-size:85%;color:#000000;font-family:Verdana;">So to attain this, following changes were made to the MyCustom.xsd</span></p>
<ul>
<li>
<p align="justify"><span style="font-size:85%;font-family:verdana;">At the location where element TD is defined, add a new Attribute Group called<br />
&#8220;cellTypeAttributeForHiText&#8221; (You can have any name you like).<a href="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGCWVydQI/AAAAAAAAAAM/iMdw75wW7LA/s1600-h/Image1.JPG"><img border="0" src="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGCWVydQI/AAAAAAAAAAM/iMdw75wW7LA/s320/Image1.JPG" style="float:left;cursor:hand;margin:0 10px 10px 0;" /></a></p>
<p></span></li>
<li>
<p align="justify"><span style="font-size:85%;font-family:Verdana;">Next we need to create this Attribute group called &#8220;cellTypeAttributeForHiText&#8221;. For this we can define a new Attribute group as in the picture.<a href="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGuWVydRI/AAAAAAAAAAU/Ld2bhlLLjGM/s1600-h/Image2.JPG"><img border="0" src="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGuWVydRI/AAAAAAAAAAU/Ld2bhlLLjGM/s320/Image2.JPG" style="float:left;cursor:hand;margin:0 10px 10px 0;" /></a></p>
<p></span></li>
<li>
<p align="justify"><span style="font-size:85%;font-family:Verdana;">While creating this Attribute group, we would be creating a simple type that would provide us the dropdown list in the intellisense when we write &#8220;Type=&#8221; in the IDE.<a href="http://bp2.blogger.com/_yP_Ri8BRUho/RkAHXmVydSI/AAAAAAAAAAc/iNBU_FX49ts/s1600-h/Image3.JPG"><img border="0" src="http://bp2.blogger.com/_yP_Ri8BRUho/RkAHXmVydSI/AAAAAAAAAAc/iNBU_FX49ts/s320/Image3.JPG" style="float:left;cursor:hand;margin:0 10px 10px 0;" /></a></p>
<p></span></li>
</ul>
<p align="justify"><span style="font-size:85%;font-family:Verdana;"></span></p>
<p><span style="font-size:85%;font-family:Verdana;">Apart from these, there are a couple more changes that are required so that the IDE distinguishes between the two schemas.</span><span style="font-size:85%;font-family:Verdana;"><span style="color:#3366ff;">&lt;xsd:schema version=&#8221;1.0&#8243; targetNamespace=&#8217;http://schemas.microsoft.com/intellisense/<span style="color:#ff0000;">MyCustomSchema</span>&#8216;<br />
xmlns=&#8217;http://schemas.microsoft.com/intellisense/<span style="color:#ff0000;">MyCustomSchema</span>&#8216;<br />
xmlns:xsd=&#8217;http://www.w3.org/2001/XMLSchema&#8217;<br />
xmlns:vs=&#8217;http://schemas.microsoft.com/Visual-Studio-Intellisense&#8217;<br />
vs:clientom=&#8221;ie6_0dom.tlb&#8221;<br />
vs:ishtmlschema=&#8221;true&#8221;<br />
vs:isserverschema=&#8221;false&#8221;<br />
vs:htmlflavor=&#8221;4.0&#8243;<br />
vs:MultipleScriptLanguages=&#8221;true&#8221;<br />
vs:cssschema=&#8221;<span style="color:#ff0000;">CSS 2.1</span>&#8220;<br />
vs:SuccinctFriendlyName=&#8221;<span style="color:#ff0000;">My Custom Schema</span>&#8220;&gt;</span></p>
<p>SO now we are all done with the changes. We have a well made XSD to use with our IDE.</p>
<p></span></p>
<p align="justify"><span style="font-size:85%;color:#3333ff;font-family:Verdana;"><strong>2. Make this XSD available to VS.NET IDE </strong></span></p>
<p align="justify"><span style="font-size:85%;color:#000000;font-family:Verdana;">In order to make this XSD available to VS IDE, we need to perform two steps.</span></p>
<ul>
<li><span style="font-size:85%;font-family:Verdana;">Firstly copy the XSD file to the location where the default XSDs for IDE are located.</span></li>
<li><span style="font-family:Verdana;"><span style="font-size:85%;">Secondly make a registry entry to register this schema with the IDE. For this, create a .reg file with the following text<span style="font-family:verdana;">:</span></span></span></li>
</ul>
<p><span style="font-size:85%;color:#3366ff;font-family:verdana;">[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 21]</span></p>
<p><span style="font-size:85%;color:#3366ff;font-family:verdana;">&#8220;Friendly Name&#8221;=&#8221;My Custom Schema&#8221;</span></p>
<p><span style="font-size:85%;color:#3366ff;font-family:verdana;">&#8220;URI&#8221;=</span><a href="http://schemas.microsoft.com/intellisense/ie7"><span style="color:#3366ff;">&#8220;<span style="font-size:85%;font-family:verdana;"><a href="http://schemas.microsoft.com/intellisense/MyCustomSchema">http://schemas.microsoft.com/intellisense/MyCustomSchema&#8221;</a></span></span></a></p>
<p><span style="font-size:85%;color:#3366ff;font-family:verdana;">&#8220;File&#8221;=&#8221;html\\MyCustom.xsd&#8221;</span></p>
<p><span style="font-size:85%;color:#3366ff;font-family:Verdana;"></span></p>
<p><span style="font-size:85%;color:#000000;font-family:Verdana;">Running this script would add the information to the Registry and would register the schema to the VS.NET IDE.</span></p>
<p><span style="font-size:85%;font-family:Verdana;">One thing to note here is that I have hardcoded the name SCHEMA21. This was because on my machine, I had 20 Schemas already loaded. By default, VS.NET creats 20 schemas and hense we need to maintain the order to get the schema working. Hense the number.</span></p>
<p><span style="font-size:85%;font-family:Verdana;"></span></p>
<p><span style="font-size:85%;color:#3333ff;font-family:verdana;"><strong>3. Using the custom XSD </strong></span></p>
<p><span style="font-size:85%;color:#000000;font-family:Verdana;">Once we close the IDE and reopen it, now this Schema would always be available to the IDE. For using this, goto the IDE, open the HTML designer and you would see a dropdown on the toolbar of the IDE for selecting <strong>TARGET SCHEMA FOR VALIDATION</strong></span></p>
<p><span style="font-size:85%;"><span style="font-family:verdana;">In the dropdown we will find our custom schema listed and by selecting that schema, we could now have intellisense from our own XSD file</span><a href="http://bp0.blogger.com/_yP_Ri8BRUho/RkAdRGVydUI/AAAAAAAAAAs/OV_AN_pAFiM/s1600-h/Image4.JPG"><img border="0" src="http://bp0.blogger.com/_yP_Ri8BRUho/RkAdRGVydUI/AAAAAAAAAAs/OV_AN_pAFiM/s320/Image4.JPG" style="float:left;cursor:hand;margin:0 10px 10px 0;" /></a><br />
</span></p>
<p><span style="font-size:85%;"></span></p>
<p><span style="font-size:85%;"></span></p>
<p><span style="font-size:85%;"></span></p>
<p><span style="font-size:85%;"></span></p>
<p><span style="font-size:85%;"><span style="font-family:verdana;">I would thank </span><a href="http://blogs.msdn.com/mikhailarkhipov/"><span style="font-family:verdana;">Mikhail Arkhipov</span></a><span style="font-family:verdana;"> for the help he provided</span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=23&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/05/08/providing-custom-intellisense-in-vsnet-ide-thanks-to-mikhail-arkhipov/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>

		<media:content url="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGCWVydQI/AAAAAAAAAAM/iMdw75wW7LA/s320/Image1.JPG" medium="image" />

		<media:content url="http://bp1.blogger.com/_yP_Ri8BRUho/RkAGuWVydRI/AAAAAAAAAAU/Ld2bhlLLjGM/s320/Image2.JPG" medium="image" />

		<media:content url="http://bp2.blogger.com/_yP_Ri8BRUho/RkAHXmVydSI/AAAAAAAAAAc/iNBU_FX49ts/s320/Image3.JPG" medium="image" />

		<media:content url="http://bp0.blogger.com/_yP_Ri8BRUho/RkAdRGVydUI/AAAAAAAAAAs/OV_AN_pAFiM/s320/Image4.JPG" medium="image" />
	</item>
		<item>
		<title>Providing Custom Validations in VS.NET IDE</title>
		<link>http://ashutoshvyas.wordpress.com/2007/05/03/providing-custom-validations-in-vsnet-ide/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/05/03/providing-custom-validations-in-vsnet-ide/#comments</comments>
		<pubDate>Thu, 03 May 2007 04:59:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[References]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/05/03/providing-custom-validations-in-vsnet-ide/</guid>
		<description><![CDATA[Hi all, Just recently, working on Reporting system, I was required to create PDF reports out of HTML pages. I did those successfully using iTextSharp, a free online library for rendering PDFs from HTML. In the process, I had to customize the particular HTMLs to contain several constraints and hense I had to validate them [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=22&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Hi all,</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Just recently, working on Reporting system, I was required to create PDF reports out of HTML pages. I did those successfully using <strong>iTextSharp</strong>, a free online library for rendering PDFs from HTML.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">In the process, I had to customize the particular HTMLs to contain several constraints and hense I had to validate them at the design level.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">I found a great designer that did the trick. The well known <strong>Visual Studio.NET Designer. </strong>I decided to use that for my purpose as it did nost ofthe validations all by itself and I just had to add a few more of my custom ones.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Say for example, in my report, I was always required to have three DIVs in my tag in HTML, namely &#8220;HEADER&#8221;, &#8220;FOOTER&#8221; and &#8220;DETAIL&#8221;</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Now by default there is not such binding for user in case he is making it a regular HTML. But if it a Report then I had to put these validation checks.</span><br />
<span style="font-family:verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">For this I had to tweak the Designer to throw messages to the user if required.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">The best way out seemed to be MACROS at that is what did the trick.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">While creating any macro or a module in a macro project, we always have one Module in it <strong>&#8220;EnvironmentEvents&#8221;. </strong>This module contains all events pertaining to all the events that occur in the Visual Studio IDE.</span></p>
<p><span style="font-family:verdana;"><span style="font-size:85%;">In the EnvironmentEvents module, choose the event<br />
&#8220;DocumentEvents_DocumentSaved&#8221;</span></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">This event will be called every time a document is saved in Visual Studio IDE.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Here in you could have all your validations and all those will be thrown back to IDE using your own system of exception throwing, which could possibly be via MessageBox or some message in Output Window etc.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Now in order to get the items into Output window or task list, we can use the following piece of code.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;color:#3366ff;font-family:verdana;">Dim projItem As EnvDTE.Solution</span><br />
<span style="font-size:85%;color:#3366ff;font-family:verdana;">Dim tw As TaskList = CType(win.Object, TaskList)<br />
win = projItem.DTE.Windows.Item(Constants.vsWindowKindTaskList)</span><br />
<span style="font-size:85%;color:#3366ff;font-family:verdana;">tw = CType(win.Object, TaskList)tw.TaskItems.Add(&#8220;ErrorCategory&#8221;, Document.Name, &#8220;Error Message&#8221;, vsTaskPriority.vsTaskPriorityHigh, , True, Document.Name, -1, True, True)</span></p>
<p><span style="font-size:85%;font-family:verdana;">&#8211; Ashutosh</span></p>
<p><span style="font-family:verdana;"><span style="font-size:85%;"></span></span></p>
<p><span style="font-family:verdana;"></span></p>
<p><span style="font-family:Verdana;"></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=22&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/05/03/providing-custom-validations-in-vsnet-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
		<item>
		<title>Properties in .NET</title>
		<link>http://ashutoshvyas.wordpress.com/2007/04/18/properties-in-net/</link>
		<comments>http://ashutoshvyas.wordpress.com/2007/04/18/properties-in-net/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 10:48:00 +0000</pubDate>
		<dc:creator>ashutoshvyas</dc:creator>
				<category><![CDATA[Concepts]]></category>

		<guid isPermaLink="false">http://ashutoshvyas.wordpress.com/2007/04/18/properties-in-net/</guid>
		<description><![CDATA[Last few days have been extremely hectic for me. We have been working with pace to set the tone up for the new HiText reporting tool that we @ EITS are planning to use to generate our reports.Finally we got it to work. And in the mean time, I learnt quite a new concepts in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=21&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;font-family:verdana;">Last few days have been extremely hectic for me. We have been working with pace to set the tone up for the new HiText reporting tool that we @ EITS are planning to use to generate our reports.</span><span style="font-size:85%;font-family:verdana;">Finally we got it to work. And in the mean time, I learnt quite a new concepts in the process itself. Be it Reflection, Be it Properties, Dynamically loading and calling assemblies, creating templates to use with Visual Studio IDE, tweeking IDE to implement my own Intellisense and many more..</p>
<p>Due to the lack of time, I could not update the place as frequently as before. So once I got some time out of work, I concentrated back on putting something up here.</p>
<p>So here is the first one from me:<br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">The <strong>PROPERTIES </strong>in .NET are said to be faster than normal user defined functions.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">But strange enough (to me atleast), the properties that are defined at the class level, at the grassroot level are implemented as functions itself.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Just to confirm the same&#8230;..you could create a simple class with a few properties defined. Compile it and then try checking the output in the ILDASM. </span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:verdana;">I came across this fact when I was playing around with Reflection and Invoking methods and getting properties to return values by just specifying the names of the properties as string.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Ususally any property in C# is written with two methods (get &amp; set) and this property is in turn implements as two seperate functions. For example if we create a property called Prop1 with methods get and set defined, the they are at root level implemented as the following two functions:</span><br />
<span style="font-size:85%;font-family:Verdana;">1. GET &#8211; get_Prop1()</span><br />
<span style="font-size:85%;font-family:Verdana;">2. SET &#8211; set_Prop1()</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">I accidentally came across the fact when the compiler told me that I can not create function named get_Prop1 or set_Prop1&#8230;&#8230;&#8230;.as they already exist ?????????????</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">After a bit of exploration, here is the result .NET properties are implemented as functions itself. If so then how come using Properties be better than using Functions.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Well the .NET compiler are built up and are implemented in such a way so as to give preceeedence to these get and set functions over all other functions and hense they are faster. No special concerns about the same.</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">Hope this helps someone in there works&#8230;..</span><br />
<span style="font-size:85%;font-family:Verdana;"></span><br />
<span style="font-size:85%;font-family:Verdana;">&#8211; Ashutosh Vyas</span></p>
<p></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ashutoshvyas.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ashutoshvyas.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ashutoshvyas.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ashutoshvyas.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ashutoshvyas.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ashutoshvyas.wordpress.com&amp;blog=1613329&amp;post=21&amp;subd=ashutoshvyas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ashutoshvyas.wordpress.com/2007/04/18/properties-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88b1d8c162ee6c0581172a5815b1afc5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ashu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
