<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sarosh Wahla</title>
	<atom:link href="http://saroshwahla.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://saroshwahla.com</link>
	<description>Labor Omnia Uicit Improbus</description>
	<lastBuildDate>Mon, 01 Mar 2010 00:58:59 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='saroshwahla.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/4114a100cb54e0d0cfccf33ad001791b?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sarosh Wahla</title>
		<link>http://saroshwahla.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://saroshwahla.com/osd.xml" title="Sarosh Wahla" />
	<atom:link rel='hub' href='http://saroshwahla.com/?pushpress=hub'/>
		<item>
		<title>Year Twenty Eight</title>
		<link>http://saroshwahla.com/2010/02/28/year-twenty-eight/</link>
		<comments>http://saroshwahla.com/2010/02/28/year-twenty-eight/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 00:00:42 +0000</pubDate>
		<dc:creator>swahla</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saroshwahla.com/?p=145</guid>
		<description><![CDATA[Today I &#8216;celebrated&#8217; my twenty eight year of existence &#8211; my &#8216;golden&#8217; birthday (Hat Tip: Tamara). So here are a few fun suggestions to try out on your birthday:
(a) Eat chocolate all day;
(b) Learn about gauge theory;
(c) Spend time with family (use Skype if they are on the other side of the planet);
(d) Think about <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saroshwahla.com&blog=2152634&post=145&subd=swahla&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Today I &#8216;celebrated&#8217; my twenty eight year of existence &#8211; my &#8216;golden&#8217; birthday (<span style="text-decoration:underline;">Hat Tip</span>: Tamara). So here are a few fun suggestions to try out on <strong>your</strong> birthday:</p>
<p>(a) Eat chocolate all day;</p>
<p>(b) Learn about <a title="Terry Tao explains Gauge Theory" href="http://terrytao.wordpress.com/2008/09/27/what-is-a-gauge/">gauge theory</a>;</p>
<p>(c) Spend time with family (use Skype if they are on the other side of the planet);</p>
<p>(d) Think about paying bills &#8211; but not <em>actually</em> pay them;</p>
<p>Also, the visual design of this site is currently less than appealing to me. I will work on it, but not today. Thanks to everyone for all the birthday wishes! I truly appreciated them.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/swahla.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/swahla.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/swahla.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/swahla.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/swahla.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/swahla.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/swahla.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/swahla.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/swahla.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/swahla.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saroshwahla.com&blog=2152634&post=145&subd=swahla&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://saroshwahla.com/2010/02/28/year-twenty-eight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a1a2e6ab842f0c23f5a5dcc48fed5c4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarosh</media:title>
		</media:content>
	</item>
		<item>
		<title>Snow Leopard, Ruby, Sinatra</title>
		<link>http://saroshwahla.com/2010/02/20/snow-leopard-ruby-sinatra/</link>
		<comments>http://saroshwahla.com/2010/02/20/snow-leopard-ruby-sinatra/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 17:33:50 +0000</pubDate>
		<dc:creator>swahla</dc:creator>
				<category><![CDATA[dev]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://saroshwahla.com/?p=132</guid>
		<description><![CDATA[My goal was to start working in Sinatra fairly quickly (specifically to get it working with Heroku). In order to do that, I had to spend a bit of time updating Ruby under Snow Leopard. The process is straight forward, if you realize the following:

(a) The $PATH is probably not set up properly;
(b) You need <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saroshwahla.com&blog=2152634&post=132&subd=swahla&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>My goal was to start working in Sinatra fairly quickly (specifically to get it working with Heroku). In order to do that, I had to spend a bit of time updating Ruby under Snow Leopard. The process is straight forward, if you realize the following:</p>
<ul>
<li>(a) The $PATH is probably not set up properly;</li>
<li>(b) You need git;</li>
<li>(c) Update everything;</li>
</ul>
<p>First step, is actually setting $PATH properly. This actually took hours because I kept forgetting a basic idea: Apple has changed this. Setting $PATH actually takes place in ~/.profile. This used to be .bash_profile. So, if you set things in .bash_profile, they may or may not show up. This wound up biting me at the end of the process when things just didn&#8217;t seem to be working properly and for the life of me I could not figure out why. It was because $PATH was not properly set. The moral of the story is: set $PATH properly or you will waste lots of time cursing.</p>
<p>After properly setting up $PATH, the next step is getting Git on OS X. Thankfully, &#8220;<a title="Git for OS X" href="http://code.google.com/p/git-osx-installer/">there&#8217;s a package for that</a>.&#8221; This was painless and sets up the environmental variables for you which was nice.</p>
<p>Next, updating Rails and RubyGems. Note that Snow Leopard already has Ruby installed (ruby 1.8.7). I may consider updating to ruby 1.9, but right now, I just want to get up and running. So, to update:</p>
<blockquote><p><code><strong>sudo gem update --system<br />
sudo gem install rails<br />
sudo gem update rake</strong><br />
</code></p></blockquote>
<p>This updates all the core stuff. Rake is Ruby&#8217;s make tool. Where does everything get installed? Ah, here is the tricky bit. If you happy to be unlucky and use:</p>
<blockquote><p><strong><code>gem install/update</code></strong></p></blockquote>
<p>without sudo, you will have a set of useless files placed in:</p>
<blockquote><p><code>~/.gem</code></p></blockquote>
<p>Now, you <em>could</em> try just <strong>rm -rf </strong>on that directory and everything goes away. But, the problem is that gem list is not updated properly. Instead, you need to uninstall using:</p>
<blockquote><p><code><strong>gem uninstall  --install-dir=~/.gem/ruby/1.8/</strong><br />
Successfully uninstalled -x.y.z<br />
</code></p></blockquote>
<p>This helps you &#8216;undo&#8217; the damage, but what happens when, inevitably, you yet again install a gem without sudo? Well, be smart and protect the directory:</p>
<blockquote><p><strong><code>chmod -R u-w ~/.gem</code></strong></p></blockquote>
<p>Thus saving your setup from <em>you</em> in the future. So far, so good. Now, install Sinatra:</p>
<blockquote><p><strong><code>sudo gem install sinatra</code></strong></p></blockquote>
<p>As I plan on using Sinatra with Heroku, it&#8217;s probably a good idea to go ahead and install the Heroku. The first step is to create an <a title="Heroku Signup" href="http://heroku.com/signup">account</a>. With the account created install the Heroku gem:</p>
<blockquote><p><strong><code>sudo gem install heroku</code></strong></p></blockquote>
<p>With Heroku, deployment under Sinatra is super easy: just Push with Git. But before we can deploy, we need to check that everything is working properly. As I am using TextMate,  I need to make sure to grab the latest RoR <a title="Rails Bundle for TextMate" href="http://railsbundle.com/">bundle</a>. Inside TextMate, select RoR in the status bar to enable syntax highlighting. Now, to ensure that everything is running, create a new file in TextMate called <strong>hello.rb </strong>with:</p>
<blockquote><p><code><br />
<strong>require 'rubygems'<br />
require 'sinatra'</strong></code></p>
<p><code><strong><br />
get '/' do<br />
"Konichi-wa Heroku-san!"<br />
end</strong><br />
</code></p></blockquote>
<p>Save the file and then hit <strong>⌘r</strong> to run the code. With any luck, you will see:</p>
<blockquote><p><code><br />
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Mongrel<br />
</code></p></blockquote>
<p>This means that Sinatra is now running. Head on over to <strong>http://localhost:4567/</strong> to see your application. Success will mean that you will see &#8220;<em>Konichi-wa Heroku-san!</em>&#8221; in your browser. This means that the local version is up and running. To get the version setup for Heroku, you need to create an additional <strong>config.ru</strong>, a Rackup file for starting the Rack application. This file must contain the complete logic for initializing the application, such as:</p>
<blockquote><p><code><br />
<strong>require 'hello'<br />
run Sinatra::Application</strong><br />
</code></p></blockquote>
<p>This file and <strong>hello.rb</strong> should be put in a new directory that is going to be put under Git revision control:</p>
<blockquote><p><code><br />
<strong>git init</strong><br />
Initialized empty Git repository in /Users/sarosh/src/hello/.git/<br />
<strong>git add .</strong><br />
<strong> git commit -m "sinatra and heroku"</strong><br />
[master (root-commit) 4f93b81] sinatra and heroku<br />
2 files changed, 8 insertions(+), 0 deletions(-)<br />
create mode 100644 config.ru<br />
create mode 100644 hello.rb<br />
</code></p></blockquote>
<p>Now, to create the app on Heroku we need to set up keypair authentication first (you only have to do this once, but again a &#8216;gotcha&#8217; if you have not set it up):</p>
<blockquote><p><code><strong>ssh-keygen<br />
</strong>Generating public/private rsa key pair.<br />
Enter file in which to save the key (/Users/sarosh/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /Users/sarosh/.ssh/id_rsa.<br />
Your public key has been saved in /Users/sarosh/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
xxxxxxxxx sarosh@Sarosh-Wahlas-MacBook-Pro.local<br />
The key's randomart image is:<br />
+--[ RSA 2048]----+</code></p></blockquote>
<blockquote><p><code><strong>ssh-keygen -t dsa</strong><br />
Generating public/private dsa key pair.<br />
Enter file in which to save the key (/Users/sarosh/.ssh/id_dsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /Users/sarosh/.ssh/id_dsa.<br />
Your public key has been saved in /Users/sarosh/.ssh/id_dsa.pub.<br />
The key fingerprint is:<br />
xxxxxxxxx sarosh@Sarosh-Wahlas-MacBook-Pro.local<br />
The key's randomart image is:<br />
+--[ DSA 1024]----+</code></p></blockquote>
<p>Creating the app on Heroku:</p>
<blockquote><p><code><br />
<strong>heroku create</strong><br />
Enter your Heroku credentials.<br />
Email: <strong>blah@blah.com</strong><br />
Password:<br />
Uploading ssh public key /Users/sarosh/.ssh/id_rsa.pub<br />
Creating simple-robot-57.... done!<br />
Created http://simple-robot-57.heroku.com/ | git@heroku.com:simple-robot-57.git<br />
Git remote heroku added<br />
</code></p></blockquote>
<p>Now, push the code:</p>
<blockquote><p><code><br />
<strong>git push heroku master</strong></code></p></blockquote>
<blockquote><p><code>Counting objects: 4, done.<br />
Delta compression using up to 2 threads.<br />
Compressing objects: 100% (3/3), done.<br />
Writing objects: 100% (4/4), 401 bytes, done.<br />
Total 4 (delta 0), reused 0 (delta 0)<br />
-----&gt; Heroku receiving push<br />
-----&gt; Sinatra app detected<br />
Compiled slug size is 4K<br />
-----&gt; Launching...... done<br />
http://simple-robot-57.heroku.com deployed to Heroku<br />
To git@heroku.com:simple-robot-57.git<br />
* [new branch]      master -&gt; master<br />
</code></p></blockquote>
<p>Now, navigating to <a title="Sinatra test app" href="http://simple-robot-57.heroku.com">http://simple-robot-57.heroku.com</a> should show the Sinatra code. To test that things really are working, modify the code in <strong>hello.rb</strong> and commit the changes:</p>
<blockquote><p><code><br />
<strong>git add .</strong><br />
</code></p></blockquote>
<blockquote><p><strong><code>git commit -m "second heroku" </code></strong></p></blockquote>
<blockquote><p><code>[master b3f0a44] second heroku<br />
1 files changed, 1 insertions(+), 1 deletions(-) </code></p></blockquote>
<blockquote><p><strong><code>git push heroku master<br />
</code></strong></p></blockquote>
<blockquote><p><code>Counting objects: 5, done.<br />
Delta compression using up to 2 threads.<br />
Compressing objects: 100% (3/3), done.<br />
Writing objects: 100% (3/3), 387 bytes, done.<br />
Total 3 (delta 0), reused 0 (delta 0)<br />
-----&gt; Heroku receiving push<br />
-----&gt; Sinatra app detected<br />
Compiled slug size is 4K<br />
-----&gt; Launching...... done<br />
http://simple-robot-57.heroku.com deployed to Heroku<br />
To git@heroku.com:simple-robot-57.git<br />
4f93b81..b3f0a44  master -&gt; master<br />
</code></p></blockquote>
<p>Then check the site again: <a title="Sinatra test app" href="http://simple-robot-57.heroku.com/">http://simple-robot-57.heroku.com</a>. Going to <a title="Heroku MyApps" href="http://api.heroku.com/myapps">http://api.heroku.com/myapps</a> will show you more information and the Heroku Dashboard. The next step is getting comfortable with Git.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/swahla.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/swahla.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/swahla.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/swahla.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/swahla.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/swahla.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/swahla.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/swahla.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/swahla.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/swahla.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saroshwahla.com&blog=2152634&post=132&subd=swahla&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://saroshwahla.com/2010/02/20/snow-leopard-ruby-sinatra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a1a2e6ab842f0c23f5a5dcc48fed5c4e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarosh</media:title>
		</media:content>
	</item>
	</channel>
</rss>