Reasonably Opinionated

Commentary on how things would be if everyone were reasonable.

Saturday, January 09, 2010

The evils of fructose - how to lose weight and stay healthy with a few simple rules

I just finished watching an amazing 90-minute video that is best summarized thusly:

How a diet rich in fructose makes us fat, poisons us slowly, and wastes billions of dollars on health care for self-inflicted chronic diseases, and what you can do about it *NOW*.

The full video is an amazing presentation by a talented presenter. It is worth watching the full thing *especially* if you struggle with obesity or don't understand how the body metabolizes food. It is a 90-minute video, so if you don't have time to watch it all, at least read my summary below the embedded video.



Here's a brief summary of the salient points:

1) Consumption of fructose, sucrose (which is a glucose-fructose disaccharide), or alcohol (ethanol is metabolized by the same pathway as fructose) should be extremely limited. That includes HFCS and most fruit juices.

Why? Because the way your body metabolizes fructose, eating a lot of it results in insulin resistance (type II diabetes), hypertension (high blood pressure), high triglycerides, high LDL cholesterol (the bad kind), and weight gain due to inability to self-regulate hunger. The combination of these effects is known as Metabolic Syndrome.

There are *two* notable exception to this fructose prohibition: 1) it's ok to eat as long as it's in *fruit* because there's not much of it and it comes with lots of fiber, which makes it even more OK, and 2) if you're in the middle of (or have just completed) some seriously epic exercise and your are glycogen-depleted, fructose actually helps you restore glycogen much faster than regular carbs. See: Gatorade.

2) Do eat "food" as Michael Pollan would say. The closer to it coming out of the ground, the better. Google "paleolithic diet".

3) His research shows that you can begin reversing Type-2 Diabetes in a short number of weeks by eating an appropriate diet.

4) His research shows that the #1 factor causing most diets to fail is cheating on fructose consumption (even worse than cheating on exercise!).

4) Exercise is good for you, but *not* primarily due to calorie burning. It barely burns any calories relative to food intake. It's good for you because it reduces stress and helps your body maintain a "fast metabolism" on an ongoing basis.

5) Fructose is a major part of our food supply due to politics. It will take a while before the corruption that propagates the problem is broker. Thus, don't trust the government on this one.

Saturday, September 19, 2009

Git Deployment Workflow and a Capistrano Recipe

After experimenting with several workflows for deployment in git, I've finally found one I really like.

  • You can push to staging at any time; every staging push is automatically tagged with a unique tag.
  • You can only push an existing staging tag to production. This helps to enforce QA of all pushes to production.
Using tags instead of branches has a lot of benefits:
  • No permanent remote branches on "canonical" git repo
  • More transparent historical record of what's been pushed where & when, and easily seeing what's changed between deploys
  • Uses tags for what they're meant for instead of "hacking" branches to do a job they weren't meant to do
One of the coolest things that fell out of this new workflow is the ability to see a changelog between two points:

$ git log --format=oneline production-2009-09-09.6..production-2009-09-17.11
5c0b4c9a3f45471926d8372d6dd3606b107ea3d3 Fix rake externals task to properly update phocoa cache. fix copy/paste naming bug.
62a943e96e90935c491f589efdc926c6975f7fb6 Merge branch 'master' of github.com:apinstein/neybor
9a5bd41d9ab9947b134db72bba2a226ed36107f8 [Story1111494] Make 0-priced syndicators show up as free.
8248fb1eecfc2c59007a99ab499bf6d86942d055 [Story1301780] Added a link to the dashboard on the main admin page
e2af47e70b3ba75fdd9c253f349ef35b7c61c01f Added site-wide stats and changed colors on all graphs
66b37218a4342f2e4ef6b16bd120f6e350284fea Merge branch 'master' into fixing_tests
The concepts used in this workflow can be used with any deployment engine, however we use Capistrano and have published our git+capistrano deployment recipe that allows you to easily implement this workflow in any git+capistrano project.

Requires the cap multistage extension:
gem install capistrano capistrano-ext

INSTALLATION: require the gitflow file after your multistage require
require 'capistrano/ext/multistage'
require 'git-deployment/gitflow.rb'

Expects stages "staging" and "production".

USE:

PUSH TO STAGING:
Whenever you want to push the currently checked-out code to staging, just do:

cap staging deploy

gitflow will automatically:
- create a unique tag in the format of 'staging-YYYY-MM-DD.X'
- configure multistage to use that tag for the deploy
- push the code and tags to the remote "origin"
- and run the normal deploy task for the staging stage.

PUSH TO PRODUCTION:
Whenever you want to push code to production, you must specify the staging tag you wish to promote to production:

cap production deploy -s tag=staging-2009-09-08.2

gitflow will automatically:
- alias the staging tag to a production tag like: production-2008-09-08.2
- configure multistage to use that tag for the deploy
- push the code and tags to the remote "origin"
- and run the normal deploy task for the production stage.

Influences and References:

Wednesday, August 19, 2009

Strong health care reform without a public option

Even if you assume the government could create and successfully implement a public plan, it would still be opposed by a sizeable minority of Americans. Factor in the likely side-effects of a public plan and how hard it would be to address issues as they occur, and it's easy to see why so many people are uneasy with it. All things being equal, private industry generally does a better job than the government, especially over long stretches of time.

However, being skeptical of a public plan is not the same as being against health-care reform. I am personally glad to see the administration signalling its understanding of this point and willingness to explore other options to achieve reform.

Instead of a public plan, consider the idea of goverment-drafted insurance plans fulfilled by private insurers. The goverment would draft coverage agreements at Bronze, Silver and Gold service levels which individuals could buy in the public market. This provides a selection for different income levels as well as confidence in what is covered and includes reform provisions such as requiring coverage of pre-existing conditions and wellness benefits. It would also reduce prices by making health insurance a commodity with robust competition.

Ideally these plans would be modeled on the HDHP/HSA model to return market economics to routine health care needs while protecting people finacially from catastrophic or chronic illness.

To expand coverage to more Americans subsidies could be used in the form of vouchers.

Goverment-sponsored research of best-practices (comparative effectiveness) as well as basic and applied research for expensive chronic conditions will provide information and new drugs to the system to reduce costs of covering customers on the government-sponsored plans.

This type of reform preserves the benefits of a free-market system with the consumer protections of a government-controlled system to ensure a fair marketplace while providing a framework for reducing costs, improving outcomes and increasing quality of care.

Friday, July 17, 2009

Announcing MP: Migrations for PHP

As my latest project has grown to need multiple developers, we have started to run into some friction in managing concurrent database changes. Over the last few months I've done a bunch of research on migrations infrastructure, including rails migrations, CakePHP migrations, and several other less-popular implementations.

None of them were perfect for my needs and since the architecture for migrations is pretty simple, I decided to write my own and open-source the results, a php migrations infrastructure called MP.

A few of the features I wanted in MP:
  • Easy-to-use
  • 100% PHP 5+ implementation
  • Command-line utility
  • API access for integration into existing apps, frameworks, or ORMs.
  • Ability to execute arbitrary code in each migration
  • Rollback capabilities
  • "Clean" option to rebuild app state from scratch
  • Persist current version in a file or in DB
  • Prevent collisions of migrations
  • Automatically preserve migrations order without manual sorting effort
Getting Started with MP
One you download mp, you can migration-enable your application in moments:

$ cd myproject

# Migration-enable myproject by creating a first migration
$ mp -c create
MP - The PHP Migrator.
Created migration 20090717_014019 at ./migrations/20090717_014019.php.

# migrate to latest migration
$ mp
MP - The PHP Migrator.

Upgrading from version 0 to 20090717_014019.
Running Upgrade: Migration created at 20090717_014019.
Upgrading to 20090717_014019 succeeded.

To implement the specifics of your migration code, just edit the corresponding migration file's up() method.

Integration
MP's API is intended as an integration point for frameworks to be able to directly implement migrations support without having to write a migrations infrastructure from scratch. Your framework's CLI utilities can programmatically configure, execute and create migrations easily. MP can also be configured with a delegate class to which all migrations have access, making it easy to bootstrap your framework before running migrations so that all of your framework's infrastructure is available for use inside the migrations with no additional effort.

Conclusion
I hope that MP can become a widely adoption standard for php migrations. I will continue to work on it and integrate it into the PHOCOA php framework and also add support for SQL migrations with Propel.

Friday, July 10, 2009

Getting postfix to relay mail through authenicated SMTP

If you're like nearly everyone out there, your home computer network has port 25 blocked by your ISP. Sadly this means that you can't easily use postfix or sendmail to deliver messages. They just pile up in your mail queue.






I have replicated the info here because it's so useful that I don't want to lose it if that link ever goes dead.


  1. Call your ISP and get your email credentials for SMTP. Typically you'll need the SMTP server, username, password, and port number.


  2. Edit /etc/postfix/main.cf:

    relayhost = [smtp.comcast.net]:587
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
    smtp_sasl_security_options =



  3. Create dir /etc/postfix/sasl if needed then edit file /etc/postfix/sasl/passwd:


    smtp.comcast.net myusername:mypassword



  4. Fix permissions:

    chown root:root /etc/postfix/sasl/passwd;
    chmod 600 /etc/postfix/sasl/passwd
    postmap /etc/postfix/sasl/passwd
    postfix reload



That's it! Blissfully perfect sendmail from now on.

Monday, June 29, 2009

Ode to IE, How I Hate Thee


Just got done spending wasting about 2 hours debugging something in IE.

I am using YUI's SimpleDialog and was getting complaints that the buttons weren't visible in IE browsers.

In the picture below is the code and the dialog displayed, incorrectly. There should be 3 buttons visible in the dialog, as you can see them defined in the code.


No errors, warnings, nothing. Of course it works in FF and Safari. So I tried figuring it out with the Web Developer Toolbar. No dice. I tried messing with widths and heights and a bunch of CSS to see if it was being hidden or something. NADA.

Then when I was browsing the DOM with the Web Developer Toolbar I noticed that there were only 2 input elements instead of the expected 3. I also noticed I had a trailing comma at the end of the third button definition. Could that be it?


Damn. C'mon IE, if you're gonna have a problem with my JS syntax, you could at least throw an error, is that so hard!

Sunday, June 21, 2009

President Obama: You're Doing it Wrong!

When Obama swept to victory in November, he did so because of a combination of a few simple things. He is charismatic, pragmatic and likeable; he talks about tricky issues in a nuanced and understanding way; and he has a long-term vision for solving problems.

Although his plans had very little substance behind them on the campaign trail, they did correctly identify the important aspects of all the major issues. As his critics often pointed out, supporters could project their own plans onto Obama's hopes. This could never last once he started governing.

Alas, now that he's running the country, the reality of how things get done is starting to scare off conservatives and independents, while the left thinks he's being too pragmatic.

As one of those independents, I am somewhat disappointed that he's generally taken a monolithic (big government) approach to solving issues. I think that he's done this because it's pragmatic - with a Democratic majority in Congress it would seem the easiest way to get things done is to do them in a way that the majority will vote for.

But most Obama supporters I know didn't vote for him to do things the way Congress wants to. We want him to be pragmatic in his solutions, not in the path he takes to get them passed. For that, we want the reformer in him; the side of him that leverages his charisma and mastery of nuance to go over Congress and not through it; to offer solutions that no one else ever has; to bridge the gap between Democrats, Republicans, and Independents, to rally the people to develop and deliver American solutions to American problems. In a word, we want change.

What we like about Obama is that he hints at a third way; not a Democratic way, not a Republican way, but a better way. He starts with the assumption that there exists a better solution to the problems at hand than either party pushes on their own. A way that leverages the ingenuity of the American people, that solves the problems at hand, and does so efficiently, fairly, and in a way that makes sense to a majority of the American people.

So what is this third way? It is a way that combines the power of the government with the ingenuity of free markets.

Government is a tool; I strongly believe that the government is the only player that can set and enfore appropriate regulations. But it is a tool that must be used appropriately. My general philosophy, and frankly one I think that the vast majority of Americans support, is that Government should be as small as possible, but no smaller. Government should create policy to acheive its goals with as little direct intervention as possible.

Free markets are a tool as well, if not the quintessential American tool. While they are extremely effective at getting individual players to compete to deliver the best solution, the best solution to the market is sometimes not the best solution for everyone. When such negative side-effects form, they need to be countered. Markets must be both fair and free of externalities that cause societical harm in any form. This is the American way. It must be the role of government to regulate markets so that the actions of the free market are based on fairness, and don't have negative side effects for market participants or society at large.

Unfortunately, on the domestic front President Obama has not pursued this third way as he has on foreign policy. I can see why; the President effectively runs foreign policy from behind his desk. For domestic policy, he must go through Congress.

My hope is that President Obama can find the courage to plot a new course as he works on Health Care and other domestic priorities that will result in the change we voted for.