I'm on holiday next week. I'll be taking the girls up to visit their Gran in Newcastle.
I'd better take a jumper. And something waterproof.
OK, so we are boycotting The Odeon, Caterpillar, and Nestlé, none of which is too painful. But if I have to boycott Penguin, too, that's going to hurt.
Goatse.cx was bad enough, but now there's this monstrosity. Safe for work, if not for your sanity, via Ben Hammersley. (The goatse.cx tribute that I linked to above is safe for work too - but many of the pages to which it links couldn't possibly be any less safe for work.)
Tulna's having a bit of trouble with some unit testing at the moment. The lovely Emma has pointed out a few holes in our test coverage, and Tulna is endeavouring to fill them.
She's currently working on building tests for our configuration classes. We use Digester to pull in all our configuration from XML. In real life, it's all as sweet as a nut, but obviously we still want unit tests to ensure that any future breakage is discovered PDQ.
We run digester in a ServletContextListener
's contextInitialized()
. After setting up our digester, after all that addObjectCreate()
, addBeanPropertySetter()
shenanigans, the code which actually does the digesting looks like this:
URL configFileURL = context.getResource("/WEB-INF/config.xml");
InputStream configFileStream = configFileURL.openStream();
config = (Config) digester.parse(configFileStream);
Question is, how do we get our test data into configFileStream
? The context
object is a mock, so we can do anything we like there - but how do we mock URL
? It's a final class, so we can't sub-class it...
"The Web is the sum of all human knowledge, plus porn." Via SlashDot.
They are selling my old house. I lived there from the age of around six intill I was 19. Bedroom 2 was mine. They still have the washing line in which I cut my arm in the garden - I've got a scar from that.
Good Lord, how self indulgent is this post?
I don't seem to have much to say for myself just a the moment. Apart, that is, from pointing out the fact the StyleReport Pro is eating my soul.
Luckily enough, there have been a few things on the 'net recently to keep me sane:
Too many Java links, too little time.
IBM has released some cool looking new Eclipse plug-ins: Eclipse Web Tooling Platform Contribution - IBM. I particularly like the look of the Data Tools, the Server Tools and the Structured Source Editing.
Ever since I started using log4j, it's irritated me that I'veneed to hard-code the package name in my Category log = Category.getInstance("package.name.here")
statements, once in every class. Well, it turns out I don't; Pretty Log4J shows how to avoid hard-coding. ClassName.java lets me do Category log = Category.getInstance(ClassName.getPackageName())
- much nicer.
Via Darren, I've discovered the delightful ChavScum. Hey, bit of a Chav name there, Darren mate. ;-)
I've lived in sunny Colliers Wood for most of my life, on and off, and we have a healthy Chav population. You'll find them particularly concentrated in and around our local BNP meeting place, The Victory.
Update: The nearest fast food to The Victory is Chic N Ribs. :-(
See also: sheppeyscum.com. I've never been to Sheppey, but El Presidente worked there at one point, and I'm assured that sheppeyscum.com is, if anything, generous.
Worst Album Covers Ever, via Simon Willison.
I know that all our bosses have the occasional David Brent moment, but this takes the biscuit; El Presidente has just been humming Mah Na Mah Na. ;-)
I was re-reading High Fidelity this weekend, and the irony didn't escape me as I slipped a Sting CD on as I was reading.
So, who would you be really embarrased to admit to having in your CD collection, but that you actually like even though you know you shouldn't? My top five, in no particular order:
WordCount: "WordCount™ is an artistic experiment in the way we use language. It presents the 86,800 most frequently used English words, ranked in order of commonality. Each word is scaled to reflect its frequency relative to the words that precede and follow it, giving a visual barometer of relevance. The larger the word, the more we use it. The smaller the word, the more uncommon it is." Via gfdc.
Google circa 1960, via Boing Boing.
Empty Supervillian Threats: the statistics, via Lonita.
"The Designer is extremely intuitive," StyleReport Pro blurb.
It isn't politically correct, is it?
Arrrgh! Have you noticed that the only people who talk about PC these days are bigots who want to use "not being beholden to political correctness" as an excuse for spouting their offensive reactionary shite?
Happy birthday to me,
Happy birthday to me,
Happy birthday to me-ee,
Happy birthday to me!
24 today. In hex.
If you were thinking of a late gift, I wouldn't be averse to a PowerBook. An iPod would be nice, too. ;-)
I bought a Time computer once. Cheep 'n' cheerful, only without the cheerful. It looked like good value for money, but every single component was rubbish.
These days, I gather, Time have attempted to leave their reputation for selling shoddy kit behind by re-branding themselves as "The Computer Shop". They'll have to re-brand themselves again pretty soon if they stitch people up like this too often.
Microsoft wouldn't want to get left behind on the dodgy business ethics front, so they are up to no good too.
I'm not usually too excited about printers, but the Circular Printer (via Boing Boing) is a thing of genuine beauty. Practical, too, if you are on the road.
Sam pointed me at EMMA, (a Java test coverage tool,) and I've recently found the time to implement it.
Well, it was either that, or struggle with StyleReport Pro. What you you rather do? ;-)
Anyway, EMMA's output is really rather nice. It's structured and informative - you get a good high level overview, but you can you can drill down to reports on individual line coverage. Getting it running with our existing test suite took me a couple of hours of fiddling - but perhaps that's another post...
People have been mentioning del.icio.us, the on-line bookmark manager, on and off for some time, but I've only in the last couple of days got around to giving it a go. It's fabulous! I'll never save bookmarks to my desktop again. It's very simple, but it does everything it needs to do. Give it a go.
Cuddly Alien, via GussetBLOG.
Inetseft's StyleReport Pro is the bane of my life at the moment. We need to point our reports at different data sources and even different servers under certain circumstances. StyleReport offers no way of soft-coding these values, so the suggestion is that we have a separate instance of each report definition for each combination of server and data source that we might want to use. Yuck.
But... the report definitions are stored as XML files. Editable XML files. Mwahahahahaha!
Now, StyleReport insists that these report definitions live in the file system. This breaks our J2EE application to a certain extent, because J2EE does not guarantee the availability of a file system. In practise, we are OK; we are deploying to Tomcat, which does give you a file system. We need to keep the application's home directory in a configuration file, which is nasty, but which works. Had we needed to deploy to a sterner J2EE server, though, such as WebSphere, we'd have been buggered.
I wonder how many supposedly J2EE applications need access to the filesystem? Quite a few, I'll be bound. So, does this mean that IBM is being a bit over-strict with WebSphere? Well, no; WebSphere runs on platforms with totally non-standard file systems; the AS/400, no, sorry, iSeries, no, sorry, i5.
Anthony points out that with a bit of work, you can give a J2EE application a file system using Commons VFS. Cool stuff.
I've spent the last couple of days with Tulna, building PDF reports with Inetseft's StyleReport Pro. It's a piece of shit. My brain is numb.
BNP activists admit to race crime. Well, there's a surprise. Still, well done the BBC - the more light is thrown on these nasty racist thugs, the less likely it is that people will be taken in by the new, moderate image that they are attempting to fool us all with.
SpellBound, Spell checker for Firefox, my browser of choice.
Via Geek News Central, via Erik again.
Hats off to David Shay for Unfinalizer. Light the blue touch-paper, and retire to a safe distance.
My favorite feature of the new Eclipse release, by far, is something that isn't turned on by default, and took me a long time to discover: Mark Occurrences. This is just so useful...
Give it a bash, if you haven't already; it's great! Basically, it highlights whichever element your cursor is on. This element is highlighted throughout the Java editor, both in the edit area and in the right-hand margin where errors and warnings are shown. (What is that called, by the way?)
And there's more. Put your cursor over a method's return type, and it'll highlight all the method's exit points. Put it over an exception in a method's throws
clause, and it'll show you all the places in your method where that exception can be thrown.
Fascinating; The Ism Book, A Field Guide to the Nomenclature of Philosophy.
Via lonita.
Also; Prefix/Suffix Meanings.
I love tube maps. I wonder why? Anyway, via qwghlmBlog I've found some great new ones, including the Obscene Tube Map and the Upside Down Map. Marvellous.
I've mentioned The Marones before. Scary Duck points out some other fab tribute band names; Nudist Priest and the Red Hot Silli Feckers. Wonderful.
Wetherspoon warns of slow sales, which will come as no surprise to anyone who's ever drank in on of their pubs - it's like watching the continents move behind the bar.
The Leatherman Squirt is nice, but it doesn't have everything. The Swiss Champ XXLT, now that has everything...
Via The Old New Thing.
Ooooh, it's going to be an exciting London Java Meetup tonight!
Firstly, we've got Hani versus James and the Groovy boys arguing about Groovy. Despite what Sam says, I'm not against Groovy as such, but I have my own favorite, and with religious wars, you often get a with-us-or-against-us kind of thing going on. ;-)
Then, for the 2nd act, you'll have the Thoughtworkers having a full and frank exchange of views with Hani, who's been dissing them and their Guru.
Should be fun.
Our unit test suite isn't all that it could be. For one thing, it wasn't run at all while I was away - that's two months! Sigh. Naturally, running Ant's test target resulted in a smoking ruin...
Still, we've got all but a couple of the tests working again, usually by changing the tests to reflect changed functionality, but often by fixing the bugs that the tests should have been making plain.
Now I'd like to see what our test coverage is; I'm sure that it's far below 100%, and I'd like to start moving it in the right direction. Has anyone used JXCL and UCovered? Any good? Or is there something else I should be looking at?
Aside from "run your bloody unit tests", there's one other lesson learned; some of the code breakage resulted from changes to our database definitions, which for some reason were never kept under source control, so it's not possible to establish who made a change, when, and most importantly, why. The database change might have been made for a good reason, so you just can't remove it - especially if your unit tests are spotty.
I gather that keeping your database definitions under source control isn't trivial when you are using SQL Server, but it must be possible. We'll do it next time; if I can't manage to convince the team to move away from SQL Server, we'll just have to work it out.
Have you ever tried to use the Odeon website? Well, you have better be using IE for a start; Firefox ain't happening...
Via Boing Boing I find that one Matthew Somerville had fixed this; he scraped the Odeon site and re-presented the data in an accessible manner.
I say had fixed this, because the odious Odeon people have forced him to take the site down.
Sadly this attitude towards accessability is very far from uncommon; I raised the issue with some clients of ours recently for whom we are building a web application, and was ridiculed for my trouble. :-(
Shy, sensitive to criticism and suffering from low self esteem? Hmmm...
Right, I'm off down the pub.
Just because I'm pointing out how lovely the Leatherman Squirt P4 is a mere three weeks before my birthday, you shouldn't assume that I'm hinting or anything. ;-)
Via Managability's Top Ten Truly Obscure But Useful Java Projects, I find the suddenly essential Joda Time. Not quite mxDateTime for Java, but almost.
Some other interesting recent Java links:
Groovy is still getting all the hype at the moment, but Jython is still very much in the picture. In fact, I hope and expect that they'll both succeed. Both get a flattering mention in Extend your Java Application with Embedded Languages.
On the Jython side, the Jython site is now indicating a major Summer release, just as Samuele said in April. Also, I hear from Jez that the Sun boys are planning to make some changes to the JVM to make continuations easier to implement in Groovy. Might this make generators easier to implement in Jython? Perhaps Samuele should get in touch with James...
Also, IBM's developerWorks is running a new series, alt.lang.jre, covering alternate JVM languages. The first article, Get to know Jython, in a nice little intro into, uh, well, I suppose you can work out what it's about for yourself. ;-) I wouldn't be surprised if a Groovy article isn't to far behind.
I've finally got around to upgrading Firefox to version 0.9.1, and it's nice. It seems a little more snappy that it used to be, and I'm sure its memory footprint is smaller. Looks nice, too.
But I have a problem with it. Whenever I open a URL via a shortcut, I get an error dialogue: "The system cannot find the file specified". The page opens fine, though. It seems that I'm not the only one: Firefox problem. I tried the suggested solution, but the result was worse than the original symptom - Firefox ended up opening the contents of the shortcut file as text!
This is almost certainly the same problem as has been reported as breaking Python's webbrowser
module on c.l.py, and I'm getting odd results opening URLs via Lookout, too - I'm getting a 'File Save' dialogue, though again, Firefox opens the page OK.
Anyone know of a fix for this? It's not a show stopper, but it is irritating.
Beer and curry at The Halal for lunch, with El Presidente, Mark "The Burger Flipper" Matthews and Jez, amongst others.
Expect no sense from me this afternoon.
It was Ella's sixth birthday last Tuesday. I'd seen her the previous weekend, and given her her present then - a Flame Red Game Boy Advance SP and a copy of Pokemon Ruby. She was rather pleased with this.
Then, on her birthday, the dog ate it. Can you imagine, six years old, and your new Game Boy gets destroyed, on your birthday? She took it as you'd expect her to take it.
So this weekend, I got her a new one. There goes this month's discretionary funds...
This one is staying at my house.
Also in my hectic social calendar in the next couple of weeks, So Long Angel, the thinking man's pub blues band, will be at The National Theatre on Wendesday the 14th. They are well worth a listen; they are better at music than they are at web site design, trust me. ;-)
And don't forget the London Java Meetup next Monday, now featuring A-list Java blogger Hani.
Robocode is a blast, but I've been having trouble getting a robot which does even the simplest things. I wanted to code up, just to give myself a starting point, a 'bot which can circle around a given point, but my trigonometry wasn't up to it. :-(
Besides, I'm more into strategy games than I am into shoot-'em-ups, so perhaps CodeRuler will be more my speed...
See Conquer medieval kingdoms with CodeRuler.
This one's for the team: Null is bad.
Null is bad because it allows errors to float around the system for quite some time before you get any symptoms (like bloody logging code falling over), and well behaved code fails fast, near the source of the problem. Mike gives some other nice examples of fail-fast code, like building stub test cases containing a single Assert.fail("Test not yet implemeted.")
, so you can't forget to build the test case, and having unimplemented methods in your mock objects throw runtime exceptions, so it's obvious if they get called.
Steve, Andy, Michael and I will be at The Stage Door this Thursday evening at sevenish, with an option of moving on to either The Fire Station or Cubana later, so that Steve can get some good ogling in. All welcome.
Thanks to Tim Couper for the title. I hope you can make it too, Tim. ;-)
How about we mix things up a little; let's ban parents from smoking, and ban smacking in public places.
I'm working on a JSP page. I'm using JSTL's c:forEach
to iterate through a collection, and I want to display each item.
Thing is, the collection is heterogeneous; that is to say, it contains objects of different types. Each object might be a String
, in which case I want to show it as-is. It night be a Date
, in which case I want to use JSTL's fmt:formatDate
tag to format it for me. Lastly, it might be a BigDecimal
which again I'll want to format, this time using fmt:formatNumber
.
The question is, how can I tell what type of object I have? JSTL's EL seems to lack an instanceof
operator. Will I have to write my own
Just a little update on Dad's condition: He's over the painkiller side-effect issue, which is a huge relief. This has meant that he's had to come off the Codeine, though, so the pain has come back a bit more. Still, he's back on the road on steady improvement, so all's well.