State of the Union 2008

It was like watching the father of the groom giving a toast at a wedding of inconvenience. As he extolled the virtues of his son (who perhaps somehow maybe played a part in the need for such a wedding in the first place) and the dual-edged glory and hardship that lay ahead for the newlyweds, his half of the audience whooped and hollered while the unamused friends of the bride sat still with the most annoyed looks on their faces that could possibly be mustered. The smug uncle of the groom sat next to the horrified but accepting mother of the bride, carefully placed just far enough behind and above the father of the groom to prevent any spontaneous fisticuffs.

The one thing everyone seemed to agree upon, even without articulating, was that everyone would be glad when the toast was over.

The Power of APT

I just did an apt-get --help on one of my Linux boxes. At the end of the usual commands and options came the following statement:

See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
This APT has Super Cow Powers.

Now THAT is some APT!

CppUnit on OS X

I have been trying to get a simple C++ test to run using CppUnit on OS X. Unfortunately, I was running into problems left-and-right, no matter what approach I tried (Xcode or GNU build tools).

Finally, I stumbled across the following bit of advice.

I rebuilt CppUnit from sources using the two specified command lines (./configure and make are two separate commands in case it is not clear from the example). Then I did a clean and build-and-go in my Xcode project and IT FINALLY WORKED.

nginx X-Accel-Redirect gotcha

In one of my Rails apps, I was trying to serve up a (potentially large) file by leveraging the X-Accel-Redirect response header for nginx (instead of serving the file up directly from Rails). The idea is that you provide a guid for a file and my Rails app figures out which file you want and tells nginx where it can find it. The directory where the files are stored is not directly available via nginx; it uses an “internal” location like this in nginx.conf which points to the literal location /var/where_i_put_stuff/files_you_cant_see:


location /files_you_cant_see {
root /var/where_i_put_stuff;
internal;
}

Everything was working fine during my informal testing. But when I tested it through the application, it would immediately run up to the file download limit and error out. Sure enough, the logs showed that Rails was asked five times to download the file, even though I really only asked once. What’s up?

It turned out to be really simple. The path I was telling nginx to download from didn’t match the path I had configured in nginx.conf. (In the above example, it was as if I had set the value of X-Accel-Redirect to something like /files_i_cant_see/file_to_download.txt) Once I got those paths in sync, everything fell into place and started working great. Interesting behavior, though, to have a missing file essentially fire off an infinite loop!

This was with nginx version 0.5.25.

Sometimes in order to succeed, you have to give up

We went camping at Wallowa Lake, OR this summer.  What a beautiful place!  Of course, it took forever to get there from Bend, but it was well worth the trip.

As is typical when we go camping, Beth and I slept in our sleeping bag atop an air mattress.  This particular air mattress had been replaced several years ago because its predecessor started to leak right around the base of the circular baffles that join the top and the bottom of the air mattress together.

Well, apparently it was time for this air mattress to suffer the same structural defect.  I awoke one morning to find my hip touching the ground and realized I would need to fix this situation if I wanted a good night’s sleep going forward.

In the past, I had been able to super-inflate the mattress and use soapy water to spot the leak.  However, this leak was not cooperating — I would have to get more serious if I wanted to sleep well for the rest of the trip.  So, I took the air mattress to the lake, figuring that if I submerged the mattress, it would yield its leak(s) in the form of air bubbles.  After twenty minutes of pushing, prodding, and otherwise cajoling the mattress into giving up the secret location of the escaping air, I was defeated.  I knew it was there, but I couldn’t find the leak.

I was resigned to several more nights of subpar sleep.  I gave up.

What do you do when you are in a beautiful lake in the afternoon with an air mattress in front of you with the sun heading toward the horizon, much like your summer is sunsetting into autumn?   You jump on your air mattress and soak up some of summer’s final rays — that’s what you do!

It was a split-second after I landed on the air mattress that the telltale WHOOSH from the leak exposed its location.  I mapped the breach immediately by counting the x and y baffle “coordinates,” took the mattress back to camp, let it dry, and finally fixed the leak.

I slept just fine that night.

Three words

If there is one internet-related idiom that has infiltrated society which I could reverse, undo, or otherwise negate and obliterate, it would be these three words:

Thanks In Advance

The usage of this preemptive strike of gratitude, for example, in a discussion group when asking for help, actually demonstrates to me that the writer is so important and so busy that he will not have time to thank someone who generously gave their own time to help the original writer.  If he cannot give his own time to thank me for giving him my time, why should I bother giving him my time in the first place?   How hard is it to say a simple “thank you” after the fact, anyway, even if it’s a blanket “thank you to everyone who helped me!” after your problem is resolved?

It has always been my assertion that there are really only two fundamental desires of most people:  to be appreciated and to be listened to.  (How do you phrase that without a dangling preposition?  Thanks in advance!  NOT!)   How the heck do you appreciate someone “in advance?”

Anyway, to all my friends and colleagues, be sure that if you help me out, it’ll be “thanks in arrears.”  Wait, that doesn’t sound right either…

What I want for Christmas from Apple

Here’s my Christmas wish list for 2007 from Apple:

  1. iChat for Windows with support for video conferencing with multiple simultaneous participants. I have a friend on Windows and another friend on an iMac and it would be wonderful to be able to get us all on at the same time. Same point for my professional colleagues who are on Windows — most in DC but another in TX.
  2. A dock/port replicator for my MacBook Pro.  You want to know how tired I am of unpacking/repacking my power cord, unplugging/replugging my speakers, etc?
  3. Make it a punishable offense to steal focus. This was my number one point I was able to hold over Windows users — that OS X never steals focus from what you’re doing (usually typing). Ironically, it seems that iTunes is now the worst offender in this category.
  4. Resolution independence. I love this high-res MacBook Pro screen; I don’t love how small the letters get at high resolution. Good thing I have “the eyesight of a ten-year-old” according to my FAA medical exam.
  5. A reliable Mighty Mouse. I love my Mighty Mouse, but it has about a 50% failure rate recognizing a “right-click.” Regardless, the scrollball absolutely ROCKS.
  6. Window cycling through Spaces. I love Spaces. I don’t love not being able to cycle through all of the windows in an application (Terminal leaps to mind) when the windows are in different spaces.
  7. Rectangular text selection in Safari. Yes, I’ve filed a feature request for this. Apparently it was a duplicate, which is a great sign!

I’m sure there’s more I could ask for that would make for a nice Christmas from Apple. But if I could have only one thing off my list, it would definitely be iChat for Windows.

Whaddayasay, Santa?

Occam versus House

When I’m troubleshooting a problem, the first tool I reach for is Occam’s Razor. 99% of the time, I find a simple solution to a problem, possibly write a unit test (assuming we’re not talking about a bad ground in my stupid old car), and move on.

Some days, though, I endure my own personal episode of House.

So it was, after trying to track down a particularly unsettling problem where my model observer — which tested out just fine over and over again — simply failed to fire in a staging environment AFTER it worked a few times first. After slashing at the problem with Occam’s Razor to the point where there was nothing left but very tiny bits of flesh (ew), I put on House’s cap (or cane, as it were).

What if the code was, literally, disappearing?

Well, it turned out that was exactly what was happening. For other reasons that remain unresolved, I was instantiating my observer class using ObserverClass.instance as opposed to adding the class to the config.active_record.observers in environment.rb. This, coupled with the unfortunate configuration mistake that kept the site running in “development” mode, and this reloading-all-of-Creation before every new request caused the observer simply to fall off into oblivion as if it had never existed.

And why did it work a couple of times before failing? nginx –> 3 mongrel servers. Succeeded once for each server before the observer went completely bye-bye.

Although the true solution lies in reworking my application-environment-specific configuration, the short term solution was simply to add the observer to the config.active_record.observers after I had instantiated it.