Skip to main content

Overthinking conference admin

At the moment I'm busy organising the EAMS 2022 conference. This is the fifth time the conference has run, and the third time fully online.

I'm pretty comfortable with what needs to happen now, and so far it seems to be going smoothly.

Over the years I've gradually automated more and more of the admin. I thought it might be interesting to write up what I've done.

This is very much a 'CLP knows how to write scripts to do things, so has done that' situation, rather than something I've done out of absolute necessity.

Do what works for you, I suppose!

Read more…

Thinking about typing mathematical notation on a phone

This post is incomplete; I'll change it and add to it as I work on this problem.

I'd really like to be able to type mathematical notation on my phone.

There are many contexts in which I'd like to do that: writing blog posts; posting on social media; taking notes for myself.

At the moment, whenever I want to toot something on mathstodon.xyz with maths in it, I wait until I'm at my PC, because writing TeX on a touchscreen keyboard is such a pain.

I'd also like to question some of the fundamentals about how TeX works, and investigate if there are other way that work just as well or better.

I've had a go at implementing some of these ideas.

Read more…

Tractor Befunge

Befunge is a classic esoteric programming language. The idea is that it's a bit like a Turing machine, but instead of the instruction pointer moving along a one-dimensional tape, it moves around a two-dimensional grid.

A happy image occurred to me of the instruction pointer as a tractor, driving around a field.

So I decided to make it happen!

I found a really nice pixel art editor called Pixelorama, which I used to draw a v v shonky tractor, patches of grass, and bales of hay representing numbers on the stack.

It's cute!

The controls were more complicated than I expected. I wanted everything to feel as "in the world" as possible, so the program should be edited by interacting with the graphics rather than typing in a code box. I ended up giving the caret a direction, so it's just as easy to type upwards or backwards as it is left-to-right. To avoid having a "reset" button, you can just pick the tractor up and move it, and right-click to empty the trailer.

Other Life stuff came up before I was completely finished with it, but I'm quite happy with my cute Turing-complete tractor.

It's online at somethingorotherwhatever.com/tractor-befunge, and the source code is on GitHub.

Kdenlive for video

I used Kdenlive to make a new Numbas demo video.

I was pleased with how easy it was.

  • Wrote a script, using the old video and the text from the Numbas front page.

  • Did some screen recordings to cover each of the bits.

  • Made 1920×1080 images using the drawings from the front page.

  • Recorded the script in gnome-sound-recorder.

  • Dragged all the files into kdenlive.

  • Cut out just the bits I wanted from the videos and the sound by making zones: play a clip, press I to set the start point, and O to set the end point, then Ctrl-I to save that as a zone.

  • Eventually realised V inserts the selected zone into the timeline.

  • Dragging things around on the timeline is easy. The move tool with M shifts a contiguous block of things around to make space.

  • Worked out that you can trim bits by dragging their sides in the timeline, and add fades or wipes by clicking the dots that appear in the corners of a clip.

Uploading an Ubuntu screen recording to Mastodon or Twitter

I used the new screen recorder in ubuntu 22.04 (I think it's really the Gnome 3 built-in recorder) to record my screen, then wanted to share it on twitter and mastodon.

It produces a webM file with a lot of missing metadata, so I had to convert it. A lot of searching finally got me something that worked.

First, make an mp4 with a fixed frame rate:

ffmpeg -i recording.webm -c:v libvpx-vp9 -minrate 2M -maxrate 2M -b:v 2M -pix_fmt yuv420p -r 16 recording.mp4

This makes something that mastodon will accept. Twitter won't, so you need to convert that. I also had the problem that my video was an odd number of pixels wide, so I did this:

ffmpeg -i recording.mp4 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" recording.twitter.mp4

Since I'm probably going to do this a few times, I've put these steps in a script in ~/bin/convert-screencast, which finds the most recent recording and converts it to mp4:

#!/bin/bash

LATEST=`ls -tr ~/Videos/Screencasts/Screencast*.webm | tail -1`
OUT=${LATEST%.webm}.mp4

ffmpeg -i "$LATEST" -c:v libvpx-vp9 -minrate 2M -maxrate 2M -b:v 2M -pix_fmt yuv420p -r 16 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" "${LATEST%.webm}.mp4"
echo $OUT

This site is now sort of static

checkmyworking.com has always been powered by WordPress, but every now and then it’s fallen victim to annoying hacks that manage to write some spam nonsense at the top of all my PHP files. From what I can tell, WordPress and the few plugins I use are such a labyrinthine mess of code that going through and closing security vulnerabilities would be a sisyphean task.

So, I’ve taken the nuclear option – this site, as served to the wider web, is now entirely made up of static files. Hopefully, that’ll stop the hacks – there’s no PHP to abuse, leaving only any vulnerabillities in Apache or Media Temple’s account management as potential ways of getting in.

The static files are generated by Spress, which seems to be one of the least opinionated static site generators I’ve come across. It was very easy to make it produce pretty much exactly the same pages WordPress does.

I still wanted the nice editing interface WordPress provides, so I’ve made a plugin which exports posts from WordPress to the Spress source directory whenever I update them. I’ve got the WordPress installation hidden somewhere private, behind a very simple login script which stands in the way to make sure that nobody else can run WordPress code. This way, I can write posts in WordPress, and the plugin automatically rebuilds the site for me. The one compromise is that I can’t do comments any more – my current line of thought is that I’ll write a script to add comments to the WordPress database which would be simple enough to satisfy myself that it’s more secure than going through WordPress itself.

For the moment I’ve kept the layout of the site as it was, but it’s looking very old now so I’d like to redo it at some point. I don’t really post here any more, so it’s entirely possible that this’ll still be the top post in a few years’ time.

Next job is to do the same thing to The Aperiodical, which will take a lot more work!

Pattern-matching syntax trees

I’m doing some very fun things with pattern-matching syntax trees today.

For context: I write a computer-based assessment system called Numbas, and it’s focused on assessing mathematics. A big part of that assessment involves asking the student to enter an algebraic expression as the answer to a question. How do you decide whether to mark the student’s answer as correct or not? Historically, there have been two approaches, given a representative “correct” expression written by the teacher:

  • Put the student’s answer and the correct answer into a canonical form. If their syntax trees are exactly the same, then the student’s answer is the same as the teacher’s. This is the model used by, for example, STACK.
  • Identify the variables used in the student’s answer and the teacher’s. Pick a few random numbers as values for those variables, and evaluate both expressions. If they come out to the same number, then the student’s answer is the same as the teacher’s. This is the model used by systems in the CALM line.

Read more…