If you blog it they will come?

Friday, December 16, 2011

The power and insanity of C++ templates

exhibit 12941b: analog literals

it is possible for this to compile as valid c++ code:

assert( ( o-------------o
|L \
| L \
| L \
| o-------------o
| ! !
! ! !
o | !
L | !
L | !
L| !
o-------------o ).volume == ( o-------------o
| !
! !
! !
o-------------o ).area * int(I-------------I) );

here's more: analog literals
still more: yep, they're turing complete

why, bjorne, why?

Monday, November 21, 2011

Don't use defaultCStringEncoding

It isn't exactly news that this innocuous-sounding parameter is "considered harmful."
But this fact needs a bit more SEO-juice, so here's another voice speaking out against defaultCStringEncoding:

(from NSString.h):

/* User-dependent encoding who value is derived from user's default language
and potentially other factors. The use of this encoding might sometimes be needed
when interpreting user documents with unknown encodings, in the absence of other hints.
This encoding should be used rarely, if at all. Note that some potential values
here might result in unexpected encoding conversions of even fairly straightforward
NSString content
--- for instance, punctuation characters with a bidirectional encoding.
+ (NSStringEncoding)defaultCStringEncoding; //Should be rarely used

Friday, April 1, 2011

write about a song in 400 words or less

Coast to Coast is the first track on Elliot Smith's final, posthumous album "From a Basement on a Hill," and it sets the tone for the rest of the album: disjointed, dense, fraying and beautiful.


Coast to Coast begins with a portion of the song played in reverse. Enter twin lumbering drum tracks and an out of tune slide guitar lead. I've listened over 50 times and just now realized that Elliot's whistling along with the guitar track. His first line: "Last stop for a resolution."

The lyrics are juvenile, but cognizant and self-examining. Elliot has no new ideas and is therefore useless to those who are expecting more (including you!). Instead of deliberate invention, he takes a "kitchen sink approach," and shovels all of his recording and songwriting reserves into the studio cauldron (did he know beforehand that this would be his final effort?).

This "kitchen-sink" approach explains why there's at least 3 guitar tracks, a piano track, a distorted bass, 2 drum tracks, 3 separate vocal tracks, several additional "background" tracks featuring a lightning-speed poetry reading (and whistling). It's chaotic, but its beauty is evident in the way "Coast to Coast" grows and reveals itself with every subsequent listen.

At any moment, the wheels could detach from the wagon and the barely-together instruments which compose the song could careen into the abyss. Yet "Coast to Coast" marches ahead with minor regard for refrain or repetition, as Elliot bemoans that he's "got no new act to amuse you." Its structure is unconventional, and the rapidity of changes suggests a songwriter who is easily bored, or seeking to outdo himself. The droning piano, which would normally have a centering effect, somehow edges us closer to the brink.

At around the 4 minute mark, the poetry track which was submerged in the mix bubbles up. Is it the outside world leaking in? The spoken words supplant us from a musical trance, especially if we reacted to them by yanking off our headphones.

As the instruments slide into a black hole, these voices take over, and the track ends. We missed the last stop; nothing is resolved.