<?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>A coder's blog for coders</title>
	<atom:link href="http://vinaychilakamarri.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinaychilakamarri.wordpress.com</link>
	<description>(Do I sound like a commie?)</description>
	<lastBuildDate>Sun, 14 Dec 2008 06:54:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vinaychilakamarri.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>A coder's blog for coders</title>
		<link>http://vinaychilakamarri.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vinaychilakamarri.wordpress.com/osd.xml" title="A coder&#039;s blog for coders" />
	<atom:link rel='hub' href='http://vinaychilakamarri.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Atoms in Regular Expressions</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/12/14/atoms-in-regular-expressions/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/12/14/atoms-in-regular-expressions/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 01:20:00 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[Regular expressions]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=50</guid>
		<description><![CDATA[I read about something interesting today. There is a term called &#8216;Atom&#8217;  when you are dealing with regular expressions. Knowing the importance of  how you formulate a regular expression becomes important because some expressions might turn out as something you usually don&#8217;t anticipate. Talking about quantifiers in the context of  atoms, the importance of atoms [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=50&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I read about something interesting today. There is a term called &#8216;Atom&#8217;  when you are dealing with regular expressions. Knowing the importance of  how you formulate a regular expression becomes important because some<br />
expressions might turn out as something you usually don&#8217;t anticipate. Talking about quantifiers in the context of  atoms, the importance of atoms becomes more vivid when you consider this example: ha{6}, (ha){6}. Although<br />
they seem to be very similar, the additional parentheses treat &#8216;ha&#8217; as a single atom and match only those words whose pattern contains &#8216;ha&#8217; for 6 consecutive times. The former expression tries to match only those patterns in which &#8216;h&#8217; is followed by 6 a&#8217;s. Let&#8217;s say I wanted to match a word that starts with &#8216;pre&#8217; and ends with &#8216;tion&#8217;</p>
<p>These are some of the possibilities that I should be expecting:<br />
premonition<br />
predilection<br />
prediction<br />
etc.</p>
<p>So, a possible expression can be:<span style="color:#00ccff;"> <span style="color:#ff9900;"><strong></strong></span></span></p>
<p><span style="color:#00ccff;"><span style="color:#ff9900;"><strong>^(pre)+([a-z]*|[A-Z]*|\\s)*(ion)+\$</strong></span></span></p>
<p>Any word that beings with the atom &#8220;pre&#8221;, in which the atom &#8220;pre&#8221; Must occur at least one time and can occur more than one time after the beginning, and there can be 0 or many characters in the middle, starting from a-z OR A-Z OR space characters with a quantifier *, which indicates that the characters can occur 0 or more times, with an external quantifier that ensures that the letter case is ignored during the match, and it only matches the patterns that end with the atom, &#8220;ion&#8221;, which is specified by the concluding $</p>
<p>Example 2:</p>
<p><span style="color:#ff9900;"><strong>^?[0-9]+(ord)+\$?</strong></span></p>
<p>Says that the atom &#8216;ord&#8217; has to be preceded at least once by a number. The + quantifier after [0-9] signifies that the numbers can be repeated any number of times. Also the ^? signifies that the numbers need not start from the beginning of the pattern in question. Also what the &#8220;\$?&#8221; means is that the pattern need not essentially end with the atom &#8220;ord&#8221;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=50&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/12/14/atoms-in-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Advanced Packaging Tool forces the usage of CD-ROM sources and quits&#8230;. help!</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/12/13/advanced-packaging-tool-cdrom-problem/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/12/13/advanced-packaging-tool-cdrom-problem/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 18:02:50 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[cd-rom]]></category>
		<category><![CDATA[linux issues]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=45</guid>
		<description><![CDATA[When I started using a headless Debian, my only weapon to install the needed packages was &#8216;apt&#8217;. But I was hit on the head, when it was forcing me to install sources from CD-ROM, instead of looking for sources from the internet. Picture this scenario: vinay@darkbox:~$ sudo apt-get install blah-app &#8230;&#8230;&#8230;&#8230;&#8230;&#8230; After printing some packages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=45&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I started using a headless Debian, my only weapon to install the needed packages was &#8216;apt&#8217;. But I was hit on the head, when it was forcing me to install sources from CD-ROM, instead of looking for sources from the internet. Picture this scenario:</p>
<p>vinay@darkbox:~$ sudo apt-get install blah-app</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>After printing some packages that need to be updated</p>
<p>&#8230;&#8230;&#8230;&#8230;..</p>
<p>&#8230;&#8230;&#8230;</p>
<p>[b]Media change: please insert the disc labeled<br />
&#8216;xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx)&#8217;<br />
in the drive &#8216;/cdrom/&#8217; and press enter<br />
&lt;enter&gt;<br />
Media change: please insert the disc labeled<br />
&#8216;xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx)&#8217;<br />
in the drive &#8216;/cdrom/&#8217; and press enter</p>
<p>** The xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx) can be anything depending on your distro.</p>
<p>A solution for this is to comment out the source list that points to the CD-ROM on the apt sources. So I did this:</p>
<p>vi /etc/apt/sources.list and comment the line that reads something similar to this:</p>
<p><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--> <span style="font-size:10pt;font-family:&quot;">deb <strong>cdrom</strong>:[</span> xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx) <span style="font-size:10pt;font-family:&quot;">]/ hoary main restricted</span></p>
<p>This will restrict the apt tool from looking back to CD-ROM for the sources and quit. There may be some other approaches for this problem. It would be helpful if anyone who reads this thread discuss those approaches here.</p>
<p>Good Luck!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=45&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/12/13/advanced-packaging-tool-cdrom-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Tetrahedral Numbers puzzle</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/11/23/tetrahedral-numbers-puzzle/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/11/23/tetrahedral-numbers-puzzle/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 19:48:47 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Algos]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=40</guid>
		<description><![CDATA[Was attending an interview few days ago an I was presented with a good puzzle. The question goes this way: A pirate arranges his cannon balls as show in the following way: In the first arrangement, there is only one cannon ball. To support it, he inserts 3 cannon balls under it. And to support [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=40&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Was attending an interview few days ago an I was presented with a good puzzle. The question goes this way:</p>
<p>A pirate arranges his cannon balls as show in the following way:</p>
<p><a href="http://vinaychilakamarri.files.wordpress.com/2008/11/1.jpg"><img class="aligncenter size-full wp-image-41" title="1" src="http://vinaychilakamarri.files.wordpress.com/2008/11/1.jpg?w=450&#038;h=294" alt="1" width="450" height="294" /></a></p>
<p>In the first arrangement, there is only one cannon ball. To support it, he inserts 3 cannon balls under it. And to support those 3, 6 would be placed under them and so on. Now if you count the balls in each case it would follow a series like 1 , 4 , 10 &#8230;. Write a logic for generating this.</p>
<p>This is interesting puzzle. As we can see, the cannon balls have some embedded pattern in them:</p>
<p>1</p>
<p>1 + (1+2)</p>
<p>1+ (1+2) + (1+2+3)</p>
<p>and so on.</p>
<p>A little math knowledge would help here. If you are aware of the formula for first N natural numbers, it is</p>
<p>N* (N+1) / 2. This can be extended to this puzzle easily to calculate the series. Here is how it can be applied</p>
<p>1*(1+1)/2</p>
<p>1*(1+1)/2 + 2 * (2+1)/2</p>
<p>1*(1+1)/2 + 2 * (2+1)/2 + 3*(3+1)/2</p>
<p>and so on.</p>
<p>As can be seen, we could apply a Sigma operator to condense this formula a little bit:</p>
<p>∑ n * (n+1)/2</p>
<p>for n = 1 to n</p>
<p>Now that we have a cute little Math counter in our hand, we can code it fast. Here is what I did:</p>
<p>public class TetrahedralNumbers {</p>
<p>public static void main(String[] args){</p>
<p>int cannon = 0;<br />
for(int i = 1; i &lt; 14; i++)<br />
{<br />
cannon += (i * (i+1))/2;<br />
System.out.println(cannon);<br />
}<br />
}</p>
<p>}</p>
<p>If you are unaware of the Math part and want to go solving this, there is a slightly inefficient approach that still solves the puzzle:</p>
<p>public class TetrahedralNumbers {</p>
<p>public static void main(String[] args)<br />
{<br />
for (int i = 1; i &lt; 10; i++)<br />
{<br />
int count = 0;</p>
<p>for(int j = 1; j &lt;= i; j++)<br />
{<br />
for(int k = 1; k &lt;= j; k++)<br />
{<br />
count += k;<br />
}<br />
}<br />
System.out.println(count);<br />
}<br />
}</p>
<p>}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=40&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/11/23/tetrahedral-numbers-puzzle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>

		<media:content url="http://vinaychilakamarri.files.wordpress.com/2008/11/1.jpg" medium="image">
			<media:title type="html">1</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing Gnome for a headless CentOS Image for VirtualBox</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/11/18/installing-gnome-for-a-headless-centos-image-for-virtualbox/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/11/18/installing-gnome-for-a-headless-centos-image-for-virtualbox/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 00:28:56 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[headless]]></category>
		<category><![CDATA[wget]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=37</guid>
		<description><![CDATA[Was searching for VDI Linux image files to plug them into my Virtual Box and was wanting to play around with CentOS image. http://virtualbox.wordpress.com/images/ This place has a gorgeous collection of images. You can pick one from them too. But the latest distribution of CentOS comes with no GUI.So I wanted to have Gnome on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=37&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Was searching for VDI Linux image files to plug them into my Virtual Box and was wanting to play around with CentOS image.</p>
<p>http://virtualbox.wordpress.com/images/</p>
<p>This place has a gorgeous collection of images. You can pick one from them too. But the latest distribution of CentOS comes with no GUI.So I wanted to have Gnome on my new CentOS baby. Luckily it had wget, yum for rescue. Here is what I did after booting up the image and logging in as root (don&#8217;t follow this before you read entire article):</p>
<p><strong>yum groupinstall  “X Window System” “GNOME Desktop Environment”</strong></p>
<p>After downloading a bunch of packages, it complained about the absense of  a &#8220;libgaim.so.0&#8243; package that is needed by &#8220;nautilus-sendto&#8221; package. You would see something like this:</p>
<p><strong>0002483: nautilus-sendto requires a non-existent libgaim.so.0 </strong></p>
<p>Fortunately, it&#8217;s a known bug: http://bugs.centos.org/view.php?id=2483</p>
<p>The solution is to get an rpm package and install it with nodeps option. So here is what you need to do:</p>
<p><strong>wget <a href="http://mirror.centos.org/centos/5/os/i386/CentOS/nautilus-sendto-0.7-5.fc6.i386.rpm">http://mirror.centos.org/centos/5/os/i386/CentOS/nautilus-sendto-0.7-5.fc6.i386.rpm</a></strong></p>
<p>After downloading the package, install it as follows:</p>
<p>rpm -Uvh &#8211;nodeps nautilus-sendto-0.7-5.fc6.i386.rpm</p>
<p>Once this is done, type in this:</p>
<p><strong>yum groupinstall  “X Window System” “GNOME Desktop Environment”</strong></p>
<p>That&#8217;s it. Your headless centOS is equipped with Gnome!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=37&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/11/18/installing-gnome-for-a-headless-centos-image-for-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a map of maps in Java</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/30/creating-a-hashmap-of-hashmaps-in-java/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/30/creating-a-hashmap-of-hashmaps-in-java/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 05:02:00 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[hashmap of hashmaps]]></category>
		<category><![CDATA[hastable]]></category>
		<category><![CDATA[hastables]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=24</guid>
		<description><![CDATA[At times I saw that some people get struck when it comes to creating a map of maps. It is not really a rocket science but needs a little sleight of hand. Here I will explain on how to create a map of maps in Java language. The same can be used for other languages. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=24&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At times I saw that some people get struck when it comes to creating a map of maps. It is not really a rocket science but needs a little sleight of hand. Here I will explain on how to create a map of maps in Java language. The same can be used for other languages. Also post in some of the other cool tricks if you may have any:</p>
<p>Here is the scenario&#8230; I have a text file in this format:</p>
<p>Gasoline     Mexico $2.5</p>
<p>Gasoline     USA    $4.5</p>
<p>Gasoline    Afghanistan  $85</p>
<p>Beer    Mexico $1.25</p>
<p>Beer  USA   $2.85</p>
<p>Beer Afghanistan  $0.0</p>
<p>Now I want to query for &#8216;gasoline&#8217; and get a map of  all &#8216;country &#8212;&gt; price&#8217; listings. Similarly, I want to ask for beer and get a list of  &#8216;country &#8212;&gt; price&#8217;. This can be easily done by building a hashmap of hashmaps.  As a visual guide, this is how the Datastructure will look like, after we&#8217;re done designing it:</p>
<p style="text-align:center;"><a href="http://vinaychilakamarri.files.wordpress.com/2008/07/beergas.jpg"><img class="size-medium wp-image-26 aligncenter" src="http://vinaychilakamarri.files.wordpress.com/2008/07/beergas.jpg?w=300&#038;h=283" alt="" width="300" height="283" /></a></p>
<p style="text-align:left;">My Approach:</p>
<p style="text-align:left;">Hashmap&lt;String,Properties&gt; gasBeerMap = new HashMap&lt;String,Properties&gt;();</p>
<p style="text-align:left;">//read the text file, get the inputstream</p>
<p style="text-align:left;">while(there are more lines in the textfile)</p>
<p style="text-align:left;">{</p>
<p style="text-align:left;">String[] tokens = tokenize the line;</p>
<p style="text-align:left;">Properties tmp =   (Properties) gasBeerMap.get(tokens[0]);</p>
<p style="text-align:left;">if(tmp == null)</p>
<p style="text-align:left;">{</p>
<p style="text-align:left;">tmp = new Properties();<br />
_gasBeerMap.put(tokens[0],tmp);</p>
<p style="text-align:left;">}</p>
<p style="text-align:left;">tmp.setProperty(tokens[1],tokens[2]);</p>
<p style="text-align:left;">}</p>
<p style="text-align:left;">
<p style="text-align:left;">This will check if the map for a specific entry is null. If it is, then it will insert a new map to that specific entry as it&#8217;s mapped value. As it can be observed, for the next iterations, the map will only get updated. This is one approach to the problem. Let me know if you have some cool approaches to this problem</p>
<p style="text-align:left;">
<p style="text-align:left;">
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=24&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/30/creating-a-hashmap-of-hashmaps-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>

		<media:content url="http://vinaychilakamarri.files.wordpress.com/2008/07/beergas.jpg?w=300" medium="image" />
	</item>
		<item>
		<title>Exporting your Java project to a jar file in two clicks using Fat-jar plugin</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/29/exporting-your-java-project-to-a-jar-file-in-two-clicks-using-fat-jar-plugin/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/29/exporting-your-java-project-to-a-jar-file-in-two-clicks-using-fat-jar-plugin/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 06:30:38 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[eclipse plugin]]></category>
		<category><![CDATA[executable jar file building]]></category>
		<category><![CDATA[fat-jar]]></category>
		<category><![CDATA[jar]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=28</guid>
		<description><![CDATA[Sick and tired of writing manifest files and arranging jar files and class files, I searched to see if I can find some click-click-click eclipse feature that will do this job for me. And the answer came in after a brief googling: The fat-jar plugin. Installing this plugin&#8217;s zip is easy. Extract the zip to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=28&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sick and tired of writing manifest files and arranging jar files and class files, I searched to see if I can find some click-click-click eclipse feature that will do this job for me. And the answer came in after a brief googling: The fat-jar plugin.  Installing this plugin&#8217;s zip is easy. Extract the <a href="http://sourceforge.net/projects/fjep" target="_blank">zip</a> to some place and copy the folder under &#8216;plugins&#8217; to the actual eclipse plugins directory. Restart the eclipse and you should see a &#8216;Build Fat jar&#8217; with a green cross when you right click on your project. Here is the tutorial on how to build the jar file after you are done with the plaugin installation:</p>
<p><a title="Fat-jar tutorial" href="http://fjep.sourceforge.net/fjeptutorial.html" target="_blank">http://fjep.sourceforge.net/fjeptutorial.html</a></p>
<p>Happy jar building!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=28&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/29/exporting-your-java-project-to-a-jar-file-in-two-clicks-using-fat-jar-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Subtle things in perl part 2: The difference between &#8216;or&#8217; and &#124;&#124;</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/27/subtle-things-in-perl-part-2-the-difference-between-or-and/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/27/subtle-things-in-perl-part-2-the-difference-between-or-and/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 18:54:49 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=19</guid>
		<description><![CDATA[In perl, both &#8216;or&#8217; and &#124;&#124; mean the same thing. But they act in different ways when used in certain circumstances. For example, lets say we are trying to open a file for read and write operations. It&#8217;s always a good idea to handle the IO errors and we do this in the following way: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=19&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In perl, both &#8216;or&#8217; and || mean the same thing. But they act in different ways when used in certain circumstances. For example, lets say we are trying to open a file for read and write operations. It&#8217;s always a good idea to handle the IO errors and we do this in the following way:</p>
<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br />
$file = shift;<br />
open FILE, $file or die &#8220;Couldn&#8217;t open the file $file&#8221;; #note this<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>The second step can also be written in this way:<br />
open FILE, $file || die &#8220;Couldn&#8217;t open the file $file&#8221;; #note this</p>
<p>But when the execution of this program happens, you will never see the message in &#8216;die&#8217;, if you use a || instead of &#8216;or&#8217;. <span style="text-decoration:line-through;">Reason for this is that the || operator has a precedence level higher than that of &#8216;or&#8217; and since<br />
the &#8216;open FILE, $file&#8217; returns a value after an attempt to execute, the || is always true and die is never reached</span>.</p>
<p>The actual reason as Martin, one of the commentators  puts it,</p>
<blockquote><p>The actual reason is that the operator precedence for the double pipe is higher than the comma, so perl is resolving the double pipe first, which chooses the first true result of its two parameters, in this case $file and the die statement. As long as $file is a nonempty string it counts as true and always gets returned by the double pipe.</p></blockquote>
<p>So it is always advisable to use &#8216;or&#8217; instead of ||. If you want to use &#8216;||&#8217;, you can do it by using the<br />
pen file with parathesis which ensures the precedence of the operators.</p>
<p>open (FILE, $file) || die &#8220;Couldn&#8217;t open the file $file&#8221;;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=19&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/27/subtle-things-in-perl-part-2-the-difference-between-or-and/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Playing with shift , @_ , $_</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/22/playing-with-shift-_-_/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/22/playing-with-shift-_-_/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 04:26:17 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=14</guid>
		<description><![CDATA[The &#8216;Shift&#8217; function pops the first element of an array and returns the popped item to the left side variable. There is a way to write cryptic code with &#8220;shift&#8221;, to impress your family (yep.. only family, sorry). Perl has some internal default variables that get initialized when in some sub routine. Lets say you&#8217;re [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=14&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The &#8216;Shift&#8217; function pops the first element of an array and returns the popped item to the left side variable. There is a way to write cryptic code with &#8220;shift&#8221;, to impress your family (yep.. only family, sorry).  Perl has some internal default variables that get initialized when in some sub routine. Lets say you&#8217;re passing an array of elements to some sub routine. You don&#8217;t need an explicit variable like in some languages to store that passed variable. You can directly use the implicit variables for getting the passed parameters. Let&#8217;s write a subroutine using some implicit variables and &#8220;shift&#8221;:</p>
<p>sub printFileContent {</p>
<p>foreach(@_){</p>
<p>printInsideThings ($_);<br />
}<br />
}</p>
<p>sub printInsideThings {<br />
open FILE,$_;<br />
while($line = &lt;FILE&gt;){<br />
print $line;<br />
}<br />
}</p>
<p>printFileContent (&#8220;C:\\Data\\virtual-hosting-howto.html&#8221;,&#8221;C:\\Data\\virtual-boasting-howto.html&#8221;);</p>
<p>As I pass a list of files,  the &#8216;@_&#8217; of my first sub is already initialized with the list of strings that I passed.<br />
So I used &#8216;foreach&#8217; and passed the &#8220;$_&#8221; to another subroutine. The &#8216;$_&#8217; will be initialized to the list item for<br />
each iteration over the list. The other sub takes the string, and using a &#8216;$_&#8217;, which is initialized with the passed value by default, it opens the file and initializes a global variable &#8216;FILE&#8217; and prints the content line by line in the while loop. The &#8216;&lt; &gt;&#8217; opens the file and reads it line by line for you (uber cool tool eh?). Other ways we can do the later subroutine:</p>
<p>sub printInsideThings {<br />
open FILE,shift;<br />
while(&lt;FILE&gt;){<br />
print ;<br />
}<br />
}</p>
<p>Look at the while loop there. Perl uses the &#8216;$_&#8217; so implicitly that you don&#8217;t even have to specify it. That loop initializes the &#8216;$_&#8217; for every iteration and assigns it the line it reads from the file. The &#8220;print;&#8221; is equivalent to &#8220;print $_;&#8221; Again, the &#8216;shift&#8217; in that file opener takes out the first of the &#8216;@_&#8217; and passes it for parsing stuff</p>
<p>This one prints the contents of a single file that is passed:</p>
<p>sub openFu{<br />
open FILE, shift;<br />
while(&lt;FILE&gt;){<br />
print;<br />
}<br />
}</p>
<p>openFu &#8220;c:\\data\\virtual-hosting-howto.html&#8221;;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=14&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/22/playing-with-shift-_-_/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Subtle things in perl</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/13/subtle-things-in-perl/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/13/subtle-things-in-perl/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 01:59:51 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=12</guid>
		<description><![CDATA[There are some untold things in Perl, that really caught my attention. Firstly, we can assign an array to a scalar variable. Doing so will initialize that scalar to the size of that array. There is also an explicit function for this. Here is what I am talking about: @arr = qw(i can be a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=12&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are some untold things in Perl, that really caught my attention. Firstly, we can assign an array to a scalar variable. Doing so will initialize that scalar to the size of that array. There is also an explicit function for this. Here is what I am talking about:</p>
<p>@arr = qw(i can be a bad guy);</p>
<p>$var = @arr;</p>
<p>print &#8220;$var&#8221;;</p>
<p>This will print 6.  In the same way we can also use an inbuilt function for this. The function is called &#8216;scalar&#8217;</p>
<p>$var = scalar(@arr); assigns the size of the array. In the same way we can also initialize a variable to a list. But the variable will get initialized to the last variable of that list. For example:</p>
<p>$var = (1,2,3,4); will initialize $var to 4.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=12&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/13/subtle-things-in-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
		<item>
		<title>Pyramid in perl</title>
		<link>http://vinaychilakamarri.wordpress.com/2008/07/06/pyramid-in-perl/</link>
		<comments>http://vinaychilakamarri.wordpress.com/2008/07/06/pyramid-in-perl/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 08:02:17 +0000</pubDate>
		<dc:creator>vinaychilakamarri</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://vinaychilakamarri.wordpress.com/?p=9</guid>
		<description><![CDATA[Lets say you want to print something like this: &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;A &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;ABA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;ABCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;ABCDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;ABCDEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;ABCDEFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ABCDEFGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;ABCDEFGHGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;ABCDEFGHIHGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;ABCDEFGHIJIHGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;ABCDEFGHIJKJIHGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;ABCDEFGHIJKLKJIHGFEDCBA &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;ABCDEFGHIJKLMLKJIHGFEDCBA &#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=9&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lets say you want to print something like this:<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;ABCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ABCDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;ABCDEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ABCDEFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ABCDEFGHIJKLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;ABCDEFGHIJKLMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ABCDEFGHIJKLMNMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ABCDEFGHIJKLMNONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;&nbsp;ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;&nbsp;ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA<br />
&nbsp; &nbsp;ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA</p>
<p>Here is the code I wrote:</p>
<p># !/usr/bin/perl<br />
@array = (&#8216;A&#8217; .. &#8216;Z&#8217;);<br />
$in = &lt;&gt;;<br />
chomp($in);<br />
if($in &lt; 0)<br />
{<br />
print &#8220;Can&#8217;t proceed&#8221;;<br />
}<br />
else{<br />
for($i = 0 ; $i &lt; $in ; $i++)<br />
{<br />
@tmp = (&#8221;);<br />
for($k = scalar(@array); $k &gt; $i; $k&#8211;)<br />
{<br />
print &#8221; &#8220;;<br />
}<br />
for($j = 0 ; $j &lt; $i; $j++)<br />
{<br />
push(@tmp,@array[$j]);<br />
print &#8220;@array[$j]&#8220;;<br />
}<br />
pop(@tmp);<br />
@revtmp = reverse(@tmp);<br />
foreach(@revtmp)<br />
{ print &#8220;$_&#8221; ;}<br />
print &#8220;\n&#8221;;<br />
}<br />
}</p>
<p>This is a rough attempt at the problem. It can be:<br />
1. Checked for input validity</p>
<p>2. Enhanced with what ever you want to ice on top of it.</p>
<p>Have fun!<code></code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vinaychilakamarri.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vinaychilakamarri.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vinaychilakamarri.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vinaychilakamarri.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vinaychilakamarri.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vinaychilakamarri.wordpress.com&amp;blog=4110777&amp;post=9&amp;subd=vinaychilakamarri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vinaychilakamarri.wordpress.com/2008/07/06/pyramid-in-perl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/596abbde69de87d4fe6a473ed199e07a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vinaychilakamarri</media:title>
		</media:content>
	</item>
	</channel>
</rss>
