Thursday, April 28, 2011

Setting up a Development Environment - JEE

Recently i had to configure a development environment for a new project. Since it is interesting thought of posting it here.

Tools, etc used

This project is build using Maven with AppFuse. AppFuse is great to develop web application using java. With Maven its amazing. We used Struts 2,Spring, Hibernate. Since there is Maven pluging for AppFuse you can create a simple application in a minute. Also there are very good design pricipals they have used. Ether you can just use it or you can modify it. Struts 2 magic with Maven and Appfuse

Since the company having few issues with the CVS they decided to go with SVN for this new project. Intalling svn is not a big deal. Follow the steps here (SVN on CentOS). Some of the useful SVN commands also in there. Then you can add your project to it.

TeamCity used as the Continuous Integration server. Again this is also very easy thaks to jetbrains. Just download it and run the "runAll" script.
After installation you have to add projects to it. For that you can use the TeamCity Documentation. You have set your build tool (Maven/Ant,etc) and Version control system (SVN,CVS) and set build triggers.

Thursday, August 12, 2010

Debugging techniques

Here are some debugging techniques which will be help full for java buddies.

1st the basic one putting system outs. This is not a good practice but if you don’t have any other way to check it then this might be the only option. But the most important thing is make sure to remove these system outs in the production code.

2nd instead of system outs you can use a logging tool like log4J. Using its functionalities you can put debug level logs and check the logging files. Here if you use good pattern for logging you can find all most all information you want to know. Like Class, line number, time and others.

3rd debug using the IDE. This will help to identify how the code works for each different scenario which you can do with your system. There are lots of features available to understand the behavior of the code. But some times you might have a problem if you are dealing with a multi-thread application. Because if different thread access you debugging point; you might be disconnected or mislead by it. So in those cases 2nd approach will be helpful. You can find more information related to this in your favorite IDE related documents.

4th Remote deguging. This is like 3rd but you can debug and application running remotely. For this what you have to do is enable debugging on the remote application. To enable this you have to pass Parameters to JVM saing which port is available to remote access. After you enable it what you have to do is connect to remote port using local code base and debug it.

Tuesday, April 6, 2010

Speed Broadband for Firefox

Here's something for broadband people that will really speed Firefox up:

* Type "about:config" into the address bar and hit return. Scroll down and look for the following entries:


Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.

* Alter the entries as follows:
Set "network.http.pipelining" to "true"
Set "network.http.proxy.pipelining" to "true"
Set "network.http.pipelining.maxrequests" to some number like 30. This means it will make 30 requests at once.
* Lastly right-click anywhere and select New-> Integer. Name it "nglayout.initialpaint.delay" and set its value to "0". This value is the amount of time the browser waits before it acts on information it recieves.
If you're using a broadband connection you'll load pages MUCH faster now..

This really work for me.

Saturday, May 9, 2009

Spring PropertyPlaceholderConfigurer

Here is the code to use PropertyPlaceholderConfigurer with XMLBeanFactory

XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("test.xml"));
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.setLocation(new ClassPathResource(""));
// now actually do the replacement
MyBean bean = (MyBean)factory.getBean("myBean");
System.out.println(bean .getProperty());

Thursday, May 7, 2009

Struts common configurations

<!-- Standard Action Servlet Configuration (with debugging) -->


















Wednesday, February 11, 2009

Eclipse class change error

While I am using Eclipse I got this error few times and do lots of things finally I clear my eclipse Workspace it works.