matthew-jones.com

Ramblings from a software developer

I’d just like to put together my thoughts on how well I think that Elevate WebBuilder (EWB) fits the requirements of many developers today, particularly Delphi developers. In the last year, I’ve done a lot of thinking about the tools I use, and what I need from them. What I think of course doesn’t apply to everyone, but it might help someone in their thinking.

The key for me was that mobile is here. A friend who moved from Delphi to .Net a long time ago had been telling me that the desktop is dead for most purposes, and given that I develop both my own products and for others, and I was doing desktop stuff, I knew it to be “wrong”, but it is also right of course – it is fading. You cannot develop for desktop alone. Apple’s iOS was for a long time the main target, with Android a second stage. Delphi recognised this too, and started targeting iOS. But while they floundered getting something sensible together, the world changed, and our customers are not just using iOS, and not only Android as a primary target too, but Windows phone and the web and anything you can think of. I was not happy with the way XE4 turned out, with language changes too. I like the single UI platform to target, and that wasn’t available in the “pascal” language options, nor C# offerings. EWB came along at the right time for me, and I have been amazed at the close control it gives. I can easily respond to the screen size of the device that is running it (particularly with the new option coming in 1.02 (and now released) that I’ve been hacking in recently myself). I’ve been listening to the Tablet Show podcast recently, and I am a fan of the “application theme” rather than “device style”, given that our application is going to be used across multiple devices. EWB does this nicely – making my own theme to style our application has been easy.

Continue reading

For some time now, I’ve struggled to work out how to build the WiX files that are generated by MSI Factory in FinalBuilder and include the bootstrapper. Building WiX files in FinalBuilder is dead easy – it has actions for the WiX Candle and the WiX linker so you can compile the files that MSI Factory generates (or any other WiX files of course) quite easily. But once you have your MSI, it is nice to have the EXE wrapper for bootstrapping it. Why does this matter? Because if you issue an update to your MSI file, and then double-click to run it, Windows will tell the user they must manually uninstall the app before they can install the update. Not so friendly.

Okay, so what’s so hard? The bootstrap compiler takes a number of options, and they include the GUIDs that are needed to check if it is installed already. The problem is that you don’t know the GUID in the build. It turns out that the answer is simple, but it took some time to find, so I’m blogging it so I remember for next time.

The MSI Factory software comes with a command line tool called “IRMakeBootstrap.exe”. This takes an XML configuration file and the name of the output file as parameters, and the product name, but also then needs three parameters that are key to proper operation.

The key ones are -var:PackageCode and -var:ProductCode. Now if you look at your WiX file you will see that it has a line like:

<Product Id="D03192D5-40A2-4EAC-B1A1-9BACE96AFE78" Name="My App Name" Version="1.0.0" Manufacturer="My Company" UpgradeCode="76D9BEB2-C077-4B7C-A91E-DF294F4C3457" Language="1033">

The “Id” matches the “Product Code” , and the “UpgradeCode” matches the Upgrade code, in the Project settings dialog of MSI Factory. However, the PackageCode is not in the file at all. There is a Package node in the XML, but no value. If you look in MSI Factories dialog, there is a “Package ID” on the Package tab, but it says “leave blank to auto-generate”. But if that is left blank, I can’t find out what it is to set it to something useful, and thus pass to the bootstrap maker.

Okay, so what is the solution? Simple. Define a GUID in the dialog for the Package ID in the MSI Factory dialog. This is normally a “bad thing”, because you want to to change each time (pretty much essential). But you are doing better anyway by using FinalBuilder (or other build tool?) and FinalBuilder is able to generate a GUID just fine. So, set it to a valid GUID string, and then generate the WiX files.

<Package Id="59D9FCDF-13BE-4AD7-841B-1F11D2E74500" ...

You will now find that the XML contains an “Id” for the package too. Haha! Now you have what you need to automate it. The value in the XML can now be replaced in your script, and also passed through to the bootstrap builder. Note that the GUIDs passed to the bootstrap builder need the curly brackets surrounding them. This ensures that they match properly.

Finally, you can check that it all works properly by running your install EXE with the “/Log:c:\install.txt” parameter which causes it to output a log of its activities.

The final parameters for  the bootstrap maker is:

 

"D:\Src\bootstrap_config.xml" "D:\Src\MySetup.exe" -var:AllowExtractMSI=1 -var:ProductName="Product Name"  -var:PackageCode="{%INST_PACKAGECODE%}"  -var:ProductCode="{%INST_PRODUCTCODE%}" -var:ProductVersion=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_BUILD%

I think Apple should be banned from making the iPad. And tablet PCs
generally should be banned.

Think about how kids will grow up having tablets in the house as common items. They will watch TV programmes like Star Trek and see them using the PADD that was ahead of its time, and the kids will think it is just normal! No people, such things are the future! The Star Trek communicator already looks old fashioned, and what is going to be left for kids to think are not normal but futuristic?

Ban them now!

Edit: I’ve been to see Avatar, and the world is set to right again. Clear “glass” pads and lovely 3D visualisers. It will be a year or two before Apple or anyone brings out devices like that. The future is safe.

EnTabFile is a tool to convert the spaces at the start of each line in a file to tabs. This allows them to work better in editors that support proper tabs. It is primarily designed to be used as a command line tool, but supports manual operation too.

How EnTab works

This tool is quite simple – it just removes spaces at the start of each line of an ANSI text file and replaces them with tab characters. It does not replace any spaces anywhere else in the line – it stops once it find anything that isn’t a space.

The number of spaces used for each tab is settable in the user interfaace, but the tool is really designed to be used from the command line as part of a bigger process – perhaps source code reformatting using something like DelForExp. Set DelForExp to output 4 spaces for each tab, and then use EnTabFile to convert every 4 spaces into a tab.

Note that if an incomplete set of spaces is found, a tab will still be output. Thus if there are 6 spaces and the tab setting is 4, then 2 tabs will be output. No spaces are ever left at the start of a line.

For safety, it will save an original copy with the extension “.pretab” that you can use to compare. If it already exists, no copy is made so that the entab can be done multiple times and the original is still there.

Manual use:

Run the application, and type in the name of the file you wish to entab. You can click the ‘…’ button to use a browser.

Select the number of spaces per tab.

Click “Entab” and it will be loaded, converted, and saved. A progress bar shows the activity.

Command line use:

Run the application with the filepath for the file you want converted. The full path should be specified for proper operation of the backup.

Only a single file can be specified on the command line.

You can specify the tab size using the command line switch /1, /2 /3 /4 /5 /6 /7 or /8.

With a command line, the app will convert the file (if it exists!) and then close immediately.

Delphi Integration:

For use within Delphi, you can add it to the Tools menu. The following are suggestions:

Title: EnTab this file
Program: [PATH TO FILE]\EnTabFile.exe
Working Directory: [PATH TO FILE]
Parameters: $SAVE $EDNAME

Note that if run after DelForExp, you will have to save before it can convert. After Entabbing, Delphi will say the file has changed and do you want to reload. The answer should always be yes or the tabs will not be loaded!

Download

A zip file with these basic instructions and the self-contained application are available via the link: EnTab for Windows. No installer is needed – just put the file in a suitable location, unzip it, and start using it.

This integrity checker is designed to work data transport and storage systems, such as network connections and disk storage (particularly removable media). This is done by writing sequences of numbers repeatedly and then reading them back again. There should never be any difference, but sometimes a bad device driver or media causes corruption – this application will help you check if this is happening. It doesn’t provide any cures, but it can help prove that you have a problem, and where it is.

For really thorough testing, use both of the checkers included in the app over the same transport simultaneously – the application is truly multi-threaded so they will each go full speed and work the transport hard.

There is no cost for this application – it is provided as-is for free. But if you are looking for some custom development work done, you might like to consider me as a candidate – see my contracting page.

Note: This file is a pre-release version, but based on stable code used in a DOS based version. If you see any issues, please let me know.

Download IntegrityChecker.zip now – updated 02 Apr 2002