<?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>Something Bizzare</title>
	<atom:link href="http://arunsark.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://arunsark.wordpress.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2012 00:07:34 +0000</lastBuildDate>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='arunsark.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Something Bizzare</title>
		<link>http://arunsark.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://arunsark.wordpress.com/osd.xml" title="Something Bizzare" />
	<atom:link rel='hub' href='http://arunsark.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Emacs absolute basics</title>
		<link>http://arunsark.wordpress.com/2011/11/04/emacs-absolute-basics/</link>
		<comments>http://arunsark.wordpress.com/2011/11/04/emacs-absolute-basics/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 10:47:52 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[emacs vim]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=177</guid>
		<description><![CDATA[There is an awesome editor out there which are used by great programmers and then there is an OS which is also getting used as an editor by the not so geeky Hugely inspired or copied from Vim Katas I will write a line and hit C-j to insert a new line I will write [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=177&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is an awesome editor out there which are used by great programmers and then there is an OS which is also getting used as an editor by the not so geeky <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Hugely inspired or copied from <a href="http://wekeroad.com/2010/05/24/vim-kata-one">Vim Katas</a></p>
<p><code><br />
I will write a line and hit C-j to insert a new line<br />
I will write a line and hit C-a C-j to insert a new line above</p>
<p>I will navigate from beginning of line to end of line using C-a and C-e<br />
I will go to the top of the document by hitting M-&lt;<br />
I will go to the first line of the document using M-g g 1<br />
I will go to the thirty fifth line of the document using M-g g 35<br />
I will delete the first line by using M-&lt; C-k<br />
I will paste it back using C-y</p>
<p>I will delete the next line using C-n C-a C-k<br />
I will delete the entire line using C-S-backspace<br />
I will paste it back using C-y<br />
I will repeat previous command using C-x z</p>
<p>I will undo using C-_<br />
I will undo again using C-_</p>
<p>I will select a line using C-a C-SPC C-e<br />
I will remove everything using C-w<br />
I will undo using C-_</p>
<p>I will go down a line using C-n<br />
I will go up a line using C-p<br />
I will go left 1 using C-b<br />
I will go right 1 using C-a<br />
I will go up four lines using M-4 C-p<br />
I will go up four lines using C-u 4 C-p<br />
I will go up four lines using C-u C-p<br />
I will go down four lines using M-4 C-n<br />
I will go down four lines using C-u 4 C-n<br />
I will go down four lines using C-u C-n<br />
I will go down eight lines using C-u C-u C-n</p>
<p>I will select 2 lines below this using C-n C-a C-SPC C-u 2 C-n<br />
I will select 4 lines below this using C-n C-a C-SPC C-u C-n<br />
I will select 3 lines above this using C-p C-e C-SPC C-u 3 C-p</p>
<p>I will save using C-x C-s</p>
<p>I will navigate by word using M-f<br />
I will navigate by many words using C-u 3 M-f<br />
I will replace words using M-%<br />
I will undo those changes using C-_<br />
I will delete this line using C-S-backspace and undo with C-_<br />
I will delete these words using C-u 3 M-d<br />
I will undo using C-_<br />
I will save and quit with C-x C-c<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=177&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/11/04/emacs-absolute-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Agile Tour Visits Hyderabad</title>
		<link>http://arunsark.wordpress.com/2011/10/06/agiletourhyd/</link>
		<comments>http://arunsark.wordpress.com/2011/10/06/agiletourhyd/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 18:15:41 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Tour]]></category>
		<category><![CDATA[Hyderabad]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[Waterfall]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=171</guid>
		<description><![CDATA[For the first time Agile tour visited Hyderabad last weekend on October 1st. The event was held at the awesome HICC. This event comes in the back of Agile Hyderabad 2011 conference which was a well organized one and had great speakers like Vibhu Srinivasan and Jesse Fewell. The theme for Agile tour Hyderabad was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=171&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For the first time Agile tour visited Hyderabad last weekend on October 1st. The event was held at the awesome <a href="http://www.hicc.com/">HICC</a>.</p>
<p>This event comes in the back of <a href="http://agilehydconf2011.wordpress.com/">Agile Hyderabad 2011</a> conference which was a well organized one and had great speakers like <a href="http://www.linkedin.com/in/bedifferent">Vibhu Srinivasan</a> and <a href="http://www.jessefewell.com/">Jesse Fewell</a>.</p>
<p>The theme for Agile tour Hyderabad was Agile First Steps. As the theme indicates, the conference delved into the basics of Agile, especially the <strong>&#8220;what&#8221;</strong> bit &#8212;  understanding what agile is and what benefits it provides. Understandably, the talks didn&#8217;t venture much into the <strong>&#8220;how&#8221;</strong> of it. On a personal note, it was a little disappointing to have such a theme as I was pretty much comfortable with the basics of Agile after reading books on Scrum, Extreme Programming, Lean Software Development and of course practicising xDD and little bit of Scrum. But I was also looking forward to meet the agile community in Hyderabad.</p>
<p>The event kicked off with a key note by Mr. Vivek Jain, Director, <a href="http://www.pega.com/">Pega Systems</a>, on “Introducing Agile Work in a Product Enterprise”. Basically the talk was about how Pega System adopted Scrum and have seen exponential growth in revenue numbers and have successfully launched a couple of products after that. They had adopted Scrum hardly 2 years back after doing waterfall/chaotic model for a decade or long. The talk was well delivered but I have a peeve for the way it was delivered. I thought they spend lot time explaning Pega Systems, their revenue and market analysis etc. rather than focussing more on nitty-gritties of how really Scrum works at the ground level or at least what their experience has been.</p>
<p>Then we moved to the 2nd key note of the day by <a href="http://in.linkedin.com/in/madhurkathuria">Madhur Kathuria</a>. Madhur is the only Certified Scrum Coach in India, and I have heard him talk at Agile Hyderabad 2011. He is an eloquent speaker and really engages the audience well in his talks. So I was expecting a very good session and Madhur really delivered with his keynote on “Why it&#8217;s hard to Scrum in India”. He touched on the cultural factors which stand against us (Indians) when it is coming to do Scrum. I still remember the points he delivered on that day on top of my mind. I think some of the factors he touched upon were</p>
<ul>
<li>The Cultural Factors &#8211; where we Indians hesitate to say NO</li>
<li>Chalta Hai Attitude &amp; Jugaad – basically we tend accept status quo and just accept to fate “it&#8217;s like that only”</li>
<li>The Service Focus – where we accept anything that client tells us to do blindly</li>
<li>The Power Index – where the perceived distance to power center is pretty large when it comes to Inida.</li>
</ul>
<p>Overall Madhur did a great job and by interspersing games between the talks and there by engaging all the participants the session received a good response.</p>
<p>After the keynote was the time for Just a Minute sessions where anyone can walk up to the stage and talk for a minute or two about their pet topics. I talked about the lack of focus on Engineering Practices in Scrum, especially in Indian context how bad it may hurt the success of agile projects. The message I was trying to drive was – even if we do Scrum, do standups and plan our sprints etc. if we are bad at writing code, if we do not do proper TDD, Refactoring, Continuous Integration and so on, we are basically just sugar-coating our old bad habits with the guise of Scrum and in a couple of years down the line we could be staring at a system which would be tough to maintain, enhance and understand much like the <a href="http://www.laputan.org/mud/">Big Ball of Mud</a>. Weren&#8217;t those the problems which waterfall had and agile tried to solve when it came to limelight in the early 2000s?</p>
<p>Here is a picture of me doing my JAM session.</p>
<p><img src="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/302553_2324255620100_1060911183_2628544_635868731_n.jpg" alt="Arun's JAM" /></p>
<p>The next 30mts was for Open Space where, any one could propose a topic and whoever interested in topic can form a group and discuss the same. There were around 8 topics up for discussion. I participated in topic “TDD” and had some heated debate with my fellow participants and I also propsed and anchored a topic on “What killed waterfall could agile”. Again it was based on my JAM talk about lack of engineering focus while practicing agile. The ideas were around lack of learning in technical side from Project Managers, lack of passion to improve by the upcoming developer community in India and of course the attitude that &#8220;if it ain&#8217;t broke, don&#8217;t fix&#8221; which is dangerous! And here is why, quoting from the Refactoring Workbook:</p>
<blockquote><p><strong>Build Testing into Your Practice</strong></p>
<p>There&#8217;s an old adage (as so many are), <em>“If it ain&#8217;t broke, don&#8217;t fix it.”</em> (How many times has that last simple change caused an unexpected bug?) In programming, the downside of applying this adage is that the code just gets uglier and uglier.<br />
Refactoring is willing to go against this rule through two mechanisms: safe refactorings and a supply of tests to verify that the transformations have been done correctly. Don&#8217;t neglect your tests. </p></blockquote>
<p>In fact resonating my idea Jesse Fewell has touched upon the same topic in his latest blog past about his experiences with India. Read the section <a href="http://www.jessefewell.com/2011/09/02/reflections-after-a-year-of-agile-coaching-in-india/">India&#8217;s talent is an impediment</a>. Sad, but true!</p>
<p>The afternoon sessions were split into two tracks and I had a chance to attend the following topics</p>
<p><strong>Learning Agile by Flipping Pennies, by Tushar Somaiya</strong> &#8211; the idea of the session was simple, there was a team of 4 (requirements guy, design guy, coder, tester) and their respective managers. The team had to flip a bunch of different coins based on some value assigned. First it was done in waterfall way, then it was done in a more iterative way with smaller releases and focussed priorities. After each round the timings were noted and we were shown how agile really reduced the time to market and how effectively people were engaged rather than sitting idle.</p>
<p><strong>Culture and it compatibility in Agile Adoption, by Mohammed Shaik, PayPal</strong> – Shaik really spoke well from his experience of 10+ years on what sort of org culture works for Agile and what doesn&#8217;t work. He was really forthright in pointing out the short comings of Agile Projects being done in India and how they were just doing lipservice in the name of Agile.</p>
<p><strong>Scrum and Lean: Multiply the Powers, by Om Band, SAP Labs</strong> – He demonstrated how SAP had adopted lean practices and meshed it with Scrum and using it in their day-to-day work. I thought this was the best session I attended, it really concentrated on the meat instead of focussing on SAP. The explanations of Lean principles were crisp and to the point. I really enjoyed this session, more so because I am very keen in Lean Startup concept as well.</p>
<p><strong>Master the how, not just the what and why in Agile world, by Shweta Parashar, Xebia </strong>– This was a game of building Lego House using Scrum methodology. There were 3 teams of 7 members and each team had Scrum Master. We planned on the Back log, Sprint Plans and Sprint Tasks embarked on building the house by picking task by task. There was also a scrum board on which we posted our tasks using sticky-notes, and moved them from &#8220;To Do&#8221; to &#8220;In Progress&#8221; to &#8220;Done&#8221; time to time. I think the time given for the session was not enough to complete the task or the task was big (probably they could have chosen a less complicated lego toy), nevertheless it was an enjoyable experience. I thought even the presenters were doing it the first time and generally the teams struggled to build the house because there were a hell of a lot of pieces to be arranged. Our team did a fairly decent job, and only we could build something which was appreciated by our Product Owners (aka presenters). Perphaps my experience of playing with my son daily using blocks and lego toys helped us <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>Overall</strong></p>
<p>Yea, the cookies were real good, food was awesome, and the desserts were fabulous <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Coming to the sessions, as I said it was at a very basic level. So if you were aware of Agile Methodology and its basics there was nothing much to take home as learning &#8212; it was just reinstating the points back. Again more of it was tuned towards corporate audience in well-set companies (read Project Managers). As a Startup founder may be many of these points may not be applicable for my situation. But looking at the audinece profile, most of the members were Project Managers who never had done Agile in full spirit, they were also trying to figure out how things worked in Agile and many were confused whether what practice they were doing in their job was Agile or not. I could see that there were many misconceptions and misunderstanding floating around. Like one guy concluded that Waterfall with shorter iterations is Agile, or some one else was saying that they did TDD, where they documented the test-case in a Word Doc before starting coding or a Project Manager was mentioning how Agile reduced their release cycle from one year to 6-7 months.</p>
<p>And adding to the list is my pet peeve the target audience was just Project Managers not developers for this conference. I really hope that they had one track next year as to how they do agile technically as well like how you practically do TDD with xUnit or how you refactor the code and stuff like that sort. Again I may be wrong because in Indian context only managerial stuff may sell.</p>
<p>But overall I would rate the event was very good, it gave opportunity to meet a lot of people and surely I hope Agile Tour would come up with a big bang next year as well.</p>
<p>Some of the links from the event<br />
<a href="http://www.facebook.com/media/set/?set=oa.267944886569832&amp;type=1">http://www.facebook.com/media/set/?set=oa.267944886569832&amp;type=1</a><br />
<a href="http://www.isec.co/event_detail_info.php?event_id=5">http://www.isec.co/event_detail_info.php?event_id=5</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=171&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/10/06/agiletourhyd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>

		<media:content url="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/302553_2324255620100_1060911183_2628544_635868731_n.jpg" medium="image">
			<media:title type="html">Arun&#039;s JAM</media:title>
		</media:content>
	</item>
		<item>
		<title>Tidying up your RSpecs &#8211; 1</title>
		<link>http://arunsark.wordpress.com/2011/09/21/tidying-up-your-rspecs-1/</link>
		<comments>http://arunsark.wordpress.com/2011/09/21/tidying-up-your-rspecs-1/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 12:05:06 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=162</guid>
		<description><![CDATA[This is a cross post from our company blog. Almost everyone in Ruby world agrees that RSpecs are a great way to test code in both Ruby and Rails projects. Today, I want to share some of the tips which I had learnt and used in my RSpecs which has really help to tidy up [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=162&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a cross post from our company <a href="http://ostryalabs.com/blog/2011/09/21/tidying-up-your-rspecs-1.html">blog</a>.</p>
<p>Almost everyone in Ruby world agrees that RSpecs are a great way to test code in both Ruby and Rails projects.</p>
<p>Today, I want to share some of the tips which I had learnt and used in my RSpecs which has really help to tidy up the RSpec code and output.</p>
<p><strong>Explicit Subjects &amp; Contexts</strong></p>
<p>Consider a RSpec for a Rails Controller. Assume that controller actions require a user to authenticate himself before performing any of the actions. In order to test this aspect we can write RSpec like this</p>
<p><code>describe PlacesController do<br />
&nbsp;&nbsp;describe "access control" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;describe "for non-signed in users" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it "should redirect to sign in page for delete :destroy" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete :destroy, :id =&gt; "1234"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.should redirect_to(new_user_session_path)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it "should redirect to sign in page for get :index" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get :index<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.should redirect_to(new_user_session_path)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it "should redirect to sign in page for get :show" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get :show, :id =&gt; "123"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;response.should redirect_to(new_user_session_path)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;end</code></p>
<p>The above specs can be repeated for each and every action in the controller. Now when I run the above spec the output will look something like this.</p>
<p><code>for non-signed in users<br />
&nbsp;&nbsp;should redirect to sign in page for delete :destroy<br />
&nbsp;&nbsp;should redirect to sign in page for get :index<br />
&nbsp;&nbsp;should redirect to sign in page for get :show</code></p>
<p>The output doesn’t read really that great. One of the good guideline which I believe for writing good RSpec is that the output should be really readable like a prose and easily convey the behavior or intent of the code it tests. So it’s time to tweak the code and make the output more readable. Also if you look the code has lot of repeatition of response.should redirect_to all over the place. So let us clean up that with explicit subject and context.</p>
<p><code>describe PlacesController do<br />
&nbsp;&nbsp;describe "access control" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;context "for non-signed in users" do</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subject { response }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context "delete :destroy" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;before { delete :destroy, :id =&gt; "1234" }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it { should redirect_to(new_user_session_path) }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context "get :index" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;before { get :index }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it { should redirect_to(new_user_session_path) }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context "get :show" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;before { get :show, :id =&gt; "123" }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it { should redirect_to(new_user_session_path) }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;end<br />
end  </code></p>
<p>Notice how I have used the <code>subject {}</code> to specify an explicit subject. The implicit subject for any RSpec is the class which is used with the describe at top. In the above case it would be PlacesController. By specifying an explicit subject we are declaring the object which need to evaluated for subsequent tests. In this case it has been set to the response object. The usage of context really makes the code much clean and readable. Basically it sets the context for each test case while running. Now if we run the RSpec the output looks much cleaner like this.</p>
<p><code><br />
for non-signed in users<br />
&nbsp;&nbsp;delete :destroy<br />
&nbsp;&nbsp;&nbsp;&nbsp;should redirect to "/users/sign_in"<br />
&nbsp;&nbsp;get :index<br />
&nbsp;&nbsp;&nbsp;&nbsp;should redirect to "/users/sign_in"<br />
&nbsp;&nbsp;get :show<br />
&nbsp;&nbsp;&nbsp;&nbsp;should redirect to "/users/sign_in"<br />
</code></p>
<p>Here is another example of an explicit subject below. This is an RSpec for User Role assignments with CanCan.</p>
<p><code><br />
describe Ability do<br />
&nbsp;&nbsp;context "Admin Role" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;before(:each) do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@admin = Factory(:admin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@ability = Ability.new(@admin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;end</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;subject { @ability }<br />
&nbsp;&nbsp;&nbsp;&nbsp;it { should be_able_to(:manage,User) }<br />
&nbsp;&nbsp;&nbsp;&nbsp;it { should be_able_to(:manage, Restuarant)}<br />
&nbsp;&nbsp;&nbsp;&nbsp;it { should be_able_to(:manage,Place) }<br />
&nbsp;&nbsp;end<br />
end<br />
</code></p>
<p>The code really is looking succinct and clean with the usage of <code>subject {}</code> . Without the subject it would have been a drudgery to write the same piece with describe&#8230;it..end blocks.</p>
<p><strong>Shared Examples</strong></p>
<p>Now let us turn our attention to the technique of Shared Examples which keeps our RSpec code DRY. Here is an example which tests the Links appearing in a footer of the page based on the User Role.<br />
<code><br />
shared_examples "footer" do |links|<br />
&nbsp;&nbsp;links.each do |link|<br />
&nbsp;&nbsp;&nbsp;&nbsp;it "with #{link}" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;within("div#footer") do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page.should have_xpath("//nav/ul/li/a[contains(text(),'#{link}')]")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;&nbsp;&nbsp;end<br />
&nbsp;&nbsp;end<br />
end</p>
<p>describe "Footer" do<br />
&nbsp;&nbsp;extend LinkHelpers</p>
<p>&nbsp;&nbsp;  context "not signed in user" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;before { visit search_home_path }<br />
&nbsp;&nbsp;&nbsp;&nbsp;it_behaves_like "a footer", normal_links<br />
&nbsp;&nbsp;  end</p>
<p>&nbsp;&nbsp;  context "Admin" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;    before(:each) do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@admin = Factory(:admin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sign_in_user(@admin.email,"password")<br />
&nbsp;&nbsp;&nbsp;&nbsp;    end<br />
&nbsp;&nbsp;&nbsp;&nbsp;    it_behaves_like "a footer", admin_links<br />
&nbsp;&nbsp;   end<br />
end<br />
</code></p>
<p>The code is pretty self-explanatory. For a noumal user I want a bunch of links to appear in the footer. For an admin user I want another set of links to appear. In the code above <code>normal_links</code> method gives the array of links for normal user and <code>admin_links</code> gives the array of links for admin user. [Note normal_links and admin_links are methods defined in a <code>module LinkHelpers</code> which I am extending below describe]</p>
<p>Coming to the DRY part. The code for doing the actual testing is put under a shared_example “footer” and it is invoked with <code>it_behaves_like</code> call. Also note we can pass zero or any number of arguments to shared_example. In the example above it accepts a single argument of Array type.</p>
<p>Let us see the output of the above code:<br />
<code><br />
Footer<br />
&nbsp;&nbsp;  not signed in user<br />
&nbsp;&nbsp;&nbsp;&nbsp;    behaves like a footer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with About Us<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Feedback<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Disclaimer<br />
&nbsp;&nbsp;  Admin<br />
&nbsp;&nbsp;&nbsp;&nbsp;    behaves like a footer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with About Us<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Feedback<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Disclaimer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Manage Restaurant<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Manage Place<br />
</code></p>
<p>Even though the behavior and output is correct, the above results and code doesn’t read proper. Probably we shouldn’t call display of footer as a behavior. RSpec to rescue again! We can customize what appears in the output (in this case “behaves like a”) as well as rename the function it_behaves_like to something which is more appropriate for the context.</p>
<p>So for diplay of a footer it may be good to have a function like it_has_a &#8220;footer&#8221; instead of it_behaves_like &#8220;a footer&#8221;. Now let us see how this done:<br />
<code><br />
RSpec.configure do |c|<br />
&nbsp;&nbsp;  c.alias_it_should_behave_like_to :it_has_a, 'has a'<br />
end</p>
<p>shared_examples "footer" do |links|<br />
&nbsp;&nbsp;  links.each do |link|<br />
&nbsp;&nbsp;&nbsp;&nbsp;    it "with #{link}" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      within("div#footer") do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        page.should have_xpath("//nav/ul/li/a[contains(text(),'#{link}')]")<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      end<br />
&nbsp;&nbsp;&nbsp;&nbsp;    end<br />
&nbsp;&nbsp;  end<br />
end</p>
<p>describe "Footer" do<br />
&nbsp;&nbsp;  extend LinkHelpers</p>
<p>&nbsp;&nbsp;  context "not signed in user" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;    before { visit search_home_path }<br />
&nbsp;&nbsp;&nbsp;&nbsp;    it_has_a "footer", normal_links<br />
&nbsp;&nbsp;  end</p>
<p>&nbsp;&nbsp;  context "Admin" do<br />
&nbsp;&nbsp;&nbsp;&nbsp;    before(:each) do<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      @admin = Factory(:admin)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      sign_in_user(@admin.email,"password")<br />
&nbsp;&nbsp;&nbsp;&nbsp;    end<br />
&nbsp;&nbsp;&nbsp;&nbsp;    it_has_a "footer", admin_links<br />
  &nbsp;&nbsp;end<br />
end<br />
</code></p>
<p>In the above code <code>RSpec.configure</code> block actually aliases the <code>it_behaves_like</code> function <code>it_has_a</code> and specifies that “has a” should be the output instead of “behavies like a” while the specs are run. Let us check the output now:</p>
<p><code><br />
Footer<br />
&nbsp;&nbsp;  not signed in user<br />
&nbsp;&nbsp;&nbsp;&nbsp;    has a footer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with About Us<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Feedback<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      with Disclaimer<br />
&nbsp;&nbsp;  Admin<br />
&nbsp;&nbsp;&nbsp;&nbsp;    has a footer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     with About Us<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     with Feedback<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     with Disclaimer<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     with Manage Restaurant<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     with Manage Place<br />
</code></p>
<p><strong>To Conclude</strong></p>
<ul>
<li>Use context with describe and make the test more readable instead of just getting stuck with describe..describe&#8230;it kind of format.</li>
<li>Give a before {} block for any context to set any pre-conditions before running the context.</li>
<li> Wherever possible declare an explicit subject and reduce the cruft in the specs.</li>
<li>DRY up your RSpec with shared_examples.</li>
<li>Customize the method name and output by aliasing in RSpec.configure.</li>
</ul>
<p>Hope this post was helpful, do share your thoughts if any!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=162&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/09/21/tidying-up-your-rspecs-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Treasure [Witch] hunt at Sree Padmanabha Swamy Temple</title>
		<link>http://arunsark.wordpress.com/2011/07/01/treasure-witch-hunt-at-sree-padmanabha-swamy-temple/</link>
		<comments>http://arunsark.wordpress.com/2011/07/01/treasure-witch-hunt-at-sree-padmanabha-swamy-temple/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 14:07:35 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Nothing Special]]></category>
		<category><![CDATA[Padmanabha]]></category>
		<category><![CDATA[Sree Padmanabha Swamy Temple]]></category>
		<category><![CDATA[Temple]]></category>
		<category><![CDATA[Travancore]]></category>
		<category><![CDATA[Treasure]]></category>
		<category><![CDATA[trivandrum]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=155</guid>
		<description><![CDATA[The great hunt is on and each day crores of value worth antiques are unraveled from the hidden chests and dark chambers of the great Sree Padmanabha Swamy Temple. Its really mesmerizing to read all about the treasure and its hidden coffers in such an ancient monument and engineering marvel. South Indian temples really fascinate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=155&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The great <a href="http://www.thehindu.com/news/states/kerala/article2148311.ece">hunt </a>is on and each day crores of value worth antiques are unraveled from the hidden chests and dark chambers of the great <a href="http://en.wikipedia.org/wiki/Padmanabhaswamy_temple">Sree Padmanabha Swamy Temple</a>. Its really mesmerizing to read all about the treasure and its hidden coffers in such an ancient monument and engineering marvel. </p>
<p>South Indian temples really fascinate me, its grandiose structure and innate work and fine grained artistry really entices me. These temple just shows the passion of people who conceived this structures and passion of people who worked for them to make it as they are – a resilient structures which can withstand 1000 years of time and tide. </p>
<p>Sree Padmanabha Swamy temple is relatively a young temple compared to great Chola or Pallava monuments in Tamil Nadu.  The great temples in Tanjore, Chidambaram, Gangai Konda Cholavaram, Kumbakonam really bowl me over when I stand before them like a kid with eyes and mouth wide open.</p>
<p>Its really no surprise that so much of treasure is hidden beneath the stone structure of Padmanabha Swamy temple. In fact each and every ancient temple in South India surely would have had such secret treasure troves, but alas now everything is lost because either being looted by British or invading Muslim Kings and if they have survived those stooges our own people might have siphoned off them. The crux is we Indians don’t take pride in such structures nor do we care about these marvels. Many people loathe going to temple for various reason – being an atheist or aversion to crowd or laziness to travel and many other silly reasons.  No wonder in Chidambaram you see lot foreigners with cameras than Indians with camera. They are fascinated by them than us. </p>
<p>Coming to this unraveling story of treasures in Padmanabha Swamy Temple – what will happen to them? Now that secret is out in the open vested interests in different quarters may be frothing in their mouth to take control of temple or to seize a nickel out of it and keep it in their showcase or worse siphon it off for money. Remember the price being derived is just based on current market rates, if you add the antique value of these pieces it may run into more crores in value. But it would also be insane to argue that these whole thing is proprietary of one family now. These treasures are not earned by them, they might have been got as gifts to the state, as tax and wealth of the state. So today a family cannot come and claim them because of a lineage. Its like our Prime Minister claiming rights on India’s economy. I feel it belongs to the people of Kerala and its upto the people be proud about it, be passionate about it and care about it and preserve it for generations.  </p>
<p>Sree Padmanabha Swamy temple is one of those finest temples out there where a visit can really calm your soul and soothe you. Its ranks high in the way its maintained and run. A big kudos to the Royal family and the trust which does it – after all they never got tempted to loot the treasures till now. Alas that today we have denigrated to such a passé that arbid ego clashes and petty interests have lead to this skull drudgery of a situation and we have no one to blame but ourselves [read Hindus] for such an impasse. From here if an ordinance is promulgated and secular Congress party decides to put a secular person [like Mr. George Joseph or Mr. Mohammed Haji] in the trust running the temple we just have to live with it. </p>
<p>Now the question is next what? What to do with the treasure – should we use it for eradicating poverty or negating some of our fiscal deficit or implement NREGA with that? Anything can happen in this country. I am sure some insane voices would opine that now that people know about the treasures they are not safe where they are and should be put in bank vaults. Nothing can be disastrous than that. We have smart people in this country who even though cannot be creative can easily be creative enough to make fakes and swap the real ones. Hope we won’t tread that path. I personally would like them to maintained where they are and status quo maintained on it. Or even if they can make some great fool-proof arrangement to exhibit them and open the chambers for public that would also be good (something like public viewing every year say, for 2 weeks and then they are back to the chambers). I personally would like to see them and more than the treasure I would be excited in seeing the secret chamber and its security plugs. </p>
<p>Its not clear as to what will happen to the temple or the treasures – a handful of cronies and their ego will decide its fate. But thank god they can’t take the Lord away or take the shrine itself away. Those two are enough for mere mortals like me to be happy about. </p>
<p>A walk in the alleys of this sacred temple is enough to transpire you to another realm, to mesmerize you about our rich history and culture and hope a day will not come when they won’t even allow to do that!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/155/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=155&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/07/01/treasure-witch-hunt-at-sree-padmanabha-swamy-temple/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Rails HABTM in Mongoid &amp; Factory Girl</title>
		<link>http://arunsark.wordpress.com/2011/05/18/rails-habtm-in-mongoid-factory-girl/</link>
		<comments>http://arunsark.wordpress.com/2011/05/18/rails-habtm-in-mongoid-factory-girl/#comments</comments>
		<pubDate>Wed, 18 May 2011 13:20:59 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Active Record]]></category>
		<category><![CDATA[Factory Girl]]></category>
		<category><![CDATA[Mongo]]></category>
		<category><![CDATA[Mongoid]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=151</guid>
		<description><![CDATA[In Rails say you have a HABTM (N:N) relationship between two models class User has_and_belongs_to_many :posts ........... end class Post has_and_belongs_to_many :users ....... end So what essentially it means is a Post can have many Authors and an Author can have multiple posts. Now you want to test drive the thing by seeding test data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=151&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Rails say you have a HABTM (N:N) relationship between two models</p>
<p><code><br />
class User<br />
   has_and_belongs_to_many :posts<br />
    ...........<br />
end</p>
<p>class Post<br />
   has_and_belongs_to_many :users<br />
   .......<br />
end<br />
</code></p>
<p>So what essentially it means is a Post can have many Authors and an Author can have multiple posts.<br />
Now you want to test drive the thing by seeding test data in Factory Girl.</p>
<p>Here is an <a href="http://robots.thoughtbot.com/post/254496652/aint-no-calla-back-girl">article</a> for seeding data for 1:N relationships in Factory girl. But it doesn&#8217;t talk about HABTM relations.</p>
<p>I was playing around with factory girl and figured out a way to seed a post with authors.<br />
Here is how you do it -</p>
<p><code><br />
Factory.define :user, :class=&gt;User do |user|<br />
  user.first_name "Alex"<br />
  user.last_name "Malcolm"<br />
  user.nick_name "Alexy"<br />
  user.email "alexy.m@gmail.com"<br />
  user.password "foobar"<br />
  user.password_confirmation "foobar"<br />
  user.role "author"<br />
end</p>
<p>Factory.define :post do |post|<br />
  post.title "Foo Post"<br />
  post.content "Bar content"<br />
end</p>
<p>Factory.define :post_with_author, :parent =&gt; :post do |post|<br />
  post.after_create { |p| Factory(:user, :posts =&gt; [p]) }<br />
end<br />
</code></p>
<p>Now in your Test class do<br />
<code> @post = Factory(:post_with_author) </code></p>
<p>Factory girl would have inserted the User for you and then a Post and updated the relationship.</p>
<p>Btw I the code above was tested in Mongoid/MongoDB and not on Active Record. But since its working in Mongoid there is no reason I see why it won&#8217;t work with Active Record natively.</p>
<p>Another thing which I found with Mongoid/MongoDB and HABTM is that unlike Active Record you don&#8217;t need a Join Table like Users_Posts &#8211; the reason being MongoDB doesn&#8217;t support join queries. So you have to lump the join table into the respective models.</p>
<p>The Mongoid stores HABTM relation in back-end something like this<br />
<code><br />
&gt; db.users.find()<br />
{ "_id" : ObjectId("4dc2010ea38c3d0b50000003"), "first_name" : "Alex", "last_name" : "Malcolm", "nick_name" : "Alexy", "post_ids" : [<br />
	ObjectId("4dc2012fa38c3d0b50000005"),<br />
	ObjectId("4dd1240ca38c3d104a000009"),<br />
	ObjectId("4dd12ff9a38c3d104a00000f")<br />
], "role" : "author" } </code></p>
<p>That is in the Users model you have an array of post_ids and similarly in the Posts Model you will have an array of user_ids.</p>
<p>And finally if its on Active Record it may be preferable to have <code> has_many :through</code> instead of <code>has_and_belongs_to_many</code> relation as this <a href="http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off">post</a> says.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=151&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/05/18/rails-habtm-in-mongoid-factory-girl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Cucumber Scenarios : The Dilemma</title>
		<link>http://arunsark.wordpress.com/2011/05/15/cucumber-scenarios-the-dilemma/</link>
		<comments>http://arunsark.wordpress.com/2011/05/15/cucumber-scenarios-the-dilemma/#comments</comments>
		<pubDate>Sat, 14 May 2011 19:40:04 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rspecs]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=147</guid>
		<description><![CDATA[Off late I am exploring BDD with Cucumber &#38; RSpec in Rails. The first step in BDD after understanding the customer requirements is to come up with the User Stories in a particular structure. Read this brilliant article from Dan North if you want to know more on the structure of User Story in BDD. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=147&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Off late I am exploring <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">BDD</a> with Cucumber &amp; RSpec in Rails.</p>
<p>The first step in BDD after understanding the customer requirements is to come up with the User Stories in a particular structure. Read this brilliant article from Dan North if you want to know more on the <a href="http://dannorth.net/whats-in-a-story/">structure</a> of User Story in BDD.</p>
<p>Let&#8217;s say I am creating a simple blog app, a sample Scenario for Creating a Post can be written in two ways as shown below. These scenarios are as coded for Cucumber.</p>
<p>A pithy way<br />
<code><br />
Scenario: Create Post<br />
   Give I am a registered User<br />
   And I have signed in<br />
   When I go to Create Post Page<br />
   And Create a Post and Publish it<br />
   Then I should see the Post in the Index Page<br />
</code></p>
<p>or a Detailed way<br />
<code><br />
  Scenario: Create a Post<br />
    Given I am a registered User with name "Arun", email "foo@bar.com" and password "foobar"<br />
    And I sign in as "foo@bar.com/foobar"<br />
    When I visit Create Post Page<br />
    And I fill up Title as "Foo Post"<br />
    And I fill up Content as "Bar Contents for Foo Post"<br />
    And I publish the Post<br />
    Then I should see message "Post was successfully created."<br />
    And I should see post in the index page<br />
</code></p>
<p>The <a href="http://pragprog.com/titles/achbd/the-rspec-book">RSpec Book </a>touches on this topic. It calls the first approach Declarative Style and second one Imperative Style. The Book also advises to use the former way if the project is more like a single man show where developer dons analyst/tester/coder hats and go for 2nd approach if the project has a bigger team and a business analyst for writing scenarios.</p>
<p>But its really a touch and go topic and its really difficult to gauge to how much in depth we have to go. The declarative seems to be pretty concise with loaded step definitions, but the imperative style gives a fair idea of what it takes to accomplish something in the system. So if we have a little bit informed tech savvy customer, probably second approach may add lot of value and clear lot of confusion. The imperative style is kind of walking the customer through the UI flows of the system. </p>
<p>But the conundrum with imperative style is if we already have good RSpecs for the Views/Controllers our RSpecs may read a lot like the imperative scenario and may look redundant.</p>
<p>So I can do <code>rspec spec --format doc</code> to get detailed documentation of the flows like the Cucumber imperative style. But of course it may not be good idea to share RSpecs with a Business User.</p>
<p>As the RSpec book says perhaps we need to mix judiciously both and perhaps experience only will teach to balance that. </p>
<p>The trigger for me to write this post was I was trying to create Scenarios for a sample project I am doing and just one hour I spend switching a scenario between declarative and imperative and was pretty confused where I would/should settle.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/147/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=147&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/05/15/cucumber-scenarios-the-dilemma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Phusion Passenger + Apache2 for RoR</title>
		<link>http://arunsark.wordpress.com/2011/03/31/phusion-passenger-apache2-for-ror/</link>
		<comments>http://arunsark.wordpress.com/2011/03/31/phusion-passenger-apache2-for-ror/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 20:09:28 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[GemSet]]></category>
		<category><![CDATA[mod rails]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[Passenger Installation]]></category>
		<category><![CDATA[Phusion Passenger]]></category>
		<category><![CDATA[Phusion Passenger Installation]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=141</guid>
		<description><![CDATA[Ok here goes my little notes on making a small nifty Rails App run on Apache2 with mod_rails provided by Phusion Passenger. The installation of mod_rails is pretty straight forward. The installation steps are small and well documented here plus you have the amazing rails cast by Ryan Bates. After watching the videos and reading [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=141&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ok here goes my little notes on making a small nifty Rails App run on Apache2 with mod_rails provided by <a href="http://www.modrails.com/">Phusion Passenger</a>.</p>
<p>The installation of mod_rails is pretty straight forward. The installation steps are small and well documented <a href="http://www.modrails.com/install.html">here</a> plus you have the amazing <a href="http://www.modrails.com/videos/passenger.mov">rails cast</a> by Ryan Bates.</p>
<p>After watching the videos and reading the steps well I thought its gonna be a breeze I am going to wind up in 15mts and going to enjoy the night! Sigh! But things went wrong a 15mts exercise consumed close 4/5hrs of my time.</p>
<p>Ok here is where the fun is all about &#8211; I use RVM to maintain my installs. The first step in passenger installation is obviously to install the passenger gem. Now I felt it would be good to put the passenger in global gemset rather than any specific one and there by making it available to all. So I did</p>
<p><code>rvm use 1.9.2@global</code></p>
<p>Then<br />
<code>gem install passenger</code></p>
<p>Then<br />
<code>passenger-install-apache2-module</code></p>
<p>In my system after the above step it said some libraries were missing in the system (Ubunut Lucid Lynx), so I had to correct those by manually installing them with apt-get. After I got all the dependencies installed I again ran the passenger install and everything went fine. </p>
<p>At the end of the passenger-install step, it would spew a few lines of code which we need to put it on apache2.conf file. For me those lines looked like</p>
<p><code>LoadModule passenger_module /home/arun/.rvm/gems/ruby-1.9.2-p136@global/gems/passenger-3.0.5/ext/apache2/mod_passenger.so<br />
PassengerRoot /home/arun/.rvm/gems/ruby-1.9.2-p136@global/gems/passenger-3.0.5<br />
PassengerRuby /home/arun/.rvm/wrappers/ruby-1.9.2-p136@global/ruby</code></p>
<p>Now I added a Virtual Host to Apache to point to my sample Rails App by adding the following to the apache2.conf</p>
<p><code><br />
   &lt;VirtualHost *:80&gt;<br />
    ServerName www.depot.com<br />
    DocumentRoot /media/harddisk/work/ror/depot/public<br />
    &lt;Directory /media/harddisk/work/ror/depot/public&gt;<br />
        Allow from all<br />
        Options -MultiViews<br />
    &lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</p>
<p></code></p>
<p>So that is it &#8211; restart the apache and hit www.depot.com in your browser you should see your rails app. But hey! wait won&#8217;t entering depot.com make the browser go and search the Internet rather than your local system. Well yes, so we have to make a small exception in the file /etc/hosts. In the file add a line</p>
<p><code>127.0.0.1 www.depot.com<br />
127.0.0.1 depot.com</code></p>
<p>Ok all set! now again enter the URL to your browser biff! now got a new error</p>
<p><code>no such file to load -- bundler</code></p>
<p>The error was obvious it was not able to find the bundler. But from terminal I gave </p>
<p><code>gem list -d bundler </code></p>
<p>It was showing proper output, means bundler gem was there up and kicking. Mind you this command I was giving from the gemset which I was working on. Then I started googling this error and got many suggestions and tried one by one and spent nearly 3hrs and couldn&#8217;t make any break through. It was really frustrating. </p>
<p>Then finally help arrived from <a href="http://www.phusion.nl/about">Hongli Lai</a> of Phusion Team through the Phusion Passenger Google Group. She was pointing to me that ruby I am using for Phusion given in apache2.conf file was pointing to global gemset while bundler was installed in the other gemset. So I had replace the line in apache2.conf to pick up the ruby from the gemset which I was working on. So suppose <strong>foo</strong> is your gemset change PassengerRuby line in apache2.conf to </p>
<p><code>PassengerRuby /home/arun/.rvm/wrappers/ruby-1.9.2-p136@foo/ruby</code></p>
<p>Yes! This worked. Now if you are running a static site things would start working now. But my sample app had some tables so when I fired up app in browser it was complaining that tables were missing in the production. </p>
<p>So if you run into a similar situation just migrate the tables to production with rake.<br />
<code>rake db:migrate RAILS_ENV="production"</code></p>
<p>In my case I had some load scripts as well which was for loading some sample data to tables, for loading those data into production use the rails runner with following option</p>
<p><code>rails runner -e production script/load_xxxxx.rb</code></p>
<p>That is it, now I see my rails app working well in my Apache2 server with mod rails.</p>
<p>Ok! here is a small tip, in order to restart the Rails App after changes you need not restart the server, you can give this command from Rails Application Root</p>
<p><code>touch tmp/restart.txt</code></p>
<p>Passenger would see the timestamp of restart.txt and reload the Rails App if needed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=141&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/03/31/phusion-passenger-apache2-for-ror/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://www.modrails.com/videos/passenger.mov" length="18988364" type="video/quicktime" />
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Back to emacs for Ruby on Rails</title>
		<link>http://arunsark.wordpress.com/2011/03/24/back-to-emacs-for-ruby-on-rails/</link>
		<comments>http://arunsark.wordpress.com/2011/03/24/back-to-emacs-for-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 19:44:43 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rinari]]></category>
		<category><![CDATA[rsense]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby electric]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=137</guid>
		<description><![CDATA[I remember last Java Sun Tech Days @ Hyderabad, when James Gosling was asking the audience who all were out there still using old editors like emacs/vim. Hardly a bunch would have raised their hands. The point he was driving was that in this age, we should probably move away from these editors and get [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=137&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I remember last Java Sun Tech Days @ Hyderabad, when James Gosling was asking the audience who all were out there still using old editors like emacs/vim. Hardly a bunch would have raised their hands. The point he was driving was that in this age, we should probably move away from these editors and get into the groove of modern IDEs like Eclipse/NetBeans as they give powerful features like refactoring, automated testing etc. So its not worth the effort to learn all those weird key combos to drive the work. Of course he was talking more in perspective of J2EE development.</p>
<p>So what makes me drive back in time to the good old editor of yester years? Well, first is I am now full time into Ruby on Rails. I started Ruby learning expedition with NetBeans. But then somewhere in between I learnt Oracle has stopped support for JRuby in NetBeans. So then I moved to gedit and installed all the relevant plugins to make it a <a href="http://maketecheasier.com/transform-gedit-into-a-web-developer-ide/2010/12/29">gmate</a> (the mac-textmate equivalent in Ubuntu). Even though it was too good than the conventional gedit, still a lot was desired. So finally I decided to take the plunge and get into emacs. The good old emacs which I had been using some 4-5 years back and then ditched it to enter the snazzy world of IDEs. First few days were time for refreshing those old commands C-x s and C-x c etc. After that things just rolled out fast.</p>
<p>Now I am fully hooked onto emacs &#8211; the beautiful editor of Unix. To facilitate Ruby/Rails development I went ahead and installed <a href="http://rinari.rubyforge.org/index.html">Rinari</a> &#8211; The Ruby on Rails Minor Mode for emacs. From there there was no looking back. The awesome keys which Rinari provides has made Rails development a breeze. If you are a Rails guy you would savour this short cuts &#8211; a ready reckoner of keyboard commands in emacs for Ruby on Rails Projects.</p>
<p><code>     C-c ; f c	rinari-find-controller<br />
     C-c ; f e	rinari-find-environment<br />
     C-c ; f f	        rinari-find-file-in-project<br />
     C-c ; f h	rinari-find-helper<br />
     C-c ; f i	        rinari-find-migration<br />
     C-c ; f j	        rinari-find-javascript<br />
     C-c ; f l	        rinari-find-plugin<br />
     C-c ; f m	rinari-find-model<br />
     C-c ; f n	rinari-find-configuration<br />
     C-c ; f o	rinari-find-log<br />
     C-c ; f p	rinari-find-public<br />
     C-c ; f s	rinari-find-script<br />
     C-c ; f t	        rinari-find-test<br />
     C-c ; f v	rinari-find-view<br />
     C-c ; f w	rinari-find-worker<br />
     C-c ; f x	rinari-find-fixture<br />
     C-c ; f y	rinari-find-stylesheet<br />
</code></p>
<p>Rinari makes navigating within the Rails Project a breeze. Say if you are in view page you do C-c ; f c it takes you to the controller of the corresponding page and from there do C-c ; f m you land in the model of that page. It&#8217;s intelligent to figure you out the correct file for that. </p>
<p>Also it includes the shortcut C-c; w which starts the webserver for you within emacs. The webserver logs are like just another buffer in emacs. So when some error crops up do a C-x b to switch to the logs then in the error line in the log just hit a  you land at the source code line where error has occured.</p>
<p>On top of Rinari, its good also to install Ruby-Electric which helps in automatic bracket closure, indentation etc. Then add up AutoCompletion and RSense to get auto completion feature in emacs for Ruby/Rails code like any other modern IDE. This <a href="http://itstickers.blogspot.com/2010/11/all-about-emacs.html">blogpost</a> is a good reference to configure emacs for Ruby on Rails.</p>
<p>The good thing about emacs is its just not a editor its an ecosystem unto itself, each day I am discovering something new in emacs. Once you are proficient in emacs I think you need not go out to shell or anyother place everything can be accomplished within emacs. For instance I have started maintaining my calendar &amp; dairy and daily notes within the emacs with M-x calendar command. I have started using emacs calculator for my math occassionally, now I am trying to bring in my google mail box within emacs, small pdf documents I read within emacs now. </p>
<p>So the clock has turned back &#8211; its sheer joy using emacs and learning those beautiful commands. </p>
<p>I am not sure if there is any other editor out there which has some much features rolled into it and allow customizations to crazy levels if you know a bit of lisp.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=137&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/03/24/back-to-emacs-for-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing RoR in Ubuntu</title>
		<link>http://arunsark.wordpress.com/2011/02/25/installing-ror-in-ubuntu/</link>
		<comments>http://arunsark.wordpress.com/2011/02/25/installing-ror-in-ubuntu/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 07:14:02 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Gems]]></category>
		<category><![CDATA[Gemsets]]></category>
		<category><![CDATA[Rails3]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RVM]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=131</guid>
		<description><![CDATA[The real strength of Ubuntu/Debian system is its package manager which makes the upgrade and installs in the system a breeze. In this post I am going to talk about ways to install Ruby and Rails in Ubuntu system. Perhaps the easiest way to install Ruby is to use the apt package manager. Well you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=131&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The real strength of Ubuntu/Debian system is its package manager which makes the upgrade and installs in the system a breeze. In this post I am going to talk about ways to install Ruby and Rails in Ubuntu system.</p>
<p>Perhaps the easiest way to install Ruby is to use the apt package manager. Well you can do<br />
<code>sudo apt-get install ruby</code>	</p>
<p>But it turns out that its a bad idea to use apt for installing Ruby in Ubuntu. Primary reason being that Ruby development goes real fast and Ubuntu package managers are bit slow in catching up with it. As of today Ruby 1.9.1 is available through apt-get, but Ruby currently is 1.9.2. Ok, that is one of the reasons for not using apt, the other major reason is that we need to have a mechanism to install and switch between multiple versions of Ruby and Rails and perhaps switch back and forth between them.</p>
<p>Say you have to work with Ruby 1.8.7 with Rails2.3 in one project and Ruby 1.9.2 with Rails3 in another one. Using apt to install various versions of the language makes this difficult. Enter <strong>RVM</strong> (Ruby Version Manager)</p>
<p>Ok, if you want to further convince yourself about reasons of not going with debian package manager read <a href="http://news.ycombinator.org/item?id=2039438">this</a>.</p>
<p><strong>Some Terminologies</strong><br />
A newbee in Ruby Land can be overwhelmed with the terminologies in this world, so let me first clear them before diving into the how-to&#8217;s of upping the RoR in Ubuntu machine</p>
<p><strong>Gem</strong> &#8211; aka RubyGem is a package manager for Ruby. As apt is the package manager for Ubuntu you can think Gem is package manager for just Ruby Ecosystem. In apt you have .deb file, here we have .gem file which is called the gem file, gem is nothing but a packaged Ruby program or library. Analogous to Java World .gem file can be equated to .jar file. But gem provides command like gem install which you can use to install gems remotely (like apt-get install). Similar commands are there for remove. </p>
<p><strong>RVM</strong> &#8211; <a href="http://rvm.beginrescueend.com/rvm/basics/">Ruby Version Manager</a> is a manager which helps in installing multiple versions of ruby language and gems. You can easily mix and match the language version with various gems and use them independently. It provides a neat way of separating the versions without any clashes. RVM does this through gemsets. Essentially it provides a compartment or work-area where you can start your work with Ruby.</p>
<p><strong>Gemset</strong> &#8211; Gemset is like an environment provided by RVM. In a Gemset first you choose which version of Ruby to use and then you can add as many gems within that gemset. You can create as many gemsets as you want. For each gemset you choose the ruby version and add gems into the gemset.</p>
<p><strong>Installation</strong></p>
<p>Ok, I hope now you are comfortable with jargons, its time to dive deep into the installation steps.</p>
<p><strong>Pre-reqs</strong> To get started make sure you have git and curl in your system. Assume all those into programming will already have that ready.</p>
<p><strong>Install RVM</strong> Look through the steps for RVM Install <a href="http://rvm.beginrescueend.com/rvm/install/">here</a>. Its pretty straightforward. Once we have the RVM, we can install Ruby and start creating gemsets.</p>
<p>To install ruby you have give command<br />
<code>rvm install 1.9.2</code></p>
<p>Here 1.9.2 denotes the Ruby Version.</p>
<p>Suppose you want to have 1.8.7 Ruby also in same system do<br />
<code>rvm install 1.8.7</code></p>
<p>Now that you have multiple versions of Ruby in your system, you have to decide which version to use, you can give<br />
<code>rvm use 1.9.2</code></p>
<p>or say to make 1.9.2 default<br />
<code>rvm --default use 1.9.2</code></p>
<p><strong>Creating Gemsets</strong><br />
Now that you have Ruby ready, you have option to create gemset or you can even ignore this and use the default (the global gemset). I feel its always better to start by creating a gemset, so that later on you can easily switch to different version if needed.</p>
<p>To create your own gemset give command<br />
<code>rvm gemset create foo</code></p>
<p>So foo is the name of your gemset. Next step would be to associate a Ruby Version to the gemset and start using it. For that start using gemset foo give<br />
<code>rvm use 1.9.2@foo</code></p>
<p>So you are saying that you want to use Ruby 1.9.2 with gemset foo. Note above command also switches you to the foo gemset. So from now on if you do anything it will be within the gemset foo. That is to say suppose you install any gem like rails it will be within the gemset foo.</p>
<p>To check the gems within gemset give<br />
<code>gem list --local</code></p>
<p>Ok! now to the crux, to install Rails just have to give<br />
<code>gem install rails</code></p>
<p>Yup! that is it, you are up and running with Ruby on Rails!</p>
<p><strong>Potential Pitfalls</strong><br />
When you install Ruby using the rvm install command it pulls out the source code and compiles it and then installs it. So you have make sure that relevant libraries are there in the system, especially the zlib.</p>
<p>In one of the system, where I was trying out, didn&#8217;t have zlib so after doing all the steps when I tried to install gems with gem install command it was giving error</p>
<p><code>$ gem install rails<br />
ERROR:  Loading command: install (LoadError)<br />
    no such file to load -- zlib<br />
ERROR:  While executing gem ... (NameError)<br />
    uninitialized constant Gem::Commands::InstallCommand</code></p>
<p>This was quite vexing issue I tried to install zlib with apt-get still couldn&#8217;t resolve it. So if you face this problem you can do the following steps</p>
<p><code><br />
$ rvm pkg install zlib<br />
$ rvm remove 1.9.2<br />
$ rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr<br />
</code></p>
<p>Essentially what  it does is installs zlib with rvm. Then we remove Ruby and then compile and install Ruby again.</p>
<p>The best approach to tackle this will be to do this step before start of the installation</p>
<p><code><br />
$sudo apt-get install build-essential bison openssl libreadline5 libreadline5-dev curl git zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf<br />
</code></p>
<p><strong>Moving Ahead</strong></p>
<p>RVM installs and maintains all the gems and gemsets in your home directory under .rvm/ folder.<br />
Here under ~/.rvm/gems folder you can find info about all your gemsets</p>
<p><code>gems&gt;pwd<br />
/home/arun/.rvm/gems<br />
gems&gt;ls -l<br />
total 24<br />
drwxr-xr-x 2 arun arun 4096 2011-01-30 00:29 cache<br />
drwxr-xr-x 7 arun arun 4096 2011-01-31 18:07 ruby-1.9.2-p136@foo<br />
drwxr-xr-x 2 arun arun 4096 2011-02-01 05:32 ruby-1.9.2-p136@foo1<br />
drwxr-xr-x 7 arun arun 4096 2011-01-30 00:29 ruby-1.9.2-p136@global<br />
drwxr-xr-x 2 arun arun 4096 2011-01-31 17:39 ruby-1.9.2p136@rails3tutorial</code></p>
<p>So there you can see the gemsets created by me. global is the default gemset created by rvm.</p>
<p>Suppose you want to download a gem and install it. Copy the downloaded gem file to <code>$GEM_HOME</code>.<br />
Then you can give<br />
<code>gem install </code></p>
<p>Suppose you want to have <a href="http://www.robertblum.com/downloads/rubyrss-1.1.gem">Ruby RSS gem</a>. Download it and copy it to $GEM_HOME. Then give gem install. The steps are listed below</p>
<p><code><br />
gems&gt;cp /media/harddisk/downloads/rubyrss-1.1.gem $GEM_HOME<br />
gems&gt;cd $GEM_HOME<br />
ruby-1.9.2-p136@foo&gt;ls<br />
bin  cache  doc  gems  rubyrss-1.1.gem  specifications<br />
ruby-1.9.2-p136@foo&gt;gem install rubyrss-1.1<br />
Successfully installed rubyrss-1.1<br />
1 gem installed<br />
Installing ri documentation for rubyrss-1.1...<br />
Installing RDoc documentation for rubyrss-1.1...<br />
ruby-1.9.2-p136@foo&gt;gem list --local<br />
...........<br />
rspec-mocks (2.3.0)<br />
rspec-rails (2.3.0)<br />
rubygems-update (1.4.2)<br />
<strong>rubyrss (1.1)</strong><br />
.........................<br />
</code></p>
<p><strong>TIP</strong><br />
While installing gems it&#8217;s better to avoid rdoc and ri doc which gets installed with the gem. These documentation consume space and increases time to install. Anyway most of us will be googling or consulting online docs while development so if needed we can avoid docs totally while installing any gem. For that give</p>
<p><code>gem install rubyrss-1.1 -d --no-rdoc --no-ri</code></p>
<p>Hope a new-bee would find this post useful and easily get on with RoR in Ubuntu. </p>
<p><strong>Great References</strong></p>
<p>http://everydayrails.com/2010/06/28/rvm-gemsets-rails3.html</p>
<p>http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you</p>
<p>http://rvm.beginrescueend.com/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=131&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2011/02/25/installing-ror-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
		<item>
		<title>Cardinal Sins of Programming</title>
		<link>http://arunsark.wordpress.com/2010/12/25/cardinal-sins-of-programming/</link>
		<comments>http://arunsark.wordpress.com/2010/12/25/cardinal-sins-of-programming/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 20:15:37 +0000</pubDate>
		<dc:creator>arunsark</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Clean Code]]></category>
		<category><![CDATA[Code Complete]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Craftmanship]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://arunsark.wordpress.com/?p=126</guid>
		<description><![CDATA[What I am going to put here is nothing new or enlightening for a seasoned software developer, it&#8217;s just my trials and tribulations working through some heavily screwed projects over the course of my career. So what are those software (mal)practices which sound death knell and ensue disaster? Well, here are my top recipes for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=126&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What I am going to put here is nothing new or enlightening for a seasoned software developer, it&#8217;s just my trials and tribulations working through some heavily screwed projects over the course of my career.</p>
<p>So what are those software (mal)practices which sound death knell and ensue disaster? Well, here are my top recipes for embracing pain</p>
<p>1. Code Repetition &#8211; Remember DRY aka Do not Repeat Yourself. Even if you repeat a mere 3/4 lines of code in 10 odd places just pause and think over. Something ought to be fishy, try to put that repetition into a function, reuse the code. I have burnt my fingers fixing repeated lines of code in 10 to 100 odd places, even a full package of Java files being completely duplicated to another package. Just remain ruthless if you see duplication, it should never be there, don&#8217;t hesitate to select and hit del, even if your manager is going to fire you for that.</p>
<p>2. Intermixing logic &#8211; Or simply violating SRP (Single Responsibility Principle). Its really catastrophic to mix UI logic with business logic. It just makes the whole code very difficult to read/debug and even more difficult to change anything. Suppose you want a new UI for the same logic, you are screwed, you have to recode the entire business logic again or refactor the current code to separate out business logic from UI. In this aspect I need to point out a horrible technological offering from Java Stable &#8211; JSP. If not used carefully JSP spell death knell. It&#8217;s so easy to mix db calls/business logic and UI HTML into the JSP. But what we get out of this shortcut is a code mass which totally undecipherable, not at all debuggable and what more stack traces point to the dynamic servlet code line numbers of the JSP. I loathe JSPs and wish Sun never gave so much power to the naive user to intermix things and screw up life.</p>
<p>3. Conventions &#8211; How do you feel when you see code with variables test1, test2, test5, i, j, looper, arraylist, map1, list1 etc. Terrible and horrible. You read method half way then you wonder what this test1 actually is then you scroll up then find out what is getting assigned to it, then come down and re-read. The naming convention is not confined to Java variables or methods, even for HTML tags. Its really a bad idea to give tag ids as myForm or myButton. I faced really a real night mare when we decided to consolidate all JavaScrips littered over JSPs to a single JS and include it every where. In the end you have 10 functions with name submitForm. You are screwed, you have a real pain to correct them If your form is an Order entry form right name for form id would be orderForm and submit of that form would invoke submitOrder() method in JavaScript. </p>
<p>4. Looong methods &#8211; How long can a method be? 1000 lines, 4000 lines? Well I had opportunity to debug upto 10k lines of code in a method. My pea brain just could not hold on that and I just had to leave that and pray before I run those methods. I personally feel 50 is the max number of lines  you can have, 50 is upper limit of tolerance, ideally a method need to be 10-15 lines of code in a well crafted software.</p>
<p>5. Exposing the internals &#8211; If you have class, don&#8217;t expose the internals of it to outside. If you maintain list of names as HashMap inside a class, don&#8217;t tell world that you are using HashMap. Just keep it with you and give neat interfaces to outside like<br />
<code>void addStudent(int id,String name)<br />
Iterable getStudentNames()<br />
void getStudentName(int id)</code></p>
<p>rather than using<br />
<code>HashMap getStudentMap()</code></p>
<p>In the latter case call can even modify the Map without you being aware of it and at later point if you are going to change the Map to a Student Class, you are screwed up because all those who are exposed to your internals need to be updated.</p>
<p>6. Building the code on<code> ArrayList, HashMap</code> &#8211; ArrayList and HashMaps are good, but should be the lowest level of implementation never exposed out through public APIs or methods. I had tremendous experiences where a HashMap contains 10 keys, 1st key returns another HashMap which intern has 10 keys and each of those keys have ArrayList, Array, String, Integer etc. Then there were wonderful data structures like an Array of ArrayList. These kind of things drive you nuts and crazy, unless you debug line by line and print line by line its never clear what goes where. Class is the most powerful abstraction you have and try to encapsulate things within the objects and pass around objects rather than Lists and Maps.</p>
<p>7. Think a little bit ahead &#8211; Yea its not good to code for requirements which you are not having today, but still for some cases it&#8217;s good to assume certain things and give that flexibility in the code.  A case in point is internationalization, just don&#8217;t litter messages and boiler plate texts in Java/JSP/JavaScripts, have mechanism in place from beginning itself, even though you may just show things in English alone. Another aspect is db, it&#8217;s not good to assume one db and code it, code ought to be db agnostic. I had seen code where things were assumed to be always on Oracle and they take liberty of using sequences or sysdate (both Oracle specific) and one fine morning customer comes and tell you, well I want only SQL/Server. You are doomed.</p>
<p>8. Passion &#8211; (or lack of it) Majority of those who write code, do it for getting pay cheque at month end. Building code is cheap and easy. Anyone with a reasonable aptitude can do it. But crafting it to be readable, extensible, maintainable requires lot of pain, learning and rework. If you are not willing to take that pain, not willing to learn how to write testable software, then don&#8217;t just do it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/arunsark.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/arunsark.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/arunsark.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=arunsark.wordpress.com&amp;blog=15730&amp;post=126&amp;subd=arunsark&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://arunsark.wordpress.com/2010/12/25/cardinal-sins-of-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/909afbd1ba3910ccfba277391599f47a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">arunsark</media:title>
		</media:content>
	</item>
	</channel>
</rss>
