<?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>The Brian Olore Story &#187; work</title>
	<atom:link href="http://brian.olore.net/wp/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://brian.olore.net</link>
	<description>Less of a story, more of a brain dump</description>
	<lastBuildDate>Sun, 18 Dec 2011 17:19:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing Postgresql on Mac &#8211; again</title>
		<link>http://brian.olore.net/wp/2011/11/installing-postgresql-on-mac-again/</link>
		<comments>http://brian.olore.net/wp/2011/11/installing-postgresql-on-mac-again/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 02:15:32 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=357</guid>
		<description><![CDATA[About a year ago I posted about installing Postgres 9.0 on my Mac. We&#8217;ll since then I lost a hard drive and am just re-installing Postgres now. This time 9.1. Here&#8217;s what I did: 1.  Download postgres for Mac Don&#8217;t sign up for enterprise db crap, the download will start in a sec 2. Install [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 74px"><img title="PostgreSQL" src="http://www.wikivs.com/images/d/d0/Elephant-64.png" alt="" width="64" height="64" /><p class="wp-caption-text">PostgreSQL</p></div>
<p>About a year ago I posted about installing Postgres 9.0 on my Mac. We&#8217;ll since then I lost a hard drive and am just re-installing Postgres now. This time 9.1. Here&#8217;s what I did:</p>
<p><strong>1.  </strong><strong><a href="http://www.postgresql.org/download/macosx" target="_blank">Download postgres for Mac</a></strong></p>
<ul>
<li>Don&#8217;t sign up for enterprise db crap, the download will start in a sec</li>
</ul>
<p><strong>2. Install postgres</strong></p>
<ul>
<li>This may require reboot to set some syscontrol settings (it did for me)</li>
<li>I created the &#8220;postgres&#8221; user with &#8220;postgres&#8221; as the password (so I could remember it)</li>
</ul>
<p><strong>3. Start postgres to create the defaults in the data directory</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ <span class="kw2">sudo</span> <span class="kw2">su</span> &#8211; postgres<br />
$ . ./pg_env.<span class="kw2">sh</span><br />
$ pg_ctl restart</div>
<p><strong>4. Modify Postgres to use &#8220;trust&#8221; authentication, so we don&#8217;t need to supply a password when connecting to the database.</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ vi /Library/PostgreSQL/<span class="nu0">9.1</span>/data/pg_hba.conf</div>
<p><strong>4.1 For each entry, change METHOD &#8220;md5&#8243; to &#8220;trust&#8221; </strong> (this should only be done on your developer machine!)</p>
<p><strong>5. Restart postgres to pick up the conf changes</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ <span class="kw2">sudo</span> <span class="kw2">su</span> &#8211; postgres<br />
$ . ./pg_env.<span class="kw2">sh</span><br />
$ pg_ctl restart</div>
<p><strong>6. Beer time!</strong></p>
<p>&nbsp;</p>
<p>This setup requires you to <strong>su &#8211; postgres</strong> whenever you want to restart the database, but for now it&#8217;ll work.</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2011/11/installing-postgresql-on-mac-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refinery on Dreamhost</title>
		<link>http://brian.olore.net/wp/2011/10/refinery-on-dreamhost/</link>
		<comments>http://brian.olore.net/wp/2011/10/refinery-on-dreamhost/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 02:36:54 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[refinerycms]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=343</guid>
		<description><![CDATA[Looking around for a Rails based CMS because I am sick of working in PHP (Drupal). RefineryCMS looks like the best of the bunch. Here are some notes from my installation of it on my Dreamhost account: 1) ssh to your host 2) a simple &#8216;gem install refinerycms&#8217; just hung &#38; I didn&#8217;t feel like waiting [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://refinerycms.com/"><img class="alignright" src="http://assets.vator.tv/images/attachments/pitch_logos/plogo_refinery-cms_final-logo.jpg?1258756262" alt="refinery logo" width="140" height="56" /></a>Looking around for a Rails based CMS because I am sick of working in PHP (Drupal). <a href="http://refinerycms.com/">RefineryCMS</a> looks like the best of the bunch.</p>
<p><strong>Here are some notes from my installation of it on my Dreamhost account:</strong></p>
<p>1) ssh to your host</p>
<p>2) a simple &#8216;gem install refinerycms&#8217; just hung &amp; I didn&#8217;t feel like waiting around so a quick Google search came up with this answer:</p>
<p>In your tmp directory, create a temporary Gemfile with the following contents:</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="kw3">source</span> <span class="st0">&#8216;http://rubygems.org&#8217;</span><br />
gem <span class="st0">&#8216;refinerycms&#8217;</span></div>
<p>then run &#8216;bundle&#8217;</p>
<p>The bundle command failed for me, even though &#8216;gem list&#8217; showed it was installed. So I ran &#8216;gem install bundle &#8211;no-rdoc &#8211;no-ri&#8217; which installed a newer version &amp; also setup the binary so I could successfully execute &#8216;bundle&#8217;.</p>
<p>3) Next thing to do is delete the temporary Gemfile and cd to your home directory.</p>
<p>4) From your home directory, execute the following (using your desired [sub]domain name):</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">refinerycms cms.olore.net</div>
<p>5) Then, create a new subdomain in Dreamhost via <a href="http://panel.dreamhost.com">http://panel.dreamhost.com</a> (same as above, I called mine cms.olore.net), click the checkbox for &#8216;Passenger (Ruby/Python apps only):&#8217; and let it add &#8216;public&#8217; to the end of your web directory &#8211; this will point to the public directory of the rails app that you just created.</p>
<p>Give Dreamhost a minute or two, then hit your site with a browser. You should see the initial screen for RefineryCMS asking you to create a new user.</p>
<p><strong>Possible problems &#8230; with solutions!</strong></p>
<p>a) When first accessing your site, you may get a Passenger error about rack versions. You may need to modify Gemfile.lock to use rack 1.2.1. If you make this change, simply &#8216;touch tmp/restart.txt&#8217; to tell Passenger to restart, then hit the URL in the browser again.</p>
<p>b) When first accessing your home page you may get a 500 error. I resolved this by running &#8216;RAILS_ENV=production rake db:migrate&#8217; followed by &#8216;touch tmp/restart.txt&#8217;</p>
<p>&nbsp;</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2011/10/refinery-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>H&amp;R Block 2011 won&#8217;t install</title>
		<link>http://brian.olore.net/wp/2011/02/hr-block-2011-wont-install/</link>
		<comments>http://brian.olore.net/wp/2011/02/hr-block-2011-wont-install/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 04:03:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=310</guid>
		<description><![CDATA[If you tried to install H&#038;R Block 2011 (formerly TaxCut) on your windows machine you may have been greeted by a useless error message that says the install failed. To get around this problem, in windows explorer, click on the D: (or wherever your CD/DVD is) and then right click on the .exe file and [...]]]></description>
			<content:encoded><![CDATA[<p>If you tried to install H&#038;R Block 2011 (formerly TaxCut) on your windows machine you may have been greeted by a useless error message that says the install failed.</p>
<p>To get around this problem, in windows explorer, click on the D: (or wherever your CD/DVD is) and then right click on the .exe file and select &#8220;Run as administrator&#8221;</p>
<p>This solution was next to impossible to find on the Google, so I am hoping this helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2011/02/hr-block-2011-wont-install/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing PostgreSQL on my Mac</title>
		<link>http://brian.olore.net/wp/2010/11/postgresql-on-mac/</link>
		<comments>http://brian.olore.net/wp/2010/11/postgresql-on-mac/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 01:54:58 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=268</guid>
		<description><![CDATA[1.  Download postgres for Mac Don&#8217;t sign up for enterprise db crap, the download will start in a sec 2. Install postgres This may require reboot to set some syscontrol settings (it did for me) I created the &#8220;postgres&#8221; user with &#8220;postgres&#8221; as the password (so I could remember it) 3. Add stuff to your [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 74px"><img title="PostgreSQL" src="http://www.wikivs.com/images/d/d0/Elephant-64.png" alt="" width="64" height="64" /><p class="wp-caption-text">PostgreSQL</p></div>
<p><strong>1.  <a href="http://www.postgresql.org/download/macosx" target="_blank">Download postgres for Mac</a></strong></p>
<ul>
<li>Don&#8217;t sign up for enterprise db crap, the download will start in a sec</li>
</ul>
<p><strong>2. Install postgres</strong></p>
<ul>
<li>This may require reboot to set some syscontrol settings (it did for me)</li>
<li>I created the &#8220;postgres&#8221; user with &#8220;postgres&#8221; as the password (so I could remember it)</li>
</ul>
<p><strong>3. Add stuff to your ~/.bash_profile</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="kw3">export</span> <span class="re2">PATH=</span><span class="re1">$PATH</span>:/Library/PostgreSQL/<span class="nu0">9.0</span>/bin<br />
<span class="kw3">export</span> <span class="re2">PGDATA=</span>/Library/PostgreSQL/<span class="nu0">9.0</span>/data</div>
<p><strong>4. Execute the profile</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ . ~/.bashrc</div>
<p><strong>5. Modify Postgres to use &#8220;trust&#8221; authentication, so we don&#8217;t need to supply a password when connecting to the database.</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ <span class="kw2">sudo</span> vi /Library/PostgreSQL/<span class="nu0">9.0</span>/data/pg_hba.conf</div>
<p><strong>5.1 For each entry, change METHOD &#8220;md5&#8243; to &#8220;trust&#8221; </strong> (this should only be done on your developer machine!)</p>
<p><strong>6. Restart postgres to pick up the conf changes</strong></p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$ <span class="kw2">sudo</span> <span class="kw2">su</span> &#8211; postgres<br />
$ . ./pg_env.<span class="kw2">sh</span><br />
$ pg_ctl restart</div>
<p><strong>7. Beer time!</strong></p>
<p>All of the above was done solely so I could run some ActiveRecord tests, so here&#8217;s how we do that:</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="re1">$gem</span> <span class="kw2">install</span> pg<br />
$ git clone git://github.com/rails/rails.git<br />
$ <span class="kw3">cd</span> rails/activerecord<br />
$ rake postgresql:build_databases<br />
$ rake test_postgresql <span class="re2">TEST=</span>test/cases/base_test.rb<br />
<span class="br0">&#40;</span><span class="kw1">in</span> /Users/brian/dev/ruby/rails/activerecord<span class="br0">&#41;</span></p>
<p>/System/Library/Frameworks/Ruby.framework/Versions/<span class="nu0">1.8</span>/usr/bin/ruby -<span class="kw2">w</span> -I<span class="st0">&quot;lib:test:test/connections/native_postgresql&quot;</span> <span class="st0">&quot;/Users/brian/.gem/ruby/1.8/gems/rake0.8.7/lib/rake/rake_test_loader.rb&quot;</span> <span class="st0">&quot;test/cases/base_test.rb&quot;</span><br />
Using native PostgreSQL<br />
Loaded suite /Users/brian/.gem/ruby/<span class="nu0">1.8</span>/gems/rake<span class="nu0">-0.8</span><span class="nu0">.7</span>/lib/rake/rake_test_loader<br />
Started<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br />
Finished <span class="kw1">in</span> <span class="nu0">3.321415</span> seconds.<br />
<span class="nu0">131</span> tests, <span class="nu0">336</span> assertions, <span class="nu0">0</span> failures, <span class="nu0">0</span> errors</div>
<p><strong>SUCCESS!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/11/postgresql-on-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doing battle with metric_fu</title>
		<link>http://brian.olore.net/wp/2010/08/doing-battle-with-metric_fu/</link>
		<comments>http://brian.olore.net/wp/2010/08/doing-battle-with-metric_fu/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 02:17:01 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[metric_fu]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=198</guid>
		<description><![CDATA[&#8220;Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Flay, Rcov, Reek, Roodi, Churn, RailsBestPractices, Subversion, Git, and Rails built-in stats task to create a series of reports. It&#8217;s designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.&#8221; It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;<a href="http://metric-fu.rubyforge.org/">Metric_fu</a> is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Flay, Rcov, Reek, Roodi, Churn, RailsBestPractices, Subversion, Git, and Rails built-in stats task to create a series of reports. It&#8217;s designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.&#8221;</p>
<p>It&#8217;s really a pretty sweet tool. It generates all these reports and you can either ignore them or act on them. Not saying which of those we do&#8230; but that&#8217;s not important right now.</p>
<p>If you&#8217;ve used metric_fu you probably ran into the <strong>NaN</strong> error. Good ol&#8217; &#8220;Not A Number&#8221;.<br />
Generally the output looks something like this:</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">NaN<br />
/usr/lib64/ruby/gems/<span class="nu0">1.8</span>/gems/activesupport<span class="nu0">-2.3</span><span class="nu0">.4</span>/lib/active_support/core_ext/<span class="kw3">float</span>/rounding.<span class="me1">rb</span>:<span class="nu0">19</span>:<span class="kw1">in</span> <span class="st0">`round_without_precision&#8217;<br />
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/float/rounding.rb:19:in `</span>round<span class="st0">&#8216;<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:135:in `round_to_tenths&#8217;</span><br />
/usr/lib64/ruby/gems/<span class="nu0">1.8</span>/gems/metric_fu<span class="nu0">-1.3</span><span class="nu0">.0</span>/lib/generators/rcov.<span class="me1">rb</span>:<span class="nu0">85</span>:<span class="kw1">in</span> <span class="st0">`to_h&#8217;<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:131:in `</span>generate_report<span class="st0">&#8216;<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/base/generator.rb:53:in `generate_report&#8217;</span><br />
/usr/lib64/ruby/gems/<span class="nu0">1.8</span>/gems/metric_fu<span class="nu0">-1.3</span><span class="nu0">.0</span>/lib/base/report.<span class="me1">rb</span>:<span class="nu0">54</span>:<span class="kw1">in</span> <span class="st0">`add&#8217;<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6:in `</span>each<span class="st0">&#8216;<br />
/usr/lib64/ruby/gems/1.8/gems/metric_fu-1.3.0/lib/../tasks/metric_fu.rake:6<br />
</span></div>
<p>This particular error has cropped up several times for us, each time we do the same google searches, look at the same metric_fu sources, and slowly dissect which tests are causing this problem. Hopefully this post will help expedite debugging this error for you and your friends.</p>
<p><span id="more-198"></span></p>
<p>The NaN error is the result of an Infinity/Infinity calculation in metric_fu. How Infinity gets in there in the first place is left as a reader exercise. Ultimately the problem resides in the fact that the <strong>scratch/rcov/rcov.txt</strong> output file does not contain the expected output. In fact, in our case, it contained a failing test.</p>
<p>At this point, running rcov by itself (outside of metric_fu) would result in expected output &#8211; everything worked and there were no failing tests!</p>
<p>So we ran metric_fu again with all tests disabled except for rcov (by editing our rake task).<br />
Metric_fu failed in the exact same place. Great &#8211; at least now it is narrowed down (even if it does take a few minutes to run).</p>
<p>Taking a look at the failing test nothing stood out, until we dug a little deeper.<br />
This test class was overriding a cattr_reader with a cattr_accessor so it could change the value for testing.<br />
No big deal, it worked fine when run by itself &#8230;.</p>
<p>Turns out that this wasn&#8217;t the only test class that was modifying the class variable.<br />
Metric_fu loads up all of the tests (functionals &amp; units) and runs them together.<br />
We had one unit test class that was modifying a class variable (and not setting it back!) and<br />
a functional test class that was making assertion based on the expected default value of that class variable.<br />
<strong>We had indirectly made our tests order dependent.</strong></p>
<p>The reason we never saw it in our normal tests was that our functional and unit tests run separately (via rake).</p>
<p><strong>Summary:</strong></p>
<ol>
<li>Look in scratch/rcov/rcov.txt to find a failing test</li>
<li>Look for usage of class variables or constants &#8211; namely the changing of them (and not setting them back).</li>
</ol>
<p><strong>Our Solution:</strong></p>
<p style="padding-left: 30px;">Our solution was to only temporarily change the class variable, and only do it when we need to:</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="kw1">def</span> temporarily_set_observer_limit_to<span class="br0">&#40;</span>count, &amp;amp;block<span class="br0">&#41;</span><br />
&nbsp; old_limit = MyClass.<span class="me1">observer_limit</span><br />
&nbsp; MyClass.<span class="me1">observer_limit</span>=count<br />
&nbsp; <span class="kw1">yield</span><br />
&nbsp; MyClass.<span class="me1">observer_limit</span>=old_limit<br />
<span class="kw1">end</span><br />
&nbsp;</div>
<p>A better solution would be to get rid of the class variables&#8230;<br />
Another solution would be to change metric_fu to handle a failing test more gracefully</p>
<p>In the end, we are left with this rule:</p>
<h3>Don&#8217;t change class variables in tests!</h3>
<p>&#8230; or better yet &#8230;</p>
<h3>Don&#8217;t use class variables!</h3>
<p style="text-align: right;">Friends don&#8217;t let friends use class variables.<br />
Partnership for cattr-free coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/08/doing-battle-with-metric_fu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Compleat Rubyist &#8211; Day 1</title>
		<link>http://brian.olore.net/wp/2010/06/compleat-rubyist-day-1/</link>
		<comments>http://brian.olore.net/wp/2010/06/compleat-rubyist-day-1/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 12:25:21 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[compleatrubyist]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=193</guid>
		<description><![CDATA[Day 1 of 2 of my notes for the Compleat Rubyist training course Ruby Versions and Implementations  &#8211; David http://ruby-versions.net/ &#8211; David&#8217;s home for ruby versions &#38; implementations for learning &#38; historical reference Ruby version manager &#8211; http://rvm.beginrescueend.com &#8211; lets you install several ruby versions/implementations and easily switch between (including your own custom compiled version). [...]]]></description>
			<content:encoded><![CDATA[<p>Day 1 of 2 of my notes for the <a href="http://www.compleatrubyist.com">Compleat Rubyist</a> training course</p>
<h3><span style="text-decoration: underline;">Ruby Versions and Implementations  &#8211; David</span></h3>
<p><a href="http://ruby-versions.net/">http://ruby-versions.net/</a> &#8211; David&#8217;s home for ruby versions &amp; implementations for learning &amp; historical reference</p>
<p>Ruby version manager &#8211; <a href="http://rvm.beginrescueend.com">http://rvm.beginrescueend.com</a> &#8211; lets you install several ruby versions/implementations and easily switch between (including your own custom compiled version). Suggestion &#8211; don&#8217;t install as root, even though it is allowed.</p>
<p>Notes on a few of the existing options:</p>
<ul>
<li>MacRuby &#8211; interacts with Cocoa</li>
<li> Rubinius &#8211; Ruby in Ruby</li>
<li> JRuby &#8211; Ruby on JVM</li>
<li> REE &#8211; optimized &#8211; created by Phusion Passenger team</li>
<li> MagLev &#8211; built in object persistence, repository instead of files, smalltalk-ish</li>
<li> IronRuby &#8211; Ruby on .NET</li>
<li> URABE &#8211; ?</li>
</ul>
<p>rvm allows you to compare performance between versions/implementation:</p>
<pre>rvm ruby-1.8.6,ruby1.9.2 benchmark filename.rb</pre>
<p>Why does everyone use 1.8 instead of 1.9?</p>
<ul>
<li>Same amount of people are using it as last year (like almost no one)</li>
<li>Rails considerations</li>
<li>1.9 is not 100% backwards compatible</li>
<li>1.8.7 backported many of the features of 1.9, so people feel safer</li>
</ul>
<p>Ruby Enterprise Edition has major memory and speed improvements</p>
<p><strong>Highlights of changes between 1.8 &amp; 1.9</strong></p>
<ul>
<li> Enumerators</li>
<li> Method parameters</li>
<li> Block variable binding &amp; scope</li>
<li> Syntax changes</li>
</ul>
<p><strong><span id="more-193"></span>Discussion</strong></p>
<ul>
<li>&#8220;Ruby 1.9 was plenty different enough to be 2.0&#8243; &#8211; David</li>
<li>1.9.1 is currently the stable supported version and has been for about a year.</li>
<li>1.8.6 to 1.8.7 was a big jump &#8211; major backporting of 1.9 features into 1.8</li>
<li>1.8.7 was a safe harbor for those that wanted 1.9 features but were scared of 1.9</li>
<li>rails3 + ruby 1.9.1 = segfaults <img src='http://brian.olore.net/wp/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />    … works with certain revisions of 1.9.2 HEAD</li>
</ul>
<p><strong>Enumerator object &#8211; 1.9</strong></p>
<ul>
<li>mixes in Enumerable</li>
<li>you write the &#8216;each&#8217; method
<ul>
<li> borrow from another object (can be lazy)</li>
<li> or</li>
<li> pass in code block on instantiation (via a yielder)</li>
</ul>
</li>
<li>once it knows how to &#8216;each&#8217;, it can do select, map, each_cons ….</li>
<li>1.8.6 &#8211; require &#8216;enumerator&#8217; &#8211; Enumerable::Enumerator</li>
<li>1.9.x &#8211; no require needed &#8211; promoted to top level &#8216;Enumerator&#8217;</li>
</ul>
<p>side bar: each_cons vs each_slice</p>
<p>Note to self: I need to memorize each/select/map/collect</p>
<p>What methods do I get with Enumerator that I don&#8217;t get with Enumerable (Array)?</p>
<pre>Enumerator.instance_methods - Array.instance_methods
:with_index, :with_object, :next, :rewind</pre>
<p><strong>Method argument semantics<br />
</strong>required args can now come after optional args<br />
def m(a, b=1, c)<br />
def m(a, *b, c)<br />
def m((a,b),c)<br />
required arguments get filled first</p>
<p><strong>Block variable scope</strong></p>
<ul>
<li>probably the most important/annoying/significant change</li>
<li>breaks stuff in surprising ways</li>
<li>but if it does break stuff, you were likely doing something buggy before</li>
</ul>
<p>Example 1:</p>
<pre>a = [1,2,3]
a.each {|x| p x}</pre>
<p>x gets value of 3 when you are done</p>
<p>|x| literally assigns x ( |x=…| ), so it becomes available outside the block</p>
<p>Example 2:</p>
<pre>a = 1
array.each { a = 2 }</pre>
<p>does not change the value of a</p>
<ul>
<li>Matz said he wished he had done this from the beginning</li>
<li>Unifies the parameter syntax between methods &amp; lambas</li>
</ul>
<p><strong>1.9 Miscellany</strong></p>
<ul>
<li>no more String#each
<ul>
<li>&#8220;Hello&#8221;[0] = &#8220;H&#8221;  #in 1.8 it returns 72</li>
</ul>
</li>
<li>new instance_exec is like instance_eval but takes a param to inject</li>
</ul>
<p>JRuby &#8211; ask David about using ArrayList instead of [] in playpoker.rb</p>
<h3><span style="text-decoration: underline;">The Testing Landscape</span></h3>
<p>Test::Unit is gone in 1.9<br />
Test::Unit::TestCase -&gt; Mini::Test::TestCase<br />
Mini::Test has a new option: refute_match<br />
require &#8216;shoulda&#8217; &#8211; makes it more like RSpec without going full RSpec<br />
RSpec is the defacto standard for Behavior-driven testing</p>
<p>Jeremy &#8211; wrote &#8216;context&#8217; and &#8216;match&#8217;<br />
Given/When/Then &#8211; cucumber is most popular<br />
&#8220;Think in units of features rather than units of code&#8221; &#8211; Gregory<br />
require &#8216;could&#8217; &#8211; another tool &#8211; include feature test right in the same file as tests</p>
<p><strong>Test data </strong></p>
<ul>
<li>YAML/CSV &#8211; hard to maintain, csv is kinda nice because you can open in spreadsheet program (or rather your testers can)</li>
<li>model_stubbing  <a href="http://github.com/technoweenie/model_stubbing">http://github.com/technoweenie/model_stubbing</a></li>
<li>Factories is the new hotness
<ul>
<li> FactoryGirl</li>
<li> Machinist &#8211; <a href="http://github.com/notahat/machinist">http://github.com/notahat/machinist</a>
<ul>
<li> create shams &amp; blueprints</li>
<li> &#8220;way slower&#8221; than fixtures</li>
</ul>
</li>
</ul>
</li>
<li>mocking/stubbing
<ul>
<li> can extend a class to do it</li>
<li> can use OpenStruct to do it require &#8216;ostrich&#8217;</li>
<li> Jeremy likes using &#8216;rr&#8217;</li>
<li> RSpec has it&#8217;s own stubbing</li>
<li> flexmock</li>
</ul>
</li>
<li>Proxies
<ul>
<li>Proxies are like mocks &amp; stubs &amp; real code combined</li>
<li>Proxies are the Ken Jennings of mocks &amp; stubs</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/06/compleat-rubyist-day-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf &#8211; Day 3 &#8211; Lightning talks</title>
		<link>http://brian.olore.net/wp/2010/06/railsconf-day-3-lightning-talks/</link>
		<comments>http://brian.olore.net/wp/2010/06/railsconf-day-3-lightning-talks/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 21:48:56 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[lightning]]></category>
		<category><![CDATA[railsconf]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=190</guid>
		<description><![CDATA[Brian C &#8211; DNC http://github/dnclabs - client_side_validations &#8211; gem that does client side validation for rails - takes AR validations &#8211; serves them via json &#8211; used by jquery.validate how to kill rails github.com/michel bad practices by a few rails developers Don&#8217;t reduce yourself to $20/hr, stick to your price, delivery quality Communication is important! [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Brian C &#8211; DNC</strong></p>
<p>http://github/dnclabs</p>
<p>- client_side_validations &#8211; gem that does client side validation for rails<br />
- takes AR validations &#8211; serves them via json &#8211; used by jquery.validate</p>
<p><strong>how to kill rails</strong><br />
github.com/michel<br />
bad practices by a few rails developers<br />
Don&#8217;t reduce yourself to $20/hr, stick to your price, delivery quality<br />
Communication is important!</p>
<p><strong>Democracy.com</strong><br />
Raimond Garcia<br />
Revolutionize Democracy<br />
Parsed Congress web page &#8211; created a prototype on heroku in 48 hours<br />
legal palitical party in spain &#8211; &#8220;partido de internet&#8221;</p>
<p><strong>What&#8217;s new in RSpec-2</strong><br />
David Chelimsky<br />
in beta right now<br />
Old rspec won&#8217;t work with Rails 3<br />
doesn&#8217;t work with rails &lt; 3 (yet)</p>
<p>http://github.com/rspec</p>
<p>$rspec spec<br />
modularized, rspec-core is built on micronaut</p>
<p><strong><span id="more-190"></span>Surveyor gem</strong><br />
Mark Yoon<br />
Surveys in your Rails app<br />
write surveys in DSL<br />
exmaple Kitchen Sink survey<br />
dates, ranges, plck any, grids, multiple answers<br />
needs: admin ui, validations in UI, Rails3 support</p>
<p>http://github.com/breakpointer/surveyor</p>
<p><strong>MySQL is awesome</strong></p>
<p>@igrigorik<br />
Don&#8217;t believe all the NoSQL hype</p>
<p>http://bit.ly/bgi1Wf</p>
<p>more flexibility in the relational model<br />
em-proxy gem &#8211; tcp level proxy<br />
- used to rewrite SQL queries on the fly</p>
<p><strong>Michael Hartl</strong><br />
railstutorial.org<br />
Joy of publishing online<br />
goal &#8211; write a source file, publish HTML &amp; PDF with syntax highlighting &amp; linking to other sections<br />
PolyyTeXnic<br />
HTML &amp; PDF stay in sync</p>
<p><strong>Jake Scruggs </strong><br />
@jakescruggs<br />
ActiveMQ &amp; ActiveMessaging<br />
Mostly a Java shop, so not Resque, delayed job<br />
sending messages is easy<br />
pass id&#8217;s NOT serialized objects<br />
Tips:<br />
- Tell ActiveMessage to not be greedy<br />
- Namespace your queues<br />
- Name your pollers<br />
- Double Kill &#8211; Die Poller Die &#8211; script/poller run vs script/poller start</p>
<p><strong>Greg Nelson</strong><br />
foreign assistance</p>
<p>http://bit.ly/RwandaOnRails</p>
<p><strong>Jim Rumsick (Big Tiger)- HashRocket</strong><br />
Improv &#8211; Comedy to Coding<br />
Programming is about communication</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/06/railsconf-day-3-lightning-talks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf &#8211; Day 3 &#8211; Persistence Smoothie</title>
		<link>http://brian.olore.net/wp/2010/06/railsconf-day-3-persistence-smoothie/</link>
		<comments>http://brian.olore.net/wp/2010/06/railsconf-day-3-persistence-smoothie/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 19:34:36 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[datamapper]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[railsconf]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=188</guid>
		<description><![CDATA[Persistence Smoothie &#8211; Blending SQL &#38; NoSQL &#8211; Flip Sasser (Intridea, Inc.) @flipsasser http://github.com/flipsasser/Persistence-Smoothie NoSQL means no ACID Keep what you know &#8211; don&#8217;t throw out your MySQL DataMapper is the swiss army knife of ORM - can point different models to different datastores - Have a lot of refactoring to do Sample Store App [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.oreilly.com/rails2010/public/schedule/detail/11245">Persistence Smoothie &#8211; Blending SQL &amp; NoSQL</a> &#8211; <a href="http://en.oreilly.com/rails2010/public/schedule/speaker/81272">Flip  Sasser</a> (Intridea, Inc.)<br />
@flipsasser</p>
<p>http://github.com/flipsasser/Persistence-Smoothie</p>
<p>NoSQL means no ACID<br />
Keep what you know &#8211; don&#8217;t throw out your MySQL</p>
<p>DataMapper is the swiss army knife of ORM<br />
- can point different models to different datastores<br />
- Have a lot of refactoring to do</p>
<p>Sample Store App<br />
- Authentication &#8211; keep in Reational DB<br />
- Products &#8211; store metadata<br />
- Purchases &#8211; keep it in RDB<br />
- Activity Stream &#8211; denormalize with key/value store</p>
<p>mongofy &#8211; gem for moving data from mysql to mongo</p>
<p>Drawbacks<br />
- DataPortability is lowered<br />
- Lot more moving parts<br />
- Say goodbye to all your fun AR mixins</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/06/railsconf-day-3-persistence-smoothie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf &#8211; Day 3 &#8211; Introduction to Cassandra and CassandraObject</title>
		<link>http://brian.olore.net/wp/2010/06/railsconf-day-3-intro-to-cassandra/</link>
		<comments>http://brian.olore.net/wp/2010/06/railsconf-day-3-intro-to-cassandra/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 18:40:35 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[cassandra]]></category>
		<category><![CDATA[cassandraobject]]></category>
		<category><![CDATA[railsconf]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=184</guid>
		<description><![CDATA[Introduction to Cassandra and CassandraObject &#8211; Michael Koziarski (Koziarski Software Limited) Scales linearly &#8211; increases not only read access, but also write access A ColumnFamily per query CassandraObject - Mostly AR compatible - In flux - taking patches]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.oreilly.com/rails2010/public/schedule/detail/14740">Introduction to Cassandra and CassandraObject</a> &#8211; <a href="http://en.oreilly.com/rails2010/public/schedule/speaker/4847">Michael  Koziarski</a> (Koziarski Software Limited)</p>
<p>Scales linearly &#8211; increases not only read access, but also write access</p>
<p>A ColumnFamily per query</p>
<p>CassandraObject<br />
- Mostly AR compatible<br />
- In flux<br />
- taking patches</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/06/railsconf-day-3-intro-to-cassandra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf &#8211; Day 3 &#8211; Redis, Rails and Resque</title>
		<link>http://brian.olore.net/wp/2010/06/railsconf-day-3-resque/</link>
		<comments>http://brian.olore.net/wp/2010/06/railsconf-day-3-resque/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 17:52:55 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[railsconf]]></category>
		<category><![CDATA[redis]]></category>
		<category><![CDATA[resque]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=181</guid>
		<description><![CDATA[Redis, Rails, and Resque &#8211; Background Job Bliss &#8211; Chris Wanstrath (GitHub) redis is a key value store for data structures redis is not use for everything because entire dataset used to have to fit into RAM &#8211; would have to shard across machines github &#8211; uses redis for routing, can add, remove.modify routes quickly [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.oreilly.com/rails2010/public/schedule/detail/14595">Redis, Rails, and Resque &#8211; Background Job Bliss</a> &#8211; <a href="http://en.oreilly.com/rails2010/public/schedule/speaker/45877">Chris  Wanstrath</a> (GitHub)<br />
redis is a key value store for data structures</p>
<p>redis is not use for everything because entire dataset used to have to fit into RAM &#8211; would have to shard across machines</p>
<p>github &#8211; uses redis for routing, can add, remove.modify routes quickly &amp; easily &#8211; can determine what server to put new users on, etc</p>
<p>Old &#8211; HAProxy sending to mongrels<br />
New &#8211; Unicorn &#8211; instead of receiving requests, it asks for one using &#8216;select&#8217;, pooled, forks similar to passenger</p>
<p>Used 6 or 7 different bg &#8211; SQS, DelayedJob<br />
Used Delayed job for 2 years</p>
<p>resque is built on redis, jobs are serialized to json and workers can be in any language http://github.com/defunkt/resque</p>
<p>resque has a plugin API &#8211; 15 or so plugins already exist &#8211; http://wiki.github.com/defunkt/resque/plugins</p>
<p>has admin interface</p>
<p>github has 35 types of background jobs</p>
<p>Notes: lightning fast talker! Lots of good information though. I&#8217;d have a beer with this guy!</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/06/railsconf-day-3-resque/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

