<?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>Duplo</title>
	<atom:link href="http://kill-0.com/duplo/feed/" rel="self" type="application/rss+xml" />
	<link>http://kill-0.com/duplo</link>
	<description>Building Blocks &#38; Learning Experiences</description>
	<lastBuildDate>Fri, 29 Mar 2013 03:26:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Obscure bug in Ruby 1.9</title>
		<link>http://kill-0.com/duplo/2013/03/28/obscure-bug-in-ruby-1-9/</link>
		<comments>http://kill-0.com/duplo/2013/03/28/obscure-bug-in-ruby-1-9/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 00:03:10 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=201</guid>
		<description><![CDATA[I ran across a really obscure and subtle bug in Ruby 1.9, which was triggered by RSpec including a module for the purpose of altering RSpec::Mock objects before they&#8217;re serialized to YAML. I was attempting to update a work project from REE 1.8.7 to MRI 1.9.3. Some of the tests were failing with a SystemStackOverflow: [...]]]></description>
				<content:encoded><![CDATA[<p>I ran across a really obscure and subtle bug in <a href="http://www.rubylang.org">Ruby 1.9</a>, which was triggered by <a href="http://rspec.info">RSpec</a> including a module for the purpose of altering RSpec::Mock objects before they&#8217;re serialized to <a href="http://www.yaml.org">YAML</a>.</p>
<p>I was attempting to update a work project from REE 1.8.7 to MRI 1.9.3. Some of the tests were failing with a <tt>SystemStackOverflow: stack level too deep</tt> error while trying to save an ActiveRecord (AR) model. The stack traces were completely useless, they could only lead me to the <tt>save!</tt> call in the test.</p>
<p>Using the debugger proved exceedingly difficult, because as of AR 3.x, callbacks were re-written to use heavy metaprogramming, and it doesn&#8217;t take long before the debugger has no idea which line of code its on anymore.</p>
<p>I tried a number of things, including disabling callbacks, observers, and serialized attributes. I increased the maximum stack size, ran the tests in different orders, ensure the databases were cleaned before and after each test, and a number of other things. The tests always failed with 1.9, but passed with 1.8.</p>
<p>When none of those things worked for the primary model, I started to do the same for models referenced as <tt>belongs_to</tt> relations of the primary model. Sure enough, one of them was indeed the culprit. I began the process again, but this time on the secondary model. I was able to quickly narrow it down to one of the secondary models&#8217;s serialized attributes. A simple <tt>ActiveSupport::HashWithIndifferentAccess</tt> (HWIA) was to blame. Whenever I tried to serialize it, kaboom! I was able to further narrow it down to the first key-value pair, <tt>("async", nil)</tt>. Reproducing this same HWIA in the console did not yield a crash, however.</p>
<p>Using <a href="https://github.com/pry/pry/">pry</a>, I compared the output of <tt>ls -v</tt> for the <tt>nil</tt> value in the console, versus the <tt>nil</tt> value in the RSpec test. What I noticed, was that the <tt>to_yaml</tt> methods were attributed to different sources. In the console, <tt>to_yaml</tt> came from <tt>Object</tt>, while in the RSpec test, <tt>to_yaml</tt> came from <tt>RSpec::Mocks::Serialization::YAML</tt>.</p>
<p>Searching Google, I quickly found a workaround, use the older YAML parser, syck, instead of the new default of psych:</p>
<pre><code>YAML::ENGINE.yamler = "syck"
</code></pre>
<p>But syck has its own issues, and besides, there&#8217;s no reason why this shouldn&#8217;t work, the HWIA wasn&#8217;t cyclical at all. I kept looking, then eventually I found it.</p>
<blockquote><p><a href="https://github.com/rspec/rspec-core/commit/622a4b7ac41e0ab6a4786070cca3ff866b72b57c">https://github.com/rspec/rspec-core/commit/622a4b7ac41e0ab6a4786070cca3ff866b72b57c</a></p></blockquote>
<p>More googling led me to this:</p>
<blockquote><p><a href="https://gist.github.com/myronmarston/845896">https://gist.github.com/myronmarston/845896</a></p></blockquote>
<p>End result? Upgrade RSpec to a version >= 2.6.</p>
<p>Then I searched some more, to see if the core ruby folks know about this? Yep, they do:</p>
<blockquote><p><a href="http://bugs.ruby-lang.org/issues/3351">http://bugs.ruby-lang.org/issues/3351</a></p></blockquote>
<p>It&#8217;s slated to be fixed in 1.9.4, if such a beast is ever released.</p>
<p>Thanks to my co-workers at LMP, and the folks on the URUG mailing list for helping me out along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2013/03/28/obscure-bug-in-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling CTRL-v Pasting In Urxvt</title>
		<link>http://kill-0.com/duplo/2012/05/18/enabling-ctrl-v-pasting-in-urxvt/</link>
		<comments>http://kill-0.com/duplo/2012/05/18/enabling-ctrl-v-pasting-in-urxvt/#comments</comments>
		<pubDate>Fri, 18 May 2012 21:25:55 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=191</guid>
		<description><![CDATA[Rxvt-unicode (aka urxvt) has been my terminal of choice in Linux these days. Since I like to use the keyboard as much as possible, I found it frustrating that I couldn&#8217;t paste from my clipboard into urxvt without having to use the middle mouse button. I searched for a solution to this problem, and found [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://software.schmorp.de/pkg/rxvt-unicode.html" title="rxvt-unicode">Rxvt-unicode</a> (aka urxvt) has been my terminal of choice in Linux these days. Since I like to use the keyboard as much as possible, I found it frustrating that I couldn&#8217;t paste from my clipboard into urxvt without having to use the middle mouse button.</p>
<p>I searched for a solution to this problem, and found <a href="http://www.github.com/muennich/urxvt-perls" title="urxvt-perls">urxvt-perls</a> by Bert Muennich. His <tt>clipboard</tt> plugin for urxvt adds CTRL-v pasting to urxvt. It solved the problem perfectly.</p>
<p>Another great tool along these lines, is <a href="http://parcellite.sf.net">parcellite</a>. It unifies your primary clipboard (those things you highlight with the mouse) with the copy clipboard (things you specifically use CTRL-c or Edit > Copy for). With parcellite running, you can click the &#8220;Copy URL to Clipboard&#8221; icon on <a href="http://github.com">Github</a>, then ALT+Tab to your terminal, and type: git clone &lt;CTRL-v&gt; to clone.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2012/05/18/enabling-ctrl-v-pasting-in-urxvt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Your $PATH For Emacs On Mac OS X</title>
		<link>http://kill-0.com/duplo/2011/08/05/setting-your-path-for-emacs-on-mac-os-x/</link>
		<comments>http://kill-0.com/duplo/2011/08/05/setting-your-path-for-emacs-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 15:30:11 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=178</guid>
		<description><![CDATA[I was having some trouble running rspec within Emacs. One of the gems in my Gemfile was pointing to a git repo, and as a result, bundle was shelling out through Emacs to check my revision using this method: def revision_from_git if File.exists?(scope('.git/HEAD')) Dir.chdir scope(".") do `git rev-parse HEAD` end end end Since my git [...]]]></description>
				<content:encoded><![CDATA[<p>I was having some trouble running <a href="https://github.com/pezra/rspec-mode"><tt>rspec</tt> within Emacs</a>.  One of the gems in my Gemfile was pointing to a git repo, and as a result, bundle was shelling out through Emacs to check my revision using this method:
<pre><code>def revision_from_git
  if File.exists?(scope('.git/HEAD'))
   Dir.chdir scope(".") do
     `git rev-parse HEAD`
    end
  end
end</code></pre>
<p>Since my <tt>git</tt> lives in a non-standard location, it was failing:<br />
<blockquote><code>/Users/xxxxxxxx/.rvm/gems/ruby-1.9.2-p290@global/bundler/gems/compass-91a748a91636/lib/compass/version.rb:48:in ``': No such file or directory - git rev-parse HEAD (Errno::ENOENT)</code></p></blockquote>
<p>Searching for a solution, I found a <a href="http://www.emacswiki.org/emacs/EmacsApp#toc2">page in the EmacsWiki</a> that dealt with this issue, but I didn&#8217;t care for any of the solutions there.  What I went with was to open <tt>~/.MacOSX/environment.plist</tt> with the Property List Editor, and add the path to my <tt>git</tt> executable to the <tt>PATH</tt> variable therein.  I then had to reboot.  The reboot seems to be the only way to get launchd to re-read this file.  I launch Emacs via Spotlight, and so it is started by launchd behind the scenes.  I tried using <tt>launchctl setenv</tt> first, as mentioned in the EmacsWiki, but that didn&#8217;t seem to work, I&#8217;m not sure why.</p>
<p>With the <tt>PATH</tt> variable set, rspec-mode, and rvm.el loaded, I was able to successfully run my specs from within Emacs.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2011/08/05/setting-your-path-for-emacs-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cucumber, Capybara, and Select Tags With Multiple Selections Enabled</title>
		<link>http://kill-0.com/duplo/2011/05/24/cucumber-capybara-and-select-tags-with-multiple-selections-enabled/</link>
		<comments>http://kill-0.com/duplo/2011/05/24/cucumber-capybara-and-select-tags-with-multiple-selections-enabled/#comments</comments>
		<pubDate>Wed, 25 May 2011 04:43:16 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[Capybara]]></category>
		<category><![CDATA[Cucumber]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=164</guid>
		<description><![CDATA[If you happen to have a &#60;select&#62; tag with its multiple attribute set, you can unselect them in Cucumber by adding this step: When /^(?:&#124;I )unselect "([^"]*)" from "([^"]*)"$/ do &#124;value, field&#124; &#160;&#160;unselect(value, :from => field) end]]></description>
				<content:encoded><![CDATA[<p>If you happen to have a <tt>&lt;select&gt;</tt> tag with its multiple attribute set, you can unselect them in Cucumber by adding this step:</p>
<p><code style="whitespace: pre">When /^(?:|I )unselect "([^"]*)" from "([^"]*)"$/ do |value, field|<br />
&nbsp;&nbsp;unselect(value, :from => field)<br />
end</code></p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2011/05/24/cucumber-capybara-and-select-tags-with-multiple-selections-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tmux With Terminal.app Line Wrapping Weirdness</title>
		<link>http://kill-0.com/duplo/2011/03/02/tmux-with-terminal-app-line-wrapping-weirdness/</link>
		<comments>http://kill-0.com/duplo/2011/03/02/tmux-with-terminal-app-line-wrapping-weirdness/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 21:31:27 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[term]]></category>
		<category><![CDATA[Terminal.app]]></category>
		<category><![CDATA[tmux]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=157</guid>
		<description><![CDATA[When using tmux in Terminal.app with the TERM preference set to xterm-color causes some weird line wrapping behavior. Images speak louder than words here: Just before the weirdness This blank line is the weirdness, it&#8217;s really disconcerting when typing a long command, or when using readline to look through previous commands. The weirdness continues&#8230; But [...]]]></description>
				<content:encoded><![CDATA[<p>When using <a href="http://tmux.sourceforge.net/">tmux</a> in Terminal.app with the <tt>TERM</tt> preference set to <tt>xterm-color</tt> causes some weird line wrapping behavior.  Images speak louder than words here:</p>
<p><img src="http://kill-0.com/duplo/wp-content/uploads/2011/03/Screen-shot-2011-03-02-at-2.14.36-PM.png" alt="Just before the weirdness" />Just before the weirdness</p>
<p><img src="http://kill-0.com/duplo/wp-content/uploads/2011/03/Screen-shot-2011-03-02-at-2.14.45-PM.png" alt="The weirdness begins" />This blank line is the weirdness, it&#8217;s really disconcerting when typing a long command, or when using readline to look through previous commands.</p>
<p><img src="http://kill-0.com/duplo/wp-content/uploads/2011/03/Screen-shot-2011-03-02-at-2.15.06-PM.png" alt="Continuing weirdness..." />The weirdness continues&#8230;</p>
<p><img src="http://kill-0.com/duplo/wp-content/uploads/2011/03/Screen-shot-2011-03-02-at-2.15.15-PM.png" alt="And after a CTRL-l we're fine again" />But a CTRL-l will help ease our pain.</p>
<p>The weirdness seems to have something to do with being at the bottom of a terminal window.  The problem is not exhibited at the top of an empty window.</p>
<p><a href="http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/651">A solution</a> is to set your <tt>TERM</tt> value in Terminal.app to <tt>xterm</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2011/03/02/tmux-with-terminal-app-line-wrapping-weirdness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using The Uservoice Gem With Heroku</title>
		<link>http://kill-0.com/duplo/2010/07/02/using-the-uservoice-gem-with-heroku/</link>
		<comments>http://kill-0.com/duplo/2010/07/02/using-the-uservoice-gem-with-heroku/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 16:03:14 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[Heroku]]></category>
		<category><![CDATA[UserVoice]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=128</guid>
		<description><![CDATA[The uservoice gem provides a nice easy way to integrate your Rails app with the UserVoice user feedback service. If you&#8217;re using Heroku to deploy your Rails app, there are two things that will provide speed bumps. The first is that, short of storing your UserVoice API key in your git repository, there&#8217;s no way [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://rubygems.org/gems/uservoice">uservoice gem</a> provides a nice easy way to integrate your Rails app with the <a href="http://uservoice.com">UserVoice user feedback service</a>.  If you&#8217;re using <a href="http://heroku.com/">Heroku</a> to deploy your Rails app, there are two things that will provide speed bumps.  The first is that, short of storing your UserVoice API key in your git repository, there&#8217;s no way to get it into your Rails app&#8217;s configuration.  The second is that the uservoice gem lists rails as a dependency.  Both can be overcome, and I&#8217;ll describe how.</p>
<h2>Securely Passing Your UserVoice API Key To Heroku</h2>
<p>In order to pass your UserVoice API key to Heroku without committing it in plain-text in your git repository we make use of Heroku&#8217;s config feature.</p>
<p><code>$ heroku config:add USERVOICE_API_KEY=&lt;your api key&gt; USERVOICE_USER=&lt;your username&gt;</code></p>
<p>This will make your UserVoice API Key and username accessible to your Heroku Rails app via <tt>ENV["USERVOICE_API_KEY"]</tt> and <tt>ENV["USERVOICE_USER"]</tt> respectively.</p>
<p>Now we simply need to get these values into the uservoice gem&#8217;s <tt>config/uservoice.yml</tt> configuration file.  To do this, <del datetime="2010-07-02T15:29:59+00:00">we need to add <a href="http://www.ruby-doc.org/core/classes/ERB.html">ERB</a> support to the uservoice gem&#8217;s config loader</del><ins datetime="2010-07-02T15:29:59+00:00"><a href="http://github.com/iltempo/uservoice/commit/de7e99557236b084c2c93c1c919b1589fe119eb8">my pull request</a> has been accepted, and this functionality is baked in to the uservoice gem as of version 0.3.1.</ins></p>
<p>Now we can setup our uservoice gem configuration file like so:<br />
<code>
<pre>uservoice_options:
  # required
  key: <%= ENV["USERVOICE_USER"] %>
  host: my_app.uservoice.com
  forum: my_app
  # optional
  showTab: true
  alignment: left
  background_color: "#f00"
  text_color: white
  hover_color: "#06C"
  lang: en

uservoice_api:
  api_key: <%= ENV["USERVOICE_API_KEY"] %></pre>
<p></code></p>
<h2>Installing The Uservoice Gem To Heroku</h2>
<p>Of course we need to add the uservoice gem to our <tt>.gems</tt> file.  However, the uservoice gem lists Rails as a dependency.  This means that when Heroku installs the uservoice gem, it will also install the latest version of Rails (2.3.8 at the time of writing).  Heroku&#8217;s stack currently relies on Rails version 2.3.5, and having the two versions of Rails installed causes a clash.  The solution is to add the <tt>--ignore-dependencies</tt> flag to the uservoice line of the <tt>.gems</tt> file.  However, this means that Heroku won&#8217;t install uservoice&#8217;s <em>other</em> dependency, the ezcrypto gem.  To work around that, we simply add ezcrypto manually, on it&#8217;s own line, to the <tt>.gems</tt> file.  The lines that need to be added should look like this:<br />
<code>
<pre># &lt;RAILS_ROOT&gt;/.gems
ezcrypto --version '>= 0.7.2'
uservoice --version '>= 0.3.1'  --ignore-dependencies</pre>
<p></code><br />
While the version arguments aren&#8217;t strictly necessary, I&#8217;ve found it helpful to be explicit when specifying gems, to help alleviate issues caused by new versions of gems being released in the middle of my development cycle.</p>
<p>With those changes in place, you should be able to push your git repository to Heroku and receive all sorts of great user feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/07/02/using-the-uservoice-gem-with-heroku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminder: Update selenium-server.jar When Upgrading Webrat</title>
		<link>http://kill-0.com/duplo/2010/05/27/reminder-update-selenium-server-jar-when-upgrading-webrat/</link>
		<comments>http://kill-0.com/duplo/2010/05/27/reminder-update-selenium-server-jar-when-upgrading-webrat/#comments</comments>
		<pubDate>Fri, 28 May 2010 06:25:03 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[webrat]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=122</guid>
		<description><![CDATA[This post is a reminder to myself, that when I upgrade my webrat gem, I need to replace its vendor/selenium-server.jar. If I forget, then Selenium Remote Control will most likely break because the version of selenium-server.jar included with webrat is old, and doesn&#8217;t support current versions of Firefox.]]></description>
				<content:encoded><![CDATA[<p>This post is a reminder to myself, that when I upgrade my <a href="http://github.com/brynary/webrat">webrat</a> gem, I need to replace its <tt>vendor/selenium-server.jar</tt>.  If I forget, then <a href="http://seleniumhq.org/projects/remote-control/">Selenium Remote Control</a> will most likely break because the version of <tt>selenium-server.jar</tt> included with webrat is old, and doesn&#8217;t support current versions of Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/05/27/reminder-update-selenium-server-jar-when-upgrading-webrat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs ruby-mode comment keybinding</title>
		<link>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/</link>
		<comments>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:52:57 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[ruby-mode]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=117</guid>
		<description><![CDATA[I&#8217;ve often been sad that there is no default keybinding for comment-region in Emacs&#8217;s ruby-mode. Eventually it annoyed me enough that I added one: (add-hook 'ruby-mode-hook (lambda () (define-key ruby-mode-map "\C-c#" 'comment-or-uncomment-region) ) ) This assigns C-c # to comment the current region, or if the current region is already commented, it will uncomment the [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve often been sad that there is no default keybinding for <tt>comment-region</tt> in Emacs&#8217;s <a href=" http://www.emacswiki.org/emacs/RubyMode">ruby-mode</a>.  Eventually it annoyed me enough that I added one:<code>
<pre>(add-hook 'ruby-mode-hook
	  (lambda ()
	    (define-key ruby-mode-map "\C-c#" 'comment-or-uncomment-region)
	    )
	  )</pre>
<p></code>This assigns <tt>C-c #</tt> to comment the current region, or if the current region is already commented, it will uncomment the region.</p>
<p>But what about when there&#8217;s no region currently marked?  It would be nice if emacs would (un)comment the current line.  To do this, I took a page from <a href="http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html">DJCB at Emacs-fu</a>.<code>
<pre>(defadvice comment-or-uncomment-region (before slick-comment activate compile)
  "When called interactively with no active region, comment a single line instead."
  (interactive
   (if mark-active (list (region-beginning) (region-end))
     (list (line-beginning-position)
	   (line-beginning-position 2)))))
</pre>
<p></code>Now with nothing marked, pressing <tt>C-c #</tt> will cause emacs to toggle commenting on the current line.</p>
<p>In case it isn&#8217;t obvious, one should add the abbove snippets to their <tt>.emacs</tt> file to gain their benefits.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>autotest-inotify: extend autotest to use inotify</title>
		<link>http://kill-0.com/duplo/2010/02/11/autotest-inotify-extend-autotest-to-use-inotify/</link>
		<comments>http://kill-0.com/duplo/2010/02/11/autotest-inotify-extend-autotest-to-use-inotify/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 22:35:22 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[inotify]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=102</guid>
		<description><![CDATA[Autotest-inotify is a gem that extends autotest to use Linux&#8217;s inotify to monitor changes to your source and test files, running the appropriate tests as files are modified. By default, autotest implements filesystem polling to detect these changes. This can use a significant amount of CPU cycles1, and can impact battery life in laptops. Through [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://github.com/ewollesen/autotest-inotify">Autotest-inotify</a> is a gem that extends <a href="http://www.zenspider.com/ZSS/Products/ZenTest/">autotest</a> to use Linux&#8217;s <a href="http://en.wikipedia.org/wiki/Inotify">inotify</a> to monitor changes to your source and test files, running the appropriate tests as files are modified.</p>
<p>By default, autotest implements filesystem polling to detect these changes.  This can use a significant amount of CPU cycles<sup><a href="http://kill-0.com/duplo/2010/02/11/autotest-inotify-extend-autotest-to-use-inotify/#footnote_0_102" id="identifier_0_102" class="footnote-link footnote-identifier-link" title="On one of my machines, ~25% of a single core&rsquo;s cycles were spent polling the filesystem">1</a></sup>, and can impact battery life in laptops.</p>
<p>Through Linux&#8217;s inotify, autotest-inotify inserts callbacks into the underlying filesystem, which allows the filesystem to notify us when files we&#8217;re interested in have been modified.  This allows autotest to sleep until inotify indicates a change has been made to one our files of interest, i.e. we don&#8217;t have to constantly poll the filesystem.</p>
<p>This work was inspired by <a href="http://www.bitcetera.com/en/techblog/2009/05/27/mac-friendly-autotest/">Sven Schwyn&#8217;s work</a> on autotest-fsevent, which extends autotest to use Mac OS X&#8217;s <a href="http://en.wikipedia.org/wiki/FSEvents">FSEvents</a> system, as well as <a href="http://blog.tryphon.org/alban/archives/2007/10/26/inotify-support-for-autotest/">Alban Peignier&#8217;s work</a> using the INotify gem.  Where autotest-inotify differs from Schwyn&#8217;s work, is that autotest-inotify can be used in Linux, whereas autotest-fsevent uses FSEvent, which is Mac OS X specific.  Autotest-inotify differs from Peignier&#8217;s work in that it offers a simpler gem-based installation, and it is less obtrusive to autotest&#8217;s methods for determining which files to watch for changes.</p>
<p>Source code for the autotest-inotify gem can be found at <a href="http://github.com/ewollesen/autotest-inotify">http://github.com/ewollesen/autotest-inotify</a>.  It is licensed under the MIT license.  See the <a href="http://github.com/ewollesen/autotest-inotify/blob/master/README.rdoc">README</a> for installation instructions.</p>
<ol class="footnotes"><li id="footnote_0_102" class="footnote">On one of my machines, ~25% of a single core&#8217;s cycles were spent polling the filesystem</li></ol>]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/02/11/autotest-inotify-extend-autotest-to-use-inotify/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My tweaks to metric_fu&#8217;s saikuro and flay configurations</title>
		<link>http://kill-0.com/duplo/2010/02/09/my-tweaks-to-metric_fus-saikuro-and-flay-configurations/</link>
		<comments>http://kill-0.com/duplo/2010/02/09/my-tweaks-to-metric_fus-saikuro-and-flay-configurations/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 06:26:01 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[metric_fu]]></category>
		<category><![CDATA[saikuro]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=91</guid>
		<description><![CDATA[In the process of setting up metric_fu, I found that, one way or another, saikuro&#8217;s output wasn&#8217;t getting into the correct place. I&#8217;ll spare you the long story, and just show the config settings I had to put into my Rakefile to get things working: config.saikuro = { &#58;output_directory => "#{ENV["CC_BUILD_ARTIFACTS"]}/scratch/saikuro", :input_directory => ["app\" --input_directory [...]]]></description>
				<content:encoded><![CDATA[<p>In the process of setting up metric_fu, I found that, one way or another, saikuro&#8217;s output wasn&#8217;t getting into the correct place.  I&#8217;ll spare you the long story, and just show the config settings I had to put into my Rakefile to get things working:<br />
<code>
<pre>config.saikuro = {
<b>  &#58;output_directory => "#{ENV["CC_BUILD_ARTIFACTS"]}/scratch/saikuro", </b>
<b>  :input_directory => ["app\" --input_directory \"lib"],</b>
  :cyclo => "",
  :filter_cyclo => "0",
  :warn_cyclo => "5",
  :error_cyclo => "7",
  :formater => "text", #this needs to be set to "text"
}
config.flay = {
  :dirs_to_flay => ['app', 'lib',],
<b>  :minimum_score => 10, </b>
}
</pre>
<p></code><br />
My changes in bold.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/02/09/my-tweaks-to-metric_fus-saikuro-and-flay-configurations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
