MacWorld Keynote: First Reactions

Tuesday, January 9th, 2007

The AppleTV is underwhelming. You mean I have to pay $300 for yet another box to balance on my already crowded dresser along with the cable box, VCR, DVR, and DVD player? All so I can buy movies from iTunes and network movies with my Mac? Sorry, that’s not nearly enough value for the money. For $300, it would have to replace at least one, preferably all, of my existing boxes. I’d actually be more interested if it ran the other direction. That is, if it let me broadcast my TV signal to the computer. That would let me ditch one cable box (the one hooked up to my computer).

The iPhone is cool, and I was almost ready to buy one until I noticed it required a 2-year Cingular contract (and wouldn’t be available till June). I guess the rumors that Apple would sell it unbundled and unlocked were false. The UI may well be a quantum leap over everything else on the market, but the business model is the same consumer-hostile crap we’ve been seeing for years. I expected better of Apple.

No new Macs. No new software. I guess new PowerMacs, Minis, and MacBooks will trickle out over the next few months when they’re ready. No new iLife. No new iWork. No new Leopard. (Maybe that will arrive at WWDC.) Will anything else be announced by Apple at the show? I hope so. So far, I’m feeling let down.

Perl and Multiple Line Ending Characters

Saturday, January 6th, 2007

Perl uses \n (the linefeed) as its default end of line character (record separator). You can change this with -0 option on the command line to be \r (carriage return), \r\n (carriage return linefeed pair) or something else. For example, this command sets the record separator to \r before replacing every occurence of the string foo with the string bar:

$ perl –pi -e -00d ‘s/foo/bar/g’ test.html

However my files are a weird mix of Unix, Mac, and Windows conventions. A few files may even use several line ending conventions in one file. Most modern text editors can autodetect and deal with this without any problem, as can XML parsers. However as near as I can figure, Perl cannot. It expects me to know in advance what kind of file I’m feeding it.

Is there any simple way around this? There’s more than one way to do it, but is there more than one $/?

All Dollars are Equal: A Common Economic Fallacy

Thursday, January 4th, 2007

Here’s an example of an all-too common fallacy in assessing the rationality of economic actors. It comes from Daniel Kahneman and Jonathan Renshon in Foreign Policy in an otherwise interesting article:

Imagine, for example, the choice between:

Option A: A sure loss of $890

Option B: A 90 percent chance to lose $1,000 and a 10 percent chance to lose nothing.

In this situation, a large majority of decision makers will prefer the gamble in Option B, even though the other choice is statistically superior. People prefer to avoid a certain loss in favor of a potential loss, even if they risk losing significantly more.

Kahneman and Renshon believe Option A to be the rational choice, but in fact Option B should be preferred by most people, most of the time. Do you see why?
(more…)