GPX GPS trace files and elevation gain
Submitted by ckdake on Mon, 2008-06-23 13:07I carry a GPS with me on long bike rides and pull the resulting trace into Google Earth and Garmin's MapSource software. Google Earth is nice for looking at, but doesn't provide much useful information, and MapSource is pretty awful to look at (and will only run in Windows so I have to boot up VMware) but does provide elevation maps (as well as the ability to load maps). I recently started using a bike computer with cadence, and a heart rate monitor, and the last missing piece of information was total elevation gain over a ride. This information is nowhere in MapSource or Google Earth.
I can get GPX format (The standard interchangable format for GPS information) files out of MapSource and it's just XML, so after trying several tools online and several programs I downloaded that didn't work, I wrote a quick python script to get me the info I want. Hopefully this will help someone else:
from xml.dom import minidom
file = minidom.parse('./file.gpx')
min = 1000000
max = 0
gain = 0
loss = 0
last = 0
for node in file.getElementsByTagName("ele"):
cur = float(node.childNodes[0].data)
if (cur > max):
max = cur
if (cur < min):
min = cur
if (last != 0):
if (cur > last):
gain = gain + (cur - last)
elif (cur < last):
loss = loss + (last - cur)
last = cur
print "max: %.2fft" % (float(max * 3.2808399))
print "min: %.2fft" % (float(min * 3.2808399))
print "gain: %.2fft" % (float(gain * 3.2808399))
print "loss: %.2fft" % (float(loss * 3.2808399))
So for my 43 mile ride on sunday:
max: 1110.63ft
min: 773.16ft
gain: 3328.98ft
loss: 3232.78ft
Getting those numbers were a lot harder than it should have been! Good ride though..
riding bikes and Faster Mustache: RACE
Submitted by ckdake on Tue, 2008-06-17 12:12I had my last set of X-Rays yesterday and while it's very obvious where the break was, it's mostly healed and I can perhaps try some mountain biking again soon! I posted about my new road bike exactly a month ago, and in that month I've put 500 miles on it. Every morning during the week except Wednesdays I ride for ~2 hours, usually with a few other people, and on weekends I try to do ~3 hours twice. Sunday I rode out to Stone Mountain and did a lap around it before coming back, usually it's just a turnaround point, and in the mornings I've followed green arrows marked with "safari" (turned out to be ~25 mile tour to 8 parks with some hunting for the route at each one), gone on known routes such as the Outback Bikes Wednesday night ride route, and come up with a few of my own including one that is definitely going to be a regular route and put online somewhere. It's great to not be stuck inside on the trainer any more!
In related news, the Faster Mustache race team had our first organizational meeting last night. We're doing very well in lots of races: everything from 3rd place in an expert levels trials competition, to taking the vast majority of top 10 finishes in sport level mountain bike racing, to winning both our category and overall at a 24 hour mountain bike race in Conyers, GA. However, sponsorships have been very slow! If you'd like your name on our website, it only takes $25 and for $250 and up, you can have things like: your company linked to from our website, your logo on our jerseys, your logo on our tents and banners at races, etc! Please get in touch with me if you'd like to know more about sponsoring our team! Just email team@fastermustache.org! Every little bit helps because the team covers 50% of entry fees for people that commit to 10 races a season, and races cost between $20 and $100 a person to enter.
Griffin PowerMate and Rhythmbox
Submitted by ckdake on Tue, 2008-06-03 18:25I was going through some drawers and stumbled across my good old Griffin PowerMate that I got back before I started using Linux. It controlled iTunes in Mac OS 10.1 and was great because I could change volume and pause music without having to change programs or anything. These days I use Rhythmbox in Linux to listen to music and theres not a plugin for it. Yet!
Rhythmbox supports plugins written in python, a guy has some skeleton python code for talking to the powermate, and that means something could work out!
I got the powermate working by compiling and loading the powermate module for 2.6 linux kernels (In 2.6.23 it's in Device Drivers -> Input device support -> Miscellaneous devices -> Griffin PowerMate and Contour Jog support), adding a udev.d entry:
# /etc/udev/rules.d/45-powermate.rules
KERNEL=="event*", SYSFS{product}=="Griffin PowerMate", NAME="powermate", GROUP="users", MODE="0660"
I plugged it in, catted /dev/powermate, and with each twist or push it spit out garbage to the screen. Success!
A quick glance through everything shows that Rhythmbox doesn't support threads and the python code here uses polling so I'd need to delve into the Rhythmbox docs to figure out the best way to do that, but Rhythmbox also exposes itself through DBus and there are some examples of using this around the internet. In a few minutes, I hacked together something dirty to cover the basics and perhaps later on I'll make something that works as a Rhythmbox module. Right now pushing the button is play/pause, turning it adjusts the volume, and the LED shows volume when playing and pulses slowly when paused. Here ya go:
#!/usr/bin/python
import powermate
import dbus
EVENT_BUTTON_PRESS = 1
EVENT_RELATIVE_MOTION = 2
DBUS_START_REPLY_SUCCESS = 1
DBUS_START_REPLY_ALREADY_RUNNING = 2
bus = dbus.SessionBus()
(success, status) = bus.start_service_by_name('org.gnome.Rhythmbox')
proxy_obj = bus.get_object('org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Player')
player = dbus.Interface(proxy_obj, 'org.gnome.Rhythmbox.Player')
pm = powermate.PowerMate("/dev/powermate")
while 1:
event = pm.WaitForEvent(-1)
if (event[2] == EVENT_BUTTON_PRESS and event[4] == 0):
player.playPause(1)
if player.getPlaying():
pm.SetLEDState((int)(player.getVolume() * 255), 0, 0, 0, 0)
else:
pm.SetLEDState(255, 252, 1, 1, 1);
elif (event[2] == EVENT_RELATIVE_MOTION and player.getPlaying()):
player.setVolumeRelative(event[4] * 0.02)
pm.SetLEDState((int)(player.getVolume() * 255), 0, 0, 0, 0)
Download powermate.py and the code above, save the code above as whatever.py, run it, and you'll be able to control rhythmbox with your PowerMate in Linux!
dpchallenge
Submitted by ckdake on Wed, 2008-05-21 09:09I've been participating at DP Challenge off and on for a while now, but my images have rarely finished in the top 50% of challenges. (here's my profile there) Photography is a very subjective thing and the end result of everyones votes can be surprising! I was fairly confident with my entry into the Bicycles II challenge:
but as voting went progressed, it swung around between 4.9 (more typical for me) to 6.8 (a possible first place!). Could I win for once? After the week of voting, I ended up in 15th place out of 135, which is in the top 10%! That works for me. I like first place and tenth place better than mine, but if it was up to me, I would have given myself third :)
Hopefully I'll start doing this more regularly, if only they'd offer and RSS feed of new challenges!
New Road Bike
Submitted by ckdake on Sat, 2008-05-17 16:00I figured that starting off on a fixed gear or a full suspension mountain bike might not be the best thing for my still recovering collarbone, so I decided a few weeks ago that I was going to get a road bike. I researched around online and narrowed it down to a 2008 Roubaix Elite Compact. All Shimano 105 except the brakes and cranks, about what my budget was, and I like the way it looks. However, when I got to Outback Bikes to buy one, they had some 2007 models left over... So I ended up picking up a 2007 version of the Roubaix Comp Compact for a few hundred dollars less than they were selling the Elite for. This one has Shimano 105 brakes and cranks, and slightly nicer wheels. Another great deal on a bike from Outback (I got my full-suspension mountain bike in a similar situation there a few years ago). I'm going to try a few laps around the block later today and hopefully the doctor on Monday will say that I'm good to start seriously riding outside again! Hopefully those ~1000 miles I've done on the trainer will pay off...
Photoblog
Submitted by ckdake on Wed, 2008-05-14 19:26I take a lot of pictures. I figure I should post them on here. Here goes one. This is a HDR of the trees in my backyard:
(If you see a "used without permission" watermark on the image in your feed reader, please let me know in a comment or by email, so that I can add it to the list of allowed referrers!)
F-Spot EXIF information mangling
Submitted by ckdake on Tue, 2008-05-13 10:56I use F-Spot to manage my photographs. It's fast, clean, simple, and does everything in my current workflow which is JPG on camera -> YYYY/MM/DD folders -> Gallery on my website. Once I start shooting RAW it will get a little more complicated, but F-Spot keeps moving forward so hopefully they'll come up with a plan for that.
When uploading images to Gallery, I noticed that my photo timestamps were off. Conveniently, there was a discussion about this on the F-Spot mailing list at the same time and it turns out that every time you import an image in F-Spot, it adjusts the EXIF Timestamp information based on your timezone. Basically, if you're 5 hours away from GMT, on import F-Spot writes to the file that the image was taken 5 hours later than it actually was. Not only does it do this once, but if you re-import images into F-Spot for whatever reason it does this again, again, and again.
This was a bit of a surprise because EXIF information written by the camera shouldn't be changed by an import program! I thought I'd lost all the actual capture date/times of my ~30,000 photos, and was getting pretty upset that software would do this, but after digging through EXIF headers from all the cameras I've had, it turns out that the "DateTimeOriginal" was still good! I disabled F-Spots ability to write metadata to files (which means I'll have to stop tagging images until this is all resolved upstream) and wrote a little script to fix my files. If you've run into this and would like your original EXIF information back so that photos taken on New Years Eve as the year ticks over aren't at some hour after sunrise on Jan 1st, use this! Just replace $directory with the path to your photo library, store it to a file named "fixer.pl" and run "perl fixer.pl". Note that you'll need find and jhead installed.
EDIT: Note! I looked at this again with my 40D and new version of f-spot. It seems that now the correct EXIF header is "DateTimeDigitized" and _NOT_ "DateTimeOriginal". Please verify things on your setup before running this random script you found on the internet!
#!/usr/bin/perl -w
use strict;
my $directory = "/media/photos/";
my %opts;
my @files;
@files = `find $directory -type f -iregex \'.*\\.\\(jpg\\|jpeg\\)\'`;
foreach my $file (@files) {
chomp $file;
my $dateline = `jhead -v "$file" | grep DateTimeOriginal`;
if (defined($dateline)) {
$dateline =~ /.*\"(.*)\".*/;
my $date = $1;
if (defined($date)) {
$date =~ s/ /-/g;
system("jhead -ts$date \"$file\"");
system("jhead -ft \"$file\"");
}
}
}
10+ years of internetting
Submitted by ckdake on Thu, 2008-05-08 16:59I just realized that my yahoo profile is now over 10 years old! I apparently created it on February 12, 1998, and while I know that I had AOL at home before that for perhaps around a year, I can't find any indication that they provide account creation dates anywhere in their system. (And back before AIM was properly integrated, I had to switch from ckdake to theckdake when we canceled AOL and didn't get to switch back to ckdake until perhaps college?)
Before AOL, I got online once or twice at a friends house, but I know my first experience online was at the 99X booth at some olympic experience thing at the 1996 Atlanta Olympics. They had a web browser, I typed in "games" in the address bar and alas, couldn't get to any games. Needless to say I didn't realize that the internet was good to have until later.
In 1999, I purchased my first domain name: ithought.org (for $70 a year or something stupid expensive from Network Solutions) and it's still the one I use for all my servers. ckdake.com finally showed up in 2004.
Things sure have come a long way in ~12 years!




