  <?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/"
	>

<channel>
	<title>Gaurish Sharma Live</title>
	<atom:link href="http://www.gaurishsharma.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gaurishsharma.com</link>
	<description>Gaurish Sharma&#039;s blog foccused on Technology,Broadband,Latest Offers. He seldomly writes about his life experiances</description>
	<lastBuildDate>Tue, 09 Apr 2013 12:17:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Understanding Differences Between Symbols &amp; Strings in Ruby</title>
		<link>http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html</link>
		<comments>http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html#comments</comments>
		<pubDate>Tue, 09 Apr 2013 12:10:25 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Guides and Howtos]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=794</guid>
		<description><![CDATA[The Ruby Programming language has two different ways by which you can represent strings in your programs: String Symbol IMO, This stuff is the most confusing to people who are new to ruby &#38; a friend of mine recently asked me to explain it(hence this blog post). so I am this post we will talk <a href='http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The Ruby Programming language has two different ways by which you can represent strings in your programs:</p>
<ol>
<li>String</li>
<li>Symbol</li>
</ol>
<div>IMO, This stuff is the most confusing to people who are new to ruby &amp; a friend of mine recently asked me to explain it(hence this blog post). so I am this post we will talk about the following:</div>
<div>
<ol>
<li>what is a symbol?</li>
<li>The main differences between symbol &amp; string?</li>
<li>When to use symbol instead of string?</li>
</ol>
</div>
<div></div>
<div>so, without wasting further time, here is the brain-dump of my explanation on symbols vs strings in ruby</div>
<h3>What is a symbol?</h3>
<p>A symbol is a string which is prefixed colon at starting. In other words, if you take ruby string such as &#8220;gaurish&#8221;, &#8216;gaurish sharma&#8217; or &#8220;gaurish-sharma&#8221; &amp; prefix a colon(&#8216;:&#8217;) at te start, you get a symbol.  here is can example.</p>
<h3>Two ways to do the essentially the same thing. Why?</h3>
<p>Yes, you guessed it right. Strings &amp; Symbols are essentially the thing. so why have two diffident &#8220;types&#8221; to represent string? The reason is how strings are implemented in ruby.</p>
<blockquote><p>In Ruby, Everything is a Object including Strings</p></blockquote>
<p>Due to SmallTalk influence, Ruby is fully object oriented language &amp; there are no primitive types. Everything is implemented as Objects. so, when ever you try to assigned a string value to an variable like this x = &#8220;foo&#8221;, you are creating a new object in memory. Here is an small program which allocates same string to a variable 1,000 times &amp; prints object_id of each string<script type="text/javascript" src="https://gist.github.com/gaurish/5344872.js"></script></p>
<p>As you may notice from terminal output of this program/script that each string has different object_id. ruby does creates a new object in memory every single time even thought the string is the same.</p>
<h4>Wonder, if there is a another way?</h4>
<p>How can I have strings which create object in memory once &amp; all later operations refer to that previously created object with same object_id?</p>
<p>Glad: you asked. Enter Symbols! here is the same program with symbols.<br />
<script type="text/javascript" src="https://gist.github.com/gaurish/5345032.js"></script></p>
<p>In contrast with string, Notice how object_id is same for symbols which means its the same symbol.</p>
<h3>What are the differences between Symbols &amp; Strings?</h3>
<ol>
<li>Symbols are immutable: Their value remains constant.</li>
<li>Multiple uses of the same symbol have the same object ID and are the same object compared to string which will be a different object with unique object ID, everytime.</li>
<li>You can&#8217;t call any of the String methods like #upcase, #split on Symbols.</li>
</ol>
<h3>When to use symbol instead of string?</h3>
<p>Symbols generally have performance benefits. so will see their usage almost everywhere including getters &amp; setters in classes, hash keys etc. here is few examples</p>
<pre class="brush: ruby; title: ; notranslate">
#you will NEVER see this
class Foo
  attr_reader &quot;name&quot;
end

# Instead, you will ALWAYS see a symbol
class Foo
  attr_reader :name
end
#same thing but symbols are faster than strings
</pre>
<h4>to use strings when:</h4>
<ol>
<li>you want to use any of string methods like #upcase, #split, #downcase etc.</li>
<li>you want to change/mutate the string</li>
</ol>
<h4>to use Symbols when:</h4>
<ol>
<ol>
<li>symbols can&#8217;t be changed at runtime. If you need something that absolutely, positively must remain constant</li>
<li>Places where same string is going to be repeatably used, example hash keys are pretty good candidate for symbols<span style="font-size: 13px; line-height: 19px;">. so instead of string keys,<em> hash["key"] = value</em>. you should  use symbols like this  <em>hash[:key] = value </em></span></li>
</ol>
</ol>
<p>To conclude, strings &#038; symbols in ruby are similar but differences given above. But the main difference is that symbols are immutable &#038;   slightly more performant than strings so you should you them place where you know same string is likely to be repeated again &#038; again. </p>
<p>Related posts:<ol>
<li><a href='http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html' rel='bookmark' title='New Ruby 1.9 hash syntax'>New Ruby 1.9 hash syntax</a></li>
<li><a href='http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html' rel='bookmark' title='Ruby vs Java: Why do I like ruby more'>Ruby vs Java: Why do I like ruby more</a></li>
<li><a href='http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html' rel='bookmark' title='Contributing to Ruby on Rails &#8211; A Guide'>Contributing to Ruby on Rails &#8211; A Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Contributing to Ruby on Rails &#8211; A Guide</title>
		<link>http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html</link>
		<comments>http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html#comments</comments>
		<pubDate>Sun, 16 Dec 2012 15:41:34 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=785</guid>
		<description><![CDATA[Recently, I have started contributing to Ruby on Rails &#8212; the popular web framework for quickly building web applications. I have just started but couple of my commits have been merged into rails core &#38; have a pretty good idea on contributing&#160; to rails. this guide details how you can start contributing to rails. Step <a href='http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I have started contributing to <a href="http://rubyonrails.org/">Ruby on Rails</a> &#8212; the popular web framework for quickly building web applications. I have just started but <a href="http://contributors.rubyonrails.org/contributors/gaurish-sharma/commits">couple of my commits have been merged into rails core</a> &amp;  have a pretty good idea on contributing&nbsp; to rails. this guide details how you can start contributing to rails.</p>
<h2>Step 0 &#8211; Decide what to contribute</h2>
<p>It could be a bug or feature that you want aka starch your itch. It could a bug fix in which cause check github issue tracker for existing issues &amp; see if you can fix anyone of them and send a Pull Request. It could be removing a warning from test. Or it would contributing documentation.</p>
<h2>Step 1 &#8211; Fork &amp; Change</h2>
<p>This is rather simple but you must know how to use git &#8211; the popular distributed version control system. If you don&#8217;t then please following this guide closely &amp; read multiple times until you understand.</p>
<ul>
<li>Goto rails page on github &amp; click the &#8220;Fork&#8221; button on the top. requires github account. so register if not already done. Its free!</li>
<li>You&#8217;ve successfully forked rails, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.
<pre class="brush: bash; title: ; notranslate">
git clone https://github.com/your_github_username_goes_here/rails.git
# Clones your fork of the repo into the current directory in terminal
</pre>
</li>
<li>Create a new branch
<pre class="brush: bash; title: ; notranslate">
$ git checkout -b my_branch
</pre>
</li>
<li>Create new rails app based on your fork
<pre class="brush: bash; title: ; notranslate">
        $ /replace/with/path/to/your/rails/fork/railties/bin/rails new app_name_goes_here --dev
        </pre>
</li>
<li>Do your changes. Now whatever changes you do, would instantly get reflected into your rails app. Once you are okay with said changed, commit them
<pre class="brush: bash; title: ; notranslate">
            $ git commit -a -m &quot;Describe your change in this message&quot;
            # commit your changes. make sure to follow the guidance of a good commit message
       </pre>
</li>
</ul>
<h2>Step 2 &#8211; Create a Pull Request</h2>
<p>so you have made your change, tested it.Sweet! Now, its time to send your awesome changes to rails core team for review.</p>
<ul>
<li>Add Upstream:
<pre class="brush: bash; title: ; notranslate"> $ git add remote git@github.com:rails/rails.git </pre>
</li>
<li>switch back to master, pull latest changes
<pre class="brush: bash; title: ; notranslate">
         $ git checkout master
	 $ git pull --rebase upstream master
</pre>
</li>
<li>Switch back your branch &#038; Reapply your changes ontop of latest changes of the rails&#8217; upstream master
<pre class="brush: bash; title: ; notranslate"> $ git checkout my_branch
$ git rebase master
</pre>
</li>
<li>In the process of the rebase, it may discover conflicts. In that case it will stop and allow you to fix the conflicts. After fixing conflicts, use <strong>git add .</strong> to update the index with those contents, and then just run:
<pre class="brush: bash; title: ; notranslate">
$ git rebase --continue
</pre>
</li>
<li>Push branch to GitHub
<pre class="brush: bash; title: ; notranslate">
$ git push origin my_branch --force
</pre>
</li>
<li>Open Pull request using <a href="https://help.github.com/articles/using-pull-requests">github&#8217;s web-interface</a>.</li>
</ul>
<p>Congratulation on your contribution! Now, wait for comments on the Pull request.</p>
<h2>Step &#8211; 3</h2>
<p>Once your Pull request is opened, most probably someone will suggest 1 or 2 changes.&nbsp; hers is how to do them:</p>
<ol>
<li>switch to your feature branch
<pre class="brush: bash; title: ; notranslate">
	$ git checkout my_branch
</pre>
</li>
<li>make changes &amp; commit</li>
<li>squash changes into one commit. rule is one feature == one commit</li>
<li>force push</li>
</ol>
<p>To close, let me welcome you the world of open source.&nbsp; where code you write gets used by thousands of developers &amp; affects lives of millions of people around the world. Its pretty amazing!</p>
<p>Related posts:<ol>
<li><a href='http://www.gaurishsharma.com/2012/04/enable-gzip-compression-for-rails-3-2-on-heroku-cedar.html' rel='bookmark' title='Enable gzip compression for Rails 3.2 on heroku Cedar'>Enable gzip compression for Rails 3.2 on heroku Cedar</a></li>
<li><a href='http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html' rel='bookmark' title='Understanding Differences Between Symbols &amp; Strings in Ruby'>Understanding Differences Between Symbols &#038; Strings in Ruby</a></li>
<li><a href='http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html' rel='bookmark' title='Ruby vs Java: Why do I like ruby more'>Ruby vs Java: Why do I like ruby more</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is cloud computing?</title>
		<link>http://www.gaurishsharma.com/2012/09/what-is-cloud-computing.html</link>
		<comments>http://www.gaurishsharma.com/2012/09/what-is-cloud-computing.html#comments</comments>
		<pubDate>Sat, 01 Sep 2012 08:23:19 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Editorial]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=773</guid>
		<description><![CDATA[Recently, I asked this question to group of people &#38; they have given different answers: Cloud computing is platform which provides &#160;free space where we can keep our data securely.example gmail,Dropbox Cloud &#160;provides you software on rent Cloud is the new type of hosting. Earlier we had shared,dedicated &#38; now cloud hosting Cloud allows you <a href='http://www.gaurishsharma.com/2012/09/what-is-cloud-computing.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I asked this question to group of people &amp; they have given different answers:</p>
<blockquote><p>Cloud computing is platform which provides &nbsp;free space where we can keep our data securely.example gmail,Dropbox</p></blockquote>
<blockquote><p>Cloud &nbsp;provides you software on rent</p></blockquote>
<blockquote><p>Cloud is the new type of hosting. Earlier we had shared,dedicated &amp; now cloud hosting</p></blockquote>
<blockquote><p>Cloud allows you to rent computer(resources), so you can do work that requires i7 CPU with much slower intel Atom processor.</p></blockquote>
<p>Are these people correct? this is what cloud computing means? Well&#8230;yes &amp; no. Confused?</p>
<h2>What is<span id="more-773"></span> Cloud?</h2>
<p>Cloud is different things to different people. The perspectives are very different; depending upon whom you are you asking this question. &nbsp;such as,</p>
<ul>
<li>to&nbsp;<strong>consumers/non-technical&nbsp;people</strong>: Services like Dropbox,Gmail&nbsp;are cloud computing to them.</li>
<li>to&nbsp;<strong>developers</strong>: Cloud is On Demand,elastic &amp; Pro-rata billed, virtualized resource for running applications. Cloud allows us developers to stay developers &amp; not have to become system administrator.</li>
<li>to&nbsp;<strong>Sysadmins/DevOps</strong>: Cloud is platform that virtulizes the entire IT infrastructure, including servers, storage and networks. A<br />
cloud combines these resources into a simple and uniform set of computing resources in the virtual environment. Due to its easy provisioning &amp; elastic nature cloud could be used to solve hard scaling problems like Scaling apps from 1 request/minute to 1,000requests/second &amp; then back to 1 request/minute.This &nbsp;kind of brust-scaling which was really hard to with bare-metal resources. But its much easier wth cloud computing</li>
<li>to&nbsp;<strong>CIOs/CEO</strong>: Cloud is new way using which we can manage IT infrastructural resources as a shared utility, and can dynamically provision these resources efficiently to different business units and projects, without worrying about the underlying hardware differences and limitations</li>
<li>to&nbsp;<strong>Journalists</strong>: Cloud is new Buzz word that everybody keeps is talking about &amp; has a lot of activity, hence lot of articles/editorial needs to&nbsp;written about it.</li>
</ul>
<h2>In My opinion, what is cloud computing according?</h2>
<p>To me, when someone says cloud; depending upon the context it could represent any of the following:<br />
Cloud can be Application hosting platform(Google App engine, Microsoft Azure), Cloud can be Consumer Internet service like Gmail Dropbox, Cloud can be On-demand virtual machines,Cloud can be way of managing I.T infrastructure(servers,storage, networks etc) &amp; so on&#8230;</p>
<p>Hence, I like to think Cloud computing more as marketing term which doesn&#8217;t mean much, but at same time its a term that most people across spectrum can understand enough get hint on what it it could it be related to. &nbsp;This marketing term also &nbsp;helps to push latest advances in Virtualization Technology, IT resource&nbsp;managent, Deployment &amp; provisioning tools, &nbsp;Standardization &amp; Inter-<em>Operability efforts.&nbsp;</em>. so the term might be vague &amp; may have different meaning depending upon the context which it is an useful term explaining all these areas.</p>
<p>So, that how I think about The cloud. what comes to your mind when you think about cloud?</p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/09/what-is-cloud-computing.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basics of Search Engine Optimization</title>
		<link>http://www.gaurishsharma.com/2012/08/basics-of-search-engine-optimization.html</link>
		<comments>http://www.gaurishsharma.com/2012/08/basics-of-search-engine-optimization.html#comments</comments>
		<pubDate>Sun, 12 Aug 2012 09:21:57 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Guides and Howtos]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=248</guid>
		<description><![CDATA[Note: This Search Engine Optimization Tutorial that I wrote years ago when i was into SEO but never published it. It had been lying as draft all these years, never finished. today, I discovered it while cleaning my drafts &#38; decide to publish it in its current state as it is. so warning this might contains lot of <a href='http://www.gaurishsharma.com/2012/08/basics-of-search-engine-optimization.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<div id="post_message_22913" class="vb_postbit"><strong>Note:</strong> This Search Engine Optimization Tutorial that I wrote years ago when i was into SEO but never published it. It had been lying as draft all these years, never finished. today, I discovered it while cleaning my drafts &amp; decide to publish it in its current state as it is. so warning this might contains lot of errors, please read at your own risk.</div>
<div class="vb_postbit"></div>
<div class="vb_postbit"></div>
<div class="vb_postbit"></div>
<div class="vb_postbit"></div>
<hr />
<div class="vb_postbit">this is basic tutorial which makes you understand the basics of Search Engine Optimization (SEO), search engine optimization is more than page optimization, it depends on many factors like link building, quality of incoming links etc.<br />
So lets start with the basics.<br />
<strong></strong></div>
<div class="vb_postbit"></div>
<div class="vb_postbit"><strong>What is search engine optimization?</strong></div>
<div id="post_message_22913" class="vb_postbit">
<p>Its a magic which no one can understand, kidding <img src="http://www.whoisdeep.com/wp-includes/images/smilies/icon_wink.gif" alt="" border="0" /> Actually, It is a simple concept which any kid can understand. It works like this:</p>
<p>For a human being, to become popular he needs to do something extra ordinary so that whole world can know about it and he becomes known face in the world from nowhere. So same logic applies for websites also, to make your website popular first you need to do something good so that other people know about it, for example: you have a genuine site with good content and once people know about it they talk about the site (provide links, give your site links in forums, sites, blogs etc)</p>
<blockquote>
<h4>Search engine optimization is a process of taking something extra ordinary out of your site and let the whole world know about it.</h4>
</blockquote>
<p>Now to make your site known to<span id="more-248"></span> public you will have to do few things on your site.Lets start by explaining things one by one in short which are important part of your site and are helpful for ranking:-</p>
<div><span style="text-decoration: underline;"><strong><br />
On Page Factors</strong></span></div>
<p><strong>Page Title: </strong>The most important part. Page title plays major role in SEO, your page title must contain the keywords you are optimizing page for. Let me give you one example:<br />
Our example keyword is Technology Blog</p>
<p><strong><em>Title 1:</em></strong> <em>Example.com &#8211; Your own Technology Blog</em><br />
<strong><em>Title 2:</em></strong> <em>Technology Blog &#8211; Your own Tech Blog by Example.com</em></p>
<p>Now from above 2 examples Title 2 is correct because it gives keywords as first preference than the site. It also includes one more keyword &#8211; Tech Blog &#8211; so you can optimize for one more keyword on the same page. Here is why Title 1 is not correct.</p>
<p>Title 1 started with the site name i.e. example.com which people are going to hardly search but the main keyword &#8211; Technology Blog &#8211; which gets search by people, is given last preference.</p>
<p><strong>Meta Keywords: </strong>Many people say that none of the search engines do not use Meta Keywords tag but I do not agree with it. But there are still search engines which give preference to Meta Keyword tags.</p>
<p>This tag should only include the keywords which you are optimizing our page for.In our case the keywords will be technology blog, tech blog. Many people just stuff the Meta Keywords tag with useless keywords but there is no point in doing that, you will never get top tanking with it. Adding long list of keywords in the tag won&#8217;t give you top ranking at any cost.</p>
<p><strong>Meta</strong><strong> Description: </strong>This tag plays very important part in the ranking. Many search engines fetch content from this tag. Best example about this would be search engine Google. Google fetches description of the site from Meta Description tag and if not present, page content is used. So if you use your keywords in a smarter way then it makes sense to both, users searching for the keyword as well as search engines.<br />
Let me explain this by examples:</p>
<p><strong><em>Description 1:</em></strong> Technology Blog, Tech Blog, Technology Blog India, Tech Blog India. Example.com is India&#8217;s best Technology Blog. Example.com is India&#8217;s best Tech Blog.<br />
<strong><em><br />
Description 2: </em></strong>Technology Blog &#8211; India&#8217;s First Tech Blog with latest happening in the technology world. Technology news, tech reviews and more</p>
<p>Now in this 2nd Description is more readable than the first one. It makes more sense to users reading as well as for search engines. The keywords are not repeated many times but are framed such way that it makes proper sentence as well as includes keywords more than once.</p>
<p>So stuffing keywords is certainly not the way to get higher ranking but still few sites succeed in it but sooner or later search engines will detect and consider those sites as spam. So it is always better to play safe.</p>
<p><strong>Page Content:</strong>People say content is king and I won&#8217;t disagree with that but at the same time I would call Page Title and Meta Description also as king because they are as important as page content. I have seen many sites with less content but powerful Title and Description tag on top and I have also seen sites on top with no description, no keyword tags..just Page title and Page content. so content is really the king. Page content should contain the keywords but like I said earlier, the keywords should not be stuffed in the content. The content should be readable to the users. Person should not use the hidden text i.e. keeping text color same as page background or use CSS to hide the text. It is always better to use heading tags in the page i.e. H1, H2 etc but it should be used only when it is needed and misuse of these tags may land you up in a ban from search engines. Now a days search engines (Specially Google) are becoming very smart and detects search spam done using Heading Tags and CSS. Google employee, <a href="http://www.mattcutts.com/blog/type/googleseo/">Matt Cutts blog</a> gives very good information on Search Spam.</p>
<p><strong>Footer:</strong>This part should contain link to the important section of the site and in this you can include keywords too. For example if you have 2 different sections News and Reviews then you can have links with text Technology News, Tech Reviews etc.Some people prefer stuffing keywords with the footer copyright note but there is no point in that and should not be done.</p>
<p><strong>Site Map:</strong>This should be the page containing links to main pages of the site. This will help search engines and users to find the sections of the site. Search engine crawlers will crawl through the links provided on that page and include them in the search index. (It is possible that it may not crawl all at the same time but sooner or later the pages get included)</p>
<p><strong>Resources or Links section: </strong>If you are optimizing the site then you can have this section for link exchange. You can include the links of your link partners or in simple worlds, the guys with whom you have exchanged links. More the links you have coming from various sites, more it helps. Search engines will find more sites pointing to you and will increase the importance of your site. (<em>This section is not necessary in all the cases. You can also optimize the site without this section too.</em>)</p>
<p>Now this does not mean that you have to exchange links with every other site you see in the world. It is always better to exchange links with the sites in your theme and make sure that you ask them to write your keywords in your link.<br />
Following examples will make you understand it properly.</p>
<p>For a technology blog, there is no point in getting links from sites which are totally in different category. i.e. getting links from sites dealing in clothes, gifts or link directories which are not related to technology. Google will consider them as a link but the value of link coming from technology site will be much higher than the one coming from non-technology site. Getting links from tech forums or other technology blogs could help a lot.</p>
<p>Now 2nd part of this is, including keywords in the link:</p>
<p><strong><em>Link 1:</em></strong> Example.com<br />
<strong><em>Link 2:</em></strong> Example.com &#8211; Technology Blog and Tech Reviews</p>
<p>From above examples 2nd one is better because it includes the keywords of your site and it will make search engines understand that, example.com contains Technology Blog and Tech Reviews.</p>
<p><strong>Page Code: </strong>This is not very important part for many sites but yes it should not be ignored too. Cleaner the code, better the chances. Many people will disagree with this but somewhere down the line, page code plays some role in optimization.<br />
Many people use table to create the layout. there is nothing wrong in it, the person should use whatever he is comfortable with it BUT the code should be clean i.e. there should not be many unnecessary tags.The same thing can be driven by CSS and this will make code clean and search engines will find your page content easily compared to messy code.</p>
<p>I personally use CSS based layouts for my websites because I feel that it makes code cleaner because of less lines and everything is driven by CSS file so pages are also of less size and it also saves bandwidth.</p>
<div><span style="text-decoration: underline;"><strong>Off site factors</strong></span></div>
<p>Once modifications are done with the site, you will have to move on to submitting the sites to directories.</p>
<p><strong>There is no need to submit the sites in search engines</strong>. The ones who say, we will submit your site to xxx number of search engines and all are just fake. Till now (as far as I know) only 3 major search engines are present; Google, Yahoo and MSN. These 3 search engines have their different crawlers. Rest of the search engines just use combination of search results generated by these 3 major search engines. There are few more search engines which use their own crawlers but they still use combination of search data from these 3 major search engines.</p>
<p>To get your site listed all you have to do is, get a link from the site which is already listed in search engines. For example: if any of your friends is having a site or blog which is already listed in search engine, ask him to provide your link on his site, search engine will visit his site, find your link (if easily visible), follow the link and jump to your site. so this way your site will also get listed. <strong>OR </strong>if you have RSS feed of your site, you can submit it to Yahoo, Technorati and other blog search networks. This should help to get the site crawled quickly.</p>
<p>Now let&#8217;s move to <strong>Submitting the site to directories: </strong>For this you will have to pick selected directories only i.e. no point in submitting the sites to the directories which are meant just for spam purpose. Generally the spam directories have many links on the page as sponsored section. I have seen few directories with keyword stuffed links in header, footer and right navigation area. So it is better to stay way from these sites.</p>
<p>Directories like <a href="http://www.dmoz.org/" target="_blank">Dmoz</a>, <a href="http://www.botw.org/" target="_blank">Best of the world</a> (BOTW) are examples of good directories. (BOTW is paid now)</p>
<p>There are many paid directories too but I personally won&#8217;t suggest submitting the site to paid directory unless it is needed. In some industries paid directories are must and very helpful in generating leads and sales. But in our example technology blog, there is no need to submit the site to paid directories and waste money.</p>
<p>The list of good directories can be found <a href="http://www.webproworld.com/viewtopic.php?t=21900" target="_blank">here</a></p>
<p>The other important factor in search engine optimization is:</p>
<p><strong>Link</strong><strong> Building. </strong>this factor mainly deals with getting links from other websites or exchanging links with other</p>
<p>websites. You can use sites like <a href="http://www.linkmarket.net/" target="_blank">Link Market</a>, <a href="http://www.linkmetro.com/" target="_blank">Link Metro</a> etcâ€¦</p>
<p>But I must remind you, <strong>these link exchange sites are helpful only for basic purpose, for serious SEO purpose, you need to go way beyond these link exchange sites.</strong></p>
<p>That&#8217;s it, I this is the end of 3year old post. Hope it is helpful to some people. And pleas excuse me for errors, if any<br />
<strong></strong></p>
<p>Source:<a title="Gaurish Sharma" href="http://www.gaurishsharma.com/">who else, me</a></p>
</div>
<p><!-- / message --><br />
<script type="text/javascript">// <![CDATA[
&lt;!-- google_ad_client = "pub-5548414865458161"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-05-27: Forum Post google_ad_channel = "8614829638"; google_color_border = "EAF4FF"; google_color_bg = "EAF4FF"; google_color_link = "1C5CAD"; google_color_text = "636363"; google_color_url = "636363"; //--&gt;
// ]]&gt;</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">// <![CDATA[</p>
<p>// ]]&gt;</script></p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/08/basics-of-search-engine-optimization.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating my Blog to AppFog Cloud: Initial Impressions</title>
		<link>http://www.gaurishsharma.com/2012/08/migrating-my-blog-to-appfog-cloud-initial-impressions.html</link>
		<comments>http://www.gaurishsharma.com/2012/08/migrating-my-blog-to-appfog-cloud-initial-impressions.html#comments</comments>
		<pubDate>Wed, 01 Aug 2012 13:08:33 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Guides and Howtos]]></category>
		<category><![CDATA[appfog]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[pass]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=723</guid>
		<description><![CDATA[AppFog Paas, a cloud hosting platform launched into general availability &#38; released their pricing. Since, the pricing looks attractive, I decided to try Appfog over the weekend by migrating this wordpress blog over there. So, if you want to know how Appfog is or just want to learn how to host your wordpress blog on appfog <a href='http://www.gaurishsharma.com/2012/08/migrating-my-blog-to-appfog-cloud-initial-impressions.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://appfog.com/products/appfog/">AppFog Paas</a>, a cloud hosting platform launched into general availability &amp; released their <a href="https://console.appfog.com/pricing">pricing</a>. Since, the pricing looks attractive, I decided to try Appfog over the weekend by migrating this wordpress blog over there. So, if you want to know how Appfog is or just want to learn how to host your wordpress blog on appfog for FREE, read on!</p>
<h3>What is AppFog?</h3>
<p>AppFog is a Cloud Hosting platform which is categorized as <strong>P</strong>latform <strong>a</strong>s <strong>a</strong> <strong>S</strong>ervice(PaaS). PaaS is the thing that lets developers stay developers but still empower them to deploy applications that can reach millions.  Basically, PaaS saves you from having to do system administration &amp; focus only on development of your web application. think of all the tasks you have to do when a new box is commissioned into production; they are silly things like installing web server,download &amp; compile PHP/ruby, installing security update, firewall &amp; security configuration &amp; countless other small configurations &amp; optimizations. With PaaS like Appfog,  you get that application environment ready out-of-the-box  &amp; with lots of other features like scaling, cloning etc. Appfog supports multiple runtimes,  PHP(v5.3),Ruby MRI(v1.9), Java(v7), Node.js(v0.4 &amp; v0.6), Python(v2.7) &amp; Erlang(R14).</p>
<h3>Why should I care about AppFog?</h3>
<p>Agreed, there are a lot of other PaaS solutions like Google App Engine, Redhat&#8217;s OpenShift, Salesforce&#8217;s Heroku, Microsoft&#8217;s Azure and many others but I am going to give 2 things that according to me are special about Appfog:</p>
<ol>
<li><strong>Ability to Choose Underlying Cloud Platform &amp; Locations:</strong> Appfog lets you pick almost any cloud(current supported are AWS, Rackspace, Azure &amp; HP&#8217;s Openstack) with choice of location where your app would be hosted(current locations are in US,Europe &amp; Asia). This is in sharp contract with PaaS solutions like heroku where you are forced to host in US even half of your traffic comes from other parts of the world resulting increased latency. With Appfog, you can seamlessly deploy your application to multiple clouds at different locations. Thereby reducing <a href="http://en.wikipedia.org/wiki/Single_point_of_failure">SPOF</a></li>
<li><strong>Generous Free Quota: </strong><a href="https://console.appfog.com/pricing">Free plan</a> gives you total 2 GB RAM(per account) which scalable over multiple instances, 1GB Database(per account), 50 GB data transfer limit(per account) &amp; 100mb diskspace(per application). Except the 100mb diskspace, all others are pretty generous.  There is a comparison of appfog with other PaaS solutions on what you have to pay for 4 instances with 512MB each:<br />
<table>
<thead>
<tr>
<th>Pass Provider</th>
<th>Price/mo</th>
</tr>
</thead>
<tbody>
<tr>
<td>dotcloud</td>
<td>$276</td>
</tr>
<tr>
<td>Heroku</td>
<td>$107</td>
</tr>
<tr>
<td>AppFog</td>
<td><strong>$0</strong></td>
</tr>
</tbody>
</table>
</li>
</ol>
<div>Based, on the two reasons given<span id="more-723"></span> above, I set out to try Appfog by migrating this wordpress powered blog from self-managed VPS to AWS Singapore.</div>
<h3>The Great WordPress Migration</h3>
<p>creating new applications on appfog is straightforward &amp; trivial thanks to nicely designed web console. Migrating existing apps involves few extra steps.In this part, I will describe how i got this blog running on a VPS migrated to Appfog. feel Skip this part, if you do not plan to run any PHP. However, if you plan to move your wordpress blog here, this is something you should read:</p>
<ol>
<li><strong>Download file backup &amp; the Database dump</strong>(.SQL file) of your blog from your existing host.</li>
<li><strong>Install ruby</strong>: we are going to the af command line tool to interact with appfog(reason in next section).  <em>af </em>is a rubygem which needs ruby to run. Unless, you have ruby programming language already installed like me(hello there, fellow rubyist!) you need to:
<ul>
<ul>
<li>On Windows: Download &amp; install <a href="http://railsinstaller.org/">railsinstaller</a></li>
<li>On Linux or Mac: Use rvm.  just run the following command
<pre class="brush: bash; title: ; notranslate">curl -L get.rvm.io | bash -s stable</pre>
<p>for further details, see check out the <a href="https://rvm.io/rvm/install/">RVM installation page</a> or just watch the video below <iframe src="http://www.youtube.com/embed/MiAz0DnnY_k" frameborder="0" width="640" height="360"></iframe>Once you have installed ruby, Verify ruby is correctly installed &amp; is above version 1.9.2</p>
<pre class="brush: bash; title: ; notranslate">
$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
</pre>
</li>
</ul>
</ul>
</li>
<li><strong>Install &amp; setup af tool</strong>: Now, time that you open your command prompt/terminal and start typing following commands. Install af tool
<pre class="brush: bash; title: ; notranslate">
$ gem install af
Successfully installed af-0.3.16.5
1 gem installed
Installing ri documentation for af-0.3.16.5...
Installing RDoc documentation for af-0.3.16.5...
 </pre>
<p>login with appfog account</p>
<pre class="brush: bash; title: ; notranslate">
$ af login
Attempting login to [https://api.appfog.com]
Email: user@example.com
Password: ***
</pre>
</li>
<li><strong>Configure Database details:</strong>In Appfog, the database details are set as environment variables, so we need to edit wp-config.php and tell wordpress. basically, you need to replace staic values:
<pre class="brush: php; title: ; notranslate">
define('DB_NAME', 'db_name');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
define('DB_PORT', 3306);
</pre>
<p>with the environment variables</p>
<pre class="brush: php; title: ; notranslate">
$services_json = json_decode(getenv('VCAP_SERVICES'),true);
$mysql_config = $services_json['mysql-5.1'][0]['credentials'];
define('DB_NAME', $mysql_config['name']);
define('DB_USER', $mysql_config['user']);
define('DB_PASSWORD', $mysql_config['password']);
define('DB_HOST', $mysql_config['hostname']);
define('DB_PORT', $mysql_config['port']);
</pre>
</li>
<li><strong>Create the app</strong>: now, we are going to create the application &amp; upload it on the cloud. for that first cd into the directory where you blog files are stored. for example, I have my files stored at /home/gaurish/wordpress so navigate to that director. remember, to cd into the directory &amp; not outside the directory.
<pre class="brush: bash; title: ; notranslate">$ cd /home/gaurish/wordpress/</pre>
<p>next, lets create the application. the commands are self-exploratory</p>
<pre class="brush: bash; title: ; notranslate">
gaurish@DEN:~/wordpress$ af push
Would you like to deploy from the current directory? [Yn]: Y
Application Name: gaurishblog
Detected a PHP Application, is this correct? [Yn]: Y
Application Deployed URL [gaurishblog.aws.af.cm]: gaurishblog.aws.af.cm
Memory reservation (128M, 256M, 512M, 1G, 2G) [128M]: 512M
How many instances? [1]: 1
Bind existing services to 'gaurishblog'? [yN]: n
Create services to bind to 'gaurishblog'? [yN]: Y
1: mongodb
2: mysql
What kind of service?: 2
Specify the name of the service [mysql-7149]: mysql-gaurishblog
Create another? [yN]: n
Would you like to save this configuration? [yN]: Y
Manifest written to manifest.yml.
Creating Application: OK
Creating Service [mysql-gaurishblog]: OK
Binding Service [mysql-gaurishblog]: OK
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK
Push Status: OK
Staging Application 'gaurishblog': OK
Starting Application 'gaurishblog': OK</pre>
<p>If you see output similar to above, you have successfully created an application. if it fails to try checking the logs</p>
<pre class="brush: bash; title: ; notranslate">af logs gaurishblog --all</pre>
</li>
<li><strong>Migrate database:</strong>appfog doesn&#8217;t offer with direct access to database. so I created a tunnel to reach mysql using caldecott gem &amp; import SQL dump file into mysql. Please note the tunnelling support is not available in all locations(ex not available in Asia, Europe). 
<pre class="brush: bash; title: ; notranslate">
$ gem install caldecott
$ af tunnel
1: mysql-gaurishblog
Which service to tunnel to?: 1
Binding Service [mysql-gaurishblog]: OK
Stopping Application 'caldecott': OK
Staging Application 'caldecott': OK
Starting Application 'caldecott': OK
Getting tunnel connection info: OK

Service connection info:
  username : uXopxxxxmeI7
  password : plwWxxxxxekQPg
  name     : db25966b4xxxxxxxxxxx7dc515acf2c4

Starting tunnel to mysql-gaurishblog on port 10000.
1: none
2: mysql
3: mysqldump
Which client would you like to start?: 1
Open another shell to run command-line clients or
use a UI tool to connect using the displayed information.
Press Ctrl-C to exit...
</pre>
<p>at this point the remote mysql database is been tunneled on your localhost.   you can use the given the Service connection info given above to import data using Mysql CLI client or install GUI client like <a href="http://www.mysql.com/downloads/workbench/">Mysql Workbench</a>.for mysql CLI client, open a new command prompt or terminal and enter</p>
<pre class="brush: bash; title: ; notranslate">
$ mysql --protocol=TCP -P 10000 -h localhost -u uXopxxxxmeI7 -p'plwWxxxxxekQPg' db25966b4xxxxxxxxxxx7dc515acf2c4 &lt; /path/to/mysqldump.sql
</pre>
<p>For Mysql Workbench, use the following parameters: <a href="http://imgur.com/KKzuq"><img src="http://i.imgur.com/KKzuq.png" alt="" /></a></li>
<li><strong>Custom Domains</strong>: Now, my site was running on <em>gaurishblog.aws.af.cm</em> but I need to map it gaurishsharma.com. Good thing is Appfog allows to set up custom domains even on free plan! to make it work, I had to do two things. first, add <em>gaurishsharma.com</em> to Domain name list in web console. Second, create a new CNAME record for <em>www.gaurishsharma.com</em> pointing to <em>cname01.us01.aws.af.cm</em>. This worked but I still need to resolve <em>gaurishsharma.com</em>. However, as noted in the Web Console -&gt; Domains, currently root-level domains are not supported. so As a workaround, I setup a URL forwarder using <a href="http://blog.cloudflare.com/introducing-pagerules-url-forwarding">cloudflare&#8217;s page rules</a> to send all traffic from root domain(<em>gaurishsharma.com</em>) to <em>www.gaurishsharma.com</em>. Worked Perfectly!<a href="http://imgur.com/tvZte"><img title="" src="http://i.imgur.com/tvZte.png" alt="cloudflare" /></a></li>
</ol>
<h3>Initial Impressions</h3>
<ul>
<li><strong>No Vendor Lock-in, Multiple Clouds</strong>: As said earlier, Appfog allows you to choose which between different cloud platform along with server locations which is cool, if you don&#8217;t want to rely on single vendor &amp; establish multi-cloud solution. And incase you are worried about lock-in with Appfog itself, you might be pleased to know that Appfog is based on VMware&#8217;s opensource Cloudfoundry platform.</li>
<li><strong>Free Plan</strong> which gives you generous resources which is compelling reason to try Appfog.Also, Appfog seems like excellent platform to run your personnel blog on for FREE</li>
<li><strong>Command Line tool is swiss army knife: </strong>the af CLI tool is handy and works well. Af gem can manage everything related to your appfog account with ease.</li>
<li><strong>Web console is a dud:</strong>, works sometimes but sometimes starts spliting out errors for some reason. Example, I tried creating a new php app at AWS Singapore from their web control panel &amp; <a href="http://i.imgur.com/wocw7.png">nothing was created</a>. app didn&#8217;t show up, tried multiple times; <a href="http://i.imgur.com/Z8Krw.png">didn&#8217;t work</a>. sometimes the app would show up in the app list but open it in browser but then nginx would throws 404 &#8211; page not found error at you.  This left a bad first impression &amp; bitter taste as Appfog is not beta service but they want to be used as platform to host production applications! But to credit of appfog, they reached out to me on <a href="http://news.ycombinator.com/item?id=4305133">Hacker new</a> &amp; offered support on <a href="https://twitter.com/gaurish/status/229152276768518144">twitter</a>(even though I was free user!). In morning the same app which was throwing 404, started working just fine. I was greeted with WordPress 3-step install screen.</li>
<li>There are <strong>Rough edges:</strong>  There are some of rough edges.When I uploaded my blog files to appfog using <em>af update. </em>the process worked flawlessly(no errors) &amp; blog did start to appear. But few minutes after, mischievously nginx gave 404s. Later, I checked logs &amp; found that I was exceeding disk-space limit of 100mb.      My fault but the thing is at no-point I was informed that I had exceeded diskspace nor there were any errors  during af update or af push.  This should have been handled better.</li>
<li>PHP Platform: As per <a href="http://php-info.aws.af.cm/">phpinfo()</a>They seems to be using standard packages provided Ubuntu with which support all common php extensions. further, the storage is not writable which the same with all mordern PaaS. Nothing wrong but something you have to keep in mind specially for PHP apps like WordPress.</li>
</ul>
<h3>Conclusion</h3>
<p>Inspite of all its current bugs, AppFog is a seems a promising PaaS platform because it is cheaper than other PaaS specially if you are running CPU intensive applications, their pricing model is simple, supports multiple runtimes,clouds &amp; service locations. And not to mention they seem to have good support. I personally, would use Appfog to host my blog &amp; host my rails application under development.</p>
<p>What about you? How is your experience with Appfog</p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/08/migrating-my-blog-to-appfog-cloud-initial-impressions.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>This is why you should Pay me more</title>
		<link>http://www.gaurishsharma.com/2012/06/this-is-why-you-should-pay-me-more.html</link>
		<comments>http://www.gaurishsharma.com/2012/06/this-is-why-you-should-pay-me-more.html#comments</comments>
		<pubDate>Wed, 13 Jun 2012 06:28:34 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Me Myself and My Life]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=714</guid>
		<description><![CDATA[Rails development requires collection of following skills image credits &#038;nbsp]]></description>
			<content:encoded><![CDATA[<h2>Rails development requires collection of following skills</h2>
<p><a href="http://i.imgur.com/uS0Pe.png"><img title="Hosted by imgur.com" src="http://i.imgur.com/uS0Pe.png" alt="" /></a></p>
<p><a href="http://www.readysetrails.com/index.php/181/this-is-why-learning-rails-is-hard/" rel="nofollow">image credits</a></p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/06/this-is-why-you-should-pay-me-more.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HAML Quick reference</title>
		<link>http://www.gaurishsharma.com/2012/06/haml-quick-reference.html</link>
		<comments>http://www.gaurishsharma.com/2012/06/haml-quick-reference.html#comments</comments>
		<pubDate>Mon, 04 Jun 2012 14:05:58 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=699</guid>
		<description><![CDATA[This would serve as a quick&#160;reference for HAML. HAML is a markup language that gets&#160;transformed&#160;into HTML. you may ask, why not write write my code in HTML, What&#8217;s wrong with HTML? And how does HAML solve does the problem? Problem with HTML HTML is verbose &#38; becomes hard to maintain specially, if you have a <a href='http://www.gaurishsharma.com/2012/06/haml-quick-reference.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h2>This would serve as a quick&nbsp;reference for HAML.</h2>
<p>HAML is a markup language that gets&nbsp;transformed&nbsp;into HTML. you may ask, why not write write my code in HTML, What&#8217;s wrong with HTML? And how does HAML solve does the problem?<img class="alignleft" title="HAML" src="http://upload.wikimedia.org/wikipedia/commons/3/3b/Haml_1-5_logo.png" alt="HAML_logo" width="217" height="225" /></p>
<h3>Problem with HTML</h3>
<p>HTML is verbose &amp; becomes hard to maintain specially, if you have a large site. To see why HTML&#8217;s verbosity is issue, consider this example:</p>
<p><strong>HTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;/pre&gt;
&lt;div id=&quot;profile&quot;&gt;
&lt;div class=&quot;left column&quot;&gt;
&lt;div id=&quot;date&quot;&gt;&lt;strong&gt;4th June 2012&lt;/strong&gt;&lt;/div&gt;
&lt;div id=&quot;address&quot;&gt;&lt;em&gt;Jaipur, India&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;right column&quot;&gt;
&lt;div id=&quot;email&quot;&gt;&lt;a href=&quot;www.example.com&quot;&gt;example.com &lt;/a&gt;&lt;/div&gt;
&lt;div id=&quot;bio&quot;&gt;Rails Developer&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre&gt;
</pre>
<p>As you may notice, there are couple of issues with html:</p>
<ol>
<li>Every starting tag has to have a ending tag</li>
<li>The number of words &amp; lines are more</li>
<li>plain HTML is pain to write &amp; read</li>
</ol>
<p>Now, compare this to HAML which basically does the same thing but in lot more human readable form</p>
<pre class="brush: xml; title: ; notranslate">
#profile
.left.column
#date
       %strong 4th June 2012
#address
       %em Jaipur, India
.right.column
#email
       %a{:href=&quot;www.example.com&quot;}
            example.com
#bio   Rails Developer
</pre>
<p>So in short,</p>
<table border="1">
<tbody>
<tr>
<th>Syntax</th>
<th>Description</th>
</tr>
<tr>
<td><em>%tag_name</em></td>
<td>produces opening &amp; closing tags</td>
</tr>
<tr>
<td><em>%tag_name.class_name</em></td>
<td>add a class attribute to given tag</td>
</tr>
<tr>
<td><em>%tag_name#id_name</em></td>
<td>adds a id attribute to given tag</td>
</tr>
<tr>
<td><em>-</em></td>
<td>runs the native code(ruby etc) but doesn&#8217;t not display result</td>
</tr>
<tr>
<td>=</td>
<td>runs the native code(ruby etc) and display output</td>
</tr>
<tr>
<td>#body</td>
<td>Produces div tag with id=&#8221;body&#8221; as div tag is default</td>
</tr>
</tbody>
</table>
<p>For more, kindly refer to <a href="http://haml.info/" rel="nofollow">HAML official site</a></p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/06/haml-quick-reference.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby vs Java: Why do I like ruby more</title>
		<link>http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html</link>
		<comments>http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html#comments</comments>
		<pubDate>Sat, 19 May 2012 15:37:56 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=688</guid>
		<description><![CDATA[I dislike java, by dislike I mean I do not enjoy programming in java but I still use it in situations where java feels best tool for the job, because I am technology agnostic &#38; belive in using best tool for the job; for example writing Android Apps. And I admit I enjoy writing ruby <a href='http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I dislike java, by dislike I mean I do not enjoy programming in java but I still use it in situations where java feels best tool for the job, because I am technology agnostic &amp; belive in using best tool for the job; for example writing Android Apps. And I admit I enjoy writing ruby code that much more than java that I will even write ruby from my deathbed. sounds crazy! I know!. But it&#8217;s not fanboyism, because for writing webapps &#8212; ruby &amp; the rails stack is TEH best. In future, if something better comes along, I would switch in a heartbeat because I really believe in using best possible tools to get the job done</p>
<p>Now, let&#8217;s go back to the reason of this blog post. Why do I like ruby more:<br />
well, there are <a href="http://myloveruby.herokuapp.com/" rel="nofollow">lot</a> of reasons but for me, the main reason is the philosophy behind the langauge</p>
<blockquote>
<h3>Ruby is designed to make programmers happy</h3>
<p>- <em>Matz, Creator of Ruby</em></p></blockquote>
<p>To explain this, consider this ruby code:</p>
<pre class="brush: ruby; title: ; notranslate">
5.times {print &quot;My Name is Gaurish &quot;}
</pre>
<p>so even if you do not know ruby programming or heck do not know programming at all, I am pretty sure you can know what this code is doing does just by reading aloud words by word. Why, because it reads like &#8220;<em>5 times print my name is</em> gaurish&#8221;.</p>
<p>Lets take another example, this time a bit more complex , to read a file &amp; then print it.  here is the code to do that in Java</p>
<pre class="brush: java; title: ; notranslate">
class FileOperations{
static void readfile(String filename) throws FileNotFoundException {
  File input = new File(filename);
  String line;
  Scanner reader = null;
  try {
    reader = new Scanner(input);
    while(reader.hasNextLine()) {
      System.out.println(reader.nextLine());
    }
  } finally { reader.close(); }
}
public static void main(String args[]){
 readfile(&quot;hello.txt&quot;);
}</pre>
<p>}</p>
<p>now, compare this to ruby code which does the same thing without using classes which is mandatory in java.  Another thing is, the Java version needs to wrap the creation of the Scanner in a <code>try</code> block so it can be guaranteed to be closed.Now, lets compare this to ruby version of same program</p>
<pre class="brush: ruby; title: ; notranslate">
def readfile(filename)
  File.open(filename, &quot;r&quot;) do |f|
    f.each_line {|line| print line }
  end
end
readfile &quot;hello.txt&quot;
</pre>
<p>Because of the existence of blocks, it is possible to abstract away the need to close the File in a single location, minimizing programmer error and reducing duplication. And this is one of the reason, I like ruby more than Java. There are plenty of other reasons &amp; maybe I will cover those in future posts, if anyone is interested, then leave a comment below</p>
<p>PS: I have used print, instead of puts because to highlight the readability of ruby. But if you write ruby more, you will find yourself using puts as it auto inserts a new line which has to be manually inserted when using print.</p>
<p>Related posts:<ol>
<li><a href='http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html' rel='bookmark' title='New Ruby 1.9 hash syntax'>New Ruby 1.9 hash syntax</a></li>
<li><a href='http://www.gaurishsharma.com/2008/06/java-is-finally-free-and-open-gpl.html' rel='bookmark' title='Java is finally Free and Open! GPL Compatible.'>Java is finally Free and Open! GPL Compatible.</a></li>
<li><a href='http://www.gaurishsharma.com/2008/08/learning-java-programming-language-day.html' rel='bookmark' title='Learning Java Programming Language &#8211; Day 1'>Learning Java Programming Language &#8211; Day 1</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Ruby 1.9 hash syntax</title>
		<link>http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html</link>
		<comments>http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html#comments</comments>
		<pubDate>Sun, 22 Apr 2012 19:48:23 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=678</guid>
		<description><![CDATA[Ruby 1.9 has a cool hash syntax which is quite similar to javascript, so the following hash can be written as now, what if both key &#38; values are symbols, in ruby 1.8 &#38; before you would write but now, this could be written in short form as And this both new &#38; old syntax <a href='http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Ruby 1.9 has a cool hash syntax which is quite similar to javascript, so the following hash</p>
<pre class="brush: ruby; title: ; notranslate">
hash = {:symbol =&gt; &quot;value&quot;}
</pre>
<p>can be written as</p>
<pre class="brush: ruby; title: ; notranslate">hash = {symbol: &quot;value&quot;}</pre>
<p>now, what if both key &amp; values are symbols, in ruby 1.8 &amp; before you would write</p>
<pre class="brush: ruby; title: ; notranslate">
:pick =&gt; :any
</pre>
<p>but now, this could be written in short form as</p>
<pre class="brush: ruby; title: ; notranslate">
pick: :any
</pre>
<p>And this both new &amp; old syntax for hash are supported in ruby 1.9, you can use whatever syntax you are comfortable the most but it helps to know both forms of syntax specially when reading the code that other might have written. personally, I like the new one &#8212; fewer characters to type <img src='http://www.gaurishsharma.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<p>PS: this new has syntax is applicable only if the<em> key is a :symbol. </em>In case when key is not a symbol. you have to still stick with old array syntax(<em>=&gt;)</em></p>
<p>Related posts:<ol>
<li><a href='http://www.gaurishsharma.com/2013/04/understanding-differences-between-symbols-strings-in-ruby.html' rel='bookmark' title='Understanding Differences Between Symbols &amp; Strings in Ruby'>Understanding Differences Between Symbols &#038; Strings in Ruby</a></li>
<li><a href='http://www.gaurishsharma.com/2012/05/ruby-vs-java-why-do-i-like-ruby-more.html' rel='bookmark' title='Ruby vs Java: Why do I like ruby more'>Ruby vs Java: Why do I like ruby more</a></li>
<li><a href='http://www.gaurishsharma.com/2012/12/contributing-to-ruby-on-rails-a-guide.html' rel='bookmark' title='Contributing to Ruby on Rails &#8211; A Guide'>Contributing to Ruby on Rails &#8211; A Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/04/new-ruby-1-9-hash-syntax.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable gzip compression for Rails 3.2 on heroku Cedar</title>
		<link>http://www.gaurishsharma.com/2012/04/enable-gzip-compression-for-rails-3-2-on-heroku-cedar.html</link>
		<comments>http://www.gaurishsharma.com/2012/04/enable-gzip-compression-for-rails-3-2-on-heroku-cedar.html#comments</comments>
		<pubDate>Sat, 14 Apr 2012 12:39:10 +0000</pubDate>
		<dc:creator>gaurish</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.gaurishsharma.com/?p=679</guid>
		<description><![CDATA[Heroku is the popular ruby on rails PAAS hosting platform. With the earlier versions, if you were hosting a rails web application on it.&#160;All apps deployed to Heroku used to automatically compress pages they serve, by passing through Nginx’s gzip filter on the way out. But with their newest Cedar Stack, things have changed In <a href='http://www.gaurishsharma.com/2012/04/enable-gzip-compression-for-rails-3-2-on-heroku-cedar.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Heroku is the popular ruby on rails PAAS hosting platform. With the earlier versions, if you were hosting a rails web application on it.&nbsp;All apps deployed to Heroku used to automatically compress pages they serve, by passing through Nginx’s gzip filter on the way out. But with their newest <a href="https://devcenter.heroku.com/articles/cedar">Cedar Stack</a>, things have changed</p>
<p>In Cedar, the HTTP requests terminates directly at your app server &amp; no longer goes through a proxy server(Nginx), hence there can&#8217;t be&nbsp;automatic gzip compression. More information about this can be found in <a href="https://devcenter.heroku.com/articles/http-routing">HTTP routing dev center article</a> So we have to manage gzip compression on our own.&nbsp;fortunately, this is trivial as adding just one line to your config. basically, you will need to use&nbsp;<strong>Rack::Deflater </strong>&amp; make sure that it get loaded before&nbsp;ActionDispatch::Static. The simplest way to enable gzip compression in Rails 3.2 is by adding &#8220;use&nbsp;<strong>Rack::Deflater</strong>&#8221; in <em>config.ru</em> file.</p>
<p>After the change, this how your config.ru file should look like:</p>
<pre class="brush: ruby; title: ; notranslate">
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
use Rack::Deflater
run Improvingoutcomes::Application
</pre>
<p>I spending sometime gather information about this. So Hope this post help you save some time.</p>
<p>&nbsp</p>]]></content:encoded>
			<wfw:commentRss>http://www.gaurishsharma.com/2012/04/enable-gzip-compression-for-rails-3-2-on-heroku-cedar.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
