^(((0|1)\d)|(2[0-3])):?[0-5]\d$

No, it’s not a sanitized version of what I would say if I were to hit my thumb with a hammer.

I’ve been doing some computer programming and I’m using a lot of what are called “regular expressions” to ensure the users entered correct data to the program.

A regular expression is a template used by a “regular expression engine” (a computer program) to decide if some text presented to the “engine” matches a user supplied template.

The concept is quite powerful because the characters to check do not need to be known in advance. So, one can do things like “check to see if what was input was a specific number of letters followed by some optional characters, but the set of optional characters depend on something else within the characters being considered. but only if”… well you get the idea.

What I needed to do was to decide if a user provided the computer program with a set of characters that could be considered a valid time of day in 24 hour format.

This is not as easy as it seems. There must be four digits with an optional : character between the second and third digits. No other characters are allowed. But wait, there’s more. If the first character is a 0 or 1, then the second character can be any single digit, but if the first character is a 2, then the second character is limited to values in the range of 0-3. The third character is always limited to values in the range of 0-5 and the final character can be any single digit.

Any violations to the above criteria means the number can not be considered a valid time in 24 hour format.

It took me about 5 minutes to get the above stuff to work and I was pleased with myself.

I still can’t decide if that looks like what I said when I realized that I have a bunch of date-time calculations to do (that is a huge mess) or when I realized that “despite it being ‘only yesterday’ when I was 20…I’m over 60 years old.”

Linux

I grew up in the computer age when it could safely be assumed that the bandwidth of an internet connection was measured in bits per second…not gigabits per second…not megabits per second…nor even kilobits per second….but bits per second.

Because we knew that bandwidth was a scarce commodity, we were careful to ensure that we didn’t try to use the entire network bandwidth and we were also careful to make sure that minimum amount of data was moved.  It probably took twice as long and required twice the effort to write the software, but we had to do it.

Fast forward to today.  I think most software writers assume that bandwidth is nearly unlimited and that there is no concern for the amount of data that is moved across a network.

My example of this  is Microsoft Windows 10.  Each day, I turn on the computer, it opens more than 25 connections to a server that, according to the whois records, belongs to Microsoft Corporation.  This ends up saturating my internet connection.  If I’m lucky, it only lasts for a few minutes.  If, like today, I’m unlucky, this will go on for several hours.

I live far enough out of the city that my best internet connection speed is 1.8Mbps and until the processes finish their connections to Microsoft, my internet experience reminds me of back in the day when Teletype Model 33 and 35 ASRs were pretty much all that was commonly available for use.  These ran at 110 bits per second….for text, which is all they printed, that is 10 characters per second!

I will probably head to the thrift store to see what is available for “old” laptops under $20 and see how well Linux runs on it.

For what it’s worth, my favorite distribution is Slackware Linux.  I use it at work on some test servers that I operate.