<?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>An apple a day</title>
	<atom:link href="http://ranjithchandran.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ranjithchandran.wordpress.com</link>
	<description>learn, unlearn and re-learn</description>
	<lastBuildDate>Tue, 09 Aug 2011 16:02:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ranjithchandran.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>An apple a day</title>
		<link>http://ranjithchandran.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ranjithchandran.wordpress.com/osd.xml" title="An apple a day" />
	<atom:link rel='hub' href='http://ranjithchandran.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Bash : find days in previous month</title>
		<link>http://ranjithchandran.wordpress.com/2010/03/29/bash-find-days-in-previous-month/</link>
		<comments>http://ranjithchandran.wordpress.com/2010/03/29/bash-find-days-in-previous-month/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 15:59:45 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[days in previous month]]></category>
		<category><![CDATA[ksh]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=98</guid>
		<description><![CDATA[Here is a one liner to find the number of days in previous month (works in bash and KSH)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=98&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a one liner to find the number of days in previous month (works in bash and KSH)<br />
<pre class="brush: perl;">
cal $((`date '+%m'`-1)) `date '+%Y'` | grep . | fmt -1 | tail -1
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=98&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2010/03/29/bash-find-days-in-previous-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Find sum of file sizes listed in ls -l using awk</title>
		<link>http://ranjithchandran.wordpress.com/2010/03/01/find-sum-of-file-sizes-listed-in-ls-l-using-awk/</link>
		<comments>http://ranjithchandran.wordpress.com/2010/03/01/find-sum-of-file-sizes-listed-in-ls-l-using-awk/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:17:01 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[sum]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=94</guid>
		<description><![CDATA[With this, awk will pull field number 5 from ls -l, which is the size in bytes in most of the *nix platforms. Then for each occurrence add to the variable TOTAL. At &#8220;END&#8221;, it will divide TOTAL by 1024*1024 ( bytes to MB) and print<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=94&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: perl;">
ls -l | awk '{ TOTAL += $5} END { print TOTAL/1024/1024 }'
</pre><br />
With this, awk will pull field number 5 from ls -l, which is the size in bytes in most of the *nix platforms.</p>
<p>Then for each occurrence add to the variable TOTAL. At &#8220;END&#8221;, it will divide TOTAL by 1024*1024 ( bytes to MB) and print</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=94&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2010/03/01/find-sum-of-file-sizes-listed-in-ls-l-using-awk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell script to read java-style property files</title>
		<link>http://ranjithchandran.wordpress.com/2010/01/28/shell-script-to-read-java-style-property-files/</link>
		<comments>http://ranjithchandran.wordpress.com/2010/01/28/shell-script-to-read-java-style-property-files/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:08:49 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[key value]]></category>
		<category><![CDATA[property file]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=89</guid>
		<description><![CDATA[One interesting API in Java is to manipulate key-value configuration files known as &#8216;properties&#8217; I do not know if shell script gurus like to use property files. However, if you are looking for some code to read a key-value pair property file, here is something: Suppose you have a properties file such as : test.properties [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=89&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One interesting API in Java is to manipulate key-value configuration files known as &#8216;properties&#8217;</p>
<p>I do not know if shell script gurus like to use property files. However, if you are looking for some code to read a key-value pair property file, here is something:</p>
<p><pre class="brush: perl;">
#!/bin/sh
#---------------------
# arg1: prop file
# arg2: prop key
# returns property value if found,
# nothing if not found
#---------------------
get_prop(){
propfile=$1
key=$2
grep  &quot;^${2}=&quot; ${1}| sed &quot;s%${2}=\(.*\)%\1%&quot;
}
</pre></p>
<p>Suppose you have a properties file such as : test.properties below</p>
<p><pre class="brush: perl;">
user.name=Ranjith
init.dir=/tmp
</pre></p>
<p>A test call to get value for &#8220;user.name&#8221; would look like</p>
<p><pre class="brush: perl;">
get_prop test.properties user.name
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=89&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2010/01/28/shell-script-to-read-java-style-property-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Printing a crude boxed message using perl &#8211; useful in shell too</title>
		<link>http://ranjithchandran.wordpress.com/2009/12/08/printing-a-crude-boxed-message-using-perl-useful-in-shell-too/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/12/08/printing-a-crude-boxed-message-using-perl-useful-in-shell-too/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 16:13:26 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[box]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=83</guid>
		<description><![CDATA[Sometimes you would want to print  boxed messages such as the following from a script: +-----------------------------------+ &#124;A word is defined as a string of   &#124; &#124;characters delimited by spaces,    &#124; &#124;tabs, or newline characters.       &#124; +-----------------------------------+ If you want to have a re-usable routine to do this, things get a bit complex. There comes print [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=83&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes you would want to print  boxed messages such as the following from a script:<br />
<code>+-----------------------------------+<br />
|A word is defined as a string of     |<br />
|characters delimited by spaces,       |<br />
|tabs, or newline characters.             |<br />
+-----------------------------------+</code></p>
<p>If you want to have a re-usable routine to do this, things get a bit complex. There comes print formatting and word wrapping. While print formatting is easy in shell with printf, word wrapping would require writing a lot of lines of code and trickery. But you can do this real quick using Perl. Here is a little program.<br />
To execute, pass string to be boxed and width of the box as commandline arguments as below<br />
<pre class="brush: perl;">
 perl box.pl &quot;A word is defined as a string of characters delimited by spaces, tabs, or newline characters.&quot; 35
</pre><br />
Source:<br />
<pre class="brush: perl;">
use Text::Wrap;
$Text::Wrap::columns = $ARGV[1];
print ( &quot;+&quot; . ( &quot;-&quot; x $ARGV[1] ) . &quot;+\n&quot; );
foreach(split('\n',wrap('', '', $ARGV[0])))
{
        printf &quot;|%-$ARGV[1]s|\n&quot;, $_;
}
print ( &quot;+&quot; . ( &quot;-&quot; x $ARGV[1] ) . &quot;+\n&quot; );
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=83&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/12/08/printing-a-crude-boxed-message-using-perl-useful-in-shell-too/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Shameless plug</title>
		<link>http://ranjithchandran.wordpress.com/2009/12/05/shameless-plug/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/12/05/shameless-plug/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:43:34 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hibernate hibernate-search lucene java swing]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/2009/12/05/shameless-plug/</guid>
		<description><![CDATA[Here is my Google project to demo hibernate search features. http://code.google.com/p/hb-search-demo/<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=81&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is my Google project to demo hibernate search features.<br />
<a href="http://code.google.com/p/hb-search-demo/">http://code.google.com/p/hb-search-demo/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=81&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/12/05/shameless-plug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick find and edit using vi in Linux/UNIX</title>
		<link>http://ranjithchandran.wordpress.com/2009/11/17/quick-find-and-edit-using-vi-in-linuxunix/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/11/17/quick-find-and-edit-using-vi-in-linuxunix/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 16:04:39 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[tr]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=76</guid>
		<description><![CDATA[OK, so you want to edit/view all the files matching certain pattern on vi from command prompt. How would you do it? Search files using usual &#8220;find&#8221; command, then translate new line in result to space using &#8220;tr&#8221; command and feed the list to vi &#8211; simple! Here you go:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=76&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>OK,  so you want to edit/view all the files matching certain pattern on vi from command prompt. How would you do it?<br />
Search files using usual &#8220;find&#8221; command, then translate new line in result to space using &#8220;tr&#8221; command and feed the list to vi &#8211; simple! Here you go:<br />
<pre class="brush: java;">vi `find . -name *.sh  | tr '\n' ' '`</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=76&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/11/17/quick-find-and-edit-using-vi-in-linuxunix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Scala does not have checked exceptions</title>
		<link>http://ranjithchandran.wordpress.com/2009/07/31/scala-does-not-have-checked-exceptions/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/07/31/scala-does-not-have-checked-exceptions/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 08:46:15 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=65</guid>
		<description><![CDATA[Good! so, the following code will not impact your method signature<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=65&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Good! so, the following code will not impact your method signature<br />
<pre class="brush: perl;">
def doSomething(n:Int) = {
  if (n &lt; 10) {
    throw new  Exception(&quot;Only values between 1 and 10&quot;)
  }
 ...
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=65&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/07/31/scala-does-not-have-checked-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>vim 7 spell check</title>
		<link>http://ranjithchandran.wordpress.com/2009/07/29/vim-7-spell-check/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/07/29/vim-7-spell-check/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 05:39:06 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[gvim]]></category>
		<category><![CDATA[spellcheck]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=63</guid>
		<description><![CDATA[vim as of version 7 had introduced built-in spellchecker. I had not used till date, but recently checked it out. So, to turn it on, type command set spell If you have some text on your vim and you turn sell on with above command, you will see red underlines for words that vim thinks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=63&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vim.org">vim </a>as of version 7 had introduced built-in spellchecker. I had not used till date, but recently checked it out. So, to turn it on, type command<br />
<code>set spell</code><br />
If you have some text on your vim and you turn sell on with above command, you will see red underlines for words that vim thinks are incorrectly spelled. Of course, while coding you might not want spell check, so you can turn it off by<br />
<code>set nospell</code><br />
Now, about navigation and correction.<br />
To go to next spelling error, the keyboard command is <code>]s</code> to go to previous error, the command is <code>[s</code>. To see spelling suggestions, while the cursor is on word with error, press <code>=z</code> and it presents a list of possible words to choose from. Just type the number corresponding to the word that you are interested in, and you are all set.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=63&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/07/29/vim-7-spell-check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Generics puzzler</title>
		<link>http://ranjithchandran.wordpress.com/2009/07/20/java-generics-puzzler/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/07/20/java-generics-puzzler/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 09:22:04 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=58</guid>
		<description><![CDATA[Ok, so you are very excited about Generics and would &#8220;Generify&#8221; whatever you can. But here some interesting pointers. One: This will cause a compilation error Okay, that we all know. Two: Now, what will happen with this? This will compile fine (With a warning actually, that we all would ignore) and print contents of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=58&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ok, so you are very excited about Generics and would &#8220;Generify&#8221; whatever you can. But here some interesting pointers.</p>
<p>One: This will cause a compilation error</p>
<p><pre class="brush: java;">

 Set&lt;String&gt; set = new HashSet&lt;String&gt;();
 set.add(&quot;Testing&quot;);
 set.add(&quot;Testing again&quot;);
 set.add(&quot;Testing again and again&quot;);
 set.add(new Integer(1));

</pre></p>
<p>Okay, that we all know.</p>
<p>Two: Now, what will happen with this?</p>
<p><pre class="brush: java;">

  public static void main(String[] args){
    Set&lt;String&gt; set = new HashSet&lt;String&gt;();
     set.add(&quot;Testing&quot;);
     set.add(&quot;Testing again&quot;);
     set.add(&quot;Testing again and again&quot;);
     doSomething(set);
     System.out.println(set);
   }
   private static void doSomething(Set s){
     s.add(new Integer(21));
   }
}

</pre></p>
<p>This will compile fine (With a warning actually, that we all would ignore) and print contents of the set, including a number.</p>
<p>Three: Well, how to fix this ? How to throw an error when a legacy code is attempting to change the sole purpose of your HashSet? The answer is to declare your set as</p>
<p><pre class="brush: java;">
Set&lt;String&gt; set = Collections.checkedSet(new HashSet&lt;String&gt;(),String.class);
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=58&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/07/20/java-generics-puzzler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
		<item>
		<title>If you want to add an Object to java.util.TreeSet, it must implement Comparable</title>
		<link>http://ranjithchandran.wordpress.com/2009/07/17/if-you-want-to-add-an-object-to-java-util-treeset-it-must-implement-comparable/</link>
		<comments>http://ranjithchandran.wordpress.com/2009/07/17/if-you-want-to-add-an-object-to-java-util-treeset-it-must-implement-comparable/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 09:39:51 +0000</pubDate>
		<dc:creator>ranjithchandran</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Comparable]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[TreeSet]]></category>

		<guid isPermaLink="false">http://ranjithchandran.wordpress.com/?p=44</guid>
		<description><![CDATA[This code will throw a Exception in thread "main" java.lang.ClassCastException Unless Employee implements comparable<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=44&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: java;">
public class Employee{
  private String name;
  Employee(String str ){
    this.name= str;
  }
}
public class Test {
  public static void main(String argv[]){
    TreeSet myMap = new TreeSet();
    Employee s3 = new Employee(&quot;abcdef&quot;);
    Employee s4 = new Employee(&quot;abcdef&quot;);
    myMap.add(s3);
    myMap.add(s4);
</pre></p>
<p>This code will throw a<br />
<code>Exception in thread "main" java.lang.ClassCastException</code></p>
<p>Unless Employee implements comparable</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjithchandran.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjithchandran.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjithchandran.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjithchandran.wordpress.com&amp;blog=7666873&amp;post=44&amp;subd=ranjithchandran&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjithchandran.wordpress.com/2009/07/17/if-you-want-to-add-an-object-to-java-util-treeset-it-must-implement-comparable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/78acdda3998dccc4d1ff0057c8daa9cd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ranjithchandran</media:title>
		</media:content>
	</item>
	</channel>
</rss>
