<?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 StoryThe Brian Olore Story</title>
	<atom:link href="http://brian.olore.net/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>Tue, 02 Oct 2012 03:01:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Upgrading to Phonegap 2.0</title>
		<link>http://brian.olore.net/wp/2012/07/upgrading-to-phonegap-2-0/</link>
		<comments>http://brian.olore.net/wp/2012/07/upgrading-to-phonegap-2-0/#comments</comments>
		<pubDate>Mon, 23 Jul 2012 06:53:13 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[play]]></category>
		<category><![CDATA[cordova]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[upgrading]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=382</guid>
		<description><![CDATA[I recently upgraded my ios app to Phonegap 2.0 and found the upgrade instructions a little daunting. In an attempt to make them more approachable &#38; consumable, I&#8217;ve annotated many of them below. Please let me know if I missed anything. Install Cordova 2.0.0 Download from http://phonegap.com/download Unzip the file into ~/pg2.0 Double click on the ~/pg2.0/Cordova-2.0.0.pkg [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://phonegap.com"><img class="alignright" src="http://phonegap.com/uploads/artwork/Build-Bot.png" alt="" width="128" height="128" /></a></p>
<div>I recently upgraded <a href="itunes.apple.com/us/app/drive-by/id527034924">my ios app</a> to Phonegap 2.0 and found the <a href="http://docs.phonegap.com/en/2.0.0/guide_upgrading_ios_index.md.html#Upgrading%20Cordova%20iOS">upgrade instructions</a> a little daunting. In an attempt to make them more approachable &amp; consumable, I&#8217;ve annotated many of them below.</div>
<div></div>
<div>Please let me know if I missed anything.</div>
<ol>
<li><strong>Install</strong> Cordova 2.0.0
<ol>
<li>Download from <a href="http://phonegap.com/download" target="_blank">http://phonegap.com/download</a></li>
<li>Unzip the file into ~/pg2.0</li>
<li>Double click on the ~/pg2.0/Cordova-2.0.0.pkg to begin the installation<a href="http://brian.olore.net/wp/wp-content/uploads/2012/07/install.png" rel="lightbox[382]" title="install"><img class="size-medium wp-image-383 aligncenter" title="install" src="http://brian.olore.net/wp/wp-content/uploads/2012/07/install-300x129.png" alt="" width="300" height="129" /></a></li>
</ol>
</li>
<li><strong>Create a new project</strong> from the command-line tools &#8211; you will have to grab the assets from this new project
<ol>
<li>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">TEMP_PROJ=~/temp_project2.0<br />
~/pg2.0/lib/ios/bin/create $TEMP_PROJ com.temp_project2.0 TempProject</div>
</li>
</ol>
</li>
<li><strong>Copy</strong> the <strong>www/cordova-2.0.0.js</strong> file from the new project into your <strong>www</strong> folder, and delete your <strong>www/cordova-1.9.0.js </strong>file
<ol>
<li>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">$EXISTING_1_9_PROJ=~/dev/iphone/myapp/  #Set this to the path of the folder that contains your app&#8217;s www folder<br />
cp $TEMP_PROJ/www/cordova-2.0.0.js $EXISTING_1_9_PROJ/www</div>
</li>
</ol>
</li>
<li><strong>Update</strong> the Cordova script reference in your <strong>www/index.html</strong> file (and any other files that contain the script reference) to point to the new <strong>cordova-2.0.0.js</strong> file</li>
<li>Copy the <strong>&#8220;cordova&#8221;</strong> folder from the new project into your project&#8217;s root folder (if you want the project command-line tools)
<ol>
<li>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">cp -r $TEMP_PROJ/cordova/ $EXISTING_1_9_PROJ/www</div>
</li>
</ol>
</li>
<li><strong>Add</strong> a new entry under <strong>Plugins</strong> in your <strong>Cordova.plist</strong> file (under the <strong>Supporting Files</strong> group) &#8211; the key is <strong>Device</strong> and the value is <strong>CDVDevice</strong>
<ol>
<li>Edit <strong>Cordova.plist</strong>, to include Device/CDVDevice like so, (or edit the file in Xcode)
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="sc3"><span class="re1">&lt;key<span class="re2">&gt;</span></span></span>Plugins<span class="sc3"><span class="re1">&lt;/key<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;dict<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;key<span class="re2">&gt;</span></span></span>Device<span class="sc3"><span class="re1">&lt;/key<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;string<span class="re2">&gt;</span></span></span>CDVDevice<span class="sc3"><span class="re1">&lt;/string<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;key<span class="re2">&gt;</span></span></span>Logger<span class="sc3"><span class="re1">&lt;/key<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</li>
<li>Remove <strong>Cordova.framework</strong>
<ol>
<li>Select <strong>Cordova.framework </strong>in Xcode then Edit -&gt; Delete, then select Remove Reference</li>
</ol>
</li>
<li>Remove <strong>verify.sh</strong> from the <strong>Supporting Files</strong> group
<ol>
<li>Select <strong>verify.sh</strong> in Xcode Select in <strong>Cordova.framework </strong>in Xcode</li>
</ol>
</li>
<li>Select the <strong>project icon</strong> in the Project Navigator, select your project <strong>Target</strong>, then select the <strong>&#8220;Build Settings&#8221;</strong> tab</li>
<li>Search for <strong>&#8220;Preprocessor Macros&#8221;</strong>, then remove all <strong>&#8220;CORDOVA_FRAMEWORK=1&#8243;</strong> values</li>
<li>Locate the <strong>CordovaLib</strong> folder that was installed in your hard-drive under your home folder&#8217;s <strong>Documents</strong> sub-folder.</li>
<li>Locate the <strong>CordovaLib.xcodeproj</strong> file in the <strong>CordovaLib</strong> folder, then <strong>drag and drop</strong> the file into your project &#8211; it should appear as a <strong>sub-project</strong>.
<ol>
<li>Drop <strong>CordovaLib.xcodeproj</strong>on top of your project to include to it in as a sub-project<a href="http://brian.olore.net/wp/wp-content/uploads/2012/07/subproject.png" rel="lightbox[382]" title="subproject"><img class="aligncenter size-full wp-image-384" title="subproject" src="http://brian.olore.net/wp/wp-content/uploads/2012/07/subproject.png" alt="" width="257" height="81" /></a></li>
</ol>
</li>
<li><strong>Build</strong> your project, you should get some <strong>errors</strong> relating to <strong>#import</strong> directives</li>
<li>For the <strong>#import errors</strong>, change any <strong>quote-based</strong> imports in this style:
<pre><code>#import "CDV.h" </code></pre>
<p>to this <strong>brackets-based</strong> style:</p>
<pre><code>#import &lt;Cordova/CDV.h&gt; </code></pre>
<p>and remove any <strong>#ifdef</strong> wrappers around any Cordova imports, they are not needed anymore (the imports are <strong>unified</strong> now)</li>
<li><strong>Build</strong> your project again, and it should not have any <strong>#import</strong> errors.
<ol>
<li>You <strong>will still have build errors</strong>, they will get cleaned up shortly</li>
</ol>
</li>
<li>Select the <strong>project icon</strong> in the Project Navigator, select your project <strong>Target</strong>, then select the <strong>&#8220;Build Phases&#8221;</strong> tab</li>
<li>Expand the <strong>&#8220;Target Dependencies&#8221;</strong> phase, then select the <strong>&#8220;+&#8221;</strong> button</li>
<li>Select the <strong>&#8220;CordovaLib&#8221;</strong> target, then select the <strong>&#8220;Add&#8221;</strong> button</li>
<li>Expand the <strong>first</strong> <strong>&#8220;Link Binary with Libraries&#8221;</strong> phase (it should already contain a bunch of frameworks), then select the<strong>&#8220;+&#8221;</strong> button</li>
<li>Select the <strong>libCordova.a</strong> static library, then select the <strong>&#8220;Add&#8221;</strong> button
<ol>
<li>Select <strong>libCordova.a</strong> from the dialog<a href="http://brian.olore.net/wp/wp-content/uploads/2012/07/libCordova.png" rel="lightbox[382]" title="libCordova"><img class="aligncenter size-medium wp-image-385" title="libCordova" src="http://brian.olore.net/wp/wp-content/uploads/2012/07/libCordova-262x300.png" alt="" width="262" height="300" /></a></li>
<li>When these steps are complete, it should look like the following<a href="http://brian.olore.net/wp/wp-content/uploads/2012/07/selection_done.png" rel="lightbox[382]" title="selection_done"><img class="aligncenter size-medium wp-image-387" title="selection_done" src="http://brian.olore.net/wp/wp-content/uploads/2012/07/selection_done-300x167.png" alt="" width="300" height="167" /></a></li>
</ol>
</li>
<li>Delete the <strong>&#8220;Run Script&#8221;</strong> phase.
<ol>
<li>Click the <strong>X</strong> to the right of the <strong>Run Script</strong> section title and confirm deletion</li>
</ol>
</li>
<li>Select the <strong>project icon</strong> in the Project Navigator, select your project <strong>Target</strong>, then select the <strong>&#8220;Build Settings&#8221;</strong> tab</li>
<li>Search for <strong>&#8220;Other Linker Flags&#8221;</strong>, and add the values <strong>-all_load</strong> and <strong>-Obj-C</strong>
<ol>
<li>Modify the flags by clicking the + at the bottom and adding both flags separately<strong><a href="http://brian.olore.net/wp/wp-content/uploads/2012/07/linker.png" rel="lightbox[382]" title="linker"><img class="aligncenter size-medium wp-image-386" title="linker" src="http://brian.olore.net/wp/wp-content/uploads/2012/07/linker-300x139.png" alt="" width="300" height="139" /></a></strong></li>
</ol>
</li>
<li>Expand the <strong>&#8220;CordovaLib&#8221; sub-project</strong></li>
<li>Locate the <strong>&#8220;VERSION&#8221;</strong> file, drag it into your main project (we want to create a link to it, not a copy)</li>
<li>Select the <strong>&#8220;Create groups for any added folders&#8221;</strong> radiobutton, then select the <strong>&#8220;Finish&#8221;</strong> button</li>
<li>Select the <strong>&#8220;VERSION&#8221;</strong> file that you just dragged in a previous step</li>
<li>Press the key combination <strong>Option-Command-1</strong> to show the <strong>File Inspector</strong> (or menuitem <strong>View -&gt; Utilities -&gt; Show FileInspector</strong>)</li>
<li>Choose <strong>&#8220;Relative to CORDOVALIB&#8221;</strong> in the <strong>File Inspector</strong> for the drop-down menu for <strong>Location</strong></li>
<li><strong>Build</strong> your project, it should compile and link with <strong>no issues</strong>.</li>
<li><strong>Select your project</strong> from the <strong>Scheme</strong> drop-down, and then select <strong>&#8220;iPhone 5.1 Simulator&#8221;</strong></li>
<li>Select the <strong>Run</strong> button</li>
</ol>
<p><strong>NOTE 1:</strong><br />
If your project is <strong>not working</strong> as expected in the Simulator, please <strong>take a note of any errors</strong> in the <strong>console log in Xcode</strong> for clues.</p>
<p><strong>NOTE 2:</strong><br />
For the <strong>unified #import headers</strong> to work, the build products should <strong>build into the same build directory</strong>. You may need to set the preference <strong>&#8220;Xcode Preferences -&gt; Locations -&gt; Derived Data -&gt; Advanced…&#8221;</strong> to <strong>&#8220;Unique&#8221;</strong></p>
<div><strong><br />
</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2012/07/upgrading-to-phonegap-2-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<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>First iPad app</title>
		<link>http://brian.olore.net/wp/2011/03/first-ipad-app/</link>
		<comments>http://brian.olore.net/wp/2011/03/first-ipad-app/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 03:01:30 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[play]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=317</guid>
		<description><![CDATA[Wrote my first iPad application tonight. Took me longer to redo the signer cert and provisioning profiles than to write the code&#8230; but it was worth it. I used Titanium Mobile which I&#8217;ve played with in the past. The goal of this app is to teach my kids the positions on the baseball field. Here [...]]]></description>
				<content:encoded><![CDATA[<p>Wrote my first iPad application tonight. Took me longer to redo the signer cert and provisioning profiles than to write the code&#8230; but it was worth it.</p>
<p>I used <a href="http://www.appcelerator.com/products/titanium-mobile-application-development/">Titanium Mobile</a> which I&#8217;ve played with in the past.</p>
<p>The goal of this app is to teach my kids the positions on the baseball field.</p>
<p>Here it is in all it&#8217;s glory</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;">
<p><span class="kw2">var</span> win1 = Titanium.<span class="me1">UI</span>.<span class="me1">createWindow</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; top: <span class="nu0">0</span>,<br />
&nbsp; left: <span class="nu0">0</span>,<br />
&nbsp; backgroundColor:<span class="st0">&#8216;#fff&#8217;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw2">var</span> webview = Titanium.<span class="me1">UI</span>.<span class="me1">createWebView</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; top: <span class="nu0">20</span>,<br />
&nbsp; left: <span class="nu0">0</span>,<br />
&nbsp; height: <span class="st0">&#8217;75%&#8217;</span>,<br />
&nbsp; url:<span class="st0">&#8216;./baseball_diamond.jpg&#8217;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw2">var</span> label = Titanium.<span class="me1">UI</span>.<span class="me1">createLabel</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; text:<span class="st0">&#8216;Where is Right Field?&#8217;</span>,<br />
&nbsp; &nbsp; bottom: <span class="st0">&#8217;50px&#8217;</span>,<br />
&nbsp; &nbsp; height:<span class="st0">&#8216;auto&#8217;</span>,<br />
&nbsp; &nbsp; width:<span class="st0">&#8216;auto&#8217;</span>,<br />
&nbsp; &nbsp; shadowColor:<span class="st0">&#8216;#aaa&#8217;</span>,<br />
&nbsp; &nbsp; shadowOffset:<span class="br0">&#123;</span>x:<span class="nu0">5</span>,y:<span class="nu0">5</span><span class="br0">&#125;</span>,<br />
&nbsp; &nbsp; color:<span class="st0">&#8216;#900&#8242;</span>,<br />
&nbsp; &nbsp; font:<span class="br0">&#123;</span>fontSize:<span class="nu0">48</span><span class="br0">&#125;</span>,<br />
&nbsp; &nbsp; textAlign:<span class="st0">&#8216;center&#8217;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span>;</p>
<p>webview.<span class="me1">addEventListener</span><span class="br0">&#40;</span><span class="st0">&#8216;singletap&#8217;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; point = e.<span class="me1">globalPoint</span>;<br />
&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>point.<span class="me1">x</span> &gt; <span class="nu0">480</span> &amp;&amp; point.<span class="me1">x</span> &lt; <span class="nu0">766</span> &amp;&amp; point.<span class="me1">y</span> &gt; <span class="nu0">382</span> &amp;&amp; point.<span class="me1">y</span> &lt; <span class="nu0">624</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; label.<span class="me1">text</span> = <span class="st0">&quot;Right!&quot;</span>;<br />
&nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; label.<span class="me1">text</span> = <span class="st0">&quot;WRONG!&quot;</span>;<br />
&nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span>;</p>
<p>
win1.<span class="me1">add</span><span class="br0">&#40;</span>webview<span class="br0">&#41;</span>;<br />
win1.<span class="me1">add</span><span class="br0">&#40;</span>label<span class="br0">&#41;</span>;<br />
win1.<span class="kw3">open</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2011/03/first-ipad-app/feed/</wfw:commentRss>
		<slash:comments>2</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>3</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>Using Twitter Tools to integrate tweets into WordPress</title>
		<link>http://brian.olore.net/wp/2010/08/integrating-tweets-with-twitter-tools/</link>
		<comments>http://brian.olore.net/wp/2010/08/integrating-tweets-with-twitter-tools/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 02:11:03 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[play]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=235</guid>
		<description><![CDATA[I realized the other day that I wanted blog more. At the same time I realized that I post a lot to Twitter and set out to find a way to integrate my tweets in-line with my blog posts. I also figured that as I get close to the 3200 tweet history limit it&#8217;d be [...]]]></description>
				<content:encoded><![CDATA[<p>I realized the other day that I wanted blog more. At the same time I realized that I post a lot to Twitter and set out to find a way to integrate my tweets in-line with my blog posts. I also figured that as I get close to the <a href="http://support.twitter.com/entries/13920-frequently-asked-questions">3200 tweet history limit</a> it&#8217;d be nice to have some of that history in my own hands. That&#8217;s when I discovered <a href="http://wordpress.org/extend/plugins/twitter-tools/">Twitter Tools</a>.</p>
<p>Twitter Tools allowed me to modify my theme in such a way that I can get my tweets either as they happen, daily or a weekly summary&#8230; pretty slick. I wanted the &#8220;as they happen&#8221; option and I wanted them to show up differently, as quick blurbs (inspired by Gina Trapani&#8217;s <a href="http://smarterware.org">Smarterware.org</a> (where I think she is using <a href="http://web.twelvehorses.com/projects/quickpost/">QuickPost</a>)) right in line with my blog posts.</p>
<p>After some monkeying around, I learned I could switch the theme based on which tags were used in the post. So I set up Twitter Tools to use the tag &#8220;tweet&#8221;. With that in mind I used the following code in index.php:</p>
<div class="dean_ch" style="overflow: scroll;white-space: nowrap;"><span class="kw2">&lt;?php</span> <span class="kw1">while</span> <span class="br0">&#40;</span>have_posts<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> : the_post<span class="br0">&#40;</span><span class="br0">&#41;</span>; <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; <span class="kw2">&lt;?php</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$posttags</span> = get_the_tags<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$tweet</span> = <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$posttags</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$posttags</span> <span class="kw1">as</span> <span class="re0">$tag</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="st0">&#8216;tweets&#8217;</span> == <span class="re0">$tag</span>-&gt;<span class="me1">name</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$tweet</span> = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$tweet</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include</span> <span class="st0">&quot;post_tweet.php&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include</span> <span class="st0">&quot;post_normal.php&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">?&gt;</span><br />
<span class="kw2">&lt;?php</span> <span class="kw1">endwhile</span>; <span class="kw2">?&gt;</span></div>
<p>With that in place, tweets get rendered with post_tweet.php and everything else with post_normal.php. Yeah my post_tweet.php needs some love&#8230; I&#8217;m getting there&#8230;.</p>
<p>But in the mean time &#8211; victory is mine!</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/08/integrating-tweets-with-twitter-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated Twitter bots</title>
		<link>http://brian.olore.net/wp/2010/08/updated-twitter-bots/</link>
		<comments>http://brian.olore.net/wp/2010/08/updated-twitter-bots/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 00:34:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[play]]></category>
		<category><![CDATA[retweet]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitterbot]]></category>

		<guid isPermaLink="false">http://brian.olore.net/?p=215</guid>
		<description><![CDATA[Finally got around to re-enabling and updating my twitter bots &#8211; including new images! Thanks to Google&#8217;s new image search option for &#8220;labeled for reuse&#8221; @NYBadDrivers image courtesy of Leo Reynolds (via Flickr) @CTBadDrivers image courtesy of Daniel Case (via Wikimedia) @NJBadDrivers image courtesy Mr. Matté (via Wikipedia) Each account is re-enabled now, checking for [...]]]></description>
				<content:encoded><![CDATA[<p>Finally got around to re-enabling and updating my twitter bots &#8211; including new images!</p>
<p>Thanks to <a href="http://googleblog.blogspot.com/2009/07/find-creative-commons-images-with-image.html">Google&#8217;s new image search option</a> for &#8220;labeled for reuse&#8221;</p>
<p><a href="http://twitter.com/NYBadDrivers">@NYBadDrivers</a> image courtesy of Leo Reynolds (<a href="http://www.flickr.com/photos/49968232@N00/2570758247/">via Flickr</a>)<br />
<a href="http://twitter.com/CTBadDrivers">@CTBadDrivers</a> image courtesy of Daniel Case (<a href="http://commons.wikimedia.org/wiki/File:I-84_western_approach_to_Waterbury,_CT.jpg">via Wikimedia</a>)<br />
<a href="http://twitter.com/NJBadDrivers"> @NJBadDrivers</a> image courtesy Mr. Matté (<a href="http://en.wikipedia.org/wiki/File:GSPkwy_Shield.png">via Wikipedia</a>)</p>
<p>Each account is re-enabled now, checking for any @replies to their respective account.</p>
]]></content:encoded>
			<wfw:commentRss>http://brian.olore.net/wp/2010/08/updated-twitter-bots/feed/</wfw:commentRss>
		<slash:comments>0</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>3</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>
	</channel>
</rss>
