In Stockholm

For those of you who are not in contact with me on a daily basis, you may not know that I’m spending this weekend in Stockholm. Thursday and Friday are for work here in Stockholm, and after that we’re spending the rest of the week here too.

I’m very undecided about Stockholm. It’s got a lot of nice places, sure. But…

  • The atmosphere is odd. People are driving like crazy, they use the car horn for minor things, they are rude, and there’s a very superficial air about everything.
  • The house prices are enormous. From what I’ve heard, the going rate is about $7,500 per square meter. Paying $2,000-$3,000 a month in rent is not at all weird; some places more than that.
  • Everything is small and shabby. And old. A friend we ran into here spent $600,000 on an apartment that’s smaller than mine back home.
  • The daily commute is a nightmare. Back where I live, 25 minutes in the car to work feels like a long time. Here, you may easily double this figure. Or triple it. Or possibly quadruple it.

I can’t say that I miss home very much, because there’s nothing back home but a cold, empty apartment; but I miss the friendly atmosphere, miss having a burger at McD’s, and I miss not getting ruined by buying a sandwich at a cafĂ©. Quite frankly, I don’t really see what all the buzz is about. Although, yes, Stureplan is a little bit upscale from ICA Nordeviks, I get it, but…

Anyway. I’m going to bed now. More exploring to do tomorrow.

Programming with Nifty 1.2

Some features in the upcoming Nifty Framework 1.2 release:

<?php

class Index extends NF_Page
{
    public function executeView($id)
    {
        global $Request, $Persistence, $Response;

        $form = NF_Component::fromArray(array(
            'component' => 'NF_CForm', 'name' => 'form',
            array('component' => 'NF_CInputHidden', 'name' => 'id', 'dataField' => 'id'),
            array('component' => 'NF_CInputText', 'name' => 'name', 'dataField' => 'name',
                  'label' => 'Name: '),
            array('component' => 'NF_CSelect', 'name' => 'type', 'dataField' => 'type',
                  'label' => 'Nationality: ', 'options' => Nationality::getList()),
            array('component' => 'NF_CButton', 'name' => 'submit',
                  'type' => NF_CButton::Submit, 'label' => 'Save!')
        ));

        $form->dataObject = $Persistence->load('User', $id);

        if (!$Request->isPost())
            $Response->content = $form;
        else
        {
            $form->processPostback();
            $Persistence->save($form->dataObject);
            $Response->redirect("/index/view/$id");
        }
    }
}

The whole thing…

  1. Defines a form, containg an input field for “name”, a dropdown list for “nationality”, and a submit button.
  2. Loads a “User” object from the database, and binds the form to this object.
  3. Renders the form and sends it to the client.

When the postback occurs,

  1. The form processes it, feeding all the data into the bound object.
  2. Saves the object to the MySQL database.
  3. Finally redirects back to the input form again.

I can’t make it shorter than that.

(There is also a configuration file, containing database parameters, a skeleton “User” class that holds three data fields – and one “Types” class that loads nationality lookups. Nothing more. This is a complete application.)

On the Topic of Running Cars on Water

From time to time I stumble into these people (i.e. websites, blogs, and comments) that honestly believe that you can make cars that run on water, and that the main reason why we don’t have water cars is because of the oil industry.

Supposedly, the idea is that you run the water through electrolysis, producing hydrogen and oxygen, and the burn the two together, giving off energy. This energy is allowed to power the car, and the only exhaust is water. Sounds like a good, clean, energy-efficient system, right?

Except that violates the fundamental laws of nature. You can’t get more energy out of an engine than you put into it. And water happens to be one of the least energy-rich materials on earth. That’s why we have oceans of water just floating around, doing nothing; and which is also why we use it to put out fires.

Of course, the counter-argument is that you can, in fact, electrolyze water into hydrogen and oxygen. And you can, in fact, burn these two together, giving energy. But it still is a closed system – water goes in, water goes out – and you can’t create energy in between with anything less than the complete annihilation of matter1, which involves anti-matter anyway2.

And, yes, fuel cells run on hydrogen, which can be made from water, but in that case you should have cars running on hydrogen, not water. As soon as you put water as a source material, you’ve got a closed system again, and the total amount of energy that can be even theoretically extracted is 0 joule.

So there.

I’m just writing this to set the record straight.

Now if anyone dares to comment on this article, saying that I’m wrong, I’ll taunt you and poke you with a sharp stick.

1) Which means you end up with less water anyway. Thermodynamic laws are intact.

2) Finding, containing and utilizing antimatter for energy would be a cool thing. But dangerous. Not likely to be done in vehicles anytime this century.

The Growth of the Worldwide Population 1750 – 2000

World population development

This chart depicts the growth of the worldwide population (in thousands) from 1750 to 2000.

I think the chart in itself is so absurd that no explanation is necessary.

It’s interesting to note that the initial figure – about 800 million – is the total population growth since the dawn of time until 1750.

The world population at different times in history, as estimated by Wikipedia:

  • At the time of Abraham in the old testament (1900 BC): somewhere around 35 million.
  • About at the time of Israel’s hey-days (900 BC): roughly 50-60 million.
  • Around the birth of Jesus (1 AD): 200 million.
  • Deep in the Medieval age (1000 AD): 300 million.
  • Today (2005 AD): 6.4 billion.