Month: June 2005

Another alternative to Oracle

Have a look at fyracle. This is an Oracle-compatible version of Firebird, which seems to have come of age. The tools to compile PL/SQL etc. cost about €80 a desk and the run-time is free. Reports are good.

I’ve not had a lot of time to look at this but I think it’s definitely a viable alternative if Oracle licences are going to eat your profit. I don’t know if it has an equivalent of mod/plsql but if it did I’d be very interested in it for highly scalable projects that need big servers, for which Oracle like to charge you through the nose. That said; for the moment MySQL will do for my personal projects.

Fyracle doesn’t have the spatial or context extensions, but these could possibly be supported by some other tools and a bridge. Needs looking at; face it – if you’re a small company developing software or running a website that doesn’t make a fortune but needs big iron (which is very cheap if you use eBay) and have to pay Oracle licences it may be a good bludgeon to get Oracle to give you a better discount.

Where I work we are Oracle partners and the price is reasonably sane. Big corporations get good discounts, as do applications users. It’s the small-to-medium independent guys that get it.

Ah well, back to something else.

Holiday in Amsterdam

Saturday 30 July 2005

We went over to Holland via Hull to Rotterdam. I had the mistaken impression that it was going to take 5 or so hours to get to Hull and was completely wrong; 3 with a break. The checking in and so on was fairly painless, but we did get some funny looks because we had a 14 foot open boat on the top of the car.

We were on the Pride of Rotterdam. We elected to stay in the continental bar and have a snack, rather than fight our way down to the restaurant. Jon went and played with the other kids in the ball pool and Deb decided to sit and read a book. We thought there were only 2 beds in the cabin but then discovered that another pair come down from the ceiling.

We met up with the others from the Canoe Camping Club and had a couple of beers, exchanging war stories and talking about what we would do when we got there.

Got to bed around midnight.

Sunday 31st July

Were woken up at a ridiculously early hour (lost an hour going to the continent). We grabbed a bite in the bar and then disembarked. After some confusion we all met up at the small car park on the way out of the ferry terminal. The tunnel under the river was closed and, after some mix ups, we ended up going through Rotterdam, which was spooky because everyone was still in bed (it looked like anyway).

Got to Amsterdam about lunch time and set up our new tent. This was amazingly easy and the tent worked really well. We were staying at a place owned by the local canoe club called Slaughterplass, which was about 20 minutes from the centre of Amsterdam by tram. Had a paddle around the lake (we were on an island) and then, in the evening, went into Amsterdam and had some food and a wander around. I don’t know why but I really like the place. Very peaceful for a capital city.

The local club were really good to us, even setting up a sink where we could wash our plates etc. Really nice people.

Monday 1st June

Rained a lot so we decided to check out the climbing walls we had looked up on the internet before we left. We were going to go with one of the other families but we managed to lose each other in heavy traffic and, of course, hadn’t swapped mobile numbers or given them the address (stupid stupid). Had an interesting near-miss turning left when I just didn’t look properly for oncoming traffic – not funny. The climbing wall was officially closed but they let us in and we had a mess about in the dry for a couple of hours. It was a purpose built building on an industrial estate, looked like a big A frame that was maybe 20 metres high and 30 by 20 square. I never managed to get to the top. Too scary.

I’m beginning to master things like bouldering. You have to prepare and swing your weight to get up things. In addition you sometimes have to switch which side of your body is closest to the wall, which I still haven’t quite understood.

The evening was much better and if memory serves Rosie and Deb went round the lake again. Plus some of the guys from the club came and we did some canoe polo, which consisted of splashing the other guys as much as possible with the ball. Jon joined in and enjoyed himself hugely. He agreed to come paddling the next day.

Tuesday 2nd June

Lazy morning. About 10 we left and …

Decided to publish this because I never had time to finish it so in it goes.

Nulls again

Nulls have been the bane of my life as a database programmer and they got me again today. I was getting a constraint violation on an optional foreign key from MySQL.

My PHP data entry system was returning the empty string when the user hadn’t entered anything, which is fine. In Oracle (as I’ve discussed many times here) ‘’ is null. Not in MySQL. In MySQL it is an empty string – which is probably right.

I had to add the following scan in my processing:

  foreach ($values as $key => $val)
  {
    if( $val == ’’) $values[$key] = null ;
  }

Now it works.

Standing on the shoulders of giants: Part 1

As most of you who read this know I’ve been writing a system to do the data entry for my collaboration system. It had the following objectives:

  1. The data model (and as far as possible the boiler plate etc.) is in an XML document.
  2. This XML document is used to
    1. Create the schema
    2. Render HTML forms
    3. Generate the insert/update SQL from a structured object
    4. Define navigation paths between tables (peer, master/detail)
    5. Define lookups and foreign keys
  3. The resulting system should be database agnostic.

I originally started in Java and wrote the code that generates the schema from an XML document probably 18 months ago. I then looked at things like Jackarta Struts and other Java technology to deliver the data entry and the rest of the application, because I knew that Oracle on its own was a non-runner and I didn’t want to pay a small fortune in licences to them for a system that may sink without trace.

Problems: productivity with Java is crap. Struts was too hard to get things going in. I could have written it all as a pile of JSP’s but it would have been a pig to maintain. I have learned a lot from learning Java (and getting Sun Certified) but it’s poor for small projects.

I then decided (about 2 months ago) to look at using PHP; in fact a friend suggested it to me. PHP differs from Java in that there are a lot of very useful things in the base language that you don’t have to redefine for yourself. Also it uses associative arrays. Associative arrays alone can save you a great deal of time if you know how to use them properly and the language has proper syntactic sugar to manage them. I already knew this from using Awk. These exist in Java, but they are yet another class you have to learn, not part of the language. Java 1.5 does have some syntax to walk these kind of objects but its too little too late.

Java was created by computer scientists for computer-sciency reasons. PHP is extremely pragmatic. PHP 5 stole the good bits out of the C++ and Java object models but made them optional. In Java everything is an object (apart from the base types which have a ton of irritating rules around them). In PHP a variable is a variable and its type can change.

In the 8 or so weeks, putting in about 6-10 hours a week I have managed to get to a place where I can insert data and render a data entry form in HTML just by getting information from my structured object.

Part 1

I have already described how easy it was to change the original XML parsing code that created the schema into PHP from Java. This took me about 3 days, and at least part of this was learning the syntax of PHP as I went.

Part 2

This is where the giants come in. My HTML forms are rendered by the Pear package HTML_Quickform, the database management by the DB package.

As an example, I was worrying about how I was going to do sequences for ID’s etc. in my insert forms. No problem. The DB package has a generic way of generating them and does its own thing with the underlying database. I just cut and paste the examples out of the manual and change some variable names, it works.

Another example – I was constructing dynamic SQL to take the list of names and values in the associative array used by the quick form object. I didn’t need to. The DB package will do all of the donkey work for you if you pass it the table name with an array of column names and values, and tell it what you want to do. I did have to do things like remove the elements from the values array that were control data, and also (for the update) create a where clause. But it was trivially easy.

Part 3

You don’t need a complex IDE full of demented wizards. You can just sit in a directory and work on your code. Vim and Apache are all that is required as long as you are disciplined. I recon my productivity is maybe 10 times what it would be in a Java IDE. No compiling. Hit refresh on your browser and you can see your changes straight away. No constantly restarting your J2EE containers – there aren’t any!!! It works really well with the make a small change test the results way of working, without all of the constant pauses while the IDE thinks about things.

I am beginning to think that even a Java shop could benefit from PHP if you use its object model. This is because it should be fairly easy to translate the PHP to Java after you’ve resolved the issues around what you want the application to look like. You could even write a first-cut translator in PHP (or better Python – which is brilliant at text manipulation). Just treat Java as what it is; the lowest common denominator, the C of the 21st Century.

Gotta get some sleep.

Outsourcing

I response to this.

I believe the gains from outsourcing are dubious at best.

From personal and anecdotal experience I believe that the gains in 2-5 years when your business changes (and it will, particularly in legislation-rich areas like financial services) you will suddenly find yourself with a bill for several million pounds to keep up with new requirements; hindered by inter-company change control and stuffed by your more far sighted (i.e. agile) competition.

Of course, you’ll be gone by then with a fat bonus – or am I being cynical?

I do agree that HR and some of the other dull stuff could benefit from this, but be very careful of your core business. Like it or lump it IT is core business these days for every organisation.