matthew-jones.com

Ramblings from a developer

With the security updates for the OpenSSL project that come out, I started to face an issue as a developer who uses them in projects that I develop. I get an update, and I need to make sure that the new DLLs are put into the “distribution” directories for the projects, so that next time they are built the new DLL will be included “automatically”. But my projects are all over the place, and manually finding and remembering which ones to update is time consuming. Sure, I can use a search tool, but that leave the “go to the location and paste the files”.

So I wrote a tool to scan my disks and tell me which version is in situ. And then, if I want, to update them. The optional part is important because not all applications should be updated – there may be incompatibilities. An update is now much easier. You can put the new files, “ssleay32.dll” and “libeay32.dll” in the same directory as the updater if you want. It will create a “fileoptions.xml” file in the same directory too (so don’t put the updater in Program Files or other similar reduced access rights directory). The folders to scan can be separated with a semi-colon, so “C:\;D:\” will scan the C and D drives. Note that there must be a trailing ‘\’. Then scan (it is a background thread for speed). Click to select any you wish to update, and it will do so.

Supplied as-is.

Screen shot of Open SSL updater

Download the OpenSSL updater here

One thing I often ponder is why I like the RemObjects SDK for my developments, when things like REST are “free” and perhaps more standard. The simple answer is that my code looks just like any other code I write. For this example, I have written a demonstration “chat” application. You log in, you can post messages, and you get all the messages from the server. This is the procedure that sends a message to the server:

procedure TfrmLogin.SendMessage(szMessage : String);
begin 
  m_xChatService.SendMessage(szMessage, SendMessageComplete, OnLinkError);
end;

There’s no building up a URL, no encoding of parameters. Just a normal function call to a class member. If this wasn’t a WebBuilder function, I’d not have the SendMessageComplete callback – it would just wait until the call returned, but the browser is always asynchronous, so we have the callback:

procedure TfrmLogin.SendMessageComplete(nResult : Integer; szHumanResult: String);
begin 
  Report('Sent: ' + szHumanResult);
end;

That’s all there is in the client for normal coding. On the server, this is the code that implements the service:

function TChatService.SendMessage(const szMessageJSON: Utf8String; out szHumanResult: Utf8String): Integer;
begin
  Result := 1;
  g_xMessageList.Add(szMessageJSON);
end;

Continue reading

I have found Elevate Software’s WebBuilder product to be a very productive environment for me to use to develop web based user interfaces. As a long term Delphi developer, it suits me very well, allowing me to take all the language skills in Delphi, and create very capable Javascript single-page applications. It contains a core set of UI components which at first may seem to be lacking advanced options, but like Lego, you can make very nice complex components with the raw tools provide. I have implemented both an advanced grid, and a slider control using the provided TPanels, TLabels and other components.

The finished result:

The finished WebBuilder grid

Continue reading

I was in discussion with someone recently about how I go about doing my development, which uses a Javascript user interface built using the Elevate Software WebBuilder product, and a Windows service that is written using Delphi XE2. I was asked why I used the RemObjects SDK rather than any of the other mechanisms available. I have used it for many years and it has served me well, so it took a little time to work out what the benefit is – why do I pay money when there are other options “out of the box”?

Continue reading

I backed the Pebble watch on the second day, so I got my shipped Pebble fairly early in the delivery process. I was asked by a friend recently how I was getting on with it, so I emailed a response, and he said “I wasn’t expecting a blog post”, but why not post it anyway?

Overall the Pebble is exactly what I thought it would be, and done very well. There was a lot of talk about the iWatch type stuff and how Apple would do one with a touch interface and apps and concepts on how you would select them. But that misses the point in my opinion – what you want is an interface you don’t have to look at. One night I went to bed in a hotel room and wore the Pebble. I was able to listen to a podcast and to turn it off when I was about to go to sleep without having to look at anything – I can feel the buttons to know which one to use, and the order. In the middle of the night, I could check the time by shaking the watch and using the big number style so my blurry eyes without glasses could still make it out. Podcast control is great, and handy to pause from across the room when the kids come in making noise, to rewind a bit after, or to skip adverts. You cannot do those when your watch needs you to do fancy touch gestures.

Continue reading

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