<?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</title>
	<atom:link href="http://www.furmanek.net/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>Ruby Metaprogramming quiz #1</title>
		<link>http://www.furmanek.net/250/ruby-metaprogramming-quiz-1/</link>
		<comments>http://www.furmanek.net/250/ruby-metaprogramming-quiz-1/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 21:36:27 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=250</guid>
		<description><![CDATA[Implement only MyHelper module and make the tests pass. Good luck.

View Code RUBYrequire 'test/unit'
&#160;
module MyHelper
&#160;
end
&#160;
class Foo
  BAR = 1
  NORM = 3
  include MyHelper
end
&#160;
class Baz
  BAR = 2
  NORM = 4
  include MyHelper
end
&#160;
class MyTest &#60; Test::Unit::TestCase
  def test_Foo
    foo = Foo.new
    assert_equal&#40;1, [...]]]></description>
			<content:encoded><![CDATA[<p>Implement only MyHelper module and make the tests pass. Good luck.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code2'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2502"><td class="code" id="p250code2"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'test/unit'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> MyHelper
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Foo
  BAR = <span style="color:#006666;">1</span>
  NORM = <span style="color:#006666;">3</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> MyHelper
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Baz
  BAR = <span style="color:#006666;">2</span>
  NORM = <span style="color:#006666;">4</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> MyHelper
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> MyTest <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">Test::Unit::TestCase</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> test_Foo
    foo = Foo.<span style="color:#9900CC;">new</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>, foo.<span style="color:#9900CC;">score</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>, Foo.<span style="color:#9900CC;">bar</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>, foo.<span style="color:#9900CC;">bar</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">3</span>, Foo.<span style="color:#9900CC;">norm</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">3</span>, foo.<span style="color:#9900CC;">norm</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> test_Baz
    baz = Baz.<span style="color:#9900CC;">new</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, baz.<span style="color:#9900CC;">score</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, Baz.<span style="color:#9900CC;">bar</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span>, baz.<span style="color:#9900CC;">bar</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">4</span>, Baz.<span style="color:#9900CC;">norm</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    assert_equal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">4</span>, baz.<span style="color:#9900CC;">norm</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>

]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/250/ruby-metaprogramming-quiz-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tidy incantations</title>
		<link>http://www.furmanek.net/238/tidy-incantations/</link>
		<comments>http://www.furmanek.net/238/tidy-incantations/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 15:51:01 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=238</guid>
		<description><![CDATA[I have been using tidy on and off for a few years now and it&#8217;s been a great tool for finding problems with the html markup.  I always wanted to use it for reformatting (cleaning up) output.  Especially wanted it for reformatting xml output of some web services that have a nasty habit [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using tidy on and off for a few years now and it&#8217;s been a great tool for finding problems with the html markup.  I always wanted to use it for reformatting (cleaning up) output.  Especially wanted it for reformatting xml output of some web services that have a nasty habit of putting the whole content on a single line.</p>
<p>But now I have found the right incantation:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p238code4'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2384"><td class="code" id="p238code4"><pre class="sh" style="font-family:monospace;">&nbsp;
$ cat source_file.xml | tidy -q -xml -i -w 300 &gt; reformatted_file.xml</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/238/tidy-incantations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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('p231code8'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2318"><td class="code" id="p231code8"><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('p231code9'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2319"><td class="code" id="p231code9"><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('p231code10'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p23110"><td class="code" id="p231code10"><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('p206code14'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20614"><td class="code" id="p206code14"><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('p206code15'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20615"><td class="code" id="p206code15"><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('p206code16'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p20616"><td class="code" id="p206code16"><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('p190code20'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19020"><td class="code" id="p190code20"><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('p190code21'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19021"><td class="code" id="p190code21"><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('p190code22'); return false;">View Code</a> SH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p19022"><td class="code" id="p190code22"><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>Few words on cracking iPhone applications</title>
		<link>http://www.furmanek.net/154/few-words-on-cracking-iphone-applicatons/</link>
		<comments>http://www.furmanek.net/154/few-words-on-cracking-iphone-applicatons/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 02:02:37 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[cracking]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=154</guid>
		<description><![CDATA[Few days ago I was reading about Craculous being released as an open source application.  Since Craculous is an iPhone application cracking tool and I have a few apps in the AppStore I have a few points to make to all those people who are considering using the tool.
I know a few developers who [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago I was reading about Craculous being released as an open source application.  Since Craculous is an iPhone application cracking tool and I have a few apps in the AppStore I have a few points to make to all those people who are considering using the tool.</p>
<p>I know a few developers who write apps for the AppStore.  They aren&#8217;t millionaires. Some of them barely make enough money to cover their bills. Others, work second jobs because the income from the AppStore is just not enough to pay for their necessities.</p>
<p>Yes, there are few people who were lucky enough to make good money but, if you think for a second, how many of those have you heard about?  3, 5, 20?  And how many apps are in the AppStore? The last number was around 18&#8242;000.  So who do you think you are stealing from?  You may as well go to the poorest part of town you live in, find a woman who is working 2 jobs to support her and two children and then rob her.  That&#8217;s pretty much an real life equivalent of you cracking an app from the AppStore.</p>
<p>Now that you know how it feels from the other side of the AppStore let me tell you a little bit of what happens when the third party developers can&#8217;t make enough money.  People like I and my friends have two choices.</p>
<p>First, is just to say &#8220;fuck it!&#8221; and do something else where we can make some money.  The second option is to develop ad supported apps. Both of these options aren&#8217;t very good for you.</p>
<p>See, unlike artists (musicians, actors, producers) we developers can do other things. We can work for companies and write business apps for them.  We can create subscription web apps for which you will shell out way more money then a simple app on your phone.  We can work for big companies Apple, Adobe, Microsoft and create apps that are locked<br />
so tight that you will need a blood sample to authenticate yourself as a user. It&#8217;s not the most attractive work but it does pay the bills.  We can do that but then you will not get the cool apps on your phone.</p>
<p>Honestly, most of the indy developers would rather create apps for you.  Find out what you need and help you out with the solution.  All we ask is for you to help us pay our bills.</p>
<p>Now the second option.  Adware!  Sounds almost like a curse word and it really is. When someone develops adware they are no longer working for you.  The are working for the people who peddle their products through the software.  You will never have as good experience with adware as with software that is developed for you.  You loose the control of what features are added to the program because you aren&#8217;t paying for it.  This is why most adware software are pieces of garbage.</p>
<p>Take for example the shows you get on TV stations supported by commercials and the ones that are not.  Most of the shows on commercials supported channels are designed to sell you stuff.  The plot is created to build the suspense up and stop for a commercial break.  They will always leave you hanging and show you the stuff  they want to sell to you.</p>
<p>On the other hand when you watch shows from stations which do not have to rely on sponsors you will get the whole story.  They don&#8217;t have to worry about placing the ads and creating the shows with ads in mind.  They just want to give YOU the best experience.  The best show.</p>
<p>Similar things you will find in software.  Either you pay for the best experience there is or you are going to get junk that sells you other junk.  Your choice. </p>
<p>The last thing I would like to bring to your attention is the word &#8220;honor.&#8221;  Where is their honor?  I realize that some people might have forgotten the word.  Others, may be confused by the myriad of definitions. </p>
<p>I am talking about this one:</p>
<p><strong>honor</strong><br />
  <em>- noun</em><br />
    &#8220;honesty, fairness, or integrity in one&#8217;s beliefs and actions&#8221;</p>
<p>Is cracking $0.99 app worth giving up your integrity?</p>
<p>Please comment and let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/154/few-words-on-cracking-iphone-applicatons/feed/</wfw:commentRss>
		<slash:comments>2</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('p93code24'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p9324"><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="p93code24"><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>Logo artwork</title>
		<link>http://www.furmanek.net/83/logo-artwork/</link>
		<comments>http://www.furmanek.net/83/logo-artwork/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 17:31:45 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Artwork]]></category>
		<category><![CDATA[logo]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=83</guid>
		<description><![CDATA[There are days when your work is appreciated and rejected at the same time.  Today is one of those days.  I was told by my boss that she liked the logo but we have to keep everything branded so we will not use it.  In my opinion one of the less creative [...]]]></description>
			<content:encoded><![CDATA[<p>There are days when your work is appreciated and rejected at the same time.  Today is one of those days.  I was told by my boss that she liked the logo but we have to keep everything branded so we will not use it.  In my opinion one of the less creative marketing drones was deeply involved in the decision making.  Oh well, since they did not want it I figured some of you may enjoy it.</p>
<p><img src="http://www.furmanek.net/wp-content/uploads/2009/01/tti_university_towers.jpg" alt="tti_university_towers" title="tti_university_towers" width="289" height="155" class="alignleft size-full wp-image-84" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/83/logo-artwork/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('p61code26'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p6126"><td class="code" id="p61code26"><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>iPhone SDK 2.2 &#8211; CodeSign Error</title>
		<link>http://www.furmanek.net/54/iphone-sdk-22-codesign-error/</link>
		<comments>http://www.furmanek.net/54/iphone-sdk-22-codesign-error/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 02:25:54 +0000</pubDate>
		<dc:creator>Gregory Furmanek</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CodeSign Error]]></category>

		<guid isPermaLink="false">http://www.furmanek.net/?p=54</guid>
		<description><![CDATA[My weekend work plans were simple.

Update iphone sdk to 2.2
Write some more functionality for my FitTimer app.

Unfortunately the second part of my plan was never started because updating the SDK took most of my Saturday and Sunday.  
The official update was not very difficult but after I have installed SDK 2.2 and updated my [...]]]></description>
			<content:encoded><![CDATA[<p>My weekend work plans were simple.</p>
<ol>
<li>Update iphone sdk to 2.2</li>
<li>Write some more functionality for my <a href="http://www.eideticsoftware.com/fittimer">FitTimer</a> app.</li>
</ol>
<p>Unfortunately the second part of my plan was never started because updating the SDK took most of my Saturday and Sunday.  </p>
<p>The official update was not very difficult but after I have installed SDK 2.2 and updated my test devices I no longer was able to install my apps.  I have gotten this nasty CodeSign error:</p>
<pre>
"CodeSign error: a valid provisioning profile is required for product
type 'Application' in SDK 'Device - iPhone OS 2.2"
</pre>
<p>I have done everything from adjusting project settings to regenerating certificates and provisioning profiles.  I have not gotten much traction with any of my efforts.  The solution came after I have found a post claiming there is a bug in SDK2.2 that causes for the project files to get corrupted.</p>
<p>So I have pulled out my trusty (MacVim) editor and opened up the: ProjectName.xcodeproj/project.pbxproj file and started snooping around.  </p>
<p>I have found that I had multiple Build Configuration sections and my  </p>
<pre>
"PROVISIONING_PROFILE[sdk=iphoneos*]" =
   "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
</pre>
<p>entry had a different number then my installed provisioning profiles.</p>
<p>So here are the steps to get it working again:</p>
<ol>
<li>SAVE YOUR WORK JUST IN CASE THIS SOLUTION DOES NOT WORK FOR YOUR PROBLEM</li>
<li>Save your old project file.</li>
<li>Go to ~/Library/MobileDevices/Provisioning Profiles</li>
<li>Figure out which profile is the one relating to your project.  Sometimes the profiles are saved with UUID as the file name so you may have to run grep with your project&#8217;s name to figure out which one it is.
</li>
<pre>
$ grep myAppName *
Binary file xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision matches
</pre>
<li>Copy the xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx number.</li>
<li>Save your current work and close XCode</li>
<li>Go to <code>yourProjectDirectory/ProjectName.xcodeproj/</code> and using a text editor (MacVim for me) open the <code>project.pbxproj</code> file</li>
<li>Find all <code>"PROVISIONING_PROFILE[sdk=iphoneos*]"</code> entries and replace the assignment value with the number you have copied in step 4.</li>
<li>Save the project.pbxproj file</li>
<li>Reopen Xcode and recompile your projects.  The CodeSign error should be gone.</li>
</ol>
<p>I hope this helps and saves you a lot of time.</p>
<p>Good luck and if you have some time please check out my app: <a href="http://www.eideticsoftware.com/fittimer">FitTimer</a></p>
<p><strong>Updated: [important]</strong><br />
Please read Big3&#8217;s post <a href="https://devforums.apple.com/message/15497">https://devforums.apple.com/message/15497</a> and file bug report with apple.  Send them your saved project file so they can figure out why XCode projects are getting corrupted. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.furmanek.net/54/iphone-sdk-22-codesign-error/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>
