CRON-O-Meter: The Diet Tracker I’ve Been Looking For?

Filed under:Computing, Diet, Open Source — posted by Nic "RedWord" Smith on September 27, 02009 @ 12:12 PM

Found CRON-O-Meter, a diet tracking program the other day, and so far I like it. It gives me the instant feedback on my diet that I like so much, without most of the annoyances of NutritionData.CRONoMeter

The program uses the same USDA database that everyone else under the sun seems to use, but allows adding new foods. Even more importantly, you can take a food in the database, change its values, and make a new entry out of it, something that I desperately wanted on several occasions when using NutritionData. So, if you have a piece of salmon that just has a mystery coating on it that adds some calories, getting that into CRON-O-Meter is a matter of starting with the entry for the right type of salmon and adjusting it; while not every food can be dealt with like this, it’s still helpful for lots and lots of things.

The visualizations of CRON-O-Meter are less razzle-dazzle than NutritionData, but they’re “good enough” and don’t require selectively loading a buttload of flash; I can live with plain old bar charts and pie charts, and you could ever argue that these are superior, time-tested charts that are easier to read than NutritionData’s triangle. NutritionData, unlike CRON-O-Meter, has always been a bit of a nutritional nag, complaining indiscriminately about relatively high levels of fat and sodium on a food-by-food basis. I know I shouldn’t anthropomorphize computer programs, but NutritionData seems shrill and nagging about EVERYTHING. As I once joked — “Sugar has sugar in it? I had no idea.

I’m not yet certain if CRON-O-Meter is smart enough to have any sense of “Net Carbs.”

CRON-O-Meter also has a sense of time, and will happily act as a food diary for a while. NutritionData requires daily “clearing” to use its tracking on a day-by-day basis.

It looks like it’s possible to share nutritional information from CRON-O-Meter with others. I have no idea how this works.

As the name indicates, CRON-O-Meter was designed with Calorie Restriction in mind, but I don’t see any reason you couldn’t use it for basically any reasonable diet.

Installation on my Ubuntu system was a bit awkward. The “Linux” download link is a shell file that has comments to download the MacOSX version and unzip it in the same directory. The zip utility that comes with Kubuntu, Ark, insisted that this archive wasn’t valid, although I managed to open it up just fine with the command-line unzip. All said and done, I managed to get an entry in Kickoff that I click on to launch CRON-O-Meter just like any other program, even though it took me a few minutes (Hint: Working directory matters). I’m guessing Windows installation is easier, actually having an executable setup.

Strange PHP Code I wrote

Filed under:Computing, PHP, Silly — posted by Nic "RedWord" Smith on September 11, 02009 @ 9:02 PM

I wrote this to deal with the weird, weird way that PHP handles variable variables and arrays:

eval (\$item_to_make = &$item_to_make;”);

I think it’s the ugliest thing I’ve ever written.

My DSL Connection Script

Filed under:Computing, Open Source — posted by Nic "RedWord" Smith on August 7, 02009 @ 12:20 PM

I recently moved into a new apartment, and that meant getting a new Internet connection. This is the first time I’ve set up a permanent high-speed connection that I’m not sharing with anyone else for my computer. To complicate things slightly, Windows isn’t working right now on Lelouch (my laptop), and Kubuntu is all I have.

I used pppoeconfig to set up my intial connection, and was pleased that it more or less “just worked” right away, so I was surprised when I rebooted, ran pon dsl-provider, and it didn’t work.

By playing around with pppoeconfig, I managed to figure out that it runs pppoe -A -I eth0 when it says “looking for access concentrator” or something like that. From what I gather from Wikipedia, this is the discovery phase of PPPOE, and either the DSL modem or my ISP expects it for every single connection.

So, I ultimately came up with this script to connect to the internet:

#!/bin/bash
pppoe -A -I eth0
pon dsl-provider
sleep 2
plog
echo "Press any key to continue..."
read -n1

Mind you, I only have a really, really vague sense of what pppoe -A -I eth0 actually does, so there could be some inefficiency or problem here that I’m not aware of (in other words, your milage may vary). But it works. The last four lines are because I’m nosy and like to see what going on.

The Lexmark x4270 DOES Work In Linux

Filed under:Computing, Open Source — posted by Nic "RedWord" Smith on July 27, 02009 @ 12:48 PM

There’s a lot of misinformation about the Lexmark x4270 under Ubuntu, with a lot of pages simply claiming it doesn’t work. This is not correct; the printer works just fine (as far I can tell, I haven’t tested color printing yet) using the Lexmark Z42 CUPS driver. While I’m not aware of any way to get the _scanner_ to work, the fax and copier should also work standalone, of course.

Old Comments Closed

Filed under:Computing — posted by Nic "RedWord" Smith on January 10, 02009 @ 3:08 PM

To make maintence easier, comments on old posts on Original Cin have been closed.

NutritionData: Master of the Obvious

Filed under:Computing, Silly — posted by Nic "RedWord" Smith on December 10, 02008 @ 11:42 AM

This page at NutrionData states the obvious:

Sugar has sugar in it? I never would have guessed…

More Fun With Random Numbers

Filed under:Computing, Silly — posted by Nic "RedWord" Smith on September 27, 02008 @ 2:59 AM

From http://xkcd.com/221/

License

Custom UIComponent extention in Flex and Keyboard Input

Filed under:Computing — posted by Nic "RedWord" Smith on September 19, 02008 @ 9:58 PM

I was having a hell of a time trying to get keyboard input to work for a custom UIComponent in Flex. Many messages on the web about this particular problem are not very helpful, don’t identify what’s going wrong, and tend to misidentify the problem as failing to call the super.keyDown() method. After determining that my UIComponent extension wasn’t receiving focus, I found this comment by Khelonium in the documentation:

I had a little problem when I tried to have focus working on my custom Components. The UIComponent class documentation looks like Focus is enabled by default, but it is not. To have Focus enabled you have to implement the IFocusManagerComponent , I have found the documentation(thanks to the mailinglist) here :
http://livedocs.macromedia.com/flex/2/docs/00001727.html

Chalk it up to boneheaded language design, poor choice of defaults, and bad documentation that this problem from no later than Sept 2006 is still confusing in 2008.

FanCruft Facelift

Filed under:Computing, Create It, design (visual style), marketing — posted by Nic "RedWord" Smith on August 2, 02008 @ 1:59 PM

FanCruft, my anime website, has just gotten a much-needed facelift. Here are before and after pictures:

When I first made Fancruft, I wanted to make it look good even in Internet Explorer 5 running on a fairly low-resolution screen (640×480). Many “Web 2.0″ concepts were new; RFC4627 was published just earlier that year. People were still advocating Smarty for PHP templating. I had been a Wikipedia administrator for maybe around a year and a half, and had not yet read The Wisdom of Crowds.

A lot of works still needs to go into FanCruft, but it now has a fairly modern face. IE 5 is no longer a concern, and the site now renders much more consistently across IE 7, Firefox 2 and 3, Opera, and Safari. IE 6 doesn’t seem to understand fixed positioning and misinterprets it as absolute positioning, but this is still acceptable. The site is now designed for a screen of 800×600, but linearizes fairly well and should still be acceptable on smaller screens.

The independent “scattered” buttons have been replaced by a bar with a uniform height and no margin. Min-width is now supported well enough that I don’t mind just setting it and forgetting it, instead of using the IE5/6 hacks of yesteryear. Also, the buttons now glow gold on hover; yay!

The fine print at the bottom of the page has been cut down to a minimum, and the RSS icon now hovers on screen, just in case it isn’t noticed in the browser’s address bar. Overall, FanCruft is sleek and good looking.

Made Of Division

Filed under:Computing, Create It, PHP — posted by Nic "RedWord" Smith on July 26, 02008 @ 11:17 PM

I was a bit surprised earlier this week to find out that Omegapaladin (who is lightyears ahead of me in l33t math skillz) hadn’t heard of the concept of the modulo before. There’s a lot of unfortunate nitty-gritty problems about mod, but it’s a very useful operation. I wrote a small program in PHP that uses mod in two interesting ways.

The script is attached to this post. First, though, here’s the image it creates:

This is Pi, sort of. The image can be “read” from left to right starting at the top and going to the bottom. Because there are ten possible digits in Pi but there are seven rainbow colors, I needed a way to figure out what to map 7, 8, and 9 to. The “correct” way to do this would to get a base-7 representation of Pi, but I wanted to talk about mod. So, for each digit of pi, I picked a color for the rectangle by taking the corresponding digit of pi and modding it by 7: “i % 7″

Now, the digits of Pi can be thought of as a one dimensional sequence, but the image above is two dimensional. Given that we’re considering the nth digit of pi, how do we translate this into an x and y position? Using mod:

for($i = 0; $i < $length_of_pi; $i++) {
$current_pixel_y = floor($i/25);
$current_pixel_x = $i % 25;

The first line determines what row we’re in, from the top (there are 25 pixels in each row). The next line determines the column within the row, using mod. This works because the number of pixels left after accounting for all the previous rows go into the current row.

PiPHP.txt – The Script

Fun With Random Numbers

Filed under:Computing — posted by Nic "RedWord" Smith on July 22, 02008 @ 2:20 PM

My roommate and I were discussing pseudorandom number generators. Since I’m not particularly good at math, he stumped me for a while by asking how a sequence of numbers from a generator compares to real random numbers (like, for instance, numbers generated from radioactive decay).

It turns out that my roommate could have stumped someone with a lot more knowledge with his question: Wikipedia notes “It is an open question, and one central to the theory and practice of cryptography, whether there is any way to distinguish the output of a high-quality PRNG from a truly random sequence without knowing the algorithm(s) used and the state with which it was initialized.” Of course, some sequences of numbers generated by a less than perfect PRNG are almost certainly not random.

Googletastic

Filed under:Computing, design (visual style), marketing — posted by Nic "RedWord" Smith on July 19, 02008 @ 10:42 PM

One of the neat things about Google: They often work to subtly improve their service, and when they do, they often integrate the improvement so seamlessly into their existing site that you can easily miss it. This is a screenshot from the other day. I’ve entered the (domain) name of a website, and Google has automatically put a search box for that site under its listing in the results. I almost entered a second query in this box and clicked the button without even noticing that this was something I hadn’t seen before!

A search for "chipublib" on Google

A search for "chipublib" on Google

Hello Love

Filed under:Computing, Silly — posted by Nic "RedWord" Smith on July 17, 02008 @ 12:56 AM

You’ll need Love to play this trippy Hello World animation.
Hello World

Japan, Eat A Hand

Filed under:Anime, Computing, Create It — posted by Nic "RedWord" Smith on July 15, 02008 @ 3:11 PM

Now, for the explanation of the previous post.

I managed to get the buffering trick in XUL to work: it is possible to use a deck of stacks in XUL for animation. HOWEVER, doing so has a really, really high CPU cost, to the extent that just flipping back and forth between two images at 30fps shot my CPU usage up to 100%. (But note that other have done far more interesting things with the canvas tag without things being quite so disasterrific).

So, I basically decided that in-browser games are highly overrated, and I was looking for a more traditional game engine. My requirements were basically that it’s available under a BSD style liscence, a 2D focus, and has decent scripting. Somehow, I found LÖVE (Ha!). So of course, I started look at the demos, and found the Kawaii Kitten Adventure, which is a bizarre, bizarre game where you shoot eyebeams at hearts. Oh, and Caramelldansen is playing in the background while you do this. For an explanation of the title of this post, see the misheard lyrics; or maybe not, I think my eyes might be bleeding.

LOVE?! Kitten!? WTF?!!!

Filed under:Computing, Create It, Role Playing Games, Silly — posted by Nic "RedWord" Smith on @ 1:55 AM

I’ll post the story behind this pic sometime after I wake up “tomorrow.” The short version: It’s a screenshot of a tech demo for a game engine called “Love” that I found online.

56 Megabytes of Obama: The Microsoft Bloatware Story

Filed under:2008 election, Computing — posted by Nic "RedWord" Smith on July 11, 02008 @ 2:32 PM

I was running Windows Update today, and found this gem in the “Important” updates:

Microsoft update KB955202 Screenshot

Just to go over what I’ve highlighted in the image above: The update is just over 56 MB. It’s considered an “Important” update. And it updates the dictionary used for spellcheck – to add new words to it.

Now, I can see how a dictionary update could be important if the default dictionary is correcting words in a dangerous, humorous, or obscene manner. But all this does is remove a few squiggly red lines.

And what words does KB955020 actually add? According to Microsoft: “Friendster,” “Klum,” “Nazr,” “Obama,” and “Racicot”.

For reference, the entire ISPELL wordlist is just over 1.5MB, uncompressed.

File paths, chrome, and XUL

Filed under:Computing, Create It, Javascript — posted by Nic "RedWord" Smith on June 1, 02008 @ 1:34 AM

I was working with XUL and Javascript yesterday, and I ran into some interesting problems. I’ve set up my chrome so that the project I’m working on in Eclipse is available in Firefox as “chrome://twodee/content/exampleScreen.xul”. I wanted a function I wrote to accept a filename as an argument, but no matter what I tried, a relative path wouldn’t work.

Well, of course not. You can’t just arbitrarily go from chrome-based URLs to file locations. Tossing a chrome URL into a function that’s expecting a file path is going to have some bad results. Specifically, “not a file” exceptions.

So, this works:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="2DYouSee" title="Demo &quot;Game&quot;"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	onload="Start2D('C:\\Users\\Nic\\workspace\\2DYouSee\\content\\demo\\gameworld.json.txt')"
	width="650" height="490">
	<script src="io.js" />
	<script src="json.js" />
	<script src="twodee.js" />
	...
</window>

This does not:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="2DYouSee" title="Demo &quot;Game&quot;"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	onload="Start2D('gameworld.json.txt')" width="650" height="490">
	<script src="io.js" />
	<script src="json.js" />
	<script src="twodee.js" />
	...
</window>

Ponoko

Filed under:Computing, Create It, Project TickTock — posted by Nic "RedWord" Smith on May 4, 02008 @ 2:03 AM

I just happened to find Ponoko, a site that will laser-cut things based on EPS files. Oh, and they have Inkscape templates available.

More On The Logic Of The Clock

Filed under:Computing, Create It, Project TickTock — posted by Nic "RedWord" Smith on March 12, 02008 @ 11:41 AM

Last time, I wrote that it’d be very difficult to work through the clock’s logic if I used only 5 output pins. Fortunately, there’s no requirement that says I need to do so — leaving two pins available for input should be sufficient. I can use 1 pin to denote AM/PM, and that leaves 10 pins available.
In general, the fewer pins make up a combination for a particular hour, the easier the logic will be to work through, so I’m starting by assigning every available combination that uses only 1 or 2 pins first (for AM and PM, respectively) then I move on to 2 and 3 pin combinations:
0000000001 1AM/PM
0000000010 2AM/PM
0000000100 3AM/PM
0000001000 4AM/PM
0000010000 5AM/PM
0000100000 6AM/PM
0001000000 7AM/PM
0010000000 8AM/PM
0100000000 9AM/PM
1000000000 10AM/PM
1000000001 11AM/PM
1000000010 12AM/PM

The Logic Of The Clock

Filed under:Computing, Project TickTock — posted by Nic "RedWord" Smith on March 4, 02008 @ 2:44 AM

The clock, as I’ve previously described it, can be in one of 24 possible states, because there are 24 hours in a day. Each hour “segment” of the clock can be in one of three possible states — red, yellow, or green, but red and yellow are really the same state based on whether the time is AM or PM.

I’m thinking of making an Arduino the heart of the clock. It’s a bit of overkill, but I guess I can have a fancy light display for the change of the hour or something like that.

The Arduino has thirteen digital outputs (or inputs, as the case may be). One way to hook things up would be to have each output control a single section of the clock, and use the final one to determine AM/PM. Unfortunately, this doesn’t leave any way to change the time.

There are 24 possible states for the clock face. The minimum number of outputs needed to represent this is 5, since 25=32. However a lot of fairly complex logic would be required to get the clock working in this case: 12PM would be “01100″ and 4PM would be “10000″ — here’s a table of each possible output when using five pins this way, the corresponding time, the color that the “9′o’clock” segment should be.

Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Time Color
0 0 0 0 1 12:00:00 AM GREEN
0 0 0 1 0 01:00:00 AM GREEN
0 0 0 1 1 02:00:00 AM GREEN
0 0 1 0 0 03:00:00 AM GREEN
0 0 1 0 1 04:00:00 AM GREEN
0 0 1 1 0 05:00:00 AM GREEN
0 0 1 1 1 06:00:00 AM GREEN
0 1 0 0 0 07:00:00 AM GREEN
0 1 0 0 1 08:00:00 AM GREEN
0 1 0 1 0 09:00:00 AM YELLOW
0 1 0 1 1 10:00:00 AM YELLOW
0 1 1 0 0 11:00:00 AM YELLOW
0 1 1 0 1 12:00:00 PM GREEN
0 1 1 1 0 01:00:00 PM GREEN
0 1 1 1 1 02:00:00 PM GREEN
1 0 0 0 0 03:00:00 PM GREEN
1 0 0 0 1 04:00:00 PM GREEN
1 0 0 1 0 05:00:00 PM GREEN
1 0 0 1 1 06:00:00 PM GREEN
1 0 1 0 0 07:00:00 PM GREEN
1 0 1 0 1 08:00:00 PM GREEN
1 0 1 1 0 09:00:00 PM RED
1 0 1 1 1 10:00:00 PM RED
1 1 0 0 0 11:00:00 PM RED

So, the rule just to determine if the yellow LEDs for the 9 segment should be on would be something along the lines of “Light up if ((Pin 2 AND Pin 4) AND NOT (Pin 3)) OR ((Pin 2 AND Pin 3) AND NOT (Pin 4 OR Pin 5))”

Yikes. Complex! Poking around Wikipedia gives some hints on how to make this slightly better, but nothing based on an output of 5 pins is going to be simple. Fortunately, there are some things that I can do to make things easier for myself…


next page


image: detail of installation by Bronwyn Lace