Tuesday, February 20, 2007

How to store XML in database

Imagine that you have a lot of XML documents and you need to store them in RDBMS.

Using OOP approach is preferred. So, lets take JAXB - now we can work with our XML as with object hierarchy. Storing some _object_ in RDBMS means using some ORM. Let it be Hibernate. What is the next ?

Solution is Hyperjaxb 2. It's relational persistence extension of the JAXB RI. With this simple Ant target you can generate binding from XML Schema or DTD and hibernate mappings as well :

<target name="generate-sources">
<taskdef
name="xjc"
classname="com.sun.tools.xjc.XJCTask"
classpathref="classpath"/>
<xjc target="src" extension="true">
<arg line="
-dtd
-Xequals
-XhashCode
-Xhyperjaxb2"/>
<schema dir="xml/schema">
<include name="**/*.dtd"/>
</schema>
</xjc>
</target>

In this snip of code DTD is used instead of XML schema (-dtd flag is added).
After "ant generate-sources" all the classes and hibernate mappings are placed in src dir. This tool can simplify my life and save some time for rest :)

This is probably one more reason of using mainstream (Hibernate) - third party addons.

Saturday, February 17, 2007

Page preview

Few tips about how to get page preview. In fact, this feature is connected with html and css rendering. It is core concept. There are some html and css renrerers in Java , so I can play a little. Another things are : Flash and JavaScript. And now the fun begins. How to capture an image of some page with flash animation ? Here is a link with a lot of flash :)

How "Snap Preview Anywhere" will catch it ?

But... there is another way to do it. Just load in some way a page in ordinary browser and make a screenshot. How to automate it is another story...

Wednesday, February 14, 2007

Oracle tried to buy open-source MySQL

It is interesting fact. Oracle products are in Java. I can't understand how C product can be useful for Oracle. From this point of view, Geronimo/Websphere or Derby/Cloudscape from IBM looks like another story.

Buying JBoss is also interesting move. JBoss seems to be cool since it was Jboss, then it's owned by RedHat and now Oracle wish to buy it. How about Oracle Application Server ? We'll see :)

Tuesday, February 13, 2007

Preview link before visiting

Take a look at Snap Preview Anywhere. Now you can preview link to see what it's look like before visiting. I found this feature useful.

But ... how do they do that ? :) I'm sure it's AJAX (without looking at the source). Adding some page element without page refresh from external resource is not new for me. I see that "cloud" is an png image about 7 Kb in size, and actually preview is also png image few kilobytes in size. The question is how to get a preview image. It is mystery for me :)

I don't think that it is something really new. But it is new for me.

Sunday, February 11, 2007

Apache OJB mailing list

Take a look at interesting discussion at apache ojb mailing list. It is here. Why I'm writing about OJB ? Actually I have an experience of failed project when we used OJB (OJB was not the root of evil).

Almost two years ago I started on real J2EE project. I was really green that time :) I had no idea what is ORM and why some people used it. I had some issue with class loader, limited support for hsqldb (<1.8) no book about OJB, such as "Hibernate in Action" for Hibernate... My suggestion to change persistence framework was rejected by manager (I hope he does not feel angry with me).

And now I see (after two years) a phrase "Shit happens! ;-)" from one of developers... I wish you to understand me correctly. I'm not say that OJB is ugly. It works perfect for some people. But at the moment I'm described it wasn't the best choice. Not more and no less.

By the way, interesting link. I had never seen it before. It is activity stats of Apache projects mailing lists.

Thursday, February 08, 2007

Create pretty html forms online

Take a look at http://wufoo.com/ . Simple, but sometimes very useful thing - creating pretty forms. Free service is quite limited but interesting. Only one pre-defined theme available, but maybe it is for free service only ? In fact this info (about wufoo.com) came from this page. I'm working with Struts 2... As for me, Zapatec AJAX suite approach to form design is more interesting anyway :)

Wednesday, February 07, 2007

Google Analytics stats

As you can see, the topics of my blog is very different. It is pity but I don't have almost any feedback. I hope my readers understand my poor English :) So, I rely on statistics... Here is the top 5 keywords from search engines :

  1. Stas Ostapenko python
  2. "martin fowler"
  3. netcracker, sumy
  4. sumy, netcracker
  5. moscow netcracker salary
Ahaa :) It seems to be that the most interesting thing in my blog is a blog entry about NetCracker. OK. I'll disappoint you a little - this is my last entry about this company. I'm not angry that I'm not working with them. Some facts persuaded me that QA is not interesting field for me. I'm developer but QA engineer is NOT. Of course, the salary at this company is bigger than I have at my primary work at Sumy State University. But the question is not in salary only. All the people is different and my self-analysis says me that I'm developer. I heed to create something by my hands, and not write test-cases. It doesn't make sense in preparing person as QA which will migrate to developers as soon as possible.

But from the other side, it was very interesting experience when I tested my web application with Mercury LoadRunner 8.0 and RadView TestView products. It fun to see an web application written by myself under stress of few thousands virtual users. You can see some things that you couldn't even imagine as developer !

I saw the visitors from NetCracker (according to Google Analytics) many times. From Russia, Moscow and USA, Waltham. Hello and Welcome ! I'm glad to "see" you ! If you (or any other my reader) would like to contact me, here is my e-mail : stas dot ostapenko at gmail dot com.
Somebody, take a look at http://netcracker.com/request.html and click submit. Friendly speaking I expected to see the same form with validation error messages, but I'm not. It is a little bit strange to have OSS solution based on J2EE and web site with ugly CGI perl script. It is only my opinion !

But... Operation Support Systems is still interesting for me. Why ? Mm... The most interesting things appear at the cross of different fields. In this case it is network management and business management of the system of great complexity.

Python ? I like it ! :) Just 10 lines of code and you make something useful. I promise to write something about Python and Internet Explorer interaction. All this playing takes time , I can't say when I get something really interesting to write about.

Good luck !

Tuesday, February 06, 2007

Struts 2 and Injection of Control

As I wrote before, I decided to use Struts 2 + EJB 3 for a new project. I want to use dependency injection for Struts and EJB integration. JNDI lookups is not interesting :) Dependency injection is possible with the help of Spring plug-in bundled with Struts. So, I need to be familiar with Spring. But I'm not yet :) OK. Googling around I have found a book "POJOs in Action" by Chris Richardson. There is some info about "Integrating Spring and EJB dependency injection". But... i started to read it from the beginning... Why ? Its all because review by some architects which are comparing this book with famous Martin Fowler’s great book
"Enterprise Architecture Patterns". Good points ! I'm reading it now and I like it :) I hope this book can help me in the future to make more smart architectural decisions.