Mon 16 Jan 2006
Category : Technology/WebMon204.txt
WebMon is the application I use everyday, several times a day, to check my web server log, no matter where I am. It's the first thing I do, right after reading my mail, even while I was away in Bangkok (and I was surprised and happy that even loading 6000 records, which is about 12 hours of web activity in my case, didn't take too long).
It allows me to see how the web server is being accessed, which pages are being read, which applications have been downloaded. And if we have a payment coming in from PayPal, it allows me to see how our latest customer had come in to the web site - was it via a Google search or through the Macintosh Product Guide or via Version Tracker - and to track his or her progress through the site.
It's about keeping my eyes on the business.
Of course, it also has a few other features, like it helps me turn on WebDav (to allow us to share our calendars and workplans), SSL, and PHP, etc, in five minutes whenever we have to set up a new server, and that's long after I've forgotten how to do it all on the command line.
But the thing about WebMon is that it's also my experiment in using the power of Cocoa Bindings in Mac OS X. I've really tried to push the technology quite a fair bit in WebMon -- to store arrays of information about the server or servers that I'm monitoring in the WebMon preferences file in ~/Library/Preferences.
I'm amazed at the amount of things we're able to do in Cocoa Bindings, without writing any code, and the depth to the ideas we can represent : e.g., to store arrays of dictionaries (in my case, about the servers I'm monitoring) which can contain other arrays and other dictionaries. And to do that with very little coding, using a very efficient, compact notation, with the ability to write it out to persistent storage in the preferences file.
It's like, wow, Cocoa Bindings is seriously useful, and we can get a lot more things done, a lot faster, coding like this. Cocoa is Apple's true crown jewels.
But, with the power and convenience comes a little loss of control. There are things that go on in the Bindings that you've got to trust that Apple does correctly. When they don't, you could spend a whole weekend just tracing the bug.
Like I just did.
I was wondering why WebMon didn't work properly in Panther, notably in 10.3.9. I traced it, at last, to a quirk in the Cocoa Bindings/User Defaults interaction in Panther, together with one other quirk that surfaced in 10.3.9. It was hard to trace because it wasn't a programming or logic bug on my part, and it worked perfectly in Tiger. It took a long time to pin-point the exact point in the code where things went into the Twilight Zone and then to find the answer somewhere in this Tech Note, thanks to Google.
But the point is that Cocoa Bindings is super-powerful. But be prepared to have the rug pulled from under your feet now and then. At least until Apple polishes it with each subsequent release.
Anyway, WebMon 2.0.4 is now ready for download. With that, WebMon works again with every version of Panther, as well as with Tiger, of course. (And PS : we're now only one step away from making it a Universal Binary.)