21 May 2008

Respect The Machine

In a survey conducted recently (using the acclaimed dalton fast-answersTM survey technique*), most respondents claimed that respect for another human being motivates their behaviour more strongly than respect for rules imposed by a machine. More simply, people are more willing to break rules imposed by an abstract authority, than to break rules that might directly hurt another human being.

So, in Paris there are two official ways to cross the street - at painted zebra crossings without lights, and at painted zebra crossings with lights. In the presence of lights, all users are obliged by the law to respect the lights. In their absence, the pedestrian has priority.

Curiously, real-world observations reveal that pedestrians, despite having the right-of-way on bare crossings, congregate at the edge of the road waiting for a gap in the traffic to cross. The drivers appear strangely willing to co-operate with the docility of the wheelless, in what amounts to a blatant violation of pedestrian rights, in which the pedestrians themselves are complicit.

Conversely, I could spend all day pushing the button at a dedicated light-protected pedestrian crossing, and snicker as drivers patiently stop for the ensuing red light and gaze upon footless black and white road stripes until the light goes green again.

What mystery underlies this paradox? What unfathomable fountain of generosity inspires these empowered pedestrians to cede their hard-won road-crossing rights to the mobile metal capsules of our oil-addicted era? And what inexplicable well-spring of patience seizes the hearts and minds of those normally stressed and terribly late and I-don't-have-time-for-pedestrians wheel-turners so that they idle precious seconds before the useless red light of an empty crossing?

Some have suggested that the truth may be more prosaic. From the perspective of the pedestrian, apparently, it is better to be alive than to be right. Fear of a gruesome death, and not noble generosity, inspires the humble pedestrian to stand and wait while those mindless nuts behind the wheel careen past. But how, in this case, are our drivers different from terrorists? How can we say we are civilised when every minute a pedestrian's right to cross the road is crushed by a ruthless driver brutally, savagely wielding the threat of mangling your corpse under his shining wheel rims? This is not the jungle!

I think it's all a big misunderstanding, really. In fact, pedestrians shouldn't worry themselves at all. On several occasions in my personal experience cars have stopped with great suddenness so that I could continue to cross the road safely and legally. Drivers, regardless of any penalties applicable to the situation in question, will never, I have learned, never risk getting blood on their bonnets, or bits of skull in their headlights, or perhaps the paintwork scratched by a protruding fragment of fractured bone. Think of the washing-up! Peeling off patches of skin and torn flesh! The headache of insurance and other administrative formalities! No, they will screech to a halt sooner than face that. And remember, to paraphrase someone wiser than I, it is only a small 95% of bad drivers that make all the rest look bad ...**

* The dalton fast-answersTM survey technique involves me imagining what people would say if I asked them, and compiling the results in my head. The approach is wildly popular for its speed in gathering information; however, some doubts have been raised concerning its accuracy (according to another survey using the same technique)

** Always excercise utmost caution in crossing the road. Never take legal, medical, financial, or road-crossing advice from a blog. Seek professional help from qualified practitioners before making any decisions.

12 May 2008

Listening to the Customer

So one evening my son decided he wanted to program, too. This comes up occasionally, but today he was more insistent than usual. I had heard about StarLogo and that it was a language used for learning programming, so I installed it, fired it up, and stared blankly at the various panels that were waiting patiently for my input.

- but I want to program, I want to program now!!

- hold on, I'm just figuring this out

- but I want to program, why don't you let me program

- I haven't a clue how this works, will you give me a minute

And so on, until I had a wonderful insight. I fired up a text editor, maxed the font, and handed him the computer. Whereupon he merrily whacked the keyboard randomly for the next ten minutes or so.

And the moral of the story: never forget to find out what your customer wants before starting work on the solution ...

09 April 2008

mongrel_rails, ssh, and capistrano

Nothing was working. "command not found: mongrel_rails" - how could this be? It turns out that capistrano uses a non-interactive ssh session, which means the remote user doesn't get the usual environment, but rather some system default, which, as you have guessed, in my case today, doesn't include /opt/local/bin (or wherever you keep your mongrel_rails). Some commenters (eg http://www.ruby-forum.com/topic/79248) suggest tweaking the ssh and sshd configuration - but I cheated and made a smybolic link from /usr/bin/mongrel_rails to /opt/local/bin/mongrel_rails. Much simpler. At least now the error message is gone. I've still a lot of capistranoing to do though ...

22 March 2008

I want more, and I want it now

Meal times with a 3-year-old can be quite an exercise in negotiation. I know how much he's going to eat on average, so I offer a portion which is likely to fulfill the twin goals of happy customer, and no waste.

- "But I want a big portion!!"

- "When you've eaten that, you can have more - look, there's heaps in the pot. You can have as much as you can eat, I just don't want wasted food left on your plate."

- "No but I want more now!!"

And suddenly, I remember having this conversation in a completely different context. Maybe he'll be a business analyst ...

08 March 2008

Anger for Free

Our internet provider is free.fr and our freebox died recently. I called free, a human replied quickly, and after I explained the situation, they assured me

We want to fix this as quickly as possible so we'll send you a new (upgraded) freebox by courier tomorrow morning and also give you a month's credit on your account to compensate for the inconvenience. The new box will work out-of-the-box (if you'll pardon the pun), but in case you have any trouble getting it going we'll send a technician to you within a day to fix anything that might have gone wrong. Thank you for bringing this issue to our attention and we hope you will continue to enjoy surfing with us!

*** Only Joking !!!

In fact, it took about twenty calls before reaching a human, and the indignity of it, each time it took about two minutes on their 34c/min line to reach the point where their computer voice told me there was no human available at the moment.

When Sabrina finally got through (I had given up), they needed the password to our client area on their own site so they could order a freebox upgrade on our behalf - which would take about two weeks to "configure" and deliver.

At the same time, I got a suggestion from their email support that I borrow a power adapter from a neighbour and see if that fixes the problem - and please provide the name and telephone number of said neighbour when you're done.

Three weeks later, I called again, and politely inquired whether I would be seeing any freeboxes coming my way in the foreseeable future - it was supposed to take two weeks, after all. "Oh, no, sir, we don't give timelines for delivering the freebox. The person who told you two weeks was in error".

I have to say, we've been using freetelecom for about three years now, and their service worked flawlessly for the whole of that time. As far as I can tell from articles and forums on the topic, they are one of the best providers in France. But this is the end for me. Their goodwill has a half-life of about one day, and it's so miniscule now it's not even homeopathic.

If anyone has an ISP recommendation, I would love to hear it. Especially if it comes with uptime guarantees, even if it has to cost more ...

07 March 2008

Fundamentals of OO (aka FOO)

Whenever I happen upon a beginner's introduction to OOP (why this happens to me is another story altogether), there's usually a long-winded account of how a Cat is a kind of Mammal, and so is a Dog, and a Mammal is an Animal, blah blah blah.

OO is basically about types, and types came from ... guess where ... Typing!! Ladies and Gentlemen, this is not a joke!! Gutenberg (the person, not the free online book project), credited with the invention of Movable Type (the printing system, not the blogging software, we're talking 15th century here), used Types for creating printed representations - instances, one might say - of letters.

So there you have it, OO in a nutshell, you have a Type, and from it you create as many instances as you desire. Object Oriented Programming is the direct descendant of the humble TypeWriter. The Type is not the instance, and vice-versa, although the characteristics of the Type evidently determine the characteristics of the instance.

Please unlearn everything you might have read about Cats and Dogs and Mammals, it's BS.

(picture under GFDL, borrowed from Wikipedia, thanks to Daniel Ullrich)

06 March 2008

Tomcat Deploys My Application Twice !

I drop my foo.war under webapps, and from the logs I see objects from my Spring application context getting loaded two times. What's causing this double deployment?

After much head-scratching I realised that my foo app was getting deployed as the root context (under "/"), as well as under "/foo". And in our Tomcat's server.xml we had a little

  <Context path=""
              docBase="/path_to_tomcat/webapps/foo"
              reloadable="true" 
              crossContext="true"> 
  </Context>

We dumped this Context entry, renamed foo.war to ROOT.war (caps necessary), and our double application startup disappeared.

Tomcat was dutifully doing its auto-deploy magic with its webapps directory, and then dutifully deploying any Contexts it found in its server.xml. If you really need a Context in your server.xml, make sure its docBase isn't under your Tomcat's webapps directory.

A simple solution, but it took us a while to fix, and according to my friend google lots of other people have had similar symptoms and worse trouble fixing them.

HTH :))