Archive | Life
What’s Your Command?
Thanks to Brandon for the meme.
684 [mikeh@gideon]>history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}' | \\
sort | uniq -c | sort -nr | head -10
69 cd
64 l
51 time
31 python
28 make
23 matrix
19 sudo
17 less
13 ./getdistance.py
10 sqlite3
Things You Say Only If You Are The Parent of a Toddler
In addition to what Gina said, here is a collection of some funny things that Gina and I have been saying to Leah:
- “If you are going to go on a journey with me, you have to have pants.”
- “Tell Daddy he’s stinky.”
- “It’s summer. We don’t wear jackets in the summer.”
- “I don’t want to dance like that.”
- “Where do you go when you have to go potty? You can’t just go on the couch!”
- “We call this ‘tired energy’.”
- “No, she doesn’t sleep until she sleeps.”
- “I am dancing.”
- “Don’t play with your potty.”
To the Bid Snipers
Dear eBay Snipers,
You tried, you really tried to snip all my bids away. You frustrated me a lot — a lot — I never thought I would suceed. I was down to less than a minute several times, but you guys and gals always stole it away. Not matter how I priced it, you did it.
I thought that the sniping would be over towards the end of the week-long flood. Alas, no. The sniping continued. Soon the flood would be over and I would be out of luck. I relunctly raised my final price and, finally, I prevailed.
So, to you snipers, I say, “I spit in your general direction!”
Studio 60 on the Sunset Strip
Gina and I are timeshifters, so that is why I’m talking about a TV show the premired a couple of nights ago — we just watched it last night.
Of course, I’m talking about “Studio 60 on the Sunset Strip,” probably one of the most talked about shows this season. And for good reason — it’s Aaron Sorkin created and writing, and it’s got a great cast. I was a fan of the early life of “The West Wing” but totally missed “Sports Night”. Gina was the other way around — she loved “Sports Night” but totally missed “The West Wing.” Afterwards, we talked about how we both got different sides of Sorkin (comedy and drama) and “Studio 60″ combines them both. And, strangely, it works.
Of course, we are hooked at the beginning when the producer of a sketch comedy show is angry that a skit has been pulled by the network, so he interrupts a live skit and launches into a tirade about how terrible TV is. The rest of the episode is the network trying to save face. They eventually bring back the original Golden Boys of “Studio 60″, who were thrown out of their jobs and became big names in their own right.
It’s Sorkin, so it’s preachy. Besides the tirade, the skit that is pulled is called “Crazy Christians”. This brings up a dialog Christians and, we discover, one of the cast of the show is a Christian, put out a Christian CD, and even performed on The 700 Club. Some Christians were apalled by the dialog about Christians but I was not. In fact, by being angry about it and ranting and raving all the time, you are making Sorkin’s point. He talks about how idiotic Christians can be, and he’s not off base.
I’ve talked enough about the writing, but equal credit goes to the cast. Matthew Perry and Bradly Whitford were perfect as the Golden Boys who are talked into returning. They have the hard task of appearing as two men that have been friends for a long time and have been through thick and thin. And they pulled it off extremely well. Amanda Peet surprised me as new network president — young and smart, it was fun watching her calmly pull the strings to make sure she got want she wanted. Stephen Weber as also excellent as the money-grubbing chairman who got rid of Perry and Whitford from Studio 60 originally.
Of course, this is a pilot, so it’s going to set up the scene and capture you. It’s not the best pilot I’ve ever seen. That goes to “Lost” but I stopped watching that after a few episodes. I don’t plan stopping to watch “Studio 60 on the Sunset Strip” anytime soon.
A techno-geek geocaching holy grail
If you’ve been following my geocaching posts, you have probably realized that I keep everything in a GPX (read: XML ) file and go lookups on that. The reason is simple: with a GPX file you can keep everything together in one place and use GPSBabel to do “queries” on that. An important query for me is finding the distance away from one point to a geocache in my GPX file.
I wrote many shell scripts to manipulate data into GPX files and to query against them. But, eventually, my XML-as-a-database abstraction ran into problems:
- I wanted to be able to choose a waypoint (geocache or otherwise) by name and find all the geocaches around it. Doable with some Python DOM-fu, but not something I wanted to do a lot of.
- Mucking with the GPX files, especially those with Groundspeak’s namespaces is bulky. The size is huge.
- I wanted to easily mark a geocache that I had found as “Found” but keep it in my records.
All of this means that my abstraction is leaky. The real solution was to put it in a database but manually figuring out the distance between two latitude and longitude coordinates is not trivial. I could do it at the database level, but the only decent, free DB with geographical support is PostGIS, which implies a lot of overhead for my little stuff. Not that I’m complaining — it’s just not something I wanted to do.
I was looking for something else last night when I saw this on the close method in the Geo::Distance documentation. Huh? A DBH filehandler? Sqlite database? Oh, it seems I can point Perl at a database of waypoints and it will find the closest points to the given latitude and longitude. This is what I’ve been looking for.
Using Geo::Distance is a piece of cake. Making the database is a different story. I grabbed Python and SQLObject and created two tables — waypoint, which contains the latitude, longitude, name, and description from the GPX file. Then another table called cache that contains the geocache-specific information — container type, diffculity, etc. That way, I can have waypoints that aren’t geocaches, so I can still query on them.
Then the diffcult part — writing a GPX to DB converter. It was easier than I thought, because I combined SQLObject to represent the databae and cElementTree to work the XML and *poof* things were converted. I first worked on my found cache list and then a list of caches from an upcoming trip. Very easy. Then I worked my “master list” — the 8MB GPX file. I had to do some massaging, but it turned out nicely. And the SQLite DB is just over 1MB — much smaller than the GPX file!
I haven’t posted anything yet, because it’s still a little rough. That said, if you read this via Google and want a copy, drop me a line and I’ll ship it off to you.
