Recent Posts

Tools for Studying Computer Science

1 minute read

I’ve recently been putting a lot of hours into levelling up my computer science and coding, mostly covering Python, Tensorflow, machine learning, and a few little projects to scratch personal itches.

Over the past few weeks I’ve got a nice little workflow going. Here are some of the things I do:

Make the Most of Free Resources

I’ve been using Coursera for their course on Nand2Tetris, and MIT’s Open Courseware for their courses on Python and data science. I’m especially a fan of MIT’s offering because it doesn’t ask for you to sign up – something that’s more of a concern in these days of massive Facebook data breaches.

Pop Out Youtube Videos

While the above sites are good, I have to keep their page open in my browser to view the video on my laptop screen. Luckily MIT’s videos are all on Youtube too, so I use the Youtube Popout Player extension for Firefox. With that, and my Linux desktop allowing me to keep certain windows on top, I can play the video in the corner of my desktop while focusing on the code in my editor.

Use Jupyter Notebook

I’d played with Jupyter a fair bit before, but didn’t really see the point. Why bother when I have Sublime Text?

But since we use Jupyter at Remix, I thought I should play with it a bit more, and I’m starting to fall in love, especially with their tab completion and special commands. It’s a bit of a pain to set up if you’re unfamiliar with Docker or the command line, but well worth it. Having said that, I wouldn’t say it’s great for everything. Learning coding and data science? Sure. Building programs that do file IO, web serving, or need GUIs? Maybe not so much.

Now I’ve started playing with JupyterLab, the next generation of Jupyter Notebook. It’s even more of an IDE, and I’m just getting started learning the new features. So far, so good!

Stuff I’ve Been Learning and Doing Recently

1 minute read

Object-Oriented Python

I’ve been programming for quite a long time, but always in an ad-hoc, pick-it-up-as-I-go fashion to fix a specific problem I was having. That generally meant procedural programming, and relying on copy-pasting examples to use anything like objects. But in the past week or so I really focused on upping my game. I’ll be using objects a lot more from now on – I can’t believe it took me this long to get into it!

I can really recommend MIT’s 6.0001 Introduction to Computer Science and Programming in Python if you want to learn this stuff yourself.

PowerPoint Translation Utility

Using my new object-oriented superpowers, I put together a quick and dirty command line utility to translate PowerPoint files from one language to another. Very useful for dealing with Chinese PowerPoints sent by my colleagues! Not perfect yet, but translated about 80% of an example PPT.

NumPy and Pandas

A couple of Python libraries for scientific computing and dealing with matrices and tables of data. I’ve been trying to muck about with TensorFlow recently, but not getting far. Understanding these more fundamental mathematical libraries helps a lot.

Jupyter Notebooks and ipython

IPython is a nice way of testing out Python programming and libraries. Lots of autocomplete and help functionality, and runs in my terminal. Jupyter is the web-based successor, but means a bit more overhead and faff to set up. Now I need to see how to get ipython working with Python 3

Flower Classifier

I built a flower classifier using TensorFlow. Well, when I say “built”, more “followed instructions”. I’m planning on digging much deeper in TensorFlow in the coming weeks.

NAND2Tetris

NAND2Tetris is a course that teaches you to build a modern computer from first principles, starting at the most basic logic gates. It’s a lot to take in – Boolean algebra, assembly code, multiple levels of abstraction, &c &c. I’m taking a break from it for a little bit to focus on higher level stuff (some of which I described above), but relish the chance to get back to this course.

Throwback Thursday: A Story About ‘Magic’

3 minute read

Though our field of computer science is still relatively young, it has lots of wonderful (and sometimes naughty) stories in its short history.

This one is taken from The Jargon File by Eric S. Raymond 1

Some years ago, I (GLS) was snooping around in the cabinets that housed the MIT AI Lab’s PDP-10, and noticed a little switch glued to the frame of one cabinet. It was obviously a homebrew job, added by one of the lab’s hardware hackers (no one knows who).

You don’t touch an unknown switch on a computer without knowing what it does, because you might crash the computer. The switch was labeled in a most unhelpful way. It had two positions, and scrawled in pencil on the metal switch body were the words ‘magic’ and ‘more magic’. The switch was in the ‘more magic’ position.

I called another hacker over to look at it. He had never seen the switch before either. Closer examination revealed that the switch had only one wire running to it! The other end of the wire did disappear into the maze of wires inside the computer, but it’s a basic fact of electricity that a switch can’t do anything unless there are two wires connected to it. This switch had a wire connected on one side and no wire on its other side.

It was clear that this switch was someone’s idea of a silly joke. Convinced by our reasoning that the switch was inoperative, we flipped it. The computer instantly crashed.

Imagine our utter astonishment. We wrote it off as coincidence, but nevertheless restored the switch to the ‘more magic’ position before reviving the computer.

A year later, I told this story to yet another hacker, David Moon as I recall. He clearly doubted my sanity, or suspected me of a supernatural belief in the power of this switch, or perhaps thought I was fooling him with a bogus saga. To prove it to him, I showed him the very switch, still glued to the cabinet frame with only one wire connected to it, still in the ‘more magic’ position. We scrutinized the switch and its lone connection, and found that the other end of the wire, though connected to the computer wiring, was connected to a ground pin. That clearly made the switch doubly useless: not only was it electrically nonoperative, but it was connected to a place that couldn’t affect anything anyway. So we flipped the switch.

The computer promptly crashed.

This time we ran for Richard Greenblatt, a long-time MIT hacker, who was close at hand. He had never noticed the switch before, either. He inspected it, concluded it was useless, got some diagonal cutters and diked it out. We then revived the computer and it has run fine ever since.

We still don’t know how the switch crashed the machine. There is a theory that some circuit near the ground pin was marginal, and flipping the switch changed the electrical capacitance enough to upset the circuit as millionth-of-a-second pulses went through it. But we’ll never know for sure; all we can really say is that the switch was magic.

I still have that switch in my basement. Maybe I’m silly, but I usually keep it set on ‘more magic’.

1994: Another explanation of this story has since been offered. Note that the switch body was metal. Suppose that the non-connected side of the switch was connected to the switch body (usually the body is connected to a separate earth lug, but there are exceptions). The body is connected to the computer case, which is, presumably, grounded. Now the circuit ground within the machine isn’t necessarily at the same potential as the case ground, so flipping the switch connected the circuit ground to the case ground, causing a voltage drop/jump which reset the machine. This was probably discovered by someone who found out the hard way that there was a potential difference between the two, and who then wired in the switch as a joke.