Gulp was devoured!

If you get this message when you run gulp, you have installed devour which also provides a gulp executable that wraps Gulp and prints this message.

I was having problems building some assets for a project, and eventually discovered this after a lot of hair-tearing trying to figure out why nothing was building. Hopefully the search engines will pick up on this and give more useful results to the next person who has this problem.

Ethernet Aglets

…are technically known as 8P8C modular connectors. It took five of us to figure this out—everyone knew exactly what I was talking about, and nobody could think of the actual name for the things.

How to install NodeJS on Debian/Ubuntu systems using Ansible

Since I’ve had to figure out how to do this twice now, and the NodeSource instructions make this more confusing than it ought to be. Make sure you replace node_6.x with the appropriate version from the installation instructions and xenial with the results of lsb_release -s -c.

- name: NodeSource package key
    state: present
- name: NodeSource repository
    repo: 'deb xenial main'
- name: Install NodeJS
    state: present
    name: nodejs

How to split a git repository and follow directory renames

This is a mirror of my answer to this StackOverflow question.

I had a very large repository from which I needed to extract a single folder; even --index-filter was predicted to take 8 hours to finish. Here’s what I did instead.

Read more

Rendering a 3D shape with Python

A friend wanted to 3D-print a shape to demonstrate using calculus to find the volume of solids of known cross-section. The shape he wanted was a graph of $sin(x)$ vs $x^2$, where each vertical slice of the intersection was a square. Here’s the graph, with $y_1 = sin(x)$ and $y_2 = x^2$. The blue lines show the edge of each square. He couldn’t figure out how to do this in a CAD program (I’m not even sure if it’s possible), so he asked me if I could write some code to render it.

This post was written in literate Python. Download and run it yourself!

Read more

A Mad Scientist's Guide to Finite State Machines

This was my presentation for the 2015 BarCamp Rochester. Unfortunately I don’t have any notes for the presentation, as I did it more or less at the last minute and made up most of what I said on the fly.

Read more

Using Airbrake with Electron

Just a quick tip on how to use Airbrake to report errors in an Electron renderer process.

Read more

Unbound classpath variable: 'wpilib'

Our team runs into this every year, and every year I forget how to fix it:

Unbound classpath variable: 'networktables' in project 'TESTROBOT'. Unbound classpath variable: 'networktables' in project 'TESTROBOT'

I decided that this is the year I’ll write it down. (Probably now that I’ve documented it they’ll fix it next year.)

Read more

Little did Microsoft know...

(One penguin, to another) “I’ll trade you five herring for your Microsoft software.”

I found this image on the back of a Microsoft booklet from 1991 called Microsoft products for the Macintosh. This same book contains other gems such as:

My success at breeding captive animals can mean the difference between their survival or extinction. That’s why I use Microsoft Mail.

Grant Hutchinson noted:

Keep in mind that in this particular situation, the transaction would be based on the unit values present in the 1991 herring market. The same transaction today would need to have the equivalent herring value calculated at the current rate of exchange.

Use Visual Studio web.config transform for debugging

I have a Visual Studio project which is under version control and is developed by several people, all of whom need to have different database and logfile settings during development. Visual Studio has built-in support for Config Transforms for web.config files; all you need to do is right-click the web.config file in the solution explorer and click ‘Add Config Transforms’. However, these transforms are applied only when publishing the project, not when debugging it using Visual Studio.

The solution to this is to implement the config transforms manually with a pre-build task and leave the debug transform out of version control, so each developer can have their own copy.

Read more

FRC 2015 Control System Notes

These are notes I took while watching the FRC Behind the Lines episode “2015 Control System Beta Teams” ( They are organized into broad categories, but are otherwise not cleaned up.

Read more

Compiling SleepyHead on Ubuntu Trusty

I wanted to install SleepyHead on my new computer (running Ubuntu 14.04 Trusty), but there’s no package in the Ubuntu repositories. SleepyHead has instructions for building from source on their wiki, but they don’t tell you which packages you need, which is the difficult bit of the process. After some trial and error, I arrived at the following instructions, which worked for me and which I believe to be accurate.

Read more

Apache, mod_ldap, and 500 errors

I just finished setting up an Apache server with LDAP authentication. I got everything set up and restarted Apache, but when I loaded a page it blew up with an Apache 500 Internal Server Error. No problem, I thought, I’ll just check the logs. Absolutely nothing was being logged. After a lot of searching the Internet, trying things out, and hair-tearing, I eventually discovered that this is a known bug in mod_authz_ldap (#50630).

If your LDAP server is using self-signed certificates, the LDAP module silently fails without logging an error anywhere. To see if this is your issue, try adding the following line to your Apache configuration (remember to restart Apache afterward!):

LDAPVerifyServerCert Off

This will prevent the error from occurring, but also is less secure (someone could pretend to be the LDAP server and Apache would never know). If this is a concern, set LDAPTrustedGlobalCert to your LDAP server’s CA certificate.

Rendering HTML5 Video with Handbrake

For my video server project, I needed to be able to show HTML5 videos in a wide variety of browsers. I also didn’t want to have to keep multiple copies of the video in different formats (there were a lot of videos, and space constraints). The closest I could get was using MediaElement.js, which provides a Flash player fallback. You should be able to put an MP4 encoded with the [h.264] video codec on your page, and have it work anywhere. It turns out it’s not that easy. (iPads, for instance, need a specific sound codec as well.)

After a lot of research, I came up with the following settings for HandBrake, which will create a video that works (in combination with MediaElement.js) on most if not all browsers, looks good, and has a small size. I’ve tested it on Windows using Firefox, Google Chrome, and Internet Explorer, on Linux using Firefox, and on the iPad using Safari. If you don’t want to enter all of these settings manually, you can download a handbrake presets file instead.

Read more

Multinomial Probability Mass Function in TI-BASIC

Another TI-BASIC challenge proposed to me by the same person who asked me last time was to calculate the probability mass function of a multinomial distribution. The formula is:

$$\frac{n!}{x_1 \cdots x_k} p_1^{x_1}\cdots p_k^{x_k} \mbox{ where } n = \sum_{i=1}^k x_i$$
The naïve way of calculating this is to read $x_1$ and $p_1$ through $x_k$ and $p_k$ and then crunch the numbers. However, this necessitates a list to keep track of all the numbers and an extra loop at the end to crunch them. Since we don’t actually need the numbers, there’s an easier way.

Read more

Calculating the mode of a list in TI-BASIC

Recently, someone challenged me to write a program to find the mode (or modes) of a list in TI-BASIC. I picked up my TI-83+ and whipped this program up in about half an hour. Somebody else asked me for a copy, so I figured I’d post it on my website.

Read more