<?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>SANDBOX.......</title>
	<atom:link href="http://veechand.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://veechand.wordpress.com</link>
	<description>Mirrored Blog</description>
	<lastBuildDate>Mon, 21 Nov 2011 17:10:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='veechand.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>SANDBOX.......</title>
		<link>http://veechand.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://veechand.wordpress.com/osd.xml" title="SANDBOX......." />
	<atom:link rel='hub' href='http://veechand.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Static block initialization</title>
		<link>http://veechand.wordpress.com/2011/06/26/static-block-initialization/</link>
		<comments>http://veechand.wordpress.com/2011/06/26/static-block-initialization/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 10:49:50 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=725</guid>
		<description><![CDATA[java static block initialization<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=725&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently, my friend <a href="https://www.facebook.com/profile.php?id=1150126972&amp;sk=wall" target="_blank">Chandru</a> came up with a new problem in java.</p>
<p>Try solving the below problem without java.exe <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><pre class="brush: java;">
public class StaticUnderstanding {
	public static void main(String[] args) {
		SubClass.dummyMethod();
	}
}
class SuperClass {
	static {
		System.out.println(&quot;In superclass...&quot;);
	}
	protected static void dummyMethod(){
		System.out.println(&quot;In dummy method...&quot;);
	}
}
class SubClass extends SuperClass {
	static {
		System.out.println(&quot;In subclass...&quot;);
	}
}
</pre></p>
<p>If you come with any answer other than the below, then you need to read <a href="http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44557" target="_blank"> JLS 12.4 &#8211; Initialization of Classes and Interfaces.</a></p>
<p>In superclass&#8230;</p>
<p>In dummy method&#8230;</p>
<p>Thanks to <a href="http://twitter.com/intent/user?screen_name=saivignesh87" target="_blank">Sai</a> for getting this awesome data !!</p>
<p class="getsocial" style="text-align:left;"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2011/06/26/725" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4014.png?w=468" alt="Add to Facebook" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;title=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4024.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;title=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4034.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;title=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4044.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;title=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4054.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;Title=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4064.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Static%20block%20initialization+%40+http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4074.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http://veechand.wordpress.com/2011/06/26/725" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4084.png?w=468" alt="Add to Technorati" /></a><a title="Add to Yahoo Buzz" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;headline=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4094.png?w=468" alt="Add to Yahoo Buzz" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2011%2F06%2F26%2F725&amp;h=Static%20block%20initialization" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4104.png?w=468" alt="Add to Newsvine" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/725/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=725&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2011/06/26/static-block-initialization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4014.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4024.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4034.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4044.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4054.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4064.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4074.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4084.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4094.png" medium="image">
			<media:title type="html">Add to Yahoo Buzz</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4104.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>
	</item>
		<item>
		<title>Bit support in Java (32 or 64 bit)</title>
		<link>http://veechand.wordpress.com/2010/10/25/bit-support-in-java-32-or-64-bit/</link>
		<comments>http://veechand.wordpress.com/2010/10/25/bit-support-in-java-32-or-64-bit/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 16:52:09 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=698</guid>
		<description><![CDATA[I came across a task to find out the bit support level in the installed java. This has to be done from the command line and the solution has to be unique across Solaris and Linux. I presumed it to be an easy problem, however it is not so. Below describes the different solution that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=698&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I came across a task to find out the bit support level in the installed java. This has to be done from the command line and the solution has to be unique across Solaris and Linux. I presumed it to be an easy problem, however it is not so. Below describes the different solution that I tried and the problems I faced in those<br />
<span id="more-698"></span></p>
<ol>
<li><strong>Java –version</strong></li>
<p>The very first solution that came to my mind is to parse the output of <em><strong>java –version</strong></em> assuming the output to have some details about the bit support level. Happily the below output from Linux 64 bit server supports my assumption</p>
<blockquote><p><em><br />
java version &#8220;1.6.0_20&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)<br />
Java HotSpot(TM) <strong>64-Bit Server VM </strong>(build 16.3-b01, mixed mode)<br />
</em></p></blockquote>
<p>Sadly, similar output, stating the bit support level, is not shown in Solaris 64 bit SPARC server.</p>
<blockquote><p><em><br />
java version &#8220;1.6.0_22&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)<br />
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing) </em></p></blockquote>
<p><em> </em></p>
<li><strong><em>file</em> command</strong></li>
<p>Those worked in nix* systems should be familiar of the <em><a href="http://swoolley.org/man.cgi/file" target="_blank">file </a></em>command. For others, <em>file </em>command determines the type of the file. Again, in Linux the output shows that java.exe is 64 bit compiled however in Solaris it is not so. Output from both the OS are as below</p>
<blockquote><p><em><br />
<strong>Linux:</strong> java: ELF 64-bit LSB executable, [snipped]<br />
<strong>Solaris:</strong> java:     ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped, no debugging information available </em></p></blockquote>
<p><em> </em></p>
<p>The disparity of output between the OSes is because 64 bit version of java in Solaris SPARC is actually a patch over corresponding 32 bit version.  Not sure of this special treatment for Solaris SPARC. Let me know if you have idea on this.</p>
<p><strong>Caveat:</strong> All the<a href="http://java.sun.com/j2se/1.5.0/install-solaris-64.html" target="_blank"> java installation</a> notes mentions installation of 64 bit java in a 64 bit Solaris SPARC server is two step process. The first step is to install 32 bit java and then install “supplemental files” for 64-bit support. However the download page doesn’t indicate any file as supplemental files.  See below,</p>
<p><em> </em></p>
<p>&nbsp;</p>
<div id="attachment_703" class="wp-caption aligncenter" style="width: 310px"><em><em><a href="http://veechand.files.wordpress.com/2010/10/download.jpg"><img class="size-medium wp-image-703" title="File names and description on download" src="http://veechand.files.wordpress.com/2010/10/download.jpg?w=300&#038;h=150" alt="" width="300" height="150" /></a></em></em><p class="wp-caption-text">File names and description on download</p></div>
<p>Both the file has the same name and description too. Even the installation doesn’t give any indication to the user. This is the starting point for most of the confusion. Will Oracle fix this?</p>
<li><strong>64 bit OS is not default</strong></li>
<p>This is something interesting. Java provides a property “sun.arch.data.model” that provides the bit support of the JVM.  Executing a simple code that prints the output of the above property reveals that Solaris SPARC servers doesn’t take 64 bit by default. If 64 bit support is needed then it should be indicated with the option –d[support_level]</ol>
<p>Point 3 reveals a new way to find out the bit support level in java for both Solaris and Linux OSes. Proper completion of the command <em><strong>java –d64 –version </strong></em>shows that 64 bit java is installed in the server. If there is some error then probable causes could be no java is installed or installed java supports only 32 bit.  By executing <strong><em>java –version</em></strong> we could find the exact cause.<br />
Snippet<br />
<em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><pre class="brush: bash;">
 Java -d64 -version 2&gt;/dev/null
 if [ $? -eq 0 ]
then 
	echo “64 bit”
else
	echo “32 bit”
</pre></p>
<p>Let me know if you have some efficient way than this</p>
<p style="text-align:left;" class="getsocial"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2010/10/25/" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4012.png?w=468" alt="Add to Facebook" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;title=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4022.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;title=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4032.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;title=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4042.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;title=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4052.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;Title=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4062.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Bit%20support%20in%20Java%20(32%20or%2064%20bit)+%40+http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4072.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http://veechand.wordpress.com/2010/10/25/" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4082.png?w=468" alt="Add to Technorati" /></a><a title="Add to Yahoo Buzz" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;headline=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4092.png?w=468" alt="Add to Yahoo Buzz" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F10%2F25%2F&amp;h=Bit%20support%20in%20Java%20(32%20or%2064%20bit)" rel="nofollow" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/08/gs4102.png?w=468" alt="Add to Newsvine" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/698/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/698/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/698/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=698&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2010/10/25/bit-support-in-java-32-or-64-bit/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2010/10/download.jpg?w=300" medium="image">
			<media:title type="html">File names and description on download</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4012.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4022.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4032.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4042.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4052.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4062.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4072.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4082.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4092.png" medium="image">
			<media:title type="html">Add to Yahoo Buzz</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/08/gs4102.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>
	</item>
		<item>
		<title>Is Scala implicit conversions prevents auto boxing?</title>
		<link>http://veechand.wordpress.com/2010/04/30/is-scala-implicit-conversions-prevents-auto-boxing/</link>
		<comments>http://veechand.wordpress.com/2010/04/30/is-scala-implicit-conversions-prevents-auto-boxing/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 14:20:07 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=681</guid>
		<description><![CDATA[People following me on twitter know that I am in the phase of learning Scala for the past few days. As a java programmer I am comfortable with most of the aspects of Scala (though more to explore in coming days). Recently I came across a problem that gave me an impression that Scala fails [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=681&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>People following me on <a href="http://twitter.com/veechand">twitter</a> know that I am in the phase of learning Scala for the past few days. As a java programmer I am comfortable with most of the aspects of Scala (though more to explore in coming days). Recently I came across a problem that gave me an impression that Scala fails in doing auto boxing. <span id="more-681"></span> Let us take the below example for our further discussions,</p>
<p><pre class="brush: scala;">
object AutoBoxing extends Application
{
   val intVariable = 2;
    System.out.printf(&quot;%d&quot;,2); //this line fails during implicit conversion
}
</pre></p>
<p>The above code suffers during implicit conversion from Int to Object with an error</p>
<blockquote><p><em><br />
AutoBoxing.scala:4: error: type mismatch;<br />
found   : Int<br />
required: java.lang.Object<br />
Note that implicit conversions are not applicable because they are ambiguous:<br />
both method int2Integer in object Predef of type (Int)java.lang.Integer<br />
and method intWrapper in object Predef of type (Int)scala.runtime.RichInt<br />
are possible conversion functions from Int to java.lang.Object<br />
System.out.printf(&#8220;%d&#8221;,intVariable);<br />
^<br />
one error found<br />
</em></p></blockquote>
<p>On skimming through the <a href="http://www.scala-lang.org/docu/files/api/index.html" target="_blank">API documentation of Scala </a>, I came to know of the following object hierarchy</p>
<ul>
<li>Int subclass of AnyVal</li>
<li>AnyVal subclass of Any</li>
<li>AnyRef subclass of Any</li>
<li>Object subclass of AnyRef</li>
</ul>
<p>As a java programmer we all are aware that System.out.printf accepts object as its second parameter</p>
<p><pre class="brush: java;">
  public PrintStream printf(String format, Object ... args) {
  }
</pre></p>
<p>By now you should have sensed the issue, yes Scala fails when it tries to convert Int to Object (which is of type AnyRef, not in the hierarchy). However the error is not explicit to reason that out. There are few ways to resolve the issue</p>
<ul>
<li> <strong>Solution 1 : Using console.printf(…) </strong><br />
<pre class="brush: scala;">
          Console.printf(&quot;%d&quot;,2);
     </pre></li>
<li> <strong>Solution 2 : Converting explicitly to java.lang.Integer using asInstanceOf </strong><br />
<pre class="brush: scala;">
          System.out.printf(&quot;%d&quot;,
                             intVariable.asInstanceOf[java.lang.Integer]);
          System.out.printf(&quot;%d&quot;,intVariable : java.lang.Integer);
     </pre></li>
<li> <strong>Solution 3 : Converting to java.lang.Integer using int2Integer </strong><br />
<pre class="brush: scala;">
         System.out.printf(&quot;%d&quot;,int2Integer(intVariable));
     </pre></li>
</ul>
<p>Do you know more way to do this? Eager to learn from you, let me know it !!</p>
<p>Similar problem could occur for any other type of <em>AnyVal</em>. Being said all these; I could find certain enhancement request on Scala with regard to this <a href="http://lampsvn.epfl.ch/trac/scala/ticket/496" target="_blank">http://lampsvn.epfl.ch/trac/scala/ticket/496</a>.</p>
<p>Disclaimer: I am a beginner in Scala, pardon my ignorance <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p class="getsocial" style="text-align:left;"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2010/04/30/" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4012.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;h=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4022.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;title=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4032.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;title=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4042.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;title=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4052.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;title=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4062.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;Title=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4072.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F+%40+http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4082.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4092.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F04%2F30%2F&amp;t=Is%20Scala%20implicit%20conversions%20prevents%20auto%20boxing%3F" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4102.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/681/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=681&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2010/04/30/is-scala-implicit-conversions-prevents-auto-boxing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4012.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4022.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4032.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4042.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4052.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4062.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4072.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4082.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4092.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4102.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>Subnet address from slash notation to dot notation</title>
		<link>http://veechand.wordpress.com/2010/03/14/subnet-address-from-slash-notation-to-dot-notation/</link>
		<comments>http://veechand.wordpress.com/2010/03/14/subnet-address-from-slash-notation-to-dot-notation/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 11:28:33 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=674</guid>
		<description><![CDATA[Few weeks back I attempted to write a program that converts subnet address in slash notation to dot notation. Though answers using if/switch statements came to my mind, I am not pretty convinced with those. I like to follow the KISS principle here. After struggling for some time with the help of my friend Sree [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=674&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few weeks back I attempted to write a program that converts subnet address in slash notation to dot notation. Though answers using if/switch statements came to my mind, I am not pretty convinced with those. I like to follow the <a href="http://www.embedded.com/columns/programmerstoolbox/218102136">KISS </a>principle here.<span id="more-674"></span> After struggling for some time with the help of my friend Sree came with the below piece of code</p>
<p><pre class="brush: java;">

public void setSubnetMask(int slashNotation) {
try {
   byte[] ipaddress = new byte[4];
   for (int i = 0; i &lt; ipaddress.length; i++, slashNotation -= 8){
      ipaddress[i] = (byte) ((255 &lt;&lt; (8 - (slashNotation &lt; 9 ? slashNotation: 8))) &amp; 255);
   }
   InetAddress address = InetAddress.getByAddress(ipaddress);
   this.subnetMask = address.getHostAddress();
  } catch (UnknownHostException e) {
      e.printStackTrace();
      this.subnetMask = &quot;&quot;;
  }
}
</pre></p>
<p>Hope you find this useful. Let us know if you have a simpler approach.</p>
<p><strong>Question for readers :-</strong> How will you approach the problem to achieve the vice versa functionality, i.e. converting the subnet address from dot notation (255.255.255.0) to slash notation (/24)</p>
<p style="text-align:left;" class="getsocial"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2010/03/14/subnet-address-from-slash-notation-to-dot-notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4011.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;h=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4021.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;title=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4031.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;title=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4041.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;title=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4051.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;title=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4061.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;Title=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4071.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Subnet%20address%20from%20slash%20notation%20to%20dot%20n...+%40+http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4081.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4091.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2010%2F03%2F14%2Fsubnet-address-from-slash-notation-to-dot-notation&amp;t=Subnet%20address%20from%20slash%20notation%20to%20dot%20notation" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4101.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/674/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=674&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2010/03/14/subnet-address-from-slash-notation-to-dot-notation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4011.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4021.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4031.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4041.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4051.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4061.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4071.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4081.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4091.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4101.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>GNS3/Dynamips network simulator</title>
		<link>http://veechand.wordpress.com/2010/02/13/gns3dynamips-network-simulator/</link>
		<comments>http://veechand.wordpress.com/2010/02/13/gns3dynamips-network-simulator/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 17:35:04 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=670</guid>
		<description><![CDATA[GNS3 dynamips<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=670&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are looking for any of below mentioned “How to” then the following five minutes screen cast will help you out</p>
<ol>
<li>How to start with Dynamips/GNS3</li>
<li>How to emulate a switch using Dynamips/GNS3</li>
<li>How to save configuration in Dynamips/GNS3</li>
</ol>
<span style="text-align:center; display: block;"><a href="http://veechand.wordpress.com/2010/02/13/gns3dynamips-network-simulator/"><img src="http://img.youtube.com/vi/t_d8yu7POVE/2.jpg" alt="" /></a></span>
<p>Almost a month after updated my blog with a short screencast. Hope many more articles will flow in soon. Let us know your further questions on Dynamips/GNS3 through comments.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/670/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/670/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/670/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=670&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2010/02/13/gns3dynamips-network-simulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>
	</item>
		<item>
		<title>Is a number Power of Two</title>
		<link>http://veechand.wordpress.com/2009/12/19/is-a-number-power-of-two/</link>
		<comments>http://veechand.wordpress.com/2009/12/19/is-a-number-power-of-two/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 15:59:55 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=657</guid>
		<description><![CDATA[finding is a number is power of 2 <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=657&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week, I was reading through an article written by <a href="http://www.artima.com/wbc/interprog.html">Bill Venners</a> (don’t read this now). Though the purpose of the article is to highlight some of the key interviewing techniques, I was excited by <strong>Josh Bloch</strong> question, “Finding is a number power of 2”.<span id="more-657"></span></p>
<p>After finding few answers other than the one mentioned in the above article, I put the same question to some of my colleagues/friends. Most of them (99% of people, including me) immediately came up with the following answer “recursive (Number/2)==0, then power of 2” or continuous multiplication with 2 gives that number, as shown below</p>
<p><pre class="brush: java;">
int number = 8;
int tempNumber = 1;
while(tempNumber&lt;number){
    tempNumber*=2;
}
if(tempNumber==number){
   System.out.println(&quot;Power of&quot;);
else{
   System.out.println(&quot;Not a power of&quot;);
}
</pre></p>
<p>Yes, the above solve the problem in hand, but is this an efficient one? Will this work for large numbers or gives overflow issues? For sure I can’t see this solution as an efficient one. So I contacted my genius friend Sree. Not to the surprise, he came up with a more efficient solution. I and 99% of my friends have seen the problem in decimal but Sree has seen it in bits. Without further ado let us see the (one line) code</p>
<p><pre class="brush: java;">
 System.out.println(((number&amp;(number-1))==0)?&quot;Power of&quot;:&quot;Not a power of&quot;);
</pre></p>
<p>Hope you too accept it to be more efficient than mine  One other solution proposed by Josh Bloch in the article <a href="http://www.artima.com/wbc/interprog.html">http://www.artima.com/wbc/interprog.html</a> (now read it) is</p>
<p><pre class="brush: java;">
System.out.println(((number&amp;(-number))==number)?&quot;Power of&quot;:&quot;Not a power of&quot;);
</pre></p>
<p>Which answer you came up with? Hey did you come up with some new one? Let us know the same.</p>
<p class="getsocial" style="text-align:left;"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2009/12/19/is-a-number-power-of-two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4013.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;h=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4023.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;title=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4033.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;title=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4043.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;title=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4053.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;title=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4063.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;Title=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4073.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Is%20a%20number%20Power%20of%20Two+%40+http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4083.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4093.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F12%2F19%2Fis-a-number-power-of-two&amp;t=Is%20a%20number%20Power%20of%20Two" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4103.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/657/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/657/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/657/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=657&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2009/12/19/is-a-number-power-of-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4013.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4023.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4033.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4043.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4053.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4063.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4073.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4083.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4093.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4103.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>My experiences with AWS Chennai workshop</title>
		<link>http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/</link>
		<comments>http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 02:42:59 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[aws awschennai]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=598</guid>
		<description><![CDATA[AWS EC2 S3<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=598&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today (10-Nov-2009) I have experienced many new things in my life. First to mention, being an inhabitant of Chennai only after five years of industry experience, today is my first day to visit <a href="http://www.tidelpark.com/">Tidel Park, Chennai</a>.  Also today I have my first time exposure to <a href="http://aws.amazon.com/">Amazon Web Services (AWS)</a>. It is a good <a href="http://awschennai.in/">workshop</a> that opened my eyes towards many new technical jargons. In this blog, I am trying to capture most of the items that are discussed today. Most of the things captured here are from my notes (or from top of my head), so they are going to be keywords rather than detailed explanations.<span id="more-598"></span></p>
<p>Amazon evangelist <a href="http://www.linkedin.com/in/jinman">Jinesh Varia</a>, after taking us through an introduction to Cloud Computing and its advantages talked about various cloud offerings from Amazon . In his words, Cloud Computing is one in which everything from storage, computing to network are accessed through APIs. APIs are exposed in REST, Query or SOAP/XML based.  For java developers, he has shown bunch of tools (sorry I couldn’t make note of everything) that comes handy, few to mention are <a href="http://code.google.com/p/typica/">typica</a>, <a href="http://aws.amazon.com/eclipse/">Eclipse Plug-in</a>. I am able to grab one of his slides from <a href="http://tinyurl.com/y86p624" target="_blank">slideshare</a>. Jinesh also spent good time in explaining about the key offerings from AWS like</p>
<ul>
<li><a href="http://aws.amazon.com/s3/">S3 &#8211; Distributed redundant storage</a></li>
<li><a href="http://aws.amazon.com/ebs/">EBS &#8211; Elastic Block storage</a></li>
<li><a href="http://aws.amazon.com/simpledb/">Amazon simple DB</a> &#8211; Light weight database, indexed and query able database. However it is not a relational database.</li>
<li><a href="http://aws.amazon.com/rds/">Amazon Relation Data Service</a> – It is a MySQL relation database service</li>
<li><a href="http://aws.amazon.com/sqs/">Amazon SQS</a> – I don’t have a proper definition of it, but from my understanding it is a Q that passes messages between applications/computers. It should be analogous to JMS queue</li>
<li><a href="http://aws.amazon.com/ec2/">EC2</a> – Virtual computation servers. It is where we create the instance that we need for processing. I see this as the heart of AWS.</li>
<li><a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346">Elastic IP Address</a> – Static IP Addresses for virtual instances in clouds. <a href="http://www.8kmiles.com/">8kMiles</a> CTO, one of the participants mentioned this as “<em>Pay when you don&#8217;t use</em>” <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="https://www.mturk.com/mturk/welcome">Amazon Mechanical turk</a> – It is work force in the cloud. I need to research, what is needed to join this work force <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>Jinesh also mentioned about EBS snapshot and EBS load balancing. To understand most of these items I try to find an analogy out of the things I know. So, I think EBS snapshot should be like a virtual machine snapshot but former is all about data in S3.</p>
<p>We had a good time playing in clouds. Thanks to Amazon, for giving us a temporary account to play with clouds. After installing <a href="https://addons.mozilla.org/en-US/firefox/addon/3247">S3Fox</a> a Firefox plug-in, working with S3 is almost like working in windows explorer as shown in Figure 1</p>
<div id="attachment_600" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-600" href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/pic1/"><img class="size-medium wp-image-600 " title="S3 Fox" src="http://veechand.files.wordpress.com/2009/11/pic1.jpg?w=300&#038;h=138" alt="S3 Fox" width="300" height="138" /></a><p class="wp-caption-text">Figure 1 - View of S3Fox</p></div>
<p>You can create buckets by right clicking on the cloud area (right upper part of the window). A bucket (directory) is a container that contains objects (files). Clicking on create directory shows a new window for entering bucket name and its location details as shown in Figure 2</p>
<div id="attachment_602" class="wp-caption aligncenter" style="width: 261px"><a rel="attachment wp-att-602" href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/pic3/"><img class="size-full wp-image-602   " title="Creating Bucket" src="http://veechand.files.wordpress.com/2009/11/pic3.jpg?w=251&#038;h=201" alt="Creating Bucket" width="251" height="201" /></a><p class="wp-caption-text">Figure 2 - Creating Bucket</p></div>
<div style="width:425px;text-align:left;">As the buckets are created you can go into any of those buckets and upload files from local folder to those buckets thereby to S3 clouds. It is also possible to change access permission of the files in the cloud as you do for files in windows</p>
<div id="attachment_610" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-610" href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/pic4-2/"><img class="size-full wp-image-610   " title="Editing ACL" src="http://veechand.files.wordpress.com/2009/11/pic41.jpg?w=468&#038;h=176" alt="Editing ACL" width="468" height="176" /></a><p class="wp-caption-text">FIgure 3 - Editing ACL</p></div>
<p>Once a file is available in the cloud you will be able to access globally using normal http or through the exposed APIs, provided you have permission.</p>
<p>Now it’s time to play with EC2. We have installed <a href="http://s3.amazonaws.com/ec2-downloads/elasticfox.xpi">Elastic Fox</a>, yet another Firefox plug-in to play with EC2. Using Elastic Fox anyone could create an instance of Windows/Ubuntu/LAMP/WordPress (anything you name) instances in no time. In Amazon jargon these are called as <a href="http://en.wikipedia.org/wiki/Amazon_Machine_Image">AMI, Amazon Machine Image</a>.</p>
<div id="attachment_615" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-615" href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/pic5/"><img class="size-medium wp-image-615" title="ElasticFox listing AMI" src="http://veechand.files.wordpress.com/2009/11/pic5.jpg?w=300&#038;h=138" alt="ElasticFox listing AMI" width="300" height="138" /></a><p class="wp-caption-text">Figure 4 - ElasticFox listing AMI</p></div>
</div>
<div style="width:425px;text-align:left;">I created one Windows 2003 R2 Datacenter edition server and I am able to successfully RDP to it. I am on Cloud9 when I am working on EC2 cloud for the first time <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I am able to successfully run windows update in the virtual server running on the cloud. Even from my home network (128Mbps) I am having a good user experience (no delays or hiccups) with EC2 clouds. I searched for a Windows 7 AMI but I am not able to get one <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . When you create an instance you will be able to assign access groups and also configure services that need to be started.   Here is a short video on how to create EC2 instances using ElasticFox</div>
<div style="width:425px;text-align:left;"><span style="text-align:center; display: block;"><a href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/"><img src="http://img.youtube.com/vi/D4wtAFvQFp8/2.jpg" alt="" /></a></span></div>
<div style="width:425px;text-align:left;">After seeing all this, I swear in future (not too far) there won’t be any system administrators, everyone will be cloud administrators. In no time I thought this, Jinesh told us about <a href="http://www.slideshare.net/jesserobbins/using-chef-for-automated-infrastructure-in-the-cloud">Chef tool</a> which is mainly designed for system administrators.</div>
<div style="width:425px;text-align:left;">
<p>Here are some of sites that use AWS</p>
<ul>
<li><a href="http://www.vembu.com/">www.vembu.com</a> – It offers free online backup at <a href="http://home.vembu.com/">home.vembu.com</a></li>
<li><a href="http://www.hungama.com/">Hungama.com</a> – One stop shop for entertainment</li>
<li><a href="http://animoto.com/">animoto.com</a> – Give a bunch of photo and a music file, they will create video for you. They say it is “End of Slide shows”</li>
</ul>
</div>
<div style="width:425px;text-align:left;">
<p>and many more like <a href="http://www.salesforce.com/">Salesforce.com</a>, <a href="http://8kmiles.com/">8kmiles.com</a>. Some other resources worth mentioning here are <a href="http://www.eucalyptus.com/">Eucalyptus</a> (analogous to EC2), Walrun (analogous to S3) and <a href="http://hadoop.apache.org/">Apache Hadoop</a></p>
<p>Before ending the workshop Jinesh has taken us through the “Migration Guidelines” and “Best Practices” that we need to follow when we work on cloud. Very few items, from the top of my head</p>
<ol>
<li>First migrate all your static contents to the cloud</li>
<li>If you backup on tape drives then you can export it to Amazon S3 storage. Amazon provides an export backup offer, where you ship the entire content in hard disk to Amazon and Amazon will load it in to the S3. This is extremely useful for users who are starting with S3 and having large amount of data to be exported to S3 but with limited network bandwidth</li>
<li>Migrate you application modules to EC2 instances, definitely after doing POC</li>
<li>Create Amazon SQS to interface between your EC2 instances</li>
<li>Create proxies to interface with some legacy applications</li>
</ol>
</div>
<p><strong>Warning</strong>: These are really very few that are on top of my head and they might not be 100% perfect too. So I request you to take this as keys and search for more in Google. I also heard that Jinesh is writing white papers on these topics. So keep watch on that too.</p>
<div style="width:425px;text-align:left;">
<p>After the conference we had a short un-conference section from <a href="http://railsfactory.com/">RailsFactory</a>, <a href="http://www.8kmiles.com/">8kmiles</a>, <a href="http://www.csscorp.com/">CSS corp</a>, <a href="http://www.marketsimplified.com/">Market Simplified</a>, <a href="http://www.xlsoft.com/">XlSoft</a>, <a href="http://hover.in/">Hover.in</a>, <a href="http://www.vembu.com/">Vembu</a> and <a href="http://www.anantsol.com/">Anantara</a> representatives. We ended up the section with a nice cool video, which you too should watch (be sure you listen to lyrics, they are shown at the bottom too)</p>
<span style="text-align:center; display: block;"><a href="http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/"><img src="http://img.youtube.com/vi/Miv3Y42Fv44/2.jpg" alt="" /></a></span>
<p>Hope the blog is informative. Without your feedback the blog is not complete, so please comment on your feedback. I will feel guilty if I close this without thanking my friend Sree for making me aware of this event. Thanks Sree!!</p>
</div>
<p style="text-align:left;" class="getsocial"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4012.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;h=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4022.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;title=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4032.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;title=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4042.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;title=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4052.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;title=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4062.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;Title=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4072.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=My%20experiences%20with%20AWS%20Chennai%20workshop+%40+http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4082.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4092.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F11%2Fmy-experiences-with-amazon-web-services-workshop&amp;t=My%20experiences%20with%20AWS%20Chennai%20workshop" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4102.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/598/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/598/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=598&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2009/11/11/my-experiences-with-amazon-web-services-workshop/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/11/pic1.jpg?w=300" medium="image">
			<media:title type="html">S3 Fox</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/11/pic3.jpg" medium="image">
			<media:title type="html">Creating Bucket</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/11/pic41.jpg" medium="image">
			<media:title type="html">Editing ACL</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/11/pic5.jpg?w=300" medium="image">
			<media:title type="html">ElasticFox listing AMI</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4012.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4022.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4032.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4042.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4052.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4062.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4072.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4082.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4092.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4102.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>Playing with REST annotations</title>
		<link>http://veechand.wordpress.com/2009/11/09/playing-with-rest-annotations/</link>
		<comments>http://veechand.wordpress.com/2009/11/09/playing-with-rest-annotations/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 19:20:42 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[rest jersey]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=541</guid>
		<description><![CDATA[how to get user inputs in REST<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=541&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/">last article </a>in addition to setting up our IDE for writing REST services we have also got friendly with four basic annotations. In this article we will look in to some of the other commonly used annotations in REST.<span id="more-541"></span></p>
<p>The example of greeting a user is used through this article to help you comprehend and assimilate the tips provided in this article. Let us start by creating the form</p>
<p><pre class="brush: xml;">
&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;
	pageEncoding=&quot;ISO-8859-1&quot;%&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
  &lt;head&gt;
     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
     &lt;title&gt;Playing with Annotations&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;form method=&quot;post&quot; action=&quot;/PracticeREST/rest/helloworld/ &quot;&gt;
         &lt;label&gt;User Name:&lt;/label&gt;
         &lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;&lt;/input&gt;
         &lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;&lt;/input&gt;
      &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>On submit, the form will be submitted as a POST request to the REST service deployed at <em>PracticeREST/rest/greetings/</em> (same service that we wrote in our last article with certain modifications). The REST service should welcome the entered user. Pretty similar to the service that we saw in our last article with the following changes,</p>
<ol>
<li>Have to handle POST request rather than GET as we did previously</li>
<li>Have to get the user name from form</li>
</ol>
<p>Once we complete this, we will also look in to other ways of getting the user name, for example from <em>URL </em>and <em>HTTPServletRequest </em>object.</p>
<p><strong>Manipulating Form Attributes:</strong></p>
<p>For handling POST request, the POJO method needs to be decorated with @POST annotation as shown below,</p>
<p><pre class="brush: java;">
@POST
public String sayHello(){
	//implement the business logic here
}
</pre></p>
<p>REST provides two annotations @MultivaluedMap and @FormParam to manipulate form attributes.  Using @FormParam(“param name”) we will be able to get the value of a particular form parameter as shown below,</p>
<p><pre class="brush: java;">
public String sayHello(@FormParam(&quot;name&quot;) @DefaultValue(&quot;NoName&quot;) String name ){
	return &quot;Howdy &quot;+name+&quot; !! Welcome to Jersey REST.&quot;;
}
</pre></p>
<p>In addition to @FormParam, REST provides @MultivaluedMap annotation to iterate over all the form parameters as shown below,</p>
<p><pre class="brush: java;">
public String sayHello(MultivaluedMap&lt;String, String&gt; formParams){
	for (String key : formParams.keySet()) {
			formparameters = formparameters + formParams.get(key);
		}
		formparameters += &quot;&lt;br&gt; Value got using FormParam &quot; + userName;
	System.out.println(formparameters);
}
</pre></p>
<p><strong>Note:</strong> Form parameters that has name attribute can only be manipulated with @MultivaluedMap  and @FormParam annotations</p>
<p><strong>Other ways to get user inputs</strong></p>
<p>In addition to the above annotations which directly work on form parameters, REST provides @PathParam, @Context annotation to get user inputs.</p>
<p><strong>Using @PathParam</strong></p>
<p>To illustrate this, let us add a new link to our index.jsp as shown below</p>
<p><pre class="brush: xml;">
…..
&lt;input type=&quot;text&quot; name=&quot;name&quot;&gt;&lt;/input&gt;
&lt;a href=&quot;/PracticeREST/rest/helloworld/veechand&quot;&gt;Click Me&lt;/a&gt;
</pre></p>
<p>Clicking on the link will direct the user to the service at <em>/PracticeREST/rest/helloworld/veechand</em> as a GET request. Assume that the username in the link, namely veechand, is dynamically populated using the logged in user. In this case our service URL should be something like <em>/PracticeREST/rest/helloworld/[variable]</em> and our business logic should able to get and process on the variable. @PathParam helps us in doing this,</p>
<p><pre class="brush: java;">
@Path(&quot;/helloworld/{username}&quot;)
public String sayHello(@PathParam(&quot;username&quot;) @DefaultValue(&quot;NoName&quot;) String name ){
		return &quot;Howdy &quot;+name+&quot; !! Welcome to Jersey REST.&quot;;
}
</pre></p>
<p>1. @PATH annotation has a variable embedded in it. This variable will be substituted at run time.  Variable have to be represented in curly braces ‘{‘<br />
2. Value of the URI variables can be got using @PathParam(’[variable name]&#8216;). This annotation could take @DefaultValue to assign a default value to the variable.</p>
<p><strong>Using @Context</strong></p>
<p>@Context can be used for obtaining and processing information about the application deployment and individual request. Using @Context we can get handle to HttpHeaders, Request, SecurityContext, HttpServletConfig, ServletContext, HttpServletRequest, HttpServletResponse and EJB container details like @EJB, @EJBs, @WebServiceRef, @WebServiceRefs, @PersistenceContext, @PersistenceContexts, @PersistenceUnit and @PersistenceUnits. So using @Context a handle to Request object can be obtained and manipulated to get the needed parameters</p>
<p><pre class="brush: java;">
public String post(@Context HttpServletRequest req) {
          String username = req.getParameter(key)
}
</pre></p>
<p>Hopefully you&#8217;ve found this tutorial interesting and this has been useful to you. Feel free to reuse this code elsewhere in your projects and chime in here if you are running into difficulties. Questions? Nice things to say? Criticisms? Hit the comments section and leave me a comment. Happy coding!</p>
<p style="text-align:left;" class="getsocial"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2009/11/09/playing-with-rest-annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4014.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;h=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4024.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;title=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4034.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;title=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4044.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;title=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4054.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;title=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4064.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;Title=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4074.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Playing%20with%20REST%20annotations+%40+http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4084.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4094.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F11%2F09%2Fplaying-with-rest-annotations&amp;t=Playing%20with%20REST%20annotations" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4104.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/541/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=541&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2009/11/09/playing-with-rest-annotations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4014.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4024.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4034.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4044.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4054.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4064.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4074.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4084.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4094.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4104.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting started with REST</title>
		<link>http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/</link>
		<comments>http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 16:39:17 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>
		<category><![CDATA[rest jersey]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=464</guid>
		<description><![CDATA[Introduction REST, acronym for Representational State Transfer is coined by Roy Fielding to represent architectural style of networked systems. This is not a standard but an architectural style for an application that is based on different standards like HTTP, XML, URL, MIME types.  JAX-RS specification, JSR 311 defines a set of java APIs for development [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=464&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction </strong></p>
<p><strong> </strong> <a href="http://www.xfront.com/REST-Web-Services.html" target="_blank">REST</a>, acronym for Representational State Transfer is coined by <a href="http://www.ics.uci.edu/~fielding/" target="_blank">Roy Fielding</a> to represent architectural style of networked systems. This is not a standard but an architectural style for an application that is based on different standards like HTTP, XML, URL, MIME types.  JAX-RS specification, <a href="https://jsr311.dev.java.net/nonav/releases/1.0/spec/index.html">JSR 311</a> defines a set of java APIs for development of RESTful web services and RESTful java application.  <a href="https://jersey.dev.java.net/use/getting-started.html">Sun Jersey</a>, <a href="http://www.jboss.org/resteasy/">JBoss RESTEasy</a>, <a href="http://cwiki.apache.org/CXF/">Apache CXF</a> provides implementation for JSR 311. In this article we will look at the steps needed to setup Eclipse IDE for developing REST application using Jersey. We will also write our first HelloWorld service. <span id="more-464"></span></p>
<p><strong>Step 1 : Downloading needed jars</strong></p>
<p>The following jars needed to be available at compile time and runtime,</p>
<ul>
<li>jersey-core*.jar</li>
<li>jersey-server*.jar</li>
<li>jsr311-api-1.1.jar</li>
<li>asm*.jar</li>
</ul>
<p>All these jars can be downloaded in zip format at <a href="http://download.java.net/maven/2/com/sun/jersey/jersey-archive/">http://download.java.net/maven/2/com/sun/jersey/jersey-archive/</a></p>
<p><strong>Note</strong>: Setup procedure is different for maven users and not covered in this blog.</p>
<p><strong>Step 2 : Creating a Dynamic Web Project</strong></p>
<p>Follow the step 2 mentioned in <a href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/">http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/</a></p>
<p><strong>Note</strong>: Have the project name as PracticeREST instead of Struts2InAction</p>
<p><strong>Step 3 : Configuring Build Path</strong></p>
<p>Right click on the project. Choose <em>properties </em>and then<em> Java Build Path &gt; Libraries</em>. Using “<em>Add External Jars</em>” option add the four jars downloaded in step 1</p>
<div id="attachment_465" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-465" href="http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/restfigure1/"><img class="size-full wp-image-465" title="Figure 1 : Adding REST Jars" src="http://veechand.files.wordpress.com/2009/10/restfigure1.jpg?w=468&#038;h=424" alt="Figure 1 : Adding REST Jars" width="468" height="424" /></a><p class="wp-caption-text">Figure 1 : Adding REST Jars</p></div>
<p>Also, change the Default output folder to classes directory (create newly) under WEB-INF folder. This has to be done in <em>Source </em>tab as shown below</p>
<div id="attachment_466" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-466" href="http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/restfigure2/"><img class="size-full wp-image-466" title="Figure 2 - Changing Default output folder" src="http://veechand.files.wordpress.com/2009/10/restfigure2.jpg?w=468&#038;h=434" alt="Figure 2 - Changing Default output folder" width="468" height="434" /></a><p class="wp-caption-text">Figure 2 - Changing Default output folder</p></div>
<p><strong>Step 4 : Configuring REST servlets</strong></p>
<p>To load Jersey servlets dispatcher add the following entries to PracticeREST/WebContent/WEB-INF/web.xml</p>
<pre><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="line-height:19px;white-space:normal;"><span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;font-size:small;"><span style="line-height:18px;white-space:pre;">&lt;servlet&gt;</span></span></span></span>
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:small;"><span style="line-height:19px;white-space:normal;"><span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;font-size:small;"> </span></span></span>  &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
  &lt;servlet-class&gt;<span style="text-decoration:underline;">com</span>.sun.jersey.<span style="text-decoration:underline;">spi</span>.container.<span style="text-decoration:underline;">servlet</span>.ServletContainer&lt;/servlet-class&gt;
&lt;/servlet&gt;
&lt;servlet-mapping&gt;
 &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
 &lt;url-pattern&gt;/myrest/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
<span style="font-size:small;">&lt;/servlet&gt;</span></pre>
<p>Now all our REST web services will be available through …/rest/[resource]</p>
<p><strong>Step 5 : Writing our first “Greetings” service</strong></p>
<p>Create a new class my.practice.rest.Greetings and paste the below code</p>
<p><code><br />
package my.practice.rest;<br />
import javax.annotation.Resource;<br />
import javax.ws.rs.DefaultValue;<br />
import javax.ws.rs.GET;<br />
import javax.ws.rs.Path;<br />
import javax.ws.rs.QueryParam;<br />
/*<br />
* @author veechand<br />
*/<br />
@Path("/sayhello/")<br />
public class Greetings {<br />
@GET<br />
public String sayHello(@QueryParam("name") @DefaultValue ("NoName") String name ){<br />
return "Howdy "+name+" !! Welcome to Jersey REST.";<br />
}<br />
}<br />
</code></p>
<p>The meaning of the annotations used in the above code are as below</p>
<p>&nbsp;</p>
<table border="1">
<tbody>
<tr>
<th>Annotation</th>
<th> Description</th>
<th>Values</th>
</tr>
<tr>
<td>@Path</td>
<td>Identifies the URI path that serves a request. This corresponds to javax.ws.rs.Path package</td>
<td>Our Greeting service will be available through http://hostaddress:port-number/PracticeREST/rest/sayhello</td>
</tr>
<tr>
<td>@Get</td>
<td>Identifies the method that serves the Get request</td>
<td>This corresponds to javax.ws.rs.Get package</td>
</tr>
<tr>
<td>@QueryParam</td>
<td>Maps between the URL parameter and a java variable. This corresponds to javax.ws.rs.QueryParam package.</td>
<td>In our case the “name” parameter in URL is mapped to java variable, name</td>
</tr>
<tr>
<td>@DefaultValue</td>
<td>Defines the default value. This value will be assigned to the variable if URL doesn’t have the specified parameter.</td>
<td>In our case NoName will be assigned by default.</td>
</tr>
</tbody>
</table>
<p><strong>Step 6 : Testing our Greetings Service</strong></p>
<p>You will be able to access the Greetings service by launching   <a href="http://hostaddress:port-number/PracticeREST/rest/sayhello?name=veechand">http://hostaddress:port-number/PracticeREST/rest/sayhello?name=veechand</a> in your favorite http client</p>
<p><strong> Note</strong>: You have to replace hostaddress and port-number with corresponding values.</p>
<div id="attachment_534" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-534" href="http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/restfigure3-2/"><img class="size-full wp-image-534" title="Figure 3 - Result" src="http://veechand.files.wordpress.com/2009/10/restfigure31.jpg?w=468&#038;h=349" alt="Figure 3 - Result" width="468" height="349" /></a><p class="wp-caption-text">Figure 3 - Result</p></div>
<p><strong>Closing Notes:</strong></p>
<p>List of principles of a REST web design can be read at <a href="http://www.xfront.com/REST-Web-Services.html">http://www.xfront.com/REST-Web-Services.html</a>. Yes, we are violating the 2<sup>nd</sup> principle. I leave fixing this violation to readers. Comment if you have any issues in getting through it.</p>
<p>Keep watching for more write ups on Jersey REST</p>
<p style="text-align:left;" class="getsocial"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2009/10/29/getting-started-with-rest" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4011.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;h=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4021.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;title=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4031.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;title=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4041.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;title=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4051.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;title=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4061.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;Title=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4071.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=Getting%20started%20with%20REST+%40+http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4081.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4091.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F10%2F29%2Fgetting-started-with-rest&amp;t=Getting%20started%20with%20REST" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4101.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/464/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/464/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/464/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=464&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2009/10/29/getting-started-with-rest/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/10/restfigure1.jpg" medium="image">
			<media:title type="html">Figure 1 : Adding REST Jars</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/10/restfigure2.jpg" medium="image">
			<media:title type="html">Figure 2 - Changing Default output folder</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/10/restfigure31.jpg" medium="image">
			<media:title type="html">Figure 3 - Result</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4011.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4021.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4031.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4041.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4051.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4061.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4071.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4081.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4091.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4101.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
		<item>
		<title>4 easy steps to load Strut2InAction source</title>
		<link>http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/</link>
		<comments>http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 11:22:53 +0000</pubDate>
		<dc:creator>Veerabahu</dc:creator>
				<category><![CDATA[techinal]]></category>

		<guid isPermaLink="false">http://veechand.wordpress.com/?p=440</guid>
		<description><![CDATA[eclipse Struts2InAction<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=440&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Currently I am reading <a href="http://www.manning.com/dbrown/">Struts 2 in Action</a>. This is my second book from Manning publication. My first book was <a href="http://www.manning.com/bibeault2/">JQuery in Action</a> which is awesome.  As I completed the second chapter in Struts 2 I like to try out the sample HelloWorld program.  So I downloaded the source code from <a href="http://www.manning.com/dbrown/SampleApplication.zip">manning website</a>. I am able to play with HelloWorld in few minutes by deploying (copying) the downloaded war inside Tomcat 5.5.  However I also want to make a development setup in my eclipse so that I could try out certain things after changing the downloaded source. Unfortunately I am not able to make this easily. <span id="more-440"></span>My search for a document explaining the step to import the downloaded source in to eclipse also went in vain. After a struggle of few hours, got the downloaded source integrated with Eclipse. Today, we&#8217;re going to take a closer look at the steps to load the downloaded source in to eclipse.</p>
<p><strong>Note:</strong> Below steps explains about loading Struts2InAction (war). The same applies to HelloWorld.</p>
<h3>Step 1 – Extract the war file</h3>
<p>Open the war file using some extraction utility like Winrar. Extract the contents in to <strong>Struts2InAction</strong>(create new) directory in your workspace.</p>
<div id="attachment_441" class="wp-caption aligncenter" style="width: 477px"><a rel="attachment wp-att-441" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step1/"><img class="size-full wp-image-441" title="Figure 1 - Extracting" src="http://veechand.files.wordpress.com/2009/09/struts2step1.jpg?w=467&#038;h=181" alt="Figure 1 - Extracting" width="467" height="181" /></a><p class="wp-caption-text">Figure 1 - Extracting</p></div>
<h3>Step 2 – Create a Eclipse project</h3>
<p>We need to create a <strong><em>Dynamic Web Project</em></strong> in eclipse.</p>
<div id="attachment_444" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-444" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step2/"><img class="size-full wp-image-444" title="Figure 2 - Creating a new project" src="http://veechand.files.wordpress.com/2009/09/struts2step2.jpg?w=468&#038;h=244" alt="Figure 2 - Creating a new project" width="468" height="244" /></a><p class="wp-caption-text">Figure 2 - Creating a new project</p></div>
<p>Enter the project name as “<strong><em>Struts2InAction”. </em><span style="font-weight:normal;">Select the directory created in Step 1 as value to project contents</span></strong></p>
<p><strong><span style="font-weight:normal;"> </span></strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<div id="attachment_445" class="wp-caption aligncenter" style="width: 478px"><a rel="attachment wp-att-445" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step3/"><img class="size-full wp-image-445" title="Figure 3 - Dynamic Project" src="http://veechand.files.wordpress.com/2009/09/struts2step3.jpg?w=468&#038;h=482" alt="Figure 3 - Dynamic Project" width="468" height="482" /></a><p class="wp-caption-text">Figure 3 - Dynamic Project</p></div>
<p><span style="font-weight:normal;">Click Finish. A new project will be created with all the source code imported as shown in the below figure, </span></p>
<p><span style="font-weight:normal;"> </span></p>
<div id="attachment_446" class="wp-caption aligncenter" style="width: 242px"><a rel="attachment wp-att-446" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step4/"><img class="size-full wp-image-446" title="Figure 4 - Wrong directory structure" src="http://veechand.files.wordpress.com/2009/09/struts2step4.jpg?w=232&#038;h=383" alt="Figure 4 - Wrong directory structure" width="232" height="383" /></a><p class="wp-caption-text">Figure 4 - Wrong directory structure</p></div>
<h3>Step 3: Files re-arrangement</h3>
<p>We need to make certain re-arrangements before successfully running the applications.</p>
<ol>
<li>Copy all Chapter* directories in to WebContent directory</li>
<li>Copy menu, images in to WebContent directory</li>
<li>Copy index.html in to WebContent directory</li>
<li>Replace Struts2InAction/WebContent/WEB-INF with Struts2InAction/WEB-INF</li>
</ol>
<p><strong>Note:</strong> Do the above steps using windows explorer. After copying refresh the project in eclipse.</p>
<p>Once the above steps are done, the workspace will be re-structured as shown below</p>
<div id="attachment_448" class="wp-caption aligncenter" style="width: 245px"><a rel="attachment wp-att-448" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step5-2/"><img class="size-full wp-image-448" title="Figure 5 - Project Structure" src="http://veechand.files.wordpress.com/2009/09/struts2step51.jpg?w=235&#038;h=383" alt="Figure 5 - Project Structure" width="235" height="383" /></a><p class="wp-caption-text">Figure 5 - Project Structure</p></div>
<h3>Step 4 – Run and Have fun</h3>
<p>Now on a single click the application will be running within eclipse.</p>
<div id="attachment_450" class="wp-caption aligncenter" style="width: 477px"><a rel="attachment wp-att-450" href="http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/struts2step6/"><img class="size-full wp-image-450" title="Figure 6 - Running Application" src="http://veechand.files.wordpress.com/2009/09/struts2step61.jpg?w=467&#038;h=363" alt="Figure 6 - Running Application" width="467" height="363" /></a><p class="wp-caption-text">Figure 6 - Running Application</p></div>
<p>Hope this blog helps you in saving your valuable time. The same procedure applies to creation of any “Dynamic Web Project”. Let me know if you find more easier way to achieve the same.</p>
<p class="getsocial" style="text-align:left;"><a title="Add to Facebook" href="http://www.facebook.com/sharer.php?u=http://veechand.wordpress.com/2009/09/14/440" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4015.png?w=468" alt="Add to Facebook" /></a><a title="Add to Newsvine" href="http://www.newsvine.com/_wine/save?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;h=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4025.png?w=468" alt="Add to Newsvine" /></a><a title="Add to Digg" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;title=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4035.png?w=468" alt="Add to Digg" /></a><a title="Add to Del.icio.us" href="http://del.icio.us/post?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;title=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4045.png?w=468" alt="Add to Del.icio.us" /></a><a title="Add to Stumbleupon" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;title=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4055.png?w=468" alt="Add to Stumbleupon" /></a><a title="Add to Reddit" href="http://reddit.com/submit?url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;title=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4065.png?w=468" alt="Add to Reddit" /></a><a title="Add to Blinklist" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Url=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;Title=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4075.png?w=468" alt="Add to Blinklist" /></a><a title="Add to Twitter" href="http://twitter.com/home/?status=4%20easy%20steps%20to%20load%20Strut2InAction%20source+%40+http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4085.png?w=468" alt="Add to Twitter" /></a><a title="Add to Technorati" href="http://www.technorati.com/faves?add=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4095.png?w=468" alt="Add to Technorati" /></a><a title="Add to Furl" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fveechand.wordpress.com%2F2009%2F09%2F14%2F440&amp;t=4%20easy%20steps%20to%20load%20Strut2InAction%20source" target="_blank"><img style="border:0;margin:0;padding:0;" src="http://getsocialserver.files.wordpress.com/2009/02/gs4105.png?w=468" alt="Add to Furl" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/veechand.wordpress.com/440/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/veechand.wordpress.com/440/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/veechand.wordpress.com/440/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=veechand.wordpress.com&amp;blog=4898249&amp;post=440&amp;subd=veechand&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://veechand.wordpress.com/2009/09/16/4-easy-steps-to-load-strut2inaction-source/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/86b7deee7b6c29ee12158ba3455022e0?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">veeru</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step1.jpg" medium="image">
			<media:title type="html">Figure 1 - Extracting</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step2.jpg" medium="image">
			<media:title type="html">Figure 2 - Creating a new project</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step3.jpg" medium="image">
			<media:title type="html">Figure 3 - Dynamic Project</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step4.jpg" medium="image">
			<media:title type="html">Figure 4 - Wrong directory structure</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step51.jpg" medium="image">
			<media:title type="html">Figure 5 - Project Structure</media:title>
		</media:content>

		<media:content url="http://veechand.files.wordpress.com/2009/09/struts2step61.jpg" medium="image">
			<media:title type="html">Figure 6 - Running Application</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4015.png" medium="image">
			<media:title type="html">Add to Facebook</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4025.png" medium="image">
			<media:title type="html">Add to Newsvine</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4035.png" medium="image">
			<media:title type="html">Add to Digg</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4045.png" medium="image">
			<media:title type="html">Add to Del.icio.us</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4055.png" medium="image">
			<media:title type="html">Add to Stumbleupon</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4065.png" medium="image">
			<media:title type="html">Add to Reddit</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4075.png" medium="image">
			<media:title type="html">Add to Blinklist</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4085.png" medium="image">
			<media:title type="html">Add to Twitter</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4095.png" medium="image">
			<media:title type="html">Add to Technorati</media:title>
		</media:content>

		<media:content url="http://getsocialserver.files.wordpress.com/2009/02/gs4105.png" medium="image">
			<media:title type="html">Add to Furl</media:title>
		</media:content>
	</item>
	</channel>
</rss>
