Spiritual Java

Spiritual java is an attempt to let me express my thoughts, my ideas, my views and my feelings about two topics which are very close to my heart. Vippasana and Java!!! I have been practicing Vipassana for more than 8 years now and in all these years the way this teqnuqie helped me in overcoming many ups and downs in my life is quite remarkable. Java on the other hand is my source of my materialistic existence. So I'll be sharing my views on J2EE technology and its relevance in web.

Monday 28 December 2009

Important tips for IT contracting

Anyone who is planning to do IT contracting should do a little bit of research. This site gives some basic tips and tricks about IT contracting in UK
http://www.bytestart.co.uk/content/contractors/index.shtml


Information about IT Contract Rates can be found from these resources:
ITJobswatch:This is a handy site which provides high level data for key roles (such as Analysts, Developers) as well as specific skill sets (e.g. Oracle, UNIX, Java, .NET)
Jobstats: Jobstats has provided data extracted from the major job search engines for many years now. This site paints a general picture of the state of the IT Contracting market - including average market rates.

In addition, the following sites also provide data on pay rates in the IT arena:
E-Skills - Skills site, also provides training and salary information.
Contract Eye - This one is a dedicated IT Contractor site, with a dedicated channel on IT contractor rates


Next task is to write a good and to the point CV. This one explains it best http://www.bytestart.co.uk/content/contractors/contractor-guides/it-contractors-cv.shtml
            

Wednesday 23 December 2009

Saturday 19 December 2009

Java concepts


This post contains the compilation of some of the most popular java design questions that every java developer should be aware of.

  • ThreadLocal explained in Detail.
This is a very well written article that explains the use of ThreadLocal with example

  • Why multiple inheritance is not for java?
This question come to any developer's mind who has worked in C++. This is a very nice article that explains exactly this.

http://www.javaworld.com/javaqa/2002-07/02-qa-0719-multinheritance.html


  • Diamond shape problem solved.
How multiple inheritance is achieved in java with the help of interfaces.



  • What is the difference b/w weak and soft references?


  • Static Factory pattern example: class instance which is created at the time of Static member initialization. This Factory always returns this instance.
http://alexmcferron.com/staticFactory.html

  • Static method Pattern example: This pattern is just a style of decoupling object initialization from the client code. It always returns a new class instance.


Monday 5 October 2009

An inspirational interview from Hrithik Roshan

This is another deviation from my normal posts. I just saw a talk show on youtube and thought it is worth keeping this in my compilation of posts. So here it is... A little preface, we all know Kritik Roshan. A Bollywood superstar who has delivered hits like Koi Mil gaya, Kaho na pyar hai, Dhoom 2 and Lakshya to name a few. From the energetic performance and the kind of dance that he do, a few people would know at one time he had twisted spine problem and stammering problem.
Kritik Roshan is one of the few Bollywood superstars who made his life's adversity as an opportunity. From birth he was born with bundles of problems; stammering problem, spinal problem; born with double thumb and all the emotional and social pressure that these problems brings with them. From the state of such an adversity to the current state of being a Bollywood star is some journey in itself.

This interview in itself captures the essence that if you wish something in life and you are determined to do it, then nothing is impossible. An old saying is true..."Nothing is impossible, even impossible say I'm possible"
Just to keep in mind that this interview is majority in Hindi language. What I really liked in this interview compared to others is that its not treated as just another celebrity talk show. It would be worth watching the last part of the video in which a physically challenged  girl plays a very good music composition.

Part 1. In this Kritik talks about his stammering problem and how he showed determination to overcome that weakness...




Part 2. Continues further with the introduction of another Bollywood celebrity Kangana Ranaught...




Part 3. Kritik and Kangana plays some fun games...




Part 4. In this part the physically challenged girl plays the musical composition...

Saturday 3 October 2009

"Letters from Mara..."

Few days back Vikas Ji shared an inspirational Article(sent to him from Prof Dhar) with Delhi Vipassana group meditators.
Got some time today and read it. Found it very interesting and engaging.
The article "Letters from Mara" has got 10 letters in it. The article is taken by Buddha's one of the Sutta's.
Each of the letters is written by Mara to its squadrons namely desires, craving, lust, boredom,...(the impurities in the mind).
Thought of something to be shared. http://bit.ly/1AkHrR

Thursday 1 October 2009

Deploying Simple Hellworld lift webapp on Google App Engine




In the previous post we deployed the sample HelloWorld lift app on tomcat. In this post we will take one step further and go ahead with our lift helloworld webapp and deploy it on Google App engine.
From whatever I have read on different blogs, lift framework 1.0 support seems unavailable on GAE. But in milestone 1.1 there seems to be a limited support for it. With the future release lift may become fully compatible with GAE.
So for this example we will deviate from our 1.0 version to 1.1-M4 version.


Steps to do the initial maven setup remain same as with the previous post.
 
Ok, lets get started; first go to your workspace and type in the following maven command

mvn archetype:generate -U \-DarchetypeGroupId=net.liftweb \-DarchetypeArtifactId=lift-archetype-blank \-DarchetypeVersion=1.1-M4 \-DremoteRepositories=http://scala-tools.org/repo-releases \-DgroupId=demo.helloworld \-DartifactId=helloworld \-Dversion=1.0-SNAPSHOT



Once executed it will dispaly a list of outputs in verbose mode. At one or two places you may be prompted, just press enter.


Go to the project directory.
suresh-sharmas-macbook-pro:Projects sureshsharma$ cd helloworld
suresh-sharmas-macbook-pro:helloworld sureshsharma$ ls
pom.xml src
suresh-sharmas-macbook-pro:helloworld sureshsharma$


Packaging of the scr code to the war file can be done with maven's package command. Staying at /Projects/helloworld/ folder give the following command
suresh-sharmas-macbook-pro:helloworld sureshsharma$mvn package


This will create a war file in /Projects/helloworld/target/helloworld-1.0-SNAPSHOT.war


To deploy the war locally, go to the helloworld project directory. Maven comes in with inbuilt jetty and tomcat plugin so give the following command for tomcat deploy the app using tomcat plugin for maven.


suresh-sharmas-macbook-pro:helloworld sureshsharma$ mvn tomcat:run


Ok now coming back to GAE deployment, the first step for Deployment of war file to GAE is to install the google app engine SDK for java. You can download it from here.
Unzip the files in a folder say /usr/local/appengine-java-sdk-1.2.5/


Now for preparing the war file to be deployed in GAE, first go to /Projects/helloworld/src/main/webapp/WEB-INF folder. Their you will see web.xml file. For GAE deployment we need to create another appengine-web.xml file and add the following entries in it.

<?xml version="1.0" encoding="utf-8"?>
 <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
 <application>surylifting</application>
 <version>3</version>
 <system-properties>
   <property name="in.gae.j" value="true" />
 </system-properties>
 <sessions-enabled>true</sessions-enabled>
 <static-files>
   <exclude path="/**" />
 </static-files>
</appengine-web-app>



Change application name with the name of your registered application id in GAE, in my case it is surylifting.
Now first we will deploy GAE locally and then if everything goes fine we will deploy it to GAE.
Staying at /Projects/helloworld/ give the following command 


suresh-sharmas-macbook-pro:helloworld sureshsharma$/usr/local/appengine-java-sdk-1.2.5/bin/dev_appserver.sh /Projects/helloworld/target/helloworld-1.0-SNAPSHOT

Note that .war extension is not present above for helloworld-1.0-SNAPSHOT

And here u go u will be able to see it running at http://localhost:8080/


Now finally to deploy this app on GAE give the following command


suresh-sharmas-macbook-pro:helloworld sureshsharma$/usr/local/appengine-java-sdk-1.2.5/bin/appcfg.sh update /Projects/helloworld/target/helloworld-1.0-SNAPSHOT


again note that helloworld-1.0-SNAPSHOT is without .war extension


Once the deployment starts  you will be prompted for email id and password with which you registered on app engine. Once deployment is done you are ready to see you helloworld app on GAE.


Click on the http://surylifting.appspot.com and you will see my application deployed there. Simple :-)


Tuesday 29 September 2009

Installing tomcat in Mac OSX leopard

Found an interesting link for installing Tomcat on Mac OSx. Hope you will find it useful. This post gives details instructions to install the tomcat. Have a look at it.
http://www.malisphoto.com/tips/tomcatonosx.html