0xDECAFBAD

It's all spinning wheels and self-doubt until the first pot of coffee.

Think of everything but the obvious first

Today's revelation while tinkering with my PersonalWebProxy: Decompressed content is larger than compressed content.

See, I was decompressing gzipped content streams in the proxy in order to fiddle with the content before it got to the browser, but then I noticed that browsers kept only displaying part of the content. I remove the in-proxy decompression, things are fine. Put it back in, things get cut short. I poke for a few hours at various bits and parts, to no avail.

Then, finally I remember... "Hey, you know, I think browsers pay attention to that Content-Length header. And hey, you know... decompressed content is larger than compressed content." Bingo. Problem solved by keeping the Content-Length header updated with the length of modified content. This makes me feel very dumb, because it's not like I haven't written a handful or two both of HTTP clients and servers. And I've written code that uses the Content-Length header, over and over again. I'd've thought this would be something I'd remember more quickly.

More often than I'd like to admit, remembering simple and obvious things like the above are what unlock problems that I'd been banging my head against. The last revelation of this nature I had while frustrated at a project at work was: "Not all months are 31 days." And before that, "Not all days in a year are 24 hours long, due daylight savings time."

Trying to think of more, but I thought I'd share. Maybe I'll start a wiki topic for sage bits of the ObviousInHindsight.

shortname=oooceg

Archived Comments

  • I find that 80% of my programming time is spent solving obvious and mundane problems. The other 20% is actually productive... If I could fins a way to get past the things that make me smack my head, I'd be a programming god.
  • I spent a while working on a system for PowerGen, a UK electricity company. Electricity is traded here in half hour slots and I reckon I spent about 25% of my time coding to cope with the time when there are 46 or 50 half hour slots in a day sometimes. There were all sorts of calculations that needed to be done for the generators to do with ramping up and ramping down and changing output. The companies promised never to change anything during the autumn/fall clock change when we had a "repeated" hour.
  • Ah, yes, the "I am SUCH an idiot!" moments. I dearly *hope* they happen to everyone. 'Cuz if they don't... man, I am *such* an idiot!