Friday, November 27, 2009

How to set a custom ToolTipManager in java flex 3.0

I needed to set a custom implementation of the ToolTipManager (more struts for our life!!!). I was looking for solution and found it. Here it is.

To register your own class you should invoke Singleton.registerClass(interfaceName, clazz) method with appropriate parameters. If class with interfaceName have been registered yet you cannot override it . It means you cannot register class in creationComplete, initialize or preinitialize handlers. You should create custom Preloader class and register class in constructor and set one to the application class via MXML code:

<mx:Application xmlns:mx="" layout="absolute" preloader="CustomPreloader">

Here is the example of custom preloader class:

public class CustomPreloader extends DownloadProgressBar
       public function CustomPreloader()


Maybe anyone has another solution.

Handling Page Not Found using struts

While surfing web, Most of us have encountered 404- Page not found message. Any resource you request; If it does not exist on server you would get such an error. In struts applications when you request for and if there is no Action-mapping defined in struts-config.xml file for ActionForward x; You would get such an error.

Unknown ActionMapping

In struts you can define one ActionMapping which will receive all requests for which no ActionMappins is defined. It is called "Unknown ActionMapping".


Notably one can also do some NLP or spell correction to seek for resource user might be looking for and can ask to give that resource. This helps improving user experience while surfing your site.

Java 7 Preview


Here's a PDF file which contains sneak peak preview for Java 7

Java 7 is really cool...check it out !!!

Thursday, November 26, 2009

Problem with mozilla event mechanism


Last week i was coding for a website which was totally dynamic using jsp and spring framework, I wrote many JavaScript functions to perform dynamic things throughout the website. Now, the site worked perfectly in internet explorer 8 and other old ie versions. Now my task was to make it compatible for other browsers including mozilla, opera and google chrome. I managed to make it work in opera and google chrome but failed to execute some modules in mozilla firefox !!!

Here's where i failed

-> document.getElementById('myid').click()

This function failed in mozilla and worked fine in other ie versions

I solved it using

var oEvent = document.createEvent("MouseEvents");
oEvent.initMouseEvent("click", true, true,window, 1, 1, 1, 1, 1, false, false, false, false, 0, target);
target.dispatchEvent( oEvent );

I managed to make click event dynamic using javascript functions which worked for me in both ie and mozilla

-> Event propagation in dynamic check boxes created using DOM

var element3 = document.createElement("input");
element3.type = "checkbox";;
element3.onclick = function() { checkChangedValue('mytest',nameid, gname, e) };

The above mechanism does not work in mozilla firefox but it works perfectly in internet explorer.

I resolved it using

element3.addEventListener("click", function(e) {checkChangedValue('myname',ids, gname, e);}, true);

This works perfectly in both browsers, i had other issues with mozilla firefox but its a long list to discuss, it took around 22 hours for me to make this whole website compactible in mozilla firefox and internet explorer......Feeling like have won a war !!! One day, all browsers will follow same scripting all ower, m waiting for that day to come...

Cheers all,


Wednesday, November 4, 2009

Rotated Floral Heart Bullet

No really, it’s a Unicode character, U+2767 if you must know. I found it here (warning; won’t display properly in most browsers) via Zeldman. I made a really big picture; read on for a look.

On my windows machine, the dingbats are noticeably absent in most fonts; only all there in, as one might guess, Zapf Dingbats.

The Autobox of Death

Hmm, maybe I should have another blog for Java geeking. What happened was, I had an ArrayList and for a variety of reasons I decided to turn it into a HashMap. After I’d fixed everything up, I got the weirdest NullPointerException, and I traced it to a call that looked like (x is the HashMap)

if ((x.size() > 0) && x.get(0).equals(foo))

and somehow the compiler had decided that get(0) was a reasonable thing to do to a HashMap. Uh, strong typing, anyone?


Hey, this is cool; it’s a little doo-hickey that draws pie charts and graphs of what you’ve got on your disk. I wonder on what set of hardware/OS combinations the web-start Just Works like it did on my Mac? The pie-charts of my life were so cool I had to publish a few. And I turned up a real problem, too.

It took well over five minutes to crawl through my home directory, which I guess isn’t too bad for 35G.

This API can be found at

Funny Error in the Servlet Spec

I was reading the servlet spec and I found this funny error in the document on page 58, just wanted to share it ...