Archive for December, 2005

Losing weight with GNUplot

Posted on December 25, 2005, under general.

Last summer, myself and Noirin went to Manhattan, and had a brilliant time, If you havn’t seen it already, we kept a travel blog of the whole thing, and I’m sure we’ll go back there at some stage.

As amazing and exciting as it was, the many tasty meals, donuts, hot-dogs and even (yum) baked Alaska that New York had to offer did some serious damage to my health. Although I don’t normally over-eat (at least according to my Doctors), I’ve never been slim, and I’ve probably been in the clinically overweight since I was 15 years old. After New York, I weighed in at 112 Kg (17.5 stone/245 lbs), which is into the obese range for my height of 190 cm (6′ 3″). So I decided to do something about it.

Having done Physics in College, I’ve always been a bit mystified by the whole weight-loss industry, because the figures never seem to add up to me. Terms like Calories and KiloJoule mean very specific things, and the conservation of energy principle is something I’m more than prepared to give the benefit of doubt. And yet, when you add the numbers up the value of exercise is absurdly small, but it’s nearly always key.

My fitness levels are o.k., I cycle and walk quite a lot and can walk or cycle for hours a day without any problem, I can even out-run most people my age, and my physical strength is o.k. too. So whenever I’ve done the numbers I’ve always figured that I’d need to devote many hours a day to exercise in order to have any meaningful affect. After all, just one donut is about the same an hour of cycling, for crying out loud. How am I supposed to find that time?

Well, after doing some initial reading, I discovered that there are some factors which cause me problems. I was eating things in the wrong order, meaning that although I had a fine calorie-per-day count, I wasn’t giving my system a chance to digest it properly. Spending 3 nights a week in Trinity College also meant that I was generally eating late, quite often I’d have 1500 calories of food after 10:30pm, which is just insane, and probably caused my insomnia too. I wasn’t putting on weight in general though, so I just had to lose it, which was something positive.

From cutting out any snacks and completely overhauling my lunch, I lost just over 6Kg (14 lbs/1 stone) in two months, which isn’t bad. But then I did some more research, and came across the excellent book: The Hacker’s Diet. This book is a no-nonsense approach to the subject, and explains it all in terms of process control and energy conservation. Things that make sense, and it really does work. More or less since I read it, I’ve been following it, and have lost even more weight. Here’s the GNUPlot:

Graph of weight over time

I update that graph on a daily basis (when I have measurements) and for reference: Apachecon US 2005 starts on day 40. Right now I weigh just under 91Kg (201 pounds/14 Stone 4 pounds), and for the first time I’m way actually in the healthy weight range. I’ve lost 19 Kg (42 pounds/3 stone) and 12 cm (5 inches) from my waistline too, and my XL t-shirts now look ridiculous on me. And there are other changes too, I’m surprised to find my watch dangling loosely on my arm and frequently find it on the underside of my wrist (wasn’t expecting that), cycling is a lot easier now (since the engine has higher power/weight ratio) and my centre of mass has moved too, which I can actually notice leaning back on a chair.

It’s bizarre, but it feels really good. Still, there’s more to go, my target weight is 77Kg (170 lbs / 12 stone, 2 lbs) , which I should be able to reach within the next 3 months, but I’m well over half-way there, and already feeling pretty good for it. It absolutely improves just about every aspect of your life, I’m even sleeping a lot better.

The weird thing is, I have so much leeway in the planning, that I can still frequently eat out on the spur of the moment, and have horrendously unhealthy meals, and still lose weight. As long as I account for it, and take action, it all works.

The approach from the book has been working well for me, too well in fact, my rate of loss has been too fast, and I’ve had to add supplements to my diet. Since I haven’t really been feeling hungry, it just goes to show what a little organisation and planning can do. I also really like the systematic approach to measurement taking and plotting which the book includes. Most books recommend you weigh yourself once a week, to avoid the noise of daily water changes.

This is a load of crap. Measurements are the bread and butter of science, and more is always better than fewer. So I’ve been making daily measurements and plotting using the weighted average method outlined in the book. I had been working on a system based on the Mean Value Theorem, but the simplistic weighted average is working out just fine, so I think I’ll stick with that. I’ve been working it out by hand and have a very simple shell script to produce the graphs, using Excel would have been a bit to burdensome.

If you ever feel like losing weight, I can highly recommend the book, and along with abother book or two on good nutrition (which it really doesn’t cover) you should be set to go. Best of all, the whole thing is free and on-line! Do consult a Doctor though, it can be easy to leave yourself with some nutrient deficiencies, and they’ll be able to advise you on what rates are healthy and what else you may need to take into consideration. I’ve definitely learned that the principle of understanding all of a problem in order to solve it definitely applies just as much to your own body as with anything else. Once I found out in what ways your body can actually be entirely predictable, and that it isn’t just a huge vague biological process with unpredictable outcomes it becomes a lot easier to have some confidence that your exertions of will-power will actually have a definable, measurable, effect.

I already had the fitness part in place, so that it’s more dramatic, but all the same, it’s amazing what some understanding can achieve. Now let’s see how Christmas and the New Year go.

Justin Mason is a God

Posted on December 22, 2005, under apache, general, niagara.

… at least according to Tim Bray.

JM with a Halo

He’s also got a photo of a seemingly disinterested me;

Me, bored

… getting a demo of the dtrace stuff. In fairness, dtrace is really impressive, and a few of us httpd committers hope to add dtrace inspection points to Apache over the coming months, it looks really useful. Matty has already done some really useful work in this regard over here, where you’ll find mod_dtrace and some other interesting examples. They should be taken with a pinch of salt though, Matty isn’t quite getting how pools work and some of his examples misinterpret what’s going on, but still it’s excellent work all the same.

I thought Tim’s keynote was actually very good, but I found one part of it really dissapointing. Their raw numbers on the Niagara system were totally bogus, he quoted a figure of 25,000 requests/second from the box, both in the presentation and the article, but it’s really not. It can do way way better. We had a close look at the system and found amongst other things that the httpd was a 32-bit build, which was a bad start, and as Tim points out the benchmarking was being done with ab from a laptop. Since our dual Itanium box can push 25,000 reqs/second in its sleep, I’m guessing their Niagara box can easily push at least 4 times that number, especially with the event MPM. It maxed at 290 Mbit/second too, which is quite low (despite what Tim might think). Just last week we shipped 1.2Gbit/sec in production without actually noticing much at all, so again I’d say the Niagra box can at least quadruple that kind of number. Of course it’s great that the numbers were wrong in the conservative direction, the opposite of the usual corporate PR.

The guys mentioned that they have some detailed Specweb stats, so it’ll be neat to see those. The platform did really “feel” fast (by which I mean responsive), not the usual sparc sense of treacle-like slowness, and dtrace really is an amazing utility. I know I’ll be looking very very seriously at the platform, and I already like their low-end X64 boxes as an alternative to Dell. So I have to agree with God, Sun really have made a gigantic sea-change, and it is kind of mind-blowing. Good stuff!

Update: I’ve applied for a free box from Sun for 60 days, to benchmark it myself, thouroughly.