<?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, 18 May 2012 21:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<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&amp;#8217;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>
		<item>
		<title>On the Difference Between Abstract Factory and Dependency Injection/Inversion of Control</title>
		<link>http://kill-0.com/duplo/2010/02/05/on-the-difference-between-abstract-factory-and-dependency-injectioninversion-of-control/</link>
		<comments>http://kill-0.com/duplo/2010/02/05/on-the-difference-between-abstract-factory-and-dependency-injectioninversion-of-control/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 02:04:57 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[abstract factory]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[inversion of control]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=71</guid>
		<description><![CDATA[When my wife recently pointed me to an article by Jim Weirich about Dependency Injection (DI), one of my first thoughts was, “how is this different from the Abstract Factory (AF) pattern?” So I did some searching and found a brief comment from Martin Fowler: If you have multiple ways to construct a valid object, [...]]]></description>
			<content:encoded><![CDATA[<p>When my wife recently pointed me to <a href="http://onestepback.org/index.cgi/Tech/Ruby/DependencyInjectionInRuby.rdoc">an article by Jim Weirich about Dependency Injection (DI)</a>, one of my first thoughts was, “how is this different from the <a href="http://c2.com/cgi/wiki?AbstractFactoryPattern">Abstract Factory (AF) pattern</a>?”  So I did some searching and found <a href="http://martinfowler.com/articles/injection.html">a brief comment from Martin Fowler</a>:</p>
<blockquote><p>If you have multiple ways to construct a valid object, it can be hard to show this through constructors, since constructors can only vary on the number and type of parameters. This is when Abstract Factory Methods come into play, these can use a combination of private constructors and setters to implement their work. The problem with classic Factory Methods for components assembly is that they are usually seen as static methods, and you can&#8217;t have those on interfaces. You can make a factory class, but then that just becomes another service instance. A factory service is often a good tactic, but you still have to instantiate the factory using one of the techniques here.</p></blockquote>
<p>Fowler&#8217;s objections with respect to static methods on interfaces are specific to java, and don&#8217;t apply in python or ruby, since neither have native interfaces.  Yet I see DI used in both ruby and python, so I still feel like there has to be another difference.</p>
<p>Next I found <a href="http://stackoverflow.com/questions/557742/dependency-injection-vs-factory-pattern">some interesting thoughts at Stack Overflow</a>, but none of the responses shed a clear light on the subject for me.</p>
<p>What finally got the light in my head to switch on, oddly enough, was <a href="http://tutorials.jenkov.com/dependency-injection/dependency-injection-replacing-factory-patterns.html">an article by Jakob Jenkov</a>.  After reading Jenkov, I understood that both AF and DI are responsible for creating instances of objects.  Furthermore, they both decouple the class requesting object creation from having to know any details about the created object that they&#8217;ll receive.  Where they&#8217;re different, is that when AF is being used, the class desiring the creation of an object needs to know about—and send a message to—an AF, whereas with DI, the class desiring the creation of an object is simply handed that object during it&#8217;s own initialization.  To put it another way, the object on which it relies is “injected” into it at its own creation.  This is the inversion, that rather than the class needing to ask for an object to be created, it is instead handed the object.</p>
<table style="font-size: x-small">
<summary>Dependency Injection as compared with Abstract Factory.</summary>
<thead>
<tr>
<th>Characteristic</th>
<th>DI</th>
<th>AF</th>
</tr>
</thead>
<tbody>
<tr>
<td>Is responsible for instantiating classes?</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Class needs to know details of the created object?</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Class needs to explicity request creation of desired object?</td>
<td><strong>No</strong></td>
<td><strong>Yes</strong></td>
</tr>
<tr>
<td>Class is dependent upon the DI/Factory that creates objects on its behalf?</td>
<td><strong>No</strong></td>
<td><strong>Yes</strong></td>
</tr>
</tbody>
</table>
<p>Now that the light was on, I re-read the first few references, and I found that may of them made more sense.  Funny how that works.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/02/05/on-the-difference-between-abstract-factory-and-dependency-injectioninversion-of-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

