junwei's profileRichard's footprint on ....PhotosBlogListsMore Tools Help

Blog


    July 30

    A good introduction to Hibernate

    Lat Friday, I was plan to read the quick start documentation of Hibernate so that it could be utilized immediately in my project near future. I downloaded the hibernate 3.0.5 since I am used to reading the first-hand materials from its official publication/documentation when I want to employ some tech. but unfortunately, I cant run its provided demo program thru ant eg command successfully with the report saying something like the syntax of sql statement is incorrect and alike. I dont know whether anyone alse encountered same problem? I didn't spend more additional time on that, just skip it and do its provided sample step by step. That's a rather simple standlone java console app. I read, modified and adapted it for my web app, as wellsimplicity to just a jsp page to test hibernate feature. But in the end, the frustration is when requesting this jsp, always a NoSuchClassDefException was thrown. A frustrating day I thought.
    Today, I had a second look at the hibernate3 online documentation:
    that's a good point for novices like me to start with. I placed the hibernate mapping file *.hbm.xml in the wrong place?
    July 26

    what's essence of debug

    This morning our customer made a telephone to use saying that the source codes of VS2005 plugin cant be steped into and when launching debugger, it's reported that the debug info cant be found for devenv.exe.I was assigned this problem and began to try to reproduce this bug. After several times trying, I found I made a big mistake. That's I was used to consider things from my gained experiences such that some new clues is often omitted by me. but it is these clues that helps resolving problem if considered earlier. Take this time as an example, the key point to this problem is that I ignored the message "the debug info cant be found for devenv.exe" and this is the most important clue it proved finally. I resolved the problem just by uncheck the option "allow unmanaged code debug" on the debug tab of properties page of the plugin project. Besides this piece of experience, I learned another debug skill: if your breakpoint was not hit, you can right click it to find possible way out. There is a "location" context menu, you can check the option on the pop up window to allow debug even though you codes is slightly different form its original version.
    Today's lesson made me think more than that. I began to ask myself question how much debug skills I mastered on earth even though almost each day I use it? how much I knew about debug? what's the essence of debug?
    July 05

    Event Bubbling

    This morning when I designed my JSP page I encountered this classic javascript problem. It is about event bubbling. I have a checkbox in some cell of a table element. both the checkbox element and its ancestor tr are attached to a click event handler. When I click the checkbox the event handler for it raises first and then the event handler for tr element (In IE6). That's not what I want, I dont want the click event to propogate to tr element. So I search it using "event bubble" keywords. After reading, it is proved that event model depends browser, different browsers support different models (event capturing/event bubbling/w3c model). Finally I have found solution to my problem.
    //Add the following codes to the event handler for the checkbox's click event to stop event bubbling up to its ancestor.
    if (!e) var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();

    I can stop event bubble this way.

    I recommend these links to read about event model.

    http://www.quirksmode.org/js/events_order.html (event model intro.)

    http://msdn2.microsoft.com/en-us/library/ms533023.aspx (detailed event bubbling model)