Radio Buttons and Devops in Org Mode

Regular readers know that I am very enamored of Howard Abrams’
excellent post and video on literate devops. It’s not that my duties
include devops; rather it’s that the methods he demonstrates are
applicable to a wide range of problems that we encounter in the
technical fields. The idea of maintaining a little “notebook” that
describes a problem and its solution—along with any code used in that
solution—is a very powerful technique. It’s one I’ve been trying to
apply in my day-to-day tasks.

It turns out that Matúš Goljer (Fuco1) feels the same way. He has a
really great post that begins by sketching out a typical use of the
technique. He was working on a personal version the app stack where
the problem occurred and wanted to repeat the process on the staging
and production systems. Everything was the same between the systems
except the port number used to access the pertinent database.

Easy enough, just change the port number and rerun things. But that
port number was used in several places so rather than replace them all
he made another code block that returned the port number and accessed
it with org-babel-ref-resolve in every code block that needed it.
Now he simply needed to change the port number in one place to access
any of the systems.

He works with a lot of systems so it became difficult to remember the
port number for any given system. He solved that problem by adding a
list of port numbers above the code block that returns the needed port
number. Then he thought that, gee, that looks just like a set of
buttons that I should be able to click on to choose the right port.
What he really wanted, of course, was a list of radio buttons. Org
doesn’t support that but John Kitchin had a post with some code for
doing it.

Fuco1 refactored Kitchin’s code, packaged it up on GitHub, and then
used it in his notebooks. Now when he wants to run things on a
different system, he just clicks on the target system and everything
else is taken care of. This is a really brilliant solution and his
post is a must read for anyone who want to use Abrams’ techniques in
their own work.

Update [2018-03-11 Sun 14:44]: Matus → Matúš.

This entry was posted in General and tagged , . Bookmark the permalink.