Categories
General

Hilbert curves

In an attempt to further harass postscript printers, I hacked the postscript l-system which I wrote, err, a long time ago, so that instead of trees it draws hilbert curves. Then it occured to me to animate it, starting from a straight-ish line, and gradually folding it in, increasing the turn angle until it reaches 90 degrees. Kinda pretty. Makes me wonder how long the piece of string gets when it’s straightened out; might hack the postscript file to tell me that later.

Categories
General

CS question: calculus vs algebra

I have never been sure if calling something a “calculus” as opposed to an “algebra” is intended to communicate something important in computer science. For example, people talk about the “lambda calculus“. But they also talk about “process algebras“. What’s the key property that would make some system a ‘calculus’? Or is it an arbitary naming choice, just indicating the personal preference of the creator?

Categories
General

Notes from Milner Symposium

First-hand anecodote on the naming of the pi-calculus, courtesy of John Power. Robin Milner viewed it as a successor to the lambda calculus. What comes after lambda in the greek alphabet? Mu, but there was already a mu-calculus. Nu comes next, but sounds too similiar to mu. Next up is omicron, but who’d want to work on the “omicron calculus”?! And so you get to pi. PI CALCULUS.

GĂ©rard Huet’s opening talk was amazing. He talked flowingly for 40 minutes, entirely from memory. He talked about the early days of ML, including the ‘split’ between Standard ML and the INRIA caml/caml-light/ocaml. He described being asked by Milner to rename the INRIA flavour of ML after the Standard ML effort, and then cheekily naming it CAML, ostensibly because of the Categorical Abstract Machine but usefully keeping ML in the name.

I really enjoyed Xavier Leroy’s talk about a future in which programming languages and theorem provers increasingly blend into one – an area which I keep meaning to get deeper into. I also thought Benjamin Pierce’s talk was really appropriate for the occasion – taking the time to walk through the Hindley-Milner (or Milner, or Damas-Hindley-Milner) type inference algorithm in detail.

Categories
General

Another eclipse extension

Like this person, I often want to surround the eclipse selection with parens. For example, “42” becomes “(42)” with the cursor before the first paren, ready to turn into “foo(42)”. Combined with eclipse’s structured selection, this is pretty handy. For the last while, I’ve used a template for this. It requires a few keystrokes though, so was a prime target for optimization.

So tonight I threw together an extension called Parens which does it in a single keypress. The surprising thing was that it worked perfectly first time I ran it. This never happens!

I’m starting to like customizing eclipse. it’s not quite as ‘discoverable’ as emacs is .. largely due to it’s modular nature and careful dependency tracking. However, given that emacs’s lack of modularity and dependency tracking drive me mad, I can’t complain too much.

Categories
General

Remote android

I’ve got an HTC Wildfire, but text input is pretty dire. Even with a swype-style keyboard, it’s still too laggy to do things quickly. I could send texts twice as fast on my old phone which had real keys.

However, I do spend most of my life at a computer with a full keyboard. Recently, I tried out some apps (eg. Airdroid) which start a web server on your phone and let you control it via a browser. That’s pretty cool, but often my phone is connected to a wifi behind NAT, and my computer is connected to a different part of the network. NAT == no server. Also, my phone gets a random IP address each time it joins wifi, so there’s not a stable network name for ‘my phone’.

So, I decided to fix the problem. If NAT means my phone can’t be a server, then my phone needs to dial out to the outside world. It needs to meet up with my computer somewhere and exchange messages. Sounds like a chat server? That’s what I thought. So, I set up a private jabber server on t’internet and wrote a new android app for my phone. The app connects to the jabber server as “phone”. I connect to the jabber server like normal from my computer as “andy”. By striking up a conversation with my phone (!), I can instruct it to do a bunch of stuff. So far, it can send SMS’s, start beeping, vibrate and report its location. The app is smart enough to reconnect to the jabber server whenever wifi becomes available, which means it’s connects automatically when I go to work or arrive home – the main times at which this is useful. It also means if I lose my phone (at home or work) I can cause it to beep (ala WheresMyDroid).

I thought about adding the reverse direction – ie. if the phone receives an sms, it routes it to jabber – but I don’t have a pressing need for that yet so I’ve not added it.

This was an interesting project. Jabber/XMPP was a pragmatic solution. I originally planned on doing a custom socket protocol, using SSL/SASL for encryption/authentication. But then I’d need to handcraft a “command sending” application and carry it around. I’d also need to make it robust – automatic reconnections etc. I also looked at using various “message queue” technologies as the hub instead of jabber. They’d all work, and I kinda like queues, but there’s no need for that rich a feature set. Jabber is fine.