Saturday, December 21, 2024

More CPAP

Today's the shortest day of the year in the Northern Hemisphere. From tomorrow the days will start getting longer which is just as well.

We were woken at about 3 am by alarms being sounded by neighbouring settlements (but not ours). A ballistic missile had been fired by the Houthis and landed somewhere in south Tel Aviv. Quite why the alarms were sounding in our area is a mystery as that landing site is nowhere near us. Maybe there was the fear that debris from the missile could land in a wide area. As our bedroom is also the security room, we didn't have to get up and run for cover elsewhere.

Saturday morning is the time when I extract the data card from my CPAP machine and look at the data from the past week. Since receiving a new mask1 at the beginning of November, the average number of apneic events has dropped dramatically: over the past week, six days had no apneic events, and the seventh day had only one event (per hour). Not only that, the 'deep sleep' count for every night last week didn't drop below 46 minutes (apart from last night, when it was 'only' 25 minutes: maybe being woken suddenly in the middle of the night affected this). On Thursday night, I remember having many dreams, and the deep sleep value for that night was 82 minutes, so maybe there is some correlation between deep sleep and dreams.

Internal links
[1] 1853



This day in history:

Blog #Date TitleTags
31821/12/2010The gumption trapComputer, Psychology, Problem solving
43721/12/2011The sense of an endingLiterature

Thursday, December 19, 2024

Saving album art to mp3 files with VLC

I use the VLC player to listen to the multitude of mp3 (along with flac and wav) files that I have on my computer. I've often noticed that an image appears in the player that seems to be connected to the file that is currently playing. Sometimes it is the correct picture, sometimes the picture belongs to some other track by the same artist, sometimes there is no connection between the picture and the song and sometimes there is no image.

This irks me sufficiently that I had to learn how to attach the correct file to the file. It transpires that the instructions that I read were 90% correct, or rather, they were correct as far as they went but they missed the final step.

In order to add a picture to the file that is being played, one goes to the Tools option on the menu bar, then chooses Media Information from the menu that appears. A dialog is displayed with four tabs, but one only needs the first tab, 'General'. At the bottom right of this dialog appears the file's image (probably the default picture). Right clicking on this will bring up a 'choose file' dialog from which one can choose the image. But this image is not saved and there seems to be no way of saving the data!

I discovered today that one has to enter some new data in one of the fields on the left (I chose 'encoded by') - once there is a new value then a 'save metadata' button appears. Pressing this will of course save the image to the file.

Strangely, the 'encoded by' value seems not to be saved, even though it appears in the picture to the left. If I reopen this dialog, the picture will be displayed but the 'encoded by' value will not. 

As the screen shots show, I am listening to The Unthanks' newest disc, "In winter". This is actually a double cd, made up of wintry and Christmassy songs. At the moment, "Gower Wassail" is playing - this bears almost no resemblance to the version by Steeleye Span from way back in 1971 (and which I used to sing). There is a version of 'Come all ye faithful' played in 68 time, making it both familiar and unfamiliar at the same time. I remember being an 11 year old chorister and belting this out at school. The final verse had a counter-melody sung by the sopranos (of which I was one) that I didn't know at first but quickly learnt. The Unthanks don't sing this harmony line. I should point out that I quite enjoyed singing carols but I never sang the word 'Christ', as this means 'messiah', and as my religious friends would inform me, the Messiah has yet to come.

Obtaining this album was quite difficult; being on their mailing list, I was informed over a month ago of its impending release. When I tried to order it from their site, although there was an option to have it sent to Israel, their carrier lacked the capability to send it. After a few emails back and forward (including one signed by Rachel - could this be Rachel Unthank?), they finally got their act together, allowing me to order the disc (the postage costs more than the disc). Unfortunately, it is currently out of stock, so I don't know when I'll get my physical copy. But they give links that enabled me (and all other purchasers) to download mp3 files, so I can listen to the album and won't have to bother about ripping the discs when they eventually come.

I note that I haven't written about the Unthanks for the past 13 years, but I do listen on and off to their music and thoroughly enjoy their early albums. That said, some of their material, such as the Molly Drake album, doesn't particularly enthuse me.



This day in history:

Blog #
Date
TitleTags
66119/12/2013
Some anomalies in "Lord Valentine's Castle"Robert Silverberg
99319/12/2016
The best of our spiesLiterature, MI5

Wednesday, December 18, 2024

Jasmine Myra in Zurich

Another concert performance of Jasmine Myra has popped up, although this is not available in its entirety (at least, not at the moment) on YouTube. I followed the link to a Swiss site that allowed me to watch only 10 minutes of the concert that lasts 100 minutes in total. By the help of Google Translate, I was able to figure out that I needed to buy a one-time subscription for CHF 6.90 in order to watch the entire stream (whilst recording it by means of a program called SoundTap).

The concert was held on 25 October 2024 in Zurich; Jasmine states at the beginning that this is the second night of their European tour and that the previous night they had played in Warsaw. This is not the same tour as when they appeared in Portugal1 on 14 July 2024, and indeed the band is different. This time around, all the familiar faces appear: Jasmine Myra  (alto saxophone, of course), Arran Kent (bass clarinet and flute), Ben Haskins (guitar), Jasper Green (grand piano), Alice Roberts (harp), Sam Quintana (bass) and George Hall (drums). For a change, Jasper plays a real piano instead of his regular Nord 3 keyboard.

The tunes are, of course, familiar, but also give the band a chance to stretch out; as an example, we get a double bass solo around the 28 minute mark. The sound is much better than that of the Portugal concert which presumably was recorded by someone of a mobile phone. The introductions are also longer (e.g. "Words left unspoken" (WLU)). I wonder how the band feel about some of these revealing and intimate explanations.

The keen ear will pick up what appear to be string-like sounds in the background of WLU; these can only originate from Ben Haskins, who doesn't always play as a traditional guitarist but as a creator of ambient sounds. I would love to know what pedals he uses in order to achieve those sounds. These are more audible in the sparser pieces such as WLU.

Around the 54 minute mark, Jasmine introduces a new piece that does not as yet have a name. She mentions being influenced by Kenny Wheeler. This is so new that one can see Jasper Green reading his part from manuscript paper; I single him out solely because he is more visible. This piece is different in style from most of Jasmine's pieces, not being mood music or with a relatively simple melody line. This one moves around through various keys, always maintaining interest. Although the drummer is playing, it's mainly brushes on snare and is barely audible.

Oh dear: at 79 minutes, Jasmine talks about "the genocide in Palestine" and raising money "for those who need our help". This raises the awkward question of whether one's appreciation of an artist's talent should take into account the artist's personal behaviour and beliefs. I've edited out this minute of speech from my recording; it's bad enough that I had to hear it once but I don't want to hear it every time I play the recording.

I thought that they weren't going to play my favourite tune, "Knowingness", but it is played as the encore. This time it really catches fire at around the 98 minute mark.



Another interesting video of Jasmine appeared on YouTube: this time, it's a scaled down version of the band playing and being recorded direct to vinyl! Along with Jasmine are Arran Kent, Jasper Green and an unidentified drummer. The photo shows how tall Jasper Green is: normally he's sitting down so I've never noticed before. Having only four instruments playing means that the sound is thinner, but also allows the individual parts to be more clearly heard. Jasper is playing both his parts and some of the bass and harp parts. It's an interesting 'alternative mix' of "Rising".

Internal links
[1] 1845



This day in history:

Blog #Date TitleTags
15218/12/2008Bits and piecesWeather
43618/12/2011Watching the weight / 3Diet
66018/12/2013DCI Banks mistakesDCI Banks, Peter Robinson
99218/12/2016Robbie Robertson - TestimonyThe Band
144818/12/2021A fruitful day, part one: "Building the life" (new song)Song writing, Janis Ian
144918/12/2021A fruitful day, part two: a conversation with my doctoral supervisorDBA
145018/12/2021A fruitful day, part three: continuing work on PrioXRefProgramming, Personal
145118/12/2021Further thoughts on running Excel from a background threadProgramming, Delphi, Office automation, Threads
169418/12/2023Nutrition examsNutrition

Tuesday, December 17, 2024

Saving a form's image as jpg file

Yesterday, when writing about a new feature in the Blog Manager program, I wrote1 "I thought that it would be helpful if I could save the graph as an image". I found some old tech tips that helped me write the code; some of this was very low level with reference to device contexts and similar.

Still reading "Smarter than you think"2, where Clive ponders AI and Jeopardy, I got the idea of asking AI program co-pilot to write a program in Delphi to save a form's image as jpg. Well, it did, and the procedure is remarkably similar to what I pieced together, although without all the low level device contexts.

procedure TForm1.SaveFormAsJPG(const FileName: string); var Bitmap: TBitmap; JpegImage: TJpegImage; begin Bitmap:= TBitmap.Create; JpegImage:= TJpegImage.Create; try // Capture the form's image Bitmap.Width:= Self.ClientWidth; Bitmap.Height:= Self.ClientHeight; Self.PaintTo (Bitmap.Canvas.Handle, 0, 0); // Convert the bitmap to JPG JpegImage.Assign(Bitmap); // Save the JPG to a file JpegImage.SaveToFile(FileName); finally Bitmap.Free; JpegImage.Free; end; end;

I don't want the entire form to be saved, only the graph, so it may be that the critical PaintTo procedure will not be available for a TChart that is apparently based on TPanel. I'll have to check this*. As far as I can see, the PaintTo procedure hides all the device context code.

* Indeed, CoPilot's code works, even when 'self' is replaced by 'chart1'. Well done!

Internal links
[1] 1874
[2] 1873



This day in history:

Blog #
Date
TitleTags
2117/12/2005
The Brief and The BookTV series, Van der Graaf Generator
78617/12/2014
Seasonal greetingsJewish holidays
156717/12/2022
Doctoral thesis extension grantedDBA

Monday, December 16, 2024

Latest additions to the blog manager program

As we're almost at the end of another (not particularly good) year, my thoughts have been turning to an end-of-the-year blog. Apart from remembering this year, I thought that it would be nice if I could show how my blogging habits have changed over the years (I've been at this for over 19 years).

A few months ago, I wrote a 'blogs by month' query, so I copied this to a 'blogs by year' and in doing so simplified a few matters. When I had the graph displayed, I thought that it would be helpful if I could save the graph as an image. The graph has a built-in method for printing, but this isn't what I want.

I combined two snippets of code - one for creating the bitmap of the chart, and one for converting the bitmap to jpg - and now I have the ability to save any graph displayed as a jpg. The filename will be the caption of the form, e.g. Blogs per month between 01/01/2024 and 31/12/2024.jpg, but the forward slashes in the dates create a problem. I used the stringreplace function in Delphi to convert them to dashes.



This day in history:

Blog #
Date
TitleTags
15116/12/2008
Firebird/2Firebird
78516/12/2014
A feral system under my noseERP, DBA, Excel

Sunday, December 15, 2024

Smarter Than You Think: How Technology is changing our minds for the better

I am currently reading this book, written by Clive Thompson (who also wrote 'Coders' that I wrote about a month ago1). I've only got as far as the second chapter and already I have something to write about. The topic is memory and how computers act as auxiliary memories; Thompson is writing about people who document everything (automatically, using cameras and similar devices) but notes that the problem is not finding something in that memory but rather remembering that there is something to find.

I started thinking about how this blog serves as my auxiliary memory and immediately hit the problem: I was sure that I'd written about a previous book by Clive Thompson, but I was equally sure that I hadn't created a tag for his name. Fortunately I was able to locate the blog entry under the tag 'non-fiction books, and now I have added a tag for Clive so that I will be able to find his books more easily.

I want to quote the following: Wegener thought it would be fun to do the same thing with check-ins—show people what they’d been doing on a day in their past. In one hectic weekend of programming, he created a service playfully called FoursquareAnd7YearsAgo. Each day, the service logged into your Foursquare account, found your check-ins from one year back (as well as any “shout” status statements you made), and e-mailed a summary to you. Users quickly found the daily e-mail would stimulate powerful, unexpected bouts of reminiscence.  

I'm already doing this in my blog manager program: the feature is called 'This day in history', a title that is very presumptuous. A better title would be 'This day in my blog history' or the very mundane 'Previous blog entries for this day'. I quickly found the blog entry2 where I announced this function, but sadly I didn't write why I was adding this. But that quoted paragraph does give the reason: I like to see what I was doing one, two or even fourteen years ago on this date.

I wonder what other gems await me in this book.

Internal links
[1] 1850
[2] 1543



This day in history:

Blog #
Date
TitleTags
11415/12/2007
Uncle no longerUncle
11515/12/2007
Sleep, part threeApnea, Migraine
43515/12/2011
Front end program for converting HTML to PDFProgramming, Delphi, ERP

Saturday, December 14, 2024

The family that plays together stays together

Eighteen and a half years ago, I bought1 for my son a Yamaha PSR-E 303 electric keyboard. I hate to admit it but for many years this keyboard has been idle and stored out of sight. For a while, it was resident in our 'music room' where I used to play it now and then, but after my father's death, it was replaced by my father's antique bureau and the keyboard was banished.

Granddaughter #1 started piano lessons about a month ago; she doesn't have any means of practicing in her home, and when she comes to us, she normally doesn't touch the piano, despite my encouragement (maybe I overwhelm her as I can easily play the simple tunes that she has been taught. We promised her that we would give her the electric keyboard so that she can play at home.

It was granddaughter #2's sixth birthday2 last week and granddaughter #1 wanted to play some tunes for her birthday. So yesterday evening, which is when we celebrated the birthday, we took the keyboard along with us and transferred ownership. Three generations of Newmen have now played on it!


 

Internal links
[1] 59
[2] 1189



This day in history:

Blog #
Date
TitleTags
15014/12/2008
FirebirdProgramming, Delphi, Firebird
78414/12/2014
Television detectivesTV series
128014/12/2019
Sour grapes (Song festival 2019)Kibbutz
136514/12/2020
John Le Carre (1931-2020)Obituary, John Le Carre
156614/12/2022
Another case study for the DBA - that can validate my modelDBA

Thursday, December 12, 2024

Corinne Allal, RIP

Israeli composer, singer and guitarist Corinne Allal died today from pancreatic cancer, aged 69.

She first crossed my radar in 1976 when she sang backup vocals in Arik Einstein's "Atur Mizchech". At the time she would have been a fresh veteran of some Army entertainment troupe which no doubt is where the connection would have been made.

She had a few successful records in the late 1980s-1990s but in my world she was more known as a composer, including the song "I don't have any other country", whose relevance has only grown in the past few years.

She announced a few years ago that she had breast cancer but overcame it. Last year she announced that she was suffering from pancreatic cancer; she appeared to have beaten it a few months ago, which is when she had a television interview and resumed her concert appearances, although she was forced to play sitting.

The radio is mainly playing her songs today.

Apart from her musical contributions to our lives, her illness is very important to my family, as my brother in law was diagnosed with pancreatic cancer seven months ago.

She is/was only 16 months older than me.



This day in history:

Blog #Date TitleTags
21912/12/2009Displaying tabs on the right of a TTabControlDelphi, Right-to-left
136412/12/2020How could I have known? (new song)Song writing, Home recording
144712/12/2021Darwin and Covid-19Covid-19
156412/12/2022CaffeineSleep, Non-fiction books

Wednesday, December 11, 2024

A mistake in a MIDI sequence has a positive outcome

I've been working on a new song for the past ten days. Although the tune and chords have been settled, the arrangement is about 70% finished at the moment. Each verse lasts 24 bars that can be subdivided into two loops of eight bars followed by two loops of four bars. The first five bars of the eight bar loop are in D myxolidian (D C Bm Am G) but then the tonality changes, possibly to D minor (F E A). I suspect that the four bar loop can be seen as in D minor, although this tonic chord does not appear in the sequence (Bb F Gm A). 

The bridge is definitely in D minor and is influenced by a recent video by David Bennett Piano, where he discusses songs containing three bar loops. I spent some time playing various such sequences on the guitar (the verse sequence was composed 'in my head') until I decided on Dm7, CMaj7 and Gm add 9.  Sometimes this last chord is replaced by BbMaj7 - they only differ by one note, G being replaced by F. This sequence is repeated seven times at the moment.

I imported the MIDI sequence into Reason yesterday where a huge surprise awaited me. When I played the sequence with a rough mix, every note was sustaining almost infinitely; this has never happened before. Changing the instruments around and reimporting didn't make any difference. Eventually I realised what had been causing this sustain: a MIDI controller message. As it happens, I had wanted to improve the sustain in the sound created by the MIDI sequencer (expecting that this would have no effect in Reason as R generally ignores MIDI messages) so I had added a controller #64 message (sustain pedal) at the beginning of every track. Once I removed these messages, I began to obtain the sound that I was expecting.

Normally I deal with sustain in Reason, but it's good to know that I can achieve this by adding a controller #64 message with a moderate value such as 10.

The song itself is fairly normal and restrained: a decent beginning for any new album that might appear in the future.



This day in history:

Blog #Date TitleTags
43411/12/201150 words for snow - Kate BushKate Bush
99111/12/2016Repairing the KindleKindle
109811/12/2017More on Delphi 7/Hebrew/Win 10Programming, Delphi, Unicode
144611/12/2021Mike Nesmith, RIPObituary
156311/12/2022Could it be that it's over? A rant about current Israeli politics.Israel, 1984, Yehonatan Geffen

Monday, December 09, 2024

A simple replacement filling for a tooth

I am recording all of the below for history's sake in case something similar occurs in the future.

Yesterday I was called into the dental clinic to undergo a replacement filling in the left-most tooth of my upper jaw. The appointment was supposed to be for next week but it seems that the clinic had room to fill so they called me with 45 minutes notice. I was just about to eat lunch, so I ate very quickly before walking down to the clinic.

Through the dentist's point of view, the treatment was simple and successful. From my POV, it was anything but. During the drilling phase, when the old filling was removed, I started having difficulty in breathing - it was as if I could only breath half of the capacity that I wanted. During this stage we had to stop for a few minutes to enable me to restore my breathing. The dentist said that the anesthetic would affect my left nostril as well as the jaw so this might explain my feeling.

Later on, during the stage in which the filling is inserted into the cavity, my arms and stomach felt as if they were on fire, or at least very hot. This was uncomfortable but bearable. 

When the treatment finished, I discovered that I was extremely weak and could hardly get out of the dental chair. It seems as if the dentist didn't have any clients after me, so I was allowed to lie there for a while. Eventually I got up, only to get as far as the reception area which is where I sank into a chair. The dentist came to talk to me: no doubt passing the time for her, but also allowing her to monitor my progress. 

I told her that this reminded me of the time 40 years ago when I had a wisdom tooth removed and had to return to the dental clinic (in a town, not on my kibbutz) to have the cavity washed with hydrogen peroxide. Presumably as a result of this treatment, I suffered from low blood pressure for a few years.

Eventually my daughter came to pick me up and take me home in her car. Once at home, I laid down for about half an hour before I felt that I had any strength to do anything. I measured my blood pressure, which was at its regular levels. Eventually I went to bed just before 6 pm.

This morning I feel almost normal.



This day in history:

Blog #Date TitleTags
11309/12/2007UncleUncle
21809/12/2009After the accounting examMBA
52509/12/2012Guitar standGuitars
65909/12/2013Gymnopedie Number 3?Woody Allen, Satie
90709/12/2015Margin call and redundancyFilms, Business novel
98909/12/2016Greg Lake, RIPObituary, King Crimson
109709/12/2017Delphi 7/Hebrew programs running on Windows 10Programming, Delphi, Unicode
156209/12/2022Yitzchak Klepter, 1950-2022Israel, Obituary
169309/12/2023Days of ChanukaKibbutz, Home movies

Sunday, December 01, 2024

Armand Gamache - a new (to me) detective series

During the last week, I've been reading novels in the Chief Inspector Armand Gamache series, written by Louise Penny. As opposed to the detective novels that I normally read (set in Britain), this series is set in a village ('Three Pines') in the Quebecois hinterland of Canada, and so the landscape is normally one of snow and very low temperatures.

I've only read one complete novel (the first, "Still life") but I've nearly finished the second ("A fatal grace"). I haven't been too impressed with the technical side of the investigations - whilst there are fingerprints, there are no DNA analyses that seem to make modern investigations so much easier. Instead the eponymous detective listens to crime scenes, and there seems to be a great deal of philosophy bandied about. The resolutions seem to be somewhat evidence-free and I wonder how court cases would be built from these investigations.

There is also a sense of humour present, of the sort that speaks to me. For example, in chapter 17 of "A fatal grace", the following exchange appears: ‘Let every man shovel out his own snow, and the whole city will be passable,’ said Gamache. Seeing Beauvoir’s puzzled expression he added, ‘Emerson.’ ‘Lake and Palmer?’ ‘Ralph and Waldo.’ ... Emerson, Ralph and Waldo? What was that? thought Beauvoir. Some obscure hippy group from the ’60s probably. The lyrics didn’t even make sense. While Beauvoir hummed ‘Lucky Man,’ Gamache downloaded his messages....

I actually know who R.W. Emerson was, as the famous "Nightfall" story by Isaac Asimov begins with a quote from Emerson. "A fatal grace" also has some quotes from Leonard Cohen, son of Montreal.

In a later book that I read partially (I decided that it would be better to read them in order), there is a great deal of reference to monkeys. One character briefly mentions being a daydream believer, someone else mentions Davy Jones, and further on, Peter Tork is referenced. I wonder whether the modern audience understands these jokes. Authoress Penny is a few years younger than me, so at least we have the same vintage.

If I'm mentioning that 'it would be better to read the books in order', then I have to mention the Kobo. This managed at one stage to display the series metadata of the books (e.g. Chief Inspector Armand Gamache, book 2), but I've not been able to restore this display. The metadata definitely appears in Calibre. 

After playing around a little, I've figured out how to get this text displayed: first of all, I have to have Calibre open when the Kobo is connected to the computer, so that Calibre can 'see' the Kobo. This will cause a new 'Devices' option to appear, allowing Calibre to synchronise with the Kobo. There's an option "update metadata" (or something similar) - clicking on this causes the Kobo to add books to collections and to display the series metadata. This means that I might have to keep books for longer in the Calibre library.

This metadata continues to appear, even if I change the 'sort' setting, but then the books won't be displayed in 'series' order. At the moment, sorting by series seems to be best; I can see which books I have read (or not) by the finished/86% read/unread indicator.



This day in history:

Blog #
Date
TitleTags
11101/12/2007
SleepApnea, Anaemia
65401/12/2013
Critical weekDBA
77901/12/2014
My army service - part oneIsrael, Personal
136101/12/2020
E-hour minus 4DBA
136201/12/2020
Viva resultDBA
144401/12/2021
My body is like a barometerWeather
155801/12/2022
Christine McVie, RIPObituary, Fleetwood Mac
169101/12/2023
Restringing the Stagg - againGuitars

Friday, November 29, 2024

Goodbye F25

At the beginning of the month, I wrote1 about the F25 Cell phone stand with wireless speaker, noting that whilst I could hear the person on the other end of the call clearly, they couldn't hear me. After a few days of frustrating use, I stopped using the device.

An Internet search found a device that seems to provide a solution closer to what I want: the SYNC 20 (M) USB-A, but that website frustratingly does not provide prices. I suspect that this device costs much more than what I am prepared to pay.

Yesterday, I happened to be in the local shopping mall, so I went into a store that sells mobile phones and accessories. I asked them whether they had the sort of device that I was looking for; they didn't but suggested a few options.

And then the penny dropped: the devices that they were offering provided sound from the bluetooth speaker, but one had to speak into the phone as this is where the microphone is. I very strongly suspect that this is the same as the F25: one hears through the device's speaker, but the microphone is the phone's. Thus if I keep the phone in my pocket, it's not surprising that I wouldn't be heard on the other end. This means that if I want to be heard, I will have to keep the phone in the stand - which is not what I want to do.

After leaving the store, the cheap and cheerful solution occurred to me: when I sit down to work, I will take the phone out of my pocket and leave it on my desk. Should someone call me, I will use the speakerphone function on the phone. This may not be exactly what I'm looking for, but it's good enough.

In the mean time, I'm offering the F25 for adoption.

Internal links
[1] 1855



This day in history:

Blog #Date TitleTags
52229/11/2012Uncle once more!Blood pressure, Uncle, Acupuncture
98729/11/2016End of November/TV seriesTV series, Cold feet
127729/11/2019A 'new' DVD recorderDVD
136029/11/2020New favourite drinkPersonal

Tuesday, November 26, 2024

Delphi logging

In my Delphi programs, I often have the need (or desire) to write data to a logfile which is a simple text file. I've always used the following code that is based on "old style Pascal I/O".

procedure TMainForm.Write2Log (const s: string); var f: textfile; begin assignfile (f, logfilename); if fileexists (logfilename) then append (f) else rewrite (f); writeln (f, datetimetostr (now), ' ', s); flush (f); closefile (f); end;

For reasons that I have never been able to establish, this sort of code is frowned upon by some Delphi developers. I have eventually got around to converting the procedure to regular Delphi code.

procedure TMainForm.Write2Log (const s: string); // the Delphi way var outstring: string; fs: TStream; begin if not fileexists (logfilename) then fs:= TFileStream.Create (logfilename, fmCreate OR fmShareDenyNone) else begin fs:= TFileStream.Create (logfilename, fmOpenWrite OR fmShareDenyNone); fs.Position:= fs.Size end; try outstring:= datetimetostr (now) + #9 + s + #13#10; fs.WriteBuffer (outstring[1], length (outstring)) finally fs.Free end end;

To me, this seems unnecessarily low level - adding the tab, carriage return and line feed to the string and passing the length of the string to be output. There is also a small bug in that code - in unicode days, length (outstring) is not equal to the number of bytes to be output. But I'm writing non-unicode programs, so I'll get by. 

I wondered whether it's possible to create the stream on program startup - thus there will be no need to destroy the steam each time. Of course, the end of the file has to be 'seeked' (or in English, sought). Although this works, no other program is able to open the log, somewhat negating the whole idea of a logfile.

As it happens, variations of my old-style code can be found on the Internet, for example here, although it should be pointed out that the linked article is from 2005. Various techniques are shown, but as all I want/need to do is append a line at the end of the file, reading the file (e.g. stringlist.loadfromfile) then adding the line and writing it back to disk (stringlist.savetofile) seems like overkill, especially if the file has many lines.

Incidentally, an alternative version uses Pointer (outstring)^ instead of str[1]; although the result is the same, some consider that using the typecast to pointer makes it more clear what the expression is (the first character in the string). I'm not so sure.



This day in history:

Blog #
Date
TitleTags
144326/11/2021
Opening Excel from a thread and displaying a fileProgramming, Delphi, Office automation, Threads
169026/11/2023
Guitar thoughtsGuitars

Monday, November 25, 2024

Counting beats with Matthew Halsall

For the last few days, I've been listening again to the Matthew Halsall playlist: I definitely prefer his earlier, sparser, recordings to his most current album, 'An ever changing view1'. So I'm sitting at my desk, playing 'table percussion', when I notice that a piece from the album 'When the world was one' is in 74 time. Whilst the track list given at Bandcamp  for the album is 60 minutes long, the mp3 at YouTube that I have plays for 81 minutes, thus enabling me to ascertain that I am referring to the track 'Tribute to Alice Coltrane'. The youtube video adds as a bonus an alternate take of the piece at the end of the album, so more beats in 74. And now that I'm paying attention, the track that follows (presumably 'Jura', also a bonus track) is in 54 time. And to think that I considered that most of his pieces are in 3! The album "Into forever" starts with a few songs in common time - but then these songs are sung, as opposed to everything else in the Halsall oeuvre.

I think that this piece is the one to which I was referring when I wrote in the blog referred to above "here and there are lines that I might have played myself". Obviously at the time I was listening to the melody and not so much to the rhythm.

I've been trying to explain to my wife about time signatures, but not only does she appear not to understand, she also thinks that I'm weird when I walk around the house counting 1-2-3-4-5 or 1-2-3-4-5-6, etc. Thus when she sees Elizabeth Zharoff2 doing the same, or even better, a video that I saw the other day, she understands that the counting is some obscure musical ritual.

Internal links
[1] 1658
[2] 1804



This day in history:

Blog #
Date
TitleTags
6125/11/2006
LoveBeatles
11025/11/2007
MIDI keyboard funMIDI
31225/11/2010
Algorithm for quickly drawing activity networksMBA, Project management
43125/11/2011
Crisis averted: no need for oral surgeryTeeth
77825/11/2014
Meeting with a colleagueDBA

Saturday, November 23, 2024

Management email problems

One of the users of my Management 'ERP' program has suddenly become unable to send emails via the program. As all the necessary definitions are contained within the database, it's not a problem of a wrong definition. An attempt to debug using a simple program that I wrote once that sends a standard email via Gmail and outputs all the status messages failed to send the email, but it's not clear (at least, to me) what the problem is. "Something to do with the user's computer" was my lame explanation; as it happens, the same non-result happens when I run that test program on my mobile computer, but this didn't lead to any further insights.

When discussing this problem with the OP yesterday, I had the idea that maybe instead of calling the 'send mail' function in the Management program, the email would be sent via a separate, auxiliary, program, in a similar fashion to the auxiliary program that I discussed1 a month ago.

So yesterday afternoon, I spent a few hours working on this. There were two major problems: the program should have to wait for the thread that sends the email to finish before closing itself, and that on my computer, the program is located at c:\program files\...... As a filename had to be passed to the auxiliary program, it made sense to write a console application (as is the previous auxiliary program) and get the filename via the use of the paramstr function. But the space in 'program files' causes paramstr to malfunction, producing two strings that have to be concatenated in order to get the filename.

Eventually this sort of worked but I wasn't very happy about it. Sometime during the night, I realised that I could use the 'OnTerminate'2 event to establish when the thread finished, solving the first problem. But at about 5 am, a new idea struck me: instead of executing an auxiliary program, have a constantly running program (a 'daemon') poll a given directory and send from there any email files that may have been stored there. Of course, having had this idea, I had to examine it from various angles and consider the polling code, and as a result I couldn't get back to sleep.

Later on, I realised that the idea of an auxiliary program was doomed from the start: although the program might be stored on the server, it would be executed from the user's computer and the original problem would still occur. Having a program that constantly runs on the server would solve this problem.

Only a minor change - and in fact, a simplification - was required in the management program; basically if the user is defined as 'aux mail' then the file holding the email is saved in one directory, otherwise the file is saved in a different directory and the email sending thread is executed.

In the daemon, I got around the 'waiting for the thread' problem by the program never closing. It has a timer that wakes up once every five minutes; first it checks to see if there are any files with the 'msx' extension in the mail directory - if there are, these files are deleted. Then the programs checks to see if there are any files with the 'msg' extension in the directory - these are the email files. If so, a loop runs over these files: the file is copied to a new file with the 'msx' extension, this filename is passed to the email thread and finally the msg file is deleted (so that it won't be found again).

After I finished working on this and checking that emails are indeed sent (and received), I had the idea that the management program should try to execute the mail program, and so the mail program had to have a semaphore that prevents it from being executed more than once. This is easy to add, as is the code to the management program to execute the mail program. Then I realised that the original problem is liable to occur again: the user runs the management program on her computer and so a new instance of the mail program will run on her computer - and probably won't be able to send email. So I removed the offending line from the management program; I'll have to remember to add the mail program to the startup list on the server. 

We'll see how well this works during the coming week.

Internal links
[1] 1840
[2] 1838



This day in history:

Blog #Date TitleTags
30923/11/2010The gravy boatCooking
31023/11/2010Copper socks 2Health, Copper
109323/11/2017Two more people have passed awayObituary

Tuesday, November 19, 2024

Vindicated!

I wrote1 just over one year ago About once a month, the 'Unhalfbricking' version of 'Who knows where the time goes?' gets played on the radio, but recently it seems to be played once every few days. My wife has become extremely enamoured of the song (finally, after 43 years of marriage) and asked me to add it to her telephone playlist. She then asked if there were any other songs that she might like - I could think of at least one hundred - and so I sent her "I'll keep it with mine".

It occurs to me now that IKIWM has several similarities to WKWTTG in terms of harmony  - although in fact it should be written the other way around, as IKIWM was written in 1964 by Bob Dylan and WKWTTG was written in 1968 by Sandy Denny. Both start off with a chord stream that can be seen as I ii iii ii; after that the chords used by the songs differ but their gross structure is quite similar. The Dylan song is unusual (for Dylan) in its use of the bVI chord (every time I hear the Hollies' "He ain't heavy", my mind always plays the piano riff from the Dylan song - played by Denny - when the Hollies' song also reached the bVI song) whereas Sandy's has the unusual iv chord - A minor - that is especially striking when it comes after the iii chord, G#m. Not only that, iv is the relative minor of bVI - if both of the songs were in the key of E major, then one song has Am and the other has C; almost the same notes.

There are further, formal, correspondences: both songs have three verses, neither song has a chorus, and both feature each song's title as the last line of every verse. Dylan does this frequently whereas Denny does it less often.

The arrangements also are similar with Richard Thompson playing guitar obbligatos. There is a world of difference between the original Strawbs' version (Sandy solo) and the Fairport version, and today I wonder how much the arrangement of WKWTTG was inspired - if at all - by what they did with the Dylan song.

Could I renew my old channel of communication with Simon Nicol in order to check my hypothesis? Probably not as I strongly suspect that the email address that I have for him has not been current for at least a decade.

My wife also recognises Nick Drake on the radio; he too gets played once every few days, primarily "Northern Sky".

Internal links
[1] 1685



This day in history:

Blog #Date TitleTags
64919/11/2013What's in a name?Israel, Personal
90419/11/2015Even dogs in the wildIan Rankin
118619/11/2018E dorianSong writing, Music theory
127419/11/2019The luxury of digital recordingMIDI, Kibbutz, Song writing
144119/11/2021Tables in Word documents opened in a threadProgramming, Delphi, Office automation, Threads
155319/11/2022DBA updateDBA
168819/11/2023Network upgrades and printer problemsComputer

Monday, November 18, 2024

Shel Talmy, Peter Sinfield RIP

Shel Talmy was a legendary producer from the 1960s who worked in Britain, despite his being American. His initial and major clients were the Kinks and the Who although he worked with many other acts. He even produced an early mix1 of VdGG's "The least we can do". This morning, the Guardian announced his passing.

From YouTube, I learned earlier this morning of the passing of Peter Sinfield, who was one of the initial members of King Crimson. Sinfield wrote the lyrics for their first four albums; I find some of them brilliant, others are unnecessarily obtuse and there are those that are irrelevant.

Both these people have my respect, but they are very peripheral to my listening habits. 

Internal links
[1] 655



This day in history:

Blog #Date TitleTags
14518/11/2008Lonely at the topMIDI, Randy Newman
30518/11/2010How to save money when ordering books from abroadBook depository
30618/11/2010Alesis Q49MIDI, King Crimson, Antibes
52118/11/2012Warming up for DBA examDBA
77718/11/2014Enron's spreadsheetsDBA, Excel
155218/11/2022Fairport newsFairport Convention
168718/11/2023The musical group reconvenesMusical group

Sunday, November 17, 2024

More hours spent improving the blog manager program

Yesterday I spent several hours working on the blog manager program (BMP); this time can be divided into three sections: (a) adding functionality for which I had an idea before programming; (b) fixing the startup code once again; (c) improving something that occurred to me whilst I was working.

Way way back, just over two years ago, I wrote1 it occurred to me that I could make a useful extension, and allow my program to execute the Internet browser and display a given blog. So I added an 'address' field both to the 'entries' table and to the form that allows me to enter or edit an entry. In writing/copying that quote, I utilised the 'address' field in order to find the link to that blog - it's much faster to do so in the BMP that via the online blogger site. 

Since then, I've been adding the address to every blog that I've written, and in an informal way I've been adding addresses to older blogs. Again, because the online blogger site's interface doesn't make this easy, I would request to display a tag then iterate over all the blogs with that tag, adding addresses to those that lack them.

This was somewhat ad hoc, so yesterday I had the idea of first creating a list of all tags that have entries without addresses, sorted by descending count; double clicking on a line should bring up the actual entries for that tag that lack an address. Then I can iterate over these blogs and add their addresses.

At first I tried to use the existing ShowTags form, as this already has a certain amount of functionality built-in (or rather, I've already added this). But it seemed that I was fighting the existing code all the way, and that the advantages that would accrue from using the existing form were overshadowed by the overhead. So I decided to create a new and much simpler form (NoAddress) to show the tags that lack addresses.

For some currently unknown reason, I was not able to display this list sorted in descending order. After banging my head against the computer screen for a while, eventually I hit upon a solution that will technically sort in ascending order but will display in descending order.

select tags.id, tags.name, count (*), 200 - count (*) as final from tags inner join tag2entry on tag2entry.tag = tags.id inner join entries on entries.id = tag2entry.entry where entries.address is null group by 1, 2 order by 4, 2

This is a kludge but it works. Once I had this out of the way, I could write the query to collect all the entries that lack an address by a given tag in order to pass this to a new instance of the ShowEntries form. I also added the code to graph the top ten tags, should I be so inclined to see this.

Then it occurred to me that if I had added all the addresses lacking in the ShowEntries form, that form should somehow update the tags shown in the NoAddress form, reflecting that some entries now had addresses. At first I thought to do this by passing some form of parameter to ShowEntries, but this would change (not necessarily break) a certain amount of code. It would be much easier for the ShowEntries form when it was about to close to send a message to the main form that would look for child forms of type TNoAddress and tell them to refresh. This is more complicated to write in English than it is to program! I also added a 'secret' flag that will cause the entries to be shown in reverse order - this saves a key press. Displaying the entries in reverse order causes them to be in the same order as shown on the web site.

To my chagrin, I discovered that 90 of the 174 blogs tagged 'DBA' were lacking an address. So I toiled to add the addresses of all the blogs. This will also have reduced the number of entries lacking addresses for other tags, as there are the BMP informs me that 41 tags are paired with tag=DBA.

Having got all of that out of the way, I then discovered that once again2 the program would not work on my mobile computer. Instead of the usual error message that I had seen before, I was now getting a message that the database connection was missing (or similar). Eventually I realised that the code was blanking the location of the database file but was not providing a new location. The solution to this follows, moving code that was previously in the OpenDatabase procedure to BeforeConnect. A few hours later, it occurred to me that this code will prevent me from accessing the 'other' blog on my development machine and will also not set the 'fileprefix' variable, but this won't matter very much.

procedure TDm.OpenDatabase (index: word); begin dbnum:= index; datadir:= IncludeTrailingPathDelimiter (ExtractFileDir (application.exename)) + 'data\'; mutex:= TILMutex.Create (progname); end; procedure TDm.SQLConnection1BeforeConnect(Sender: TObject); var pname, dir: string; begin if not fileexists (dm.SQLConnection1.Params.values['database']) then begin case dbnum of 0: begin pname:= 'Perceptions'; fileprefix:= pname; end; 1: begin pname:= 'PPP'; fileprefix:= 'Programming pitfalls in Priority'; end; end; fileprefix:= fileprefix + ' '; with TRegIniFile.create (regpath) do begin dir:= ReadString ('firebird', pname, ''); free end; with sqlconnection1 do begin close; params.values['database']:= dir; loginprompt:= false; end; end; end;

I checked this code by running it on my mobile computer and trying to access the second database; this worked, but when I tried to run the 'show singleton query' (i.e. tags that have been used precisely once), I received a syntax error in the query. This was easily dealt with, and then I saw that in order to show the singleton entry, I was using code that had since been refactored into a procedure in the data module. So I replaced the duplicate code with a simple procedure call.

Now I can spend my idle time by adding addresses to entries - the next tag on the list is 'Holiday' with 53 entries. I imagine that I will kill two birds with one stone, as slightly further down the list is 'Italy' with 43 entries; I doubt that there are many - if any - old entries about Italy that are not connected to holidays.

Internal links
[1] 1538
[2] 1846



This day in history:

Blog #Date TitleTags
64817/11/2013TV series updateTV series, DCI Banks
127317/11/2019Song festival 2019Kibbutz, Song writing

Saturday, November 16, 2024

New CPAP mask (2)

After nine days with my new mask1, I'm getting more comfortable with it and learning how to connect all the straps in the dark. I try to keep the 'right cheek' strap connected all the time so that I only have to connect (or disconnect) the 'left cheek' strap. It's much harder to set the mask up if both straps are loose.

As expected, the data from the machine shows a great improvement from the final weeks of the old mask. There are no leaks at all, and most nights have either 0 or 1 apneic events per hour, meaning that my sleep get interrupted less and so I should feel more rested. 

One night, the 'deep sleep' count was 124 minutes which is about twice as high as it's ever been. I don't pay much attention to this measure as it seems to have no correlation whatsoever with my perceived quality of sleep, and I don't remember anything special about that night.

Internal links
[1] 1853



This day in history:

Blog #Date TitleTags
64716/11/2013Song festivalMIDI, Kibbutz, Song writing
135816/11/2020Vinyl log #32Vinyl log, Heron
168616/11/2023Counting beats with Van der Graaf Generator (4) - Whatever would Robert have said?Van der Graaf Generator

Thursday, November 14, 2024

Counting beats with Jasmine Myra

Continuing my occasional series of blogs1where I note the time signature used in pieces, it is time to look at the music of Jasmine Myra. In instrumental music, the use of 34 time is far more prevalent than it is in vocal music and so JM has pieces in 3, pieces in 4, and there's even one piece in both, though obviously not at the same time*. As I noted before, my favourite piece "Knowingness"2 begins in 34 time then moves to 44 for the second half.

Today her music was again playing in my headphones when suddenly I noticed that the piece "Words left unspoken" (written about not being able to part with her grandmother who died in hospital during the Covid-19 lockdown) is in 54 time - or at least, I think it is. It's very difficult to establish where the 'one' is, and without this, one can't determine the rhythm properly. Normally the advice given is to listen to the drums, and if that doesn't work, then listen to the bass, as one of these instruments will emphasize the first beat of each bar. In the studio recording of this piece, the string quartet's lines do not start on the one.

* Although this is possible - it's called a '3 against 4 polyrhythm'. I've done it in my songs a few times, but only for a few bars at a time, having six crotchet triplets in a bar of 44

Internal links
[1] 1686
[2] 1742



This day in history:

Blog #
Date
TitleTags
6014/11/2006
The BandRandy Newman, The Band
14314/11/2008
WokCooking
30314/11/2010
Sumptuous SundayCooking, Slow cooker
51814/11/2012
Inside the DOCU program (1)Programming, Delphi
77614/11/2014
Matching a computer language to the problems it needs to solveProgramming
135714/11/2020
Cold Feet, series 9TV series, Cold feet
144014/11/2021
Sleeping even more deeplyCPAP, Binaural beats, Sleep

Wednesday, November 13, 2024

Peripheral edema (2)

I wrote1 two months ago about peripheral edema: how my legs - especially the right one - swell. Since then, I've attended an appointment with a cardiologist who tended to discount the theory that one of my blood pressure medicines is causing the problem. As he said, medicines don't distinguish between left and right, and so there should be swelling in the left leg and foot.He sent me for an ultrasound scan of the veins in my legs; this showed nothing unusual. 

When I returned to my GP, I pointed out that the swelling is much reduced, implying that the weather is the primary cause and the bp medicine a secondary cause. She opted to do nothing for the time being, and to wait until the swelling becomes problematic, probably in another eight months time. The most important thing, she told me, is that my heart is fine. As I told her in my previous appointment, "I keep a close watch on this heart of mine"2, but she didn't get the reference (hardly surprising).

Internal links
[1] 1830
[2] 1776



This day in history:

Blog #
Date
TitleTags
10913/11/2007
My body is falling apartApnea, Anaemia, Teeth, Bursitis
42813/11/2011
Kindle arrivesKindle
42913/11/2011
Relieving the pressureMBA, Finance
77513/11/2014
Another Priority interface - multiple import filesProgramming, ERP, Office automation
90213/11/2015
The latest addition to our musical menagerie ... and peppermint foodMusical instruments, Peppermint

Tuesday, November 12, 2024

Karla's choice

Three weeks ago, I wrote1 about the announcement of this book that caught me - and probably many other people - totally by surprise. Since then, I have finished reading the book, although the actual process by which I read the book (I'll explain below) left me rather unsatisfied.

The first words that I read of the book were the author's note and the opening of the first chapter - these were available from the a link in the Guardian article, although I should point out that later they were replaced by other material, also from the first chapter. 

The author's note was very interesting, although it had very little to do with the book itself. It explained how Nick Harkaway (a nom de plume - Nick is the youngest son of JlC, aka David Cornwell) came to write the book. NH is aware of the problem of Smiley's age2, linking it to the age of Karla. But for the latter, an extra, possibly previously unknown, datum is added: [he] served as a kitchen boy on a train in 1904 (also in Tinker Tailor). Remember this when reading the book.

So what's the book about? Initially it is about the search in Britain for a Hungarian publisher called László Bánáti who has disappeared; shortly after, it transpires that he is better known - at least, to the Circus - as Ferencz Róka, a veteran Centre agent. After tracing some of his movements in London, the search of Róka then moves to the continent, giving the author a chance to introduce all manner of characters, some of whom we met in 'The spy who came in from the cold' and some we will meet in TTSS. The plot thickens and possibly over-thickens.

Why was I unsatisfied by the way I read the book? After the initial meeting with the opening words on a web page, I found a copy of the audio book. As I had just received a new pair of headphones (replacing the unsatisfactory pair that I described3 a month ago), I thought that I would try them whilst listening to an audio book. I found this to be very unsatisfying for a few reasons - I could listen for only about half an hour at a time as I walked the dog in the morning and evening, and had to concentrate entirely on the reading (no thinking about other problems!). Names especially became mangled, especially as there were several non-English names and words in the opening chapters. But probably what I missed the most was the ability to go back to the beginning and reread something that wasn't initially clear.

I had listened to about half of the book when the epub version arrived, so I quickly transferred my allegiance to that. I lightly reread the book to where I had left the audio version, then continued with computer and Kobo. I've noticed that over the past few weeks I haven't been concentrating as much as I usually do when reading, discarding several books after having read their first chapter. Thus I don't know whether it's me being unorganised or it's the book itself that is causing my dissatisfaction. I shall try and reread "Karla's choice" in one dedicated sitting - we are promised a power cut on Friday morning from 7am - 11am, and this will be an excellent time to read as there will be nothing else that I can do.

"In universe", one problem that I noted was that the identification of Bánáti as Róka was made by Bill Haydon. As we discover in TTSS, Haydon is a Russian mole; surely it would have been better for a mole to keep his mouth shut here instead of blowing Róka's identity. As the Circus had been unaware of Róka's presence in Britain and his role, it seems unlikely that Haydon would have been briefed about Róka in the past and so wouldn't have been able to use the opportunity to get rid of someone who is out of favour with Centre. Anyone else, e.g. Toby Esterhase, a Hungarian himself, could have made this identification without problem. On the other hand, Haydon does try to take hold of the investigation, presumably after having discussed it with his controller, so this attempt does make sense. Maybe I am reading too much into this; it could be, as David Lodge puts it in 'Nice work', an aporia, a figure of undecidable ambiguity, [an] irresolvable contradiction. I doubt that I will ever learn if this was laziness on the author's part or genuinely intended.

Control does wonder what Róka's role was in Britain, but little to no effort is expended in discovering what it might be. I see this as an authorial problem and not one of the Circus. In the book, the pace heats up once the action leads to Europe and the British connection is forgotten.

And wither Karla and his eponymous choice? All through the book I wondered when this was going to appear, and it's only around the last two chapters that what it is becomes clear. The final chapter reads more like an epilogue than part of the story.

I recall that I had to read TTSS several times before it achieved clarity in my mind. I read "The Honourable Schoolboy" whilst travelling around America by bus, which is most certainly an unsuitable environment for reading material of this nature, and so that book too took a long time to become assimilated. On the other hand, the third part of what was to be called the Karla trilogy, "Smiley's People", was clear from the start. So not understanding the grand design of this book on its first reading is not necessarily a failure on my part or on the author's part.

Internal links
[1] 1843
[2] 1070
[3] 1842



This day in history:

Blog #Date TitleTags
14212/11/2008Seasons - a songMIDI, Song writing
30212/11/2010What are the 10 songs that defined one's tastes?King Crimson, Van der Graaf Generator, Beatles, Richard Thompson, Randy Newman, The Band, 1971
64612/11/2013Minimalistic arrangementsMIDI
77412/11/2014Navigating by machineMobile phone
98612/11/2016Headphone amplifierComputer, Musical instruments
135612/11/2020Date set for doctoral oral defence!!!!DBA