ONJava.com’s Top 15 Ant Best Practices is a good read. Speaking as someone whose new build files tend to be copied and hacked about from existing projects, I really should pay more attention to my poor neglected ant files. I especially liked the recommendation to use zipfileset to create archives, as it means you don’t have to create temporary directory structures prior to creating your JAR, WAR and EAR files – something I do quite a bit.
I found an interesting bug in my code today. I’m storing an object in a cache, and using a couple of indexes to address it. One index is a normal HashMap object, which is indexing the object based on its unique ID. The other index is applying a grouping – several objects with the same grouping could exists so here I use a HashMap indexing a HashSet object. When I need to update the object, I call put on the ID index, which updates the entry. For the grouping index, I get the HashSet and call add. I noticed that the unique ID index was updating, but the grouping index wasn’t – I had of course failed to read the documentation for HashSet‘s add method:
Adds the specified element to this set if it is not already present.
This contrasts with the HashMap‘s put method:
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
Now I should of read the documentation, but the reason for my mistake is that I knew that a HashSet was actually backed by a HashMap – as such I assumed add would just call put on the underlying HashMap using the same object as a key and the value. Of course I am misusing a Set here – a Set is a collection of objects with no duplicates. When calling add equals is called, shows that the object is already there, and therefore doesn’t re-add it. Really I want the behaviour of a Map with the simpler interface of a Set, so I should just stop complaining and write my own wrapper class, shouldn’t I?
Well, much fun was had by all, especially the very drunk guy who started eating rice with his fingers whilst swaying slightly. I managed to meet up with “Simon Brunning(Small Values of Cool)”:http://www.brunningonline.net/simon/blog/, “Simon Brown”:http://today.java.net/pub/au/82, “Jeremy”:http://javanicus.com/blog2/ (to whom much kudos must be given for organising the whole thing), “James Strachan”:http://radio.weblogs.com/0112098/ who was kind enough to field a vast array of questions on all things Groovy, Drools (mostly me) and Core Developers and many, many others. James also dropped some hints that I should look at “PicoContainer”:http://www.picocontainer.org/ – expect a brief comparison wrt the “Spring Framework”:http://www.springframework.org/ in the next few days…
I’m off to the London Java Xmas Meetup after work, and don’t know what anyone looks like. I have this horrific notion that I’m going to introduce myself to a complete stranger who has no idea what I’m talking about, and rather than listening to my inane prattlings he’ll beat me to death with his Shoe. Either that or I get lost.
Finally someone has written a “tool(redemption in a blog – MT-Blacklist Updater)”:http://blog.codefront.net/archives/2003/12/14/mtblacklist_updater.php#comments to dynamically update your MT blacklist. As some of you may be aware, Jay Allen’s excellent “MT Blacklist(MT-Blacklist – A Movable Type plugin to eradicate comment and trackback spam)”:http://www.jayallen.org/projects/mt-blacklist/ plugin allows you to blacklist comments based on URLs, to stop spammers attempting to use your blog to inflate their Google pageranks. Entries for your blacklist can easily be added yourself, however Jay is maintaining an RSS feed with new changes to his master list.
Cheah Chu Yeow has created a “PHP program(
MT-Blacklist Updater – Keep your blacklist updated
)”:http://blog.codefront.net/scripts/blacklistupdater/ run via Cron which can update your blacklist based on this master list. Now as Jay himself has stated, in the long term a master list of blacklisted sites is not necessarily the answer (Jay has proposed a peer to peer solution) but in the meantime this will do. As soon as I’ve updated to the new version of MT Blacklist, I’ll be giving this plugin a whirl…
A nice little site this – “Widgetopia”:http://www.eleganthack.com/widgetopia/ catalogues various widgets from websites. Resources such as this can help show just how functional a website’s UI can be, and more importantly can give some well needed inspiration to webapp UI designers. Its time webapp developers realised that their interfaces don’t need to be ugly, bland affairs, and that beyond looking nice, a decent functional design can make for a more pleasant and efficient user experience.
My ongoing campaign to understand all facets of the “Spring Framework”:http://www.springframework.org/ has been hampered somewhat by the fact that I haven’t been able to develop anything with it. Using it at work is a non-starter, so I’m looking at developing a project at home which is big enough to explore the various aspects I want to explore, but not so big that it becomes too much work. And ideally it needs to be useful. I certainly want to use AOP with the Spring Framework. Documentation for Spring’s AOP support is sparse to say the least, but I did manage to find a brief overview from the old Wiki which gives me enough of an idea. The problem with these simple demos however is that they have to be simple enough to cover in a straightforward manner but always end up being a trivial example, that doesn’t really help show the power of AOP. Perhaps I’ve found the topic for another article…
I am seriously considering writing an aggregator webapplication actually. Given my knowledge of Informa, RSS and blogging as a whole it would make sense. The only problem with that idea is that I don’t need one really, and I’m not sure anyone else does – blo.gs works fine for me. Oh well, lets see what the new year brings.
It is with a growing sense of dread and depression that I read the “news(news.com – Judge orders SCO to show Linux infringement)”:http://news.com.com/2100-7344_3-5114689.html that SCO finally delivered the UNIX source code that it claims IBM has infringed the copyright of. Surely this should be a cause for celebration? Finally we will see exactly what SCO has been talking about – an army of Linux coders waits in the wings to analyse the code and help rebuke SCO’s claims. The problem? Well SCO has decided to deliver said source code to IBM on 1 million pieces of paper. This reminds me of a bet I won with a welsh friend of mine concerning the England v Wales 5 nations (as was) rugby match a few years back – he took great delight in delivering the £5 in pennies, wet ones at that. I suppose its naivety on my part, but I had hopped that this whole debacle wouldn’t descend into playground tactics.
The Daily Telegraph has some RSS 2.0 feeds available, so go forth and aggregate.
For a while now I have been singing the praises of “FeedDemon”:http://www.bradsoft.com/feeddemon/index.asp, Nick Bradbury’s very good RSS reader. I still think its a great product, however a couple of niggles caused me to look elsewhere. Firstly, with FeedDemon its a bit of a pain to synchronise my blogroll between sites. I browse both at work and at home, and whilst FeedDemon does allow you to synchronise your feeds with an online OPML file, this is a manual process. Also it cannot write to the file (meaning an export->ftp upload before leaving work). The lack of blog synchronisation between sites also means I’m not sure what I’ve read and what I haven’t, so keeping up can be a pain. Secondly, I can’t use Firebird (well, Gecko) to render the sites. Not a major gripe I’d admit, but IE blows.
“blo.gs”:http://blo.gs/ is an online service that stores a list of your favourite blogs. When you log into the service, you can see your favourites, and when they were last updated. In of itself this isn’t too useful. What is useful however is the sidebar they provide for NS6/Firebird. It sits quite nicely in my Firebird sidebar. When at home or the office, I can use the time stamp of my favourites to work out what I would of read. Even better is the fact that my favourites get automatically exported as an OPML file thereby making the construction of a online blogroll very easy (expect one soon). FeedDemon hasn’t been started since I got all of my favourites loaded into blo.gs.