Posts

Showing posts from 2010

Bookmarks - Bookmarks with Tags: jersey within http://www.ibm.com/developerworks/web

Bookmarks - Bookmarks with Tags: jersey within http://www.ibm.com/developerworks/web

Wicket Framework

One of the most popular component based Java Web Frameworks is Wicket. Here is some cool links about the Wicket: 1)  http://www.viddler.com/explore/oredev/videos/61/ 2)  http://www.javalobby.org/java/forums/t105230.html 3)  http://www.ibm.com/developerworks/web/library/wa-aj-wicket/ 4)  http://wicket.apache.org/

Java frameworks trends

Image
Here is the interesting trends of three Java Frameworks (Wicket vs JSF vs Stripes vs Spring MVC) against the job market (USA): jsf, wicket, stripes, spring MVC Job Trends Jsf jobs - Wicket jobs - Stripes jobs - Spring Mvc jobs

The quality code: How to write clean Function/Method

T o write clean code is an art rather than science. From my experience at university, I did not get any course where I can learn to write clean code. Why do I bother clean code? Is it really important than solve a problem? No, it is not important than the solution of a problem but it will be pain in the future to maintain the code. For this reason, I have to write clean code to improve the quality and maintainability of the software. Here, I have presented a cheat sheet to create clean function or method: Function should do only one thing or logic [1]. Function should be small not more than 30 lines [2] Function name should be descriptive rather than short name [3] The ideal number of function arguments [4]: Zero or no argument is the best policy One argument is the better policy Two arguments are the good policy Three arguments are the worse policy More than three arguments are not acceptable. The function should be converted to a s...

Tips 1: Closing the InfoWindow when opening a new InfoWindow

Image
Today, I will discuss about InfoWindow of the Google MAP API V3.  At first I will show how to attach InfoWindow with each marker. As a result, when you will click a marker   figure 1                                   an InfoWindow will be displayed. Then click another marker a new InfoWindow will be displayed without closing the previous InfoWindow, see figure 1. It is a default behavior of the Google Map API V3. To do this, follow the following steps: Step 1 : Create Google MAP API V3 map object:      var latlng = new google.maps.LatLng(23.922499,91.164062);      var myOptions = {            zoom:6,            center: latlng,            mapTypeId: google.maps.MapTypeId.ROADMAP,       };...

Forbidden technique: Multi-threading inside J2EE server

It is an old post based on old idea, it is not relevant anymore.   It was in 2009, I just wrote a multi-threaded code to fetch data from two DB2 servers. They are both physically separated. My intension was to get multiple data simultaneously, so JavaBeans will work quickly. I uploaded my multi-threaded J2EE application in the production server, after one or two months later the whole production server was terribly slowed down. I thought there is memory leak problem inside the server. However, I also checked which application is taking two much CPU and memory. I found that my implemented multi-threaded application consuming vast amount of computing resources. I was surprised and I researched on the multi-threading in J2EE. I found from several tech-forums that multi-threading inside J2EE server is forbidden technique. Hmmmm, WHY?   To understand why J2EE does not support multi-threading [7], we need to understand fundamental theory of J2EE server at first. J2EE server is not...

J2EE best practice

I found an interesting article about J2EE best practice. I think, it might help any J2EE developer: http://www.ibm.com/developerworks/websphere/techjournal/0405_brown/0405_brown.html

I like my old friend

  It is an old post based on old idea, it is not relevant anymore.   XML VS JSON. Which one is the super-power to exchange data from server-side to client-side? This is old debate. You will find thousands article about it. Why am I writing about it? When I was working with IBM Toronto Lab, someone asked me why I like XML. I said my reason and I have only one reason. Most of the people like JSON because of its hype and unfortunately, they did not get the opportunity to work with complex data.  JSON is the best approach to transfer data from server-side to the client-side because JSON is lighter than XML and easy to fetch data from JavaScript. It is true only if complexity of data and business requirement are simple. Now think about the following scenario, I am working with scheduling software where XML contains schedule of each team member. I need to send more than 1000 data from server to client side such as, RIA at a time.  The big picture of the XML is: ...

How to develop Liferay portlet using Eclipse

Image
I have written this blog because the portlet development environment of LifeRay is not easy to setup. I am hoping, this blog will help beginners to develop portlet using LifeRay SDK. Step by Step process: W e have to download 5 components, they are: Ant 1.7.x Eclipse Galileo 3.5.x LifeRay with Tomcat bundles LifeRay Plugin SDK LifeRay source LifeRay with Tomcat bundles: At first, we will create a directory as LifeRayPortal. Download LifeRay with Tomcat 6.x. Unzip it inside the LifeRayPortal. In this tutorial, we will unzip all LifeRay components in the LifeRayPortal directory Go to the webapps directory of tomcat. If you see sevencogs-hook and sevencogs-theme directories, please delete those directories. ANT 1.7.x Download ANT tool. The version should be avove 1.7, otherwise it will not work with LifeRay. Put your ANT directory file path in your "Environment Variable". Add ANT_HOME as variable name and your ant directory file path (e.g: c:\ant\) as variable value. LifeRay So...

Why am I getting Java.lang.NullPointer error?

Sometimes we have experienced with Java.lang.NullPointer error and sometimes it is so hard to predict which code producing the error. I have experienced about this error in 2007, and then I read NULL pointer exception documentation from SUN ( http://java.sun.com/j2se/1.4.2/docs/api/java/lang/NullPointerException.html ) which saved my debugging time. I hope it will save yours time also. There is only 4 reasons to get NULL POINTER EXCEPTION: 1 Calling the instance method of a null object 2 Accessing or modifying the field of a null object 3 Taking the length of null as if it were an array 4 Throwing null as if it were a Throwable value