Archive for November, 2002

GenJava core work

Saturday, November 9th, 2002

Went through the good experience of deleting old code. Emptying things from GenJavaCore that are now released in Commons Lang, Collections and CLI.
One early piece of code from March ‘99 was especially hard to delete :)

JDJ editorial

Saturday, November 9th, 2002

This months JDJ guest editorial is from Joseph Ottinger, a name I’ve seen around a fair bit and who seems to have been involved in many Java community things.

He has a fairly big grumble about the JCP, which seems relatively justified, though his example of Log4J seems utterly wrong. As far as I recall, JDK 1.4 Logging came from IBM’s Log framework and the Log4J parts were integrated only after much community disfatisfaction. So to blame Log4J for JDK 1.4 Log’s lack of new concepts is a bit weak.

Typical coding

Friday, November 8th, 2002

Ah, a typical evening of coding. I started by looking to fill in some parts for the new DbUtils project I’m trying to get going at Jakarta Commons. It’s an itch I have to scratch at the moment but does mean less time for IO and getting the next release of Lang moving [we had a big bug with setMaximum returning the minimum :)].

So after committing a minimal first DbUtils from my own JdbcW’s two most commonly used methods, I then looked into writing your own jdbc driver [btw, jdbc is trademarked, so no Jakarta Commons JDBC project :( ]. This of course led me to a classic “i should do this” subject of “why don’t I generate it from java.sql.Driver”. Thankfully this time I had my correct-lazy hat on and I did it. Kind of.

Java is all well and good, but perl was my first love. And I got to spend the evening playing with perl, writing regexps [my real love, perl was just an excuse to get at regexp] and crying out in glee [much to my wife’s amusement] when I come up with such wonders as:

s/ ([^( ]*)(([^)]*))[]/[] ()/;

So now I can type: javap java.sql.Driver | wrap.pl | import.pl
[Note: This still has issues. For example, java.util.BitSet shows some bugs]
and get:Obviously not compilable, but a long way there;

import java.sql.Driver;import java.sql.Connection;import java.util.Properties;import java.sql.SQLException;import java.sql.DriverPropertyInfo;

public class DriverWrapper implements Driver {    public Connection connect(String string, Properties properties) throws SQLException {    }

    public boolean acceptsURL(String string) throws SQLException {    }

    public DriverPropertyInfo[] getPropertyInfo(String string, Properties properties) throws SQLException {    }

    public int getMajorVersion() {    }

    public int getMinorVersion() {    }

    public boolean jdbcCompliant() {    }

}

Blogs…

Friday, November 8th, 2002

Stuck at work? Bored? Just not quite enthused to work on that open source Java code to save the world?

Why not goto Google, search for the name of your hometown and ‘blog’ and just surf with laughter. A true understanding of why blogging has the “And jimmy broke up with me, but it’s okay because [celebrity] is on [tv show] this week” stereotype.

Thanks to Eric for getting me stuck into blog-laughing.

Outliner

Friday, November 8th, 2002

Fleeting mention [James Strachan’s already pegged it, and someone else before him. Russell?].

Outliner is very cool. Not only for putting todo’s in, but possibly for recording the time-tracking information I’m having to start to record at work. I wonder how it compares to OmniGroup’s Outline tool. They’re stuff is usually very good.

OS X and Open Source Java

Friday, November 8th, 2002

What is it about OS X and us open source Java people? It’s amazing.
I got my powerbook hot on the heels [July/August 2001] of hearing so many good things and hearing that John Viega [Security guy, wrote Mailman, runs a company over DC-way] was loving his new powerbook. I had a signing-bonus cheque in my pocket, I had a catching website in my eyes and John egging me on from the sidelines. So I did it.

Wow. Yum. Wow. Yum. Ooo. Eek. WHAT? Oh. Mmmm.

Is pretty much the story of the first day. That was around about the time I started to get into Apache [if you don’t have a laptop, buy one, it sets your coding free] and as I hung around the Apache pits, I discovered more and more people, Java people, running OS X. Back on the Muds, people were quickly aquiring powerbooks or ibooks. George Reese [Database guy, wrote the first jdbc driver, works MN way] picked one up, and I think loved it, Robert Zigweid [works for John, used to work with us Brits back at Internation] adores his and people whose names I don’t even know [just their pseudonyms] were happily chatting about their new apples.

So what’s the deal? Java is still behind on OS X, there aren’t tons of apps out there, though the apps there are, are great. Apple are hardly an open, embracing company, but OS X is… it’s the linux we were hoping might turn up isn’t it. I’m a long time SuSE user, but it’s never been like this. This isn’t a computer, it’s a device.

Either this is love, or Apple’s marketing department have suckered an enourmous percentage of the internet communities I involve myself in. Damn. It’s the bloody marketeers isn’t it.

Coding Badly, Well?

Thursday, November 7th, 2002

I’m writing an app for my wife. A time-tracker. It’s a whole load of experiments in one. It’s view-driven in that she makes a html-mockup, then we discuss it, plan a data-model if need be, and I implement the logic. I’m trying to do it using the highest tier technologies I can, so all in JSP is the dream. And I’m aiming to migrate it from mysql to postgres for production.

I’ve chosen to use the JSTL, and more surprisingly for someone who spends all his time using Java to load from databases, I’m going to attempt to rely on the JSTL sql taglib, that is, SQL in JSP! [Shocks, cries, people faint at their browsers]. The crux of the idea being, can a technology be BAD, or is it merely the inexperienced uses people put it to. Can I happily setup an MVC structure [and with it a pattern-framework that my wife can follow in later projects] without having to launch into the depths of JDBC?

I think I can. Part of this is due to the fact that I think that SQL is a part of the Controller and not a part of the Model. Admittedly it’s a part that should probably be abstracted below the Controller, but there’s no great need. It’s the Controller’s job to decide when and where to load new model’s etc, and that’s what the SQL is primarily for. Indeed, the only Java will be the Model, aka a set of JavaBeans.

This is where i hit my first real grumble. I’m being simple and lazy. Why oh why is the classic bad Java struct not recognised as a Bean :)
public class Person {
public String name;
}

I know, I know. But it’s an irritating limitation as I so very very rarely find a need to put anything in the encapsulation. Part of this is to try bad ideas and see if they really are that bad, so a shame I can’t try that one. The world is saved.

I’ve hit some oddities in JSTL, but all in all it seems to be working okay. Once JSP 2.0 is available I can see that a fair chunk of the oddities will work or be simplified. Indeed, it’s hard to remember that when the JSTL isn’t working I can just rely on the good old basic JSP bits.

My first real crash is in everyone’s favourite: Sequenced numbers for object IDs.
In PHP, which is where I’ve often done little hacky apps for my wife, the mysql-drivers have a nice bit in which the auto-increment field of the table is returned from the insert-method. I’ve hidden this all behind a PHP-OO API, but it is still very nice. In JSTL, I can’t even use such nasty hacks as SELECT LAST_INSERT_ID(). I suspect because of a commit or some such, it always returns 0. I’d only have to port to postgres anyway, so I need a better solution.
Brett McLaughlin discusses it in his Enterprise Applications book, so I may take a brief sidestep to research a good sequence-number API or make my own. [At work we use Oracle Sequence numbers explicitly, so it’s been a while since I’ve had to think about this issue. Back in the UK we just used a unique number [time and memory]].

So after the first night or so of hacking, I’m still quite enthused that a good JSP architecture can be created without resorting to much Java [and the little Java needed could easily be generated from a command-line wizard, in fact, I should do that]. Although it’s easy to slip into a mess of jsp files, and I’ll have to keep refactoring the framework until it’s ready to be declared ‘The Way We Do It’, I think it looks good.

OmniGraffle

Wednesday, November 6th, 2002

I was playing with OmniGraffle last night, and updated [well, redid] my home network diagram. I like OmniGraffle, need to take it to work and use it for design documents there.

Anyway, here’s the 2nd version of our network. There’s a PNG, but oddly enough if I click on it in Mac IE it claims not to know what to do with a file of that format.

The first version is also still there. So you can see the changes to the network that have been made :)
Note, I haven’t replaced everything with G4’s, I just preferred the nice colours to the boring PC images.

Blogs etc

Wednesday, November 6th, 2002

Gotta love how Moveable Type keeps you blogging by screwing the layout up when the number of blogs in a given period tends to one. Unless that’s my modifications, but I don’t think it is.

Looking for a nice RSS client. Moatas pointed me to AmphetaDesk, but as he pointed out, it’s got no memory for what I’ve already read.

I used to have a nice Docklet on OS X that did this kinda thing, but it didn’t record habits either and only did certain hard coded feeds. Still, it must have improved by now so I’ve just got to hunt it down. Any recommendations out there?

Time off

Wednesday, November 6th, 2002

A nice weekend with no techiness at all [my dad was visiting from the UK and my wife was christmas shopping in Chicago]. Thus nothing much to post.

I’ve started to read into Bitter Java. It starts well, the author achieves a quick rapport. I turned WEP back on, the Zaurus accepts it all happily, though Opera on the Zaurus continues to fail to download .ipk’s properly.

Just finished a Frederik Pohl book, Starburst. I’ve a mound of sci-fi/fantasy to work my way through, and another mound of technical books to go through. Including learning VB.Net and SQL Server 2000. Maybe.

Release of CLI imminent, helping John Keyes out with that, and a production release at work is close, which means i’ll get to do my favourite part, go through CVS and upgrade/break/fix lots of things.