Just a note: thank you to everyone who made it to the events. We raised enough money to build a school!  It’ll be in the Salavan Province, on Road No. 13 South.  We’re not going to torment the kids’ ability to learn phonetics by calling it The XKCD School, but we will be writing a dedication which will go on a plaque.  You guys made this happen — does anyone have any suggestions for what it should say?

Also, I’m currently happily hiding out for a while working on drawing and other projects, but I’ll hopefully be doing some less fundraise-y free signing events around Boston in the next month or two.  I’ll let you know once we have any places or dates!

Physics for Entertainment

Update: I’m finally home after a month or so of nonstop events, including several xkcd book fund-raisers/signings.  I met tons of cool people, we raised a lot of money for the EFF and Room to Read, and at one point I signed a book for a robot.  Thank you to everyone who ordered a copy, by the way!  I hope you like it.  They’re shipping out nicely, and we’re about ready to order a second printing.

The events and travel were a huge amount of fun, and I loved getting to talk to (or at) so many of you cool people.  But I’m an introvert at heart, and after doing that much socializing I feel a powerful urge to hide in my room for about a month.  At some point in my travels I seem to have picked up a cold that’s been keeping me down for a couple days, so it’s just as well that I don’t have any more events on the immediate calendar.  There’s no fever, so it’s not swine flu, but it’s keeping me awake at night and I’m going through a lot of tissues and cough medicine.  But it should blow over in a couple days, and then I’ll get to spend a while quietly working on new projects!

While I’m doing that, here’s a bit about a neat book I found recently:

Physics for Entertainment:

Physics for Entertainment was written by Yakov Perelman in the 1920’s (in Russian) and updated periodically through the 1930’s.  There are actually two parts to it, but Volume 1 is long out-of-print (though findable online — more on that later).  The book I have is a 1975 translation of Volume 2. The book is a series of a few hundred examples, no more than one or two pages each, asking a question that illustrates some idea in basic physics.

It’s neat to see what has and hasn’t changed in the last century or so.  Many of the examples he uses seem to be straight out of a modern high school physics textbook, while others were totally new to me.  And some of the answers to the questions he poses seem obvious, but others made me stop and think.  The diagram to the right shows a design for a fountain with no pump — it took me a while to get why it works.  (For an easier-to-build variant, click here.)  Later in the book, he explains the physics of that drinking bird toy.

It’s written in a fun, engaging, conversational style, as if he’s in the room chatting with you about these neat ideas.

There are a lot of diagrams:

And it’s hard not to like the guy:

“If you’ll bear with me for a moment, let’s analyze this fairy tale from a physics standpoint …”  That’s a man after my own heart.

He also spends a lot of time discussing why various perpetual-motion machines won’t work.  it’s interesting to see that there was as thriving a community of free energy people a century ago as there is now, many of their designs based on the same misapplications of physics.

Lastly, when he talks about space travel — from a pre-space-age perspective — he turns starry-eyed and poetic:

I alternate wildly between thinking that it’s totally crazy that we clawed our way up out of the atmosphere and walked on the moon, and thinking that it’s a shame that it turned out to be so boring.  But I really desperately want to see more missions to places like the Jovian moons. If it turns out one of them is teeming with life, we’re gonna feel awfully silly about how long we spent shuffling around in the Martian dust.  Also, Kepler is really exciting, putting us in a much better place to speculate about life in the galaxy.

You can get the printed Volume 2 on Amazon, while Volume 1 was supposedly unavailable for translation or reprint.  However, I mentioned this book at one of the events recently, and reader Matthias Kübel emailed me to let me know Volume 1 is available free online!  I’m looking forward to reading through it.

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 email, not 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.