Mike Schaeffer's Weblog
Fri, 24 Mar 2006
Restaurant Nutritional Information
No geek stuff today....

The FDA has done a good job of requiring packaged food to be labled with nutritional information, but when you eat out, that food can fall through the cracks. Some restaurants make solid attempts at making the information available: Red Lobster actually puts nutritional information for selected products right on the menu. However, even Red Lobster has limits: they only list information for their LightHouse menu, their menu of lighter fare. Go to their website, and you can see their position on the rest of their menu: "Since our chefs are continuously creating and customizing recipes for our menu, we only have Red Lobster's LightHouse menu information available online.". That rings a little hollow once you realize that dishes like their Crab Alfredo have been on the menu for decades. Of course, what's really going on is that Red Lobster knows that publishing information on the 2,000 calories (that's a guess) in a plate of Crab Alfredo will kill their sales. After all, restaurants are supposed to be a fun treat, not a tiptoe through a nuturitional minefield.

Like you'd expect, some restaurants are better than others. P. F. Chang's China Bistro (wonderful Americanized Chinese food, you should try it if you haven't) does the ultimate: they put all of their nutritional information online. That's everything from the 56 calorie cup of Hot and Sour soup to the 1,883 calorie "Great Wall of Chocolate". Good show (even if it is buried beneath some inconvenient JavaScript). McDonald's is also noteworthy: they have complete nutritional information available in the store, before

Moving down a bit are restaurants like Jason's Deli. Jason's deli claims that "We provide our nutritional information in Adobe Acrobat .pdf format.". However, once you open the PDF file, they ask you to send a mail asking for each piece of nuturitional information seperately. I don't know what their expectation is (do I really need to list every nutritional variable for every menu item?), but the evidence seems to indicate their closing the information up, rather than making it more open. Another trick is on Firehouse Subs' website. They publish nutritional information, but they fail to include cheese or mayo in their calorie counts (which are served by default) in their table of figures. If you order a stock medium sandwhich and skim the chart, you're liable to understimate the calorie count by 30-40%. In fact, the only way you can get the total calorie count of a completely dressed sandwich is to know that there are 9 calories per gram of fat.

I don't know what percentage of calories our country consumes comes through restaurants, but I do know that it's been increasing for a long time. As a result, it seems reasonable for the FDA to mandate that restaurants make nutritional information easily available in the store, at the time of purchase. To avoid too much adverse impact on smaller restaurants, perhaps this could be means tested: restaurants serving fewer than X people per day could be excluded, etc. Either way, I want to be able to know what I'm eating.

reddit this! Digg Me!

[/misc] permanent link

Mon, 20 Mar 2006
Time Flies...
A couple months since my last post... my news years resolution died pretty darned quickly. At the very least, I think I have a very good reason. Needless to say, Teresa and I are thrilled.

reddit this! Digg Me!

[/tech/this_blog] permanent link

Macros and Inline Functions
I recently converted a bunch of accessor macros in vCalc over to inline functions. These macros are a legacy of vCalc's siod heritage, and generally looked something like this:
#define FLONM(x) ((*x).storage_as.flonum.data)
In this macro, x is expected to be a pointer to an LObject, which is basically a struct consisting of union, storage_as, and a type field that specifies how to interpret the union. vCalc has a set of these macros to refer to fields in each possible interpretation of the storage_as union. These little jewels remove a lot of reduntant storage_as's from the code, and generally make the code much easier to work with. However, like all C/C++ macros, these macros have finicky syntax, bypass typechecking, and have limited ability to be extended to do other things (like verifying type fields, etc.). Fortunantly, they are a perfect candidate to be replaced by C++ inline functions and references:
inline flonum_t &FLONM(LRef x) 
{ return ((*x).storage_as.flonum.data); }
Even better, with function inlining turned on, there's no apparant performance penalty in making this transformation; even with inlining off, the penalty seems pretty modest at 20-20%. In other words, inline functions works exactly as advertised. It works well enough, if fact, that I made the 'logical extension', and added some type checking logic.
inline flonum_t &FLONM(LRef x)
{      assert(FLONUMP(x));
	return ((*x).storage_as.flonum.data); }
This version of the code verifies that x is actually a flonum before trying to interpret it as such. Normally, the code using these accessor functions explicitly checks the type of an object before making a reference, but sometimes, due to coding errors, invalid references can slip through the cracks. With the old style macros, these invalid references could result in data corruption with no warning. With checks, there's at least an attempt to check for bad references before they are made.

Adding these checks proved profitable: they revealed three logic errors in about 5 minutes of testing, two related to reading complex numbers, and one related to macroexpansion of a specific class of form. Adding these type checks also killed performance, but that was pretty easy to solve by making the additional checks independently switchable.

reddit this! Digg Me!

[/tech/general] permanent link

Visual Studio 2003 Safety Tip: Your Projects have GUIDs
If you ever manually work with Visual Studio 2003 projects (*.vcproj files), be aware that projects have both names and GUIDs, which are usually assigned by the IDE. If you try to duplicate a project in a solution by copying it to a new directory, renaming it, and adding the copy to your solution, the MSVC IDE will get confused since you didn't give your new project a new GUID. Other things might be effected by this confusion too, but the inter-project dependancy editor definately can't distinguish between the two same-GUID projects. This ends up making it impossible to correctly sequence the two project builds, and there's no clue in the UI about the cause of the problem, since the dependancy editor lists the two same-GUID projects under seperate names.

I don't know if MSBuild, in VS2005, is any better, but they claim to have made it more friendly to non-IDE use cases. The strange thing about this is that I'm not sure what purpose the GUID's serve: I'd think that having multiple projects of the same name would create a host of other problems that the GUIDs wouldn't solve by themselves. Combine that with the outright user hotility of string like this one, it's easy to wonder why the GUIDs are used.
{4051A65D-4718-41AE-8C94-6B1906EB4D77} = \
  {4051A65D-4718-41AE-8C94-6B1906EB4D77}


reddit this! Digg Me!

[/tech/general] permanent link