<?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>Caffeine++ = Code++</title>
	<atom:link href="http://riddhimandas.com/feed" rel="self" type="application/rss+xml" />
	<link>http://riddhimandas.com</link>
	<description>Riddhiman Das</description>
	<lastBuildDate>Wed, 06 Mar 2013 23:35:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Install Sun/Oracle JDK 6 on Ubuntu 12.04</title>
		<link>http://riddhimandas.com/blog/177</link>
		<comments>http://riddhimandas.com/blog/177#comments</comments>
		<pubDate>Wed, 06 Mar 2013 23:29:03 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=177</guid>
		<description><![CDATA[<p>Ubuntu 12.04 is my primary OS, however, there doesn&#8217;t appear to be many guides on installing the Sun/Oracle JDK on Ubuntu.</p> <p>In case someone else finds it useful, here&#8217;s what I did on my 64 bit Ubuntu 12.04 install:</p> <p>1. Download the Java SE Development Kit 6 Update 38 for Linux x64 from http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html (The [...]]]></description>
				<content:encoded><![CDATA[<p>Ubuntu 12.04 is my primary OS, however, there doesn&#8217;t appear to be many guides on installing the Sun/Oracle JDK on Ubuntu.</p>
<p>In case someone else finds it useful, here&#8217;s what I did on my 64 bit Ubuntu 12.04 install:</p>
<p>1. Download the <em>Java SE Development Kit 6 Update 38</em> for <em>Linux x64</em> from http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html (The filename should be jdk-6u38-linux-x64.bin and <span style="color: #ff0000;">NOT</span> jdk-6u38-linux-x64.<span style="color: #ff0000;">rpm.</span>bin)</p>
<p>2. Make the file executable: <em>chmod +x jdk-6u38-linux-x64.bin</em></p>
<p>3. Extract the file <em>./jdk-6u32-linux-x64.bin</em></p>
<p>4. Create a directory called <em>jvm</em> in <em>/usr/lib</em>: <em>sudo mkdir /usr/lib/jvm</em></p>
<p>5. Move the extracted JDK directory into <em>/usr/lib/jvm</em>: <em>sudo mv jdk1.6.0_38 /usr/lib/jvm/jdk1.6.0_38</em></p>
<p>6. Make it the default JDK in the system:</p>
<p>sudo update-alternatives &#8211;install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1<br />
sudo update-alternatives &#8211;install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1<br />
sudo update-alternatives &#8211;install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1</p>
<p>sudo update-alternatives &#8211;config javac<br />
sudo update-alternatives &#8211;config javaws<br />
sudo update-alternatives &#8211;config java</p>
<p>&nbsp;</p>
<p>If you want, you can add the JAVA_HOME environment variable to point to your new JDK installation as:</p>
<p><em>export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_38/</em></p>
<p>and now you can put the JDK binaries like java, javac etc. as:</p>
<p><em>export PATH=$PATH:$JAVA_HOME/bin</em></p>
<p>Sticking those two statements in your .bashrc would ensure they always stay in your path across.</p>
<p>&nbsp;</p>
<p>Edit: You can also enable the Java plugin for Chrome and Firefox as:</p>
<p><em>sudo ln -s /usr/lib/jvm/jdk1.6.0_38/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins</em></p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/177/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The absolute minimum every developer should know about git</title>
		<link>http://riddhimandas.com/blog/167</link>
		<comments>http://riddhimandas.com/blog/167#comments</comments>
		<pubDate>Sun, 25 Mar 2012 21:44:13 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[basics of git]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[software collaboration]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=167</guid>
		<description><![CDATA[<p>Some of the developers I have worked with on smaller projects have never used <a href="http://git-scm.com/" target="_blank">Git</a> (shocking, I know), and I always end up having to give them a very basic tutorial just to help them get up to speed.</p> <p>Since I&#8217;ve already done it more than a couple of times, I thought I [...]]]></description>
				<content:encoded><![CDATA[<p>Some of the developers I have worked with on smaller projects have never used <a href="http://git-scm.com/" target="_blank">Git</a> (shocking, I know), and I always end up having to give them a very basic tutorial just to help them get up to speed.</p>
<p>Since I&#8217;ve already done it more than a couple of times, I thought I should write a post about the absolute minimum every developer should be aware of when starting to use git to collaborate with other developer(s) on a software development project.</p>
<p>Note: I prefer using git from the command line. Most linux distributions should come with git pre-installed. If you don&#8217;t have it or you&#8217;re on a mac, you can download it from the official <a href="http://git-scm.com/download" target="_blank">git downloads page</a>. If you&#8217;re on windows, you can use <a href="http://code.google.com/p/msysgit/downloads/list" target="_blank">mysysGit</a>, which comes with bash. (Secret: if you&#8217;ve always missed bash on Windows, this can replace cmd.exe for most command-line work)</p>
<p>First, you should know how to clone a repository. Most of the times, if the repository is hosted on a hosting service like <a href="https://github.com/" target="_blank">GitHub</a> or <a href="https://bitbucket.org/" target="_blank">Bitbucket</a>, this consists of copying and pasting one git command from the website, like in the screenshot I took from bitbucket below:</p>
<p><a href="http://riddhimandas.com/wp-content/uploads/2012/03/Screen-Shot-2012-03-24-at-10.44.27-PM.png"><img class="aligncenter size-medium wp-image-168" title="bitbucketgitclone" src="http://riddhimandas.com/wp-content/uploads/2012/03/Screen-Shot-2012-03-24-at-10.44.27-PM-300x86.png" alt="" width="300" height="86" /></a></p>
<p>Now, you should have the files for your project in the directory you cloned your repository.</p>
<p>Then, once you&#8217;ve worked on your project (i.e. added/modified/removed files), you can do:</p>
<pre>git add -A</pre>
<p>which basically tells git &#8220;hey, I&#8217;ve modified stuff and I want you to know about them&#8221;.</p>
<p>Then you can commit your changes as:</p>
<pre>git commit -m "<em>message</em>"</pre>
<p>where &#8221;<em>message</em>&#8221; is a little note describing what you&#8217;ve changed.</p>
<p>After this step, you want to pull for any new changes that may have been made. This is important, and is often forgotten by beginners. Between the last time you cloned/pulled from a remote repository, there may have been changed committed to the files by another member of your team, and you want to get those changes and deal with any conflicts at this step. I thought <a href="http://blog.wuwon.id.au/2010/09/painless-merge-conflict-resolution-in.html" target="_blank">this tutorial</a> had a great discussion on handling merge conflicts in Git.</p>
<p>After you&#8217;ve taken care of any merge conflicts you may have had, it&#8217;s push time. This is as easy as</p>
<pre>git push origin master</pre>
<p>which tells git now that you know what I changed (using git add -A) and how I described what I did (using git commit -m &#8220;message&#8221;), I want you to take my changes and send it to the remote server where everything is hosted.</p>
<p>This, in my opinion, is the bare minimum that every developer should know about git. While what I&#8217;ve described is in no way comprehensive, it should be enough to get started on a project that&#8217;s using Git for source control.</p>
<p>Once you feel comfortable with all this, I recommend you check out some tutorials available online. If you like videos, O&#8217;Reilly has <a href="http://youtu.be/OFkgSjRnay4" target="_blank">a great one hour video tutorial</a> on Git. If you like traditional books, the <a href="http://book.git-scm.com/" target="_blank">Git Community Book</a> is probably the most authoritative, comprehensive and up-to-date guide, and it&#8217;s available for free (I had <a href="http://book.git-scm.com/3_basic_branching_and_merging.html" target="_blank">their chapter on branching and merging</a> bookmarked for many months when I was first learning this stuff).</p>
<p>I also have a printed copy of this <a href="http://byte.kde.org/~zrusin/git/git-cheat-sheet-large.png">Git Cheat Sheet</a> on my desk, and I find myself frequently looking up stuff at <a href="http://schacon.github.com/git/everyday.html">Everyday GIT with 20 Commands Or So</a>. I also found the <a href="http://sandofsky.com/blog/git-workflow.html">Git Workflow essay</a> by Benjamin Sandofsky a good introduction to basic workflow.</p>
<p>Update: The <a href="https://github.com/codeforamerica/skillshares/tree/master/git_basics" target="_blank">Git Basics Tutorial by CodeForAmerica/Skillshares</a> is really good for beginners as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/167/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>VIM Tip: Spaces in arguments</title>
		<link>http://riddhimandas.com/blog/154</link>
		<comments>http://riddhimandas.com/blog/154#comments</comments>
		<pubDate>Tue, 20 Mar 2012 03:15:31 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[GVim]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monaco]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=154</guid>
		<description><![CDATA[<p>I&#8217;ve been trying to switch to Vim from TextMate as my default text editor, and I&#8217;m constantly stumbling and learning in the process.</p> <p>One quirk I dealt with recently was spaces. Well, yeah, spaces.</p> <p>I liked using Monaco as my default font on TextMate and Xcode when I&#8217;m working on Python scripts or on iOS [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been trying to switch to Vim from TextMate as my default text editor, and I&#8217;m constantly stumbling and learning in the process.</p>
<p>One quirk I dealt with recently was spaces. Well, yeah, spaces.</p>
<p>I liked using Monaco as my default font on TextMate and Xcode when I&#8217;m working on Python scripts or on iOS apps, mainly because characters are distinct, and it is difficult to confuse 0 (figure zero) and O (uppercase O), or 1 (figure one) | (Vertical bar) I (uppercase i) and l (lowercase l) &#8211; which are all characters that occur a lot in programming. So I wanted to set it up as my default font on GVim on Ubuntu. <a href="http://www.gringod.com/wp-upload/MONACO.TTF" target="_blank">I got a copy of it</a> and installed it just fine, and set it as my font on GVim using the menu.</p>
<p>To make it my default font, I went ahead and opened my <em>.vimrc</em> file, and when I looked it up on GVim (using <em>set guifont?</em>), I saw this:</p>
<div id="attachment_155" class="wp-caption aligncenter" style="width: 258px"><a href="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215245.png"><img class="size-full wp-image-155" title="MonacoGuifont" src="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215245.png" alt="guifont = Monaco 11" width="248" height="92" /></a><p class="wp-caption-text">:set guifont?</p></div>
<p>Then I added the same line to my <em>.vimrc</em> as</p>
<div id="attachment_156" class="wp-caption aligncenter" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215711.png"><img class="size-medium wp-image-156" title="MonacoVimrcNoSpace" src="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215711-300x97.png" alt="MonacoVimrcNoSpace" width="300" height="97" /></a><p class="wp-caption-text">Incorrect vimrc settings</p></div>
<p>and it wouldn&#8217;t work. Whenever I started GVim, it would complain that it didn&#8217;t understand the <em>.vimrc</em> file.</p>
<p>After searching online and looking up a lot of forum posts, I learned that Vim does not recognize spaces in arguments. So I actually had to add a backslash (\) after the first word if I wanted vim to treat the next word as part of the same argument.</p>
<div id="attachment_158" class="wp-caption aligncenter" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215703.png"><img class="size-medium wp-image-158" title="MonacoSuccess" src="http://riddhimandas.com/wp-content/uploads/2012/03/Screenshot-at-2012-03-19-215703-300x105.png" alt="Monaco\ 11" width="300" height="105" /></a><p class="wp-caption-text">Correct .vimrc settings</p></div>
<p>And it worked!</p>
<p>Now I&#8217;ve been using it in more places where it&#8217;s appropriate. For example, if I have a long piece of text and I wanted to replace <em>apples</em> with <em>yellow oranges</em>, I could just do</p>
<pre><strong>:%s/apples/yellow\ oranges/g</strong></pre>
<p>and voila, every occurrence  of <em>apples</em> will be replaced with <em>yellow oranges</em>.</p>
<p>Maybe this will help another struggling Vim user someday!</p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/154/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Programming in academia vs industry</title>
		<link>http://riddhimandas.com/blog/130</link>
		<comments>http://riddhimandas.com/blog/130#comments</comments>
		<pubDate>Sun, 13 Nov 2011 03:09:15 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[programming in college]]></category>
		<category><![CDATA[programming in industry]]></category>
		<category><![CDATA[stackexchange]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=130</guid>
		<description><![CDATA[<p>I&#8217;ve programmed both in the academic setting and in industry. In college, I&#8217;ve been in research projects, directed readings with professors, developed apps and an autograder, and had a great experience doing so. I&#8217;ve also done programming in industry, actually worked on products that have shipped to users. Most of my work in industry has [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve programmed both in the academic setting and in industry. In college, I&#8217;ve been in research projects, directed readings with professors, developed apps and an autograder, and had a great experience doing so. I&#8217;ve also done programming in industry, actually worked on products that have shipped to users. Most of my work in industry has been either embedded systems programming or enterprise application programming.</p>
<p>A lot of people seem to think that programming in academia <strong><a href="http://techcrunch.com/2011/11/12/10-things-entrepreneurs-dont-learn-in-college/">isn&#8217;t real world programming</a></strong>. While I agree that four years programming in academia solving theoretical problems in C or Matlab isn&#8217;t going to make you a rockstar in implementing RESTful web services in Java or .NET, I do think the core programming skills and principles carry over nonetheless.</p>
<p>In this post, I would like to highlight some of the differences I&#8217;ve noticed in my experiences with both so far.</p>
<p>One of the major differences in my experience between the two domains has been guidance. If I&#8217;m stuck on something in college, even if this is as <em>trivial </em>as figuring out the best practices, I can bounce ideas off my professors, and they understand that I&#8217;m learning by doing and are usually accommodating. <strong>An elegant solution is preferred over a hacked together solution</strong>, and you are encouraged to learn best practices doing it.</p>
<p>Now, I&#8217;m not talking about a programming assignment for class here. I&#8217;m talking about projects done under the guidance of a faculty advisor.</p>
<p>My experience in industry tells me that the <strong>some product is better than no product</strong> rule takes precedence over anything else. If you cannot figure out the most elegant way to do something, hack something together to have a working solution. If time and budget permit, you may have a chance to later go back and fix it, although sometimes you may not. You may have a mentor assigned to you, but he&#8217;s busy doing his stuff and will usually try to point you to something, and if it doesn&#8217;t help, and you are on your own to <em>figure it out</em>. If you ask TOO MUCH, you&#8217;re probably a bad hire.</p>
<p>Another difference I&#8217;ve discovered is <strong>documentation (comments in code)</strong>. While programming in academia, if you do not document your code, someone&#8217;s going to get upset because they do not know the language you&#8217;re using and can&#8217;t figure out the algorithm, or just because you&#8217;re not following what has been taught in your courses. In industry, <em>regrettably</em>, no one has the time for extensive source code documentation. Maybe it&#8217;s just that I&#8217;m working under experienced professionals who know what the code does by just looking at ten lines out of a 500 lines class implementation, but such has been my experience. After all, were you hired to produce products and services or to write pre- and post-conditions for your methods?</p>
<p>I&#8217;m sure I&#8217;m not the only person who&#8217;s wished that this would change. For a developer, comments in source code are more helpful than external documentation any day.</p>
<p>Academic programming also tends to have evolving <strong>designs and architectures</strong>. Trial and error is better than something set in stone. A professor would rather work on an interesting problem than have meetings to discuss an architecture document. After all, wasn&#8217;t I supposed to have taken a software engineering class?</p>
<p>Programming in industry will <strong>always have written architecture, design and other documentation</strong>. If not, it&#8217;s probably not a real project.</p>
<p>I will admit that I&#8217;ve programmed more in an academic setting than in industry, but so far, I think there&#8217;s pros and cons with both, and both would do themselves a favor if they learned from each other.</p>
<p>&nbsp;</p>
<p>UPDATE: I also posted <a href="http://programmers.stackexchange.com/questions/119470/differences-between-programming-in-school-vs-programming-in-industry" target="_blank">this question on the stackexchange programmers</a> community, and I received some very interesting answers. Here are some of them:</p>
<hr />
<p>In a traditional undergraduate computer science program you learn just programming. But industry doesn&#8217;t want people who are just programmers, industry wants real software engineers. I know many job descriptions don&#8217;t seem to know the difference which only confuses the matter, but in the real world you need to be able to:</p>
<p>Gather and analyze requirements, when they aren&#8217;t directly given to you<br />
Design and analyze architecture, with near endless possibilities<br />
Create test plans and act on them, to evaluate and improve the quality of a system<br />
Work collaboratively on a team, of people with different backgrounds and experience levels<br />
Estimate and plan work, even if you don&#8217;t know exactly what to build<br />
Communicate effectively with stakeholders, who have different needs that don&#8217;t necessarily align<br />
Negotiate schedule, budget, quality, and features, without disappointing stakeholders</p>
<p>Oh yeah, and you also have to be able to write code too, but that&#8217;s, on average, only 40 &#8211; 60% of a software engineer&#8217;s time.</p>
<p>So, it&#8217;s not that freshly minted computer science undergrads don&#8217;t know how to program (many are in fact, very good programmers) &#8211; it&#8217;s that many of them don&#8217;t know how to do anything else!</p>
<hr />
<p>University</p>
<p>(I call this scenario university, because programming as an actual computer scientist is also different than what you do while studying)<br />
Your teacher gives you:</p>
<p>A well defined, isolated problem, the solution of which can be provided within a short and well defined time span and will be discarded afterward<br />
A well defined set of tools that you were introduced to prior to assignment<br />
A well defined measure for the quality of your solution, with which you can easily determine whether your solution is good enough or not</p>
<p>&#8220;Real World&#8221;</p>
<p>In this scenario:</p>
<p>The problem is blurry, complex and embedded in context. It&#8217;s a set of contradictory requirements that change over time and your solution must be flexible and robust enough for you to react to those changes in an acceptable time.<br />
The tools must be picked by you. Maybe there&#8217;s already something usable in your team&#8217;s 10 year old codebase, maybe there&#8217;s some open source project, or maybe a commercial library or maybe you will have to write it on your own.<br />
To determine whether the current iteration of your software is an improvement (because you&#8217;re almost never actually done in a software project), you need to do regression testing and usability testing, the latter of which usually means that the blurry, complex, contradictory, context-embedded requirements shift once again.</p>
<p>Conclusion</p>
<p>These things are inherently different to a point where there&#8217;s actually very little overlap. These two things work at to completely different levels of granularity. CS will prepare you for &#8220;real world&#8221; software development like athletics training would prepare an army for battle.</p>
<hr />
<p>Academia is mainly focused on the &#8220;science of programming&#8221; thus studying the way to make efficient particular algorithm or developing languages tailored to make certain paradigms more expressive. Industry is mainly focused in producing things that have to be sold. It has to rely on &#8220;tools&#8221; that are not only the languages and the algorithms, but also the libraries, the frameworks etc.</p>
<p>This difference in &#8220;focus&#8221; is what makes a academic master in C practically unable to write a windows application (since we windows API are not in the C99 standard!), thus feeling as it is &#8220;unable to program&#8221;. But, in fact, he has all the capabilities to learn itself what he&#8217;s missing. Something that -without proper academic studies (not necessarily made in Academia)- is quite hard to find.</p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/130/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>How to set up Maven/Tomcat to build &amp; run &amp; debug through IntelliJ</title>
		<link>http://riddhimandas.com/blog/111</link>
		<comments>http://riddhimandas.com/blog/111#comments</comments>
		<pubDate>Sun, 06 Nov 2011 00:43:28 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[IDEA]]></category>
		<category><![CDATA[IntelliJ]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=111</guid>
		<description><![CDATA[<p>I work from home for a company where we write enterprise Java web applications using <a href="http://www.springsource.org/">Spring</a>, <a href="http://www.hibernate.org/">Hibernate</a> for <a href="http://tomcat.apache.org/">Tomcat</a> and use <a href="http://maven.apache.org/">Maven</a>. A couple of months ago, when I started working from home, my manager agreed to buy me a copy of <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a> so I could be more productive [...]]]></description>
				<content:encoded><![CDATA[<p>I work from home for a company where we write enterprise Java web applications using <a href="http://www.springsource.org/">Spring</a>, <a href="http://www.hibernate.org/">Hibernate</a> for <a href="http://tomcat.apache.org/">Tomcat</a> and use <a href="http://maven.apache.org/">Maven</a>. A couple of months ago, when I started working from home, my manager agreed to buy me a copy of <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a> so I could be more productive than when I was when I was using <a href="http://www.eclipse.org/">Eclipse </a>(which is an IDE I love and still use for other projects, but is also a memory hog).</p>
<p>While I have been using IntelliJ for sometime now, I haven&#8217;t had a lot of success in configuring Tomcat to run through the IDE. I followed <a href="http://www.jetbrains.com/idea/webhelp/run-debug-configuration-tomcat.html">the steps on the official help page</a>, but it didn&#8217;t seem to work with my Maven project. So I added a configuration descriptor to Tomcat to load the target directory of my Maven project each time it loads and when I want to run my code, I produce an exploded war through IntelliJ and then run Tomcat externally.</p>
<p>When I had to debug my code, I would print out debugging statements which would help me narrow down the places in my code where the bug was, and then I would just inspect it manually. Not really the best way to debug code, but I really didn&#8217;t have the time to integrate Tomcat into IntelliJ.</p>
<p>Last night, I had a NullPointerException in a Java Spring project I&#8217;ve been working on for a couple of months now, and this approach didn&#8217;t work, and I set out to integrate Tomcat with IntelliJ once and for all.</p>
<p>When I had first tried to integrate Tomcat with IntelliJ, I had followed <a href="http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_and_deploying_it_to_Tomcat">the steps on the Jetbrains Wiki</a> and that worked just how it was described, but when I tried to run or debug my Maven project through IntelliJ, it just would not work.</p>
<p>After a lot of Googling and Binging *wink*, I had found no single source that explained how this should be done, and I spent a major part of last night just playing with different combinations of the different settings and was finally able to set it up correctly (I hope). Now, I am able to run and debug Maven projects directly through Tomcat and trust me, life is better.</p>
<p>I&#8217;m not sure if there&#8217;s other people who&#8217;ve been through the same experience as I have, so I&#8217;ve decided to put together this guide. Hope someone who is in the same position as I was yesterday will get something out of it.</p>
<p>1. Add your Tomcat configuration to IntelliJ through Settings -&gt; Application Servers -&gt; Add. Both<em> Tomcat Home</em> and <em>Tomcat Base Directory</em> should be set to your tomcat installation directory (e.g. C:\Tomcat6.0.33)</p>
<div id="attachment_112" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/Tomcat6Added.png"><img class="size-medium wp-image-112" title="Adding Tomcat 6 to IntelliJ Settings" src="http://riddhimandas.com/wp-content/uploads/2011/11/Tomcat6Added-300x209.png" alt="Adding Tomcat 6 to IntelliJ Settings" width="300" height="209" /></a><p class="wp-caption-text">Adding Tomcat 6 to IntelliJ Settings</p></div>
<p>2. Add a <em>Run/Debug Configuration</em> to your IntelliJ project.</p>
<div id="attachment_113" class="wp-caption alignnone" style="width: 170px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/EditConfiguration.png"><img class="size-full wp-image-113" title="Edit Run/Debug Configuration" src="http://riddhimandas.com/wp-content/uploads/2011/11/EditConfiguration.png" alt="Edit Run/Debug Configuration" width="160" height="96" /></a><p class="wp-caption-text">Edit Run/Debug Configuration</p></div>
<p>3. Click the + and add a new Tomcat local default configuration. Give it a name and you can have it start your browser automatically and go to a startup page.</p>
<div id="attachment_114" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/NewConfiguration.png"><img class="size-medium wp-image-114" title="New Tomcat Configuration" src="http://riddhimandas.com/wp-content/uploads/2011/11/NewConfiguration-300x178.png" alt="New Tomcat Configuration" width="300" height="178" /></a><p class="wp-caption-text">New Tomcat Configuration</p></div>
<p>4. On the <em>Before Launch</em> frame, check <em>Make</em>.</p>
<div id="attachment_115" class="wp-caption alignnone" style="width: 117px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/BeforeLaunchMake.png"><img class="size-full wp-image-115" title="Before Launch Make" src="http://riddhimandas.com/wp-content/uploads/2011/11/BeforeLaunchMake.png" alt="Before Launch Make" width="107" height="61" /></a><p class="wp-caption-text">Check Make</p></div>
<p>5. Click the ellipses (&#8230;.) button next to <em>Build Artifact</em> and check<em> exploded war</em>.</p>
<div id="attachment_116" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/exploded-war-build.png"><img class="size-medium wp-image-116" title="Exploded war Build" src="http://riddhimandas.com/wp-content/uploads/2011/11/exploded-war-build-300x194.png" alt="Exploded war Build" width="300" height="194" /></a><p class="wp-caption-text">Exploded war Build</p></div>
<p>6. Similarly for Maven, click the ellipses (&#8230;) button next to<em> Run Maven Goal</em> and select <em>package</em>.</p>
<div id="attachment_117" class="wp-caption alignnone" style="width: 289px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/MavenPackage.png"><img class="size-medium wp-image-117" title="Maven Package" src="http://riddhimandas.com/wp-content/uploads/2011/11/MavenPackage-279x300.png" alt="Maven Package" width="279" height="300" /></a><p class="wp-caption-text">Maven Package</p></div>
<p>7. On the <em>Deployment</em> tab, in the<em> Deploy at Server Startup</em> section, add a new Exploded war Artifact.</p>
<div id="attachment_118" class="wp-caption alignnone" style="width: 273px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/DeployServerStartup.png"><img class="size-medium wp-image-118" title="Deploy at Server Startup" src="http://riddhimandas.com/wp-content/uploads/2011/11/DeployServerStartup-263x300.png" alt="Deploy at Server Startup" width="263" height="300" /></a><p class="wp-caption-text">Deploy at Server Startup</p></div>
<p>(Steps below show how to configure the IntelliJ debugger to connect to Tomcat)</p>
<p>8. On the <em>Startup/Connection</em> tab, Select <em>Debug</em> from the left pane and set the port to <em>8000</em>.</p>
<div id="attachment_119" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/DebugPort.png"><img class="size-medium wp-image-119" title="Debug Port" src="http://riddhimandas.com/wp-content/uploads/2011/11/DebugPort-300x130.png" alt="Debug Port" width="300" height="130" /></a><p class="wp-caption-text">Set Debug Port</p></div>
<p>9. Create two new environment variables (Directions here for <a href="http://www.cyberciti.biz/faq/set-environment-variable-linux/">*nix</a> and <a href="http://support.microsoft.com/kb/310519">Windows</a>)</p>
<pre>JPDA_ADDRESS=8000
JPDA_TRANSPORT=dt_socket</pre>
<p>And you&#8217;re set. Now when you click <em>Run</em> or <em>Build</em>, you should see maven packaging the project and work it&#8217;s &#8216;magic&#8217;, and then Tomcat should run with the new app!</p>
<div id="attachment_121" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/11/Maven-Build.png"><img class="size-medium wp-image-121" title="Maven Build" src="http://riddhimandas.com/wp-content/uploads/2011/11/Maven-Build-300x46.png" alt="Maven doing its magic" width="300" height="46" /></a><p class="wp-caption-text">Maven doing its magic</p></div>
<p>While now it seems simple, this was not at all intuitive when I was first tried to set all this up. But now that I have got this set up, my workflow is a lot improved and I can go back to focusing on the code!</p>
<p>Alternatively, if you wanted to run your project outside of IntelliJ, you can put a configuration descriptor into your <em>tomcat/conf/Catalina/localhost </em>directory to automatically look in a directory and deploy it every time it starts. For my QEF project, I have a file <em>qef.xml</em> that looks like this:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Context <em>docBase</em>="/programming/appQef/target/qef"&gt;
    &lt;Manager className="org.apache.catalina.session.PersistentManager" maxInactiveInterval="600" saveOnRestart="false"/&gt;
    &lt;ResourceLink name="jdbc/qef" global="jdbc/qef" type="javax.sql.DataSource" /&gt;
    &lt;ResourceLink global="config/machine" name="config/machine" type="java.lang.String"/&gt;
    &lt;ResourceLink global="config/envType" name="config/envType" type="java.lang.String"/&gt;
    &lt;ResourceLink global="config/envLocation" name="config/envLocation" type="java.lang.String"/&gt;
&lt;/Context&gt;</pre>
<p>Now whenever I want to execute my program, I build an exploded war through IntelliJ and start Tomcat, which looks for the exploded war in the given directory and automatically deploys it.</p>
<p>Thanks to <a href="http://vinetoolkit.org/content/intellij-idea-tomcat-gridsphere">this</a> and <a href="http://mattfleming.com/node/281">this</a>, I was able to figure it all out. Thanks Matt and Piotr!</p>
<p>Hope this will help somebody out as well. <img src='http://riddhimandas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/111/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>WritingBuddy Screenshots</title>
		<link>http://riddhimandas.com/blog/52</link>
		<comments>http://riddhimandas.com/blog/52#comments</comments>
		<pubDate>Sun, 23 Oct 2011 04:33:54 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[WritingBuddy]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=52</guid>
		<description><![CDATA[<p>Here are some screenshots of <a href="http://itunes.apple.com/us/app/writingbuddy/id418705304">WritingBuddy</a>, available for iOS devices (iPhone, iPod, iPad).</p>]]></description>
				<content:encoded><![CDATA[<p>Here are some screenshots of <a href="http://itunes.apple.com/us/app/writingbuddy/id418705304">WritingBuddy</a>, available for iOS devices (iPhone, iPod, iPad).</p>
<div id="attachment_57" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.vtdrihjm.320x480-75.jpg"><img class="size-medium wp-image-57" title="WritingBuddy5" src="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.vtdrihjm.320x480-75-300x200.jpg" alt="WritingBuddy Contacts Screen" width="300" height="200" /></a><p class="wp-caption-text">WritingBuddy Contacts Screen</p></div>
<div id="attachment_56" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.ufhpeydf.320x480-75.jpg"><img class="size-medium wp-image-56" title="WritingBuddy4" src="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.ufhpeydf.320x480-75-300x200.jpg" alt="WritingBuddy Backend Access Screen" width="300" height="200" /></a><p class="wp-caption-text">WritingBuddy Backend Access Screen</p></div>
<div id="attachment_55" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.syrwvdud.320x480-75.jpg"><img class="size-medium wp-image-55" title="WritingBuddy3" src="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.syrwvdud.320x480-75-200x300.jpg" alt="WritingBuddy Options Screen" width="200" height="300" /></a><p class="wp-caption-text">WritingBuddy Options Screen</p></div>
<div id="attachment_54" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.cvtcdvdr.320x480-75.jpg"><img class="size-medium wp-image-54" title="WritingBuddy2" src="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.cvtcdvdr.320x480-75-300x200.jpg" alt="WritingBuddy Typing Screen" width="300" height="200" /></a><p class="wp-caption-text">WritingBuddy Typing Screen</p></div>
<div id="attachment_53" class="wp-caption alignnone" style="width: 310px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.bhkbepbt.320x480-75.jpg"><img class="size-medium wp-image-53" title="WritindBuddy1" src="http://riddhimandas.com/wp-content/uploads/2011/10/mzl.bhkbepbt.320x480-75-300x200.jpg" alt="WritingBuddy Typing Screen" width="300" height="200" /></a><p class="wp-caption-text">WritingBuddy Typing Screen</p></div>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/52/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paigow Screenshots</title>
		<link>http://riddhimandas.com/blog/34</link>
		<comments>http://riddhimandas.com/blog/34#comments</comments>
		<pubDate>Sun, 23 Oct 2011 04:08:35 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[Paigow]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=34</guid>
		<description><![CDATA[<p>Here are some screenshots of Paigow (full version), available for iOS devices (iPhone, iPod, iPad).</p> <p>The graphics for this game were created with the help of Ayushman Das, my 13 year old brother!</p>]]></description>
				<content:encoded><![CDATA[<p>Here are some screenshots of Paigow (full version), available for iOS devices (iPhone, iPod, iPad).</p>
<div id="attachment_35" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/11.jpg"><img class="size-medium wp-image-35" title="Paigow1" src="http://riddhimandas.com/wp-content/uploads/2011/10/11-200x300.jpg" alt="Paigow Game Play" width="200" height="300" /></a><p class="wp-caption-text">Paigow Game Play</p></div>
<div id="attachment_36" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/21.jpg"><img class="size-medium wp-image-36" title="Paigow2" src="http://riddhimandas.com/wp-content/uploads/2011/10/21-200x300.jpg" alt="Paigow Tutor" width="200" height="300" /></a><p class="wp-caption-text">Paigow Tutor</p></div>
<div id="attachment_37" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/31.jpg"><img class="size-medium wp-image-37" title="Paigow3" src="http://riddhimandas.com/wp-content/uploads/2011/10/31-200x300.jpg" alt="Paigow Gameplay with Hints" width="200" height="300" /></a><p class="wp-caption-text">Paigow Gameplay with Hints</p></div>
<div id="attachment_38" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/41.jpg"><img class="size-medium wp-image-38" title="Paigow4" src="http://riddhimandas.com/wp-content/uploads/2011/10/41-200x300.jpg" alt="Paigow Four Player Gameplay" width="200" height="300" /></a><p class="wp-caption-text">Paigotr Four Player Gameplay</p></div>
<p>The graphics for this game were created with the help of Ayushman Das, my 13 year old brother!</p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/34/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Paigow Lite Screenshots</title>
		<link>http://riddhimandas.com/blog/31</link>
		<comments>http://riddhimandas.com/blog/31#comments</comments>
		<pubDate>Sun, 23 Oct 2011 04:03:54 +0000</pubDate>
		<dc:creator>rdasxy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[Paigow]]></category>

		<guid isPermaLink="false">http://riddhimandas.com/?p=31</guid>
		<description><![CDATA[<p>Here are some screenshots of Paigow Lite, available for iOS devices (iPhone, iPod, iPad).</p> <p>&#160;</p> <p>The graphics for this game were created with the help of Ayushman Das, my 13 year old brother!</p>]]></description>
				<content:encoded><![CDATA[<p>Here are some screenshots of Paigow Lite, available for iOS devices (iPhone, iPod, iPad).</p>
<div id="attachment_22" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/1.jpg"><img class="size-medium wp-image-22" title="PaigowLite1" src="http://riddhimandas.com/wp-content/uploads/2011/10/1-200x300.jpg" alt="Game Play in Paigow Lite" width="200" height="300" /></a><p class="wp-caption-text">Paigow Lite Gameplay</p></div>
<p>&nbsp;</p>
<div id="attachment_23" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/2.jpg"><img class="size-medium wp-image-23" title="PaigowLite2" src="http://riddhimandas.com/wp-content/uploads/2011/10/2-200x300.jpg" alt="Paigow Lite Help Tile" width="200" height="300" /></a><p class="wp-caption-text">Paigow Lite Help Tile</p></div>
<div id="attachment_24" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/3.jpg"><img class="size-medium wp-image-24" title="PaigowLite3" src="http://riddhimandas.com/wp-content/uploads/2011/10/3-200x300.jpg" alt="Paigow Lite in Game Hints" width="200" height="300" /></a><p class="wp-caption-text">Paigow Lite in Game Hints</p></div>
<div id="attachment_25" class="wp-caption alignnone" style="width: 210px"><a href="http://riddhimandas.com/wp-content/uploads/2011/10/4.jpg"><img class="size-medium wp-image-25" title="PaigowLite4" src="http://riddhimandas.com/wp-content/uploads/2011/10/4-200x300.jpg" alt="Paigow Lite Gameplay" width="200" height="300" /></a><p class="wp-caption-text">Paigow Lite Gameplay</p></div>
<p>The graphics for this game were created with the help of Ayushman Das, my 13 year old brother!</p>
]]></content:encoded>
			<wfw:commentRss>http://riddhimandas.com/blog/31/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
