<?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/"
	>

<channel>
	<title>Two Minute Spates</title>
	<atom:link href="http://blog.jonathanrwallace.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jonathanrwallace.com</link>
	<description>Ruby, rails, iPhone, git, entrepreneurship, what else is the hot newness?</description>
	<pubDate>Sat, 13 Feb 2010 21:00:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Roseanne - in browser comparison between two&#160;files</title>
		<link>http://blog.jonathanrwallace.com/2010/02/roseanne-in-browser-comparison-between-two-files/</link>
		<comments>http://blog.jonathanrwallace.com/2010/02/roseanne-in-browser-comparison-between-two-files/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 21:00:29 +0000</pubDate>
		<dc:creator>Jonathan Wallace</dc:creator>
		
		<category><![CDATA[couchdb]]></category>

		<category><![CDATA[heroku]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[diff]]></category>

		<guid isPermaLink="false">http://blog.jonathanrwallace.com/?p=46</guid>
		<description><![CDATA[ I telecommute 100% of the time at my current company.  We make use of git and skype to communicate.  If we need to share a bunch of code, we use remote branches (grb makes this super easy).  
But when its only one file, the overhead is too much.  
&#8220;Wait, wait. [...]]]></description>
			<content:encoded><![CDATA[<p> I telecommute 100% of the time at my current <a href="http://intellum.com">company</a>.  We make use of git and skype to communicate.  If we need to share a bunch of code, we use remote branches (<a href="http://grb.rubyforge.org/">grb</a> makes this super easy).  </p>
<p>But when its only one file, the overhead is too much.  </p>
<blockquote><p>&#8220;Wait, wait.  Let me create a remote branch - now I&#8217;m committing, now I&#8217;m pushing to the origin - there you go!  Go ahead and pull.&#8221;</p></blockquote>
<p>  This can really break up the work flow.  </p>
<p>To highlight what&#8217;s changed in the file and share it with my coworker, is this too much to ask?  Now, of course, we could just pipe the diff into a file but then how do we transfer it?  Use email?  Ugh.</p>
<p>Definitely not.</p>
<p>Instead, let&#8217;s use a nice web service and paste two files.  (On mac os x, check out <code>cat some_file_name | pbcopy</code>.  very nifty).  With one url, we can both insure we&#8217;re looking at the exact same diff.</p>
<p>Enter <a href="http://github.com/wallace/roseanne">roseanne</a>.  If you&#8217;re a solo user, roseanne allows you to run a pure javascript diff (thanks to <a href="http://snowtide.com/jsdifflib">Chas Emrick</a>.  I &#8220;ported&#8221; it to use prototype).  Or, you can submit the diff to the server.</p>
<p>Since Chas based his js diff lib off of Python&#8217;s sequence matcher and Test::Unit::Diff::SequenceMatcher is based off the same for the server side, I generate the JSON and store it in a couchdb at <a href="http://cloudant.com/">cloudant</a> to save the view for later and share with others.</p>
<p>The app is hosted at <a href="http://heroku.com/">heroku</a> and is a rails app.  <a href="http://diff.jonathanrwallace.com">Try it</a> yourself.  </p>
<p>Since the app is basically a simple proxy, I&#8217;m thinking of replacing it with a <a href="http://www.sinatrarb.com/">Sinatra</a> app.  Any thoughts?  Is there something I could do to make it better?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonathanrwallace.com/2010/02/roseanne-in-browser-comparison-between-two-files/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updating to Rails&#160;2-3-stable</title>
		<link>http://blog.jonathanrwallace.com/2009/05/updating-to-rails-2-3-stable/</link>
		<comments>http://blog.jonathanrwallace.com/2009/05/updating-to-rails-2-3-stable/#comments</comments>
		<pubDate>Tue, 19 May 2009 14:08:29 +0000</pubDate>
		<dc:creator>Jonathan Wallace</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.jonathanrwallace.com/?p=18</guid>
		<description><![CDATA[Here are the steps I followed to upgrade our flagship product.
Steps I had to take on the git repos:

verify that rake version is 0.8.4 and rubygems is 1.3.1
rm -rf vendor/rails
gem update rails rack
cd vendor &#38;&#38; git clone git://github.com/rails/rails.git
cd rails &#38;&#38; grb track 2-3-stable
git checkout 2-3-stable
rm -rf .git
cd ~/
modify environment.rb to user rails 2.3.2
rake rails:update
git add [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the steps I followed to upgrade <a href="http://intellum.com">our</a> <a href="http://www.rollbook.com">flagship product</a>.</p>
<p>Steps I had to take on the git repos:</p>
<pre>
verify that rake version is 0.8.4 and rubygems is 1.3.1
rm -rf vendor/rails
gem update rails rack
cd vendor &amp;&amp; git clone git://github.com/rails/rails.git
cd rails &amp;&amp; grb track 2-3-stable
git checkout 2-3-stable
rm -rf .git
cd ~/
modify environment.rb to user rails 2.3.2
rake rails:update
git add -A
</pre>
<p>Upgrade issues I ran into:</p>
<pre>
# check plugins/gems that need to be updated
# mocha
5076 rollbook:master+! % rake test:units
rake aborted!
can't activate mocha (= 0.9.4, runtime), already activated mocha-0.9.5
# move "require 'mocha'" from test/test_helper.rb into config/environments/test.rb
# http://gist.github.com/111060 -- solution: remove "require 'ar-extensions" from config/initializers/<file>.rb
# remove all references to Test::Unit http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/f90ecdba834c2ef8/f204e834e5e0303c?lnk=raot in test dir
# replace Test::Unit w/ActiveRecord or ActionController as appropriate
# replace CGI::Session.generate_unique_id w/ActiveSupport::SecureRandom.hex(16)
# updated hoptoad and shoulda
# add xmlsimple to be required
# updated new_relic agent
# install country_select plugin
</pre>
<p>Steps to be take on the production server:</p>
<pre>
# update passenger 2.2.2
# gem update rails rack
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonathanrwallace.com/2009/05/updating-to-rails-2-3-stable/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Monitoring BackgrounDRb workers with&#160;God</title>
		<link>http://blog.jonathanrwallace.com/2008/08/monitoring-backgroundrb-workers-with-god/</link>
		<comments>http://blog.jonathanrwallace.com/2008/08/monitoring-backgroundrb-workers-with-god/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 17:04:00 +0000</pubDate>
		<dc:creator>Jonathan Wallace</dc:creator>
		
		<category><![CDATA[backgroundrb]]></category>

		<category><![CDATA[god]]></category>

		<category><![CDATA[intellum]]></category>

		<category><![CDATA[monitoring]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.jonathanrwallace.com/?p=4</guid>
		<description><![CDATA[Updated 2008/09/24 for latest version of backgroundrb 1.0.4
The other day on our staging server, I noticed that the BackgrounDRb queue worker had died.  As it turned out, the queue worker had died over 3 months ago!!
There was no cause for alarm as the staging server isn&#8217;t critical but this did start me to worrying. [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-style:italic;">Updated 2008/09/24 for latest version of backgroundrb 1.0.4</span></p>
<p>The other day on our staging server, I noticed that the <a href="http://backgroundrb.rubyforge.org/">BackgrounDRb</a> queue worker had died.  As it turned out, the queue worker had died over 3 months ago!!</p>
<p>There was no cause for alarm as the staging server isn&#8217;t critical but this did start me to worrying.  We needed to implement a monitoring solution which not only verified that BackgrounDRb was running but also that particular workers were running.</p>
<p>As we had just implemented <a href="http://god.rubyforge.org/">god</a> monitoring with a custom condition for another issue, its a slam dunk to do the same again.  (Thanks to <a href="http://jnewland.com/">Jesse Newland</a> and his <a href="http://atlrug.org/jnewland/posts/45-God-Process-and-Task-Monitoring-Done-Right-Slides">god tutorial</a> at <a href="http://atlrug.org/">AtlRUG</a>.)</p>
<p>Here&#8217;s the configuration file that got it done for us.</p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#run on command line with 'god -c backgroundrb.god -D' </span>
RAILS_ROOT = <span style="color:#996600;">'/var/www/rails/rollbook/current'</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#load required rails and backgroundrb files</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'/../boot'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'/../environment'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'erb'</span>
<span style="color:#ff6633; font-weight:bold;">$LOAD_PATH</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;#{RAILS_ROOT}/vendor/plugins/backgroundrb/lib/backgroundrb.rb&quot;</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#create custom condition for checking that QueryProcessingWorker is running</span>
MiddleMan = <span style="color:#6666ff; font-weight:bold;">BackgrounDRb::ClusterConnection</span>.<span style="color:#9900CC;">new</span>
<span style="color:#9966CC; font-weight:bold;">module</span> God 
  <span style="color:#9966CC; font-weight:bold;">module</span> Conditions
    <span style="color:#9966CC; font-weight:bold;">class</span> Backgroundrb <span style="color:#006600; font-weight:bold;">&lt;</span> PollCondition
      <span style="color:#9966CC; font-weight:bold;">def</span> initialize; <span style="color:#9966CC; font-weight:bold;">super</span>; <span style="color:#9966CC; font-weight:bold;">end</span> 
      <span style="color:#9966CC; font-weight:bold;">def</span> valid?; <span style="color:#0000FF; font-weight:bold;">true</span>; <span style="color:#9966CC; font-weight:bold;">end</span> 
&nbsp;
      <span style="color:#9966CC; font-weight:bold;">def</span> test
        <span style="color:#9966CC; font-weight:bold;">begin</span>
          queue_worker = MiddleMan.<span style="color:#9900CC;">all_worker_info</span>.<span style="color:#9900CC;">values</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#CC0066; font-weight:bold;">select</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>w<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#ff3333; font-weight:bold;">:queue_processing_worker</span> == w<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:worker</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
          queue_worker.<span style="color:#9900CC;">empty</span>?
        <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#008000; font-style:italic;">#if all_worker_info raises exception, then bdrb isn't running and we were unable to connect</span>
          <span style="color:#0000FF; font-weight:bold;">true</span>
        <span style="color:#9966CC; font-weight:bold;">end</span> 
      <span style="color:#9966CC; font-weight:bold;">end</span> 
    <span style="color:#9966CC; font-weight:bold;">end</span> 
  <span style="color:#9966CC; font-weight:bold;">end</span> 
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
God.<span style="color:#9900CC;">watch</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>w<span style="color:#006600; font-weight:bold;">|</span> 
  w.<span style="color:#9900CC;">name</span>      = <span style="color:#996600;">'backgroundrb'</span>
  w.<span style="color:#9900CC;">interval</span>  = 1.<span style="color:#9900CC;">minute</span>
  w.<span style="color:#9900CC;">restart</span>   = <span style="color:#996600;">&quot;cd #{RAILS_ROOT} &amp;&amp; #{RAILS_ROOT}/script/backgroundrb -e production stop &amp;&amp; #{RAILS_ROOT}/script/backgroundrb -e production start&quot;</span>
  w.<span style="color:#9900CC;">stop</span>      = <span style="color:#996600;">&quot;cd #{RAILS_ROOT} &amp;&amp; #{RAILS_ROOT}/script/backgroundrb -e production stop&quot;</span>
  w.<span style="color:#9900CC;">start</span>     = <span style="color:#996600;">&quot;cd #{RAILS_ROOT} &amp;&amp; #{RAILS_ROOT}/script/backgroundrb -e production start&quot;</span>
  w.<span style="color:#9900CC;">grace</span>     = 1.<span style="color:#9900CC;">minute</span>
  w.<span style="color:#9900CC;">pid_file</span>  = <span style="color:#996600;">&quot;#{RAILS_ROOT}/tmp/pids/backgroundrb_11000.pid&quot;</span>
&nbsp;
  w.<span style="color:#9900CC;">start_if</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>start<span style="color:#006600; font-weight:bold;">|</span>
    start.<span style="color:#9900CC;">condition</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:process_running</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span> 
      c.<span style="color:#9900CC;">running</span>  = <span style="color:#0000FF; font-weight:bold;">false</span>
    <span style="color:#9966CC; font-weight:bold;">end</span> 
  <span style="color:#9966CC; font-weight:bold;">end</span> 
&nbsp;
  w.<span style="color:#9900CC;">restart_if</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>restart<span style="color:#006600; font-weight:bold;">|</span>
    restart.<span style="color:#9900CC;">condition</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:backgroundrb</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span> 
      <span style="color:#008000; font-style:italic;">#just restart it</span>
    <span style="color:#9966CC; font-weight:bold;">end</span> 
  <span style="color:#9966CC; font-weight:bold;">end</span> 
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>In the select call on line 21, you can modify the condition to access :job_key or :status as well.  Obviously, you need to modify RAILS_ROOT for your situation.</p>
<p>If you have suggestions for improvement or questions, hit me up in the comments.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonathanrwallace.com/2008/08/monitoring-backgroundrb-workers-with-god/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ack, a better grep for coders in 3 easy&#160;steps</title>
		<link>http://blog.jonathanrwallace.com/2007/12/ack-a-better-grep-for-coders-in-3-easy-steps/</link>
		<comments>http://blog.jonathanrwallace.com/2007/12/ack-a-better-grep-for-coders-in-3-easy-steps/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 20:58:00 +0000</pubDate>
		<dc:creator>Jonathan Wallace</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.jonathanrwallace.com/?p=3</guid>
		<description><![CDATA[Ack has this nice colorized output when searching code files.  Some may say that grep can do the same thing (it can), but there&#8217;s no need for arg&#8217;ing it up with ack.  There&#8217;s a similar ruby version, rak, but I&#8217;ve heard it isn&#8217;t quite as fast as ack.  Ack works well enough [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://petdance.com/ack/">Ack</a> has this nice colorized output when searching code files.  Some may say that grep can do the same thing (it can), but there&#8217;s no need for arg&#8217;ing it up with ack.  There&#8217;s a similar ruby version, <a href="http://rak.rubyforge.org/">rak</a>, but I&#8217;ve heard it isn&#8217;t quite as fast as ack.  Ack works well enough for me and the install process isn&#8217;t that painful.</p>
<p>There&#8217;s two ways to install listed over at <a href="http://petdance.com/ack/">ack</a>; I chose the CPAN route (since I never know when I&#8217;ll need to install some more perl goodies).</p>
<p>How to install ack on Mac OS X leopard in 3 easy steps.
<ol>
<li>install <a href="http://www.macports.org/">mac ports</a></li>
<li>sudo port install perl5.8</li>
<li>sudo cpan -i App::Ack</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonathanrwallace.com/2007/12/ack-a-better-grep-for-coders-in-3-easy-steps/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
