magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

Archive for ‘December, 2003’

Ex RedHat CEO Bob Young gave an “interview(Lulu : Marketplace for a World of Digital Content)”:http://www.infoworld.com/article/03/12/11/HNredhatfounder_1.html to Robert McMillan this week as a followup to “his response”:http://www.lulu.com/journal/scoletter?fTheme=community to “Darl McBrides”:http://www.sco.com/copyright/ earlier open letter. Of particular interest to me is his detailing of damage mitigation, which he explains far better than I can:

…the way copyright law works is you have to prove damages. And there’s another concept in American law, which says you’re required to mitigate your damages. In other words, just because you know someone did something bad to you, you can’t maximize the impact of that bad thing and then claim a much bigger penalty against the person who did the bad thing to you because you maximized the harm.

Let’s take an example. If someone hits your car, your car is now damaged. But in order to maximize the penalty, you know your car is going to break down if you drive it to New York, but you drive it to New York anyway, because you know you can sue the guy who hit you for wrecking your car on the way to New York. Well a judge would say, ‘No, he should have fixed your car. He hit your car, but the fact that you further damaged your car by driving it to New York is your problem, not his.’ ” That’s the concept of mitigating damages.

But SCO is going out of their way to avoid the mitigation of damages. If SCO actually has a reasonable claim to owning the way that Linux swaps data in and out of data or the way that Linux talks to the video devices, we can fix that. But SCO will not tell us what they are claiming, so we can’t fix it.

So, even if SCO are successful in arguing that SCO-owned code was folded into Linux, and the resulting operating system then caused damage to SCO’s business, they still have to overcome the fact that in the eyes of US law they have done little to mitigate the damage done by Linux. To be honest I’d be amazed if SCO’s FUD campaign gets as far for this to be a major issue (I’ll be mildly suprised if it even gets to court), but you never can tell…

As Andrej Koelewijn rightly “points out(Andrej Koelewijn – Persistence layer poll on OTN)”:http://andrej.racchvs.com/archive/2003/12/18/persistence_layer_poll_on_otn.html, the Oracle Technology Network’s “JDevelper site”:http://otn.oracle.com/products/jdev/index.html has survey on which persistence layers people are using seems a little sparse – “Hibernate”:http://www.hibernate.org/ (amongst others) is not included. This may be either because Oracle are worried that their own products might loose the poll, or it could be that they haven’t heard of Hibernate. Both “BC4J”:OracleAS TopLink, the #1 Java object-to-relational persistence architecture, and “TopLink”:http://otn.oracle.com/products/ias/toplink/index.html are included, both of which are Oracle products. In fact the TopLink product page contains the following quote:

OracleAS TopLink, the #1 Java object-to-relational persistence architecture…

One wonders if this quote is based on a survey where TopLink was the only possible answer…

One of the reasons for my annoyance on this poll is that I have a real desire to find out just what persistance frameworks people are using – vendor specific surveys clearly aren’t the way to go.

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…