Best Code Comment Ever

Comments left by developers in the dead of the night are inside jokes left for others. Little winks of comic relief left for others that will be parsing through the sub-routines trying to wrangle software to get things working. Usually code comments are short but this one left by a frustrated programmer of a Photoshop viewer is epic.

uint32 sign=[fh readUInt32BE];
uint32 marker=[fh readUInt32BE];
uint32 chunklen=[fh readUInt32BE];
off_t nextchunk=[fh offsetInFile]+((chunklen+3)&~3);
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
// If there are two different ways of doing something, PSD will do both, in different
// places. It will then make up three more ways no sane human would think of, and do those
// too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide
// that *these* particular chunks should be aligned to four bytes, and that this alignement
// should *not* be included in the size? Other chunks in other places are either unaligned,
// or aligned with the alignment included in the size. Here, though, it is not included.
// Either one of these three behaviours would be fine. A sane format would pick one. PSD,
// of course, uses all three, and more.
// Trying to get data out of a PSD file is like trying to find something in the attic of
// your eccentric old uncle who died in a freak freshwater shark attack on his 58th
// birthday. That last detail may not be important for the purposes of the simile, but
// at this point I am spending a lot of time imagining amusing fates for the people
// responsible for this Rube Goldberg of a file format.
// Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this,
// I had to apply to them for permission to apply to them to have them consider sending
// me this sacred tome. This would have involved faxing them a copy of some document or
// other, probably signed in blood. I can only imagine that they make this process so
// difficult because they are intensely ashamed of having created this abomination. I
// was naturally not gullible enough to go through with this procedure, but if I had done
// so, I would have printed out every single page of the spec, and set them all on fire.
// Were it within my power, I would gather every single copy of those specs, and launch
// them on a spaceship directly into the sun.
//
// PSD is not my favourite file format.
if(sign!='8BIM') break; // sanity check

– via Fark

UPDATE: If you want more code comments, check out Stack Overflow which has a collection of them.

Stanley Cup’s Colorful History

Careful Hayden, you don't know where it's been
Careful Hayden, you don't know where it's been

After last night’s loss to Anaheim, the San Jose Sharks are out of the running.  Might as well post some highlights from the checkered past of the world’s most famous trophy.

  • In 1905, the Ottawa Silver Seven tried to drop-kick it over the Rideau Canal on the Ottawa River. (They failed.)
  • In 1906, it went missing after a photography session. It turned out the photographer’s mother had adopted it as a planter for geraniums.
  • In 1924, the Montreal Canadiens left it by the side of the road while changing a tire.
  • In 1940, managers burned the mortgage of Madison Square Garden in the cup, which the Rangers won that year. (This occasioned a “curse” that kept the Rangers from the cup for 54 years.)
  • In 1980, New York Islander Clark Gillies fed his dog from it.
  • In 1991, Pittsburgh Penguin Mario Lemieux tried to float it in his swimming pool. It sank. (Colorado Avalanche goalkeeper Patrick Roy later did the same thing.)
  • In 1994, Ranger Ed Olczyk filled it with oats to feed Kentucky Derby winner Go for Gin.
  • In 1996, Avalanche defenseman Sylvain Lefebvre had his daughter baptized in it.

via Futility Closet.

Mobile Social Networking “up for grabs” in the United States

Jason Calcanis has a great post on 10 things the new MySpace CEO should do. All of them are good (buy a search engine, add casual games, virtual currency) but I particularly liked his comment about the wide open space for a successful mobile social network here in the US. Japan is leading the way, the US is just not there yet.
Let’s face the facts: Facebook is a much better platform on the Web. MySpace has a lot of work to do just to match Facebook’s offering. However, Facebook and MySpace both suck on mobile phones. Translation? Mobile SNS (social networking services) is up for grabs in the United States.

On my recent trip to Japan, it became very clear to me that the majority of social network activity was occurring on mobile phones–not desktop PCs. No one has built the ultimate iPhone and BlackBerry social networking tools, although some folks are starting to get there. Geolocation tools, combined with the social graph, are the Holy Grail of social networking.

The full post is here.
Reblog this post [with Zemanta]

Traffic Sources and Attention

There’s been good debate around how the source of traffic to sites is changing, shifting from the search engines to social sites such as Facebook and Twitter. I confirmed that I too am seeing a greater percentage of traffic come in via links shared on social sites and shared a colleague’s theory about what this would mean for Google’s advertising revenues. Fred Wilson also posted about this topic here and here.

What about attention? How does the average visitor from a social site compare to someone from a search engine? Niall Kennedy tweeted the following stats from his referral logs:

  • Twitter: 7 seconds
  • Digg: 20 seconds
  • StumbleUpon: 40 seconds
  • Facebook: 52 seconds
  • Delicious: 82 seconds

timespent

Here are my stats for the past year:

  • StumbleUpon: 40 seconds
  • Digg: 42 seconds
  • FriendFeed: 53 seconds
  • Facebook: 60 seconds
  • Twitter: 86 seconds*
  • Delicious: 110 seconds
  • Techmeme: 114
  • MyBlogLog: 176 seconds

Compared to the attention span of those coming from the major search engines we get:

  • Live.com (MSFT): 21 seconds
  • Yahoo: 35 seconds
  • Google : 40 seconds
  • Ask: 46 seconds

It would be interesting to see figures from other sites, especially online shopping sites which are the ones most interested in getting (and therefore likely to pay for) traffic. While it’s clear that visitors from social sites are more engaged with my blog because they tend to hang around a bit longer, that may not be the case with a shopping site where there is less intent to purchase than if they come from a search engine but Mark Essel thinks otherwise.

Increasingly, the flow of web links is being made between individuals via social media sites.  Your good fishing buddy who knows the Bay area, shares a link to his favorite supply store.  As focused communities become populated across geographic barriers, local quality referrals become more likely.  But what if you want to know what store fishermen prefer in San Francisco?  You could simply use twitter search for fishing san francisco.  In real time you could send a message to several individuals who are interested in fishing in that region.

Shared links are compelling but they need to be matched with impulse buying or discoverable when you’re looking for it. I’m thinking of O’Reilly’s flash discount shared via twitter (44% off to celebrate the 44th president) which was effective in bumping registration at the recent Web 2.0 Expo. The other way to generate business via shared links is to make them searchable so you can find what you need when you want it – but then we’re right back at sending traffic via search again.  Yes, you can search twitter but you can find this stuff on Google too.

The jury’s still out as I think this will be a slow shift of behavior that will take a long time to impact existing business models. The real prize is back to social search which would combine the best of the recommendation trusts of social networks with the ability to find what you need when you’re looking for it.

Facebook recommendations married to Google ‘s structure and ranking? That’s the subject of another post.

—o—

* I dug into the Twitter figures because they’re so out of whack with what Niall is seeing and it looks like there are a few visitors that hung out for a long time that are pushing that average higher than it should be.

Reblog this post [with Zemanta]

Web 2.0 Expo 2009

I knew this time would come. The talks about this thing called social media were great because they used to be in small groups, people passing around knowledge as if around a campfire. Now, in an attempt to codify this knowledge, package it for wider distribution, it’s become wooden – formulaic.

I like the fact that this year’s conference was themed, “The Power of Less” and at it least alluded to the fact that maybe it’s time to get back to simpler roots. Tara Hunt did a great job bringing that folksy delivery to the masses in her talk about Whuffie, her delivery is just as important as the message.  John Maeda’s talk riffed on that theme as well talking about the difference between MIT’s Media Lab and the hands-on artists at the Rhode Island School of Design.

Outside the conference there was a company passing out fliers on how to get 8,000 twitter followers without even trying, I’m not clear on the details but they sounded like Snake Oil salesmen. Just down the street was a guy sitting on a milk crate with an old typewriter on his knees. He was offering to type you up a personal poem on the spot. The Power of Less indeed.

“If your product ain’t real-time, you’re dead.” I think that was the gist of a sticker I saw last week. Basically long-form blogging and analysis are dead. Everyone is focused on the quick fix, easy access you get when you’re the first to hear about something and the first to react. Chartbeat is a real-time stats package that feeds right into the real-time web. I love the fact that you can set up parameters so you know when things are outside the norm but I don’t think I need to know exactly how many people are writing comments at any one time. Quitter has been around for a while but I wonder if I really want to know which tweets drove someone to stop following me.

Sometimes it’s better to have the fuzzy resolution of the non-realtime world. More letters, less tweets. A guy I know who runs a stationary store says that business is up.

It’s all about the pile on – jump onto a hot trend on Techmeme and ride the click-thru wave with the rest of them. There was no IRC backchannel this year – everyone was tweeting away their 140-character updates into the massive, public “in-crowd” of twitters. It’s not only about those in-the-know, there are now a subset of those that heard-it-first. Less about the original perspective, more about the twitch reaction. 

As pimping your product via Social Media goes mainstream, the kids that created this unique space are going to look for somewhre else to hang out. It’s looking like that place will be mobile but we’re going to have to wait a bit longer for all the pieces to fall into place. The iPhone taught everyone that it’s not so much the hardware but the application ecosystem that you build up around the device which drives utility. The Palm Pre will hopefully teach everyone that the phone can truely be a terminal to data stored in the cloud and that a small local cache of you cloud is all you need.

22994459I’m hopeful that the next couple of years will bring together that perfect storm of better/faster that tore down the walls between Compu Serve and AOL in the late-90s and got us the internet. Ubiquitous low-cost wireless bandwidth and app stores will do for us today what the 28.8 Supra modem and usenet did for us back then.

Until then, the image of everyone on BART either pecking away at their phone or turning it over and over again while they talk with someone will stick in my mind. I’ve never seen a technology so pervasive in someone’s life. Right now it’s drawing people away from the face-to-face conversation, the bluetooth headset indicates that anyone you’re talking to is secondary to the random caller on your cell. I’m hoping we can reverse that and make something that brings them back together.

John Maeda at Web 2.0 Expo

One of my favorite presentations from this past week’s Web 2.0 Expo is now online. John Maeda, a designer & interactive artist, is now at the Rhode Island School of Design after spending time at the MIT Media Lab.