Monday, June 4, 2012

Google appengine


I have Always been a fan of Google applications, when Google started appengine few years ago I was very excited, the only problem was that it supported python and I was not much familiar with python. Within a year while I was leaning python GAE started supporting java.
The features and services provided were tempting enough for a developer like me to jump in right away. I started using it for one of my website, migrated it from php to java and while I was doing that it was always in my mind that the code is becoming increasingly coupled to gae, but I was stupid and lazy to write the code smart enough that could avoid the trap.

Thursday, December 1, 2011

Could not initialize class com.ibm.rational.team.client.ui.model.common.ImageManager

An error has occurred. See error log for more details.Could not initialize class com.ibm.rational.team.client.ui.model.common.ImageManager, If you also got stuck in this thing then here is the solution.
Start eclipse with -clean option it works fine.

Thursday, September 29, 2011

Save the best

Even though we may be unaware of it but most of us have this tendency - to save the best. I recall my school days when I was very much into western music I used to collect and maintain a decent collection of music tapes.
In those times where Hindi music cassettes used come for 22Rs English cassettes used to cost over a 100Rs, even though this luxury was quite beyond my reach I still used to save for it and buy my fav ones, The bigger problem in those days was that you have so many friends and if they know that you have all this great stuff it goes into a circulation with no return guarantee. On the other hand I used to love my music so much that sometimes with the fear of a tape may go bad, I used to first make a copy of it and then listen the copy.
Eight years ago, one day I left my hometown looking for a job in Delhi, I still remember that day clearly that I could feel my baggage and how I have no option but to shed some of the load of it in order to move ahead, it was a very sad day of my life as all the feelings that were coming while leaving my town I was also feeling down that I will never be able to use my stuff ever again, two box full of rare oldies music - and my bag was too small to carry the boxes along.
Each day life keeps becoming complex and busier, and these old memories and hobbies keep fading.
Bangalore is a place with heavy traffic on roads, my 14Km office commute take over an hour, I usually watch movies and TV serials in bus, This let to another hobby of watching movies and TV series.
Within a short span of less than a year I watched hundreds of good movies and download over 3 TB movies on my machine.
Last week I was thinking of buying a new Disk to accommodate more movies and this is when I again felt the same thing about music tapes - That even though it is going fine for the time being will I have enough time in future to enjoy what I am collecting. I don't have an answer to this and so this leads to that instead of buying a new disk I should delete the movies that I have already seen and free up space.

Tuesday, June 28, 2011

When we bought our first car.

Last month I bought a car, even though I did a lot of research on the internet about the various options that were in my budget limit it was still a difficult task to finally select a model.
Our primary reason to buy a car was that my wife was finding it difficult to commute in the thickly populated BMTC busses. The first thing that went through my head was that since she is not a experienced driver she might find it difficult to drive in Bangalore traffic so it would be a good idea to buy a second hand car as it won't pain that much if it gets few scratches or dents.
We went to a send hand car dealer in JP Nagar and we discovered that second hand cars in Bangalore are very expensive for instance a new Alto costs ~ 3.20 L while a 2007 model Alto costs 2.20 L and the same was seen with other cars like Wagon R, Hyundai etc.
We then decided to buy a new car, the thought that my wife is a beginner when it comes to driving still kept us on the track that we should not be spending too much on our first car. We decided to have a Tata Nano test drive, we went to a Tata showroom and saw Nano, when we sat in this car it was awesome, it feels spacious and the car is really good, the sales guy told us that the test drive car is gone to some place and that we can book a test drive and he can get the car at our place for a test drive, The same day after leaving from there we went for Maruti Showroom and had a look at Alto, Alto was much better the only issue was that it was costing almost as much as Wagon R ( ~4L ), we had a wagon r test drive and liked it we also booked it the same day. With Petrol prices touching 72 we discussed at home that when we are spending something like 4.5L why not try to get a Diesel car instead.
We had a look at Swift and Ritz, no one can "not like" Swift and Ritz was good but the speedometer and dashboard didn't look like a 6 L car to me, and we finalized Swift Diesel.
The only problem this time was that the waiting time was around 4 months. We thought of having a check at other dealers if someone has a lower waiting period, we found one where some one had just canceled his Swift Dzire Diesel version and even though it was slightly out of our reach we borrowed some money from family to get this car.
It has been one month now, I am 100% satisfied with this car.

Sunday, June 26, 2011

Spring 3 BlazeDS Google AppEngine Integration


I am finally able to get this thing working, this is how it can be done.

1. Follow what Martin's blog says about this issue.
2. You can take reference from my code .

Spring 3 Blazeds Integration.

This weekend I wanted to learn how to integrate Spring and Blazeds and test it using SoapUI.
Ok, before you get started the you need to make sure that you have the following softwares properly installed on your machine.
Java SDK 6, Maven 2.2, Eclipse Helios - (Plugins that I have installed are subeclipse, m2, ), SoapUI, Tomcat 6.

1. Create a Web Project
Open command prompt and type.

mvn archetype:create -DgroupId=org.example.webapp -DartifactId=example-webapp -DarchetypeArtifactId=maven-archetype-webapp

maven has created a simple web application, now we need create few eclipse files so that we can easily import this project in eclipse.

mvn -Dwtpversion=2.0 eclipse:eclipse

Next we have to import this project in eclipse.


Wednesday, June 22, 2011

Create Aspects in Spring for Logging DAO response time

Step One: Create a System architecture class which defines which methods to pointcut

@Aspect
public class SystemArchitecture {

/**
* Service Layer Aspect.
*/
@Pointcut("within(com.service..*)")
public void inServiceLayer() {

}

/**
* Service Implementation layer aspect.
*/
@Pointcut("execution(* com.service..*.*(..))")
public void businessService() {

}

/**
* DAO Layer aspect.
*/
@Pointcut("execution(* com.dao..*.*(..))")
public void dataAccessOperation() {

}
}

Step two: Create a Tracing Aspect class which contains the actual code that is executed at the point cuts

@Aspect
public class TracingAspects {

/**
* Around advice to log method entry and exits. Logs at TRACE level
*
* @param pjp ProceedingJoinPoint
* @return Object
* @throws Throwable if aspect throw any exception
*/
@Around("com.util.SystemArchitecture.dataAccessOperation()")
public Object traceMethodEntryExit(ProceedingJoinPoint pjp) throws Throwable {
Log log = LogFactory.getLog(pjp.getTarget().getClass());

MethodSignature mthdSignature = (MethodSignature) pjp.getSignature();
log.debug("Entering method " + mthdSignature.getName());

try {
return pjp.proceed();
} finally {
log.debug("Exiting method " + mthdSignature.getName());
}

}

/**
* round advice to log method execution time. Logs at DEBUG level
*
* @param pjp ProceedingJoinPoint
* @return Object
* @throws Throwable if aspect throw any exception
*/
@Around("com.util.SystemArchitecture.dataAccessOperation()")
public Object perfTrace(ProceedingJoinPoint pjp) throws Throwable {
Log log = LogFactory.getLog(pjp.getTarget().getClass());

MethodSignature mthdSignature = (MethodSignature) pjp.getSignature();
long startTime = System.currentTimeMillis();

try {
return pjp.proceed();
} finally {
long elapsedTime = System.currentTimeMillis() - startTime;
log.debug("Method " + mthdSignature.getName() + " took " + elapsedTime + "ms");
}

}


Step Three: Enable AOP in Spring configuration


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

<aop:aspectj-autoproxy proxy-target-class="true"/>
<bean id="tracingAspects" class="com.util.TracingAspects"/>
</beans>