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.

Miscellaneous Friday Notes

For quite a while I’ve done a bad job of managing my email. I’m finally getting my inbox back in order, but there are still tens of thousands of messages — spanning the last year or so — that will probably go unread and unanswered for the near future. I’m going to do some sifting through, but I’ll probably end up declaring email bankruptcy. To everyone who I was a jerk to by not seeing their email, or not replying, I’m sorry. I will do better in the future.

Speaking of things I found deep in my inbox, T. Campbell told me he and Gisèle Lagacé were doing a comic for me last year, and I said I’d pass around the result. So here it is!

Raptor Awareness Day is this weekend! 200,000 attendees! I will spend it hiding in my attic with a tire iron and my Jurassic Park collection.

And lastly, Daniel Cohen tipped me off that apparently Nathan Fillion owns an electric skateboard, too!  To be honest, up until I saw that, I couldn’t name a single other person I knew of who had one.  I wonder if he’s interested in installing Li-On batteries (he says he only gets 6 or 7 miles to a charge).  It’s nice to know I’m not alone.  Although his is 30% more powerful than mine, so the odds would be against me in a race (unless he’s put off replacing the catalyzer on his port compression coil …)

The Pursuit of Laziness

Since I was a kid, I’ve been looking for the perfect way to read in bed. The ideal position would involve no sustained muscle effort, so I could just let my eyes drift shut as I read, without the book falling shut or my hand slipping or anything.  One way is to sit up against something and hold the book on your lap, but that’s not great for falling asleep.  So I usually end up reading on my side.

The problem is, you have to hold the book to see both pages, and in either case, you’re using some muscles to hold it where it is.

This has worked for most of my life, but it’s still not that ultimate relaxation.

However, I recently got a Kindle.  I was intending to use it mainly as a mobile web browser, but I’ve surprised myself by using it to read an awful lot.  And, with apologies to all the bibliophiles out there, I find the ergonomics better than a paperback.  When snacking and reading, I can lay it flat on a table without the use of a book weight to hold it opened, and when lying in bed, I don’t have to keep moving it to read.

But it’s not perfect.  There’s no way to hold it with a finger on the ‘next page’ buttons that doesn’t require a few muscles to hold it upright:

Either I work to hold my hand off the bed, or I awkwardly curl my fingers around it.  Either way, it tips over if I relax my arm, even if it’s leaning against a pillow, and I’m startled awake by this:

I started to wonder if I could do even better.  I got out of bed one night, went to the closet, and got a steel coat hanger and some pliers.  After a few minutes of twisting, I created this:

First of all, it holds the Kindle upright …

And second, it lets me lie there motionless, and turn the pages with just a tiny twitch of my thumb:

Finally, after decades of reading in bed, I have reached that stage of perfect relaxation.

A Date Idea Analyzed

I don’t do conventions very often, but I recently went to ConBust out in Northampton, MA, while visiting some friends.  While I was there, I had a guy propose something fascinating to me.  I can’t remember the guy’s name, so if he or one of his friends sees this, post your info in the comments. (Edit: it was a dude by name of Thom Howe.)

The guy Thom had an idea for a date.  He wanted to rent a cherry picker, drive it to her door, and pick her up in it.

Then, he’d drive to the beach, and get there at just the right time to watch the sun set.

Once the sun had set, he’d activate the cherry picker, they’d be lifted up above the beach …

… and they’d watch the sun set again.

Clearly, this is an excellent idea, and any girl would be lucky to see this guy Thom at her door.  But is it plausible?  How fast and how high does the cherry picker have to go?

I tried to work out the answer for him there at the table, but there was a line of people and there wasn’t time.  But when I got home, I remembered it again, and I’ve worked out the solution.

Here’s the situation:

By the time the earth has rotated through angle theta, the cherry picker will have to have climbed to height h.

After t seconds, theta in radians is:

The height of the lift above the center of the earth is:

So the height above the surface (sea level) is:

Substituting everything so far we get this expression for the height the lift needs to reach t seconds after sunset to stay even with the sun.

Now, an actual cherry picker has a maximum lift rate (I Googled some random cherry picker specs, and 0.3 m/s is a normal enough top lift rate.)  We’ll call that rate v, so the actual height of the lift will be this:

Substituting that in and solving for v, we get this:

(That’s arcsecant, not arcsecond). This equation tells us how fast the lift has to go to get from the ground to height h in time for the sunset1.

But we can also get the answer by just trying a few different heights.  We plug it in to Google Calculator2:

2*pi*6 meters/(day*arcsec(6 meters/(radius of earth)+1))

and find that h=6 meters gives about the right speed.  So, given a standard cherry picker, he’ll get his second sunset when they’re about six meters up, 20 seconds later.

You might notice that I’m ignoring the fact that he’s not starting at sea level — he’s a couple meters above it.  This is actually pretty significant, since the sunset line accelerates upward, and it brings down his second-sunset height quite a bit.  If he got a faster lift, or used an elevator, the correction would become less necessary.  Extra credit3 for anyone who wants to derive the expression for the height of the second sunset given the lift speed and height of first sunset. For now, I recommend he dig a hole in the sand and park the lift in it, so their eyes are about at sea level4.

1 Ideally, we’d solve for h, but it’s inside the arcsec and that looks like it’s probably hard. Do one of you wizards with Maple or Mathematica wanna find the result?

2 If you work in one of the physical sciences and don’t use Google Calculator for all your evaluatin’, you’re missing out.  I wish there were a command-line version so I could more easily look/scroll through my history.  I know Google Calculator is largely a frontend to the unix tool units, but it’s better than units and available everywhere.

3 Redeemable for regular credit, which is not redeemable for anything.

4 I suggest a day when there aren’t many waves.