You are here


Random bits of technology

User trap of the week: Android SDK sqlite3 libreadline

This user trap was a nice one. I noticed a month or so ago that the "libreadline" support in my "sqlite3" executable on my home box was no longer working. For the uninitiated, this means that I couldn't use line history and line editing when working on database queries. Really annoying.

Tonight I decided I would fix it, dammit. An hour or so of careful investigation later I finally noticed that some joker had stuck a copy of sqlite3 without readline support in the Android SDK "tools" directory; my path stuff was configured to find that one first.


User trap of the week: GIMP Script-Fu

When I was rebuilding my crosshatch plugin for the GIMP as Script-Fu Scheme a week or two ago, I ran into a beautiful little problem. It seemed that sometimes I needed to take the car (the "head of list") of the result of some Script-Fu functions for no apparent reason. In fact, the more I poked at it, the more I couldn't figure out when I didn't need to…


The 'Sleep Sort' meme

People keep pointing me at Sleep Sort in email and IRL; it is apparently a popular topic right now. To Sleep Sort an array of integers, you spawn one process per array element. Each process sleeps t seconds, where t is the value of its array element, and then outputs t


Proposals for Open Source Bridge

I'm submitting a talk to  Open Source Bridge - June 21–24, 2011 - Portland, OR

Things I see in student code

I've read quite a lot of student code over the years. Some of it is quite good. A lot of it is full of predictable badnesses. These notes attempt to enumerate some of this badness, so that you may avoid it.

This is pretty C-centric in its current form. However, many of its lessons are multilingual. This is a living document, so don't expect it to be the same next time you look at it. In particular, the numbering may change if something gets inserted in the middle. It is revisioned automatically by Drupal, so feel free to point at a particular revision if you care.


Why cut-copy-paste is hard

[This note is primarily a response to a recent LWN thread. I'm posting it here because it got a bit long for a discussion forum.]

Several years ago, I joined the X.Org Foundation Board of Directors. One of my campaign pledges was to organize a project to finally "fix" X cut-copy-paste (CCP).

It has long been acknowledged by anyone paying attention that the user experience around CCP on the X desktop is horrible (although it has improved a bit in the last couple of years). I'm smart, I could fix it, right?

Uh, no. Here's some reasons why CCP is hard, especially on X…


HOWTO: Rotated Halftones in Inkscape

There are a few good tutorials on the web about how to get a (mediocre) halftone screen in Inkscape (1, 2). (The GIMP, by contrast, has a special halftoning plugin that does a nice job. I wish that Inkscape had one of those.)

One thing that none of these tutorials tell you is how to rotate the halftone screen. This turns out to be important, since unrotated screens of different colors do not overlay well.

In this tutorial, I summarize the basic technique for halftoning in Inkscape, and suggest a way to do rotation…


Notes on getting Debian Gnome Bluetooth working

This is a rought-draft page that I'm making to take some notes on how I got the Debian Gnome Bluetooth support to work this time around. Bluez and its supporting utilities are an endless source of frustration and perhaps even of nightmare, so it's probably a good idea to have some notes…


Random non-repeating sequences

While doing some research for an upcoming paper, I came upon a 2008 blog post describing a special case of the following interesting problem:

Given an alphabet of n symbols, construct a uniformly-selected sequence of m of these symbols, with the sequence containing no duplicate symbols.

[Updated 2009/12/14] The difficulty arises when both m and n are large. The obvious method is a rejection method: repeatedly pick a random symbol from the alphabet and check whether you've picked it already. If not, append it to your target number. The problem is that the duplicate check seems to require log m time even if you code it cleverly, giving an asymptotic performance of O(m log m). Hash tables can help some, but ultimately you're going to waste a lot of time checking for the unlikely case that you've generated a duplicate.

There were various solutions given in the comments, but none of them were optimal. A spoiler follows…


Everything broke at once

I woke up yesterday morning in Tuscon. A lovely day…



Subscribe to RSS - Tech