<?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>Floyd Price &#187; Ruby</title>
	<atom:link href="http://www.floydprice.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.floydprice.com</link>
	<description>Art is never finished, only abandoned. — Leonard da Vinci</description>
	<lastBuildDate>Wed, 14 Dec 2011 15:01:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rails can&#8217;t scale!</title>
		<link>http://www.floydprice.com/2010/06/rails-cant-scale/</link>
		<comments>http://www.floydprice.com/2010/06/rails-cant-scale/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 05:25:32 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=217</guid>
		<description><![CDATA[I&#8217;m not sure who coined the phrase &#8220;Rails can&#8217;t scale&#8221;? but its on of those things that amazingly keeps coming up, particularly when you talk to people in the corporate world who for some reason have it as the stock answer to any rails related discussions. Anyway this is my Open Source answer to that statement, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure who coined the phrase &#8220;Rails can&#8217;t scale&#8221;? but its on of those things that amazingly keeps coming up, particularly when you talk to people in the corporate world who for some reason have it as the stock answer to any rails related discussions.</p>
<p>Anyway this is my Open Source answer to that statement, so please if anybody asks you &#8220;can rails scale&#8221; or makes the statement &#8220;Rails can&#8217;t scale!&#8221; please feel free to use this answer&#8230;</p>
<blockquote>
<p>Applications built in rails are actually as capable of scaling as apps built in any other language (or on top of any other framework), in fact rails out-of-the-box is good enough for 99.9% of the applications you will ever write, and that tiny amount of apps that will have problems would have the same problems in ANY other language or framework. The benefits of Rails as a framework and Ruby as a language (Like Productivity, Maintainability, Developer Engagement, Mapping to an Agile Process) should in every case be considered over any notion of scaling issues. In fact if your app doesn&#8217;t have 8 million concurrent users right now, don&#8217;t worry about scaling at all, your wasting time that could be better spent getting 8 million users.</p>
</blockquote>
<p>Now this answer doesn&#8217;t touch the real issue with this question but in my experience it is good enough to satisfy the type of people who ask this question.</p>
<p>The only exception where i wouldn&#8217;t use this answer is if the question (or statement) comes from a &#8220;Technical Architect&#8221; in a large corperate who is paid 6 figures a year to keep a development team of 100+ moving forward, if he says &#8220;Rails can&#8217;t scale&#8221; Punch him between the fucking eyes, because he should know better.</p>
<p>The truth, is of course that, anybody who says this knows f-all about software architecture and in fact shouldn&#8217;t be in a position where they have an audience to spout their nonsense.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2010/06/rails-cant-scale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Buy &#8211; Open Sources IdeaX</title>
		<link>http://www.floydprice.com/2010/06/best-buy-open-source-ideax/</link>
		<comments>http://www.floydprice.com/2010/06/best-buy-open-source-ideax/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 21:38:17 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Didn't know Yesterday]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=209</guid>
		<description><![CDATA[Best Buy has received much acclaim for its IdeaX platform over the last year, and rightly so. For anyone who isn&#8217;t away of IdeaX its an Idea Gathering application that allows Best Buy to capture ideas and comments from customers and staff members, which can then be voted or commented on buy other customers or [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bestbuy.com">Best Buy</a> has received much acclaim for its <a href="http://bestbuyideax.com/">IdeaX</a> platform over the last year, and rightly so. For anyone who isn&#8217;t away of IdeaX its an Idea Gathering application that allows Best Buy to capture ideas and comments from customers and staff members, which can then be voted or commented on buy other customers or staff members. The basic idea is that good ideas will organically rise to the top as votes and comments increase the &#8220;score&#8221; given to an Idea. Best Buy can then take a &#8220;good&#8221; idea and make it into a reality.</p>
<p>Idea Gather Applications (also known as Idea Management Apps) are not a new thing, many American corporates have already embraced this concept including Google and Dell, and while each have great apps the Best Buy IdeaX platform stands head and shoulders about the competition.</p>
<p>While browsing Hacker News the other day i noticed a post saying that the Best Buy IdeaX platform has been open sourced! This is a great step for Best Buy, Come on, a big non-tech US corporate releasing an Open Source product!!! its unheard of! Whats more the app is written in Ruby on Rails, which in its self is a massive step for a big corporate who would traditionally have written apps like this in C# or Java.</p>
<p>Check out the <a href="http://bbyidx.com/">project home page</a> for the full story, and be sure to take a look around the code <img src='http://www.floydprice.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>The project does take some getting going, you have to me using Postgress and be sure to check out the mad Postgress Specific stuff going on in the migrations. I plan on getting a version of it up and running on EC2 over the next few days (time permitting) so I will issue some instructions in a later post.</p>
<p>All I can say is Hat Tip to Best Buy, Great job!</p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2010/06/best-buy-open-source-ideax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Daily Dose #4</title>
		<link>http://www.floydprice.com/2008/08/daily-dose-4/</link>
		<comments>http://www.floydprice.com/2008/08/daily-dose-4/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 17:41:34 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Daily Dose]]></category>
		<category><![CDATA[IPhone]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Team]]></category>
		<category><![CDATA[ThoughtWorks]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=93</guid>
		<description><![CDATA[Bourbon Creams and Bananas are not a balanced diet. Phusion Passenger on Amazon EC2 Some useful stuff relating to Phusion Passenger (mod_rails) on Amazons Elastic Computing Cloud. Moving from Java to C# A senior ThoughtWorker talks about his first C# project 10 years after he first tasted the Java bean. IPhone GUI PSD Some photoshop [...]]]></description>
			<content:encoded><![CDATA[<p>Bourbon Creams and Bananas are not a balanced diet.</p>
<p><a href="http://nutrun.com/weblog/phusion-passenger-on-amazon-ec2/">Phusion Passenger on Amazon EC2</a><br />
Some useful stuff relating to Phusion Passenger (mod_rails) on Amazons Elastic Computing Cloud.</p>
<p><a href="http://markthomas.info/blog/?p=47">Moving from Java to C#</a><br />
A senior <a href="http://www.thoughtworks.com">ThoughtWorker</a> talks about his first C# project 10 years after he first tasted the Java bean.</p>
<p><a href="http://www.teehanlax.com/blog/?p=447">IPhone GUI PSD</a><br />
Some photoshop goodies for mocking up IPhone UI&#8217;s.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/daily-dose-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Notifier in Rails 2.1</title>
		<link>http://www.floydprice.com/2008/08/exception-notifier-in-rails-21/</link>
		<comments>http://www.floydprice.com/2008/08/exception-notifier-in-rails-21/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 17:29:45 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=91</guid>
		<description><![CDATA[If you have recenlty or are about to Upgrade an existing Rails application to Rails 2.1 (and why wouldn&#8217;t you), be aware that your implementation of Exception Notifier might not work due to a scope change in Rails where: @controller.filter_parameters Is now protected, therefore the code in Exception Notifier that called it needs to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you have recenlty or are about to Upgrade an existing Rails application to Rails 2.1 (and why wouldn&#8217;t you), be aware that your implementation of Exception Notifier might not work due to a scope change in Rails where:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">filter_parameters</span></pre></div></div>

<p>Is now protected, therefore the code in Exception Notifier that called it needs to be change as follows :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="rails" style="font-family:monospace;">   <span style="color:#008000; font-style:italic;">#exclude_raw_post_parameters? ? @controller.filter_parameters(parameters) : parameters</span>
   exclude_raw_post_parameters? ? <span style="color:#0066ff; font-weight:bold;">@controller</span>.<span style="color:#9900CC;">send</span>!<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:filter_parameters</span>, parameters<span style="color:#006600; font-weight:bold;">&#41;</span> : parameters</pre></td></tr></table></div>

<p>Utilizing the send method allows you to call the protected method.</p>
<p>Fortunately the Exception Notifier plugin on GitHut has already been updated to accommodate this fix and can be installed by :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">	.<span style="color: #000000; font-weight: bold;">/</span>script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>rails<span style="color: #000000; font-weight: bold;">/</span>exception_notification.git</pre></td></tr></table></div>

<p><strong>NOTE</strong><br />
Exception Notifier (like most plugins) comes with a suite of tests that you should run as part of your build or at the very least whenever you change something as fundamental as the Rails version your using&#8230; BTW I did neither of these things and found out the hard way :-/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/exception-notifier-in-rails-21/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Catch-All routes in Rails</title>
		<link>http://www.floydprice.com/2008/08/catch-all-routes-in-rails/</link>
		<comments>http://www.floydprice.com/2008/08/catch-all-routes-in-rails/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 15:36:25 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Routing]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=78</guid>
		<description><![CDATA[Sometimes you need a catch-all route in rails to support dynamic applications like Content Management Systems, where all requests that are not matched by an existing route get passed to a controller who can deal with the request. Add the following to the end of your routes.rb : map.with_options(:controller => &#8216;page_engine&#8217;) do &#124;site&#124; site.connect &#8216;*url&#8217;, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need a catch-all route in rails to support dynamic applications like Content Management Systems, where all requests that are not matched by an existing route get passed to a controller who can deal with the request.</p>
<p>Add the following to the end of your routes.rb :</p>
<p>map.with_options(:controller => &#8216;page_engine&#8217;) do |site|<br />
  site.connect &#8216;*url&#8217;, :action => &#8216;show_page&#8217;<br />
end</p>
<p>If that’s your last route, it means that anything that isn’t recognised by any of the other routes will get routed to that controller/action (page_engine/show_page). It shouldn’t interfere with images/assets because they are served with higher priority than Rails routes. It lets you have any number of forward-slashes. </p>
<p>So if you hit your site with the following URL:</p>

<div class="wp_syntax"><div class="code"><pre class="url" style="font-family:monospace;">http://localhost:3000/we/really/hate/wcf</pre></div></div>

<p>The request will be routed to the show_page action in the page_engine controller where you can then access the actual url elements with :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">path = request.<span style="color:#9900CC;">path</span> <span style="color:#008000; font-style:italic;"># '/we/really/hate/wcf'</span>
path_elements = request.<span style="color:#9900CC;">path</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'/'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># ['', 'we', 'really', 'hate', 'wcf']</span></pre></td></tr></table></div>

<p>While this isn&#8217;t the type of thing you would do on many Rails projects you certainly will find this useful for projects that have an element of dynamic routing that goes beyond the RESTful style that rails implements, and its especially useful for implementing Content Management Systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/catch-all-routes-in-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Memcached on Windows</title>
		<link>http://www.floydprice.com/2008/08/memcached-on-windows/</link>
		<comments>http://www.floydprice.com/2008/08/memcached-on-windows/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 13:19:08 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[MemCache]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=72</guid>
		<description><![CDATA[Last time I tried to do MemCache on windows I gave up, as getting MemCache to work on Windows was seriously difficult. Well this is all a thing of the past due to some fine work from Kenneth Dalgleish who has created a Win32 port &#8211; Top Man Installation Download the memcache port from http://www.splinedancer.com/memcached-win32/ [...]]]></description>
			<content:encoded><![CDATA[<p>Last time I tried to do MemCache on windows I gave up, as getting MemCache to work on Windows was seriously difficult.</p>
<p>Well this is all a thing of the past due to some fine work from Kenneth Dalgleish who has created a Win32 port &#8211; Top Man <img src='http://www.floydprice.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>Installation</strong></p>
<p><strong>Download</strong> the memcache port from http://www.splinedancer.com/memcached-win32/</p>
<p><strong>Extract</strong> the download to your filesystsm (say c:\memcached)</p>
<p><strong>Create</strong> a service using the command : c:\memcached\memcached.exe -d install</p>
<p><strong>Start</strong> the server using the command : c:\memcached\memcached.exe -d start (or using the services management console)</p>
<p>Thats it! by default it listens on port 11211</p>
<p>Rails 2.1 makes using memcache really easy and having this option on Windows is a real shot in the arm for Enterprises who are looking to host Rails apps on Windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/memcached-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails in the Enterprise</title>
		<link>http://www.floydprice.com/2008/08/rails-in-the-enterprise/</link>
		<comments>http://www.floydprice.com/2008/08/rails-in-the-enterprise/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 11:20:57 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Consulting]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Team]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=70</guid>
		<description><![CDATA[I love Rails and use it all the time, fortunately the company i work for builds web products that lend them selves to the Rails way, however we also do consultancy work for larger Enterprise companies where Rails doesn&#8217;t lend itself so well. I&#8217;d love to see Rails include features that would ease its adoption [...]]]></description>
			<content:encoded><![CDATA[<p>I love Rails and use it all the time, fortunately the <a href="http://www.componentworkshop.com">company</a> i work for builds <a href="http://www.codespaces.com">web products</a> that lend them selves to the Rails way, however we also do consultancy work for larger Enterprise companies where Rails doesn&#8217;t lend itself so well.</p>
<p>I&#8217;d love to see Rails include features that would ease its adoption within the enterprise, here are a few things that i&#8217;d like to see:</p>
<p><strong>Better support for Windows</strong><br />
Now it hurts me to say this as everybody here loves OS X and our products are built for OS X or linux deployment but many (i&#8217;m inclined to think most) enterprises use Windows for deployment of internal intranet apps. </p>
<p>With the release of <a href="http://www.modrails.com">Mod_rails</a>, deploying ruby apps into production is now only easy its reliable, Enterprises organizations need both of these things, but i think they need them on windows too.</p>
<p><strong>Support for Stored Procs</strong><br />
Now i now its pretty easy to add this support (and i will get to that later) but having Stored Procs support baked into Rails would make using Rails in a enterprise environment so much easier.</p>
<p>We have been to many large companies to build large internal intranet applications and in every one of them we have had to interface with legacy systems via APIs that are exposed by stored procs.</p>
<p>Telling a client that you are going to use Rails in this environment consistently produces a look of horror from the clients technical guys and follows with a Rails can only do Object Relational Mapping discussion. </p>
<p>Any (that i have met) technical architect in the corporate work will dismiss rails for its (perceived) lack of Stored Proc support.</p>
<p>I&#8217;d like to see this functionality baked in to rails and advertised as a &#8220;Feature&#8221;.</p>
<p><strong>Integrated Development Environment</strong><br />
Right now i can think of at least 6 IDE&#8217;s that support rails and thats not including TextMate (which i use).</p>
<p>Of all the IDE&#8217;s that i have tried NetBeans is the best, it has good all round support for rails but even still, its miles away from what a corporate developer would consider a good IDE for rails development. </p>
<p>Developers need refactoring tools in any language but the need for good refactoring is greater with dynamic languages, netbeans has one refactoring option enable when using rails &#8220;Rename&#8221; and even that doesn&#8217;t safely rename.</p>
<p>Now i&#8217;m not suggesting we need <a href="http://www.jetbrains.com/resharper/">Resharper</a> for rails before corporate developers adopt rails but somewhere in between resharper and what we have now would be a good start.</p>
<p><strong>Address the Scaffolding Myths.</strong><br />
Every rails developer knows that scaffolding was (pre rails v2.x) pretty useless but served a good purpose in helping to increase the Buzz around rails with the promise of one click application stubs. </p>
<p>In rails 2.0 scaffolding is <strong>Slightly</strong> more useful in that it creates nice Restful controllers and some pages to help you get going with the first few resources in your application however, the Rails community needs to address the perception thats rails is all about scaffolding.</p>
<p>So many times i have had conversations with Tech Leads, Development Managers, Developers, etc about rails being more than scaffolding, usually they are amazed to hear that most rails developers don&#8217;t even use scaffolding in there apps.</p>
<p>Its as if this great little feature of rails is holding it back in the minds of &#8220;serious&#8221; corporate developers, who don&#8217;t see scaffolding for what it is.</p>
<p><strong>Database Support</strong><br />
Active Resource is an amazing piece of work, I often go through the Code Base to see how certain things are done and find myself gushing over the code in there its amazing&#8230; </p>
<p>However, since Rails v1.2.6 the core team seem to have lost interest in Databases other than sqlite and mysql, which is all good and well for the the Web 2.0 community, however corporate guys need Oracle and/or Microsoft SQL Server support out of the box, and it seems that using either of these engines now requires extra gems and some hacking around. I have had many conversations with devs who &#8220;tried&#8221; to use rails but couldn&#8217;t get it to connect to Oracle. After looking around the web they often got frustrated by the contradicting and out of dat solutions to this problem and gave up.</p>
<p>If rails is living on its promise to give database independence and Rapid development thought active records object relational mapping magic it can&#8217;t force corporate developers down a wild goose chasing for gems, it need to work &#8211; Out of the box.</p>
<p><strong>The Solution&#8230;</strong><br />
Well rails is young and i&#8217;m certain that these issues will be resolved given time, however i think its the responsability of all rails developers to increase its presence in the Corporate world when and where ever we can.</p>
<p>As such I&#8217;m going to start a <strong><a href="http://gotrubyonrails.com">Rails in the Enterprise</a></strong> site where issues such as the ones i have highlighted can be discussed, resolved and communicated to the corperate world.</p>
<p>I&#8217;m like to see this site become a one stop resource for corporate developers who are trying to use rails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/rails-in-the-enterprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Something I didn&#8217;t know Yesterday #2</title>
		<link>http://www.floydprice.com/2008/08/something-i-didnt-know-yesterday-2/</link>
		<comments>http://www.floydprice.com/2008/08/something-i-didnt-know-yesterday-2/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 19:46:44 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Didn't know Yesterday]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=45</guid>
		<description><![CDATA[Rails (or should i say ActiveSupport) adds a blank? instance method to object that encapsulates the nil? &#124;&#124; empty? check that I find myself doing all the time. A quick review of the source show that the empty? method is added to the following: # An object is blank if it's nil, empty, or a [...]]]></description>
			<content:encoded><![CDATA[<p>Rails (or should i say ActiveSupport) adds a blank? instance method to object that encapsulates the nil? || empty? check that I find myself doing all the time.</p>
<p>A quick review of the source show that the empty? method is added to the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#008000; font-style:italic;"># An object is blank if it's nil, empty, or a whitespace string.</span>
  <span style="color:#008000; font-style:italic;"># For example, &quot;&quot;, &quot;   &quot;, nil, [], and {} are blank.</span>
  <span style="color:#008000; font-style:italic;">#</span>
  <span style="color:#008000; font-style:italic;"># This simplifies</span>
  <span style="color:#008000; font-style:italic;">#   if !address.nil? &amp;&amp; !address.empty?</span>
  <span style="color:#008000; font-style:italic;"># to</span>
  <span style="color:#008000; font-style:italic;">#   if !address.blank?</span></pre></div></div>

<p>The full source is actually very simple (I Love Ruby)</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Object</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> blank?
    <span style="color:#9966CC; font-weight:bold;">if</span> respond_to?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:empty</span>?<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> respond_to?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:strip</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      empty? <span style="color:#9966CC; font-weight:bold;">or</span> strip.<span style="color:#9900CC;">empty</span>?
    <span style="color:#9966CC; font-weight:bold;">elsif</span> respond_to?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:empty</span>?<span style="color:#006600; font-weight:bold;">&#41;</span>
      empty?
    <span style="color:#9966CC; font-weight:bold;">else</span>
      !<span style="color:#0000FF; font-weight:bold;">self</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:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">NilClass</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> blank?
    <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">FalseClass</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> blank?
    <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">TrueClass</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> blank?
    <span style="color:#0000FF; font-weight:bold;">false</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">Array</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  alias_method <span style="color:#ff3333; font-weight:bold;">:blank</span>?, <span style="color:#ff3333; font-weight:bold;">:empty</span>?
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Hash</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  alias_method <span style="color:#ff3333; font-weight:bold;">:blank</span>?, <span style="color:#ff3333; font-weight:bold;">:empty</span>?
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<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;">def</span> blank?
    empty? <span style="color:#006600; font-weight:bold;">||</span> strip.<span style="color:#9900CC;">empty</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC00FF; font-weight:bold;">Numeric</span> <span style="color:#008000; font-style:italic;">#:nodoc:</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> blank?
    <span style="color:#0000FF; font-weight:bold;">false</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/something-i-didnt-know-yesterday-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Ruby Enterprise Edition on CentOS 5.2</title>
		<link>http://www.floydprice.com/2008/08/installing-ruby-enterprise-edition-on-centos-52/</link>
		<comments>http://www.floydprice.com/2008/08/installing-ruby-enterprise-edition-on-centos-52/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 19:04:19 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=33</guid>
		<description><![CDATA[Installing Ruby 1.8.6 on CentOS is not as easy as you would hope. The YUM repositories do not have anywhere near the latest version of ruby so you are forced into installing from source, which means locating and installing many dependancies before building ruby itself. I have found myself building ruby several times on a [...]]]></description>
			<content:encoded><![CDATA[<p>Installing Ruby 1.8.6 on CentOS is not as easy as you would hope. The YUM repositories do not have anywhere near the latest version of ruby so you are forced into installing from source, which means locating and installing many dependancies before building ruby itself.</p>
<p>I have found myself building ruby several times on a new CentOS box after realizing that i had missed a dependancy that was required to use rails or some other ruby component.</p>
<p>I was going to write up a step by step guide to installing Ruby 1.8.6, Rails, MySql, etc&#8230; on CentOS 5.2 (and i may still do this) however i have found that the guys who wrote <a href="http://www.modrails.com/">Phusion Passenger</a> have also build a version of Ruby that as well as having a lower memory footprint has a convenient installer that takes the pain out of building from source.</p>
<p>Here are my steps for installing <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> on CentOS 5.2</p>
<p>* 1. ssh into CentOS using your favorite ssh client.<br />
* 2. cd /usr/local/src<br />
(this is where I downloaded the source to you can do this anywhere i guess)<br />
* 3. sudo wget http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.tar.gz<br />
(this is the latest version at the time of writing this post)<br />
* 4. tar xzvf ruby-enterprise-1.8.6-20080810.tar.gz<br />
* 5. sudo ./bin/ruby-enterprise-1.8.6-20080810/installer</p>
<p>The last step starts the convenient installer process that will build everything you need from sources. </p>
<p>I found that first time the script ran i didn&#8217;t have MySql or PostgreSQL development header files so i installed them using </p>
<p>* sudo yum install postgresql-devel.i386<br />
* sudo um install mysql-devel.i386</p>
<p>After running the install script again it completed with no errors (you could have just ran the gem install again rather than installing the whole of ruby&#8230;)</p>
<p>The great thing about this installer is that it isolates the installation and does not touch any system files so it will not screw up any of your existing ruby installs.</p>
<p><a href="http://www.traqus.com">We</a> have been using <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> on one of our projects for a few weeks now and i have to say that it works really well, and it also includes the recent security patches for ruby &#8211; sweet!</p>
<p>Oh don&#8217;t let the name put you off <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> is actually Open Source &#8211; Yay <img src='http://www.floydprice.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/installing-ruby-enterprise-edition-on-centos-52/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Daily Dose #2</title>
		<link>http://www.floydprice.com/2008/08/daily-dose-2/</link>
		<comments>http://www.floydprice.com/2008/08/daily-dose-2/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 12:22:33 +0000</pubDate>
		<dc:creator>Floyd Price</dc:creator>
				<category><![CDATA[Daily Dose]]></category>
		<category><![CDATA[My Links]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.floydprice.com/?p=31</guid>
		<description><![CDATA[Spent the best part of the day estimating development effort for an upcoming project&#8230; Yarn. CMS Rails Kit Ben Curtis has released a new CMS Rails Kit. The Ruby Hoedown in 10 minutes The guys from Rails Envy give a quick review of the Ruby Hoedown. Ruby Visual Identity Team Want to show the world [...]]]></description>
			<content:encoded><![CDATA[<p>Spent the best part of the day estimating development effort for an upcoming project&#8230; Yarn.</p>
<p><a href="http://railskits.com/cms/">CMS Rails Kit</a><br />
Ben Curtis has released a new CMS Rails Kit.</p>
<p><a href="http://railsenvy.com/2008/8/12/the-ruby-hoedown-in-10-minutes">The Ruby Hoedown in 10 minutes</a><br />
The guys from <a href="http://railsenvy.com/">Rails Envy</a> give a quick review of the Ruby Hoedown.</p>
<p><a href="http://rubyidentity.org/">Ruby Visual Identity Team</a><br />
Want to show the world that you love Ruby? Get a high quality Ruby image for your website.</p>
<p><a href="http://www.continuousthinking.com/2008/8/6/ar-extensions-0-8-0-released">ar-extensions 0.8.0 released!</a><br />
Some <a href="http://agilewebdevelopment.com/plugins/ar_extensions">handy extensions</a> to Active Record that now work with Rails 2.1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.floydprice.com/2008/08/daily-dose-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

