<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Slackhacker</title>
	<atom:link href="http://slackhacker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://slackhacker.com</link>
	<description>Hackin&#039; and slackin&#039;!</description>
	<lastBuildDate>Mon, 31 Jan 2011 01:10:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='slackhacker.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Slackhacker</title>
		<link>http://slackhacker.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://slackhacker.com/osd.xml" title="Slackhacker" />
	<atom:link rel='hub' href='http://slackhacker.com/?pushpress=hub'/>
		<item>
		<title>Setting up Erjang with MacPorts</title>
		<link>http://slackhacker.com/2010/12/05/setting-up-erjang-with-macports/</link>
		<comments>http://slackhacker.com/2010/12/05/setting-up-erjang-with-macports/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 21:01:21 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[os/x]]></category>

		<guid isPermaLink="false">http://slackhacker.com/?p=423</guid>
		<description><![CDATA[To setup the JVM based Erlang VM (i.e. Erjang) follow this recipe: Install the Erlang port: sudo -i port install erlang Follow the build instructions on the Erjang wiki. export ERL_ROOT=/opt/local/lib/erlang Enjoy!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=423&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To setup the JVM based Erlang VM (i.e. Erjang) follow this recipe:</p>
<ol>
<li>Install the Erlang port: <code>sudo -i port install erlang</code></li>
<li>Follow the <a href="https://github.com/trifork/erjang/wiki/README">build instructions</a> on the Erjang wiki.</li>
<li><code>export ERL_ROOT=/opt/local/lib/erlang</code></li>
<li>Enjoy! <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=423&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/12/05/setting-up-erjang-with-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning to love Finder</title>
		<link>http://slackhacker.com/2010/10/24/learning-to-love-finder/</link>
		<comments>http://slackhacker.com/2010/10/24/learning-to-love-finder/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 18:17:40 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[os/x]]></category>

		<guid isPermaLink="false">http://slackhacker.com/?p=393</guid>
		<description><![CDATA[Let&#8217;s face it. The venerable OS X file manager, the Finder, is not a perfect tool. Finder is probably one of the aspects of OS X I like the least. It&#8217;s good for cruising around file systems in &#8220;column mode&#8221; and for browsing media files with Coverflow but for serious file management work I tend [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=393&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it.</p>
<p>The venerable OS X file manager, <strong>the Finder, is not a perfect tool</strong>. Finder is probably one of the aspects of OS X I like the least. It&#8217;s good for cruising around file systems in &#8220;column mode&#8221; and for browsing media files with Coverflow but for serious file management work I tend to want to drop into the Terminal as soon as possible. Problem is that the new Terminal window will not be in the same folder as to where I&#8217;ve navigated in Finder, causing me to lose context - every time.</p>
<p><a href="http://slackhacker.files.wordpress.com/2010/09/cdto.png"><img class="alignright size-full wp-image-408" title="cdto" src="http://slackhacker.files.wordpress.com/2010/09/cdto.png?w=388&#038;h=322" alt="" width="388" height="322" /></a>Recently I stumbled on <a href="http://code.google.com/p/cdto/">cdto</a> &#8211; a little app that adds an icon to Finder that open a Terminal window. With the current working directory set to the folder shown in Finder! No context lost!</p>
<p>And remember, the opposite operation  &#8211; opening a Finder window in the current working directory of a Terminal &#8211; is trivial with the always useful <tt>open</tt> command:</p>
<pre class="brush: plain;">
$ open .
</pre>
<p>When applied together, these two small tips makes it possible to <strong>use Finder only for the tasks where it shines</strong>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=393&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/10/24/learning-to-love-finder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>

		<media:content url="http://slackhacker.files.wordpress.com/2010/09/cdto.png" medium="image">
			<media:title type="html">cdto</media:title>
		</media:content>
	</item>
		<item>
		<title>How to set a custom DNS server with Java System properties</title>
		<link>http://slackhacker.com/2010/07/21/how-to-set-a-custom-dns-server-with-java-system-properties/</link>
		<comments>http://slackhacker.com/2010/07/21/how-to-set-a-custom-dns-server-with-java-system-properties/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 18:30:57 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://slackhacker.com/?p=387</guid>
		<description><![CDATA[Recently I was in the position of having to override the system default DNS server configuration with a custom DNS server for a Java app. Expecting this to be easily achievable along the line of the well-known http.proxyHost/http.proxyPort JVM parameters I whipped out Google. Turned out to not to be so simple. Obviously I got [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=387&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I was in the position of having to override the system default DNS server configuration with a custom DNS server for a Java app. Expecting this to be easily achievable along the line of the well-known <tt>http.proxyHost/http.proxyPort</tt> JVM parameters I whipped out Google.</p>
<p>Turned out to not to be so simple.</p>
<p>Obviously I got some search hits, but no simple recipe for the simple configuration change I was looking for. After spending some time with the leads I was able to conclude that, as a consequence of  an apparent exemple of over-engineering by Sun, the following is explicitly required just to change the JVM DNS server:</p>
<pre class="brush: java;">
//Override system DNS setting with Google free DNS server
System.setProperty(&quot;sun.net.spi.nameservice.nameservers&quot;, &quot;8.8.8.8&quot;);
System.setProperty(&quot;sun.net.spi.nameservice.provider.1&quot;, &quot;dns,sun&quot;);
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/387/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=387&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/07/21/how-to-set-a-custom-dns-server-with-java-system-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>Mercurial tooling reaching the tipping point</title>
		<link>http://slackhacker.com/2010/07/20/mercurial-tooling-reaching-the-tipping-point/</link>
		<comments>http://slackhacker.com/2010/07/20/mercurial-tooling-reaching-the-tipping-point/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 22:00:15 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://slackhacker.com/?p=379</guid>
		<description><![CDATA[A tipping point can be defined as the levels at which the momentum for change becomes unstoppable. I&#8217;d venture to state that distributed version control system Mercurial reached its tipping point when version 1.6.0 of MercurialEclipse recently was released.  At least for me. During the last years I&#8217;ve been consistently and repeatedly underwhelmed with the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=379&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_382" class="wp-caption alignright" style="width: 235px"><a href="http://slackhacker.files.wordpress.com/2010/07/hg.png"><img class="size-full wp-image-382" title="hg" src="http://slackhacker.files.wordpress.com/2010/07/hg.png?w=225&#038;h=591" alt="" width="225" height="591" /></a><p class="wp-caption-text">The MercurialEclipse context menu certainly looks comprehensive..</p></div>
<p>A tipping point can be defined as <em>the levels at which the momentum for change becomes unstoppable</em>.</p>
<p>I&#8217;d venture to state that distributed version control system Mercurial reached its tipping point when <a href="http://blogs.intland.com/main/entry/20100511">version 1.6.0 of MercurialEclipse recently was released</a>.  At least for me. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  During the last years I&#8217;ve been consistently and repeatedly underwhelmed with the state of Mercurial tooling in my favoured integrated development enviroment, resorting to use hg at the command line exclusively.  Command line interfaces are good for many things but it&#8217;s hard to let go of the comforts of a good GUI when one is used to the brilliant Subclipse Subversion plugin.</p>
<p>MercurialEclipse is a quantum leap. I sincerely hope the availability of first class Eclipse support for Mercurial will be the tipping point for distributed version control systems in general and Mercurial in particular!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/379/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=379&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/07/20/mercurial-tooling-reaching-the-tipping-point/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>

		<media:content url="http://slackhacker.files.wordpress.com/2010/07/hg.png" medium="image">
			<media:title type="html">hg</media:title>
		</media:content>
	</item>
		<item>
		<title>Top Clojure Links</title>
		<link>http://slackhacker.com/2010/02/23/top-clojure-links/</link>
		<comments>http://slackhacker.com/2010/02/23/top-clojure-links/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 21:45:00 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=368</guid>
		<description><![CDATA[On my quest to pick up Clojure during 2010 I&#8217;m primarily accompanied by the very solid Programming Clojure by Stuart Halloway. I&#8217;ve however also stumbled upon some interesting, cool, thought-provoking etc. Clojure resources on the web. So here goes &#8211; in no particular order: Clojure &#8211; Functional Programming for the JVM by R. Mark Volkmann is both a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=368&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On my quest <a href="http://slackhacker.wordpress.com/2010/01/24/weighing-in-on-programming-language-investment-options-for-2010/"><strong>to pick up Clojure during 2010</strong></a> I&#8217;m primarily accompanied by the very solid <em>Programming </em><em>Clojure</em> by Stuart Halloway. I&#8217;ve however also stumbled upon some interesting, cool, thought-provoking etc. Clojure resources on the web. So here goes &#8211; in no particular order:</p>
<p><a href="http://java.ociweb.com/mark/clojure/article.html">Clojure &#8211; Functional Programming for the JVM</a> by R. Mark Volkmann is both a great introductory article and a handy reference. Actually a cheap aspiring functional programmers alternative to <em>Programming Clojure</em>!</p>
<p><a href="http://jnb.ociweb.com/jnb/jnbMay2009.html">MiGLayout: The one Java layout manager that does it all</a> by Chris Hardin is another of the many excellent Java News Briefs by Object Computing, Inc. (OCI). MIGLayout is a Java Swing UI layout manager which is as powerful and expressive as the Clojure programming language. This makes MIGLayout an excellent choice for all your Clojure UI needs!</p>
<p><a href="http://vimeo.com/channels/fulldisclojure">Full Disclojure</a> is a series of easily digested screen casts highlighting a particular feature of Clojure in each episode. The screen casts are accompanied by clear audio and the well-paced action takes place directly at the REPL (as it should!). Full Disclojure is on an accessible level for newbies and covers, among other topics, many of the cool features introduced in Clojure 1.1.0.</p>
<p><a href="http://travis-whitton.blogspot.com/2009/09/hot-code-swapping-with-clojure.html">Hot Code Swapping</a> is not the exclusive domain of Erlang!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/368/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/368/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=368&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/02/23/top-clojure-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>Put a Spotlight on a MacPort</title>
		<link>http://slackhacker.com/2010/02/11/put-a-spotlight-on-a-macport/</link>
		<comments>http://slackhacker.com/2010/02/11/put-a-spotlight-on-a-macport/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 20:50:16 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[os/x]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=355</guid>
		<description><![CDATA[OS X essentiality MacPorts has a convenient command line user interface for querying and browsing available software packages. For instance a simple "ports info pine&#8221; will net: pine @4.64 (mail) Variants: darwin_9, ssl_plain Description: Pine is a tool for reading, sending, and managing electronic messages that was designed with novice users inmind. Homepage: http://www.washington.edu/pine/ Platforms: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=355&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>OS X essentiality <a href="http://www.macports.org/">MacPorts</a> has a convenient command line user interface for querying and browsing available software packages. For instance a simple <code>"ports info pine</code>&#8221; will net:</p>
<pre>pine @4.64 (mail)
Variants:             darwin_9, ssl_plain
Description:          Pine is a tool for reading, sending, and managing
                      electronic messages that was designed with novice
                      users inmind.
Homepage:             http://www.washington.edu/pine/

Platforms:            darwin
License:              unknown
Maintainers:          sean@fuzzymagic.com</pre>
<p>A more graphical option for the occasional port lookup is to use OS X built-in file indexing system <strong>Spotlight </strong>that happily provides as-you-type matching of available ports in the local ports tree.</p>
<div id="attachment_354" class="wp-caption aligncenter" style="width: 357px"><a href="http://slackhacker.files.wordpress.com/2010/01/screenshot_macports.png"><img class="size-full wp-image-354" title="screenshot_macports" src="http://slackhacker.files.wordpress.com/2010/01/screenshot_macports.png?w=347&#038;h=185" alt="" width="347" height="185" /></a><p class="wp-caption-text">The corresponding port file directory will  typically be the top match when searching for well-known unix software.</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/355/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=355&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/02/11/put-a-spotlight-on-a-macport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>

		<media:content url="http://slackhacker.files.wordpress.com/2010/01/screenshot_macports.png" medium="image">
			<media:title type="html">screenshot_macports</media:title>
		</media:content>
	</item>
		<item>
		<title>Weighing in on programming language investment options for 2010</title>
		<link>http://slackhacker.com/2010/01/24/weighing-in-on-programming-language-investment-options-for-2010/</link>
		<comments>http://slackhacker.com/2010/01/24/weighing-in-on-programming-language-investment-options-for-2010/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 18:56:25 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=325</guid>
		<description><![CDATA[In the classic text The Pragmatic Programmer: From Journeyman to Master Andrew Hunt and David Thomas make a very convincing case for practicing software developers to pick up a new programming language each year as a part of a deliberate knowledge investment plan. The software industry can be a pretty fast-moving place sometimes, and keeping [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=325&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the classic text<em> The Pragmatic Programmer: From Journeyman to Master</em> Andrew Hunt and David Thomas make a very convincing case for practicing software developers to <strong>pick up a new programming language each year</strong> as a part of a deliberate knowledge investment plan. The software industry can be a pretty fast-moving place sometimes, and keeping on top of (or even ahead of) the latest trends can be a pretty smart thing career-wise, particularly so in a recession. Also, new languages broadens ones horizons, and analogous with picking up new natural languages can further proficiency in ones mother tongue (bread-and-butter programming language).</p>
<p>The language of 2009 was <strong>Groovy </strong>for me. As a (primarily) Java developer you simply gotta love the groovy! I would like to describe the language as a super charged version of Java that shares most of Java syntax, but requires far less boiler plate code, supports dynamic typing and the <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">closures</a> Sun successfully has been able to keep out of the Java programming language up til now¹. Groovy is extremely interoperable with Java: groovy source code compiles to Java bytecode and calling Java code from Groovy or vice verse is trivial. The Groovy take on the famous Ruby-On-Rails web application framework, Grails, is an impressive invention even if it <a href="http://slackhacker.wordpress.com/2009/10/15/the-dark-side-of-grails/">has its problems</a>.</p>
<p><em>The Programmatic Programmer</em> argues that one should, just in conventional investing, diversify ones portfolio. For 2010 I&#8217;m ready to take on a language that shares far fewer traits with my current personal, as well and most of the industry&#8217;s, primary bread-and-butter language Java than Groovy does. Maybe even a  functional programming language. I decided on short listing <a href="http://en.wikipedia.org/wiki/Scala_%28programming_language%29">Scala</a>, <a href="http://en.wikipedia.org/wiki/Erlang_%28programming_language%29">Erlang</a> and <a href="http://en.wikipedia.org/wiki/Clojure">Clojure</a>.</p>
<h2>The short list</h2>
<p><strong>Scala</strong> appears to enjoy tremendous momentum for the moment. If Groovy is Java on steroids, Scala is Java 2.0. Founder of the Groovy programming language James Strachan has <a href="http://macstrac.blogspot.com/2009/04/scala-as-long-term-replacement-for.html">openly stated</a> that if Scala had been around in 2003, Groovy would probably never has seen the light of day. Scala supports a mixed imperative/functional programming model and is a statically typed language with an advanced type system. Scala compiles to JVM bytecode and is Java interoperable on the same level as Groovy. Unfortunately Scala appears be be a quite complex language &#8211; the &#8220;authoritative tutorial&#8221; on the language, <a href="http://www.artima.com/shop/programming_in_scala">Programming in Scala</a> by language founder Martin Odersky, contains more than 750 pages.</p>
<p><strong>Erlang</strong> is a  functional language with its origin within the telecommunication industry. Erlang has a strong focus on efficient concurrent execution and fault tolerance. Erlang is of Swedish origin, fully functional and has a syntax very different compared to C syntax language. On the down side, Java interoperability is very weak as Erlang compiles to a none-JVM bytecode. Also, Erlang momentum appears to currently be rather diminutive.</p>
<p><strong>Clojure</strong> is a <a href="http://en.wikipedia.org/wiki/LISP">LISP</a> and thus both <a href="http://en.wikipedia.org/wiki/Homoiconicity">homoiconic</a> and very functional in nature. The syntax is completely dissimilar to C languages, being much smaller and relying on liberal usage of lots and lots of nice parentheses. Clojure is fully JVM-interoperable and appears to have some traction within the developer community, perhaps not on the level of Scala but there&#8217;s definitely some momentum out there.</p>
<p>What investment option did you go with for this year?</p>
<p>¹) Late 2009, Sun finally &#8211; obviously much overdue &#8211; announced that we can expect <a href="http://tech.puredanger.com/2009/11/18/closures-after-all/">closures to be included in Java 1.7 after all</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/325/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=325&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/01/24/weighing-in-on-programming-language-investment-options-for-2010/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>OS X Essentials: MacPorts</title>
		<link>http://slackhacker.com/2010/01/17/os-x-essentials-macports/</link>
		<comments>http://slackhacker.com/2010/01/17/os-x-essentials-macports/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 22:26:22 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[os/x]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=305</guid>
		<description><![CDATA[There is plenty of great  Mac software available. Among my favorites are the instant messaging client Adium, the editor TextMate and the media center Plex. This is software that is OS X-only &#8211; stuff I really miss when I run Linux. However there is now way around the fact that Linux has an advantage when it comes to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=305&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is plenty of great  Mac software available. Among my favorites are the instant messaging client <a href="http://en.wikipedia.org/wiki/Adium">Adium</a>, the editor <a href="http://en.wikipedia.org/wiki/Textmate">TextMate </a>and the media center <a href="http://en.wikipedia.org/wiki/Plex_(software)">Plex</a>. This is software that is OS X-only &#8211; stuff I really miss when I run Linux. However there is now way around the fact that Linux has an advantage when it comes to general Unix software. Most stuff is only an <code>apt-get</code> away in Debian-derived Linux distributions, while you need to Google around to find a disk image when you are on a Mac, or &#8211; even uglier &#8211; download and untar something under <code>/usr/local</code> or similar.</p>
<p>However it is in fact perfectly possible to achieve an <code>apt-get</code> level of convenience on a Mac! The silver bullet is <a href="http://www.macports.org/">MacPorts </a>- a Mac implementation of the <a href="http://en.wikipedia.org/wiki/Ports_collection">BSD ports system</a>. The only problem is just that MacPorts is a ports implementation meaning that only source code is pulled from the net, all binaries are built locally (in the case of MacPorts with the Apple Xcode tool chain). MacPorts is thus a bad fit for the impatient (especially if one for instance would aspire to install the Gimp port with all its dependencies). I&#8217;ve no complaints with regard to the user interface (command line based just as <code>apt-get</code>) or port availability and upstream synchronization frequency. Everything I have desired to install so far has successfully been pulled down, configured, built and installed under the MacPorts prefix <code>/opt/local</code>.</p>
<p>I was delighted to find that MacPorts even provided a port of Java build tool staple Maven.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/305/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=305&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/01/17/os-x-essentials-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>Review: Practical API Design: Confessions of a Java Framework Architect</title>
		<link>http://slackhacker.com/2010/01/17/review-practical-api-design-confessions-of-a-java-framework-architect/</link>
		<comments>http://slackhacker.com/2010/01/17/review-practical-api-design-confessions-of-a-java-framework-architect/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 21:48:54 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[book review]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=294</guid>
		<description><![CDATA[I&#8217;m a bit behind schedule with regard to my book reviewing commitment but I&#8217;ve at least been able to finish off a couple of the volumes I committed to and now I am ready to share some views on Practical API Design by Jaroslav Tulach. This book is a rather personal presentation by Tulach &#8211; the author [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=294&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a bit behind schedule with regard to my <a href="http://slackhacker.wordpress.com/2009/11/05/the-latest-book-batch/">book reviewing commitment</a> but I&#8217;ve at least been able to finish off a couple of the volumes I committed to and now I am ready to share some views on <strong>Practical API Design</strong> by Jaroslav Tulach.</p>
<p>This book is a rather personal presentation by Tulach &#8211; the author is constantly relating to his personal experiences as developer/architect of the Netbeans platform (on which the famous IDE is built).  Tulach doesn&#8217;t refrain from lengthy, and sometimes rather esoteric, argumentations and analogies even going so far as to comparing API design with astronomical observations.</p>
<p>There are some golden nuggets here and there, some techniques and observations that were new to me, but in general I think there is too little meat and too much padding. The book is perhaps of most interest to designers of very long living API:s with a large number of disparate users, for lowly general Java devs like me there are far more rewarding reads among the books that have recently been published in the field of software engineering. A suggestion would be the extremely &#8220;meaty&#8221; <em>Clean Code: A Handbook of Agile Software Craftsmanship</em> by Robert C. Martin (a.k.a Uncle Bob).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/294/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=294&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2010/01/17/review-practical-api-design-confessions-of-a-java-framework-architect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing logging behaviour in four code lines flat</title>
		<link>http://slackhacker.com/2009/12/08/testing-logging-behaviour-in-four-code-lines-flat/</link>
		<comments>http://slackhacker.com/2009/12/08/testing-logging-behaviour-in-four-code-lines-flat/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 22:32:46 +0000</pubDate>
		<dc:creator>slackhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mockito]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://slackhacker.wordpress.com/?p=265</guid>
		<description><![CDATA[Adding assertions for logging behaviour to my unit tests have been a long standing item om my ToDo list. This imperfection have been a nagging thorn in my side since it obvious that logging is a critical aspect (no AOP pun intended) of any commercial system of importance. But I thought that it must be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=265&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Adding assertions for logging behaviour to my unit tests have been a long standing item om my ToDo list. This imperfection have been a nagging thorn in my side since it obvious that logging is a critical aspect (no <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">AOP</a> pun intended) of any commercial system of importance. But I thought that it must be hard and boring work to add tests for logging. To be honest I&#8217;m no fan of boring work. Recently I finally got around to take a shot at it and found it <strong>surprisingly easy to accomplish</strong> in a mavenized Spring project with the help of the everyone&#8217;s favorite Java mocking library: <a href="http://www.mockito.org">Mockito</a>.</p>
<p>Originally I though I had to modify all the classes under test to accept a log4j <a href="http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/Logger.html"><code>Logger</code></a> as constructor argument and mock that logger in the unit test. This would have required quite a lot of code rewrite since most classes in the project simply use:</p>
<pre class="brush: java;">
Logger.getLogger(this.getClass())
</pre>
<p>to get access to a logger instance. Also I don&#8217;t like the idea to &#8220;pollute&#8221; the constructors with additional arguments, most classes had just enough dependencies passed in that way as it were.</p>
<p>Next up was an idea to write a custom log4j <a href="http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/Appender.html"><code>Appender</code></a> and add a <code>log4j.properties</code> to <code>src/test/resources</code> with:</p>
<pre class="brush: java;">
log4j.rootLogger=ERROR,TESTAPPENDER
log4j.appender.TESTAPPENDER=com.my.fantastic.MockedAppender
</pre>
<p>The main problem with this approach is that <code>MockedAppender</code> instance would be shared by all unit tests, forcing manual (ugly!) resets of its state between test invocations.</p>
<p>Then I discovered that log4j provides an API for dynamic <code>Appender</code> configuration at runtime! What it all boiled down to became surprisingly succinct when some Mockito magic was applied. In fact <strong>only four code lines</strong> (ignoring imports, and other noise) bought me the capability to make assertions about the logging behavior of the code under test!</p>
<pre class="brush: java;">
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public class FooTest {
	private Appender appenderMock;
	@Before
	public void setupAppender() {
		appenderMock = mock(Appender.class);
		Logger.getRootLogger().addAppender(appenderMock);
	}
	@After
	public void removeAppender() {
		Logger.getRootLogger().removeAppender(appenderMock);
	}
	@Test
	public void testMethod()  {
		doStuffThatCausesLogging();
		verify(appenderMock).doAppend((LoggingEvent) anyObject());
	}
}
</pre>
<p>Using Mockito&#8217;s handy <a href="http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/index.html?org/mockito/ArgumentCaptor.html"><code>ArgumentCaptor</code></a> class it&#8217;s dead simple to make stronger assertions, with regard to for instance the level the message was logged at:</p>
<pre class="brush: java;">
		ArgumentCaptor&lt;LoggingEvent&gt; arguments = ArgumentCaptor.forClass(LoggingEvent.class);
		verify(appenderMock).doAppend(arguments.capture());
		assertThat(arguments.getValue().getLevel(), is(Level.WARN));
</pre>
<p>Ergo &#8211; I have no longer any excuse for settling for anything less than comprehensive unit tests, adding tests for logging is actually quite trivial using modern tools!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/slackhacker.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/slackhacker.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/slackhacker.wordpress.com/265/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=slackhacker.com&amp;blog=9798043&amp;post=265&amp;subd=slackhacker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://slackhacker.com/2009/12/08/testing-logging-behaviour-in-four-code-lines-flat/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d64c2589090e5666f087624520c3e323?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">slackhack</media:title>
		</media:content>
	</item>
	</channel>
</rss>
