<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Raymond Law: Category Ruby on Rails</title>
    <link>http://blog.rayvinly.com/articles/category/rubyonrails</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Sanitize your output in Ruby on Rails</title>
      <description>&lt;p&gt;We all know about the holy h() method that escapes your output when you do &amp;lt;&lt;span&gt;=h blah %&amp;gt;.  But how many of us can claim we remember to use it where it&amp;#8217;s appropriate during development 100&lt;/span&gt; of the time?  Can you swear you&amp;#8217;ve never missed one?  Moreover, it&amp;#8217;s such a mental distraction to think logic and h() at the same time.  And when you take over a Rails project in the middle, how can you ensure the previous developers use h()?&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s the rescue.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://github.com/pelargir/safe_erb"&gt;safe_erb&lt;/a&gt; + &lt;a href="http://github.com/drnic/rails-footnotes"&gt;footnotes&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I don&amp;#8217;t think I need to explain more.  Just use it and you will find all those places where you should sanitize your output with h(), sanitize(), and untaint(), ...etc.&lt;/p&gt;</description>
      <pubDate>Thu, 30 Oct 2008 14:37:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:2139fb2c-3adc-4a1c-9de8-56bf527e1f9a</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/10/30/sanitize-your-output-in-ruby-on-rails</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>safe_erb</category>
      <category>footnotes</category>
      <category>sanitize</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/73</trackback:ping>
    </item>
    <item>
      <title>RailsRumble 2008</title>
      <description>&lt;p&gt;We just finished the &lt;a href="http://lyricistapp.com"&gt;Lyricist&lt;/a&gt; application for &lt;a href="http://railsrumble.com"&gt;RailsRumble 2008&lt;/a&gt; with 3 other &lt;a href="http://intridea.com"&gt;Intridea&lt;/a&gt; folks.  Here are some observations:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Keep the idea small and achievable&lt;/strong&gt; &amp;#8211; There are only 48 hours, so you can&amp;#8217;t build the next Google.  And there&amp;#8217;s pressure.  Try to keep your idea small and make sure you can accomplish it.  You have to deploy a finished product in order to have any chance of winning.  So stop day dreaming about cool extra features because you won&amp;#8217;t get that implemented.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Prior planning is the key&lt;/strong&gt; &amp;#8211; We barely had any because we had decided on the idea the day before the rumble began.  When the competition started, people don&amp;#8217;t know who&amp;#8217;s doing what and it was kinda a mess.  Fortunately we had a campfire room where all conversation happen, so we can kind of iron out the issues.  However, better preparation and team cohesiveness would have helped a great deal in communication.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Deploy early&lt;/strong&gt; &amp;#8211; I&amp;#8217;ve seen too many deployment problems came up before, so I took the initiative to make sure we could deploy as soon as the competition began.  It helped tremendously because we never had to worry about if we could deploy before time expired.  While you are fixing last minute bugs and the pressure, it would have been tough to set up a server and deploy flawlessly.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;A lot of scaffolding&lt;/strong&gt; &amp;#8211; I took full advantage of Rails scaffolding.  There&amp;#8217;s just no time to reinvent the wheels when all the restful model and controller methods are already available with just one command.  You use plugins and gems for the same reason, right?  So, don&amp;#8217;t be stupid.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Conflicts&lt;/strong&gt; &amp;#8211; The bigger your team, the more conflicts there would be when people check in and out.  We were writing a new application, so people were editing the same files.  Now, if you organize and assign work to people as in a regular project, conflicts don&amp;#8217;t usually happen and even if they do occur, it is trivial to resolve.  However, when you are rumbling, you will step on one another&amp;#8217;s toes.  I can guarantee you that.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Forget about writing tests&lt;/strong&gt; &amp;#8211; Look, I am in support of agile and test-driven development, with one exception.  That is, you are not participating in RailsRumble.  There&amp;#8217;s just no time for it.  If you are a good enough programmer, you can build a small application with no tests.  If you can&amp;#8217;t, I don&amp;#8217;t want to work with you.  Writing tests for a new application starting from scratch in just 48 hours is simple not feasible.  No bargain!&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;No ticketing system like Unfuddle and Lighthouse&lt;/strong&gt; &amp;#8211; One team member had tried to use Unfuddle to create tickets to get ourselves more organized.  While it was a sincere attempt, it simply didn&amp;#8217;t work.  There&amp;#8217;s no time to accept a ticket, create a new ticket, ...  We pretty much abandoned it soon after we started.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Nice to have a designer&lt;/strong&gt;: &amp;#8211; It is very nice if you have a designer on you team because it&amp;#8217;s hard to wear two hats in 48 hours.  Design work can draw your focus away from development.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Now that I&amp;#8217;ve given you my insights for next year&amp;#8217;s RailsRumble.  As a token of appreciation, please &lt;a href="http://railsrumble.com/teams/the-unstable-isotopes"&gt;vote for us&lt;/a&gt;!&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;UPDATE 2008&lt;/span&gt;/10/20&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;One more thought on RailsRumble the day after:&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;Numerous projects that I worked with before never deploy quickly, let alone in 48 hours.  I think it&amp;#8217;s refreshing and rewarding to have something built and deployed so quickly.  It is true that we have to cut many features in order to deploy a first version, but lesser is better than never.  I think many other projects can try to deploy early and often and just go through more iterations and get feedbacks from users and customers.  The whole application doesn&amp;#8217;t need to be finished.  Even if you only have login and logout, you can still deploy.  Add the next feature, deploy again.  That way, you aren&amp;#8217;t keeping the features to yourself.  You can get feedback from users to see what improvements they are looking for and may even lead you to implement the real features that they truly want.&lt;/p&gt;</description>
      <pubDate>Sun, 19 Oct 2008 19:40:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:71bf621b-35c6-4a75-ad14-562651eaf015</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/10/19/railsrumble-2008</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>railsrumble</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/71</trackback:ping>
    </item>
    <item>
      <title>Capistrano Deployment Recipes</title>
      <description>&lt;p&gt;&lt;a href="http://dealistic.com/"&gt;Dealistic&lt;/a&gt; was first deployed to &lt;a href="http://www.slicehost.com/"&gt;Slicehost&lt;/a&gt; when we were testing it on staging.  However, I only got the 256 slice and low memory is a big problem for Ruby and Mongrel.  We&amp;#8217;ve moved to &lt;a href="http://www.amazon.com/gp/browse.html?node=201590011"&gt;Amazon &lt;span class="caps"&gt;EC2&lt;/span&gt;&lt;/a&gt; when we launched.  It is running rock solid and we don&amp;#8217;t run out of memory again, at least for now :P&lt;/p&gt;


	&lt;p&gt;As a result of all these, I wrote two &lt;a href="http://www.capify.org/"&gt;Capistrano&lt;/a&gt; recipes for deployment, for both Slicehost and &lt;span class="caps"&gt;EC2&lt;/span&gt;.  We also use &lt;a href="http://github.com/"&gt;GitHub&lt;/a&gt; for version control.  I think these deployment recipes may be helpful to others.  So here they are:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://blog.rayvinly.com/shared/deploy_slicehost.rb"&gt;deploy.rb for Slicehost&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://blog.rayvinly.com/shared/deploy_ec2.rb"&gt;deploy.rb for &lt;span class="caps"&gt;EC2&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;We wrote some custom Capistrano tasks to copy over configuration files, symlink plugins, start/stop &lt;a href="http://backgroundrb.rubyforge.org/"&gt;BackgrounDRb&lt;/a&gt;, and a custom maintenance page.  But these things are optional.  It should be simple to add/remove things as you see fit.&lt;/p&gt;</description>
      <pubDate>Mon, 04 Aug 2008 17:30:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:f24253c2-5880-49fb-8e78-8d74075c0cbb</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/08/04/capistrano-deployment-recipes</link>
      <category>Entrepreneurship</category>
      <category>Git</category>
      <category>Dealistic</category>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>dealistic</category>
      <category>slicehost</category>
      <category>amazon</category>
      <category>ec2</category>
      <category>capistrano</category>
      <category>github</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/69</trackback:ping>
    </item>
    <item>
      <title>Dealistic is launched</title>
      <description>&lt;p&gt;&lt;img src="http://dealistic.com/images/logo.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://blog.andrewng.com"&gt;Andrew&lt;/a&gt; and I have been working on a new site &lt;a href="http://dealistic.com"&gt;Dealistic&lt;/a&gt; after our work at &lt;a href="http://www.onmylist.com"&gt;OnMyList&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;ve also put up a screencast to show off our features (HUGE thanks to &lt;a href="http://sherrysun.com/"&gt;Sherry&lt;/a&gt;)&lt;/p&gt;


&lt;object width="400" height="300"&gt;    &lt;param name="allowfullscreen" value="true" /&gt;    &lt;param name="allowscriptaccess" value="always" /&gt;    &lt;param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1427503&amp;amp;server=www.vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;    &lt;embed src="http://www.vimeo.com/moogaloop.swf?clip_id=1427503&amp;amp;server=www.vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;

	&lt;p&gt;It lets you find deals by specifying a list of tags and it can notify you by email, &lt;span class="caps"&gt;RSS&lt;/span&gt; feed, and/or &lt;span class="caps"&gt;SMS&lt;/span&gt; when new deals appear that match your tags.&lt;/p&gt;


	&lt;p&gt;We made the site because we often need to find deals on things we want to buy but we spend way too much time looking for irrelevant deals on a lot of different sites.  With &lt;a href="http://dealistic.com"&gt;Dealistic&lt;/a&gt;, what you get is what you want.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Never miss a deal because you don&amp;#8217;t have time to find it!  Just add a tag at &lt;a href="http://dealistic.com"&gt;Dealistic&lt;/a&gt; and we will let you know when a deal that you are looking for appears.&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;We also have a &lt;a href="http://getsatisfaction.com/dealisticcom"&gt;feedback tool&lt;/a&gt; that we hope you can give us suggestions to do better.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jul 2008 02:29:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:cb8f6b81-2db1-48f4-b530-922c4d2dfbea</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/07/29/dealistic-is-launched</link>
      <category>Entrepreneurship</category>
      <category>Random</category>
      <category>Dealistic</category>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>dealistic</category>
      <category>deal</category>
      <category>buy</category>
      <category>coupon</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/68</trackback:ping>
    </item>
    <item>
      <title>Ruby Performance Benchmarking</title>
      <description>&lt;p&gt;Courtesy of &lt;a href="http://www.igvita.com/2008/07/08/6-optimization-tips-for-ruby-mri/"&gt;igvita.com&lt;/a&gt;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;benchmark&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="ident"&gt;n&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="number"&gt;1000000&lt;/span&gt;
&lt;span class="constant"&gt;Benchmark&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;bm&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
  &lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;report&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;copy&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;n&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;times&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;;&lt;/span&gt; &lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;{};&lt;/span&gt; &lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;h&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;merge&lt;/span&gt;&lt;span class="punct"&gt;({&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="punct"&gt;});&lt;/span&gt; &lt;span class="keyword"&gt;end&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;

  &lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;report&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;no copy&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="ident"&gt;n&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;times&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;;&lt;/span&gt; &lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;{};&lt;/span&gt; &lt;span class="ident"&gt;h&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;merge!&lt;/span&gt;&lt;span class="punct"&gt;({&lt;/span&gt;&lt;span class="number"&gt;1&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="number"&gt;2&lt;/span&gt;&lt;span class="punct"&gt;});&lt;/span&gt; &lt;span class="keyword"&gt;end&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;

  &lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;report&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;map(&amp;amp;:id)&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;n&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;times&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
      &lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;{}&lt;/span&gt;
      &lt;span class="ident"&gt;h&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;map&lt;/span&gt;&lt;span class="punct"&gt;(&amp;amp;&lt;/span&gt;&lt;span class="symbol"&gt;:object_id&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;

  &lt;span class="ident"&gt;x&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;report&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;map { |i| i.id }&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;n&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;times&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
      &lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;{}&lt;/span&gt;
      &lt;span class="ident"&gt;h&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;map&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;e&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;object_id&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;In Rails script/console or Ruby 1.9:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="punct"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="ident"&gt;load&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/Users/rlaw/Desktop/bm.rb&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
      &lt;span class="ident"&gt;user&lt;/span&gt;     &lt;span class="ident"&gt;system&lt;/span&gt;      &lt;span class="ident"&gt;total&lt;/span&gt;        &lt;span class="ident"&gt;real&lt;/span&gt;
&lt;span class="ident"&gt;copy&lt;/span&gt;  &lt;span class="number"&gt;4.000000&lt;/span&gt;   &lt;span class="number"&gt;0.020000&lt;/span&gt;   &lt;span class="number"&gt;4.020000&lt;/span&gt; &lt;span class="punct"&gt;(&lt;/span&gt;  &lt;span class="number"&gt;4.081549&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="ident"&gt;no&lt;/span&gt; &lt;span class="ident"&gt;copy&lt;/span&gt;  &lt;span class="number"&gt;2.780000&lt;/span&gt;   &lt;span class="number"&gt;0.010000&lt;/span&gt;   &lt;span class="number"&gt;2.790000&lt;/span&gt; &lt;span class="punct"&gt;(&lt;/span&gt;  &lt;span class="number"&gt;2.818923&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="ident"&gt;map&lt;/span&gt;&lt;span class="punct"&gt;(&amp;amp;&lt;/span&gt;&lt;span class="symbol"&gt;:id&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="number"&gt;10.880000&lt;/span&gt;   &lt;span class="number"&gt;0.040000&lt;/span&gt;  &lt;span class="number"&gt;10.920000&lt;/span&gt; &lt;span class="punct"&gt;(&lt;/span&gt; &lt;span class="number"&gt;11.094024&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="ident"&gt;map&lt;/span&gt; &lt;span class="punct"&gt;{&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;i&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;id&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;  &lt;span class="number"&gt;2.060000&lt;/span&gt;   &lt;span class="number"&gt;0.020000&lt;/span&gt;   &lt;span class="number"&gt;2.080000&lt;/span&gt; &lt;span class="punct"&gt;(&lt;/span&gt;  &lt;span class="number"&gt;2.178544&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;[]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <pubDate>Wed, 09 Jul 2008 20:55:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:7f698a40-885f-41f0-9759-031a4833af89</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/07/09/ruby-performance-benchmarking</link>
      <category>Ruby on Rails</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>performance</category>
      <category>benchmark</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/66</trackback:ping>
    </item>
    <item>
      <title>Deploying your Rails applications with Phusion Passenger</title>
      <description>&lt;p&gt;There have been several methods to deploy an Ruby on Rails application.  Until recently, the most popular is to run Apache and proxy balance to multiple Mongrel instances that are running simultaneously.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt;, developed by &lt;a href="http://www.phusion.nl/about.html"&gt;Phusion&lt;/a&gt;, is the new kid entering the Rails deployment market.  We have been using the Apache &lt;span class="caps"&gt;PHP&lt;/span&gt; module for years and deploying a &lt;span class="caps"&gt;PHP&lt;/span&gt; applications is a snap.  This has not been possible with Rails until Passenger.  It is so easy too!  You can still use &lt;a href="http://capify.org/"&gt;Capistrano&lt;/a&gt; to automate deployment.  I will show you how I get it to work on Ubuntu.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo gem install passenger
passenger-install-apache2-module&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Phusion just released &lt;a href="http://phusion-passenger.googlecode.com/files/passenger-1.9.0.gem"&gt;Passenger 2.0 &lt;span class="caps"&gt;RC 1&lt;/span&gt;&lt;/a&gt;.  You can download this version and do &lt;code&gt;gem install passenger-1.9.0.gem&lt;/code&gt; instead.  But I had an error compiling it on Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; Leopard.  hongli pointed me to use the version from &lt;a href="http://github.com/FooBarWidget/passenger/tree/master"&gt;GitHub&lt;/a&gt; that has the fix and it works like a charm.  Thanks Phusion guys.&lt;/p&gt;


	&lt;p&gt;To get it from GitHub:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;git clone git://github.com/FooBarWidget/passenger.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I create a separate &lt;code&gt;/etc/apache2/mods-available/passenger.load&lt;/code&gt; and it contains the following:&lt;/p&gt;


	&lt;p&gt;For 1.0.5:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /usr/local/bin/ruby&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;For the GitHub version (Of course the path will look different depending on where your git clone is):&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;LoadModule passenger_module /home/rlaw/downloads/passenger/ext/apache2/mod_passenger.so
PassengerRoot /home/rlaw/downloads/passenger
PassengerRuby /usr/local/bin/ruby&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I then tell Apache to load the Passenger module:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;a2enmod passenger&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Now, I create a virtual host configuration for one of my Rails app in &lt;code&gt;/etc/apache2/sites-available/dealistic&lt;/code&gt;:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;lt;VirtualHost *:80&amp;gt;
  ServerAdmin webmaster@dealistic.com
  ServerName dealistic.com

  DocumentRoot /home/deploy/apps/dealistic/current/public

  &amp;lt;Directory /home/deploy/apps/dealistic/current/public&amp;gt;
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  &amp;lt;/Directory&amp;gt;

  LogLevel warn
  ErrorLog /var/log/apache2/dealistic/error.log
  CustomLog /var/log/apache2/dealistic/access.log combined
&amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I then restart Apache:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;sudo /etc/init.d/apache2 reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;When you need to restart your application because you have changed some code that Rails does not reload in production, just do:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;touch /home/deploy/apps/dealistic/current/tmp/restart.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I have not tried their &lt;a href="http://www.rubyenterpriseedition.com/"&gt;Ruby Enterprise Edition&lt;/a&gt; yet.  They claim substantial memory and speed improvement at &lt;a href="http://en.oreilly.com/rails2008/public/schedule/detail/4354"&gt;RailsConf 2008&lt;/a&gt;, so it will be interesting to see.&lt;/p&gt;</description>
      <pubDate>Tue, 24 Jun 2008 10:00:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:43311149-3ecb-4bad-b3bc-c7dceca4269b</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/06/24/deploying-your-rails-applications-with-phusion-passenger</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>deploy</category>
      <category>deployment</category>
      <category>apache</category>
      <category>passenger</category>
      <category>phusion</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/65</trackback:ping>
    </item>
    <item>
      <title>Badger Rails Plugin</title>
      <description>&lt;p&gt;&lt;em&gt;(I also posted about this plugin in the &lt;a href="http://intridea.com/2008/6/16/announcing-the-badger-rails-plugin"&gt;Intridea blog&lt;/a&gt; )&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://github.com/rayvinly/badger/tree/master"&gt;Badger&lt;/a&gt; (hosted at &lt;a href="http://github.com/"&gt;GitHub&lt;/a&gt;) is a simple Rails plugin that creates badges.  A site often allows its users to upload a profile image.  A profile image is just that, an image resized to fit in a predefined space to show up in the user&amp;#8217;s profile.&lt;/p&gt;


	&lt;p&gt;With Badger, you can have something prettier &amp;#8211; a badge that shows the user-uploaded image on top of another image that identifies the user as a part of the community.  We have company badges, security badges, so why not web badges to have your users show off his/her affection for your site?&lt;/p&gt;


	&lt;p&gt;Badger works by accepting cropping parameters of the overlay image in a hash (x1, y1, width, height), which is used to crop the overlay image.  It then resizes the cropped image to the size specified by composite_width and composite_height in badger.yml.  Finally, it places the resized image on top of the background image at location specified by composite_x and composite_y in badger.yml.  The resulting image is saved back to either the filesystem or Amazon S3, using attachment_fu.&lt;/p&gt;


	&lt;p&gt;Badger requires the attachment_fu plugin, ImageMagick, and MiniMagick.  Also, the JavaScript Image Cropper UI can be used to obtain the cropping parameters from the users.&lt;/p&gt;


	&lt;p&gt;For example:&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://img.skitch.com/20080415-s2twpkugcjfmpp27fqs42upi7.png" alt="" /&gt;
+
&lt;img src="http://img.skitch.com/20080415-xukti26i4q12bhr8tdxegadsbx.png" alt="" /&gt;
=
&lt;img src="http://img.skitch.com/20080415-g1k6y99fk5fnn4qti76xcyutp8.png" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Here I overlay &lt;span class="caps"&gt;RUBY&lt;/span&gt; on top of &lt;span class="caps"&gt;JAVA&lt;/span&gt; to produce &lt;span class="caps"&gt;I LOVE RUBY&lt;/span&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 23 Jun 2008 10:00:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:b89d8dd8-08ec-4f8a-8f86-684c535d8736</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/06/23/badger-rails-plugin</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>badger</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>plugin</category>
      <category>github</category>
      <category>intridea</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/58</trackback:ping>
    </item>
    <item>
      <title>Back from RailsConf 2008</title>
      <description>&lt;p&gt;Photos posted to my &lt;a href="http://flickr.com/photos/rayvinly/sets/72157605409054629/"&gt;flickr&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 04 Jun 2008 11:31:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:b02ad881-d337-46f2-a8a9-1e6d9ffddeec</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/06/04/back-from-railsconf-2008</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>railsconf</category>
      <category>railsconf2008</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/63</trackback:ping>
    </item>
    <item>
      <title>Attending RailsConf 2008</title>
      <description>&lt;p style="float:right"&gt;&lt;a href="http://conferences.oreilly.com/rails/"&gt;&lt;img src="http://conferences.oreillynet.com/banners/rails/promote/125x125.gif" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I will be attending the &lt;a href="http://railsconf.com"&gt;RailsConf&lt;/a&gt; from 5/29 to 6/1 in Portland with my colleagues from &lt;a href="http://intridea.com"&gt;Intridea&lt;/a&gt;.  It is going to be great to see the whole team there, and attend the different sessions.  I am really excited to meet other Rails enthusiasts and talk about projects we are working on.&lt;/p&gt;


	&lt;p&gt;We will be helping with the Community Project Code-Drive on 5/29 from 10am to 5pm.  Come check us out.&lt;/p&gt;


	&lt;p&gt;Josh Owens and Chris Selmer will also be presenting &lt;a href="http://en.oreilly.com/rails2008/public/schedule/detail/1935"&gt;  Building an app in 48 hours &amp;#8211; A Rails Rumble Case Study&lt;/a&gt; to talk about their fast developments in their participation of the Rails Rumble event.  Josh won first place with &lt;a href="http://tastyplanner.com/"&gt;Tasty Planner&lt;/a&gt; in the event!  Chris participated as a solo team on &lt;a href="http://www.yourpetrecords.com/"&gt;Your Pet Records&lt;/a&gt;.  Come attend their session to see how they developed an app in just 48 short hours!&lt;/p&gt;</description>
      <pubDate>Fri, 23 May 2008 16:29:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:b5694fa0-18f7-4e44-a7d1-ae7728dc9f6f</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/05/23/attending-railsconf-2008</link>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>web2.0</category>
      <category>railsconf</category>
      <category>portland</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/62</trackback:ping>
    </item>
    <item>
      <title>Tricky Git Submodule</title>
      <description>&lt;p&gt;I recently spent a good amount of time figuring out why the &lt;a href="http://www.mbleigh.com/plugins/acts-as-taggable-on-customizable-tagging-for-rails"&gt;acts_as_taggable_on&lt;/a&gt; plugin did not work for me.  I used Git&amp;#8217;s submodule to grab the code fom GitHub.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;gt; git submodule add git://github.com/mbleigh/acts-as-taggable-on.git vendor/plugin/acts-as-taggable-on&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;It seems logical to name my plugin directory with dashes since that&amp;#8217;s what the path suggests, right?  Wrong!  If you do that, it does not work because the plugin expects underscores.  This is probably due to the way Rails finds and loads the plugins, I guess.  Haven&amp;#8217;t had time to really dig deep into that&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Use this instead:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;gt; git submodule add git://github.com/mbleigh/acts-as-taggable-on.git vendor/plugin/acts_as_taggable_on&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I initially didn&amp;#8217;t pay attention to this because before Git, I just used:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;gt; script/plugin install http://svn.intridea.com/svn/public/acts_as_taggable_on/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I did not have to explicitly tell where to put the plugin.  script/plugin is a Rails thing while Git is not.&lt;/p&gt;


	&lt;p&gt;Hopefully anyone who gets tripped up by this in the future will find out this post.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Apr 2008 01:03:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:54d24e33-5043-4f89-a99a-18a5dc77bc62</guid>
      <author>Raymond Law</author>
      <link>http://blog.rayvinly.com/articles/2008/04/29/tricky-git-submodule</link>
      <category>Git</category>
      <category>Ruby on Rails</category>
      <category>Web 2.0</category>
      <category>git</category>
      <category>submodule</category>
      <category>ruby</category>
      <category>rails</category>
      <category>rubyonrails</category>
      <category>plugin</category>
      <trackback:ping>http://blog.rayvinly.com/articles/trackback/61</trackback:ping>
    </item>
  </channel>
</rss>
