<?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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>Rohit's Blog &#187; Computing</title>
	<atom:link href="http://www.smart-techie.com/blog/category/computing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.smart-techie.com/blog</link>
	<description>My opinion about anything and everything!</description>
	<lastBuildDate>Sat, 10 Jul 2010 00:44:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>@Microsoft</title>
		<link>http://www.smart-techie.com/blog/2009/09/microsoft/</link>
		<comments>http://www.smart-techie.com/blog/2009/09/microsoft/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 20:17:56 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Coding/ Programming]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/?p=161</guid>
		<description><![CDATA[So it has been a month since I have been at Microsoft. Still getting comfortable with the code base, trying to understand the design of the software; it seems like starting again. Working at Microsoft IDC at Hyderabad seems like a long time ago. There are so many parallels between when I started at IDC [...]]]></description>
			<content:encoded><![CDATA[<p>So it has been a month since I have been at Microsoft. Still getting comfortable with the code base, trying to understand the design of the software; it seems like starting again. Working at Microsoft IDC at Hyderabad seems like a long time ago. </p>
<p>There are so many parallels between when I started at IDC and at Redmond. </p>
<p> <center><br />
<table border="1" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="200"><strong>@IDC</strong></td>
<td valign="top" width="200"><strong>@Redmond</strong></td>
</tr>
<tr>
<td valign="top" width="200">
<p align="left">Started in the last week of July.</p>
</td>
<td valign="top" width="200">
<p align="left">Started in the last week of July.</p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="left">Windows Vista was launched just after I joined.</p>
</td>
<td valign="top" width="200">
<p align="left">Windows 7 is launched soon after I joined.</p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="left">Office move within a month or two of joining.</p>
</td>
<td valign="top" width="200">
<p align="left">Office move within two months of joining.</p>
</td>
</tr>
</tbody>
</table>
<p> </center>
<p>A major difference this time is that I would be (mostly) coding in C++ rather than in .NET, so you can expect my posts to be more about my adventures with C++. In my opinion, C++ is like God with enormous power; if you are good (with your coding style and program design), it would reward you. But if you are sloppy with the way you code and anger the C++ God, it will make your life miserable (read understanding convoluted code and debugging).</p>
<p>I hope not to anger the C++ God anytime soon, so am reading up on how to be a better C++ programmer. Maybe I will learn a thing or two and post it here on my blog <img src='http://www.smart-techie.com/blog/smilies/msn_smiley.png' alt='&#58;&#41;' class='wp-smiley' width='21' height='21' title='&#58;&#41;' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2009/09/microsoft/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<geo:lat>47.672235</geo:lat>
		<geo:lon>-122.115569</geo:lon>
	</item>
		<item>
		<title>Why was Yahoo SMTP misbehaving?</title>
		<link>http://www.smart-techie.com/blog/2008/04/why-was-yahoo-smtp-misbehaving/</link>
		<comments>http://www.smart-techie.com/blog/2008/04/why-was-yahoo-smtp-misbehaving/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 15:44:55 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/?p=60</guid>
		<description><![CDATA[Yahoo provides free SMTP access to all its non yahoo.com domain email addresses. I started using the server around 6 months back. The best part was that the SMTP servers were dumb. They were acting as open message relays for anyone who had a valid Yahoo ID. So I could send an email message as [...]]]></description>
			<content:encoded><![CDATA[<p>Yahoo provides free SMTP access to all its non yahoo.com domain email addresses. I started using the server around 6 months back. The best part was that the SMTP servers were dumb. They were acting as open message relays for anyone who had a valid Yahoo ID. So I could send an email message as support@yahoo-inc.com using the SMTP server and the Yahoo server would happily send my email message. Worse, the receiver had very few options for detecting that the email message was fake. It came from a Yahoo server and looked like a message from Yahoo customer care and so should be genuine. The reason for this (as I suspect) were Yahoo Plus accounts. They used the same SMTP servers as the free country domain Yahoo accounts. Apparently, Yahoo didn&#8217;t verify the FROM address for its paying Yahoo Plus customers and so passed the benefits to the free customers too.</p>
<p>The ramifications for this became apparent. Yahoo servers started sending out spam. I had no proof in the beginning but <a href="http://blog.fastmail.fm/2008/02/12/yahoo-smtp-accounts-sending-spam/" rel="nofollow">this post</a> verified my suspicions. Spammers became aware of the golden opportunity and started abusing Yahoo servers to the fullest. This led to really tough times for the Yahoo Mail people and their PR guys as apparent from <a href="http://www.ymailblog.com/blog/2008/02/resolved-email-delays-through-smtp-servers/">this post</a> on Yahoo Mail Blog. Not only were the email servers overloaded, but ISPs started blocking mails from Yahoo servers which led to delayed/undelivered mails.</p>
<p>Now it seems that Yahoo has changed the way it routes emails through its SMTP servers. Earlier methods were quite trivial as the mail headers would have shown.   <code>     <br />Received: from smtp104.plus.mail.re1.yahoo.com (smtp104.plus.mail.re1.yahoo.com [69.147.102.67]) by rly-ma08.mx.aol.com (v120.9) with ESMTP id MAILRELAYINMA088-8c647354bcb3bd; Sat, 10 Nov 2007 01:12:27 -0400     <br />Received: (qmail 55018 invoked from network); 10 Nov 2007 06:12:27 -0000     <br />Received: from unknown (HELO localhost) (myYahooID@myIPAddress with login)     <br />by smtp104.plus.mail.re1.yahoo.com with SMTP; 10 Nov 2007 06:12:26 -0000</code></p>
<p>Gradually Yahoo started repairing its servers from the smtp11x.plus.mail.re1.yahoo.com series to smtp10x.plus.mail.re1.yahoo.com as the latter still worked for a long time without FROM address checks.</p>
<p>Now the mail headers are more complicated. It seems that Yahoo does some internal checks regarding whether the FROM address is valid and then only routes the emails.   <br /><code>Received: from n3.bullet.mail.ac4.yahoo.com (n3.bullet.mail.ac4.yahoo.com [76.13.13.29])     <br />by mx.google.com with SMTP id d12si10680167and.24.2008.04.05.08.35.00;     <br />Sat, 05 Apr 2008 08:35:01 -0700 (PDT)     <br />Received-SPF: neutral (google.com: 76.13.13.29 is neither permitted nor denied by best guess record for domain of myYahooAddress) client-ip=76.13.13.29;     <br />DomainKey-Status: good (test mode)     <br />Authentication-Results: mx.google.com; spf=neutral (google.com: 76.13.13.29 is neither permitted nor denied by best guess record for domain of myYahooAddress) smtp.mail=myYahooAddress; domainkeys=pass (test mode) header.From=myYahooAddress     <br />Received: from [76.13.13.26] by n3.bullet.mail.ac4.yahoo.com with NNFMP; 05 Apr 2008 07:31:40 -0000     <br />Received: from [68.142.237.88] by t3.bullet.mail.ac4.yahoo.com with NNFMP; 05 Apr 2008 15:34:24 -0000     <br />Received: from [216.252.111.166] by t4.bullet.re3.yahoo.com with NNFMP; 05 Apr 2008 15:34:24 -0000     <br />Received: from [127.0.0.1] by omp101.mail.re3.yahoo.com with NNFMP; 05 Apr 2008 15:34:24 -0000     <br />X-Yahoo-Newman-Id: 666616.8045.bm@omp101.mail.re3.yahoo.com     <br />Received: (qmail 61052 invoked from network); 5 Apr 2008 15:34:24 -0000     <br />DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;s=s1024; d=yahoo.co.in;     <br />h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID: Date:From:User-Agent:MIME-Version:To: Subject:Content-Type:Content-Transfer-Encoding;b=1zOo54htnYlA5Gy3kNjQQVpRD8fYyEbgwwejDXI4Jr/RZ32+QDvvwYLxJOdSkbwWyJhA3P5PfBVX+mGGYePhw3TXtmfqdVSUcu/BGnwpyONzF3umcYLylkOzLBu/URre6lF+6gdEnRPsfIE3isy25r9dfELJke0wDDwqEdCEYg= ;     <br />Received: from unknown (HELO Why?are?spaces?replaced?by??BTW?if?you?read?this?you?are?a?G33K) (myYahooID@myIPAddress with plain)by smtp103.plus.mail.re1.yahoo.com with SMTP; 5 Apr 2008 15:34:24 -0000</code></p>
<p>BTW I had told this to the Engineering head of Yahoo Atlanta during my internship interview here and he was surprised by this. Unfortunately I couldn&#8217;t demo this for him as Yahoo had started fixing this problem starting that day only.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2008/04/why-was-yahoo-smtp-misbehaving/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SMS Spam is good</title>
		<link>http://www.smart-techie.com/blog/2008/01/sms-spam-is-good/</link>
		<comments>http://www.smart-techie.com/blog/2008/01/sms-spam-is-good/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 03:21:17 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2008/01/sms-spam-is-good/</guid>
		<description><![CDATA[Spam is usually bad; &#8216;usually&#8217; because it can be used for fighting crime. Confused? Here&#8217;s a novel way in which SMS spam was used to identify a criminal&#8217;s location and catch him. It&#8217;s the stuff movies are made of So the next time you curse your service provider for yet another SMS to download a [...]]]></description>
			<content:encoded><![CDATA[<p>Spam is usually bad; &#8216;usually&#8217; because it can be used for fighting crime. Confused? Here&#8217;s a novel way in which SMS spam was used to identify a criminal&#8217;s location and catch him. It&#8217;s the stuff movies are made of <img src='http://www.smart-techie.com/blog/smilies/msn_smiley.png' alt='&#58;&#41;' class='wp-smiley' width='21' height='21' title='&#58;&#41;' /></p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/GoogleMapsSpam.jpg" rel="lightbox"><img src="http://s104.photobucket.com/albums/m190/rohit_sud/Blog/th_GoogleMapsSpam.jpg" border="0" alt="Google Maps and SMS"></a></p>
<p>So the next time you curse your service provider for yet another SMS to download a ringtone, remember that they could be actually gathering more data than it meets the eye!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2008/01/sms-spam-is-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orkut and a Worm</title>
		<link>http://www.smart-techie.com/blog/2007/12/orkut-and-a-worm/</link>
		<comments>http://www.smart-techie.com/blog/2007/12/orkut-and-a-worm/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 04:08:56 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2007/12/56/</guid>
		<description><![CDATA[So its not often that my computer is actually infected by a Worm (or Virus). But then when I got an email from an old friend about scrapping when I hadn&#8217;t done so, I was surprised. A quick and thorough scan of my PC revealed nothing. Now I faintly remembered receiving 2 scraps (which obviously [...]]]></description>
			<content:encoded><![CDATA[<p>So its not often that my computer is actually infected by a Worm (or Virus). But then when I got an email from an old friend about scrapping when I hadn&#8217;t done so, I was surprised. A quick and thorough scan of my PC revealed nothing.</p>
<p>Now I faintly remembered receiving 2 scraps (which obviously looked like Spam) from my friends and that I had deleted them promptly. Could it be a case of <a title="Cross Site Scripting" href="http://en.wikipedia.org/wiki/Cross-site_scripting" id="mecc">Cross Site Scripting</a>? A <a title="blog article" href="http://www.marrowbones.com/commons/technosocial/2007/12/orkut_worm_code_and_why_was_go.html" id="r9a5" rel="nofollow">blog article</a> that I read today confirmed by suspicions.</p>
<p>Now in <a href="http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/">my previous post</a> I had emphasized my belief that &#8220;All input is evil&#8221; and even though Google seems to do a pretty good job with Blogger, filtering out <i>bad</i> HTML and unwanted scripts; it has failed to do that with Orkut. Especially when it keeps adding more and more features to make the UI richer and interactive, the importance of such measures increases.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2007/12/orkut-and-a-worm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inspecting Web Interfaces</title>
		<link>http://www.smart-techie.com/blog/2007/06/inspecting-web-interfaces/</link>
		<comments>http://www.smart-techie.com/blog/2007/06/inspecting-web-interfaces/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 15:22:52 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Coding/ Programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Links]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2007/06/inspecting-web-interfaces/</guid>
		<description><![CDATA[(Continued from Secure Web Interfaces) OK, I had a tremendous urge to call this post &#8220;Hacking Web Interfaces&#8221;. But due to some uneducated folks who believe hacking is a bad word, I think I will stick to its euphemism. The most direct way to feed random data to a web-service is in a raw format. [...]]]></description>
			<content:encoded><![CDATA[<p><em>(Continued from <a href="http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/">Secure Web Interfaces</a>)<br />
</em></p>
<p>OK, I had a tremendous urge to call this post &#8220;Hacking Web Interfaces&#8221;. But due to some uneducated folks who believe hacking is a bad word, I think I will stick to its euphemism.</p>
<p>The most direct way to feed random data to a web-service is in a raw format. Use telnet for absolute low level communications or tools like Fiddler, for communications at a higher level like HTTP.&nbsp;But with sites hosting hundreds of script files and html pages on their server, this approach has become more and more impractical. But there are other means to mess with the client side code.</p>
<h3>DOM Inspector</h3>
<p>If you use Firefox, you will notice there&#8217;s a utility called <a href="http://www.mozilla.org/projects/inspector/">DOM Inspector</a> that is included with it. As the name suggests, it allows you to see the DOM of the rendered HTML page. But, it also allows you to modify that DOM. You can modify the values of the properties of different DOM objects in the tree and even insert new objects.</p>
<p>Let&#8217;s try this technique on a product of one of the largest software companies, Google Calendar. I will use no other software than Firefox and DOM inspector.</p>
<p>Let&#8217;s go to the Settings screen. They have a setting for the &#8220;Custom View&#8221; property for the calendar.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image-1.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="99" alt="Google Calendar Settings" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb-2.png" width="122" border="0" /></a></p>
<p>Now I am a guy who wants to know what he would be doing in next 2 months but there is no option for that kind of view. Hmm, lets see if the DOM can help us. Firing the DOM Inspector, we see that the logic is quite simple.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_3.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="99" alt="Firefox DOM Inspector" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb_3.png" width="127" border="0" /></a></p>
<p>The value of the ComboBox determines how the duration for which the custom view display the calendar. The value in the ComboBox is simply translated to the number of days. So I change the value to 42 (which is 6 weeks) and save my Settings.&nbsp;Et voilÃ , I get a custom view with 6 weeks <img src='http://www.smart-techie.com/blog/smilies/msn_smiley.png' alt='&#58;&#41;' class='wp-smiley' width='21' height='21' title='&#58;&#41;' /> Cool!</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_4.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="99" alt="Customized Google Calendar" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb_4.png" width="122" border="0"/></a></p>
<h3>Using Visual Studio with IE</h3>
<p>IE has a script debugger built in, but it is worthwhile to go in for Visual Studio as the debugger of choice. There&#8217;s a free version of the Visual Studio suite called the Express edition available which you can download and use.</p>
<p>Now to make it work&#8230;</p>
<ol>
<li>
<p>Enable Script debugging in Internet Explorer.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_5.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="99" alt="Internet Explorer Settings" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb_5.png" width="78" border="0"/></a></p>
<li>
<p>Create a New Solution with an Empty Website (File &gt; New &gt; Web Site&#8230;)</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/WebProject.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="87" alt="New WebSite Project" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/WebProject_thumb.png" width="132" border="0"/></a></p>
<li>
<p>Go to Property Pages for the new Website in Solution Explorer and enter the URL you want to debug. Don&#8217;t worry if you don&#8217;t know the URL, just enter any URL and fire the breakpoints only when you hit the required URL.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/PropertyPages.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="75" alt="Property Pages" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/PropertyPages_thumb.png" width="132" border="0"/></a></p>
<li>
<p>You might get a dialog asking you to include the web.config file. Answer Yes and continue. Now you will be surfing with the debugger attached to Internet Explorer. You can hit pause, set breakpoints and even skip those functions that don&#8217;t interest you <img src='http://www.smart-techie.com/blog/smilies/msn_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='19' height='19' title='&#59;&#41;' /></p>
</li>
</ol>
<h3>Using&nbsp;Venkman with Firefox</h3>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_6.png" atomicselection="true" rel="lightbox"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="99" alt="Venkman Firefox shortcut" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb_6.png" width="56" border="0"/></a></p>
<p>I would have loved it if Visual Studio also worked with Firefox. There&#8217;s a solution called <a href="http://www.mozilla.org/projects/venkman/" target="_blank" rel="nofollow">Venkman</a>. I won&#8217;t go through the complete detail of how to go about using it, you can read it up <a href="http://www.mozilla.org/projects/venkman/venkman-walkthrough.html" target="_blank" rel="nofollow">here</a>.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_7.png" atomicselection="true" rel="lightbox"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="94" alt="Venkman Firefox" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb_7.png" width="132" border="0"/></a></p>
<p>I haven&#8217;t found a way to skip code (a la Visual Studio) using this yet. </p>
<p>You can change variable values by directly typing the JavaScript code for it. </p>
<p>The interface doesn&#8217;t have all the bells and whistles but should be able to get most of your work done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2007/06/inspecting-web-interfaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Web Interfaces</title>
		<link>http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/</link>
		<comments>http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/#comments</comments>
		<pubDate>Sun, 24 Jun 2007 11:47:55 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Coding/ Programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/</guid>
		<description><![CDATA[On the Internet, security is overrated. Every third site you visit talks about it. But&#160;still, not many sites take steps to implement it. This has been the complaint of people all these years and is still true today. Unless it is a site that is dealing with financial transactions, most interfaces provided by these sites [...]]]></description>
			<content:encoded><![CDATA[<p>On the Internet, security is overrated. Every third site you visit talks about it. But&nbsp;still, not many sites take steps to implement it. This has been the complaint of people all these years and is still true today. Unless it is a site that is dealing with financial transactions, most interfaces provided by these sites are non-secure and prone to client side attacks. I believe it is a false assumption that unless your site is processing a credit card payments, it doesn&#8217;t need security. Security is not just about protecting &#8216;monetary transactions&#8217;. It is more than that, it involves protecting your computational resources (bandwidth, CPU usage), intellectual resources (JS files, web services) and of course, the services that the site is providing (like acting as a <a href="http://www.clickatell.com/products/sms_gateway.php">SMS gateway</a>).</p>
<p>In this post I take a look at some ridiculously simple security blunders committed by popular sites. These might not always be critical but provide an interesting insight into the design quality metrics followed at these companies.</p>
<p>While surfing the Net, whenever I see a website offering a cool service, my natural instinct is to find out how they are doing it. For example, Rediff used to have this ActiveX based multilingual mail composition feature, which they replaced with a JavaScript based one. Cool! So now I could work on Firefox and still send my mail in Hindi! How (naively?) were they doing this? Create an IFrame and put the entire composition feature in it. Hmmm, OK, but couldn&#8217;t someone just rip off the JS files and create, say, a multilingual composition plugin for WordPress using their code. Access to the .js files doesn&#8217;t even require a login to the Rediff servers and using them is as easy as pointing the URL to <a title="http://f1mail.rediff.com/quill/QuillPadWeb.html" href="http://f1mail.rediff.com/quill/QuillPadWeb.html">http://f1mail.rediff.com/quill/QuillPadWeb.html</a>. I am not sure what their testing team (if they have one) thought of this, but this allows someone to use the cool text entry interface by just copying 4 files off the Rediff site.</p>
<p><a href="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image.png" atomicselection="true" rel="lightbox"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="76" alt="image" src="http://i104.photobucket.com/albums/m190/rohit_sud/Blog/image_thumb.png" width="132"/></a> </p>
<p>The easiest way to thwart leechers is to deny access to the scripts unless you are logged on. That would take care of <a href="http://en.wikipedia.org/wiki/Direct_linking" target="_blank">direct linking</a> (protecting computational resources). But there&#8217;s no easy solution if someone just copies the files off the server and hosts them on his website (protecting intellectual resources). What do you do then? Probably obfuscate the code enough so that he never knows what file he has to copy. Yahoo mail does an excellent job of the obfuscation. Even their images are <em>protected</em> (in a loose way) by referring them through their MD5 hashes; enough to deter a casual hacker.</p>
<p>Another flaw is doing all (and I mean <strong>ALL</strong>) the validation at the client side using JavaScript. Client side validation is a nice way to&nbsp;reduce load&nbsp;at the server end. But sometimes, this solution is implemented without safeguards.
<p>While designing any API, there is a golden rule that has to be followed&#8230; <code><br />
<blockquote>All input is evil</p></blockquote>
<p></code>
<p>Agreed, you have JS to check and ensure that the user input is correct. But what if I <a href="http://en.wikipedia.org/wiki/Code_injection" target="_blank">inject code</a> through your web service using a simple script debugger like Visual Studio for IE and <a href="http://www.mozilla.org/projects/venkman/" target="_blank" rel="nofollow">Venkman</a> for Firefox. Even if I am not able to inject code, I will certainly be able to inject syntactically valid input data which&nbsp;is still invalid.&nbsp;To illustrate, imagine a banking service where&nbsp;the amount that can be withdrawn is checked against current balance using JavaScript. I could very well skip the function, overwrite the function which gets the current balance and a lot more.&nbsp;Unless the server is checking the validity of the transaction itself, I&nbsp;would be able&nbsp;to make any kind of transaction.</p>
<p>In my <a href="http://www.smart-techie.com/blog/2007/06/inspecting-web-interfaces/">next post</a> I will discuss, some techniques that can be misused to thwart JavaScript based validations. The purpose of the post will be to further educate software designers about the pitfalls of client side validation which is not backed by robust server side validation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2007/06/creating-secure-web-interfaces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sharing Firefox profiles across Operating Systems</title>
		<link>http://www.smart-techie.com/blog/2007/03/sharing-firefox-profiles-across-operating-systems/</link>
		<comments>http://www.smart-techie.com/blog/2007/03/sharing-firefox-profiles-across-operating-systems/#comments</comments>
		<pubDate>Wed, 21 Mar 2007 15:18:22 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2007/03/sharing-firefox-profiles-across-operating-systems/</guid>
		<description><![CDATA[I like Firefox because of innumerable extensions and settings that are available to the user. Not only that, it is the&#160;(only?) browser that was available across all the operating systems which provided me with an OS independent experience that the Internet is truly meant to be.&#160; One of the gripes I had about this was [...]]]></description>
			<content:encoded><![CDATA[<p>I like Firefox because of innumerable extensions and settings that are available to the user. Not only that, it is the&nbsp;(only?) browser that was available across all the operating systems which provided me with an OS independent experience that the Internet is truly meant to be.&nbsp;</p>
<p>One of the gripes I had about this was that I had to install Firefox for every Operating System (OS) that was there on my computer. So on my home computer which had Windows ME, Windows XP and Ubuntu, I had to install Firefox separatelyfor each of them. I could understand this as they were separate OSes and required different binaries for themselves. But installing all the Extensions and Themes for each and every OS was just plain irritating.</p>
<p>Browsing through <a href="http://www.mozilla.org">www.mozilla.org</a> I saw an <a title="http://www.mozilla.org/support/firefox/profile" href="http://www.mozilla.org/support/firefox/profile" target="_blank" rel="nofollow">article</a> on Profile management in Firefox. Profiles allow different users to have individual settings for a software on the same computer. But this is not what I wanted to do. I wanted to use the <u>same profile</u> across different installations of <u>Firefox, on different OSes</u>, in my machine.</p>
<p>So how I did this was -</p>
<ol>
<li>
<p>This step can vary but I will outline the simplest solution. Linux can access your mounted FAT or NTFS drives easily. So we would create the profile folder on a Windows partition and instruct Linux to read data from there.</p>
<p>For this, locate the profile in Windows and note down the name like <code><var>xxxxxxxx</var>.default</code>. It will reside&nbsp;&nbsp;
<ul>
<li>On <strong>Windows Vista/XP/2000</strong>, the path is usually <code>%AppData%\Mozilla\Firefox\Profiles\<var>xxxxxxxx</var>.default\</code>, where <var>xxxxxxxx</var> is a random string of 8 characters. Just browse to <code>C:\Documents and Settings\<var>[User Name]</var>\Application Data\Mozilla\Firefox\Profiles\</code> on Windows XP/2000 or <code>C:\users\<var>[User Name]</var>\AppData\Roaming\Mozilla\Firefox\Profiles\</code> on Windows Vista, and the rest should be obvious.
<li>On <strong>Windows 95/98/Me</strong>, the path is usually <code>C:\WINDOWS\Application Data\Mozilla\Firefox\Profiles\<var>xxxxxxxx</var>.default\</code></li>
</ul>
<li>
<p>Now for each of the other OSes, open up <code>profiles.ini</code> in a text editor. The file is located in the <em>application data folder</em> for Firefox: </p>
<ul>
<li>On <strong>Windows Vista/XP/2000</strong>, the path is <code>%AppData%\Mozilla\Firefox\</code>
<li>On <strong>Windows 95/98/Me</strong>, the path is usually <code>C:\WINDOWS\Application Data\Mozilla\Firefox\</code>
<li>On <strong>Linux</strong>, the path is <code>~/.mozilla/firefox/</code></li>
</ul>
<li>Change <code>IsRelative=1</code> to <code>IsRelative=0</code>.
<li>Change <code>Path=&lt;something&gt;</code> to <code>Path=<code>C:\WINDOWS\Application Data\Mozilla\Firefox\Profiles\<var>xxxxxxxx</var>.default\</code></code> (assuming that the profile that you selected in step 1 was in this location).
<li>For Linux, set the <code>Path</code> according to the location of the folder in the mounted drive (Assuming the local mount folder is <code>/media/cdrive</code> your path will be <code>/media/cdrive/WINDOWS/Application Data/Mozilla/Firefox/Profiles/<var>xxxxxxxx</var>.default</code>)
<li>That&#8217;s it! Your Firefox Extensions, Themes, Settings, Cache and History will be shared across all the operating Systems.</li>
</ol>
<div contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati tags: <a href="http://technorati.com/tags/Firefox" rel="tag">Firefox</a>, <a href="http://technorati.com/tags/profiles" rel="tag">profiles</a>, <a href="http://technorati.com/tags/multiple%20OS" rel="tag">multiple OS</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2007/03/sharing-firefox-profiles-across-operating-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your GPRS mobile is spying on you!</title>
		<link>http://www.smart-techie.com/blog/2007/01/your-gprs-mobile-is-spying-on-you/</link>
		<comments>http://www.smart-techie.com/blog/2007/01/your-gprs-mobile-is-spying-on-you/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 12:53:26 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Coding/ Programming]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2007/01/your-gprs-mobile-is-spying-on-you/</guid>
		<description><![CDATA[One of the great things about the Internet is anonymity; one can surf the net without disclosing who he/she is and where he comes from (OK, your IP address can be used to track you, but then unless you go through the long process of getting your ISP to yield details about the IP address, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great things about the Internet is anonymity; one can surf the net without disclosing who he/she is and where he comes from (OK, your IP address can be used to track you, but then unless you go through the long process of getting your ISP to yield details about the IP address, such means can be safely ruled out). Also people using a shared IP address <em>can</em> be more anonymous. In Qatar, there is just one ISP with only one IP address. How can one trace an individual net-surfer from only that information?</p>
<p>No wonder, people expect to have the same kind of anonymity while surfing the web through their mobile devices too. The mobile operator <em>does</em> give you a shared IP address. Though surfing through mobile phones is still very painful in India (3KBps download speeds aren&#8217;t that great), mobile Internet access through GPRS is becoming cheaper every passing month; Airtel offers a HTTP only package for just Rs. 99 per month which would encourage more people to at least try mobile web surfing. But cheap access doesn&#8217;t translate into secure access.</p>
<p>I always used to wonder how various websites like Yahoo, Rediff et al could get access to mobile subscriber data and charge them for their products and services. So I created  a small servlet at http://www.myjavaserver.com/servlet/proteus.SmallFiles.WmlHead [Server is dead now].  And the results turned out to be shocking. I accessed the page from my friend&#8217;s phone and this is what I saw (the number was <strong>not masked</strong>, it has been done so to protect his privacy.</p>
<blockquote><pre><code>Host : www.myjavaserver.com

X-Wap-Profile : &quot;http://wap.sonyericsson.com/UAprof/W700iR101.xml&quot;

Accept-Language : en

Accept : application/vnd.wap.xhtml+xml, application/vnd.wap.wmlc, application/xhtml+xml, image/gif, */*, text/vnd.wap.wml

User-Agent : SonyEricssonW700i/R1CA Browser/SEMC-Browser/4.2 Profile/MIDP-2.0 Configuration/CLDC-1.1

Accept-Charset : *

Accept-Encoding : deflate, gzip

TE : deflate, gzip
<strong>
MSISDN : 9198xxxxxxxx</strong>

WAP-Connection : Stack-Type=HTTP

Cookie : $Version=0;User-Identity-Forward-<strong>msisdn=9198xxxxxxxx</strong>;&#8203;User-Identity-Forward-ppp-username=void&#8203;;Bearer-Type=w-TCP;&#8203;wtls-security-level=none;network-access-type=CSD;&#8203;nas-ip-address=10.151.1.18;apn=airtelfun.com;<strong>imsi=404490016894720</strong>;&#8203;Called-station-id=airtelfun.com;&#8203;accounting-session-id=3D5FF84246578127;&#8203;accounting-authentication-method=2;&#8203;sgsn-ip-address=125.19.6.40

SCRIPT_URL : /servlet/proteus.SmallFiles.WmlHead

SCRIPT_URI : http://www.myjavaserver.com/servlet/proteus.SmallFiles.WmlHead

Remote Address : 203.145.131.158

Remote Host : 203.145.131.158

Server Name : www.myjavaserver.com

Protocol : HTTP/1.1</code>></pre>
</blockquote>
<p>This is from Airtel network in Andhra Pradesh, India. As one can see it is transmitting your mobile number in plain text as well as your mobile operator information to each and every website you visit. It also has your <a href="http://en.wikipedia.org/wiki/IMSI">IMSI</a> number which, about which Wikipedia says &quot;<em>In order to avoid the subscriber being identified and tracked by eavesdroppers on the radio interface, the IMSI is sent as rarely as possible and a randomly generated TMSI is sent instead.</em>&quot;. This is potentially a great way for spammers to send you spam SMSs or track your surfing habits. They can put in a 0 X 0 pixel image on web pages and track you without you having to visit their site. Though much of this is what they can do through normal browsers on computers, here they can <strong>personally identify</strong> you through your phone number. You can visit the <a href="http://www.myjavaserver.com/servlet/proteus.SmallFiles.WmlHead" target="_new">link</a> given above to verify what headers you ISP is attaching to your outbound requests over GPRS. It is a WML page so even the oldest browsers should be able to open it.</p>
<p>It would be futile to even talk to your Customer Care guys about this, write to your ISP about this and ask them WHY they are exposing you to dangers which involve endangering your privacy. As a defence against this, you can use an anonymizing proxy like Opera Mini which will hide your information, but prevention is better than cure!</p>
<p>Source for the Java Servlet is available <a href="http://www.smart-techie.com/web/programming/java-servlets/servlet-to-view-browser-information-while-visiting-a-site-in-wml-format.html">here </a>.<br />
<em><strong><br />
Remember you need to access the URL with your Mobile phones , accessing through your normal browser will display the header information of your PC Browser. Also you need a GPRS connection that allows you to surf external sites and not just those of your service provider&#8217;s.</strong></em><br />
<br/><br />
For the curious, I have also added a Java Servlet that displays the headers sent by your PC browsers <a href="http://www.myjavaserver.com/servlet/proteus.SmallFiles.ShowStore">here</a>. The source for this one is available <a href="http://www.smart-techie.com/web/programming/java-servlets/servlet-to-view-browser-information-while-visiting-a-site-in-html-format.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2007/01/your-gprs-mobile-is-spying-on-you/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		<geo:lat>17.385044</geo:lat>
		<geo:lon>78.486671</geo:lon>
	</item>
		<item>
		<title>ControlTemplates in XAML</title>
		<link>http://www.smart-techie.com/blog/2006/12/controltemplates-in-xaml/</link>
		<comments>http://www.smart-techie.com/blog/2006/12/controltemplates-in-xaml/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 19:16:46 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[Coding/ Programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2006/12/16/23/</guid>
		<description><![CDATA[XAML has this great concept of look-less controls. When we see a normal Win32 control like say a checkbox, we always assume that it will be a square box along with some text written to the left of it. Taking an example from our old friend WordPad, we would always expect a checkbox to look [...]]]></description>
			<content:encoded><![CDATA[<div class="entrytext">
<p>XAML has this <em>great</em> concept of look-less controls. When we see a normal Win32 control like say a checkbox, we always assume that it will be a square box along with some text written to the left of it. Taking an example from our old friend WordPad, we would always expect a checkbox to look like</p>
</div>
<p class="c6"><img src="http://i104.photobucket.com/albums/m190/rohit_sud/picidd5908DsDmfED-6ipuz2GcoaxIcYOOd.jpg" /></p>
<p>
  </p>
<p>Pretty boring, if you would ask a kid (or even a teenager!). Even though it makes the control much more usable (which is a <strong>very</strong> important thing BTW), it doesn&#8217;t look <strong><em>cool</em></strong>. So how does WPF help us here?</p>
<p>For starters, when you define a control, WPF doesn&#8217;t force to you to define the look of the control along with the functionality. Here comes the concept of a look-less control; a control whose behaviour is defined but whose look is not defined. For instance, we might define the behavior of the check box (it has a bool or a bool? property called IsChecked, it has a check mark to the left of the content, etc&#8230<img src='http://www.smart-techie.com/blog/smilies/msn_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='19' height='19' title='&#59;&#41;' /> but leave it to the author to define the look for it. So we might have something like</p>
<div>
<table cellspacing="0" cellpadding="3" width="100%" border="0">
<tbody>
<tr>
<td width="50%">
<p><img src="http://i104.photobucket.com/albums/m190/rohit_sud/picidd5908DsDmfED-6ipuz2GcoaxLJao3I.jpg" align="left" /></p>
</td>
<td width="50%">Checked Checkbox<br />
          </td>
</tr>
<tr>
<td width="50%">
<p><img src="http://i104.photobucket.com/albums/m190/rohit_sud/picidd5908DsDmfED-6ipuz2GcoaxNvsd7G.jpg" align="left" /></p>
</td>
<td width="50%">Unchecked Checkbox</td>
</tr>
</tbody>
</table>
</div>
<p>
  </p>
<p>How to go about doing this? This is all done by redefining the ControlTemplate for the checkbox. ControlTemplate is basically what it says, it is a Template for the Control and decides how the control will <span class="c7">look</span> like. To achieve such a look we define the Style of the Checkbox as</p>
<blockquote>
<pre class="xmlcode"><code><span class="xml01">&lt;Style</span><span class="xml08"> </span><span class="xml03">x:Key</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml08"> </span><span class="xml03">TargetType</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml01">&gt;</span>
    <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;SnapsToDevicePixels&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;true&quot;</span><span class="xml08">/</span><span class="xml01">&gt;</span>
    <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;OverridesDefaultStyle&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;true&quot;</span><span class="xml08">/</span><span class="xml01">&gt;</span>
    <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;Template&quot;</span><span class="xml01">&gt;</span>
      <span class="xml01">&lt;Setter.Value&gt;</span>
        <span class="xml01">&lt;ControlTemplate</span><span class="xml08"> </span><span class="xml03">TargetType</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml01">&gt;</span>
          <span class="xml01">&lt;WrapPanel</span><span class="xml08"> </span><span class="xml03">Orientation</span><span class="xml08">=</span><span class="xml19">&quot;Horizontal&quot;</span><span class="xml01">&gt;</span>
            <span class="xml01">&lt;Border</span><span class="xml08"> </span><span class="xml03">x:Name</span><span class="xml08">=</span><span class="xml19">&quot;Border&quot;</span><span class="xml08">
              </span><span class="xml03">CornerRadius</span><span class="xml08">=</span><span class="xml19">&quot;0</span><span class="xml08">&#8221; </span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Image</span><span class="xml08"> </span><span class="xml03">Name</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml08">
                      </span><span class="xml03">Height</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">Binding</span><span class="xml08"> </span><span class="xml03">ElementName</span><span class="xml08">=</span><span class="xml19">MyContent</span><span class="xml08">, </span><span class="xml03">Path</span><span class="xml08">=</span><span class="xml19">ActualHeight</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml08"> </span><span class="xml03">Source</span><span class="xml08">=</span><span class="xml19">&quot;happy.gif&quot;</span><span class="xml01">&gt;</span>
                <span class="xml01">&lt;Image.BitmapEffect&gt;</span>
                  <span class="xml01">&lt;OuterGlowBitmapEffect</span><span class="xml08"> </span><span class="xml03">GlowColor</span><span class="xml08">=</span><span class="xml19">&quot;Blue&quot;</span><span class="xml08"> </span><span class="xml03">GlowSize</span><span class="xml08">=</span><span class="xml19">&quot;2</span><span class="xml08">&#8221; </span><span class="xml03">Noise</span><span class="xml08">=</span><span class="xml19">&quot;.1</span><span class="xml08">&#8221; </span><span class="xml03">Opacity</span><span class="xml08">=</span><span class="xml19">&quot;0.8</span><span class="xml08">&quot;</span><span class="xml11">/&gt;</span>
                <span class="xml01">&lt;/Image.BitmapEffect&gt;</span>
              <span class="xml01">&lt;/Image&gt;</span>
            <span class="xml01">&lt;/Border&gt;</span>
            <span class="xml01">&lt;ContentPresenter</span><span class="xml08"> </span><span class="xml03">Margin</span><span class="xml08">=</span><span class="xml19">&quot;4</span><span class="xml08">,</span><span class="xml05">0</span><span class="xml08">,</span><span class="xml05">0</span><span class="xml08">,</span><span class="xml05">0</span><span class="xml08">&quot; </span><span class="xml03">Name</span><span class="xml08">=</span><span class="xml19">&quot;MyContent&quot;</span><span class="xml08">
              </span><span class="xml03">VerticalAlignment</span><span class="xml08">=</span><span class="xml19">&quot;Center&quot;</span><span class="xml08">
              </span><span class="xml03">HorizontalAlignment</span><span class="xml08">=</span><span class="xml19">&quot;Left&quot;</span><span class="xml08">
              </span><span class="xml03">RecognizesAccessKey</span><span class="xml08">=</span><span class="xml19">&quot;True&quot;</span><span class="xml08">/</span><span class="xml01">&gt;</span>
          <span class="xml01">&lt;/WrapPanel&gt;</span>
          <span class="xml01">&lt;ControlTemplate.Triggers&gt;</span>
            <span class="xml01">&lt;Trigger</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;IsChecked&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Null</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;Source&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;unsure.gif&quot;</span><span class="xml08"> </span><span class="xml11">/&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;BitmapEffect&quot;</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml01">&gt;</span>
                <span class="xml01">&lt;Setter.Value&gt;</span>
                  <span class="xml01">&lt;OuterGlowBitmapEffect</span><span class="xml08"> </span><span class="xml03">GlowColor</span><span class="xml08">=</span><span class="xml19">&quot;Black&quot;</span><span class="xml08"> </span><span class="xml03">GlowSize</span><span class="xml08">=</span><span class="xml19">&quot;2</span><span class="xml08">&quot; </span><span class="xml03">Noise</span><span class="xml08">=</span><span class="xml19">&quot;.1</span><span class="xml08">&quot;
                  </span><span class="xml03">Opacity</span><span class="xml08">=</span><span class="xml19">&quot;0.8</span><span class="xml08">&quot; </span><span class="xml11">/&gt;</span>
                <span class="xml01">&lt;/Setter.Value&gt;</span>
              <span class="xml01">&lt;/Setter&gt;</span>
            <span class="xml01">&lt;/Trigger&gt;</span>
            <span class="xml01">&lt;Trigger</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;IsChecked&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;false&quot;</span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;Source&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;sad.gif&quot;</span><span class="xml08"> </span><span class="xml11">/&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;BitmapEffect&quot;</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Null</span><span class="xml08">}</span><span class="xml03">&quot;/</span><span class="xml01">&gt;</span>
            <span class="xml01">&lt;/Trigger&gt;</span>
            <span class="xml01">&lt;Trigger</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;IsMouseOver&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;true&quot;</span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;BitmapEffect&quot;</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml01">&gt;</span>
                <span class="xml01">&lt;Setter.Value&gt;</span>
                  <span class="xml01">&lt;OuterGlowBitmapEffect</span><span class="xml08"> </span><span class="xml03">GlowColor</span><span class="xml08">=</span><span class="xml19">&quot;Red&quot;</span><span class="xml08"> </span><span class="xml03">GlowSize</span><span class="xml08">=</span><span class="xml19">&quot;2</span><span class="xml08">&quot; </span><span class="xml03">Noise</span><span class="xml08">=</span><span class="xml19">&quot;.1</span><span class="xml08">&quot;
                  </span><span class="xml03">Opacity</span><span class="xml08">=</span><span class="xml19">&quot;0.8</span><span class="xml08">&quot; </span><span class="xml11">/&gt;</span>
                <span class="xml01">&lt;/Setter.Value&gt;</span>
              <span class="xml01">&lt;/Setter&gt;</span>
            <span class="xml01">&lt;/Trigger&gt;</span>
            <span class="xml01">&lt;Trigger</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;IsPressed&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;true&quot;</span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;BitmapEffect&quot;</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;CheckMark&quot;</span><span class="xml01">&gt;</span>
                <span class="xml01">&lt;Setter.Value&gt;</span>
                  <span class="xml01">&lt;OuterGlowBitmapEffect</span><span class="xml08"> </span><span class="xml03">GlowColor</span><span class="xml08">=</span><span class="xml19">&quot;Yellow&quot;</span><span class="xml08"> </span><span class="xml03">GlowSize</span><span class="xml08">=</span><span class="xml19">&quot;2</span><span class="xml08">&quot; </span><span class="xml03">Noise</span><span class="xml08">=</span><span class="xml19">&quot;.1</span><span class="xml08">&quot;
                  </span><span class="xml03">Opacity</span><span class="xml08">=</span><span class="xml19">&quot;0.8</span><span class="xml08">&quot; </span><span class="xml11">/&gt;</span>
                <span class="xml01">&lt;/Setter.Value&gt;</span>
              <span class="xml01">&lt;/Setter&gt;</span>
            <span class="xml01">&lt;/Trigger&gt;</span>
            <span class="xml01">&lt;Trigger</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;IsEnabled&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;false&quot;</span><span class="xml01">&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;Border&quot;</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;Background&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">StaticResource</span><span class="xml08"> </span><span class="xml03">DisabledBackgroundBrush</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml08"> </span><span class="xml11">/&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">TargetName</span><span class="xml08">=</span><span class="xml19">&quot;Border&quot;</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;BorderBrush&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">StaticResource</span><span class="xml08"> </span><span class="xml03">DisabledBorderBrush</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml08"> </span><span class="xml11">/&gt;</span>
              <span class="xml01">&lt;Setter</span><span class="xml08"> </span><span class="xml03">Property</span><span class="xml08">=</span><span class="xml19">&quot;Foreground&quot;</span><span class="xml08"> </span><span class="xml03">Value</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">StaticResource</span><span class="xml08"> </span><span class="xml03">DisabledForegroundBrush</span><span class="xml08">}</span><span class="xml03">&quot;/</span><span class="xml01">&gt;</span>
            <span class="xml01">&lt;/Trigger&gt;</span>
          <span class="xml01">&lt;/ControlTemplate.Triggers&gt;</span>
        <span class="xml01">&lt;/ControlTemplate&gt;</span>
      <span class="xml01">&lt;/Setter.Value&gt;</span>
    <span class="xml01">&lt;/Setter&gt;</span>
  <span class="xml01">&lt;/Style&gt;</span></code></pre>
</blockquote>
<p>Let&#226;&#8364;&#8482;s dissect this monster to see how it works <img class="wp-smiley" title=":)" height="21" alt=":)" src="http://www.smart-techie.com/blog/smilies/msn_smiley.png" width="21" /></p>
<p>The first line</p>
<blockquote>
<pre class="xmlcode"><code><span class="xml01">&lt;Style</span><span class="xml08"> </span><span class="xml03">x:Key</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml08"> </span><span class="xml03">TargetType</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml01">&gt;</span></code></pre>
</blockquote>
<p><span class="c10"><span class="c9">means that this is a Style being defined for Type CheckBox in the namespace referred to by x which is <span class="c8">http://schemas.microsoft.com/winfx/2006/xaml</span> in my case.</span></span></p>
<p class="c11">Moving on, the core part of the Style is in defining the ControlTemplarte.</p>
<blockquote>
<pre class="xmlcode"> <code><span class="xml01">&lt;ControlTemplate</span><span class="xml08"> </span><span class="xml03">TargetType</span><span class="xml08">=</span><span class="xml19">&quot;</span><span class="xml08">{</span><span class="xml03">x:Type</span><span class="xml08"> </span><span class="xml03">CheckBox</span><span class="xml08">}</span><span class="xml03">&quot;</span><span class="xml01">&gt;</span></code></pre>
</blockquote>
<p>Note that I could have defined the ControlTemplate for the CheckBox using CheckBox.ControlTemplate but have chosen to implement it using a Style as it is quite common to do so.</p>
<p class="c11">It is in this ControlTemplate that I define the <span class="c7">look</span> of the CheckBox. Here I say that it should be a <span class="c12">WrapPanel</span> which should contain a <span class="c12">Border</span> which has an <span class="c12">Image</span> and a <span class="c12">ContentPresenter</span> in it. You can read more about the <span class="c12">ContentPresenter</span> in MSDN, it is just a <span class="c12">UIElement</span> which can contain and display any other object. The <span class="c12">Image</span> has a binding to the Height of the <span class="c12">ContentPresenter</span> so that it resizes automatically to the Height of the content, else you might have a case when you have text with FontSize 36 points but you checkmark is just 10 pixels high. That&#8217;s it! That&#8217;s the definition of our customized CheckBox; could it be any easier?</p>
<p class="c11">I added some Triggers to change the Image in the CheckBox depending on its state. I have added an image when IsChecked is null to account for a Tri State CheckBox. I also added some BitmapEffects for a Glow (just to make it more pretty!)</p>
<p class="c11">Go through the code, it isn&#8217;t very hard to understand or comprehend. Now whenever you wish your CheckBox to use this style, simply use it as</p>
<blockquote>
<pre class="xmlcode"><code><span class="xml01">&lt;CheckBox</span><span class="xml08"> </span><span class="xml03">Margin</span><span class="xml08">=</span><span class="xml19">&quot;8</span><span class="xml08">&#8221; </span><span class="xml03">Style</span><span class="xml08">=</span><span class="xml19">&quot;myCheckBoxStyle&quot;</span><span class="xml01">&gt;</span>
    <span class="xml01">&lt;TextBlock</span><span class="xml08"> </span><span class="xml03">FontSize</span><span class="xml08">=</span><span class="xml19">&quot;20&quot;</span><span class="xml01">&gt;</span>Happy or Sad?<span class="xml01">&lt;/TextBlock&gt;</span>
<span class="xml01">&lt;/CheckBox&gt;</span></code></pre>
</blockquote>
<p>If you find this article useful, do comment and let me know</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http://www.smart-techie.com/blog/2006/12/controltemplates-in-xaml/"><img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.smart-techie.com/blog/2006/12/controltemplates-in-xaml/" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2006/12/controltemplates-in-xaml/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Make Yahoo Mail Beta work with any Operating System</title>
		<link>http://www.smart-techie.com/blog/2006/12/make-yahoo-mail-beta-work-with-any-operating-system/</link>
		<comments>http://www.smart-techie.com/blog/2006/12/make-yahoo-mail-beta-work-with-any-operating-system/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 15:48:41 +0000</pubDate>
		<dc:creator>Ankit</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.smart-techie.com/blog/2006/12/general/make-yahoo-mail-beta-work-with-any-operating-system/</guid>
		<description><![CDATA[A lot of friends had been asking me as to how my Yahoo Mail Beta would work on Windows Millennium, Windows 98 or Linux, so I am writing about it here.&#160; We start from the basics of the problem to solve it (college taught me something didn&#8217;t it ) How does Yahoo know i am [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of friends had been asking me as to how my <strong>Yahoo Mail Beta would work on Windows Millennium, Windows 98</strong> <strong>or Linux</strong>, so I am writing about it here.&nbsp;</p>
<p>We start from the basics of the problem to solve it (college taught me something didn&#8217;t it <img src='http://www.smart-techie.com/blog/smilies/msn_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='19' height='19' title='&#59;&#41;' /> ) How does Yahoo know i am not using Windows XP ? Answer is your user agent , the browser communicates your user agent to any site you access. Any workaround? </p>
<p>In Opera : No easy way, but in Firefox one can edit the useragent easily and that&#8217;s what&#8217;s going to help us. </p>
<p>Step 1 : Backup Everything , Although the step doesn&#8217;t involve anything risky AFAIK, I still tell you to backup and release myself from liability. In this case just remember the key value that you are going to edit or even better make it blank! </p>
<p>Step 2 : Type about:config in your address bar </p>
<p>Step 3 : Right Click on any entry, Select new string and enter string name as &#8216;general.useragent.override&#8217;. </p>
<p>Step 4 : Take Your Pick Mozilla Firefox versions from <a href="http://en.wikipedia.org/wiki/User_agent#Browsers">http://en.wikipedia.org/wiki/User_agent#Browsers</a> or just use<br />
<blockquote>
<pre class="&rdquo;code&rdquo;"><code> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0.1</code>
</pre>
</blockquote>
<p> You might want to replace the version at the end to suit your version of Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smart-techie.com/blog/2006/12/make-yahoo-mail-beta-work-with-any-operating-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
