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>

Exception Handling in Spring MVC

Here is one good and easy way to do it
First of all We should create a user defined exception class

public class MyExceptionClass extends RuntimeException {
private String userMessage = "User message not set";

public MyExceptionClass() {
super();
}

public MyExceptionClass(String userMessage, Throwable cause) {
super(cause);
this.userMessage = userMessage;
}

public MyExceptionClass(String userMessage) {
super(userMessage);
this.userMessage = userMessage;
}

public MyExceptionClass(Throwable cause) {
super(cause);
userMessage = cause.getMessage();
}

public String getUserMessage() {
return userMessage;
}

public void setUserMessage(String userMessage) {
this.userMessage = userMessage;
}

@Override
public String toString() {
return "User message = " + userMessage + "\n" + super.toString();
}
}

Next step is to configure exception handling in application context file

<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="MyExceptionClass">error</prop>
<prop key="java.lang.Exception">error</prop>
</props>
</property>
</bean>

Tuesday, March 8, 2011

Commandos Windows 7 64 bit

Struggled to get this to work properly but found some solutions that might be helpful. I'm running Windows 7 64 bit.

1)
To get it to save, obviously run the comandos.reg to modify the registry. Then what you need to do it add the following three lines to Comando.cfg in the OUTPUT folder:

.SIZE [ .INITSIZE 3 ]
.PROFILE [ .USER 0 ]
.DEVELOP 1

After doing that my saving and loading works perfectly.

2)
To get the game to run at the proper speed (the fast speed doesn't really bother me too much, but here's the solution nonetheless), download Advanced Game Loader from here: http://www.sven-of-nine.de/site/doku.php/downloads

Then run that program and go Options -> Add Game to create a new entry for Commandos. Then in the options tab add the Commandos execuable (e.g. C:\Games\Commandos\Commandos.exe) and then at the bottom there's a ticker to choose by how much you want to slow down the CPU. This value will obviously depend on your CPU but it should be easy to get a nice value with a bit of fiddling.

Tuesday, January 11, 2011

Test Oracle Stored procedures

Testing proc with input and output variables.

declare
outVar1 varchar2(20);
outVar2 varchar2(100);
begin
PKG_NAME.PROC_NAME('INPUT1', 'INPUT2', outVar1 , outVar2);
dbms_output.put_line('outVar1-->'||outVar1);
dbms_output.put_line('outVar2-->'||outVar2);
end;
/