Getting Wii fit

After having been a bit sceptical about the Wii Fit, I decided to get one for the family. I don’t regret it.

The idea is really simple, and probably doesn’t carry much “scientific weight” when it comes to many of the “exercises”, but it is fun. And having “contestants” in the ages 4.5 to 47, I have to say that Nintendo have managed to create something that works for most. As far as the Wii Fit being considered yet another geeky accessory for a geeky video game may have some validity, but I’m not sure who’s the geek; the fitness psycho who lives at the “Fitness Club” or the gaming geek who thinks he can stay fit from the living room floor 🙂

A lot of exercises with the Wii Fit are about balance, something that requires practice and some amount of skill. Whether or not the Wii and/or Wii Fit is sufficiently accurate in this regard, is something I’ll leave to the “experts” to argue about.

Think of the Wii Fit as a fun accessory for a fun video game, if you like Nintendo that is. If you don’t, well.. don’t think of the Wii Fit at all 🙂

The words “Family Fun” are very applicable in the Wii Fit context.

Games consoles ‘not green enough’

Greenpeace doesn’t leave much to chance. This time, they’ve disected several video consoles. Nintendo is ranked at the bottom of Greenpeace’s global assessment of “green” technology companies. Both Microsoft (XBOX) and Sony (PS3) also use questionable materials in their products; circumventing many regulations for toys, claiming that video game consoles aren’t toys.

I can’t really claim to be surprised. If there’s no consumer demand for “environmentally friendly” (yeah right..) products in a given market, the manufacturers won’t produce them. So once again: consumer power rules, regardless of the product.

The BBC article goes on and says that if Sony can make a “better” computer (its Vaio Laptop range), why can’t they accomplish the same thing in their video game console? The answer is simple: It’s not fashionable (yet). While IT departments and companies all over the world take “pride” in claiming “green IT equipment” being used throughout their domains, consumers are yet to voice the same opinions about video game consoles.

That isn’t to say that I’m not for video game consoles (or any product for tha matter) that lessen the impact on the environmet.

Read the BBC news article here.

In the meantime, I’ll be looking forward for the next Wii, with a “Greenpeace” stamp.

EFF: Is Your Printer Spying On You?

Imagine that every time you printed a document, it automatically included a secret code that could be used to identify the printer – and potentially, the person who used it. Sounds like something from an episode of “Alias,” right?

So begins an article on the EFF website. It makes for some interesting reading. I’ve heard about this a few times in the past, so I guess I wasn’t caught completely off-guard. As with most measures that may aid law enforcement to track down the “bad guys”, this too could be a breach of your right to privacy.

I can’t really disagree with EFF, but it seems to me that something like IP-address tracking, combined with a side-by-side comparison of ISP logs, is a far greater invasion of my right to privacy.

More reading:

EU: Printer Tracking Dots May Violate Human Rights
List of Printers Which Do or Do Not Display Tracking Dots
Wikipedia: Printer steganography
Seeing Yellow

(Printer Icon from iconaholic.com)

Application event tracker (or really simple debugging) for PHP

DISCLAIMER: There’s nothing revolutionary with what you are about to read, should you continue 🙂 This is simply something I did to avoid having to use a debugger where using a debugger wasn’t practical; and also to avoid having to emit “debug output” throughout the application. There are a number of ways to accomplish this, and many people have done it before me. What I describe here works for me. If you break it, you own all the pieces, be it thirteen or four.

The problem, that I had, was to track the progress of an application that did some heavy data processing. During the processing, a number of things could go wrong. It didn’t necessarily have to terminate the application (I don’t like the good old tits up-method of ending a PHP-script, i.e. “die (‘Error’);”), but I needed to track a number of variables and states throughout the execution of the script.

Using “echo ‘The value of x=’.$x” constructs works for really small implementations. It’s a proven “debugging” method and has been used for a long time in the history of computer programming (well, something similar to that construct anyway, considering PHP hasn’t been along for that long).

I have a base class, upon which I base all other classes. If you don’t have one, simply derive the class you want to debug from the code that follows. Also, please note, this method can be extended in a zillion (possibly more) ways. My example doesn’t quite reflect my actual implementation, but it should give you an idea of where this is going.

The class (tested with PHP 5):

[php]
class ezPHPdebug {
protected //We do this to avoid non-derived external modification
$__rBuf;//Recording buffer

function __construct ()
{
$this->rBufReset ();//Clear recording buffer
}

function __destruct ()
{ }

function rBufRecord ($s)
{
$this->__rBuf .= $s . “\n”;
}

function rBufReset ()
{
$this->__rBuf = ”;
}

function rBufRead ($forHtml)
{
if ($forHtml)
return (nl2br ($this->__rBuf));
else
return ($this->__rBuf);
}

}//ezPHPdebug
[/php]

Nothing to it, right? Alright, let’s say we create an example class that uses this “debugger”.

[php]
class myClass extends ezPHPdebug {
function __construct ()
{
parent::__construct ();
}

function __destruct ()
{
parent::__destruct ();
}

function doSomethingImportant ($x)
{
$this->rBufRecord (‘{doSomethingImportant}’);
$this->rBufRecord (‘x=’.$x);
echo ‘Hello, this is a cool function, it does nothing.’;
echo ‘Oh yes, I forgot, $x is ‘.$x.’
‘;
$this->rBufRecord (‘{/doSomethingImportant}’);
}

function doSomethingElseImportant ($x)
{
$this->rBufRecord (‘{doSomethingElseImportant}’);
$this->rBufRecord (‘x=’.$x);
echo ‘Hello, this is an uncool function, it does something.’;
echo ‘Oh yes, I forgot, $x is ‘.$x.’
‘;
$this->rBufRecord (‘{/doSomethingElseImportant}’);
}

}//myClass
[/php]

This is (obviously) a very simplified way of using the “debugger” class, but it’ll do the job for now.

Now, in the “application” or “main” script, we do something like:

[php]
$r = new myClass ();
$r->doSomethingImportant (‘This is a string’);
$r->doSomethingElseImportant (1024);
[/php]

What does this do? Nothing much .. it’ll call the two methods (in myClass), which outputs some data and that’s it. But, what if we wanted to know what happened inside the class (myClass).. well, do this:

[php]
$r = new myClass ();
$r->doSomethingImportant (‘This is a string’);
$r->doSomethingElseImportant (1024);
echo ‘TRACKER: ‘.$r->rBufRead (true);
[/php]

This will output the same thing as the first example, plus an additional debug output.

By “recording” entry and exit names, we clearly show that we’re in a function (and that we’re not).

One could add automated timestamping to this, by forcing a timestamp to be inserted each time a line is “recorded”.
Another possible extension is of course to do logging directly to a file or a database; but part of the beauty (IMHO) of the in-memory tracker is that I can output the debug output in one go, and determine when I want to see it.

The Planet

A clickable summary of things that you may not know about Mother Earth and its current shape; go check it out on www.forskning.se/theplanet (English), www.forskning.se/planeten (Swedish).

The aim with the production is to enhance public awareness of the planet Earth; to show its limits, its treats and its possibilities. The Planet is presented with educational stories, illustrative animations, and interactive videos.

Forskning.se is a nationwide website that provides information on research and research findings in Sweden.