Windows Genuine Advantage – for who?

Microsofts Genuine Advantage program will check whether you have a registered copy of Windows.

This is a bit of a liberty – don’t they trust me? I have a fully licenced version of XP Pro on this machine.

OK I don’t mind performing this once to download a particular piece of software. However once I have demonstrated to Microsoft that my machine is genuine that should be it. However Microsoft have a different opinion. Every time that you needto install software that is protected by WGA you need to go through the same hoops. How can my machine that is already a Genuine Windows machine stop being a genuine windows machine? Can they decide that it has been revoked?

want and environment variables

Want is a delphi freindly build tool based upon ant.

It is useful for more than building delphi.

It is a small standalone exe that can be used to script tasks.

You can use %{MY_VAR} to access environemt variables.

This makes creating build scripts that work for more than one developer much easier. 

Useful delphi TStream descendants

Delphi has a number of very useful stream classes.

They all derive from TStream.

The basic version is TFileStream – this writes to a filesystem.

There is also THandleStream – this writes to a windows handle – useful if you need to keep a file locked then write to it.

TStringStream is useful when dealing with delphi strings – especially when writing to another stream.

TBlobStream is used for accessing blob data from a database.

TResourceStream is used to read from embedded resources.

TMemoryStream that acts upon blocks of memory. 

There are also the adapter streams that takes another stream as a parameter.

 There is the TIStream that acts as a bridge between TStreams and the IStreams interface.

These include ZipStreams, EncryptionStreams, SocketStreams &c

These all take the approach that everything looks like a file this massively simplifys code.


XSLT Considered Harmful

Warning XSLT can seriously twist your brain.

XLST was hailed at the end of the 90’s as being the uttimate tool to transform XML.
Theoretically you can use it to transform any XML into any other other format.

It can be very powerful (look at Code Generation).
However it needs to be treated especially carefully and be properly supported by unit tests of the transforms. Just because some clever code can be written does not mean that it should. Don’t take too many shortcuts.

Here is a useful python script that will make life a little easier:

import os

def XPathToXML(XPath):
   s = XPath.split(“/”)
   for x in s:
      print (“<“+x+”>”
   for x in s:
      print (“</”+x+”>”

if __name__ == “__main__”:

This little beauty will take an XPath fragment such as
a/b/c and return:
Which is just what the doctor ordered when creating XSLT test data.

What is three tier design

Recently I heard the preposterous claim that a three tier application that uses stored procedures is not really three tier.

A three tier application splits it work up into distinct tiers (Here is an example):

1. Presentation Layer
2. Business Layer
3. Database layer

While this is harder initially to set up it does provides a range of deployment, security, development and maintenance benefits.

Just because the database layer uses stored procedures does not in any way invalidate this model.

For deployment, with a corrrect design it is possible to only require detailed configuration once on the server as opposed to every client.

For security there are more oppertunities for security in depth (you only need grant database access to the Business Layer or Database Layer not every user).

For development there are more incentives to reuse code since the layers provide a some decoupling. In a two tier application there is far more room for code duplication. The layers also provide a point for performance tuning.

For maintenance having distinct layers means that a patch can be better isolated.
If you don’t change the interface only a single changed component needs to be deployed.

Wireless at last

I have finally managed to get my laptop to work wirelessly!
When I set up the Belkin router I had switched off wifi as I did not have any wifi devices at the time.
Subsequently I have been trying to work out why the laptop cannot see the network.
I have sucessfully configured and secured other peoples wifi networks and it was getting embarasing.