Marco's Blog

All content personal opinions or work.
en eo

PHP Weight Table

2005-11-25 2 min read Site Updates marco

Somehow this application follows me like a curse…

The PHP version of the weight table is available as a Mambo/Joomla component. It was my first attempt at a component, and I have to admit it was much easier than I thought. You can download the component from the Remository.

A long time ago I decided I needed to track my weight. I used to be a fat kid, and even in early adulthood I had real problems keeping my weight. In the winter, in particular, I would need comfort calories to an excess.

At first, I would just write it on paper. Then I would go out of my way and track the same chart on drafting paper, and pour over it for ages, trying to find a logic to the madness. Finally I decided to use my skills in Tcl to get a graph drawn. This was my first attempt at computerizing my weight.

The first application was a fairly complete standalone app. It was terribly slow at processing the data, but ran on Linux and on Windows. That was quite a success for me. As a side benefit, I learned a few tricks of the trade: how to find your own weight rythm (that is, the frequency of the swings, which is entirely a function of the person); what kind of stimuli make you gain or lose weight (bad sleep and bad weather make me gain weight, as does stress; sunshine and sexual excitement make me lose it).

Then I switched to the web and wrote a Perl version. That one used static images and GD::Graph to generate them. The code base was factors faster and the results pretty enough.

Switching to PHP could not just be a repeat. But I wanted to integrate the table into Mambo/Joomla, so I thought writing it as a component, fully integrated into the framework would be cool.

I found that a lot of the infrastructure of Mambo is lacking. For instance, there seems to be no standardized way to store configuration parameters. The separation between frontend logic and backend logic is a bit asinine. But it’s exciting to have made this step forward, used as I am to thinking in terms of J2EE logic.