<?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>furmanek.net &#187; Ruby</title>
	<atom:link href="http://www.furmanek.net/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.furmanek.net</link>
	<description>Greg Furmanek's personal blog</description>
	<lastBuildDate>Fri, 16 Jul 2010 22:29:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Updating rubygems from 1.2.0 to 1.3.5</title>
		<link>http://www.furmanek.net/231/updating-rubygems-from-1-2-0-to-1-3-5/</link>
		<comments>http://www.furmanek.net/231/updating-rubygems-from-1-2-0-to-1-3-5/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 17:28:32 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=231</guid>
		<description><![CDATA[You would think it this process is straight forward but it appears there were changes that prevent simple update but here are the steps:
1. Update to 1.3.0:

View Code SH$&#62; sudo gem install rubygems-update -v 1.3.0
...
&#160;
$&#62; sudo update_rubygems
...

2. Update to the most recent release

View Code SH$&#62; sudo gem update --system
...

3. Check the version

View Code SH$&#62; gem [...]]]></description>
			<content:encoded><![CDATA[<p>You would think it this process is straight forward but it appears there were changes that prevent simple update but here are the steps:</p>
<p>1. Update to 1.3.0:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code4'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2314"><td class="code" id="p231code4"><pre class="sh" style="font-family:monospace;">$&gt; sudo gem install rubygems-update -v 1.3.0
...
&nbsp;
$&gt; sudo update_rubygems
...</pre></td></tr></table></div>

<p>2. Update to the most recent release</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code5'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2315"><td class="code" id="p231code5"><pre class="sh" style="font-family:monospace;">$&gt; sudo gem update --system
...</pre></td></tr></table></div>

<p>3. Check the version</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code6'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2316"><td class="code" id="p231code6"><pre class="sh" style="font-family:monospace;">$&gt; gem --version
1.3.5</pre></td></tr></table></div>

<p>That&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/231/updating-rubygems-from-1-2-0-to-1-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AutoGrowling: making autotest and spectest work with Growl</title>
		<link>http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/</link>
		<comments>http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 00:46:12 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=206</guid>
		<description><![CDATA[I like test and feature driven development.  It keeps me on track when writing ruby code.  Since I work on few different projects and some of these projects use TestUnit while others use Rspec I needed the .autospec hook to handle both formats. 
So here is another tutorial on how to get these [...]]]></description>
			<content:encoded><![CDATA[<p>I like test and feature driven development.  It keeps me on track when writing ruby code.  Since I work on few different projects and some of these projects use TestUnit while others use Rspec I needed the .autospec hook to handle both formats. </p>
<p>So here is another tutorial on how to get these things working together:</p>
<ol>
<li> Download Growl from: http://growl.info/</li>
<li> Install the downloaded dmg</li>
<li> Install growlnotify from Extras/growlnotify folder in the dmg</li>
<p>Copy the folder to your desktop<br />
Open the terminal and run following commands.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p206code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20610"><td class="code" id="p206code10"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> Desktop<span style="color: #000000; font-weight: bold;">/</span>growlnotify
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> install.sh</pre></td></tr></table></div>

<li> Create
<pre>~/.autotest_images/</pre>
<p> folder.</li>
<li>Save following images into the folder.</li>
<p>
<a href='http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/rails_fail/' title='rails_fail'><img width="50" height="64" src="http://www.furmanek.net/wp-content/uploads/2009/04/rails_fail.png" class="attachment-thumbnail" alt="" title="rails_fail" /></a>
<a href='http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/rails_pass/' title='rails_pass'><img width="50" height="64" src="http://www.furmanek.net/wp-content/uploads/2009/04/rails_pass.png" class="attachment-thumbnail" alt="" title="rails_pass" /></a>
<a href='http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/rails_pending/' title='rails_pending'><img width="50" height="64" src="http://www.furmanek.net/wp-content/uploads/2009/04/rails_pending.png" class="attachment-thumbnail" alt="" title="rails_pending" /></a>

</ol>
<p>Install following gems: ZenTest, redgreen:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p206code11'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20611"><td class="code" id="p206code11"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> ZenTest
$ <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> redgreen</pre></td></tr></table></div>

<p><a href="http://www.furmanek.net/wp-content/downloads/autotest.rb">Download</a> the script below and rename the file to <strong>.autotest</strong> and place it in your home folder user folder.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p206code12'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20612"><td class="code" id="p206code12"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">##!/usr/bin/ruby</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'autotest/redgreen'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'autotest/timestamp'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> AutoTestNotifier
  IMAGEDIR = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;~/.autotest_images&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  FAIL_IMG = IMAGEDIR <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/rails_fail.png&quot;</span>
  PASS_IMG = IMAGEDIR <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/rails_pass.png&quot;</span>
  PEND_IMG = IMAGEDIR <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/rails_pending.png&quot;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">growl</span><span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    AutoTestNotifier.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">notify</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@priority</span> = <span style="color:#0000FF; font-weight:bold;">nil</span>
    <span style="color:#0066ff; font-weight:bold;">@result</span> = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> data.<span style="color:#9900CC;">last</span> =~ <span style="color:#006600; font-weight:bold;">/</span>examples<span style="color:#006600; font-weight:bold;">/</span>i
      parse_spec_message<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
      parse_unit_message<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> parse_spec_message<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:type</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#ff3333; font-weight:bold;">:spec</span>
    output = data.<span style="color:#9900CC;">last</span>.<span style="color:#9900CC;">strip</span>.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>\e\<span style="color:#006600; font-weight:bold;">&#91;</span>\d<span style="color:#006600; font-weight:bold;">+</span>m<span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    output.<span style="color:#9900CC;">map</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> 
      val, lbl = i.<span style="color:#9900CC;">strip</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot; &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span>lbl.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#93;</span> = val.<span style="color:#9900CC;">to_i</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> parse_unit_message<span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:type</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#ff3333; font-weight:bold;">:unit</span>
    output = data.<span style="color:#9900CC;">last</span>.<span style="color:#CC0066; font-weight:bold;">chop</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">','</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    output.<span style="color:#9900CC;">map</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> 
      val, lbl = i.<span style="color:#9900CC;">strip</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot; &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span>lbl.<span style="color:#9900CC;">to_sym</span><span style="color:#006600; font-weight:bold;">&#93;</span> = val.<span style="color:#9900CC;">to_i</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> img
    <span style="color:#0000FF; font-weight:bold;">return</span> FAIL_IMG <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:errors</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:failures</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> 
    <span style="color:#0000FF; font-weight:bold;">return</span> PEND_IMG <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:pending</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> 
    <span style="color:#0000FF; font-weight:bold;">return</span> PASS_IMG
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> title
    pre = <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:type</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#ff3333; font-weight:bold;">:spec</span> ? <span style="color:#996600;">&quot;Spec Tests&quot;</span> : <span style="color:#996600;">&quot;Unit Tests&quot;</span>
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;">&quot;#{pre} Failed:&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:errors</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:failures</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> 
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;">&quot;#{pre} Pending:&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:pending</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span> 
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;">&quot;#{pre} Passed:&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> to_s
    msg = <span style="color:#996600;">&quot;&quot;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Examples: #{@result[:examples]}     &quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:examples</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Tests: #{@result[:tests]}     &quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:tests</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Assertions: #{@result[:assertions]}     &quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:assertions</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Pending: #{@result[:pending]}      &quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:pending</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Failures: #{@result[:failures]}     &quot;</span>
    msg <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Errors: #{@result[:errors]}&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0066ff; font-weight:bold;">@result</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:errors</span><span style="color:#006600; font-weight:bold;">&#93;</span>
    msg
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> priority
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0066ff; font-weight:bold;">@priority</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#006666;">0</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> stick
    <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#996600;">&quot;&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> notify
    cmd = <span style="color:#996600;">&quot;growlnotify -n autotest --image #{img} -p #{priority} -m '#{to_s}' #{title} #{stick}&quot;</span> 
    <span style="color:#996600;">`#{cmd}`</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> <span style="color:#6666ff; font-weight:bold;">Autotest::Growl</span>
  Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:ran_command</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
    AutoTestNotifier.<span style="color:#9900CC;">growl</span><span style="color:#006600; font-weight:bold;">&#40;</span>at.<span style="color:#9900CC;">results</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>This should take care for both the UnitTest and RSpec messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/206/autogrowling-making-autotest-and-spectest-work-with-growl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing libxml-ruby 0.9.9 on Leopard OS X</title>
		<link>http://www.furmanek.net/190/fixing-libxml-ruby-099-on-leopard-os-x/</link>
		<comments>http://www.furmanek.net/190/fixing-libxml-ruby-099-on-leopard-os-x/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 22:03:35 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[libxml-ruby]]></category>
		<category><![CDATA[gem]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=190</guid>
		<description><![CDATA[Update: The problem has been fixed in version 1.0.0.
Recently I have tried to update my gems and I have noticed that things just stopped to a grinding halt when it got to libxml-ruby.  It appears that the 0.9.9 spectacularly barfed all over itself and it stopped other gems from being updated.  Not good! [...]]]></description>
			<content:encoded><![CDATA[<p>Update: The problem has been fixed in version 1.0.0.</p>
<p>Recently I have tried to update my gems and I have noticed that things just stopped to a grinding halt when it got to libxml-ruby.  It appears that the 0.9.9 spectacularly barfed all over itself and it stopped other gems from being updated.  Not good!  </p>
<p>I started Googling for some answers but since the release has only 2 days I guess not that many people have run into it just yet.</p>
<p>I have found a repo with a patch: </p>
<p><a href="http://github.com/tadman/libxml-ruby/tree/master">http://github.com/tadman/libxml-ruby/tree/master<br />
</a><br />
If you not paranoid you may do:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p190code16'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19016"><td class="code" id="p190code16"><pre class="sh" style="font-family:monospace;">$ git clone git://github.com/tadman/libxml-ruby.git 
$ cd libxml-ruby
$ ruby setup.rb
$ rake gem
$ sudo gem install admin/pkg/libxml-ruby-0.9.9.gem</pre></td></tr></table></div>

<p>If you are paranoid then you would go to the install directory where the original gem broke:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p190code17'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19017"><td class="code" id="p190code17"><pre class="sh" style="font-family:monospace;">$ cd /Library/Ruby/Gems/1.8/gems/libxml-ruby-0.9.9
$ cd ext/libxml</pre></td></tr></table></div>

<p><strong>Edit:</strong></p>
<p>ruby_xml_html_parser_context.c<br />
ruby_xml_parser_context.c<br />
by inserting &#8220;extern&#8221; before &#8220;ID IO_ATTR;&#8221; statement.</p>
<p>After these files are updated</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p190code18'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19018"><td class="code" id="p190code18"><pre class="sh" style="font-family:monospace;">$ cd ../..
$ ruby setup.rb
$ rake gem
$ sudo gem install admin/pkg/libxml-ruby-0.9.9.gem</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/190/fixing-libxml-ruby-099-on-leopard-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone screenshot processing &#8211; part 2</title>
		<link>http://www.furmanek.net/93/iphone-screenshot-processing-part-2/</link>
		<comments>http://www.furmanek.net/93/iphone-screenshot-processing-part-2/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 04:37:22 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[screen shots processing]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=93</guid>
		<description><![CDATA[Today I was working on automating of preparation of iPhone screen shots for usage on the website.  The new eideticsoftware.com website design requires for the images to have drop shadows so instead processing everything in Adobe&#174; Photoshop&#174; I have decided it would be much nicer to just automate the process with rmagick.  
If [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was working on automating of preparation of iPhone screen shots for usage on the website.  The new <a href="http://eideticsoftware.com">eideticsoftware.com</a> website design requires for the images to have drop shadows so instead processing everything in Adobe&reg; Photoshop&reg; I have decided it would be much nicer to just automate the process with rmagick.  </p>
<p>If you are impatient and just want the script jump to the bottom of the post and download image_processor.rb but if you want to know how it works then read on.</p>
<p>This script scales the images for the post.<br/><br />
<img src="http://www.furmanek.net/wp-content/uploads/2009/01/example_scaled.png" alt="example_scaled" title="example_scaled" width="160" height="240" class="alignleft size-full wp-image-103" /><br />
First we take the original image and scale it by 50% &#8211; </p>
<pre>source = original.scale(0.5)</pre>
<p><br/><br/><br/><br/><br/><br/><br/><br/><br/><br />
<img src="http://www.furmanek.net/wp-content/uploads/2009/01/example_scaled_stripped.png" alt="example_scaled_stripped" title="example_scaled_stripped" width="160" height="230" class="alignleft size-full wp-image-104" /><br />
Next we strip out the status bar with crop method:</p>
<pre>source = source.crop(0, 10, 160, 240)</pre>
<p><br/><br/><br/><br/><br/><br/><br/><br/><br/><br />
<img src="http://www.furmanek.net/wp-content/uploads/2009/01/example_scaled_stripped_canvas_with_shadow.png" alt="example_scaled_stripped_canvas_with_shadow" title="example_scaled_stripped_canvas_with_shadow" width="170" height="240" class="alignleft size-full wp-image-106" /><br />
We create a transparent canvas that is 10px wider and 10px longer and another identical canvas that we are going to use for the shadow.  On the image_shadow canvas we draw a rectangle with the same dimensions as the original image.  In the source file the rectangle is created by the &#8220;drop_shadow_rectangle&#8221; function.</p>
<p>We use the image_shadow canvas to create two shadows, first is the actual shadow, the second we use as a mask to soften the shadow itself.</p>
<p>We apply the first shadow to the original canvas with &#8220;OverCompositeOp&#8221; option and then we apply the mask on top of that with &#8220;CopyOpacityCompositeOp&#8221; option.<br />
<br/><br />
<img src="http://www.furmanek.net/wp-content/uploads/2009/01/example_scaled_stripped_canvas_with_image.png" alt="example_scaled_stripped_canvas_with_image" title="example_scaled_stripped_canvas_with_image" width="170" height="240" class="alignleft size-full wp-image-105" /><br />
We apply the scaled and cropped image on top of the shadow and draw a white border.  The white border is only necessary when the screen shot is dark to distinguish the shadow from the image.  </p>
<p>Finally we write the image to a file with &#8220;canvas.write&#8221; method.<br />
<br/><br/><br/><br/><br/><br/><br/></p>
<h2>Source Code</h2>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p93code20'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p9320"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
</pre></td><td class="code" id="p93code20"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rmagick'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">include</span> Magick
&nbsp;
img_filename = <span style="color:#996600;">&quot;example.png&quot;</span>
&nbsp;
&nbsp;
<span style="color:#008000; font-style:italic;"># Helper function to create new name</span>
<span style="color:#9966CC; font-weight:bold;">def</span> new_name<span style="color:#006600; font-weight:bold;">&#40;</span>img_filename, modifier = <span style="color:#996600;">&quot;_shadow&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  chunks = img_filename.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  chunks<span style="color:#006600; font-weight:bold;">&#91;</span>0..<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;.&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> modifier <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;.#{chunks[-1]}&quot;</span>  
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Creates drop show rectangle</span>
<span style="color:#9966CC; font-weight:bold;">def</span> drop_shadow_rectangle<span style="color:#006600; font-weight:bold;">&#40;</span>x,y,width,height<span style="color:#006600; font-weight:bold;">&#41;</span>
  gc = Draw.<span style="color:#9900CC;">new</span>
  gc.<span style="color:#9900CC;">fill_color</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;black&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  gc.<span style="color:#9900CC;">rectangle</span><span style="color:#006600; font-weight:bold;">&#40;</span>x,y,width,height<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># creates frame draw object</span>
<span style="color:#9966CC; font-weight:bold;">def</span> white_frame<span style="color:#006600; font-weight:bold;">&#40;</span>x,y,width, height<span style="color:#006600; font-weight:bold;">&#41;</span>
  frame = Draw.<span style="color:#9900CC;">new</span>
  frame.<span style="color:#9900CC;">fill_opacity</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>
  frame.<span style="color:#9900CC;">stroke_color</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;white&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  frame.<span style="color:#9900CC;">rectangle</span><span style="color:#006600; font-weight:bold;">&#40;</span>x,y,width,height<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> add_shadow<span style="color:#006600; font-weight:bold;">&#40;</span>img_filename<span style="color:#006600; font-weight:bold;">&#41;</span>  
  original = ImageList.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>img_filename<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  source = original.<span style="color:#9900CC;">scale</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.5</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  source.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_name<span style="color:#006600; font-weight:bold;">&#40;</span>source.<span style="color:#9900CC;">filename</span>, <span style="color:#996600;">&quot;_scaled&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  source = source.<span style="color:#9900CC;">crop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span>, <span style="color:#006666;">10</span>, <span style="color:#006666;">160</span>, <span style="color:#006666;">240</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  canvas = Image.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>source.<span style="color:#9900CC;">columns</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#006666;">10</span>, source.<span style="color:#9900CC;">rows</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">background_color</span> = <span style="color:#996600;">&quot;transparent&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Generates intermediate images</span>
  <span style="color:#008000; font-style:italic;">#source.write(new_name(source.filename, &quot;_stripped&quot;))</span>
  <span style="color:#008000; font-style:italic;">#canvas.write(new_name(source.filename, &quot;_raw_canvas&quot;))</span>
&nbsp;
  image_shadow = Image.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>canvas.<span style="color:#9900CC;">columns</span>, canvas.<span style="color:#9900CC;">rows</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">background_color</span> = <span style="color:#996600;">&quot;transparent&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  drop_shadow_rectangle<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span>, <span style="color:#006666;">0</span>, source.<span style="color:#9900CC;">columns</span>, source.<span style="color:#9900CC;">rows</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">draw</span><span style="color:#006600; font-weight:bold;">&#40;</span>image_shadow<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  blur = <span style="color:#006666;">1</span>
  x, y = <span style="color:#006666;">1</span>, <span style="color:#006666;">1</span>
&nbsp;
  image_shadow = image_shadow.<span style="color:#9900CC;">shadow</span><span style="color:#006600; font-weight:bold;">&#40;</span>x, y, blur, <span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  shadow_mask = image_shadow.<span style="color:#9900CC;">shadow</span><span style="color:#006600; font-weight:bold;">&#40;</span>x, y, blur, <span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Place the shadow</span>
  canvas.<span style="color:#9900CC;">composite</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>image_shadow, <span style="color:#006666;">0</span>, <span style="color:#006666;">0</span>, OverCompositeOp<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Place the mask to soften the shadow</span>
  canvas.<span style="color:#9900CC;">composite</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>shadow_mask, <span style="color:#006666;">0</span>, <span style="color:#006666;">0</span>, CopyOpacityCompositeOp<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Intermediate image  </span>
  <span style="color:#008000; font-style:italic;"># canvas.write(new_name(source.filename, &quot;_canvas_with_shadow&quot;))</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Now place the image on the canvas</span>
  canvas.<span style="color:#9900CC;">composite</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>source, <span style="color:#006666;">1</span>, <span style="color:#006666;">1</span>, OverCompositeOp<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># And draw the white border on top of the image</span>
  white_frame<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span>, <span style="color:#006666;">0</span>, source.<span style="color:#9900CC;">columns</span>, source.<span style="color:#9900CC;">rows</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">draw</span> canvas
&nbsp;
  <span style="color:#008000; font-style:italic;"># save the final image</span>
  canvas.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_name<span style="color:#006600; font-weight:bold;">&#40;</span>source.<span style="color:#9900CC;">filename</span>, <span style="color:#996600;">&quot;_canvas_with_image&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
add_shadow<span style="color:#006600; font-weight:bold;">&#40;</span>img_filename<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<hr/>
Processor: <a href='http://www.furmanek.net/wp-content/uploads/2009/01/image_processor.rb'>image_processor.rb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/93/iphone-screenshot-processing-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automating iPhone screenshots processing with rmagick</title>
		<link>http://www.furmanek.net/61/automating-iphone-screenshots-processing-with-rmagick/</link>
		<comments>http://www.furmanek.net/61/automating-iphone-screenshots-processing-with-rmagick/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 20:06:56 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=61</guid>
		<description><![CDATA[In programming repetition is evil.  No one should do the same task more than once so I was not to excited about doing screenshots for FitTimer.
Taking the screenshots is not a big deal.

On your device Hold the sleep/wake button and click the &#8220;home&#8221; button.
Connect the device to your mac and import your images to [...]]]></description>
			<content:encoded><![CDATA[<p>In programming repetition is evil.  No one should do the same task more than once so I was not to excited about doing screenshots for <a href="http://www.eideticsoftware.com/fittimer">FitTimer</a>.</p>
<p>Taking the screenshots is not a big deal.</p>
<ol>
<li>On your device Hold the sleep/wake button and click the &#8220;home&#8221; button.</li>
<li>Connect the device to your mac and import your images to iPhoto</li>
<li>Select the imported images in iPhoto and drag them to a desired folder.</li>
</ol>
<p>Unfortunately you can&#8217;t use these raw images.  Apple requires you convert them to JPEG format and recommends you crop out the iPhone status bar.  This task for many people mean opening each screenshot in Photoshop, cropping the image to &#8220;320 x 460&#8243; and saving it as a JPG. </p>
<p>One may say: &#8220;It&#8217;s only a few images&#8221;  but if you often update to your applications UI updating screenshots becomes one more thing you have to do.  Additionally, if your website requires screenshots of different size or thumbnails, your screenshot updating task will take more and more time.</p>
<p>There is a better way of dealing with screenshots.  You can automate the whole process with a few simple lines of ruby code using <a href="http://rmagick.rubyforge.org">rmagick gem</a>.</p>
<p>To use rmagick you will need to install the gem.  You can find a link to installation instructions at the end of the post in the references section.</p>
<p>After you have rmagick successfully installed you can start processing your images.</p>
<p>I keep all my marketing material in &lt;project_root&gt;/marketing folder to keep it together in a single source code repository (git), however you are welcome to keep it anywhere you like.</p>
<p>To use my script you will need to prepare a few things:</p>
<ol>
<li>Create your working folder (in my project &#8211; &#8220;marketing&#8221;)</li>
<li>In the working folder create three folders &#8220;raw_images&#8221;, &#8220;itunesconnect&#8221; and &#8220;web_images&#8221;</li>
<li>Copy the script to the working folder</li>
<li>Copy your raw &#8216;png&#8217; screenshots to raw_images</li>
<li>If you are copying the files from iPhoto you may want to rename them to something human readable like &#8220;main_view.png&#8221;</li>
<li>Open your favorite terminal app and run the script</li>
</ol>
<p><b>The script does 4 things.</b></p>
<ol>
<li>Crops the status bar and saves screenshots for itunesconnect in the itunesconnect folder</li>
<li>Saves the cropped screenshots in the web_images folder</li>
<li>Reduces the image by 50% and saves it in web_images folder with new name &lt;filename&gt;_50.jpg</li>
<li>Creates a thumbnail by reducing the original image to 25% of it&#8217;s original size and saves it in web_images folder with new name following schema &lt;filename&gt;_thumb.jpg
</li>
</ol>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p61code22'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6122"><td class="code" id="p61code22"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rmagick'</span>
&nbsp;
<span style="color:#CC00FF; font-weight:bold;">Dir</span>.<span style="color:#9900CC;">glob</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'raw_images/*'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>original<span style="color:#006600; font-weight:bold;">|</span>
  path = original.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  name = path<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:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'.'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">first</span>
&nbsp;
  itunes_img_path = <span style="color:#996600;">&quot;itunesconnect/#{name}.jpg&quot;</span>
&nbsp;
  web_img_path = <span style="color:#996600;">&quot;web_images/#{name}.jpg&quot;</span>
  web_img_scaled_path = <span style="color:#996600;">&quot;web_images/#{name}_50.jpg&quot;</span>
  web_img_thumb_path = <span style="color:#996600;">&quot;web_images/#{name}_thumb.jpg&quot;</span>
&nbsp;
  original = <span style="color:#6666ff; font-weight:bold;">Magick::ImageList</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>original<span style="color:#006600; font-weight:bold;">&#41;</span>
  cropped = original.<span style="color:#9900CC;">crop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span>,<span style="color:#006666;">20</span>, <span style="color:#006666;">320</span>, <span style="color:#006666;">460</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  cropped.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>itunes_img_path<span style="color:#006600; font-weight:bold;">&#41;</span>
  cropped.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>web_img_path<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  scaled = cropped.<span style="color:#9900CC;">scale</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.5</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  scaled.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>web_img_scaled_path<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  thumb = cropped.<span style="color:#9900CC;">scale</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0.25</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  scaled.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>web_img_thumb_path<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<hr/>
<p style="font-weight: bold;">References</p>
<p><a href="http://rmagick.rubyforge.org/install-faq.html#osx">Rmagick installation instructions</a><br />
<em>iTunes Connect Developer Guide</em> can be found on the itunesconnect website in Manage Your Applications Section.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/61/automating-iphone-screenshots-processing-with-rmagick/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Rails, tests and code coverage</title>
		<link>http://www.furmanek.net/48/rails-testing-code-coverage/</link>
		<comments>http://www.furmanek.net/48/rails-testing-code-coverage/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 16:50:36 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[rcov]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=48</guid>
		<description><![CDATA[&#8220;If it&#8217;s not tested assume it&#8217;s broken.&#8221;  This is one of the mantras in my company.  Sometimes it&#8217;s easier said then done.  If I always had to test everything I would be doing nothing but testing.  So I employ different techniques to keep me programming and the computer to test the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;If it&#8217;s not tested assume it&#8217;s broken.&#8221;  This is one of the mantras in my company.  Sometimes it&#8217;s easier said then done.  If I always had to test everything I would be doing nothing but testing.  So I employ different techniques to keep me programming and the computer to test the code I write.</p>
<p>One of the nice things about Rails is that you have a whole array of tools to automate testing and at least one very nice tool to let you know what&#8217;s tested and what&#8217;s not.  Yes I am talking about Rcov.</p>
<p>Rcov has been &#8220;the bee&#8217;s knees&#8221; for code coverage awareness.  Recently I have noticed Rcov has been doing more work then expected.  When I ran the rcov command in a rails project it tested everything.  I mean everything, including gems installed on the system.</p>
<p>Since everything is just a bit too much for my project I started looking for a way to limit the output. It appears I had to use -x option to stop the code coverage tool from traversing the gems.  Here is the whole task:</p>
<pre>
desc 'Measures test coverage using rcov'
Rcov::RcovTask.new(:rcov) do |rcov|
  rcov.pattern    = "test/**/*_test.rb"
  rcov.rcov_opts  = [
    "-x 'gems/.*,rubygems/.*,rcov/.*'",
    "-T",
    "--rails" ]
  rcov.output_dir = "rcov/unified"
end
</pre>
<p>I hope this helps you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/48/rails-testing-code-coverage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gaussian Rounding in Ruby</title>
		<link>http://www.furmanek.net/37/gaussian-rounding-in-ruby/</link>
		<comments>http://www.furmanek.net/37/gaussian-rounding-in-ruby/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 23:09:59 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[banker's rounding]]></category>
		<category><![CDATA[gaussian rounding]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=37</guid>
		<description><![CDATA[While working on a research tool for my work I have noticed that my ruby solution rounds differently then the original c# .net code.  It was not in every but about 10 percent of my tests failed due to the different rounding schemes.
Ruby uses the Symmetric Arithmetic Rounding while C# .net uses the Gaussian [...]]]></description>
			<content:encoded><![CDATA[<p>While working on a research tool for my work I have noticed that my ruby solution rounds differently then the original c# .net code.  It was not in every but about 10 percent of my tests failed due to the different rounding schemes.</p>
<p>Ruby uses the <em>Symmetric Arithmetic Rounding</em> while C# .net uses the <em>Gaussian rounding</em> otherwise known as the <em>Banker&#8217;s routing</em>.</p>
<p>I have looked for a quick solution for Ruby but Google did not return a result I could immediately use.  I have found a javascript solution which I translated to Ruby.</p>
<p>Additionally I have added a &#8220;decimal&#8221; parameter to specify the precision of rounding.</p>
<p>Here is the code:</p>
<pre>class Numeric
  def _round(val)
    sign = val &lt; 0 ? -1 : 1
    return (val.abs.round * sign) if (val.abs - val.abs.floor) != 0.5
    return (val.abs.ceil  * sign) if val.abs.floor % 2 == 1
    return (val.abs.floor * sign)
  end

  def gaussian_round(decimals = 0)
    return (_round(self * (10**decimals))/((10**decimals).to_f))
  end
end</pre>
<hr />Ref: <a href="http://snippets.dzone.com/posts/show/1305">Javascript Gaussian Rounding Example</a><br />
Ref: <a href="http://en.wikipedia.org/wiki/Rounding">Wikipedia article on rounding</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/37/gaussian-rounding-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MacRuby to set Xcode project version from git</title>
		<link>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/</link>
		<comments>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 08:29:01 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[macruby]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=36</guid>
		<description><![CDATA[I have been looking into automating some of my development tasks in Cocoa/Xcode environment.  For the longest time I was using Subversion which would integrate quite well with Xcode. Recently, however, I have been exploring other version control systems.  Especially git.  Since it&#8217;s a much newer (D)VCS it does not have as much integration into [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking into automating some of my development tasks in Cocoa/Xcode environment.  For the longest time I was using Subversion which would integrate quite well with Xcode. Recently, however, I have been exploring other version control systems.  Especially git.  Since it&#8217;s a much newer (D)VCS it does not have as much integration into systems as subversion.</p>
<p>I have managed to find some interesting solutions to include Git version number in Xcode project however the only actual solutions I have found are written in languages I don&#8217;t care for anymore.  Yes I can program in them but why would I want to.</p>
<p>So here is a quick solution written in MacRuby.</p>
<pre style="font-size: 0.9em">#!/usr/local/bin/macruby

git_output = `git show --abbrev-commit`
commit_version = git_output.split("\n").grep(/^commit/).first
version = commit_version.gsub(/^commit\s+(.*)\.{3}/, "\\1")
if version
  list = NSMutableDictionary.dictionaryWithContentsOfFile("Info.plist")
  list["CFBundleVersion"] = version
  list.writeToFile('Info.plist', :atomically =&gt; true)
end</pre>
<p>In my final solution I intend to have an output in following format:</p>
<pre>major.minor.revision (build)</pre>
<p>where the &#8220;build&#8221; is going to correspond with the git commit version<br />
and the other parts will reflect the marketing version numbers.</p>
<hr/>
Ref: <a title="Shiny Frog Article on Integrating git and Xcode" href="http://www.shinyfrog.net/en/sync-svn-version-and-cfbundleversion-in-xcode">Shiny Frog Article</a> Python solution<br />
Ref: <a href="http://www.cimgf.com/2008/04/13/git-and-xcode-a-git-build-number-script/">Cocoa is my Girlfriend Article</a> Perl solution</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Contributing to ActiveMerchant</title>
		<link>http://www.furmanek.net/31/contributing-to-activemerchant/</link>
		<comments>http://www.furmanek.net/31/contributing-to-activemerchant/#comments</comments>
		<pubDate>Thu, 15 May 2008 02:53:37 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Ecommerce]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[active_merchant]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[paypal]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=31</guid>
		<description><![CDATA[I have always been a fan of open source and wanted to contribute some code to a project or two.  Somehow, I never found a project I would really enjoy and could directly benefit from as well.  I was simply looking for an project that would scratch my itch.
Finally while working on an [...]]]></description>
			<content:encoded><![CDATA[<p>I have always been a fan of open source and wanted to contribute some code to a project or two.  Somehow, I never found a project I would really enjoy and could directly benefit from as well.  I was simply looking for an project that would scratch my itch.<br />
Finally while working on an e-commerce system for my company I have decided to use active_merchant to connect to PayPal.  The original implementation used by active_merchant was targeting and older xml based gateway and I have decided to re-implement the gateway using more recent NVP (name-value pair) interface.  Hopefully this will allow for more modern features of the PayPal service.<br />
A few days ago Cody has committed my patch and it is currently part of the active_merchant main code.</p>
<p>I have also created git repository where I can add more functionality as needed.<br />
Here is the link for the interested:<br />
<code><br />
git clone http://git.furmanek.net/active_merchant.git<br />
</code><br />
Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/31/contributing-to-activemerchant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby acrobatics aka. metaprogramming</title>
		<link>http://www.furmanek.net/29/ruby-acrobatics-aka-metaprogramming/</link>
		<comments>http://www.furmanek.net/29/ruby-acrobatics-aka-metaprogramming/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 18:09:16 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Learning]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/29/ruby-acrobatics-aka-metaprogramming/</guid>
		<description><![CDATA[Dave Thomas shows how to make ruby into a beautiful meta-programming language.  So if you want to know how things like has_many in Ruby on Rails works, here is your chance.
http://www.infoq.com/presentations/metaprogramming-ruby
]]></description>
			<content:encoded><![CDATA[<p>Dave Thomas shows how to make ruby into a beautiful meta-programming language.  So if you want to know how things like has_many in Ruby on Rails works, here is your chance.</p>
<p><a href="http://www.infoq.com/presentations/metaprogramming-ruby">http://www.infoq.com/presentations/metaprogramming-ruby</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/29/ruby-acrobatics-aka-metaprogramming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
