<?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>Zen and the Art of Programming &#187; Ruby on Rails</title>
	<atom:link href="http://programmingzen.com/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingzen.com</link>
	<description>By Antonio Cangiano, Software Engineer &#38; Technical Evangelist at IBM</description>
	<lastBuildDate>Wed, 21 Jul 2010 22:12:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Padrino: a Ruby framework built upon Sinatra</title>
		<link>http://programmingzen.com/2010/06/11/padrino-a-ruby-framework-built-upon-sinatra/</link>
		<comments>http://programmingzen.com/2010/06/11/padrino-a-ruby-framework-built-upon-sinatra/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 12:56:07 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1189</guid>
		<description><![CDATA[From the Padrino&#8217;s site: Padrino is a ruby framework built upon the excellent Sinatra Microframework. Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort. This framework makes it as fun and easy as possible to code increasingly advanced web applications by expanding upon Sinatra while maintaining the spirit [...]]]></description>
			<content:encoded><![CDATA[<p>From the <a href="http://www.padrinorb.com/guides">Padrino&#8217;s site</a>:</p>
<blockquote><p>Padrino is a ruby framework built upon the excellent Sinatra Microframework. Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort. This framework makes it as fun and easy as possible to code increasingly advanced web applications by expanding upon Sinatra while maintaining the spirit that made it great.</p></blockquote>
<p>The Ruby community has plenty of web frameworks at this point. Padrino &mdash; self-described as &#8220;The Elegant Ruby Web Framework&#8221;  &mdash; is interesting because it&#8217;s built on top of Sinatra, it&#8217;s highly modular, quite fast, and provides a drop-in admin interface. It fits between Sinatra and a large framework like Rails.</p>
<p><img src="http://antoniocangiano.com/wp-content/uploads/2010/06/padrino.png" align="right" style="float: right" alt="Padrino" hspace="5" />If it wasn&#8217;t for the fact that Rails 3 is about to be released, Padrino may have had a fighting chance at acquiring a good market share within the Ruby community. Rails 3 is here though, and it too is very modular and fast. Plus, it&#8217;s hard to beat the huge ecosystem that&#8217;s already built around it.</p>
<p>That said, the presence of an admin interface, a la Django, and the Sinatra core are definitely inviting features. Check out <a href="http://www.padrinorb.com/guides">their documentation</a> and <a href="http://www.padrinorb.com/guides/blog-tutorial">screencast</a>, to see if you think it&#8217;s worth considering for your own web development needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/06/11/padrino-a-ruby-framework-built-upon-sinatra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to Rails 3</title>
		<link>http://programmingzen.com/2010/05/25/upgrading-to-rails-3/</link>
		<comments>http://programmingzen.com/2010/05/25/upgrading-to-rails-3/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:12:12 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Screencasts]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1179</guid>
		<description><![CDATA[Rails 3 is a major upgrade; using it almost feels like working with an entirely new framework. Porting existing applications and acquiring the skills required to build new ones entails a significant amount of effort. You could scout the net for bits and pieces of information, but that would be time consuming and possibly frustrating. [...]]]></description>
			<content:encoded><![CDATA[<p>Rails 3 is a major upgrade; using it almost feels like working with an entirely new framework. Porting existing applications and acquiring the skills required to build new ones entails a significant amount of effort. You could scout the net for bits and pieces of information, but that would be time consuming and possibly frustrating. Thankfully there are resources available that have done the work for you, so you don&#8217;t have to waste time trying to figure out what&#8217;s new.</p>
<p>In this post, I&#8217;d like to point out a couple of resources that I think compliment each other well, and focus on how to upgrade applications, as opposed to simply providing you with a shopping list of features.</p>
<p>The first one is <a href="http://thinkcode.tv/catalog/upgrading-rails-3/">Upgrading applications to Rails 3</a>, a screencast that was just released by <a href="http://thinkcode.tv">ThinkCode.TV</a>. This screencast is almost an hour-long and shows you how to port a real world web application from Rails 2 to Rails 3. As such, it can be very useful if you have existing code that you&#8217;d like to port over to Rails 3. The author ported a few large applications to Rails 3, as he has solid experience with it. I&#8217;m biased of course, but I feel it&#8217;s well worth $8.99. (Today only, use the coupon <strong>RAILS3</strong> to purchase this Rails screencast for just $5.99.)</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="rails3.png" src="http://antoniocangiano.com/wp-content/uploads/2010/05/rails3.png" border="0" alt="rails3.png" width="550" height="323" /></p>
<p>The second resource is the <a href="http://www.railsupgradehandbook.com/">Rails 3 Upgrade Handbook</a> by&nbsp;Jeremy McAnally. It&#8217;s a beautiful PDF that succinctly explains what&#8217;s new in Rails 3, as well as how to upgrade your applications to the new edition of the framework. At 10c per page ($12 for 120 pages), it too is worth the money in my opinion.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="rails3uh.png" src="http://antoniocangiano.com/wp-content/uploads/2010/05/rails3uh.png" border="0" alt="rails3uh.png" width="400" height="355" /></p>
<p>Regardless of whether you end up buying these resources or not, I sure hope you have extensive test coverage for your existing Rails 2 applications. In my experience this is a must, because porting complex applications to Rails 3 without solid test support is a definite challenge. Nevertheless, I feel that this major upgrade is truly worth it. Rails 3 really brings Rails to a whole new level and we, as a community, should be proud and excited about what lies ahead of us.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/05/25/upgrading-to-rails-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>IBM_DB 2.5.0 with support for Rails 3 is out</title>
		<link>http://programmingzen.com/2010/05/12/ibm_db-2-5-0-with-support-for-rails-3-is-out/</link>
		<comments>http://programmingzen.com/2010/05/12/ibm_db-2-5-0-with-support-for-rails-3-is-out/#comments</comments>
		<pubDate>Wed, 12 May 2010 12:06:33 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1162</guid>
		<description><![CDATA[This is a tiny post to let you know that IBM just released version 2.5.0 of the IBM_DB gem with support for the upcoming Rails 3. That&#8217;s what I call both proactive and a true testament of IBM&#8217;s commitment towards DB2 on Rails. Aside from providing a working adapter and driver before the new framework [...]]]></description>
			<content:encoded><![CDATA[<p>This  is a tiny  post to let you know that IBM just released <a href="http://rubygems.org/gems/ibm_db">version 2.5.0 of the IBM_DB  gem</a> with support for the upcoming Rails 3. That&#8217;s what I call both  proactive  and a true testament of IBM&#8217;s commitment towards <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2</a> on Rails.</p>
<p>Aside from providing a working adapter and driver before the new  framework release is even out, this release has a few improvements  and fixes, such as getting rid of a minor bug related to prepared  statements and  has_many associations.</p>
<p>Finally, ibm_db 2.5 improves upon Unicode integration with support for any encoding format that&#8217;s permitted by Ruby 1.9.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/05/12/ibm_db-2-5-0-with-support-for-rails-3-is-out/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails, DB2 and the Enterprise</title>
		<link>http://programmingzen.com/2010/04/22/rails-db2-and-the-enterprise/</link>
		<comments>http://programmingzen.com/2010/04/22/rails-db2-and-the-enterprise/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 02:52:43 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1145</guid>
		<description><![CDATA[Recently Matt Aimonetti wrote an insightful article about Rails and the Enterprise. In it he identifies five core Enterprise application needs: Reliability Support Performance Advantage over the competition Integration and transition path Matt then proceeds to illustrate how Rails does a good job in regards to most of these points, despite a few existing challenges. [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://antoniocangiano.com/wp-content/uploads/2010/04/enterprise.jpg" alt="The Enterprise :)" /></p>
<p>Recently Matt Aimonetti wrote <a href="http://weblog.rubyonrails.org/2010/3/24/rails-and-the-enterprise">an insightful article</a> about Rails and the Enterprise. In it he identifies five core Enterprise application needs:</p>
<ul>
<li>Reliability</li>
<li>Support</li>
<li>Performance</li>
<li>Advantage over the competition</li>
<li>Integration and transition path</li>
</ul>
<p>Matt then proceeds to illustrate how Rails does a good job in regards to most of these points, despite a few existing challenges.</p>
<p>Among these challenges, I can clearly see the following:</p>
<ul>
<li>
<p>There isn&#8217;t a 1-800-<span class="caps">RAILS</span> number; the community may be great, but there are not exactly yearly contracts in place. Furthermore, the author of the Ruby driver for, say, Oracle doesn&#8217;t owe you a thing. He may or may not be there for you when you need something to be fixed quickly.</p>
</li>
<li>
<p><span class="caps">XML</span> support is less than ideal (but it is improving).</p>
</li>
<li>
<p>Integration with the Enterprise world is not easy, due in part to less than stellar <span class="caps">SOAP</span> support (but that is also improving).</p>
</li>
<li>
<p>If you&#8217;re taking advantage of ActiveRecord and an Enterprise database like Oracle, your <span class="caps">DBA</span> isn&#8217;t likely to be happy that you aren&#8217;t using prepared statements.</p>
</li>
</ul>
<p>You may think these are small points, and in the startup world they generally are. However, in the Enterprise world they do make the difference between adoption and niche.</p>
<p>One thing that Matt forgot to mention is <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2</a>, which should be the poster child for how Rails can be Enterprise ready. And as a bonus, you get to throw around IBM&#8217;s name (which is synonymous with Enterprise) because Rails is both supported by, and used within, <span class="caps">IBM</span>.</p>
<p>Let&#8217;s address each point above with DB2 on Rails in mind.</p>
<p><span class="caps">IBM</span> is the only database vendor to provide a Ruby driver and ActiveRecord/Rails adapter for its databases. This means that you have a team that&#8217;s accountable when things don&#8217;t work as they&#8217;re supposed to. This team is accountable, regardless of whether you have a contract with <span class="caps">IBM</span> or not; it&#8217;s their job, not a hobby. This involvement with Rails dates back to 2006, with continuing releases and improvements ever since. Our IBM&#8217;s optional yearly 24/7 support contracts (e.g., for less than $3000 a year per server with DB2 Express-C) include support for DB2 on Rails as well.</p>
<p>DB2 supports native storage and querying of <span class="caps">XML</span> documents and data (plus <a href="http://antoniocangiano.com/2008/11/04/benchmarking-db2-purexml-against-1-tb-of-xml-data/">it&#8217;s fast</a>). This technology is known as <a href="http://www-01.ibm.com/software/data/db2/xml/">pureXML</a>.</p>
<p>DB2 can both consume and serve <span class="caps">SOAP</span> web services. This lets DB2 do the integration for you.</p>
<p>DB2 on Rails supports <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-1001db2rubyonrailsapps/">parameterized queries</a>. (While on the subject of queries, if you are using JRuby you can take advantage of <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-0708ahadian/index.html">pureQuery</a>, which is an <span class="caps">IBM</span> created Enterprise solution that&#8217;s aimed at making your queries fast, reliable, manageable and easy to debug.)</p>
<p>If you are trying to introduce Rails into your Enterprise job, chances are that DB2 will already be present within the company infrastructure. If not, you can use <a href="http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C</a> which is entirely free &mdash; thus making it easier to introduce than an expensive solution.</p>
<p><span class="caps">IBM</span> is one of the most trusted brands on the market today, as it has been for decades now. Banks and Enterprise companies the world over trust DB2 with their most critical data. One way for the Rails community to increase the adoption of Rails in the Enterprise, is to acknowledge and embrace the great pair that is Rails and DB2.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/04/22/rails-db2-and-the-enterprise/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>DB2 support for Ruby/Rails turns 2.0</title>
		<link>http://programmingzen.com/2010/01/21/db2-support-for-rubyrails-turns-2-0/</link>
		<comments>http://programmingzen.com/2010/01/21/db2-support-for-rubyrails-turns-2-0/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:03:24 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1120</guid>
		<description><![CDATA[The API development team just released a major version of the ibm_db gem. Detailed installation instructions are available on RubyForge (PDF). Among several improvements, there are three particularly newsworthy features: Support for Ruby 1.9; Support for mingw32, used by the latest version of the Ruby installer for Windows;; Performance and security enhancements through &#8220;automatic&#8221; parameterized [...]]]></description>
			<content:encoded><![CDATA[<p>The API development team just released a major version of the <a href="http://rubyforge.org/frs/?group_id=2361&#038;release_id=42388">ibm_db gem</a>. Detailed installation instructions are <a href="http://rubyforge.org/docman/view.php/2361/10532/IBM_DB.pdf">available on RubyForge</a> (PDF). Among several improvements, there are three particularly newsworthy features:</p>
<ol>
<li>Support for Ruby 1.9;</li>
<li>Support for mingw32, used by the latest version of the <a href="http://rubyforge.org/projects/rubyinstaller/">Ruby installer for Windows;</a>;</li>
<li>Performance and security enhancements through &#8220;automatic&#8221; parameterized queries.</li>
</ol>
<p>As we approach the release of Rails 3, supporting Ruby 1.9 is becoming more of a necessity. Likewise, the so called &#8220;One-Click installer&#8221; on Windows has been replaced by a current project that uses mingw32, which offers a much needed performance boost on Windows. Having a mingw32 compatible gem is starting to become a requirement for many of our Windows users.</p>
<p>Finally, DB2 is now the only database that supports prepared statements in ActiveRecord (without changing any of the application&#8217;s code). This has important performance benefits, as I explained in my article <a href="http://www.ibm.com/developerworks/data/library/techarticle/dm-1001db2rubyonrailsapps/index.html"><em>Improve the security and performance of DB2 Ruby on Rails applications using parameterized queries</em></a>, which was published today by developerWorks.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2010/01/21/db2-support-for-rubyrails-turns-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Ruby Enterprise Edition, nginx and Passenger (aka mod_rails) on Ubuntu</title>
		<link>http://programmingzen.com/2009/11/20/setup-ruby-enterprise-edition-nginx-and-passenger-aka-mod_rails-on-ubuntu/</link>
		<comments>http://programmingzen.com/2009/11/20/setup-ruby-enterprise-edition-nginx-and-passenger-aka-mod_rails-on-ubuntu/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 19:17:26 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1117</guid>
		<description><![CDATA[The following is a very short guide on setting up Ruby Enterprise Edition (REE), nginx and Passenger, for serving Ruby on Rails applications on Ubuntu. It also includes a few quick and easy optimization tips. We start with setting up REE (x64), using the .deb file provided by Phusion: wget http://rubyforge.org/frs/download.php/66163/ruby-enterprise_1.8.7-2009.10_amd64.deb sudo dpkg -i ruby-enterprise_1.8.7-2009.10_amd64.deb [...]]]></description>
			<content:encoded><![CDATA[<p>The following is a very short guide on setting up Ruby Enterprise Edition (REE), nginx and Passenger, for serving Ruby on Rails applications on Ubuntu. It also includes a few quick and easy optimization tips.</p>
<p>We start with setting up REE (x64), using the .deb file provided by Phusion:</p>
<div class="highlight">
<pre>wget http://rubyforge.org/frs/download.php/66163/ruby-enterprise_1.8.7-2009.10_amd64.deb
sudo dpkg -i ruby-enterprise_1.8.7-2009.10_amd64.deb
ruby -v
</pre>
</div>
<p>In output you should see &#8220;ruby 1.8.7 (2009-06-12 patchlevel 174)&#8230;&#8221; or similar. If this is the case, good; while you are there, update RubyGems and the installed gems:</p>
<div class="highlight">
<pre>sudo gem update --system
sudo gem update
</pre>
</div>
<p>Next, you&#8217;ll need to install nginx, which is a really fast web server. The <a href="http://phusion.nl/about.html">Phusion</a> team has made it very easy to install, but if you simply follow most instructions found elsewhere, you&#8217;ll get the following error:</p>
<pre>checking for system md library ... not found
checking for system md5 library ... not found
checking for OpenSSL md5 crypto library ... not found

./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.  You can either disable the module by using
--without-http-cache option, or install the OpenSSL library in the
system,
or build the OpenSSL library statically from the source with nginx by
using
--with-http_ssl_module --with-openssl=
<path> options.</pre>
<p>Instead, we are going to install libssl-dev first and then nginx and its Passenger module:</p>
<div class="highlight">
<pre>sudo aptitude install libssl-dev
sudo passenger-install-nginx-module
</pre>
</div>
<p>Follow the prompt and accept all the defaults (when prompted to chose between 1 and 2, pick 1).</p>
<p>Before I proceed with the configuration, I like to create an init script and have it boot at startup (the script itself is adapted from one provided by the excellent <a href="http://articles.slicehost.com">articles at slicehost.com</a>):</p>
<div class="highlight">
<pre>sudo vim /etc/init.d/nginx
</pre>
</div>
<p>The content of which needs to be:</p>
<div class="highlight">
<pre><span class="c">#! /bin/sh</span>

<span class="c">### BEGIN INIT INFO</span>
<span class="c"># Provides:          nginx</span>
<span class="c"># Required-Start:    $all</span>
<span class="c"># Required-Stop:     $all</span>
<span class="c"># Default-Start:     2 3 4 5</span>
<span class="c"># Default-Stop:      0 1 6</span>
<span class="c"># Short-Description: starts the nginx web server</span>
<span class="c"># Description:       starts nginx using start-stop-daemon</span>
<span class="c">### END INIT INFO</span>

<span class="nv">PATH</span><span class="o">=</span>/opt/nginx/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
<span class="nv">DAEMON</span><span class="o">=</span>/opt/nginx/sbin/nginx
<span class="nv">NAME</span><span class="o">=</span>nginx
<span class="nv">DESC</span><span class="o">=</span>nginx

<span class="nb">test</span> -x <span class="nv">$DAEMON</span> <span class="o">||</span> <span class="nb">exit </span>0

<span class="c"># Include nginx defaults if available</span>
<span class="k">if</span> <span class="o">[</span> -f /etc/default/nginx <span class="o">]</span> ; <span class="k">then</span>
    . /etc/default/nginx
<span class="k">fi</span>

<span class="nb">set</span> -e

. /lib/lsb/init-functions

<span class="k">case</span> <span class="s2">&quot;$1&quot;</span> in
  start<span class="o">)</span>
    <span class="nb">echo</span> -n <span class="s2">&quot;Starting $DESC: &quot;</span>
    start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/<span class="nv">$NAME</span>.pid <span class="se">\</span>
        --exec <span class="nv">$DAEMON</span> -- <span class="nv">$DAEMON_OPTS</span> <span class="o">||</span> <span class="nb">true</span>
<span class="nb">    echo</span> <span class="s2">&quot;$NAME.&quot;</span>
    ;;
  stop<span class="o">)</span>
    <span class="nb">echo</span> -n <span class="s2">&quot;Stopping $DESC: &quot;</span>
    start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/<span class="nv">$NAME</span>.pid <span class="se">\</span>
        --exec <span class="nv">$DAEMON</span> <span class="o">||</span> <span class="nb">true</span>
<span class="nb">    echo</span> <span class="s2">&quot;$NAME.&quot;</span>
    ;;
  restart|force-reload<span class="o">)</span>
    <span class="nb">echo</span> -n <span class="s2">&quot;Restarting $DESC: &quot;</span>
    start-stop-daemon --stop --quiet --pidfile <span class="se">\</span>
        /opt/nginx/logs/<span class="nv">$NAME</span>.pid --exec <span class="nv">$DAEMON</span> <span class="o">||</span> <span class="nb">true</span>
<span class="nb">    </span>sleep 1
    start-stop-daemon --start --quiet --pidfile <span class="se">\</span>
        /opt/nginx/logs/<span class="nv">$NAME</span>.pid --exec <span class="nv">$DAEMON</span> -- <span class="nv">$DAEMON_OPTS</span> <span class="o">||</span> <span class="nb">true</span>
<span class="nb">    echo</span> <span class="s2">&quot;$NAME.&quot;</span>
    ;;
  reload<span class="o">)</span>
      <span class="nb">echo</span> -n <span class="s2">&quot;Reloading $DESC configuration: &quot;</span>
      start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/<span class="nv">$NAME</span>.pid <span class="se">\</span>
          --exec <span class="nv">$DAEMON</span> <span class="o">||</span> <span class="nb">true</span>
<span class="nb">      echo</span> <span class="s2">&quot;$NAME.&quot;</span>
      ;;
  status<span class="o">)</span>
      status_of_proc -p /opt/nginx/logs/<span class="nv">$NAME</span>.pid <span class="s2">&quot;$DAEMON&quot;</span> nginx <span class="o">&amp;&amp;</span> <span class="nb">exit </span>0 <span class="o">||</span> <span class="nb">exit</span> <span class="nv">$?</span>
      ;;
  *<span class="o">)</span>
    <span class="nv">N</span><span class="o">=</span>/etc/init.d/<span class="nv">$NAME</span>
    <span class="nb">echo</span> <span class="s2">&quot;Usage: $N {start|stop|restart|reload|force-reload|status}&quot;</span> &gt;&amp;2
    <span class="nb">exit </span>1
    ;;
<span class="k">esac</span>

<span class="nb">exit </span>0
</pre>
</div>
<p>Change its permission and have it startup at boot:</p>
<div class="highlight">
<pre>sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
</pre>
</div>
<p>From now on, you&#8217;ll be able to start, stop and restart nginx with it. Start the server as follows:</p>
<div class="highlight">
<pre>sudo /etc/init.d/nginx start
</pre>
</div>
<p>Heading over to your server IP with your browser, you should see &#8220;Welcome to nginx!&#8221;. If you do, great, we can move on with the configuration of nginx for your Rails app.</p>
<p>Edit nginx&#8217; configuration file:</p>
<div class="highlight">
<pre>sudo vim /opt/nginx/conf/nginx.conf
</pre>
</div>
<p>Adding a server section within the http section, as follows:</p>
<div class="highlight">
<pre>    server <span class="o">{</span>
        listen 80;
        server_name example.com;
        root /somewhere/my_rails_app/public;
        passenger_enabled on;
        rails_spawn_method smart;
    <span class="o">}</span>
</pre>
</div>
<p>The server name can also be a subdomain if you wish (e.g., blog.example.com). It&#8217;s important that you point the root to your Rails&#8217; app public directory.</p>
<p>The rails_spawn_method directive is very efficient, allowing Passenger to consume less memory per process and speed up the spawning process, whenever your Rails application is not affected by its limitations (for a discussion about this you can read the proper <a href="http://www.modrails.com/documentation/Users%20guide.html#_the_smart_spawning_method">section in the official guide</a>).</p>
<p>If you have lots of RAM (e.g., more than 512 MB) on your server, you may want to consider increasing you maximum pool size, with the directive passenger_max_pool_size from its default size of 6. Conversely, if you want to limit the number of processes running at any time and consume less memory on a small VPS (e.g., 128 to 256MB), you can decrease that number down to 2 (or something in that range). (Always test a bunch of configurations to find one that works for you). You can read more about this directive, <a href="http://modrails.com/documentation/Users%20guide%20Nginx.html#PassengerMaxPoolSize">in the official guide</a>.</p>
<p>While you are modifying nginx&#8217; configuration, you may also want to increase the worker processes (e.g., to 4, on a typical VPS) and add a few more tweaks (such as enabling gzip compression):</p>
<div class="highlight">
<pre><span class="c"># ...</span>
http <span class="o">{</span>
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5;
    passenger_ruby /usr/local/bin/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    access_log  logs/access.log;

    sendfile        on;
    keepalive_timeout  65;
    tcp_nodelay on;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;   

    server <span class="o">{</span>
    <span class="c">#...</span>
</pre>
</div>
<p>When you are happy with the changes, save the file, and restart nginx:</p>
<div class="highlight">
<pre>sudo /etc/init.d/nginx restart
</pre>
</div>
<p>If you wish to restart Passenger in the future, without having to restart the whole web server, you can simply run the following command:</p>
<div class="highlight">
<pre>touch /somewhere/my_rails_app/tmp/restart.txt
</pre>
</div>
<p>Passenger also provides a few handy monitoring tools. Check them out:</p>
<div class="highlight">
<pre>sudo passenger-status
sudo passenger-memory-stats
</pre>
</div>
<p>That&#8217;s it, you are ready to go! I hope that you find these few notes useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/11/20/setup-ruby-enterprise-edition-nginx-and-passenger-aka-mod_rails-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Installing the Ruby driver for DB2 on Mac OS X Snow Leopard</title>
		<link>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/</link>
		<comments>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 19:23:35 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1097</guid>
		<description><![CDATA[Now that Mac OS X 10.6 is out, it&#8217;s time to leave the world of 32 bit computing behind. The pre-installed Ruby interpreter will run in 64 bit mode by default, so you may need to pay attention when installing some C-based gems. The ibm_db Ruby gem for DB2 can easily be installed or updated [...]]]></description>
			<content:encoded><![CDATA[<p>Now that Mac OS X 10.6 is out, it&#8217;s time to leave the world of 32 bit computing behind. The pre-installed Ruby interpreter will run in 64 bit mode by default, so you may need to pay attention when installing some C-based gems. The ibm_db Ruby gem for DB2 can easily be installed or updated to the latest available version by following these simple steps:</p>
<div class="highlight">
<pre><span class="nv">$ </span>sudo -s
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_LIB</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib/lib64
<span class="nv">$ </span><span class="nb">export </span><span class="nv">IBM_DB_INCLUDE</span><span class="o">=</span>/Users/&lt;username&gt;/sqllib/include
<span class="nv">$ </span><span class="nb">export </span><span class="nv">ARCHFLAGS</span><span class="o">=</span><span class="s2">&quot;-arch x86_64&quot;</span>
<span class="nv">$ </span>gem install ibm_db
</pre>
</div>
<p>You can verify that the installation was successful my running the following:</p>
<div class="highlight">
<pre><span class="nv">$</span> <span class="n">irb</span>
<span class="o">&gt;&gt;</span> <span class="nb">require</span> <span class="s1">&#39;ibm_db.bundle&#39;</span>
<span class="o">=&gt;</span> <span class="kp">true</span>
</pre>
</div>
<p>Please let me know if you encounter any issues, I&#8217;d be glad to help you.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/09/03/installing-the-ruby-driver-for-db2-on-mac-os-x-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recommended Ruby and Rails books (August 2009)</title>
		<link>http://programmingzen.com/2009/08/24/recommended-ruby-and-rails-books/</link>
		<comments>http://programmingzen.com/2009/08/24/recommended-ruby-and-rails-books/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 12:46:10 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Merb]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=1087</guid>
		<description><![CDATA[I finally got around to updating the Ruby and Rails book pages. The existing list was getting a bit obsolete and I didn&#8217;t like the idea of recommending old books to newcomers. I also had some interesting new entries. Without further ado: Recommended Ruby Books Recommended Rails Books A few people may disagree with the [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to updating the Ruby and Rails book pages. The existing list was getting a bit obsolete and I didn&#8217;t like the idea of recommending old books to newcomers. I also had some interesting new entries.</p>
<p>Without further ado:</p>
<ul>
<li><big><a href="http://antoniocangiano.com/ruby-and-rails-recommended-books/">Recommended Ruby Books</a></big></li>
<li><big><a href="http://antoniocangiano.com/rails-books/">Recommended Rails Books</a></big></li>
</ul>
<p>A few people may disagree with the choices, but I think most experienced Ruby and Rails programmers, who&#8217;ve read those books, will concur with my recommendations. I&#8217;m quite confident that these are, all things considered, some of the best books available on the subject.</p>
<p><strong>A word to the publishers</strong></p>
<p>As tempting as it is to collect Ruby and Rails books, these days I don&#8217;t feel I can economically justify the act of purchasing every Ruby or Rails book put out there. So if you are a publisher or an author, and you&#8217;d like for me to consider your book, you are certainly welcome to <a href="mailto:info@antoniocangiano.com?subject=Review copy">send me a review copy</a>. I will definitely read it, but only include it on these lists if it&#8217;s either outstanding or as good as the existing ones. If it&#8217;s a programming book that&#8217;s not related to Ruby/Rails, yet is really good, I would consider reviewing it on my blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/08/24/recommended-ruby-and-rails-books/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>On JRuby&#8217;s importance for the future of Ruby</title>
		<link>http://programmingzen.com/2009/07/28/on-jrubys-importance-for-the-future-of-ruby/</link>
		<comments>http://programmingzen.com/2009/07/28/on-jrubys-importance-for-the-future-of-ruby/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 20:10:36 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=886</guid>
		<description><![CDATA[In a recent blog entry, Charles Nutter argues about the importance of JRuby for Ruby&#8217;s adoption within the Enterprise. Or, in his own words: The idea of &#8220;Enterprise Ruby&#8221; has become less repellant since Dave Thomas&#8217;s infamous keynote at RailsConf 2006. There are a lot of large, lumbering organizations out there that have yet to [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://blog.headius.com/2009/07/jrubys-importance-to-ruby-and-erubycon.html">recent blog entry</a>, Charles Nutter argues about the importance of JRuby for Ruby&#8217;s adoption within the Enterprise. Or, in his own words:</p>
<blockquote><p>The idea of &#8220;Enterprise Ruby&#8221; has become less repellant since Dave Thomas&#8217;s infamous keynote at RailsConf 2006. There are a lot of large, lumbering organizations out there that have yet to adopt any of the newer agile language/framework combinations, and Rails has most definitely led the way. I personally believe that in order for Ruby to become more than just a nice language with a great community, it needs to gain adoption in those organizations, and it needs to do it damn quickly. JRuby is by far the best way for that to happen.</p></blockquote>
<p>He has a very good point. Working for IBM (it doesn&#8217;t get much more Enterprise than that) I can testify to the number of colleagues and partners who ask me questions like, &#8220;Can I interface Rails with Java?&#8221;, &#8220;Can I deploy it with WebSphere?&#8221; or &#8220;How can I generate a Rails WAR file?&#8221;. The answers to these and similar questions are all found in JRuby.</p>
<p>A couple of years ago I &#8220;toured&#8221; Canada, speaking at a few IBM, internal conferences. The vast majority of my attendees were experienced Java developers who were doing business consulting for IBM&#8217;s clients. They were all very enthusiastic about my presentation on Ruby and Rails. It was a break from J2EE&#8217;s complexity. These people were genuinely excited about the perspective of using Rails when doing client work.</p>
<p>Mid-conference, one attendant said to me, &#8220;This is cool, but they&#8217;ll never let us use this stuff&#8221;. And that&#8217;s when I reached for the JRuby slides. The mood in the room suddenly shifted. These developers started to think &#8220;OK, this could actually work&#8221;. At the end of my speech, most of the questions I received had to do with JRuby.</p>
<p>As I mentioned during that series of conferences &#8220;JRuby can be your gateway to introducing Rails into your workplace&#8221;. Many people within the Enterprise world don&#8217;t have an option. It&#8217;s either a JVM-based solution or they have to give up on Rails altogether.</p>
<p>JRuby is not only attractive to Ruby fans who&#8217;d like to use Ruby/Rails in certain work environments, it&#8217;s also appealing to those who are looking for an alternative to Java as a language. Here is where we could hit the jackpot in terms of Ruby&#8217;s adoption. There are countless Java programmers in the world. Convincing even just a fraction of them to switch would be enough to drastically increase the size of our community.</p>
<p>As Charles mentioned in his post, people can now pick between Scala, Clojure, Groovy, JRuby and Jython. I believe that the choice developers ultimately make boils down to three key usability aspects:</p>
<ol>
<li>If I&#8217;m moving away from the complexity and limits of the Java programming language, I will most likely want to embrace something that is easy to use, yet also very powerful. JRuby, Jython and perhaps Groovy, have a major advantage in this regard. Most Java developers will find Scala and Clojure intimidating, in my opinion.</li>
<li>Java is one of the fastest languages out there. The speed of these implementations will have an impact on the sort of choice people ultimately end up making. Going from Java to JRuby can be a pretty dramatic decrease in speed. In this sense Scala has <a href="http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&#38;lang=all">the upper hand</a>. So I believe that continuing to improve JRuby&#8217;s performance will be key.</li>
<li>Java integration. How hard does this language make using libraries that I&#8217;m already used to? Are they easily wrapped or do I have to jump through hoops? I think JRuby does a pretty good job in this regard.</li>
</ol>
<p>Charles&#8217; team has been focusing on the right things. If I can be permitted one criticism though, it would be to avoid responding to every post that praises a competing implementation. Openly fighting against other implementations can backfire and looks unprofessional. I understand the desire to set the record straight and being competitive, but there is no reason to constantly point out that &#8220;these implementations are not done&#8221; every time an early project shows some form of promise or progress. Otherwise, it&#8217;s easy to come across as someone whose &#8220;<a href="http://twitter.com/headius/status/2553356299">heart turned black as coal</a>, and who finds himself wishing bad luck towards other implementations&#8221;.</p>
<p>Today JRuby is an Enterprise-friendly alternative to Ruby MRI/KRI; and Charles is right, JRuby is important for Ruby&#8217;s future. It would however be wrong to assume that JRuby is the only sort of future for Ruby and that C/C++ based implementations are becoming irrelevant. Ruby has never been a zero-sum game. Plurality is a substantial part of what the Ruby ecosystem is all about.</p>
<p>Finally, let me conclude by congratulating the JRuby team, who have just been <a href="http://www.itworld.com/business/72663/suns-jruby-team-jumps-ship-engine-yard">hired by Engine Yard</a>. I think this could be a very strategic move for both JRuby and Engine Yard.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/07/28/on-jrubys-importance-for-the-future-of-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DB2 Express-C 9.7 and the Django adapter released</title>
		<link>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/</link>
		<comments>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 20:29:04 +0000</pubDate>
		<dc:creator>Antonio Cangiano</dc:creator>
				<category><![CDATA[DB2]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://antoniocangiano.com/?p=825</guid>
		<description><![CDATA[This is a great day for those of us who love DB2, as DB2 Express-C 9.7 has just been released. As mentioned before, this is the best DB2 ever, and an extremely important release. To learn more about what&#8217;s new in this release, please check out the recording of our latest webinar: If you run [...]]]></description>
			<content:encoded><![CDATA[<p>This is a great day for those of us who love DB2, as <a href="http://www.ibm.com/services/forms/preLogin.do?source=swg-db2expressc&#038;S_CMP=ECDDWW01&#038;S_TACT=ACDB201">DB2 Express-C 9.7</a> has just been released. As mentioned before, this is <a href="http://antoniocangiano.com/2009/04/22/the-best-db2-ever/">the best DB2 ever</a>, and an extremely important release.</p>
<p>To learn more about what&#8217;s new in this release, please check out the recording of our latest webinar:</p>
<div align="center">
<object width="400" height="270"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5035884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5035884&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="405"></embed></object>
</div>
<p><br/></p>
<p>If you run Linux, Unix or Windows, <a href="http://www.ibm.com/services/forms/preLogin.do?source=swg-db2expressc&#038;S_CMP=ECDDWW01&#038;S_TACT=ACDB201">download it</a> while it&#8217;s hot.</p>
<p><strong>DB2 9.7 on the Cloud</strong></p>
<p>Another great aspect of this release is that for the first time ever, DB2 has been released both as a product and as a deployment on the Cloud. If you pop over to <a href="http://rightscale.com">RightScale</a>, you can get a trial account for free and should see DB2 Express-C 9.7 on both CentOS and Ubuntu within the partner catalog. RightScale has been an amazing partner and they really do wonders to simplify Cloud Computing. In ten minutes time you can be up and running on the Cloud, thanks to the templates provided.</p>
<p align="center">
<a href="http://antoniocangiano.com/images/rightscale-big.png" target="_blank"><img src="http://antoniocangiano.com/images/rightscale.jpg" border="0" alt="DB2 on the Cloud" title="Click to enlarge" /></a>
</p>
<p><strong>DB2 support for Django</strong></p>
<p>But the good times don&#8217;t stop there, we are also announcing the first official release of the Django adapter for DB2. It sounded crazy when I first proposed the idea within IBM back in 2006, but now it&#8217;s a reality.</p>
<p>You can download the .tar.gz archive from the <a href="http://code.google.com/p/ibm-db/">Google Code homepage for the project</a>, or simply by <a href="http://ibm-db.googlecode.com/files/ibm_db_django-0.1.0.tar.gz">clicking here</a>. This version fully supports the Django 1.0.2 API. For instructions on how to install it, please read the <a href="http://code.google.com/p/ibm-db/wiki/ibm_db_django_README">Getting started with the IBM DB Django adapter</a> guide. The current version supports DB2 for Linux, Unix, Windows and MAC OS X, version 8.2 or higher (9.5 FP2 or higher for MAC OS X). In the future, IBM Cloudscape, Apache Derby, Informix (IDS) and both System i &#038; z/OS will be supported.</p>
<p><strong>ibm_db gem updated to 1.1</strong></p>
<p>I&#8217;ll conclude this DB2-centric post with a smaller, but still interesting announcement. <a href="http://rubyforge.org/projects/rubyibm/">The ibm_db gem</a> has been updated to version 1.1. This release includes support for ActiveRecord&#8217;s QueryCache mechanism, enhanced support for BigInt (and BigSerial), support for rename_column (requires DB2 9.7), parametrization of the timestamp datatype (requires DB2 9.7), and a few fixes and performance enhancements as well. It is recommended that you upgrade to this version.</p>
]]></content:encoded>
			<wfw:commentRss>http://programmingzen.com/2009/06/19/db2-express-c-97-and-the-django-adapter-released/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
