xkcd: volume 0

The xkcd book is now officially available in the store! (There are also a handful of new shirts available for preorder, and we’ve got the signed prints back in stock).

It’s been fun putting it all together.  It was neat to go back through various huge stacks of old drawings, some on the back of school assignments, and scan them at print resolution.  I also had fun with the marginal notes.  I’m really excited to finally have it in print, and I’m looking forward to seeing people and signing copies at the release events this weekend.  I’m also excited about getting back to work on some other projects which have been on hold for a bit, at least one of which will involve lakes and a recently-acquired Arduino.

P.S. Thank you so much for the help with the phone this weekend.  Through a bizarre set of exploits, I’ve gotten it unlocked without losing any data (for details, see the edits to the previous post).

I need G1 tech support.

Note: for anyone with a G1 with this same problem who found this entry by Googling, you don’t have to lose any data — we eventually found a workaround that doesn’t require a factory reset.  Details are at the bottom of this post.

I’ve hit the end of the flowchart, it’s 3 AM, and I’m turning to you all.

I’m at my cousin’s wedding and I’ve been locked out of my G1 phone.  I was idly playing with the screen unlock pattern (it’s fun to draw G1 unlock patterns) and it eventually said I’d made too many attempts and asked for my Google account email and password.  I typed them in.

They don’t work.  (Edit: and the username/password are correct — they work fine for logging in via the web, and they’ve worked recently in other parts of the phone.) I tried every variation on the email (it’s an @xkcd.com email, not @gmail.com) and every password I’ve ever used for anything Google-related.  It still says ‘incorrect username or password’.  It’s the middle of the night, I’m exhausted, and I was about to set my phone as an alarm clock to wake me up for the wedding.

I’ve googled around and found lots of other people with the same problem.  They seem to suggest it’s simply an Android bug, and the only solution is a factory reset of the phone.  This will lose all my app data.  Music, photos, and contact lists will be saved, but I’ll have to redownload all my apps, and I’ll lose my call history, Google Tracks, saved games, Shazam tagged songs, and a pile of text messages containing useful information and/or sentimental minimalist poems.

The phone is not a dev/rooted phone, so a few hacks I found with ADB won’t work.  Does anyone know anything else I can do, or is this an unfixable bug?  I just want my phone back.  I would really appreciate any help anyone can give.  I’ll watch here for a little bit, then find something else to use as an alarm and see if there’s a solution in the morning.

Thank you in advance.

Edit: I’ve used the bug mentioned in #28 here (thanks, Julian!) to successfully get to the home screen.  I couldn’t believe it actually worked, but it does — you can unlock the phone by getting a call and flipping the screen open and shut repeatedly while tapping ‘home’.  Now I can get into the phone by opening the keyboard, but if I just try to touch ‘menu’ it’s still locked.  This is still annoying, but I can deal with it for now (I’ll let it finish syncing and try reboots and stuff).  Thank you so much, internet.  <3

Edit #2: Thanks to Dan Egnor over at Google, I’ve gotten the last piece.  The phone was tied to my Google Apps account rather than my Google account, which have the same email address as their name (and I had tried the passwords for both, of course).  By changing the password for the Google Apps account (not the Google account), I made the phone fail to sync, which prompted me for a new password — which was then saved properly.  When the lockout screen came up next, I entered that password, and my phone is back.  So, in summary, to fix this without wiping your phone, you:

  1. Get someone to call you.
  2. After answering, flip the screen open and shut repeatedly, tapping the “home” button every few flips.  Eventually you’ll drop through to your home screen.  This may take a few tries.
  3. Go into your security settings and disable the unlock pattern.  You can now bypass the lockout just by opening the keyboard.
  4. Change the password on your account, which may be your Google Apps account if you have one.
  5. In a few moments, your phone will fail to sync with email and prompt you for a password.  Enter the new password.
  6. You can now log in with the new password.  Lock your screen, press menu to try unlocking it, and enter your new information.  This should unlock your phone.


There’s an xkcd book!

xkcd: volume 0 will be released in the xkcd store next week, and I’m going to some events in New York and California next weekend to celebrate the release and also help out some nonprofits.

The book contains strips chosen by me from the first 600 xkcd comics, including many of my favorites plus some which were acted out by fans or otherwise had a weird real-world effect.  The project took a little longer than expected because I went back and redid the comic selection and page layout myself.  I also reconstructed a lot of the old comics from scans (many high-res versions of early comics were missing, and others were lost in my 2007 laptop theft).  Throughout the process, I added various marginal notes and doodles.  It will be initially available in the xkcd store (and possibly later in some bookstores).

The book is being published by BreadPig, an adorable company set up by reddit founder Alexis Ohanian.  A portion of the profits go toward build a school in Laos, via the charity Room to Read.  There’s a possibility we’ll get to name the school; I wanted to name it ‘the xkcd school’ because of how confused it would make the kids who are trying to learn English phonetics, but I think they’re vetoing that idea.

We’ll be in New York on September 19th, San Francisco on September 21st, and Silicon Valley on September 22nd.  For more information on the events, check out the BreadPig announcement.  I’ll be doing some events to raise money for Room to Read and the EFF, including a Q&A where the questions are selected by reddit users.  You can add questions and vote here (hey, Reddit admins — if I bribe you with free copies of the book, will you artificially vote down the terrifying Romanian question?).

I hope to see you at the events!

VK Couples Testing

Just for the hell of it, we actually threw together the site in yesterday’s comic.


I hope no hearts out there are broken, but it’s important to know these things.  Bots can handle thousands of connections at once, so you don’t know who else your internet partner is chatting with.  There’s nothing worse than a Turing Test coming back positive for chlamydia.

Urinal protocol vulnerability

When a guy goes into the bathroom, which urinal does he pick?  Most guys are familiar with the International Choice of Urinal Protocol.  It’s discussed at length elsewhere, but the basic premise is that the first guy picks an end urinal, and every subsequent guy chooses the urinal which puts him furthest from anyone else peeing.  At least one buffer urinal is required between any two guys or Awkwardness ensues.

Let’s take a look at the efficiency of this protocol at slotting everyone into acceptable urinals.  For some numbers of urinals, this protocol leads to efficient placement.  If there are five urinals, they fill up like this:

The first two guys take the end and the third guy takes the middle one.  At this point, the urinals are jammed — no further guys can pee without Awkwardness.  But it’s pretty efficient; over 50% of the urinals are used.

On the other hand, if there are seven urinals, they don’t fill up so efficiently:

There should be room for four guys to pee without Awkwardness, but because the third guy followed the protocol and chose the middle urinal, there are no options left for the fourth guy (he presumably pees in a stall or the sink).

For eight urinals, the protocol works better:

So a row of eight urinals has a better packing efficiency than a row of seven, and a row of five is better than either.

This leads us to a question: what is the general formula for the number of guys who will fill in N urinals if they all come in one at a time and follow the urinal protocol? One could write a simple recursive program to solve it, placing one guy at a time, but there’s also a closed-form expression.  If f(n) is the number of guys who can use n urinals, f(n) for n>2 is given by:

The protocol is vulnerable to producing inefficient results for some urinal counts.  Some numbers of urinals encourage efficient packing, and others encourage sparse packing.  If you graph the packing efficiency (f(n)/n), you get this:

This means that some large numbers of urinals will pack efficiently (50%) and some inefficiently (33%).  The ‘best’ number of urinals, corresponding to the peaks of the graph, are of the form:

The worst, on the other hand, are given by:

So, if you want people to pack efficiently into your urinals, there should be 3, 5, 9, 17, or 33 of them, and if you want to take advantage of the protocol to maximize awkwardness, there should be 4, 7, 13, or 25 of them.

These calculations suggest a few other hacks.  Guys: if you enter a bathroom with an awkward number of vacant urinals in a row, rather than taking one of the end ones, you can take one a third of the way down the line.  This will break the awkward row into two optimal rows, turning a worst-case scenario into a best-case one. On the other hand, say you want to create awkwardness.  If the bathroom has an unawkward number of urinals, you can pick one a third of the way in, transforming an optimal row into two awkward rows.

And, of course, if you want to make things really awkward, I suggest printing out this article and trying to explain it to the guy peeing next to you.

Discussion question: This is obviously a male-specific issue.  Can you think of any female-specific experiences that could benefit from some mathematical analysis, experiences which — being a dude — I might be unfamiliar with?  Alignments of periods with sequences of holidays? The patterns to those playground clapping rhymes? Whatever it is that goes on at slumber parties? Post your suggestions in the comments!

Edit: The protocol may not be international, but I’m calling it that anyway for acronym reasons.


I’ll be at Connecticon in Hartford, CT this weekend!  There are some cool people there – I’ll be on a panel with the Cyanide and Happiness guys.  If you’re in the area, come say hi!  I should have mentioned Connecticon earlier, but I’ve been busy finishing up a project – more on that later!

Note: Some of the stuff in the article is no longer accurate – since then, I’ve gone back and redone the layout and comic selection myself.

Security breach

This blag has been hacked.  Sorry.

As those reading by RSS may have noticed, there are ads being inserted periodically into the bottom of xkcd blag posts.  They’re hidden from the web view.  This is due to a security hole in WordPress 2.7.x and 2.8 (and possibly others).  davean is watching packet flow and trying to figure out exactly how it happens, but in the meantime, sorry for the annoyance.  One way or another, it should be solved soon.

I just had extremely minor surgery this morning (removing a lipoma from my right arm).  I’m fine; it’s just a paranoid better-safe-than-sorry thing. But I’m writing this under the influence of the lingering anesthetics and my first-ever Vicodin.  No interesting side effects so far other than dizziness, a higher rate of typing errors, and the tendency to zoom images all the way in and stare at them for several minutes at a time.  Why *is* that cat in the ceiling, anyway?  Hello, internet.

Laptop update

I’ve been busy these past few weeks on a variety of things, but a quick note: I decided on a new laptop, concluding my February agonizing.  I’m replacing my Fujitsu Lifebook P1610 with a Lenovo Thinkpad x200s.  Thank you to everyone who suggested it.

My Lifebook isn’t quite dead yet (though this morning it was refusing to charge until I jabbed the power port with a mechanical pencil a few times), but three things motivated my choice.  First, I got a chance to play with a friend’s x200s and she gave a good general report of it.  Second they’re on a pretty steep sale right now (especially with the friends and family employee discount sent by a kind reader — thank you!).  And third, I finally got a G1 (my first smartphone!).  The G1 means that I have ssh and a browser in my pocket, so I don’t need my laptop to be quite so pocketable as I used to.  By the way — I’m very happy with the G1 so far.  I left Verizon to get a G1, and the T-Mobile ccoverage is actually a lot better than I was warned; so far it hasn’t been a problem at all, even on various road trips.

If you are still one of those crazy people who needs an optical drive, the x301 is basically a slightly larger x200 with an optical drive bay.  And the Toshiba R600 looks like another good option for high-end ultraportables, though I’ve never had a chance to see one in person.

P.S. The Lenovo site layout is pretty wonky — the tech spec sheets for the x200s and x301 are tricky to find.

Duke Nukem Forever Metalist

Now that the Duke Nukem Forever project is dead (until it’s sold off and picked up by someone else), there’s a lot of renewed interest in the hilarious list of things that took less time than the Duke Nukem Forever development process.  It lists things such as the Beatles’ entire music career and World War II plus the Manhattan Project.

What struck me was that the list itself has been around a long time.  I was laughing at it years ago, and though it was updated just today, most of the items on it still date back to the original list (circa late 2005/early 2006, I think).

So I present to you — and read this carefully; it’s not a mistake — a list of things that happened since the List of Things That Have Happened Since Duke Nukem Forever Was Announced was written.

  • Barack Obama announced his candidacy, slogged through the longest Presidential campaign in American history, and was elected.
  • Hurricane Katrina flooded New Orleans and wiped out much of the Gulf Coast.
  • Ehud Olmert came to power in Israel, pursued a war against Lebanon, and was succeeded by Netanyahu.
  • Chief Justice John Roberts and Justice Samuel Alito have had their entire Supreme Court careers since the list was written.
  • The world panicked over bird flu, calmed down, panicked over swine flu, and apparently dodged a bullet.
  • The iPhone was announced, released, and developed to the point where it could make fart noises.
  • Windows Vista was released, sputtered a bit, and is now reaching the end of its life cycle.

Additionally, the List of Things That Took Less Time Than the Duke Nukem Forever Development has been circulating for longer than each of these things took:

  • The release of all three Lord of the Rings movies
  • The painting of the ceiling in the Sistine Chapel (or, will be true in a few months)
  • World War I (nearly; age of list is uncertain)
  • The development of Windows 95 from Windows 3.1
  • The construction of the Empire State Building
  • The entire run of the original Mighty Morphin’ Power Rangers show plus the first movie.
  • The premier of Firefly, its cancellation, its growth into a geek classic, and the subsequent greenlighting, filming and release of Serenity.

A Problem

I think I have a Bash problem.  What follows is an actual command from my history.

cat /usr/share/dict/words | fgrep -v "'" | perl -ne 'chomp($_); @b=split(//,$_); print join("", sort(@b))." ".$_."n";' | tee lookup.txt | perl -pe 's/^([^ ]+) .*/1/g' | awk '{ print length, $0 }' | sort -n | awk '{$1=""; print $0}' | uniq -c | sort -nr | egrep "^[^0-9]+2 " | awk '{ print length, $0 }' | sort -n | awk '{$1=""; print $0}' | perl -pe 's/[ 0-9]//g' | xargs -i grep {} lookup.txt | perl -pe 's/[^ ]+ //g' | tail -n2

It’s just so hard to bite the bullet, admit that the problem has grown in scope, and move it to its own Perl/Python script.  (P.S. The Guinness Book is wrong.  “Conservationalists” is not a real word.)

Edit: to those who are competing in the comments to improve (shorten) the above command: when pasting code, use the <code> tag to override WordPress quote formatting.

Joey Comeau has a new book out based on Overqualified, which has long been one of my favorite things on the internet.  He writes cover letters to companies.  They each sound businesslike enough for the first paragraph or so, and then you gradually realize you are reading something that is in no way a normal cover letter.  An excerpt from one to Nintendo:

We need a new Mario game, where you rescue the princess in the first ten minutes, and for the rest of the game you try and push down that sick feeling in your stomach that she’s “damaged goods”, a concept detailed again and again in the profoundly sex negative instruction booklet, and when Luigi makes a crack about her and Bowser, you break his nose and immediately regret it. When Peach asks you, in the quiet of her mushroom castle bedroom “do you still love me?” you pretend to be asleep. You press the A button rhythmically, to control your breath, keep it even.

#2 (NeoPost), #28 (Phone surveys) and #58 (MySpace) are three of my favorites.