September 30, 2003

Google News en Español!

It was about time! Google now has a Spanish localized version of it's Google News service. This is good stuff since I like to keep abreast of the news but don't really have the patience to read the propaganda masquerading as newspapers you buy here.

Actually, I speak like it's a Spain thing when it isn't. All newspapers have biases, most of them are political or religious, and you have to take everything they say with a grain of salt. Same thing for TV news. The great thing about Google News is that since it aggregates news from many different sources, you can be reasonably sure that you're getting a bias-free picture of the world, in that all the biases eventually cancel each other out. That's my theory anyway.

So it looks like I'll be getting my local news from Google now instead of, well, ignoring the news because I can't stand reading any single newspaper or watching any single TV channel. I've been getting most of my international news from Google News UK, since it's the closest I have to local and even though I don't often click through to the UK stories, I'm impressed that I have a much better picture of what's going on there than I've ever had since I moved away. I suppose it's just a great idea. Can you tell I love Google? ;)

Posted by Dave at 03:26 PM | Comments (0)

September 19, 2003

Hurricane Isabel

The news tonight showed images of hurricane Isabel beating the east coast of the US. While I hope that the damage is minimal and that nobody gets hurt, I have one question on my mind, a question that occurs to me every time I see images of hurricanes (or earthquakes) in the states:

Have americans not heard of bricks? Why do they build their houses out of plywood? Every time that something like this happens we are treated to footage of houses having their walls blown away, whole blocks lying in heaps of wood and plastic... Why don't they use durable materials to build their homes? This isn't Bangladesh, after all.

Still, I have no experience in the matter, so I can't give an informed opinion. I just think that if we had that kind of weather here in Europe, we could handle it by just bringing in anything that could fly away and covering the windows with something hurricane-proof. Minimal destruction, except maybe for tiled roofs (not a big issue in Madrid) ;).

It just seems odd...

Posted by Dave at 01:14 AM | Comments (0)

September 18, 2003

What do you mean?

Check out WordPirates, a site dedicated to listing words and terms that people are tired of hearing out-of-context or just with a completely different meaning. I think I'll be contributing a couple of words in the next few days... All I need to do is choose them, because if I start listing everything that bothers me, I'll be there all day. :)

(From Dan Gillmor's eJournal)

Posted by Dave at 01:30 AM | Comments (0)

September 17, 2003

Ranting & Raving

I've just signed up to be informed when Sun's Project Rave is released. From what I've read, it's either "programming for retards" or else Sun is lying. :)

But seriously, I hope it's not like Visual Basic. The existence of VB is solely responsible for the huge amount of people who think they are computing professionals because they know how to put together simple apps, and nothing more.

Maybe I'm overreacting, but there are an awful lot of people like that in Spain. At least I keep on running into them. The other day at work, we were asked to install a webapp on a server we manage. The first thing that looked off was that the package was in a .jar, not a .war. Upon inspection of this .jar, we find a collection of classes - and nothing more. No WEB-INF, no web.xml, nothing. Thinking that this must be an oversight, we got in touch with the "coder" and asked for the web.xml file. No problem. Five minutes later we're staring at the following file:

<web-app>
</web-app>

Seriously. And the guy swore that it was correct. So the next few hours were spent reading the code and working out what servlet declarations had to be done (incidentally, the servlet-mappings were all the same as the class names).

Here is what I think happened: The guy started out writing VB programs, and thought he was good. Sometime during 1998-2000 he got a job in the computing industry, taking advantage of the dot-com boom. So that's how he got his job. Now one day he was asked to do something in Java. So he gets JBuilder (or something) and starts reading one of these cheap-ass (and crap) spanish computer books printed by these gentlemen. Armed with not nearly enough knowledge about computers in general and his chosen subject in particular, he starts doing stuff in JBuilder. He uses wizards, he copies public-domain code from the net, and in a couple of weeks has come up with a web application that seems to work. Great, except he doesn't know it's a web application, he doesn't know how it works internally, he doesn't know what an application server is, he doesn't know about .wars, etc, etc. And this is where we get a bunch of talented and qualified people wasting time arguing with this guy about his web.xml and then reverse-engineering his code to make it work. Thankfully we were charging by the hour for this.

And that is the danger of VB. It makes the novice think that what he sees in the IDE is all there is to his program, because in VB it *is* all. However when he has to use something a little more complex, he's not even lost because he's not aware that there is so much more to know. And he just goes merrily on his way, oblivious to all the problems his code may be causing, thinking that if it doesn't work it's someone else's fault for not knowing how to set it up. "They must be so dumb", he thinks. "It's so simple".

What does all this have to do with Project Rave, you ask? Well, imagine for a moment that it is "programming for retards", as I mentioned before. This would mean that suddenly a whole bunch of people who don't know Java would end up thinking that they do. A whole bunch of clueless managers would believe them.

Now, where is Java used that VB isn't? Think small unimportant places like financial institutions, insurance companies, etc. So the risk is that suddenly you're enabling this calibre of programmer to do some *real* damage instead of limiting it to some stupid little desktop apps.

Does nobody else find this scary?

Posted by Dave at 03:22 PM | Comments (0)

September 07, 2003

Choosing the Right Tool

On Friday afternoon I was asked to whip up a way of calling a command on a unix box by just bringing up a URL in a browser (insecure, I know, but it's what the customer insisted they wanted. Whoever said the customer is always right obviously wasn't talking about IT consulting. :) ).

There were a couple of extra issues. Firstly, the command takes arguments that had to be passed through the URL. Secondly, the command had to be run as a specific user. The first requirement is not so complicated, all web languages provide easy access to URL variables. However the second requirement was a little more puzzling.

My initial approach was to think of the problem as a regular Unix problem. If you have to execute a command or a series of commands, you write a shell script. So I thought about writing a CGI shell script. This is my reasoning:

  • Maintanability - for a short system script, it's important that it be maintainable by the System Administrator, not a developer on a team. Sysadmins use Shell scripts daily, where PHP (for example) will probably not be as familiar.
  • Testing - A little mojo at the beginning of the script (switch between command-line and URL arguments) allows you to test from the command line. Very handy.
  • Flexibility - Since shell scripts are designed to run external programs, they allow a lot of flexibility in how commands are called, which commands are called, etc.
  • Elegance - A shell script will be much more easy to read than a PHP file full of system() calls, for example, and is more appropriate to the problem being solved.

With the platform decided, I started by looking at how to get URL arguments into the script. Since I was a little short on time, I didn't want to start looking up how CGI worked, which environment variables were set, etc. A quick Google search turned up bashlib, a great little project designed to make using Bash as a CGI scripting tool easier, specifically by handling things like URL variables. This made the first point given above trivial.

Now on to the second point, running the command as another user. Now I like to think I know a fair bit about Unix, but I'm mainly a developer and not a sysadmin, so although I had heard about Sudo I had never used it. It turned out to be exactly what I needed. At first I had tried just using su, but apart from being horribly insecure, I couldn't find a way of using it non-interactively. When that approach failed, I looked up sudo. All I needed was a single line in /etc/sudoers with the command, the calling user and the user the command should be called as. It's important to include the directive NOPASSWD so that the command can be run in a script without expecting a password.

And that was it, problem solved! That's how I ended my work week. I like doing something different now and again, since it's easy to get burned out working week in week out on the same thing, especially in the "client is being a pain" phase. And it's the kind of task that allows you to learn new things in small steps and relatively stress-free.

Why have I called this post "Choosing the Right Tool"? I am referring to writing a CGI in Bash. When you have a problem like the one I have described, where I could have done it in PHP, Perl, Python or whatever, you have to look at the most elegant solution and that which satisfies the most "unnamed criteria" - things that don't usually go into a project description but are a given, like efficiency or maintainability, mentioned above. In this context, I think I made the right choice.

Posted by Dave at 12:32 PM | Comments (0)

September 03, 2003

Defective?

The Reg is carrying a story about a lady in France who took EMI to court over a copy-protected CD - and won!

According to the story, the judge ruled that the CD she purchased, which would not work in her car CD player, was defective. This means that EMI have to provide her with a new CD that does work in all CD players (i.e. is NOT defective), or else refund the money. It also means that EMI are formally forbidden from selling defective CDs.

Of course, a CD is only considered defective as long as it can't be played in some devices, so if someone comes up with a "better" mechanism that does work well, then copy protecting is not in itself verboten.

Why do I find this interesting? Well, for one thing I live in Spain and I suspect that it would be possible to get a similar ruling here from the courts if it came to it. The government doesn't seem to be interested in helping the music industry, as can be appreciated by walking through anywhere in Madrid and watching all the illegal immigrants selling pirated CDs/DVDs/Video Games in front of the local police force.

The other reason I like this ruling is that at last someone seems to be talking sense. You see, I have a reasonable CD collection, nothing enormous, but well over 100. I think that that alone, and the fact that I keep on buying CDs even though I have a broadband connection at home and could easily never buy any music again, should be enough for the music industry to afford me some respect and not assume that I am a criminal.

Fortunately, I don't buy the kind of CDs that are usually copy protected, so it hasn't affected me much. But still, is a little respect too much to ask for? I think not. And if the situation gets really out of hand, I can always move to France... ;)

Posted by Dave at 04:19 PM | Comments (0)

September 01, 2003

Simon Says...

Simon Song seems to have changed the address of his weblog a couple of months ago and I didn't realise until today. I find his opinions of US culture as an outsider quite interesting, and as someone who has never been to the US I think they may be more in line with my own opinions than the usual stuff you read about in (american) blogs... :)

Posted by Dave at 06:02 PM | Comments (0)