Nerdishness

JPublish 2.0

Tagged:  

I'm a bit slow on this one, but Anthony Eden has reacted to some of my earlier comments on JPublish by publicly mulling over his plans for 2.0. He's going to come up with an architecture for storage, something it lacks now, and hopefully a way to get content into the system. He's also thinking about what modules it needs.

JPublish's model for finding data, templates, and meta-data is very nice, but there are no tools for entering any of these things, other than by plopping them into the file system. That's the best way to manage data as files, since there are plenty of tools available. But for those who want to keep a lot of content in a database, we need some tools to manage that content.

One thing that will be interesting to see is whether Anthony moves over to a JPublish-based blog package at some point. He's a big booster of Roller, which looks like it is on the way to becoming a primo Java blogging package, but JPublish would be a good platform to build a blog/wiki/forum type thing on top of, something like what Russell has been talking about. Of course Roller is here now and rapidly being improved by a community, and I haven't seen any momentum for building something like it on JPublish, so I guess it's a wheel thing.

One thing Anthony mentioned as a goal for JPublish 2.0 is:

In general I am going to try to factor out as many of my own components as possible and start using other peoples components so that I can focus on items which are really important in JPublish such as the repository system.

This is one of the reasons I decided* not to use Cofax: it implements its own database persistence, templating, and pretty much everything else, and IMO spreading development effort over so much shows in that each of these is mediocre when compared with components available off the shelf, such as Velocity, OJB, WebWerk, etc. There are some things I like about Cofax, in particular the way it finds page templates is brilliantly flexible. But I decided that refactoring Cofax's framework to implement standard components would be more work than reimplementing its clever bits on another framework.

(* Back when I was looking to get into CMS consulting, which it doesn't look like I'll be doing after all)

java.blog

This branch of my site is now officially a Java Blog, with a listing on Mike "The Rebelutionary"'s list of Java-oriented blogs. It's kind of weird to see kief.com listed as a blog - I've had this site for five years, and it was never a blog, just a few stale pages where my family could see what I was up to 9 months ago. Once I set up Movable Type to manage the pages, I just fell into blogging, and now there are actually a handful of people reading the site and linking it from other sites. Cool!

Of course I don't consider this to be a pure Java blog, Java is just one of the things I'm into. But if the multi-blogger is a Java Blogger, why not me?

Thanks Mike! I'm putting the new java.blog button in my sidebar - btw Mike, where's yours? ;)

Tomcat, tempdir

Tagged:  

Finally found the cause of the problem I was having with Tomcat, and it was a bitch to find. Basically, I was missing a directory named "temp" in the CATALINA_BASE directory. Usually this is caused by unzipping the Tomcat distribution with an unzipper which doesn't create empty directories, which apparently WinZip doesn't. This actually wasn't my case, I'm building the web site home with Ant, but my source copy of the website didn't have the temp directory, so it was the same problem.

Searching on the exceptions involved turned up lots of irrelevant stuff, but I finally turned up a thread on the Tomcat-Users mailing list which tipped me off. For the record (and Google), here's the stack trace I was getting:

2002-09-03 14:40:59 ContextConfig[/docs]: Scanning JAR at resource path \n '/WEB-INF/lib/neat_friends.jar'
2002-09-03 14:40:59 ContextConfig[/docs] Exception processing JAR at \n resource path /WEB-INF/lib/neat_friends.jar
javax.servlet.ServletException: Exception processing JAR at resource path \n /WEB-INF/lib/neat_friends.jar \n at org.apache.catalina.startup.ContextConfig.tldScanJar(ContextConfig.java:936)
...

----- Root Cause -----
java.io.IOException: The system cannot find the path specified
at java.io.Win32FileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1162)
at java.io.File.createTempFile(File.java:1247)
at java.io.File.createTempFile(File.java:1284)
at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:143)
...

Keywords: Tomcat 4, scanning jar, jar file does exist! WTF!?!?

Untangling hairballs

For the past week or so I've been working at untangling a hairball. The Wild5 site was our first product at bitBull, and it was a lot of fun to build. I worked with a team of great people who really know their stuff, and cut my teeth on a complex JSP/servlet/database site. Too bad it never made a cent.

James is still working on the games/graphics code which was used to create the chat, but the rest of us went off to other projects, and the site has languished. The live site is on a server we no longer have full access to, and some of the source code has fallen into the cracks (lesson: make sure everyone keeps their code updated in CVS!!) Every once and a while I get some time to take a whack at fixing some of the bits that have broken, in preparation for moving it to our own server, and each time I get a little further, although it always takes a while to figure out where I left off last time.

Since the wild5 was my first major Servlets project, it suffers from being a learning experience, there are lots of architectural flaws. It's not a total hack job, the HTML is created in JSP pages and the logic is mostly in separate libraries with well-defined functionality. But it's not totally consistent, there is still too much logic in JSP, the database and javax.servlet.* classes both creep into the logic, and of course there are zero unit tests, much less round-trip tests.

If I had the time and the possibility of revenue, I would do an overhaul using Good Programming ] techniques. First, write round-trip tests to parse the HTML and verify the functionality from the user's perspective, then start refactoring. Out with the JSP, in with Velocity, out with my half-baked persistence package, in with someting like OJB, unit testing all the way. But I don't, my objective is just to get it functioning on a new server.

The new and old servers are both Solaris, so the only real changes are the database, from Informix to MySQL, and the servlet engine, Resin to Tomcat 4. First I got it going on my Win2k laptop with MySQL, twiddling the SQL code to handle the database changes. This wasn't too painful, although my persistence package was only half-baked, we did keep most of the SQL code fairly centralized.

The biggest pain was when I humped it from my laptop onto the new Solaris box, it turns out MySQL is case sensitive on Unix, especially with respect to table names. Neither Informix on Unix nor MySQL on Windows is case sensitive, so until now the database code mixes capitalization for table names. Since our table names are often the same as names of classes and variables, a simple search and replace wouldn't do it. Ugh.

Now it's working, but I'm wrestling with Tomcat. I supposed I could leave it with Resin, but being a committer on Tomcat, even if I'm the world's least frequent contributor, I figure I ought to do the dogfood thing and run it. I'm currently stuck with an error I've seen before, where Tomcat finds all of the jars in WEB-INF/lib, and then declares that the path to each of them is invalid. I don't remember how I've fixed this before, I think it was something that didn't address the problem, e.g. update Tomcat from CVS and rebuild. The mailing lists and bug database mention the problem, but have no solution. I'll keep banging my head on it, maybe I'll be able to squash the bug.

Gentoo Metoo

Tagged:  

While downloading Gentoo Linux in the background I read that Rafe has just installed it. Something in the ether? Since I've got my Solaris box which I can fiddle on from the office, I don't really have much use for my third PC at home, a crusty P5 (what the kids today would probably call a P1) languishing with a two-versions old install of FreeBSD. But I'm probably going to be teaching some Unix sysadmin stuff in the next week or two, so I figured I'd use Gentoo to teach on.

Why Gentoo? Because it seems like the cleanest Linux distribution, and I want to start with a stripped down box and build it up by hand. If you're going to teach a class on cooking, you wouldn't show your students how to put frozen meals in the microwave, you'd want them to know how to make dishes from scratch.

I would use FreeBSD or OpenBSD, but most of the students (my coworkers, actually), have at least tried Redhat Linux at home, and especially in the Turkish and European markets, I think "Linux" is better CV fodder. It's one thing for me to run a niche-market, high-testosterone system for my own purposes, but I have a responsibility to my students. Gentoo should give me the brand value of Linux combined with the dirty-hands learning experience of *BSD.

I'm still working out how to structure my "Unix From Scratch" course. Maybe the best thing is to sit down together and install Gentoo on a PC, then create user accounts and customize their dot-files. After that we can add stuff to the box like Apache and other apps, and eventually get into snort, crack, ipfilters, etc. I think the best approach is hands-on, where I'm learning and figuring some stuff alongside them, so they can see how the process of figuring stuff out works.

Tablet PC

Tagged:  

I've always wanted a Tablet PC, and now the Evil Ones are coming out with one. Some years ago I decided handheld computers would be much more useful if they were designed to be used like a clipboard, something you can work with while walking around (unlike a notebook), but big enough to avoid the awkwardness of handhelds.

More recently I've been hankering for WiFi, something that hasn't caught on in Turkey, although wireless tech has a lot of potential to avoid the telco monopoly. I've been thinking a handheld with WiFi would be very cool in the office, and now I read that Microsoft's Table PC has WiFi support built-in ... [insert Homer-style drooling noises.]

Of course it only runs a weird variant of Windows XP. I find Windows 2000 fine for my desktop, but I'm skeptical of using any flavor of Windows on something so small, and I shudder when I think I'll probably be forced to use Outlook. Hopefully they'll have Linux running on it, although I'm not so sure that'll suit me either. I really want to be able to run all the same stuff I use on my desktop PC.

[Via the doc.]

New JavaBoutique Article

Yay, my new article is up on JavaBoutique. This one is about writing servlet filters, kind of an introductory-level topic, but I don't think filters are exploited enough. They're essentially Java server plugins, if you write a filter it can be used on any standards compliant Java server.

Last month I wrote an article on how to configure Ant build files for multi-developer projects, particularly projects you want to manage with CVS. Next I'd like to do an article on Jakarta's Digester, which is a really clever package for making a configuration system for pluggable components. It uses Beanutils for painless introspection, another tool that deserves wider awareness.

The Java Gap

Tagged:  

Rebelutionary's reaction to Russell's choice to use Struts rather than WebWork, because of the CV value, struck a chord with me. I thought something similar when I read it. There is a gap in the Java world, between the JSR standards issued by Sun and the best practice tools coming especially out of the open source movement, and if it continues to grow there will be two totally different skillsets - the EJB, JSP, JSR XYZ programmers and the Velocity, WebWork, JFoo programmers.

The problem is that Sun is in a frenzy to make sure there are Java standards to cover everything under the, err, sun, so they're turning out a lot of garbage standards. Meanwhile the open source community is cranking out their own solutions developed from experience in the trenches, and these are increasingly diverging from the party line. JSP sucks, EJB is generally unnecessary, the Sun logging standard totally ignores the battle-tested log4j, and the list is growing.

The split is not total. The Jakarta project lives in the gap between, for every Jakarta log4j which is ignored by the CSR there is a Jakarta Struts, which is evolving into Sun canon. Of course it helps that Struts' McClanahan is a prominent engineer at Sun, while Log4j's Ceki is not.

For us developers it's a difficult line to walk. In the ideal world we would use the best technology, and employers wouldn't have a problem with it. But I've had the experience of hedging when asked whether I know EJB - "Yeah, I've played with it, but I've never had a real-world project where it was necessary." You and I may know that 99% of projects that use EJB app servers don't really need EJB, and would be better off without it, but to an IT manager looking for a contractor that answer sounds like it comes from a bedroom hacker with no "real" skills. Then I go on to explain why I use Velocity rather than JSP.

It's nice to think that Mike is right when he dismisses employers who would choose people based on buzzword compliance, but he works for a small company which sees the benefit of solid software over Sun-certified garbage. But many big companies use the stuff with the official seal.

It's worse in countries like Turkey, and perhaps somewhat in Spain also. Small, progressive software companies are hard to find, the only companies which can pay a decent wage are big corporates; banks, telecomms, insurance companies, etc. In developing countries companies want to use Big Name Software from IBM, Microsoft, and Sun for the same reason people go out to McDonalds and smoke Marlboros - because that's what the rich kids use. They don't want free hand-me-downs or local brand cigarettes, because that's what the poor folks use.

I wonder whether the two sides will continue to diverge, or whether they will play off each other and revolve around a center of gravity which keeps them from spinning in totally different directions. My guess is in the long run better quality will feed back into the Sun process, albeit maybe in a watered down form, the way MVC turned into Struts.

Personally, I'll look for opportunities to work with clients who use EJB's and similar things, to get the CV material, but for my own projects I'm going with the stuff that works best.

Update: David "The Roller" Johnston is more understanding of Russell's choice than the Reb, suggesting a few more good reasons for going with the flow: "more books on the shelf, more trained developers, more momentum, and more chance of long term improvement". Of course there are many non-standard packages which are becoming mainstream, the best example being Ant, so it's not quite accurate of me to portray this as JSR vs. everything else.

JPublish 1.2 Out

Tagged:  

Anthony has released JPublish 1.2. I've played around with this, and written a module which is in the CVS repository but which I have let languish a bit. As I've mentioned before, I spent some time looking at CMS possibilities, and settled on JPublish.

I wouldn't really call JPublish a CMS, it's more like a CMS kernel, basically a simple, clean, well-architected web application framework. It uses Velocity for templating, and has a nice model for selecting page content, template, and meta-data based on the incoming path.

One thing it lacks is a good storage model. most of the components that come with it are file system based, which isn't going to scale well. There is database code, but it is based on hard-coded SQL, so if you want to add new objects to the framework, you're going to hard-code it.

I fantasize about building ObjectBridge support for it, and making it all more bean-based, probably using BeanUtils and Digester, but these would be a major change in architecture. And since it doesn't look like I'm going to be doing much CMS work after all, I'm not going to have anything like the cycles to commit.

Oh, well, it'll be interesting to see where JPublish goes, it has a lot of promise. I'm just waiting for someone to build a blogging package with it!

Mail Stuff

Yesterday I finally got around to trying out Spamassassin, since all the cool geeks were talking about it a few weeks ago. Of course it was a recursive installation session, I needed procmail (well, it wasn't required, but seemed like the best way to go about it). It works very nicely, although a lot of my mail is still coming through a different server, so is escaping the assassin's deadly attentions. But I intend to consolidate everything on my kief.com server, which is going to seriously clean my inbox.

While I was at it I upgraded Postfix and QPopper, so everything in the mail department is now shipshape! I'm still using a crusty old version of Eudora, but when I saw that version 5's best new feature was to waste CPU cycles to monitor how many exclamation points I type, I figured I could give it a pass. But Eudora 4 still works fine for me.

It's cool to see that Qualcomm decided not to make separate commercial and free versions of qpopper; they're giving refunds to users who bought the beta. I'd slam them for charging money for beta software, but this makes up for it. Qpopper 4 also has SSL support - I'd like to get all of my mail and file copying services over to SSL. I use SSH tunneling for some stuff, but I'd like to find something for my users that doesn't require opening a shell. stunnel looks somewhat useful, but seems to be focused on the server - how can client apps use it transparently?

Syndicate content