<?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>ideas.each &#38;:post &#187; Software</title>
	<atom:link href="http://blog.tobiascrawley.net/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tobiascrawley.net</link>
	<description>Another not so cleverly named blog mostly about software.</description>
	<lastBuildDate>Fri, 28 May 2010 13:56:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>open_exception gem: now with better emacs support!</title>
		<link>http://blog.tobiascrawley.net/2010/05/28/open_exception-gem-now-with-better-emacs-support/</link>
		<comments>http://blog.tobiascrawley.net/2010/05/28/open_exception-gem-now-with-better-emacs-support/#comments</comments>
		<pubDate>Fri, 28 May 2010 13:56:51 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=325</guid>
		<description><![CDATA[I just released v0.3.1 of the open_exception gem. This release does a better job of handling exceptions that have been munged by Rails, and now provides a tempfile containing the full stack trace to the open command. If you are using emacs, you can use the :emacs_with_trace open command, and get the stack trace as [...]]]></description>
			<content:encoded><![CDATA[<p>I just released <a href="http://rubygems.org/gems/open_exception">v0.3.1</a> of the <a href="http://blog.tobiascrawley.net/2010/04/26/open_exception-gem-auto-open-exceptions-in-your-editor/">open_exception gem</a>. This release does a better job of handling exceptions that have been munged by Rails, and now provides a tempfile containing the full stack trace to the open command. </p>

<p>If you are using emacs, you can use the <code>:emacs_with_trace</code> open command, and get the stack trace as a navigable compilation buffer (next to || below) the source file in a split frame. For this to work, you&#8217;ll need to add the following function to your emacs init:</p>

<script src="http://gist.github.com/417151.js?file=gistfile1.el"></script>

<p>See github for the <a href="http://github.com/tobias/open_exception">code</a> and <a href="http://github.com/tobias/open_exception/blob/master/README.md"><span class="caps">README</span></a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2010/05/28/open_exception-gem-now-with-better-emacs-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>open_exception gem: auto open exceptions in your editor</title>
		<link>http://blog.tobiascrawley.net/2010/04/26/open_exception-gem-auto-open-exceptions-in-your-editor/</link>
		<comments>http://blog.tobiascrawley.net/2010/04/26/open_exception-gem-auto-open-exceptions-in-your-editor/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 21:58:13 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=318</guid>
		<description><![CDATA[open_exception opens an exception in your favorite editor when developing locally. It works by parsing the backtrace, and opening the offending file at the offending line in your favorite editor (assuming your favorite editor supports remote open commands). You can add filters that allow you to ignore some exceptions, and filters that allow you to [...]]]></description>
			<content:encoded><![CDATA[<p>open_exception opens an exception in your favorite editor when developing locally. It works by parsing the backtrace, and opening the offending file at the offending line in your favorite editor (assuming your favorite editor supports remote open commands).</p>

<p>You can add filters that allow you to ignore some exceptions, and filters that allow you to scope the backtrace search. The backtrace scoping is useful for opening the last call in your application code when the exception occurs in a framework or lib.</p>

<p>If you are on MacOSX and have the <a href="http://rubygems.org/gems/growl">growl gem</a> installed, you will get a growl notification with the exception message when the file is opened.</p>

<h3>Editors</h3>

<p>Out if the box, the gem supports three editors (with the following open commands):</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    <span style="color:#ff3333; font-weight:bold;">:emacs</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'/usr/bin/emacsclient -n +{line} {file}'</span>,
    <span style="color:#ff3333; font-weight:bold;">:textmate</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'/usr/local/bin/mate -a -d -l {line} {file}'</span>,
    <span style="color:#ff3333; font-weight:bold;">:macvim</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'/usr/local/bin/mvim +{line} {file}'</span></pre></div></div>




<p>Note: if using emacs, you will need to be running <code>emacsserver</code>. To start the server: <code>M-x server-start</code><br />
or add <code>(server-start)</code> to your init.</p>

<h3>Configuration</h3>

<p>To configure, pass a block to the configure method:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    OpenException.<span style="color:#9900CC;">configure</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>oe<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#008000; font-style:italic;"># open_with can be one of the built in editors (:emacs, :macvim, :textmate)</span>
      <span style="color:#008000; font-style:italic;"># or a command to execute to open the file, where {file} and {line} will be replaced</span>
      <span style="color:#008000; font-style:italic;"># with the file path and line number, respectively. See 'Editors' above for an example.</span>
      <span style="color:#008000; font-style:italic;"># The default editor is :emacs.</span>
&nbsp;
      oe.<span style="color:#9900CC;">open_with</span> = <span style="color:#ff3333; font-weight:bold;">:emacs</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># you can add exclusion filters to ignore exceptions. A filter can be an exception class to </span>
      <span style="color:#008000; font-style:italic;"># ignore, or a proc that is passed the exception, and should evaluate to true if the exception </span>
      <span style="color:#008000; font-style:italic;"># should be ignored. Be careful with using a class - it uses is_a?, so any subclasses of the</span>
      <span style="color:#008000; font-style:italic;"># passed class will be ignored as well. The list of filters is [] by default.</span>
&nbsp;
      oe.<span style="color:#9900CC;">exclusion_filters</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> SomeErrorClass
      oe.<span style="color:#9900CC;">exclusion_filters</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>exception<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#9966CC; font-weight:bold;">if</span> exception_should_be_excluded <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># you can scope the search for the file:line to open with a filter as well. A filter can be a </span>
      <span style="color:#008000; font-style:italic;"># regular expression that is matched against the line, or a proc that is passed the line and </span>
      <span style="color:#008000; font-style:italic;"># should evaluate to true if the line should be used. The first line that any filter passes for </span>
      <span style="color:#008000; font-style:italic;"># will be the file:line that is opened. This is useful for opening the point in the stack just</span>
      <span style="color:#008000; font-style:italic;"># before control passes out of your app code when the exception occurs in an external </span>
      <span style="color:#008000; font-style:italic;"># lib/framework. The list of filters is [] by default. </span>
&nbsp;
      oe.<span style="color:#9900CC;">backtrace_line_filters</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">/</span>app<span style="color:#006600; font-weight:bold;">/</span>root<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>app<span style="color:#006600; font-weight:bold;">|</span>lib<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span> 
      oe.<span style="color:#9900CC;">backtrace_line_filters</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>backtrace_line<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#9966CC; font-weight:bold;">if</span> line_should_be_used <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>




<h3>Rails Integration</h3>

<p>The gem also alias chains in to rails&#8217; <code>ActionController#rescue_action_locally</code> method to automatically open exceptions in development mode. The gem also adds the following filter to the <code>:backtrace_line_filters</code> to scope the opened files to the app:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    @<span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#008000; font-style:italic;">#{Rails.root}/(app|lib)}@</span></pre></div></div>




<p>To replace or remove this filter, you will need to reset the <code>:backtrace_line_filters</code> in your configure block:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    OpenException.<span style="color:#9900CC;">configure</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>oe<span style="color:#006600; font-weight:bold;">|</span>
      oe.<span style="color:#9900CC;">backtrace_line_filters</span> = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      oe.<span style="color:#9900CC;">backtrace_line_filters</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> my_new_filter
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>




<p>This has been tested with rails v2.3.5, but should work fine with 2.1 &lt;= rails &lt; 3. It may work with rails 3 as well, I just haven&#8217;t yet looked at rails 3.</p>

<h3>Standalone/Other Frameworks</h3>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">    <span style="color:#008000; font-style:italic;"># To manually open an exception, or wire it up in another framework, you call:</span>
    OpenException.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>exception<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># You can override the default (or configured) options by passing a hash as the second arg:</span>
    OpenException.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>exception, <span style="color:#006600; font-weight:bold;">&#123;</span>:open_with <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:textmate</span>, <span style="color:#ff3333; font-weight:bold;">:backtrace_line_filters</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>filter, another_filter<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>




<p>The source is on <a href="http://github.com/tobias/open_exception">github</a>, and the gem is on <a href="http://rubygems.org/gems/open_exception">rubygems</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2010/04/26/open_exception-gem-auto-open-exceptions-in-your-editor/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Generate a migration and open it in a buffer (in Emacs)</title>
		<link>http://blog.tobiascrawley.net/2010/03/19/generate-a-migration-and-open-it-in-a-buffer-in-emacs/</link>
		<comments>http://blog.tobiascrawley.net/2010/03/19/generate-a-migration-and-open-it-in-a-buffer-in-emacs/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 13:35:57 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=312</guid>
		<description><![CDATA[Requires rinari]]></description>
			<content:encoded><![CDATA[<p><script src="http://gist.github.com/337495.js?file=rails-generate-migration.el"></script><br />
<strong>Requires <a href="http://rinari.rubyforge.org/">rinari</a></strong></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2010/03/19/generate-a-migration-and-open-it-in-a-buffer-in-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Commenting out blocks of ruby in emacs</title>
		<link>http://blog.tobiascrawley.net/2010/02/17/commenting-out-blocks-of-ruby-in-emacs/</link>
		<comments>http://blog.tobiascrawley.net/2010/02/17/commenting-out-blocks-of-ruby-in-emacs/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 04:56:37 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=302</guid>
		<description><![CDATA[I&#8217;ve been an emacs user for 12+ years, and am ashamed to admit that I&#8217;ve never learned emacs lisp (yes, my last post was about emacs lisp code, but it was a copy and paste with a few changes, and I certainly didn&#8217;t understand what it was doing). Until now, that is. I started reading [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been an <a href="http://www.gnu.org/software/emacs/">emacs</a> user for 12+ years, and am ashamed to admit that I&#8217;ve never learned <a href="http://en.wikipedia.org/wiki/Emacs_Lisp">emacs lisp</a> (yes, my last post was about emacs lisp code, but it was a copy and paste with a few changes, and I certainly didn&#8217;t understand what it was doing). Until now, that is. I started reading the <a href="http://www.gnu.org/software/emacs/emacs-lisp-intro/">emacs lisp intro</a>, but only got about fifty pages in to it before I got the itch to write some code.</p>

<p>So here it is. Its a package that allows you to comment out a block of ruby code from a keybinding (I&#8217;m sure there is code out there to do this already, but it was a fun learning challenge).</p>

<p>The main function is <code>comment-ruby</code>, which I have bound to <code>C-:</code>. If there is a region active, it comments out the region. If that region is less than five lines, each line is commented with  &#8216;# &#8216;, otherwise the entire region is wrapped in <code>=begin...=end</code>. If the region is not active, the current line is commented out with &#8216;# &#8216;.</p>

<p>After a region has been commented out, the point (cursor) is set to the line above or below the region, depending on whether the point was at the beginning or end of the region when called.</p>

<p>Here is the code &#8211; it probably isn&#8217;t idiomatic lisp. If you have any suggestions on improving the code or making it more idiomatic, please let me know!</p>

<script src="http://gist.github.com/306302.js?file=comment-ruby.el"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2010/02/17/commenting-out-blocks-of-ruby-in-emacs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Emacs tip: running ack in the project root w/rinari</title>
		<link>http://blog.tobiascrawley.net/2010/02/11/emacs-tip-running-ack-in-the-project-root-wrinari/</link>
		<comments>http://blog.tobiascrawley.net/2010/02/11/emacs-tip-running-ack-in-the-project-root-wrinari/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 04:16:25 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=292</guid>
		<description><![CDATA[This post covers how to combine the awesomeness of ack with rinari in emacs to run ack in the project root by default. (If you aren&#8217;t using ack, definitely check it out for searching your codebase. If you aren&#8217;t using emacs, this post isn&#8217;t going to convince you to switch). I&#8217;ve been using Kim van [...]]]></description>
			<content:encoded><![CDATA[<p>This post covers how to combine the awesomeness of <a href="http://betterthangrep.com/">ack</a> with <a href="http://rinari.rubyforge.org/">rinari</a> in emacs to run ack in the project root by default. (If you aren&#8217;t using ack, definitely check it out for searching your codebase. If you aren&#8217;t using emacs, this post isn&#8217;t going to convince you to switch). </p>

<p>I&#8217;ve been using <a href="http://www.rooijan.za.net/">Kim van Wyk&#8217;s</a> <a href="http://www.rooijan.za.net/?q=ack_el">ack.el</a> for a few months now, but was annoyed that I had to tell it the directory where to run ack, when in most cases I wanted it to run in the root of my Rails app. So I copied the <code>ack</code> function from ack.el and made one that only asks for the search pattern, then runs in the root of the app (provided by rinari&#8217;s <code>rinari-root</code> function). I then bound that function to <code>C-c f a</code>. </p>

<p>Here is the code:<br />
<script src="http://gist.github.com/301205.js?file=ack-in-project.el"></script></p>

<p><strong>Note:</strong> you will need <a href="http://rinari.rubyforge.org/">rinari</a> and <a href="http://www.rooijan.za.net/?q=ack_el">ack.el</a> loaded, and <a href="http://betterthangrep.com/">ack</a> will need to be in your path.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2010/02/11/emacs-tip-running-ack-in-the-project-root-wrinari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refreshing an individual gemspec</title>
		<link>http://blog.tobiascrawley.net/2009/12/08/refreshing-an-individual-gemspec/</link>
		<comments>http://blog.tobiascrawley.net/2009/12/08/refreshing-an-individual-gemspec/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 22:34:48 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[why am I not using bundler?]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=288</guid>
		<description><![CDATA[I&#8217;m in the process of upgrading a rails app from 2.1 to 2.3, and 2.3 wants me to refresh some of the gemspecs for my vendored gems. Unfortunately, when I run rake gems:refresh_specs I get the dreaded: rake aborted! can't activate , already activated json-1.1.9 I was able to refresh the spec in question outside [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in the process of upgrading a rails app from 2.1 to 2.3, and 2.3 wants me to refresh some of the gemspecs for my vendored gems. Unfortunately, when I run <code>rake gems:refresh_specs</code> I get the dreaded:</p>



<pre>
rake aborted!
can't activate , already activated json-1.1.9
</pre>



<p>I was able to refresh the spec in question outside of rake with (in the console):</p>



<pre>
&gt;&gt; Rails::GemDependency.from_directory_name('vendor/gems/gem_name-0.1.0', false).refresh
</pre>



<p>Hopefully that helps someone else out.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2009/12/08/refreshing-an-individual-gemspec/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The quest for a better keyboard layout</title>
		<link>http://blog.tobiascrawley.net/2009/12/05/the-quest-for-a-better-keyboard-layout/</link>
		<comments>http://blog.tobiascrawley.net/2009/12/05/the-quest-for-a-better-keyboard-layout/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 00:40:54 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[keyboard layout]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ukelele]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=241</guid>
		<description><![CDATA[The Quest Like most programmers, I type a lot &#8211; many hours a day, most days of the week. The keyboard is the primary conduit of my creative expression most of the time, whether I&#8217;m writing code or constructing elaborate stories to impress friends, clients, or co-workers (aka email/chat/this blog). For the last couple of [...]]]></description>
			<content:encoded><![CDATA[<h3>The Quest</h3>

<p> <img src="http://blog.tobiascrawley.net/wp-content/uploads/2009/12/AdventureQuest-header5-300x166.jpg" alt="" title="" width="300" height="166" class="alignleft size-medium wp-image-249" /></p>

<p>Like most programmers, I type a lot &#8211; many hours a day, most days of the week. The keyboard is the primary conduit of my creative expression most of the time, whether I&#8217;m writing code or constructing elaborate stories to impress friends, clients, or co-workers (aka email/chat/this blog). For the last couple of years, I&#8217;ve been mildly obsessed with making that conduit more efficient. I&#8217;ve <a href="http://en.wikipedia.org/wiki/IBM_Model_M">tried</a> <a href="http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=043">several</a> <a href="http://www.kinesis-ergo.com/images/freestyle-solo_690x375.jpg">different</a> <a href="http://www.kinesis-ergo.com/index.htm">keyboards</a> and entirely new <a href="http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard">keyboard</a> <a href="http://en.wikipedia.org/wiki/Colemak#Colemak">layouts</a>. </p>

<p>I stopped the keyboard search with the <a href="http://www.kinesis-ergo.com/index.htm">Kinesis Advantage</a> &#8211; it works really well for me, and is the easiest keyboard for touch typing that I&#8217;ve ever used. But the keyboard layout search continued. The productivity hit during the learning period for <a href="http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard">Dvorak</a> or <a href="http://en.wikipedia.org/wiki/Colemak#Colemak">Colemak</a> was too great, and I quickly slid back to <a href="http://en.wikipedia.org/wiki/Qwerty">Qwerty</a>. </p>

<p>I could type as fast as I wanted in Qwerty, so I tried to figure out what was really bugging me about my typing. I realized it was the shift key &#8211; I was frustrated with the high percentage of characters I typed that involved shift. I primarily code in Ruby, which uses &#8216;_&#8217; much more often than &#8216;-&#8217; (about 14 times more often), &#8216;:&#8217; more than &#8216;;&#8217; (about 78 times more often!), and &#8216;{}&#8217; more than &#8216;[]&#8216; (or so I thought &#8211; more on that later). </p>

<p>I then decided to create a custom keyboard layout that would reduce the need for the shift key when coding. My goals were:</p>


<ul>
<li>no remapping of the letter keys, since my muscle memory knows where they all are</li>
<li>remap commonly used symbols to be available without the shift key</li>
<li>be easy to learn, so no remapping characters to new keys</li>
</ul>



<p>Using the <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=Ukelele">Ukelele</a> keyboard layout editing tool (for MacOS), I played around with some layout ideas before settling on the one I&#8217;ve been using since May 2009.</p>

<h3>The Layout</h3>

<p><img src="http://blog.tobiascrawley.net/wp-content/uploads/2009/12/covered-model-railway-layout-300x253.jpg" alt="" title="" width="300" height="253" class="alignright size-medium wp-image-252" />
Since I mostly code in Ruby, and mostly use symbols in code vs. email/chat/etc., I remapped the shifted symbols I used more often.<br />
I &#8216;shift-swapped&#8217; (meaning the symbol you get with or without the shift key depressed are reversed) the following character pairs:</p>


<ul>
<li>{ [</li>
<li>} ]</li>
<li>| \</li>
<li>~ `</li>
<li>: ;</li>
<li>_ -</li>
</ul>




<p>I assumed that I used most of the symbols on the top row number keys more than I used the numbers, so I shift-swapped the 1 &#8211; 0 number keys with the corresponding symbol. If caps-lock is on, number keys revert to normal, but all of the other symbol keys remain swapped (meaning when caps-lock is on, pressing the &#8217;1&#8242; key will give you a 1, but pressing the &#8216;[' key will give you a {). Since the Kinesis keyboard does not have a separate keypad, this makes entering number sequences easier. </p>

<p>The caps-lock key has been moved to the f1 key, and I use the original caps-lock as a control key (for <a href="http://en.wikipedia.org/wiki/Emacs">Emacs</a>). This mapping can't be done by <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=Ukelele">Ukelele</a>, since it cannot remap function or modifier keys, so I did this using the remapping functionality in the Kinesis keyboard itself.</p>

<h3>Analysis</h3>

<p>After six weeks or so of using the new layout, I decided to analyze a large ruby codebase to see what my shift pair ratios actually were (something I should have done <em>before</em> creating a new layout). Using <a href="http://gist.github.com/133750">this script</a>, I got the following results:</p>



<pre>
Analyzed 457 files, 25060 lines
` ~     25     58  2.320
1 !   1161    713  0.614
2 @    564   2700  4.787
3 #    416   1914  4.601
4 $    264     55  0.208
5 %    359    303  0.844
6 ^    257     44  0.171
7 &amp;    152    226  1.487
8 *    176    115  0.653
9 (    196   4479  22.852
0 )   1761   4485  2.547
- _   1559  21837  14.007
[ {   1385   1304  0.942
] }   1396   1306  0.936
\ |    144   1480  10.278
; :    108   8446  78.204
= +   5588    729  0.130
&#8216; &quot;   5585   3909  0.700
, &lt;   4737    791  0.167
. &gt;  10257   2067  0.202
/ ?   1077   1054  0.979
</pre>



<p>Columns one and two are the shift pairs. Columns three and four are the occurrence counts for each character in the pair. The last column shows the ratio of the second character (normally shifted) to the first character (normally not shifted).  So a higher number in that column indicates an advantage to swapping the shift pair.</p>

<p>I looked at the shift pairs I had swapped, along with the other symbol shift pairs that I did not swap (the last five lines above).  There are some big wins here with my current remapping, along with some loses. The '[]'/'{}' swap was a small mistake - looks like I access elements of collections slightly more often than I define inline blocks or explicit hashes (which is kind of obvious in hindsight. In fact, on reflection I would think that collection access would happen considerably more often than inline block creation). And some of the number key remaps are big loses based on the ratios, but the lowest ratio pairs there have generally low volume. After this analysis, I didn't undo any of the remappings, though I should have reversed (and still should reverse) the bracket/brace swap. </p>

<h3>Usage </h3>

<p><img src="http://blog.tobiascrawley.net/wp-content/uploads/2009/12/hat-usage-instructions-300x266.jpg" alt="" title="" width="300" height="266" class="alignleft size-medium wp-image-259" />
The name of this layout is 'rubyist'. If you are interested in giving it a try, download the MacOS keylayout file <a href="http://tobiascrawley.net/rubyist/rubyist.keylayout">here</a>, and put it in ~/Library/Keyboard Layouts/. </p>

<p>I don't expect this layout to work well for everyone, or really anyone other than me. I do think all of us could benefit from evaluating the text we type the most, and seeing if some keyboard layout tweaks could make us more efficient. If you do want to give your own layout a try, check out these platform specific tools:</p>


<ul>
<li>MacOS: <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=Ukelele">Ukelele</a></li>
<li>Linux: <a href="http://www.linux.com/archive/articles/113715"><span class="caps">XKB</span></a></li>
<li>Windows: <a href="http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx">Microsoft Keyboard Layout Creator</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2009/12/05/the-quest-for-a-better-keyboard-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pomodoro, status updates, and a distributed team</title>
		<link>http://blog.tobiascrawley.net/2009/11/05/pomodoro-status-updates-and-a-distributed-team/</link>
		<comments>http://blog.tobiascrawley.net/2009/11/05/pomodoro-status-updates-and-a-distributed-team/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 15:47:31 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[campfire]]></category>
		<category><![CDATA[pomodoro]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=232</guid>
		<description><![CDATA[For the last few months, I&#8217;ve been playing with the pomodoro technique to manage my time and stay focused on the task at hand. It works best for me when I&#8217;m stressed and have an overwhelming workload. It helps me focus on the immediate task, and not get distracted too much by all of the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.tobiascrawley.net/wp-content/uploads/2009/11/pomodoro_status.jpg" alt="pomodoro_status" title="pomodoro_status" width="545" height="151" class="aligncenter size-full wp-image-235" /></p>

<p>For the last few months, I&#8217;ve been playing with the <a href="http://www.pomodorotechnique.com/">pomodoro technique</a> to manage my time and stay focused on the task at hand. It works best for me when I&#8217;m stressed and have an overwhelming workload. It helps me focus on the immediate task, and not get distracted too much by all of the other stuff I need to do. </p>

<p>One issue with managing the technique is keeping interruptions to a minimum. When I start a pomodoro, I&#8217;ll quit email, twitter, and chat. But we are a distributed team, and I work from home 95% of the time. I want to let the rest of the team know I&#8217;m around, but also let them know that I&#8217;m in a pomodoro, and to only interrupt in emergencies. Since we primarily use <a href="http://campfirenow.com">Campfire</a> to communicate, I set up a &#8216;Status&#8217; room there that allows us to post what we are up to/where we are at/etc. Its not only useful for pomodoro updates, but also &#8216;off to lunch&#8217;, &#8216;gone for the day&#8217;, etc. (And here is a third sentence that ends in etc.) But manually entering those status updates means they won&#8217;t happen. So I wrote a simple update script using the lovely <a href="http://tinder.rubyforge.org/">tinder</a> gem. It consists of two files &#8211; the script itself:</p>

<script src="http://gist.github.com/227107.js"></script>

<p>and the config file (<code>~/.campfire_status</code>):</p>

<script src="http://gist.github.com/227109.js"></script>

<p>But pomodoro status updates still require a manual step to run the script. Enter <a href="http://pomodoro.ugolandini.com/">Pomodoro</a>, a MacOS pomodoro client by <a href="http://www.ugolandini.com/">Ugo Landini</a>. His client allows integration with growl, twitter, and applescript. So I added the following applescript snippets to update the status for me:</p>

<script src="http://gist.github.com/227129.js"></script>

<p>A couple of gotchas I ran in to:<br />
* the Pomodoro app does not allow copy &amp; paste in the applescript text areas, making it a bit of a pain to enter<br />
* the Pomodoro app also has a file selector next to each applescript text area, but I could not get it to recognize the saved applescripts<br />
* the Campfire <span class="caps">API </span>seems to ignore requests from users that are currently logged in(?), so the status updates come from another account (in our case, we have a &#8216;service-bot&#8217; account that posts messages from other services). That&#8217;s why there is a <code>USER_NAME</code> setting that is displayed with the message.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2009/11/05/pomodoro-status-updates-and-a-distributed-team/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rails_habitat: a simple rails plugin to make RAILS_ENV a bit friendlier</title>
		<link>http://blog.tobiascrawley.net/2009/10/13/rails_habitat-a-simple-rails-plugin-to-make-rails_env-a-bit-friendlier/</link>
		<comments>http://blog.tobiascrawley.net/2009/10/13/rails_habitat-a-simple-rails-plugin-to-make-rails_env-a-bit-friendlier/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 20:04:30 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=227</guid>
		<description><![CDATA[I just released a stupid simple plugin based on the idea behind Coda Hale&#8217;s rails_environments plugin. This plugin adds the following functionality to the Rails module to help with determining the current enviroment: &#62;&#62; Rails.environment # a convenience alias to Rails.env =&#62; &#34;development&#34; &#62;&#62; Rails.development? =&#62; true &#62;&#62; Rails.not_development? =&#62; false &#62;&#62; Rails.production? =&#62; false [...]]]></description>
			<content:encoded><![CDATA[<p>I just released a stupid simple plugin based on the idea behind Coda Hale&#8217;s <a href="http://blog.codahale.com/2006/04/09/rails-environments-a-plugin-for-well-rails/">rails_environments plugin</a>.</p>

<p>This plugin adds the following functionality to the Rails module to help with determining the current enviroment:</p>



<pre>
  &gt;&gt; Rails.environment       # a convenience alias to Rails.env
  =&gt; &quot;development&quot;
  &gt;&gt; Rails.development?
  =&gt; true
  &gt;&gt; Rails.not_development?
  =&gt; false
  &gt;&gt; Rails.production?
  =&gt; false
  &gt;&gt; Rails.not_production?
  =&gt; true
  &gt;&gt; Rails.test?
  =&gt; false
  &gt;&gt; Rails.not_test?
  =&gt; true
</pre>



<p>Not only does it provide <code>env?</code> and <code>not_env?</code> methods for the standard environments, it also provides those methods for any environment you define in config/environments/ (in fact that is how it learns about all of the environments, including the standard three). So if you define new environments in config/environments/ they will be picked up automatically. </p>

<p>Install with: <code>script/plugin install git://github.com/tobias/rails_habitat.git</code></p>

<p>It lives on <a href="http://github.com/tobias/rails_habitat">github</a>.</p>

<p><strong>Edit</strong>: see David&#8217;s comment below for the built in way to do this (in Rails &gt;= 2.2).</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2009/10/13/rails_habitat-a-simple-rails-plugin-to-make-rails_env-a-bit-friendlier/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Notify a Campfire room on cap deploy</title>
		<link>http://blog.tobiascrawley.net/2009/10/08/notify-a-campfire-room-on-cap-deploy/</link>
		<comments>http://blog.tobiascrawley.net/2009/10/08/notify-a-campfire-room-on-cap-deploy/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 14:26:11 +0000</pubDate>
		<dc:creator>Tobias</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[campfire]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.tobiascrawley.net/?p=224</guid>
		<description><![CDATA[We use Campfire for internal communication, and I&#8217;ve lately been pushing notifications there for all to see (Zendesk ticket updates, git repo pushes, etc). We decided it would be useful for the support team to know when a deployment occurs. I googled a bit to see if anyone had shared a Capistrano recipe, and did [...]]]></description>
			<content:encoded><![CDATA[<p>We use <a href="http://campfirenow.com">Campfire</a> for internal communication, and I&#8217;ve lately been pushing notifications there for all to see (<a href="http://zendesk.com">Zendesk</a> ticket updates, git repo pushes, etc). We decided it would be useful for the support team to know when a deployment occurs. I googled a bit to see if anyone had shared a <a href="http://capify.org">Capistrano</a> recipe, and did not find one. So I&#8217;m sharing mine.</p>

<p>Using the <a href="http://github.com/collectiveidea/tinder">tinder</a> gem, its super easy:<br />
<script src="http://gist.github.com/205055.js"></script></p>

<p>Enjoy!</p>]]></content:encoded>
			<wfw:commentRss>http://blog.tobiascrawley.net/2009/10/08/notify-a-campfire-room-on-cap-deploy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
