Author Archive

November 16, 2009: 6:58 pm: kpdrowing

Saw this in a post on the Concept 2 Forum by igoeja. Back issues of Rowing News are in Google Books available online for free and with the ability to search. Cool!


November 11, 2009: 7:02 am: kpdindoor-rowing, programming, rowing

My unofficial interface to the Concept 2 Online Logbook is ready.

This allows one to programmatically get information from the logbook (such as your total meters rowed to date) or to add workouts to the logbook from another program.

For example, entering this URL in your browser after getting your own API KEY:

http://c2logapi.appspot.com/api/1/user/totalmeters?format=xml&api_key=xxx

would cause the browser to prompt you for your logbook username and password and then it would return the total meters you’ve rowed to date.

Details and code examples in Python and Java are at the (Unofficial) Concept 2 Online Logbook REST API Home Page.

: 6:42 am: kpdPython, wxPython

I’ve been looking to find a way to resize a font when the window’s size changes. Here is code that will create a font that is close as possible to a given height in pixels without specifying anything about the font width. Osku Salerma posted some code in GitHub that did the trick.

I changed it a bit to make it self-contained. Here’s my modified version of his code to create a wxPython font given a height in pixels:


<pre>
    def createFontFromHeightInPixels(self, heightInPixels, family, style, weight):
        # return a font that's as close to 'heightInPixels' as possible without being larger
        # modified from code at http://github.com/oskusalerma/blyte/blob/master/util.py  
        fontSizeToTest = 6
        bestFontSoFar = wx.Font(fontSizeToTest, family, style, weight, encoding = wx.FONTENCODING_ISO8859_1)
        closestDiffInPixelsSoFar = 1000
        testDc = wx.MemoryDC()
        testDc.SelectObject(wx.EmptyBitmap(512, 32)) 
        while 1:
            testedFont = wx.Font(fontSizeToTest, family, style, weight, encoding = wx.FONTENCODING_ISO8859_1)
            testDc.SetFont(testedFont)
            heightOfTestedFont = testDc.GetTextExtent("_\xC5")[1]
            diff = heightInPixels-heightOfTestedFont
            if diff >= 0:
                if diff < closestDiffInPixelsSoFar:
                    closestDiffInPixelsSoFar = diff
                    bestFontSoFar = testedFont
            else:
                break
            fontSizeToTest += 2
        return bestFontSoFar 
</pre>

It would be used like this assuming the above function is in the window class or one of its superclasses:


<pre>
def __init__(self, *args, **kwds):
    .
    .
    .
    self.Bind(wx.EVT_SIZE, self.OnSize)     

def OnSize(self, event):
        size = event.GetSize()
        currentFont = self.GetFont()
        newFont = self.createFontFromHeightInPixels( (size.height*0.8), 
            currentFont.GetFamily(), currentFont.GetStyle(), currentFont.GetWeight())
        self.label_1.SetFont(newFont)
 </pre>

September 26, 2009: 6:44 am: kpdPython

A very slight tweak to the code posted by John Lee on the wwwsearch mailing list at SourceForge allows mechanize to work on the google app engine. The code I am using, which is almost all his, is:


<pre>
import urllib2
import copy
import mechanize
import mechanize._response

class GAEMechanizeHTTPHandler(mechanize.BaseHandler):

    def __init__(self, gae_http_handler, debuglevel=0):
        self._debuglevel = debuglevel
        self._gae_http_handler = gae_http_handler

    def http_open(self, req):
        return self._gae_http_handler.http_open(req)

def make_gae_handler():
    return urllib2.HTTPHandler()

def make_http_handler():
    gae_handler = make_gae_handler()
    return GAEMechanizeHTTPHandler(gae_handler)

class GAEBrowser(mechanize.Browser):
    handler_classes = copy.copy(mechanize.Browser.handler_classes)
    handler_classes["http"] = make_http_handler 
</pre>

Mechanize is not thoroughly tested, but the above does allow my project’s code to pass its regression tests when running on the GAE.

August 21, 2009: 4:44 am: kpdrowing

Tom Kotula and Jon Hauserman, two local rowers from the Cleveland State University Viking crew, were videoed and interviewed on the CBS evening news. They are rowing from Cleveland, Ohio to Key West to raise awareness for Habit for Humanity. They also made the local evening news.

Oh to be young again and have the time for adventures like this!

June 16, 2009: 8:15 am: kpdrowing

A local news channel featured a short segment on a local, fairly new, rowing club. We’ve pretty much given up trying to get our local newspaper to recognize the local high-school rowing teams (the paper is becoming less and less relevant anyway), so it is always good to see rowing in the popular media.

I hadn’t realized the Portage Lakes Rowing association had grown. It’s very good to hear!

February 14, 2009: 9:07 am: kpdrowing

I had a search registered for this book on tape.
It is a fictional account of his experience as a rowing coach. Copies are rare and I already have mine, so I’m passing this along to the group in case anyone is interested.

Wanted: Rowing Coach by Brad Alan Lewis
Audio Cassette. Books on Tape, Inc. (1996)
9780736634342.
Good. $4.80
Buy now at: http://www.alibris.com/booksearch.detail?invid=9701681989

It’s not quite ‘The Shell Game’ but still a very worthwhile listen.

February 1, 2009: 2:57 am: kpdErgMate, rowing

I’ve uploaded a new video showing a 350 meter row with ErgMate to: http://powertwenty.com/ergmate/videos/350MeterRow/350MeterRow.html

There is also a new release that fixes a minor bug when editing the percent heart-rate clip.

January 24, 2009: 8:32 am: kpdErgMate, indoor-rowing

An update to ErgMate is available at: http://powertwenty.com/ergmate/update.html.

This fixes problems found with communication to the erg and calling power 10’s and 20’s.

There is no need to download the full version if you’ve installed it once already, the update is much smaller as it does not include the computer voice.

Do download the full version if it is your first time as it contains a high-quality voice.

January 19, 2009: 4:54 pm: kpdErgMate, indoor-rowing, rowing

I am pleased to say that ErgMate 1.0 was released today.

ErgMate is a program used while rowing on the Concept II Indoor Rowing Machine.

It helps you meet your goals by calling out information about the row – such as distance remaining or time to go, just like a real coxswain. It can sequence music for you throughout the piece – start out with a list of songs that are steady and driving, then switch over to something fast for the final 250 meter sprint as your ErgMate calls a final power 20.

Have a look and download a free trial at http://powertwenty.com/ergmate/index.html.

Hope you enjoy it!