Tuesday, July 29, 2025

Pinning blogs

Yesterday evening I was working as a freelance Priority programmer when I had recourse to use a special technique that I had developed a month or two ago. Unfortunately I only remembered that the technique existed but I couldn't remember its details. I knew that I had documented it, so I launched the Blog Manager Program (BMP) for "the other blog", looking for the specific entry, which I found after a few minutes.

This entry gave the backbones of the technique but not the actual details. For that, I knew that I would need the name of the procedure in which I had used the technique, but this essential detail was missing from the blog. There's no easy way of finding a given procedure in Priority, especially if one doesn't remember its name, so I had to look through several menus until I eventually found the procedure and of course, the special technique.

Back in the BMP, the first thing that I did was to edit the saved entry to include the procedure's name (this doesn't appear on the Internet version of the blog). Then I thought that it would be a good idea if I could find this entry without having to search for it, or as I called it, "pin the entry to the start bar". Of course, the BMP doesn't have a start bar and there's no concept of pinning, but after a few moments' cogitation, I realised that it would be very simple to have a list of blogs displayed on program startup.

At first, I implemented pinning by creating a new table named ... yes, you guessed it, 'pinned'. This table has only one field, 'blog', and obviously any blog whose number is in this table is pinned. I wrote the code necessary to check whether there were any pinned blogs and if so, to display them. Then I went over several units in order to add code to either pin or unpin a given blog.

I then took the dog for a walk, and realised that I wasn't thinking totally straight. As Fred Brooks wrote in his book "The mythical man month", plan to throw one [implementation] away; you will, anyhowObviously, a table with one field isn't a particularly good idea; much better would be to add a 'pinned' field to the 'entries' table. This way I don't have to deal with 'insert' and 'delete' statements; instead, the field's value is updated to either 1 (pinned) or 0 (not). This is much simpler, and in fact, the updating is done by one central and common procedure.

It would be nice if this procedure could also check whether there is a list of pinned blogs being displayed, and if so, update it. Another possibility would be to display a list of pinned blogs if one is not displayed. This is slightly problematic, because 'the list' or a rather, a query of entries whose value of pinned is 1, is not a simple list but instead an invocation of the 'temp' table with a specific instance number. So I would have to either insert into this table or delete from it, then cause the pinned window to update. Not too complicated, but fiddly. The first thing to do is save the instance number of the pinned window.


This day in blog history:

Blog #Date TitleTags
4429/07/2006HolidayHoliday, Joni Mitchell
18729/07/2009Speed, speed, speed/2Programming, Office automation
61429/07/2013Transferring more cassettesPersonal, Old recordings
74429/07/2014Research proposal acceptedDBA
96529/07/2016The night managerTV series, John Le Carre
141029/07/2021My father's eyes (song)Song writing, Father
164829/07/2023Exhausted but happySong writing, Swimming, Musical group

No comments: