Friday, April 24, 2009

fix broken ubuntu gutsy apt-get sources.list

I couldn't find any docs about what to do with my broken gutsy install now that the apt repositories have all stopped carrying gutsy. "Drop what you're doing and reinstall with hardy" is not an okay answer this afternoon. So here's the solution.

Obsolete releases get moved to, so here's my working /etc/apt/sources.list:

deb gutsy main restricted universe multiverse
deb-src gutsy main restricted universe multiverse

deb gutsy-updates main restricted universe multiverse
deb-src gutsy-updates main restricted universe multiverse

deb gutsy-security main restricted universe multiverse
deb-src gutsy-security main restricted universe multiverse

Use with caution of course.

Daydream in blue

I love university radio stations! The clear channel stations suck -- it's all repeats of a couple of popular songs. But the local university station almost always has something I haven't heard before.

The other day they played Daydreamin' by Lupe Fiasco. And it turns out to be one of those songs with a fascinating past.

The Encyclopedia of Record tells us it was first recorded in 1968 as Daydream by The Wallace Collection.

I, Monster has a nice take on it.

The Pharcyde's She Said (with Fuzz Face from Portishead, naturally) rocks.

The Beta Band called theirs Squares.

Maybe later I'll look up some of the other songs in the wikipedia article.

Tuesday, April 21, 2009

Write a text format protobuf in python

The protobuf docs aren't clear on this, but I found the magic incantation in one of the tests.

To create a text format (ascii printable) protocol buffer using the python interface,

from google.protobuf import text_format


Thursday, April 16, 2009

Comparing images pixel for pixel on the linux command line

There's an old file format called ppm that stores an image as a very simple, very large text file. Unfortunately, there are several types of ppm images, without even getting into the pgm and pbm images which form the rest of the pnm family of image formats.

The Wikipedia netpbm article gives more details on how the family of formats work.

The P3 ppm (sometimes called "ascii ppm" or "plain ppm") image is most useful. It's surprisingly simple, and I've often implemented it by hand in C when I got sick of trying to make an image library work and just needed to get pixels into an image. It's also useful for pixel-by-pixel comparisons:

Let's say you have two images, a.png and b.png, and you want to know if the pixels differ at all between the two images. You could use gimp to subtract them and then tweak the histogram to hilight the differences, but it's slow going.

Instead, you can convert them to P3 ppm files and use diff to compare:

(-compress none tells the ImageMagick convert utility to produce a P3 ppm)
$ convert a.jpg -compress none a.ppm
$ convert b.jpg -compress none b.ppm
$ diff a.ppm b.ppm > differences
$ head differences
< 58 61 58 58 61 58 58 60 58 58 60 58
> 58 60 58 58 60 58 58 60 58 58 60 58

So, 13000 lines into the files, we see that a 61 has become a 60, and that it does so again the next pixel over. (These files have lines with 4 pixels each. In the above output, a.ppm had (rgb values) (58,61,68), (58,61,68), (58,60,58), (58,60,58), for example. So b.ppm differed by a single bit in the green channel in two adjacent pixels.)

Sunday, April 12, 2009


Supermax prisons have always struck me as evil institutions. This New Yorker article on solitary confinement is subjective, but also offers various pieces of research to support its claims.

I've often been inclined to write letters to inmates in solitary, although I hesitate to reveal my street address. Maybe someone could set up an email-to-snail-mail gateway like this one, but free, and people could volunteer to write to inmates. I wonder how much it would help.

Saturday, April 11, 2009

Shared google reader items

I think b has the right idea about using a shared google reader page to share links instead of creating a new blog post for each one.

Friday, April 10, 2009

Gatto + Gilbert

I've long been a fan of John Taylor Gatto. He talks a lot about the education system, but also about what he calls networks vs. communities.

And why does society now gravitate toward networks instead of community? I think Dan Gilbert has the answer there: we avoid commitment, even though it makes us less happy. And it does so in general, not just in the network/community sense.

I'm hopeful that society will learn from this and develop healthy ways of accepting commitment without discarding flexibility and choice. But I'm not sure that Gatto's communities will re-emerge.

Maybe there's something new that we'll stumble upon that will help us feel less lonely. I hope so, because I think the lack of it is corrosive.

Self-haters donate more

Another fascinating study at the overcoming bias blog: people are less charitable when they feel they're more moral.

Classic engineering mistakes

I like this list of classic mistakes in engineering projects. Here's the author's summary (see the original article for description):

1. Undermined motivation

2. Weak personnel

3. Uncontrolled problem employees

4. Heroics

5. Adding people to a late project

6. Noisy, crowded offices

7. Friction between developers and customers

8. Unrealistic expectations

9. Lack of effective project sponsorship

10. Lack of stakeholder buy-in

11. Lack of user input

12. Politics placed over substance

13. Wishful thinking

14. Overly optimistic schedules

16. Insufficient risk management

17. Contractor failure Insufficient planning

18. Abandonment of planning under pressure

19. Wasted time during the fuzzy front end

20. Shortchanged upstream activities

21. Inadequate design

22. Shortchanged quality assurance

23. Insufficient management controls

24. Premature or too frequent convergence

25. Omitting necessary tasks from estimates

26. Planning to catch up later

27. Code-like-hell programming

28. Requirements gold-plating

29. Feature creep

30. Developer gold-plating

31. Push me, pull me negotiation

32. Research-oriented development

33. Silver-bullet syndrome

34. Overestimated savings from new tools or methods

35. Switching tools in the middle of a project

36. Lack of automated source-code control

Wednesday, April 08, 2009

Dealing with impossible crises

I like this article on Dealing with impossible crises. The author's summary:

  • Calm down, smile and remain polite to maintain any chance of success
  • Become a human being rather than a faceless number
  • Be persistent to grind away the brick wall
  • Be prepared to lose to expand your freedom of thought and action
  • Be clear about your objective so you can be flexible about how to achieve it
  • Find who can, since often the first person you speak to cannot help
  • Take an active part in making things happen more efficiently
  • Make the other person feel good about helping you so that they are more likely to help you
  • Don’t relax this stance until it’s over, it’s easy to snatch defeat from the jaws of victory.

Thursday, April 02, 2009

Laman and Lemuel are dead

If you're one of those people who knows about the Book of Mormon and also Rosencrans and Guildenstern are Dead, then seriously, what's wrong with you? Nevertheless, you'll enjoy
Laman and Lemuel are Dead.