<?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>eric.jain.name &#187; Programming</title>
	<atom:link href="http://eric.jain.name/tags/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://eric.jain.name</link>
	<description>Eric Jain&#039;s Blog</description>
	<lastBuildDate>Mon, 26 Apr 2010 18:40:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hosting Applets in Google Docs</title>
		<link>http://eric.jain.name/2010/01/22/hosting-applets-in-google-docs/</link>
		<comments>http://eric.jain.name/2010/01/22/hosting-applets-in-google-docs/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 23:44:46 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/?p=92</guid>
		<description><![CDATA[Google Docs recently added support for uploading arbitrary files (up to 250MB large). Can this be used to host Java applets?

I uploaded a jar file containing a simple test applet to Google Docs and referenced it like so:

&#60;applet
  width=&#34;440&#34; height=&#34;60&#34;
  code=&#34;JavaVersionDisplayApplet.class&#34;
  codebase=&#34;http://docs.google.com/&#34;
  archive=&#34;uc?id=0B9ANnqvnRtroOTM5YWE3YmMtMGZkMy00ZGE5LWE2NWUtOGZhNzk5MzA2NzBk&#34;&#62;
&#60;/applet&#62;

The result:
 
]]></description>
			<content:encoded><![CDATA[<p>Google Docs recently added support for <a href="http://docs.google.com/support/bin/answer.py?answer=50092">uploading arbitrary files</a> (up to 250MB large). Can this be used to host Java applets?</p>
<p><span id="more-92"></span></p>
<p>I uploaded a jar file containing a simple test applet to Google Docs and referenced it like so:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">applet</span></span>
<span style="color: #009900;">  <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;440&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;60&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">code</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;JavaVersionDisplayApplet.class&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">codebase</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://docs.google.com/&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">archive</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;uc?id=0B9ANnqvnRtroOTM5YWE3YmMtMGZkMy00ZGE5LWE2NWUtOGZhNzk5MzA2NzBk&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">applet</span>&gt;</span></pre></div></div>

<p>The result:</p>
<p><applet width="440" height="60" code="JavaVersionDisplayApplet.class" codebase="http://docs.google.com/" archive="uc?id=0B9ANnqvnRtroOTM5YWE3YmMtMGZkMy00ZGE5LWE2NWUtOGZhNzk5MzA2NzBk"> </applet></p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2010/01/22/hosting-applets-in-google-docs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GTAC 2008</title>
		<link>http://eric.jain.name/2008/10/23/gtac-2008/</link>
		<comments>http://eric.jain.name/2008/10/23/gtac-2008/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 07:03:45 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2008/10/24/gtac-2008/</guid>
		<description><![CDATA[Here are my take-away notes from the first day of the Google Testing and Automation Conference.

James A. Whitaker (Microsoft) on The Future of Testing: Crowdsourcing testing (see e.g. uTest) is the simplest way to get an application tested on a large number of different platforms. Such services should also allow testers to focus more on [...]]]></description>
			<content:encoded><![CDATA[<p>Here are my take-away notes from the first day of the <a href="http://googletesting.blogspot.com/2008/04/gtac-2008-in-seattle.html">Google Testing and Automation Conference</a>.</p>
<p><span id="more-67"></span></p>
<p><strong>James A. Whitaker (Microsoft) on <em>The Future of Testing</em>:</strong> Crowdsourcing testing (see e.g. <a href="http://www.utest.com/">uTest</a>) is the simplest way to get an application tested on a large number of different platforms. Such services should also allow testers to focus more on designing rather than executing (manual) tests. Virtualisation could address the issue of hard to reproduce bugs by capturing the state of the machine as part of bug reports. Game testers use maps to highlight areas in game worlds that have been thoroughly tested. Similar visualizations could help people testing normal software what areas of the application need more testing.</p>
<p><strong>Elfriede Dustin and Marcus Borch (IDT) on <em>Advances in Automated Software Testing Technologies</em></strong>: There are <a href="http://generatedata.com/">tools that can help generate random test data</a>. The speakers spoke in great length about generating test code from customer supplied spreadsheets. Not sure if anyone in the audience understood what the advantage of this approach is &#8212; I didn&#8217;t.</p>
<p><strong>Andres Almiray (Oracle) on <em>Boosting Your Testing Productivity with Groovy</em>:</strong> This was more about the advantages of Groovy in general than testing, though towards the end of the talk the speaker did show how to create mock objects (using MockFor/StubFor) and how to use DbUnit in Groovy (more or less the same way you&#8217;d use it in Java). Oh boy this guy really did drink the Kool-Aid&#8230;</p>
<p><strong>Markus Clermont and John Thomas on <em>Taming the Beast: How to Test an AJAX Application</em>:</strong> The speakers did their best to keep he audience awake in this after-lunch talk. This got a bit tiring after the tenth &#8220;raise your hand if&#8230;&#8221;, but they had an excellent point: The amount of large, end-to-end tests (written e.g. with Selenium) should be minimized in favor of &#8220;medium&#8221;-sized tests that test interactions between specific components (one level deep).</p>
<p><strong>Matt Wood (Sanger Institute) on <em>The New Genomics: Software Development at Petabyte Scale</em>:</strong> This was perhaps the most interesting talk, though it didn&#8217;t really go into testing at all!</p>
<p><strong>Marc-Elian Bégin (Six2) on <em>Using Cloud Computing to Automate Full-Scale System Tests</em>:</strong> The case was made that Amazon EC2 is of great use for (system-level) testing. The speaker predicts that paravirtualization (e.g. with Xen) will increasingly be replaced with full virtualization (e.g. KVM), even though latter requires special hardware support (built into most newer processors?).</p>
<p><strong>Vishal Chowdhary (Microsoft) on <em>Practicing Testablity in the Real World</em>:</strong> Good explanation of the basics of writing testable code, though perhaps a bit too basic for the audience that was present.</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2008/10/23/gtac-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manning Books in Safari Books</title>
		<link>http://eric.jain.name/2008/06/19/manning-books-in-safari-books/</link>
		<comments>http://eric.jain.name/2008/06/19/manning-books-in-safari-books/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 20:38:35 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2008/06/19/manning-books-in-safari-books/</guid>
		<description><![CDATA[Over the last few days several books from Manning Publications appear to have been added to Safari Books.


So far there are 11 books, from Jess in Action (published July 2003) to jQuery in Action (published February 2008). I&#8217;m somewhat surprised that there was no announcement (so far) on either company&#8217;s web sites&#8230; In any case [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few days several books from <a href="http://www.manning.com/">Manning Publications</a> appear to have been added to <a href="http://my.safaribooksonline.com/">Safari Books</a>.</p>
<p><span id="more-64"></span></p>
<p><img src="/2008/06/19/manning-books-in-safari-books/safari.png" alt="Safari Screen Shot"/></p>
<p>So far there are 11 books, from <a href="http://my.safaribooksonline.com/9781930110892">Jess in Action</a> (published July 2003) to <a href="http://my.safaribooksonline.com/9781933988351">jQuery in Action</a> (published February 2008). I&#8217;m somewhat surprised that there was no announcement (so far) on either company&#8217;s web sites&#8230; In any case I&#8217;m hoping that there is more to come!</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2008/06/19/manning-books-in-safari-books/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Fluff Just Stuff</title>
		<link>http://eric.jain.name/2008/04/20/no-fluff-just-stuff/</link>
		<comments>http://eric.jain.name/2008/04/20/no-fluff-just-stuff/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 06:25:04 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2008/04/20/no-fluff-just-stuff/</guid>
		<description><![CDATA[Spent this weekend at the Spring 2008 Pacific Northwest Software Symposium. Here are my notes (trimmed down to whatever I felt was new &#038; noteworthy to me) and some general comments about the event.

Sessions
These are the sessions I attended:

TestNG with Code Coverage (Howard Lewis Ship)
Groovy: Metaprogramming (Scott Davis)
Professional Java UI Development with Eclipse RCP (Brian [...]]]></description>
			<content:encoded><![CDATA[<p>Spent this weekend at the <a href="http://www.nofluffjuststuff.com/conference/seattle/2008/04/index.html">Spring 2008 Pacific Northwest Software Symposium</a>. Here are my notes (trimmed down to whatever I felt was new &#038; noteworthy to me) and some general comments about the event.</p>
<p><span id="more-63"></span></p>
<h3>Sessions</h3>
<p>These are the sessions I attended:</p>
<ul>
<li>TestNG with Code Coverage (Howard Lewis Ship)</li>
<li>Groovy: Metaprogramming (Scott Davis)</li>
<li>Professional Java UI Development with Eclipse RCP (Brian Sam-Bodden)</li>
<li>The Busy Java Developers Guide to Concurrency (Ted Neward)</li>
<li>Code Metrics &#038; Analysis for Agile Projects (Neal Ford)</li>
<li>Building Web Apps with Spring OSGi (Craig Walls)</li>
<li>The Busy Developer&#8217;s Guide to Debugging (Ted Neward)</li>
<li>The Busy Developer&#8217;s Guide to Monitoring (Ted Neward)</li>
<li>The Busy Developer&#8217;s Guide to Scala (Ted Neward)</li>
<li>The Busy Developer&#8217;s Guide to Hacking on the JVM (Ted Neward)</li>
</ul>
<h3>Notes</h3>
<p>Test coverage should at least be 85% as there is often a significant number of bugs that are flushed out when you cross that threshold. But if you don&#8217;t aim for 100% coverage, there is the risk that you start copping out on testing the most difficult code!</p>
<p>When using the <a href="http://www.eclemma.org/">EclEmma</a> Eclipse plug-in for gathering code coverage statistics, set up separate build output folders &#8212; otherwise unit tests are included in the statistics (even if the unit test source folder is not selected).</p>
<p><a href="http://cobertura.sourceforge.net/">Cobertura</a> generates somewhat better code coverage statistics than <a href="http://emma.sourceforge.net/">EMMA</a>, but lacks an IDE plug-in.</p>
<p><a href="http://maven.apache.org/">Maven</a> is a great idea, but using it for your project can be &#8220;like living with a dangerous psychopath&#8221; &#8212; it behaves when showing it to other people, but you never know when it will turn on you&#8230;.</p>
<p>Ant has a <a href="http://ant.apache.org/manual/CoreTasks/presetdef.html">presetdef</a> task that allows you to create an alias for a task, and set default attribute values.</p>
<p><a href="http://testng.org/doc/">TestNG</a> can be used both for unit and for functional tests. Test &#8220;groups&#8221; can distinguish the two (quirk: can&#8217;t directly select all tests that are not in a group). TestNG creates only one instance of each test class. TestNG can run tests in parallel (either at the class or at the method level). There is an @DataProvider mechanism that can return either an array of test data or an iterator. TestNG can run JUnit tests! Can also run Selenium RC from TestNG &#8212; check the Tapestry test code.</p>
<p>New <a href="http://groovy.codehaus.org/">Groovy</a> language features don&#8217;t require new Java versions. This may be attractive for people who are stuck with old versions of Java. Groovy even allows addition and modification of all methods at runtime via its <a href="http://groovy.codehaus.org/ExpandoMetaClass">ExpandoMetaClass</a>, e.g. <code>String.metaClass.foo = { -> delegate.toUppercase() }</code></p>
<p>A JVM may map threads n:m at the OS level.</p>
<p>Schedulers may do &#8220;priority inversion&#8221; when a low priority thread holds a lock required by a high priority thread.</p>
<p>Build-specific deltas are more interesting than absolute numbers when looking at code metrics.</p>
<p>The &#8220;teddy bear&#8221; debugging technique: Explain the problem to a teddy bear! Often you&#8217;ll realize what the problem is before you need to go bother a colleague&#8230;</p>
<p>Should declare unchecked exceptions.</p>
<p><code>-XX:OnOutOfMemoryError=cmd</code> sets a command that is run when we run out of memory.</p>
<p><code>-XX:TraceClassLoading</code> shows where classes are loaded from.</p>
<p>The <code>extconflict</code> tool (shipped with Sun&#8217;s Java) detects duplicate classes in lib/ext.</p>
<p>Heisenberg principal: Monitoring a system always influences it (e.g. garbage collection activity due to jconsole connection).</p>
<p>jconsole has a scripting plugin. Also consider using Groovy for scripting tasks.</p>
<p><a href="http://www.scala-lang.org/">Scala</a> is an (impure) functional language. Functional languages are great for concurrent programming (immutable objects, use of &#8220;actors&#8221; etc). But Scala won&#8217;t be ready for production use this year (or even next year). Get the <a href="http://www.artima.com/shop/forsale">book</a>!</p>
<p>Reflection can be used to read (and set) private fields, even in core classes such as java.lang.String! Going one step further: We can provide our own String implementation (use <code>-Xbootclasspath=...</code>).</p>
<h3>Comments</h3>
<p>Most of the talks were at a level of detail that if you happened to have read a book on the topic you weren&#8217;t likely to learn a lot. Nevertheless you were bound to pick up some useful stuff as (most of) the speakers were clearly not only quite experienced but also great speakers. Ideally you&#8217;d have the number one expert on each topic give the talk, but I realize that isn&#8217;t practical&#8230; Despite the &#8220;No Fluff&#8221; branding there was a lot of talk about how we all need to be &#8220;agile&#8221; etc. Nevertheless I think everyone managed to keep their feet on the ground, and in any case their were sufficient technical talks. Not to mention the food and free stuff :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2008/04/20/no-fluff-just-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Java to Read Excel Files</title>
		<link>http://eric.jain.name/2008/02/14/java-excel/</link>
		<comments>http://eric.jain.name/2008/02/14/java-excel/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 03:06:35 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2008/02/14/java-excel/</guid>
		<description><![CDATA[I recently needed to add support for extracting data from Excel files (which are still ubiquitous in labs) to a Java application.

First I tried using POI-HSSF (a well-known Apache project). The code is reasonably straightforward &#8212; though I had to get it from tutorials on the Web as I couldn&#8217;t find much in terms of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to add support for extracting data from Excel files (which are still ubiquitous in labs) to a Java application.</p>
<p><span id="more-62"></span></p>
<p>First I tried using <a href="http://poi.apache.org/hssf/">POI-HSSF</a> (a well-known Apache project). The code is reasonably straightforward &#8212; though I had to get it from tutorials on the Web as I couldn&#8217;t find much in terms of documentation on their site, and the API isn&#8217;t exactly self-evident:</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">POIFSFileSystem fs = <span style="color: #000000; font-weight: bold;">new</span> POIFSFileSystem<span style="color: #009900;">&#40;</span>in<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
HSSFWorkbook wb = <span style="color: #000000; font-weight: bold;">new</span> HSSFWorkbook<span style="color: #009900;">&#40;</span>fs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
HSSFSheet sheet = wb.<span style="color: #006633;">getSheetAt</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399; font-weight: bold;">Iterator</span> rows = sheet.<span style="color: #006633;">rowIterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000;  font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>rows.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    HSSFRow row = <span style="color: #009900;">&#40;</span>HSSFRow<span style="color: #009900;">&#41;</span> rows.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399; font-weight: bold;">Iterator</span> cells = row.<span style="color: #006633;">cellIterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> fields = <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000;  font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>cells.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        HSSFCell cell = <span style="color: #009900;">&#40;</span>HSSFCell<span style="color: #009900;">&#41;</span> cells.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000;  font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>cell.<span style="color: #006633;">getCellType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000;  font-weight: bold;">case</span> HSSFCell.<span style="color: #006633;">CELL_TYPE_STRING</span>:
                fields.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>cell.<span style="color: #006633;">getStringCellValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000000;  font-weight: bold;">case</span> HSSFCell.<span style="color: #006633;">CELL_TYPE_NUMERIC</span>:
                fields.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Double</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span>cell.<span style="color: #006633;">getNumericCellValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000000;  font-weight: bold;">default</span>:
                log.<span style="color: #006633;">warn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Unsupported cell type: &quot;</span> + cell.<span style="color: #006633;">getCellType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    process<span style="color: #009900;">&#40;</span>fields<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This works fine &#8212; except that there doesn&#8217;t seem to be a way to keep the precision of numbers, i.e. if you don&#8217;t want to convert &#8220;4&#8243; to &#8220;4.0&#8243;! Fortunately POI isn&#8217;t the only game in town. I ended up using <a href="http://jexcelapi.sourceforge.net/">JExcel API</a> which has a much simpler API (and behaves the way I want it to):</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">Workbook workbook = Workbook.<span style="color: #006633;">getWorkbook</span><span style="color: #009900;">&#40;</span>in<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Sheet sheet = workbook.<span style="color: #006633;">getSheet</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000;  font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> i = <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> sheet.<span style="color: #006633;">getRows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> ++i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> fields = <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000;  font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> j = <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> sheet.<span style="color: #006633;">getColumns</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> ++j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        fields.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>sheet.<span style="color: #006633;">getCell</span><span style="color: #009900;">&#40;</span>j, i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getContents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    process<span style="color: #009900;">&#40;</span>fields<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2008/02/14/java-excel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Some Java Benchmarks</title>
		<link>http://eric.jain.name/2007/09/29/java-hyperthreading-benchmarks/</link>
		<comments>http://eric.jain.name/2007/09/29/java-hyperthreading-benchmarks/#comments</comments>
		<pubDate>Sat, 29 Sep 2007 11:23:20 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2007/09/29/java-hyperthreading-benchmarks/</guid>
		<description><![CDATA[During the last two weeks I ran some tests to answer a few questions that had been accumulating:

Should I disable hyper-threading (ht)?
How much does doubling the available memory improve performance?
Mirror, mirror on the wall, who has the fastest JVM of them all?


Method
The machine in question has a single 2.8GHz Intel Xeon processor with 2GB RAM [...]]]></description>
			<content:encoded><![CDATA[<p>During the last two weeks I ran some tests to answer a few questions that had been accumulating:</p>
<ol>
<li>Should I disable <a href="http://en.wikipedia.org/wiki/Hyper-threading">hyper-threading</a> (ht)?</li>
<li>How much does doubling the available memory improve performance?</li>
<li>Mirror, mirror on the wall, who has the fastest JVM of them all?</li>
</ol>
<p><span id="more-53"></span></p>
<h3>Method</h3>
<p>The machine in question has a single 2.8GHz Intel Xeon processor with 2GB RAM and is running Linux (2.6.9-42.0.3.ELsmp).</p>
<p>The application is a web application with a large (several gigabytes) <a href="http://lucene.apache.org/java/">Lucene</a> index and <a href="http://www.oracle.com/technology/products/berkeley-db/je/">Berkeley DB</a> for storing data. The main interest was the performance of the data import procedure, though I also had a brief look at the search and retrieval performance.</p>
<p>The following (Java 6) VMs were tested:</p>
<ul>
<li><a href="http://dev2dev.bea.com/jrockit/">BEA JRockit</a><br />
<small>build R27.3.1-1-85830-1.6.0_01-20070716-1248-linux-ia32</small></li>
<li><a href="http://java.sun.com/">Sun Java HotSpot Server VM</a><br />
<small>build 1.6.0_02-b05</small></li>
<li><a href="http://www.ibm.com/developerworks/java/jdk/">IBM J9 VM</a><br />
<small>build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20070817_13537</small></li>
</ul>
<p>Note that even though the machine has a 64-bit processor, I used the 32-bit versions of the JVMs as these are faster than (or the same speed as) the corresponding 64-bit versions (depending on whether the JVM is smart enough to always use 32-bit pointers whenever the heap size is small enough).</p>
<p>Some of the tests were repeated with some of the JVM parameters <a href="http://dev2dev.bea.com/blog/hstahl/archive/2007/08/a_second_look_a.html">described by Henrik Stahl</a>. But I never managed to beat the default configuration! So I ended up using only <code>-Xms</code> and <code>-Xmx</code> for all tests.</p>
<h3>Results</h3>
<p>Median response time (s) for running 1&#8242;000 queries sequentially:</p>
<p><img src="/2007/09/29/java-hyperthreading-benchmarks/search_1.png" alt=""/></p>
<p>Median response time (s) for running 1&#8242;000 queries from 10 parallel clients each:</p>
<p><img src="/2007/09/29/java-hyperthreading-benchmarks/search_10.png" alt=""/></p>
<p>Total time (h) for loading and indexing (in a single thread) all data (UniProt release 12.2):</p>
<p><img src="/2007/09/29/java-hyperthreading-benchmarks/load.png" alt=""/></p>
<h3>Discussion</h3>
<p>Hyper-threading can slow down single-threaded applications a bit (perhaps depending on whether the bottleneck is garbage collection, which can be done in a separate thread, or IO). But as soon as there are lots of threads there appears to be a clear benefit in keeping hyper-threading enabled.</p>
<p>More memory is better (surprise)&#8230; Doubling the memory in the system from 2 to 4gb (and increasing the heap size from 1 to 2gb) improved performance by about a third for some configurations. Doubling again however may not be worth the expense (diminishing returns).</p>
<p>The latest version of Sun&#8217;s JVM appears to be a bit ahead of the others&#8230; for now!</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2007/09/29/java-hyperthreading-benchmarks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No GPL?</title>
		<link>http://eric.jain.name/2007/09/07/no-gpl/</link>
		<comments>http://eric.jain.name/2007/09/07/no-gpl/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 23:52:01 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2007/09/07/no-gpl/</guid>
		<description><![CDATA[It&#8217;s not uncommon for organizations to have strict policies regarding the use of GPLed code, due to the somewhat viral nature of this license.

Nevertheless I was a bit taken aback when I discovered this sign at the entrance to our garage:

Moreover, the prohibition sign to the right contains a figure that resembles a hacker wearing [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not uncommon for organizations to have strict policies regarding the use of <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>ed code, due to the somewhat <a href="http://en.wikipedia.org/wiki/Copyleft#Is_copyleft_.22viral.22.3F">viral</a> nature of this license.</p>
<p><span id="more-52"></span></p>
<p>Nevertheless I was a bit taken aback when I discovered this sign at the entrance to our garage:</p>
<p><img src="/2007/09/07/no-gpl/gpl.jpg" alt="GPL Prohibited?"/></p>
<p>Moreover, the prohibition sign to the right contains a figure that resembles a hacker wearing a hat!</p>
<p>Microsoft-sponsored conspiracy, or misunderstanding?</p>
<p><strong>Hint:</strong> I&#8217;m currently working in a <a href="http://www.google.com/search?q=define:GPL&#038;defl=fr">French-speaking</a> region.</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2007/09/07/no-gpl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hiring</title>
		<link>http://eric.jain.name/2007/06/26/hiring/</link>
		<comments>http://eric.jain.name/2007/06/26/hiring/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 06:44:22 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Life Science]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Semantic Web]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2007/06/26/hiring/</guid>
		<description><![CDATA[In the latest effort to make myself obsolete by the end of this year, we are looking for a software developer to help us better make our data available to both humans and machines. The main responsibilities of this position will be the further development of the UniProt web site and the UniProt RDF distribution.

If [...]]]></description>
			<content:encoded><![CDATA[<p>In the latest effort to make myself obsolete by the end of this year, <a href="http://expasy.org/people/swissprot.html">we</a> are looking for a software developer to help us better make our data available to both humans and machines. The main responsibilities of this position will be the further development of the <a href="http://beta.uniprot.org/">UniProt web site</a> and the <a href="http://dev.isb-sib.ch/projects/uniprot-rdf/">UniProt RDF distribution</a>.</p>
<p><span id="more-49"></span></p>
<p>If you have some experience with coding Java, have a strong interest in science and the technologies we use, thrive in <span style="text-decoration:line-through">chaotic</span> open environments, and would like to work in one of the world&#8217;s <a href="http://www.mercerhr.com/referencecontent.jhtml?idContent=1128060">best cities to live</a>, here are the <a href="http://www.isb-sib.ch/infos/careers_070625.htm">instructions for applying</a>.</p>
<p>You can meet me at <a href="http://open-bio.org/wiki/BOSC_2007">BOSC</a> and <a href="http://www.iscb.org/ismbeccb2007/">ISMB</a> next month. If you have any questions, <a href="mailto:Eric.Jain@isb-sib.ch">contact me</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2007/06/26/hiring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source Code Visualization</title>
		<link>http://eric.jain.name/2007/06/06/source-code-visualization/</link>
		<comments>http://eric.jain.name/2007/06/06/source-code-visualization/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 21:52:56 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2007/06/06/source-code-visualization/</guid>
		<description><![CDATA[My colleagues regularly ask me if I couldn&#8217;t provide them with some graphic view of my code, looking at source code is so tedious etc. I&#8217;ve looked at various UML tools in the past, but never managed to get any truly useful visualization out of any of them. But maybe the problem with UML is [...]]]></description>
			<content:encoded><![CDATA[<p>My colleagues regularly ask me if I couldn&#8217;t provide them with some graphic view of my code, looking at source code is so tedious etc. I&#8217;ve looked at various UML tools in the past, but never managed to get any truly useful visualization out of any of them. But maybe the problem with UML is that it&#8217;s so limited to two dimensions? Enter <a href="http://www.workingfrog.org/">Relief</a>, a tool that visualizes code in three dimensions!</p>
<p><span id="more-59"></span></p>
<p>Here&#8217;s a 3D view of the source code for <a href="http://beta.uniprot.org/">beta.uniprot.org</a>:</p>
<p><img src="/2007/06/06/source-code-visualization/1.png" alt=""/></p>
<p>I do wonder what all those lines and boxes mean, but it certainly is pretty!</p>
<p>And here we zoom in on one <a href="http://dev.isb-sib.ch/projects/expasy4j/api/org/expasy/uniprot/models/Entry.html">frequently used class</a>:</p>
<p><img src="/2007/06/06/source-code-visualization/2.png" alt=""/></p>
<p>Any questions? OK, maybe I&#8217;ll have to keep looking for the perfect visualization tool :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2007/06/06/source-code-visualization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>EMBRACE Talk</title>
		<link>http://eric.jain.name/2007/06/01/embrace-talk/</link>
		<comments>http://eric.jain.name/2007/06/01/embrace-talk/#comments</comments>
		<pubDate>Fri, 01 Jun 2007 19:58:37 +0000</pubDate>
		<dc:creator>Eric Jain</dc:creator>
				<category><![CDATA[Life Science]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eric.jain.name/2007/06/01/embrace-talk/</guid>
		<description><![CDATA[Gave a brief talk about programmatic access to beta.uniprot.org at the EMBRACE workshop in Geneva today.

Here are the slides that I showed along with the demo I gave:

The workshop (which was really more of a series of normal talks than a real workshop) ended with a SOAP vs REST debate. The SOAP camp felt that [...]]]></description>
			<content:encoded><![CDATA[<p>Gave a brief talk about programmatic access to <a href="http://beta.uniprot.org/">beta.uniprot.org</a> at the <a href="http://www.ch.embnet.org/EMBRACE/">EMBRACE workshop</a> in Geneva today.</p>
<p><span id="more-46"></span></p>
<p>Here are the slides that I showed along with the demo I gave:</p>
<p><object type="application/x-shockwave-flash" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=60150&#038;doc=uniprot-rest-api-16705" width="425" height="348"><param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=60150&#038;doc=uniprot-rest-api-16705" /></object></p>
<p>The workshop (which was really more of a series of normal talks than a real workshop) ended with a SOAP vs <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a> debate. The SOAP camp felt that their technology would in some unspecified way address interoperability issues.  The REST camp on the other hand had plenty of war stories that showed that SOAP helped little with that but introduced a lot of problems. Of course no consensus was reached, but some of the participants volunteered to write a review paper that explains the different positions&#8230; Let&#8217;s see what comes out of that.</p>
]]></content:encoded>
			<wfw:commentRss>http://eric.jain.name/2007/06/01/embrace-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
