Joakim Nygård Archive Linked About

The State of Computing

17 Apr 2009 -

A long but good post on why we are still stuck with the desktop metaphor for most user interfaces. The very problem I’ve addressed when talking about the problem with online data and views to your media files:

Every geek I know shares, to some degree, the notion that the “desktop” metaphor for computers is outdated. What nobody seems to have a solid opinion on is what would take its place.

Brent Simmons sums it up brilliantly:

I don’t know about you, but I know this issue is always in the back of my head. There’s a nagging feeling that we’re doing it wrong, that there are some leaps forward we’re missing, that we’re still stuck in 1984.

Designing Convertbot

3 Apr 2009 -

The new iPhone app Convertbot by Tapbots is just as beautifully designed as their first, Weightbot. The app feels so polished and at home in the iPhone GUI that it just begs for usage. It doesn’t really feel like an app, rather it becomes the device. This is exactly what it means to raise the bar.

Scienta ZF Debug Bar 1.4

2 Apr 2009 -

Thanks to all the comments in the introducing blog post , a lot of great features have been implemented in the new version 1.4 of my debug bar plugin for Zend Framework.

PHP

jQuery

HTML

Head over to the Scienta ZF Debug Bar page and give it a spin or read the introducing post.

Silicon Graphics Sold for $25 Million

2 Apr 2009 -

I first thought this to be an April Fools story, but the sgi press release confirms that they have indeed been sold to Rackable.

When I was a kid, Silicon Graphics was king of computer generated imagery (along with George Lucas’ Industrial Light & Magic), producing special effects for movies like Jurassic Park and Terminator. They even initiated the defacto standard for describing 3d models, the OpenGL standard.

Good stuff

Earth Hour Pictures

31 Mar 2009 -

It’s not imagery from the ISS but this picture series from The Boston Big Picture is a fantastic display of before and after. The Wikipedia entry on Light Pollution has some background on the scale and some of the consequences of using so much light, including two remarkable pictures from space (composites of satelite photos) of the earth at night in 2000 and 2007 - the increase is stunning.

The Makers of Things

27 Mar 2009 -

Rands:

We are defined by what we build. It’s not just the engineering ambition that designed these structures, nor the 20 people who died building the Brooklyn Bridge. It’s that we believe we can and decide to act.

OmniGraphSketcher

26 Mar 2009 -

New application by Omni Group that looks amazing. It is the kind of software that feels like a magic, digital version of pen and paper. A simple idea but it works remarkably well for creating illustrative graphs.

The Startup Myth

20 Mar 2009 -

From the SAMBA blog:

Get real. Entrepreneurship is about growth and value. Entrepreneurship is about creating something a sufficient number of people want or need. Entrepreneurship is about turning every dollar of resources spent into something worth more than a dollar. Entrepreneurship is about building a company and growing it beyond startup stage.

Zend Framework Validator for Danish VAT Numbers

17 Mar 2009 -

Working on an as of yet unpublished startup, I needed a validator for the Danish CVR numbers issued as part of VAT registration. As the project is written in Zend Framework, I decided to implement the code as an extension of the Zend_Validate_Abstract and share it here.

The validation is based on the specification located at cvr.dk and involves a modulus 11 check on the 8th digit based on a weighted sum of the previous seven. Not particularly interesting but nice to have when working with Danish companies.

<?php
/**
 * Scienta Zend Additions
 *
 * @category   Scienta
 * @package    Scienta_Validate
 * @copyright  Copyright (c) 2008-2009 Joakim Nygård (http://jokke.dk)
 * @version    $Id$
 */

/** Zend_Validate_Abstract */
require_once 'Zend/Validate/Abstract.php';

/** Zend_Filter_Digits */
require_once 'Zend/Filter/Digits.php';

/**
 * A class for validating Danish CVR numbers based on modulo 11
 * @see http://www.cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60
 * @category   Scienta
 * @package    Scienta_Validate
 * @copyright  Copyright (c) 2008-2009 Joakim Nygård (http://jokke.dk)
 */
class Scienta_Validate_Cvr extends Zend_Validate_Abstract
{
    const INVALID          = 'cvrInvalid';
    const INCORRECT_LENGTH = 'stringLengthNotRight';
    const NOT_DIGITS       = 'notDigits';

    protected $_messageTemplates = array(
        self::INVALID          => "'%value%' is not a valid CVR number",
        self::INCORRECT_LENGTH => "'%value%' does not contain 8 digits",
        self::NOT_DIGITS       => "'%value%' does not contain only digits",
    );

    protected $_cvrWeights = array(2, 7, 6, 5, 4, 3, 2);

    public function isValid($value)
    {
        $valueString = (string) $value;
        $this->_setValue($valueString);
    
        $filter = new Zend_Filter_Digits();
        if ($valueString !== $filter->filter($valueString)) {
            $this->_error(self::NOT_DIGITS);
            return false;
        }
        if (8 != strlen($valueString)) {
            $this->_error(self::INCORRECT_LENGTH);
            return false;
        }
    
        $sum = 0;
        foreach ($this->_cvrWeights as $i => $weight) {
            $sum += $valueString[$i] * $weight;
        }
        $remainder = $sum % 11;
		if($remainder==1){
		    $this->_error(self::INVALID);
		    return false;            
		}
		if($remainder==0)
		    $lastDigit = 0;
		else
		    $lastDigit = 11 - $remainder;
		
        $valid = ($valueString[7] == $lastDigit);

        if ($valid) {
            return true;
        } else {
            $this->_error(self::INVALID);
            return false;
        }
    }
}

Save the above to the file library/Scienta/Validate/Cvr.php with library being the directory containing the Zend framework. The class can then be used to test a number as follows:

$cvrValidator = new Scienta_Validate_Cvr();
if ($cvrValidator->isValid($proposedCvrNumber)) {
    ...
}

One case where testing is needed might be a Zend_Form, in which case the class is easily added as a validator on the appropriate element.

Forever's Not So Long

13 Mar 2009 -

Remarkable new short film by Shawn Morrison and Garrett Murray. Beautiful shots and great acting.

Archive