<?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>christopherowen.id.au</title>
	<atom:link href="http://christopherowen.id.au/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://christopherowen.id.au/blog</link>
	<description>Stuff cubed plus one</description>
	<lastBuildDate>Mon, 11 Jan 2010 23:43:26 +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>The Happy Toggler</title>
		<link>http://christopherowen.id.au/blog/2010/01/11/the-happy-toggler/</link>
		<comments>http://christopherowen.id.au/blog/2010/01/11/the-happy-toggler/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 12:23:49 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[nerd]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=156</guid>
		<description><![CDATA[So I've been writing a lot of boolean toggling code recently, and it's been making me sad. Can't we make it happier?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been writing a lot of UI code lately, and one of the bread-and-butter operations in UI code is toggling boolean state, usually in response to a button press. Now, what does toggling code look like? </p>
<p>Say I have an object that likes to transition solely between happy states every time a certain event occurs. Here&#8217;s how I might handle it:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> theObject.<span style="color: #006633;">happy</span> <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>theObject.<span style="color: #006633;">happy</span><span style="color: #339933;">;</span></pre></div></div>

<p>There. Simple huh? Something you probably learn how to do in an introductory programming course. It might be surprising to you, but someone <a href="http://stackoverflow.com/questions/224311/cleanest-way-to-toggle-a-boolean-variable-in-java">asked a question on how to do this on Stack Overflow</a>. The other alternative provided in the answer is the somewhat more cerebral:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">theObject.<span style="color: #006633;">happy</span> <span style="color: #339933;">^=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span></pre></div></div>

<p>Thanks Spock. Of course if your language doesn&#8217;t have an assigning XOR operator this option is ruled out. If you value clarity of code, or you simply don&#8217;t want less brainy maintainers pestering you about what your code is doing, you rule this option out as well.</p>
<p>So I&#8217;ve been writing a lot of code recently of the first form, and it&#8217;s been making me sad. There&#8217;s a strong feeling of non object oriented-ness about it. I mean, to toggle the state of an object I have to:</p>
<ol>
<li>ask it what its current state is;
<li>flip that state locally;
<li>and then tell the object to take on this new state.
</ol>
<p>Bleh! Why the hell should I care what state it currently is in? I just want to toggle it! Shouldn&#8217;t I just be able to ask the object to toggle it&#8217;s own state; perhaps of even multiple properties in a batch sequence? </p>
<p>Naturally, nobody wants to write a toggling method for every writable boolean property of their objects. So either there needs to be automatic support in the platform or some ability to provide a general toggling abstraction.</p>
<p>One such example of a crude toggling abstraction would be a Ruby module defined like the following.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">module</span> Toggler
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">class</span> ToggleHelper
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>target<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@target</span> = target
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> method_missing<span style="color:#006600; font-weight:bold;">&#40;</span>sym<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@target</span>.<span style="color:#9900CC;">toggle</span><span style="color:#006600; font-weight:bold;">&#40;</span>sym<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">def</span> toggle; <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> toggle<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>sym<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> ToggleHelper.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> sym.<span style="color:#9900CC;">empty</span>?
&nbsp;
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{sym}=&quot;</span>, !<span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span>sym<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Such a module could be mixed-in at the appropriate levels of an inheritance hierarchy, or maybe even at the root level if you&#8217;re game.</p>
<p>With the mix-in mixed-in, toggling code would be more concise and less repetitious:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">the_object.<span style="color:#9900CC;">toggle</span>.<span style="color:#9900CC;">happy</span>
the_object.<span style="color:#9900CC;">toggle</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:happy</span><span style="color:#006600; font-weight:bold;">&#41;</span>
the_object.<span style="color:#9900CC;">toggle</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:wanted</span>, <span style="color:#ff3333; font-weight:bold;">:happy</span>, <span style="color:#ff3333; font-weight:bold;">:virtuous</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Doesn&#8217;t a declarative syntax such as this feel much more happy?</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2010/01/11/the-happy-toggler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stories what I wrote when I was ten</title>
		<link>http://christopherowen.id.au/blog/2009/10/15/stories-what-i-wrote-when-i-was-ten/</link>
		<comments>http://christopherowen.id.au/blog/2009/10/15/stories-what-i-wrote-when-i-was-ten/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 09:59:31 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=130</guid>
		<description><![CDATA[A youthful and somewhat insensitive re-telling of a classic fairy tale.]]></description>
			<content:encoded><![CDATA[<p>I present to you a youthful and somewhat insensitive re-telling of a classic fairy tale.</p>
<p><strong>Please note</strong>&mdash;The following story is not meant to imply that the residents of Chernobyl were:</p>
<ul>
<li>tax evaders; or</li>
<li>incompetent home builders; or</li>
<li>mean spirited; or</li>
<li>comparable to swine; or</li>
<li>given to formulaic naming of their children.</li>
</ul>
<p>Any resemblance to any person, living or dead, is purely (and tragically) coincidental.</p>
<h2>The Three Little Taxpayers</h2>
<p>by <cite>C. D. Owen.</cite> (Age 10)</p>
<p>Once upon a time, there were three little taxpayers and they lived in a Russian town called Chernobyl. Two lived in the outskirts of the town and they had made their homes of poor building material. One whose name was Yuri had made his house of straw. The other, whose name was Yori, had made his house of sticks and branches. Everyone in the town made fun of the them. The other taxpayer lived in the upper-crust of the city and he was very well-off. His name was Yari and he lived in a magnificent sky-scraper and he made fun of Yuri and Yari as well.</p>
<p>One day, the big bad tax-collector came along and his name was Yiri. He came to Yuri&#8217;s house and knocked on the woven door.</p>
<p>&ldquo;Little tax-payer, little tax-payer, let me in!&rdquo;<br />
&ldquo;Not by the vinyl of my skinny wallet!&rdquo;<br />
&ldquo;Then I&#8217;ll have to demolish your house!&rdquo;</p>
<p>So the big bad tax-collector went away and then came back with a bull-dozer. He then knocked over Yuri&#8217;s residence. He then went and on and came to Yori&#8217;s house of sticks.</p>
<p>&ldquo;Little money bag, little money bag, let me in!&rdquo;<br />
&ldquo;Not by the leatherette of my medium filled wallet!&rdquo; came the reply.<br />
&ldquo;Then I&#8217;ll have to demolish your house!&rdquo;</p>
<p>And again he went away and this time brought back a demolishing ball. He then knocked down Yori&#8217;s house. Then he continued along collecting debts. He then came to the sky-scraper belonging to Yari.</p>
<p>&ldquo;Little dollar-sign, little dollar-sign, let me in!&rdquo;<br />
And Yari replied, &ldquo;Not by the one hundred percent leather of my fat wallet!&rdquo;</p>
<p>And so away went the big, bad tax-collector yet another time. He then came back with a demolishing squad but they couldn&#8217;t destroy the sky-scraper because they didn&#8217;t have a permit to destroy large buildings.</p>
<p>As you have probably known, the big bad tax-collector was very greedy and he just had to have Yari&#8217;s wallet. So the big bad tax collector went to the Chernobyl nuclear power plant and he shut off the reactor&#8217;s cooling  systems and then the power plant blew up causing Yari&#8217;s building to glow and melt.</p>
<p>The next day the big bad tax-collector came back in his protective clothing and he searched the rubble for Yari&#8217;s wallet, which he never found but he was glad he gained his revenge.</p>
<p>The moral to this story is: pay your debts or you&#8217;ll be sorry!</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/10/15/stories-what-i-wrote-when-i-was-ten/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java developers have 99 problems&#8230;</title>
		<link>http://christopherowen.id.au/blog/2009/08/26/java-developers-have-99-problems/</link>
		<comments>http://christopherowen.id.au/blog/2009/08/26/java-developers-have-99-problems/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 13:49:11 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=119</guid>
		<description><![CDATA[Java developers have many problems but safe resource acquisition and release isn't one.]]></description>
			<content:encoded><![CDATA[<p>&#8230; but this ain&#8217;t one.</p>
<p>Today Yahuda Katz posted his <a href="http://yehudakatz.com/2009/08/24/my-10-favorite-things-about-the-ruby-language/">10 favourite things about the ruby language</a>. His list certainly reflects most of the things I find very appealing about the language. The sixth item highlights Ruby&#8217;s excellent support for blocks and lambdas and an argument is mounted that when performing file operations in languages without them, programmers are <q>forced to use an inline “ensure” block every in the same lexical scope that they originally opened the file in, to ensure that the resource is closed.</q> As is often the case the comparison is made to Java, but as any seasoned Java developer will tell you (and this point has probably be made many, many times) it just isn&#8217;t true. Java supports a safer and comparable idiom via the anonymous inner class. </p>
<p>The example given is a very succinct Ruby method to print out the lines of a text file. Ruby&#8217;s <kbd>File.open</kbd> ensures the file is properly closed after the block has completed, normally or otherwise:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> run<span style="color:#006600; font-weight:bold;">&#40;</span>input<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>input, <span style="color:#996600;">&quot;r&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span>
    f.<span style="color:#9900CC;">each_line</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>line<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> line <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The Java version listed does the same but, predictably, is far more verbose and laborious:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> in<span style="color: #009900;">&#41;</span> 
<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">FileNotFoundException</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">File</span> input <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>in<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> line<span style="color: #339933;">;</span> Scanner reader <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Scanner<span style="color: #009900;">&#40;</span>input<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>reader.<span style="color: #006633;">hasNextLine</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: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">nextLine</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>
  <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span> reader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>However no Java developer that values their sanity is ever going to sprinkle this pattern through their code base any time they want to use a File and ensure that it is closed properly. Here&#8217;s what they are going to use instead:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> Processor<span style="color: #339933;">&lt;</span>T<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">void</span> process<span style="color: #009900;">&#40;</span>T target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Scanner</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FileSlurper <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> slurp<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> fileName, Processor<span style="color: #339933;">&lt;</span>Scanner<span style="color: #339933;">&gt;</span> processor<span style="color: #009900;">&#41;</span> 
    <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">FileNotFoundException</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #003399;">File</span> input <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>fileName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Scanner reader <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Scanner<span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      processor.<span style="color: #006633;">process</span><span style="color: #009900;">&#40;</span>reader<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span>
      reader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Once that infrastructure is in place, the Java implementation of the example becomes:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">FileSlurper.<span style="color: #006633;">slurp</span><span style="color: #009900;">&#40;</span>input, <span style="color: #000000; font-weight: bold;">new</span> Processor<span style="color: #339933;">&lt;</span>Scanner<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> process<span style="color: #009900;">&#40;</span>Scanner reader<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">hasNextLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">nextLine</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>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>No one can argue that this is as pretty or convenient as the Ruby version, but it does ensure that file opening and closing is handled correctly without any effort from the client code. The code in the anonymous inner class can even access variables in the current lexical context, as with the Ruby block, with the caveat that they must be declared <kbd>final</kbd> (not quite a lexical closure!). This pattern, in conjunction with the <kbd>Processor</kbd> interface may be used any time there is a need for similar resource acquisition and clean&ndash;up procedures, as might be the case for locks or database connections.</p>
<p>Lambdas and blocks are very useful constructs, and the anonymous inner class can act as an acceptable, if far from ideal, analogue. What an anonymous inner class can&#8217;t do is act as a co&ndash;routine; this is a truly powerful feature of Ruby&#8217;s blocks and associated method invocation features that Java can&#8217;t directly compete with.</p>
<p>One thing&#8217;s for certain: the Ruby community won&#8217;t win over Java developers by giving examples of deficiencies where none exist.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/08/26/java-developers-have-99-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insoporia</title>
		<link>http://christopherowen.id.au/blog/2009/08/23/insoporia/</link>
		<comments>http://christopherowen.id.au/blog/2009/08/23/insoporia/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 15:18:31 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=116</guid>
		<description><![CDATA[Fear and self-loathing in Sydney.]]></description>
			<content:encoded><![CDATA[<p>And the sleep won&#8217;t come,<br />
the time ticks a pattern in my head,<br />
a memory of you enters and fades,<br />
a lost time, more potent than the time I&#8217;m losing now.</p>
<p>If I could choose, if I truly had free will,<br />
I&#8217;d run, I&#8217;d break out, I&#8217;d be unbonded, free.<br />
but while I&#8217;m here in this state, a listless nowhere,<br />
I can&#8217;t, I won&#8217;t, I&#8217;ll never be.</p>
<p>and even now, when I feel almost alive, I&#8217;ll falter<br />
search for words that won&#8217;t come, that will never say what I want to say<br />
I&#8217;ll think that at the very least, I&#8217;ve created something<br />
but for what purpose? In the end, I&#8217;ll hate them, hate it, loathe it all the same.</p>
<p>And the sleep still won&#8217;t come, but maybe I always am.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/08/23/insoporia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash your Fish</title>
		<link>http://christopherowen.id.au/blog/2009/06/05/bash-your-fish/</link>
		<comments>http://christopherowen.id.au/blog/2009/06/05/bash-your-fish/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 13:22:56 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[nerd]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[fish]]></category>
		<category><![CDATA[functions]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=109</guid>
		<description><![CDATA[I've recently started to spend some time with the Fish shell, although there is a problem with it: my collection of Bash functions that I've accumulated over the years in <kbd>.bashrc</kbd> are rendered impotent in this environment. Fortunately there is a quick way to bridge the gap.]]></description>
			<content:encoded><![CDATA[<p>I love shells. I spend an inordinate amount of every working day in one. That one happens to be Bash, arguably the most ubiquitous CLI shell in the world. It&#8217;s not bad at all, although sometimes I think CLIs could be so much more than they are today. Some <a href="http://directwebremoting.org/blog/joe/2009/05/27/command_lines.html">other people agree too</a>, but that delectable future seems a little way off.</p>
<p>An existing shell that aims to provide a better interactive experience is the <a href="http://fishshell.org/index.php">Friendly Interactive SHell &#8212; Fish</a>. I&#8217;ve recently started to spend some time with this shell although there is a problem with it: my collection of Bash functions that I&#8217;ve accumulated over the years in <kbd>.bashrc</kbd> are rendered impotent in this environment. Sure, I could spend some time and redefine them all in Fish&#8217;s shellscript dialect; or I could just abandon trying something new in the name of efficiency and laziness and head back to Bash. That does seem sad, and fortunately there is a way to bridge the gap.</p>
<p>For other souls in a similar situation to me, here&#8217;s some script you can pop in your <kbd>~/.config/fish/config.fish</kbd> (Fish&#8217;s equivalent to <kbd>.bashrc</kbd>)</p>
<pre>
function bash_env
    set -x BASH_ENV ~/.bash_functions
    bash -c "$argv"
end

for BASH_FUNCTION in (bash_env 'declare -F' | awk '{print $3}')
    eval "function $BASH_FUNCTION; bash_env $BASH_FUNCTION \$argv; end"
end
</pre>
<p>You&#8217;ll need to change the <kbd>BASH_ENV</kbd> setting on the second line to point to the file where you declare your Bash functions. I&#8217;ve moved my functions out of <kbd>.bashrc</kbd> and into a separate file that I source from <kbd>.bashrc</kbd>. This is because I also source <kbd>/etc/bash_completion</kbd> from <kbd>.bashrc</kbd>, and that is quite a time consuming process to do every time you want to run a simple Bash function from Fish.</p>
<p>Once that&#8217;s done, simply fire up Fish and type &#8216;functions&#8217;. You should see all of your old, dear Bash functions appear in the list, ready to aid you in your daily endeavours, just like times of old. Now, try the Fish!</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/06/05/bash-your-fish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Almost divine</title>
		<link>http://christopherowen.id.au/blog/2009/05/05/almost-divine/</link>
		<comments>http://christopherowen.id.au/blog/2009/05/05/almost-divine/#comments</comments>
		<pubDate>Mon, 04 May 2009 16:09:18 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[adam]]></category>
		<category><![CDATA[rodin]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=99</guid>
		<description><![CDATA[
This is a photograph I took of Auguste Rodin&#8217;s &#8220;The Three Shades&#8221; on the Palo Alto campus of Stanford University. I find myself mesmerized by its other-worldly, almost divine qualities. Awe and fear; peaceful yet harbouring a latent, almost callous, indifference.
]]></description>
			<content:encoded><![CDATA[<p><img src="http://christopherowen.id.au/blog/wp-content/uploads/2009/05/sculpture-small.jpg" alt="sculpture-small" title="sculpture-small" width="530" height="403" class="alignnone size-full wp-image-100" /></p>
<p>This is a photograph I took of Auguste Rodin&#8217;s &#8220;The Three Shades&#8221; on the Palo Alto campus of Stanford University. I find myself mesmerized by its other-worldly, almost divine qualities. Awe and fear; peaceful yet harbouring a latent, almost callous, indifference.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/05/05/almost-divine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fluid Rails search</title>
		<link>http://christopherowen.id.au/blog/2009/05/05/fluid-rails-search/</link>
		<comments>http://christopherowen.id.au/blog/2009/05/05/fluid-rails-search/#comments</comments>
		<pubDate>Mon, 04 May 2009 13:48:57 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[nerd]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[fluid]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ssb]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=86</guid>
		<description><![CDATA[Having quick access to API documentation is one of the absolutely essential requirements during my development day. Here's what I use to for quick access to Rails documentation.]]></description>
			<content:encoded><![CDATA[<p>Having quick access to API documentation is one of the absolutely essential requirements during my development day. I have knowledge of so many different technologies, APIs, syntaxes, runtime behaviours, protocols, editing environment commands and shortcuts crammed into my head that I&#8217;m well beyond having perfect recall of every single detail of whatever I happen to be working with. At the start of my Ruby programming adventures, I was always trawling through the online Ruby and RoR documentation, either using Google to find references or Firefox&#8217;s inbuilt page search to find a method, module or class in the framed documentation lists. This was wholly unsatisfying, particularly with how web browsers search through frame-sets. I also seem to have a major personality defect in which I will persist in certain kinds of suboptimal practices for far too long; I&#8217;m often loath to steal time from a current task to thrash out a solution to something that is bothering me at the fringes. Eventually I snapped and asked my colleagues what they used to satisfy their API reference needs when working with Rails. I was dismayed when I was told they used the same strategy as mine. There had to be something a little less primitive.</p>
<h2>Enter the Rails Searchable API Doc</h2>
<p>A few weeks ago I was directed to <a href="http://railsapi.com/">the Rails Searchable API Doc beta</a> by Vladimir Kolesnikov: a nicely bundled, offline, HTML Rails API reference with full search facilities. Simply download a bundle (Rails, Ruby and gem documentation bundles are available) and unpack in a convenient location. Open the <tt>index.html</tt> file and voila! You now have a nice and fast Rails API reference available offline. The only problem with this is that a web browser is a very ad-hoc environment. I often have scores of tabs open, browsing random resources around the web. This meant that I now had the problem of trying to find my current Rails documentation amidst all of the other random guff that builds up in my browser. </p>
<h2>Enter Fluid</h2>
<p><a href="http://fluidapp.com">Fluid</a> is a Mac OS X application that enables the configuration of <a href="http://en.wikipedia.org/wiki/Site-specific_browser">site-specific browsers</a>. An SSB can essentially make a web application appear much like a first-class desktop application via a dedicated web browser sandbox. An SSB is a great way to keep your Google Reader, Facebook or other web sessions completely separate from each other, hosted in separate processes complete with individual Dock icons. It also turns out to be a really handy way of keeping HTML based references close at hand.</p>
<p>Simply:</p>
<ol>
<li>Grab <a href="http://fluidapp.com/">Fluid</a> and <a href="http://railsapi.com/">the Rails Searchable API.</a></li>
<li>Snag <a href="http://azizash.deviantart.com/art/Ruby-on-Rails-icon-pack-81755219">a nice Ruby on Rails icon</a>. This is to be used for the Dock.</li>
<li>Unpack all of these bundles into appropriate places.</li>
<li>Launch Fluid and set up a Rails API site-specific browser.</li>
<p><img src="http://christopherowen.id.au/blog/wp-content/uploads/2009/05/fluid.jpg" alt="Fluid configuration" title="fluid" width="555" height="323" class="size-full wp-image-88" />
</li>
<li>Consider dragging the generated SSB to the Dock.</li>
<li>Enjoy!<br />
<img src="http://christopherowen.id.au/blog/wp-content/uploads/2009/05/fluid-rails-api-11.jpg" alt="fluid-rails-api-11" title="fluid-rails-api-11" width="530" height="410" class="alignnone size-full wp-image-92" />
</li>
</ol>
<p>Fluid uses WebKit as its rendering engine, and configuration of the browser is naturally very similar to Safari. By default it maximizes browsing area by eliminating the tool and status bars but these can be added via the menu. In the screen shot you can see I&#8217;ve added back, forward and font resizing buttons. For a documentation SSB, it also makes sense to set Fluid to only hide the window when the window is closed. Such a setting is available in the <tt>Behaviour</tt> tab of the application preferences.</p>
<p>For those with open source cravings, Mozilla Labs has an SSB project called <a href="http://labs.mozilla.com/projects/prism/">Prism</a> that offers similar functionality, although I find their offering a little more sparse.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/05/05/fluid-rails-search/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The clock keeps ticking</title>
		<link>http://christopherowen.id.au/blog/2009/03/25/the-clock-keeps-ticking/</link>
		<comments>http://christopherowen.id.au/blog/2009/03/25/the-clock-keeps-ticking/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 08:48:10 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[atlassian]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[silverbrook]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=75</guid>
		<description><![CDATA[Don't blink, or you might just miss a significant fraction of a year. I've made that mistake.]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t blink, or you might just miss a significant fraction of a year. I&#8217;ve made that mistake.</p>
<p>Over three months ago now, I left my position as Technical Lead on <a href="http://www.atlassian.com/">Atlassian</a>&#8217;s <a href="http://www.atlassian.com/software/confluence">Confluence</a> team. It&#8217;s still an odd thing to state. I still believe that Atlassian is one of the best companies in Australia to work for as a software or technical support engineer, especially if Java development takes your fancy. Some of the most passionate and knowledgeable Java developers I have ever known work there. I&#8217;d like to thank everyone at Atlassian for their tremendous work and invaluable friendship. I had a truly memorable, enjoyable and productive three years there; they will always be a highlight and serve as a formidable benchmark.</p>
<p>But I&#8217;m a hopelessly restless person. I still feel like such an amateur in many respects. I&#8217;ve been developing software professionally for coming on a decade now plus many years tinkering with programming before my first paid position and I still feel I&#8217;ve much more to learn. I crave new experiences and problems. As such, I&#8217;ve taken a new position, working as a software engineer at <a href="http://www.silverbrookresearch.com/">Silverbrook Research</a>. My first project is being built using Ruby on Rails, something I&#8217;ve wanted to learn but never managed to find the time along with everything else I want to do. My new position offers some unique opportunities, and I&#8217;m excited to be involved. I hope to blog more about my experiences using this platform.</p>
<p>The wheel keeps turning, and there appears to be never a shortage of interesting problems to solve, or interesting tools to help solve them. Even after all of this time, I still love doing what I do, and working with people who love what they do too.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2009/03/25/the-clock-keeps-ticking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strange days</title>
		<link>http://christopherowen.id.au/blog/2008/10/09/strange-days/</link>
		<comments>http://christopherowen.id.au/blog/2008/10/09/strange-days/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 04:21:36 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=48</guid>
		<description><![CDATA[I'll go no farther I think, this is where I'll stay.]]></description>
			<content:encoded><![CDATA[<p>I walk down a narrow, high walled alley of some Mediterranean village. The sun beats down through the topless canyons, a harsh glow, warmth evaporated, an exuberant promise unkept.</p>
<p>Energy suddenly drains from me instantaneously, my legs sag and I flop against the blue wash wall, totally spent, the bag that I&#8217;m carrying falling limply to the ground. People stroll pass; some look at me, but through me, no recognition apparent, no friendly hand or aid. The remainder continue on oblivious. I&#8217;m not going any farther; this is where I&#8217;m going to stay, anchored to this ground, destination unknown and irresistibly unreachable.</p>
<p>Two young girls ride pass on bikes, they giggle as they pluck the sunglasses from my face. The sun flares in my eyes angrily, yet its heat still plays truant. Cute I think and wait for them to return them to me, but they don&#8217;t &#8211; they ride off, content with their spoils, unsympathetic to the fire in my mind. How could they? I ponder as if it really matters.</p>
<p>Time passes; an age; an instant. I return and I&#8217;m still affixed. I look down to my bag, the pound cake I was carrying is gone, no evidence of its existence, unless a bent clipboard and a crumpled piece of paper are a new confection. </p>
<p>I&#8217;ll go no farther I think, this is where I&#8217;ll stay.</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2008/10/09/strange-days/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>HTTP Humour</title>
		<link>http://christopherowen.id.au/blog/2008/08/01/http-humour/</link>
		<comments>http://christopherowen.id.au/blog/2008/08/01/http-humour/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 06:44:45 +0000</pubDate>
		<dc:creator>Christopher Owen</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[nerd]]></category>
		<category><![CDATA[http gone rest]]></category>

		<guid isPermaLink="false">http://christopherowen.id.au/blog/?p=45</guid>
		<description><![CDATA[This post contains bad nerd humour. Please exercise caution.]]></description>
			<content:encoded><![CDATA[<p>Today I posted this picture to an internal discussion at <a href="http://www.atlassian.com/">Atlassian</a> on RESTful APIs.</p>
<div>
<img src="http://christopherowen.id.au/blog/wp-content/uploads/2008/08/tombstone-410-300x180.jpg" alt="Tombstone with \&quot;410\&quot; GONE engraved" title="tombstone-410" width="300" height="180" class="size-medium wp-image-44" />
</div>
<p><a href="http://fishbowl.pastiche.org/">Charles</a> added some additional, thoughtful alternatives:</p>
<blockquote><p>Depending on your belief or not in an afterlife/reincarnation, it could be <tt>301 Moved Permanently</tt>, or if you believe <a href="http://en.wikipedia.org/wiki/John_Edward" rel="nofollow">John Edward</a>, <tt>305 Use Proxy</tt>.</p></blockquote>
<p>Yes &#8212; we do think this is funny <img src='http://christopherowen.id.au/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  If you do to, perhaps <a href="http://www.atlassian.com/about/jobs.jsp">you should consider joining us</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://christopherowen.id.au/blog/2008/08/01/http-humour/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
