<?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>Todd Huss &#187; Java</title>
	<atom:link href="http://gabrito.com/post/category/technical/java/feed" rel="self" type="application/rss+xml" />
	<link>http://gabrito.com</link>
	<description>Anecdotes on Technology Leadership, Ruby, Java, Scala, Cloud Computing, Open-Source, SEO, and Design</description>
	<lastBuildDate>Thu, 08 Dec 2011 00:21:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Storing Git repositories in Amazon S3 for high availability</title>
		<link>http://gabrito.com/post/storing-git-repositories-in-amazon-s3-for-high-availability</link>
		<comments>http://gabrito.com/post/storing-git-repositories-in-amazon-s3-for-high-availability#comments</comments>
		<pubDate>Sat, 13 Nov 2010 01:01:28 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Source Control]]></category>
		<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=344</guid>
		<description><![CDATA[At VolunteerMatch we&#8217;re experimenting with using Chef Solo to manage Amazon EC2 servers. The catch is that if a server is going to rely on Chef to boot up, then the Chef Recipes (which we&#8217;re storing in a Git Repository) &#8230; <a href="http://gabrito.com/post/storing-git-repositories-in-amazon-s3-for-high-availability">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://git-scm.com/"><img src="http://gabrito.com/wp-content/uploads/2010/11/git-logo.png" alt="" title="Git" width="188" height="97" class="alignleft size-full wp-image-346" /></a>At <a href="http://www.volunteermatch.org">VolunteerMatch</a> we&#8217;re experimenting with using <a href="http://wiki.opscode.com/display/chef/Chef+Solo">Chef Solo</a> to manage <a href="http://aws.amazon.com/ec2/">Amazon EC2</a> servers. The catch is that if a server is going to rely on Chef to boot up, then the Chef Recipes (which we&#8217;re storing in a Git Repository) need to be highly available. </p>
<p>Here&#8217;s how we went about using a private S3 bucket to store our Git repository of Chef Recipes. Thanks to this post on <a href="http://blog.spearce.org/2008/07/using-jgit-to-publish-on-amazon-s3.html">using JGit to publish to S3</a> which got us started, the key difference is we wanted to use a private S3 bucket and it took us some experimenting to figure out how to update an existing Git repo (via fetch and merge) from S3.</p>
<p>Download <a href="http://eclipse.org/jgit/download/">jgit.sh</a>, rename it to jgit and put it in your path (for example $HOME/bin). <span id="more-344"></span></p>
<p>Setup the .jgit config file and add the following (substituting your AWS keys):</p>
<p>vim ~/.jgit</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">accesskey: aws access key<br />
secretkey: aws secret access key</div></div>
<p>Note, by not specifying <em>acl: public</em> in the .jgit file, the git files on S3 will be private (which is what we wanted). Next create an S3 bucket to store your repository in, let&#8217;s call it git-repos, and then create a git repository to upload:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">s3cmd mb s3:<span style="color: #000000; font-weight: bold;">//</span>git-repos<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> chef-recipes<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> chef-recipes<br />
<span style="color: #c20cb9; font-weight: bold;">git init</span><br />
<span style="color: #c20cb9; font-weight: bold;">touch</span> README<br />
<span style="color: #c20cb9; font-weight: bold;">git add</span> README<br />
<span style="color: #c20cb9; font-weight: bold;">git commit</span> README<br />
<span style="color: #c20cb9; font-weight: bold;">git remote</span> add origin amazon-s3:<span style="color: #000000; font-weight: bold;">//</span>.jgit<span style="color: #000000; font-weight: bold;">@</span>git-repos<span style="color: #000000; font-weight: bold;">/</span>chef-recipes.git</div></div>
<p>In the above I&#8217;m using the <a href="http://s3tools.org/s3cmd">s3cmd</a> command line tool to create the bucket but you can do it via the Amazon web interface as well. Now let&#8217;s push it up to S3 (notice how we use jgit whenever we interact with S3, and standard git otherwise):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">jgit push origin master</div></div>
<p>Now go somewhere else (e.g. cd /tmp) and try cloning it:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">jgit clone amazon-s3:<span style="color: #000000; font-weight: bold;">//</span>.jgit<span style="color: #000000; font-weight: bold;">@</span>git-repos<span style="color: #000000; font-weight: bold;">/</span>chef-recipes.git</div></div>
<p>When it comes time to update it (because jgit doesn&#8217;t support merge or pull) you do it in 2 steps:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> chef-recipes<br />
jgit fetch<br />
<span style="color: #c20cb9; font-weight: bold;">git merge</span> origin<span style="color: #000000; font-weight: bold;">/</span>master</div></div>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/storing-git-repositories-in-amazon-s3-for-high-availability/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Acceptance Testing non Ruby web applications with Cucumber</title>
		<link>http://gabrito.com/post/acceptance-testing-non-ruby-apps-with-cucumber</link>
		<comments>http://gabrito.com/post/acceptance-testing-non-ruby-apps-with-cucumber#comments</comments>
		<pubDate>Tue, 26 Oct 2010 21:49:18 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Quality Assurance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=318</guid>
		<description><![CDATA[If you&#8217;re looking for the sample Standalone Cucumber Test Suite to get you started testing non Ruby based applications with Cucumber, here&#8217;s the source: http://github.com/thuss/standalone-cucumber. Sometimes you inherit a non Ruby based web app written in PHP, Perl, Java, C#, &#8230; <a href="http://gabrito.com/post/acceptance-testing-non-ruby-apps-with-cucumber">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://gabrito.com/wp-content/uploads/2010/10/cucumber-logo.png"><img src="http://gabrito.com/wp-content/uploads/2010/10/cucumber-logo.png" alt="" title="cucumber-logo" width="300" height="128" class="alignleft size-full wp-image-321" /></a>If you&#8217;re looking for the sample <a href="http://github.com/thuss/standalone-cucumber">Standalone Cucumber Test Suite</a> to get you started testing non Ruby based applications with Cucumber, here&#8217;s the source: <a href="http://github.com/thuss/standalone-cucumber">http://github.com/thuss/standalone-cucumber</a>.</p>
<p>Sometimes you inherit a non Ruby based web app written in PHP, Perl, Java, C#, or Python and you want to create an automated functional/acceptance test suite to minimize the amount of manual QA you need to do.<span id="more-318"></span> <a href="http://seleniumhq.org/">Selenium</a> is a great tool for doing just that and at <a href="http://www.commonsensemedia.org">Common Sense Media</a> I created the <a href="http://github.com/thuss/selenium-continuous-integration-runner">Selenium Continuous Integration Runner</a> to make it easy to run <a href="http://seleniumhq.org/docs/04_selenese_commands.html">Selenese</a> based tests from your <a href="http://en.wikipedia.org/wiki/Continuous_integration">Continuous Integration</a> Server such as Hudson, Cruise Control, or Teamcity. That said, Selenese based tests leave something to be desired in terms of readability and maintainability. </p>
<p>The <a href="http://www.ruby-lang.org/en/">Ruby</a> camp is often at the forefront of great testing frameworks with <a href="http://github.com/aslakhellesoy">Aslak Hellesøy</a> often leading the charge with innovations like <a href="http://rspec.info/">RSpec</a> and <a href="http://cukes.info/">Cucumber</a>. I&#8217;d read and played around with Cucumber on Rails based apps and was loving the concept of english language specs that are actually executable as well. But when my friend and former colleague Chris Kimm mentioned that the testing group at his company was using it to test their Java application, I started to get excited as that was the problem I was about to try and tackle at <a href="http://www.volunteermatch.org">VolunteerMatch</a>.</p>
<p>However, getting the project structure in place required a little help from the <a href="http://groups.google.com/group/cukes">Cucumber mailing list</a> and in the hopes of saving others the time, I&#8217;ve published the <a href="http://github.com/thuss/standalone-cucumber">Standalone Cucumber Test Suite</a> to  Github. It&#8217;s simply a Cucumber project designed to test a non Ruby web application with a sample search.feature that uses Google search as the basis for the test. It uses <a href="http://github.com/jnicklas/capybara">Capybara</a> with the <a href="http://seleniumhq.org/docs/09_webdriver.html">Selenium Webdriver</a> on the backend but you can also switch it to use <a href="http://github.com/langalex/culerity">Culerity</a> or <a href="http://github.com/brynary/webrat">Webrat</a> if you don&#8217;t want it actually firing up a real browser to run the tests.  Fork it or download it to start testing your existing website with Cucumber!</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/acceptance-testing-non-ruby-apps-with-cucumber/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code readability through conciseness</title>
		<link>http://gabrito.com/post/code-readability-through-conciseness</link>
		<comments>http://gabrito.com/post/code-readability-through-conciseness#comments</comments>
		<pubDate>Tue, 10 Aug 2010 22:06:51 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=286</guid>
		<description><![CDATA[One of the things I love about newer languages like Ruby and Scala (and to a degree Python and Groovy) are the language features that allow you to dial conciseness up or down for readability. Take for instance the typical &#8230; <a href="http://gabrito.com/post/code-readability-through-conciseness">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://gabrito.com/wp-content/uploads/2010/08/lambda.jpeg" alt="" title="lambda" width="72" height="80" class="alignleft size-full wp-image-287" />One of the things I love about newer languages like  Ruby and Scala (and to a degree Python and Groovy) are the language features that allow you to dial conciseness up or down for readability. Take for instance the typical one liner for summing numbers in languages that support anonymous functions (which can be a bit cryptic in terms of readability):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Ruby<br />
sum = [1,2,3,4].inject(0) {|result, value| result + value}<br />
Scala<br />
val sum = Array(1,2,3,4).foldLeft(0) ((result, value) =&gt; result + value)<br />
Groovy<br />
sum = [1,2,3,4].inject(0) { result, value -&gt; result + value }<br />
Python<br />
sum = reduce(lambda result, value: result + value, [1,2,3,4])</div></div>
<p>One of the jobs of a good programmer<span id="more-286"></span> is to make their code readable and in this case by naming the variable sum it&#8217;s obvious what&#8217;s going on to the right so if you can simplify the anonymous function or use syntactic sugar to reduce the amount of code there&#8217;s a good chance you can improve the readability as follows:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Ruby<br />
sum = [1,2,3,4].inject(:+)<br />
Scala can either reduce the anonymous function<br />
val sum = Array(1,2,3,4).reduceLeft(_+_)<br />
or in Scala 2.8 they added the sum method<br />
val sum = Array(1,2,3,4).sum<br />
Groovy can't reduce the anonymous function but has a sum method<br />
sum = [1,2,3,4].sum<br />
Python can't reduce the anonymous function but has a sum function<br />
sum = sum([1,2,3,4])</div></div>
<p>Then even if the programmer reading the code is coming from another language and doesn&#8217;t know :+ or _+_ you&#8217;ll still have improved readability because they certainly understand how a sum is computed and can move past the line of code instead of having to read 3-4 lines of a for loop for something as simple as a summing operation. I love the balance of being very concise with the simple stuff so that I can be more verbose with the complex stuff, whereas in Java even the simple stuff is often extremely verbose.</p>
<p>There is of course the extreme of making your code too concise. Look no further than <a target="_blank" href="http://en.wikipedia.org/wiki/Write-only_language">write-only languages</a> like Perl to see where too much conciseness and obfuscation can lead to unmaintainable code.</p>
<p>This example is only trivial and somewhat contrived but I find that newer languages like Ruby and Scala give you significantly better tools to elegantly dial up or down the conciseness than Java or C# resulting in <em>less code + more readable code = easily maintainable code</em>.</p>
<p>As an example, I used just about every conciseness trick in the book I knew of when composing <a target="_blank" href="http://github.com/thuss/rpcfn-3-shortest_path">my submission</a> for the <a target="_blank" href="http://rubylearning.com/blog/2009/10/30/rpcfn-short-circuit-3/">3rd Ruby Challenge&#8217;s Shortest Path Algorithm</a> and I only discarded the ones that I thought obfuscated the intent. I like to think the reason my submission won was precisely because it was concise while still being readable. Writing that same algorithm with the same level of readability in Scala would be easy but in Java it would have tripled the lines of code hurting readability somewhat.</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/code-readability-through-conciseness/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Selenium Continuous Integration Runner</title>
		<link>http://gabrito.com/post/selenium-continuous-integration-runner</link>
		<comments>http://gabrito.com/post/selenium-continuous-integration-runner#comments</comments>
		<pubDate>Sat, 10 Jan 2009 20:34:47 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Quality Assurance]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=227</guid>
		<description><![CDATA[At Common Sense Media I wanted to get some functional testing up and running that didn&#8217;t require a lot of user training for the QA folks. I also wanted those tests to run in our Rightscale/Amazon EC2 hosted Hudson continuous &#8230; <a href="http://gabrito.com/post/selenium-continuous-integration-runner">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://seleniumhq.org/" target="_blank"><img src="http://gabrito.com/wp-content/uploads/2009/01/selenium1.png" alt="selenium" title="selenium" width="200" height="181" class="alignleft size-full wp-image-226" /></a> At <a href="http://www.commonsensemedia.org/">Common Sense Media</a> I wanted to get some functional testing up and running that didn&#8217;t require a lot of user training for the QA folks. I also wanted those tests to run in our <a href="http://www.rightscale.com/">Rightscale</a>/<a href="http://aws.amazon.com/ec2/">Amazon EC2</a> hosted <a href="https://hudson.dev.java.net/">Hudson continuous integration server</a>. As a result I&#8217;ve published the:</p>
<p><a href="http://github.com/thuss/selenium-continuous-integration-runner/tree/master"> Selenium Selenese Continuous Integration Runner</a> </p>
<p>on GitHub in the hopes that it will save other people time when trying to get their Selenese tests running from a continuous integration server. It&#8217;s very simple but one thing I battled with was that I had to patch the selenium JAR to get it to work with Firefox 3.0. It should work fine in any continuous integration server regardless if it&#8217;s <a href="https://hudson.dev.java.net/">Hudson</a>, <a href="http://studios.thoughtworks.com/cruise-continuous-integration">Cruise</a>, <a href="http://cruisecontrol.sourceforge.net/">Cruise Control</a>, <a href="http://www.atlassian.com/software/bamboo/">Bamboo</a>, etc.</p>
<p>The functional testing products I&#8217;ve used that drive a real browser include <a href="http://www.automatedqa.com/">Test Complete (commercial)</a>, <a href="http://seleniumhq.org/">Selenium</a>, and <a href="http://wtr.rubyforge.org/">Watir</a>. I think all 3 do a good job but one thing I like about Selenium is that it&#8217;s dirt simple to get a user productive with the Selenium IDE Firefox plugin. However, that benefit is also the most limiting factor of the <a href="http://seleniumhq.org/">Selenium IDE</a> which is that to be able to re-open tests in Selenium IDE you have to save them as Selenese (which is the most limited of the testing languages that Selenium supports). Still, I think Selenese is a reasonable choice for a lot of organizations that need a moderately sophisticated functional test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/selenium-continuous-integration-runner/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Standalone Migrations: Using Rails migrations in non Rails projects</title>
		<link>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects</link>
		<comments>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects#comments</comments>
		<pubDate>Tue, 23 Dec 2008 01:15:47 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=194</guid>
		<description><![CDATA[Update 8/7/2010: Standalone migrations is now a gem (sudo gem install standalone_migrations) so disregard the outdated installation instructions below Update 7/8/2009: With the latest batch of contributed patches standalone migrations now works just like Rails migrations Update 12/26/2008: I switched &#8230; <a href="http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/thuss/standalone-migrations/tree/master"><img src="http://gabrito.com/wp-content/uploads/2008/12/github.png" alt="Standalone Migrations" title="Standalone Migrations" width="157" height="60" class="alignleft" /></a><strong>Update 8/7/2010</strong>: Standalone migrations is now a gem (sudo gem install standalone_migrations) so disregard the outdated installation instructions below</p>
<p><strong>Update 7/8/2009</strong>: With the latest batch of contributed patches standalone migrations now works just like Rails migrations<br />
<strong>Update 12/26/2008</strong>: I switched standalone migrations to use a Rakefile instead of a Ruby script.</p>
<p>In my work managing websites I end up working in Ruby, Java, and PHP. In everything but Rails managing the schema requires rolling your own solution. As a result I&#8217;ve started using Rails migrations in non-Rails projects to manage the schema. It&#8217;s not much code but I figured others might benefit from it so I created a little Github project called <a target="_blank" href="http://github.com/thuss/standalone-migrations/tree/master">standalone migrations</a>. </p>
<p>It&#8217;s based on Lincoln Stoll&#8217;s blog post titled <a target="_blank" href="http://lstoll.net/2008/04/stand-alone-activerecord-migrations/">Stand-alone ActiveRecord migrations</a> and David Welton&#8217;s blog post titled <a target="_blank" href="http://journal.dedasys.com/2007/01/28/using-migrations-outside-of-rails">Using Migrations Outside of Rails</a>.</p>
<p>Assuming you have Ruby and Gem installed on your machine, here&#8217;s how to use it:</p>
<pre>
gem install -y activerecord rake mysql
wget http://github.com/thuss/standalone-migrations/zipball/master (or fetch it using <a target="_blank" href="http://git.or.cz/">git</a>)
unzip it, and mv to something like my_non_rails_project/db
cd my_non_rails_project/db/ (or wherever you put it)
cp config/database_sample.yml config/database.yml
vi config/database.yml
./new_migration some_user_story
vi migrations/*_some_user_story.rb
rake db:migrate (this applies your newly created migration)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Moving to 64 bit Ubuntu</title>
		<link>http://gabrito.com/post/moving-to-64-bit-ubuntu</link>
		<comments>http://gabrito.com/post/moving-to-64-bit-ubuntu#comments</comments>
		<pubDate>Fri, 14 Nov 2008 20:45:51 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gabrito.com/?p=183</guid>
		<description><![CDATA[After 3 Ubuntu upgrades on my primary workhorse (a Lenovo Thinkpad z61t) I decided it was time for a fresh install to remove all the cruft. In the past I&#8217;ve always used 32 bit Ubuntu (even though my laptop is &#8230; <a href="http://gabrito.com/post/moving-to-64-bit-ubuntu">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ubuntu.com"><img class="alignleft" src="/files/ubuntu.jpg" alt="Ubuntu Logo" /></a>After 3 Ubuntu upgrades on my primary workhorse (a <a href="http://www.geek.com/articles/chips/lenovo-thinkpad-z61t-notebook-2007044/">Lenovo Thinkpad z61t</a>) I decided it was time for a fresh install to remove all the cruft. In the past I&#8217;ve always used 32 bit Ubuntu (even though my laptop is a 64 bit Core 2 duo) because of issues with the Flash plugin, Java plugin, and Skype. After backing up my files I bit the bullet and did a fresh install of <a href="http://releases.ubuntu.com/8.10/">64 bit Ubuntu Intrepid Ibex</a> and in the process also decided to give <a href="http://www.debian-administration.org/articles/388">XFS a shot instead of EXT3</a> as my primary filesystem.</p>
<p>I&#8217;m pleased to say that after 3 hours I had the install done and all of my software installed and working including Jetbrains IDEA, Netbeans, Skype, VirtualBox, Flash plugin, Java plugin, Web Developer Toolbar, and Firebug. Apparently things have gotten a little better for 64 bit Linux over the past year and a half! However, I&#8217;m still running into odd issues every now and again related to both Sun&#8217;s 64 bit Java (IDE <del>and Jetty</del> occasionally hangs) and the the Open JDK browser plugin which is still buggy. Hopefully future updates will help address these issues. Anyhow, I thought I&#8217;d throw out the links I used to get everything working:</p>
<p><strong>Fonts</strong><br />
<a href="http://www.ubuntu-unleashed.com/2008/05/howto-install-mac-fonts-on-ubuntu.html">Howto: Install Mac Fonts on Ubuntu</a><br />
<a href="http://stdout-dev-null.blogspot.com/2007/03/make-firefox-in-ubuntu-look-much-better.html">Make Firefox in Ubuntu look much better</a></p>
<p><strong>Skype</strong><br />
<a href="https://help.ubuntu.com/community/Medibuntu">Add the Medibuntu repository</a><br />
sudo apt-get install skype-static</p>
<p><strong>Flash plugin</strong><br />
<a href="http://www.cyberciti.biz/tips/install-flash-10-ubuntu-linux-64bit.html">Install Flash 10 Under Ubuntu Linux 64 bit Edition</a></p>
<p><strong>Java plugin</strong><br />
sudo apt-get install openjdk-6-jre icedtea-gcjwebplugin</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/moving-to-64-bit-ubuntu/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An interview with the authors of JRuby</title>
		<link>http://gabrito.com/post/an-interview-with-the-authors-of-jruby</link>
		<comments>http://gabrito.com/post/an-interview-with-the-authors-of-jruby#comments</comments>
		<pubDate>Tue, 23 Jan 2007 05:23:17 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/an-interview-with-the-authors-of-jruby</guid>
		<description><![CDATA[The Java Posse hosted a great podcast interview with the authors of JRuby: Charles Nutter and Thomas Enebo. Additionally you get to hear what Tor Norbye is up to with his work on NetBeans Ruby integration and it looks like &#8230; <a href="http://gabrito.com/post/an-interview-with-the-authors-of-jruby">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Java Posse hosted a great <a href="http://javaposse.com/index.php?post_id=171709">podcast interview with the authors of JRuby</a>: <a href="http://headius.blogspot.com/">Charles Nutter</a> and <a href="http://www.bloglines.com/blog/ThomasEEnebo">Thomas Enebo</a>. Additionally you get to hear what Tor Norbye is up to with his work on <a href="http://blogs.sun.com/tor/entry/ruby_screenshot_of_the_week1">NetBeans Ruby integration</a> and it looks like there&#8217;s some nice code assist features in the works! Really good code assist is the thing I miss most when doing Ruby (in RadRails) as opposed to  Java (in IDEA).</p>
<p>It&#8217;s exciting to see the convergence of my two favorite languages coming along!</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/an-interview-with-the-authors-of-jruby/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tab completion and history with irb and script/console</title>
		<link>http://gabrito.com/post/tab-completion-and-history-with-irb-and-scriptconsole</link>
		<comments>http://gabrito.com/post/tab-completion-and-history-with-irb-and-scriptconsole#comments</comments>
		<pubDate>Wed, 06 Dec 2006 17:46:08 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/tab-completion-and-history-with-irb-and-scriptconsole</guid>
		<description><![CDATA[One thing I love about Ruby (and really miss when working in Java) is its interactive command line interpreter irb (or script/console if you&#8217;re using Rails). I really wish irb had tab completion and saved history configured by default out &#8230; <a href="http://gabrito.com/post/tab-completion-and-history-with-irb-and-scriptconsole">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One thing I love about Ruby (and really miss when working in Java) is its interactive command line interpreter <a href="http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks">irb</a> (or <a href="http://wiki.rubyonrails.org/rails/pages/Console">script/console</a> if you&#8217;re using Rails). I really wish <strong>irb</strong> had tab completion and saved history configured by default out of the box. The good news is it&#8217;s easy to configure by creating a <strong>$HOME/.irbrc</strong> file with the following contents:<br />
<span id="more-165"></span></p>
<pre>
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:EVAL_HISTORY] = 1000
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = File::expand_path("~/.irbhistory")
</pre>
<p><!--adsense--></p>
<p>Now when I fire up <strong>irb</strong> or <strong>script/console</strong> I get full readline support including tab completion (for example type Time:: and hit tab), reverse command search (control-R), and saved command history so when I exit and restart my command history is still there!</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/tab-completion-and-history-with-irb-and-scriptconsole/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Instantiating and populating a list or collection</title>
		<link>http://gabrito.com/post/instantiating-and-populating-a-list-or-collection</link>
		<comments>http://gabrito.com/post/instantiating-and-populating-a-list-or-collection#comments</comments>
		<pubDate>Tue, 21 Nov 2006 01:56:21 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/instantiating-and-populating-a-list-or-collection</guid>
		<description><![CDATA[In Java it always irks me when I have to create a collection and then populate it in separate steps as follows: List states = new ArrayList(); state.add(State.CA); state.add(State.WY); Then today I read about using an anonymous subclass with instance &#8230; <a href="http://gabrito.com/post/instantiating-and-populating-a-list-or-collection">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In Java it always irks me when I have to create a collection and then populate it in separate steps as follows:</p>
<pre>List states = new ArrayList();
state.add(State.CA);
state.add(State.WY);</pre>
<p>Then today I read about using an <a href="http://home.comcast.net/~pholser/writings/concisions.html">anonymous subclass with instance initializer</a> to initialize a collection which appeals to the block loving Rubyist in me:<br />
<span id="more-160"></span></p>
<pre>List states = new ArrayList() {{ add(State.CA); add(State.WY); }};</pre>
<p>Another approach shown to me by a new co-worker specific to Lists (that involves creating an extra array) but is also quite short is:</p>
<p><!--adsense--></p>
<pre>List states = Arrays.asList(new State[]{State.CA, State.WY});</pre>
<p><strong>Update:</strong> <a href="http://cime.net/~ricky/">Ricky Clarkson</a> pointed out the best solution so far in my opinion (requires JDK 5 or higher) using varargs and generics:</p>
<pre>List&lt;String&gt; list=Arrays.asList("rocks","my","world");</pre>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/instantiating-and-populating-a-list-or-collection/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Upgrading to Spring 2.0 and Hibernate 3.2</title>
		<link>http://gabrito.com/post/upgrading-to-spring-20-and-hibernate-32</link>
		<comments>http://gabrito.com/post/upgrading-to-spring-20-and-hibernate-32#comments</comments>
		<pubDate>Fri, 20 Oct 2006 04:48:43 +0000</pubDate>
		<dc:creator>Todd Huss</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://gabrito.com/post/upgrading-to-spring-20-and-hibernate-32</guid>
		<description><![CDATA[Tonight I just completed the upgrade from Spring 1.2 and Hibernate 3.1 to Spring 2.0 and Hibernate 3.2 for work. I was expecting a rough upgrade but was pleasantly surprised how easily it went. Our entire unit and integration test &#8230; <a href="http://gabrito.com/post/upgrading-to-spring-20-and-hibernate-32">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tonight I just completed the upgrade from Spring 1.2 and Hibernate 3.1 to <a href="http://static.springframework.org/spring/docs/2.0.x/reference/new-in-2.html">Spring 2.0</a> and <a href="http://www.hibernate.org/344.html">Hibernate 3.2</a> for <a href="http://www.greatschools.net">work</a>. I was expecting a rough upgrade but was pleasantly surprised how easily it went.<br />
<span id="more-158"></span><br />
Our entire unit and integration test suite which hits Spring and Hibernate pretty good runs in about the same amount of time so there doesn&#8217;t appear to be any significant performance penalty or improvement with the upgrade.</p>
<p><!--adsense--></p>
<p>I had one minor problem and it was that we connect to multiple databases so we have multiple session factories that interact with EhCache. Hibernates org.hibernate.cache.EhCacheProvider now expects one configuration per sesssion factory which I wasn&#8217;t too excited about given we have 51 databases (1 database per state plus Washington DC) and it&#8217;s been working fine for 2 years with one cache provider. The problem caused this exception:</p>
<pre>
 Invocation of init method failed; nested exception is java.lang.NullPointerException
    [java] Caused by: org.springframework.beans.factory.BeanCreationException:
       Error creating bean with name 'surveysSessionFactory' defined in class path resource
          [gs/data/dao/hibernate/applicationContext-hibernate.xml]:
          Invocation of init method failed;
          nested exception is java.lang.NullPointerException
    [java] Caused by: java.lang.NullPointerException
    [java] at net.sf.ehcache.CacheManager.detectAndFixDiskStorePathConflict(CacheManager.java:269)
    ...
</pre>
<p>However, I wasn&#8217;t the only person who had this problem so a quick search turned up that EhCache now offers the net.sf.ehcache.hibernate.SingletonEhCacheProvider and switching the hibernate.cache.provider_class property to this new provider solved the problem and allows us to continue using a single cache provider.</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrito.com/post/upgrading-to-spring-20-and-hibernate-32/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

