<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ketan&#039;s Musings &#187; experiences</title>
	<atom:link href="http://ketan.padegaonkar.name/category/experiences/feed" rel="self" type="application/rss+xml" />
	<link>http://ketan.padegaonkar.name</link>
	<description>Where he blogs about his eclipse musings</description>
	<lastBuildDate>Fri, 23 Jul 2010 16:03:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Run JRuby From Within A Jar And Package Your Own Gems Along</title>
		<link>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html</link>
		<comments>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html#comments</comments>
		<pubDate>Fri, 10 Apr 2009 03:50:35 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[GNU & Linux]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse-meets-jruby]]></category>
		<category><![CDATA[jruby]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/?p=323</guid>
		<description><![CDATA[Jruby-in a jar already bundles rspec and rake, so the goal was to find out where it gets packaged. Download the jruby source zip, extract it and open the build.xml file, search for &#8220;rspec&#8221; (there&#8217;s two occurences) and you&#8217;ll find that it&#8217;s passed in as an argument to the gem installer, add in another line [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dist.codehaus.org/jruby/1.2.0/jruby-complete-1.2.0.jar">Jruby-in a jar</a> already bundles <a href="http://rspec.info/">rspec</a> and <a href="http://rake.rubyforge.org/">rake</a>, so the goal was to find out where it gets packaged.</p>
<p>Download the <a href="http://dist.codehaus.org/jruby/1.2.0/jruby-src-1.2.0.zip">jruby source zip</a>, extract it and open the build.xml file, search for &#8220;rspec&#8221; (there&#8217;s two occurences) and you&#8217;ll find that it&#8217;s passed in as an argument to the gem installer, add in another line with &#8220;cucumber&#8221;:</p>
<pre>
&lt;target name="install-gems"&gt;
  &lt;property name="jruby.home" value="${basedir}"/&gt;
  &lt;java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true"&gt;
    &lt;classpath refid="build.classpath"/&gt;
    &lt;classpath path="${jruby.classes.dir}"/&gt;
    &lt;sysproperty key="jruby.home" value="${jruby.home}"/&gt;
    &lt;arg value="--command"/&gt;
    &lt;arg value="maybe_install_gems"/&gt;
    &lt;arg value="rspec"/&gt;
    &lt;arg value="rake"/&gt;
    <b>&lt;arg value="cucumber"/&gt; &lt;!-- add cucumber --&gt;</b>
    &lt;arg value="--env-shebang"/&gt;
  &lt;/java&gt;
&lt;/target&gt;
</pre>
<p>Then run ant:</p>
<pre><b>$ ant jar-complete</b></pre>
<p>To verify that everything is fine:</p>
<pre>$ <b>java -jar lib/jruby-complete.jar -S gem list</b>

*** LOCAL GEMS ***

builder (2.1.2)
cucumber (0.2.3)
diff-lcs (1.1.2)
polyglot (0.2.5)
rake (0.8.4)
rspec (1.2.2)
sources (0.0.1)
term-ansicolor (1.0.3)
treetop (1.2.5)</pre>
<p>Great we&#8217;ve now managed to package jruby-in-a-jar with some additional gems. Now to run <a href="http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html">cucumber on jruby in eclipse</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along+-+http://bit.ly/cB0QnT&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;t=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;description=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse and TDD</title>
		<link>http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html</link>
		<comments>http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html#comments</comments>
		<pubDate>Sat, 13 Oct 2007 15:09:22 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html</guid>
		<description><![CDATA[It&#8217;s been after quite a while that I&#8217;m back to doing eclipse plugins. In this span of time I learnt some good techniques &#8212; TDD. It&#8217;s a really good safety check to know that your code is in a working state. Test-first-development or TDD as it is called is where you generally write tests first [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been after quite a while that I&#8217;m back to doing eclipse plugins. In this span of time I learnt some good techniques &#8212; TDD. It&#8217;s a really good safety check to know that your code is in a working state.</p>
<p>Test-first-development or TDD as it is called is where you generally write tests first and then write code that makes these tests pass. This in some ways ensures that you write clean APIs that are simple to test, use and understand. The APIs don&#8217;t really do more that what is needed for the job. So far so good.</p>
<p>The fun began when I moved back to doing eclipse. I now realize that it is difficult to do TDD when I&#8217;m writing code that implements (or extends) some third party interfaces. These implementations return some more interfaces, which only compounds to the problem of test-first-development.</p>
<p>The way I write eclipse plugins is create a null implementation that does nothing at all. It merely prints method names of the methods being called on to the console. I then start off eclipse (in debug mode), understand the sequence in which the interface is invoked, and what eclipse does with the return values (that&#8217;s walking though a lot of code, BTW), I also sometimes need to look at similar implementation to understand what they do. I then gradually implement those methods in a way that what eclipse expects. This gives another meaning to BDD &#8212; breakpoint driven development.</p>
<p>This process is what most developers would probably do when using a framework for the first time. Most frameworks (unlike the eclipse frameworks) are much simpler than eclipse is. There are some known interfaces that are exposed. Since there are very few interfaces to implement, developers gradually get to know them very well. As the expectation out of these interfaces is known well, gradual use of these interfaces, makes it easy to write tests for the interface before implementing the interface itself, which means that developers can move from BDD to TDD.</p>
<p>This process is a quick (and IMO, dirty) way of writing code. The initial code is not written with testability in mind, writing unit tests at the end is quite difficult, and testability can be achieved after quite some bit of refactoring to allow make the code testable.</p>
<p>An example of this is a typical java webapp that consists of some servlets, and jsps containing tag-libs etc. There are very few known interfaces that the clients implement (the HttpServlet, Filter, FilterChain etc.) Since the webapp framework itself is very compact, a framework to unit test the implementations of interfaces exposed by the servlet spec has evolved over a period of time. <a href="http://jakarta.apache.org/cactus/">Cactus</a> is one such example:</p>
<blockquote><p>Cactus is a simple test framework for unit testing server-side java code (Servlets, EJBs, Tag Libs, Filters, &#8230;) [...] It uses JUnit and extends it.</p></blockquote>
<p>To test a servlet one would write a test as:</p>
<pre>public class TestSampleServlet extends ServletTestCase {
  public void testThatServletPrintsHelloWorld(){
    Servlet servlet = new HelloWorldServlet();
    ...
    session.setAttribute("name", "bob");
    ...
    assertTrue("hello, bob", servlet.printHelloWorld());
  }
}</pre>
<p>It is mind boggling to imagine a framework similar to cactus to test the thousands of interfaces exposed by a framework like eclipse, and we are still not talking about the other, &#8220;smaller&#8221; projects under the eclipse umbrella.</p>
<p>Given this scenario, how do you do test-first-development ?</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html&amp;title=Eclipse+and+TDD" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html&amp;title=Eclipse+and+TDD" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Eclipse+and+TDD+-+http://bit.ly/apvyUY&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html&amp;t=Eclipse+and+TDD" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html&amp;title=Eclipse+and+TDD&amp;description=It%27s%20been%20after%20quite%20a%20while%20that%20I%27m%20back%20to%20doing%20eclipse%20plugins.%20In%20this%20span%20of%20time%20I%20learnt%20some%20good%20techniques%20--%20TDD.%20It%27s%20a%20really%20good%20safety%20check%20to%20know%20that%20your%20code%20is%20in%20a%20working%20state.%0A%0ATest-first-development%20or%20TDD%20as%20it%20is%20called%20is%20where%20you%20generally%20write%20tests%20first%20and%20t" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/10/13/eclipse-and-tdd.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Source-opening of open-source ?</title>
		<link>http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html</link>
		<comments>http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html#comments</comments>
		<pubDate>Wed, 05 Sep 2007 06:15:51 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[aptana]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[license]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html</guid>
		<description><![CDATA[zx recently pointed out to this interesting, source-opening of a very popular eclipse based web development tools, Aptana. Could this be a case of an over zealous new management person who&#8217;s at worst ignored his/her devs&#8217; inputs. So what does this mean to me as an eclipse developer ? This change in the licence terms [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mea-bloga.blogspot.com/">zx</a> recently pointed out to this interesting, <a href="http://mea-bloga.blogspot.com/2007/09/source-open.html">source-opening</a> of a very popular eclipse based web development tools, <a href="http://www.aptana.com/">Aptana</a>.</p>
<p>Could this be a case of an over zealous new management person who&#8217;s at worst ignored his/her devs&#8217; inputs.</p>
<h4>So what does this mean to me as an eclipse developer ?</h4>
<p>This change in the licence terms mean that in case I build plugins on top of Aptana, then I need to ask for a <a href="http://www.aptana.com/legal/apl/">licence</a> from Aptana <a href="http://www.aptana.com/forums/viewtopic.php?t=2637&amp;highlight=licence+license">because</a> &#8220;The new license just gives us[Aptana] more visibility into who is redistributing the IDE. We[Aptana] want to keep a very high level of quality, therefore we[Aptana] want to be aware of any redistribution of the IDE, and we[Aptana] ask that if you are going to redistribute, you contact us for a license (free or otherwise).&#8221;</p>
<p>The <a href="http://www.aptana.com/apl_faq.php">license faq</a> makes for an interesting read.</p>
<h4>So what are the implications of this going forward?</h4>
<p>It may mean that the next time I contribute something back to any open source project, I may need to look up as to what may become of my contribution. I contributed my work under EPL, but since the copyright belongs to the company maintaining the project, the company may just decide to change the license terms altogether.</p>
<p>I may also want to investigate who makes such decisions in the company. Is it an aliance of contributors from various companies (like <a href="http://www.osgi.org/">OSGi</a>); is it a foundation like Apache, or Eclipse, or Gentoo that has representatives from a lot of other companies which may put their foot down on such issues ?</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html&amp;title=Source-opening+of+open-source+%3F" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html&amp;title=Source-opening+of+open-source+%3F" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Source-opening+of+open-source+%3F+-+http://bit.ly/cfM2R8&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html&amp;t=Source-opening+of+open-source+%3F" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html&amp;title=Source-opening+of+open-source+%3F&amp;description=zx%20recently%20pointed%20out%20to%20this%20interesting%2C%20source-opening%20of%20a%20very%20popular%20eclipse%20based%20web%20development%20tools%2C%20Aptana.%0A%0ACould%20this%20be%20a%20case%20of%20an%20over%20zealous%20new%20management%20person%20who%27s%20at%20worst%20ignored%20his%2Fher%20devs%27%20inputs.%0A%0ASo%20what%20does%20this%20mean%20to%20me%20as%20an%20eclipse%20developer%20%3F%0A%0AThis%20change%20" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/09/05/source-opening-of-open-source.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flash Player on 64-bit FireFox on Linux</title>
		<link>http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html</link>
		<comments>http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html#comments</comments>
		<pubDate>Wed, 01 Aug 2007 08:37:45 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[GNU & Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash-player]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nspluginwrapper]]></category>
		<category><![CDATA[sun-microsystems]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html</guid>
		<description><![CDATA[Here&#8217;s how to get your firefox running on a 64 bit Linux machine to work with 32 bit plugins. I&#8217;ve tried this with gentoo, it should work with ubuntu or kubuntu or any other distro of your choice. Download and install nspluginwrapper from http://gwenole.beauchesne.info/projects/nspluginwrapper/. For ubuntu, there are some instructions on how to do this [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to get your firefox running on a 64 bit Linux machine to work with 32 bit plugins. I&#8217;ve tried this with gentoo, it should work with ubuntu or kubuntu or any other distro of your choice.</p>
<p>Download and install nspluginwrapper from <a href="http://gwenole.beauchesne.info/projects/nspluginwrapper/">http://gwenole.beauchesne.info/projects/nspluginwrapper/</a>.</p>
<p>For ubuntu, there are some instructions on how to do this here (<a href="http://ubuntuforums.org/showthread.php?t=341727">http://ubuntuforums.org/showthread.php?t=341727</a>). On gentoo I had to
<pre> #emerge nspluginwrapper</pre>
<p>Download the flash installer from the website here: <a href="http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_9_linux.tar.gz">http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_9_linux.tar.gz</a>. Untar the installer:</p>
<pre>$ tar -zxvf install_flash_player_9_linux.tar.gz</pre>
<p>Step into the installer directory:</p>
<pre>cd install_flash_player_9_linux</pre>
<p>Edit the installer file:</p>
<pre>vi flashplayer-installer #use nano or gedit if you like</pre>
<p>Navigate to line 47 (this inside the function exit_cpu) and comment out the line that says exit 1.</p>
<pre># the architecture is not supported
exit_cpu () {
  echo ""
  echo "ERROR: Your architecture, \'$1\', is not supported by the"
  echo "       $PRODUCT installer."
  echo ""
  #exit 1   # this was line 47
}</pre>
<p>Install the flash plugin, I used the default paths, you can choose the paths according to what you have on your computer (I used /home/ketan/.mozilla)</p>
<pre>./flashplayer-installer</pre>
<p>Now verify that the plugin actually got installed in the directory that you specified</p>
<pre>$ ls /home/ketan/.mozilla/plugins</pre>
<p>Use nspluginwrapper to create a 64-bit wrapper around this 32 bit plugin. (thanks to <a href="#comment-1037">Lance</a> for a typo update)</p>
<pre>$ nspluginwrapper -i /home/ketan/.mozilla/plugins/libflashplayer.so</pre>
<p>Now restart firefox, that should get you to run firefox with flash player.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html&amp;title=Flash+Player+on+64-bit+FireFox+on+Linux" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html&amp;title=Flash+Player+on+64-bit+FireFox+on+Linux" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Flash+Player+on+64-bit+FireFox+on+Linux+-+http://bit.ly/cP1lhn&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html&amp;t=Flash+Player+on+64-bit+FireFox+on+Linux" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html&amp;title=Flash+Player+on+64-bit+FireFox+on+Linux&amp;description=Here%27s%20how%20to%20get%20your%20firefox%20running%20on%20a%2064%20bit%20Linux%20machine%20to%20work%20with%2032%20bit%20plugins.%20I%27ve%20tried%20this%20with%20gentoo%2C%20it%20should%20work%20with%20ubuntu%20or%20kubuntu%20or%20any%20other%20distro%20of%20your%20choice.%0A%0ADownload%20and%20install%20nspluginwrapper%20from%20http%3A%2F%2Fgwenole.beauchesne.info%2Fprojects%2Fnspluginwrapper%2F.%0A%0AF" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/08/01/flash-player-on-64-bit-firefox-on-linux.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Composite Logger for Ant</title>
		<link>http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html</link>
		<comments>http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html#comments</comments>
		<pubDate>Wed, 04 Apr 2007 13:54:36 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html</guid>
		<description><![CDATA[When doing long builds in CruiseControl, ant build logs are generally logged using the XmlLogger. In certain cases, say for example when the build is taking longer than usual, and needs to be killed/stopped, the XmlLogger does not flush contents to disk. It would be nice if there is some sort of a composite logger [...]]]></description>
			<content:encoded><![CDATA[<p>When doing long builds in CruiseControl, ant build logs are generally logged using the XmlLogger.</p>
<p>In certain cases, say for example when the build is taking longer than usual, and needs to be killed/stopped, the XmlLogger does not flush contents to disk.</p>
<p>It would be nice if there is some sort of a composite logger than can chain any logger along with the XmlLogger.</p>
<p>I just happened to write one sometime today. This is the source code for a CompositeLogger that logs to a default logger, and the XmlLogger. This needs the environment variable ANT_LOG_PREFIX to be set (there&#8217;s no better way I can think of)</p>
<pre>
package com.thoughtworks.ant.logger;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;

import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.XmlLogger;

/**
 * @author Ketan Padegaonkar
 */
public class CompositeAntLogger implements BuildLogger {

        private ArrayList       loggers;
        private String          logPrefix;
        private PrintStream     out;

        public CompositeAntLogger() {
                checkLogPrefix();
                createLoggers();
        }

        public void setEmacsMode(boolean emacsMode) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.setEmacsMode(emacsMode);
                }
        }

        public void buildFinished(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.buildFinished(event);
                }
        }

        public void buildStarted(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.buildStarted(event);
                }
        }

        public void messageLogged(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.messageLogged(event);
                }

        }

        public void targetFinished(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.targetFinished(event);
                }
        }

        public void targetStarted(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.targetStarted(event);
                }
        }

        public void taskFinished(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.taskFinished(event);
                }
        }

        public void taskStarted(BuildEvent event) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.taskStarted(event);
                }
        }

        public void setMessageOutputLevel(int level) {
                for (Iterator iterator = loggers.iterator(); iterator.hasNext();) {
                        BuildLogger logger = (BuildLogger) iterator.next();
                        logger.setMessageOutputLevel(level);
                }
        }

        public void setOutputPrintStream(PrintStream output) {
                // do nothing
        }

        public void setErrorPrintStream(PrintStream err) {
                // do nothing
        }

        private void createLoggers() {
                loggers = new ArrayList();
                try {
                        loggers.add(createDefaultLogger());
                        loggers.add(createXmlLogger());
                } catch (FileNotFoundException e) {
                        throw new BuildException("The loggers could not open the file", e);
                }
        }

        private void checkLogPrefix() {
                logPrefix = System.getenv("ANT_LOG_PREFIX");
                if (logPrefix == null || logPrefix.trim().length() == 0)
                        throw new BuildException("You need to set the environment variable ANT_LOG_PREFIX.");
        }

        private DefaultLogger createDefaultLogger() throws FileNotFoundException {
                DefaultLogger logger = new DefaultLogger();
                out = new PrintStream(new FileOutputStream(logPrefix + ".txt"));
                logger.setOutputPrintStream(out);
                logger.setErrorPrintStream(out);
                return logger;
        }

        private XmlLogger createXmlLogger() throws FileNotFoundException {
                XmlLogger logger = new XmlLogger();
                out = new PrintStream(new FileOutputStream(logPrefix + ".xml"));
                logger.setOutputPrintStream(out);
                logger.setErrorPrintStream(out);
                return logger;
        }
}
</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html&amp;title=Composite+Logger+for+Ant" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html&amp;title=Composite+Logger+for+Ant" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Composite+Logger+for+Ant+-+http://bit.ly/b8opeL&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html&amp;t=Composite+Logger+for+Ant" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html&amp;title=Composite+Logger+for+Ant&amp;description=When%20doing%20long%20builds%20in%20CruiseControl%2C%20ant%20build%20logs%20are%20generally%20logged%20using%20the%20XmlLogger.%0A%0AIn%20certain%20cases%2C%20say%20for%20example%20when%20the%20build%20is%20taking%20longer%20than%20usual%2C%20and%20needs%20to%20be%20killed%2Fstopped%2C%20the%20XmlLogger%20does%20not%20flush%20contents%20to%20disk.%0A%0AIt%20would%20be%20nice%20if%20there%20is%20some%20sort%20of%20a" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/04/04/composite-logger-for-ant.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Lotus Notes beta 8, and Eclipse</title>
		<link>http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html</link>
		<comments>http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html#comments</comments>
		<pubDate>Fri, 23 Mar 2007 04:31:07 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[lotus_notes]]></category>
		<category><![CDATA[osgi]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html</guid>
		<description><![CDATA[I saw this post by ZX on Lotus Notes 8 based on the Eclipse platform. ZX says: &#8230; In the end, this is great news for Eclipse which now gets to interact with a whole new set of users and developers. Eclipse (OSGi) on clients&#8230; devices&#8230; servers&#8230; , what&#8217;s next? &#8230; OSGi is great on [...]]]></description>
			<content:encoded><![CDATA[<p>I saw <a href="http://mea-bloga.blogspot.com/2007/03/eclipse-and-lotus-notes.html">this post</a> by <a href="http://mea-bloga.blogspot.com">ZX</a> on <a href="http://lotus.com">Lotus Notes</a> 8 based on the <a href="http://eclipse.org">Eclipse</a> platform.</p>
<p>ZX says:</p>
<blockquote><p>
&#8230;<br />
In the end, this is great news for Eclipse which now gets to interact with a whole new set of users and developers.</p>
<p>Eclipse (OSGi) on clients&#8230; devices&#8230; servers&#8230; , what&#8217;s next?<br />
&#8230;
</p></blockquote>
<p>OSGi is great on my desktop, laptop, servers, even mobile phones. But lotus notes based on OSGi ? I&#8217;m a die hard Eclipse fan and developer. But when it comes to usability of the software that I have to use everyday I&#8217;m a tough guy to convince.</p>
<p>For another potshot at this installer (for now) it is about 673 MB, is packaged as a .tar (Anyone at IBM lotus notes packaging team heard about something called as gzip/bzip2?) The documentation (which is about a total of 3MB) comes as a separate download. While it is a good idea to package the documentation separately I wonder if the installer comes with some documentation.</p>
<p>I just hope that I do not have to go through all these <a href="http://ketan.padegaonkar.name/2007/03/07/howto-installing-lotus-notes-70-on-ubuntu.html">pains</a> and <a href="http://ketan.padegaonkar.name/2007/03/08/musings-on-installing-lotus-notes-70.html">musings</a> and <a href="http://ketan.padegaonkar.name/2007/03/22/some-more-rants-on-lotus-notes-70-on-ubuntu.html">some more pains</a> to install Lotus Notes 8. Especially after downloading something that is 673 MB.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html&amp;title=Lotus+Notes+beta+8%2C+and+Eclipse" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html&amp;title=Lotus+Notes+beta+8%2C+and+Eclipse" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Lotus+Notes+beta+8%2C+and+Eclipse+-+http://bit.ly/a9xTZM&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html&amp;t=Lotus+Notes+beta+8%2C+and+Eclipse" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html&amp;title=Lotus+Notes+beta+8%2C+and+Eclipse&amp;description=I%20saw%20this%20post%20by%20ZX%20on%20Lotus%20Notes%208%20based%20on%20the%20Eclipse%20platform.%0A%0AZX%20says%3A%0A%0A...%0AIn%20the%20end%2C%20this%20is%20great%20news%20for%20Eclipse%20which%20now%20gets%20to%20interact%20with%20a%20whole%20new%20set%20of%20users%20and%20developers.%0A%0AEclipse%20%28OSGi%29%20on%20clients...%20devices...%20servers...%20%2C%20what%27s%20next%3F%0A...%0A%0A%0AOSGi%20is%20great%20on%20my%20deskto" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/03/23/lotus-notes-beta-8-and-eclipse.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SVNAnt: Using ant with SVN</title>
		<link>http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html</link>
		<comments>http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html#comments</comments>
		<pubDate>Tue, 13 Mar 2007 14:40:47 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[SVNAnt]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html</guid>
		<description><![CDATA[While working on some ant build scripts today. A lot of custom batch files that were being exec&#8217;ed from within ant builds; batch files that would perform svn updates, reverts and commits, among other svn actions. A good alternative would be to use SVNAnt (some snippets follow): &#60;svn&#62; &#60;delete&#62; &#60;fileset dir="workingcopy/deleteTest"&#62; &#60;include name="**/*.del"/&#62; &#60;/fileset&#62; &#60;/delete&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>While working on some ant build scripts today. A lot of custom batch files that were being exec&#8217;ed from within ant builds; batch files that would perform svn updates, reverts and commits, among other svn actions.</p>
<p>A good alternative would be to use <a href="http://subclipse.tigris.org/svnant/">SVNAnt</a> (some snippets follow):</p>
<pre>
&lt;svn&gt;
  &lt;delete&gt;
    &lt;fileset dir="workingcopy/deleteTest"&gt;
      &lt;include name="**/*.del"/&gt;
    &lt;/fileset&gt;
  &lt;/delete&gt;
  &lt;commit message="commit deleted files"
       dir="workingcopy/deleteTest"/&gt;
&lt;/svn&gt;
</pre>
<pre>
&lt;svn&gt;
  &lt;update dir="dir/to/update/" recurse="true" /&gt;
&lt;/svn&gt;
</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html&amp;title=SVNAnt%3A+Using+ant+with+SVN" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html&amp;title=SVNAnt%3A+Using+ant+with+SVN" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+SVNAnt%3A+Using+ant+with+SVN+-+http://bit.ly/aHmXyn&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html&amp;t=SVNAnt%3A+Using+ant+with+SVN" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html&amp;title=SVNAnt%3A+Using+ant+with+SVN&amp;description=While%20working%20on%20some%20ant%20build%20scripts%20today.%20A%20lot%20of%20custom%20batch%20files%20that%20were%20being%20exec%27ed%20from%20within%20ant%20builds%3B%20batch%20files%20that%20would%20perform%20svn%20updates%2C%20reverts%20and%20commits%2C%20among%20other%20svn%20actions.%0A%0AA%20good%20alternative%20would%20be%20to%20use%20SVNAnt%20%28some%20snippets%20follow%29%3A%0A%0A%0A%26lt%3Bsvn%26gt%3B%0A%20%20%26lt%3B" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/03/13/svnant-using-ant-with-svn.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overriding equals and hashCode in Eclipse</title>
		<link>http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html</link>
		<comments>http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html#comments</comments>
		<pubDate>Thu, 01 Mar 2007 14:15:57 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse-3.html</guid>
		<description><![CDATA[Most colleagues use IntelliJ Idea as their favorite Java IDE. I&#8217;m an Eclipse plugin developer, and Eclipse happens to be my favorite Development platform of choice. A lot more that just once, I&#8217;ve seen peers curse Eclipse for the lack of keyboard support, lack of refactoring, lack of functionality, lack of blah, blah, blah&#8230; Let [...]]]></description>
			<content:encoded><![CDATA[<p>Most colleagues use IntelliJ Idea as their favorite Java IDE. I&#8217;m an Eclipse plugin developer, and Eclipse happens to be my favorite Development platform of choice.</p>
<p>A lot more that just once, I&#8217;ve seen peers curse Eclipse for the lack of keyboard support, lack of refactoring, lack of functionality, lack of blah, blah, blah&#8230;</p>
<p>Let me address some of these issues:<br />
<span id="more-144"></span></p>
<h4>Lack of Keyboard Support</h4>
<p>Most IntelliJ idea users I&#8217;ve seen <i>never</i> touch the mouse. They can do most development using the keyboard: navigating, refactoring, writing code. It is amazing how good IntelliJ is at increasing productivity.</p>
<p>That said, Eclipse is definitely something that can be compared to IntelliJ on this front. Eclipse supports emacs keybindings, and I&#8217;ve seen people use emacs keybindings to do all the things that I&#8217;ve mentioned above.</p>
<p>It&#8217;s merely a matter of learning new keybindings, or configuring existing ones to suit their needs.</p>
<h4>Lack of Refactoring Support</h4>
<p>The refactoring support in Eclipse is as good as that on IntelliJ. Most folks have not used (much of) Eclipse and I feel that this particular point holds no relevance.</p>
<h4>Lack of Functionality</h4>
<p>Part of this blame also goes to me. There&#8217;s a whole lot of functionality that is available, that I&#8217;ve myself never used. I&#8217;m unable to point out out some functionality that exists in IntelliJ, but is not &#8220;easily&#8221; seen on Eclipse <img src='http://ketan.padegaonkar.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>A point in case is being able to override equals() and hashCode(). During a training session this morning, we had to create a class that overrides equals() and hashCode(). I&#8217;d almost never had to write these, so I began the tremendous task of hand coding these methods. Later I decided to write an eclipse plugin <img src='http://ketan.padegaonkar.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Later in the evening, I realized that this feature already existed <img src='http://ketan.padegaonkar.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href='http://ketan.padegaonkar.name/files/2007/03/overrideequalsandhashcode.png' title='OverrideEqualsAndHashCode'><img src='http://ketan.padegaonkar.name/files/2007/03/overrideequalsandhashcode.png' alt='OverrideEqualsAndHashCode' /></a></p>
<p><a href='http://ketan.padegaonkar.name/files/2007/03/overrideequalsandhashcode-dialog.png' title='OverrideEqualsAndHashCode-dialog'><img src='http://ketan.padegaonkar.name/files/2007/03/overrideequalsandhashcode-dialog.png' alt='OverrideEqualsAndHashCode-dialog' /></a></p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html&amp;title=Overriding+equals+and+hashCode+in+Eclipse" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html&amp;title=Overriding+equals+and+hashCode+in+Eclipse" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Overriding+equals+and+hashCode+in+Eclipse+-+http://bit.ly/bwJX0C&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html&amp;t=Overriding+equals+and+hashCode+in+Eclipse" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html&amp;title=Overriding+equals+and+hashCode+in+Eclipse&amp;description=Most%20colleagues%20use%20IntelliJ%20Idea%20as%20their%20favorite%20Java%20IDE.%20I%27m%20an%20Eclipse%20plugin%20developer%2C%20and%20Eclipse%20happens%20to%20be%20my%20favorite%20Development%20platform%20of%20choice.%0A%0AA%20lot%20more%20that%20just%20once%2C%20I%27ve%20seen%20peers%20curse%20Eclipse%20for%20the%20lack%20of%20keyboard%20support%2C%20lack%20of%20refactoring%2C%20lack%20of%20functionality%2C" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/03/01/overriding-equals-and-hashcode-in-eclipse.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fighting Spam</title>
		<link>http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html</link>
		<comments>http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html#comments</comments>
		<pubDate>Mon, 19 Feb 2007 12:42:49 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[experiences]]></category>
		<category><![CDATA[askimet]]></category>
		<category><![CDATA[comment-spam]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html</guid>
		<description><![CDATA[I recently enabled comments on my blog. Ever since this has happened, there&#8217;s been a whole lot of spam comments that I&#8217;ve had to delete. Unfortunately my web host does not allow external connections, so using a service like askimet seems to be out of question. So how do I stop spam comments from being [...]]]></description>
			<content:encoded><![CDATA[<p>I recently enabled comments on my blog. Ever since this has happened, there&#8217;s been a whole lot of spam comments that I&#8217;ve had to delete.</p>
<p>Unfortunately my web host does not allow external connections, so using a service like <a href="http://akismet.com/">askimet</a> seems to be out of question.</p>
<p>So how do I stop spam comments from being entered in my site ?</p>
<p><a href="http://en.wikipedia.org/wiki/Captcha">Captcha</a>? Naah&#8230; It&#8217;s way too unreadable for most users.<br /><a href="http://www.herod.net/dypm/">Simple math</a>? Yeah&#8230; It restricts comment spam by throwing the commenter a simple math question.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html&amp;title=Fighting+Spam" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html&amp;title=Fighting+Spam" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+Fighting+Spam+-+http://bit.ly/9PQdom&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html&amp;t=Fighting+Spam" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html&amp;title=Fighting+Spam&amp;description=I%20recently%20enabled%20comments%20on%20my%20blog.%20Ever%20since%20this%20has%20happened%2C%20there%27s%20been%20a%20whole%20lot%20of%20spam%20comments%20that%20I%27ve%20had%20to%20delete.Unfortunately%20my%20web%20host%20does%20not%20allow%20external%20connections%2C%20so%20using%20a%20service%20like%20askimet%20seems%20to%20be%20out%20of%20question.So%20how%20do%20I%20stop%20spam%20comments%20from%20being" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/02/19/fighting-spam.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How would you clean this up ?</title>
		<link>http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html</link>
		<comments>http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html#comments</comments>
		<pubDate>Wed, 14 Feb 2007 07:44:45 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[experiences]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Object-Oriented]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html</guid>
		<description><![CDATA[This was an interesting piece of code from a long time mentor and friend. He&#8217;s just started to learn Java some time ago, and has written this program to demonstrate how to draw an Ellipse. He&#8217;s about 60 years of age. Has been a long time Turbo C-2.0 programmer. Mostly he develops small graphics programs [...]]]></description>
			<content:encoded><![CDATA[<p>This was an interesting piece of code from a long time mentor and friend. He&#8217;s just started to learn Java some time ago, and has written this program to demonstrate how to draw an <a href="http://en.wikipedia.org/wiki/Ellipse">Ellipse</a>.</p>
<p>He&#8217;s about 60 years of age. Has been a long time Turbo C-2.0 programmer. Mostly he develops small graphics programs to demonstrate some engineering drawing and mechanics concepts.</p>
<pre>
<font color="#a020f0">import</font> java.awt.*; <font color="#0000ff">// Requisite files od JAVA</font>
<font color="#a020f0">import</font> java.awt.event.*;
<font color="#0000ff">//import java.awt.geom.*;</font>
<font color="#a020f0">import</font> javax.swing.*;
<font color="#0000ff">//import java.math.*;</font>
<font color="#0000ff">//import java.util.*;</font>
  <font color="#0000ff">//Projest name and the following class name should be same</font>
<font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>class</b></font> leenaTrial1 <font color="#2e8b57"><b>extends</b></font> JFrame {
        JFrame frame = <font color="#804040"><b>new</b></font> JFrame(<font color="#ff00ff">&quot;Applet&quot;</font>);
        JPanel drawingArea = <font color="#804040"><b>new</b></font> JPanel(); <font color="#0000ff">// Drawing Area is named</font>
        JButton b1; <font color="#0000ff">// Defines action Button</font>
        <font color="#2e8b57"><b>int</b></font> mouse_i = <font color="#ff00ff">1</font>;  <font color="#0000ff">// Counter for action</font>

        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> run() {
                frame.setSize(<font color="#ff00ff">1000</font>, <font color="#ff00ff">500</font>); <font color="#0000ff">// Frame size is defined</font>
                <font color="#2e8b57"><b>final</b></font> Container content = getContentPane();
                content.setBackground(Color.lightGray);
                <font color="#0000ff">// color of frame or container is defined</font>
                content.setLayout(<font color="#804040"><b>new</b></font> FlowLayout());

                drawingArea.setPreferredSize(<font color="#804040"><b>new</b></font> Dimension(<font color="#ff00ff">750</font>, <font color="#ff00ff">700</font>));
                <font color="#0000ff">// Size of draw area is defined &amp; color in the next line</font>

                drawingArea.setBackground(Color.black);
                content.add(drawingArea);
                b1 = <font color="#804040"><b>new</b></font> JButton(<font color="#ff00ff">&quot;Next Step&quot;</font>); <font color="#0000ff">// b1 is button for the next step</font>
                content.add(b1);

                b1.addActionListener(<font color="#804040"><b>new</b></font> ActionListener() {
                <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> actionPerformed(ActionEvent event) {
                        Graphics g = drawingArea.getGraphics();
                        Font font20 =<font color="#804040"><b>new</b></font> Font(<font color="#ff00ff">&quot;TimesRoman&quot;</font>,Font.PLAIN,<font color="#ff00ff">20</font>);
                        Font f0nt14=<font color="#804040"><b>new</b></font> Font(<font color="#ff00ff">&quot;TimesRoman&quot;</font>,Font.PLAIN,<font color="#ff00ff">14</font>);
                        g.setFont(font20);
                        <font color="#2e8b57"><b>int</b></font> r1 = <font color="#ff00ff">250</font>, r2 = <font color="#ff00ff">150</font>, x0 = <font color="#ff00ff">375</font>, y0 = <font color="#ff00ff">415</font>;
                        <font color="#0000ff">// r1, r2 semi-major &amp; semi-minor axex, x0,y0 center of circles</font>
                        <font color="#2e8b57"><b>double</b></font> inc = <font color="#ff00ff">0.005</font>; <font color="#0000ff">// increment </font>
                        <font color="#2e8b57"><b>int</b></font> x1, y1, x2, y2; <font color="#0000ff">// Two ends of a line</font>

                        <font color="#0000ff">// inner circle in </font>
                        <font color="#804040"><b>if</b></font>(mouse_i == <font color="#ff00ff">1</font>) {
                                g.setColor(Color.white);
                                <font color="#0000ff">//g.drawOval(w, w, x, y);           // top, left, width, height</font>
                                g.drawString(<font color="#ff00ff">&quot;Step 1: Draw inner circle with the radius equal to semi-minor axis of the ellipse.&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">20</font>);
                                ovalByPixels(x0,y0,r2,r2,<font color="#ff00ff">1</font>,Color.blue);
                     }

                        <font color="#0000ff">// outer circle</font>
                         <font color="#804040"><b>if</b></font>(mouse_i == <font color="#ff00ff">2</font>) {
                                g.setColor(Color.white);
                                g.drawString(<font color="#ff00ff">&quot;Step 2: Draw outer circle with the radius equal to semi-major axis of the ellipse.&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">35</font>);
                                ovalByPixels(x0,y0,r1,r1,<font color="#ff00ff">1</font>,Color.red); <font color="#0000ff">// Color spesified by name</font>
                        }

                        <font color="#0000ff">// twelve lines</font>
                         <font color="#804040"><b>if</b></font>(mouse_i == <font color="#ff00ff">3</font>) {
                                g.setColor(Color.white);
                                g.drawString(<font color="#ff00ff">&quot;Step 3: Divide the circles in twelve parts.&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">50</font>);
                                <font color="#804040"><b>for</b></font>(<font color="#2e8b57"><b>int</b></font> k = <font color="#ff00ff">0</font>; k &lt; <font color="#ff00ff">6</font>; k++) {
                                        <font color="#2e8b57"><b>double</b></font> cos = Math.cos(k*<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>);
                                        <font color="#2e8b57"><b>double</b></font> sin = Math.sin(k*<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>);
                                        <font color="#2e8b57"><b>double</b></font> f1 = <font color="#ff00ff">1.06</font> ; <font color="#0000ff">// numbers are printed out side of larger circle</font>
                                        <font color="#2e8b57"><b>double</b></font> f2 = <font color="#ff00ff">0.9</font> ; <font color="#0000ff">// numbers are printed in side of smaller circle</font>
                                        x1 = x0 + (<font color="#2e8b57"><b>int</b></font>)(r1*cos); <font color="#0000ff">// x1,y1 are on outer circle on one end of diameter</font>
                                        y1 = y0 - (<font color="#2e8b57"><b>int</b></font>)(r1*sin);
                                        x2 = x0 - (<font color="#2e8b57"><b>int</b></font>)(r1*cos); <font color="#0000ff">// x2,y2 are on outer circle at other end of diameter</font>
                                        y2 = y0 + (<font color="#2e8b57"><b>int</b></font>)(r1*sin);
                                        lineByPixels(x1, y1, x2, y2,<font color="#ff00ff">5</font>,<font color="#804040"><b>new</b></font> Color(<font color="#ff00ff">255</font>,<font color="#ff00ff">100</font>,<font color="#ff00ff">100</font>)); <font color="#0000ff">// 5 is delay value</font>
                                        <font color="#0000ff">// Color spesified by values of three colors</font>
                                        g.drawString(<font color="#ff00ff">&quot;a&quot;</font> + Integer.toString(k+<font color="#ff00ff">1</font>),  x0-<font color="#ff00ff">10</font>+ (<font color="#2e8b57"><b>int</b></font>)(f1*r1*cos), y0+<font color="#ff00ff">10</font> - (<font color="#2e8b57"><b>int</b></font>)(f1*r1*sin));
                                        g.drawString(<font color="#ff00ff">&quot;a&quot;</font> + Integer.toString(k+<font color="#ff00ff">7</font>),  x0-<font color="#ff00ff">10</font> - (<font color="#2e8b57"><b>int</b></font>)(f1*r1*cos), y0+<font color="#ff00ff">10</font> + (<font color="#2e8b57"><b>int</b></font>)(f1*r1*sin));
                                        g.drawString(<font color="#ff00ff">&quot;b&quot;</font> + Integer.toString(k+<font color="#ff00ff">1</font>),  x0 -<font color="#ff00ff">10</font>+ (<font color="#2e8b57"><b>int</b></font>)(f2*r2*cos), y0+<font color="#ff00ff">10</font> - (<font color="#2e8b57"><b>int</b></font>)(f2*r2*sin));
                                        g.drawString(<font color="#ff00ff">&quot;b&quot;</font> + Integer.toString(k+<font color="#ff00ff">7</font>),  x0 -<font color="#ff00ff">10</font>- (<font color="#2e8b57"><b>int</b></font>)(f2*r2*cos), y0+<font color="#ff00ff">10</font> + (<font color="#2e8b57"><b>int</b></font>)(f2*r2*sin));
                                        delay(<font color="#ff00ff">500</font>);        <font color="#0000ff">// call delay function         </font>
                                }
                        }

                         <font color="#804040"><b>if</b></font>(mouse_i == <font color="#ff00ff">4</font>) { <font color="#0000ff">// Step 4     * * * * * * * * * * *</font>
                                g.setColor(Color.white);
                                g.drawString(<font color="#ff00ff">&quot;Step 4: From inner circle points, draw horizontal lines and from corresponding points &quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">70</font>);
                                g.drawString(<font color="#ff00ff">&quot;         on the outer circle, draw vertical lines. Cutting points are points on Ellipse.&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">85</font>);
                                Color cr = <font color="#804040"><b>new</b></font> Color(<font color="#ff00ff">255</font>,<font color="#ff00ff">200</font>,<font color="#ff00ff">100</font>);
                                <font color="#804040"><b>for</b></font>(<font color="#2e8b57"><b>int</b></font> k = <font color="#ff00ff">0</font>; k &lt;= <font color="#ff00ff">11</font>; k++) {
                                        <font color="#0000ff">//int x1,x2,y1,y2;</font>
                                        x1 = x0 + (<font color="#2e8b57"><b>int</b></font>)(r1*Math.cos((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k)); <font color="#0000ff">// point on outer circle</font>
                                        y1 = y0 - (<font color="#2e8b57"><b>int</b></font>)(r1*Math.sin((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k));
                                        x2 = x0 + (<font color="#2e8b57"><b>int</b></font>)(r2*Math.cos((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k)); <font color="#0000ff">//points on inner circle</font>
                                        y2 = y0 - (<font color="#2e8b57"><b>int</b></font>)(r2*Math.sin((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k));
                                        <font color="#2e8b57"><b>int</b></font> x1L = x0 + (<font color="#2e8b57"><b>int</b></font>)(<font color="#ff00ff">1.2</font>*r1*Math.cos((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k)); <font color="#0000ff">// point on outer circle</font>
                                        <font color="#2e8b57"><b>int</b></font> y2L = y0 - (<font color="#2e8b57"><b>int</b></font>)(<font color="#ff00ff">0.9</font>*r2*Math.sin((<font color="#ff00ff">2</font>*Math.PI/<font color="#ff00ff">12</font>)*k));
                                        g.setColor(Color.green);
                                        <font color="#804040"><b>if</b></font>(k==<font color="#ff00ff">3</font> || k==<font color="#ff00ff">9</font>){
                                                lineByPixels(x0-<font color="#ff00ff">20</font>, y2, x0+<font color="#ff00ff">20</font>, y2,<font color="#ff00ff">5</font>,cr );}<font color="#0000ff">// 5 is delay value</font>
                           <font color="#0000ff">//g.drawLine( x0-20, y2, x0+20, y2);}</font>
                                        <font color="#804040"><b>else</b></font>{
                                                lineByPixels(x2, y2, x1L, y2,<font color="#ff00ff">5</font>,<font color="#804040"><b>new</b></font> Color(<font color="#ff00ff">255</font>,<font color="#ff00ff">100</font>,<font color="#ff00ff">200</font>));}
                                                <font color="#0000ff">//g.drawLine(x2, y2, x1L, y2);} // horizontal line</font>
                                        g.setColor(Color.yellow);
                                        <font color="#804040"><b>if</b></font>(k==<font color="#ff00ff">0</font> || k==<font color="#ff00ff">6</font>){
                                                lineByPixels(x1, y0-<font color="#ff00ff">20</font>, x1,  y0+<font color="#ff00ff">20</font>,<font color="#ff00ff">5</font>,<font color="#804040"><b>new</b></font> Color(<font color="#ff00ff">100</font>,<font color="#ff00ff">100</font>,<font color="#ff00ff">200</font>));}
                                                <font color="#0000ff">//g.drawLine(x1, y0-20, x1,  y0+20);}// Vertical line</font>
                                        <font color="#804040"><b>else</b></font> {
                                                lineByPixels(x1, y1, x1, y2L,<font color="#ff00ff">5</font>,<font color="#804040"><b>new</b></font> Color(<font color="#ff00ff">100</font>,<font color="#ff00ff">255</font>,<font color="#ff00ff">100</font>));}
                                                <font color="#0000ff">//g.drawLine(x1, y1, x1, y2L);}// vertical line</font>
                                        delay(<font color="#ff00ff">500</font>); <font color="#0000ff">// call delay function         </font>
                                        g.setColor(Color.white);
                                        g.drawOval(x1-<font color="#ff00ff">3</font>, y2-<font color="#ff00ff">3</font>, <font color="#ff00ff">6</font>, <font color="#ff00ff">6</font>); <font color="#0000ff">// Box (top, left, width, height</font>
                    delay(<font color="#ff00ff">500</font>);
                                }
                        }

                        <font color="#804040"><b>if</b></font>(mouse_i == <font color="#ff00ff">5</font>) {
                                g.setColor(Color.white);
                                g.drawString(<font color="#ff00ff">&quot;Step 5: Draw a smooth curve connecting the twelve cutting points.&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">100</font>);
                                g.setColor(Color.RED);
                                <font color="#804040"><b>for</b></font>(<font color="#2e8b57"><b>double</b></font> i = <font color="#ff00ff">0</font>; i &lt; <font color="#ff00ff">2</font>*(<font color="#ff00ff">3.1415926</font>); i=i+inc) {
                                        g.drawLine((<font color="#2e8b57"><b>int</b></font>)(x0+r1*Math.cos(i)), (<font color="#2e8b57"><b>int</b></font>)(y0-r2*Math.sin(i)), (<font color="#2e8b57"><b>int</b></font>)(x0+(r1+<font color="#ff00ff">1</font>)*Math.cos(i)), (<font color="#2e8b57"><b>int</b></font>)(y0-(r2+<font color="#ff00ff">1</font>)*Math.sin(i)));
                                        delay(<font color="#ff00ff">1</font>); <font color="#0000ff">// calls delay function</font>

                                } <font color="#0000ff">// Ellipse drawing is complete</font>

                                g.drawString(<font color="#ff00ff">&quot;Ellipse by Concentric Circles, by Dr. Vasant D. Barve&quot;</font>, <font color="#ff00ff">20</font>, <font color="#ff00ff">680</font>);
                                g.drawString(<font color="#ff00ff">&quot;DONE!&quot;</font>, <font color="#ff00ff">670</font>, <font color="#ff00ff">350</font>);
                        }
                        mouse_i++;
                 }
                });

                pack();
                setVisible(<font color="#ff00ff">true</font>);
        }
    <font color="#0000ff">// This is delay procedure  </font>
        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> delay(<font color="#2e8b57"><b>int</b></font> dt1)
        {
                <font color="#804040"><b>try</b></font> {
                        Thread.sleep(dt1);
                }
                <font color="#804040"><b>catch</b></font> (InterruptedException e) {
                }
        } <font color="#0000ff">// Delay procedure ends</font>

    <font color="#0000ff">// This is Oval (circle or ellipse) by pixel procedure   * * * * * * * * * * * * * * *      </font>
        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> ovalByPixels(<font color="#2e8b57"><b>float</b></font> x0, <font color="#2e8b57"><b>float</b></font> y0, <font color="#2e8b57"><b>float</b></font> r1, <font color="#2e8b57"><b>float</b></font> r2, <font color="#2e8b57"><b>int</b></font> dt, Color objColor)
        {   <font color="#0000ff">// Center of circle at x0,y0 Radius r dt delay after each pixel counterclckwise</font>
                Graphics g = drawingArea.getGraphics();
                <font color="#2e8b57"><b>double</b></font> rm = Math.max(r1, r2); <font color="#0000ff">// Greater of the two picked up</font>
                <font color="#804040"><b>for</b></font>(<font color="#2e8b57"><b>double</b></font> i = <font color="#ff00ff">0</font>; i &lt; <font color="#ff00ff">2</font>*(<font color="#ff00ff">3.1415926</font>); i=i+<font color="#ff00ff">1</font>/rm) {
                        <font color="#2e8b57"><b>double</b></font> x1 = x0+ r1*Math.cos(i);
                        <font color="#2e8b57"><b>double</b></font> y1 = y0+r2*Math.sin(i);
                        <font color="#2e8b57"><b>double</b></font> x2 = x0+(r1+<font color="#ff00ff">1</font>)*Math.cos(i);
                        <font color="#2e8b57"><b>double</b></font> y2 = y0+(r2+<font color="#ff00ff">1</font>)*Math.sin(i);
                        g.setColor(objColor);
                        g.drawLine((<font color="#2e8b57"><b>int</b></font>)x1, (<font color="#2e8b57"><b>int</b></font>)y1, (<font color="#2e8b57"><b>int</b></font>)x2, (<font color="#2e8b57"><b>int</b></font>)y2);
                        delay(dt); <font color="#0000ff">// call delay function    </font>
                }
        } <font color="#0000ff">// OvalByPixels procedure Ends</font>

<font color="#0000ff">//       lineByPixels Procedure starts              * * * * * *  * * * * *</font>
        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> lineByPixels(<font color="#2e8b57"><b>int</b></font> x1, <font color="#2e8b57"><b>int</b></font> y1, <font color="#2e8b57"><b>int</b></font> x2, <font color="#2e8b57"><b>int</b></font> y2, <font color="#2e8b57"><b>int</b></font> dt,Color objCol ) {
                <font color="#0000ff">// Line starts at (x1,y1) &amp; ends at (x2,y2) each point is drawn as short line of one pixel length</font>
                Graphics g = drawingArea.getGraphics();
                <font color="#0000ff">//g.setColor(Color.white); </font>
                g.setColor(objCol);

                <font color="#2e8b57"><b>int</b></font> L= (<font color="#2e8b57"><b>int</b></font>) Math.sqrt(Math.pow(x2-x1,<font color="#ff00ff">2</font>)+Math.pow(y2-y1,<font color="#ff00ff">2</font>));
            <font color="#0000ff">// length of line is found</font>
                <font color="#2e8b57"><b>double</b></font> th=Math.atan2(y2-y1,x2-x1); <font color="#0000ff">// inclination of line with x axis</font>
               <font color="#804040"><b>for</b></font>(<font color="#2e8b57"><b>int</b></font> i=<font color="#ff00ff">0</font>; i&lt;=L-<font color="#ff00ff">1</font>; i=i+<font color="#ff00ff">1</font>)
            { g.drawLine((<font color="#2e8b57"><b>int</b></font>) (x1+i*Math.cos(th)), (<font color="#2e8b57"><b>int</b></font>) (y1+i*Math.sin(th)),(<font color="#2e8b57"><b>int</b></font>) (x1+(i+<font color="#ff00ff">1</font>)*Math.cos(th)), (<font color="#2e8b57"><b>int</b></font>) (y1+(i+<font color="#ff00ff">1</font>)*Math.sin(th)));
          delay(dt);    <font color="#0000ff">//delay introduced to see line being drawn    </font>
            }
        } <font color="#0000ff">// lineByPixels Procedure Ends</font>

        <font color="#0000ff">// Paint graphics starts                     * * * * * * * * *</font>
        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>void</b></font> paint(Graphics g) {
                <font color="#2e8b57"><b>super</b></font>.paint(g);
        } <font color="#0000ff">// Paint graphics Ends</font>

        <font color="#2e8b57"><b>public</b></font> <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>void</b></font> main(String[] args) {
                leenaTrial1 ecc = <font color="#804040"><b>new</b></font> leenaTrial1(); <font color="#0000ff">// here the function is called</font>
                ecc.run();
        }
}
</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html&amp;title=How+would+you+clean+this+up+%3F" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html&amp;title=How+would+you+clean+this+up+%3F" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=RT+%40ketanpkr+How+would+you+clean+this+up+%3F+-+http://bit.ly/cBRsiF&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html&amp;t=How+would+you+clean+this+up+%3F" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.dzone.com/links/add.html?url=http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html&amp;title=How+would+you+clean+this+up+%3F&amp;description=This%20was%20an%20interesting%20piece%20of%20code%20from%20a%20long%20time%20mentor%20and%20friend.%20He%27s%20just%20started%20to%20learn%20Java%20some%20time%20ago%2C%20and%20has%20written%20this%20program%20to%20demonstrate%20how%20to%20draw%20an%20Ellipse.%0A%0AHe%27s%20about%2060%20years%20of%20age.%20Has%20been%20a%20long%20time%20Turbo%20C-2.0%20programmer.%20Mostly%20he%20develops%20small%20graphics%20pro" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2007/02/14/how-would-you-clean-this-up.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
