I gave my GWT presentation to my fellow developers and the two project leaders today. I think it went very well.
Continue reading “GWT Demo – I rule!”
Category: Geekery
Passive-agressive problems call for passive-agressive solutions
The new president of the flying club has been a member since Orville and Wilbur signed him off for his license. And like a lot of old-fart pilots, he seems to resent any attempt to get him to use more computer technology than just the bare minimum to get a weather briefing. (I should mention in passing that he also seems baffled by the concept of a period (full-stop for you UK readers), and seems to randomly sprinkle the gaps between his sentences with anywhere from 3 to 5 of them. It’s like reading somebody from somebody who mumbles and just trails away to nothing at the end of every sentence.)
Because of some big decisions that have to be made in the club, and the fact that with the shrinkage in pilot numbers probably nearly half the club are either on the Board of Directors or are club officers, I decided to open up the officers mailing list to BoD and asked all the officers and BoD who were not currently on the mailing list to join. When that didn’t work, I used the mailman “send an invitation” function to invite them all, including the new President.
Continue reading “Passive-agressive problems call for passive-agressive solutions”
There’s no such thing as a perfect solution
I’m still trying to find a way to deal with the problem of assigning Canadian waypoints to their correct province. The first thing I did was grab George Plews Airports In Canada data file, which as well as giving me hundreds of new airports that I didn’t have already, also made sure that all my airports were in the right province. But I’ve still got problems.
Continue reading “There’s no such thing as a perfect solution”
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.
That’s your job, isn’t it?
Our company has a translation group. Normally we send off our properties files, and we get back the versions for the languages we support in this application. Sometimes we get a few questions from the translators, usually just a clarification of how we’re using a term or a request for some context. I send back and answer, and a few days later I get my translation.
I don’t think their Chinese translator quite understands this process though. I got back a list of translator questions from him, and it’s all stuff like “Please confirm this translation of the string ‘Foo Bar'” followed by a string of Chinese characters. Or “Should the word ‘Digest’ be translated or left as English?” I feel like writing back and saying “HOW THE FUCK SHOULD I KNOW? YOU’RE THE ONE WHO CAN SPEAK CHINESE!” But I won’t. Instead I’m writing to his manager to explain that we can’t answer his questions because we don’t speak Chinese, and leaving out the part about how if we did speak Chinese we wouldn’t need them.