Web Technologies Are Dumb

Hey, remember how anyone who talks about coding style is all like “use more whitespace. Whitespace makes code more readable,” right? (hint: the answer is “yes.” If you answered anything else, you’re doing it wrong, and you should use more whitespace. Whitespace makes code more readable.)

Well, PHP has this great (read: terrible) idea in which you’re really just writing XML, and the actual code is kinda embedded within it. This means that if you add whitespace in the wrong places, it gets included in the final page shown to users. Usually this is not a problem, because in HTML extraneous whitespace gets ignored. However, if you’re writing true (non-HTML) XML (like, you’re generating an RSS feed or something), apparently the very first line of the file needs to start with <?xml ...?>, or else it doesn’t parse correctly.

WordPress has a file called functions.php, where you put miscellaneous utility functions. I had added a function to it that would append a ‘→’ to all cuts on my blog, I had responsibly surrounded it with documentation explaining what it does and how it interacts with the rest of the system, and I separated it from the previous function with a blank line so they wouldn’t run together and look like a single giant function. What I failed to realize was that functions.php is used in the stuff that generates RSS feeds, which means that suddenly the RSS feed had a blank line before the <?xml?> tag, which meant it failed to parse correctly, and broke. That’s right—I broke my website by adding documentation. This is fixed now, but it’s the dumbest problem I’ve seen in a while. If you ever design a programming language or markup language (or, heck, anything that gets parsed), please, please, for the love of Zeus allow blank lines to be added in arbitrary places without affecting the functionality.

Goodbye, Cruel LiveJournal

I figured I should break my silence to give a quick update of what’s going on with this blog. I’m fed up with the crap that LiveJournal has been pulling recently, so I’m leaving and moving to my own website. The reasons to switch away from LJ have been mounting: reasons I no longer like LiveJournal behind the cut →

Logic Puzzles vs. Hat Problem II

This is closer to the unsolved hat problem I have previously discussed than the solved hat problem I discussed. It made the rounds on a “Math Enthusiasts” mailing list I’m on today.

There are n people who have been given a challenge: tomorrow, a hat will be placed on each of their heads. There are n different colors of hats, and colors can be repeated (or not used at all). Everyone will be able to see the hats on everyone else’s head but not their own. No one is allowed to communicate in any way while looking at each others’ hats. Then everyone is lead away into separate rooms and each person is asked the color of their own hat. If at least one person answers correctly, the group as a whole wins (unlike the unsolved hat problem mentioned above, no one is penalized for an incorrect guess). The people can discuss strategy amongst themselves before the challenge starts, but cannot communicate in any way once anyone gets a hat.

What strategy can they use to guarantee that the group wins?

and for the pedants out there: all participants are told all possible hat colors before the challenge starts (no need to guess what the unseen colors might be), and n is small enough that all colors can be distinguished on sight (it uses less than a million different shades of blue, for instance).

An Unexpected Annoyance

My car keys have an RFID chip in them, and my car has an RFID scanner that allows me to unlock the doors and drive the car without taking the keys out of my pocket. The transceiver in my new cell phone is strong enough that it jams the RFID communication when it’s in the same pocket as my keys. I now need to get in the habit of keeping my keys and my phone in separate pockets. :-P

Edit: to be clear on the unexpected part, not only did I not foresee this issue, I’ll wager that neither the RFID makers, nor the car designers, nor the phone designers considered this confluence, either.

A fun web series

It revolves around Mr. Deity (creator of the universe), his assistant Larry, Jesse (also known as Jesus), and Lucy (short for Lucifer).

More episodes are at mrdeity.com, and extra stuff as well as a Seinfeldesque project they did are on their YouTube channel. Two of the YouTube episodes even feature Michael Shermer and PZ Meyers.

It’s so strange to think that something this entertaining can be made by the same people that did the infamously bad Windows 7 video.

Question for a physicist and/or chemist

I have some wild rice. The instructions on it say to boil some water in a saucepan, stir in the rice, cover, reduce heat to a simmer, and wait a while. When I stir the rice into the boiling water, I also stir in some butter and a spice mix (sugar, powdered soy sauce, onion, sesame seeds, garlic, and some other stuff). I mix everything thoroughly, cover it (so I can’t see what happens), reduce the heat, and wait.

When the rice is done, I uncover it, and all the sesame seeds are in a ring around the edge of the pan. The ring is maybe an inch thick; the pan is about 8 inches in diameter. The butter and sugar are mixed throughout and not clustered in any place, but the other spices, like the sesame seeds, seem to be in higher concentrations in the ring and lower concentrations in the center of the pan. I have a gas-powered stove, if that makes a difference.

Why does this happen?

Science is Awesome: Speciation Happening Within Our Lifetimes

(found via the Skeptic’s Guide to the Universe)

The short version: British bird enthusiasts have (unintentionally) split a population of birds into two separate groups, and over the past 50 years they have slowly but surely been turning into two separate species.

The long version (copied here for fear that the original article will disappear):
Article behind cut →

Ligature Alternatives in LaTeX

I’ve been corresponding with Dario Taraborelli and Will Robertson, and we have concluded a couple things about LaTeX and alternative glyphs for ligatures: Don’t bother reading behind this cut if you don’t use LaTeX →

Like XKCD for History Buffs

Take a look at Hark! A Vagrant:

She also has an LJ at beatonna.

An Interesting Idea