|
|
Monday, January 6, 2003 |
I love coding, but sometimes it's frustrating as hell. Today was one of those days. Castor JDO is a great tool, but it's lack of appropriate error messages is a killer. If I had the time, I'd help them put more descriptive error messages in their code. That wouldn't be too hard to do.
Java coders, if you have spare time go lend the Castor JDO project a hand. Put some descriptive error messages and documentation in!
6:29:14 PM
|
|
AAAARRRRRGGGGHHHHH! I've been working on a problem with Castor JDO 0.9.4.1 for several hours now. I have a class that represents a simple table. It has 3 columns, one of which is a char(1) in my database. I am mapping that in to a String in my Java class.
The problem that I've been having is that I wanted to tread the char(1) column as a boolean with getLock and isLock accessor methods but really store it as a String behind the scenes. However, Castor JDO doesn't like that at ALL! I had to change the code so that it was using getLock and setLock with the appropriate String types. It took me FOREVER to figure that out, because I didn't realize it was a problem with the class. Castor JDO apparently looks at every class in the mapping file at the time it loads its configuration and not just when the class is first used.
The problem showed up in my application as a NullPointerException right after I loaded the configuration with JDO.loadConfiguration().
4:07:22 PM
|
|
If you use JDO Castor 0.9.3.x, and you specify in your mapping file that a column is a primary key, you better make sure that it has a primary key index on it in your database. If not, JDO will fail with a NullPointerException!
11:35:55 AM
|
|
Here's a bash script that I wrote to calculate the MD5 hash of all files in the specified directory and below. It's quick and dirty, but I've found it useful to compare files in 2 directories to see if anything has changed. I can pipe the results out to a file for each directory and then diff them. OR, even better, you can compare them with md5sum itself by:
cd <dir-to-compare> md5sum -c <file-contatining-sums>
Here's the script:
#!/bin/bash # Script that calculates an MD5 hash for each file in the specified directory # and all directories below that. # # Author: Tom Pierce # Date: 10/31/02
export IFS=$'t\n'
# a quick check to see if any files were given # if none then its better not to do anything than rename some non-existent # files!! if [ "$1" == "" ] then echo "Usage: md5dir " exit 0 fi
# For each file in the specified directory, get the md5 for file in $(find $1 -type f) do md5sum "$file" done
10:34:31 AM
|
|
© Copyright 2004 Tom Pierce.
|
|