<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Place for my head &#187; rant</title>
	<atom:link href="http://gnufied.org/category/rant/feed/" rel="self" type="application/rss+xml" />
	<link>http://gnufied.org</link>
	<description>On Ruby, Rails, Concurrency and fiction</description>
	<lastBuildDate>Mon, 10 Oct 2011 06:49:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dont Buy Acer Laptops Ever</title>
		<link>http://gnufied.org/2008/03/01/dont-buy-acer-laptops-ever/</link>
		<comments>http://gnufied.org/2008/03/01/dont-buy-acer-laptops-ever/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 01:30:42 +0000</pubDate>
		<dc:creator>Hemant</dc:creator>
				<category><![CDATA[laptop]]></category>
		<category><![CDATA[notebook]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://gnufied.org/2008/03/01/dont-buy-acer-laptops-ever/</guid>
		<description><![CDATA[I am serious, I know perhaps you have read my last blog entry about Dell support, but let me tell you, that got resolved eventually and onsite tech support guy came and fixed it. Now, Acer was/is the first Laptop I bought about one and half year ago. I had various issues with notebook. One [...]]]></description>
			<content:encoded><![CDATA[<p>I am serious, I know perhaps you have read my last blog entry about Dell support, but let me tell you, that got resolved eventually and onsite tech support guy came and fixed it.</p>
<p>Now, Acer was/is the first Laptop I bought about one and half year ago. I had various issues with notebook. One of them was overheating, other was rebooting without any reasons ( perhaps because of issue#1). Acer never fixed them. I live in Chennai and their service center is in one obscure place ( only one in Chennai ), where you are supposed to take your notebook and ask them to fix. They will take 4 to 5 days if you are lucky enough and after that you are supposed to go there and collect your notebook. Each day, getting your notebook repaired will take almost half of your day. But anyways, they never actually fixed. </p>
<p>Last time I took my notebook to them,  my warranty period was over and their repair charges were almost same as cost of their brand new laptop with almost same configuration.  Whats sad is, that was my first laptop and I bought it with Prize money obtained from <a href="http://www.redhat.in/community/rhscholarship.php">here </a>.</p>
<p>Needless to say, I left hope. But just for anyone else out there, please don&#8217;t buy Acer laptops.</p>
]]></content:encoded>
			<wfw:commentRss>http://gnufied.org/2008/03/01/dont-buy-acer-laptops-ever/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tips for budding Ruby hacker</title>
		<link>http://gnufied.org/2008/02/24/tips-for-budding-ruby-hacker/</link>
		<comments>http://gnufied.org/2008/02/24/tips-for-budding-ruby-hacker/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 20:26:42 +0000</pubDate>
		<dc:creator>Hemant</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://gnufied.org/2008/02/24/tips-for-budding-ruby-hacker/</guid>
		<description><![CDATA[I am no expert in Ruby, but overtime I have accumulated some thoughts that may help you in writing better Ruby code. Always create a directory hierarchy for your library/application. Such as: &#124;__ bin &#124;__ lib &#124;__ tests &#124;__ yaml_specs If you are not writing a library and rather an executable application. Then, have a [...]]]></description>
			<content:encoded><![CDATA[<p>I am no expert in Ruby, but overtime I have accumulated some thoughts that may help you in writing better Ruby code. </p>
<ul>
<li> Always create a directory hierarchy for your library/application. Such as:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">|</span>__ bin
   <span style="color: #000000; font-weight: bold;">|</span>__ lib
   <span style="color: #000000; font-weight: bold;">|</span>__ tests
   <span style="color: #000000; font-weight: bold;">|</span>__ yaml_specs</pre></div></div>

</li>
</li>
<p> If you are not writing a library and rather an executable application. Then, have a separate file that loads/requires required libraries and does some basic stuff. For example, I have a boot.rb in my Comet server that looks like:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;rubygems&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;eventmachine&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;buftok&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;sequel/mysql&quot;</span>
PUSH_SERVER_PATH = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#996600;">'..'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;lib&quot;</span>,<span style="color:#996600;">&quot;channels&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> $:.<span style="color:#9900CC;">unshift</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>PUSH_SERVER_PATH,x<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;push_server&quot;</span></pre></td></tr></table></div>

<p>  Why? Because such a file can come handy when you are writing test_helper for your applications. There, you can simply require above boot.rb, so as you don&#8217;t have to copy stuff back and forth if your required libs change. </li>
<li> If your project hierarchy is like above and you are writing an library not an application, don&#8217;t make the mistake of putting all your files in lib directory straightaway. Rather have a setup like:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  Root
  <span style="color: #000000; font-weight: bold;">|</span>__ bin
  <span style="color: #000000; font-weight: bold;">|</span>__ lib
  <span style="color: #000000; font-weight: bold;">|</span>__ lib<span style="color: #000000; font-weight: bold;">/</span>packet.rb
  <span style="color: #000000; font-weight: bold;">|</span>__ lib<span style="color: #000000; font-weight: bold;">/</span>packet<span style="color: #000000; font-weight: bold;">/</span>other files go here</pre></div></div>

<p>  And use relative requires in &#8220;packet.rb&#8221; file, like:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">$:.<span style="color:#9900CC;">unshift</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span>
  $:.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> $:.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_parser&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_meta_pimp&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_core&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_master&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_connection&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;packet/packet_worker&quot;</span>
&nbsp;
PACKET_APP = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#996600;">'../'</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#9966CC; font-weight:bold;">defined</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>PACKET_APP<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> Packet
  VERSION=<span style="color:#996600;">'0.1.4'</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p> It would be helpful in avoiding package name collisions that otherwise your users will report.
</li>
<li>  Once <a href="http://chneukirchen.org/blog/">chris2 </a> mentioned on #ruby-lang, you shouldn&#8217;t be overly clever with test cases. Don&#8217;t try to be too DRY in your test cases. </li>
<li> Write code that can be <em> easilly </em> tested. What the fuck that means? When I started with Ruby and was doing Network programming. I used to write methods like ughh, that always manipulated state through instance variables. I either used threads or EventMachine. One of the issues with EventMachine is, code written usually relies on state machine and hence it can be notoriously difficult to unit test, because most of the time your methods are working according to the state of instance of variables. That was bad. Try to write code in more functional way, where methods take some parameters and return some values based on arguments. You should minimize methods with side effects as much as possible. This will make your code more readable and easily <em>testable </em></li>
<li> Read code of some good libraries, such as <a href="http://ramaze.net/">Ramaze </a>, Rake, standard library. </li>
<li> Use <a href="https://rubyforge.org/projects/fastri/">FastRi</a> rather than Ri. If possible, generate your set of documentation using rdoc on Ruby source code. I spend time just looking through methods, classes just for fun. However, I don&#8217;t like the default default RDoc template, use Jamis RDoc template, if you like Rails documentation. Often for gems installed on your machine, you can use gem server or gem_server to view their documentation.</li>
<li> #ruby-lang on freenode is generally a good place to shoot general Ruby questions. Be polite, don&#8217;t repeat and you will get your answers </li>
<li> Avoid monkey patching core classes if your code is a library and will go with third party code. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://gnufied.org/2008/02/24/tips-for-budding-ruby-hacker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Lyrical Whisprings #5</title>
		<link>http://gnufied.org/2008/01/08/lyrical-whisprings-5/</link>
		<comments>http://gnufied.org/2008/01/08/lyrical-whisprings-5/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 21:59:47 +0000</pubDate>
		<dc:creator>Hemant</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://gnufied.org/2008/01/08/lyrical-whisprings-5/</guid>
		<description><![CDATA[Slow silly movement. No, its not for you. No, You can&#8217;t talk too loudly , you will be grabbed and gagged. There will be questions! Its not, &#8220;Freedom is Slavery&#8221;. Its You. Its the tangled webs that you have woven, and lo! Who is hanging and smiling from webs of Shelob. No its not him, [...]]]></description>
			<content:encoded><![CDATA[<p>Slow silly movement. No, its not for you.<br />
No, You can&#8217;t talk too loudly , you will<br />
be grabbed and gagged. There will be questions!</p>
<p>Its not, &#8220;Freedom is Slavery&#8221;.</p>
<p>Its You. Its the tangled webs that you have woven, and lo! Who is hanging and smiling from<br />
webs of Shelob. No its not him, its you most likely.</p>
<p>A memory of never happening bliss and if it happens you wouldn&#8217;t know most likely.</p>
<blockquote><p>That there<br />
Thats not me<br />
I go<br />
Where I please<br />
I walk through walls<br />
I float down the liffey<br />
Im not here<br />
This isnt happening<br />
Im not here<br />
Im not here</p></blockquote>
<p>I wish no questions!</p>
]]></content:encoded>
			<wfw:commentRss>http://gnufied.org/2008/01/08/lyrical-whisprings-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

