Tuesday, December 11, 2007

Google's excellent new service..!!!

Guys who want to type in their regional fonts (for example, in an indian language) can rely upon google's "Transliteration service", a wonderful effort from google.

Just type in english and press "space bar" to watch the typed text getting automatically "trans scripted" to your language of choice.

Just a small example here in the indian language "tamil".

To say "Wishes" in tamil, i just type "vaazhthukkal" and press space.
Google trans scripts it into "வாழ்த்துக்கள்" (this might not be displayed properly in firefox, view this page in IE to see it better)

Thrilled...?
Check the link below to explore further:

Google Transliteration

சும்மா அதிருத்திலே

Monday, December 10, 2007

Vote for developer.com's Product of the Year 2008

Don't miss this great opportunity.
Cast your vote for your favorite tool/technology.

Yes, NetBeans, Eclipse, Glassfish etc.. are in the list

Click the link here to go to the poll booth.

Product of the year 2008


Hurry! The voting ends on December 21, 2007.

Monday, December 3, 2007

Implementing session timeout in swing apps

If you are working in a web based project, the term "session" must be a frequently used one. "I want to implement a HttpSessionListener", "How do I access http session?", "Should i store my user state in http session or in a session bean?".

But I just wondered, how to implement that in a swing application? (Sorry, i haven't learn swing application framework yet)

Consider this typical scenario:
A user has logged into the swing application and has opened some 2 or three windows (JFrames). Now the user goes somewhere leaving the system idle.
How can we logout the user automatically here (for security reasons)?
How to close the opened resources?

I initially thought of writing a global event listener and implementing that in all the user interface classes. But that looked like a bad idea for me, because that would involve a lot of code changes.

So I searched through the net and found out a solution from a java forum (thanks camickr).
In contrast to my expectations, it was quite simple though. And here it is:

private void trackSystemEvents()
{
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
{
public void eventDispatched(AWTEvent event)
{
String eventText = event.toString();
if(eventText.indexOf("PRESSED") != -1 || eventText.indexOf("RELEASED") != -1)
{
SessionMonitor.getInstance().setLastActionTime(System.currentTimeMillis());
}
}
}, AWTEvent.MOUSE_EVENT_MASK + AWTEvent.KEY_EVENT_MASK);
}

Here, i want to track the user activity through a "global" listener kind of thing. And here the event listener is registered with AWTEvent.MOUSE_EVENT_MASK and AWTEvent.KEY_EVENT_MASK. That means, only mouse events and key events shall be tracked.

And i don't want to track the mouse moved/entered events and that's why the small "if" condition which checks only for "pressed/released" actions like key pressed, mouse released etc.

This will help you in implementing the logic to track session timeout.

And spice it up with "observer" pattern to notify your user interfaces to close the opened resources.

Friday, November 30, 2007

Third party swing components

I've been blogging about Java IDEs for quite some time, and i thought of taking a different route this time and hence this topic.

I've been working with java swing for a long time. I remember the days, where i use to struggle a lot to design a decent swing application. Then i managed to learn some techinques to come up with some decent, if not great design. Those were the days when NetBeans GUI builder was not there.
Then NetBeans came and made swing development a breeze.

Though NetBeans made it very easy to design swing apps, the swing component suite remains the same and hasn't evolved much. You are left with the basic components like label, textfield, scrollpane, table, tree etc. Though these components are sufficient for most of the applications and swing itself is very much extensible, creating components that meets your need is not impossible.

But who want to invest and develop things like date chooser or tree table, which is needed by even the smallest of the applications?. Thank God, there are legions of third party components available and many are open source (that's the beauty of java). There is swingx (tons of components), l2fprod, jcalendar, jfreechart, jide etc. And if one takes "look and feel" providers as well then there is jgoodies, substance (improving day by day), liquidlnf (we use it in some of our projects), synthetica and so on...

But wait!!! which one should i choose? Which integrates better with my application, with other components? Are they consistent across different look and feels?

I've been using components like jcalendar, jfreechart for a while and i can say that, they have worked very well so far.
I've been exploring swingx for quite some time and i'm really impressed with the component suite it boasts now. (But i wonder, whether swingx has a stable release yet or not. Whenever i go to swinglabs.org/downloads, i find only milestones and weekly builds. So i'm afraid that i may end up using unstable components. But i really like their components, especially the sortable table/treetable. We spend so much of time in providing sortable functionality to our JTables ):

I've used look and feels provided by jgoodies, substance and liquidlnf. Among the three, i prefer jgoodies for their clean and professional look. But we are using liquidlnf in quite a number of projects. Substance is really amazing, but i couldn't use it because our applications are mostly for business users, so we don't want all those cool effects and themes. But i'm really looking forward to use substance in our upcoming projects because substance now provides some cool themse like "SubstanceBusinessBlueSteel" etc.

Of late, i've been exploring JIDE swing suite and i was amazed at their vast component suite and quality.
You can even design an application as complex as an IDE, using JIDE components. Amazing!!!
You should see their demo applications which mocks visual studio and msword. It was very realistic. Great work!!
They even have a code editor component, which looks exactly like Intellij IDEA's code editor.
(Does IDEA use jide components?)

Even more shocking was the fact that some of the JIDE components are open sourced. I explored their open source component suite and though they are basic, they provide great functionality (like searchable table, searchable bar)
I'm really looking forward to use some of their open source components (their commericial components are bit expensive, but i think they are worth of it)

Do you use any third party swing components? If yes, can you share your experience?

Saturday, November 17, 2007

Eclipse 3.3 - Initial impressions

In my last blog entry, i wrote an article about the best features in NetBeans 6.0.

This entry explains the initial impressions i had with Eclipse 3.3 (Europa)

I've always heard people saying that eclipse editor is superior to netbeans. I was very curious to find out how.

I don't know whether these features are available in eclipse for a long time (as i'm a intellij idea/netbeans user). But these are the things that impressed me a lot.

1. Much intuitive syntax colouring. Eclipse stands out from netbeans here. I don't think the default syntax colours in netbeans is great, though we can configure it. For example the colours chosen by eclipse to "Mark occurences" and to "highlight braces" are clearly eye-friendly than the netbeans colours.

2. Lots and lots of code navigation options. Wow! it's really amazing. Now i can understand why eclipse users feel proud about their ide.
I really like the "navigate java elements - CTRL+SHIFT+UP/DOWN" option. This is one feature which i like very much in intellij idea and missed a lot in netbeans. I made a lot of requests in netbeans user mailing lists to add this feature but till now i don't have that feature in netbeans :-(.

3. Very good "surround with" options. Eclipse simply offers a lot of options to surround your code with. Though intellij idea has supported this feature for a longggggg time, it's nice to see that in eclipse.
Netbeans also has "surround with" options but i have a small complaint there. That is sometimes when i select a particular block of code and choose the surround with try catch option, it surrounds the entire piece of code inside the method (not just the selected block).

4. Lightning fast code completion. Hats off to eclipse here. The code completion is really really fast. (Netbeans guys, you still need to improve. Though 6.0 has reasonably faster code completion than 5.5, it's not as fast as eclipse )-:

5. More options while creating a java class. Eclipse provides a lot of options while creating a java class. I would like to mention a few here:
- Options to declare a class as abstract/final
- Options to declare class access modifiers (public/default)
- Option to extend a super class
- Option to declare the list of interfaces the class shall implement.

Some might argue that these options make the class generation wizard a bit more complex to look nevertheless, it looks like a very useful feature to me.

6. Local history is just a right click from the editor window.

7. Improved servlets/jsp support. (Disclaimer: I didn't spend much time investigating this, but i read an article which explained the improvements done in the web tools platform project)


But i found somethings which didn't look intuitive to me:

- Running a project/class is not as simple as "right click the project/class, click run". There might be some valid reason for this, but for me, it looks a bit more complex than it need to be.

- There are no menu items (atleast to my understanding) to stop a project which is running. (Yes, i have a small stop button in the run window itself, but trust me, it took me nearly half an hour to figure that out)-:

But overall, i think Eclipse 3.3 is a great product and i'm very much interested in exploring it further.

I also found onething that might amuse netbeans users...(i'm a loyal netbeans user as well :-)

Netbeans is really catching up fast with eclipse in terms of pure java editing. Eclipse users, beware!!!!

I missed only a few (but very very useful)-: features in eclipse that don't have a equivalent in netbeans.
I hope netbeans developers will take note of this and improve netbeans further.

As a java developer, i thank both the eclipse and netbeans teams for giving away world class products with amazing quality free of cost. Thank you so much.............

(Note:
If anybody know a visual source safe plugin for netbeans/eclipse, please let me know, because if i don't find anything i'm planning to develop that on my own :->> )

Friday, November 9, 2007

Best feature in NetBeans 6.0

You might have heard tons of information about NetBeans 6.0 in recent days.

I'm using NetBeans 6.0 Beta 2 for almost 2 weeks now for some of my development activities.
Though it had lots of new features available, the new refactoring is the feature which impressed me the most.
(Note: So far, I have used the ide for Java SE projects only)

Refactoring in NetBeans 5.5 is good, but in 6.0 it's outstanding, i must admit.

I heard that refactoring has been improved in 6.0, but i didn't spend time reading what were the improvements.
So when i first pressed the shortcut key to refactor a local variable, it highlighted all the occurrence of the variable in blue and when i started to change the variable name in one place, all the highlighted occurrences were changed simultaneously. This is really excellent!!!


Figure 1: All the occurrence to be refactored are highlighted.

Now when i start changing it, all the highlighted occurences change simultaneously.



Figure 2: All occurences change simultaneously

This is the view after refactoring is done.


Figure 3: View after refactoring

Great, isn't it?

I was even more impressed when i stumbled across one more astonishing refactoring feature....

This time, i wanted to change a method name used in more than one class and what better than the netbeans refactoring?

I want to change a method name "getAESEncryptedText" to "getEncryptedText", but this method is referred in more than one class. So when i pressed "CTRL + R", this is what i got.


Figure 4: Refactor dialog


I wanted to have a preview of the places where this change will be effected. This is the preview offered by the ide:


Figure 5: Refactoring preview

That is outstanding. You can see exactly how the refactored code will look like in the preview pane.

I was thrilled by this offering from netbeans.

Now i'm motivated to compare the refactoring module offered by netbeans and eclipse.

Interesting times ahead for the developers....

Friday, September 21, 2007

The tale of two IDE's (in my heart :-)

I felt really sad today.
Yes today i packed up a companion who served me faithfully for nearly 3 years.
This friend of mine was with me helping me to hone my programming skills.
When i'm coding i use to do mistakes often and this friend of mine use to point out me my syntax errors.

When i want to rename a poorly named variable which is used across many classes, this friend of mine was always willing to help me with refactoring.
And i'm a lazy breed who don't want to use mouse often but like to use keyboard shortcuts whereever possible.
And my friend was one of the best in offering me those tools to navigate very quickly across the codes which i work on.

And i never need to worry whether i would loose my source code because this friend use to offer me tools to integrate very nicely with my favourite (???) source control system, visual source safe (arghhh!!!, blame my company for making it my only option).

But sometimes i use to get annoyed with him.
I never liked the idea of opening a new window to open and view different projects. He came back to me and said why not u create modules for projects which can be viewed in the same window. I replied him that what if i want to view two completely independent projects at the same time in one window?

I use to complain to him that i don't like building jars on my own, as i'm too lazy to do it.
I explained to him that nothing is more difficult in this world than building swing apps by hand!!! (Trust me, i really really hate the concept of developing gui by hand coding)
I told him that i never want to build web apps with him.

All said, but overall, this friend was really very good in whatever he offered. The good things offered by him outweighed the other things i missed.

People in this world call this friend as IntelliJ IDEA.

I had one more friend who was very good at building web apps.
I worked with him when his age was 4.1.
I liked him for a very first reason that he was from a company which developed my favourite programming language.
I liked his concept of arranging projects in one single window without a need to open many windows for each project
But this friend's coding support was much inferior when compared to my friend IDEA.
I used him occasionally for hobby web projects.
He is called fondly as NetBeans by everyone.

In the meanwhile i came to know that a guy called Eclipse is rocking this world with his priceless offerings.
I evaluated him and found him to be quite useful but i felt that i don't need him as i had a loyal friend in IDEA.
Who knows? This friend might have been very useful to me if i didn't have IDEA.

Though i had a very good tool for coding in IDEA, i was still struggling to develop quality apps in swing with him.
Once my boss asked me, "James, would you be bothered if we choose some other language to develop our user interfaces?. They look really bad. Java might be a great language, but i think it's pretty poor to develop user interfaces."
This really stirred my heart as i didn't want anyone to comment about my favourite language's capabilities.
That started my pursuit for visual studio like gui builders for java.

Suddenly i found that this old friend of mine, NetBeans, was creating some news in the web about his gui development skills.
Seriously i doubted his capabilities because i have used him before. But since i was pushed to a great extent in my company, i was forced to check what NetBeans has to offer for me.

Whoops!!! That's marvellous. I couldn't believe that NetBeans can be used to design swing apps visually similar to visual studio. Since i badly needed it because of the pressure, i had to go for it as i had no other good choice in the horizon.
I really liked the gui building abilities of NetBeans. He has grown a lot!. Yes his age is 5.0 now.

From then onwards i became a fan of NetBeans and started to follow it's progress.
Later i found that he did not just offer gui builder but lot of other good utilities like profiler too.
But still i found the coding portion of NetBeans can come nowhere near my friend IDEA. IDEA was a master there.

Later there was huge rivalry between IDEA and NetBeans in my mind (atleast!!) to become my favourite ide.
IDEA was still leading though. But NetBeans gave a tough fight to my friend IDEA when he was 5.5.1 years old.
I was slowly moving away from swing towards Java EE and NetBeans caught me at the right time with it's superior Java EE support.
My friend IDEA had to play a catch up game here.

With all these goodies, (and freebies as well!!) NetBeans almost caught me totally to become my favourite IDE. I started to move away slowly from IDEA. My interactions with him started to minimize and i started depending on NetBeans more and more.

But still at my heart i felt that NetBeans can come nowhere near IDEA when it comes to pure coding. IDEA was so wonderful there.
But this cunning NetBeans somehow found that i was not loving him wholeheartedly and i'm still showing partiality to him.
He started working slowly to improve him on his weakness. I didn't observe this zeal inside this fellow to win me fully.

But one fine day when i was surfing the net, i found suddenly that everybody was speaking about how well NetBeans has transformed.
I thought, what is this guy doing? Everybody is talking about him!.
Later i found that NetBeans has almost changed the portion in him which everyone disliked, the editor.
I said, "Fine, let me evaluate how good is this fellow compared to my old friend IDEA".
IDEA is already very sick in my machine, because i haven't met him for a long long time.

Now NetBeans is almost 6 years old and when i evaluated him, i couldn't believe my eyes!!!.
Stupendous effort. This guy is really zealous in what he is doing. He read my mind correctly and found quickly that i still had a soft heart towards IDEA. I was really amazed at the improved code editing offerings from him. That's really very cool. Add to that the tons of other goodies which you can read anywhere on the web.

Filled with joy i returned to my home and found that IDEA was seriously ill. He longed for my love and care but i almost forgot him because of NetBeans.
Shortly to my shock, IDEA died on my machine today. (I uninstalled it :-)
With tears in my eyes i said good bye to a very faithful friend who served his very best till his last breath on my machine. Hats off to IDEA!

And now to the end, "NetBeans has become really the only IDE i need". It's not surprising that the motto for NetBeans 6.0 reads "The only IDE you need". I feel personally that this guy speaks what he lives. I feel really proud to have a friend like NetBeans.

Monday, August 6, 2007

Those pretty angels..!

i always think good friends as angels sent by God to strengthen us in our times of tribulation.
you don't get good friends whereever you go. they are a rare breed.

sometimes, we need to find out good friends who get along very well with our personality.
but sometimes we get them without any effort.

i'm so fortunate to get good friends all along my life.
i thank God very much for giving such friends.

when you have problem, as a first measure you need to go to God and express it.
but God cannot speak to you directly. He speaks to you through such good friends.

good friends are precious. you need to preserve those friendships.

sometimes we may think that we don't have any good friends around.
open your eyes...
the next one sitting near you may be that wonderful angel God has sent for you !!!

Note:
These thoughts just came into my mind as one of my best friends K.S.Raja left our company to India.

Hi K.S, if you are reading this blog, i just want to say that you are very very special to me.

Monday, July 23, 2007

Near the historic Christ Church in Malacca



Around the historic "reddish" Christ Church built by the Dutch rulers in 1754 A.D.
Colourful place indeed.

Malacca Trip

You can see me (in right corner with blue jeans) there tasting a dutch lady !!.

In the picture are my colleagues (from top left) Deepak (thoppi waala), Mahesh, Rajesh, Johnson Uncle, Karthikeyan, K.S.Raja and yours truly.

The photographer is M.Sankar (who was my classmate in college and has been a colleague for a long while)

Sunday, July 22, 2007

Logging into the blogosphere.....

Hi everybody,
It's very nice to enter into the blogging community.

A brief and short introduction here about me.

I'm James Selvakumar from Madurai, Tamilnadu, India.

I'm currently working in a software firm in Kuala Lumpur.

Some of my hobbies are blogging (!!!!), reading books, developing software.

I'm very interested in reading/blogging about Travel/Tamil/Java

Stay tuned...