Archive for March, 2004

Implementing a web-poll, just how easy?

Tuesday, March 30th, 2004

So I’m pondering the implementation of a quick poll. Say I wanted to have people vote for their favourite Struts book. Not too hard. I’ve done such things in the past with a few lines of php and a mysql table.

I hit a problem with my pergamum site though. It’s all static. So I wonder, what would be the easiest possible way to implement a poll, hopefully keeping it utterly static.

Here’s my [just in my head] solution:

The poll merely links to a relatively empty page, which redirects to the results page. The results page mentions that the poll is updated every 5 minutes, so the voter’s vote won’t be shown yet [an unfortunate downside]. Additionally, the server has a simple cron-job which greps the web-logs for the urls and ips, weeds out any duplicates and generates the results page, every 5 minutes let’s say.

All very static as far as the server is concerned, and very, very basic. To make it easier, I could possibly configure Apache to log those particular special urls [say they all end in .vote] to a special log, and the cron could check to see if the special log is newer than the results page. Then it could possibly be run more aggressively.

Bizarre…yet I like the cut of its jib. Now to wait for the itch to strike to implement such a thing. Maybe I could make it a more global thing, not a poll but a category-vote, which would end up with a best-of-category series of books.

Books on Open Source Java changes..

Monday, March 29th, 2004

Tim Vernum supplied me with a new l&f for the Pergamum site, which Jason Jones [gfx designer at my workplace] made a few adjustments to and it’s now live. Many thanks to both of them.

It’s also now at a new url, www.pergamum.org.

Next up, RSS feeds.

Books on OS Java site…

Monday, March 29th, 2004

Books, open-source and Java fill a lot of my time. So I decided to let this potential scratch drive an itch to do something simple and fun; making a website about books on open-source Java projects.

It’s currently a sub-directory at osjava.org, http://www.osjava.org/pergamum/, but will get its own domain name soon [better than wasting 8 dollars on 2 beers anyway]. It’s implemented in an odd way that I aim to continue to play with. MVC + XML. I’m sick of always starting these projects as an sql schema, so having failed to keep the itch scratching in that method a few months previously, I decided to implement the database as a series of XML files. Very loose.

It was but a short step from there to trying to use XSL to create HTML pages, rather than bothering my servers with dynamic code. However, this felt bad. I wanted to do something like sitemesh/tiles, where a layout is defined which includes various lesser pages. Portal-like.

So I created a series of content files in xml which describe the site itself. The XSL [and the simple Java file that runs it all] is responsible for taking the content files and db files and creating the HTML from their union. Lots of good XSL lessons learnt, though HTML seems to leak into all parts of the system. This is a laziness I guess, p and a tags could be renamed to para and link to slowly create a non-html schema.

It’s hiding in the new osjava svn repository if anyone’s interested.

The next step was to try and have a nice look and feel. Well I suck at this as I have no colour sense at all. The initial colours I chose [a nice red and green] seemed to make people vomit [or to quote Steve, “Make my eyes want to vomit”], so I simplified it all. It’s probably still terrible, but at least your eyes are still dry. Anyway, nice look and feel ish occurred in pure CSS. I dislike pure CSS as absolute positioning makes me squirm, but it seems to be okay above 800×600.

If anyone has any opinions, I’d be interested in hearing them [username: bayard domain: generationjava.com].

Youngsters?!? I'm old

Monday, March 29th, 2004

Federer [swiss tennis player] just lost to a new wunderkind 17 year old Spaniard. The BBC report that:

“He hit some really incredible shots, and that’s what youngsters do,” added the 22-year-old.

YOUNGSTER?!? You’re 22! That’s no excuse. Say you were out drinking last night with supermodels and these 17 year olds get to bed early or something.

What happened to the previous days quote of:

“I was very concerned. I was not feeling well today,” said the Swiss player.

http://news.bbc.co.uk/sport2/hi/tennis/3577661.stm

branching/tagging in svn

Sunday, March 28th, 2004

Slowly my mind is unlearning the cvs concepts and learning the svn concepts. Must remember to say that at work at some point, keep ‘em afraid.

Anyway. While the looseness of svn’s branching/tagging makes me nervous, it also starts me thinking about setting up the type of system I want in CVS.

Top level is the repo. Under that is trunk, dead-fork, fork, bugfix, dead-bugfix and releases. Robert [osjava.org SVN admin] has set us up with trunk, branches, tags and releases; which should be fine there but won’t be organised enough for work.

I’ve noticed that we only branch for one of two reasons. The first is a bugfix. This is when an existing tag is branched for a short series of fixes to be made. It may not be short, but often is. The other is a fork. This is usually due to a physical difference [we have european and usa versions of the software, which are often developed in stagger] but might be due to a temporary idea [rewriting a mound of code to use hibernate when near a deadline]. In both cases, but especially in the fork case where the active lifetime is a lot longer, I want to record which forks are still open, and which are dead.

Now, I can remove the branch when it’s not active anymore, but this seems a bit dangerous. From reading the SVN book, it seems tricky to look for deleted information [no Attic with its fortunate side-effect], so removing old forks seems worrisome.

Possibly the biggest thing I like about SVN tagging etc, is that as it’s a copy operation, it will be commentable. Now the only problem is that there’s no easy way to ask for a report of all tag comments, because it’s just a copy. Curses.

Anyway, I think I’m starting to see a light. Shame the one place it would pay off is the last place I’ll be able to apply SVN. I’m pencilling in a 6-12 month migration aim.

SVN Server

Sunday, March 28th, 2004

So, following the happiness of feeling in control of SVN Client installs, it’s time to tackle the server again. Last time I got it all done, except for the bloody LANG variable.

So, starting anew, I decide to install the latest berkley db library. I’m trusting that having an older version installed won’t be problematic. This all goes well enough, though the berkley setup is a little non-standard.

Next, install subversion! Link to Apache, pass the –with-ssl [and install openssl-devel] and we’re good. Erm. Nearly. Turns out I’m a minor-release too far behind on my APR. 0.94 instead of 0.95 onwards. Curses.

So, install Apache 2 latest. Which I have PHP 5 hooked into, so I’ll go ahead and install the latest PHP too [RC1]. Which needs libxml2 2.5.10 and not 2.5.3 as I have. At least the Eels are playing from the CD player to keep my spirits up.

Hunting libxml down can be a pain. I seem to recall having to do this before once. PHP don’t list the url [xmlsoft.org], and they don’t offer any http downloads, but the second ftp server appears to respond somewhat. Not all good though, the ./configure for libxml2-2.6.8 tells me my /lib/cpp fails sanity check. Erm. If I’d known the sanity of C++ was being debated I’d have stopped resting my feet on the server for warmth, cpp/GCC 3.3 btw.

So the first chickening out, –disable-libxml to stop it looking [happened to notice such a thing existed while googling]. This hits a problem with a failure to see the postgresql installation path, well I thought I’d try :) I am trying to get myself to use postgres and mysql in equal amounts. Quick switch to sudo’ing the configure as the postgres path is not readable by a normal user, but still a failure. Giving up on php->postgres. Second chickening. Time to make.

Apache build next. Goes smoothly on top of the old version. Until I try to start it. undefined symbol dav_xml_get_cdata. As it was already running, subversion make/install went smoothly. So apart from a fragged apache, so just a fragged apache. Now, I’m pretty clueless, but at least I can move the dead apache2 out of the way and repeat the make installs for apache, php and then subversion to see if it fixes things. Sadly it does sod all.

Seems that I might have to –enable-dav the http install. Odd. I thought that was default. Something to try. And it seems to work. At least Apache does. Next step…learn SVN and DAV. [when I get to that point in the red-bean book anyway].

svn on SuSE

Sunday, March 28th, 2004

Amazing, my wife is in Boston for 5 days and I somehow am doing less coding at home than I usually manage. The usual routine s’all messed up.

I am however endeavouring to grokk subversion. Having failed to install it on Linux [SuSE] and OS X in the past, I was pretty low on hope. However, I did a source install on the Mac a week ago and am enjoying its use there [fink’s svn is useless, go straight from source with ./configure –with-ssl].

I can now repeat this happily on the SuSE box too [though you need to change the LANG variable to “C” and have openssl-devel installed]. The latter is a general linux tip I guess. If you ever seem to have problems in which an install is claiming you don’t have library xxxx, chances are you really need xxxx-devel.

Next up, a repeat attempt at installing the server.

xsl fun

Wednesday, March 24th, 2004

I’ve been playing with XSL recently. I had special fun trying to do the following:

document($src)/html/head/title

It never worked. I yelled, I cursed, I offered praise to the small gods, but no avail. Then I found an old email from James Clark to the Mulberry list [I remember being on that list 4+ years ago when I first read about XSL], in which he points out that XPath does not work upon the default namespace.

Ouch, think I. Still the small gods fail to offer options. So I did the next best thing, I guessed based on the principle of least surprise.

document($src)/:html/:head/:title

and it worked. Simple really.

Hibernate dependency frustration

Monday, March 22nd, 2004

Am I the only one who finds Hibernate an utter pain when it comes to dependencies?

It depends on commons-lang.jar! Woo. Will that work or not with my other code that depends on commons-lang-2.0.jar.

Okay, I know that the versions are listed in README.txt, but I have my doubts on this as I have two cglib2.jar’s which claim to be version 2.0-rc2. One of which contains org.objectweb.something.Type and the other doesn’t. 30k or so difference, both culled, I believe, from different versions of Hibernate.

Java Teaching

Sunday, March 21st, 2004

I’m very close to agreeing to do some Java teaching in the evenings for the next 5 months. I’ve been teaching/mentoring people since I first did Java [my course had a lot of non-hard-code coders on it], though I’ve never actually taught a class [16 in this case].

My largest worries are over the lack of a strong syllabus or existing slides. Sounds like we’ll use Thinking in Java though, and apparantly Bruce Eckel has some slides I can base off. I guess I’ll just go through the book and highlight chapters I want to teach.

One interesting thing is going to be UK vs US style teaching. In the UK [for me at least], there were no books you had to have with homework of reading chapters. Maybe a couple of courses had them, buggered if I can remember. I’m not sure if these students are expecting to go home with a homework of “read chapter 5″ or if they expect to go home with programs I want them to code. It’s not for a computer-course but some kind of business course, so that may affect the style. Plus there’s an online element. So I might have to write painful multiple-choice style quizzes.

It would be cool if I could setup my own system with Applets, though I wouldn’t have the time to develop it, but I’ll be stuck on the college’s system.

Another hard thing is the renumeration. It’s actually good money for the hours I’ll be teaching I think, but it’s poor money for the effect I suspect it will have on me in terms of hours. My wife and I share a car, so an 8->9:30 lesson actually involves me staying at work 2 hours late. Or driving a lot more.

Still. There will be two major benefits. Public talking, which with the dearth of numbers at our JUG has been hard to achieve, and discovering if I like teaching, or just being an assistant.

Also, there’s the academic discounts while an educator :) While I’ve not really got my eyes on anything, unless I choose to use Keynote or something for presentations, there must be some things out there that will perk my interest.

Anyone know a company who do sizable academic-discounts on rack-servers? :)