The Black Triangle

Stuart Langridge on Planet Ubuntu posted about this story a while back, and its a something that’s happened to me a lot of times over my career.

The Black Triangle

The tl;dr is that a complex, extremely flexible system, well built system often takes a long time to put together, and the first fruit of the labor is often something seemingly simple to do from the perspective of someone else. However, the complex underpinnings of the well designed system allow the project to grow by leaps and bounds once that first black triangle is shown on the screen! That ‘black triangle’ one of the coolest parts of being an engineer.

(Oh, and, being a graphics guy, I definitely have had a lot of black triangles appear on the screen…. I slightly prefer the multicolored ones though… šŸ™‚ )

Posted in Coding, Open Source, Random, Uncategorized | Leave a comment

C++ 11 tip of the day

If you’re working with code using C++11 ‘s use of the <thread> library, and you get this error at runtime:

[code lang=”bash”] terminate called after throwing an instance of ‘std::system_error’
what(): Operation not permitted
zsh: abort ./main

That means you forgot to tell g++ to link to the pthread library when you compiled. Add the flag

[code lang=”bash”] -lpthread [/code]

to your g++ command string, and you should be set to go.

I’ve run into this error a few times already, and I haven’t found a good google search that answers it, so I decided to write this one. Hope it absolves a few head-scratchers out there….

Posted in Coding, Open Source | 2 Comments

Irssi OSD notifications

I wanted irssi to ping me using Ubuntu/Gnome’s on screen notification system, but didn’t want to dig into irssi’s code… what is one to do?

Cobble scripts together of course! Here’s how I got it done:

  1. Download this irssi plugin:
    This script will update a text fileĀ  (~/.irssi/fnotify) with a new line every time you are pinged
  2. Put in ~/.irssi/scripts
  3. autorun this script by executing:
    ln -s ~/.irssi/scripts/ ~/.irssi/scripts/autorun/
  4. start irssi, and run:
    /hilight -nick {your_nick}
  5. When someone pings you, check the ~/.irssi/fnotify file for that ping, it should be there
  6. Download my script below (call it lastline_notify) and run it like this:
    ./lastline_notify ~/.irssi/fnotify & disown

[code lang=”python”]
import os
import sys
import pyinotify
import pynotify

if (len(sys.argv) != 2):
print "usage: lastline_notify "
filename = sys.argv[1]

class PTmp(pyinotify.ProcessEvent):
def process_IN_MODIFY(self, event):
print "Create: %s " % os.path.join(event.path,

#get the last line in file
with open(filename) as myfile:
msg_text = (list(myfile)[-1])

msg = pynotify.Notification("Irssi Notification:", msg_text)

wm = pyinotify.WatchManager()
mask = pyinotify.IN_MODIFY
notifier = pyinotify.Notifier(wm, PTmp())
wdd = wm.add_watch(filename, mask, rec=True)

while True:
if notifier.check_events():
except KeyboardInterrupt:

Viola! You now get a message in the upper right hand corner like if someone were to ping you on empathy. There might be a better way to do this, but it works for me! Both channel pings and queries should get a notification. This script runs as a daemon, so you shouldnt have to worry about it gobbling up CPU.

Posted in Open Source, Random, Ubuntu | Leave a comment

Legos and Turing machines

Jeroen and Davy over at legoturingmachine made a pretty cool little turing machine to honor Turing‘s centennial birthday. I thought I’d repost!

Check out the video:

LEGO Turing Machine from ecalpemos on Vimeo.

Pretty cool way to honor the theoretical basis for all modern computing!

Posted in Hardware, Random | Leave a comment

Gnome notifications from your Terminal!

Its pretty easy to get your terminal to notify you using Gnome’s libnotify system and a short python script. Python’s pynotify package (available as Debian/Ubuntu package: python-notify) I use this short script occasionally to notify me when a long compile is done like this:

[code lang=”bash”] make && echo "Done compiling!" | notifier [/code]

Short python script in my $PATH called “notifier”

[code lang=”python”]
import pynotify
import sys

pynotify.init("Quick Notify")
input = sys.stdin.readline()
msg = pynotify.Notification("Shell Notification:", input)

Posted in Random, Ubuntu | 3 Comments

Android ARM inline assembly

If you happen to want to write some inline assembly in Android, its just about as easy as you’d expect! See the code snippet below for a simple example of how to add two numbers in assembly on ARM.

Download code with Android makefile

[code lang=”c”]
include "stdio.h"

static inline int add(int a, int b) {
int sum;
__asm__ __volatile ("add %[c][/c], %[a], %[b]"
: [c][/c] "=r" (sum) /* one output */
: [a] "r" (a), [b] "r" (b) /* two inputs */
: /*code does not clobber*/ );
return sum;

int main(int argc, char ** argv) {
printf("sum is %in", add(4,222));
return 0;
If you run this on your android device (say, a pandaboard), you’ll see:
[code lang=”bash”]sum is 226[/code]

Now, this is just a simple example, I’m sure you will want to do something more complex. You should read up and make sure you know what you’re doing before you start tinkering with assembly, or you might be left with head scratching and your code broken… Some recommended reading

Happy hacking!

Posted in Coding, Hardware, Random | Leave a comment

The Cupholder Problem

There’s a little story I always think about when designing or modifying an established, well entrenched API, and it goes like this:

Back a few decades ago, no cars had cupholders. A team of engineers were given the task to add a few cupholders to the new car model, so they went down to their localĀ convenienceĀ store (like 7-11) and bought all the varieties of cups that the store had. They then analyzed the cups and designed a cupholder for the car that would work with all the different sizes of cups, and put it in their new car.

Fast forward a few decades, and all the cars had cupholders. TheĀ convenienceĀ store had to design a few new cups to accommodate new demands, so they went to their office parking lot and measured all the car’s cupholders. The analyzed the car cupholder data, and came up with a cup that fit most the cars in the parking lot.


Now, I have no idea whether this story is true or not. I would guess that it’s not true if I were a betting man, but its somewhat reasonable that it could have happened. I’ve seen things like this happen first hand, where you have two moving targets designing for each other. But it does illustrate a problem that often happens when two distinct teams are designing around each other.

The core of the problem is that the two teams are designing around each other, and not coming to an agreement on what to get done. Toyota shoots to meet the changing requirements of 7/11 and 7/11 shoots meet the changing requirements of Toyota, and the result is that both teams miss the mark slightly.

In this situation, 7/11 and Toyota probably don’t have a very strong relationship, so thats expected. Even within one company though, this happens between teams if you don’t come to clearly defined specifications. Team A designs an api to finish processing some task in 10 ms for Team B. While Team A is working on that api, Team B accepts a new task to add more functionality, and they now need the task to be done in 5ms! The options are that 1) Team A has to unfairly work extra hard to cover the changing requirements or else 2) Team B will look foolish. Neither of these are good, 2) has immediate consequences and 1) will lead to Team A burnout eventually.

I don’t have any grand sweeping conclusions about this I can sum up in one sentence. Most people have probably stopped reading by this paragraph even. šŸ™‚ I’m sure that if you’ve worked in engineering teams before, you’ll have had experience in situations like this, and your experience will be a stronger anecdote than anything I can say about my little story. Just think when you’re working, am I designing for the specification, or am I specifying the design?



Posted in Uncategorized | Leave a comment

Installing the blob on your Pandaboard for Android

The Pandaboard by Texas Instruments is a pretty good, mostly open source little development board with one teensy problem….

the blobbbbbbbbb (illustrated by Hermes Conrad to the left…)

If you’ve followed this blog post from last week, you have an image that was built from source, and is identical to the images that linaro produces. However, you still have to go and install the binary drivers provided by TI to get things like graphics acceleration working.

I’ve been using a script by vishalbhoj from linaro here. Pretty much, if you read it, it just has a download location, and then conveinently installs the download to the proper partition on the device. I haven’t had any problem with it. The current download for the binary blob that I’m using is here, hosted by google.

Happy hacking! Let’s hope TI gets with the picture and open sources their drivers. Intel has been doing it for a long time on the desktop, and it doesn’t seem to hurt them!

Posted in Coding, Hardware, Open Source | Leave a comment

Back from UDS-Q

Me at UDS

I’m back from from the Ubuntu Developer’s Summit for Quantal Quetzal (12.10)! This was my first UDS, and it was really cool to see so many developers from everywhere come together to make the next version of Ubuntu something amazing. I saw a lot of cool presentations, sessions, and talks. I also got a bit of sightseeing in in Oakland, San Francisco, and Berkeley on the weekend and at night.

Although I mostly went for planning the next version of the Ubuntu desktop interface, there were a lot of cool things going on with cloud computing as well. I learned a fair amount about MAAS (rapidly deploying thousands of servers) as well as other cloud services like Juju. We saw Mark and the founder of an ARM server company debut a new high density servercluster that runs Ubuntu, and were given some details about just how pervasive Ubuntu is in the cloud computing market. Open source remains ahead of the curve on the server!

The next desktop for Quantal Quetzal is shaping up well too. The best summary was during the Desktop roundtable on friday, where all the topics related to the desktop were discussed and summarized. You can see the notes from this session here. Hopefully will continue to improve how beautiful Ubuntu is, and make the desktop experience even more cutting edge and smooth.

Ubuntu on ARM Showing the Schedule

Welcome Canonical

        Another cool thing I was able to see and learn more about was Ubuntu running on ARM devices. This project is ran by the Linaro Foundation, which is a nonprofit dedicated to bringing open source platforms (Android and Ubuntu) to ARM devices. They’re doing great work, and I even have a PandaBoard to experiment with! The powered all the HD televisions (probably about 20 setups) in the hotel, which displayed the UDS schedule. There’s a picture down below. Its awesome that Ubuntu is running so well on ARM!

From seeing all the bright people working on open source at UDS, it looks like Quantal Quetzal is shaping up to be a great release!

Only in Oakland!

Ubuntu in the Lobby

Posted in Open Source, Ubuntu | 1 Comment

Building Linaro Android (12.04 or daily) for Pandaboard

I recently came into possession of a TI pandaboard for ARM development. Its a pretty cool little package, but if you want to build from source, you run into all sorts of old outdated wiki’s from Linaro that have you chasing your tail trying to build the android tree from source. Here’s how you do it as of May 2012

You have to get a ARM cross-compile toolchain and an android source tree that are in sync with each other. This is the tricky part, because its not exactly well tagged on the internet which version of the toolchain will work with what version of the source tree! When I was trying to match the versions myself, I kept running into all sorts of compile errors because the toolchain tools and the makefiles weren’t based around the same version of the toolchain.

After asking around on IRC, I figured out that linaro makes a build script for each daily/release version that has the URL’s for the proper versions of the source tree and the toolchain. This script is called You can find these scripts on Just find the build you want to replicate, and find in the download section, and download the script. For instance, you can find this script for the 12.04 release is here under the downloads section.

If you want, you can just chmod +x the script and run it. It should download the right files and build on your system. However, if you’re like me and would rather take care of these steps manually, the prebuilt toolchain URL is in avariable in $TOOLCHAIN_URL, and the repo commands and URL to init the android tree are plainly available in the file.

Happy ARM hacking!

Posted in Coding, Hardware, Open Source | 1 Comment