<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lab Notes - H</title>
	<atom:link href="http://labnotesh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://labnotesh.wordpress.com</link>
	<description>'Nuff with the lol-catz</description>
	<lastBuildDate>Wed, 26 Aug 2009 12:18:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='labnotesh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/db3e253f85d58c972a168314c5d68ec9?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Lab Notes - H</title>
		<link>http://labnotesh.wordpress.com</link>
	</image>
			<item>
		<title>Attach non image files in Rails with paperclip</title>
		<link>http://labnotesh.wordpress.com/2009/05/19/attach-non-image-files-in-rails-with-paperclip/</link>
		<comments>http://labnotesh.wordpress.com/2009/05/19/attach-non-image-files-in-rails-with-paperclip/#comments</comments>
		<pubDate>Tue, 19 May 2009 21:40:10 +0000</pubDate>
		<dc:creator>H</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://labnotesh.wordpress.com/?p=113</guid>
		<description><![CDATA[Content moved to http://awesomeful.net/posts/33-attach-non-image-files-in-rails-with-paperclip
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=113&subd=labnotesh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Content moved to <a href="http://awesomeful.net/posts/33-attach-non-image-files-in-rails-with-paperclip">http://awesomeful.net/posts/33-attach-non-image-files-in-rails-with-paperclip</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/labnotesh.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/labnotesh.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/labnotesh.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/labnotesh.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/labnotesh.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/labnotesh.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/labnotesh.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/labnotesh.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/labnotesh.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/labnotesh.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=113&subd=labnotesh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://labnotesh.wordpress.com/2009/05/19/attach-non-image-files-in-rails-with-paperclip/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">H</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiling Ruby 1.9 with GCC 4.4</title>
		<link>http://labnotesh.wordpress.com/2009/04/28/compiling-ruby-19-with-gcc-4/</link>
		<comments>http://labnotesh.wordpress.com/2009/04/28/compiling-ruby-19-with-gcc-4/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 14:54:18 +0000</pubDate>
		<dc:creator>H</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[ruby19]]></category>

		<guid isPermaLink="false">http://labnotesh.wordpress.com/?p=71</guid>
		<description><![CDATA[Got the 1.9 pickaxe, so it&#8217;s definitely time to get Ruby 1.9 installed alongside 1.8. It turns out that if you try to build Ruby 1.9 with GCC 4.4 by means of the typical ./configure; make; sudo make install, you will hit a wall on the make step. I&#8217;m running into this while evaluating Fedora11 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=71&subd=labnotesh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Got the 1.9 pickaxe, so it&#8217;s definitely time to get Ruby 1.9 installed alongside 1.8. It turns out that if you try to build Ruby 1.9 with GCC 4.4 by means of the typical ./configure; make; sudo make install, you will hit a wall on the <strong>make</strong> step. I&#8217;m running into this while evaluating Fedora11 snap1, still in beta. The issue is that GCC 4.4 introduces a few changes that will impede ruby 1.9 from compiling without some minor adjustments.</p>
<p>These are the steps to get going:<br />
1. Download, verify and unpack Ruby 1.9.<br />
<code>$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz<br />
$ md5sum ruby-1.9.1-p0.tar.gz<br />
50e4f381ce68c6de72bace6d75f0135b  ruby-1.9.1-p0.tar.gz #verify that hash matches<br />
$ tar xvf ruby-1.9.1-p0.tar.gz<br />
$ cd ruby-1.9.1-p0</code><br />
At this point, we have verified and extracted the ruby 1.9 source code. Go ahead and create your platform&#8217;s compile configuration. There are many flags you can pass. To see them all, type ./configure &#8211;help. I&#8217;ve chosen to keep the libraries in their default locations, and suffix the binaries with &#8216;19&#8242; (leaving your 1.8 ruby installation intact). Some folks prefer to install it on a completely different path to avoid this very issue, by using the &#8211;prefix-path flag instead. That&#8217;s up to you.<br />
<code>./configure --program-suffix=19 --disable-pthread</code><br />
At this point, you may be tempted to type &#8220;make&#8221;. If you do, you&#8217;ll get the following error:<br />
<code>
<pre>--snip--
cont.c:90:6: error: #elif with no expression
cont.c:270:6: error: #elif with no expression
cont.c:317:6: error: #elif with no expression
make: *** [cont.o] Error 1
</pre>
<p></code><br />
The resolution is to <strong>edit the cont.c</strong> file to go on. Open it up, and <strong>change the lines 90,  270 and 317 from #elif to #else</strong>.</p>
<p>Now, carry on as usual:<br />
<code>$ make<br />
$ make test #make sure everything's sane<br />
$ sudo make install #or su -, or whatever it is you kids use to gain admin privileges these days</code><br />
You&#8217;re done. irb will open up the console on ruby 1.8, and irb19 will open it in ruby 1.9. Similarly, point your scripts to the ruby19 binary instead of ruby.</p>
<p>You can now try out some of the new ruby 1.9 features in irb19:<br />
<code>$irb19<br />
irb(main):001:0&gt; [1,2].inject(:+) #new injections<br />
=&gt; 3<br />
irb(main):002:0&gt; {a: 'a_val', b: 'b_val'} #new hash synthax<br />
=&gt; {:a=&gt;"a_val", :b=&gt;"b_val"}<br />
irb(main):003:0&gt; p = -&gt; a,b,c {a+b+c} #lambda shorthand<br />
=&gt; #<br />
irb(main):004:0&gt; Time.now.tuesday?<br />
=&gt; true<br />
irb(main):005:0&gt; beta_string = 'ß' #utf-8 strings<br />
=&gt; "ß"<br />
irb(main):006:0&gt; π = 3.14 # and variables<br />
=&gt; 3.14<br />
irb(main):007:0&gt; π * 5<br />
=&gt; 15.7</code></p>
<p>Now, let&#8217;s see what the fuzz is all about. I tried running the the full <a href="http://github.com/acangiano/ruby-benchmark-suite/tree/master">ruby benchmark suite</a>, but I got a nasty kernel panic:<code>Apr 27 23:03:45 hgnux kernel: Critical temperature reached (95 C), shutting down.</code>Guess I need a laptop that sucks less to run it. This isn&#8217;t over though: I&#8217;ll stick my laptop in the freezer if I have to, just to run the full benchmark suite.</p>
<p>Instead, let&#8217;s run and benchmark the most inefficient piece of crap on both versions of ruby. Recursion will do the trick. Let&#8217;s calculate factorials and fibonaccis left and right. Save this script somewhere:<br />
<code>
<pre>#recursion.rb
require 'benchmark'
include Benchmark
def fact(n)
  n == 1 ? 1 : n*fact(n-1)
end

def fib(n)
  if n == 0 || n == 1
    n
  else
    fib(n-1) + fib(n-2)
  end
end

puts "Ruby #{RUBY_VERSION} patch #{RUBY_PATCHLEVEL}"

bm do |r|
  r.report do
    (1..35).each do |n|
      fact(n)
      fib(n)
    end
  end
end</pre>
<p></code></p>
<p>Now, invoke it with both your ruby and your ruby19 binaries:<br />
<div id="attachment_88" class="wp-caption alignleft" style="width: 100px"><a href="http://labnotesh.files.wordpress.com/2009/04/comparison.png"><img src="http://labnotesh.files.wordpress.com/2009/04/comparison.png?w=90&#038;h=150" alt="Ruby 1.8 vs. Ruby 1.9 running recursion.rb" title="vmplots" width="90" height="150" class="size-thumbnail wp-image-88" /></a><p class="wp-caption-text">Ruby 1.8 vs. Ruby 1.9 running recursion.rb</p></div><br />
<code>
<pre>$ ruby recursion.rb
Ruby 1.8.6 patch 287
      user     system      total        real
155.320000  45.950000 201.270000 (229.181959)</pre>
<p></code><br />
<code>
<pre>$ ruby19 recursion.rb
Ruby 1.9.1 patch 0
      user     system      total        real
 16.030000   0.100000  16.130000 ( 16.852891)</pre>
<p></code></p>
<p>Sweet! I&#8217;ve also included the results of vmstat + vmplot of these runs. Most impressive is the minimized number of system interrupts on the ruby 1.9 version.</p>
<p>References:<br />
Ruby downloads: <a href="http://www.ruby-lang.org/en/downloads/">http://www.ruby-lang.org/en/downloads/</a><br />
GCC 4.4 porting notes: <a href="http://gcc.gnu.org/gcc-4.4/porting_to.html">http://gcc.gnu.org/gcc-4.4/porting_to.html</a><br />
Extended vmplot: <a href="http://ronaldbradford.com/blog/extending-vmplot-2009-03-31/">http://ronaldbradford.com/blog/extending-vmplot-2009-03-31/</a><br />
Ruby benchmark suite: <a href="http://github.com/acangiano/ruby-benchmark-suite/tree/master">http://github.com/acangiano/ruby-benchmark-suite/tree/master</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/labnotesh.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/labnotesh.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/labnotesh.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/labnotesh.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/labnotesh.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/labnotesh.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/labnotesh.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/labnotesh.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/labnotesh.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/labnotesh.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=71&subd=labnotesh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://labnotesh.wordpress.com/2009/04/28/compiling-ruby-19-with-gcc-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">H</media:title>
		</media:content>

		<media:content url="http://labnotesh.files.wordpress.com/2009/04/comparison.png?w=90" medium="image">
			<media:title type="html">vmplots</media:title>
		</media:content>
	</item>
		<item>
		<title>Really silly percentage calculation in Ruby</title>
		<link>http://labnotesh.wordpress.com/2009/03/22/really-silly-percentage-calculation-in-ruby/</link>
		<comments>http://labnotesh.wordpress.com/2009/03/22/really-silly-percentage-calculation-in-ruby/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 18:56:07 +0000</pubDate>
		<dc:creator>H</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[metaprogramming]]></category>

		<guid isPermaLink="false">http://labnotesh.wordpress.com/?p=62</guid>
		<description><![CDATA[Content moved to http://awesomeful.net/posts/32-really-silly-percentage-calculation-in-ruby
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=62&subd=labnotesh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Content moved to <a href="http://awesomeful.net/posts/32-really-silly-percentage-calculation-in-ruby">http://awesomeful.net/posts/32-really-silly-percentage-calculation-in-ruby</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/labnotesh.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/labnotesh.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/labnotesh.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/labnotesh.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/labnotesh.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/labnotesh.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/labnotesh.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/labnotesh.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/labnotesh.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/labnotesh.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=62&subd=labnotesh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://labnotesh.wordpress.com/2009/03/22/really-silly-percentage-calculation-in-ruby/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">H</media:title>
		</media:content>
	</item>
		<item>
		<title>Upgrade to Rails 2.2 on Windows</title>
		<link>http://labnotesh.wordpress.com/2009/01/17/upgrade-to-rails-22-on-windows/</link>
		<comments>http://labnotesh.wordpress.com/2009/01/17/upgrade-to-rails-22-on-windows/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 02:18:32 +0000</pubDate>
		<dc:creator>H</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://labnotesh.wordpress.com/?p=47</guid>
		<description><![CDATA[A glimpse at the bottom of the Rails 2.2 release notes show that Rails 2.2 require RubyGems version 1.3.1. 
After failing to simply gem update &#8211;system, try the following:

&#62; gem install rubygems-update
&#62; cd c:\ruby\lib\ruby\gems\1.8\gems\rubygems-update-1.3.1
&#62; ruby install.rb

This will successfully update RubyGems, and you should finally be at:

&#62; gem -v
1.3.1

Now, we can simply do

&#62; gem install rails
Successfully [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=47&subd=labnotesh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A glimpse at the bottom of the <a href="http://weblog.rubyonrails.org/2008/11/21/rails-2-2-i18n-http-validators-thread-safety-jruby-1-9-compatibility-docs">Rails 2.2 release notes</a> show that Rails 2.2 require RubyGems version 1.3.1. </p>
<p>After failing to simply gem update &#8211;system, try the following:</p>
<p><code><br />
&gt; gem install rubygems-update<br />
&gt; cd c:\ruby\lib\ruby\gems\1.8\gems\rubygems-update-1.3.1<br />
&gt; ruby install.rb<br />
</code></p>
<p>This will successfully update RubyGems, and you should finally be at:</p>
<p><code><br />
&gt; gem -v<br />
1.3.1<br />
</code></p>
<p>Now, we can simply do</p>
<p><code><br />
&gt; gem install rails<br />
Successfully installed activesupport-2.2.2<br />
Successfully installed activerecord-2.2.2<br />
Successfully installed actionpack-2.2.2<br />
Successfully installed actionmailer-2.2.2<br />
Successfully installed activeresource-2.2.2<br />
Successfully installed rails-2.2.2<br />
6 gems installed<br />
Installing ri documentation for activesupport-2.2.2...<br />
Installing ri documentation for activerecord-2.2.2...<br />
Installing ri documentation for actionpack-2.2.2...<br />
Installing ri documentation for actionmailer-2.2.2...<br />
Installing ri documentation for activeresource-2.2.2...<br />
Installing RDoc documentation for activesupport-2.2.2...<br />
Installing RDoc documentation for activerecord-2.2.2...<br />
Installing RDoc documentation for actionpack-2.2.2...<br />
Installing RDoc documentation for actionmailer-2.2.2...<br />
Installing RDoc documentation for activeresource-2.2.2...<br />
</code></p>
<p>So far so good. Now, if you froze an earlier rails version in your app, setting it free is as simple as:</p>
<p><code><br />
rake rails:unfreeze<br />
</code></p>
<p>At this point, update your config/environment.rb to rails version 2.2.2, and then run:</p>
<p><code><br />
&gt;rake rails:freeze:gems<br />
(in C:/code/app)<br />
Freezing to the gems for Rails 2.2.2<br />
rm -rf vendor/rails<br />
mkdir -p vendor/rails<br />
cd vendor/rails<br />
Unpacked gem: 'C:/code/app/vendor/rails/activesupport-2.2.2'<br />
mv activesupport-2.2.2 activesupport<br />
Unpacked gem: 'C:/code/app/vendor/rails/activerecord-2.2.2'<br />
mv activerecord-2.2.2 activerecord<br />
Unpacked gem: 'C:/code/app/vendor/rails/actionpack-2.2.2'<br />
mv actionpack-2.2.2 actionpack<br />
Unpacked gem: 'C:/code/app/vendor/rails/actionmailer-2.2.2'<br />
mv actionmailer-2.2.2 actionmailer<br />
Unpacked gem: 'C:/code/app/vendor/rails/activeresource-2.2.2'<br />
mv activeresource-2.2.2 activeresource<br />
Unpacked gem: 'C:/code/app/vendor/rails/rails-2.2.2'<br />
cd -<br />
</code></p>
<p>Now run your tests suite. You do have tests. You do.</p>
<p>Bonus: If you are stuck on windows, do yourself a favor and use <a href="http://sourceforge.net/projects/console/">console2</a> for a half decent command prompt. Easier to select/paiste text, resize the window (no full screen (!!!)), tabs, and other goodies.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/labnotesh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/labnotesh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/labnotesh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/labnotesh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/labnotesh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/labnotesh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/labnotesh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/labnotesh.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/labnotesh.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/labnotesh.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=47&subd=labnotesh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://labnotesh.wordpress.com/2009/01/17/upgrade-to-rails-22-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">H</media:title>
		</media:content>
	</item>
		<item>
		<title>Vim for Rails development</title>
		<link>http://labnotesh.wordpress.com/2008/12/23/vim-for-rails-development/</link>
		<comments>http://labnotesh.wordpress.com/2008/12/23/vim-for-rails-development/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 05:01:18 +0000</pubDate>
		<dc:creator>H</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://labnotesh.wordpress.com/?p=35</guid>
		<description><![CDATA[UPDATE: This configuration, while valid, is pretty obsolete. I recommend you just grab my config from github at http://github.com/hgimenez/vimfiles/tree/master which I update more often.
I&#8217;ve been using Vim for a while for all ruby and rails development. Vim is a fantastic cross platform text editor, and the more you use it, the more you realize how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=35&subd=labnotesh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>UPDATE: This configuration, while valid, is pretty obsolete. I recommend you just grab my config from github at <a href="http://github.com/hgimenez/vimfiles/tree/master">http://github.com/hgimenez/vimfiles/tree/master</a> which I update more often.</strong></p>
<p>I&#8217;ve been using Vim for a while for all ruby and rails development. Vim is a fantastic cross platform text editor, and the more you use it, the more you realize how efficient it is.<br />
<div id="attachment_39" class="wp-caption alignright" style="width: 138px"><a href="http://labnotesh.files.wordpress.com/2008/12/gvim-windows.png"><img src="http://labnotesh.files.wordpress.com/2008/12/gvim-windows.png?w=128&#038;h=93" alt="vim screenshot on windows" title="gvim-windows" width="128" height="93" class="size-thumbnail wp-image-39" /></a><p class="wp-caption-text">vim screenshot on windows</p></div></p>
<p>But you won&#8217;t get too far with the default vim installation. Here&#8217;s a few settings and plugins that take the experience from great to superb.</p>
<p>Starting with the plugins:</p>
<ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=39">matchit.vim</a>: Press % to jump between parenthesis, brackets, html tags, you name it!</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1984">fuzzyfinder</a> and <a href="http://github.com/jamis/fuzzyfinder_textmate/tree/master">fuzzyfinder_textmate</a>: This duo make finding files in your project a snap, making plugins like Project and NERDTree a waist of time in my opinion (there&#8217;s always :E or :Sex if you really need to browse around).</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1697">surround.vim</a> is all about dealing with surroundings in text strings. It helps to rapidly change single to double quotes, quotes to html, etc.</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=473">BlockComment.vim</a>: select a block in visual mode, and use .c to comment it, and .C to uncomment it.</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1905">camelcasemotion.vim</a> will create word boundaries at CamelCase or under_score word endings when using the motion keys w, b and e (see my vimrc for configuration).</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1567">rails.vim</a>. If you&#8217;re doing Rails programming, you must install this. End of story.</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1318">snippetsEmu</a> emulates a bunch of the snippets implemented in E/TextMate. For instance, key in <code>def</code> and a method definition will be expanded with the cursor right on the spot to write the method name. Other snippets for each, map, and others are also emulated.</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=90">vcscommand.vim</a>: Why would you have to leave your editor to commit your changes or update your code? You don&#8217;t. VCSCommand handles Git, SVN and other SCMs</li>
<li><a href="http://ctags.sourceforge.net/">Exuberant CTags</a> is just magic! Position the cursor over any method call and press C-[ to jump right to the method definition. C-T takes you back. A must have.</li>
</ul>
<p>In terms of eye candy, there are three colorschemes that I'd like to mention: <a href="http://www.vim.org/scripts/script.php?script_id=1995">railscasts</a>, <a href="http://www.vim.org/scripts/script.php?script_id=368">oceandeep </a>and <a href="http://www.vim.org/scripts/script.php?script_id=1891">vividchalk</a>. I keep alternating between these, but have settled for railscasts for a while now.</p>
<p>The font I've settled for is <a href="http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released">Envy Code R</a>.</p>
<p>Finally, my .vimrc file:</p>
<p><code><br />
set nocompatible<br />
" I usually go back and forth between these three colorschemes.<br />
":colorscheme oceandeep<br />
":colorscheme vividchalk<br />
:colorscheme railscasts<br />
" Some taken from http://items.sjbach.com/319/configuring-vim-right<br />
set history=1000<br />
" additional matches for %: do/end, if/else/end, the usual () [] {}&#8230;<br />
runtime macros/matchit.vim<br />
set wildmode=list:longest<br />
&#8221; search case insensitive<br />
set ignorecase<br />
&#8221; search case sensitive when search-term has a capital letter<br />
set smartcase<br />
nnoremap  3<br />
set ruler<br />
&#8221; Intuitive backspacing in insert mode allow, backspace over everything<br />
set backspace=indent,eol,start<br />
&#8221; Highlight search terms&#8230;<br />
set hlsearch<br />
&#8221; search dynamically as keyword is typed.<br />
set incsearch<br />
set shortmess=atI<br />
&#8221; get rid of the BEEP<br />
set visualbell<br />
&#8221; Provide two lines of context<br />
set scrolloff=2<br />
&#8221; set GUI font, again, I go back and forth between these<br />
&#8220;set gfn=Bitstream_Vera_Sans_Mono:h9:cANSI<br />
set gfn=Envy_Code_R:h10:cANSI<br />
&#8221; when a line has wrapped, jk navigation moves one line on the screen, instead of one line in the file<br />
nnoremap j gj<br />
nnoremap k gk<br />
vnoremap j gj<br />
vnoremap k gk<br />
nnoremap  gj<br />
nnoremap  gk<br />
vnoremap  gj<br />
vnoremap  gk<br />
inoremap  gj<br />
inoremap  gk<br />
&#8221; CamelCaseMotion plugin mappings<br />
map  w CamelCaseMotion_w<br />
map  b CamelCaseMotion_b<br />
map  e CamelCaseMotion_e<br />
&#8221; Tell vim to remember certain things when we exit<br />
&#8221;  &#8216;10 : marks will be remembered for up to 10 previously edited files<br />
&#8221;  &#8220;100 : will save up to 100 lines for each register<br />
&#8221;  :20 : up to 20 lines of command-line history will be remembered<br />
&#8221;  % : saves and restores the buffer list<br />
&#8221;  n&#8230; : where to save the viminfo files<br />
set viminfo=&#8217;10,\&#8221;100,:20,%,n~/.viminfo<br />
&#8221; remember open buffers accross sessions<br />
&#8221; set viminfo^=%<br />
&#8221; Quick write (F2) and load (F3) session:<br />
map  :mksession! ~\vim_session<br />
map  :source ~\vim_session<br />
&#8221; highlight line of cursor:<br />
set cursorline<br />
&#8221; Remove toolbar<br />
set guioptions-=T<br />
&#8221; and menus<br />
set guioptions-=m<br />
&#8221; For fuzzy finder/textmate<br />
&#8221; Requires fuzzyfinder and fuzzyfinder_textmate plugins<br />
let g:fuzzy_ignore = &#8220;*.log&#8221;<br />
let g:fuzzy_ignore = &#8220;.svn&#8221;<span id="more-35"></span><br />
let g:fuzzy_matching_limit = 70<br />
map t :FuzzyFinderTextMate<br />
map b :FuzzyFinderBuffer<br />
&#8221; me likes the syntax folding:<br />
set foldmethod=syntax<br />
</code></p>
<p>How about you? Any plugin or setting I may be missing?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/labnotesh.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/labnotesh.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/labnotesh.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/labnotesh.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/labnotesh.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/labnotesh.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/labnotesh.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/labnotesh.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/labnotesh.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/labnotesh.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=labnotesh.wordpress.com&blog=382123&post=35&subd=labnotesh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://labnotesh.wordpress.com/2008/12/23/vim-for-rails-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">H</media:title>
		</media:content>

		<media:content url="http://labnotesh.files.wordpress.com/2008/12/gvim-windows.png?w=128" medium="image">
			<media:title type="html">gvim-windows</media:title>
		</media:content>
	</item>
	</channel>
</rss>