Ruby, Scripting

Operator Overloading? Nada!

So today I got a perfect example of why operator overloading is such a nightmare.

What do you think this piece of Ruby means?

a << @b

The short answer is that it means nada. It will depend on both a and b and even if you learn what one instance of the operator means it will serve as no guide to identical operators for different types. This one operator resulted in a bug every time it was used and I don’t think it represents any value over a more verbose method call.

Standard
Groovy, Java, Scripting, Swing

Groovy Gridbag Example

Before Christmas I decided to give the Groovy Swing Builder a go since I am in the market for a language that makes creating small utilities in Java easier. Groovy is now Groovy 1.5, fully aligned with the Java 1.5 release. The new release sees lots of improvements all over the place. The Groovy Console has had a substantial revision and is now a really good way of experimenting with more complicated scripts (previously I only really used it to run snippets of code). The text colouring and decoration really works and the previous problems with massive stack traces obscuring actual issues seem to have been fixed. Really there are just two things that are needed to make it perfect, the first is line numbers so you can relate error messages back to the script you are working on and auto-completion. I wouldn’t mind having tabbed editors in the console as well but I can live without it.

What hasn’t changed is that documentation is generally woeful and examples and tutorials are hard to find. Most of the Swing examples I could find really used small numbers of components and simple Layout Managers. I have tried to create a more complex example using Grid Bag and based around some existing Swing code I found.

It took me a lot longer than I thought it would to create this code. Part of this is just not knowing how to tackle things, Groovy allows you to set attributes within the constructor with the interesting syntax property: value. However it is hard to know when you should use this or when the interaction should occur within the braces. After getting a working example going there is only one major mystery to me here. If I do not put the table inside the scroll pane then I lose the header columns on the table in the second tab. I really cannot see why that should be and if anyone more versed in the language can help me I would be grateful.

Standard
ThoughtWorks

Last of the Immersion

This post is probably going to get a bit happy clappy so if you’re allergic to gushing sentimentality it is probably best to skip this post and come back for some of the more analytic stuff later.

This last week was a lot harder and longer than last week but for all the right reasons. I felt material was coming at us as fast as we could ask for it. The attendees were treated like the intelligent, capable people they are and if we asked for more we got it. For someone with no formal background in Agile it was interesting to be given some theoretical framework to work with.

However probably the best thing about the whole experience was being locked in a room with nine other intelligent, articulate and experienced people and being made to think about the job you are embarking on. A ThoughtWorks Immersion programme is hard to explain through the syllabus material alone. It’s pretty standard stuff and a lot of the time the material is very much the broad view. The trainers we had were good and put the trainees above simple delivery of slides but presentation cannot really explain it either. I feel that it was my fellow attendees that really made the experience something special.

The TW Immersion is multi-discipline and is really focussed on soft skills and Agile practices. It isn’t really about coding and it isn’t about huge org charts. It should really try and explain what we are trying to achieve as a company and what every person within the company does to support their co-workers and thus achieve success as a whole.

The thing that really impressed me was that no matter what someone’s background or nominal job within the firm everyone tackled every challenge or task on the course with enthusiasm and a commitment that held no reservation. At the end of the two weeks I felt that if I had these nine other people with me (who I had never met until two weeks ago) there was no challenge I couldn’t take on.

It is corny but I really mean it, it is a feeling I have certainly never experienced in any other environment. To me it feels like the secret of any collective endeavour is to collect the best people you can find. If you use the best people then you are going to succeed.

But isn’t using a fuzzy term like “best people” just a cop out? What does that mean? TW genuinely has some of the most experienced and talented people who work in IT. Anyone looking to recruit wants to hire the most capable and experienced people they can.

However if you had the choice would you leave it there? If you could hire anyone wouldn’t you also want to employ the people who could work together effectively, adapt to new situations, who could be honest with their colleagues, be willing to take on both risk and responsibility, who would try to succeed for the long-term rather than scrabbling for short-term advantage?

I think you would want to hire those people. I think you would also regard those people as being the best people; people who were good at whatever it is they do and then have all these qualities on top. I think if you were able to recruit those people, bring them together in the right environment and then have them interact and cross-pollinate all their ideas and experiences then I think you would find those people pretty damn inspiring.

I think that is how I feel at the end of Immersion. I may know how TW writes a User Story, uses Mingle or plans a release but all that is really incidental. What I really know is that TW has hired at least nine of the best people and that’s a fantastic feeling.

Standard
ThoughtWorks

Halfway through a ThoughtWorks induction

Okay week one is over and what are we thinking at the halfway point. Well I think the abiding impression is that TW lives up to a lot of its hype. The people they recruit are talented, intelligent and, at least in the group I am working with, experienced. Everyone is very enthusiastic and committed to the programme and that really lifts the whole experience. I would not say that I was absolutely fired up about every item on the agenda and therefore it can be really helpful to have someone else kick things off and fuel the fire a bit. I am sure anyone who has been on a corporate training course knows that all these things are not necessarily that common.

Also the course attendees are truly cross-discipline and that is really helping to broaden the perspective of the course. I am not that interested in the sales service (for example) but I am glad that I have had a chance to hear people who are interested in such thing have their questions answered. You should try to avoid staying in your technical ghetto for too long.

TW has a pretty established framework for providing feedback and discussing issues. You do have to invest a little in understanding the rules and it can be hard to resist the rox/sux tendency but I think it pays off. The result is that you tend to give people a reason to try and fix problems and listen to your advice. These rules do actually set TW apart from other IT companies as I am not sure I have seen anything like this elsewhere.

Looking at the more specific circumstances of my course I am very grateful that the course is being held in London. I feel I am meeting a lot more people who will be in the office when I start working from there. It is also great to be able to switch between the course rooms and the office. If you get told to talk to someone you can head over to the office in less than ten minutes and actually talk to them. It also means that people in the office are going to start recognising your face.

The days are also quite long (particularly as you have to tend to prepare more for meetings, feedback and sessions) and therefore I am glad that I am going home for a few hours each day rather than simply drifting back to a hotel. It avoids getting totally fixated on the job. You have to get over yourself and listen to the details of someone else’s day rather than just endlessly dissecting your own.

TW is an organisation that has its own issues and foibles but I did notice that on the last day of the first week a lot of the new starters were starting to talk unconsciously about “we” where they meant TW as an entity. I am not sure I have seen people feel so comfortable with their collective identity at the end of an induction course let alone halfway through and that to me is a testament to there being something “right” with ThoughtWorks. It may be in the recruitment or the training or in the way that ThoughtWorkers are encouraged to think about themselves and the company. I suspect it is probably in all of these.

Standard
ThoughtWorks

ThoughtWorks Induction

Well the taxman’s been informed so I don’t see why I can’t publicly say that I am currently joining ThoughtWorks. The first day of the two week induction was today. One of the most interesting things was that the induction was the same as that you would get at most reasonably-sized IT companies. Probably the major difference was that (as advertised) the attendees, while sharing the same broad spectrum of IT employee quirks, were noticeably more… well, intelligent than those at other companies I have worked with before.

People had views, were informed, had opinions; however they were also able to discuss, reason and compromise which I think is much rarer.

Standard
Java, Software

Setting up a Derby Database

Okay so I currently I am setting up a number of databases on my own V-Server and I thought it would be helpful to make a few notes about the current Java databases and how easy they are to run in Server mode. The two biggest databases are Derby and HSQLDB, this post is about Derby. Both databases are really geared towards the embedded space and generally focus their documentation and tasks around this. In their default setups they are both pretty insecure for running on a public network, neither for example defaults to using passwords to authenticate logins.

All the databases are getting setup in the same basic way. Each database is going to be run in the userspace of a dedicated UNIX user and that user is meant to be accessed via SSH and SSH Keys. All the datafiles will reside within the user’s space. I’m not going to go into that as it is fairly straightforward and is probably better covered by the various UNIX admin guides you can find around the internet.

So Derby first then, well I have played around with Derby before so I hoped this would be the easiest. One thing that you need to know about Derby is that its documentation is good but it is organised into several different documents… by a madman. There is no apparent logic, rhyme or reason to the way information is included in one document or another. When setting up the server I had to jump between the Developer’s Guide, the Tuning Guide, the Server Guide and more unusually the Tool Guide. If you have the same experience then don’t worry, you’re probably doing it right.

Having downloaded the Derby package unpack it to the root directory. I find it helps with upgrades to create a symbolic link ~/derby to the actual installation directory. You can also create a profile environment variable DERBY_HOME that points to $HOME/derby.

With that all setup you can simply run ~/derby/startNetworkServer and you should be in the basic network server business. This is where it gets a bit more complicated. Derby will look for its configuration in the directory where you start it not in DERBY_HOME. So you need to create a derby.properties file in $HOME to configure the behaviour of the server.

To require authorisation you need to properties created in the properties file. Remember that the format of this file is a standard Java properties file. The two properties are:

  • derby.connection.requireAuthentication=true
  • derby.authentication.provider=BUILTIN

You should now restart the server. Now when you want to interact with the database you should need to provide a username and password. You have to check this though to make sure it works.

Run the ij tool from the command line: try to create a new database with something like the following

connect 'jdbc:derby:test;create=true';

You should get a message saying something like ‘Invalid authentication’. If the database is actually created then the database is probably not picking up your properties file, which in turn is likely to be an installation issue.

All being well we can now add a user to the properties file. User information is also a property so to make the file manageable you probably want to use comments to divide up the file into relevant sections and try and keep all the user setup in the same place. The format of the user entry is derby.user.USERNAME=PASSWORD. So for example

derby.user.test=changeme

Okay now restart the server and login via ij again. This time use a connection URL like the one below.

connect 'jdbc:derby:test;create=true;user=test;password=changeme';

This should now create a new database under HOME and give you access to it normally. Drop out of ij and confirm that the test directory has been created.

That is pretty much that now, from here on in you can connect to your server database instance as you would any other database server.

Written like this the setup must seem very basic and quick to perform, which is good. However when I was finding my way with it, it took over an hour and most of that time was taken up with looking for things in the documentation. Nothing is logically organised with Derby, for example the configuration properties are all described in the Tuning Guide. Except the network control properties which are described in the Admin’s Guide.

Unlike code DRY is not a good idea unless you are going to very rigorously modularise the documentation. Even then why not repeat something if it means that all the information relevant to task is one place?

Derby has a great feature list but I wonder how many users are ignorant of what it can do because of the poor documentation?

Standard
Films

I am Legend

Okay, last movie post for a while I hope. The new Will Smith vehicle stars Will Smith as an Army Colonel and Scientific Genius with a Loving Family; Will Smith also manages to Save the World (again). You go Will!

Strangely the film is nowhere near as bad as it might sound. It is based on pretty good source material, a clever inversion of the vampire story. A lot of the original comes through although the script sprawls and often staggers under the weight of sub-plots. There is no need, for example, for the extensive flashbacks as the fate of the protagonists family is ludicrous and is far better left to the imagination. The appearance of survivors creates an entirely different film that is rather at odds with the initial section. Ultimately the film drowns in forced sentiment.

The most interesting comparison is with 28 Days Later which achieves a lot more deserted city for a lot less budget. The CGI vampires in I am Legend are almost comical compared to the Infected. They all look like a squishy bodied Gollums with laughter-inducing ragged clothes to save their modesty ala The Incredible Hulk.

So what is actually good about it? Well the wildlife CGI is excellent and Will Smith is one of those actors who is great at interacting with stuff that isn’t actually there, he’s an actor of the CGI Age. He also manages some moments of completely convincing acting, he does an incredible fear for example. Ultimately he undermines himself with the usual wise-cracking and clowning because he undermines the pathos he has just so painstakingly built up. However he is a decent action hero with a wider range than dinosaurs such as Stallone and Schwarzenegger.

The most notable thing though is the way it uses silence. Sound-wise is not quite Dogme but it is as close as you are going to get in a mainstream film. There are stabs, soliloquies and the sound has all been cleaned up but there is no orchestral music filling up dead scenes and there are long periods of silence which help contribute to the idea that this really is the last man left on earth.

Thank god for a little experimentation in an action flick, now lets have the sixty minute edit.

Standard
Films

The Golden Compass

This is a great Christmas movie, sensibly adapted from the source material, sprinkled with good actors and great effects. The lead Dakota Blue Richards is a real find (although possibly you could have cast her just for the name alone) and gives a beautiful performance that is nuanced and convincing and makes her contempories in the film look terribly, terribly wooden.

Like all good Christmas movies theres a balance of light and dark and the constant menace at the edges keeps things tense and enjoyable although sometimes the pacing was too frantic.

I’m looking forward to the next installment already!

Standard
London

The Assassination of Jesse James by the Coward Robert Ford

I had the chance to see this film at the London Film Festival and I happy to confirm that it features beautiful photography, excellent performances from all the leads, nice period detail and that it is indeed very, very, very long indeed.

I dread to think what was in the original cut but while I can see a fantastic multi-disc DVD release for the whole thing there is a theatrical release that is 45 minutes long dying to be free from this film. We really do not need to see Nick Cave mugging for the cameras for example.

Acting from the entire cast is excellent and it reminded me of how often we are dependent on just one or two principals for our narrative. Here everyone has a role in recreating the post-Civil War era with its complex politics and its often simple personalities.

In the era of really long films this one is actually worth giving your time to. If you watched Cold Mountain for example you spent a lot longer for a lot less.

Standard