Monthly Archives: June 2011

Running crontab as root

If you want to run some script as the root user using crontab, make sure you sudo as root before you modify the crontab entries :

$ sudo -i
[sudo] password for xxx :
(enter your password)

$ crontab -e

The sudo -i command will change your current user to root, so crontab -e will automatically use the cron file of the root user.

Symfony2 validation using annotations

The Symfony2 book says that validation using annotations should be done as follows :

// Acme/BlogBundle/Author.php
use Symfony\Component\Validator\Constraints as Assert;

class Author
{
    /**
     * @Assert\NotBlank()
     */
    public $name;
}

I tried this on my installation, but this doesn’t work. I had to change ‘@Assert\’ into ‘@assert:’ to make it work :

// Acme/BlogBundle/Author.php

class Author
{
    /**
     * @assert:NotBlank()
     */
    public $name;
}

Read more »

Symfony2 and required fields

I just came across my first HTML5 ‘issue’. I was testing the Symfony2 forms, and for required fields I always got the message ‘Please fill out this field.’ which was shown in a tooltip. I started looking in the Symfony2 code where this message came from, but I couldn’t find it anywhere. So I started inspecting the generated html, and I saw the ‘required’ attribute on the input fields. Apparently this is a new attribute in HTML5, and most browers already support it. I now realise that HTML5 really is something I should learn more about…

While looking for some more info, I came across an online book that seems very interesting : http://diveintohtml5.org. Definitly on my todo list now :)