provide-free-support Ujjwal's Blog: November 2009

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="http://www.adobe.com/2006/mxml" layout="absolute" preloader="CustomPreloader">



Here is the example of custom preloader class:

public class CustomPreloader extends DownloadProgressBar
   {
       public function CustomPreloader()
       {
           super();
           Singleton.registerClass("mx.managers::IToolTipManager2",
                                   CustomToolTipManager);
       }

   }



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 x.do 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".

name="/debug"
unknown="true"
forward="/pages/debug.jsp/>

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

Hi,

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

http://sites.google.com/site/ujjwalbsoni/Home/Java7Preview%5B1%5D.pdf?attredirects=0&d=1

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

Thursday, November 26, 2009

Problem with mozilla event mechanism

Hi,

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");
cell3.setAttribute("align","center");
element3.type = "checkbox";
element3.id=myid;
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,

Ujjwal

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?

JDiskReport

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
JDiskReport

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 ...

best-it-exam-    | for-our-work-    | hottst-on-sale-    | it-sale-    | tast-dumps-us-    | test-king-number-    | pass-do-it-    | just-do-it-    | pass-with-us-    | passresults-everything-    | passtutor-our-dumps-    | realtests-us-exam-    | latest-update-source-for-    | cbtnuggets-sale-exam    | experts-revised-exam    | certguide-sale-exam    | test4-sale-exam    | get-well-prepared-    | certkiller-sale-exam    | buy-discount-dumps    | how-to-get-prepared-for-the    | in-an-easy-way    | brain-dumps-sale    | with-pass-exam-guarantee    | accurate-study-material    | at-first-try    | 100%-successful-rate    | get-certification-easily    | material-provider-exam    | real-exam-practice    | with-pass-score-guarantee    | certification-material-provider    | for-certification-professionals    | get-your-certification-successfully    | 100%-Pass-Rate    | in-pdf-file    | practice-exam-for    | it-study-guides    | study-material-sku    | study-guide-pdf    | prep-guide-demo    | certification-material-id    | actual-tests-demo    | brain-demos-test    | best-pdf-download    | our-certification-material    | best-practice-test    | leading-provider-on    | this-course-is-about    | the-most-reliable    | high-pass-rate-of    | high-pass-rate-demo    | recenty-updated-key    | only-for-students-free-download    | courseware-plus-kit-for    | accurate-answers-of    | the-most-reliable-id    | provide-training-for    | welcome-to-buy    | material-for-success-pass    | provide-free-support    | best-book-for-pass    | accuracy-of-the-answers    | pass-guarantee-id    | pass-exam-key    | pass-sku-id    | study-for-exid    | pdf-sku-exid    | sku-pdf-id    | pdf-demo-key    | exam-demo-ske    | pass-it-dump    |
http://inn-on-the-hill.com/    | http://inn-on-the-hill.com/    |