I try to write blogs whenever I get spare time

Just to let you know what I am trying to learn and what I am doing now.

Add Ext-GWT (GXT) to your GWT project

If you are familiar with the Ext-JS library, then probably you have seen their marvelous widgets. If you want to use those widgets in your GWT project, there is a very simple way to do that. Follow these steps:

  • First, download the GXT library from here.
  • Create a GWT project as described in my previous article.
  • Add the following entry to you projects module xml file.(This xml file would be found in your source folder, named as "xyz.gwt.xml"):
    << rel="stylesheet" type="text/css" href="css/ext-all.css" >>
  • Add the following stylesheet to your host page (the main html file that would be found in your "public" folder inside the source folder).
    << link rel="stylesheet" type="text/css" href="css/ext-all.css" >>
  • The first line of the html file should be:
    << !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >>
  • Eclipse Configuration:
  • Add gxt.jar to the project. You would find this jar file inside the folder where you have unzipped the library previously.
    a. Right click on project name in 'Package Explorer'.
    b. Select 'Properties' from content menu.
    c. Select 'Java Build Path'.
    d. Select 'Libraries' tab.
    e. Add the gxt.jar either with 'Add JARs...' or 'Add External JARs...'.
  • Add GXT jar to launch configuration.
    a. Choose Run / Open Run Dialog.
    b. Select your appropriate launch configuration under 'Java Application'.
    c. Select the 'Classpath' tab.
    d. Add the gxt.jar to the classpath.

That's all. Now you can use those beautiful widgets of Ext-JS in your project.

Getting Started With the GWT

The world is moving too fast now a day. People wants immediate response from the web pages rather than the total reloading of the page. That's why, web applications using AJAX, are becoming more and more popular day by day. Now suppose, you want to develop this kind of web applications, but you are not familiar with javascript or the AJAX technology and you know Object Oriented Programming, you have the basics of developing desktop applications, then GWT is the perfect tool you are looking for.
GWT (Google Web Toolkit) is a marvelous tool to develop web app with java programming. You write your application in java like a desktop app, and GWT will convert it to a web-app by compiling the java code to javascript code. You can have a look here for the official review of GWT.
For developing using GWT, you have to:

  • Install the Java SDK. You can get it from here.
  • Have Eclipse IDE (version 3.0 or later).
  • Download GWT from here.
  • Unzip the Google Web Toolkit package.
If the above four steps are finished, you are ready to give a run with GWT.

Now, Look at the folder you have just unzipped. You'll see there are two command line utility named "projectCreator" and "applicationCreator". These two files will help you to create a new GWT project. Follow this steps now:
  • First of all, we will create a project with eclipse support by running this script on the command-line:
    projectCreator.cmd -eclipse TestGWT -out samples\TestGWT
This command will create a Eclipse project named "TestGWT" under the "samples" folder.
  • Then, run this script:
applicationCreator.cmd -out samplesTestGWT -eclipse TestGWT -overwrite org.hillol.testgwt.client.TestGWT
This will generate all the files needed two start a GWT project.
  • To open your project in Eclipse, launch Eclipse and click the File -> Import menu. Choose "Existing Projects into Workspace" in the first screen of the wizard, and enter the directory in which you generated the .project file in the next screen of the wizard. When you are complete, you should see your GWT project loaded into your Eclipse workspace:

  • Now, run the project. You will see a page with a logo and a button. Click on the button, you will see a dialogue box popped up. This is the default simplest GWT project. Later I will show you how to create more complex applications and how to communicate with the server.

Check the performance of your JS engine

Javascript is becoming a tremendous issue of importance now a day, as the web is inclining to the use of web-apps. So, you may eager for inspecting how powerful the JS engine used by the browser you are using. You can do it easily here. Google chrome is demanding that the JS engine (V8) they have used is very potent one. You can check it yourself by running the test in IE, in mozilla FF and also in Google Chrome. After the test just compare the result, you'll see the difference!

VirtualBox: Amazing world of virtualization...

Suppose you are using Windows XP and you need to use Linux for any purpose. What you'll do? Possibly install the linux OS in your machine, and whenever you need to use linux you have to shutdown windows and start linux. And again when you need to back to windows you'll do the reverse. Isn't it unpleasant? There are smarter way to do that. You can use VMWare for virtualization, but that is also a bit clumsy process. There is even a smarter way to do that now.
Use VirtualBox. Installing a new OS is now as easy as installing mozilla firefox in your PC. And there is no need of restarting your PC everytime you need to switch OS. Just Open the VirtualBox and create your own Virtual machines for any OS you want. then install the OS in that virtual machine and use it like a installed software through VirtualBox.
This means you can use any OS from any other host OS now in a very easy way.
You can download it from here.
Download, install and Enjoy the world of Virtualization.

Ubiquity : A new dimension of innovation...

One of my friend posted a link of this mozilla firefox add-on. When I go for the link and read out the "What is ubiquity" I got very curious - what a mere add on can do here? I install it, read the tutorial and then when I started to use it, I simply got stunned. It's an awesome implementation of an awesome idea. And after that, one thing rang my mind - life is becoming so easy these days. Now you can search for a location to inform your friend about that by mailing the map with simply writing some words as a command and you'll get all the works done by pressing a enter key. This is only a example how powerful "ubiquity" is!
Check this link for downloading ubiquity and here you'll find a fine tutorial. Use it and you'll love it that's for sure.

Securing your Java EE applications

Security of enterprise applications is a great issue to deal with. There are two types of security issues you have to take care of: Authentication and authorization.
Authentication means "The verification of the identity of a person or process".
(To be continued....)

The idea of auto generation of boiler-plate codes of Java EE (part 2)

After defining your XML structure and writing the DTD file, now write your actual XML file that will contain your required info about the entity (like its name, attribute list etc). The XML file can be something like this:

After finishing this initial task, then you have to look for a XML API that would help you to parse and manipulate these XML data. There are many choices like SAX, JAX etc.
I will describe the use of a Borland tool that uses SAX (Simple API for XML). I am telling about this tool because I am familiar with it. You can use any other tool that serves this purpose.
The Borland tool that I am telling about, is provided with JBuilder. Now let us see, how can we combine all these to produce our desired generator.
1. Open JBuilder and choose "New" from the File menu.
2. Choose a databinding project from the XML options. And give the desired name and other info about the project.
3. Then when asked for the DTD file, choose the DTD file we've created before and show the root element of the XML.
4. When you finish the project creation, you will see Some classes attached with your project. The Borland XML tool creates a class for each XML tag it finds in the DTD file. The inter-relationship between classes are defined according to the relations defined in the DTD file. The getter, setter methods for each class and their children.
5. Now you are ready to make your run. You can make a java class named Generator in which you will write the code to generate your desired codes using the XML classes. It will use simple File I/O to write the generated classes.
6. All you need now is to call a unmarshal method of the root class. For example, if we call the method like this: entities.unmarshal("data.xml");
We'll get a tree structure from which, we can get the children list by calling like: entities.getentity().getentityList();
7. And then we are free to use this data anywhere in our code generator class.

The idea of auto generation of boiler-plate codes of Java EE (part 1)

The Java EE is a great framework for building large scale and distributed enterprise softwares. A java enterprise software has many boiler-plate codes that need not to be coded by yourself. They can be generated by smart IDE's like Netbeans just with your few mouse-clicks. But, the code Netbeans generates is kind of a mere skeleton code of those classes. If you need customization in all those netbeans generated classes, it is better to write a generator that will generate customized classes according to your requirement. It's a very simple thing to do.

First, let us assume we need to generate the following classes for a single entity:
1. a entity bean,
2. a session bean,
3. a detail file of the entity bean (that will hold the form level abstraction of the entity bean),
4. a converter class that would convert the detail class to the entity class and vice versa.
5. and a form that would represnt the attributes of the entity bean (in the front end).

For all these, at first you need to write a data source in which you would store the name of the entity, it's attribute list, properties of the attributes etc. An XML is a feasible solution here to write these data. So, write an XML file by defining significant tags in it. Then, write the DTD (Data Type Definintion) file for this XML, in which the type of your tags would be defined. If you are not very familiar with these validation stuffs of XML, you can check these DTD tutorial.

Windows Search 4

The search technique of previous versions of Windows (before Win Vista) was very trivial searching, it took a long time to find anything you needed. Microsoft has provided "Windows Search 4" which has a better searchability. You can try it.

WinTabber - Get a tabbed look...

Suppose you like to work with lots of applications,folders,files all opened and stored on the taskbar. It makes your taskbar clumsy and squalid. You can use "Wintabber" to get a tabbed look and feel. You can add any opened application or folders as a tab. You can add as many tabs as you want. You can get it from here.