Posts

simple Strava to CSV ride decoder with Perl

Slight detour from my project... Just wanted confidence I could decode JSON data, at least in Perl. I wrote a little decode for Strava ride data using Perl. The code, which I call "Strava_to_csv", requires a command line option specified as follows: Strava_to_csv -activity activity-number where activity-number is the number of the activity. It's nothing fancy, and not very robust. It expects all data to be scalar except for "latlng", which is an array of two numbers, the first the latitude, the second the longitude. It worked for me. This code uses the JSON module version 2.53 from CPAN. There's a lot of stuff there about encoding type, but since Strava is unicode, it worked simply. The code is written for Linux and maybe OS/X: it uses a system call to the "wget" command to download the URL (a Perl package for HTML could be used instead). Anyway, here's my code. This hardly took any effort at all, maybe 30 minutes, which makes m...

writing my Strava Android app, part 2

More progress... First, I did more sketch work on my proposed pages for the app. One of these involves data plots: plotting the altitude, and on a separate plot, speed from a Strava activity on a graph. This is the biggest challenge of my GUI design: the rest consists of a text widget, a bunch of button widgets, and some labels, with more simple widgets in the "configuration" screen. Plots with limited pixels are a challenge: I believe the screen resolution is only 480 × 800 for which only a small subset, for example 400 × 100, will be available for each plot. Not so bad, actually, but real estates needs to be used efficiently. I'll avoid doing anything fancy: no scrolling or zooming, for example. The goal is just to identify portions of the ride in a clearly identifiable fashion. For this I can either do my own plots with graphic primitives or use a more general purpose plotting package. I'm not yet decided on this. Second, I looked into the Strava API itse...

writing my Strava app: part 1

The first step in writing my Strava app was to make a note of exactly what I wanted it to do. Well, perhaps not exactly: I don't know the capabilities yet of the Strava API. In particular, does the Strava API allow you to replace the data on a ride? Apparently it does, since StravaHaHa allows modification of ride data. Honestly I don't know where the API is documented, but I am deferring that until later. No rush. So then when I knew what I wanted the program to do, I set out to design some pages. So I measured the screen on my HTC Incredible phone and found it was 5 cm wide by 8 cm high. So I set up an image file using GIMP with 500 pixels wide by 800 pixels high, and for each screen, began "sketching out" how I wanted the page to look. It's different assembling a page from a widget tool kit, so details aren't critical here: I just the look and feel of each page. When I got tired of doing that, and I was on-line, I started downloading some of the s...

writing an Android app

I've long wanted to write an Android app so now seems a fairly good time to give that a shot. I want to port over some Perl stuff I've done, not directly necessarily, probably in Java, which I've done some work in before but long ago. I really liked Java, though: a proper object oriented environment rather than the layered kludge-fest which is C++, or for that matter "object-oriented Perl", neither of which I've ever liked. I end up with hybrid object oriented - sequential code. Better to have the environment optimized for the object oriented paradigm and stick with that. Step one didn't go too well... upgrade my Ubuntu to the 11.10, but then my CD drive on my old Thinkpad isn't working well. I tried to clean it but now it's working worse... Anyway, I got a book on the subject ( Android Applications for Dummies ), but am not waiting for that to arrive. There's plenty of on-line reference material and tutorials. Book form is just more ...

rating New Zealand climbs

Image
I've described a decent number of climb profiles from my trip to New Zealand, with profile data collected from a Garmin Edge 500 or, in the case of Haylocks, by Strava using topological data in conjunction with positions recorded by the Strava Android app. It's then obvious to ask: how do the climbs compare? Which was the toughest? Good question. First, some data. I plot here the altitude gained versus the climbing distance for each of the climbs. I define "the climb" as the portion of road which maximizes my climb rating, which I've described in this blog before. Here's the result, where I normalize each by the number associated with Old La Honda road: What makes a climb tough? To me, it's continuous time spent at a big grade, with a lot of altitude gained. click on image for expanded view profile of Haylocks from Maori church. Ignore wiggles, a mapping artifact; climb is continuously up. Click on image for larger view. Using an objectiv...

climbing Onuku hills

Image
With climbs, there's a tendency to focus on those which gain big altitude and are frequently ridden, preferably in top-level races. However, sometimes it's the back-road little-known compact climbs are equally memorable, or in this case, surprisingly challenging. The day after my big Banks Peninsula hill ride, I went for a short scenic ride with Cara south of Akaroa. The goal was to check out Lighthouse Road. From the distance Lighthouse road is clearly visible, etched in the side of the treeless hill, the occasional car snaking its way slowly up the road's numerous switchbacks. It looked steep. But before our trip I'd set Cara's bike up with a 34/32 SRAM 1070 cassette with a medium cage SRAM Rival rear derailleur, a very nice combination which seemed to work very well (I detected no reduction in shift quality relative to her previous SRAM Red short-cage). So I figured we'd go check it out and see how steep it really was. Looks can be deceiving. In cent...

Climbing Dyers Pass Road

Image
Christchurch was the beginning and end of my just-completed trip to New Zealand. Christchurch consists of a dense central district, a suburban ring, and beyond that, agricultural land dramatic mountains. The central district has been largely destroyed in two days of quakes: 4 Sept 2010, and a highly destructive aftershock on 22 Feb 2011. The damage to the suburbs is less visible but just as real: many houses were condemned due to structural damage. But the riding outside the city limits remains truly excellent. There's three popular passes just south of the city: Gabbies Pass, Dyers Pass, and Evans Pass. My route book, " Classic New Zealand Road Rides " by Jonathan Kennett and Kieran Turner described a ride over Gabbies Pass and Evans Pass, and shorter ride over Dyer Pass and Evans Pass. Each of these rides went over Evans Pass, but I was told as I staged at Zero's Cafe near Princess Margaret Hospital in Cashmere (part of Christchurch) that Evans was closed. S...