Why the Pernice Brothers Don’t Tour

From “Will he/they tour?“:

JP: We make any money if we tour for two weeks?

JL: You mean ten days, if rehearsals are included.

JP: Yes.

JL: No.

JP: Well then why would we do it?

RM: Because Menck wants to rock.

JL: Theoretically, the tour is just one piece of the things you do if you want to sell records.

JP: We don’t sell enough records at shows to justify that. Especially if YOU work the merch table, because people are scared of you.

JL: Theoretically, it’s not just the stuff you sell at the show, it’s the review that you get in the local paper, the placement you get in the local record store, none of which happens if you don’t play a show in that city.

JP: So you think we should tour?

JL: The extent of the fuck I do not give about whether you tour can’t really be measured.

RM: Doesn’t anyone care that Menck just wants to rock?

PHP UTF-8 string class

A couple years ago I put together a class for UTF-8 strings, kind of a smart wrapper around Harry Fuecks’s phputf8 string functions. All Utf8String objects—if I’m not missing bugs!—are guaranteed to house valid UTF-8 strings. The factory, make(), enforces UTF-8 validity, stripping non-UTF-8 bytes (default) or replacing them with Utf8String::$replacement (? by default).

$str = Utf8String::make('āll īs & ōk');

All the major string functions are methods with similar signatures (dropping the input string argument). Since native string assignment is always a copy, I felt all Utf8String objects should be immutable to avoid accidental referencing. After the following line, $str actually points to a fresh Utf8String object:

$str = $str->ucwords(); // Āll Īs & Ōk

Of course this means they’re chainable:

$str = $str->strtolower()->toAscii(); // all is & ok

Casting to string does what you’d think:

echo $str; // out come UTF-8 bytes.

Checking for UTF-8/ASCII-ness can be slow, so methods that create new objects propagate this info into the constructor so the new objects don’t have to check again. The constructor is private to avoid misuse of those arguments. I also threw in some convenience methods:

// input() returns false if $_POST['msg'] isn't present
if ($msg = Utf8String::input($_POST, 'msg')) {
    echo $msg->_; // escape with htmlspecialchars
}

In theory a framework could use a class like this to force safer string handling throughout:

function handleStrings(Utf8String $input) { /**/ }

It’s a proof-of-concept anyway (it’s missing preg_* methods and a lot of other stuff), but if the API could be ironed out, someone could make it into a proper C extension.

Research Chain E-mails in 30 Seconds

A friend or family member has just forwarded you a wonderful piece of propaganda: It’s filled with inflammatory bare assertions, stirring anecdotes, and a dare to pass it on to everyone you know! And no sources.

1. Find a phrase in the message that’s a) unlikely to appear in anything else on the web, and b) contains minimal or no punctuation.

Bad: “Really important!!! Will take thirty seconds to read+-+-+Aren’t you mad!?!?”

Good: “Many citizens had no idea that members of Congress could retire with the same pay after only one term”

2. Search for the phrase without surrounding quotes.

3. Look for results on sites with names like: Snopes, Urban Legends, Politifact, Truth or Fiction, Hoax Busters, etc.

4. If you can’t find any page debunking your forward, search again with quotes around it, try another phrase, or add “hoax” or “myth” to the search. E.g. the next phrase in the e-mail with “myth” added returns the same top three results, all to myth-busting sites.

If you still can’t find anything, you have scientifically proven the forward to be 100% true! If the message confirms your preexisting beliefs, it must be true.