<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>RubyJudo - Home</title>
  <id>tag:rubyjudo.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://rubyjudo.com/feed/rss.xml" rel="self" type="application/atom+xml"/>
  <link href="http://rubyjudo.com/" rel="alternate" type="text/html"/>
  <updated>2008-05-03T02:29:31Z</updated>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>ryan</name>
    </author>
    <id>tag:rubyjudo.com,2008-05-03:454</id>
    <published>2008-05-03T02:03:00Z</published>
    <updated>2008-05-03T02:29:31Z</updated>
    <category term="rubyonrails topfunky peepcode"/>
    <link href="http://rubyjudo.com/2008/5/3/interview-on-the-ruby-on-rails-podcast" rel="alternate" type="text/html"/>
    <title>Interview on the Ruby on Rails podcast.</title>
<content type="html">
            &lt;p&gt;The &lt;a href=&quot;http://podcast.rubyonrails.org&quot;&gt;interview&lt;/a&gt; I did with the incredibly gracious and awesome &lt;a href=&quot;http://topfunky.com&quot;&gt;Geoffrey Grosenbach&lt;/a&gt; (of Peepcasts) on the official Ruby on Rails podcast just went up.&lt;/p&gt;


	&lt;p&gt;I talk a little bit about &lt;a href=&quot;http://norbauer.com&quot;&gt;consulting at Norbauer Inc&lt;/a&gt;, a bit about &lt;a href=&quot;http://rubyrags.com&quot;&gt;RubyRags&lt;/a&gt;, and I spend a bit of time kicking social networks in the nuts.&lt;/p&gt;


	&lt;p&gt;Incidentally, I&#8217;m proud to announce that we&#8217;re now selling Peepcode shirts at RubyRags:&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://rubyrags.com&quot;&gt;&lt;img src=&quot;http://rubyrags.com/pictures/0000/0057/peepcode-tshirt.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-28:453</id>
    <published>2008-04-28T20:13:00Z</published>
    <updated>2008-04-28T20:17:47Z</updated>
    <category term="jruby"/>
    <category term="rubinius"/>
    <category term="ruby1.9"/>
    <link href="http://rubyjudo.com/2008/4/28/alternative-ruby-implementations" rel="alternate" type="text/html"/>
    <title>Alternative Ruby Implementations</title>
<content type="html">
            &lt;p&gt;Sorry to just link drop on ya&#8217;ll, but if you haven&#8217;t seen it, Charles Nutter of the JRuby team has published a writeup titled &lt;a href=&quot;http://headius.blogspot.com/2008/04/promise-and-peril-for-alternative-ruby.html&quot;&gt;Promise and Perils for Alternative Ruby Impls&lt;/a&gt;. It provides an excellent analysis of 1.8, 1.9, JRuby, Rubinius, and the other Ruby interpreter projects out there, if only slightly biased for JRuby (understandably). If you have an interest in the future of Ruby, it is a recommended read.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-19:445</id>
    <published>2008-04-19T04:13:00Z</published>
    <updated>2008-04-19T04:16:11Z</updated>
    <link href="http://rubyjudo.com/2008/4/19/rails-2-0-development-finally-meets-web-2-0" rel="alternate" type="text/html"/>
    <title>Rails 2.0 development finally meets Web 2.0</title>
<content type="html">
            &lt;p&gt;I know I am late to the show, but I&#8217;d just like to say it is about time that Rails move off of Trac &#8211; with the move to &lt;a href=&quot;http://weblog.rubyonrails.com/2008/4/15/rails-and-family-on-lighthouse&quot;&gt;Lighthouse&lt;/a&gt; and &lt;a href=&quot;http://weblog.rubyonrails.com/2008/4/11/rails-premieres-on-github&quot;&gt;Github&lt;/a&gt;, Rails development itself is now hosted on awesome Rails-based services. I know such migrations are not easy for such a large project so I just want to say thanks to the Rails team, and nice choices!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-17:442</id>
    <published>2008-04-17T15:15:00Z</published>
    <updated>2008-04-17T18:01:48Z</updated>
    <category term="grapefruit"/>
    <link href="http://rubyjudo.com/2008/4/17/strange-analogy" rel="alternate" type="text/html"/>
    <title>Strange analogy</title>
<content type="html">
            &lt;p&gt;&lt;img src=&quot;http://s3.amazonaws.com/rubyjudo/grapefruit.jpg&quot; /&gt; Creating software is like eating a grapefruit (&lt;a href=&quot;http://xkcd.com/388/&quot;&gt;Randall Munroe&#8217;s favorite fruit&lt;/a&gt;). Sure, you can rush through it and you&#8217;ll get some enjoyment out of the grapefruit bits, but if you take your time and patience, you will get much more out of it. Like all things, you reap what you sow.&lt;/p&gt;


	&lt;p&gt;(Photo via &lt;a href=&quot;http://commons.wikimedia.org/wiki/Image:Grapefruit_-_half.jpg&quot;&gt;Wikimedia&lt;/a&gt;)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-12:435</id>
    <published>2008-04-12T10:05:00Z</published>
    <updated>2008-04-16T15:32:16Z</updated>
    <category term="ebb"/>
    <category term="frameworks"/>
    <category term="http"/>
    <category term="mongrel"/>
    <category term="thin"/>
    <link href="http://rubyjudo.com/2008/4/12/yet-another-ruby-framework-and-http-adapter" rel="alternate" type="text/html"/>
    <title>Yet another Ruby framework and HTTP adapter</title>
<content type="html">
            &lt;p&gt;It&#8217;s an exciting time to be Ruby or Rails developer as there are so many new and exciting things going on &#8211; in fact, it&#8217;s a lot to keep tabs on. Let&#8217;s look at two issues: Ruby web frameworks and &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; adapters.&lt;/p&gt;


	&lt;p&gt;So, web frameworks, some of these you&#8217;ve probably heard of:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.rubyonrails.org&quot;&gt;Ruby on Rails&lt;/a&gt; &#8211; You&#8217;ve probably heard of this one.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://camping.rubyforge.org/&quot;&gt;Camping&lt;/a&gt; has been around for a while, and aims to be tiny and simple &#8211; great when you&#8217;re only building a few pages. Developed by the infamous &lt;a href=&quot;http://whytheluckystiff.net/&quot;&gt;why&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://merbivore.com/&quot;&gt;Merb&lt;/a&gt; was created by &lt;a href=&quot;http://brainspl.at&quot;&gt;Ezra&lt;/a&gt;, which now has many of the core Rails features, but less of the frills. It&#8217;s fast and, &lt;a href=&quot;http://rubyjudo.com/2007/6/6/why-threading-matters&quot;&gt;best of all, its thread-safe&lt;/a&gt;.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;But, oh, there are so many more:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.nitroproject.org/&quot;&gt;Nitro&lt;/a&gt; &#8211; Been around a while now, but development stalled for a year or two.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://rubywaves.com/&quot;&gt;Ruby Waves&lt;/a&gt;, which claims to be highly flexible.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://wuby.org/&quot;&gt;Wuby&lt;/a&gt;, a tiny server+framework, which serves &lt;span class=&quot;caps&quot;&gt;RHTML&lt;/span&gt; files, in a manner similar to &lt;span class=&quot;caps&quot;&gt;PHP&lt;/span&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://sinatrarb.com/&quot;&gt;Sinatra&lt;/a&gt;, a &lt;span class=&quot;caps&quot;&gt;REST&lt;/span&gt;-centric framework which uses a &lt;a href=&quot;http://en.wikipedia.org/wiki/Domain-specific_programming_language&quot;&gt;&lt;span class=&quot;caps&quot;&gt;DSL&lt;/span&gt;&lt;/a&gt; to make life simpler.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://ramaze.net/&quot;&gt;Ramaze&lt;/a&gt;, which is also very flexible, supporting a variety of ORMs, template engines, &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; adapters, etc.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://www.mackframework.com/&quot;&gt;Mack&lt;/a&gt; is brand new, claiming to be highly modular and agile, as well as speedy. Their site is down but their &lt;a href=&quot;http://api.mackframework.com/&quot;&gt;documentation&lt;/a&gt; is up.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://maveric.rubyforge.org/&quot;&gt;Maveric&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://vintage.devjavu.com/&quot;&gt;Vintage&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://cerise.rubyforge.org/&quot;&gt;Cerise&lt;/a&gt; &#8211; Not recently maintained (2006).&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://enigo.com/projects/iowa/index.html&quot;&gt;&lt;span class=&quot;caps&quot;&gt;IOWA&lt;/span&gt;&lt;/a&gt; &#8211; Not recently maintained (2004).&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;I&#8217;m sure I still missed some. Moving on the &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; adapters &#8211; these are the likes of WEBrick and Mongrel. It&#8217;s good to keep up on these as they can often mean a boost in performance for your app, often regardless of your framework, thanks to the common interface provided by the &lt;a href=&quot;http://rack.rubyforge.org/&quot;&gt;Rack library&lt;/a&gt;.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://ebb.rubyforge.org&quot;&gt;Ebb&lt;/a&gt; is the newest to the show, touting fantastic performance as most of it is written in C. It can be a little tough to set up. It has support for Rails; for other frameworks, you&#8217;ll have to roll your own interface.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://code.macournoyer.com/thin/&quot;&gt;Thin&lt;/a&gt; is quickly becoming the defacto standard (at least until ebb is further along)&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://swiftiply.swiftcore.org/mongrel.html&quot;&gt;Swiftiply and Evented Mongrel&lt;/a&gt; was the first to improve Mongrel&#8217;s performance.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://mongrel.rubyforge.org/&quot;&gt;Mongrel&lt;/a&gt; started it all.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://fuzed.rubyforge.org/&quot;&gt;Fuzed&lt;/a&gt; allows your Rails app to run with &lt;a href=&quot;http://yaws.hyber.org/&quot;&gt;Yaws&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://www.modrails.com/&quot;&gt;Passenger&lt;/a&gt; is &#8220;mod_rails&#8221; for Apache, which could be a big news. They are also working on &lt;a href=&quot;http://www.rubyenterpriseedition.com/&quot;&gt;Ruby Enterprise Edition&lt;/a&gt;, which will be launched soon.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;And you have already learned and adopted &lt;a href=&quot;http://git.or.cz/&quot;&gt;git&lt;/a&gt;, right? Can&#8217;t fall behind the times&#8230;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-08:434</id>
    <published>2008-04-08T07:33:00Z</published>
    <updated>2008-04-08T07:44:27Z</updated>
    <category term="git"/>
    <category term="git-reset"/>
    <category term="git-revert"/>
    <link href="http://rubyjudo.com/2008/4/8/git-revert-reset-a-single-file" rel="alternate" type="text/html"/>
    <title>git: revert (reset) a single file</title>
<content type="html">
            &lt;p&gt;This one is hard to find out there so here it is. If you have an &lt;strong&gt;uncommitted&lt;/strong&gt; change (its only in your working copy) that you wish to revert (in &lt;span class=&quot;caps&quot;&gt;SVN&lt;/span&gt; terms) to the copy in your latest commit, do the following:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;git checkout filename&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This will checkout the file from &lt;span class=&quot;caps&quot;&gt;HEAD&lt;/span&gt;, overwriting your change. This command is also used to checkout branches, and you could happen to have a file with the same name as a branch. All is not lost, you will simply need to type:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;git checkout -- filename&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You can also do this with files from other branches, and such. &lt;code&gt;man git-checkout&lt;/code&gt; has the details.&lt;/p&gt;


	&lt;p&gt;The rest of the Internet will tell you to use &lt;code&gt;git reset --hard&lt;/code&gt;, but this resets &lt;strong&gt;all&lt;/strong&gt; uncommitted changes you&#8217;ve made in your working copy. Type this with care.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-06:433</id>
    <published>2008-04-06T09:09:00Z</published>
    <updated>2008-04-06T09:32:21Z</updated>
    <category term="pack,unpack,obscure"/>
    <link href="http://rubyjudo.com/2008/4/6/generating-access-keys" rel="alternate" type="text/html"/>
    <title>Generating access keys</title>
<content type="html">
            &lt;p&gt;This is a somewhat obscure but very efficient way to generate access keys. Look ma, no loops!&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt;.new(&lt;span class=&quot;i&quot;&gt;16&lt;/span&gt;) { rand(&lt;span class=&quot;i&quot;&gt;256&lt;/span&gt;) }.pack(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).unpack(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;H*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).first&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This will generate a 32-length key, like &lt;code&gt;b3512f4972d314da94380e1a70e6814a&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;This may look strange unless you&#8217;ve used &lt;a href=&quot;http://www.ruby-doc.org/core/classes/Array.src/M002173.html&quot;&gt;Array.new&lt;/a&gt;, &lt;a href=&quot;http://www.ruby-doc.org/core/classes/Array.src/M002245.html&quot;&gt;Array#pack&lt;/a&gt;, and &lt;a href=&quot;http://www.ruby-doc.org/core/classes/String.src/M000775.html&quot;&gt;String#unpack&lt;/a&gt; many times in the past. In the gaming world, I tended to deal with binary data on a regular basis, so &lt;code&gt;pack&lt;/code&gt; and &lt;code&gt;unpack&lt;/code&gt; became commonly-used weapons in my repertoire. They allow you to operate on binary data &#8211; pack creates binary data (stored in a regular string) from an array of Ruby objects, and unpack takes binary data and creates Ruby objects in an array. If you think about it, you are dealing with binary data here: you&#8217;re creating a random 128-bit (16-byte) key which you want in hex-format, so using pack and unpack do make sense. The parameters (&lt;code&gt;C*&lt;/code&gt; and &lt;code&gt;H*&lt;/code&gt;, in this case), are formats which indicate how to process the data.&lt;/p&gt;


	&lt;p&gt;Very cool cats may want to create more-compact Base64 keys. Be aware that Base64 is case sensitive:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;[ &lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt;.new(&lt;span class=&quot;i&quot;&gt;16&lt;/span&gt;) { rand(&lt;span class=&quot;i&quot;&gt;256&lt;/span&gt;) }.pack(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;C*&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) ].pack(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).chop&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This generates keys like &lt;code&gt;Gv5CJ68ptOZKVRvAFdzGpg==&lt;/code&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>ryan</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-03:432</id>
    <published>2008-04-03T14:24:00Z</published>
    <updated>2008-04-03T14:25:25Z</updated>
    <category term="rubyrags"/>
    <link href="http://rubyjudo.com/2008/4/3/new-rubyrags-shirt" rel="alternate" type="text/html"/>
    <title>New RubyRags shirt</title>
<content type="html">
            &lt;p&gt;I&#8217;m excited to announce a new fantastical RubyRags design: &lt;em&gt;The Ruby City&lt;/em&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;http://rubyrags.com/pictures/0000/0053/city.png?1207231422&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;It&#8217;ll be in stock and shipping in mid- to late April.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://rubyrags.com/products/6&quot;&gt;You can join the waiting list or read more at the RubyRags site&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>ryan</name>
    </author>
    <id>tag:rubyjudo.com,2008-04-01:431</id>
    <published>2008-04-01T06:21:00Z</published>
    <updated>2008-04-01T06:21:29Z</updated>
    <category term="startrek rubyconf ruby"/>
    <link href="http://rubyjudo.com/2008/4/1/ruby-meets-star-trek" rel="alternate" type="text/html"/>
    <title>Ruby Meets Star Trek</title>
<content type="html">
            &lt;p&gt;This isn&#8217;t funny.&lt;/p&gt;


	&lt;p&gt;But somehow I&#8217;m happy to know such a thing exists.&lt;/p&gt;


&amp;lt;object height=&quot;355&quot; width=&quot;425&quot;&gt;&amp;lt;param&gt;&amp;lt;/param&gt;&amp;lt;param&gt;&amp;lt;/param&gt;&amp;lt;embed src=&quot;http://www.youtube.com/v/mQoVqY2mWus&amp;amp;#38;hl=en&quot; height=&quot;355&quot; width=&quot;425&quot;&gt;&amp;lt;/embed&gt;&amp;lt;/object&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>ryan</name>
    </author>
    <id>tag:rubyjudo.com,2008-02-01:420</id>
    <published>2008-02-01T22:50:00Z</published>
    <updated>2008-02-02T00:04:19Z</updated>
    <category term="railsconf"/>
    <link href="http://rubyjudo.com/2008/2/1/cabooseconf" rel="alternate" type="text/html"/>
    <title>CabooseConf!</title>
<content type="html">
            &lt;p&gt;One of my favorite Rails bloggers has just announced what is the only good news I&#8217;ve heard thus far about RailsConf 2008.  I&#8217;ll let Courtenay put it in &lt;a href=&quot;http://www.caboo.se/articles/2008/1/30/caboose-conf-2008&quot;&gt;his own words&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote&gt;
In May, if you don&#8217;t want to cough up almost &lt;strong&gt;a thousand dollars&lt;/strong&gt; to go learn things you already know, but want to come to Portland to network with skilled Rails coders from all over the world, instead of hanging out in the lobby at the Lloyd Center like I did last year, come to Caboose Conf.
&lt;/blockquote&gt;

	&lt;p&gt;I completely agree: the conference last year was way overpriced and the content utterly unenlightening.  I actually enjoyed RailsConf 1, but I found the O&#8217;Reilly version much less fun.  It turned into an enterprisey schmooze-fest, with all us small-time folks wandering around looking to make individual connections in the vestibule.  I&#8217;m not opposed to a bit of business, but I certainly am when it comes at the expense of authenticity, aesthetics, and social experience&#8212;which it certainly did last year.&lt;/p&gt;


	&lt;p&gt;My &lt;a href=&quot;http://norbauer.com&quot;&gt;Rails consultancy&lt;/a&gt; was already scheming a &lt;a href=&quot;http://rubyrags.com&quot;&gt;RubyRags&lt;/a&gt; gathering at the super-swank &lt;a href=&quot;http://www.jupiterhotel.com&quot;&gt;Jupiter Hotel&lt;/a&gt;, which we were planning to bill as a sort of unRailsconf Railsconf party.  (Sign up on our &lt;a href=&quot;http://rubyrags.com/newsletter&quot;&gt;announcement list&lt;/a&gt; to get an invite and details in the next few weeks.)  I&#8217;m guessing the folks interested in Cabooseconf are going to be fairly like-minded to the RubyRags crowd, so hopefully we&#8217;ll find some way to dovetail our events.&lt;/p&gt;


	&lt;p&gt;I&#8217;ll keep you posted.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2008-01-23:417</id>
    <published>2008-01-23T14:18:00Z</published>
    <updated>2008-01-23T19:53:04Z</updated>
    <category term="activerecord"/>
    <category term="mysql"/>
    <category term="performance"/>
    <link href="http://rubyjudo.com/2008/1/23/activerecord-performance-vs-self-executing-statements" rel="alternate" type="text/html"/>
    <title>ActiveRecord performance vs self-executing statements</title>
<content type="html">
            &lt;p&gt;One of the battles of Rails development is dealing with performance problems. If you have a database-intensive operation, using ActiveRecord can be an incredible slowdown to your system. You will know this because the &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt; usage of your Rails app during the operation will be pegged at 100% (this means your server is busy running Ruby code), while your MySQL daemon will be coasting along at 5% or less.&lt;/p&gt;


	&lt;p&gt;What I have found is that, for an &lt;span class=&quot;caps&quot;&gt;INSERT&lt;/span&gt; query, directly executing the query using ActiveRecord::Base.connection.execute (alternately, use the model name of the table you&#8217;re using, e.g., Post.connection.execute) will yield roughly a 10 times speedup in performance versus using create!. Consider the following steps that Rails will execute to run create!:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Initialize and build a new ActiveRecord model from the data you passed to create!&lt;/li&gt;
		&lt;li&gt;Validate the model using any validations you have placed on it&lt;/li&gt;
		&lt;li&gt;Before and after each step, check to see if there are any callbacks, and if so, execute them&lt;/li&gt;
		&lt;li&gt;Build the query using several levels of abstraction, passing through many functions, etc.&lt;/li&gt;
		&lt;li&gt;Hundreds of calls to #read_attribute to read the data out of the ActiveRecord model.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Compare this to what Ruby has to do if you create the query yourself:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;One call to sprintf.&lt;/li&gt;
		&lt;li&gt;One call to ActiveRecord::Base.connection.execute, which then invokes the Mysql adapter.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Be wary, of course, that you get none of the benefits of ActiveRecord: no validations, no callbacks, no quoting, etc. I do not recommend doing this if the data is coming from the end-user unless it is carefully validated and escaped first. Note also that you will not get the resulting ActiveRecord objects.&lt;/p&gt;


	&lt;p&gt;To summarize, if you need to create 100 objects, change this:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; d &lt;span class=&quot;r&quot;&gt;in&lt;/span&gt; data&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;co&quot;&gt;Something&lt;/span&gt;.create!(d)&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;To this:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; d &lt;span class=&quot;r&quot;&gt;in&lt;/span&gt; data&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;co&quot;&gt;Something&lt;/span&gt;.connection.execute(sprintf(&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;INSERT INTO somethings (a, b, c, d) VALUES (%d, %d, %d, %d)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;    d[&lt;span class=&quot;sy&quot;&gt;:a&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:b&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:c&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:d&lt;/span&gt;]))&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;h2&gt;Taking It Further: Multi-inserts&lt;/h2&gt;


	&lt;p&gt;Pundits may realize that there is even a better way to do this: MySQL supports inserting multiple records at once, known as a multi-insert or extended insert. This can yield a 2x to 5x increase above executing the queries singly, depending on the speed of your database. Using the previous code as a base, you could change it to a multi-insert by doing the following:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;values = data.collect &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |d|&lt;tt&gt;
&lt;/tt&gt;  sprintf(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;(%d, %d, %d, %d)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, d[&lt;span class=&quot;sy&quot;&gt;:a&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:b&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:c&lt;/span&gt;], d[&lt;span class=&quot;sy&quot;&gt;:d&lt;/span&gt;])&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;Something&lt;/span&gt;.connection.execute(&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;INSERT INTO somethings (a, b, c, d) VALUES &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; + values.join(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;))&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>kit</name>
    </author>
    <id>tag:rubyjudo.com,2008-01-13:413</id>
    <published>2008-01-13T06:07:00Z</published>
    <updated>2008-01-13T06:14:06Z</updated>
    <category term="deployment"/>
    <category term="lighttpd"/>
    <link href="http://rubyjudo.com/2008/1/13/lighttpd-1-5-0-vaporware" rel="alternate" type="text/html"/>
    <title>lighttpd 1.5.0 = vaporware?</title>
<content type="html">
            &lt;p&gt;lighttpd has seen constant development and is currently at 1.4.18, so the project seems to be healthy.&lt;/p&gt;


	&lt;p&gt;lighttpd 1.4.0 was released in August 2005: about 2.5 years ago and according to lighttpd&#8217;s trac, &lt;a href=&quot;http://trac.lighttpd.net/trac/milestone/1.5.0&quot;&gt;1.5.0 is still only 29% complete&lt;/a&gt; (who knows how accurate this is).&lt;/p&gt;


	&lt;p&gt;Is anyone still holding their breath for 1.5.0 and mod_proxy_core?  Is anyone out there actually counting on deploying their Rails apps on lighttpd at any point?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2007-12-09:370</id>
    <published>2007-12-09T23:16:00Z</published>
    <updated>2007-12-09T23:23:15Z</updated>
    <category term="ruby1.9 rails2.0"/>
    <link href="http://rubyjudo.com/2007/12/9/ruby-1-9-and-rails-2-0" rel="alternate" type="text/html"/>
    <title>Ruby 1.9 and Rails 2.0</title>
<content type="html">
            &lt;p&gt;On the &lt;a href=&quot;http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done&quot;&gt;Ruby 2.0 announcement thread&lt;/a&gt;, &lt;a href=&quot;http://www.rubyonrails.org/core&quot;&gt;Marcel&lt;/a&gt; &lt;a href=&quot;http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done#comment-18200&quot;&gt;filled us in&lt;/a&gt; on Ruby 1.9 compatibility work in Rails 2.0:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;A lot of exploratory work and updates have already been made for 1.9 compatibility, mostly by Jeremy Kemper. So Rails 2.0 isn’t that far off from being 1.9 ready.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Hopefully this means that we will see a Ruby 1.9 compatible version of Rails a few weeks after its release.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2007-12-04:367</id>
    <published>2007-12-04T00:31:00Z</published>
    <updated>2007-12-04T00:44:19Z</updated>
    <category term="rails,gettext,errors"/>
    <link href="http://rubyjudo.com/2007/12/4/script-console-gives-the-best-error-messages" rel="alternate" type="text/html"/>
    <title>script/console gives the best error messages</title>
<content type="html">
            &lt;p&gt;I sometimes get bizarre startup error messages from &lt;code&gt;script/server&lt;/code&gt;. The answer? Always check &lt;code&gt;script/console&lt;/code&gt; if you&#8217;re getting something odd.&lt;/p&gt;


	&lt;p&gt;Here I am trying to use &lt;code&gt;script/server&lt;/code&gt;:&lt;/p&gt;


&lt;blockquote&gt;&lt;pre&gt;
rails-1.2.3/lib/commands/servers/mongrel.rb:18:
  undefined method `options' for []:Array (NoMethodError)
&lt;/pre&gt;&lt;/blockquote&gt;

	&lt;p&gt;Huh? Let&#8217;s try &lt;code&gt;script/server webrick&lt;/code&gt;:&lt;/p&gt;


&lt;blockquote&gt;&lt;pre&gt;
vendor/plugins/loaded_plugins/lib/loaded_plugins.rb:21:
  in `&amp;lt;&amp;lt;': can't modify frozen array (TypeError)
&lt;/pre&gt;&lt;/blockquote&gt;

	&lt;p&gt;Still no good&#8230; let&#8217;s try &lt;code&gt;script/console&lt;/code&gt;:&lt;/p&gt;


&lt;blockquote&gt;&lt;pre&gt;
ruby/vendor_ruby/1.8/rubygems.rb:251:
  in `report_activate_error': 
  Could not find RubyGem gettext (&amp;gt;= 0.0.0) (Gem::LoadError)
&lt;/pre&gt;&lt;/blockquote&gt;

	&lt;p&gt;Oh, just install the gettext gem!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://rubyjudo.com/">
    <author>
      <name>jd</name>
    </author>
    <id>tag:rubyjudo.com,2007-11-30:335</id>
    <published>2007-11-30T06:38:00Z</published>
    <updated>2007-12-03T05:27:08Z</updated>
    <category term="ruby1.9"/>
    <link href="http://rubyjudo.com/2007/11/30/ruby-1-9-for-christmas-we-hope" rel="alternate" type="text/html"/>
    <title>Ruby 1.9 for Christmas (we hope)</title>
<content type="html">
            &lt;p&gt;This could possibly be one of the best Christmas&#8217;s ever, as Ruby 1.9 is &lt;a href=&quot;http://www.rubyinside.com/how-to-start-playing-with-ruby-19-right-now-661.html&quot;&gt;slated to be released in the near future&lt;/a&gt; with a host of &lt;a href=&quot;http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9&quot;&gt;new features&lt;/a&gt; and &lt;a href=&quot;http://on-ruby.blogspot.com/2007/04/some-real-world-performance-notes-on.html&quot;&gt;performance improvements&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The performance improvements are extremely impressive and will be a huge boost to Rails applications &#8211; I am really looking forward to them. Not only will your Rails apps load faster, but they&#8217;ll take up less &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt; resources on your system, which means less servers for large applications, meaning big cost savings and less headaches. For smaller apps, your server will be able to do more before you need to add a second, or can host more apps.&lt;/p&gt;


	&lt;p&gt;It won&#8217;t be an easy migration though: Ruby 1.9&#8217;s features include many things that will break the Rails framework and Rails apps. Here are just a few that caught my eye:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;#send&lt;/code&gt; will no longer ignores visibility (i.e. private methods), you must use &lt;code&gt;#send!&lt;/code&gt;. (Of course, you could re-define &lt;code&gt;#send&lt;/code&gt; to call &lt;code&gt;#send!&lt;/code&gt;.)&lt;/li&gt;
		&lt;li&gt;Class variables are no longer inherited.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;Hash#to_s&lt;/code&gt; returns something more intelligible, but breaks anyone relying on the current behavior of mashing all the key-value pairs together.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;Hash#each&lt;/code&gt; now passes a two-element array.&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;?c&lt;/code&gt; no longer returns the &lt;span class=&quot;caps&quot;&gt;ASCII&lt;/span&gt; value for &lt;code&gt;c&lt;/code&gt;, but instead the single-byte string &lt;code&gt;&quot;c&quot;&lt;/code&gt; (you must use &lt;code&gt;String#ord&lt;/code&gt; to get the &lt;span class=&quot;caps&quot;&gt;ASCII&lt;/span&gt; value). Behavior for &lt;code&gt;String#[]&lt;/code&gt; and &lt;code&gt;String#[]=&lt;/code&gt; changed similarly, so &lt;code&gt;&quot;foo&quot;[1] == ?o&lt;/code&gt; will still return &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
		&lt;li&gt;String is no longer an Enumerable, so &lt;code&gt;String#each&lt;/code&gt; has been removed (use &lt;code&gt;String#each_char&lt;/code&gt; instead).&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;But, there are many, many benefits. A lot of the improvements Rails made to Ruby through its &#8220;core extensions&#8221; library have landed in Ruby 1.9 (my favorite: the &lt;code&gt;Symbol#to_proc&lt;/code&gt; implementation is in). Rails 1.9 has real character encoding support, more meta-programming methods, and plenty of other cool wizardry. Check out those &lt;a href=&quot;http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9&quot;&gt;new features&lt;/a&gt; for yourself.&lt;/p&gt;
          </content>  </entry>
</feed>
