Mutant World

Sunday, November 28, 2004

Integrating JOTM 1.5.3 in Tomcat 5.0.x

Recently I have integrated Tomcat 5.0.x with JOTM 1.5.3, running on J2SE 1.4.2.

Needless to say, Greg already provides the Jetty-Extra package which already provides the Jetty-JOTM integration.

The steps for Tomcat-JOTM integration are the following:

  1. Copy to $TOMCAT/common/lib the following jars:

    • carol.jar

    • connector-1_5.jar

    • jotm.jar

    • jta-spec1_0_1.jar

    • objectweb-datasource.jar

    • xapool.jar


    I found that carol does not need any stub since it works in local mode (see below).

  2. Create a carol.properties file in $TOMCAT/common/classes containing the following text:

    # lmi stands for Local Method Invocation (it's a "fake" RMI)
    carol.protocols=lmi

    # do not use CAROL JNDI wrapper
    carol.start.jndi=false

    # do not start a name server
    carol.start.ns=false


  3. Configure Tomcat's Context (either in $TOMCAT/conf/server.xml or in $TOMCAT/conf/Catalina/localhost/<mywebapp>.xml file) so that a UserTransaction object is bound in JNDI, as shown below:


    <Context ...>
    <Resource name="jdbc/mysql" auth="Container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/mysql">
    ...
    </ResourceParams>

    <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"/>
    <ResourceParams name="UserTransaction">
    <parameter>
    <name>factory</name>
    <value>org.objectweb.jotm.UserTransactionFactory</value>
    </parameter>
    <parameter>
    <name>jotm.timeout</name>
    <value>60</value>
    </parameter>
    </ResourceParams>
    </Context>


    Normally there is also a DataSource configured, and this DataSource is also referenced in WEB-INF/web.xml, but that should be there independently of the transaction manager.


It is that simple.

It is very important not to include jotm.jar in WEB-INF/lib of your application.

If you want to see some extra logging to be sure everything went fine, just drop Log4J's jar into $TOMCAT/common/lib and add a log4j.properties in $TOMCAT/common/classes.

Jetty|Tomcat + JOTM + Hibernate does the job for me :-)

Monday, November 15, 2004

Layout without tables using CSS

I am playing with CSS to find the easiest way to layout a common disposition of <div>s for a web page.
I need a simple layout made of a header on top (width 100%); in the middle a left part that will hold a tree (say width 25%) and a content part (say width 75%) on the right; a footer at bottom (also width 100%).

Needless to say, it's very easy to obtain this using a <table>, but I wanted to go one step further and use CSS only.

Googling "columns css" returns a lot of stuff, most notably this page, which compares various solutions.

The one I've settled with, since it fits my needs, is this:

<div id="header" style="background:#AAA;">HEADER</div>
<div id="container" style="background: #EEE">
<div id="left" style="background: #EEE; float:left; width:100px; overflow:auto; border-right:2px solid black">LEFT</div>
<div id="content" style="background: white; margin-left:100px; border-left:2px solid black">CONTENT</div>
</div>
<div id="footer" style="background:#AAA; clear:both">FOOTER</div>

Nothing special about the header.
The container has the same background as the left, so that if the content expands vertically, then the left column expands as well keeping its background.
The left is floating left with a specified width. The same width is the left margin of content (if you want borders/padding you must tweak the content left margin).
The borders of left and content overlaps (and this really surprised me) to form a unique border.
The background of the body and the background of the content should be the same.
Finally, the footer must be clear:both so that no matter if left or content is higher, it will always stays below.

It works fine in Firefox 1.0 and IE6. If you have feedback about Mac, IE5 and Opera, will be great.

Monday, November 01, 2004

Online bookmarks, which one ?

I've come to a point that I really need to save my bookmarks online, since I have to deal with at least 3 computers.

Today I spent some time to browse the internet looking for a solution that fitted my needs.
Needless to say there are many, and I mean really many, online bookmarks sites out there.

I have looked at Pluck, but found negative recension about its functionality.
Then Spurl, but it's not possible to have private bookmarks.
Same for del.icio.us.
BlinkTo has the opposite problem, it's not possible to share bookmarks with others.

I've seen many others, but finally settled with Furl, also seeing that people using it are quite happy.
It is possible to decide to keep a bookmark private or public, it has RSS and search capabilities, bookmarks can be shared with others, it's possible to import/export bookmarks from many formats and many other features.
Furthermore, it has a Firefox plugin that makes its usage quite simple.

Now it's time to use it and see if I've made the right choice.

Which online bookmarks site do you use ?