<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1227413251721676178</atom:id><lastBuildDate>Mon, 27 Feb 2012 10:22:30 +0000</lastBuildDate><category>ruby</category><category>jquery</category><category>rspec</category><category>bundler</category><category>tests</category><category>git</category><category>goshortener</category><category>gem</category><category>rails</category><category>github</category><category>rails deployment</category><category>vim</category><category>rvm</category><category>rubygems</category><category>lambda</category><category>Apple</category><category>help</category><category>prototype</category><category>difference</category><category>google</category><category>proc</category><title>Ruby In Air</title><description /><link>http://www.rubyinair.com/</link><managingEditor>noreply@blogger.com (Anand)</managingEditor><generator>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RubyInAir" /><feedburner:info uri="rubyinair" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nd/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nd/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>RubyInAir</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-7795226092967362104</guid><pubDate>Mon, 27 Feb 2012 10:22:00 +0000</pubDate><atom:updated>2012-02-27T02:22:30.087-08:00</atom:updated><title>First iPhone commercials</title><description>&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/4acWkNihaxc" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;All These Years&lt;/b&gt;
&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/AbexaqNTppo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;Amazing&lt;/b&gt; &lt;br /&gt;
&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/IPTgTeLFawM" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-7795226092967362104?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/V-2VRRHt2rs/first-iphone-commercials.html</link><author>noreply@blogger.com (Anand)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/4acWkNihaxc/default.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2012/02/first-iphone-commercials.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-3454731410112512227</guid><pubDate>Thu, 02 Feb 2012 20:18:00 +0000</pubDate><atom:updated>2012-02-02T12:29:29.637-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rails</category><title>Rendering HTML in Rails for Dummies!</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Views can be rendered in 4 simple ways from an action method.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
1. Render the action's own template, named after the action's name itself. This is the default. &lt;br /&gt;
&lt;script src="https://gist.github.com/1725430.js?file=users_controller.rb"&gt;&lt;/script&gt;
&lt;/div&gt;

&lt;br /&gt;
&lt;div&gt;
2. Render some other action's template from an action method, inside the same controller. &lt;br /&gt;
&lt;script src="https://gist.github.com/1725430.js?file=orders_controller.rb"&gt;&lt;/script&gt;
&lt;/div&gt;

&lt;br /&gt;
&lt;div&gt;
3. Render an action's template which is present in some other controller, other than the one we are calling from.&amp;nbsp;
 &lt;br /&gt;&lt;script src="https://gist.github.com/1725430.js?file=activities_controller.rb"&gt;&lt;/script&gt;
&lt;/div&gt;

&lt;br /&gt;
&lt;div&gt;
4. Render any damn template file. &lt;br /&gt;
&lt;script src="https://gist.github.com/1725430.js?file=posts_controller.rb"&gt;&lt;/script&gt;

&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;

To learn more details on rendering views, see &lt;a href="http://guides.rubyonrails.org/layouts_and_rendering.html"&gt;Rails guides&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-3454731410112512227?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/_Bf4q1RyN_M/rendering-html-in-rails-for-dummies.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2012/02/rendering-html-in-rails-for-dummies.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-566726887909894935</guid><pubDate>Sun, 14 Aug 2011 05:57:00 +0000</pubDate><atom:updated>2011-08-13T22:57:08.993-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">lambda</category><category domain="http://www.blogger.com/atom/ns#">proc</category><category domain="http://www.blogger.com/atom/ns#">difference</category><title>Difference between Proc and Lambda</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Proc and Lambda are used to create code blocks. After creating them, we can pass them around our code, just like variables.&lt;br /&gt;
&lt;br /&gt;
But there are 2 significant differences we have to keep in mind.&lt;br /&gt;
&lt;br /&gt;
1. Suppose a Proc or a lambda is used to create a code block inside of a method. If the Proc/Lambda has a return statement inside of its code, in the case of Proc, the whole method is returned. But in the case of Lambda, its not. The execution continues to any further statements inside the method. Here is the code fragment that explains this difference.&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/1144620.js"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
2. A Proc will not check if the arguments are passed to it are of the same number as its parameters. A Lambda will throw an error if we violate the number of parmeters. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1144621.js"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
You see, Proc is very naughty :) It won't check for the number of arguments and it will return without the permission of the method in which it resides!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-566726887909894935?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/Mrq_i2k09_I/difference-between-proc-and-lambda.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/08/difference-between-proc-and-lambda.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-8594651938501825258</guid><pubDate>Sat, 18 Jun 2011 14:08:00 +0000</pubDate><atom:updated>2011-06-18T07:08:06.949-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rubygems</category><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">bundler</category><category domain="http://www.blogger.com/atom/ns#">rvm</category><title>RVM, RubyGems and Bundler -  How gems are installed ?</title><description>Earlier when I started programming using ruby (system ruby), it was all clean. I used to install gems with &lt;i&gt;sudo gem install somegem&lt;/i&gt; .  Then came rvm and it asked me to install gems without sudo like: &lt;i&gt;gem install somegem&lt;/i&gt;.  Then came bundler, which asked me to install gems by &lt;i&gt;bundle install&lt;/i&gt;. &lt;br /&gt;
&lt;br /&gt;
Since then, I was  confused about how things work using these 2 tools on top of ruby. Well, I decided to put an end to that confusion and here is how they work. &lt;br /&gt;
&lt;br /&gt;
When you use &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=gem_install"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
rubygems would install that gem in the place defined by $GEM_HOME environment variable. Now this is the variable that dominates where rvm puts gems in and where bundler puts gems in.&lt;br /&gt;
&lt;br /&gt;
I suppose you are using rvm to manage multiple rubies. When you switch rubies using rvm, the $GEM_HOME variable changes. rvm changes it. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=rvm_gem_home"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
When we use bundler install to manage dependencies, bundler simply call gem install under hood for each of the gems defined in Gemfile. Lets see this in terminal.&lt;br /&gt;
&lt;br /&gt;
First create a new rails project, it comes with a Gemfile. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=create%20a%20new%20rails%20project"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Lets then create a new gemset for this project and use it&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=set%20up%20new%20rvm%20gemset%20and%20use%20it"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Install bundler and check $GEM_HOME location for any gems installed.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=install%20bundler%20in%20the%20gemset"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Do a bundle install in this project and check $GEM_HOME again. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1033080.js?file=bundle_install_in_project"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-8594651938501825258?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/otuLzRuipjQ/rvm-rubygems-and-bundler-how-gems-are.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/06/rvm-rubygems-and-bundler-how-gems-are.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-6672825986248355862</guid><pubDate>Fri, 15 Apr 2011 16:57:00 +0000</pubDate><atom:updated>2011-04-15T10:20:05.156-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>'class &lt;&lt; ' merely changes the self</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Many ruby programmers use class &amp;lt;&amp;lt; self inside some class definition to create class methods. But the actual meaning behind this class &amp;lt;&amp;lt; self is completely different. Using it for creating class methods is just one usecase.&lt;br /&gt;
&lt;br /&gt;
class &amp;lt;&amp;lt; soomeobject, actually changes 'self' object inside a definition block. In ruby, in any place there is something called as current object or 'self'. If you are calling a method and if you don't specify a receiver or object on which the method has to be called (like someobject.methodname() ), the method will be called on 'self' or current object inside that scope.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;ol&gt;&lt;li&gt;Inside Instance methods, self is "the object instantiated from the corresponding class".&lt;/li&gt;
&lt;li&gt; Inside class methods and class definitions, self is the "the class object". &lt;/li&gt;
&lt;li&gt; Inside Module methods, self is either the "instance of the class that includes it" or "object that extends itself with the module". &lt;/li&gt;
&lt;li&gt; Inside Module definition, outside of module methods, self is "the module object". &lt;/li&gt;
&lt;/ol&gt;So like this, in every scope, self changes itself. If you want to enforce self to be a particular object in particular place in your program, you use class &amp;lt;&amp;lt; self. Here are some self-explanatory code snippets that demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/921993.js?file=object_self.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/921993.js?file=class_self.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/921993.js?file=module_self.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
And now comes more familiar way of using class &amp;lt;&amp;lt; self.  &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/921993.js?file=MyClass.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there is nothing called as class methods. &lt;a href="http://www.rubyinair.com/2011/04/ruby-classes-are-objects-too.html"&gt;Classes are pure ruby objects&lt;/a&gt;. Going by that logic, class methods are nothing but &lt;a href="http://www.rubyinair.com/2011/04/object-dynamism-in-ruby.html"&gt;instance methods of singleton class of an object&lt;/a&gt;(saying it differently,  singleton methods)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-6672825986248355862?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/lMeMUxptHZM/class-merely-changes-self.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/04/class-merely-changes-self.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-590369368732795281</guid><pubDate>Thu, 14 Apr 2011 04:13:00 +0000</pubDate><atom:updated>2011-04-15T10:03:27.159-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Object Dynamism in Ruby</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;When an object in Ruby is created, it has methods and instance variables that are initially defined in its class. But that doesn't stop that object from getting new capabilities. They get more powers later by their singleton classes or when their parent class gets new methods. Let me tell you about the first way. &lt;br /&gt;
&lt;br /&gt;
Every object have its own class (apart from the class from which it was instantiated). That class is called as singleton class (or some would call it ghost class, eigen class, uniclass, etc.,). Singleton classes are unique to an object. And ruby will look for methods in that class before it looks into a class, when a method is called on that object. Here is code snippet that demonstrates singleton class.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/918849.js?file=od1.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
The shout_hello method was added only to john's singleton class. &lt;br /&gt;
&lt;br /&gt;
Here is a second way in which the original class gets more methods after the object is created. You see the class gets more methods and ruby will find and invoke them. Unlike other languages, classes are not like "strict" rules boxes of what can go into an object. In ruby, they are just scopes and they get opened and closed to give more powers to their objects.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/918849.js?file=od2.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the code snippet from Rails source code where the super duper class in Ruby, "Object" gets opened for more methods to be added. &lt;a href="http://bit.ly/gC7qSr"&gt;http://bit.ly/gC7qSr&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There is one more thing. A third way to add more capabilities/methods to an object in ruby. That is by modules. We are going to create a module, extend the object's singleton class with that module. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/918849.js?file=obmodule.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Cool huh !?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-590369368732795281?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/rN9w9VyClZs/object-dynamism-in-ruby.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/04/object-dynamism-in-ruby.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-4277126274158667543</guid><pubDate>Sun, 10 Apr 2011 07:09:00 +0000</pubDate><atom:updated>2011-04-15T10:02:44.440-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>super is a keyword, not a method call!</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Methods can be overridden in subclasses of ruby. It is just a process of rewriting method definition, as it make sense in the current class/object. &lt;br /&gt;
&lt;br /&gt;
Calling super ..  oops, sorry - writing super anywhere in the over-ridden method will cause the method lookup to continue and the execute the first method found by the name. (If you want to learn about method lookup, here is a &lt;a href="http://blog.rubybestpractices.com/posts/gregory/030-issue-1-method-lookup.html"&gt;good writeup&lt;/a&gt; by &lt;a href="https://github.com/sandal"&gt;Gregory Brown&lt;/a&gt;. Here are some examples of how super can be used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/912113.js?file=super.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/912115.js?file=super.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/912116.js?file=super.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/912117.js?file=super.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Note the lines where super is written. super by default forwards all arguments to the previous method definition, unless and until you write parenthesis after it. super is not a method call though, it is just a keyword in ruby and should not be imagined as calling super(), as in other languages.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-4277126274158667543?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/g5lgUgzCQqw/super-is-keyword-not-method-call.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/04/super-is-keyword-not-method-call.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-3268639446345479661</guid><pubDate>Sat, 09 Apr 2011 17:21:00 +0000</pubDate><atom:updated>2011-04-15T10:04:19.187-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><title>Ruby Classes are Objects too!</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;To demonstrate this awesomeness, here are three ways to create your ruby classes.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/911564.js?file=person.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
And the second way,&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/911565.js?file=person.rb"&gt;
&lt;/script&gt; &lt;br /&gt;
&lt;br /&gt;
and one step further with blocks,&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/911566.js?file=noname.rb"&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
All Ruby classes are instances of class "Class". Cool huh ?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-3268639446345479661?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/SRCQlDU_j9o/ruby-classes-are-objects-too.html</link><author>noreply@blogger.com (Anand)</author><thr:total>2</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/04/ruby-classes-are-objects-too.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-101280377149868598</guid><pubDate>Sat, 05 Mar 2011 03:11:00 +0000</pubDate><atom:updated>2011-04-15T10:05:16.439-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">vim</category><category domain="http://www.blogger.com/atom/ns#">help</category><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">rails</category><title>Help yourself out</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;If a new web framework comes out, we expect a book and good blog post to be written, for us to start learning about it. If we get stuck in a problem, we expect Stackoverflow and other forums to help us out. At least, I've seen this in some people (and me). There is this, sort of permanent dependency on other things, to help us out of doubts or difficult situations in progamming. What've learnt from my seniors and some of my web friends, is that, the more we become independent in solving our problems, the more skill we have. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Vim&lt;/b&gt; &lt;br /&gt;
While working with vim, we get stuck sometimes in doing repetitive tasks. We then actually browse web/google it to get the solution from a blog post or something. What we have to realize is that Vim comes with pretty extensive help system on its own. Many (at least I) didn't know how to use it well. :h can solve any problem you might have in Vim. Vim help system is the only way you can help yourself when you face problems in Vim. No blog post or no video can help you. But, to get started in Vim help system, this &lt;a href="http://vimeo.com/7035132"&gt;video&lt;/a&gt; is really useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Git&lt;/b&gt;&lt;br /&gt;
I wonder how many people using Git know about git ls-tree command. Not many of us go and reading commands more than the necessary ones (pull, push, add, commit). Again, when we get stuck, what I've realized is that knowing "Git internals" will really help us in any situation we might be in, while using git. &lt;a href="http://peepcode.com/products/git-internals-pdf"&gt;This book&lt;/a&gt; is "The" book on Git Internals. Must read. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Rails&lt;/b&gt;&lt;br /&gt;
Well, for helping ourselves on Rails, knowledge about core ruby is really really essential. Instead of reading the documentation, if we read the corresponding code in Rails, it will really help on long term. Daily, on an average, 5-6 commits go into rails repository. Reading new code in the repository, will keep everyone updated. &lt;a href="http://www.manning.com/black2/"&gt;This book&lt;/a&gt; is the best on fundamentals of Ruby. &lt;br /&gt;
&lt;br /&gt;
To sum it up, "knowing ruby", "using vim help system", "knowing Git internals" can solve problems (that are out of your actual business/application) easily. This is what I learnt from  many guys whom I admire for their coding smartness.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-101280377149868598?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/PBi-4qKnaPw/help-yourself-out.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/03/help-yourself-out.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-7324241856140020982</guid><pubDate>Mon, 21 Feb 2011 18:50:00 +0000</pubDate><atom:updated>2011-02-21T10:50:27.665-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">goshortener</category><category domain="http://www.blogger.com/atom/ns#">gem</category><title>GoShortener with API Keys</title><description>Google servers are quite shy in answering api calls from strangers. So they have an upper bound on how many api calls you can make on their servers to shorten your long urls. Thus they recommend developers to &lt;a href="https://code.google.com/apis/console"&gt;register and use api keys&lt;/a&gt;. GoShortener gem didn't provide facility to include api keys before. &lt;br /&gt;
&lt;br /&gt;
Now starting with &lt;a href="https://github.com/luckydev/goshortener/tree/v1.2"&gt;v1.2&lt;/a&gt;, GoShortener can be used with/without google api keys. &lt;br /&gt;
&lt;br /&gt;
Here is an example usage sessions in irb.&lt;br /&gt;
&lt;script src="https://gist.github.com/837501.js"&gt; &lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-7324241856140020982?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/Ge5FLLjjFMA/goshortener-with-api-keys.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/02/goshortener-with-api-keys.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-9099215793655848919</guid><pubDate>Sun, 20 Feb 2011 03:15:00 +0000</pubDate><atom:updated>2011-02-19T19:15:37.675-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">rails</category><category domain="http://www.blogger.com/atom/ns#">tests</category><title>Test for Positive cases first</title><description>TDD is a religion in Ruby and Ruby on rails community. In any project, you will have to write test cases in any form. But the depth to which testing is done varies between any two programmers. Some programmers concentrate on testing each and every dimension of the feature they are implementing. Some programmers just write small amount of tests, to concentrate on the core use case of a feature. But I would say that we have to find a sweet spot between these two levels. Neither too extreme Nor too less. &lt;br /&gt;
&lt;br /&gt;
For example, if you are writing a Sign Up form page. You obviously would've set strong validations so that mal-users cannot enter invalid data into our forms.&lt;br /&gt;
&lt;br /&gt;
Too Extreme testing:&lt;br /&gt;
&lt;br /&gt;
In the extreme case, a developer might test the form, with his test cases, for every possible type of input and see if we throw an error to the user. So if the form may get, say 2 sets of valid data getting entered and say, 20 sets of invalid data possibilities, the programmer might write 22 test examples to check whether we catch them all and treat them appropriately. &lt;br /&gt;
&lt;br /&gt;
To less testing:&lt;br /&gt;
&lt;br /&gt;
The programmer might pick up just the positive cases that can be entered in the form, and then write test cases on it to check whether we handle them appropriately in our application. &lt;br /&gt;
&lt;br /&gt;
Optimism:&lt;br /&gt;
&lt;br /&gt;
Its always better to choose optimistic number of cases to test against. In the above case, I would pick up all the valid data sets and some frequently occurring invalid data sets and then write the test cases to test whether we handle them properly. &lt;br /&gt;
&lt;br /&gt;
In my view, all we have to care about is to handle our good users really well, i.e, we have to make sure that we deliver what we promise in our application. Handling inappropriate data sets is a different subject, but our test cases should live as a living agreement to make sure that we do the right things really well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-9099215793655848919?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/M68lDR-53AU/test-for-positive-cases-first.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/02/test-for-positive-cases-first.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-4317046225777622723</guid><pubDate>Sat, 05 Feb 2011 07:21:00 +0000</pubDate><atom:updated>2011-02-05T01:38:07.055-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">github</category><category domain="http://www.blogger.com/atom/ns#">google</category><category domain="http://www.blogger.com/atom/ns#">gem</category><title>GoShortener: gem to use goo.gl service</title><description>Recently, Google released its api for &lt;a href="http://code.google.com/apis/urlshortener/v1/getting_started.html"&gt; its URL shortener service&lt;/a&gt;. I might use this service in future, so I've created a small ruby wrapper/gem "goshortener". &lt;br /&gt;
&lt;br /&gt;
You can use Google's json api directly without any ruby wrapper like goshortener. But doing that involves, requesting google servers and handling &amp; parsing the json responses, etc., &lt;br /&gt;
&lt;br /&gt;
goshortener eliminates these problems. This gem currently exposes two methods, #shorten and #lengthen, with their names clearly expressing what they do. Installation and usage instructions can be found in &lt;a href="http://github.com/luckydev/goshortener"&gt;its github project page&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Google api for this service is currently in version 1. There might be lots of improvements to this service in the future. I hope I will maintain this goshortener gem to match all the capabilities google might give via its api.&lt;br /&gt;
&lt;br /&gt;
goshortener is hosted in &lt;a href="https://rubygems.org/gems/goshortener"&gt;rubygems.org&lt;/a&gt; and the source code is hosted in &lt;a href="http://github.com/luckydev/goshortener"&gt;github&lt;/a&gt;. If you find any issues with the gem, please log them &lt;a href="https://github.com/luckydev/goshortener/issues"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-4317046225777622723?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/S5NHqlUcZQM/goshortener-gem-to-use-googl-service.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/02/goshortener-gem-to-use-googl-service.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-7664148479326823398</guid><pubDate>Tue, 01 Feb 2011 22:06:00 +0000</pubDate><atom:updated>2011-02-01T14:06:07.669-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jquery</category><category domain="http://www.blogger.com/atom/ns#">prototype</category><title>jQuery Live in Prototype</title><description>I am not sure whether there are any prototype plugins for doing this, but I know for sure that , at the time of this blog post, jQuery "live" method has not been implemented in Prototype. One more reason to like JQuery !&lt;br /&gt;
&lt;br /&gt;
But, what if you are trapped in a project where Prototype is used and you've got to do things in prototype ways. Well, its just after all javascript. Not a problem. There are a few places where Prototype is not as comfortable as JQuery.&lt;br /&gt;
&lt;br /&gt;
"live" method is one such instance. For example, in your page, if you are expecting a new element via ajax calls, which was not present during initial page load - you can hook an event handler to it using jQuery. i.e, you are hooking an handler for some element that was not even present when your script ran. thats the power of "live" method.&lt;br /&gt;
&lt;br /&gt;
Since Prototype lacks a direct call like "live", people have found several ways to do it. One popular way is event delegation using parents. Let me explain it in simple words.&lt;br /&gt;
&lt;br /&gt;
In this technique, we don't actually listen to the "expected new" element. we instead listen to one of its parents that already existed during initial page load. Then inside the parent's event handler, we check whether the "expected new element" was actually where the event occurred. Prototype's &lt;a href="http://api.prototypejs.org/dom/Event/findElement/"&gt;"Event.findElement()"&lt;/a&gt; method is used for it. Then, if that is true, we can do whatever we want on that event.&lt;br /&gt;
&lt;br /&gt;
Simply saying, we listen to the parent. And the parent element tells us whether a new element exists and whether the event happened on that new element.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/806761.js"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
And for a specific example, here is one.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/806764.js"&gt; &lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
Here, we are listening to "a" tag that was loaded dynamically via ajax inside the parent "content" element. "cotent" could be a div for instance. This has been working well for me. So I pretty much use this technique whenever I need such functionality using Prototype. I hope it helps somebody.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-7664148479326823398?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/iyKj6zRsx38/jquery-live-in-prototype.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/02/jquery-live-in-prototype.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-4897846031405455333</guid><pubDate>Sun, 23 Jan 2011 14:31:00 +0000</pubDate><atom:updated>2011-01-23T06:31:54.932-08:00</atom:updated><title>I never miss Ryan's words</title><description>&lt;object width="640" height="390"&gt;&lt;param name="movie" value="http://www.youtube.com/v/O2Edf7h1Yn8&amp;hl=en_US&amp;feature=player_embedded&amp;version=3"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/O2Edf7h1Yn8&amp;hl=en_US&amp;feature=player_embedded&amp;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="500" height="390"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-4897846031405455333?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/8fZX85UJjKg/i-never-miss-ryans-words.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/01/i-never-miss-ryans-words.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-1165791176252357829</guid><pubDate>Wed, 19 Jan 2011 16:07:00 +0000</pubDate><atom:updated>2011-01-19T08:08:51.819-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Apple will survive Steve Job's absence</title><description>Apple will survive Steve Job's absence if there would be any such thing. Even if he retires, Apple will grow. I read an &lt;a href="http://www.npr.org/2011/01/19/133028424/will-jobs-departure-take-a-bite-out-of-apple"&gt;article&lt;/a&gt; on this thing. And they have raised same stupid questions they raised in 2009. Its completely ridiculous. Let me tell you why. &lt;br /&gt;
&lt;br /&gt;
Apple has taught us many lessons. Engineers and Entrepreneurs are learning a lot from Steve job's view on products. And from those lessons, the companies around the globe are becoming successful. Steve jobs and Apple together have influenced other companies not only with its products but also with the way it operates. &lt;br /&gt;
&lt;br /&gt;
Many CEOs and Startup companies will definitely agree to this. If "other" companies can be successful with the lessons learn't from Apple, Why not "Apple" can't be as successful as it is now ?&lt;br /&gt;
&lt;br /&gt;
1. Apple's market value is $321 billion dollars. They have huge cash. &lt;br /&gt;
2. Apple have produced several good products. So they know what would work and what wouldn't. &lt;br /&gt;
3. Apple have awesome engineers. They have been with Steve Jobs. And they know how to make good, beautiful and useful products in the coming days. &lt;br /&gt;
4. Apple have a very very strong and sincere community. &lt;br /&gt;
5. Apple have "the" huge platforms to capitalize - iTunes Market, iPhone market and Mac app market. &lt;br /&gt;
6. Apple has a very strong product line. Mac family, Macbook family, iPod, iPhone, iPad. These are enough to sail them through any disaster.   &lt;br /&gt;
&lt;br /&gt;
So, Stop thinking about Apple's demise !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-1165791176252357829?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/O-Sw5PrDV9A/apple-will-survive-steve-jobs-absence.html</link><author>noreply@blogger.com (Anand)</author><thr:total>1</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/01/apple-will-survive-steve-jobs-absence.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-4427941811117282997</guid><pubDate>Thu, 06 Jan 2011 16:28:00 +0000</pubDate><atom:updated>2011-01-06T08:30:56.446-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">rspec</category><title>Produce Documentation from your RSpec test cases</title><description>Well, if you are not in the habit of writing test cases, this post is not for you. So if you are in the other jungle, writing test cases for your app, this post hopefully will show you something cool about rspec. &lt;br /&gt;
&lt;br /&gt;
Ruby community generally believes a lot in test cases. Why? well, there are many reasons. One primary thing is that test cases document your code. what does that mean ... ? let me show you.&lt;br /&gt;
&lt;br /&gt;
If you have rspec test cases written in your ruby app ( a rails project for example) , in PROJECT_ROOT/spec/, here is a way in which you can get the documentation of your app. &lt;br /&gt;
&lt;br /&gt;
Give this command to get a neat output of rspec test cases&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/768106.js?file=rspec"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
If you want the same in a text file, probably to print it out at later stage, you can give like &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/768110.js?file=rspec"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
You can open that txt file to see your App's documentation. There are a lot of nice command line options that rspec provides you. Tweak them to your interests.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/768113.js?file=rspec%20help"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/768103.js?file=rspec%20--help"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-4427941811117282997?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/dvGokZTtWak/produce-documentation-from-your-rspec.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2011/01/produce-documentation-from-your-rspec.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-5739850251180447040</guid><pubDate>Thu, 30 Dec 2010 19:20:00 +0000</pubDate><atom:updated>2010-12-30T11:20:39.247-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ruby</category><category domain="http://www.blogger.com/atom/ns#">rvm</category><title>How to install RVM on MacOS X Snow Leopard</title><description>Managing multiple versions of rubies and ruby gems is a very difficult task. One of your projects might be using Ruby 1.9.2, while your other old project might be using Ruby 1.8.7. Adding to this complexity, each of your project might be using different versions of a same ruby gem. (For example rails 3.0.1, rails 2.3.8, rails 2.3.5). &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://rvm.beginrescueend.com/"&gt;RVM&lt;/a&gt; was created to solve this problem. RVM is surprisingly easy to use with its simple set of commands. I will explain how to use it in the next blog post. Here, I will explain how to install it. &lt;br /&gt;
&lt;br /&gt;
Before installing rvm, make sure that you have installed XCode developer tools in your mac. Apple distributes the XCode developer tools in CD with every Mac. You can even download it from &lt;a href="http://developer.apple.com/technologies/xcode.html"&gt;Apple developer site&lt;/a&gt; for free.  &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To Install RVM&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. Open your terminal, copy and paste the following command in it. Then press enter. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;bash &lt; &lt;( curl http://rvm.beginrescueend.com/releases/rvm-install-head )&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
2. Then, go to your home directory&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;cd&lt;/div&gt;&lt;br /&gt;
3. Edit your .profile file using your favorite editor. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;nano ~/.profile&lt;/div&gt;&lt;br /&gt;
4. Copy and paste the below line at the end of .profile file &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;[[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.&lt;/div&gt;&lt;br /&gt;
5. Save it and exit the file. (This step varies for different editors. For nano it is  Ctrl-o  and then Ctrl-x )   &lt;br /&gt;
&lt;br /&gt;
6. Run the following command to reload your shell settings.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;source ~/.profile&lt;/div&gt;&lt;br /&gt;
7. Confirm whether rvm was installed properly in your system by typing the following command in terminal. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;type rvm | head -1&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You should see the following output. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm is a function&lt;/div&gt;&lt;br /&gt;
Your rvm is installed now.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Installing Rubies:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ruby-1.8.7-p174 (Ruby 1.8.7 patch level 174) is installed by default in MacOSX. This is called system ruby. If you want to check its version in your mac, you can type this command and see for yourself.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;ruby -v&lt;/div&gt;&lt;br /&gt;
Now, lets install ruby 1.8.7 and ruby 1.9.2 using RVM. &lt;br /&gt;
&lt;br /&gt;
1. To install ruby 1.8.7, type this command in your terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm install 1.8.7&lt;/div&gt;&lt;br /&gt;
Now, rvm will download ruby v1.8.7 source code, compile and install it automatically. This process will take some time depending on your system and internet speed.&lt;br /&gt;
&lt;br /&gt;
2. Installing ruby 1.9.2 is by the same command.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm install 1.9.2&lt;/div&gt;&lt;br /&gt;
Note: Installing MacRuby, JRuby is similar with a few tweaks. You can refer the documentation for installing them.&lt;br /&gt;
&lt;br /&gt;
After installing, you can check by typing the following command&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm list&lt;/div&gt;&lt;br /&gt;
and it will give the following output for me.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm rubies&lt;br /&gt;
&lt;br /&gt;
   jruby-1.5.3 [ x86_64-java ]&lt;br /&gt;
   macruby-0.7.1 [ x86_64 ]&lt;br /&gt;
=&gt; ruby-1.8.7-p302 [ x86_64 ]&lt;br /&gt;
   ruby-1.9.2-p0 [ x86_64 ]&lt;br /&gt;
&lt;/div&gt;The output shows the list of rubies that are installed in my system and the little arrow shows the version I'm using currently i.e ruby-1.8.7-p302 [ x86_64 ] .&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
Using Rubies:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To start using ruby 1.8.7, you need to give this command in terminal,&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm use 1.8.7&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
and to start using 1.9.2, you need to give a similar command&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm use 1.9.2&lt;/div&gt;&lt;br /&gt;
To make one ruby version as default, you need to give command like&lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm use 1.9.2 --default&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
You can always check the version you are using currently by one of the following commands. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;rvm list&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&lt;div style="background:#424242;color:white;padding:5px;"&gt;ruby -v&lt;/div&gt;&lt;br /&gt;
Please refer the &lt;a href="http://rvm.beginrescueend.com/#docindex"&gt;documentation&lt;/a&gt; for more advanced use cases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-5739850251180447040?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/MqXnFwNqYDA/how-to-install-rvm-on-macos-x-snow.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2010/12/how-to-install-rvm-on-macos-x-snow.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-8345530475265218208</guid><pubDate>Thu, 30 Dec 2010 13:22:00 +0000</pubDate><atom:updated>2010-12-30T05:23:47.689-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">vim</category><title>Perfect VIM Video series</title><description>I have seen Vimcasts. I've seen Peepcode. But none matches Derek Wyatt Vim series. &lt;br /&gt;
&lt;br /&gt;
&lt;iframe src="http://player.vimeo.com/video/6999927" width="450" height="330" frameborder="0"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/6999927"&gt;Welcome to Vim&lt;/a&gt; from &lt;a href="http://vimeo.com/user1690209"&gt;Derek Wyatt&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
Simply the best&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-8345530475265218208?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/D4aIcdOudhI/perfect-vim-video-series.html</link><author>noreply@blogger.com (Anand)</author><thr:total>4</thr:total><feedburner:origLink>http://www.rubyinair.com/2010/12/perfect-vim-video-series.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-2233283664439435677</guid><pubDate>Mon, 27 Dec 2010 08:23:00 +0000</pubDate><atom:updated>2010-12-27T00:25:18.200-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rails deployment</category><title>Track your rails deployments using NewRelic RPM</title><description>This is applicable only if you have installed NewRelic as a gem inside your project. I am using Rails3 for my app development and adding the below lines in my deploy file worked for me.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/755962.js?file=deploy.rb"&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
For other details, you can read this &lt;a href="http://support.newrelic.com/kb/docs/recording-deployments-with-the-ruby-agent"&gt;article&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-2233283664439435677?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/zl-vBsVs9PM/track-your-rails-deployments-using.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2010/12/track-your-rails-deployments-using.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1227413251721676178.post-7276382198040008670</guid><pubDate>Thu, 16 Sep 2010 18:35:00 +0000</pubDate><atom:updated>2010-09-19T00:20:23.637-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rails</category><title>Rails 3 Upgrade Made easy !</title><description>With Rails 3 release, existing rails applications are getting upgraded to Rails 3. Rails has so many advantages compared to older versions and its always better to do the upgrade now if not later.&lt;br /&gt;
&lt;br /&gt;
Rails community has churned out a very good plugin for making this step a painless process. You can get this plugin&amp;nbsp;&amp;nbsp; rails_upgrade&amp;nbsp; &lt;a href="http://github.com/rails/rails_upgrade"&gt;here &lt;/a&gt;. Just install the plugin and follow the instructions given in its README file.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Here are some of the things which you have to take care of.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ruby versions:&lt;/b&gt; &lt;br /&gt;
Make sure you run the compatible versions of ruby ( Ruby 1.8.7 or Ruby  1.9.2). If you are not used to working with &lt;a href="http://rvm.beginrescueend.com/"&gt;rvm (ruby version manager)&lt;/a&gt;, this is the right time. Use rvm to install multiple versions of ruby and install Rails 3 with either ruby 1.8.7 and ruby 1.9.2 and without disturbing your existent environments. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Plugins:&lt;/b&gt; &lt;br /&gt;
Care has to be taken in the plugins used in the rails application. This is not a fact to be worried about. Most of the popular plugins are upgraded to work with Rails and some plugins work well in the older versions itself. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Cloud Platforms:&lt;/b&gt;&lt;br /&gt;
If you application is hosted on a dedicated server, its not a problem. You can install the necessary ruby versions and you can start the upgrade process. But when you are in platforms like Heroku, you've got to take care of the ruby version they support. Heroku (at the time of this writing) supports only Ruby 1.8.7. The support for ruby 1.9.2 is on the way as per their &lt;a href="http://docs.heroku.com/rails3"&gt;Rails 3 help page&lt;/a&gt;&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Resources for Upgrade&lt;/b&gt;&lt;br /&gt;
Ryan Bates has done 2 &lt;a href="http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1"&gt;excellent screencasts&lt;/a&gt; on how to upgrade your applications to Rails 3. Here is &lt;a href="http://omgbloglol.com/post/344792822/the-path-to-rails-3-introduction"&gt;another excellent post&lt;/a&gt; that will be of help. &lt;a href="http://edgeguides.rubyonrails.org/3_0_release_notes.html"&gt;Rails 3 release notes&lt;/a&gt; gives useful information on this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1227413251721676178-7276382198040008670?l=www.rubyinair.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/RubyInAir/~3/hN5NgRWdOgE/rails-3-upgrade-made-easy.html</link><author>noreply@blogger.com (Anand)</author><thr:total>0</thr:total><feedburner:origLink>http://www.rubyinair.com/2010/09/rails-3-upgrade-made-easy.html</feedburner:origLink></item></channel></rss>

