<?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/"
	>

<channel>
	<title>Guganeshan Thambiraja&#039;s blog &#187; Programming</title>
	<atom:link href="http://guganeshan.com/blog/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://guganeshan.com/blog</link>
	<description></description>
	<lastBuildDate>Sun, 06 May 2012 06:28:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>StackOverflow logo using C# and GDI+</title>
		<link>http://guganeshan.com/blog/stackoverflow-logo-using-csharp-and-gdi.html</link>
		<comments>http://guganeshan.com/blog/stackoverflow-logo-using-csharp-and-gdi.html#comments</comments>
		<pubDate>Sun, 29 Jan 2012 18:39:10 +0000</pubDate>
		<dc:creator>Guganeshan.T</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GDI+]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[StackExchange]]></category>
		<category><![CDATA[StackOverflow]]></category>

		<guid isPermaLink="false">http://guganeshan.com/blog/?p=261</guid>
		<description><![CDATA[Discovered the “Code Golf” in StackExchange from the people I follow in twitter (for the #codechallenge hashtag). The question to generate the StackOverflow logo in code was particularly interesting to me and naturally I wanted to try generating the logo using C# (GDI+ code). Because nobody had a C# solution listed there, I also put [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://guganeshan.com/blog/wp-content/uploads/2012/01/so-logo.png"><img class="alignleft size-full wp-image-269" title="so-logo" src="http://guganeshan.com/blog/wp-content/uploads/2012/01/so-logo.png" alt="StackOverflow logo" width="103" height="128" /></a>Discovered the “Code Golf” in StackExchange from the people I follow in twitter (for the #codechallenge hashtag).</p>
<p><a title="Generate StackOverflow logo with code - StackExchange" href="http://codegolf.stackexchange.com/questions/4561/generate-the-stack-overflow-logo" target="_blank">The question to generate the StackOverflow logo in code</a> was particularly interesting to me and naturally I wanted to try generating the logo using C# (GDI+ code). Because nobody had a C# solution listed there, I also put the code there as an answer (Look for the answer titled &#8220;C#/GDI+&#8221;)</p>
<p>I initially recreated the logo in GDI+ without a for loop (every rectangle had a hardcoded value for its locations and size). Using that approach, its possible to recreate the logo almost identical to the original. But I was not happy with doing it that way.<span id="more-261"></span></p>
<p>Also because they say → “<em><strong>The image is not required to be identical to the logo, however it must be recognizable as it</strong></em>” in the description, I used a for loop to minimize the number of lines written and to just generate a logo that looks like the StackOverflow logo, but not identical.</p>
<p>This is no “ingenious” code. I would be really happy to see anyone generating the same logo with GDI+ in a more efficient and accurate manner, using a formula to represent the exact curve that the original logo has (without hard-coding each and every position and size of the overflowing elements)</p>
<p>Here’s the difference between my generated logo and the original StackOverflow logo →</p>
<p><a href="http://guganeshan.com/blog/wp-content/uploads/2012/01/stackoverflow-logo-generated-vs-original.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="stackoverflow logo generated vs original" src="http://guganeshan.com/blog/wp-content/uploads/2012/01/stackoverflow-logo-generated-vs-original_thumb.png" alt="stackoverflow logo generated vs original" width="388" height="300" border="0" /></a></p>
<p><a title="Generate the StackOverflow logo with C# and GDI+ → source code" href="http://guganeshan.com/blog/wp-content/uploads/2012/01/StackOverflowLogoCodeChallenge.zip">Click here to download the code (zip file)</a></p>
<p>Here&#8217;s the code listing:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Drawing</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Drawing.Drawing2D</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> StackOverflowLogoCodeChallenge
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SOLogo
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">float</span> _rotateValue<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">float</span> _xValueForTransformation<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">float</span> _yValueForTransformation<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">int</span> _containerWidth<span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">int</span> _containerHeight<span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">float</span> _lineThickness<span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">int</span> _paddingWithinContainer<span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">int</span> _elementStartY<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> SOLogo<span style="color: #008000;">&#40;</span>
            <span style="color: #6666cc; font-weight: bold;">float</span> rotateValue,
            <span style="color: #6666cc; font-weight: bold;">float</span> xValueForTransformation,
            <span style="color: #6666cc; font-weight: bold;">float</span> yValueForTransformation<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Values used to position and rotate the overflowing elements.</span>
            _rotateValue <span style="color: #008000;">=</span> rotateValue<span style="color: #008000;">;</span>
            _xValueForTransformation  <span style="color: #008000;">=</span> xValueForTransformation<span style="color: #008000;">;</span>
            _yValueForTransformation <span style="color: #008000;">=</span> yValueForTransformation<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> DrawLogo<span style="color: #008000;">&#40;</span>Graphics g, <span style="color: #6666cc; font-weight: bold;">int</span> startX, <span style="color: #6666cc; font-weight: bold;">int</span> startY<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// Backup the current smoothing mode to apply later.</span>
            var SmoothingMoodBackup <span style="color: #008000;">=</span> g<span style="color: #008000;">.</span><span style="color: #0000FF;">SmoothingMode</span><span style="color: #008000;">;</span>
            g<span style="color: #008000;">.</span><span style="color: #0000FF;">SmoothingMode</span> <span style="color: #008000;">=</span> <span style="color: #000000;">System.<span style="color: #0000FF;">Drawing</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Drawing2D</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">SmoothingMode</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AntiAlias</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Values for the container box.</span>
            _containerWidth <span style="color: #008000;">=</span> <span style="color: #FF0000;">94</span><span style="color: #008000;">;</span>
            _containerHeight <span style="color: #008000;">=</span> <span style="color: #FF0000;">61</span><span style="color: #008000;">;</span>
            _lineThickness <span style="color: #008000;">=</span> 11f<span style="color: #008000;">;</span>
            _paddingWithinContainer <span style="color: #008000;">=</span> <span style="color: #FF0000;">15</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Y value of the position where the 1st overflowing element starts.</span>
            _elementStartY <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Starting point of the 'container':</span>
            <span style="color: #008080; font-style: italic;">// Top point of the line on the left-&gt; |_|</span>
            Point pointContainerLineStart <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>startX, startY<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Point pointContainer1stLineEnd <span style="color: #008000;">=</span><span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                pointContainerLineStart<span style="color: #008000;">.</span><span style="color: #0000FF;">X</span>,
                pointContainerLineStart<span style="color: #008000;">.</span><span style="color: #0000FF;">Y</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Start with the previous</span>
            pointContainer1stLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">Offset</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, _containerHeight<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Offset &quot;Y&quot;</span>
&nbsp;
            Point pointContainer2ndLineEnd <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                pointContainer1stLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">X</span>,
                pointContainer1stLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">Y</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Start with the previous</span>
            pointContainer2ndLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">Offset</span><span style="color: #008000;">&#40;</span>_containerWidth, <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Offset &quot;X&quot;</span>
&nbsp;
            Point pointContainer3rdLineEnd <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                pointContainer2ndLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">X</span>,
                pointContainer2ndLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">Y</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Start with the previous</span>
            pointContainer3rdLineEnd<span style="color: #008000;">.</span><span style="color: #0000FF;">Offset</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span> <span style="color: #008000;">-</span> _containerHeight<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Offset &quot;Y&quot; (negative)</span>
&nbsp;
            GraphicsPath pathOfBox <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> GraphicsPath<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            pathOfBox<span style="color: #008000;">.</span><span style="color: #0000FF;">AddLine</span><span style="color: #008000;">&#40;</span>
                pointContainerLineStart,
                pointContainer1stLineEnd<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Left line. Top to bottom</span>
            pathOfBox<span style="color: #008000;">.</span><span style="color: #0000FF;">AddLine</span><span style="color: #008000;">&#40;</span>
                pointContainer1stLineEnd,
                pointContainer2ndLineEnd<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Bottom line. Left to right</span>
            pathOfBox<span style="color: #008000;">.</span><span style="color: #0000FF;">AddLine</span><span style="color: #008000;">&#40;</span>
                pointContainer2ndLineEnd,
                pointContainer3rdLineEnd<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Right line. Bottom to top</span>
&nbsp;
            Pen thickPen <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Pen<span style="color: #008000;">&#40;</span>Brushes<span style="color: #008000;">.</span><span style="color: #0000FF;">Gray</span>, _lineThickness<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Color elementColor <span style="color: #008000;">=</span> Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromKnownColor</span><span style="color: #008000;">&#40;</span>KnownColor<span style="color: #008000;">.</span><span style="color: #0000FF;">Gray</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Draw the 'container'</span>
            g<span style="color: #008000;">.</span><span style="color: #0000FF;">DrawPath</span><span style="color: #008000;">&#40;</span>thickPen, pathOfBox<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Increase the size of the pen to draw the elements inside the container</span>
            thickPen<span style="color: #008000;">.</span><span style="color: #0000FF;">Width</span> <span style="color: #008000;">=</span> _lineThickness <span style="color: #008000;">+=</span> <span style="color: #FF0000;">3</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">// &quot;Y&quot; - position of the 1st element</span>
            _elementStartY <span style="color: #008000;">=</span> startY <span style="color: #008000;">+</span> <span style="color: #FF0000;">38</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// The following section draws the overflowing elements</span>
&nbsp;
            Point pointElement1Left <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                startX <span style="color: #008000;">+</span> _paddingWithinContainer,
                _elementStartY<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Point pointElement1Right <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                <span style="color: #008000;">&#40;</span>startX <span style="color: #008000;">+</span> _containerWidth<span style="color: #008000;">&#41;</span> <span style="color: #008000;">-</span> _paddingWithinContainer,
                _elementStartY<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Six colors of the overflowing elements</span>
            var colors <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Color<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span>
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">Gray</span>,
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromArgb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">6911615</span><span style="color: #008000;">&#41;</span>,
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromArgb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">4417693</span><span style="color: #008000;">&#41;</span>,
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromArgb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">2848227</span><span style="color: #008000;">&#41;</span>,
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromArgb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">554957</span><span style="color: #008000;">&#41;</span>,
                Color<span style="color: #008000;">.</span><span style="color: #0000FF;">FromArgb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">-</span><span style="color: #FF0000;">688847</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> x <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> x <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">6</span><span style="color: #008000;">;</span> x<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                thickPen<span style="color: #008000;">.</span><span style="color: #0000FF;">Color</span> <span style="color: #008000;">=</span> colors<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
                pointElement1Left <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                    startX <span style="color: #008000;">+</span> _paddingWithinContainer,
                    _elementStartY<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                pointElement1Right <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Point<span style="color: #008000;">&#40;</span>
                    <span style="color: #008000;">&#40;</span>startX <span style="color: #008000;">+</span> _containerWidth<span style="color: #008000;">&#41;</span> <span style="color: #008000;">-</span> _paddingWithinContainer,
                    _elementStartY<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                g<span style="color: #008000;">.</span><span style="color: #0000FF;">DrawLine</span><span style="color: #008000;">&#40;</span>thickPen, pointElement1Left, pointElement1Right<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                g<span style="color: #008000;">.</span><span style="color: #0000FF;">RotateTransform</span><span style="color: #008000;">&#40;</span>_rotateValue<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                g<span style="color: #008000;">.</span><span style="color: #0000FF;">TranslateTransform</span><span style="color: #008000;">&#40;</span>_xValueForTransformation, _yValueForTransformation<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            pathOfBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispose</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            thickPen<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispose</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">// Restore the smoothing mood that was backed up before we started this method.</span>
            g<span style="color: #008000;">.</span><span style="color: #0000FF;">SmoothingMode</span> <span style="color: #008000;">=</span> SmoothingMoodBackup<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Happy coding.<br />
&nbsp;</p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://guganeshan.com/blog/stackoverflow-logo-using-csharp-and-gdi.html' addthis:title='StackOverflow logo using C# and GDI+ '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://guganeshan.com/blog/stackoverflow-logo-using-csharp-and-gdi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strange characters in Visual Studio code editor</title>
		<link>http://guganeshan.com/blog/strange-characters-in-visual-studio-code-editor.html</link>
		<comments>http://guganeshan.com/blog/strange-characters-in-visual-studio-code-editor.html#comments</comments>
		<pubDate>Fri, 18 Dec 2009 07:33:44 +0000</pubDate>
		<dc:creator>Guganeshan.T</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://guganeshan.com/blog/?p=75</guid>
		<description><![CDATA[Do you see any strange dots and/or arrows in the Visual Studio code editor and have no idea how you turned them on? (check the screen-shot) These represent the &#8220;white space&#8221; characters such as the space, tab, carriage return etc. How to turn it on or off: You can press the key combination CTRL+E, S [...]]]></description>
			<content:encoded><![CDATA[<p>Do you see any strange <strong>dots and/or arrows</strong> in the Visual Studio code editor and have no idea how you turned them on? (check the screen-shot)</p>
<p><span id="more-75"></span></p>
<p><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" src="http://guganeshan.com/blog/wp-content/uploads/2009/12/whitespace-characters-in-visual-studio-code-editor.png" border="0" alt="whitespace characters in visual studio code editor" /></p>
<p>These represent the &#8220;<strong>white space</strong>&#8221; characters such as the space, tab, carriage return etc.</p>
<p><strong>How to turn it on or off:</strong></p>
<ol>
<li>You can press the key combination <strong><span style="color: #800000;">CTRL+E, S</span></strong> (can be different if you have modified). OR</li>
<li>Select: <strong><span style="color: #800000;">Edit » Advanced » View White Space</span></strong></li>
</ol>
<p>It&#8217;s actually a helpful feature to examine a code file to see what the white space consists of (tabs or spaces). But it can be annoying to keep the feature always turned on.</p>
<p>It has happened at least 5 or more times for me and I always forget what I did the last time to turn it off <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif" alt="Happy" /></p>
<p>I decided to post about it so that someone (including me!) can find this and remember what to do to turn it off (or on).</p>
<p>Hope this helps</p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://guganeshan.com/blog/strange-characters-in-visual-studio-code-editor.html' addthis:title='Strange characters in Visual Studio code editor '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://guganeshan.com/blog/strange-characters-in-visual-studio-code-editor.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft and Nokia embrace jQuery !</title>
		<link>http://guganeshan.com/blog/microsoft-and-nokia-embrace-jquery.html</link>
		<comments>http://guganeshan.com/blog/microsoft-and-nokia-embrace-jquery.html#comments</comments>
		<pubDate>Thu, 23 Oct 2008 03:12:00 +0000</pubDate>
		<dc:creator>Guganeshan.T</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://guganeshan.com/blog/?p=10</guid>
		<description><![CDATA[It was always comfortable to use features that are provided and supported by Microsoft (when it comes to Visual Studio and the like) so that we won&#8217;t be in trouble in the future, at least for me. For this reason, I always think twice (or more) before touching anything that is open source, to be [...]]]></description>
			<content:encoded><![CDATA[<p>It was always comfortable to use features that are provided and supported by Microsoft (when it comes to Visual Studio and the like) so that we won&#8217;t be in trouble in the future, at least for me.</p>
<p>For this reason, I always think twice (or more) before touching anything that is open source, to be used with production code. The <a href="http://www.asp.net/ajax/">ASP.NET AJAX</a> framework was so easy to use because of the pre-built controls provided by the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/">Ajax Control Toolkit</a> team. I had very few occasions where I needed to write some JavaScript code in the applications.<span id="more-10"></span></p>
<p>But when there were some advance pieces of code which demanded some JavaScript, I realized how much of JavaScript can be reused&#8230; and how handy it would be to use a JavaScript library for that purpose.</p>
<p>When I stumbled on this great JavaScript library called <a href="http://jquery.com/">jQuery</a>, I was skeptical because of its size&#8230; just played around some sites to explore animations and other functionalities that this library offers. But I never used it&#8230; sticking to what Microsoft offers through the ASP.NET Ajax framework.</p>
<p>And now I&#8217;m really excited to know that Microsoft and Nokia are adopting jQuery as part of their official application development platform. This shows the real power of jQuery. And what I am really excited about is the javascript intellisense support for jQuery that Microsoft will provide through Visual Studio!</p>
<p>Here are the posts of this great news from my favourite industry experts on the subject:</p>
<ul>
<li><a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx">Scott Guthrie on jQuery and Microsoft</a></li>
<li><a href="http://www.hanselman.com/blog/jQuerytoshipwithASPNETMVCandVisualStudio.aspx">Scott Hanselman on the same subject</a></li>
</ul>
<p>You can read the jQuery team&#8217;s announcement <a href="http://jquery.com/blog/2008/09/28/jquery-microsoft-nokia/">here</a>. It must be a great turning point to the jQuery team.</p>
<p>Happy coding&#8230;</p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://guganeshan.com/blog/microsoft-and-nokia-embrace-jquery.html' addthis:title='Microsoft and Nokia embrace jQuery ! '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://guganeshan.com/blog/microsoft-and-nokia-embrace-jquery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resetting asp.net membership password when the user has forgotton the answer for the security question!</title>
		<link>http://guganeshan.com/blog/resetting-asp-net-membership-password-when-the-user-has-forgotton-the-answer-for-the-security-question.html</link>
		<comments>http://guganeshan.com/blog/resetting-asp-net-membership-password-when-the-user-has-forgotton-the-answer-for-the-security-question.html#comments</comments>
		<pubDate>Fri, 16 May 2008 03:41:00 +0000</pubDate>
		<dc:creator>Guganeshan.T</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://guganeshan.com/blog/?p=7</guid>
		<description><![CDATA[Here is the scenario&#8230; a web application has been implemented with the standard user management features&#8230; can create new users, the admin approves the users, can recover passwords and change security question + answer bla bla bla What happens if a user forgets the password?&#8230; simple, just goto the password recovery page and answer the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the scenario&#8230; a web application has been implemented with the standard user management features&#8230; can create new users, the admin approves the users, can recover passwords and change security question + answer bla bla bla</p>
<p>What happens if a user forgets the password?&#8230; simple, just goto the password recovery page and answer the security question and get the new password in the email.</p>
<p>But what if he/she doesn&#8217;t remember the answer for the security question???<span id="more-7"></span></p>
<p>Well, this is what happened exactly today. Although there were some solutions on the net, they required you to create a temporary Membership provider in the config etc.. which I didn&#8217;t like doing.</p>
<p>But for my joy, I found <a href="http://geekswithblogs.net/TimH/archive/2005/09/28/55414.aspx">this post</a> that gave me the idea. Although it is not a clean solution to the problem, it was what I wanted for the urgent need of resetting the password (since this won&#8217;t happen too often)</p>
<p>The <a href="http://geekswithblogs.net/TimH/archive/2005/09/28/55414.aspx">post</a> says that you have to replace the password hash and salt with the password hash and salt of a user whose password you know! What a simple idea. Well, whose password do I know?? mine of course!</p>
<p>So this is what I did:</p>
<ol>
<li>Changed my password to something like password_999</li>
<li>Replaced the user&#8217;s (who doesn&#8217;t remember the security answer) password hash and salt with my hash and salt</li>
<li>Changed my password back</li>
<li>Gave him &#8216;password_999&#8242; as the password, which he obviously will have to change once he logged in</li>
</ol>
<p>A more hassle-free solution would be to always have a dummy user account in the Membership database, which we can keep locked or as unapproved. And to make things even simpler, we can deploy an admin&#8217;s page that can accept the user name and replace the password hash and salt (copied from the dummy user account)&#8230;  thanks to <a href="http://geekswithblogs.net/TimH/Default.aspx">Tim Huffam</a></p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://guganeshan.com/blog/resetting-asp-net-membership-password-when-the-user-has-forgotton-the-answer-for-the-security-question.html' addthis:title='Resetting asp.net membership password when the user has forgotton the answer for the security question! '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://guganeshan.com/blog/resetting-asp-net-membership-password-when-the-user-has-forgotton-the-answer-for-the-security-question.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

