<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><title>0xCAFEFEED</title><link>http://www.0xcafefeed.com</link><description>Thoughts on Java™, Java EE™ and web application development</description><language>en</language><generator>http://wordpress.org/?v=2.6.3</generator><atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://www.0xcafefeed.com/feed/" rel="self" type="application/rss+xml" /><item><title>Where was this class loaded from?!</title><link>http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/</link><category>Uncategorized</category><category>class loading</category><category>core</category><category>java</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Tue, 13 May 2008 11:54:41 -0500</pubDate><guid isPermaLink="false">http://www.0xcafefeed.com/?p=23</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>There are many ways to figure out where a class is being loaded from. Naveen uses the <a href="http://naveenkanth.blogspot.com/2007/09/want-to-know-where-your-class-is-picked.html">-verbose flag of the JVM</a> to figure out where a class is being loaded from. If you are using Pramati Server, then you can use the command: <code>who_load_me</code> to find out which classloader loaded the class, the classloader hierarchy and where the class was loaded from.</p>
<p>Another way to find out where a class was loaded from is by using the getCodeSource method, like so:</p>
<pre class="jsccJAVA">
public static void which(Class aClass) throws Exception {
    System.out.println(aClass.getProtectionDomain().getCodeSource().getLocation());
}
</pre>
<p>I used to use this so much that Ravi finally decided to check it into cvs. Thanks buddy! Lot of people wondered why I always called it <code>which</code>, it is in memory of the Unix command <a href="http://en.wikipedia.org/wiki/Which_(Unix)">which</a>, which would tell you the directory in the <code>PATH</code> variable from which the shell was picking up the exectuable from.</p>
<p>And if you are coming for an interview and give this as the answer to my question, you better be able to explain what a protection domain is and when/by-whom is the codeSource set.</p>
<p><strong>Update:</strong> I was inspired to blog about this after I spoke with <a href="http://deepakjha.wordpress.com/">Deepak</a> about this. I didn&#8217;t know he had a blog and he had <a href="http://deepakjha.wordpress.com/2008/04/24/did-u-know-u-can-find-the-location-of-the-class-file-from-the-instance/">blogged about the same topic</a> too!</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F', 'Where+was+this+class+loaded+from%3F%21')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F', title: '+Where+was+this+class+loaded+from%3F%21+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Where%20was%20this%20class%20loaded%20from%3F%21&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;=Where%20was%20this%20class%20loaded%20from%3F%21" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;t=Where%20was%20this%20class%20loaded%20from%3F%21" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F05%2Fwhere-was-this-class-loaded-from%2F&amp;title=Where%20was%20this%20class%20loaded%20from%3F%21" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected/" title="Why is finalize method protected? (2 comments), posted on September 22, 2005">Why is finalize method protected?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/" title="Of Thread dumps and stack traces &#8230; (25 comments), posted on June 17, 2004">Of Thread dumps and stack traces &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/05/of-perf-degradation-with-try-finallies/" title="Of perf degradation with try-finallies and poor VM option docs &#8230; (4 comments), posted on May 22, 2004">Of perf degradation with try-finallies and poor VM option docs &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-non-static-threadlocals-and-memory/" title="Of non-static ThreadLocals and memory leaks &#8230; (2 comments), posted on June 23, 2004">Of non-static ThreadLocals and memory leaks &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/07/update-to-memory-leaks-with-non-static/" title="An update to: Memory leaks with non-static ThreadLocals &#8230; (2 comments), posted on July 5, 2004">An update to: Memory leaks with non-static ThreadLocals &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633615" height="1" width="1"/>]]></content:encoded><description>There are many ways to figure out where a class is being loaded from. Naveen uses the -verbose flag of the JVM to figure out where a class is being loaded from. If you are using Pramati Server, then you can use the command: who_load_me to find out which classloader loaded the class, the classloader [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/feed/</wfw:commentRss></item><item><title>Moved out of blogger</title><link>http://www.0xcafefeed.com/2008/04/moved-out-of-blogger/</link><category>Uncategorized</category><category>blogger</category><category>wordpress</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Sat, 12 Apr 2008 13:05:42 -0500</pubDate><guid isPermaLink="false">http://www.0xcafefeed.com/?p=21</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>When I first setup this blog, I chose <a href="http://www.blogger.com">blogger</a> because it would let me publish (using sftp) to a server at my <a href="http://www.me.umn.edu">alma</a>. This way neither was my data locked into any blogging service nor did I have to install any software on the server.</p>
<p><a href="http://www.gapingvoid.com/Moveable_Type/archives/004409.html"><img src="http://www.gapingvoid.com/0801data-thumb.jpg" title="gapingvoid: who owns my data?" /></a></p>
<p>For the past six months or so I have been having serious problems with blogger. It was not able to publish my posts or the comments I was receiving on them to the server. All attempts to get in touch with the folks at blogger were in vain and finally I decided to move out.</p>
<p>The blog is now hosted at <a href="http://www.0xcafefeed.com">http://www.0xcafefeed.com</a>. The <a href="http://www.me.umn.edu/~shivane/blogs/cafefeed/">old url</a> redirects to this site. I am running <a href="http://www.wordpress.org">wordpress</a>. Let me know if you have any comments on the design or issues with commenting or any other suggestions.</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F', 'Moved+out+of+blogger')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F', title: '+Moved+out+of+blogger+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Moved%20out%20of%20blogger&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;=Moved%20out%20of%20blogger" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;t=Moved%20out%20of%20blogger" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F04%2Fmoved-out-of-blogger%2F&amp;title=Moved%20out%20of%20blogger" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	None</div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633616" height="1" width="1"/>]]></content:encoded><description>When I first setup this blog, I chose blogger because it would let me publish (using sftp) to a server at my alma. This way neither was my data locked into any blogging service nor did I have to install any software on the server.

For the past six months or so I have been having [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2008/04/moved-out-of-blogger/feed/</wfw:commentRss></item><item><title>Chasing the cause for performance degradation</title><link>http://www.0xcafefeed.com/2008/03/chasing-the-cause-for-performance-degradation/</link><category>Uncategorized</category><category>debug</category><category>image resize</category><category>java</category><category>native</category><category>performance</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Thu, 06 Mar 2008 06:14:00 -0600</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=18</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><em>Spoiler:</em> The last three pictures speak more than the thousand odd words that precede them</p>
<dl>
<dt>Day before:</dt>
<dd>Too many issues resizing photos in Java. Takes too much memory, takes too long, runs out of mem on Mac. A quick comparison with <a href="http://www.microsoft.com/windowsxp/using/digitalphotography/learnmore/tips/eschelman2.mspx">ImageResizer PowerToy</a> shows that the Java code is taking too much memory and time. The difference is an order of magnitude higher on V&#8217;s machine which is slightly older and has lesser memory.</dd>
<dt>Yesterday (and day before):</dt>
<dd> Implement a photo resize server using <a href="http://msdn2.microsoft.com/en-us/library/ms533798(VS.85).aspx">GDI+</a>. Go to bed happy that mem consumption is low, speed is very good and all kinks in passing around UTF-8 filenames between Java and VC++ have been ironed out.</dd>
<dt>Noon:</dt>
<dd> J integrates the new resizer into the code base.</dd>
<dt>2pm:</dt>
<dd> J verifies perf is 4 times better</dd>
<dt>6pm:</dt>
<dd> Code is checked in &#8230; waiting for integration build</dd>
<dt>8pm:</dt>
<dd> Leave for home</dd>
<dt>10pm:</dt>
<dd> Receive an e-mail, integration build ready .. start downloading with the hope of gloating in the perf gains</dd>
<dt>10.30pm:</dt>
<dd> Installation started &#8230; baby crying &#8230; unplug the laptop move closer to baby &#8230; play with the baby and complete the installation &#8230; start the test case in background</dd>
<dt>10.35pm:</dt>
<dd> No sign of test completing &#8230; should have finished 2mins ago</dd>
<dt>10.40pm:</dt>
<dd> Suspect some &#8220;first time&#8221; bug, run the test case again &#8230; </dd>
<dt>10.46pm:</dt>
<dd> No luck &#8230; still pathetic perf &#8230; does not match what I saw in the morning</dd>
<dt>10.50pm:</dt>
<dd> Pissed &#8230; shoot of a mail to J &#8230; &#8220;dood, did you checkin the integration &#8230; i see no diff in perf &#8230; </dd>
<dt>10.55pm:</dt>
<dd> No reply &#8230; shall I wait till morn &#8230; </dd>
<dt>11:00pm:</dt>
<dd> Let me try to recreate morning&#8217;s perf numbers &#8230; run the main method on java wrapper for the resizer &#8230; the same run which took 2mins in the morning is taking 6mins &#8230; as bad as the java resizer &#8230;damn ..</dd>
<dt>11:10pm:</dt>
<dd> WTF?!!</dd>
<dt>11:11pm:</dt>
<dd> Maybe I messed up the java wrapper &#8230; run the main method on exe resizer &#8230; </dd>
<dt>11:18pm:</dt>
<dd> Just as bad &#8230; three times slower than what it was in the morn &#8230;</dd>
<dt>11:20pm to 12:05am:</dt>
<dd> Make many runs trying to change some code in the exe &#8230; nothing seems to improve perf</dd>
<dt>12:05am:</dt>
<dd> Low battery alert &#8230; curse the laptop &#8230; can&#8217;t run even a few hrs without power</dd>
<dt>12:07am:</dt>
<dd> Make some more changes to c++ code &#8230; build &#8230; run &#8230;</dd>
<dt>12:09am:</dt>
<dd> By Joe! Done in 2mins instead of 6!&#8230; damn thing &#8230; why is this small change causing the whole thing to be 3 times slower &#8230; do some googling &#8230;</dd>
<dt>12:10am:</dt>
<dd> Undo the changes &#8230; recompile and run &#8230; see if it becomes slow again &#8230;</dd>
<dt>12:09am:</dt>
<dd> Thighs are burning &#8230; prop up the laptop</dd>
<dt>12:12am:</dt>
<dd> Hain?! Done in 2mins &#8230; WTF &#8230; it was taking 6mins just a few mins ago &#8230;</dd>
<dt>12:15am:</dt>
<dd> Rollback all the changes &#8230; recompile &#8230; run &#8230; </dd>
<dt>12:17am:</dt>
<dd> Done in two mins &#8230; WTF &#8230; How can this be &#8230; Check the logs for the timining &#8230; it was taking 6mins till a few mins ago &#8230; and the whole thing is back to 2mins now &#8230; no changes done &#8230; desperate to blame it on something &#8230; maybe anti virus was running earlier (should I check the anti virus logs?)&#8230; maybe the windows kernel has cached the files now (should I restart the laptop and see?) &#8230; maybe it became slow when i was running on battery &#8230;</dd>
<dt>12:18am:</dt>
<dd> Is that really possible &#8230; will my CPU run slow if it is running out of power &#8230;</dd>
<dt>12:18am:</dt>
<dd> Or will it be slow if it is running on battery &#8230; to save power</dd>
<dt>12:19am:</dt>
<dd> Hain &#8230; what a joke &#8230; laptop can&#8217;t be so smart &#8230; it was just a coincidence &#8230; I plugged in the power and it became faster &#8230;</dd>
<dt>12:19am:</dt>
<dd> There are no coincidences in this business &#8230; unplug the power &#8230; run the test &#8230; </dd>
<dt>12:22am:</dt>
<dd> No sign of ending it really is slow </dd>
<dt>12:25am:</dt>
<dd> Back to 6mins for the test</dd>
<dt>12:25am:</dt>
<dd> &#8230; can&#8217;t be &#8230; really i mean &#8230; can the laptop be so smart &#8230; what was that thing that showed clock speed &#8230; cpu-z &#8230; google: cpu-z &#8230; download &#8230; run &#8230; wow! It is true &#8230; clock speed has been reduced to 598MHz instead of 1.6GHz</p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2008/03/no-power.png" title="CPU-z shows that the CPU is running at a fraction of rated speed when the laptop is running on battery though there is a CPU intensive process running" /> </dd>
<dt>12:25am:</dt>
<dd> OK &#8230; now connect the power and see &#8230; there goes my theory &#8230; still 598MHz</p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2008/03/powered-but-idle-CPU.png" title="CPU-z shows that the CPU is running at a fraction of rated speed when the laptop is running on power but there are NO CPU intensive processes running" /> </dd>
<dt>12:25am:</dt>
<dd> Hmmm &#8230; maybe it realized though it is powered, I am not running any CPU intensive task &#8230;. could it really really that smart &#8230; nyaaah &#8230;</dd>
<dt>12:26am:</dt>
<dd> Start the test with power still connected &#8230; run cpu-z &#8230; whoa! 1.6GHz &#8230;</p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2008/03/powered-full-steam.png" title="CPU-z shows that the CPU is running at the rated speed when the laptop is powered and there is a CPU intensive process running" /> </dd>
</dl>
<p>More googling reveals, this is Intel SpeedStep<sup>TM</sup> technology at work. It can be enabled/disabled from BIOS. A <a href="http://www.bay-wolf.com/speedstep.htm#1">quick intro</a> at Bay Wolf. <a href="http://www.intel.com/design/intarch/papers/301174.htm">Implementation details</a> at Intel.</p>
<p>Now I have to locate some java API to detect if the CPU is running at a lower clock speed so I can warn the users to power up!</p>
<p><b>Update June 05, 2008:</b> I was wrong in suspecting <a href="#comment-86">my dying battery</a>. Replacing it with a brand new one <a href="#comment-123">didn&#8217;t help</a>. </p>
<p>Long long ago I was bugged by the fact that the screen would go blank when I was reading some content heavy websites. I opened up the power management dialog, noticed that the default power scheme used to switch off the monitor too soon when running on battery. So I decided to change the power scheme to Presentation. There is NO indication that this setting does anything other than affect: Monitor, Hard Disc and System Standby. </p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2008/03/misleading-power-settings-dialog-in-xp.png" title="The misleading power options dialog in Windows XP" /></p>
<p>However, following <a href="#comment-81">Alexander&#8217;s suggestion</a> when I changed the power scheme from &#8220;Presentation&#8221; to &#8220;Home/Office desktop&#8221;. I notice that the clock speed behaves the same when on battery or power: When there is no CPU intensive task, it runs on low clock speed and when there is a CPU intensive task it runs at the rated clock speed.</p>
<p>I wish XP warned me or atleast hinted in some fashion that the power scheme would affect the clock speed. *sigh*</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F', 'Chasing+the+cause+for+performance+degradation')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F', title: '+Chasing+the+cause+for+performance+degradation+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Chasing%20the%20cause%20for%20performance%20degradation&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;=Chasing%20the%20cause%20for%20performance%20degradation" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;t=Chasing%20the%20cause%20for%20performance%20degradation" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2008%2F03%2Fchasing-the-cause-for-performance-degradation%2F&amp;title=Chasing%20the%20cause%20for%20performance%20degradation" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/" title="Of Thread dumps and stack traces &#8230; (25 comments), posted on June 17, 2004">Of Thread dumps and stack traces &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected/" title="Why is finalize method protected? (2 comments), posted on September 22, 2005">Why is finalize method protected?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2007/06/why-do-catch-clauses-need-to-be-ordered/" title="Why do catch clauses need to be ordered? (9 comments), posted on June 14, 2007">Why do catch clauses need to be ordered?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/" title="Where was this class loaded from?! (2 comments), posted on May 13, 2008">Where was this class loaded from?!</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/05/of-perf-degradation-with-try-finallies/" title="Of perf degradation with try-finallies and poor VM option docs &#8230; (4 comments), posted on May 22, 2004">Of perf degradation with try-finallies and poor VM option docs &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633617" height="1" width="1"/>]]></content:encoded><description>Spoiler: The last three pictures speak more than the thousand odd words that precede them

Day before:
Too many issues resizing photos in Java. Takes too much memory, takes too long, runs out of mem on Mac. A quick comparison with ImageResizer PowerToy shows that the Java code is taking too much memory and time. The difference [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2008/03/chasing-the-cause-for-performance-degradation/feed/</wfw:commentRss></item><item><title>Yahoo! messenger archive file format</title><link>http://www.0xcafefeed.com/2007/12/yahoo-messenger-archive-file-format/</link><category>Uncategorized</category><category>desktop</category><category>file format</category><category>search</category><category>WDS</category><category>ymessenger</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Mon, 31 Dec 2007 21:46:10 -0600</pubDate><guid isPermaLink="false">http://www.0xcafefeed.com/?p=20</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>The <a href="http://www.0xcafefeed.com/2007/12/21/addicted-to-search/">first step</a> to get my <a href="http://messenger.yahoo.com/">Yahoo! messenger</a> (YMessenger) conversations into windows desktop search is to decode the conversations stored in YMessenger archive files. </p>
<p>If you enable message archiving, YMessenger saves all the conversations with your friends in <code>C:\Program Files\Yahoo!\Messenger\Profiles\${userid}\Archive\Messages\</code> directory in files with the extension .dat. The menu option Contacts -> Message Archive shows all the archived conversations grouped by user.</p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2007/12/ymessenger-archive.png" title="Yahoo! Messenger archive viewer" /></p>
<p>Figuring out the format of this file was thrilling &#8230; but probably not as challenging as the codes faced by codebreakers in the real world. (Simon Sigh&#8217;s <a href="http://www.amazon.com/Code-Book-Science-Secrecy-Cryptography/dp/0385495323">The code book</a> did leave a lasting impression on me &#8230; as did his other books!) </p>
<p>If you consider the equation <code>encoded-message = code(original-message)</code>, the real codebreakers have access to only the encoded message. They have to figure out the code and in the process figure out the original message. The biggest leverage I had was that I had to figure out only the codem given encoded-message and original-message. </p>
<p>For example, I could send myself the message &#8220;a&#8221; and look at the contents of the .dat file. Then I could send myself the message &#8220;aa&#8221; and look at the contents of the .dat file. Then send the message &#8220;b&#8221;, followed by &#8220;bb&#8221;, followed by &#8220;ab&#8221;. Looking at the changes to the .dat file after every step.</p>
<p>Each message (from your to your buddy or vice-versa) in the .dat file is represented by a Record. Every Record has a timestamp of when it was sent, whether it was from you or from your buddy and the formatted (bold, italic etc) message. Your profile name and the the name of your buddy can be derived from the name of the .dat file and the name of its parent directory respectively.</p>
<p>The format for a Record is:</p>
<ul>
<li>The first int (four bytes) represents the number of seconds from <a href="http://en.wikipedia.org/wiki/Unix_time">Java epoch (Jan 1, 1970)</a></li>
<li>The second int &#8230; i don&#8217;t know what it is</li>
<li>The third int indicates that the message is from you to your buddy if it is zero or from your buddy to you if it is non-zero</li>
<li>The fourth int (msgLen) represents the length of the encoded formatted-message. There is no encoding/encryption till this point.</li>
<li>Next msgLen bytes represent the encoded formatted-message</li>
</ul>
<p>The formatting of the message is indicated by some special tokens in the .dat file. These font-attribute tokens always start with 0&#215;1B5B. So if you type the message &#8220;this is <b>NOT</b> acceptable&#8221;, the formatted message would be &#8220;this is {[0x1B5B][0x31]}NOT{[0x1B5B]x[0x31]} acceptable&#8221; (where {} indicate one token and [] indicates bytes shown in hex value instead of ASCII values). {[0x1B5B][0x31]} is a token that indicates begin bold and {[0x1B5B]x[0x31]} indicated end bold.</p>
<p>There are tokens for (begin and end of) bold, italic, underline. Then there are tokens that mark the begining of custom and standard(/palette) colors. The ending of colors is indicated by a token that indicates begining of standard color: black! The only peculiarity I could notice was that they use HTML like tags (instead of tokens starting with 0&#215;1B5B) when you send messages with color gradient.</p>
<p>The formatted-message is then encoded before saving into the record. One of the challenges with a web-desktop application is that while storing the encrypted data on the desktop, what key do we use for encryption? The key used for encryption has to be different for each user, should not be guessable by other users and should not be stored on the PC. One option could be to use the password of the user as the key. But, whenever the user changes the password the archive has to be decrypted with the old password and encrypted with the new one. </p>
<p>The alternate solution is to have a autogenerated key stored per user on the website. An authenticated user can download his key and decrypt the archive. Changing the password does not change this key.</p>
<p>YMessenger uses the simple <a href="http://en.wikipedia.org/wiki/XOR_cipher">XOR cipher</a> to encrypt the messages. The key used for the cipher is highly guessable: your user-id! Every byte of the formatted-message is XOR&#8217;ed with a byte from the user-id. For example if you message was &#8220;<span style="color:blue">Hello World!</span>&#8221; and your user-id was &#8220;<span style="color:red">doofy</span>&#8220;, then the encrypted bytes would be: <br />&#8220;<span style="color:#CCCCCC">[</span><span style="color:blue">H</span>^<span style="color:red">d</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">e</span>^<span style="color:red">o</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">l</span>^<span style="color:red">o</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">l</span>^<span style="color:red">f</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">o</span>^<span style="color:red">y</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span> </span>^<span style="color:red">d</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">W</span>^<span style="color:red">o</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">o</span>^<span style="color:red">o</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">r</span>^<span style="color:red">f</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">l</span>^<span style="color:red">y</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">d</span>^<span style="color:red">d</span><span style="color:#CCCCCC">]</span><span style="color:#CCCCCC">[</span><span style="color:blue">!</span>^<span style="color:red">o</span><span style="color:#CCCCCC">]</span>&#8221;</p>
<p>The beauty of XOR cipher is that if <code>encoded-message = xor-cipher(original-message, key)</code> then <code>original-message = xor-cipher(encoded-message, key)</code> </p>
<p><a href="http://www.0xcafefeed.com/wp-content/uploads/2007/12/Parser.java">Parser.java</a> documents the file format in more detail. <a href="http://www.0xcafefeed.com/wp-content/uploads/2007/12/Main.java">Main.java</a> demonstrates how one can use the Parser to convert the .dat files to HTML or plain text format.</p>
<p>How did you spend your new year&#8217;s eve?! <img src='http://www.0xcafefeed.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F', 'Yahoo%21+messenger+archive+file+format')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F', title: '+Yahoo%21+messenger+archive+file+format+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Yahoo%21%20messenger%20archive%20file%20format&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;=Yahoo%21%20messenger%20archive%20file%20format" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;t=Yahoo%21%20messenger%20archive%20file%20format" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Fyahoo-messenger-archive-file-format%2F&amp;title=Yahoo%21%20messenger%20archive%20file%20format" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2007/12/addicted-to-search/" title="Addicted to search (0 comments), posted on December 21, 2007">Addicted to search</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/surviving-windoze/" title="Surviving windoze &#8230; (4 comments), posted on June 2, 2004">Surviving windoze &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633618" height="1" width="1"/>]]></content:encoded><description>The first step to get my Yahoo! messenger (YMessenger) conversations into windows desktop search is to decode the conversations stored in YMessenger archive files. 
If you enable message archiving, YMessenger saves all the conversations with your friends in C:\Program Files\Yahoo!\Messenger\Profiles\${userid}\Archive\Messages\ directory in files with the extension .dat. The menu option Contacts -&gt; Message Archive shows [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/12/yahoo-messenger-archive-file-format/feed/</wfw:commentRss></item><item><title>Addicted to search</title><link>http://www.0xcafefeed.com/2007/12/addicted-to-search/</link><category>Uncategorized</category><category>desktop</category><category>locate</category><category>lookout</category><category>search</category><category>WDS</category><category>ymessenger</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Fri, 21 Dec 2007 12:39:12 -0600</pubDate><guid isPermaLink="false">http://www.0xcafefeed.com/?p=19</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>For as long as I can remember, I have been too lazy to use: my fingers to type and my brain to remember things. When I used to work on linux, I used to rely heavily on the <a href="http://www.gnu.org/software/findutils/manual/html_mono/find.html#Invoking-locate">locate</a> command to search and open files <code>vi `locate math.h`</code>. This was something I missed a lot in windows. Finally I started using <a href="http://www.launchy.net/">Launchy</a> as a replacement for locate.<br /><img src="http://www.0xcafefeed.com/wp-content/uploads/2007/12/locating-sources-using-launchy.png" alt="Locating sources files using launchy" title="Locating sources files using launchy" /></p>
<p>Searching through mails also worked pretty well when was using Evolution on Linux. But search in Outlook sucks, especially if you are using IMAP. The amazing <a href="http://www.lookoutsoft.com">Lookout</a> plugin for Outlook was my saviour. Unfortunately, it had its own problems. It used to crash my Outlook 2K often; and once Microsoft bought them, there was no hope of getting things fixed. Microsoft has been pushing its own <a href="http://www.microsoft.com/windows/products/winfamily/desktopsearch/default.mspx">Windows Desktop Search</a> instead of Lookout. Though not as fast as Lookout &#8230; it is the compromise solution I have been using for the sake of stability.</p>
<p>I know there are other desktop search products out there, including <a href="http://desktop.google.com">the one from google</a>. But the thing I like about windows desktop search is that I can do Outlook operations on the search results (like forward the mail or move them into folders). Now I am so addicted to search that I move mails to folders only when it has huge attachment. Otherwise, it is pretty much the gmail model. I only use Inbox.yyyy and sent-mail.yyyy folders actively (yyyy being the year). I considering setting up a rule in Outlook to save sent-mail in Inbox, that way I would have only Inbox.yyyy folders and I can do a threaded view of the conversations (i.e. the gmail&#8217;s &#8220;All Mail&#8221; label)!</p>
<p>Apart from email, our other significant communication medium at work is Yahoo! messenger. I archive all my conversations and refer to them very often. The unfortunate side effect of this is that some conversations that start on email are concluded on chat and six months later when I search mails, I do not find the mail with the conclusion. Over the years I have wizened up to search conversations on email and followup the search in ymessenger. Unfortunately, search in ymessenger also sucks! You have to do a manual search based on the timestamp of email conversation and people involved.</p>
<p>YMessenger saves conversations in <code>C:\Program Files\Yahoo!\Messenger\Profiles\${userid}\Archive\Messages\</code> directory in files with the extension .dat. It would be nice to have Windows Desktop Search (WDS) index these files and show my conversation results when I search for communications. I can think of couple of  approaches to achieve this: </p>
<ul>
<li>Convert ymessenger archives to Outlook mailbox format (.pst) and let WDS index it</li>
<li>Convert ymessenger archives to RSS and import the RSS into Outlook using <a href="http://rsspopper.blogspot.com/2004/10/home.html">RSS Popper</a> and once the messages are in Outlook, WDS will index it</li>
<li>Convert the ymessenger archive files (.dat) to html format and have WDS index these. Probably the easiest integration, but the limitation would only issue will not be able to run searches of the type &#8220;customer requirements from:myYahooBuddy date:last month&#8221;</li>
<li>WDS supports plugging-in <a href="http://channel9.msdn.com/wiki/default.aspx/Channel9.IFilter">IFilters</a> to search new file types. I could implement IFilter to index the ymessenger archive files (.dat).</li>
</ul>
<p>All of these presume there is some API to decode the content in the ymessenger archive files (.dat). The search is on!</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F', 'Addicted+to+search')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F', title: '+Addicted+to+search+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Addicted%20to%20search&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;=Addicted%20to%20search" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;t=Addicted%20to%20search" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F12%2Faddicted-to-search%2F&amp;title=Addicted%20to%20search" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2007/12/yahoo-messenger-archive-file-format/" title="Yahoo! messenger archive file format (0 comments), posted on December 31, 2007">Yahoo! messenger archive file format</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/surviving-windoze/" title="Surviving windoze &#8230; (4 comments), posted on June 2, 2004">Surviving windoze &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633619" height="1" width="1"/>]]></content:encoded><description>For as long as I can remember, I have been too lazy to use: my fingers to type and my brain to remember things. When I used to work on linux, I used to rely heavily on the locate command to search and open files vi `locate math.h`. This was something I missed a lot [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/12/addicted-to-search/feed/</wfw:commentRss></item><item><title>Neal Gafter’s proposal for constructor type inference</title><link>http://www.0xcafefeed.com/2007/07/neal-gafters-proposal-for-constructor/</link><category>Uncategorized</category><category>generics</category><category>java</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Fri, 06 Jul 2007 15:59:00 -0500</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=17</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Neal gafter has proposed that java language include <a href="http://gafter.blogspot.com/2007/07/constructor-type-inference.html">Constructor Type Inference</a> in order to reduce verbosity. So what was </p>
<pre class="jsccJAVA">
Map&lt;String,List&lt;Thing&gt;&gt; map = new HashMap&lt;String,List&lt;Thing&gt;&gt;();
</pre>
<p>looks like:</p>
<pre class="jsccJAVA">
Map&lt;String,List&lt;Thing&gt;&gt; map = new HashMap&lt;&gt;();
</pre>
<p>Though there is an alternate proposal to deduce the LHS type instead, like:</p>
<pre class="jsccJAVA">
map := new HashMap&lt;String,List&lt;Thing&gt;&gt;();
</pre>
<p>I find Neal&#8217;s proposal more appealing and more natural to java. It feels so Java, that I have already used it thrice since morning only to be surprised by IDEA&#8217;s warnings! So, if anyone is counting votes, +1 from me.</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F', 'Neal+Gafter%26%238217%3Bs+proposal+for+constructor+type+inference')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F', title: '+Neal+Gafter%26%238217%3Bs+proposal+for+constructor+type+inference+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;t=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F07%2Fneal-gafters-proposal-for-constructor%2F&amp;title=Neal%20Gafter%27s%20proposal%20for%20constructor%20type%20inference" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected/" title="Why is finalize method protected? (2 comments), posted on September 22, 2005">Why is finalize method protected?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2007/06/why-do-catch-clauses-need-to-be-ordered/" title="Why do catch clauses need to be ordered? (9 comments), posted on June 14, 2007">Why do catch clauses need to be ordered?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/" title="Where was this class loaded from?! (2 comments), posted on May 13, 2008">Where was this class loaded from?!</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/" title="Of Thread dumps and stack traces &#8230; (25 comments), posted on June 17, 2004">Of Thread dumps and stack traces &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/05/of-perf-degradation-with-try-finallies/" title="Of perf degradation with try-finallies and poor VM option docs &#8230; (4 comments), posted on May 22, 2004">Of perf degradation with try-finallies and poor VM option docs &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633622" height="1" width="1"/>]]></content:encoded><description>Neal gafter has proposed that java language include Constructor Type Inference in order to reduce verbosity. So what was 

Map&amp;#60;String,List&amp;#60;Thing&amp;#62;&amp;#62; map = new HashMap&amp;#60;String,List&amp;#60;Thing&amp;#62;&amp;#62;();

looks like:

Map&amp;#60;String,List&amp;#60;Thing&amp;#62;&amp;#62; map = new HashMap&amp;#60;&amp;#62;();

Though there is an alternate proposal to deduce the LHS type instead, like:

map := new HashMap&amp;#60;String,List&amp;#60;Thing&amp;#62;&amp;#62;();

I find Neal&amp;#8217;s proposal more appealing and more natural to java. It [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/07/neal-gafters-proposal-for-constructor/feed/</wfw:commentRss></item><item><title>Why do catch clauses need to be ordered?</title><link>http://www.0xcafefeed.com/2007/06/why-do-catch-clauses-need-to-be-ordered/</link><category>Uncategorized</category><category>java</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Thu, 14 Jun 2007 10:30:00 -0500</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=16</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Looking at question #15 on JDJs <a href="http://java.sys-con.com/read/48839.htm">Secrets Of The Masters: Core Java Job Interview Questions</a> (Secrets of the masters???!! Whhoaaah!!), I was reminded of the question Vinod once asked me: &#8220;Why do catch clauses have to be ordered?&#8221;</p>
<p>It is generally known that, in Java, the order of the catch clauses is important. The more specific exceptions have to be handled first followed by the less specific exceptions. So, the following snippet of code causes a compilation error, as FileNotFoundException is more specific than IOException (FileNotFoundException extends IOException).</p>
<pre class="jsccJAVA"> try{
  //Some File I/O operations here
 }catch(IOException e){
  //handle the I/O error
 }catch(FileNotFoundException fnfe){
  //handle the case when the file is not found
 }</pre>
<p>To fix it, you need to change the order in which the exceptions are handled by moving the more specific exception (FileNotFoundException) before the less specific exception (IOException), like so:</p>
<pre class="jsccJAVA"> try{
  //Some File I/O operations here
 }catch(FileNotFoundException fnfe){
  //handle the case when the file is not found
 }catch(IOException e){
  //handle the I/O error
 }</pre>
<p>This change is so straight forward that, any smart IDE can do it for you</p>
<p><img src="http://www.0xcafefeed.com/wp-content/uploads/2007/06/ide-suggestions.png" alt="Screenshot of IntelliJ IDEA's suggestion to move catch clauses around" /></p>
<p>So Vinod&#8217;s question really was: Why didn&#8217;t the designers of the Java language make the compiler smart enough to sort the catch clauses automatically (instead of pushing the burden on to the IDEs/developers)?. To quote him verbatim (including the typos) from my messenger archive: &#8220;.. i mean you are asking the programmer to think like compiler than compiler think like a programmer &#8230; from a programmer perspective&#8230; i want to catch FNFE if the exception is of that type other wise cathc IO&#8221;. Interesting point .. I never thought of it before.</p>
<p>Spoiler: I don&#8217;t know the answer, what follows are my thoughts or possibly my <a href="http://en.wikipedia.org/wiki/Stream_of_consciousness_writing">stream of consciousness</a>, like my article on <a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected">Why is finalize method protected?</a>.</p>
<p>Having found no clues in <a href="http://java.sun.com/docs/books/jls/">The Java language specification</a> I thought the answer probably lies in the history of Java. <a href="https://duke.dev.java.net/green/">A Brief History of the Green Project</a> is a good place to start. This page gives history of Java (it was originally called Oak) and has a copy of the <a href="https://duke.dev.java.net/green/OakSpec0.2.ps">version 0.2 of the Oak language specification</a> [<a href="http://www.0xcafefeed.com/wp-content/uploads/2007/06/OakSpec0.2.zip">PDF</a>]. The spec gives an interesting perspective on how the Java language evolved.<br />
Having found no clues in <a href="http://java.sun.com/docs/books/jls/">The Java language specification</a> I thought the answer probably lies in the history of Java. <a href="https://duke.dev.java.net/green/">A Brief History of the Green Project</a> is a good place to start. This page gives history of Java (it was originally called Oak) and has a copy of the <a href="https://duke.dev.java.net/green/OakSpec0.2.ps">version 0.2 of the Oak language specification</a> [<a href="http://www.0xcafefeed.com/wp-content/uploads/2007/06/OakSpec0.2.zip">PDF</a>]. The spec gives an interesting perspective on how the Java language evolved.</p>
<h3>Side tracking: Interesting tidbits from the Oak specification</h3>
<ul>
<li><code>Throwable</code> was earlier called <code>GenericException</code></li>
<li>Asynchronous Exceptions: one thread can throw an exception (using Thread’s postException() instance method) to another thread</li>
<li>The protect/unprotect keywords</li>
<li>You could use <code>//* javadoc here</code> notation to write java docs apart from <code>/** javadoc here</code></li>
<li><code>print</code> and <code>println</code> were operators. <code>System.out</code> was possibly a refactoring</li>
<li>Interfaces declared constants using <code>const</code> instead of <code>public static final</code>. Like <code> const int aConstant = 42;</code></li>
<li>Supported assertions, preconditions and postconditions</li>
<li>Has no details on threads, serialization nor does it have a BNF</li>
</ul>
<h3>Side tracking again: Catching multiple exceptions in one catch clause</h3>
<p>Many a times people ask me: &#8220;Why can&#8217;t I catch multiple exceptions in one catch clause, I generally end up pasting same error recovery code in all the catch clauses. Why isn&#8217;t a catch clause <em>like a method signature</em>, where I can have a comma separated list of all the exceptions to be handled?&#8221; What they want is some thing like this:</p>
<pre class="jsccJAVA"> try{
  //Some File I/O operations here
 }catch(FileNotFoundException fnfe, IOException e){
  //common error handling
 }</pre>
<p>The question itself seems to have the answer. If all the exceptions were listed like method parameters, the above snippet of code would mean &#8220;Do the common error handling if BOTH FileNotFoundException and IOException are raised&#8221; instead of &#8220;Do the common error handling if EITHER FileNotFoundException or IOException is raised&#8221;. The solution probably would be to use the OR operator &#8220;||&#8221; instead of commas? Some thing like:</p>
<pre class="jsccJAVA"> try{
  //Some File I/O operations here
 }catch(FileNotFoundException||IOException||MyNewException e){
  //common error handling
 }</pre>
<p>Incidentally, the Oak specification also compares catch clauses to method definitions. From section 9.4:</p>
<p><q>A catch clause is like a method definition with exactly one parameter and no return type. When an exception occurs, the runtime system searches the nested try/catch clauses. *snip*</q></p>
<p>If you have two overloaded methods called handle, of which one takes <code>FileNotFoundException</code> as a parameter and the other takes <code>IOException</code> as a parameter, java always knows which method to call. It automatically calls the most specific method based on the runtime type of the object.</p>
<pre class="jsccJAVA"> private void handle(FileNotFoundException fnfe){
 }

 private void handle(IOException e){
 }</pre>
<p>Now, as suggested by the spec, each catch clause can be treated as an overloaded method which takes a subclass of Throwable as a method parameter and no return type. Now extending the method overloading analogy shouldn&#8217;t java be able to detect which catch clause to invoke? Unfortunately, the complete paragraph from section 9.4 reads:</p>
<p><q>A catch clause is like a method definition with exactly one parameter and no return type. When an exception occurs, the runtime system searches the nested try/catch clauses. <strong>The first one with a parameter type that is the same class or a superclass of the thrown object has its catch clause executed.</strong> After the catch clause executes, execution resumes after the try/catch statement. It is not possible for an exception handler to resume execution at the point that the exception occurred.</q></p>
<p>The question now is, instead of continuing the method definition analogy and supporting overloading semantics to the catch clauses, why does the spec say the first catch clause will be chosen?</p>
<p>One possible reason could be for ease of compiler development. This seems to be an unlikely motivation.</p>
<p>Other possible reason could be for code clarity. What if the java developers start to expect that all the exception handlers that match are invoked? The problem exists with or without auto-sorting of catch clauses. A switch like construct would have been more appropriate then:</p>
<pre class="jsccJAVA"> try{
  //Some File I/O operations here
 }catch(Throwable t){
  switchOnClass(t){ //using a hypothetical keyword switchOnClass
   case FileNotFoundException:
    //handle file not found error
    break;
   case FileNotFoundException:
   case MyNewException:
    //some processing for both FileNotFoundException and MyNewException
    break;
  }
 }</pre>
<p>Or the other possible reason is because Java&#8217;s exception handling was based on C++&#8217;s (as mentioned in the foot notes of the Oak spec page 26). C++ allows multiple inheritance. So my class <code>MusicStreamingException</code> could extend both <code>MusicPlayerException</code> and <code>IOException</code>. Now assume the compiler see&#8217;s this piece of code:</p>
<pre class="jsccJAVA"> try{
  if(someCheckHere())
   throw new MusicStreamingException();
 }catch(IOException e){

 }catch(MusicPlayerException e){

 }</pre>
<p>Both the catch clauses match equally and the compiler has no way of determining which one to invoke. Hence the best policy would be to choose the first catch clause. However, this would never happen in Java as it does not allow multiple inheritance, else the same problem would exist in overloaded methods. Is it possible that this requirement in the spec is only a legacy from C++? And can it be done away with without impacting the existing code?</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F', 'Why+do+catch+clauses+need+to+be+ordered%3F')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F', title: '+Why+do+catch+clauses+need+to+be+ordered%3F+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;t=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F06%2Fwhy-do-catch-clauses-need-to-be-ordered%2F&amp;title=Why%20do%20catch%20clauses%20need%20to%20be%20ordered%3F" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected/" title="Why is finalize method protected? (2 comments), posted on September 22, 2005">Why is finalize method protected?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/" title="Where was this class loaded from?! (2 comments), posted on May 13, 2008">Where was this class loaded from?!</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/" title="Of Thread dumps and stack traces &#8230; (25 comments), posted on June 17, 2004">Of Thread dumps and stack traces &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/05/of-perf-degradation-with-try-finallies/" title="Of perf degradation with try-finallies and poor VM option docs &#8230; (4 comments), posted on May 22, 2004">Of perf degradation with try-finallies and poor VM option docs &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-non-static-threadlocals-and-memory/" title="Of non-static ThreadLocals and memory leaks &#8230; (2 comments), posted on June 23, 2004">Of non-static ThreadLocals and memory leaks &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633623" height="1" width="1"/>]]></content:encoded><description>Looking at question #15 on JDJs Secrets Of The Masters: Core Java Job Interview Questions (Secrets of the masters???!! Whhoaaah!!), I was reminded of the question Vinod once asked me: &amp;#8220;Why do catch clauses have to be ordered?&amp;#8221;
It is generally known that, in Java, the order of the catch clauses is important. The more specific [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/06/why-do-catch-clauses-need-to-be-ordered/feed/</wfw:commentRss></item><item><title>Backward compatibility of specified, under-specified and un-specified features/API</title><link>http://www.0xcafefeed.com/2007/01/backward-compatibility-of-specified/</link><category>Uncategorized</category><category>design</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Mon, 15 Jan 2007 03:43:00 -0600</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=15</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Backward compatibility is a challenge for everyone from the guy writing the kernel to guy building the application. </p>
<p><a href="http://blogs.msdn.com/oldnewthing/">Raymond Chen</a> has written a lot of anecdotes on compatibility issues in windows. (See <a href="http://www.microsoft.com/technet/technetmag/issues/2006/10/WindowsConfidential/">Compatibility Constraints</a> and <a href=http://www.microsoft.com/technet/technetmag/issues/2006/11/WindowsConfidential/>Handling Compatibility Hacks</a>.) He has also authored a book with the same title as that of his blog: <a href="http://blogs.msdn.com/oldnewthing/archive/2006/12/25/1361289.aspx">The old new thing</a>, which I am sure will have even more interesting tidbits.</p>
<p>Even application developers have to worry about the API they expose and its backward compatibility. The fine people at <a href="http://viewvc.tigris.org/">viewvc</a> believed the URL scheme used by viewvc is part of their &#8220;API&#8221; and had a <a href="http://viewvc.tigris.org/servlets/ReadMsg?list=dev&#038;msgNo=2522">thorough discussion</a> on what changes could be made to the URL scheme before and after the 1.0 release! </p>
<p>Being in the middle tier, we seem to face more than our fair share of compatibility issues. First, the product is based on the specifications which are written in English. Each vendor is free to interpret it the way they want. Eventually this leads to customer queries like: &#8220;But this works in [plug the customer's current vendor name here]!&#8221; This results in new flags in the product configuration files. Over the years we have brought up such ambiguities in the expert groups and the newer versions of the specs clarify the interpretation.</p>
<p>The other category of issues arise from ensuring compatibility with the innumerable combinations of databases, drivers, operating systems and JVMs. JV talks about <a href="http://jroller.com/trackback/jvenu/Weblog/socket_not_connected">an issue we recently faced</a> wherein upgrading the VM from 1.4.2_10 to 1.4.2_11 breaks our product. JDK 1.4 introduced a new feature of disconnected sockets. The new implementation was supposed to be backward compatible. However, the implementation had a bug (<a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=2126509">2126509 </a>). In the process of fixing this bug in 1.4.2_11, (I believe) they introduced a new bug which breaks backward compatibility.</p>
<p>Such explicit problems are easier to manage than the unwritten contracts. While debugging I rely heavily on the exceptions raised. For example when you cast an object to a type, if there is a ClassCastException, the message generally has the class name of the object. So, in your code, if you are casting to java.util.List and the exception message is java.util.String, you know you are casting a String to a List. Also if you are casting to foo.bar.Klass and the message name is also foo.bar.Klass, then it is a class loading issue. The object you have loaded is of the same class but loaded from a different classloader. Looking at the exception message I could figure out whether it was a genuinely wrong cast or a ClassLoader issue. Unfortunately in JDK 1.4 ClassCastExceptions do not have a message. For a developer this is an annoyance, but is it worth logging a bug?</p>
<p>Here is a sample output with different jdks:</p>
<pre class="cmd">
D:\code\41>java -cp PS30\tp\classes ClassCastTest
1.5.0_06
java.lang.ClassCastException: java.lang.String
        at ClassCastTest.main(ClassCastTest.java:25)

D:\code\41>java -cp PS30\tp\classes ClassCastTest
1.4.2_10
java.lang.ClassCastException
        at ClassCastTest.main(ClassCastTest.java:25)

D:\code\41>java -cp PS30\tp\classes ClassCastTest
1.3.1_16
java.lang.ClassCastException: java.lang.String
        at ClassCastTest.main(ClassCastTest.java:25)
</pre>
<p>Would you write unit tests for the output messages?</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F', 'Backward+compatibility+of+specified%2C+under-specified+and+un-specified+features%2FAPI')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F', title: '+Backward+compatibility+of+specified%2C+under-specified+and+un-specified+features%2FAPI+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;t=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fbackward-compatibility-of-specified%2F&amp;title=Backward%20compatibility%20of%20specified%2C%20under-specified%20and%20un-specified%20features%2FAPI" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	None</div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633624" height="1" width="1"/>]]></content:encoded><description>Backward compatibility is a challenge for everyone from the guy writing the kernel to guy building the application. 
Raymond Chen has written a lot of anecdotes on compatibility issues in windows. (See Compatibility Constraints and Handling Compatibility Hacks.) He has also authored a book with the same title as that of his blog: The old [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/01/backward-compatibility-of-specified/feed/</wfw:commentRss></item><item><title>Enum and other Java 5 tricks …</title><link>http://www.0xcafefeed.com/2007/01/enum-and-other-java-5-tricks/</link><category>Uncategorized</category><category>enum</category><category>java</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Fri, 12 Jan 2007 03:30:00 -0600</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=14</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Deepak has finally started blogging at <a href="http://deepjava.wordpress.com/">Deep into Java</a>. He has been sharing some neat tricks like <a href="http://deepjava.wordpress.com/2006/12/08/bootstrapping-static-fields-within-enums/trackback/">Bootstrapping static fields within enums</a>.</p>
<p>Thanks for the tips buddy &#8230; look forward to more of them.</p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F', 'Enum+and+other+Java+5+tricks+%26%238230%3B')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F', title: '+Enum+and+other+Java+5+tricks+%26%238230%3B+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Enum%20and%20other%20Java%205%20tricks%20...&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;=Enum%20and%20other%20Java%205%20tricks%20..." title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;t=Enum%20and%20other%20Java%205%20tricks%20..." title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2007%2F01%2Fenum-and-other-java-5-tricks%2F&amp;title=Enum%20and%20other%20Java%205%20tricks%20..." title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2005/09/why-is-finalize-method-protected/" title="Why is finalize method protected? (2 comments), posted on September 22, 2005">Why is finalize method protected?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2007/06/why-do-catch-clauses-need-to-be-ordered/" title="Why do catch clauses need to be ordered? (9 comments), posted on June 14, 2007">Why do catch clauses need to be ordered?</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2008/05/where-was-this-class-loaded-from/" title="Where was this class loaded from?! (2 comments), posted on May 13, 2008">Where was this class loaded from?!</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/" title="Of Thread dumps and stack traces &#8230; (25 comments), posted on June 17, 2004">Of Thread dumps and stack traces &#8230;</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/05/of-perf-degradation-with-try-finallies/" title="Of perf degradation with try-finallies and poor VM option docs &#8230; (4 comments), posted on May 22, 2004">Of perf degradation with try-finallies and poor VM option docs &#8230;</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633625" height="1" width="1"/>]]></content:encoded><description>Deepak has finally started blogging at Deep into Java. He has been sharing some neat tricks like Bootstrapping static fields within enums.
Thanks for the tips buddy &amp;#8230; look forward to more of them.



Share: 


	
	
	
	
	
	
	
	
	
	
	
	
	
	
	



	Related posts: 
	
	Why is finalize method protected? &amp;#124; 
Why do catch clauses need to be ordered? &amp;#124; 
Where was this class loaded [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2007/01/enum-and-other-java-5-tricks/feed/</wfw:commentRss></item><item><title>Got Phished :(</title><link>http://www.0xcafefeed.com/2006/09/got-phished/</link><category>Uncategorized</category><category>web</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rajiv</dc:creator><pubDate>Thu, 14 Sep 2006 11:01:00 -0500</pubDate><guid isPermaLink="false">http://www.0xCAFEFEED.com/?p=13</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I booted my laptop early this morning to get my daily dose of Google alerts. Navigating through the alerts I ended up at: <a href="http://momb.socio-kybernetics.net/">The Museum of Modern Betas</a> and browsing through its entries I chanced upon Google&#8217;s firefox extension for detecting phishing: <a href="http://momb.socio-kybernetics.net/beta/google-safe-browsing-for-firefox">Safe Browsing</a>. While I was going through their site, I noticed the yahoo notification window show &#8220;Deeps is now online&#8221; and I was thinking to myself &#8220;What is this guy doing online so early in the morn?&#8221; (And may I ask what are YOU doing online?!) Installing Google SafeBrowsing seems to be fraught with its own problems. The SafeBrowsing home page says that it can be installed as part of google toolbar only. Antitrust I say! Some sites say the download is available only in US. Further googling revealed the URL: <a href="http://dl.google.com/firefox/google-safebrowsing.xpi">http://dl.google.com/firefox/google-safebrowsing.xpi</a></p>
<p>While I was installing the plugin (firefox waits for a couple of seconds before enabling the install button &#8230; i wonder why?!), I see a message from deeps:</p>
<p><q>Deeps: http://www.geocities.com/junebug585 <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif" alt=":)"></q></p>
<p>&#8230;and he logs out. I promptly clicked on the link which showed the page:<br />
<a href="http://www.0xcafefeed.com/wp-content/uploads/2006/09/phishing-orig.png"><br />
<img src="http://www.0xcafefeed.com/wp-content/uploads/2006/09/phishing-small.png" alt="Click to enlarge"></a>
</p>
<p>&#8220;Hmmm &#8230; password&#8221; I say. I ping deeps &#8230;&#8221;Dood &#8230; it&#8217;s asking for password&#8221;. No response. Being a stickler for online security (ask my wife on how i nag her into setting a different password for each site and make sure she does not note down her passwords anywhere!) I think to myself&#8230; &#8220;Hey! This could be a phishing site!&#8221; (what with me looking at Google SafeBrowsing site just a few mins ago). &#8220;Very well&#8221;, I tell myself, &#8220;&#8230; the url is Yahoo! Geocities, the logos and the layout looks ok &#8230; Why would deep try to phish my yahoo account details &#8230; what the hell .. let&#8217;s try to login&#8221;. Key in the user id pass nothing happens. Back to Yahoo home page. &#8220;D&#8217;oh! Have I been phished?!&#8221; with this nagging doubt go have a shower &#8230; come back&#8230; notice deeps has replied to my message:</p>
<p><q>Deeps: what login?<br />Deeps: did u a get any message from me?<br />Deeps: i did not send it..</q></p>
<p>&#8220;Oh God! I have been phished!! Change the password quickly.&#8221; Chirpy wifey: &#8220;Breakfast time!&#8221; &#8220;Oh God! Imagine after all my taunts &#8230; I&#8217;ve been phished &#8230; how am I going to tell her this?! Have I really been phished?!&#8221; So I decide to go back to the site and verify. <a href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a> shows:</p>
<pre>http://www2.fiberbit.net/form/mailto.cgi
POST /form/mailto.cgi HTTP/1.1
Host: www2.fiberbit.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.geocities.com/junebug585/?200614
Content-Type: application/x-www-form-urlencoded
Content-Length: 138
<b>Mail_From=GOD&amp;Mail_To=jawsy1%40gmail.com&amp;Mail_Subject=Gift&amp;Next_Page=http%3A%2F%2Fwww.yahoo.com
&amp;.pd=fpctx_ver%253d0&amp;<span style="color: rgb(255, 0, 0);">login=asdf&amp;passwd=asdf</span></b>

HTTP/1.x 302 Moved Temporarily
Date: Thu, 14 Sep 2006 04:01:30 GMT
Server: Apache/1.3.26 (Unix) mod_perl/1.26
Location: http://www.yahoo.com
Content-Type: text/html; charset=iso-8859-1
X-Cache: MISS from downloads.pramati.com
X-Cache-Lookup: MISS from downloads.pramati.com:3128
Connection: close
</pre>
<p>&#8220;Oh no! I really have been phished! <b>Bugger has mailed my yahoo password to himself!!</b> Change the password &#8230; change the password &#8230; change the password!&#8221;. Wifey, annoyed after waiting for me at the b&#8217;fast table: &#8220;Wot&#8217;chu doin buster?!&#8221; &#8230; where do I hide my face now?!</p>
<p>The phisher is not Deeps&#8230; some one phished his id and sent me the message. Maybe it is not even junebug585 whose geocities site was used to phish for my account details &#8230; maybe that id was also phished and misused. Maybe it is not even jawsy1@gmail.com where my userid/pass have been mailed &#8230; maybe that id/pass also have been phished?! I wonder who all will receive a message from my id now and be phished!</p>
<p>Imagine the coincidence, I am finicky abt internet security, I was just checking out Google&#8217;s SafeBrowsing and I got phished! &#8220;I took a chance typing my yahoo id, surely I wouldn&#8217;t have taken a chance if the site asked for my bank account-nos/user-ids&#8221; I rationalize. But still &#8230; what if the phisher downloaded all my password reminder mails from my yahoo mailbox??!!</p>
<p>All the best dad!</p>
<p> &#8230; now the painful part of reporting abuse to yahoo and gmail &#8230; </p>
<hr />
<p><b>Update:</b> Looks like I am not the first! &#8230; and looks like google pages are also being used for phishing. <a href="http://www.google.com/search?q=yahoo+geocities+phishing">Google: yahoo geocities phishing</a></p>
<hr />
<p><b>Update 1:</b> Yahoo!&#8217;s soln for phishing?! (via deeps):</p>
<p>&#8212;&#8212;&#8212;- Forwarded message &#8212;&#8212;&#8212;-<br />
From: Kalyan K Kumar<br />
Date: Sep 14, 2006 11:04 AM<br />
Subject: phishing<br />
To: sammelan</p>
<p>keep an eye on those yahoo login look alike geocities links. don&#8217;t enter<br />
yahoo password anywhere<br />
other than login.yahoo.com<br />
you can setup a sign in seal to protect partly.</p>
<p><a href="http://protect.login.yahoo.com/">http://protect.login.yahoo.com/</a></p>
<div id="st2008071622"><script src="http://tellafriend.socialtwist.com:80/wizard/js/shoppr.core.js?id=2008071622"></script><img src="http://tellafriend.socialtwist.com:80/wizard/getButton.jsp?id=2008071622" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '2008071622',  'http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F', 'Got+Phished+%3A%28')" onclick="cw(this, {id:'2008071622',link: 'http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F', title: '+Got+Phished+%3A%28+' })"/></div>


Share: 


	<a rel="nofollow" href="mailto:?subject=Got%20Phished%20%3A%28&amp;body=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F" title="E-mail this story to a friend!"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="del.icio.us"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="description"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F" title="Technorati"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Reddit"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://ma.gnolia.com/bookmarklet/add?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Ma.gnolia"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/magnolia.png" title="Ma.gnolia" alt="Ma.gnolia" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Google"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;=Got%20Phished%20%3A%28" title="YahooMyWeb"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.sphere.com/search?q=sphereit:http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="SphereIt"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/sphere.png" title="SphereIt" alt="SphereIt" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="StumbleUpon"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Digg"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Mixx"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F" title="TwitThis"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;t=Got%20Phished%20%3A%28" title="Furl"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.0xcafefeed.com%2F2006%2F09%2Fgot-phished%2F&amp;title=Got%20Phished%20%3A%28" title="Simpy"><img src="http://www.0xcafefeed.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a>


<br/><br/>
	<strong>Related posts: </strong><br />
	<div class="st-related-posts">
	<a href="http://www.0xcafefeed.com/2004/07/joy-of-separating-style-from-content/" title="The joy of separating style from content! (3 comments), posted on July 10, 2004">The joy of separating style from content!</a><strong> | </strong>
<a href="http://www.0xcafefeed.com/2004/10/colorizing-java-sources-in-browser/" title="Colorizing Java sources in a browser using JavaScript and CSS (8 comments), posted on October 25, 2004">Colorizing Java sources in a browser using JavaScript and CSS</a></div>

<img src="http://feeds.feedburner.com/~r/cafefeed/~4/289633626" height="1" width="1"/>]]></content:encoded><description>I booted my laptop early this morning to get my daily dose of Google alerts. Navigating through the alerts I ended up at: The Museum of Modern Betas and browsing through its entries I chanced upon Google&amp;#8217;s firefox extension for detecting phishing: Safe Browsing. While I was going through their site, I noticed the yahoo [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.0xcafefeed.com/2006/09/got-phished/feed/</wfw:commentRss></item></channel></rss>
