www.mwasoftware.co.uk

I did start a blog back 2008 but then forgot about it. I hope to get back to adding to this soon. For now, this was the last post.

Last September I fired off a letter to the Guardian phrasing the EU's decision to stop forcing changes to our weights and measures system (Take Pride in our Mongrel Measures). Surprisingly enough this got published. Its theme, that of praising plurality in our measurement systems seems to have been out of fashion for a long time, but really does need to be re-visited if bureaucrats and the arithmetically challenged are not to make our life even more sterile than it is.

When it comes to number systems, I am always reminded of what my Maths lecturers used to grind into us: if your choice of units of measurement makes a difference to the outcome of a calculation, then you have got something wrong. Units of measurement are no more than arbitrary baselines in a given dimension and can only affect the values of constants.

On the face of it, the metric system seems entirely logical and rational. What could be simpler than a measurement system based on decimals. Unfortunately, it is neither logical, nor rational, nor useful.

The only logical system is one that is based on base two - and perhaps arguably related bases such as eight and sixteen. Computers are logical; they work in base two. Humans aren't good in base 2 - although base 8 or 16 is not an unreasonable choice if you want to be logical.

The SI units of measurement are an example of a rational system. It has a single unit of measurement for each dimension and all measurements are expressed in that unit. The SI system uses the metre, kilogram and second for length, mass and time, but it could equally well have used the centimetre, gramme and second, or the foot, pound and second. All would have resulted in a total rational measurement system.

As for useful - well usefulness depends on the purpose. I would argue that for a measurement system to be useful to humans, its measurements should be expressed in small integer values. We find it hard to visualise large integers.

Here's an example of how large integers don't work. Last year, I employed builders to build an extension to my house. They got two of the windows muddled up and put the frames in the wrong location - swapped over. The size of these frames was written on the plans and the frames in millimetres (four digit values) and even though the builders were used to measuring in millimetres, they can't visualise a four digit measurement and so the lengths were no more than "names" to them. They got the names muddled up.

Now, if the frames had been labelled as four foot and four foot six (inches) -which is what they were when measured in English, there would have been no confusion. The builders can visualise this easily (to a man they would tell you their height in feet and weight in stones), and would not have made such a silly mistake.

The problem exhibited here is that while there are also examples where the metric system can be useful, it is a one size fits all approach that can never be generally useful. If the window frame had been measured in centimetres, it would still have been a three digit value, decimetres would have yielded a two digit value, and metres would given you an awkward one and a bit measurement.

Using ten as your multiplier does not give you sufficient granularity of measurement to have the choice given to you by the imperial system. The yard and the metre are about the same length and fill the same niche, but there is no equivalent to the foot in the metric system. Perhaps that's why after forty years of metricated teaching we still use feet and inches to measure our height.

The rationale for the metric system is that base ten is easy - but that is the flip side to a major complaint of teaching of mathematics today, that the subject is dumbed down. Before metrication and decimalisation, British children had to learn mental arithmetic in base 12 (inches and pennies), base 8 (pints to the gallon), base 16 (ounces to the pound) and base 3 (feet to the yard), if they were to master all the different conversion units.

The sad thing is that while the teaching of number bases seems to have been lost along with the 12 times table, base 12 is still very much needed in time (5 x 12 seconds to the minute, 12 months to the year) and in navigation and geometry. All subjects for which base 10 simply complicates your calculation. 100 degrees to a right angle may sound logical, but when a 3-4-5 right angled triangle then ends up with angles of 66.66666 recurring and 33.33333 recurring, you realise that something has gone wrong. And how do you fit ten months to the year around four seasons?

The original rationale for metrication really came from the mistaken practice with the Imperial System of trying to rationalise all measurements down to integer measures in a succession of different units. For example, the Victorians would measure the length of a railway line in so many miles (8 furlongs), furlongs (220 yds), chains (22 yds) and yards. Computing with such mixed measurements required the labourious practice method, repeatedly applying the awkward conversion units. As my lecturers would have said, your choice of measurements has made your calculation difficult, therefore you have done something wrong.

The error in the analysis was then to try and make the conversion units easy (i.e. base 10) rather than the more rational approach of only working in one unit. If you measure the railway line as 18.5 miles rather than 18 miles and 4 furlongs, life is suddenly much easier. The rule is choose the correct units for the job and stick with them.

So, back to the original letter to the Guardian. There is no need for a sterile debate about the different measurements systems. Each has its own domain of use. The Imperial System evolved over time to suit many day to day uses and is on a human scale. The metric system is now widely used for Engineering. Each works well in its domain. Let the people decide which units of measurement they want to use, and the bureaucrats can make life difficult for themselves rather than the rest of us.

If you did not study Latin at an English Grammar School in the 1960s then you probably never got the real joke in the "Life of Brian", when John Cleese's Centurion held the knife to Graham Chapman's throat and uttered the immortal phrase "How many Romans". It was the stock phrase of the Latin schoolmaster aimed at the boy or girl who had failed to correctly decline the noun or conjugate the verb,  and had used the singular rather than the plural. Was Caesar really only referring to a single soldier or a whole army?

When you had been daily humiliated by this one phrase, to see it used with a real sword rather than a metaphorical one, was too much, and laughter was only a partial relief.

Latin, with its strict syntax and word agreement was in a different league to French, with its fewer syntax traps - but French still had its traps for the English Schoolboy. Like English, Latin only uses a simple alphabet (and doesn't even have a J or a W), but French has these horrible things called accents on its letters. Sometimes they go one way, sometimes the other. They appear to add no extra information, but you lose marks if you get them the wrong way around.

The teacher would sarcastically tell you that getting the accent the wrong way round made it sound different - and would then give an exaggerated example. But, for the English, this makes little sense. You know how a word is pronounced, and you wouldn't pronounce it any differently, just because of a slip of the pen ( or as they used to tell us la plume de ma tante est dans le jardin.

Perhaps we would have understood better if they had told us more of the social history of France. France is a much more centralised state that Britain. They tell their population not just how to spell a word but also how to pronounce it. There is no (official) recognition of regional variations in how a word is pronounced. There is the official way, and that is what they accents are telling you - the official way to pronounce the word.

But, there is no Academie Anglaise". English is spoken around the world, but there is no single standard for how words are pronounced - and sometimes for what they mean. If an American drives their car into a Car Repairers in England and says please look under the hood because I think there is a problem with my muffler, the response is to be redirected to a clothing shop, while in the reverse situation, please look under the bonnet because I think there is a problem with my silencer, is likely to have people diving for cover.

But even when the words have the same meaning, they often do not sound the same. Is the English northern city on the river Tyne called Newcarsel or Newcassel. For a native of the city, it is the latter, while for a southerner like me, its the former. So we compromise and write it Newcastle.

One of the truly great features of the English Language is that words are not written in a fully phonetic manner. We use partial phonetics. We leave, in our words, many clues as to how they are pronounced but the spelling of the word does not define categorically how it is pronounced. We can thus agree on a common spelling even when we have different regional or world accents and have a common literature without a centralised view on pronunciation.

It's not as if phonetics are that useful. I don't know about you, but I haven't read by sounding out words since the age of six. I remember words by their shape, and that's how I read. Phonetics are only really useful when agreeing on how to write down a new word and to give us a clue when we come across the written version of a word that we may have heard but haven't seen written down before.

Of course, there are still some who don't get it. There was a good debate on this subject that raged on the BBC's website last year. There do seem to be some people that just can't reconcile the fact that we have 26 symbols for (at least) forty sounds, and want to resolve this by imposing a new system of phonetic spelling on us all in order to resolve a discrepancy that is not a problem for anyone else.

We should just remember that one of the great features of English is that spelling and pronunciation are only loosely linked - and without this it would be less of a candidate for a world language. If it ain't broke, don't fix it - please.

I have been using Installshield Express to install applications for more years than I care to remember. But I have never really been that happy with it and this year rather than paying up for yet another upgrade, I looked for an alternative. The alternative I found is called WiX. It is almost an oxymoron: an Open Source Product from Microsoft - and it's a great product. This blog is about why I have changed from Installshield to WiX and why WiX was used for the new versions of the Firebird Merge Modules.

Why Change?

The first reason was the usual one of cost. Installshield is not a cheap product and the even the entry level Express version seems to be getting more and more expensive - and the more powerful versions are just beyond our budget. But money isn't the only reason. In the end, money can always be found if the product is good enough and saves time and support. The problem is that Installshield didn't really do what I wanted it to do.

The first problem is that Installshield Express uses a binary file format for installation scripts. This is non-ideal for CVS style change control. When you have more than one variant of an application to install (as I do), it is easy enough to make a copy of a working installation script but thereafter it's just a headache keeping them in step when you need to make future changes.

Installshield also insists on using absolute path names for the files that you include in your installation - which is fine until you want to change the location of a file on your system, when you have to go back and change every place it is used.

The Installshield tree view of an installation looks nice - at first - but then like any attempt to present a database as a single tree view, it gets in the way as many times as it helps. Just consider the simple case of defining a short cut menu for an application executeable. Why is it in a separate place to where the application executeable is defined? Grouping short cuts together is one view on a database, while locating short cuts next to their targets is just as valid.

With the Express version you really are limited as the the dialogs and their sequence. I can't just add another minor dialog without upgrading to the more expensive version. 

And finally, Installshield Express is really just an editor for a Windows Installer database, but an editor that limits my access to Windows Installer. If I want to use additional functions then I have to upgrade to a more powerful and expensive version - and why is it that the feature I really want is never in the entry level version?

Basically, what I wanted was a means of creating a Windows Installer Database that:

  1. Uses text based scripts for easy use with CVS.
  2. Is modular in design so that I can easily cope with minor variations in an application - and reflects the structure of the application and its support components.
  3. Allows me to define the different parts of the installation (executables, short cuts, registry entries, etc.) in a way that reflects the way they relate to each other rather than be forced to use a single view on the database, and one that is oriented around the final outcome rather than its development.
  4. Allows easy modification of the paths to source files.
  5. Does not prevent me from using all of Windows Installer
  6. Allows me to customise the dialogs.
  7. Does not make me want to take deep breath when looking at the price.

The Search for a new Installation Script Preparation Tool

There are still several commercial alternatives to Installshield on the market, such as Wise and Installaware. However, none of them seemed to offer what I was looking for. On the other hand, a Wikipedia article on Windows Installer led me to WiX - and WiX was just what I was looking for.

Why WiX? Well:

  • It uses source scripts using an XML based grammar. Text based and so meets my first criteria.
  • The source scripts can be organised into many fragments and a preprocessor permits 'C' style conditional inclusion of components etc. i.e. its modular.
  • The use of XML and fragments gives great flexibility over how the components of each installation are defined. It is easy enough to define a component that consists of a file, a short cut and a registry entry all nicely grouped together in XML. On the other hand, you can keep them separate if you want to.
  • Environment variables as well as defined variables can be referenced in the scripts. These give a flexible means of defining things such as common root folders for the source files.
  • All Windows Installer functions are available.
  • Dialogs are all scripted and the scripts are available for modification. A WYSIWYG tool "WixEdit" is also available for dialog creation.
  • It's Open Source - need I say more.

Yes, I'm sold on WiX.

In practice, a WiX script is an XML representation of a Windows Installer database and the compilation and linking of the scripts is essentially a transform from the XML representation to a relational database - plus laying out the installation files for you. But, while a relational database is never easy to understand when looking at it "in the raw", an XML representation is much more meaningful.

WiX is not necessarily the right answer for everyone. If you are a novice programmer with a simple self-contained executable to install, then the versions of Installshield or Installaware packaged with Delphi are perfectly good enough. But if you are working on a larger product then you should really think about WiX. True, you need to understand Windows Installer concepts if you are to make use of WiX and an XML file can be a bit daunting at first sight. But there is a good online tutorial available, and the time spent learning to use WiX is well worth the effort.

WiX and the Firebird Merge Modules

Prior to using WiX scripts, the Merge Modules were created using Microsoft's ORCA tool. This tool allows you to create and edit Windows Installer databases, but is a low level tool and time consuming to use. It was OK for the first generation of Merge Modules, but as more requirements have come forward, such as the Classic as well as the Super Server, Windows Firewall configuration, Lock Down versions and more complicated upgrade cases, continuing to use ORCA just ceased to be a reasonable option.

With WiX, it has been possible to create a unified set of scripts for both Firebird 1.5.x and Firebird 2 and all the different variants of Server and Server Configuration. Conditional compilation is used to select the different variants. When a new version of Firebird comes out it should just be a simple case of minor changes to this set of scripts to reflect any new features, rather than having to author a new set of Merge Modules. Something that should really speed up the availability time.

Use of the Open Source WiX tool also makes it feasible to make available example installs using the Merge Modules, which can be downloaded and compiled by anyone. These examples may provide the basis of many end user Firebird Installs.

Enjoy using the Merge Modules and example scripts.

 
Tony Whyman, August 2007