Running amd64 binaries on an i386 Linux system

Normally the qemu-user-static package makes it straightforward to run binaries from another platform, but I ran into a roadblock running amd64 binaries on an i386 machine. It looks like the binfmt spec for amd64 isn’t included in recent i386 releases of qemu-user-static to save people from themselves after they manage to install the package on a mismatched architecture. Frustrating.

Specifically, this unsupport is accomplished by excluding the file /var/lib/binfmts/qemu-x86_64 from the installation. The actual interpreter, /usr/bin/qemu-x86_64-static, is exactly where you’d expect it to be. The file listing for the package didn’t include anything destined for /var/lib/binfmts, so I figured they must be unpacked and put there by an installation script. So I pulled the package apart:

$ apt-get download qemu-user-static
$ dpkg-deb -R qemu-user-static*.deb qemu-user-static
$ cd qemu-user-static/DEBIAN/
$ cat postinst

The script contains a variety of magic number and mask definitions. The script registers these via update-binfmts only as appropriate for the host platform.

Great, so we should be able to sneakily perform our own update:

$ sudo update-binfmts \
    --package qemu-user-static \
    --install qemu-x86_64 /usr/bin/qemu-x86_64-static \
    --magic '\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00' \
    --mask '\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' \
    --offset 0 \
    --credential yes


$ sudo cp /usr/bin/qemu-x86_64-static build-amd64/usr/bin
$ sudo chroot build-amd64 /debootstrap/debootstrap --second-stage
qemu: uncaught target signal 11 (Segmentation fault) - core dumped


Screw it, I’m reinstalling this machine with a 64-bit OS.

DIY Audio Snake, Part 2

(Alternate title: “As If I Didn’t Hate Myself Enough Already.”)

All the bits showed up, a heaping pile of small bubblepack envelopes with mixed Mandarin and English labeling. I’m sure I’m on at least two watchlists now due to the cumulative volume. I didn’t really track arrival dates, but the pieces trickling in at a rate of one or two per day over most of a week. After writing the last post, I revisited the project box dimensions and ultimately decided I’d better preemptively order larger ones. It’s a good thing I did, too, because the ones I originally got were far too small.

So it all got here, and then I put it on a shelf for a couple more weeks while I worked up the nerve to start the build. On December 7th I finally got sufficiently brave – foolhardy? – to make a thing. It all went pretty much as previously described: HDMI to DB-25 in the boxes, XLR to DB-25 as pigtails, and pins as I thought they ought to go. What I wasn’t prepared for was the amount of time taken building the pigtails. The microphone cable ended up being much smaller in diameter than I thought it was which meant space wasn’t an issue but stripping it sure was. In order to give myself enough spare that I could afford to make mistakes, I used 16cm lengths between the DB-25 and the XLR connectors. Good thing, too, as I ended up with only around 50cm left (of the original ~300cm – ordering in Imperial units then measuring in metric is hard). If I ever do anything like this again, I’ll figure out how to strip shielded wire without accidentally cutting through half the shielding. (Really, the big problem was that the largest hole on my wire strippers was still too small. By “figure out”, I really mean “buy a more appropriate tool”.)

I used 10cm lengths inside the box because unlike the mic cable, I’d overestimated how much I’d need for that. The boxes I ended up using were more shallow than wide (which was perfect) and I could’ve physically gotten away with 8cm or less – I just don’t know that I’d have been able to have worked with a more constrained length. Stripping short wire is a bit difficult because you don’t have much to hold onto. As for mounting the connectors onto the end plates of the box, Dad cut (drilled, really) appropriately-sized holes, then I mounted both the HDMI and DB-25 connectors with threaded anchors. The HDMI connector looks a bit funny from the outside as there’s no such thing as a screw-down HDMI cable but I used one anchor through the board (with a nut on the backside) as a spacer then ran another anchor through the end plate into the first one. The threading in the anchors isn’t as deep as their screws are long so there’s almost a millimetre of slack between the end plate and the anchor head. It doesn’t matter, though, as the mounting holes were drilled sufficiently small that the screws won’t move without rotational torque.

And then I tested the boxes with a multimeter, labeled the connectors, and took them to Team Night without ever having run audio through it. Yeah, I live life on the edge alright. More like, after seven hours of assembly, I needed some affirmation of my life decisions regardless of how the final product turned out. And the response was as positive as I’d hoped. A surprising number of people thought I was somehow running a real HDMI signal, not just using an HDMI cable as an analogue carrier. But once we got that sorted out, we found a speaker and a 50′ HDMI cable and took them for a spin. We didn’t actually try with microphone-level signals, but with line-level signals they worked admirably. Signal loss was barely audible for the first four channels, and got progressively worse (but not by much) for the last two.

There’s a couple other things I’d still like to do. The pigtails are especially fragile as the mic cable is too small in diameter to fill the holes in the plastic sheathes of the XLR connectors, and even six of them don’t fill the hole in the plastic DB-25 hood. This means the connections on both ends are supported only by the shortest wire in the cable. I made sure in all cases that it’s the ground connector (physically, the cable shielding) carrying the stress but that’s only marginally better. I’d like to add some better stress relief before (if ever) using the units “for realsies”.

I’d also like to get some hard numbers on signal loss. Probably just straightfoward as connecting each line to the ins and outs of an audio interface, generating some signal, and comparing what comes back to the interface against what was sent out. But it would be nice to do the test with a variety of lengths of HDMI cables to see how much the cable plays in versus shoddy soldering.

Up next: probably nothing. Even if the signal test does say nice things, the product is still kind of pointless. Six channels isn’t worth much, and HDMI is ultimately pretty fragile. Even with reinforcement, I’d still be wary of throwing something as half-baked as this onto a stage. It certainly wouldn’t be an important stage. Still, it was a neat project in a lot of other ways: I got to try some 100% Chineseum XLR connectors (terrible), solder a lot of wires (backbreaking until you get your table set up correctly), and learn about how HDMI electrically works under the hood (before promptly ignoring that and doing something else). A+ would recommend.

DIY Audio Snake, Part 1

(Alternate title: “An Exercise in Masochism”.)

At the beginning of summer, having graduated and left all the audio tech-related roles I had held in Wolfville, I was really missing monkeying around with mics and mixers. Fueled by that hole and thanks to Layman’s continual prodding encouragement, I ended up pitching in on audio tasks at myChurch. To make a long story shorter, the organizational hierarchy of the church places the Audio, Video, and Lighting under the broad Production (“Prod”) umbrella. As such, equipment from all three Prod teams is usually kept in the same general area in venue. More than that, to the untrained eye not paying attention to their contents, the road cases containing video, audio, and power components (largely being cabling) all look the same (assuming the label on the top of the case goes unread). Usually this doesn’t matter much because anyone on Prod learns to distinguish them pretty quickly, but when someone from another team is lobbing cables around, which bin those cables end up in can be a bit of a tossup. This leads to XLR and HDMI being found every whichway when things aren’t struck properly.

In aggressive reaction to an overabundance of HDMI being found in all the wrong places, I threatened to Brojo that I’d build an XLR-to-HDMI adapter and use his video cables to run audio the next time the cables got mixed up.

We had a good laugh. And then I started thinking about how such an adapter might actually work.

HDMI is 19 pins. (Some cheaper cables supposedly don’t include pin 14 which isn’t used by the spec, but I’m getting ahead of myself.) Divided by three (hot/cold/ground), that rounds down to six – six channels of balanced audio. The HDMI standard even defines four grounded, two-conductor channels (pins 1-3, 4-6, 7-9, and 10-12), and one grounded, three-conductor channel (pins 13 and 15-17). Well, that’s far too convenient to not abuse, and suggests that cable composition may even be amenable to carrying at least four channels (ignoring, for the moment, the absurdly low wire gauge used in HDMI cables). And even though they’re maybe not strictly suitable for it, I can try to run another channel over the leftover pins (presumably 16, 18, and 19) just for kicks.

So that’s the carrier. Without actually trying it, I’ve no idea if microphone-level audio signals will actually make it through the cable – both are low-voltage, but I imagine audio is far less current (and therefore far more susceptible to signal loss) than digital video. But working on the assumption that they will, what do we do with the connectors? HDMI is tiny. I don’t solder tiny. I try not to even work with tiny. My fingers aren’t tiny or all that steady, so at a point it becomes something of a physical impossibility. So that means getting some breakout boards – small circuit boards with easily-accessible solder pads connected to a mounted connector (in this case, female HDMI).

And then we need to think about what connects to the breakout board. I could go directly to microphone cable and then to the XLR connectors. But how do you protect that? Just by being used whatever cable comes out of the XLR is going to have tension applied to it, and I don’t want to place tension directly onto the breakout board: my soldering is not that strong, and even if it were, you don’t want the connectors taking any more stress than can’t be avoided. Plus, the breakout is going to have to be mounted to… something so it can be handled easily. And what if this doesn’t work for audio, but I still want to reuse the idea of abusing HDMI as a carrier for analog signals? Maybe it won’t behave well for audio, but I bet you $5 I can run a whole bunch of low-baud serial lines over HDMI. (For what, I don’t know, but it’s a use-case!) Let’s try to avoid connecting the HDMI breakout directly to the XLR, then.

The most commonly-used connector I can think of with around the same pin count as HDMI but which uses a larger form-factor is DB-25, commonly used for parallel port communication. It’s six wasted pins, but DB-25 connectors have sufficiently wide pin spacing to be easy to work with directly, and connectors are plentiful and cheap, both to buy new and to pillage from old equipment. Beauty. It’s more work, because I’ll have to connect each HDMI breakout to a DB-25 connector and then build DB-25-to-XLR pigtails, but it solves both the stress and reusability issues.

I don’t want the HDMI breakouts and DB-25 connectors floating in mid-air, so I’ll have to house them in project boxes. An enclosure that opens on both ends (a rectangular tube with caps on the ends, if you will) would probably be easier to work with than a container with a lid, as I can detach the endcaps to cut HDMI and DB-25-shaped holes in them. I’ll have to solder the wiring harness between the HDMI breakout and DB-25 connector, then thread one connector through the enclosure, then attach the endcaps to the connectors, then fasten the endcaps to the enclosure. As long as I make the wiring harness long enough, it shouldn’t be a problem.

What genders do I want to use for the DB-25s? On one hand, the HDMI port on both breakout boxes is going to have to be female, as HDMI is male-to-male. But the cable is still technically going to be used directionally, so I think I’ll put a male DB-25 on one box and a female connector on the other. Then the pigtale with the female XLR connectors will have a male DB-25 connector and vice-versa so the XLR and box genders match.

So, here we are: two HDMI-to-DB-25 breakout boxes, and two DB-25-to-XLR pigtails. Given that I’m cheap and not in a huge rush, I hit up eBay for the required doodads and came up with this shopping list:

Breakout Boxes

Item Quantity Total Price
HDMI breakout board 2 $24.57
Female DB-25 connector 10 $5.29
Male DB-25 connector 10 $5.29
Connector anchor 25 $5.29
Connector anchor nut 25 $5.29
45x45x18.5mm project box 2 $11.80
22AWG wire 10m $2.96


Item Quantity Total Price
XLR connectors, male/female pair 10 $20.99
Microphone cable 10ft $11.92
Female DB-25 connector with hood 5 $5.29
Male DB-25 connector with hood 5 $5.29

(Huh. That is actually starting to get really expensive. Whoops.)

I accidentally ordered too little wire for the breakout boxes (5m instead of 10m) so I’m waiting to hear back from the seller on whether I can cancel or extend that order. And, I’m dubious about the quality of the microphone cable: I ordered thin stuff to more easily fit six cables through the DB-25 hoods, but I’m not sure how easily I’m going to be able to solder it as it’s a copper-tin alloy. Fingers crossed.

As for the high quantities of DB-25 couplers and connectors, I figure having some spare around for future projects isn’t a bad thing. I also wanted to get as much as I could from the same seller in order to get a reduced shipping rate.

I’m still not totally sure how the HDMI breakouts will mount to the project box endcaps. Bolts, sure, but how long? I don’t actually know how deep the HDMI connectors on the breakout boards are and I’ll need spacers. Have to wait until the bits and pieces are in my hands, then I’ll probably get something from Home Hardware.

Speaking of dimensions, I’m unsure that the breakout boards will fit inside the project boxes. The boxes are supposedly 12.9mm tall internally. The measurements for the breakout boards are obviously wrong as they’re listed as 25.4×25.4mm when they’re visibly wider than they are tall, but I suspect 25.4mm is the accurate height and they’re close to twice that in width. I think I might have to get bigger boxes. That’s a huge and embarrassing oversight, especially as I picked that box specifically because it looked like it was probably wide enough to fit the connector. Oops. Once the breakout boards show up, I’ll get a correct measurement. And then order new boxes. Maybe something like this – that would be nice if it would work because it’s not too deep, and I don’t need any more depth than I already have.

Stuff should start showing up in about two weeks. Depending on the order in which things arrive, I can start working on the box and the pigtails independently, although both of those rely on the DB-25 connectors showing up. Fingers crossed that it all shows up before Christmas.

The Hotel Kit

Over the past four years, I’ve had numerous opportunities through the programming competition team (and one with Axe Radio) to go abroad for a night or two in attendance of competitions or conferences or what have you. Beyond the event proper, these sorts of things are as good an excuse as any for a bit of fun on nights after the scheduled activities for the day are finished. In order to facilitate such shenanigans, I’ve taken to dragging a collection of odds and ends along with me to whatever hotel I end up in.

A Spare Laptop

This isn’t about a backup plan in case something happens to the good one. This isn’t to lend to someone needing a quick Internet fix (although it’s handy for such purposes). This is some old beater you can connect to the TV as you’re unpacking and leave there until you leave. It’s nice to just leave it playing music as you’re booting around the room, and it’s a far superior option to passing a phone around the room when someone wants to show a YouTube video. And, by using a spare, not your daily driver, you don’t ever have to move it or unplug it until you’re ready to check out. It should be something you don’t mind losing if something gets spilled on it or it takes flight; old netbooks make great candidates. It ought to have a decent Wi-Fi adapter because hotel Wi-Fi is notoriously flaky, and both VGA and HDMI outputs because you never know what will be available on the TV in the room.


All of them. VGA and HDMI for reasons as noted above. Ethernet because you might need it at the conference. MicroUSB (with AC adapters!) because everything needs to be charged. Don’t forget laptop adapters. Don’t forget a male-to-male 3.5mm audio cable for the auxiliary input on the rental car for the drive down and to run laptop audio into the TV if you do have to use the VGA input.


If you’re there for more than one night (say, two nights), you’re almost bound to be bored on one of them, and with hotel Wi-Fi being what it is, video streaming is out (although music is usually OK). Make sure you stuff at least a couple fairly polar-opposite options onto the laptop before heading out the door.

So that’s about it. None of it that inobvious, but easy enough to forget as you’re haphazardly throwing things into a bag the night before.

Feel It

I’m a pretty hands-on guy. I like to twist knobs, push levers, turn dials. A whiteboard or flip chart is my best friend when scribbling down ideas, not because I particularly subscribe to the tenets of the corporate office space, but because I like scratching down words and diagrams on something I can feel.

I’ve been incredibly lucky to work at the same place for four summers running, and they’ve asked me back for a fifth. Lucky not because of the stability (although that’s a definite plus), but because the company is great and the product is really cool. The details of the product are, while interesting in and of themselves, irrelevant to this discussion; what matters is that it’s a real, physical product. It’s a beautiful blend of engineering: electrical, mechanical, and more than a little software. And I can feel it, and I can interact with it.

Which brings me to a huge disappointment I find in software: the impossibility of picking up, of playing with the things I’ve made. The intangibility of software is one of the leading reasons I often wish my aptitudes lay elsewhere.

I don’t think this trait is particularly limited to me. For example, despite the vast improvements computers have brought to the world of audio engineering over the last few decades, people still spend large bags of money on buttons and knobs and keys not because they have any impact on the range of sounds the computer can product but because they provide a more natural means of interaction with the machine. On-screen widgets which don’t provide the same tactile feedback as physical controls are simply not as satisfying to use nor as rapid at manipulating the underlying values.

It’s in our nature to want to interact with things physically. After all, fingers are pretty good at it, and we do have eight of those plus another two thumbs to help us hang onto the things we’re interacting with. Wouldn’t it be nice to be able to interact with computers in ways more akin to our nature? There have been some attempts to manufacture controls adaptable to the wide range of input tasks that software can demand; on the opposite end of the spectrum, some static controllers just have inputs for everything imaginable.

Still, these are all pretty specialized pieces of equipment: generally either specialized for gaming or multimedia production. It’d be super to see something like a USB version of the Big Knob on every desk, as standard as a keyboard. Some keyboard manufacturers have attempted to achieve something like this by jamming a million extra buttons onto keyboards. I don’t think buttons are the answer: binary states are too limiting. But then, they’re also very general, and software is a very general universe. There are so many applications for better input solutions, and then software would have to expose itself to the new controllers, and it’d be the same headache as the introduction of the mouse all over again.

When can we have our interactive hologram displays, please?


I have an enthusiasm for regular languages which borders on fetishism. PineConeBoy has had reason to half-chastise, half-mock me on several different occasions due to my well-meaning but frustratingly clumsy attempts to enforce regularity on the English language by intentionally breaking grammatical rules or restricting myself from using more-inconsistent word forms. For example, I used to capitalize every word of titles, without exception; even though I realized capitalizing “of” and “the” was grossly incorrect, it was a form of standardization. More recently, I tried to eliminate the “-er”/”-ier” adjective suffix on the basis that it doesn’t apply evenly; for instance, “happier” is a word, but “funner” isn’t. However, “more happy” and “more fun” are both valid, so for a while, that’s what I tried to stick to. (That stopped working the second someone pointed out how stupid “more easy” sounds. Or something like that. And the someone was probably PineConeBoy.)

The point being, even though I did horribly in my formal languages/translators class, I do find the topic near and dear to me. I’ve spent hours completing regex crosswords (and I’d recommend anyone else do as well — they’re a great way to get your head around some of the more complex regex operations like backreferences). I once cleared a competitive programming problem in the first ten minutes of the competition because I was able to quickly construct a pattern to match the solution. Maybe it’s because of this, or maybe it’s the other way around, but  it frustrates greatly when others overlook the importance of syntax in effective communication. (I know I go on about that topic a lot, but I do feel it’s significant!)

Some friends and I were hanging out earlier, and the topic came up of how Pickett22 crowdsourced a portion of the proofreading and editing of her master’s thesis to her Facebook friends. It was noted how she had to spend a significant amount of effort (although not as much as if she’d had to do it all herself) proofreading and correcting the returned proofreading and corrections.

Nicho and Rinnly and I have had numerous conversations about the importance of clarity in written informal communication, especially with regards to comments on websites. Nicho sides strongly with the viewpoint that your ability or otherwise to effectively verbalize your message should not decrease its importance as perceived by its recipients. This on the basis that the voices those who haven’t been as privileged in their ability to learn their target language shouldn’t be silenced. To me, that also assumes a great number of ESL communicators. My perspective is maybe a little more cynical: assuming instead that these are native speakers, I feel that if you can’t be bothered to put effort into coherently stating your opinion, it’s probably not worth it to me to spend more time deciphering it than you spent writing it.

I don’t really have a pithy conclusion or even much of a point. Guess I’m just contributing further to the noise. At least it’s mostly syntactically correct.

Laptop lifetime

The question was posed on the whiteboard in the CS student lounge:

Over n semesters attending Acadia full-time, how many laptops m have you used as your primary mobile computing device?

The answers were as follows:

n m
8 4
8 2
16 3
6 2
8 2
8 3
6 1
6 2
8 1
8 1
8 2
8 2
8 2
8 4
14 2
8 5

Later, a corrolary question appeared:

Over n semesters, how many laptops m have you bought for school?

It received the answers:

n m
8 0
8 3
14 2
8 3
8 1

The two takeaway points for me are yes, my laptop consumption is considerably above average (8/4 for the first question, 8/1 for the second) and hardly anyone below fourth year ever sticks their head through the door of the lounge. In fact, these numbers make me wonder if first- and second-year students are aware of its existence.


I broke my tablet about a month ago. The screen, specifically. Left it charging on the corner of my bedside table then went to grab it without considering the length of the cable. Even Gorilla Glass doesn’t much like a three foot drop onto ceramic tile, it would seem. (Sorry, I didn’t drop it — I used gravity to place it on the floor, as quoth Rinnly in reference to her own recently similarly-affected cellphone.) Funny, second time in a matter of hours that I’d done that, except the first time was with my plastic-screened phone and I don’t know that it even noticed — it’s seen worse. So there’s Oops #1: lack of attention.

Oops #2, it seems, is having ordered a replacement screen as a standalone piece. I knew it was going to be fun to detach the bezel from the old screen, but I didn’t know it was going to be this much fun. Decided not to get one because it would’ve been another $25 after $100 on the screen. Might’ve been worth it. “Recklessness”, let’s call it — the Oops, not the bezel. After half an hour of alternately waving a decades-old hair drier around the edges of the screen in an attempt to loosen up the glue and delicately prying it further and further back, I gave it a little more of a tug, fractured the screen (not that it wasn’t already fractured before, but it’s more to clean up), and realized the glue isn’t simply on the bezel — oh no, that would be too simple. ASUS, in their infinite wisdom, decided that the bezel should be adhered to the screen (and vice versa) by means of a sort of stencil layer of double-sided adhesive plastic. Gee, lovely. So I’ve already torn that in one place. I hope the replacement screen sticks down OK. As far as detaching the old screen goes, I’m going to cross my fingers and hope it’s sunny tomorrow so I can just leave it out in a warm place.

The replacement screen shipped out with something that might help get it to stick: three pieces of 3M 300LSE. Never run into it before, but Google tells me it’s “adhesive transfer tape”. Peeled back a little corner; seems to be really high-quality double-sided tape, like the stuff that’s on there that I’ve partially ruined, but not cut to shape. Might work. Might have to work. I guess that makes Oops #3 my apparent inability to retain anything from the disassembly/replacement video that, for once, I did bother to look up before I was half-way through the process — again, lack of attentiveness.

Something else the replacement came with was a spudger/prying tool. Nice. I’ve been too cheap to get one. Guess this means I don’t have to. Maybe Oops #4 is that I end up trying to do this crap on a semi-regular basis without adequate tools — unpreparedness. Every time I get new tools, I outgrow the problems that required those tools. Never seems to be because I’ve just solved everything. They say that when all you’ve got is a hammer all problems are nails, but it’s a weird sort of hammer to deal with sixteen-foot tall nails made of grapefruit.

I really like The Codeless Code. They’re software development koans. A cool concept. Sometimes they’re a bit far out, but other times, they’re bang on. The most recent one, Ten Thousand Mistakes, is a good one. Reviewing the four Oopses I’ve just mentioned (is immediate retrospect bad? Is that Oops #5?), none of them are new problems to me and #1 and #3 are even duplicates. Eh, I’ve got another nine-thousand nine-hundred and ninety-six mistakes with which to be original.

Windows Hate

I tried installing Windows 8 on my netbook last night. Everything went great: the install only took about fifteen minutes, and it came up with Wi-Fi support, the proper screen resolution, etc. Except, on my 1280×720 netbook, every single Metro app fails to launch, politely informing me that “The screen resolution is too low for this app to run.” Really, Microsoft? You’ll support 1024×768 as a minimum, but 1280×720 – 48 pixels shorter – is just right out? Instead, you’re endorsing the marketing-drone-constructed bastard that is 1366×768 as the lowest-supported widescreen resolution? Well, alright then.

Tomcat 6 with self-installed JDK

If you’re trying to install Tomcat 6 (or anything else with a dependency on Java) under Debian with a self-installed JDK (say, the Oracle Java 7 JDK) and you want to avoid apt-get grabbing OpenJDK, then your best bet is to use equivs to create a dummy package pretending to provide default-jre and default-jre-headless (and, if you feel like it, default-jdk). If you’re feeling particularly lazy (or are future me wishing he’d kept the resulting package around to reuse later – hello, future me!), here’s one I made earlier.

Edit 2013-12-16: This method hasn’t really worked for quite some time now, but that’s OK, as java-package has been updated to support Oracle Java 7. Along with satisfying the dependencies, it does a much better job of installing the JDK than most people will.

A note on Eclipse: Instead of depending on java-compiler like it ought, Eclipse depends on default-jdk, and more weirdly, on sun-java6-jdk. Even if you install Java using the above java-package method, you’ll still have to use an equivs package to provide those two dependencies if you want to keep OpenJDK off your system. Here’s a prebuilt package that provides just those two dependencies.