<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Panasonic Youth</title>
	
	<link>http://robsanheim.com</link>
	<description>rob sanheim writes about software, business, ruby, music, stuff and things</description>
	<pubDate>Wed, 19 Nov 2008 02:53:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<geo:lat>43.121416</geo:lat><geo:long>-89.349688</geo:long><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PanasonicYouth" type="application/rss+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
		<title>MacPorts Ruby performance gotcha</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/457892965/</link>
		<comments>http://robsanheim.com/2008/11/18/macports-ruby-performance-gotcha/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 02:51:29 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Macintosh]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/?p=402</guid>
		<description>If you install Ruby from MacPorts (all the cool kids do), be aware that the first 1.8.7 port had some issues that basically broke performance, making it run three times slower than normal.  Verify that you have the 1.8.7-p72_2 version active, and not 1.8.7-p72_1:


~ $ sudo port installed &amp;#124;grep ruby
ruby @1.8.7-p72_1+thread_hooks
ruby @1.8.7-p72_2+thread_hooks (active)


The defect [...]</description>
			<content:encoded><![CDATA[<p>If you install Ruby from MacPorts (all the cool kids do), be aware that the first 1.8.7 port had some issues that basically broke performance, making it run three times slower than normal.  Verify that you have the <code>1.8.7-p72_2</code> version active, and not <code>1.8.7-p72_1</code>:</p>
<p><code>
<pre>
~ $ sudo port installed |grep ruby
<code>ruby @1.8.7-p72_1+thread_hooks</code>
<code>ruby @1.8.7-p72_2+thread_hooks (active)</code>
</pre>
<p></code></p>
<p>The <a href="http://trac.macports.org/ticket/17092" title="#17092 (Ruby 1.8.7 is 3x slower than its predecessor) – MacPorts – Trac">defect on MacPorts Trac</a> has more details, along with links to a relevant <a href="http://groups.google.com/group/ruby-talk-google/browse_thread/thread/2b326089f18f2b29/49b69aca0f5112e8?lnk=gst&amp;q=macports#49b69aca0f5112e8">ruby-talk thread</a>.  </p>
<p>Its worth pointing out that this issue went from discovery to being fixed and released into the port stream in about a days time.  MacPorts has really come a long way from just a year or two ago.  Fairly major packages used to lag behind the latest stable releases by multiple versions, but now I find everything I care about stays up to date with ease from MacPorts.  They are even able to keep up with <a href="http://www.macports.org/ports.php?by=name&amp;substr=git-core" title="The MacPorts Project -- Available Ports">git releases</a>, an impressive task considering how fast and furious releases git releases come.  </p>
<p>Kudos to the <a href="http://www.macports.org/ports.php?by=name&amp;substr=git-core" title="The MacPorts Project -- Available Ports">MacPorts team</a> for doing a fine job and making developers&#8217; lives easier.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=GCA6N"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=GCA6N" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=GtEzN"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=GtEzN" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=inQrn"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=inQrn" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/457892965" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/11/18/macports-ruby-performance-gotcha/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/11/18/macports-ruby-performance-gotcha/</feedburner:origLink></item>
		<item>
		<title>Tarantula 0.0.5 Released - the “Naked Aardvark” release</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/403894645/</link>
		<comments>http://robsanheim.com/2008/09/26/tarantula-005-released-the-naked-aardvark-release/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 15:58:41 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/09/26/tarantula-005-released-the-naked-aardvark-release/</guid>
		<description>Announcing version 0.0.5 of Tarantula.  
Tarantula is a big fuzzy spider. It crawls your Rails application, fuzzing data to see what breaks.  It can verify HTML validation across all your pages, ensure you don&amp;#8217;t have 404s, and pretty much anything else you want via custom handlers.
Don&amp;#8217;t let the version number fool you, we&amp;#8217;ve [...]</description>
			<content:encoded><![CDATA[<p>Announcing version 0.0.5 of <a href="http://github.com/relevance/tarantula/tree/master">Tarantula.</a>  </p>
<p>Tarantula is a big fuzzy spider. It crawls your Rails application, fuzzing data to see what breaks.  It can verify HTML validation across all your pages, ensure you don&#8217;t have 404s, and pretty much anything else you want via custom handlers.</p>
<p>Don&#8217;t let the version number fool you, we&#8217;ve been using Tarantula across many projects at <a href="http://thinkrelevance.com">Relevance</a> and its very stable.  This release fixed a number of annoying bugs, including namespace conflicts with other classes due to Rails dependency loading, improved gem spec with correct dependencies, and clean up on the html reporter.</p>
<p>Install it via the Github</p>
<p><code>gem install relevance-tarantula --source http://gems.github.com</code></p>
<p>or via Rails 2.1+ gem handing:</p>
<p><code>config.gem "relevance-tarantula", :source => "http://gems.github.com"</code></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=I7HwL"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=I7HwL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=PwtzL"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=PwtzL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=P13Ol"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=P13Ol" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/403894645" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/09/26/tarantula-005-released-the-naked-aardvark-release/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/09/26/tarantula-005-released-the-naked-aardvark-release/</feedburner:origLink></item>
		<item>
		<title>Scp or rsync failing with no error message?  Check your startup scripts…</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/393830420/</link>
		<comments>http://robsanheim.com/2008/09/15/scp-or-rsync-failing-with-no-error-message-check-your-startup-scripts/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 03:52:44 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/09/15/scp-or-rsync-failing-with-no-error-message-check-your-startup-scripts/</guid>
		<description>The other day I was having issues trying to scp/rsync data, with no real error message to try and debug things.  Turns out that any output produced by your startup scripts will break rsync/scp hard.  I had some simple &amp;#8216;echo&amp;#8217; statements print when different scripts were being loaded&amp;#8230;turns out scp/rysync don&amp;#8217;t like that.
My [...]</description>
			<content:encoded><![CDATA[<p>The other day I was having issues trying to scp/rsync data, with no real error message to try and debug things.  Turns out that any output produced by your startup scripts will break rsync/scp hard.  I had some simple &#8216;echo&#8217; statements print when different scripts were being loaded&#8230;turns out scp/rysync don&#8217;t like that.</p>
<p>My capistrano task was a very simple call out to the &#8216;get&#8217; helper, which just uses scp under the hood.  The task ran and looked as if it completed, only nothing was ever transferred and the scp progress bar never came up.  Sometimes it would block and do nothing, which was real fun, too.</p>
<p>The solution was simple - change all the <a href="http://github.com/relevance/etc">bash scripts</a> we use to not output any echo anything when running.  I deployed the new scripts to all servers I needed to scp with, and the issue was resolved.</p>
<p>Since this is a <a href="http://www.openssh.org/faq.html#2.9">known issue in the faq</a>, it won&#8217;t be fixed or improved with a better error message.  It&#8217;s just something you need to be aware of and work around, either via detecting if the session has an interactive terminal before sending output or removing your output statements altogether from you startup scripts.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=vbfjL"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=vbfjL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=jVMkL"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=jVMkL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=YufZl"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=YufZl" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/393830420" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/09/15/scp-or-rsync-failing-with-no-error-message-check-your-startup-scripts/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/09/15/scp-or-rsync-failing-with-no-error-message-check-your-startup-scripts/</feedburner:origLink></item>
		<item>
		<title>Git Clone vs cp -R –&gt; WTF?</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/351022572/</link>
		<comments>http://robsanheim.com/2008/07/30/git-clone-vs-cp-r-wtf/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 01:04:44 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Git]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/07/30/git-clone-vs-cp-r-wtf/</guid>
		<description>I knew git was fast, and I even knew it was faster than a lot of plain linux local file operations.  Still, this still blew me away:
PLAIN TEXT
CODE:




rsanheim@ares:~/src/personal/oss $ du -hd 0 insoshi/


&amp;#160;26M&amp;#160; &amp;#160; insoshi/


&amp;#160;


rsanheim@ares:~/src/personal/oss $ time git clone insoshi/ /tmp/insoshi


Initialize /tmp/insoshi/.git


Initialized empty Git repository in /private/tmp/insoshi/.git/


Checking out files: 100% &amp;#40;2193/2193&amp;#41;, done.


&amp;#160;


real&amp;#160; &amp;#160; 0m3.826s


user&amp;#160; [...]</description>
			<content:encoded><![CDATA[<p>I knew git was fast, and I even knew it was faster than a lot of plain linux local file operations.  Still, this still blew me away:</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showCodeTxt('code-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/personal/oss $ du -hd <span style="color:#800000;color:#800000;">0</span> insoshi/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;26M&nbsp; &nbsp; insoshi/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/personal/oss $ time git clone insoshi/ /tmp/insoshi</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Initialize /tmp/insoshi/.<span style="">git</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Initialized empty Git repository in /private/tmp/insoshi/.<span style="">git</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Checking out files: <span style="color:#800000;color:#800000;">100</span>% <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">2193</span>/<span style="color:#800000;color:#800000;">2193</span><span style="color:#006600; font-weight:bold;">&#41;</span>, done.</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">real</span>&nbsp; &nbsp; 0m3.826s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user&nbsp; &nbsp; 0m0.251s</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sys&nbsp;0m0.658s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/personal/oss $ time cp -R insoshi/ /tmp/insoshi_cp</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">real&nbsp; &nbsp; 0m9.065s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user&nbsp; &nbsp; 0m0.114s</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sys&nbsp;0m1.442s </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Ok, so a 26 meg repo takes almost three times as long to copy via a recursive cp than a local git clone.  Thats a fairly small repo, lets try something bigger:</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showCodeTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/relevance $ du -hd <span style="color:#800000;color:#800000;">0</span> rails</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;75M&nbsp; &nbsp; rails</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/relevance $ time git clone rails /tmp/rails2</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Initialize /tmp/rails2/.<span style="">git</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Initialized empty Git repository in /private/tmp/rails2/.<span style="">git</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">real&nbsp; &nbsp; 0m2.321s</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user&nbsp; &nbsp; 0m0.151s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sys&nbsp;0m0.465s</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rsanheim@ares:~/src/relevance $ time cp -R rails/ /tmp/rails</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">real&nbsp; &nbsp; 0m7.133s</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user&nbsp; &nbsp; 0m0.067s</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sys&nbsp;0m1.505s </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The rails repo at 75 megs is still ~ 3 times faster.</p>
<p>Obviously, this is not scientific at all, but the point is pretty clear.  Git is doing some magic that lets it move files around locally 2 to 3 times faster than a plain copy.  From looking at the man page, I would guess it has something to do with git using hardlinks for things in .git/objects when cloning locally.  My linux fu falls down a bit here -- what are the ramifications of using hard links versus doing a "real" copy?</p>
<p>(This also makes me want to try out <a href="http://eigenclass.org/hiki/gibak-backup-system-introduction">gitbak</a> even more...)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=xJ1JbJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=xJ1JbJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=ocN91J"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=ocN91J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=q1isPj"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=q1isPj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/351022572" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/07/30/git-clone-vs-cp-r-wtf/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/07/30/git-clone-vs-cp-r-wtf/</feedburner:origLink></item>
		<item>
		<title>Quick: Find the Bug or Gotcha with named_scope</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/343277855/</link>
		<comments>http://robsanheim.com/2008/07/23/quick-find-the-bug-or-gotcha-with-named_scope/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 06:42:47 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/07/23/quick-find-the-bug-or-gotcha-with-named_scope/</guid>
		<description>Think fast!  Where's the bug?
PLAIN TEXT
RUBY:




named_scope :active, :conditions =&amp;#62; &amp;#91;"activated_at &amp;#60;= ?", DateTime.now.utc.to_s&amp;#40;:db&amp;#41;&amp;#93; 






Looks fine, right?  Maybe you've hit this already, and you see it immediately.  
The symptoms are that the DateTime.now always seems to be a bit off - maybe you just restarted your server and its a only a few [...]</description>
			<content:encoded><![CDATA[<p>Think fast!  Where's the bug?</p>
<div class="igBar"><span id="lruby-7"><a href="#" onclick="javascript:showCodeTxt('ruby-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-7">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">named_scope :active, :conditions =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">"activated_at &lt;= ?"</span>, DateTime.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">utc</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#40;</span>:db<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Looks fine, right?  Maybe you've hit this already, and you see it immediately.  </p>
<p>The symptoms are that the DateTime.now always seems to be a bit off - maybe you just restarted your server and its a only a few minutes off.</p>
<p>The bug is that DateTime.now gets evaluated at the time the class is loaded, not when the finder is run.  What makes this easy to miss is that it will always work fine in tests and development, as everything is constantly getting reloaded there.</p>
<p>The fix, obvious once you've spent a combined time of over an hour trying to figure out what is going on:</p>
<div class="igBar"><span id="lruby-8"><a href="#" onclick="javascript:showCodeTxt('ruby-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-8">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">named_scope :active, <span style="color:#CC0066; font-weight:bold;">lambda</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> :conditions =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">"activated_at &lt;= ?"</span>, DateTime.<span style="color:#9900CC;">now</span>.<span style="color:#9900CC;">utc</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">&#40;</span>:db<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=PP2ycJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=PP2ycJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=y8NjSJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=y8NjSJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=deE8Sj"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=deE8Sj" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/343277855" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/07/23/quick-find-the-bug-or-gotcha-with-named_scope/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/07/23/quick-find-the-bug-or-gotcha-with-named_scope/</feedburner:origLink></item>
		<item>
		<title>Notes on testing Bj (Background Job)</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/331498572/</link>
		<comments>http://robsanheim.com/2008/07/10/notes-on-testing-bj-background-job/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 07:24:39 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/07/10/notes-on-testing-bj-background-job/</guid>
		<description>Some thoughts and random notes on testing Bj within a Rails integration test (or spec).

You have to turn transactions off for the scope of the test, or suffer very confusing issues, since Bj itself wraps the job submittal within a transaction.  The way I did this was just overriding the use_transactional_fixtures method in the [...]</description>
			<content:encoded><![CDATA[<p>Some thoughts and random notes on testing <a href="http://codeforpeople.rubyforge.org/svn/bj/trunk/README">Bj</a> within a Rails integration test (or spec).</p>
<ul>
<li>You have to turn transactions off for the scope of the test, or suffer very confusing issues, since Bj itself wraps the job submittal within a transaction.  The way I did this was just overriding the use_transactional_fixtures method in the one specific spec.</p>
<div class="igBar"><span id="lruby-11"><a href="#" onclick="javascript:showCodeTxt('ruby-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-11">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">describe Foo</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">use_transactional_fixtures</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">false</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</li>
<li>Remember, bj = <strong>background</strong> job.  This may seem obvious, but whatever you submit to bj will be running in an entirely different process, so in our spec you need to wait for that job to complete before trying to assert things.  You can do something as simple as this:
<div class="igBar"><span id="lruby-12"><a href="#" onclick="javascript:showCodeTxt('ruby-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-12">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MAX_TIME = <span style="color:#006666;color:#800000;">10</span>.<span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; seconds = <span style="color:#006666;color:#800000;">0</span>.<span style="color:#006666;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span>job.<span style="color:#9900CC;">pending</span>?<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; job.<span style="color:#9900CC;">reload</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; seconds += <span style="color:#006666;color:#800000;">0</span>.<span style="color:#006666;color:#800000;">5</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">sleep</span> <span style="color:#006666;color:#800000;">0</span>.<span style="color:#006666;color:#800000;">5</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#9966CC; font-weight:bold;">if</span> seconds&gt; MAX_TIME</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># normal assertions here </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
This gives your job up to 10 seconds to finish, and will timeout if it takes too long, which usually means something has gone wrong.
</li>
<li>You now have to watch multiple logs to figure out what is going on.  So tail your test.log and tail the bj log as well, and run the script in isolation to make sure you understand where exceptions and syntax errors will go.  I wasted some time scanning logs when I really need to check the job.stderr field that bj populates, so be sure to output that for common test failures.</li>
</ul>
<p>Overall, I've been pleased with bj, besides some open questions I've still been working out by perusing the source.  Check it out if you need a easy to use persistent job queue.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=MtqSwJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=MtqSwJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=yukWGJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=yukWGJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=cwQzij"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=cwQzij" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/331498572" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/07/10/notes-on-testing-bj-background-job/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/07/10/notes-on-testing-bj-background-job/</feedburner:origLink></item>
		<item>
		<title>CapGun and LogBuddy updated to 0.0.5</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/327853640/</link>
		<comments>http://robsanheim.com/2008/07/06/capgun-and-logbuddy-updated-to-005/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 05:35:27 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/07/06/capgun-and-logbuddy-updated-to-005/</guid>
		<description>Some long overdue releases of cap_gun and log_buddy - both have been updated to version 0.0.5.  Both are now available as gems on github.com/relevance as well as from rubyforge.
CapGun gives you super simple deployment notifications from Capistrano.  LogBuddy gives you a log helper through all objects, and can also log the name of [...]</description>
			<content:encoded><![CDATA[<p>Some long overdue releases of <a href="http://github.com/relevance/cap_gun">cap_gun</a> and <a href="http://github.com/relevance/logbuddy/tree/master">log_buddy</a> - both have been updated to version 0.0.5.  Both are now available as gems on github.com/relevance as well as from rubyforge.</p>
<p>CapGun gives you super simple deployment notifications from Capistrano.  LogBuddy gives you a log helper through all objects, and can also log the name of the thing passed in along with its value -- saving you on typing and making debugging quicker.</p>
<p>CapGun got a fix so it does not attempt to display the rails_env if its not defined - this should clean up any strangeness in notifications if you saw something like "my_app was deployed to ".</p>
<p>LogBuddy got some minor tweaks and improved specs.</p>
<p>Both libraries now use Echoe, since Hoe complains about readme.txt when I want to use readme.rdoc, dammit.  Both now only have a dev dependency on echoe to play nice with RubyGems 1.2.</p>
<p>You can install them via github or rubyforge:</p>
<p><code>sudo gem install log_buddy<br />
sudo gem install cap_gun</p>
<p>or </p>
<p>gem sources -a http://gems.github.com<br />
sudo gem install relevance-log_buddy<br />
sudo gem install relevance-cap_gun<br />
</code></p>
<p>Please log bugs or issues at our <a href="http://opensource.thinkrelevance.com/">Trac</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=dcOE6J"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=dcOE6J" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=ZVk8NJ"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=ZVk8NJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=eP342j"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=eP342j" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/327853640" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/07/06/capgun-and-logbuddy-updated-to-005/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/07/06/capgun-and-logbuddy-updated-to-005/</feedburner:origLink></item>
		<item>
		<title>Git 1.5.6 released</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/315154791/</link>
		<comments>http://robsanheim.com/2008/06/18/git-156-released/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 04:51:47 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Git]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/06/18/git-156-released/</guid>
		<description>Git 1.5.6 has been released, and there are a lot of usability fixes and tweaks which should make the upgrade worth your while.  Looking at the detailed list of changes since 1.5.5, it looks like submodules have been getting quite a bit of love from many contributors, so it might be time to get [...]</description>
			<content:encoded><![CDATA[<p>Git 1.5.6 has been <a href="http://kerneltrap.org/Git/1.5.6_Relatively_Small_Impact_Changes">released</a>, and there are a lot of usability fixes and tweaks which should make the upgrade worth your while.  Looking at the detailed list of changes since 1.5.5, it looks like submodules have been getting quite a bit of love from many contributors, so it might be time to get them another shot.  Scroll down or search in the <a href="http://kerneltrap.org/Git/1.5.6_Relatively_Small_Impact_Changes">announcement</a> for the the part starting with "Changes since v1.5.5" and look through there for some of the submodule improvements that are coming.</p>
<p>The directions <a href="http://solutions.treypiepmeier.com/2008/02/25/installing-git-on-os-x-leopard/">posted here</a> worked fine for me to upgrade my existing source based installation in /usr/local.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=4g6Z0I"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=4g6Z0I" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=nH1wnI"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=nH1wnI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=rgJ5Ri"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=rgJ5Ri" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/315154791" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/06/18/git-156-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/06/18/git-156-released/</feedburner:origLink></item>
		<item>
		<title>Git lessons learned</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/306129941/</link>
		<comments>http://robsanheim.com/2008/06/06/git-lessons-learned/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 14:17:44 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Git]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/06/06/git-lessons-learned/</guid>
		<description>Lessons learned from day to day use with various ruby and rails projects.
* Submodules completely suck when things get complex - I'm moving away from no submodules, and using direct exports for now until I have time to research braid or piston 2.0.  For more details on this, see this or this post on [...]</description>
			<content:encoded><![CDATA[<p>Lessons learned from day to day use with various ruby and rails projects.</p>
<p>* Submodules completely suck when things get complex - I'm moving away from no submodules, and using direct exports for now until I have time to research braid or piston 2.0.  For more details on this, see <a href="http://blog.buildingwebapps.com/2008/5/20/got-git-submodules-not-a-go-go">this</a> or <a href="http://groups.google.com/group/github/browse_thread/thread/5f49768707d015dd">this post</a> on the github group.</p>
<p>* Use capistrano 2.2, not 2.3!  2.3 breaks git support</p>
<p>* Always use :remote_cache for deployments -- super fast with git</p>
<p>* If you have weird errors, it probably means you need to pull - when in doubt pull to make sure you have the latest</p>
<p>* Branch more locally - I've been burned a few times when I've started work in master and then regretted it later when I wished my work wasn't in mainline (yes, its possible to fix this after the fact, but that gets into more advanced git usage)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=yPCTcI"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=yPCTcI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=gdTjjI"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=gdTjjI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=VcPygi"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=VcPygi" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/306129941" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/06/06/git-lessons-learned/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/06/06/git-lessons-learned/</feedburner:origLink></item>
		<item>
		<title>Refactotum Rails Conf 2008</title>
		<link>http://feeds.feedburner.com/~r/PanasonicYouth/~3/300621610/</link>
		<comments>http://robsanheim.com/2008/05/29/refactotum-rails-conf-2008/#comments</comments>
		<pubDate>Thu, 29 May 2008 15:39:41 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[RailsConf]]></category>

		<guid isPermaLink="false">http://robsanheim.com/2008/05/29/refactotum-rails-conf-2008/</guid>
		<description>I'm in Portland for Rails Conf with over 80% of the Relevance crew.  We were testing out our "plane number" yesterday, but thank goodness American didn't let us down.
We'll be speaking today at about how to contribute to open source at Refactotum from 1:30 to 5.  We will cover some tools to help [...]</description>
			<content:encoded><![CDATA[<p>I'm in Portland for Rails Conf with over 80% of the <a href="http://thinkrelevance.com/about" title='see our ugly mugs'>Relevance crew</a>.  We were testing out our "plane number" yesterday, but thank goodness American didn't let us down.</p>
<p>We'll be speaking today at about how to contribute to open source at <a href="http://en.oreilly.com/rails2008/public/schedule/detail/2101">Refactotum</a> from 1:30 to 5.  We will cover some tools to help you find the code with the most technical debt, go over example refactorings, and then spend the rest of the session going from project to project and helping out as folks hit obstacles.  Please bring a laptop with any projects checked out that you'd like to hack on during the session (git preferred but not necessary). </p>
<p>Hope to see you there!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=aEkrFH"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=aEkrFH" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=Ou4JEH"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=Ou4JEH" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/PanasonicYouth?a=85f3Eh"><img src="http://feeds.feedburner.com/~f/PanasonicYouth?i=85f3Eh" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/PanasonicYouth/~4/300621610" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://robsanheim.com/2008/05/29/refactotum-rails-conf-2008/feed/</wfw:commentRss>
		<feedburner:origLink>http://robsanheim.com/2008/05/29/refactotum-rails-conf-2008/</feedburner:origLink></item>
	</channel>
</rss>
