<?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>Flirting With Models &#187; ruby</title>
	<atom:link href="http://coreyhoffstein.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://coreyhoffstein.com</link>
	<description>musings on numerical computing and financial modeling</description>
	<lastBuildDate>Mon, 30 Aug 2010 21:53:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Juggernaut (Ruby Technology Worthy of the Name)</title>
		<link>http://coreyhoffstein.com/2010/08/30/juggernaut-ruby-technology-worthy-of-the-name/</link>
		<comments>http://coreyhoffstein.com/2010/08/30/juggernaut-ruby-technology-worthy-of-the-name/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 21:53:04 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[comet]]></category>
		<category><![CDATA[juggernaut]]></category>
		<category><![CDATA[push server]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=293</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://juggernaut.rubyforge.org/"><img src="http://coreyhoffstein.com/wp-content/uploads/2010/08/Juggernaut.jpg" alt="Ruby Technology Worth of the Name" title="Juggernaut" width="350" height="445" class="alignnone size-full wp-image-295" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/08/30/juggernaut-ruby-technology-worthy-of-the-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Has Test-Driven Development Gone Too Far?</title>
		<link>http://coreyhoffstein.com/2010/08/03/has-test-driven-development-gone-too-far/</link>
		<comments>http://coreyhoffstein.com/2010/08/03/has-test-driven-development-gone-too-far/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 12:46:53 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=288</guid>
		<description><![CDATA[Test-Driven Design (and its cousin, Behavior Driven Development) are meant to get coders to write good unit tests. However, I am seeing more and more that people are actually making their code more complex so that it can be tested! For example, on page 128 of Metaprogramming in Ruby, we get a simple little example [...]]]></description>
			<content:encoded><![CDATA[<p>Test-Driven Design (and its cousin, Behavior Driven Development) are meant to get coders to write good unit tests.  However, I am seeing more and more that people are actually making their code more complex so that it can be tested!</p>
<p>For example, on page 128 of Metaprogramming in Ruby, we get a simple little example class that tells us when a loan on a book was originated.  The code looks something like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Loan 
   <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>book<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@book</span> = book
      <span style="color:#0066ff; font-weight:bold;">@time</span> = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> to_s 
      <span style="color:#996600;">&quot;#{@book.upcase} loaned on #{@time}&quot;</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Simple enough, right?  Except you can&#8217;t test <i>to_s</i> because then we would have to know the exact time the object was created.  The solution?</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Loan
   <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>book<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@book</span> = book
      <span style="color:#0066ff; font-weight:bold;">@time</span> = Loan.<span style="color:#9900CC;">time_class</span>.<span style="color:#9900CC;">now</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">time_class</span> 
      <span style="color:#0066ff; font-weight:bold;">@time_class</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#CC00FF; font-weight:bold;">Time</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
   <span style="color:#9966CC; font-weight:bold;">def</span> to_s
      ...</pre></div></div>

<p>Wait, wait, wait.  Let me get this straight &#8230; we introduce a class method that encapsulates the class we are using to tell time?  Well, that sure seems &#8230; obscure.  To test it, we then write,</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> FakeTime 
   <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">now</span>; <span style="color:#996600;">'Mon Apr 06 12:15:50'</span>; <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'test/unit'</span>
<span style="color:#9966CC; font-weight:bold;">class</span> TestLoan <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Test::Unit::TestCase</span> 
   <span style="color:#9966CC; font-weight:bold;">def</span> test_conversion_to_string
      Loan.<span style="color:#9900CC;">instance_eval</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#0066ff; font-weight:bold;">@time_class</span> = FakeTime <span style="color:#006600; font-weight:bold;">&#125;</span> 
      loan = Loan.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'War and Peace'</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
      assert_equal <span style="color:#996600;">'WAR AND PEACE loaned on Mon Apr 06 12:15:50'</span>, loan.<span style="color:#9900CC;">to_s</span>
   <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Okay, this has just gone too far.  We&#8217;ve convoluted our code to make it easier to test?  Let&#8217;s take a step back here.  What is to_s supposed to do?  It is supposed to return a stringified Loan object.  What sort of details do we want in it?  How about the book in all upper-case, a template string, and the time it was loaned at.  So now let&#8217;s roll back our definition of the class to the first one &#8212; the simple, intuitive implementation.  Now, given our GOAL of the to_s method, wouldn&#8217;t it make more sense to quite simply implement our test as:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'test/unit'</span>
<span style="color:#9966CC; font-weight:bold;">class</span> TestLoan <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Test::Unit::TestCase</span> 
   <span style="color:#9966CC; font-weight:bold;">def</span> test_conversion_to_string
      loan = Loan.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'War and Peace'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      assert loan.<span style="color:#9900CC;">to_s</span> ~= <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*|</span>\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span> loaned at <span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>a<span style="color:#006600; font-weight:bold;">-</span>z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>a<span style="color:#006600; font-weight:bold;">-</span>z<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span> \d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span> \d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span>:\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span>:\d<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">/</span>
   <span style="color:#9966CC; font-weight:bold;">end</span> 
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now we capture the essence of what to_s should be doing.  Arguably, you also should now be testing that the regexp does what you want &#8230; but I will assume you are fluent enough with regular expressions you don&#8217;t really need to do that.  To extend this, we could match on the book title and the time and check whether the book-title matches what we passed in and the all that jazz &#8212; but most importantly, we want to make sure that to_s is doing the job we asked it to do.</p>
<p>The point being &#8212; we are testing the intention of to_s, not some obscure instance of it.  And now we don&#8217;t have to bastardize our code to make it testable.  The way the book recommended (using Metaprogramming), we would have to actually look at the test-suite (or expect some damn-good comments) to even understand what the point of the class method was.  In my opinion, that isn&#8217;t good programming.</p>
<p>A similar situation came up when I was perusing StackOverflow.  A user was asking how to <a href="http://stackoverflow.com/questions/3075855/how-do-i-load-files-from-a-specific-relative-path-in-ruby">load specific files from a relative path</a>.  A solution was given, but it didn&#8217;t fit in well with the &#8216;testing methodology&#8217; because the OP doesn&#8217;t load the full stack during his unit tests.  The solution?  &#8220;Wrap it in an object!&#8221;  </p>
<p>In my opinion, trading in code-clarity for ease of code-testability is a bad thing.  The first test you should ever perform on code is to simply check if it is legible.  If not &#8212; I don&#8217;t care if it works &#8212; tear it down and start again.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/08/03/has-test-driven-development-gone-too-far/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Weighted Random Array</title>
		<link>http://coreyhoffstein.com/2010/06/16/weighted-random-array/</link>
		<comments>http://coreyhoffstein.com/2010/06/16/weighted-random-array/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 17:53:18 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=281</guid>
		<description><![CDATA[I had an array that I was trying to do weighted random pulls from. There are a few basic algorithms for this online, but my issue was that they were not efficient for very, very large tables &#8212; most were O(n) for each time you wanted to pull an element. So I wrote my own [...]]]></description>
			<content:encoded><![CDATA[<p>I had an array that I was trying to do weighted random pulls from.  There are a few basic algorithms for this online, but my issue was that they were not efficient for very, very large tables &#8212; most were O(n) for each time you wanted to pull an element.  So I wrote my own wrapper class that would handle the task for me using Alias Tables.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> WeightedRandomArray <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#CC0066; font-weight:bold;">Array</span>
      <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>other_array, weights<span style="color:#006600; font-weight:bold;">&#41;</span>
        total_weights = weights.<span style="color:#9900CC;">inject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>t,e<span style="color:#006600; font-weight:bold;">|</span> t<span style="color:#006600; font-weight:bold;">+</span>e <span style="color:#006600; font-weight:bold;">&#125;</span>
        proportions = weights.<span style="color:#9900CC;">map</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>e<span style="color:#006600; font-weight:bold;">|</span> e <span style="color:#006600; font-weight:bold;">/</span> total_weights <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
        elements = other_array.<span style="color:#9900CC;">zip</span><span style="color:#006600; font-weight:bold;">&#40;</span>proportions<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
        <span style="color:#008000; font-style:italic;"># construct an alias table for faster access</span>
        <span style="color:#0066ff; font-weight:bold;">@table</span> = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
        n = elements.<span style="color:#9900CC;">size</span>
        elements.<span style="color:#9900CC;">map</span>! <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>a,w<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">&#91;</span>a, w<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>n<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><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>
        elements.<span style="color:#9900CC;">sort</span>! <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>e1,e2<span style="color:#006600; font-weight:bold;">|</span> e1<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;=&gt;</span> e2<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">while</span> elements.<span style="color:#9900CC;">size</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">2</span>
          <span style="color:#CC0066; font-weight:bold;">p</span> = elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>
          elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-</span>= <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1.0</span> <span style="color:#006600; font-weight:bold;">-</span> <span style="color:#CC0066; font-weight:bold;">p</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          <span style="color:#0066ff; font-weight:bold;">@table</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0066; font-weight:bold;">p</span>, elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
          elements.<span style="color:#9900CC;">delete_at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          elements.<span style="color:#9900CC;">sort</span>! <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>a,b<span style="color:#006600; font-weight:bold;">|</span> a<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;=&gt;</span> b<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        <span style="color:#CC0066; font-weight:bold;">p</span> = elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>
        elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-</span>= <span style="color:#CC0066; font-weight:bold;">p</span>
        <span style="color:#0066ff; font-weight:bold;">@table</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0066; font-weight:bold;">p</span>, elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, elements<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
      <span style="color:#9966CC; font-weight:bold;">def</span> random_element
        entry = <span style="color:#0066ff; font-weight:bold;">@table</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">Kernel</span>.<span style="color:#CC0066; font-weight:bold;">rand</span> <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#0066ff; font-weight:bold;">@table</span>.<span style="color:#9900CC;">size</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">floor</span><span style="color:#006600; font-weight:bold;">&#93;</span>
        <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">Kernel</span>.<span style="color:#CC0066; font-weight:bold;">rand</span> <span style="color:#006600; font-weight:bold;">&lt;</span> entry<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>
          <span style="color:#0000FF; font-weight:bold;">return</span> entry<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>
        <span style="color:#9966CC; font-weight:bold;">else</span>
          <span style="color:#0000FF; font-weight:bold;">return</span> entry<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>So now the work is all up-front &#8212; and while it is considerable, so long as you will be doing enough random draws, the O(1) time to get a random entry should trump&#8230;</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/06/16/weighted-random-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing around Ruby blocks</title>
		<link>http://coreyhoffstein.com/2010/06/08/passing-around-ruby-blocks/</link>
		<comments>http://coreyhoffstein.com/2010/06/08/passing-around-ruby-blocks/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 01:56:28 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=279</guid>
		<description><![CDATA[I have some code that I am bundling together that required me to tackle a rather strange problem. Basically, I had one function that took a block, and another function that wrapped around that function. It looks something like this: def inner&#40;*args&#41; yield args&#91;0&#93;, args&#91;1&#93;*args&#91;2&#93; end &#160; def wrapper inner&#40;3,4,5&#41; end The question is, how [...]]]></description>
			<content:encoded><![CDATA[<p>I have some code that I am bundling together that required me to tackle a rather strange problem.  Basically, I had one function that took a block, and another function that wrapped around that function.  It looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> inner<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#9966CC; font-weight:bold;">yield</span> args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> wrapper
   inner<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">3</span>,<span style="color:#006666;">4</span>,<span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The question is, how do I pass a block to wrapper and have it get passed to inner?  Google wasn&#8217;t much help here.  My solution looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> call_block
   <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#006666;">4</span>, <span style="color:#006666;">5</span>, <span style="color:#006666;">6</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> wrap_block<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>blk<span style="color:#006600; font-weight:bold;">&#41;</span>
   call_block <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|*</span>args<span style="color:#006600; font-weight:bold;">|</span> blk.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
wrap_block <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x,y,z<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> x<span style="color:#006600; font-weight:bold;">+</span>y<span style="color:#006600; font-weight:bold;">+</span>z <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>Would love to see a smarter solution&#8230;</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/06/08/passing-around-ruby-blocks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Immutable Ruby?</title>
		<link>http://coreyhoffstein.com/2010/05/19/immutable-ruby/</link>
		<comments>http://coreyhoffstein.com/2010/05/19/immutable-ruby/#comments</comments>
		<pubDate>Wed, 19 May 2010 15:29:00 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=254</guid>
		<description><![CDATA[Got bored and hacked around.  Found this sort of interesting&#8230; class Object def self.new&#40; *args, &#38;blk &#41; o = allocate o.instance_eval&#123;initialize&#40; *args, &#38;blk &#41;&#125; o.freeze o end end Forcing objects to be frozen after initialization?  Almost sounds &#8230; functional.]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">Got bored and hacked around.  Found this sort of interesting&#8230;</div>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>blk <span style="color:#006600; font-weight:bold;">&#41;</span>
    o = allocate
    o.<span style="color:#9900CC;">instance_eval</span><span style="color:#006600; font-weight:bold;">&#123;</span>initialize<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>blk <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    o.<span style="color:#9900CC;">freeze</span>
    o
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<div>Forcing objects to be frozen after initialization?  Almost sounds &#8230; functional.</div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/05/19/immutable-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random thoughts of the day</title>
		<link>http://coreyhoffstein.com/2010/01/29/random-thoughts-of-the-day/</link>
		<comments>http://coreyhoffstein.com/2010/01/29/random-thoughts-of-the-day/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:25:32 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[rubinius]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby processing]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=243</guid>
		<description><![CDATA[I always bounce through a fairly regular pattern when it comes to programming.  It goes a little something like: prototype an idea with Ruby code.  Find out it is slow.  Get frustrated.  Start writing code in C++.  Take a lot longer, but be impressed by how the strict type system tends to force me to [...]]]></description>
			<content:encoded><![CDATA[<p>I always bounce through a fairly regular pattern when it comes to programming.  It goes a little something like: prototype an idea with Ruby code.  Find out it is slow.  Get frustrated.  Start writing code in C++.  Take a lot longer, but be impressed by how the strict type system tends to force me to write better programs.  Get frustrated with code verbosity.  Start looking for something else to program in that mixes the expressiveness of Ruby with the speed of C++ (one day I will realize that these two are probably mutually exclusive).  Decide that a more functional language will suit my needs.  OCaml?  Erlang?  Maybe something on the JVM!  Scala?  Clojure?  Get frustrated with build system (I don&#8217;t care what you say, Maven is just stupid) or lack of libraries.  Go back with my tail between my legs to Ruby.  Start looking at all the Ruby options: MRI, MacRuby, JRuby &#8230;</p>
<p>But wait!  How is it that I have somehow always overlooked Rubinius?  JIT compilation on LLVM?  Future multi-VM implementation (hello sandbox!)?  Holy cow!  That is AWESOME.  Rubinius is definitely my VM of choice from now on.</p>
<p>P.S. Totally unrelated, but check out Ruby Processing &#8212; it is pretty damn cool.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2010/01/29/random-thoughts-of-the-day/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Nerd Link of the Day: Create your own language with Ruby, TreeTop, and LLVM-Ruby</title>
		<link>http://coreyhoffstein.com/2009/12/03/nerd-link-of-the-day-create-your-own-language-with-ruby-treetop-and-llvm-ruby/</link>
		<comments>http://coreyhoffstein.com/2009/12/03/nerd-link-of-the-day-create-your-own-language-with-ruby-treetop-and-llvm-ruby/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 14:52:55 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[llvm]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[treetop]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/2009/12/03/nerd-link-of-the-day-create-your-own-language-with-ruby-treetop-and-llvm-ruby/</guid>
		<description><![CDATA[Orange: A great little blog entry about creating your own language using the grammar description gem TreeTop and llvmruby, a gem that gives you access to all that llvm goodness (JIT or compile to bytecode).]]></description>
			<content:encoded><![CDATA[<p><a href="http://macournoyer.com/blog/2008/12/09/orange/">Orange</a>: A great little blog entry about creating your own language using the grammar description gem TreeTop and llvmruby, a gem that gives you access to all that llvm goodness (JIT or compile to bytecode).</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2009/12/03/nerd-link-of-the-day-create-your-own-language-with-ruby-treetop-and-llvm-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nerd Link(s) of the Day</title>
		<link>http://coreyhoffstein.com/2009/12/02/nerd-links-of-the-day/</link>
		<comments>http://coreyhoffstein.com/2009/12/02/nerd-links-of-the-day/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 20:20:23 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/2009/12/02/nerd-links-of-the-day/</guid>
		<description><![CDATA[ArrayFields: Tired of indexing with numbers? Index your arrays in a better way. Main: Quit re-writing your main program structure for all those flags and options. Use this gem to do the heavy lifting. rq: rq is a great little gem for clustering Linux boxes via a job system running on an sqlite database on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sciruby.codeforpeople.com/lib/ruby/arrayfields/">ArrayFields</a>: Tired of indexing with numbers?  Index your arrays in a better way.</p>
<p><a href="http://sciruby.codeforpeople.com/lib/ruby/main/">Main</a>: Quit re-writing your main program structure for all those flags and options.  Use this gem to do the heavy lifting.  </p>
<p><a href="http://sciruby.codeforpeople.com/lib/ruby/rq/">rq</a>: rq is a great little gem for clustering Linux boxes via a job system running on an sqlite database on an NFS.  Check out a nice little article on it <a href="http://www.linuxjournal.com/article/7922">here<a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2009/12/02/nerd-links-of-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does the Language make the Programmer?</title>
		<link>http://coreyhoffstein.com/2009/08/17/does-the-language-make-the-programmer/</link>
		<comments>http://coreyhoffstein.com/2009/08/17/does-the-language-make-the-programmer/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 00:57:43 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/2009/08/17/does-the-language-make-the-programmer/</guid>
		<description><![CDATA[I have always subscribed to the Sapir-Whorf hypothesis (a.k.a. Linguistic Relativity), especially in its applications to programming. It is my firm belief that programming languages directly influence how programmers solve problems. The verbosity and robustness of any solution are often directly dependent of the paradigms that the language attempts to empower. As a simple example, [...]]]></description>
			<content:encoded><![CDATA[<p>I have always subscribed to the Sapir-Whorf hypothesis (a.k.a. <a href="http://en.wikipedia.org/wiki/Linguistic_relativity">Linguistic Relativity</a>),  especially in its applications to programming.  It is my firm belief that programming languages directly influence how programmers solve problems.  The verbosity and robustness of any solution are often directly dependent of the paradigms that the language attempts to empower.</p>
<p>As a simple example, one can examine the solutions that Ruby programmers come up with when given the power of meta-programming.  Some are clean and extremely beneficial to the end user.  If we look at ActiveRecord, we find that all sorts of instance and class level methods and values are inherited dynamically, by looking up values of columns in a database table!  All transparent to the user.  </p>
<p>While some solutions provided by Ruby&#8217;s dynamic and meta-programming ways are extremely elegant, other times it just leads to a heap of spaghetti code.  Speaking from experience, with the lack of type constraints built in, open classes, and meta-programming abilities, I often find that I get objects in some places that I don&#8217;t expect.  Twitter had the same problem.  They blamed Ruby.  Others blamed bad programmers.</p>
<p>I blame both.  Personally, I know that my &#8216;programming hygiene&#8217; has greatly suffered in my &#8216;Time of Ruby.&#8217;  While it has allowed me to code with blazing speed and agility, I find that my code smells quite a bit worse than it used to.  It was great for writing one-off programs, but my code readability and reusability has faltered greatly.  Quite simply, in the absence of static languages, or even functional languages, I failed to shoulder the responsibility of ensuring that my programs were well constructed and well tested.</p>
<p>Having picked up Scala lately, I have found the switch back to a static, semi-functional language refreshing.  In fact, I feel almost the same way I did when I switched to Ruby.  Now, writing simple one-off programs has taken me more time &#8212; but it also tends to lead me to writing reusable libraries.  I tend to break up my code more naturally, instead of hacking together solutions that work at the time.  Instead of just restarting a project, I find myself refactoring.    </p>
<p>So that brings us back to the Twitter case.  I know it is old news, but I think it is a good case study.  Twitter chose Ruby because it allowed them to rapidly develop their product.  But when it came to scalability, they found that it just didn&#8217;t suit their needs.  That isn&#8217;t to say that Ruby couldn&#8217;t suit their needs &#8212; they just didn&#8217;t find it to be the appropriate solution.  Certainly, I know I have trouble maintaining a large Ruby code base (except for maybe a well constructed Rails project).  On the other hand, most of the larger Scala projects I have written have naturally fallen into proper software engineering constructs on their own.  I put that on the language.  </p>
<p>You see, I know I am a bad programmer.  Not in the sense that I can&#8217;t write efficient algorithms, or design systems well.  I can.  But under the time constraints of business projects, I don&#8217;t.  And Ruby let me do that better than any other language I have used.  So I guess I will use Scala for now, not just for my own sake, but for the sake of everyone who has to read me code one day.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2009/08/17/does-the-language-make-the-programmer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Curtain Call for Ruby</title>
		<link>http://coreyhoffstein.com/2009/08/04/curtain-call-for-ruby/</link>
		<comments>http://coreyhoffstein.com/2009/08/04/curtain-call-for-ruby/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 12:43:00 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[actor]]></category>
		<category><![CDATA[curtaincall]]></category>
		<category><![CDATA[distributed]]></category>
		<category><![CDATA[journeta]]></category>
		<category><![CDATA[revactor]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://coreyhoffstein.com/?p=166</guid>
		<description><![CDATA[Unless you have been living under a rock, or don&#8217;t program, you know that the software world has been abuzz about the end of &#8220;free lunch&#8221; &#8212; i.e. we can no longer just toss &#8220;more horsepower&#8221; at our problems, in a traditional manner, and expect a speed-up to occur. Instead, we have to go parallel. [...]]]></description>
			<content:encoded><![CDATA[<p>Unless you have been living under a rock, or don&#8217;t program, you know that the software world has been abuzz about the end of &#8220;free lunch&#8221; &#8212; i.e. we can no longer just toss &#8220;more horsepower&#8221; at our problems, in a traditional manner, and expect a speed-up to occur.  Instead, we have to go parallel.  One of the most successful ways in doing this is by using the Actor pattern, exemplified in Erlang, which has been known to have 99.99999% up-times in real-world applications.</p>
<p>Being a fan of Ruby, I wanted to see if anyone had implemented the Actor pattern yet.  It wasn&#8217;t a hard concept &#8212; you just provide the class with a mail-box and a way to check and parse messages.  The issue falls in Ruby&#8217;s threads &#8212; namely, they are big and bulky.  To have lots of actors, we need a light-weight implementation.  What is worse is that Ruby suffers the same problem as Python when it comes to concurrency &#8212; the global interpreter lock (GIL) prevents the virtual machine from executing more than one instruction at a time.  So even though you might be running separate OS threads on multiple cores, the speed is limited by a single core.  So basically, using 1.8, the Actor pattern is a waste of time.</p>
<p>The stable release of Ruby 1.9 seems to tackle the issue head on, by providing Fibers.  With 1.9, I was able to find the (now defunct) revactor gem, which seemed like a fairly good (though poorly documented) implementation of the Actor pattern.  I also found journeta (which works on 1.8), which was a system that performed network auto-discovery.  With the power of these two combined, and some horrible spaghetti code, I whipped together a little gem called &#8216;curtaincall&#8217;, which allows end-users to spawn actors on other machines.  </p>
<p>Unfortunately, not everything turned out as well as I would have liked.  Revactor seems to break down &#8230; or at least, its dependency Rev does, in signaling the mailbox that it has a new message.  I can&#8217;t quite seem to figure out why this occurs, so as it stands, curtaincall actors never end up receiving the messages passed to them.  Furthermore, the method I used of identifying actors is horrible &#8212; though it gets the job done.  Finally, Erlang niceties like &#8216;spawn_link&#8217; are poorly implemented and untested.</p>
<p>Ultimately, once I hit the road-block with Revactor, I just gave up.  Revactor is undocumented and discontinued.  I just wanted to see if I could do this for fun.</p>
<p>The pros?  Journeta is a delight to work with.  Easy to figure out from the examples provided, and it works just as promised out of the box.  </p>
<p>Cons?  Just about everything else.</p>
<p><a href='http://coreyhoffstein.com/wp-content/uploads/2009/08/curtaincall-0.0.1.gem'>curtaincall-0.0.1</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://coreyhoffstein.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://coreyhoffstein.com/2009/08/04/curtain-call-for-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
