Following on from yesterday's blog1 about a slightly more complicated SQL query replacing iteration over a cursor, today I implemented the required change. It was a bit different from the code that I described yesterday as I already had the tag count and so did not need to use count (*) and group by.
While I was working on this, a solution popped into my mind for a problem that occurs only with the first blog of each month. Adding the blog itself is no problem - normally I do this when the 'this day in history' form is showing - but I receive the contents of the blog after having done this; frequently 'tomorrow'. In order to show the blog, I request all the blogs from 'the beginning of the current month', but since there is only one blog, the contents of the blog will be displayed instead of a list of blogs. But as there is no content yet, nothing gets displayed. Of course, I could request all the blogs from 'the beginning of the previous month', but then I get all the blogs that I don't necessarily want to see.
The solution - as always - is simple when it's formed. A new form displays
a listing of the files that are in the directory that the program accesses -
normally only one file will be there - the new one. The program reads the
file name that will include the full directory name as well as the 'htm'
suffix (e.g. 'c:\db programs\data\Perceptions dopamine rush.htm) and
extracts the name of the blog entry itself ('dopamine rush'). It then checks
to see that there is a blog entry with that title but with no contents, and
if so, the regular code for reading the contents is executed, which also
deletes the file after it has been read.
Once I had finished writing this, of course a new idea revealed itself that
was very simple to implement: display the contents of the new blog entry.
This will happen every time that I import contents, not only with this
special case.
Internal links
[1] 1850
Title | Tags | ||
---|---|---|---|
59 | Shopping | Van der Graaf Generator, Peter Hammill, Musical instruments, Keyboard | |
215 | Eliza Carthy, "Red" | Morse, Eliza Carthy | |
301 | Trains and meals | Cooking, Trains, Slow cooker | |
1088 | Forty years ago | Personal, Sandy Denny, Heron | |
1183 | Intermediate thesis submitted! | DBA | |
1436 | Opening Word from a thread and displaying a file | Programming, Delphi, Threads | |
1550 | Appearances in my school's Chronicles | Personal, Bristol Grammar School |
No comments:
Post a Comment