Monthly Archives: January 2006

Blogger Is A JSP Site’s Friend Too

At work there was a desire to put news items onto an internal page of a web application our customers log into. After the request was made, there was talk of including a page supplied to us by our internal customer representatives, providing a form they could type news into, etc. Basically a variety of solutions that all involved us writing something and/or getting directly involved in posting news. Perhaps even teaching HTML to somebody who normally just dealt with numbers and people.
I felt that was just a waste of resources. Why not just use Blogger? It has a better interface than anything I’m going to throw together in a couple of days. It will generate a page and dump the result via FTP to another server (exactly what we needed). And it doesn’t need my intervention to get the news up. Blogger is perfectly capable of generating a JSP page instead of an HTML page as its output, and if you dump it in a directory where the server (e.g. Tomcat) will notice that the original page has changed, the server can automatically recompile the page next time someone requests it and they will have updated news but any Java scriptlets on the page will still provide their dynamic output.
When you are setting up Blogger, just make sure it knows that the output file it will generate has a JSP extension, the template for your page will be a normal JSP page with whatever scriptlets and custom tags you normally use. You just have to include the Blogger tags in the section of the page where you want the news to appear. Then Blogger will replace its tags and only its tags with the HTML representing the latest news items, produce a JSP page ready for processing, and publish it to its final destination via FTP.
Definitely an easier solution and it can be setup in thirty minutes or less vs. trying to cobble together your own solution or setup some software like Movable Type or WordPress.

Google Homepage Development: Everything Old Is New Again


Since Google started their search engine schtick their front page has remained basically static. A logo, which might change with the season, mood, or to celebrate an occasion, a place to type your seach query and two buttons to perform your search and return the results or, if you were feeling “lucky”, take you directly to the best match Google could find. Yesterday, that changed as Google moved a portal page they had been working on for some time to be the default for Google. If you already have a GMail account you can log in and you’ll see your most recent messages, you can get stock quotes, news, local film listings, etc. Pretty much what you can do on Yahoo’s portal and others.
The thing is, it’s like deja vu all over again. It reminds me a great deal of the great Netscape Portal five or six years ago that had the same kind of box structure, similar content, but one thing most of us hadn’t seen up to that point was the ability to put news from any random site on the portal as long as the site supported this new “RSS” thing. It was Netscape’s portal support for RSS that prompted me to add automatic generation of RSS to the news system of GameDev.net and then I could have GameDev’s news on my Netscape portal just like we were some bigshot Associated Press or something.
Google has resurrected that portal from half a decade ago, thrown in some fancy JavaScript to allow you to drag boxes from one place to another and to have it automatically update. There’s nothing amazing there. Except that they have also provided the Google Homepage API that allows you to build your own modules that can pull XML from other sites, process that XML with JavaScript, and produce any HTML you need for the user’s page. That’s a far cry from the heavy restrictions imposed by Netscape on their portal. They would go and get the RSS from a channel for you, parse it and store the results and present that result to you in just one format.
Here you can go and build widgets of almost any sort provided you can find a way to represent the output in HTML form. They can also be interactive with the user, requesting input, allowing choices, and altering their behavior based on the input. So modules can perform searches, display maps, do calculations, or a great deal more. Thus the widgets have more in common with Yahoo! Widget Engine (nee Konfabulator) widgets than they do with the limited extensibility of My Yahoo!, which was, up till now the most configurable of the big portals. MSN.com and Netscape.com both seem to remain firmly stuck in the distant past and allow very little choice for what is on “your” page.
Now the question is, who will use this ability to create some cool modules that will make the Google homepage an improvement over the other big portals?

Preview Tabs With This Mozilla Extension

This is just a quick plug for a Firefox extension I don’t hear anybody talk about. Everybody extolls the virtues of Session Saver, Greasemonkey, and some others but I also like Ted’s Tab Preview. When you have multiple tabs open in Firefox, it shows you what is on each tab in a miniature preview as soon as your mouse moves over the tab. So, if you have multiple tabs that have the same title, no title, or you’ve just forgotten what you are doing, you don’t have to click on each one and wait for it to draw.

Audiobooks Cheap Or Free

On two previous occasions I’ve written about websites which were doing free audio books. One of those two sites closed and the other was never anything to shout about and hasn’t gotten any better with time. However, there’s now another new site named LibriVox where people are trying to do the same thing. I already like it better than the other two for a couple of reasons.
Pros:

  • They are offering BitTorrents of the books both for faster download and reduced bandwidth costs for LibriVox.
  • They don’t offer any of the low quality downloads that one of the previous sites offered. Their gimmick was that a very low quality was free and you paid if you wanted higher quality. LibriVox by contrast seem to be sticking with 64kpbs and 128kbps MP3 as well as Ogg Vorbis.

Cons:

  • They have several group projects where multiple people are reading chapters from the same book. It greatly increases the chances that a book will be finished but the quality can be all over the place. Hopefully they will allow multiple readings of the same material in their library and we will be able to rate the results and pick only the best ones. The alternative would be readings with strange pauses, a lack of re-recording mistakes, mispronunciations and varying pronunciations chapter to chapter, hiss, hum, noise, etc.

I read Agatha Christie’s The Mysterious Affair at Styles quite recently so I listened to the beginning of that recording. It was not a group project, it had been recorded by an individual. It isn’t quite as smooth as most commercial audiobooks but it seems very listenable.
Also of note are two commercial companies selling audiobooks without any kind of DRM restrictions. One I’ve mentioned before is Telltale Weekly. They are giving away some audio and selling other using both PayPal and BitPass. The other is unabridgedbooks.com. I haven’t purchased any books from either of these companies so I really can’t comment on the quality or what kind of value you are getting for your money. If anybody tries these out I’d love to hear about it. I’ll happily publish reviews if you don’t have a venue to put up your own or link to what you write about them.
The website for unabridgedbooks.com seemed to have some issues when I went. I didn’t see any price on the page where I could look at the details of the book and when I tried to add a couple of items to my cart to check their price that way, one worked and the other failed to get added to my cart. They may have some issues to iron out.

All My Podcast Subscriptions

Same song, second verse. I’ve published all the RSS channels I subscribe to with my aggregator, here are all the podcasts (both audio and audio/video) I subscribe to in iTunes:

  • APM’s Marketplace
  • Bluegrass Radio Show
  • Diggnation w/ Kevin Rose & Alex Albrecht
  • dl.tv in H.264 (Video)
  • Ebert & Roeper
  • FOO Casts: Podcasts from O’Reilly and Friends
  • Infected by Martin Sargent
  • Inside the Net
  • NOVA ScienceNOW
  • Photoshop TV (Video)
  • PodCheck Review
  • Rogue Syndicate
  • The Dawn and Drew Show!
  • The Java Posse
  • The Web 2.0 Show
  • this WEEK in TECH
  • What’s New Now

Sadly, iTunes doesn’t offer OPML export so I can’t offer all these in an easy to import form. You’ll have to search for them in iTunes or whatever your favorite podcast client is and subscribe to them one at a time. If anybody has a good idea for how to put links up here that would allow for quick subscriptions, please leave a comment and I’ll be quick to approve it.

When Not To Use StringBuffer

The old adage about only having a hammer and thinking everything is a nail can apply just as easily to programming. If you blindly apply the rule that appending strings in Java is way more expensive than using a StringBuffer you can end up with some strange and arguably wrong results.
Take for example the PreparedStatements in a large piece of code I’m charged with working on. The SQL queries in this code are quite large and would stretch out to several hundred characters if they were not wrapped in some way within the code. So they were broken up into multiple strings, but the original author apparently feared the horrific overhead that String could impose and we ended up with a lot of code that looks like this.
StringBuffer selectStatement = new StringBuffer();
selectStatement.append("select blah, blah1, blah2, blah3, ");
selectStatement.append("blah4 from BLAH where );
selectStatement.append("...");

I did a really short one as an example but imagine this going on for 20+ lines because the individual field names are long, etc. And it’s all completely pointless in this case. We aren’t building a dynamic string that has changing elements in it. There aren’t any other strings being passed into be appended, they are all just static strings containing text and question marks where the paramaters will later be put by the prepared statement. So it never changes!
In this case the StringBuffer is actually slower than just using plus signs where we had to break the lines and a String that the entire thing is assigned to. Any compiler worth its salt will take note that all the strings are static and append them into a single string at compile time without any .append() calls being needed. Plus all the extra function calls are just an obfuscation around the SQL query which you would like to have easily readable in the code. Note: The thought of moving the queries out of the code completely using something like iBatis hasn’t even been touched yet. This is really straight up JDBC stuff here.
Please, think before you blindly follow rules. Why is the rule there? When does it make sense to break the rule?