<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>S Anand</title>
	
	<link>http://www.s-anand.net/blog</link>
	<description>Technology, business and fun</description>
	<lastBuildDate>Mon, 29 Jun 2009 04:30:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/sanand" type="application/rss+xml" /><feedburner:emailServiceId>sanand</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fsanand" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/sanand" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fsanand" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fsanand" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>IE6 in Corporates</title>
		<link>http://feedproxy.google.com/~r/sanand/~3/BC2VwPKFR7U/</link>
		<comments>http://www.s-anand.net/blog/ie6-in-corporates/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 09:13:03 +0000</pubDate>
		<dc:creator>S Anand</dc:creator>
				<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.s-anand.net/blog/ie6-in-corporates/</guid>
		<description>PPK’s State of the Browser – IE Edition mentions one reason why IE6 will probably stay on for a while.
Now why do I expect IE6 to stick around while IE7 goes down? The answer is simple: Intranets… many office workers will continue to be condemned to IE6.
At work, that is. It’s quite likely that on [...]</description>
			<content:encoded><![CDATA[<p>PPK’s <a href="http://www.quirksmode.org/blog/archives/2009/06/state_of_the_br_1.html">State of the Browser – IE Edition</a> mentions one reason why IE6 will probably stay on for a while.</p>
<blockquote><p>Now why do I expect IE6 to stick around while IE7 goes down? The answer is simple: Intranets… many office workers will continue to be condemned to IE6.
<p>At work, that is. It’s quite likely that on their private computer at home they run another browser — IE7 or 8, Firefox, or maybe one of the smaller ones.
<p>… <strong>Basically, most of the IE6 market share comes from office-hour surfing, while it drops significantly in the after-hours period.</strong></p>
</blockquote>
<p>I checked the numbers on my site. It’s bang on. Last month, the percentage of IE6 users around noon was a little over 40%. At midnight, the percentage was 20%.</p>
<p><b>Percentage of IE6 users over a 24-hour window</b><a title="Percentage of IE6 users over a 24-hour window" href="http://www.flickr.com/photos/root_node/3634557407/"><img alt="Graph: Twice as many IE6 users at noon compared to midnight" src="http://farm4.static.flickr.com/3409/3634557407_fd1e6eb4f4_o.png" width="460" height="276"></a></p>
<p>Given that the bulk of my audience is from India, I would assume that these statistics are probably representative of Indian corporates. But I guess it means that there’s a fair bit of music listening happening at work. Probably a good thing.</p>
<img src="http://feeds.feedburner.com/~r/sanand/~4/BC2VwPKFR7U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.s-anand.net/blog/ie6-in-corporates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.s-anand.net/blog/ie6-in-corporates/</feedburner:origLink></item>
		<item>
		<title>The Bing effect</title>
		<link>http://feedproxy.google.com/~r/sanand/~3/4RIofmZwFwI/</link>
		<comments>http://www.s-anand.net/blog/the-bing-effect/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 19:14:01 +0000</pubDate>
		<dc:creator>S Anand</dc:creator>
				<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.s-anand.net/blog/the-bing-effect/</guid>
		<description>This graph is the number of referrals Microsoft’s new search engine, Bing, sent to my site over the last few days. Looks like the hype is dying out. Though Bing did leapfrog Yahoo briefly, that lasted just one day.</description>
			<content:encoded><![CDATA[<p><a title="bing.com referral statistics" href="http://www.flickr.com/photos/root_node/3620265928/"><img alt="bing.com referral statistics" src="http://farm3.static.flickr.com/2482/3620265928_a888a68021_o.png" width="340" height="96"></a></p>
<p>This graph is the number of referrals Microsoft’s new search engine, <a href="http://www.bing.com/">Bing</a>, sent to my site over the last few days. Looks like the hype is dying out. Though <a href="http://www.techcrunch.com/2009/06/05/did-bing-just-leapfrog-yahoo-search/">Bing did leapfrog Yahoo</a> briefly, that <a href="http://www.techcrunch.com/2009/06/07/quick-peak-bings-reign-as-2-search-engine-lasted-one-day/">lasted just one day</a>.</p>
<img src="http://feeds.feedburner.com/~r/sanand/~4/4RIofmZwFwI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.s-anand.net/blog/the-bing-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.s-anand.net/blog/the-bing-effect/</feedburner:origLink></item>
		<item>
		<title>Round buttons with Python Image Library</title>
		<link>http://feedproxy.google.com/~r/sanand/~3/WEgUwrliBWk/</link>
		<comments>http://www.s-anand.net/blog/round-buttons-with-python-image-library/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 10:41:27 +0000</pubDate>
		<dc:creator>S Anand</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.s-anand.net/blog/round-buttons-with-python-image-library/</guid>
		<description>After much hunting, I finally settled on Hedger Wang’s simple round CSS links as the most acceptable cross-browser round button implementation. The minified CSS is about 2.5KB, and the syntax is very simple. To make an input button into a round button, just wrap it within a &amp;#60;span class="button"&amp;#62;:

&amp;#60;span class=&amp;#34;button&amp;#34;&amp;#62;&amp;#60;input type=&amp;#34;submit&amp;#34;&amp;#62;&amp;#60;/span&amp;#62;

… and it’s just as [...]</description>
			<content:encoded><![CDATA[<p>After much hunting, I finally settled on <a href="http://www.hedgerwow.com/360/dhtml/css-round-button/demo.php">Hedger Wang’s simple round CSS links</a> as the most acceptable cross-browser round button implementation. The minified CSS is about 2.5KB, and the syntax is very simple. To make an input button into a round button, just wrap it within a <code>&lt;span class="button"&gt;</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;span class=&quot;button&quot;&gt;&lt;input type=&quot;submit&quot;&gt;&lt;/span&gt;</pre></div></div>

<p>… and it’s just as easy to convert a link into a rounded button:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;button&quot; href=”/”&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;</pre></div></div>

<p>It works by using a transparent PNG / GIF that looks like this:</p>
<p><img src="http://www.hedgerwow.com/360/dhtml/css-round-button/btn0.png" width="500"></p>
<p>The first button is the default button. The second appears on hover. The bottom two are for disabled buttons.</p>
<p><strong>Can we easily create buttons in different colours?</strong></p>
<p>That’s what this post is about: creating that image with round buttons and gradients. </p>
<p>When I tried creating these rounded buttons myself (and trying to do it in an automated was as usual), I saw 3 possible approaches:</p>
<ol>
<li><strong>Create it using </strong><a href="http://www.s-anand.net/blog/automating-powerpoint-with-python"><strong>PowerPoint via Python</strong></a><strong> and export as a PNG.</strong><br />So we make a curved box, put in the appropriate gradients and borders, and export it as a PNG. But the problem is <em>I couldn’t figure out how to get transparent PNGs</em>.
<li><strong>Create it in </strong><a href="http://www.gimp.org/"><strong>GIMP</strong></a><strong> using </strong><a href="http://www.gimp.org/docs/scheme_plugin/script-fu-gimp.html"><strong>script-fu plugin</strong></a><strong>.</strong><br />The problem is, <em>I don’t know scheme or GIMP’s API</em>. So I gave up on this as well.
<li><strong>Create it using </strong><a href="http://www.pythonware.com/library/pil/"><strong>Python Image Library</strong></a><strong>.</strong><br />This was inspired by Nadia’s <a href="http://nadiana.com/pil-tutorial-how-create-button-generator">PIL Tutorial: How to Create a Button Generator</a>. Let me explain how this works.</li>
</ol>
<p>The first step is to create a ‘button-mask.png’ like this one:</p>
<p><img src="http://farm4.static.flickr.com/3646/3615809813_3a1cf8a256_o.png"> </p>
<ol>
<li>Create a transparent 300 x 120 image in GIMP
<li>Selecting a box from (0,0) to (300,30)
<li>Shrink it by 2 pixels
<li>Convert it to a rounded rectangle with a radius of 80%
<li>Fill this in white
<li>Copy it to 60 pixels below</li>
</ol>
<p>Now, we need code to create a gradient:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">start, end = <span style="color: black;">&#40;</span><span style="color: #ff4500;">192</span>, <span style="color: #ff4500;">192</span>, <span style="color: #ff4500;">224</span><span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span><span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">255</span><span style="color: black;">&#41;</span>
grad = Image.<span style="color: #dc143c;">new</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'RGBA'</span>, <span style="color: black;">&#40;</span><span style="color: #ff4500;">300</span>, <span style="color: #ff4500;">120</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
draw = ImageDraw.<span style="color: black;">Draw</span><span style="color: black;">&#40;</span>grad<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>:
    draw.<span style="color: black;">line</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,y<span style="color: black;">&#41;</span>,<span style="color: black;">&#40;</span><span style="color: #ff4500;">300</span>,y<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, fill=rgb<span style="color: black;">&#40;</span>start, end, y/<span style="color: #ff4500;">30.0</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    draw.<span style="color: black;">line</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,y+<span style="color: #ff4500;">60</span><span style="color: black;">&#41;</span>,<span style="color: black;">&#40;</span><span style="color: #ff4500;">300</span>,y+<span style="color: #ff4500;">60</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, fill=rgb<span style="color: black;">&#40;</span>start, end, <span style="color: #ff4500;">1.0</span>-y/<span style="color: #ff4500;">30.0</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Now that the gradient is created, convert that into a round button by loading button-mask.png’s alpha layer onto the gradient:</p>
<pre>mask = Image.open('button-mask.png').convert('RGBA').split()[3]
border = Image.open('button-border.png').convert('RGBA')
grad.putalpha(mask)
grad.save('button.png')</pre>
<p>There it is: a simple round button generator. You can see a sample of these buttons at my <a href="http://dilbert-search.appspot.com/">Dilbert search</a> site.</p>
<img src="http://feeds.feedburner.com/~r/sanand/~4/WEgUwrliBWk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.s-anand.net/blog/round-buttons-with-python-image-library/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.s-anand.net/blog/round-buttons-with-python-image-library/</feedburner:origLink></item>
		<item>
		<title>Error logging with Google Analytics</title>
		<link>http://feedproxy.google.com/~r/sanand/~3/ko-UozvJqHQ/</link>
		<comments>http://www.s-anand.net/blog/error-logging-with-google-analytics/#comments</comments>
		<pubDate>Sat, 23 May 2009 19:29:01 +0000</pubDate>
		<dc:creator>S Anand</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.s-anand.net/blog/error-logging-with-google-analytics/</guid>
		<description>A quick note: I blogged earlier about Javascript error logging, saying that you can wrap every function in your code (automatically) in a try{} catch{} block, and log the error message in the catch{} block. 
I used to write the error message to a Perl script. But now I use Google’s event tracking. 

var s [...]</description>
			<content:encoded><![CDATA[<p>A quick note: I blogged earlier about <a href="/blog/javascript-error-logging/">Javascript error logging</a>, saying that you can wrap every function in your code (automatically) in a <code>try{} catch{}</code> block, and log the error message in the <code>catch{}</code> block. </p>
<p>I used to write the error message to a Perl script. But now I use <a href="http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html">Google’s event tracking</a>. </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> s.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">+</span> <span style="color: #3366CC;">'='</span> <span style="color: #339933;">+</span> err<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
s <span style="color: #339933;">=</span> s.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">' '</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">500</span><span style="color: #009900;">&#41;</span>
pageTracker._trackEvent<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Error&quot;</span><span style="color: #339933;">,</span> function_name<span style="color: #339933;">,</span> s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The good part is that it makes error monitoring a whole lot easier. Within a day of implementing this, I managed to get a couple of errors fixed that had been pending for months.</p>
<img src="http://feeds.feedburner.com/~r/sanand/~4/ko-UozvJqHQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.s-anand.net/blog/error-logging-with-google-analytics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.s-anand.net/blog/error-logging-with-google-analytics/</feedburner:origLink></item>
		<item>
		<title>15 years of Dilbert searchable</title>
		<link>http://feedproxy.google.com/~r/sanand/~3/qKXwdmLFoF0/</link>
		<comments>http://www.s-anand.net/blog/15-years-of-dilbert-searchable/#comments</comments>
		<pubDate>Fri, 22 May 2009 07:17:47 +0000</pubDate>
		<dc:creator>S Anand</dc:creator>
				<category><![CDATA[How I do things]]></category>

		<guid isPermaLink="false">http://www.s-anand.net/blog/15-years-of-dilbert-searchable/</guid>
		<description>The Dilbert search index now carries 15 years worth of Dilbert comics — over 5,500 strips typed out. This is mainly due to the contributions of BFMartin (over 6 years worth of strips) and Paul Dorman (over 3 years worth of strips), myself (over 3 years worth of strips) and a long tail of contributors.
You [...]</description>
			<content:encoded><![CDATA[<p>The <a href="http://dilbert-search.appspot.com/">Dilbert search index</a> now carries 15 years worth of <a href="http://www.dilbert.com/">Dilbert</a> comics — over 5,500 strips typed out. This is mainly due to the contributions of <a href="http://www.bfmartin.ca/finder/">BFMartin</a> (over 6 years worth of strips) and <a href="http://www.viscerallogic.com/paul/blog/">Paul Dorman</a> (over 3 years worth of strips), <a href="http://www.s-anand.net/">myself</a> (over 3 years worth of strips) and a long tail of contributors.</p>
<p>You can search the strips <a href="http://www.s-anand.net/dilbert.html">here</a>. While you can find strips as far back as 1989, you won’t see the images earlier than 2002 because <a href="http://www.geek.nl/">geek.nl</a> (whose images I’m shamelessly hotlinking without permission) only holds images that far back. But once you know the date of the comic (say 1991-02-03), you can visit the Dilbert official site at <a href="http://dilbert.com/1991-02-03/">dilbert.com/1991-02-03/</a> and see the strip.</p>
<p>Dilbert started around 20 years ago. So we’ve covered 75% of all the strips, and this is in just <a href="http://www.s-anand.net/blog/dilbert-search-engine/">8 months after starting this collaborative effort</a>. A couple of lessons I learnt from this:</p>
<ol>
<li><em>Crowd sourcing beats going solo</em> if you’re building content. It’s a no-brainer. There will always be only one or two people more passionate about something than you.</li>
<li><em>The long tail is not very big</em>. There will only be one or two people more passionate than something about you. Don’t expect the long tail contribution to be the significant. The value comes from being able to attract “the big fish”.</li>
</ol>
<img src="http://feeds.feedburner.com/~r/sanand/~4/qKXwdmLFoF0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.s-anand.net/blog/15-years-of-dilbert-searchable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.s-anand.net/blog/15-years-of-dilbert-searchable/</feedburner:origLink></item>
	</channel>
</rss>
