Help me lazyweb!

Update: See my next post for what I think is a solution.

(I’ve noticed a bunch of people using the term “lazyweb” to mean throwing your question out to a web based audience who might know the answer off the top of their heads either instead of or as well as attempting to research the answer yourself. Works for me.)

I bought two new external drives – one to use as a TimeMachine drive for our laptops, and one to act as a Linux backup disk. I’ve had terrible luck with external USB drives – I’d say fewer than 50% have actually worked right for what I want them for, which is sitting idle 20 hours a day and then doing a nightly backup using rsync. And it’s always the fault of the enclosure, not the drive – ripping the drive out and using the drive as an internal drive and/or putting a new drive in the enclosure has proven that beyond a doubt. So this time I bought Seagate “FreeAgent”s – I figured if Seagate made the drive and the enclosure, there could be no doubt whose fault it was if it didn’t work.
Continue reading “Help me lazyweb!”

Joel on Software

The more I read Joel on Software, the more I’m convinced that if there software jobs in heaven, they’ll look an awful lot like this. Today’s post, called Evidence Based Scheduling, is just one example of the sort of nirvana that I’m hoping awaits me after death if I’ve been sufficiently good, because I sure as hell haven’t seen anything like it in this life.

I’ve certainly seen my share of the ones he gives as bad examples. The schedules passed down from above. The “I’ll give them 30% less time than they said it would take, and then creep the feature list” managers who think it’s motivating to put you under stress, the managers who do the same and then put the blame on you when the project is late, the projects with no schedules and no clear deliverables, but which still manage to make you feel like you’re not producing enough, the “fire 30% of the team but don’t change the schedule” managers, the “if you guys were any good you wouldn’t need so much time for debugging” managers (who not coincidentally are the ones who didn’t give you any time for designing up front), the ones who are as fickle as the wind when it comes to deciding what features are absolutely 100% necessary to win this customer (who turns out to have already decided to go with your competitor), and the “compile it, run it once, deliver it to the customer and if they complain, roll them back to yesterday’s build” ones.

Yes, that’s what life is like down here on earth.

Gmail on my Treo

Now that Gmail supports IMAP, I got it working on my Treo. W00t! It’s pretty simple, but you have to use SnapperMail (the expensive version that supports IMAP rather than the cheap version that doesn’t). I created a new account. Obvious stuff under “Your Name” and “Email Address”. Under Server:

  • Incoming Mail:
    • IMAP4 Server: imap.gmail.com
    • Username: yyyyy@gmail.com
    • Password: zzzzzzz
  • Outgoing Mail:
    • SMTP Server: smtp.gmail.com
    • Username: yyyyy@gmail.com
    • Password: zzzzzz

Then click the “More…” button. Change the IMAP port to 993, and the SSL option to “Always Secure (wrapped port)”. Change the SMTP SSL option to “Always Secure (STARTTLS)”. I made a couple of other changes but they didn’t stick, and it’s still working.

The best thing is that if like me you’ve got filter options that label things and skip the inbox, IMAP treats those labels like folders so you can sync them as well. And if you delete something on your Treo, it gets archived but not deleted on GMail.

I can’t wait to see how well this work with the new Leopard Mail.app. I hated the way Mail.app worked with multiple accounts and multiple folders in Tiger, but I’m told that’s all fixed now.

Today’s “Little Bobby Tables” Moment

Ever told yourself “oh, I don’t have to sanitize the input because I’m the only person using it” only to have it bite you in the ass?

When I’m loading waypoint data into my database, I calculate the magnetic declination of each point using a program that I got years ago and hacked the hell out of. I call it magvar, because declination is sometimes (incorrectly) called “magnetic variation” and I didn’t know any better when I did it. The program as it was written prompted for input (latitude, longitude, elevation and date) one number at a time, validated it, parsed the World Magnetic Model (WMM) data file, and told you the declination and a bunch of other stuff about the location. Well, I needed it to be faster than that, so I had it pre-parse the WMM file, then it sat there in a loop where it did a "sscanf" of the four input numbers (C programmers are now shuddering in horror), and printed the output, and then my perl script did an "open2" to open a pipe to write the four numbers on, and another pipe to read the result. And that’s worked pretty well up until today.

Today I was loading some new datasource, and I noticed that about 75% of the way through, it was hanging. And it appeared to be hanging in the write to the magvar program’s input pipe. I tried commenting out the call, and it ran fine, but of course it didn’t have any declinations. So I put the call back in and ran it again. And then attached to the executable with gdb (some old atrophied skills suddenly got refreshed in memory). And that’s where I discovered that the program seemed to be stuck in a write. And going up a few levels into the code that I’d touched and dumping the local variables, the input latitude and longitude seemed to be indicating a waypoint that was one of the first ones input. That’s when I had another look at the data I was feeding the program. And that’s where I discovered instead of writing 4 doubles that scanf could happily read using "%lf %lf %lf %lf", I hadn’t noticed that on some of the waypoints in this new datasource, the elevation was given as "apprx 123". I didn’t bother to look in detail what happened at this point, but I assume my unchecked input caused the magvar program to go into an infinite loop, spewing out the same declination value over and over onto the perl program’s input pipe until the pipe filled up.

And I haven’t learned my lesson – I have no plans to fix magvar to validate its input. I’m just going to make sure this particular data loader program does a
$elev =~ s/\s*apprx\s*//;
before calling it.