Math is hard

I spent the whole weekend trying to get some DAFIF boundary and special use airspace data into my waypoint generators. It’s something I promised Kevin from Flight Master a while back.

Well, it turns out not to be all that easy. Part of the problem is simplifying the data from the formats that DAFIF provides it into something that I can put into a relational database and then spit out in a format that Flight Master can use. But the problems I spent most of the weekend on are doing spherical trig. The DAFIF data defines arcs two ways – either as the center point, radius, direction and the start and end bearings, or as the center point, radius, direction, and the start and end points. Flight Master wants just the former, so I have to detect the second case, and use one of the formulas in Ed Williams’ Aviation Formulary to find the bearings, with a little help from "use Math::Trig;". A couple of places, the DAFIF data gives both definitions, which is useful to test my implementation. So that problem was solved.

Now comes the other problem – the one that I spent most of Sunday on and still haven’t solved: How to find the actual geographic extents of circles and arcs. For circles I can go back to the Aviation Formulary and project from the center the radius at 0, 90, 180 and 270 degrees. I’m sure there are wierd cases near the poles where that doesn’t give the actual extremes, but to hell with it, this is as close as I’m going to get. BTW: This is where the intrepid hero discovers that perl’s “%” operator only works on integers, and after kicking himself over the wierd results for a while writes his own “mod” function.

But discovering the geographic extents of an arc is harder. I still haven’t licked it – I think I’m going to have to look at the arc’s start and end bearings and directions to determine if it does through any of the 0, 90, 180 or 270 degree bearings and project them as I did for the circle, otherwise use the end points. Doesn’t sound so hard, does it? And it probably isn’t.

The next challenge will come when I try and produce a geographic index, either using grid buckets (Kevin’s choice) or quadtrees (my choice). To do either of those is going to require proper data structures, and nested data structures, and doing this sort of thing in perl is … sub-optimal. I’d much rather use a language that has proper data structures – even a “struct” declaration in C would suffice. But my web host doesn’t have Java, and I don’t know python yet, and I don’t particularly want to delve into the mysteries of doing ODBC in C or C++, so I’m probably stuck with perl.

Wish me luck.

Send me money!

This guy is either really really clueless, or has… nah, he’s just really really clueless:

Rent A Coder – Build me money making website please


Description:
I would like someone to build me a good website that will make me around $1000 a week or more. The website should be useful and not have any popups. I would like you to design the whole entire website. The content as well. Would like the website to have a lot of traffic as well.

Thanks to Baz for the link.

Web proxy stupidity

At work they force us to use a web proxy. One of the things they do with this web proxy is block access to “inappropriate” web sites. Kind of embarassing when somebody sends you a URL and you paste it into your browser only to find that it’s blocked with the category “Adult Content” – especially since your manager gets a report of blocked sites you attempted to visit. Recently, I’d hit a bunch of sites that are blocked with the category “Music”, and an explanation that they’re blocking music sites because streaming and downloading music is taking too much bandwidth. Ok, I was actually looking for lyrics for songs I’m listening to on my iPod, but ok, not a big problem. (Usually now I remember to use the Google cache to look them up instead.)

At least it wasn’t a problem until I came back from lunch and hit “Refresh all tabs” on my browser, only to find that The Register is blocked as a “Music” site. WTF? Then somebody sent me a link to a story in The Guardian, and it’s blocked as a “Music site”. Putting two and two together, I tested and found that the other “The Register” link still works, and it appears that every .co.uk site is blocked.

The “access denied” message says you can get it unblocked if you can produce a business case why you need it unblocked. Hard to make a business case for The Register or The Guardian. But I discovered another site that’s blocked – our own company’s UK division. Hmmmm.

Paul’s rules of life, #1

Taking a page here from Tina Marie’s blog, I present #1 in my rules of life:

It doesn’t matter how many fun and interesting people you’ve worked with and for in the past, if you write a bunch of reminiscences about past job experiences, the only person who will find your blog and email you about it is the guy you called a dick.

Oh, and Mike? While your reasons for choosing Microsoft products were probably more valid than I gave you credit for in that blog entry, and I’m really really sorry you’ve got leukemia, I still think in many ways you were a dick. Maybe I should have mentioned some of your redeeming qualities, but hey, this was about me, not about you. I liked you as a person for the most part, but it was your management style and skills that made me think of you as a dick. As for your Quake skills – the consensus over in developer row was that we should change your model to a pup tent with a fire in front of it.

In the good news, my new Powerbook just got scanned at the FedEx facility in Harrisburg PA! This is going to be better than watching my last Powerbook go through FedEx faciliites in Asia.