PTom Logo

Weight Reduction

This post is about my personal challenges with weight, and managing it in light of a metabolic disorder.  None of it is meant to be self indulgent or congratulatory, and I promise there are some geeky bits near the end for those patient enough to wade through the content or who want to skip to the end.  Sorry for being boring, but not for being me.  On with the story:

Back in the day I could have been considered a “bean pole.”  I was highly athletic, and though moderately muscular any of the definition was overshadowed by being wiry (though I eventually outgrew the designation “gangly,” thank heavens).  This is back when I could afford to be so physically active, and before the effects of the McArdle’s disease steadily clamped down on the stamina.  More importantly, it’s when I was also getting sufficient rest to compensate for the effects of the activity I pursued regardless.

I got married, and gained the requisite 10-15 lbs. that generally comes with it, simply due to a change in lifestyle – eating more frequently, and in the company of others on a schedule of well prepared food rather than “when it suits me” and consisting of “whatever’s around.”  Even with that gain though I was smack in the middle of the Healthy band of the BMI (though individual results vary depending on body type, I’m fortunate to be a good match for the algorithmic archetype).  That weight stayed steady for another year.

Then: The Desk Job.  In the interest of advancing my career and furthering the capabilities and savings of our family, I changed from the more free-form telecommuting gig to one that met those requirements but also required standard office attendance.  I have no issue with the work, or with good work ethic, but I had been liberally making use of the telecommute arrangement to rest as necessary in order to recover from the day’s strain.  With the desk job, that luxury was forfeit.  Ignorant of the specific nature of my disorder at the time, I didn’t realize how disastrous this would be.

Seated at the console, plugging away on the code (Object Pascal cum Delphi RAD environment for MS IIS ISAPI filters on the MetaStorm e•Work product) I found myself wearied as usual, but unable to deal with it.  I compensated by being exceptionally stubborn, and when that fell short, supplemented with anything available to increase my blood sugar (I was also drinking a lot of water, which I attributed to the poor transition from Washington’s temperate and moist environment to the Utah dessert two years before – but probably only half of what I now know would be required.  Whatever the case, whenever Rachelle called I seemed to be in the bathroom).  This latter strategy came with predictable side effects, and in the course of five months I put on some 40 pounds.

The rapidity of weight gain was certainly off-putting and distressing, especially as the combined weight of the entire supplemental caloric intake during this time didn’t seem to be adequate to account for the change.  I did my best to stabilize and cut back on the snacks, suffering through the stupor instead, and plunging into another round of medical inquiry to find out why I was so tired so I could hopefully do something other than eat to manage energy levels – these of course were ineffectual.  Later, changes in jobs, the production of very very cute children, and general demands of the conditions of life slowly edged the weight upward until finally peaking at about 250 lbs. (113kg), at the same time that the last vestiges of regular physical activity (Kishindo martial arts) feel by the wayside.

I was frustrated, to say the least, but also largely to blame – by putting myself and my needs very last, I was doing myself this dramatic (and visible) harm until it interfered with my ability to continue to serve my family.  I was so bogged down, waking up exhausted (and frequently nauseous), barely pushing through the day, and repeating.  Minor gains in understanding, not necessarily of my condition but my reaction to it, gave me some latitude for correction and over the course of about 2-3 years managed to move from 250 back down to about 220.

The most recent improvements have come from a very complete comprehension of the condition and my situation.  The management strategy I’m pursuing now allows me to walk that thin line between capacity and injury, and to retain cognizance throughout even the long days (with few exceptions).  Combined with that, I’ve been able to leverage the inability to utilize stored glucose energy to maximize natural ketosis (the same condition the Atkins and other low-carb diets attempt to induce artificially) and consume stored lipids instead – this time without the crippling side effects causing near-comatose stupor.  This means that from the first day of the diet I’ve been able to realize dramatic results, as detailed below:

Down, down she goes!

Down, down she goes!

The weight log starts in late January, testing out the Wii Fit I’d gotten the family for Christmas (but was unable to play with myself, having been separated from them).  Return visits to the family explain the infrequent initial measurements, followed by my more permanent return in lat March.  Throughout April and May I was completing my research into the effects and side effects of McArdle’s before finally establishing the current regimen.  This failed to produce any effects on the weight though, so I sought out the advice of my buddy Joel – the most successful dieter I’ve ever seen.  Over the course of a year his appearance completely changed, to the point that when we were re-united for a get-together I recognized his wife, and wondered who the heck was with her.  Thus was born the references to the “Sexy Sexy Joel Diet” (as the diet belonging to and responsible for Sexy Sexy Joel, as opposed to the old Joel).

His secret?  Has nothing to do with all of those “By following these X simple rules!!1!” ads that are all over the internet, nor with fad products, “cleansing,” etc.  He wasn’t even exercising – just following the old Weight Watchers™ formula for calculating caloric intake in terms of points (calories / 50 + ( grams of fat / 12 ) – ( min{ grams of fiber, 4 } / 5 ) ) and his allowance for consuming them.  Using a calculator and log on his iPhone he followed the simple principles over time to great effect.

I adopted the same pattern, and am pleased to report that, per the graph above, have dropped 32 lbs. in the course of just over 3 months.  At this rate I have another month and a half or so to meet my long term goals, after which I can settle into a maintenance pattern.  Looking at the trend line it’s very slowly leveling out.  It also has that cyclical up-tick I’m at a loss to explain – though I also admit that I haven’t gone into an in-depth analysis for them yet, as they are inconsequential to the average / long view.

For the geekiest bits: the point system, whatever its failings, works.  In order to make sure all measurements are taken consistently, they’ve all been done within the same hour of the day, in the same general outfit (light sweats, t-shirt), immediately following my carefully metered exercise (metered to avoid undue metabolic or toxic distress) in the morning before any kind of intake.  This does mean that I’ve artificially skewed the measurement to the lowest point in a day’s fluctuation, but given that I’m moving 10-15 lbs. of water though my system throughout the course of a day it makes sense to take a low baseline, since the peak water retention will fluctuate unpredictably (or according to parameters and timings I’d rather than make explicable by mapping when there’s an easier solution).  Doing it the same way every day is what makes the biggest difference in collecting the samples, which allow me to apply a general trend analysis instead of a specific margin of error per day.  All measurements have been taken on the Wii Fit in order to keep the analysis consistent and to provide a log of the output as well, which I have carefully transcribed and reproduced above using Perl’s GD::Graph module.

I have several other observations as a result of the experience, mostly regarding psychology and sociological trends, which I’ll save for another time.  For now I’m excited for the day when I can stabilize enough to buy new pants (which I’d rather only do once, an account of being a cheapskate).  Also, while it’s true that I may have an unfair advantage due to the super-charged ketosis, Joel’s experience demonstrates the viability of the approach without such an inside track (a track, I might add, that is not worth the side effects if it can be avoided).

Bon (pétit) apétit!


Zend Devzone PHP Abstract Podcast: Torpor

Recently I had the pleasure of being interviewed by Eli White of Zend, “The PHP Company,” for the Devzone podcast PHP Abstract (by and for PHP developers).  The topic of discussion was Torpor, what it is, what it offers, and why it’s being developed.

Despite my rambling on there’s some useful information to be found – hardly all inclusive, but it should stand on its own as an introduction to the level of forethought that’s gone into an undertaking of this complexity.

The ~20 minute recording posted today – go check out Episode 46!


Torpor 0.9β Released!

The 0.9 beta release of Torpor (all major features work, but only in MySQL and there’s some definite clean-up and organization to be done) is available now:

TorporPHP_0.9b.tar.gz (via Google project hosting)

I also need to correct a statement I made earlier during the introduction of Torpor – this is not the first mature persistence layer abstraction.  I’ve come across others (turns out the buzz word for googling is “PHP ORM”, not “PHP persistence abstraction”) since I delved into this foray in the first place, though I can say I’m not especially impressed.  I can also say that Torpor easily stands on its own among these, with its philosophies fitting an appropriate niche and providing some of its own innovations (especially the intermediate cache interface and the complexity of the intrinsic deep-loading and relationship introspection).

Those feeling adventurous, enjoy!

Those without the cycles to spare, 1.0 should be available in 3-4 weeks, enabling additional database interfaces and cleaning things up.  Between 0.9b and 1.0 there may be some minor changes in naming conventions, but overall structure will remain the same.  Much documentation will be forthcoming as well.

Good luck, and good night!


Torpor

Torpor
Pronunciation: \ˈtôr-pər\
Definition:

  1. Temporary or short-term hibernation, characterized physiological activity.
  2. The first mature persistence layer abstraction for PHP, provided by Yours Truly under the MIT license.

Link: torpor-php (via Google Project Hosting)

The name is a direct take off of Hibernate since it provides very similar functionality for Object Relational Mapping.  It is not, however, a port, emulation, reimplementation, or imitation of it or any other specific ORM/Persistence abstraction out there.  This is all new code from the ground up, with the project started in the last half of July 2009.

The premise is simple: having written a significant amount of database-centric code over the years, in a variety of environments and in several different development languages, I have come to understand what I feel are the basic features every good database abstraction should have in order to be genuinely useful.  I have very frequently been without those features, and spent a great deal of time re-implementing and refining them in each of the different environments in play.

By doing this so many times over I have realized that, for a well defined (preferably 3rd-normal) schema, the feature set can be deterministically derived.  In order to test that theory, and potentially save myself an inordinate amount of tedium and re-invention in the current employment-selected language, I have written Torpor (though not until after thorough examination of other potential offerings, which I found to be thoroughly lacking and usually tied to other larger frameworks which most certainly did not meet my needs).

There are a few features left to do before the code will be packaged for distribution under the 0.9β release, which should be available in the next 1-2 weeks.  This beta release will be for MySQL only, and while it’s been coded with PHP 5.1.0 in mind I can’t guarantee full compatibility with less than 5.2.8 (have not yet tested it with the target prior version).  SQLite and Oracle adapters won’t be far behind, but Oracle probably won’t be making use of the OCI bind variables yet – though this is definitely planned for a later release

Features in a nutshell:

  1. Configuration is controlled via straightforward XML (produced in large part by a helper script).
  2. Objects have rich accessor and mutator interfaces with just-in-time fetching and optionally selective publishing.
  3. Objects are capable of acting as intelligent factories for other related objects (and sets of objects), allowing for simple and powerful code for navigating from one portion of a database to another (intrinsic deep-loading, even in data engines lacking explicit support for foreign key relationships).
  4. Full support for associating related un-published objects, with optional (on by default) cascading publish of dependent objects (deep-saving) – useful for those tables whose primary keys are generated on publish.
  5. Full support for multi-column keys, multiple unique keys (with or without multiple columns), and multiple reference relationships between similar object types (e.g., a User may act as both a Seller and a Customer on an Order and be accessed as each in turn).
  6. Extension of provided primitives is supported and encouraged, with event-based call-back hooks and a hierarchical overload/override scheme that’s easy to configure.
  7. Custom SQL support for Load, Publish (optionally differentiated by insert vs. update), Delete, including stored procedures and pseudo-bind variables (SQL placeholders filled by order of occurrence and/or named variables).
  8. Criteria based select, optionally using arbitrarily nested AND/OR collections and a rich set of criteria types and controls (including custom SQL) with support for automatic joins to related tables.
  9. Intermediate read/write -through caching interface support (can be used in distributed network based cache settings, such as memcache, for nearly-free lateral scalability).
  10. Fully extensible and customizable.

That’s a pretty big nutshell, and it’s not anywhere near complete.  There are just a couple gaps between this list and the current revision (no. svn:35 as of this writing) on both sides: a few features which need better testing and a little internal wiring, and some features provided but not listed.  Eventually the full user documentation will fill in the gaps, but so far this list and the actual available feature set have a > 90% overlap.

Implementation example snippet:

// Singleton context; support for instance-context
// and automatic config loading also available.
Torpor()->initialize( "myconfig.xml" );

$user = Torpor()->getUserById( 12345 );

$orderHistory = $user->getOrderSet();
foreach( $orderHistory as $order ){ /* ... */ }

$order = $user->newOrder();
$order->setSeller( Torpor()->getUserById( 54321 ) );
// OR $order->setSellerId( $user->getUserId() ), etc.
$order->setPurchaseDate( date() );

$product = Torpor()->newProduct();
$product->setName( 'Something Pink' );
$product->setUnitPrice( 49.95 );

$orderItem = $order->newOrderItem();
$orderItem->setProduct( $product );
// causes $product->publish(), $order->publish() cascade:
$orderItem->publish(); 

Code is available now via Google’s project hosting: Torpor: Persistence Abstraction for PHP

Feel free to poke around, make contributions, revisions, remarks (snide or otherwise), and generally check it out.  The official beta release will be announced here with great fanfare and tremendous sighs of relief, followed shortly by the tension of worrying whether it’s good enough and trying to polish user-docs.

Update (2009-08-28 09:16)

Torpor has been submitted as a potential topic of discussion for the Utah Open Source Conference 2009, October 8th-10th! This is a rather late submission, so your votes will count to help get this one on the board!

Older posts

Newer posts