Archive for November, 2005

Corporate I.T. a shambles?

Wednesday, November 23rd, 2005

It’s becoming more and more apparent that many large companies (and I’m including government departments here) have a poorly-performing mess instead of an I.T. infrastructure. How many people  haven’t ever been told by an apologetic customer service advisor or support person that "The system is down" or "The system is running slowly today"? Not many, I’ll bet. I’m just rather amazed that so many large companies seem to have these problems yet seemingly do nothing about them.

I got thinking about this when I had some trouble with Tesco online yesterday. They were supposed to make a delivery but didn’t and unusually, nobody had called to tell me why. So I called them only to find that the first person I spoke to had no record of my existance or my order ("I’ve been having problems with my system today, so I’ll just transfer you to a collegue to see if they can help you"). The second person was able to find my order after some delay ("Sorry, it’ll take a while for me to get your order up as the system is running slowly today"). They then told me that "It’s very slow, so it might be a problem with your store’s server" (I resisted the very, very strong temptation to ask them what a server is). Later I had to ring up again and spoke to someone else who told me that the system was so slow that they’d call me back when they’d got my order up. Half an hour later, they did, only to tell me that they were having "Major I.T. problems" and were unable to view my order, let alone reshedule it for me.

This is probably an extreme example, but why on earth are we seeing similar things happening with so many large companies in this country? I can only assume that the management either don’t care (perhaps because they’ve spent a lot of money on a new system and don’t want to admit that it’s crap) or the front-line staff aren’t making enough noise.
I think the main problem is that companies choose to entrust large projects to external contractors and always choose the cheapest option. There are certainly several large companies (especially those who work for the government) who have a proven track-record of providing solutions which are reliable for about 0.5 seconds after installation, yet still these companies are getting business. These companies are supplying mission-critical systems to large companies which are costing them millions of pounds a year in lost revenue and other expenses associated with not having a reliable infrastructure.
The fact of the matter is that companies can easily find out whether a new system is going to do what is required of it: it’s called acceptance testing. Probably the best way to test a large new system is to run it in parallel with the existing system, which should quickly uncover any reliability problems or features that are missing – then the company hands over no money until it’s fixed and if it doesn’t get fixed, the contractor doesn’t get paid. This clearly isn’t happening to the extent that it should be.

I know I’ve rambled on a bit, but I’m just continually flabbergasted firstly that companies let their systems get in such a state and secondly that they don’t immediately do something about it.

The world’s got a memory!

Tuesday, November 8th, 2005

Well on this week’s LUGRadio they talk about how the web can get a little scary. Basically they were saying how they may, for example, write a blog entry slagging off a company, then maybe in 5 years time they apply for a job with said company. Naturally the first thing employers do in the IT industry is Google their candidates, at which point they would find the aforementioned post and their job prospects disappear very quickly. Any potential employers reading this: stop reading this, go get your phone and offer me an interview ;-)

This got the LUGRadio guys talking about how strange it is when a collegue mentions something they saw on their blog. For some reason, people think nobody they know will ever find the stuff they post. I am guilty of this too. It’s also true that things posted on the web NEVER go away – first it is cached by Google, then archived by archive.org, so even if the original content is removed it still lives on (although thankfully all traces of my very first web site from about 1994/95 appear to be long gone :-) ). This blog may well be here for the next 50 years or so (well, who knows what the web will be in 50 years, but it will be somwhere in 50 years time) – how much of this nonsense I post is going to come back to haunt me?

If you google me, you’ll find a hell of a lot of stuff. Not just my website, but everything I’ve ever posted on a forum or public mailing list, commentry from other people about things I may have said or done, photographs I have taken or appear in, even lists of the music I listen to. I wonder how many of the new people I meet go home and Google me? Probably a not-insignificant percentage.

Readers beware: I might be Googling you  right now – what am I going to find?

Squeezed by a Python

Sunday, November 6th, 2005

No I haven’t been wandering around a zoo, I am of course going to write about Python the programming language.

I’ve been using PHP for web development for a number of years and am quite happy with it, but I keep hearing how wonderful Python is. Having used it for writing the odd GTK app, I’d be inclined to agree, but I was wondering how it compares when used under mod_python for web development.

So I decided to have a go at writing a simple script to display a row of data from a MySQL table. Here’s the PHP code I was trying to re-create (I wrote the same code in PHP so I could compare number of lines/complexity/etc):

<?php

echo "<html><head><title>PHP example</title></head>\n";
echo "<body>\n";

$conn = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("databasename", $conn);

$result = mysql_query("SELECT * FROM pages;", $conn);

$row = mysql_fetch_array($result);

for($x = 0; $x <= count($row)-1; $x++) {
  echo $row[$x];
  echo "<br />";
}

echo "</body></html>\n";

?>

As usual when working with Python I found that there was little documentation available, but I didn’t let it deter me. Here is the equivalent Python code to the above:

<%

import MySQLdb

req.write("<html><head><title>mod_python example</title></head>\n")
req.write("<body>\n")

conn = MySQLdb.connect(host="localhost",user="username",passwd="password",db="databasename")
cursor = conn.cursor()
cursor.execute("SELECT * FROM pages")

datareturned = cursor.fetchone()

for value in datareturned:
  req.write(str(value))
  req.write("<br />")

req.write("</body></html>\n")

%>

It took about an hour to write that code and make it work. Note that the indentation is important, as if you incorrectly indent something Python will die with a syntax error which will keep you busy for an hour until you spot the mistake ;-)
What I mainly wanted to find out was whether Python would make it possible to do things such as interacting with a database with less code. But as you can see, both the PHP and Python files are 13 lines long, so Python offers no advantage there. Both implementations have their annoyances as far as complexity of code is concerned. In the PHP implementation, I should have been able to use:

foreach($row as $value) {
  echo $value;
  echo "<br />";
}

But for some reason that didn’t work as expected and printed each line of data twice, even though the data in $row was correct, so I had to use a full for loop.
In Python you have to convert everything to a string before it can be displayed, hence the addition of the str(). I mean come on – I thought high-level languages had left this nonsense behind? Surely if I tell a language to display a variable and the only way to display that variable is to cast it to a string, it makes sense for the language to handle that automatically?

I think the power of Python is in the high level functions that are available – e.g. you can do network socket operations using only a few lines of code. The things I do most in PHP are simple database operations, e-mail sending, image manipulation and a bit of XML parsing. I very rarely do anything complicated. Python just doesn’t seem to make these things any simpler, so unless anyone can convince me otherwise, I think I’ll stick with PHP for now…