Friday, November 25, 2005


Packing, now. Hate it!

New job, next month. Love it!

Friday, November 18, 2005

Saturday, October 08, 2005

Looking for programmer heaven

Besides the obvious candidates such as Google, Yahoo or Amazon, where else? Where can I find this kind of information?

Tuesday, October 04, 2005

Max method size breached

I have to admit that I only learnt the existence of the 64KB size cap for a java method last night.

Thanks to someone who managed to write a WTF worthy JSP with a whopping 8000 plus lines.


If you know javac turns enum declaration into a subclass of Enum, and understand what the heck is Enum<E extends Enum<E>>, my hat off to you and please stop reading.

For the rest of us, there is a through explanation of enum.

Saturday, October 01, 2005

What servers Google uses?

Ever wondered what servers Google uses to serve up gmail page?

Server: GFE/1.3

Server: GWS/2.1

GWS must be acronym for Google Web Server. Anybody knows what GFE stands for?

Servlet Forward vs Redirect

To do redirect, server sends back a HTTP response status 302. Upon receiving such response, browser is obligated to request page from the new location, hence redirect happens.

HTTP/1.1 302 Object moved
Location: somewhere/newlocation.jsp

Forward, on the other hand, happens internally on the server, and browser is not aware of it at all.

That explains why we need to encodeURL before redirect but not before forward; why states are kept when forward but not when redirect; why redirect method is on Response object but forward is on RequestDispatcher object.

Technorati Tags:

Friday, August 26, 2005

Hit by Lucene Hits Bad file descriptor
 	at Method)
 	at org.apache.lucene.index.CompoundFileReader$CSInputStream.readInternal(
 	at org.apache.lucene.index.FieldsReader.doc(
 	at org.apache.lucene.index.SegmentReader.document(

The Hits should only be accessed when its corresponding IndexSearcher is open. Attempting to access the Hits after the searcher is closed may result in above exception.

The most disturbing thing is that this is not mentioned in the Lucene Javadoc, nor in the "Lucene In Action" book. Thus guarantee any newcomer will be hit by the hits issue! (pun intended)

Technorati Tags: ,

Wednesday, August 24, 2005

Why using Boolean to represent ternary states is a bad idea

The intention of my previous entry is not to advocate the usage of Boolean to represent ternary state but to document a usage I found while reading some open source code.

Use NULL to represent state is technically valid and common practice. Nullable column is often used in database design and many APIs return NULL.

However, people seem to really hate this idea. Why?

I believe the reason is that the usage violates the "least surprise" principle. As programmers, we are hardwired to think of boolean as binary state. The usage in this case, although valid, is against human psychology.

Use Boolean to return ternary state

By using Boolean as return value, it is possible to represent ternary state by - Boolean.TRUE, Boolean.FALSE and null.

Technorati Tags:

Monday, August 22, 2005

Be wary of "IN" clause

In my current project, some queries share a pattern of "where in (:categoryids)". To be "DRY", I implemented a routine to extract a set of category ids; then use Hibernate's setParameterList(). Nice and clean... and WRONG.

The problem is that database has limited buffer for parsing sql query so that there is a limitation on the length of the "IN" clause. The above approach works with small set of data but bombs out when data gets larger.

The solution is to place the query for extracting category ids directly in the "IN" clause as subquery. The result is messy with lots of string concatenation, special case handling. But CORRECT.

An example of leaky abstraction and a reminder to test with large data set early on.

Technorati Tags:

Wednesday, August 17, 2005

com.octo.captcha.service.CaptchaServiceException: no captcha for specified id is found

com.octo.captcha.service.CaptchaServiceException: no captcha for specified id is found
  at com.octo.captcha.service.EhcacheManageableCaptchaService$EhcacheStore.getCaptcha(
  at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(
  at com.octo.captcha.service.image.EhcacheManageableImageCaptchaService.getImageChallengeForID(

This is due to a bug in jcaptcha implementation, as detailed in here.

To spend 1 hour to get Maven running so that I can build from source to fix a bug known since June is not exactly fun for me at midnight running in "death march" mode.

Technorati Tags: ,

Sunday, August 07, 2005

No Fluff Just Staff (PHX) 2005

29684033 Aba4915151 M

I went to NFJS at Phoenix last weekend. Just as expected, the conference is well organized and speakers are great.

What I did not expect is the kind of comradeship I felt strongly towards fellow conference attendees whom I have never met before. When Larry pulled out the "Core Mac Osx And Unix Programming" from his bag and raved about the, I felt connected as I was planning to start learning Cocoa programming and the "Cocoa(R) Programming for Mac(R) OS X" by the same author is on my Amazon wish list. When I noticed Tim uses fisher pen and Moleskine Notebook , I knew instantly that he is a fellow Hipster PDA user for I have the same setup myself.

Although we are strangers, we are alike. We are all "geeks".

Saturday, August 06, 2005

[Book] JBoss : A Developer's Notebook

JBoss : A Developer's Notebook is a little book that packs a surprisingly good amount of information.

I find the last chapter on how to harden the JBoss instance alone worth the book's price. Do you know that an out-of-box JBoss installation exposes

  • the jmx console and web console without protection so that anybody can remotely shutdown the JBoss server?
  • the remote class downloading service so that anybody can remotely download any file?

If the answer is "No", you probably own it to yourself and your client to check out the book. Flipping it through for 10 minutes at your local bookstore might save you from having to deal with a security break in.

Technorati Tags:

Wednesday, August 03, 2005 Could not store message: 2 msg=1 hard 
NOT_STORED PERSISTENT queue=QUEUE.teema_email_queue priority=4 
lateClone=false hashCode=28390332; - nested throwable: 
(java.sql.SQLException: Io exception: Connection reset)

Above exception is thrown when trying to enqueue object into a JBoss JMS queue that is backed by a Oracle database.

The cryptic error message is not much help. Neither does Google. Not able to find stock anwser, I started to lay down facts in order to piece together the puzzle. The first clue is that the error appears only in a particular use case, but not in others. What is the difference, I wonder. One noticeable difference is that the object to be enqueued in the failed use case is quite large compare to those in other use cases. May be size of the object is the deciding factor here. A quick testcase confirmed my suspicion.

As I know JBoss saves JMS message as blob, this looks like a problem in handling blob data. Googling "oracle blob size" turns out both explanation and solution. Apparently the older Oracle thin JDBC drivers require non-JDBC compliant way to properly handle blob data. In other words, calling setBlob() doesn't work as expected, which is exactly what JBoss JMS implementation appears to be doing. When data is less than 4000 bytes, Oracle stores it inline, directly in the column, therefore setBlob() works for small data. For larger data, Oracle stores it as LOB and that is when setBlob() breaks and our problem begins. Upgrade to Oracle driver for 10g, which is compatible with Oracle 9 database, fixes the problem. According to its release note, 10g driver adds direct support for lob/clob/blob at JDBC level.

Technorati Tags: , ,

Tuesday, July 26, 2005

Course Collision!

The Desert Southwest Software Symposium changed the presentation schedule. Two sessions I am most interested in, "Herding Racehorses and Racing Sheep" by Dave Thomas and "Advanced Object-Relational Mapping with Hibernate", are running side by side.

Now, that is a real bummer.

How to start isqlplus

To start isqlplus, a web version of sqlplus, issue

isqlplusctl start
Thereafter, the isqlplus is accessible from http://localhost:5560/isqlplus.

Technorati Tags:

Saturday, July 23, 2005

How to run native SQL from Hibernate?

Hibernate 2 provides createSQLQuery() method on the Session for native SQL. However, this method must return a persistent class and can be costly at times.

When raw power is needed, get a JDBC connection by calling connection() method on the Session.

Technorati Tags:

What to do when dbca does not start?

Yank the network cable.

Yeah, you heard me alright. If On OSX, if the dbca just sits there, no GUI, no message, no nothing, yank the network cable. This is what I learnt after having tried to reinstall Oracle - twice.

Technorati Tags: ,

Monday, July 18, 2005

How do you develop Oracle PL/SQL on OSX

Let me take back my words. JDeveloper on OSX is useless for PL/SQL programming. Attempt to compile a simple procedure will crash the JDeveloper. Now I am back to using SQLPlus. Is there any tool, preferably free, that works well on OSX for PL/SQL?

After posting, I remembered that I am using Apple's JDK 1.5. Maybe JDeveloper doesn't work so well with 1.5, I thought. So I switched to JDK 1.4.2_08 from Apple and sure enough, it crashes no more.

Now if you excuse me, I have got some triggers to write.

Technorati Tags: ,

Wednesday, July 13, 2005

Collections.sublist() returns a non-serializable list

This gotcha me today. The Collections.sublist() method returns an instance of java.util.RandomAccessSubList, which is obviously not serializable. Solution is easy - just add all contents to an serialziable list implemenation such as ArrayList.

Technorati Tags:

Prevent .DS_Store creation on network volumes

Note to myself: Execute following command in a terminal

defaults write DSDontWriteNetworkStores true

Technorati Tags:

First LAJUG night with Si Chen

Went to my first LAJUG meeting tonight. Si Chen @ Open Source Strategies, Inc presented Open For Business In A Nutshell. I have to confess that I almost passed the meeting for mistaken it as some talk on open source business model. Turns out it is about ofbiz open source project and I am glad that I didn't miss the presentation.

Si is not only a commiter on the ofbiz project but also build his own online shopping site using ofbiz. The fact that he eats his own dog food makes him much creditable to me.

I briefly checked out ofbiz workflow about two years ago. My major reservation at the time was its map based API. I was worried about the loss of compile time check, refactoring support in IDE etc. When I raised the question tonight at the meeting, Si responded that he does not find this to be a problem in his experience. In fact he actually finds the map based API is easy to work with than traditional type based API. I didn't get a chance to ask him what kind of team he had to work with. My current take on the issue is that such a approach may be more suitable for a small and competent team, but probably not in a large team consists of programmers with various experience level.

Technorati Tags:

Thursday, July 07, 2005

Why there is no GUI tool to configure JBoss?

I have long been wondering why there is no such tool to ease JBoss configuration. Given the popularity of the JBoss server, I would thought somebody must have written such a tool already. Please leave me a comment if you know such a tool.

Saturday, June 11, 2005

Oracle DBA for Dummy

Note to myself: set up Oracle user.

renegade:~ oracle$ sqlplus "/ as sysdba"

SQL*Plus: Release - Production on Sat Jun 11 07:29:50 2005

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release - Production
With the Partitioning, OLAP and Data Mining options


User dropped.

  2  DATAFILE '/Volumes/u02/oradata/test1/user1.dbf'
  3  SIZE 100M
  5  MAXSIZE 2000M;

Tablespace created.

SQL> CREATE USER user1                    
  2  IDENTIFIED BY user1

User created.


Grant succeeded.


User altered.

Technorati Tags:

Friday, June 10, 2005

Set up Oracle 10g on Tiger

This describes how I set up Oracle 10g on OSX Tiger for development use.

Sergio has an excellent instruction on how to install Oracle 10g on Panther. However because the Oracle requires gcc 3.3 and Tiger uses gcc 4 by default. Some hacks are in order.

Following Sergio's instruction to prepare Oracle installation environment. Issue the following commands as root before launch installer.

sudo nicl . -append /groups/admin users oracle
sudo gcc_select 3.3
Then launch the Oracle installer. The installation will fail towards the end complaining lost TNS when running database creation wizard. Simply abort and do following extra steps.

Step 1: Firstly, set up $ORACLE_HOME and $PATH in your .bash_profile. By default, the ORACLE_HOME is at "/Volumes/u01/app/oracle/product/10.1.0/db_1" if you follow Sergio's instruction. While logged in as oracle, add following two lines to .bash_profile, adjust the ORACLE_HOME value as necessary.

export ORACLE_HOME="/Volumes/u01/app/oracle/product/10.1.0/db_1"
export PATH=$PATH:~/bin:$ORACLE_HOME/bin
Issue following command to activate new settings.
. .bash_profile

Step 2: Relink Oracle libraries.

mv libnnz10.dylib libnnz10.dylib.ori
relink all
mv libnnz10.dylib.ori libnnz10.dylib

Step 3: Run 'dbca' to create a database. What to do when dbca does not start?

Step 4: Run '$ORACLE_HOME/'. This script will appear hang at end and displaying a message "Expecting the CRS daemons to be up within 600 seconds." The CRS is only available on OSX Server so simply Ctrl-C terminate the process.

Step 5: Download Oracle startup and stop script and extract it to 'oracle' user home. Now you can start and stop Oracle instance by running '' and '' respectively.

Step 6: If your machine has a fixed IP, you probably don't need to perform this step. Since I run Oracle on my powerbook and I am only going to use this Oracle for development purpose, I change listener.ora and tnsnames.ora under $ORACLE_HOME/network/admin to make it work with dynamic ip like and only connectable from localhost.

My listener.ora looks like:

    (SID_DESC =
      (SID_NAME = test1)
      (ORACLE_HOME = /Volumes/u01/app/oracle/product/10.1.0/db_1)

        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

And my tnsnames.ora looks like:

    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (SERVICE_NAME = test1)

      (SID = PLSExtProc)

One final point, Oracle 10g has its own JDBC driver. Drivers for Oracle 9 won't work with 10g.

Update (Tue Jul 26 08:48:23 PDT 2005): how to start isqlplus.

Technorati Tags: ,

Thursday, June 02, 2005

Pragmatically set up JMS retry strategy in JBoss

JBoss uses so called "Dead Letter Queue" to handle undeliverable JMS message. It can be configured with "conf/standardjboss.xml".

In times though, you may want finer control over JMS retry strategy. By setting JBoss specific properties before sending message, you can pragmatically override how undeliverable JMS message is handled.

  • JMS_JBOSS_SCHEDULED_DELIVERY : scheduled time for message delivery
  • JMS_JBOSS_REDELIVERY_DELAY : delay between retry in milli-seconds
  • JMS_JBOSS_REDELIVERY_COUNT : count of retry
  • JMS_JBOSS_REDELIVERY_LIMIT : max number of retry attempt

TextMessage outMessage= topicSession.createTextMessage(outString);
outMessage.setLongProperty("JMS_JBOSS_REDELIVERY_DELAY", 10000);



Technorati Tags:

Friday, May 27, 2005

Invalid RSS feed from JavaBlogs


I noticed that there is nothing from JavaBlogs since late last night. So I did a little investigation. Turns out that the RSS feed is invalid. Instead of a valid XML document, the RSS is wrapped inside HTML mark up and this chokes any RSS parser. In addition, the "title" element is missing.

Updated my javablogs preprocess script to handle this unexpected scenario.

Technorati Tags: , ,

Monday, May 16, 2005


Stay away from Macally BTMICRO mouse.

It is too small to hold comfortably. My hand is in great strain after only a few days of usage.

Its light sensor is very picky at the surface.

Technorati Tags:

Monday, May 09, 2005


Note to myself

sudo su -
mkdir -p /Library/Java/Home/jre/bin
mkdir /Library/Java/Home/jre/lib
cd /Library/Java/Home/jre/bin
ln -s ../../bin/java 
cd ../lib
ln -s ../../../Classes/classes.jar rt.jar

Technorati Tags: ,

Tuesday, April 19, 2005

Master in Software Engineering

The difference between a software engineer and a computer programmer as similar to the difference between a civil engineer and a carpenter. -- T. Scott Ankrum on

Only recently, I found out some Universities offer such programs as Master in Software Engineering. The curriculum is definitely interesting for it addresses many skills that are missing in CS education but are essential for man in the trench. I only wish I had time and money to attend such a program.

Technorati Tags:


Well, if you know what CAPTCHA stands for, you are definitely geekier more geeky than me. A Java implementation is available at

Technorati Tags:

Friday, April 15, 2005


While reading this, it suddenly hits me that IDEA is really a play at IDE A. Nice.

Technorati Tags:

Thursday, April 14, 2005

Help: do you know what this error message means?

While porting our application to Websphere 6.0 Express, we see following error message.

TRAS0014I: the following exception was logged java.lang.SecurityException: Attempted commit in subordinate
    at net.sf.hibernate.transaction.JTATransaction.commit(
If you know what this error message means, please drop me a note. Thanks!

Update (04/14/2005 23:02:10): it looks like the Hibernate version we use doesn't play nicely with Websphere 6.0.

Technorati Tags: ,

Thursday, March 24, 2005

Re: Transaction Model Choices

Dan, are you referring to two phrase locking or two phrase commit? If my memory is not failing me, the two phrase locking refers to the database locking model which ensures serializable transaction. While the two phrase commit is referring to how distributed system can collectively make a decision. It can be used for distributed transaction, but not limited to that.

Technorati Tags:

Sunday, March 20, 2005

Sir, am I hired

If I were interviewed by SKI_BUM and given days to think it through, my answer would be as following.

Pick one or more Java API's/Class libraries and critize them (both good and bad). I don't know about you. I can never remember the appropriate IO classes to use to read/write a file. Granted, the use of decorator pattern in the Java IO libraries makes it very flexible and powerful and all that. But for mundane tasks, such as reading text file, it is awkward to use and too complicated to remember. A set of routines handling common tasks in one liner fashion as in Ruby and Python would make developers' life easier and save everybody's trouble to write his own FileUtil.

How do you participate in a team? A productive team doesn't automatically appear when you throw bunch of people together. It only grows as a result of conscious effort by management and an encouraging environment. It takes two to make up a team. So I will make you a deal. I promise I will be a good team player if you work hard to grow it.

If you have a problem in the team, for example a design problem that you can't agree on, how do you usually solve the problem? I used to believe naively that design problem should be argued purely on technical merit and reasoned with rational. That is why my view did not go through even if it was later proved to be right.

Now I am wiser. When dealing with people, even if they are tech people or even geek, we can never ignore the politics at play, or the sociology as said in the Peopleware. I am working on my HTWFIP skills.

When you design a system, what are your objectives (for instance do you care most about performance, the users, etc.)? Simple to use, good default, and easily extensible.

What books on software or programming have you read lately? In the last month, I read Programming Ruby: The Pragmatic Programmers' Guide, Second Edition, Peopleware : Productive Projects and Teams, 2nd Ed. and Advanced Bash-Scripting Guide.

Ruby is the language I plan to learn this year. Bash is something I found myself in need at work. I read Peopleware because I realized, only recently, that tech skills alone is not enough to be a good developer.

Refactoring: Improving the Design of Existing Code, The Pragmatic Programmer: From Journeyman to Master and Design Patterns are the first three books I read when I first started my programmer career 4 years ago and they are on the top of my reading list. But did not read those lately.

How do you keep up with what's going on in the industry? Following Pragmatic Programmer's advice, I try to read a book every month and learn a new language every year. In addition, I read blogs to keep on top of industry news.

What's your experience with design patterns, refactoring and test-first development? There was a period right after I finished Design Patterns book, I could not help myself to refer to a design pattern when discussing code. Now however, after it sinks in, I find myself seldom talk about it anymore. It just blends in.

Although Refactoring is about improving the existing code, I tend to use it as my coding guideline and strive to write good structured code in the first place. With more and more tools supporting automatic refactoring, it is not as important to know how to do a particular refactoring by hand as to understand why a particular refactoring is needed.

I spent last year working on a Swing application and I find it is really hard to write unit testing for it.

How do you design in UML? Do you design everything in details and the code mechanically afterwards? I don't design in UML. I use UML as sketching, as Martin Fowler suggested. I cringe whenever people suggest detailed design in UML. Firstly, I don't believe you can thought of every design detail without actually writing the code. So detailed design upfront means surprise and more surprise when actual coding starts. Secondly, unlike programing language, UML is ambiguous, people tend to interpret differently.

What's your attitude towards code standards, best practices, etc? I think every team should follow a minimum set of code standards, one page at max, so that team can easily review others' code. I have my preference in coding standard but I am not religious about it. I think code standards is a mutual agreement grow out of team members rather than imposed by management.

How do you feel about learning new API's? It is the nature of our business that one has to keep oneself updated. If a new library or framework improves my team's productivity, I am certainly all for it. However I also learnt over the years to be caution of marketing propaganda. That means I will evaluate a library on my terms rather than market hype.

I skipped two questions regarding to what I am working on as my boss won't be too happy to find it here.

Technorati Tags: , ,

Monday, March 14, 2005


The javablogs pre-processor script works out pretty well. There is just one little problem -- it refuses to ignore this particular site. I used all kinds of permutation on the site name as ignore trigger and still not working.

It was only this morning when I noticed the entry is the first line in the ignore configuration file, I realized it must be due to BOM. Sure enough, save the ignore list in "UTF8 no BOM" format solves the problem.

This is not the first time I was bitten by the BOM. Yet it took me couple of days to connect the dots. I think the difficulty arise from mismatched paradigm. When I look at a text file in a text editor, I tend to believe WYSIWYG -- what you see is what you get. While text editor, trying to be helpful, hides the BOM from the view, hence WYSINWYG.

Ruby script to pre-process javablogs daily feed


If you read Javablogs, you may be aware that there are many blogs written in languages you don't understand. I have long been searching for a way to filter those out.

Since Javablog puts the site name in square brace at the end of the feed title, it is conceptually easy to filter out feed by pattern matching its title. The problem is that few RSS readers support such operation. NetNewsWire 2.0, the reader I use, supports smartlist. Like smart playlists in iTunes, smart lists display news items based on rules that you set up. However, smartlist only covers half of what I want, the pattern matching part. Since I can not specify what action to take on matched item, I have to perform filter out manually -- by marking all (of my "Junk" smartlist) as read. To add salt to injury, the smartlist doesn't always work since the NNW2 is still in beta. I was troubled for the past few months.

Then it suddenly draw on me last night -- why not write a script to pre-process the feeds? Considering that I have been using script to grab Javablogs all along, it is surprising I did not think of this early.

While writing the script tonight, more ideas came along. The resulting script does following:

  • ignore news items of which the title contains any of ignoring texts you specify. Ignored item is removed from RSS content.
  • highlight news items. Append "(*)" to the item title so that you can easily set up rules for those items in your RSS reader.
  • alert. Very often, people republish their Blog and results in the entire site archive shows up in the feed. I consider it a anormaly if the number of entries for a site exceeds 10.
  • process log is generated as a news item.

I am happy now.

UPDATE: append "(-)" to the alerted item title. handle empty line in the configuration file.

Technorati Tags: ,

Tuesday, March 08, 2005

Find changed files

Recently I often need to find out what files are different between CVS branches. Because we have CVS tags such as $Id in the source code header, it results in GUI diff tools thinking every source file is changed.

Time to drop to terminal. I use the following command to generate a list of changed file name.

diff -Naur --brief -x CVS -x *.class -x ".*" -I '^[ \t]*\*' source-dir target-dir | awk '{print $2}' > diff_file_list
The interesting option is '-I ^[ \t]*\*', which ignores any line change starts with "*".

Learning Bash

On more than one occasion last week, I found myself in need of a quick thrown together shell script. In the sprite of sharpening the ax, I studied the Advanced Bash-Scripting Guide. After learning the capability of Bash scripting -- string manipulation, loop and conditional structure, I realized many chores I used to write in Python/Ruby can be easily done in Bash.

Friday, February 25, 2005


Remind is a sophisticated command line calendar and alarm program. Its scripting language is a great model for designing scheduling domain language. I am particularly fond of its way of specifying "last Friday in Feburary". Instead of introducing the concept of "last", specifying the equivalent -- "7 days before the first Friday in March". Very clever indeed.

Saturday, February 19, 2005

J2EE Server = SUV list

Posted by George de la Torre on TSS

=== start quote ===

1) Borland Enterprise Server (BES) = Porsche Cayenne

The Cayenne power comes from a twin-turbocharged V-8 with 450 horsepower, idle to 60 in 5.6 seconds - the fastest "real-world" SUV in the market.

The only difference between BES and Cayenne is that BES has a better cockpit.

2) Weblogic = BMW X5

The X5 has intelligent all-wheel drive system with exotic luxury features.

The BMW X5 and Weblogic are products of the same inspiration for the same market.

3) Websphere = 1995 Ford Expediion with Escort drivetrain

Escort's 4 cyl 1.8 L engine delivers good gas mileage for Expedition, but bad news if you actually have to get somewhere.

Websphere's EJB container may have better mileage.

4) Oracle OC4J 10g = Last place finish Junkyard Wars challenge

A cable TV show that challenges participants to build from junk yard materials. Thus, build a SUV that will carry a 50 pound weight for 50 yards.

Incredible, the exact same requirements for OC4J...

=== end quote ===

No UTF-8 support in SQL Server

OK, I admit that I am a little biased as a Java programmer. But is it too much to ask for from a major commercial database? In Storing UTF-8 Data in SQL Server, Microsoft acknowledges that "some applications (especially those that are Web based) must deal with Unicode data that is encoded with the UTF-8 encoding method". But instead of adding UTF-8 support to SQL Server, they patch up the IIS to perform UCS-2 to UTF-8 translation and of course you have to use ASP to benefit from that. As for those who dare to write their web applications in other insignificant languages such as JSP, you deserve to write your own conversion routine. And if your language of choice doesn't support UCS-2, you really should switch to any of "ODBC, OLEDB, COM, Win32 API calls, VB, and C".

Technorati Tags:

Friday, February 11, 2005

| vs ||

Obie is puzzled by the use of |= as a boolean operator. I can not help my smile when I read that as that is exactly sort of thing I was not aware of until I prepared for my SCJP. I know all along that boolean operators || and && do lazy evaluation. What I didn't know is that | and & are also valid boolean operator, which always evaluate both operands.

Guess I did get something out of SCJP afterall.

Technorati Tags: ,

Monday, February 07, 2005

SCJP certified

I took the Sun Certified Java Programmer 1.4 (SCJP) exam this morning and passed at 95%.

The actual test questions are easier than what I had expected. The difficulty of multiple selection question is dramatically reduced by giving away the number of answers expected.

The main book I used for self study is A Programmer's Guide to Java Certification, which has been my trusted Java reference book for the past three years. Since the book is written for SCJP 1.2, only the first eleven chapters are relevant. For test topics not covered in the book, I used Sun's assertion tutorial and the chapter 3 of Effective Java for its coverage on hashcode() and equals().

The mock up exam on covers the test topics throughly and provides detailed answer. Much recommended. If you are an experienced Java developer short on time, you can probably skip all the book reading and start right from there.

Technorati Tags: ,

Sunday, February 06, 2005

Saturday, February 05, 2005

Monday, January 31, 2005

Locating Code Source

Liou Dong blogs on how to locate the code source of a given class. Use his idea, I put together WhichClass.jsp for use in the web application (screenshot). May come in handy someday.

Technorati Tags:

Preparing for the SCJP exam

Yes, Sir. I am aware of the fact that SCJP is of less value to me, considering that I have more than three years of Java experience now. But since "No More Procrastinating" is top on my New Year resolution list, I will start with getting SCJP certified, something I wanted to do since my graduate school days.

Monday, January 24, 2005

Bye Bye, Palm

PalmOne (has) a disinterested customer base and a product line that's two years behind everyone else.. Right on, could not have said it better myself.

What is my grudge? Palm doesn't handle Chinese correctly on OSX. Although I found a copy of patched Palm Desktop conduit that remedies the problem, I am forced to use Palm Desktop which is limited and ugly. Feeling neglected and not cared for, I want to purge Palm Desktop from my hard drive. I wanted so bad, I bought myself an IPod Mini last weekend and did exactly that.

Technorati Tags:

Wednesday, January 19, 2005

Are you sure your Oracle is set to UTF8?

SQL Error: 17037, SQLState: null
java.sql.SQLException: Fail to convert between UTF8 and UCS2:  failUTF8Conv

I googled, googled... Found plenty of people asking the same question, but no definite answer.

The problem turns out to be that the correct NLS_LANG setting for UTF-8 support is AL32UTF8, not UTF8. As documented in Oracle's Globalization Support Guide, only AL32UTF8 supports the Unicode 3.1.

Technorati Tags: ,

Tuesday, January 18, 2005

Subscribe to JavaBlogs daily feed in NetNewsWire

The RSS daily feed of javablogs is in the form of
Therefore the feed for today's entry is dynamic and changes every day. This kind of feed can be easily handled by script subscription in NetNewsWire 2.0. Below is the ruby script to do just that.
#!/usr/local/bin/ruby -w

require 'date'
require 'open-uri'
require 'stringio'

d =

op ="", "w")

open("{d.mday}&amp;month=#{d.month - 1}&amp;year=#{d.year}&amp;view=rss",
    :proxy =&gt; nil) do |rss|
    rss.each_line {|line| op.puts line}

puts op.string

Technorati Tags: , ,