Blog entries on December 2005

  • Ruby on Rails first try

    By Nuno Mariz, on 15 December 2005 @ 11:38
    Ruby on Rails
    For those who are trying to install Ruby on Rails on Debian(in my case 3.1 STABLE), you will notice that your application will show a blank page and the following error on the WEBrick web server in dev/development.log:
    MissingSourceFile (no such file to load -- irb):
    You must install the following packages:
    apt-get install ruby1.8-dev
    apt-get install irb
    apt-get install libncurses5-dev libreadline5-dev
  • Strong growth for Debian

    By Nuno Mariz, on 7 December 2005 @ 14:40
    Debian -- The Universal Operating System
    According to Netcraft, the non-commercial distributions are growing faster than the commercial Linux distributions. In my opinion this is not a big surprise, but with the major companies aquiring some linux distributions like Novell with SUSE, the companies which have partnerships with Novell or Redhat will maintain or migrate for these commercial linux distributions.

    Debian is currently the fastest growing Linux distribution for web servers, with more than 1.2 million active sites in December. Debian 3.1 was declared stable in July and it appears that both the anticipation of this release becoming stable, and the release itself, have generated new interest in Debian, after some years where it had lagged behind its more active rivals. This growth is particularly noticeable at some of the larger central European hosting locations, including Komplex, Lycos Europe, Proxad and Deutsche Telecom.
  • Zend Framework Webcast

    By Nuno Mariz, on 5 December 2005 @ 21:43
    Zend Technologies
    php|architect has posted the recorded version of their Zend Framework webcast on their site. I must say is quite impressive. I've been developing a new framework to take advantage of the new features of PHP5. Right now is quite mature and is in prodution, but lacks of some features. One of the features that is missing is the ActiveRecord that Zend will implement in their new framework. Quite curious is the ZMail, have almost the same API of my Mailer class. One of the aspects that im also curious is the ZForms, right now in my framework is quite flexible. I can extend my FormManager class and add the elements that i need, like this:
    include_once 'class.FormManager.php';
    class FormLogin extends FormManager {
      public function __construct() {
         * Calling the parent
         * Usage::
         * parent::__construct($name,
         *                     $action = null,
         *                     $method = null,
         *                     $enctype = null,
         *                     $extra = null);
        parent::__construct('FormLogin', null, 'POST', null, null);
      // Must implement this method  
      public function initElements() {
         * Adding an Hidden Element
         * Usage:
         * $this->addHiddenElement($name, $value);
        $this->addHiddenElement('module', 'Authentication');
        $this->addHiddenElement('action', 'login');
         * Adding an Element
         * Usage:
         * $this->addElement($type, $name, $label, $options);
        $usernameOptions = array(...)
         * Adding a Validator
         * Usage:
         * $this->addValidator($elementName, $validatorObject);
                            new RequiredValidator());
                            new MaxLengthValidator(array('length'=>15)));
        $passwordOptions = array(...)
        $loginOptions = array(...);
        $this->addElement('submit', 'login', 'Login', $loginOptions);
    $form = new FormLogin();
    $form->render(); // render HTML form
    echo $form->getFormStart();
    // show the Username label
    echo $form->getElementLabel('username'); 
    // show the Username imput
    echo $form->getElementInput('username'); 
    // show the Password label
    echo $form->getElementLabel('password'); 
    // show the Password input
    echo $form->getElementInput('password'); 
    // show the Login submit button
    echo $form->getElementInput('login'); // show the Login submit button
    echo $form->getFormEnd();
    Another way is to load the XML configuration for the form:
    include_once 'class.XMLFormManager.php';
    $form = new XMLFormManager('FormLogin.xml');
    $form->render(); // render HTML form
    echo $form->getFormStart();
    echo $form->getElementLabel('username'); // show the Username label
    echo $form->getElementInput('username'); // show the Username imput
    echo $form->getElementLabel('password'); // show the Password label
    echo $form->getElementInput('password'); // show the Password input
    echo $form->getElementInput('login'); // show the Login submit button
    echo $form->getFormEnd();
    In the XML way is quicker, i have a web application to generate the XML automatically. I can create or load XML forms and edit with an interface. I can bind elements with database table fields, add and configure validators, etc. Recently i've improved the package to support the binding of an element with a database table field, the syntax is similary but with 2 more parameters in the addElement() method.