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

<channel>
	<title>Veerasundar &#187; Java</title>
	<atom:link href="http://veerasundar.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://veerasundar.com/blog</link>
	<description>Java, web and design</description>
	<lastBuildDate>Wed, 16 May 2012 07:13:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Java Constants &#8211; using Class, Interface, Static Imports</title>
		<link>http://veerasundar.com/blog/2012/04/java-constants-using-class-interface-static-imports/</link>
		<comments>http://veerasundar.com/blog/2012/04/java-constants-using-class-interface-static-imports/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 07:50:27 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[best-practice]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[constants]]></category>
		<category><![CDATA[imports]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[static-imports]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=3016</guid>
		<description><![CDATA[Constants are the constant things in a project. I mean, it is safe to assume that any project would have some kind of constant values used across the code. The common practice in Java is to declare them as public, static and final variables so that they can be easily referenced wherever they needed. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Constants are the constant things in a project. I mean, it is safe to assume that any project would have some kind of constant values used across the code.</p>
<p>The common practice in Java is to declare them as public, static and final variables so that they can be easily referenced wherever they needed.</p>
<p>Here&#8217;s a list of patterns that I have seen on using such constants.</p>
<h2>1. Define a Constants class</h2>
<p>In this approach, you define a class &#8216;Constants&#8217; and put all your constants inside this class. Then reference the constants as &#8216;Constants.CONST_NAME&#8217; wherever needed. Easy as it looks.</p>
<pre class="brush:java">public class Constants {
	public static final String SITE_NAME="veerasundar.com";
}</pre>
<pre>class Hello{
	public void someFun(){
		System.out.print(Constants.SITE_NAME);
	}
}</pre>
<p>But the con of this approach is that you need to prepend the class name &#8216;Constants&#8217; all the time. If you are using constants very frequently, then this will become little ineffective. We can do better.</p>
<h2>2. Define a Constants interface and implement it</h2>
<p>The second approach is that you define a Interface that contains all your constants and then implement this interface in the class where you want to use the constants. This way, you don&#8217;t need to prefix &#8216;Constants&#8217;, instead you can directly access the constant like CONSTANT_NAME.</p>
<pre>public interface Constants {
	public static final String SITE_NAME="veerasundar.com";
}</pre>
<pre>class Hello implements Constants{
	public void someFun(){
		System.out.print(SITE_NAME);
	}
}</pre>
<p>But this approach is generally considered as a bad practice because it pollutes the class&#8217;s implementation hierarchy. You are forced to implement an interface without much semantic meaning. We can still do better than this.</p>
<h2>3. Use Java static imports</h2>
<p>Static imports are introduced in Java 5. Using static imports you can import static members/properties of a class so that you can directly access them without prefixing it&#8217;s parent class&#8217;s name. So, we can define a <em>Constants </em>class as shown in first approach above and the use static imports to use the constant properties directly.</p>
<pre>package com.test;
public class Constants {
	public static final String SITE_NAME = "veerasundar.com";
}</pre>
<pre>import static com.test.Constants.*;
public class Hello {
	public void someFun() {
		System.out.print(SITE_NAME);
	}
}</pre>
<p>So, we get the best of both worlds &#8211; we don&#8217;t unnecessarily prefix <em>Constants </em>everywhere and we don&#8217;t pollute class&#8217;s API too. Win!</p>
<p>But this approach too has some bad press against it. If you use static imports very often, then your code become hard to read and understand. Especially when you statically import lot of methods. So, use it sparingly and wisely.</p>
<p>What do you think as the best of the above three approaches? Do you use any other approaches other than these? Feel free to comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/04/java-constants-using-class-interface-static-imports/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Open sourcing Twikural &#8211; an App Engine project</title>
		<link>http://veerasundar.com/blog/2012/04/open-sourcing-twikural-an-app-engine-project/</link>
		<comments>http://veerasundar.com/blog/2012/04/open-sourcing-twikural-an-app-engine-project/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 10:27:40 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[app-engine]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[thirukural]]></category>
		<category><![CDATA[twikural]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2993</guid>
		<description><![CDATA[tldr; https://github.com/vraa/twikural It all started when I asked the following question to my twitter friends: Juts checking: If there&#8217;s a service that sends you a Thirukkural every day, would you be signing up for it? — Veera (@vraa) January 31, 2012 My idea was simple: to send out Thirukural poems everyday to the people that are [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><strong>tldr; <a href="https://github.com/vraa/twikural">https://github.com/vraa/twikural</a></strong></p>
<p>It all started when I asked the following question to my twitter friends:</p>
<blockquote class="twitter-tweet tw-align-center"><p>Juts checking: If there&#8217;s a service that sends you a Thirukkural every day, would you be signing up for it?</p>
<p>— Veera (@vraa) <a href="https://twitter.com/vraa/status/164394058238799873" data-datetime="2012-01-31T17:06:12+00:00">January 31, 2012</a></p></blockquote>
<p>My idea was simple: to send out Thirukural poems everyday to the people that are signing up for the service. Instead of sending it to email addresses, I decided to use Twitter and Facebook as my medium since that&#8217;s where most of the people are hanging out these days.</p>
<p>There were few tweeples responding to it positively. Even though there are already few other alternative services available, I decided to move on and build it as I thought the new service will be different and be a learning experience.</p>
<p>It took a weekend to code the 80% of the site and I hosted it on App Engine platform. And the site is live for the past few weeks &#8211; <a href="http://twikural.veerasundar.com">http://twikural.veerasundar.com</a></p>
<p style="text-align: center;"><a href="http://twikural.veerasundar.com"><img class="aligncenter  wp-image-2997" title="twikural" src="http://veerasundar.com/blog/wp-content/uploads/2012/04/twikural.png" alt="" width="608" height="250" /></a></p>
<p>Now, the service has <a href="https://twitter.com/#!/twikural">31 followers in Twitter</a> and <a href="https://www.facebook.com/twikural">37 Likes in Facebook</a>. It has already sent out 120 Thirukurals till date. <img src='http://veerasundar.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And, I&#8217;m now open sourcing the code. The project is now <a href="https://github.com/vraa/twikural">hosted @ Github</a>. You are welcomed to check it out and if you&#8217;d like to contribute, feel free to send a pull request / contact me.</p>
<p>I would like to thank my fellow tweeples &#8211; <a href="https://twitter.com/#!/iGhillli">@iGhillli</a>, <a href="https://twitter.com/#!/anandhame">@anandhame</a>, <a href="https://twitter.com/#!/mgobi_php">@mgobi_php</a>   for their continuous support to this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/04/open-sourcing-twikural-an-app-engine-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to auto reload external code changes in Eclipse project</title>
		<link>http://veerasundar.com/blog/2012/04/how-to-auto-reload-external-code-changes-in-eclipse-project/</link>
		<comments>http://veerasundar.com/blog/2012/04/how-to-auto-reload-external-code-changes-in-eclipse-project/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 02:01:38 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[refresh]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[sublime]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[synchronize]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2965</guid>
		<description><![CDATA[I have started using Sublime text as my preferred code editor (for JS, CSS, Coffee). But, I still rely on Eclipse for writing Java code because it auto-imports Java packages and auto suggests variables and method names from my custom class files. Working on multiple editors throws in another problem: whenever I make a change [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I have started using <a href="http://veerasundar.com/blog/2012/03/unix-alias-with-parameters-or-opening-sublime-text-editor-from-command-line/">Sublime text</a> as my preferred code editor (for JS, CSS, Coffee). But, I still rely on Eclipse for writing Java code because it auto-imports Java packages and auto suggests variables and method names from my custom class files.</p>
<p>Working on multiple editors throws in another problem: whenever I make a change in some file outside of Eclipse, the IDE does not silently reload. It shows a blank page saying &#8220;The resource is out of sync. Press F5 to reload&#8221;. The message started annoying me soon as I had to switch back and forth often.</p>
<p>It is not just for the multiple editors. Even when I do a <em>git pull,</em> the resources go out of sync.</p>
<p>Then, I found a workaround for this. Eclipse provides a built-in option that auto reloads a resource if its out f sync. Here&#8217;s how you  can enable it.</p>
<p>Go to <strong>Window -&gt; Preferences -&gt; General -&gt; Workspace </strong>and check the option <strong>&#8220;Refresh using native hooks or polling&#8221;</strong>.</p>
<p>So, the next time when you try to open a out of sync file, the IDE will sync it for you (thus saving you a keystroke, one at a time <img src='http://veerasundar.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/04/how-to-auto-reload-external-code-changes-in-eclipse-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Anagram tester in Java</title>
		<link>http://veerasundar.com/blog/2012/03/anagram-tester-in-java/</link>
		<comments>http://veerasundar.com/blog/2012/03/anagram-tester-in-java/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 15:49:33 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[anagram]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2946</guid>
		<description><![CDATA[While browsing the net, I found this problem somewhere &#8211; to write a code that tests the given two strings are anagrams or not. From Wiki, &#8220;An anagram is a type of word play, the result of rearranging the letter of a word or phrase to produce a new word or phrase, using all the original letters exactly [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>While browsing the net, I found this problem somewhere &#8211; to write a code that tests the given two strings are anagrams or not. From Wiki,</p>
<blockquote><p>&#8220;An <strong>anagram</strong> is a type of word play, the result of rearranging the letter of a word or phrase to produce a new word or phrase, using all the original letters exactly once; for example <em>orchestra</em> can be rearranged into <em>carthorse</em>.&#8221;</p></blockquote>
<p>I tried to solve this problem using Java and below is the result of it. The algorithm I tried is very simple:</p>
<ol>
<li>Clean the input &#8211; remove all the spaces and punctuation marks (because it doesn&#8217;t affect the compassion).</li>
<li>Go through character by character from string <em>one</em> and check if that character exists in string <em>two</em>.</li>
<li>If exists, then remove it from string <em>two </em>and move on to next character. If not exists, then we found a mismatch and the string is not an anagram.</li>
<li>If all character from string <em>one </em>exists in string <em>two</em>, then we found it&#8217;s an anagram.</li>
</ol>
<h2> Java code to test two strings are anagrams:</h2>
<script src="https://gist.github.com/2007044.js"></script>
<p>I tested the above code with most of the anagrams found in the <a title="Anagram site" href="http://www.anagramsite.com/">Anagram Site</a> and it worked well.</p>
<p>If you think the above code can be improved in someway, feel free to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/03/anagram-tester-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Rise of the Front End Developers</title>
		<link>http://veerasundar.com/blog/2012/01/the-rise-of-the-front-end-developers/</link>
		<comments>http://veerasundar.com/blog/2012/01/the-rise-of-the-front-end-developers/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 17:53:54 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[back-end]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[opinion]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2826</guid>
		<description><![CDATA[In any web development company, there exists two different worlds; well there are more, but we&#8217;ll just focus on - front end (designers) &#38; back end (developers) The Front end guys are responsible for making something that is visible to the end users (THE LOOK). The back end guys are responsible for making the front end work [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>In any web development company, there exists two different worlds; well there are <em>more,</em> but we&#8217;ll just focus on - front end (designers) &amp; back end (developers)</p>
<p>The Front end guys are responsible for making something that is visible to the end users (THE LOOK). The back end guys are responsible for making the front end work (THE FUNCTIONALITY). Together, they both deliver a complete web application/site.</p>
<p>The back end developers would typically use programming languages, such as Java/C++/Python. Apart from talking to database and processing requests, they even have an arsenal of libraries to generate the site markup (JSPs, server side templates, etc).</p>
<p>Front end guys usually fill in by writing HTML documents and CSS files (merely a <em>writer</em>) to present this markup in an visually pleasing way and back end just take these templates to populate data.</p>
<p>Front end had only one option to do any logical operations, by using <em>JavaScript </em>- which has been used for a long time just to validate forms (and do some freaky stuffs).</p>
<p>Because of this <em>cultural </em>difference, there&#8217;s always been a ego-war between these two worlds. Even the company management would rate the front end guys par below the back end developers because the front ends guys don&#8217;t do any serious programming.</p>
<p>All was going fine until the web2.0 era. Now, the front end realized that they could use JavaScript to do much more cooler stuffs than just the form validation. The development of high speed JavaScript engines (such as V8) made it possible to run complex JavaScript code right in the browser. With the introduction of technologies such as WebGL and Canvas, even graphics rendering became feasible using JavaScript.</p>
<p>But, this didn&#8217;t change anything on the server side; the server programs were still running on JVMs/Rubys/Pythons.</p>
<p>Fast forward to today: The scenario is dramatically changing. JavaScript has just sneaked its way into the servers. Now, it is no longer required that a web application needs to have a back end programming language such as Java/C++. Everything can be done using just JavaScript.</p>
<p>Thanks to <strong>node.js </strong>which made it possible to run the JavaScript on the server side. Using <strong>MongoDB, </strong>one can replace the need to have SQL code and now store JSON documents using JavaScript MongoDB connectors. The JavaScript template libraries such as <strong>{{Mustache}}/Underscore </strong>almost removed the need to have server side templates (JSPs). On the client side, JavaScript MVC frameworks such as <strong>Backbone.JS </strong>enable us to write maintainable code. And, there&#8217;s always the plain old JavaScript waiting for us to write some form validation script.</p>
<p>With that, now it is possible to do the heavy lifting just by using JavaScript. The front end JavaScript programmers no longer need to focus on just the front end. They can use their skill set to develop the web application <strong>end-to-end.</strong></p>
<p>This rise of the front end developers poses a real threat to the survival of back end developers. If you are one of that back end guy, do you already realize this threat? What&#8217;s your game plan to stay fit to survive this challenge?</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/01/the-rise-of-the-front-end-developers/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Java.lang.VerifyError: Expecting a stackmap frame at branch target &#8211; JDK 7</title>
		<link>http://veerasundar.com/blog/2012/01/java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-7/</link>
		<comments>http://veerasundar.com/blog/2012/01/java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-7/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 13:53:21 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[jdk7]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2811</guid>
		<description><![CDATA[Right now, when I try to persist an object in Google App Engine, I&#8217;m facing the error &#8220;Java.lang.VerifyError: Expecting a stackmap frame at branch target&#8220;. I&#8217;m using JDK 7 and it seems like the problem lies with this JDK. After googling a bit, I found that there seems to be two solutions to fix this [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Right now, when I try to persist an object in Google App Engine, I&#8217;m facing the error &#8220;<strong>Java.lang.VerifyError: Expecting a stackmap frame at branch target</strong>&#8220;. I&#8217;m using JDK 7 and it seems like the problem lies with this JDK.</p>
<p>After googling a bit, I found that there seems to be two solutions to fix this problem.</p>
<h2>Solution 1: Change to JDK 6</h2>
<p>As simple as is, change your JDK to version 6 and you won&#8217;t be bugged by this exception anymore. Well, in my case, I <em>have </em>to use JDK 7. So, moving on to the solution 2.</p>
<h2>Solution 2: Configure JVM</h2>
<p>Go to <strong>Windows -&gt; Preferences -&gt; Installed JREs. </strong>Select the default JVM and click edit. Then add this parameter as VM argument &#8220;<strong>-XX:-UseSplitVerifier</strong>&#8221; as seen below.</p>
<p style="text-align: center;"><img class="size-full wp-image-2813 aligncenter" title="Screenshot-Edit-JRE" src="http://veerasundar.com/blog/wp-content/uploads/2012/01/Screenshot-Edit-JRE-.png" alt="" width="637" height="615" /></p>
<p>This should solve the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2012/01/java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making GET and POST requests in android application</title>
		<link>http://veerasundar.com/blog/2011/09/making-get-and-post-requests-in-android-application/</link>
		<comments>http://veerasundar.com/blog/2011/09/making-get-and-post-requests-in-android-application/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 04:15:19 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2555</guid>
		<description><![CDATA[It is often a requirement that you need to connect to a server through HTTP from your android application. When you use servlets/html, making such requests are a no-brainer. But, in Android it needs some searching before implementing such functions. Here&#8217;s some sample code snippets that explains how you can make GET and POST requests [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>It is often a requirement that you need to connect to a server through <a title="Hosting Java applications in the web" href="http://veerasundar.com/blog/2009/12/hosting-java-applications-in-the-web/" target="_blank">HTTP</a> from your android application. When you use servlets/html, making such requests are a <a title="Implementing Ajax in Java web application using JQuery" href="http://veerasundar.com/blog/2008/12/implementing-ajax-in-java-web-application-using-jquery/" target="_blank">no-brainer</a>. But, in Android it needs some searching before implementing such functions.</p>
<p>Here&#8217;s some sample code snippets that explains how you can make GET and POST requests from your android application.</p>
<h2>Enable Internet permission for your android application:</h2>
<p>Before making any use of internet in your android application, you should enable the internet permission for your application. To do this, open the <em>AndroidManifest.xml </em>file and then add the below line:</p>
<pre class="brush:xml">&lt;uses-permission android:name="android.permission.INTERNET" /&gt;</pre>
<h2>HTTP GET request in Android application:</h2>
<pre class="brush:java">public static String getHttpResponse(URI uri) {
	Log.d(APP_TAG, "Going to make a get request");
	StringBuilder response = new StringBuilder();
	try {
		HttpGet get = new HttpGet();
		get.setURI(uri);
		DefaultHttpClient httpClient = new DefaultHttpClient();
		HttpResponse httpResponse = httpClient.execute(get);
		if (httpResponse.getStatusLine().getStatusCode() == 200) {
			Log.d("demo", "HTTP Get succeeded");

			HttpEntity messageEntity = httpResponse.getEntity();
			InputStream is = messageEntity.getContent();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			String line;
			while ((line = br.readLine()) != null) {
				response.append(line);
			}
		}
	} catch (Exception e) {
		Log.e("demo", e.getMessage());
	}
	Log.d("demo", "Done with HTTP getting");
	return response.toString();
}</pre>
<h2>HTTP POST request in Android application:</h2>
<p>A POST request is slightly (well, vastly) different from a GET request (I have seen most developers use there requests interchangeably!). In a POST, we often send some parameters to change state of the objects in server.</p>
<p>In Android too, we have some mechanisms to send HTTP parameters while sending a POST request, which is shown in below code snippet.</p>
<pre class="brush:java">public static String postHttpResponse(URI uri) {
	Log.d(APP_TAG, "Going to make a post request");
	StringBuilder response = new StringBuilder();
	try {
		HttpPost post = new HttpPost();
		post.setURI(uri);
		List params = new ArrayList();
		params.add(new BasicNameValuePair("paramName", "paramValue"));
		post.setEntity(new UrlEncodedFormEntity(params));
		DefaultHttpClient httpClient = new DefaultHttpClient();
		HttpResponse httpResponse = httpClient.execute(post);
		if (httpResponse.getStatusLine().getStatusCode() == 200) {
			Log.d(APP_TAG, "HTTP POST succeeded");
			HttpEntity messageEntity = httpResponse.getEntity();
			InputStream is = messageEntity.getContent();
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			String line;
			while ((line = br.readLine()) != null) {
				response.append(line);
			}
		} else {
			Log.e(APP_TAG, "HTTP POST status code is not 200");
		}
	} catch (Exception e) {
		Log.e(APP_TAG, e.getMessage());
	}
	Log.d(APP_TAG, "Done with HTTP posting");
	return response.toString();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2011/09/making-get-and-post-requests-in-android-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Download and install JSTL</title>
		<link>http://veerasundar.com/blog/2011/09/download-and-install-jstl/</link>
		<comments>http://veerasundar.com/blog/2011/09/download-and-install-jstl/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 04:40:29 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[box]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[jstl]]></category>
		<category><![CDATA[share]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2541</guid>
		<description><![CDATA[To add JSTL to your project; Download jstl.jar &#38; standard.jar (360KB) Download the jstl.jar and standard.jar files from the above download link (or you can get these from your local Apache Tomcat installation too!) Put them in your project&#8217;s WEB-INF/lib folder. Add them to the CLASSPATH. Now you can use JSTL in your pages. So, why this [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>To add JSTL to your project;</p>
<p style="text-align: center;"><a class="actionbutton" title="download jstl.jar and standard.jar" href="http://www.box.net/shared/gzz2nyf9s506d3h3vkzq">Download jstl.jar &amp; standard.jar (360KB)</a></p>
<ol>
<li>Download the <em>jstl.jar </em>and <em>standard.jar</em> files from the above download link (or you can get these from your local Apache Tomcat installation too!)</li>
<li>Put them in your project&#8217;s <em>WEB-INF/lib</em> folder.</li>
<li>Add them to the CLASSPATH.</li>
<li>Now you can use JSTL in your pages.</li>
</ol>
<p>So, why this post about an obvious thing?</p>
<p>Well, I&#8217;ve seen people get confused when they try to install JSTL for the first time. They google for &#8220;<em>download JSTL or install JSTL</em>&#8221; which will end up in the page <a title="JSTL downloads" href="http://java.sun.com/products/jsp/jstl/downloads/" target="_blank">JSTL downloads</a> (which is surprisingly still hosted at <strong><em>java.sun.com</em></strong><em>). </em>And, god only knows what you can download from <em>that</em> page!</p>
<p>That is why I&#8217;d put together this simple <a href="http://www.box.net/shared/gzz2nyf9s506d3h3vkzq" title="download JSTL" target="_blank">download</a> link. Hope it&#8217;ll be useful for the JSTL beginners.</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2011/09/download-and-install-jstl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Copy paste code directly in Eclipse</title>
		<link>http://veerasundar.com/blog/2011/09/copy-paste-code-directly-in-eclipse/</link>
		<comments>http://veerasundar.com/blog/2011/09/copy-paste-code-directly-in-eclipse/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 21:13:42 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2532</guid>
		<description><![CDATA[Recently learned a really cool trick for copy-pasting code in Eclipse. Lets say you have the following code: package com.veerasundar.demo; public class CopyCode { private int nothing; } Now copy the above code, go to any Eclipse project and right click on source folder and paste. See what happens! Impressive isn&#8217;t it!? Here&#8217;s what Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Recently learned a really cool trick for copy-pasting code in Eclipse.</p>
<p>Lets say you have the following code:</p>
<pre class="brush:java">package com.veerasundar.demo;

public class CopyCode {
	private int nothing;
}</pre>
<p>Now copy the above code, go to any Eclipse project and right click on <em>source </em>folder and paste. See what happens! Impressive isn&#8217;t it!?</p>
<p>Here&#8217;s what Eclipse did: it parsed the clipboard, found that there&#8217;s a Java code in it, create the necessary package structure for the code to fit in and then copied the code there.</p>
<p>Neat!</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2011/09/copy-paste-code-directly-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heroku runs Java</title>
		<link>http://veerasundar.com/blog/2011/08/heroku-runs-java/</link>
		<comments>http://veerasundar.com/blog/2011/08/heroku-runs-java/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 09:45:22 +0000</pubDate>
		<dc:creator>Veera</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[provider]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://veerasundar.com/blog/?p=2524</guid>
		<description><![CDATA[If you are a Java fan boy, like me, then you have a good news to cheer about. Heroku runs Java now! Well, unlike other popular &#8216;web&#8217; languages like PHP/RoR, Java has the legacy of being cumbersome to deploy and maintain in an web server. All this time, only enterprises had the effort to use the Java [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img class="alignleft size-full wp-image-2525" title="heroku-logo" src="http://veerasundar.com/blog/wp-content/uploads/2011/08/heroku-logo.png" alt="" width="300" height="93" />If you are a Java fan boy, like me, then you have a good news to cheer about. <strong>Heroku runs Java now!</strong></p>
<p>Well, unlike other popular &#8216;<em>web&#8217;</em> languages like PHP/RoR, Java has the legacy of being cumbersome to deploy and maintain in an web server. All this time, only enterprises had the effort to use the Java stack on their web tier. Freelance developers never (or rarely) opted for Java.</p>
<p>But the development of cloud platforms such as Amazon Web Services and Google App Engine has changed the landscape dramatically. Cloud providers managed the hard part of deployment and server management while the developers focused on the application that they are developing. Now pushing a Java app to the wild is just a click-away; at least in GAE it is!</p>
<p>I&#8217;d already compiled a list of <a title="Hosting Java applications in the web" href="http://veerasundar.com/blog/2009/12/hosting-java-applications-in-the-web/" target="_blank">hosting providers who support Java</a> on their servers. With <a title="Heroku for Java" href="http://blog.heroku.com/archives/2011/8/25/java/">today&#8217;s announcement</a>, Heroku joins the party too.</p>
<p>Even though I&#8217;ve not used Heroku before, I&#8217;ve read some good reviews about it in Hacker News. With Heroku, all you need to deploy your app is to do a <em>git push! </em>Cool, isn&#8217;t it? And, it is not just Java &#8211; you can even run the JVM languages like Scala and JRuby.</p>
<p>Moreover, I&#8217;m a big fan for the design of their <a title="How Heroku works" href="http://www.heroku.com/how" target="_blank">How it works page</a>. <img src='http://veerasundar.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So, if you are developing your app in Java, you have one more hosting provider to consider!</p>
]]></content:encoded>
			<wfw:commentRss>http://veerasundar.com/blog/2011/08/heroku-runs-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

