Faster Net, Deeper Debt

Korean government announced that it will be 100Mbps nationwide network by 2010.  While Korea is known as the broadband mecca, not many realizes that broadband distribution in Korea is heavily centered around major cities.  I have not be able to confirm it but I have read that 90% of broadband distribution in Korea is concentrated around Seoul where nearly half of Korean population lives.  What this means is that Seoul is the broadband mecca, not Korea.

Korea went completely nuts over credit cards in recent years and many Koreans have built up unsurmountable debts which greedy card companies are now being weighed down with.  LG Card, Korea's largest credit card issuer, is in deep trouble and seeking emergency loans.  In a culture where the cost of saving face is high, credit card is both a blessing and a curse.

All it takes is one fool, who thinks spending $1000 at a bar is proper or $1500 handbag is essential, to start the domino of mutual destruction.  He treats you and you treat back and so on.  Soon such lavish treatment becomes the norm for good times and the whole country sinks in debt.  Only protection against this is the lost art of Iron Face.  Muhahaha!

Ebichu

I discovered Ebichu anime last night.  Ebichu is a cute housekeeping (?) hamster who is fiercely loyal to her undeserving master.  Ebichu is simply hillarious.  Here are some screenshots to make up for all the boring technical posts:

Ebichu cleaning

Ebichu dusting

Ebichu telling her master's boyfriend to
be fair to both of her master's breasts.

Ebichu telling her master's coworkers
what a nice girl her master is.

Ebichu underappreciated
 

Jury Duty

My wife wasted 5 hours today waiting for jury selection process.  She doesn't understand English very well but the jokers administrating the jury duty doesn't care.  Apparently they also don't care about wasting people's time because she told me she had to wait all that time just to be told to come back tommorrow.

Jury duty is a serious responsibility for every American citizen but bureaucrats are turning it into a joke.  What is the point of dragging in a busy housewife who understants little English to warm up a chair all day?  With such idiocy and glaring disregard for people's time, it is no wonder everyone tries to avoid the jury duty.  While everyone complains about the slowness of DMV and US Post Office, they are speedy when compared to the American court system.

Persimmons

On Sunday, my wife and I harvested some ripe persimmons off our two persimmon trees and took some photos while at it.

My wife doing her sexy persimmon hunter pose
in front of a persimmon tree.  Long stick she is holding is
what we use to cut the persimmons down.

A closer look at the persimmon tree.
Persimmons are riper at the top for some reason.

What we managed to harvest before I threw in the towel.

Eating too much persimmons can cause constipation.  Since I enjoy being an easy going fella, I don't eat persimmon.  Half of the harvest are for my wife and son.  The rest goes to our friends and neighbors.  The best way to eat persimmons is to ripe them until they turn red (called hong-shil in Korean) and then freeze them.  This way you can eat them like ice cream any time.

JSTL, EL, and DBXML

I changed my DBXML taglib last night so it will work with JSTL tags.  I left out EL support because I didn't need it yet.

As to the kind of changes needed for a taglib to be integrated with JSTL, classes need to support the JavaBeans method naming design pattern and implement common interfaces like Iterator or Collection.  For example JSTL Core forEach tag requires a variable set with an array of primitive data types or an object or its member implementing Iterator or Collection interface.

Unfortunately, DBXML's Java binding classes looks like they were written by a C programmer with little understanding common Java practices nor common performance pitfalls.  XmlResults class, for example, doesn't follow the JavaBeans method naming design pattern and doesn't provide an Iterator interface.  Not surprising since it doesn't even override the toString method.  It also instantiates a new XmlValue for each result item.

To get around these problems, I made these changes to DBXML Java binding:

  1. added XmlValue.setCPtr method so XmlValue can be reused.
  2. added XmlValue.nextValue method with an XmlValue out parameter.
  3. added XmlValue.toString()
  4. added getXXX versions of asXXX methods.
  5. added XmlResults.getItems() that resets and returns an Iterator implementation.

With above changes, I was able to use my DBXML taglib with JSTL tags like this:

<%@ taglib prefix="dbxml"
uri="/WEB-INF/dbxml.tld" %>
<%@ taglib prefix="c"
uri="http://java.sun.com/jstl/core" %>
<html><head><title>DBXML Test</title></head><body>
<h2>My Posts about Flash</h2>
<dbxml:setDataSource dataSource="dbxml/blog"/>
<dbxml:query var="titles"
  xpath=
"/donpark/post/item/title[contains(.,'Flash')]/text()"
  resultType="values" />
<c:forEach var="item" items="${titles.items}">
  <h4><c:out value="${item.string}"/></h4>
</c:forEach>

</body></html>

Which returns:

<h4>Funniest Comment about Flash Mobs</h4>
<h4>Flash Mob Discount?</h4>
<h4>Flash Mobs in the Bay Area?</h4>
<h4>Flashing XML</h4>

Note that EL expression ${titles.items} invokes XmlResults.getItems method and ${item.string} invokes XmlResults.getString method according to JavaBeans design pattern.  Adding EL support to a taglib involves passing attribute values and body content through the EL parser so users can use EL expressions when using your tags.

Tomcat Inner City

I spent a couple of hours this morning to write a JNDI ObjectFactory for DBXML so access to XML databases can be located and shared across web applications via JNDI similar to the way JDBC DataSources are handled automatically by Tomcat.  Unfortunately, ObjectFactory doesn't handle object lifecycle meaning it just ships objects out the door and not worry about them afterward.

To close down those databases gracefully, I need to receive notification of the container shutting down.  Tomcat provides varioius kinds of Listener support but there are two problems:

  1. Tomcat-specific interfaces must be used.
  2. Listeners are specified by class name.

I think a JCA (J2EE Connector Architecture) connector version would be more portable but I am not sure if Tomcat supports this.  Looks like I'll have to wander around the inner city a little longer.

After dinner, I am going to tinker with DBXML TagLib to make it look more like JSTL's SQL tags and support EL as well.  I don't usually get to play around at this level, so it's fun in a way.