A blast from the past

Sunday August 14, 2005

I’ve had a real, fun day today, doing something I’ve not done in a long, long time. I wrote a computer program.

Now, the reason I’ve not been writing the things is simply that I’ve not had a need. When I retired I thought for a while that I could turn programming into a hobby, self-justifying in itself. That failed because I had a problem with the activity that I was unable to solve then or since. It’s simply that, after a career in computing, I have a conditioned need for a reason to write a program, not simply to justify the time and effort needed to produce one but also to provide me with the motivation to sit down and do it.

Today the need came up and slapped me in the face. I made a major fumble last night in modifying the journal files and creating a new one for the day’s new entry. Didn’t see it until it was too late, and had to scramble hard to recover a couple of files from the server and work through the mess to restore things to a normal working state. It’s not the first time it’s happened. Although it’s a relatively easy daily task, reduced with usage to a routine I can accomplish in a couple of minutes, running on auto-pilot, it takes no more than the click of a wrong button in the text editor to foul things up. Nor is it a major calamity because I can always restore from the server, or from my daily backup if I can’t get to the server.

It did make me stop and think, however. This was a routine daily update. If it had happened at a month-end, or even worse, at a year-end, recovery would be a lot more involved. And tedious. If it were to happen on a day when my marbles were taking a holiday, there’s the slightest, most remote possibility that I’d get stuck altogether.

This is the reason I’m working in the background on selecting and customizing a Content Management System, like Word Pad, so that the whole process is automated. I’m having a problem with this, but that’s one for another day.

For today, though, I thought wistfully of the position, a couple of re-designs back, when I had a Visual Basic script I made to automate the process of creating and maintaining my local journal files. That lapsed, and now I find that my Visual Basic install has gone missing and that, although I could reinstall from the old CDs, it appears that Microsoft has dropped support in favour of some new, horridly expensive alternative called .NET, I think. I’ve looked at that and come to the conclusion it’s a route I don’t want to tread. I don’t like ‘Visual’ programming, making boxes and windows and using complicated controls to achieve a simple job I could knock together in an hour in the old days, using PL/I, FORTRAN, or COBOL, or BASIC, or even BAL.

I almost gave up at that point. Sitting with a somewhat disinterested Dolly the Mega-Cat over my morning coffee today, I had a brain-wave. Perhaps there was an alternative, not too expensive, perhaps even free. I’d seen mention of other BASIC interpreters somewhere or other. Perhaps I could find one and use it the old fashioned way to write what is really quite a simple utility program. That way I’d have nothing, or not much, to learn, and I could get the job done in a day. Or two.

Goggle came to my aid and I discovered Liberty Basic, free to try, and cheap to buy. The download and installation took less than five minutes and there I was, provided with a fully functional BASIC installation that works just as the old QBasic did, almost, but within Windows. Joy! Even more joyful, I found all my old BASIC programming knowledge, dating back almost fifty years, still there in my head, still functional, and needing only a quick dust and the application of a little oil to be ready to code. I could have gone the C++ route just as easily, but there’s a cosy, familiar feel to good old BASIC, reminding me of many happy days when my programming was done at a telex-style typewriter terminal connected to a time-sharing mainframe.

So I pulled out a pad, sketched the outline of the program I need, and started coding. And drinking coffee. And coding. And spending far too much time sitting at my computer.

At the end of the day, quite late, I fetched up with a functional first version, pushed my chair back, and contemplated the result. Neat. Crude, but neat. When I’ve finished I shall be able to invoke the program and let it do everything for me, including month-end and year-end tasks, in seconds but, more importantly, without the possibility of error.

And that was my day. Head down, coffee jug constantly replenished, and hours and hours of happy, concentrated work. Bit of a blast from the past, really.

 

' **************************************
' Set date variables from current entry:
'       mm$ dd$ yyyy$ from filename;
'       ddd$ & mmm$ from entry file
' **************************************

dd$ = mid$(t2$,7,2)
mm$ = mid$(t2$,5,2)
yyyy$ = mid$(t2$,1,4)

open currententryfilename$ for input as #1
while eof(#1) = 0
    line input #1,a$
    if instr(a$,"<!-- t01 -->")  0 then
        ddd$=""
        i=17
        while mid$(a$,i,1)" "
            ddd$=ddd$+mid$(a$,i,1)
            i=i+1
        wend
        mmm$=""
        i=i+1
        while mid$(a$,i,1)" "
            mmm$=mmm$+mid$(a$,i,1)
            i=i+1
        wend
        exit while
    end if
wend
close #1

The way it used to be

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s