Archives for the ‘Programming’ Category

Some interesting sorting algorithms

Walking back from Falafels today with CS majors, we somehow began discussing strange sorting algorithms. A good sort to know (not really) is bead sort. Imagine you have a bunch of beads on rods, like an abacus, and cross-wise they represent numbers. If you simply tilt the whole thing over, then gravity will let them […]

git-dude, meet hg-dude

Git-dude is a cool little thing. Given a directory of git repos, it continually fetches updates and displays a popup if you get any new commits. When I first saw it on Google Plus, somebody inexplicably commented, “This is a neat thing and I dont [sic] think there is a mercurial equivalent.” Given that Git […]

iOS keycodes in Javascript

Here are the iOS keycodes for the keyDown and keyPress events in JavaScript as generated by an iPad running iOS 4.3.3:

WordPress permissions on NearlyFreeSpeech.net

“To perform the requested action, connection information is required.” My earlier post on WordPress with NearlyFreeSpeech.net was too hastily written. There are more issues than WP not wanting to use the direct upgrader, and editing WordPress code is not the right way to solve it either. Problem 1: WordPress doesn’t want to use the direct […]

Scheme in Javascript

Scheme’s power to simplicity ratio makes it a fun target for implementation. Today, I introduce a couple new ways of running Scheme powered by Javascript. The first is an online Scheme interface that I’ve been working on sporadically for the last few months. Inspired by TryHaskell, it began as a series of patches to jquery-console, […]

Convert PHP to static pages with GNU Make

I recently moved an old website to a new server. For performance reasons, the new server is running nginx instead of Apache, and didn’t have nginx set up to use PHP. (The optimal way, apparently, is to use PHP-FGM, which currently requires you to patch and build PHP yourself, at least until PHP 5.4). That […]

Android emulator temp directories

If you are using the Android SDK on a shared computer, you might run into the awesome “NAND: could not create temp file for system NAND” error. This is because “/tmp/android” is hardcoded into the emulator as the directory to start temporary files during emulation, and somebody else has likely claimed it first. The easiest […]

Our friend Scope

Scope is one of those things that is absolutely essential to understand as a programmer. If you don’t understand how a language handles scope, you are doomed to continue making difficult-to-understand mistakes and poor code design. Scheme is a good platform for exploring how scope works for beginners, and the language features that it has […]

Chicken-NBT: A Minecraft NBT reader for Chicken Scheme

I didn’t see any Scheme code to read Minecraft NBT data files, so I made one. And in doing so, I see why there weren’t any NBT readers in Scheme. (Haskell programmers can use Adam Foltzer’s much cleaner Haskell version.) When I found out that there was a gzip egg called z3, I thought my […]

Writing reusable JavaScript

One of the biggest hurdles in going from JavaScript as a trivial gimmick for making divs change color to a powerful language for building real applications is its single-namespace weakness. It’s easy to accidentally cause variable names to collide when you start combining scripts, and there’s no native library or module system to alleviate this. […]