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.

Book!

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.

http://vkcouplestest.com/

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.