Tools to Help With Your Diet

Some of you probably know that I’ve lost a little over 30 pounds since May. I did it with the help of a nutritionist, and I’m really happy with the diet, so much so that I actually stick with it now, three months later, with very little effort. I have since integrated some serious substance back into my diet (ice cream once a week, croutons on salad, occasional “cheat meals”, etc), and so far, I’m still losing weight. My theory is that diet is 100% about insulin, and that’s controlled by carb intake. Startchy or processed, non-fiberous carbs prompt the production of insulin, which, as it overflows, pushes conversion to fat and triglycerides. More on that later.

I use a few tools to aid in recording my progress:

Weightbot for iPhone is one of those tools. It’s hard to go through this process without tracking your weight. I do so aggressively. I weigh myself 3-8 times a day, which is generally advised against. I do this to understand how weight fluctuates. Even eating a crappy meal won’t affect my weight, but a bad weekend, for example will. I bought an accurate scale and I track the weight daily with a single weight-in, taking immediately after I pee first thing in the morning.

Weightbot's Graph

Weightbot tracks my weight in graph form, and it gives me detailed statistics.

Weightbot's Goals

iMapMyFitness is an incredible application. I start it and then launch my iPod before going on walks. Then, when I get home, it plots my walk and gives me stats on the walk. I can measure the quality of any workout very quickly and fairly accurately, but at least consistently.

iMapMyFitness

Lastly, I recently invested in a Withings scale. It’s a super accurate scale that is wifi-enabled, which means it stores my weight online. Weightbot is fully integrated, so I will be able to even more accurately measure and graph my progress.

Good luck.

A Guide to Base Changing For Short URLs

Some time ago, I developed a VERY simple way to fake a bit.ly-style short URL. On any server that uses any form of an integer to identify an article (either in the database or the URL), on an Apache server that supports mod_rewrite, you edit your .htaccess file like so:

RewriteEngine Off
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^index.php$
RewriteRule . index.php [NC,L]
</ifmodule>

This essentially tells your server to redirect anything that isn’t a file or directory to index.php.

Then index.php looks like this:

$url = str_replace("/","",$_SERVER['REQUEST_URI']);
if(isset($url) && trim($url)!='') {
$id = base_convert($url,36,10);
//this is where you either query your database for a slug or build the URL
$uri = 'http://your-site-goes-here.com/path/to/article';
}
 
if($uri) {
header('HTTP/1.1 301 Moved Permanently');
header('Link: < '.$uri.">; rel=shortlink");
header('Location: '.$uri);
exit;
} else {
header("Location: http://your-site-goes-here.com/"); exit;
}

How do you get your short links? That’s easy. Just run this function:

$shorturl = base_convert($id,10,36);

However, this isn’t the most compact way to condense. Obviously, this is base36, the highest PHP can go. But what about uppercase letters? And other characters?

So I set out, for some reason, to build a better condenser.

This is the result of several hours of work, mostly wasted, on some intellectual pursuit that was more a case of simply not letting it defeat me. A few notes: I’m quite confident that given enough time, and if I cared, I could make the code cleaner and more efficient in some places. I’m also aware that on 32 bit machines, it maxes out at the integer limit. I does support signed integers though, from min to max.

$ft_str = '0123456789abcdefghijklmnopqrstuvqwxyzABCDEFGHIJKLMNOPQRSTUVQWXYZ';
# uncomment the next line if you prefer to use potentially non-URL-safe base96
# $ft_str .= '0123456789abcdefghijklmnopqrstuvqwxyzABCDEFGHIJKLMNOPQRSTUVQWXYZ_@$!#%^&*()=+\|}{][,;:~'; }

$powers = array();
for($p=0;$p&lt;=10;$p++) {
$powers[$p]=pow(strlen($ft_str),$p);
}
 
function ft_unconvert($str) {
if(substr($str,0,1)=='-') { $pfx='-'; } else { $pfx=''; }
global $ft_str,$powers;
$base = strlen($ft_str); $q=0;
$s = str_split(strrev($str)); $len = sizeof($s);
foreach($s as $k=>$v) {
$sp = strpos($ft_str,$v);
$decimal += pow($base,$k)*$sp;
}
return $pfx.$decimal;
}
 
function ft_converter($int) {
if($int > 0) { $pfx='-'; $int=abs($int); } else { $pfx=''; }
global $ft_str,$powers;
$base = strlen($ft_str); $q=0;
$p = str_split($str);
krsort($powers);
foreach($powers as $k=>$v) {
if($int>=$v) {
$timesinto = floor($int/$v);
$digit .= $ft_str{$timesinto};
$int = $int % $v;
} elseif($int>0 && $k==0) {
$digit .= $ft_str{$int};
$int = $int % $v;
}
}
return $pfx.$digit;
}
 
function ft_convert_demo($num) {
global $ft_str;
$ftc = ft_converter($num);
return "Converting ".$num." into base ".strlen($ft_str).": ".$ftc."<br />Unconverting ".$ftc." to base 10: ".ft_unconvert($ftc);
}
 
echo ft_convert_demo('50687');

Interesting!

The following post originally appeared on the Phish.net Blog:

I admit it: I’m a setlist snob.

I started formulating this realization on the field in Indio, when ZZYZX turned to me and said, without the condescension implied, “I remember when I was chasing bust-outs.” And my response was succinctly “If we’re going to hear a 10 minute jam, I suppose I’d rather have the jam be off of a song I haven’t heard before rather than one I’ve seen a dozen times.”

But as true as that is, it’s not the real story. The real story is that I am chasing bust-outs. Not just bust-outs, but “interesting-ness”. And “interesting-ness” changes with the seasons. I’m actually chasing anything at a show that makes me think “Interesting!

I’ve posted about setlist construction before – to me, as a bit of a Phish geek – it’s fascinating. Those seconds when the band takes the stage, before the first notes of any song, are magical and hopeful – anything can happen. Will it be AC/DC Bag? Will it be Punch? Will it be a song I like? A rarity? A random cover? Will it be something that will make the show immediately legendary, like Harpua? Or an entire cover album?! It’s maddening!

And so it goes, between every song of every show… I wait with bated breath for what might be.

I thought Black-Eyed Katy was awesome in 1997 — one of the highlights of 11/22/97, I’d say. When Moma showed up in summer 1998, it was a funkified sensation. But now Moma makes me cringe – standard fare on a standard night, been there, done that. It takes a lot to make Moma catch my ear these days. Guyute was a patient fan’s reward not too long ago. But these days, I hear groans when Phish launches into a fairly standard execution of this complex composition, which is no small musical feat. Some used to call Roggae a “set-killer,” but here we are in 2010, and 2009 made it into a cherished treasure.

That’s the thing with setlist mechanics: they change every year, if not every tour. As certain songs get played over and over (Kill Devil Falls, anyone?), they lose interesting-ness and uniqueness. When songs disappear and re-appear, they gain it. I’m not sure I think Spock’s Brain is even a very good song, but it’s certainly a rare treat, and that makes me wish I’d get a chance to see it played.

This is how it unfolds, without fail, as I review each show’s setlist. A show that opens with Vultures? Interesting! A show that features a bust-out? Interesting! A new and random cover that could be a one-timer? Interesting! A novelty show, such as the M show, GameHoist, or even the recent Saw It Again adventure? Interesting! The appearance of a song like Dogs Stole Things in a 2010 setlist is interesting, but in 1997, not as much.

A song like Stash is one where I’ve simply fallen out of love, and yet, my most recent shows, Stash has lead to an incredible jam. Ditto Down with Disease, Bathtub Gin, and Wolfman’s Brother. Seeing these doesn’t inspire an Interesting!, but it might be. Hearing a song like Harry Hood or Fluffhead live is almost always satisfying to me. But when I see it in a setlist from a show I’m not attending (or couch touring), it doesn’t make me think “Interesting!” Ditto for Bowie, YEM, and Reba.

On the other side of that coin, songs like Brother, Camel Walk, and Destiny Unbound are rare and interesting enough that, even when executed in standard fashion, they are eye-catching.

Funny thing, if I made a mix of my favorite Phish live song performances for a fellow Phish fan, it likely wouldn’t include many of the “interesting!” setlist choices, but rather, the best jams. And what songs are they? Ghost, YEM, Piper, Split Open and Melt. Not quite “Interesting!“, is it?

As you can see, judging a show from its setlist is almost always a bad idea. It’s much smarter to use the advice of those in the know, or employ something like the Phish.net show rating results to find shows to hunt down. But that doesn’t mean that some of us don’t go against better judgement, and look for those shows with setlists that make us think “Interesting!

Today is Not Yesterday (and Cannot Be)

The following originally appeared on the Phish.net blog:

Today starts Phish summer tour 2010, and I can’t help but get sucked into the whole “Phish 3.0″ debate: are they still any good? Can they still jam? Will there be any notable performances? Will 2010 be able to hold a candle to Phish 1.0 shows?

My friend and colleague ZZYZX recently pointed out that Phish has seemingly been misremebered for their long, exploratory jams, when in reality, they didn’t “jam” much until the late 90s. He also points out that perhaps there’s less work required to hit the jam stride, the sweet spot of the jam, so to speak.

I’ve been sucked in a few times to debates with people who maintain that Phish isn’t the same band they used to be. Of course this is true, they’ve got decades more experience, they aren’t trying to find themselves like they were in the 80s, and they’re at a different point in life. But what’s also true is what got us here may not get us there, to borrow a business motivation phrase.

When I hear the complaint that Phish doesn’t write like they used to, citing songs like Reba and Fluffhead, I’m bothered.  Phish does attempt songs like those still: see Time Turns Elastic. Walls of the Cave. Waves. Pebbles and Marbles. The challenge is that these are new, and new is never as good as old when it comes to music.

Let’s look at Time Turns Elastic. I’ve advocated for Time Turns Elastic before, but let me just highlight some of that here. Those noobs who make smarmy jokes suggesting TTE is only for pee breaks annoy me. Time Turns Elastic is a musician’s wet dream: I dare you to try to count it out. It’s got definitive sections, much like Fluffhead. It’s got a happy ending jam a segment, like The Arrival. It’s got some fun, warm sections, like Reba. And some tough-to-figure-out, intricate composed sections a la Divided Sky. But for whatever reason, there is a large group that simply doesn’t like this masterpiece. So much so that it was voted the worst Phish song in a recent poll on Phish.net. Meanwhile, the return of Fluffhead had phans creaming in their drawers. That doesn’t make sense to me.

I’m forced to maintain that older equates to better for too many. We’ve heard Fluffhead a thousand times, it’s part of Phishtory, and it reminds us of a simpler time. It evokes emotion in a way newer songs just don’t… yet. I think in time, should TTE become a rarity, it will get its due. In the meantime, Fluffhead was first.

There’s a certain pride, with a band, in being there first. I only heard of Phish for the first time – that I can remember – in 1992. By then, several of the Phish.net staff had already seen more concerts than I have since. I wonder sometimes if I would have even gotten into Phish if it was 1988 when I first saw them. Or 2004. The state of the band when you first took interest in them undoubtedly shapes your judgement of them in all subsequent phases of their career. But I think we’re unique here, because we have so much of the history captured on tape for posterity… and repeated analysis. I think that many of us are brainwashed because we don’t revisit the totally average shows nearly as often as the epic shows of days past, so we start to believe that the quality used to be higher. We compare every show we attend now to the highlights of days past. Dip that ladel in the tub, and your creation will yield disappointment – the purple paste of “Phish 3.0″ being a letdown. It’s not. It’s exactly what anyone paying close attention should have expected. It’s the natural evolution of Phish.

Phish is no longer a bunch of kids trying to define themselves. They’re a bunch of 40-somethings who have experimented and found their comfort zone. They’re evolving, but at the same time, narrowing in on what makes them happiest and will sustain them longest. They like a variety of music and styles and like variation in their setlists. They like adopting wacky covers, sometimes only once (e.g. Rhincerous, Layla, Golden Age, Terrapin Station). They like playing their classics. They like shelving songs and surprising audiences with their unexpected return. They like treating remote audiences to something special. They’re not a jam band or prog rockers or hippies or old men or young men – they’re amorphous. They’re not just performing, they are creating an overall experience.

In 2009, Phish honed their skills and ambitiously aimed for flawless execution. People complained about lack of variety (AC/DC Bag to open seven shows in 2009?), but Phish played 248 different songs last year, a full third of their entire twenty-five plus year repetoire. What will 2010 have in store for us and will it appease the masses?

Stay tuned to Phish.net to find out.

LOST Recap

I was mixed after the LOST finale.  Then I saw the Flashforward finale.  Flashforward is a show that did a *lot* of things wrong, but with only two weeks notice they would be canceled, they rearranged a few scenes, solved the largest mystery, and gave us an interesting, hopeful, cliffhanger-y ending.   Yes, they ignored or let die the majority of the ancillary mysteries, but overall, it was great, given the circumstances.  Lost, on the other hand, was a joke.

The gave us a “resolution” to the characters ignoring the fact that they sucked us in with the Island.  Dharma.  Jacob.  The hatch.  Hanso.  The DeGroots. The intertwining lives.  The numbers.  Hurley at the institution with Libby.  Walt being special.  The Egyptian stuff.  The statue. The constant.  The pregnancy thing. The others.  The purge.  The pylons.  The “files” on the castaways.

And they f*$%ed us.  They broke our contract – we watched and pieced it together, they were supposed to reveal what happened. And they didn’t. They didn’t just leave one or two things up to us, they just flat out abandoned the mysteries altogether. I’d say more, but I can’t do it better than Eugenia already did.  I urge you to read this piece on why LOST worked, and this piece on why Lost sucked first. Ultimately, for me, Lost was the best ride ever that had no real payoff.

LOST: What to Make of the Finale

Many people will be disappointed by last night’s series finale of LOST. Many will be incredibly satisfied. Count me among both camps.

If you were a fan of the show because it was enthralling, as I was, you’ll love the finale. It had action, romance, drama, comedy, and a generally happy ending. If you were a fan for the mystery and mythology, as I also was, you will be very disappointed as virtually every core mystery was completely abandoned.

Emotionally, I was completely satiated. I was rooting for Sawyer and Juliet to find each other, I was so happy for Claire and Charlie, I thought Jin and Sun played their awakening scene perfectly, Hurley and Libby shared an awakening kiss, and we’d already had our Desmond/Penny reunion. All that was missing was Daniel and Charlotte pairing off. I wish we had seen a happy ending for poor ol’ Miles, but I guess he had his dad.

Intellectually, I was a little stumped. First, by the solution: um… what? So the entire alternate timeline was post-death, or just the church scene? They joined the alternate timeline when they died in the real timeline? Wait… was the real timeline even real at all? I don’t know.

Mythologically, I was downright pissed. Is it okay for the writers to give us 121 hours of programming spurred on by completely mind-bending mystery and then completely and totally abandon virtually every one of those storylines with no explanation?

The central mystery of the show was “What is the island?” It was the center so much so that the pilot ended by dropping its first titlecard after Charlie’s now infamous “Guys… where are we?” That was not only not answered, it was flat out made more complicated in the finale.  In protecting “the source,” we saw Desmond and Jack descend into the light.  First off, going in certainly did not mean a fate “worse than death”; second, it seemed the bottom of the well was man-made! WHA…? There’s another entire story at the bottom of the light source.

Let’s not forget about all the little nagging ones… How does Hurley see dead people? How can Miles talk to them? What is the smoke? Who built the frozen wheel? How does the island “move” when the wheel is turned?  How did Jacob make Richard ageless? What was up with Hanso and the DeGroots? What was the Hanso connection with the Black Rock captain and the blast door map? The questions are limitless, and they go largely unanswered.

So, today, I’m not sure how I feel about the entire thing.  On one hand, I feel betrayed for having invested so much time in the mysteries to be completely ignored.  On the other, though, it was the best 121 hours of TV I’ve ever watched.  Even the less-exciting episodes were still the highlight of the TV week.  I doubt I’ll ever have as much fun with a TV show as I have on the journey of LOST.

Detox: Day Two

I went to see a nutritionist last week.  My goal was to bring down triglycerides, bring up good cholesterol, and bring down bad cholesterol.  I figure if I do those things, my weight will go down, my energy will go up, and I’ll feel generally better.

This week I began my diet modification.  I say “modification” because it’s not a diet – a diet suggests a start and stop.  This is a slow modification of what and how I eat.

All good low-glycemic diets, she says, begin with a detox period.  I’ve been asked many times about the detox, so I’ll detail it here:

This is my own summary, as relayed by my nutritionist and interpretted by me. I am not a doctor, a dietician, or an expert, but rather, an avid and curious reader, and you shouldn’t make diet or medical decisions based on what I’m telling you. But here you go anyway:

Your liver’s primary job is to filter toxins from your intake. In many cases, especially in overweight people busy eating bad food or, at best, enough calories to at least stay overweight, its busy digesting fats, protein, etc. most of the time. Sometimes, it has so much work to do, it can’t keep up. So it packages and stores fats and proteins as triglycerides and fatty acids. They are packaged for later, and the liver moves on to other things. The liver has lots of roles, though, and part of it, as you’re digesting, is to clean up after the digestion process.

When you eat carbs (sugars), your pancreas secretes insulin. The insulin response triggers the chaining together of glucose molecules from the blood into glycogen. The glycogen is “animal starch,” and it’s what we use for energy. As your body begins to get “full” – on in this case, more accurately and objectively, “postprandial,” which indicates glucose levels – insulin levels subside as production is decreased. Digestion is pretty complex, I understand a fraction of a fraction of a percent of how it works, but clearly, the liver plays a critical role and remains busy.

Most people, it seems, go through a constant cycle of sugar highs. They get hungry, they dump sugar into their bodies, they mass-produce insulin, the sugar is “dealt with”, and they crash, which makes them hungry for sugar, repeat ad nauseum. There’s another cycle of salt to sugar. I can remember times in my life of eating saltines and Chips Ahoy alternatively.

Now, when you detox – in my case, by eating ONLY certain veggies (and 3 servings of fruits a day for some simple sugars) – your liver doesn’t have anything to do most of the time. It digests your food quickly, its job is done in one to three hours. So, sitting idle, it eventually says, “Well, I might as well take care of that stuff I stored.”

It will start burning off the old stuff you’ve had stored. This process, apparently, doesn’t work forever. Eventually, the low calorie intake and the lack of carbs and protein can get very unhealthy very fast. So it’s only a week long. Then we add things like nuts and fruits and beans and fatty foods like avocado.

It does, however, in most people, “teach” your liver to go back to the stored fats and process them. And the idea is to adjust your food intake, both in quantity and in quality, over time. You want your organs working off of what you eat, not storing your food. It seems pretty evident to me that this requires you to reduce carbohydrate intake. Sugars are carbs, carbs are calories, so most low-calorie diets are actually masking the source of success: low carbs.

I’m entirely convinced that carbs are the problem in diets. Not carbs in general, but low-fiber, simple carbs that exceed the amount we need and expend. Look at all the shit we love to eat: chips, fries, cookies, ice cream, candy – it’s all carbs.

Back to the detox: in the first few days, I’m told to expect a massive drop in energy, general discomfort at the hunger pangs, unease that may come from any toxins being released from within those stored fats, and, of course, irritibility from the sugar withdrawal. But so far, so good. I’m about 36 hours in, and I’m still feeling okay. Yesterday late afternoon was tough, but I found some veggie burgers – Dr. Praeger’s – that were amazing. So good that I’d eat them off this detox. But sadly, I’m limited to 2 a day by the nutritionist, otherwise, I’d eat 10 a day.

By day 4, I’m promised that energy level should shoot up as body is growing more efficient and is oil and fat starved. Given the efficiency (and purity?) the metabolism ought to have by then, I think this is realistic. I’m optimistic about where this change is going to lead me, because I’m encouraged by everyone around me.

Updates to follow for sure.