Friday, March 18, 2005

Pushing content to browsers without registering java callbacks

Have just come across pushlets after a day or two of helping a team under significant deadline pressure to build a client application for a browser that would implement the Observer/Observable design pattern, and update the content on a browser window when the data it is rendering from a remote server is updated. I've been exploring the pitfalls of JNLP and Java Web Start for deploying the applet that they've developed; basically, Sun's approach seems to work for recent Windows platforms with the JRE already installed but it is a bit of a non-starter elsewhere; it looks like a more elegant solution lies here in this Pushlets Whitepaper by Just van den Broecke.

To paraphrase from the white paper:-

"Pushlets are a servlet-based mechanism where data is pushed directly from server-side Java objects to (Dynamic) HTML pages within a client-browser without using Java applets or plug-ins. This allows a web page to be periodically updated by the server. The browser client uses JavaScript/Dynamic HTML features available in type 4+ browsers like NS and MSIE. "

The examples are nicely done, and have the major benefit that there's no download nuisance (as long as the browser has javascript enabled and W3C WAI AA accessibility is not an issue).

Flash remoting is another option, of course, but no-one here seems to want to try this (I wonder why not?).

Monday, March 07, 2005

Using mogrify to -crop and -resize images

A quick reminder to myself for later on: when treating documents scanned in with the Canon scanner in greyscale at 150 DPI, resize the NZ and Aus diary pages slightly before uploading them to the website.

A good way to do this is with ImageMagick's mogrify command (since it can handle batches of files at a shell prompt). To resize the images, use mogrify -sample 70%x70% *.jpg. To cut off the bottom inch or so of noise caused by the diary page being shorter than A4, use "mogrify -crop 869x1080+0+0 *.jpg" (this leaves the very bottom of the page in the completed jpg file). Since mogrify rewrites files in place, there is no need to move files around afterwards.



The ImageMagick website is here.