Wednesday, July 24, 2024

The best chocolate in the world / 2

Six years ago, I wrote about finding some bars of what to me is the best chocolate in the world. Since Torino, I've never managed to find any again, despite my attempts. Today for some reason, I decided to search once again for this chocolate. I couldn't find it on the manufacturer's web site, but there was an option to contact them.

I wrote: Several years ago, I bought some of your chocolate, Cioccolato Extra Fondente con Cristalli alla Menta. I think that it's the best chocolate in the world! I have visited Italy many times, but in the past few years I have not been able to find this chocolate. Do you still make it?

And I received a reply: Dear No'am, Thanks a lot for your mail which is really appreciated. Yes, we still make that product.

So I shall look out for it the next time that I am in Italy. Maybe I'll be sent a list of shops where I can purchase the chocolate.



This day in history:

Blog #Date TitleTags
74324/07/2014Improving the In-basketProgramming, In-basket
105524/07/2017Sleeping in the groundDCI Banks, Peter Robinson
164624/07/2023Israeli Democracy, 1948-2023Israel

Monday, July 22, 2024

Italian phrases

I came across an interesting Italian expression in a book ('A glancing light' by Aaron Elkins) the other day: Non c'è di che. Before getting to what it means, let's talk about the pronounciation. A 'c' on its own (ie without a following 'h') is pronounced as one would pronounce 'ch' in English - here it sounds like 'chay' (as in 'chase'). 'Ch' on the other hand sounds like a 'k' (or a hard 'c'), so the idiom sounds like 'non chay dee kay'. What does it mean? Google Translate says 'Don't mention it'. But changing the preposition leads to some interesting results, and translating the resulting English back into Italian is even more interesting.

Preposition Italian English Back translation
di Non c'è di che Don't mention it Non parlarne
di Non c'è di che, caro You're welcome, dear Prego caro
a Non c'è a che There is nothing to it Non c'è niente di male
de Non c'è de che You have nothing to say Non hai niente da dire
in Non c'è in che There is no way Non c'è alcun modo

All of the above probably means that one shouldn't trust Google Translate too much, and that these expressions are more idiomatic than literal. The funny thing is that I can near enough understand the back translation without help (although 'male' means 'evil' or 'bad').



This day in history:

Blog #
Date
TitleTags
26622/07/2010
Porting the Amateur ReasonerProgramming, AI
26722/07/2010
Beef ratatouieCooking
61222/07/2013
Transferring cassettesPersonal, Old recordings
74122/07/2014
Rice and beansCooking
74222/07/2014
And now for something completely differentFilms
88222/07/2015
Vinyl log 20 - 22 JulyVinyl log, Fotheringay

Sunday, July 21, 2024

Continuing to search on two columns

On Friday, I wrote about the problems that I was having in exporting data to Excel then sorting by two columns. As I couldn't do this by automation, I found a baroque method of sorting the strings in a stringlist prior to transferring them to Excel. After considering the matter, I thought that it might be better to take an SQL approach by saving the intermediate data into a temporary table (a non-connected clientdataset [cds]) then use SQL to return the data sorted by however I would want it. 

So yesterday I converted the code into something more streamlined that would either insert data into the cds (first pass, values for respondents who took the test before a given date) or edit the data (second pass, values for those who took the test after a given date). The first part worked perfectly but something didn't work on the second pass; eventually I realised that for some reason the locate method of the cds was not locating the required tuples.With little choice in the matter, I had to write a short loop that is the equivalent of the locate method; it might even be faster as it doesn't need to check the flags that are passed as the third argument to locate.

Once this little problem was out of the way, I could concentrate on sorting by two columns, the raison d'etre of the code. This was quite simple:

s:= field1 + ';' + field14; qData.addindex ('idx0', s, [], '', '', 0); qData.indexname:= 'idx0';

'Field1' is the scale name and field14 the difference. I thought it best to create the index name in a separate statement before creating the index itself. Originally I omitted the third statement and couldn't understand why the data wasn't sorted; stupid mistake.

I had inserted a statement start:= gettickcount; at the beginning of the procedure and a matching finish:= gettickcount; at the end (before exporting the data to Excel) so that I could see how much of a difference the cds approach made. The csv version took 781 ticks (I ran the procedure a few times and received this answer most of the time - it surprised me that two runs would require exactly the same number of ticks). The cds approach took about 125 ticks - six times faster!

Why am I not surprised? I suppose now that I will have to go over code in this program as well as in the management program, looking for code that creates a csv stringlist that is exported to Excel. The queries in most of these places can probably be sped up.



This day in history:

Blog #Date TitleTags
26521/07/2010It's the 80s all over againProgramming, Prolog, Bill Thompson
49821/07/2012Trivets and punnetsSlow cooker
124521/07/2019Saturday swimmingSwimming

Saturday, July 20, 2024

M.Res.

I was thinking about qualifications and degrees the other day, noting that I had received no word from 'my' university. So I was pleasantly surprised when I received a letter yesterday, saying "The Research Degrees Committee met recently and confirmed the examiners recommendation to award you a Master of Research (MRes) degree". There was another letter attached to this that leaves me slightly bemused.

I am delighted to see that the Research Degrees Committee confirmed at their July meeting that you have completed the requirements for the Heriot-Watt University MRes degree. You are to be congratulated on an excellent performance and I trust that your life can now return to something approaching normality.

I wonder how much of this letter is formulaic and how much was written specifically. If I am to be congratulated on an excellent performance then couldn't have you gone a bit further and award me a doctorate? After the events of the past nine months, how can anybody's life [in Israel] return to something approaching normality?

A few weeks ago, I said to my wife that eleven/twelve years ago I was ecstatic to be awarded a master's degree; now I am disappointed to be awarded another master's degree. As we say in Hebrew, the bigger the expectation the greater the disappointment. And to think that a year ago I was considering starting a third master's degree.



This day in history:

Blog #
Date
TitleTags
9520/07/2007
1971 was when the music came togetherHabonim, King Crimson, Van der Graaf Generator, Tom Wolfe, Yes, 1971, Dave Evans, Music festivals, Jack Kerouac
26420/07/2010
Alarm clock mp3 playerClock radio
87920/07/2015
Vinyl log 19 - 20 JulyVan der Graaf Generator, Vinyl log, 1972
105320/07/2017
Back to the beginningDBA
124420/07/2019
More on Movie MakerHome movies
164420/07/2023
The end of the country as we knew it is fast approachingIsrael

Friday, July 19, 2024

Sorting on two columns

I faced an interesting situation today in one of the OP's programs. There is a suite of statements that refer to behaviours that are non-standard, such as alcoholism, drug taking and morality. One would expect that only a few people (or a low percentage of respondents) would agree with the statements and so these questions can't be analysed by standard statistical methods. The OP wants to compare the percentage of respondents that agreed with the statement in the nine months before 7 October 2023 with those in the nine months after this date.

We have a similar report that works on a per-question level, so the first thing that I did was copy the unit then update the copied version so that it would work with the non-standard statements (accessing them is slightly different from accessing the regular questions). All went well until I got to the stage of outputting the data. Over ten years ago (!), I wrote about sorting data in an Excel spreadsheet via automation. That code works for sorting on one column. Here we wanted to sort first by scale (alcoholism, etc)  then  by difference of percentage per question; in other words, sorting on two columns.
 
 sheet.Range['A1', 'G481'].Sort (sheet.Range['D2'], xlAscending,
                                 EmptyParam, EmptyParam,  // key2
                                 EmptyParam, EmptyParam,  // key3
                                 xlAscending, xlNo, EmptyParam, True,
                                 xlTopToBottom, xlSyllabary);

This code seems amenable to sorting on even three columns - all one has to do (I assumed) is to place a range statement (e.g. sheet.range ['O2']) in place of the first 'emptyparam' place holder, and to replace the second 'emptyparam' with 'xlAscending'. This seems simple in theory, but in practice it didn't work. I kept getting error messages, and as these are in mangled Hebrew, it's very difficult to know what the actual error is and even more difficult to know how to fix it.

As it was Friday, I left things as they were (sorted by scale and question - these are natural sort orders that come from the original SQL statement) and had a nap. When I awoke, I reconsidered; if I can't sort in Excel then maybe I can sort the CSV lines before they get inserted into Excel. This was easier said than done as the field by which the second sort has to be done was at the end of a csv line. Eventually after two hours' work, returning to the sort [pun not intended] of Pascal code that I would write before Delphi (including a bubble sort!), I had the final csv and hence the Excel spreadsheet ordered initially by scale then by difference. My algorithm has to create a temporary string list, insert the strings created for a given scale into this list, sort this string list then add the sorted strings from the temporary list into the main string list (the temporary string list itself is not sorted; I created an array of indices and values and did a bubble sort on this array).

Eventually I finished and it was time to take the dog for a walk. It occurred to me during the walk that it might have been better to use the original code to insert the strings into Excel when they are sorted by scale and question number, then sort different ranges of the spreadsheet in Excel. In other words, if lines 3-10 in the spreadsheet belong to scale ALC, then sort only these lines according to column O. Then sort lines 11-18, etc. I suppose that this is possible although it would be somewhat awkward (although no more awkward than the current code). Automating Excel is considered to be a slow operation, so doing this eight times might be quite slow. The current 'sort the csv in advance' approach works faster than I expected so this 'sort Excel by sections' approach might well be slower.

Then I remembered the old adage, 'if the only tool that you have is a database then every problem looks like a new table'; how would I solve this problem if I were working in Priority? I would output the intermediate data into a table then use SQL to return the data sorted by however I would want it. Why couldn't I do the same thing here? As the code was based on a unit that used the csv approach, I had simply continued in the same vein without considering other options. But now that I think of it, using a temporary table (i.e. a clientdataset that is not connected to the database) might well be more effective. There would be no need to convert percentages into strings and generally the code would be more streamlined. The 'sort the csv in advance' approach that I used today has one expensive section of code that has to be repeated once per scale (this didn't happen in the original version) and of course an SQL approach would require this expensive section to be executed only once. I might even convert the original unit to this SQL approach.

I'll leave that for tomorrow.


This day in history:

Blog #Date TitleTags
9419/07/2007What I did at work todayProgramming, ERP, Thermal printers
74019/07/2014Statistics with SQL (Firebird)Programming, Delphi, SQL, Firebird, Statistics
96419/07/2016When the music's overDCI Banks, Peter Robinson
124319/07/2019Making the Greece holiday videoHoliday, Home movies, Andros, Athens, Greece
164319/07/2023If this is jazz then I'm all for itAmbient music, Matthew Halsall

Thursday, July 18, 2024

Back to normal (computer)

I received my repaired computer yesterday morning and I've been working continuously since then with it. Apart from anything else, the larger screen (17 inch?) is a pleasure to work with after the cramped screen of my work mobile. The hard disk (SSD) has been replaced and not only does the new disk directly repair the problem that I had last week, it also fixes several minor problems (like Firefox frequently freezing, more semi-alliteration) that I had ignored but were probably due to problems in reading the disk. 

After all, I'm a software person, not a hardware guy.

One of my first acts was to backup material that has accumulated since March, primarily videos and pictures from our two trips abroad. I discovered that there is no small amount of duplication on the external hard disk, so I devoted several hours to removing the duplicates. The 'videos' directory occupies 148 GB on the computer's hard disk, 'pictures' 19.5 GB and 'songs'/'music' 91.9 GB (although this latter directory on the external disk is probably twice the size), so cleaning up freed a great deal of space on the external disk.



This day in history:

Blog #Date TitleTags
26318/07/2010The in-basket 3 (whole lotta programming)Programming, Delphi, In-basket, Combo box
73518/07/2014Research proposal submissionDBA
96318/07/2016Someone's tiredGrandfather
124218/07/2019Sending data to a procedurePriority tips

Tuesday, July 16, 2024

More computer woes

On Friday morning, after finishing whatever tasks I had on hand, I performed a Windows Upgrade on my Win 10 mobile computer. The upgrade completed but the computer would not restart. I turned it off and on again, resulting in the "Preparing automatic repair" message being displayed. The computer prepared and prepared but after twelve hours, it was clear that the automatic repair was not going to happen.

As this was the weekend, I decided to contact my computer technician only after a few days had passed. Last night he told me that there was a problem with the hard disk that he was trying to fix; first he would copy everything to another disk then presumably reformat the disk, so this is going to take some time.

This computer has had an unfortunate history with hard disks: five years ago, the computer slipped off my desk, ruining the hard disk. At the moment, it is simply inconvenient that I don't have that computer. I am working all day (and writing this) with the mobile computer from work so at least nothing there has been affected. This computer has only two usb ports, one of which is permanently used by the mouse (I don't like touchpads on computers) so that gives me a little less freedom. I tried using the usb distributor that I bought many years ago (four sockets) but this doesn't work very well as apparently my devices draw more current than the usb port can supply.

I've copied the blog manager and database programs from Mega to this computer: the last backed-up entry was about Donald Sutherland, from 23/06/24, so there's only a few entries missing. I suppose I could enter those then backup the database.

As usual, the motto is 'wait and see'. 

No 'day in history' today because apparently I have never before written a blog on 16 July. There's always a first time.

Icing on the cake: I lost my housekeys whilst walking the dog, and even though I've gone over our walk three times, I haven't found them.

Thursday, July 11, 2024

Pedalboard power supply problems

Way back in February/March, I discussed putting together a board for the various guitar pedals that I have purchased since the beginning of the year. The board consists of two logical parts: the pedals and the power system. The latter is composed of a chargeable battery and a power distributor. The last few band practices have been marred by problems with this system; even though I charged the battery for at least an hour in advance, I couldn't get any power into the distributor and from there to the pedals.

Last Saturday I devoted some time to establish where the problems were. The first seemed to be that the battery wouldn't work if its feeding cable was connected (even though the other end was not connected to anything), so of course I disconnected this cable. Then I had problems connecting the power distributor to the battery: on one end of the cable was a normal USB male plug that connects to the female socket on the battery. But the other end of the cable seemed to be a female C-type socket that would sit on the male C-type plug on the power distributor. I had trouble making this connection work but eventually it did. As a result, I obtained a nice (to my ears) swirling sound via a combination of the multifunction box and the tremolo pedal.

I resolved to do something about this situation; today I made my monthly order from Temu that included a different power distributor. This one has the feeder cable directly connected to the box so there should be no similar problems in the future. Of course, I was shown a picture of the distributor that I already have and something tickled my brain. 

This distributor had a C-type female socket for power entry, exactly the same as my telephone. So why did my distributor have a C-type male plug? It occurred to me that maybe the plug had detached itself from the cable and was stuck in the socket. So I got a pair of long-nosed pliers, put them around the plug and pulled gently; the plug came away revealing the C-type socket that had been there all along.

So I cancelled my order for a new distributor and threw away the ruined cable. Now I seem to be one cable short, but in fact there is a cable that will serve double duty. In advance, this cable will be connected on one end to power and the other end to the chargeable battery; this will charge the battery. When I am playing, the same cable will be reversed, so that the USB end connects to the battery and the C-type plug connects to the power distributor*. Problem solved!

As it happens ... a few weeks ago, my wife bought an external battery to help charge her phone, costing her 129 NIS plus another 15 NIS for delivery. This is a very simple device with a built-in male C-type plug for connecting to the phone and a built-in cable with a USB plug to connect to the charger. A few weeks later, I was offered the same device (from the same people) for only 99 NIS, so I decided to buy one for myself.

Over the last week, I wondered how I could use this battery with my pedal board, but as I was living under the misconception that the power distributor had a C-type plug and not a socket, there seemed to be no simple way of connecting the battery to the distributor. But now that the C-type socket has been revealed, this small device can be connected directly to the distributor, eliminating the need for the chargeable battery that is stuck on the pedal board.

I think that I'll leave the pedal board as it is, with the chargeable battery on-board, but that I'll take the little battery along with me in case of emergencies.

*Post-script from a few days later: I should have checked that the cable can do double duty before band practice. It turns out that the plug does not fit the power distributor socket so I had another evening without pedals. I do have a spare cable that does connect on both ends, so this is going into the gig bag. 



This day in history:

Blog #
Date
TitleTags
18311/07/2009
Treeview program managerProgramming, Delphi
26211/07/2010
Poland and the HolocaustDavid Lodge, Holocaust, Poland
38111/07/2011
Bern, baby, BernHoliday, John Le Carre
87711/07/2015
Highlighting cells in Excel based on their absolute value via DelphiProgramming, Delphi, Excel, Office automation, Statistics
123911/07/2019
The difficult negotiator returnsPersonal, Negotiation

Sunday, July 07, 2024

David Baddiel

DB is a British comedian who is also Jewish. Whilst I vaguely recognise the name, I know nothing of his work. Although he was born in New York, he grew up in Dollis Hill, North West London; as the wiki page puts it, Baddiel attended the North West London Jewish Day School in Brent,[12] and the public school Haberdashers' Aske's Boys' School in Elstree.

These used to be fertile breeding grounds for children who would join Habonim, so when I googled "David Baddiel Habonim", I wasn't surprised to find the following "When I was in a Zionist-socialist youth group called Habonim, they wanted to get people to go to kibbutz and make Aliyah, which I never did*. But in the 1970s, kibbutz was a progressive thing, and many leftists aspired to the kibbutz lifestyle. I think that's changed for a lot of reasons. Some of them have to do with things that have happened in the Middle East."

Baddiel is eight years younger than me, born in 1964, so of course he wouldn't have moved in the same circles as I did. Even so, I wonder: for a time in 1974-5, I was the leader of the young 10-12 year olds in North West London. Baddiel would have been 10 years old at the time ... maybe he was in my group?

* But I did.



This day in history:

Blog #Date TitleTags
4207/07/2006Schizophrenia and insomniaMIDI, Van der Graaf Generator, Bar mitzva, Insomnia
37707/07/2011Locarno log (3)Holiday, Italy, Switzerland
87507/07/2015New lyricsPersonal, Song writing
115607/07/2018DBA updateDBA
123807/07/2019Changes in the music roomMusical instruments
140407/07/2021Relative date fieldsProgramming, Delphi
163907/07/2023Today's nutrional reading: "The fatburn fix"Woody Allen, Non-fiction books, Nutrition