<?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>Curtis Summers &#187; programming</title>
	<atom:link href="http://csummers.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://csummers.com</link>
	<description>%w{life code ruby}.map { &#124;i&#124; "#{i} is awesome" }</description>
	<lastBuildDate>Tue, 16 Mar 2010 11:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Ruby: Recursive send</title>
		<link>http://csummers.com/2007/01/18/ruby-recursive-send/</link>
		<comments>http://csummers.com/2007/01/18/ruby-recursive-send/#comments</comments>
		<pubDate>Thu, 18 Jan 2007 20:02:25 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2007/01/18/ruby-recursive-send/</guid>
		<description><![CDATA[Ruby&#8217;s Object#send allows dynamic calling of a method. This is very useful, but what if we wanted to call several levels deep on an object? For instance: # Normal call chain post.comments.first.commented_at &#160; # Dynamically with send? Have to call three times. post.send&#40;:comments&#41;.send&#40;:first&#41;.send&#40;:commented_at&#41; What if the number of calls to send is variable depending on [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby&#8217;s Object#send allows dynamic calling of a method.  This is very useful, but what if we wanted to call several levels deep on an object?  For instance:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#008000; font-style:italic;"># Normal call chain</span>
post.<span style="color:#9900CC;">comments</span>.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">commented_at</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Dynamically with send?  Have to call three times.</span>
post.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:comments</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:commented_at</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>What if the number of calls to send is variable depending on what we&#8217;re trying to show?  In one case we might need <span style="font-family: mono">post.posted_at</span> for the date, and in another case we might need <span style="font-family: mono">post.comments.first.commented_at</span> for the date.</p>
<p>How could we dynamically craft the definition of the methods to send if we don&#8217;t know how many calls to Object#send we&#8217;ll have?  We need a way to define an arbitrary number of method calls.</p>
<p>Behold, a recursive send:  Object#rsend</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> rsend<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args, <span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
    obj = <span style="color:#0000FF; font-weight:bold;">self</span>
    args.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>a<span style="color:#006600; font-weight:bold;">|</span>
      b = <span style="color:#006600; font-weight:bold;">&#40;</span>a.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">Array</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> a.<span style="color:#9900CC;">last</span>.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">Proc</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? a.<span style="color:#9900CC;">pop</span> : block<span style="color:#006600; font-weight:bold;">&#41;</span>
      obj = obj.__send__<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>a, <span style="color:#006600; font-weight:bold;">&amp;</span>b<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    obj
  <span style="color:#9966CC; font-weight:bold;">end</span>
  alias_method <span style="color:#ff3333; font-weight:bold;">:__rsend__</span>, <span style="color:#ff3333; font-weight:bold;">:rsend</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Each argument passed to Object#rsend is an array with the symbols and arguments that will be passed on to Object#send:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">post.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:comments</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:first</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:commented_at</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>If there are no arguments to be passed on to send, the array brackets can be omitted:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">post.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:comments</span>, <span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:commented_at</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Of course, in practice you&#8217;ll probably be defining your method call chain in one part of your code, putting it in a variable, and sending it to rsend with a splat*:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">the_date = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:comments</span>, <span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:commented_at</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
<span style="color:#008000; font-style:italic;">#...somewhere else in your code you've passed the_date along:</span>
post.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>the_date<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>With arguments:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">a = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>,<span style="color:#006666;">1</span>,<span style="color:#006666;">2</span>,<span style="color:#006666;">3</span>,<span style="color:#006666;">4</span>,<span style="color:#006666;">5</span>,<span style="color:#006666;">6</span>,<span style="color:#006666;">7</span>,<span style="color:#006666;">8</span>,<span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:slice</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">8</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#=&gt; [2, 3, 4, 5, 6, 7, 8, 9]</span>
&nbsp;
a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:slice</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">8</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:slice</span>, <span style="color:#006666;">1</span>, <span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;">#=&gt; [3, 4, 5]</span></pre></div></div>

<p>Object#send accepts a block.  What about blocks?  Pass in a proc:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:map</span>, <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">proc</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;">#=&gt; [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]</span>
&nbsp;
a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:map</span>, <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">proc</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
        <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:select</span>, <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">proc</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x <span style="color:#006600; font-weight:bold;">%</span> <span style="color:#006666;">4</span> == <span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;">#=&gt; [0, 4, 8, 12, 16]</span></pre></div></div>

<p>And, in an effort to make Object#rsend behave like Object#send for the simple case, you can send a regular block:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:map</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#008000; font-style:italic;">#=&gt; [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]</span></pre></div></div>

<p>Caveat:  For the case needing parameters, Object#rsend does require an array, so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:slice</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">8</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># wrong, does not work like Object#send</span>
&nbsp;
a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:slice</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">8</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># right</span></pre></div></div>

<p>A quirk that I&#8217;ve left in for fun, but it might (and maybe should) change:  If providing a single block, that block will be called on every call unless you&#8217;ve already passed in a proc:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby">a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:map</span>, <span style="color:#ff3333; font-weight:bold;">:map</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#008000; font-style:italic;">#=&gt; [0, 4, 8, 12, 16, 20, 24, 28, 32, 36]</span>
&nbsp;
a.<span style="color:#9900CC;">rsend</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:map</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:map</span>, <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">proc</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006666;">+5</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#ff3333; font-weight:bold;">:map</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> x<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006666;">2</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#008000; font-style:italic;">#=&gt; [10, 14, 18, 22, 26, 30, 34, 38, 42, 46]</span>
  <span style="color:#008000; font-style:italic;">#outer block was called on first and third :map</span></pre></div></div>

<p>Can anyone come up with a good use for this call-the-block-each-time behavior?</p>
<p>Has anyone done this already?  I searched for such a thing and came up empty.  Maybe this method should be called something else?  I named it based on each call recursing down the chain of methods with a new object being returned for the next method to be sent to.</p>
<p>Suggestions and comments are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2007/01/18/ruby-recursive-send/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP in a subdirectory; no trailing slash</title>
		<link>http://csummers.com/2006/11/02/cakephp-in-a-subdirectory-no-trailing-slash/</link>
		<comments>http://csummers.com/2006/11/02/cakephp-in-a-subdirectory-no-trailing-slash/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 21:54:05 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/11/02/cakephp-in-a-subdirectory-no-trailing-slash/</guid>
		<description><![CDATA[I recently worked on a project using the CakePHP web framework. One problem I had was placing the framework in a subdirectory of the main website and accessing the application without a trailing slash: This worked: http://mysite.com/sub/ This did not: http://mysite.com/sub Usually Apache figures out that &#8220;sub&#8221; is a directory and will redirect to the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently worked on a project using the <a href="http://www.cakephp.org/">CakePHP</a> web framework.  One problem I had was placing the framework in a subdirectory of the main website and accessing the application without a trailing slash:</p>
<p>This worked:</p>
<p>http://mysite.com/sub/</p>
<p>This did not:</p>
<p>http://mysite.com/sub</p>
<p>Usually Apache figures out that &#8220;sub&#8221; is a directory and will redirect to the slashed location for you.  However, CakePHP&#8217;s default mod_rewrite rules play havoc with this and the result was a 400 Bad Request error.  The solution is relatively simple, but was not intuitively easy to figure out.</p>
<p>CakePHP ships with this .htaccess file in the base CakePHP directory:</p>
<pre>
&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine  on
  RewriteRule ^$  app/webroot/     [L]
  RewriteRule (.*) app/webroot/$1  [L]
&lt;/IfModule&gt;
</pre>
<p>In my attempts to solve this problem, I had tried several rewrite rules and redirects from within this file and from within my website&#8217;s root web directory (one above the CakePHP directory), but only the following worked for me:</p>
<p>1.) Put this in your website root directory (where &#8220;sub&#8221; is your CakePHP directory):</p>
<pre>
&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine  on
  RewriteRule ^sub$       sub/app/webroot/     [L]
  RewriteRule ^sub/(.*)$ sub/app/webroot/$1  [L]
&lt;/IfModule&gt;
</pre>
<p>2) <b>AND, DELETE OR RENAME your .htaccess file in the CakePHP sub directory</b>.</p>
<p>Hope that helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/11/02/cakephp-in-a-subdirectory-no-trailing-slash/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Extend String to use ActionView&#8217;s Text Helpers</title>
		<link>http://csummers.com/2006/08/07/extend-string-to-use-actionviews-text-helpers/</link>
		<comments>http://csummers.com/2006/08/07/extend-string-to-use-actionviews-text-helpers/#comments</comments>
		<pubDate>Mon, 07 Aug 2006 21:54:02 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/08/07/extend-string-to-use-actionviews-text-helpers/</guid>
		<description><![CDATA[Ruby on Rails and Ruby are an amazing combo. Here&#8217;s another example of why. ActionView&#8217;s TextHelper methods are useful, but I often need to use them in my controller or my model. For several of the TextHelper methods that expect a string as input, it makes sense to extend the String class. So, if I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rubyonrails.com/">Ruby on Rails</a> and <a href="http://www.ruby-lang.org/en/">Ruby</a> are an amazing combo.  Here&#8217;s another example of why.</p>
<p>ActionView&#8217;s TextHelper methods are useful, but I often need to use them in my controller or my model.  For several of the TextHelper methods that expect a string as input, it makes sense to extend the String class.</p>
<p>So, if I want to strip HTML tags, auto link any URLs, and then simple format a comment (in that order) before I save it in the database I can do:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> Comment <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
<span style="color:#008000; font-style:italic;">#...</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> before_save
    <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">text</span> = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">text</span>.<span style="color:#9900CC;">strip_tags</span>.<span style="color:#9900CC;">auto_link</span>.<span style="color:#9900CC;">simple_format</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This method is much cleaner than including ActionView::Helpers::TextHelper in whatever class I&#8217;m in and passing the string as an argument to each method.</p>
<p>Below is the magic code.  Since TextHelper is a module, we create a Singleton class to reference the methods, create the wrapper methods in their own module, and finally include that module in the String class.  Note that not all TextHelper methods are included&#8211;just the ones that make sense.  Drop this code into a file and require it in your environment or within a plugin.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby"><span style="color:#008000; font-style:italic;"># ActionView Text Helpers are great!</span>
<span style="color:#008000; font-style:italic;"># Let's extend the String class to allow us to call</span>
<span style="color:#008000; font-style:italic;"># some of these methods directly on a String.</span>
<span style="color:#008000; font-style:italic;"># Note:</span>
<span style="color:#008000; font-style:italic;">#  - cycle-related methods are not included</span>
<span style="color:#008000; font-style:italic;">#  - concat is not included</span>
<span style="color:#008000; font-style:italic;">#  - pluralize is not included because it is in</span>
<span style="color:#008000; font-style:italic;">#       ActiveSupport String extensions already</span>
<span style="color:#008000; font-style:italic;">#       (though they differ).</span>
<span style="color:#008000; font-style:italic;">#  - markdown requires BlueCloth</span>
<span style="color:#008000; font-style:italic;">#  - textilize methods require RedCloth</span>
<span style="color:#008000; font-style:italic;"># Example:</span>
<span style="color:#008000; font-style:italic;"># &quot;&lt;b&gt;coolness&lt;/b&gt;&quot;.strip_tags -&gt; &quot;coolness&quot;</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'singleton'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Singleton to be called in wrapper module</span>
<span style="color:#9966CC; font-weight:bold;">class</span> TextHelperSingleton
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#CC00FF; font-weight:bold;">Singleton</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActionView::Helpers::TextHelper</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">ActionView::Helpers::TagHelper</span> <span style="color:#008000; font-style:italic;">#tag_options needed by auto_link</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Wrapper module</span>
<span style="color:#9966CC; font-weight:bold;">module</span> MyExtensions <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">module</span> CoreExtensions <span style="color:#008000; font-style:italic;">#:nodoc:</span>
    <span style="color:#9966CC; font-weight:bold;">module</span> <span style="color:#CC0066; font-weight:bold;">String</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
      <span style="color:#9966CC; font-weight:bold;">module</span> TextHelper
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">def</span> auto_link<span style="color:#006600; font-weight:bold;">&#40;</span>link = <span style="color:#ff3333; font-weight:bold;">:all</span>, href_options = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#006600; font-weight:bold;">&amp;</span>block<span style="color:#006600; font-weight:bold;">&#41;</span>
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">auto_link</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>, link, href_options, <span style="color:#006600; font-weight:bold;">&amp;</span>block<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> excerpt<span style="color:#006600; font-weight:bold;">&#40;</span>phrase, radius = <span style="color:#006666;">100</span>, excerpt_string = <span style="color:#996600;">&quot;...&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">excerpt</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>, phrase, radius, excerpt_string<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> highlight<span style="color:#006600; font-weight:bold;">&#40;</span>phrase, highlighter = <span style="color:#996600;">'&lt;strong class=&quot;highlight&quot;&gt;<span style="color:#000099;">\1</span>&lt;/strong&gt;'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">highlight</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>, phrase, highlighter<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;">begin</span>
          require_library_or_gem <span style="color:#996600;">'bluecloth'</span>
&nbsp;
          <span style="color:#9966CC; font-weight:bold;">def</span> markdown
            TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">markdown</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">LoadError</span>
          <span style="color:#008000; font-style:italic;"># do nothing.  method will be undefined</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">def</span> sanitize
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">sanitize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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> simple_format
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">simple_format</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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> strip_tags
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">strip_tags</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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;">begin</span>
          require_library_or_gem <span style="color:#996600;">'redcloth'</span>
&nbsp;
          <span style="color:#9966CC; font-weight:bold;">def</span> textilize
            TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">textilize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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> textilize_without_paragraph
            TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">textilize_without_paragraph</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</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;">rescue</span> <span style="color:#CC00FF; font-weight:bold;">LoadError</span>
          <span style="color:#008000; font-style:italic;"># do nothing.  methods will be undefined</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
        <span style="color:#9966CC; font-weight:bold;">def</span> truncate<span style="color:#006600; font-weight:bold;">&#40;</span>length = <span style="color:#006666;">30</span>, truncate_string = <span style="color:#996600;">&quot;...&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">truncate</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>, length, truncate_string<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> word_wrap<span style="color:#006600; font-weight:bold;">&#40;</span>line_width = <span style="color:#006666;">80</span><span style="color:#006600; font-weight:bold;">&#41;</span>
          TextHelperSingleton.<span style="color:#9900CC;">instance</span>.<span style="color:#9900CC;">word_wrap</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>, line_width<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;">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;
<span style="color:#008000; font-style:italic;"># extend String with the TextHelper functions</span>
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">String</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">MyExtensions::CoreExtensions::<span style="color:#CC0066; font-weight:bold;">String</span>::TextHelper</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This idea and code was somewhat inspired by <a href="http://gabriel.gironda.org/articles/2006/02/08/using-helpers-inside-a-controller">Gabriel&#8217;s post on using helpers inside a controller</a>.  Thanks Gabriel!</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/08/07/extend-string-to-use-actionviews-text-helpers/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Ruby Feel</title>
		<link>http://csummers.com/2006/02/05/the-ruby-feel/</link>
		<comments>http://csummers.com/2006/02/05/the-ruby-feel/#comments</comments>
		<pubDate>Sun, 05 Feb 2006 11:28:16 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/02/05/the-ruby-feel/</guid>
		<description><![CDATA[I&#8217;ve been using PHP about 8 years now for web development. I remember when I first discovered PHP. I had been writing CGI applications in C/C++ at the time, and PHP was a breath of fresh air. It was so powerful, yet so simple. I can&#8217;t describe it exactly, but there was a good feeling [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://www.php.net/">PHP</a> about 8 years now for web development.  I remember when I first discovered PHP.  I had been writing CGI applications in C/C++ at the time, and PHP was a breath of fresh air.  It was so powerful, yet so simple.  I can&#8217;t describe it exactly, but there was a good <em>feeling</em> about PHP.</p>
<p>Fast forward to present day where I&#8217;ve been learning and using <a href="http://ruby-lang.org/en/">Ruby</a>, and the <em>feeling</em> is very similar.  For me, Ruby is the next breath of fresh air in programming languages.  It just <em>feels</em> right.</p>
<p>Obviously, other programmers have different opinions, and that&#8217;s okay with me.  I&#8217;m not here to win your heart for Ruby.  Other languages may create the right <em>feel</em> for you.  If <a href="http://www.python.org">python</a> makes you happy, then I say &#8220;Congratulations, on finding a language that you love!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/02/05/the-ruby-feel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim tips</title>
		<link>http://csummers.com/2006/01/30/vim-tips/</link>
		<comments>http://csummers.com/2006/01/30/vim-tips/#comments</comments>
		<pubDate>Mon, 30 Jan 2006 16:52:09 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2006/01/30/vim-tips/</guid>
		<description><![CDATA[I&#8217;m using Vim more and more these days for coding. Below are some useful Vim links: The official Vim site Seven habits of effective text editing Best of VIM Tips, gVIM&#8217;s Key Features Vim Cookbook &#160;]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Vim more and more these days for coding.  Below are some useful Vim links:</p>
<ul>
<li><a href="http://www.vim.org/">The official Vim site</a></li>
<li><a href="http://www.moolenaar.net/habits.html">Seven habits of effective text editing</a></li>
<li><a href="http://www.rayninfo.co.uk/vimtips.html">Best of VIM Tips, gVIM&#8217;s Key Features</a></li>
<li><a href="http://www.oualline.com/vim-cook.html">Vim Cookbook</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2006/01/30/vim-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Code &amp; Style</title>
		<link>http://csummers.com/2005/10/10/ruby-code-style/</link>
		<comments>http://csummers.com/2005/10/10/ruby-code-style/#comments</comments>
		<pubDate>Mon, 10 Oct 2005 10:56:08 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[reading]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2005/10/10/ruby-code-style/</guid>
		<description><![CDATA[Well, it&#8217;s been almost a month now since the baby came. We&#8217;re doing well, but very tired. Adding to my things-to-read-when-I&#8217;m-not-so-tired list: Ruby Code &#038; Style &#8211; a new online magazine from Artima about the Ruby language.]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s been almost a month now since the baby came.  We&#8217;re doing well, but very tired.  Adding to my things-to-read-when-I&#8217;m-not-so-tired list:</p>
<p><a href="http://www.artima.com/rubycs/index.html">Ruby Code &#038; Style</a> &#8211; a new online magazine from <a href="http://www.artima.com/">Artima</a> about the Ruby language.</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/10/10/ruby-code-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PL/Ruby and PL/PHP in PostgreSQL</title>
		<link>http://csummers.com/2005/08/23/plruby-and-plphp-in-postgresql/</link>
		<comments>http://csummers.com/2005/08/23/plruby-and-plphp-in-postgresql/#comments</comments>
		<pubDate>Tue, 23 Aug 2005 16:08:44 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=27</guid>
		<description><![CDATA[The ability to write procedural language (PL) in Ruby and PHP for PostgreSQL is awesome. I wish Oracle had something similar (and no, I&#8217;m not talking about Java). PL/Ruby PL/PHP]]></description>
			<content:encoded><![CDATA[<p>The ability to write procedural language (PL) in Ruby and PHP for PostgreSQL is awesome.  I wish Oracle had something similar (and no, I&#8217;m not talking about Java).</p>
<ul>
<li><a href="http://moulon.inra.fr/ruby/plruby.html">PL/Ruby</a></li>
<li><a href="http://www.commandprompt.com/community/plphp">PL/PHP</a></li>
</ul>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/08/23/plruby-and-plphp-in-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>passing ORACLE_HOME to Apache environment for PHP oci8 module</title>
		<link>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/</link>
		<comments>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/#comments</comments>
		<pubDate>Tue, 09 Aug 2005 16:47:42 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=25</guid>
		<description><![CDATA[A couple of weeks ago I was installing a development environment at work on CentOS with Apache 2, PHP, and the oci8 module. All configured, make&#8217;d, and installed, I was up and running with Apache, PHP, and the Oracle Client tools (sqlplus, etc.) in short order. Everything worked except the oci8 php library functions&#8211;they couldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I was installing a development environment at work on CentOS with Apache 2, PHP, and the oci8 module.  All configured, make&#8217;d, and installed, I was up and running with Apache, PHP, and the Oracle Client tools (sqlplus, etc.) in short order.  Everything worked except the oci8 php library functions&#8211;they couldn&#8217;t find my Oracle instances to connect.</p>
<p>I had covered all of the bases:</p>
<ul>
<li>I could connect with sqlplus to my instance, so the Oracle client worked</li>
<li>I had set the ORACLE_HOME with SetEnv in Apache&#8217;s configuration file and in bash&#8217;s system profile</li>
<li>phpinfo() showed the oci8 module as installed and the ORACLE_HOME environment variable as set</li>
</ul>
<p>This problem had me stumped a good part of an afternoon until I attempted to start Apache directly with apachectl instead of through the &#8216;service&#8217; command used in CentOS.  Suddenly, it worked!</p>
<p>A quick shuffle through the service script and I found that it was restricting the environment before calling the service like so:</p>
<p><code>env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"</code></p>
<p>Hmm.  So, only LANG, PATH, and TERM are passed into any service environment: ORACLE_HOME is left out in the cold.  And, even though I set it in the httpd.conf file, this is apparently too late for it to make a difference in the php oci8 module.  A quick fix in the service script adds the requisite ORACLE_HOME:</p>
<p><code>env -i ORACLE_HOME=$ORACLE_HOME LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"</code></p>
<p>The line above occurs a few times, so add to each occurance. Voila!  It works.</p>
<p><em>I&#8217;m content with this solution for now, but I don&#8217;t particularly like having to change the service script, so is there any other way to do this?</em></p>
<p><strong>Update:</strong><em>This is apparently a common issue:  <a href="http://lists.debian.org/debian-apache/2004/08/msg00135.html">Debian mailing list comment</a>, <a href="http://bugs.gentoo.org/show_bug.cgi?id=32364">Gentoo bug</a>, which is fixed with a white list of environment variables in a separate file.   I couldn&#8217;t find a similar RedHat/CentOS bug.  And, the SetEnv in the httpd.conf file is only effective for CGI PHP, which does not work for me because I&#8217;m using mod_php</em></p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/08/09/passing-oracle_home-to-apache-environment-for-php-oci8-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>back to the future in PHP</title>
		<link>http://csummers.com/2005/08/08/back-to-the-future-in-php/</link>
		<comments>http://csummers.com/2005/08/08/back-to-the-future-in-php/#comments</comments>
		<pubDate>Mon, 08 Aug 2005 16:38:18 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.csummers.org/index.php/2005/08/08/back-to-the-future-in-php/</guid>
		<description><![CDATA[We&#8217;re using PHP version 4.x in production at work, and I often find myself needing a function that has been implemented in PHP 5. A good example is the array_walk_recursive() function. I needed this in my framework library to recursively walk through an input array with a callback function to strip values of potentially harmful [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re using PHP version 4.x in production at work, and I often find myself needing a function that has been implemented in PHP 5.  A good example is the array_walk_recursive() function.  I needed this in my framework library to recursively walk through an input array with a callback function to strip values of potentially harmful input.  The recursive ability was key because the input array could be arbitrarily large, containing several nested arrays.</p>
<p>Now, I could have implemented my own function to do just this, but when we do move to PHP 5 in production, I&#8217;d want to recode to use the standard library function.  To the rescue comes the <a href="http://pear.php.net/package/PHP_Compat">PHP_Compat</a> PEAR package, full of functions and constants to help bridge the gap between different PHP versions.</p>
<p>Thanks to Aidan Lister (the lead developer) and others who contributed to this package.  It has saved me much coding, and I&#8217;m grateful!</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/08/08/back-to-the-future-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming Ruby</title>
		<link>http://csummers.com/2005/07/11/programming-ruby/</link>
		<comments>http://csummers.com/2005/07/11/programming-ruby/#comments</comments>
		<pubDate>Mon, 11 Jul 2005 22:50:56 +0000</pubDate>
		<dc:creator>Curt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[reading]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.csummers.org/?p=22</guid>
		<description><![CDATA[I&#8217;m currently reading Programming Ruby (2nd edition) in my pursuit to learn Ruby. This book, known as the PickAxe because of the tool on the front cover, is part tutorial, part language reference, part best-Ruby-practices, and part API/Library reference. The tendency with a reference book like this is to lump everything about a particular topic [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently reading <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;camp=1789&amp;tag=csummersorg-20&amp;creative=9325&amp;path=tg/detail/-/0974514055/qid=1121104373/sr=8-1/ref=pd_bbs_ur_1?v=glance%26s=books%26n=507846">Programming Ruby (2nd edition)</a><img src="http://www.assoc-amazon.com/e/ir?t=csummersorg-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> in my pursuit to learn Ruby.  This book, known as the PickAxe because of the tool on the front cover, is part tutorial, part language reference, part best-Ruby-practices, and part API/Library reference.</p>
<p>The tendency with a reference book like this is to lump everything about a particular topic into long, boring sections.  However, Dave Thomas and co-authors have managed not to do this.  The book is good at switching gears frequently enough to keep my focus.  Notes comparing Ruby to Perl, Java, and C++ add perspective if you are familiar with those languages.  The code samples in this book also set it apart from similar programming books: the examples are concise&#8211;giving just enough information to illustrate the point in question.</p>
<p>As I read through the book, I find myself thinking:  &#8220;Wow, it would&#8217;ve taken me so much more code to do that in Java (or C++ or &#8230;)!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://csummers.com/2005/07/11/programming-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

