Wednesday, June 30, 2021

1400 blogs

Real life intervened for a while, so I didn't notice that I had passed the milestone of 1400 blogs. It's time for the traditional metablog. Blog #1301 was posted on 23/03/2020 whereas #1400 dates from 21/06/2021 - let's call that 15 months. The previous 100 blogs took 'only' 13 months to write so I am definitely slowing down.

At a guess, the top three topics will be Covid-19, DBA (although there's not been so much of that in the past few months) and health or blood pressure (very strong in the past few months). Let's see what the top tags are -

PositionTagCount
1Covid-1917
2DBA15
3Health14
4Programming13
5Delphi9
6Song writing8
7Personal7
8Unicode5
9=Aldosterone4
9=Blood pressure4
9=Kibbutz4
9=Swimming4
9=Weather4

Following on, there are a further 11 topics with 3 blogs each, 8 with 2 blogs, and 24 with 1 - all in all, 58 different topics.

I expect that most of those topics will continue through the next year, except for Covid-19, which is fast disappearing from our lives.

Edit from three weeks later: I realised this morning that since 26/04/20 I've been running a separate blog for Priority tips/problems, with 34 entries from that date until 19/05/21. So I actually wrote 134 blogs between 23/03/2020 and 21/06/2021, which is almost exactly 9 blogs/month; 100 blogs in 13 months is just under 8 blogs/month, so actually I wrote more blogs in the past year than in the previous year.

Tuesday, June 22, 2021

Delphi: components array vs controls array

Yesterday, whilst programming the 'saved query' code, I made much use of the 'components' array in order to traverse the various fields on the screen and examine their values, such as

for i:= 0 to componentcount - 1 do if components[i] is TLabeledEdit then begin ord:= TLabeledEdit (components[i]).TabOrder; flags[ord]:= TLabeledEdit (components[i]).text <> '' end else if components[i] is TComboBox then begin ord:= TComboBox (components[i]).TabOrder; flags[ord]:= TComboBox (components[i]).text <> '-' end else if components[i] is TRadioGroup then begin ord:= TRadioGroup (components[i]).TabOrder; flags[ord]:= TRadioGroup (components[i]).itemindex <> 2; end;

The generic code that I wrote yesterday was similar but I knew that 'componentcount' and the components array were properties of the form itself. That might be so, but the taborder values that I was obtaining didn't seem correct.

After researching the topic slightly on Stack Overflow, I discovered that the components array contains every object that is owned by the form (I found a good answer yesterday but can't find it today). Despite the fact that the edit boxes, combo box and radio group are placed on a tab sheet (which in turn is a son of a page control which is a son of the form), their owner is the form. If I want to iterate over the objects that I placed on the tab sheet, I need to use the 'controls' array and pass the tab sheet as the 'father'. I discovered this backwards by trying to iterate over the tab sheet's components array and finding it empty ... and not understanding why.

Apart from anything else, there are far fewer objects in the tab sheet's control array than there in the form's components array, so traversing the first array will be faster than the latter. I hope that this time the taborder values that the code will read are 'correct', i.e. correspond to the values that I set in the object inspector. The taborder that I see refers to the order within the tab sheet.

Today I wrote a test program with a form similar to the parameters form from the Manager program; I wrote a simple debug routine to output the controls' name and where appropriate, the tag and tab order. This worked as expected, and when I updated the Manager program using the controls array, everything worked properly. I don't know what I messed up yesterday evening.....

Monday, June 21, 2021

Neat hack - but is it useful? (Management program)

Over the past few years, I have slowly been moving reports in the OP's management program from a simple SQL query with maybe one or two parameters (sometimes with a list of customers or therapists on one side and the required data for the chosen customer/therapist, and sometimes via two dates) to a more dynamic form, in which a form/screen/window has what Delphi calls a pagecontrol with two tabs (as shown in the picture on the left), where one tab has a form with various parameters and the other tab shows the result of the query. I see now that I wrote about this eight (!) years ago so I won't go into too many details here.

I see also that I posted the code that shows how the parameters are added, but not the basic query, which for the above form would be

select therapists.name, interviews.curdate, interviews.score, people.forename, people.surname, coalesce (people.origzehut, people.zehut) as origzehut, dockets.id, ranks.name as rname, people.id as pid from interviews inner join therapists on therapists.id = interviews.therapist inner join people on people.id = interviews.pid inner join dockets on dockets.id = people.docket left join ranks on dockets.recommendation = ranks.id where 1 = 1

The parameters are added after the 'where 1 = 1' line, such as 'and therapists.id = :p1'. When I remember, I try to add a similar parameter tab to every new report.

Last Friday we were talking about adding more fields to a different report when suddenly I thought to myself that it would be a neat hack to add saved queries to the parameter tab. The idea is very simple: let's say that I've filled in the parameters for a query (e.g. select all the interviews held during 2020 that had a score of 5 - that's three fields) and I want to repeat this query at some point in the future, maybe choosing a different therapist (I don't have a way of choosing two or three therapists; it's either one or all). I want to save this query so that I can restore it again with minimal effort. Obviously (or not), the parameters stay on the screen until one exits the screen, so repeated queries with different therapists don't require new input (apart from choosing the therapist). But should one close the screen or run the query on another day, the values must be chosen again. Saved queries allows one to restore the parameter values.

This is less a technological problem (how to save the values and later restore them) and more a user interface problem: the user must be able to save, restore, update and delete queries, preferably whilst seeing the saved parameter values.

After thinking about this for about an hour or more, I came to the conclusion that the requirements would be a list box (showing the names of the saved queries), a button allowing one to save the values (that's the '+' button on the right hand side underneath the list box), a button allowing one to update the values (that's the middle button) and one button to delete saved queries (the '-' button on the left). Restoring/choosing a query is done simply by double clicking on the query name.

Pressing the '+' button brings up a dialog box in which one gives a name for the query, and then the parameter values (those that are not default, e.g. empty) are saved. My original data design had a 'savedquery' table consisting of an id, program number and query name, along with a son table with a pointer to the father id, the tab order of the field being saved and the value of the field being saved. During testing, I belatedly realised that the management program is multi-user, and so I added a field for the user to the 'savedquery' table. This way, two users can have different saved queries for the same screen with the same name, but with different values, and each user will get the values that she saved, and not those of another user.

I originally developed the necessary code as part of my example screen; once it was finished, I considered how to make the code more generic so that I don't have to write it again. Certain parts have to be modified per screen (saving and restoring the value of a given parameter) but no small amount is generic. I think about 60-65% of the code is generic and 35% specific.

Whilst writing this blog and looking at the code, I have just realised how I can make the entire saving and restoring procedures totally generic. Hurray!

I have my suspicions that no one is going to use this feature, but I enjoyed the technical challenge of writing it!

Sunday, June 20, 2021

Sequencing "House with no door" - revised/revisited

Many years ago, I wrote about sequencing the Van der Graaf Generator song, "House with no door". At the time, I didn't like the first version that I sequenced so I created a second version. As I wrote at the time, "Last night I wasn't too convinced about the new version, but having listened to it several times this morning, I think that this will be 'the one'".

Both versions popped up on my headphones the other day, which is when I realised that there are parts of the first version that are good (and parts that are not so good) and that there are parts of the second version that are good, along with parts that are not so good. As a result, I decided to create yet another version of this song!

The first major production decision was to remove all percussion; this was one of the problems that bogged down the original versions. The second decision was to remove the completely instrumental third verse - this is where David Jackson plays the most beautiful multiple saxophone counterpoint - but in my versions, this verse was slowing things down and causing problems. I decided to create my own chord sequence for the instrumental break; if the song were in C (as is the original, but I'm playing it in Bb), the chords would be Dm (four bars), Fm (four bars), D7 (two bars), G7 (two bars), C (three bars). The D7 is the secondary dominant of G7 that is the dominant of C. 

I also simplified the instrumentation slightly but added a marimba at the beginning of the final verse: I could hear something in my imagination that was not in the original nor in either of my earlier versions.

Now all I have to do is become familiar with the new arrangement and eventually sing it. 

Wednesday, June 16, 2021

15 June 2021

A special day.

In my teens, I had several close friends whose birthdays fell between 15-19 June. Unfortunately, I lost contact with all of them years ago and no longer remember accurately whose birthday fell when. So if it's yours on 15 June, Happy Birthday!

More importantly, this is the day that the Israeli ministry of health rescinded the order about wearing masks. We are now free of mask wearing, except in hospitals and old age homes. The kibbutz clinic issued an instruction (a warning?) that masks should be worn by those with upper respiratory tract infections, but probably the warning extends to everyone. I've been a frequent visitor to health clinics in the past few weeks but now I have no outstanding appointments for a few weeks. 

Coincidentally, I made my first trip to Karmiel in what is probably a year and a half. It seems that nothing has changed in that time, although obviously I missed all the changes. I don't know whether this visit is going to be the harbinger of future visits: I made an exception because I had three consecutive meetings with the CEO and I wanted to see the infamous 'nesting' machine and the 'automatic warehouse'. I think that I'll travel to Tel Aviv in a week or so in order to give a new employee a training session with Priority but other than that, there seems to be no incentive or imperative to travel.

The automatic warehouse opens all kinds of possibilities and will allow several changes to occur with respect to how the wood planks are purchased and removed from inventory. Consider this post of mine from 12 years ago (!); almost nothing has changed in that period, but finally that era is over. The automatic warehouse allows us to know every minute how many planks are in inventory; I will add to this the requirements and so everyone will be able to see how much inventory needs to be ordered.

Sunday, June 13, 2021

Primary aldosteronism

I apologise for continuing to blog on this topic, but I find it fascinating. After all, it is my health.... Not only that, the researcher in me finds the protocols very interesting.

The new web site that I found states that primary aldosteronism (PA) should be considered in cases where

  • Blood pressure is above 150/100 mm Hg on three different measurements obtained on different days
  • Blood pressure is above 140/90 mm Hg, and does not improve despite combining three conventional antihypertensive drugs
  • Blood pressure is below 140/90 mm Hg, but  four or more blood pressure medications are combined
  • High blood pressure and sleep apnea
There are other indications, but the above is enough; the fourth might be considered to be the most obvious in my case, but I don't remember the topic of sleep apnea being raised in any consultation. The first stage in diagnosis is the aldosterone/renin ratio; my blood contains almost no renin so the ratio is very high - a good sign of PA. The second step is oral sodium loading that is supposed to suppress aldosterone production; not quite, in my case. 

Once primary aldosteronism has been biochemically established by ARR and confirmatory testing, the next step in diagnosis consists in determining the subtype of the disease. Although it only concerns about a third of patients, the form of primary aldosteronism for which treatment is the most effective is unilateral disease where an adenoma is the source of excess aldosterone.In the third step of the diagnosis process, imaging of the abdomen is obtained by [a] CT scan to assess whether there is an adenoma or the rare adrenal carcinoma on one of the adrenal glands.

One last step is needed in the diagnosis process — adrenal venous sampling. It is the “gold standard” test to distinguish unilateral from bilateral disease, and to determine the best course of treatment.

Reading further, I see that this test measures cortisol, not aldosterone; values from the adrenal veins are compared to a peripheral sample taken from the inferior vena cava that establishes a base value and to which the adrenal values can be compared.

For now, the next step is to obtain an appointment for the test. The PA site stresses that the diagnostic center handles a high enough case volume; the radiologist (or endocrinologist) to which I am being referred performed three such procedures last week. That should suffice.

I'll close this post with a paragraph I found elsewhere on the site, living with PA. Because they are prone to sleep disorders, patients with PA must ensure they get enough rest. Adopting a few simple techniques also helps reducing the anxiety and depression caused by excess aldosterone:

  • Accepting events that are beyond our control;
  • Asserting our feelings to prevent anger and aggressiveness;
  • Setting limits and saying no to requests that create excessive stress;
  • Managing our time effectively;
  • Making time for hobbies and interests;
  • Learning and practicing relaxation techniques;
  • Seeking out social support; 
  • Seeking counseling in times of crisis and to learn from professionals trained in stress management.

The above provides good reasons why I am still working from home.

Thursday, June 10, 2021

Adrenal venous sampling

I had today what I thought was going to be the decisive meeting with my nephrologist: the CT scan from a week and a half ago showed a small (1 cm) adenoma on the left adrenal gland. I feared that the next step would be surgery, but no, there is another test that can be performed before this final step.

Incidentally, I praised the doctor for his approach to the problem: although there have been many steps, there has been a gradual progression from a minor, no inconvenience, test (blood), through a slightly more complicated test (urine collection with salt loading) followed by a more complicated, but still non-invasive test, the CT. Now the gloves are coming off: the next step is invasive as is (of course) the final step. Here is a very good web site that explains the various steps in the diagnosis, so to be fair, the doctor was following their advice.

So what is the next stage? Adrenal venous sampling. There's a somewhat learned web page that discusses this, but an easier explanation can be found here. In simple terms, even though there is an adenoma on the left adrenal gland, it may not be producing aldosterone (which is upsetting the balance). The way to test this is to compare blood taken from the left adrenal gland to that taken from the right adrenal gland; if both samples have the same aldosterone level, then the adenoma is non-producing and can be left as it is. But should the sample from the left gland have a higher aldosterone level, then ....

Here's a nice picture of what's going to happen. For the patient, it's similar to catherisation, where a catheter is inserted into the femoral vein and then travels up to the heart. In this case (AVS), the catheter doesn't have to travel far, and in the words of the nephrologist, it's a much easier procedure as there's no need to battle with the blood pressure found in the aorta.

Tuesday, June 08, 2021

A new Yoni Rechter songbook


About ten days ago, there was an interview on TV with Yoni Rechter in which he discussed a new songbook ("Twenty songs from five decades"), his fourth. A few days later, I was in the local mall (after having my chest x-ray) and went into the book shop, asking about this book. I didn't know its name and I didn't know whether the book had been published yet (the interview said that it would be published in a few weeks, but now it occurs to me that the interview could have been recorded a week or more before it was broadcast). A salesperson looked it up on the computer, found the name of the book, found that they had it in stock and eventually found the physical book on the shelves. It makes a welcome change to buy something as it is published and not a year later (more on this later).

As per its title, there are (only) twenty songs in the book and these come from all across his career. There are a few from his first solo album (1980/1), some from his last 'official' album (2017) and a few from his most recent album (again, more on this later). I haven't really had the strength or ability to concentrate on reading the sheet music, but as his songs have been accompanying me on my walks for the past few days, this was an ideal opportunity to look at the notes for the title song of the last album "Svivenu" ("around us"). 

Funnily enough, I was thinking - prior to hearing this song - that there are very few Rechter songs in 6/8 or 12/8; of course, "Svivenu" is in 12/8. The song is presented in the key of A minor (although there is a modulation to Eb in the middle), but a note in the introduction to the book says that the recording is in a different key. The first chord in the verse is naturally Am; the second chord in the first verse is Bm7 (b5), which is the diatonic chord formed on the second note of the minor scale (B D F A). A few bars later, a different chord is used: B7b5; in other words, the diatonic D has been sharpened to D#, leading more naturally (pun not intended) to the E7 chord that follows. Further on (after returning from the modulation), that second chord is now B7 - not only has the D been sharpened, but also the flat fifth (F) has been 'unflattened' - it's now F#. My point is that the same sequence near enough occurs three times, but each time that second chord is changed slightly. That's variation - or sophistication. There's plenty to learn from these examples. If I get really bored, I might try entering all the notes into the MIDI sequencer.

Now resolving the 'forward' references: a few weeks ago, I idly accessed Yoni's web page (or rather, Facebook page) and discovered that he had a 'new' album of children's songs released; this came out in January 2020, before Covid-19, but presumably the pandemic prevented any PR effort on behalf of this album. Again, in one of my visits to the local mall, primarily for medical reasons (if I remember correctly, this was when I went to get the salt pills), I went into the book shop, but this time found the disc immediately.


The first few listenings to the disc were somewhat confusing, but shortly everything sorted itself out, and I very much like this collection. The writing is cinematic: voices and instruments come and go. I wonder how children would find these songs because they are not straight-forward. An animated clip of one of the songs ("Pnina") can be found here; this song is like a mini-opera and again I wonder how children would find this. This song is one of those included in the new book, so I can give a short analysis. After two bars of musical introduction in 4/4, the first bar of singing is in 5/4 followed by one in 4/4, then one in 2/4, three bars in 4/4, one in 5/4 followed by several in 3/4 before the song returns to 4/4. In other words, metrically strange. But it may be easier for an untrained mind to learn this song simply by listening than for a trained musician to follow the notes. All of the songs on the album can be heard on YouTube, starting from here

The title of the album, "Yoni Giraffe", is a joke: on Rechter's previous album for children, "The sixteenth lamb", there was a track called "The giraffe has a long neck" (he can see things coming a week before we can) which is introduced by Yonatan Geffen commanding "Yoni, Giraffe", i.e. Yoni, play the Giraffe tune. Needless to say, Yoni Rechter is ... tall.

There are a few 'songs' that are spoken with a musical background; my favourite is one called 'Zebra' which is a Hebrew translation of a song by Shel Silverstein. I was going to translate the words back into English, but I found the original (the Hebrew differs here and there):

“I asked the Zebra,
are you black with white stripes?
Or white with black stripes?
And the zebra asked me,
Are you good with bad habits?
Or are you bad with good habits?
Are you noisy with quiet times?
Or are you quiet with noisy times?
Are you happy with some sad days?
Or are you sad with some happy days?
Are you neat with some sloppy ways?
Or are you sloppy with some neat ways?
And on and on and on and on and on and on he went.
I’ll never ask a zebra about stripes...again.”

Sunday, June 06, 2021

More data on my last viral infection

A week ago I had a CT examination, primarily of my adrenal glands because of the hyperaldosteronism. The scan showed a small (1 cm) adenoma that might well be the cause of my problems. I have an appointment with the nephrologist on Thursday and he will decide what the treatment is to be.

I was so focused on this that at first I didn't notice something else in the scan results: a large amount of pleural fluid in the right lung. This also appeared in the chest x-ray from Tuesday although in a lesser amount. In other words, there definitely was something wrong with my health in the past week, and the pain in the back was probably due to the accumulation of the pleural fluid.

My regular health is now near enough back to normal: I didn't feel well enough to go swimming on Friday morning, but I did swim yesterday. The first length was delightful: the water temperature was a bit below comfortable so this adds an extra frisson. But after about ten lengths, my timing was getting progressively worse and I stopped after sixteen lengths. At home I napped for about an hour as well as eating a few sandwiches. Hopefully next week will be better.

A few nights ago I recorded a tv show about how to improve one's immune system. What tips did this programme give: don't drink alcohol (check); sleep well (check); eat properly (check), exercise (check) - in other words, I'm already doing what the programme advises. One fact that I didn't know is that a high (3+) neutrophil to leukocyte ratio is bad for one's immune system; there's a medical term that I have momentarily forgotten that became important for Covid-19 patients [toxic shock syndrome or Cytokine storm] - the immune system reacted so strongly to the infection that it overwhelmed the body (something like anaphylactic shock). Five out of the six people examined in the show had an NLR well over three at the beginning of the programme; most managed to reduce it a little during the six weeks that they were monitored. 

I looked at all the blood test results that I have from the past 8 years and discovered that there are values both for neutrophils and leukocytes, so it was a simple manner to extract the values and calculate the ratios. My normal ratio is 2.0, which is very good. Strangely, the one time when it was significantly higher (3.1) was exactly one year ago, just as we were coming out of the first Covid-19 lock-down. Apparently the psychological effect of that lock-down was to create neutrophils as if my body thought that it was under attack. Further evidence that the mind has no small effect on the body.

Wednesday, June 02, 2021

My 'friends', the viruses

I know that it's not correct to anthropomorphise viruses, but sometimes I wonder. 

For several years after I emigrated to Israel, I was subject to nasty throat infections that led to microhematuria: I remember sitting in the office of a professor telling me that the doctors would be left no option but to remove my tonsils if I had one more infection (the tonsils provide a breeding ground for the staph bacteria that cause the problems that lead to blood in the urine; whilst this operation is considered 'regular' for children [although not anymore], it's quite a serious operation for an adult). Obviously the bacteria were listening for I've never had such an infection again. I related this incident here.

My friend the cold virus comes to visit once a year; I used to have some form of infection once a month, but after I started being vaccinated for the cold, the rate dropped impressively. Even if I had to pay for the vaccine, it would be worth it, as the cost of my lost productivity far exceeded the cost of the vaccine. I used to take comfort in the knowledge that at least someone (or something) would be happy to see me once a year.

I managed to avoid an infection from Sept 2019 - Feb 2020; after that, the viruses were as scared as I was from the new guy on the block and didn't come to visit. Obviously social distancing was very important in this; once things started coming back to normal, mask wearing also kept the viruses at bay.

But May 2021 has been one long infection; the first lasted nearly a fortnight but consisted only of a sore throat and some weakness. I had barely overcome that one when another virus attacked me; apart from the sore throat, this one caused pain in my back and also, unfortunately, caused my temperature to rise, making me weak and causing my mind frequently to lose focus. 

Yesterday I finally got the chance to see a doctor (the mild fever started only on Thursday); the physical examination didn't reveal much, but the doctor left nothing to chance and ordered a chest x-ray. This was clean* and I was given the medical ok last night. True, I did wake up in the middle of the night with a headache and bad feeling, but by morning I was feeling near enough normal.

To anthropomorphise again, the virus saw how serious I was about getting rid of it, so it decided to leave. A slight headache started about half an hour ago, but doesn't feel as if it's going to progress. My mind is sharp and my body shows no weakness.

Leaving levity for a moment and returning to a more scientific point of view, the fact that Israel is returning to pre-Covid behavioural practices aligned with the fact that I've been out of the house relatively frequently the past month (various medical tests connected with my high blood pressure, as well as dealing with several bureaucracies in order to open a bank account for my father) have increased my exposure to the world. I have heard that hospitals in Israel are reporting raised levels of incoming patients with non-Covid breathing problems; it seems that the viruses are making up for the fifteen months when they had no chance of infecting people.

I hope that June is going to be a more productive month than May (although it could hardly be less productive).

* the x-ray wasn't totally clean, and I wrote the above before I saw the results. The x-ray showed some pleural effusion.

Tuesday, June 01, 2021

It's all in the voicing

About a month and a half ago, I blogged about a simple song that I had written, "There she goes". Recently, I've had the song playing in my head, but as opposed to the simple 4/4 rhythm of the original, I've been hearing it with a 6/8 rhythm. On Saturday I got the chance to sit down and create a new version of this song with the ternary rhythm. I haven't been too successful in sequencing songs with this rhythm from scratch, but this time it worked. After completing the sequencing (and discovering that two bars in the original are equivalent to four bars in the new version), I sang the song and mixed it. 

The morning after, I listened to the song once and found it terrible (too slow), although I should listen to it again. There was, however, one thing that could be saved from this version: at one stage in the song there's a Bb chord, but somehow this got sequenced as the triad C-G-D (over Bb in the bass) - an interesting sound. I took this chord and put it back into the original version, improving it somewhat.

Today I was thinking about this chord: it's a quartal chord, with intervals of fourths (D-G, G-C) as opposed to thirds as used in most chords. Whenever I see a quartal chord, I see it as a some form of a suspended chord, in this case probably Gsus4. But what happens when one adds the Bb in the bass? My next thought was that this was a Gm(add 11) chord, a strange construction. But then I thought that it could also be viewed as a Bb6/9 (no 5) chord, not that I've ever considered such a sequence: Bb D G C. I played this on the piano and it has a really nice and spaced out quality - that's because of the fourths D-G-C. When I played the tune of 'There she goes' along with this chord, the tune adds an F at the top, yet another fourth - Bb D G C F. But this can also be seen as a 'complete' Bb6/9 chord and is even more 'spaced out' or 'airy': it's a chord that allows its notes to breathe.

I've read about 6/9 chords but never appreciated them, mainly because I was playing them in closed voicing, i.e. Bb D F G C. This sounds cluttered and not very useful. But the moment that I move the F up an octave, I get the open voicing that I accidentally obtained in 'There she goes'. The sixth and ninth are decorative notes and don't really affect the quality of this chord chord that most naturally resolves to an F chord: the Bb resolves down to A, the D resolves to C, the G resolves to F and the C and F stay as they are. We now have a F major first inversion.

I'm going to play more with this open voicing and see where it leads; as opposed to the sort of harmony that I usually employ, where the chords make the running and the melody is something placed on top, it sounds like this chord can support an extended melody without having to change or resolve to another chord.