Marco's Blog

All content personal opinions or work.
en eo

Weight Table

2005-01-17 3 min read Uncategorised marco

A Weight Table?

Actually, two of them. At some point (actually, at {moscontentlink:How I lost weight|this point}) I decided it was time to record my weight and do a pretty good job at it. I worked on and off at it, perfecting the user interface (laughter appropriate), and ended up with two versions of a program that tells me how fat I really am.

I started out with a {moscontentlink:Weight Table – TCL|GUI release} in Tcl/Tk. I had been very successful with that combination, and back then there were neither PyQt nor PyGtk to help me. (To be truthful, I wouldn’t have used either, anyway…) This first release was interfacing in German and had a decent set of controls. You could input your weight in a table (just in case you had jotted a set of days on paper). You could switch from a pound to a kilogram view. You could change the number of days used to average out the weight.

Although Tcl/Tk is probably past its prime, it still is a really easy language to write to, as long as no numeric computation is involved. Nowadays, its slowness is extremely painful, and I would probably use it only for glue code.

Things started getting complicated with the addition of bodyfat, courtesy of an incorruptibly hones Tanita monitor. After I got over the grief of seeing myself called obese by my own scale, I added many charts to the program:

  • daily bodyfat and average
  • total fat and average
  • total non-fat and average

Each chart taught me something. The bodyfat chart taught me that I shouldn’t ever buy anything I could use to ridicule myself in front of myself. Because I would.

Total fat is interesting, because it doesn’t swing as widely as bodyfat and weight. If you weigh yourself on any given day, there will be a certain amount of ballast you carry with you (the kind you get rid of at a pitstop, if you really needed me to say it). Total non-fat was surprising, because it would rise and fall with total weight. I would have expected to see non-fat matters stay the same regardless of how much fat I carried around. But it turns out that fat cells need considerable amounts of water and other matter to survive.

After all this work, I started thinking it would be nice to get access to the charts from anywhere on the planet. Hence I started thinking of a web interface to the same data.

Since the wheel has been invented too many times, I started looking at open source code I could use to make my life easier. Of course, there I stumbled upon GD and its Perl interfaces. As a matter of interest, the final {moscontentlink:Weight Table – Perl|web interface in Perl} is a mere 10% of the original code in Tcl, since I don’t do any of the computation or graphing.

As I moved this site to Mambo and later Joomla, I wanted to integrate my weight table with the new infrastructure instead of using iFrames or the like. So I wrote my own component, which I later turned into a Joomla project. This is the basis for the current graph, which now uses the PHPlot library.

You can access the current weight chart here.