Skip to main content

Computer languages I learnt before university

I was thinking about the various languages I have learned over the years and why. Here they are in rough order. I don't think there's a great insight here, just a personal reflection.

Pre-teen

TURING/REGISTER MACHINE

Around age 6, I was sent to the Cavendish Laboratory at Cambridge University to a sort of camp for bright kids. I asked a man (undoubtedly a professor or lecturer from Cambridge) to tell me how a computer worked. This was the early 1970s and I'd only seen computers on television.

The man sat down with a piece of paper and drew a long strip of boxes and described a machine that looks at the boxes and decides what to do next. He also showed me a language for programming this strip-of-boxes-machine.

He had described both a Turing machine and also a register machine and I was absolutely fascinated: computers were so simple!

Teen

FORTRAN

My first hands-on time with a computer came via a teletype that no one seemed to touch. It was kept in the corner of a room at school and connected to some far away machine. But it was possible to program it in FORTRAN. I don't recall ever being told what machine I was typing to, only that it was possible to prepare simple programs in FORTRAN. I mostly wrote some simple mathematical programs (such as calculating the value of pi or factorials). Magic! (when it worked).

Pretty sure is was an ASR 33 Teletype like this:

By Bubba73 (Jud McCranie) - Own work, CC BY-SA 3.0

BASIC

The school entered the 'home computer' era with a Sharp MZ80K which I spent hours in front of first learning its BASIC so that I could write simple programs (including something called STATPAC which was a package for doing statistics: think, really, really simple R).

That machine still works and runs my old programs. The school was kind enough to let me take this computer home during the holidays. This was the first machine I knew inside out.



Z80 ASSEMBLY/MACHINE CODE

But to get any power from the machine it was necessary to learn Z80 assembly language (and the machine code since I didn't have an assembler to everything was typed in as opcodes hidden inside REM statements in BASIC programs). This didn't seem hard at all, more like a crazy game where the moves are limited and you have to work with them. I obtained a copy of Rodnay Zacks' Programming the Z80 at great cost and devoured it.



PASCAL

At some point the school got a network of Research Machines 480Z machines and on these we were able to program in BASIC and machine code. We later got an assembler and I wrote some quite large assembly language programs, such as one for scooping up network packets and analyzing them, another for spying on disk access and a complete 'network management' system.



But PASCAL was a bit of a revelation because suddenly programs that had been structured with subroutines (GOSUB or CALL) and rough and ready data structures were no structured with actual functions that operated on well-defined data. And there was a compiler.

FORTH and 6502 ASSEMBLY

I had a BBC Micro Model B (in fact I still do) and it, of course, I programmed in BASIC and 6502 assembly language, but FORTH suddenly became popular and I figured I had to try it out since this whole 'stack-based programming' thing seemed interesting. And FORTH on the BBC Micro was fast. It came on a ROM that was plugged into an expansion port.



I wrote a lot of fun programs in FORTH but it ended up feeling like an academic exercise. Fun but never going to really catch on. Of course, that's before I got to university and wrote things using Common LISP, ML and Occam :-)

Comments

Popular posts from this blog

Your last name contains invalid characters

My last name is "Graham-Cumming". But here's a typical form response when I enter it:


Does the web site have any idea how rude it is to claim that my last name contains invalid characters? Clearly not. What they actually meant is: our web site will not accept that hyphen in your last name. But do they say that? No, of course not. They decide to shove in my face the claim that there's something wrong with my name.

There's nothing wrong with my name, just as there's nothing wrong with someone whose first name is Jean-Marie, or someone whose last name is O'Reilly.

What is wrong is that way this is being handled. If the system can't cope with non-letters and spaces it needs to say that. How about the following error message:

Our system is unable to process last names that contain non-letters, please replace them with spaces.

Don't blame me for having a last name that your system doesn't like, whose fault is that? Saying "Your last name …

All the symmetrical watch faces (and code to generate them)

If you ever look at pictures of clocks and watches in advertising they are set to roughly 10:10 which is meant to be the most attractive (smiling!) position for the hands. They are actually set to 10:09.14 if the hands are truly symmetrical. CC BY 2.0image by Shinji
I wanted to know what all the possible symmetrical watch faces are and so I wrote some code using Processing. Here's the output (there's one watch face missing, 00:00 or 12:00, because it's very boring):



The key to writing this is to figure out the relationship between the hour and minute hands when the watch face is symmetrical. In an hour the minute hand moves through 360° and the hour hand moves through 30° (12 hours are shown on the watch face and 360/12 = 30).
The core loop inside the program is this:   for (int h = 0; h <= 12; h++) {
    float m = (360-30*float(h))*2/13;
    int s = round(60*(m-floor(m)));
    int col = h%6;
    int row = floor(h/6);
    draw_clock((r+f)*(2*col+1), (r+f)*(row*2+1), r, h, floor(m…

Importing an existing SSL key/certificate pair into a Java keystore

I'm writing this blog post in case anyone else has to Google that. In Java 6 keytool has been improved so that it now becomes possible to import an existing key and certificate (say one you generated outside of the Java world) into a keystore.

You need: Java 6 and openssl.

1. Suppose you have a certificate and key in PEM format. The key is named host.key and the certificate host.crt.

2. The first step is to convert them into a single PKCS12 file using the command: openssl pkcs12 -export -in host.crt -inkey host.key > host.p12. You will be asked for various passwords (the password to access the key (if set) and then the password for the PKCS12 file being created).

3. Then import the PKCS12 file into a keystore using the command: keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks -srcstoretype pkcs12. You now have a keystore named host.jks containing the certificate/key you need.

For the sake of completeness here's the output of a full session I performe…