Tuesday, October 30, 2018

Losing an old friend, gaining a new one

Today my mobile computer for work will be replaced. I thought that I had written about receiving it several years ago, but I only noted its predecessor from slightly over five years ago. There were several problems with the Dell that I received then, mainly that there were almost no sockets. I had the computer replaced with a Toshiba Portege Z30T-A which I have liked very much.

True, I've had problems with the jittery mouse, and the network adapter socket sometimes causes problems, but this computer fits neatly into my backpack, it has plenty of memory and has a very fast disk. So what happened?

Last week (Monday), I travelled to Karmiel on the train. I used the computer for about fifteen minutes at the beginning of the journey with power supplied by the battery. After I had been working at Karmiel for a few hours, I noticed that the battery was empty, even though the computer was connected to the mains. In other words, it should have been charged to full and stayed that way. I disconnected the mains, and as expected, the computer turned itself off. I called our technical support (normally they call me about Priority problems); the technician wanted me to remove the battery from the computer, but this computer doesn't allow easy access to its gizzards, so we had to leave things as they were.

The next day, I looked at the computer again: still the battery was empty despite being connected to the mains. Technical support said that they were ordering me a new computer. On Wednesday out of habit, I took out the mobile computer in order to connect to one of the companies for whom I consult - and lo and behold! The battery started charging. I informed technical support, but they said that the new computer had already been ordered, and anyway this computer is 'old' - after five years!

As it happens, I worked early this morning for about an hour with the battery with absolutely no problems. But progress is progress, and so in a few hours time I will be receiving a new computer. Then will start the awkward process of transferring as much as possible; I keep very few data files on this computer so that won't be a problem, but it's the programs (and their associated definitions) that I'm worried about.

---- to be continued on the new computer ---

So here I am on my new Dell Vostro computer, running Windows 10. I spent some time yesterday getting the computer set up the way that I want it. Earlier this morning I imported all my bookmarks along with VPN settings, so almost everything is ready. I had to look up my gmail password; I haven't yet got access to my home router (!) and there are AnyDesk settings to be imported (?) or reset. Otherwise ....

Friday, October 26, 2018

First rain

The weather forecasts have been predicting a rainstorm which is due to hit on Thursday morning and evening, then lightening up. In reality, Thursday morning was overcast, but by lunchtime the clouds had disappeared and it was quite hot. I went to bed early as I have had a very tough week and my eyes were hurting.

At about 10:30pm, I was wakened by a very strange sound, as if someone was moving wooden tiles around on the small balcony outside our bedroom window. Then the rain started. The balcony has a roof consisting of bamboo and plastic which does not let the rain through - but makes a sound when rain falls on it. And what a sound!

I have on my mobile phone an application which I originally loaded in order to measure how much noise a worker makes, close to my cubicle. He is a big man with a loud voice who speaks Russian, which I find extremely distracting. Normally his voice is in the 45-55dB range, but it has passed the 60dB mark and maybe hit 70bB.

The noise from the rain last night reached 70dB, which the application describes as 'busy traffic, vacuum cleaner', so of course it was impossible to sleep at this stage. After at least an hour, the rain eventually weakened, making it was possible to sleep again.

There were puddles everywhere this morning, but clear skies. The sun is shining now and probably causing all the water to evaporate, so by this afternoon there will be few signs of the heavy rain. I haven't seen yet the report of how much rain there was*. In Israel, we don't have the various types of rain that Britain does - drizzle, a polite rain, medium rain or heavy rain. We just have heavy rain, which isn't too good for the ground, as it quickly becomes saturated with water and can't absorb any more. This means that a fair amount of last night's rain will find its way to the sea without being absorbed into the soil. A shame.

* About 36mm, which is about 5% of the annual rainfall.

Thursday, October 18, 2018

Conditional choose-field trigger (2)

Almost exactly one year ago, I wrote a convoluted blog entry about choose-field triggers in Priority. It might be that I was wasting my time as there is a documented solution for what I was trying to achieve. From chapter 5 of the Priority SDK:

You can also write a specific CHOOSE-FIELD or SEARCH-FIELD for the procedure. Your trigger can contain references to any input value specified by the user within the same [emphasis mine] procedure step. For instance, if the procedure step contains an input parameter called CST, its value will be stored in the :PROGPAR.CST variable. This is useful, for example, if a given procedure step contains an input column for a Sales Rep and another input column for a Customer, and you want the Choose list for the latter column to display only those customers that are associated with the specified sales rep.

I emphasize the word 'same'. Looking again at the code which I presented in the blog from last year, the 'input value specified by the user' comes from a previous step in the procedure and not the same step. 

Friday, October 05, 2018

Geoff Emerick, 1945-2018

I have just learned that Geoff Emerick, who was the recording engineer for the Beatles from 'Revolver' onwards died a few days ago aged 72 from a heart attack.

His book, "Here, there and everywhere", should be compulsory reading for all Beatles fans and also for all people interested in how records were made in the analog days. It should be noted that this book is controversial "for its allegedly unfavourable portrayal of Harrison,bias towards McCartney, and belittling and dismissal of Harrison and Starr's contributions" as well as "the most negative depiction of Martin as a record producer" (quotes from Geoff's wiki page).

Wednesday, October 03, 2018

Knocking my head against a brick wall

I wrote at the beginning of September that Embarcadero has decided to make the current version of Delphi (10.2) free to freelance developers, startups, students and non-profits. After playing with it for some time, I discovered that it does not come with the components which I used for connecting to the Firebird database server, meaning that I would have to translate all the code which I currently have into new code. This is the same as I did several years ago when I transferred old BDE code to Firebird. I don't have the time to do this now, and there is no guarantee that my copy of 10.2 Delphi will work after September 2019.

I also wrote that writing a translator from Excel's newish XLSX format to tab delimited seemed possible with the new Delphi. This took about an hour as I had to figure out new components. I tried the program out and it seemed to work fine.

But there were problems every time that I ran the converter on real files at work. The program is command line driven, so that it can be called from Priority. I could see that the program was being invoked but nothing was happening. After spending no small amount of time on this (and figuratively knocking my head against a brick wall), I decided to write a manually driven program to convert input files, thus allowing me to concentrate on writing whatever code was needed in Priority.

But the fact that my program worked once but not afterwards continued to niggle me so I decided to spend some time debugging with a clean head. First I wrote a very simple 'Hello world' program to verify that Priority was invoking my program. Then I expanded the program to print its parameters. This is where the penny dropped. Assuming that I had a command line like 'x:\1\soul and pepper.xlsx', the default command line parser in the Delphi program saw that there were three parameters: 'x:\1\soul', 'and' and 'pepper.xlsx'! As my program checks to see whether exists a file which matches the first parameter ('x:\1\soul'), it is not surprising that the program did not continue - although the error logging should have displayed that the file does not exist.

OK, where to go from here? My first thought was that I should correct my Delphi program, but this was going to be problematic as there are supposed to be three parameters to the program (the input file, the output file and flags). Handling these parameters when the input file could in itself produce several parameters seemed problematic.

My next thought was to enclose the input file name with quotation marks - "x:\1\soul and pepper.xlsx". The Delphi program should see this as one file, but I couldn't get Priority to do this (string operations are problematic in Priority). I then wrote some complicated and ultimately stupid code to convert spaces in the filename to underscores - this gave me 'x:\1\soul_and_pepper.xlsx', which worked. Priority has a way of copying files which ignores the space problem, so I copied the original file to the new file and called my converter with this new name.

Then I had the proper insight: copy the original file - whatever its name - to a new file whose name I control (no spaces!), then convert the new file. Simplicity. Now my converter program works properly!