My first Python code

For a challenge I’ve tried to teach myself the Python programming language. It’s a big language with many features which I, as an ex-programmer from many decades ago, am unfamiliar with. But I’ve managed to write and test the code below, though I’m not sure I want to take this much further. I’ll see…..

import csv
from datetime import datetime
from operator import attrgetter
# A re-creation of my Reminder program from several decades ago!! My first Python program!
# Version 0.1 04-Mar-2021 In the beginning
# Version 0.2 07-Mar-2021 In the beginning 
# Version 0.3 07-Mar-2021 I'm finally happy!
class Reminder:
    def __init__(self, myRec):
        self.Date = myRec[0]
        self.DateTimeConversion = datetime.strptime(myRec[0],"%d-%b-%Y")
        self.Message = myRec[1]
# Function GetReminderData to get the reminder data
# Read each record in the file
# Ignore any blank lines 
# Add each record to the list myReminders
def GetReminderData(myFile,myReminders) :
    with open(myFile) as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=',')
        line_count = 0
        for rec in csv_reader:
            if rec == []:
                line_count += 1
                p = Reminder(rec)
# Function HowManyDaysDifference to get the number of days between today's date and a text date
# This is my weird code - what a palaver!
def HowManyDaysDifference(TextDate):
    today_object =
    mydate_in_datetime = datetime.strptime(TextDate,"%d-%b-%Y")
    tdiff = mydate_in_datetime - today_object
    diff_in_days = tdiff.days
    if diff_in_days >= 0:
        diff_in_days += 1
        tdiff = today_object - mydate_in_datetime
        diff_in_days = -tdiff.days
    return diff_in_days
# Function PrintList to nicely print the data
def PrintList ():
    mySectionSeparator = "-" * 75
    tChange = True
    print ("\n" * 10 )
    print ("         Welcome to my Python Reminder program!")
    print (mySectionSeparator)
    for i in sorted(myReminders, key = attrgetter('DateTimeConversion')):
        nDays = HowManyDaysDifference(i.Date)
        if tChange and nDays > 0:
            tChange = False
            print (mySectionSeparator)
        if nDays == 0:
            t1 = "     Today    "
        elif nDays == -1:
            t1 = "   Yesterday  "
        elif nDays == 1:
            t1 = "    Tomorrow  "
        elif nDays < 0:
            t1 = '{:4d}'.format(-nDays) + " days since"
            t1 = '{:4d}'.format(nDays) + " days until"
        t2 = i.Date +t1
        print (t2,i.Message) 
    print (mySectionSeparator)
# This is the MAIN  program
myFile = 'C:/Users/Mike/Documents/Documents/MyPythonCode/Reminder.dat'

myReminders = []

GetReminderData(myFile, myReminders)


And the output is….

How to Remotely Troubleshoot Your Relative’s Computer

I have a friend who occasionally rings me up with his computer problems. Yesterday he called to say his annual anti-virus licence was going to expire that day. He confessed to having ignored the renewal reminders!

My experience with renewing McAfee anti-virus licences is that a) renewing from McAfee is ridiculously expensive, and b) not renewing from McAfee is never straightforward. My friend took my advice and went for the second option and purchased a McAfee licence from another company ( Inevitably the update wasn’t straightforward and wasn’t successful, hence his call for my assistance. In normal times I would probably have gone to my friend’s home, but these are not normal times.

I searched the web for how to remotely take control of someone’s computer and came across a very helpful page on the PCMag site “How to Remotely Troubleshoot Your Relative’s Computer“. Although I’ve had a career in IT support I’d never needed to do this before and this web page proved a godsend. The section on using a Windows 10 PC to take control of another Windows 10 PC was very straightforward and uses the Quick Assist tool (found under Windows Accessories). Having taken remote control of my friend’s PC I was able to install the new licence for his anti-virus software, though it wasn’t straightforward!!😎

Claude Shannon

I’m currently reading “The Idea Factory – Bell Labs and the Great Age of American Innovation” by Jon Gertner. It’s a Christmas present from my Berlin son and what a great choice it was! Bell Labs became an enormous laboratory for developing ideas and inventions at the start of the communication, information and technology industries we now take for granted. This book tells the history of Bell Labs and the leading engineers, scientists and managers.

Claude Shannon was one of those scientists and who has become known as ‘ the father of information technology’. I have a vague recollection of hearing about his work whilst I was studying for a computer science course. Now, some 50 years later, he appears in this very readable history of Bell Labs. Brilliant man that he was, it’s prompted me to look for a biography, and “A Mind at Play: How Claude Shannon Invented the Information Age” by Jimmy Soni and Rob Goodman has been well reviewed.

The biography is now on order from Postscript Books, a new mail-order company to me and which had the best price. I’ve added them to my menu of Links / Amazon alternatives. Their About page says “Most of our books are publishers’ overstocks and backlist titles…..Postscript has developed over the last 30 years, starting in south-west London in 1987 and then moving to south Devon in 2011“. An interesting business to find.


I have been known to put in a false date of birth when creating a website account. Sometimes there’s no good reason why a particular organisation should have this piece of key information.

So when my DOB was rejected when trying to log into an old, redundant Apple account (so I could remove it), I wasn’t too surprised.

But after several abortive attempts at alternative solutions to the problem I discovered that my DOB was acceptable if I entered the day as the month and the month as the day. ie My DOB had been recorded as the 4th November rather than the 11th April.

I guess it’s an American v British date thingy.

Tinkering with line height

I’m very fond of tinkering with the format and layout of my blog! My previous post is somewhat rambling and I wasn’t too happy with the line spacing – it just seemed too spaced out. The solution was straightforward. Simply wrap the text of the post in the following:

<div style="line-height: 130%;">
blah blah blah........
blah blah blah........
blah blah blah........

For comparison, see below for how the line spacing of the main paragraph would look if it was given the same treatment.

I’m very fond of tinkering with my blog. My previous post is somewhat rambling and I wasn’t too happy with the line spacing – it just seemed too spaced out. The solution was straightforward. Simply wrap the text of the post in the following:

For blogs which use a different font and font size, the 130% may need to be revised. Interestingly, when I look behind the scenes, the original text has a line height of 1.75em whilst the formatted text has a line height of 130%. Now “em” is a typographic unit of measurement that is harder to understand than Einstein’s Theory of Relativity, so I’m happy to stick with using a percentage to alter line height.

[As an aside, I had to tinker with the height of the robot image in order to make it a square image (don’t ask) so this post is about height in more than one way.]

I’m feeling better this morning

I’m feeling better this morning!

Firstly, my cold, which is in its fourth day, is on the turn.

Secondly, I’ve managed to fully charge my laptop! I’ve been struggling to charge it because of wonky connections and I’d become resigned to replacing the machine. But last night I found the old unreliable power cable and it works better than the new unreliable power cable. This means the pressure is off to find a replacement laptop. Yippee!

So why do I need to replace the laptop if it’s just the power cable that’s faulty? Well it’s because it appears to be more a case of the cable becoming unreliable because of all the wiggling required to make it work in a wonky power connector inside the laptop. I’ve youtubed (made up verb) how to fix a wonky power connector and it’s beyond my skills and I don’t suppose I could get it fixed externally for less than £150 (including another new cable). So I’m resigned to having to replace my trusty 2011, Samsung laptop, although this morning’s success with the old cable eases the pressure.

I’ve started to look at new laptops, and it’s so hard! In the old days you would pop into a store and choose from a limited range. Now, online, there’s hundreds, with multiple options and configurations. I thought I’d identified a suitable Dell laptop, but the curse of the Internet throws up lousy reviews regarding the quality of the screen. It’s a nightmare making decisions in the 21st century, particularly having been brought up in an era when there wasn’t much choice.

On the subject of past eras, I’ve just started reading Alan Johnson’s third memoir, The Long and Winding Road.

Having a cold allowed me to zip through All the Old Knives, by Olen Steinhauer. I’m not really into spy novels but this is a terrific read. Most of the story takes place around a meal, where two former lovers vie to discover / hide the truth. It’s a tense, well written, highly enjoyable read.

Still tinkering

I used to be a computer programmer and I haven’t lost the pleasure to be had from figuring out how to alter or fix anything related to software. Nowadays this is likely to be exploring web design using HTML and CSS rather than writing computer code.

Using CSS within WordPress it’s possible to alter the design of a blog (providing you’ve paid a little extra for the upgrade). It can sometimes be quite a challenge. Here is an example of before and after screenshots of some recent changes I made to how an image gallery is displayed. I wanted to remove the Comment area, the view full-size option, as well as to centre the description text and to emphasise the ‘close gallery’ icon at the top. For the really curious, a screenshot of the CSS code is also shown.

Before CSS edits

After CSS edits

The CSS code!

It looks like a UK web site, but….

buyerbewareWhilst looking to source a camera battery I came across a web site with a web address and which in every respect looks like a UK web site.

But on the About page it states….

“We digsin to provide thoughtfully server for every battery buyers.”

I’m not sure what was intended, but it makes no sense to an Englishman! A simple check using shows the company is located in China!