Blog entries on June 2005

  • The big question!

    By Nuno Mariz, on 27 June 2005 @ 21:07
    The ring
    This weekend i've popped the big question to the woman of my dreams.
    You may wonder about the shape of the ring - it has the shape of the infinity symbol with two beautiful opals.
    I thought it was quite apropriate since my girlfriend is a math teacher and this is how i feel about us as a couple.
    We stayed in Gerês [Portela do Homem, Room View 1, Room View 2]. I've enjoyed a really remote place called Monte Sta. Isabel [Picture 1, Picture 2, Picture 3] that we discovered in the top of the mountains.
    At one point we didn't go further because we found a lot of traffic ;)

    By the way, she said YES! ;)
  • The PHP native template engine

    By Nuno Mariz, on 21 June 2005 @ 10:04
    “Why using templates engines if PHP is itself a template engine?” said Karlus some time ago. The answer is: The templates engines can be a great help when you're using a PHP framework that is built on modules(using MVC design pattern) where is necessary to fetch pieces of HTML to build a page, separating all code of PHP from HTML.
    But the overhead of this templates engines is enormous, because of the all parsing envolved. So templates engines is not all about a sea of roses.
    I have used Smarty for this kind of work for a long time and, in my opinion, is the best.
    When i read this article i realized Karlus point of view. So based on this idea i have developed a small class that enables all funcionality that Smarty has (witch i use) but using the PHP natively as the parser.
    It's a class with only 160 lines of code(without comments), so don't expect too much...


    Using templates that are PHP files

    Including templates inside templates

    Caching with expired system in seconds or without expiration

    Caching with id's

    Plugin system, as simple as you can get

    Discover the diferences with a simple template:

    Smarty template (index.tpl)

    {include file="header.tpl"}
    Title: {$title} 
    {foreach from=$list item=list_item} {$list_item}
    {/foreach} </body> </htm>

    Smarty object creation (index.php)

    $smarty =& new Smarty();
    $smarty->template_dir = 'smarty/templates/';
    $smarty->compile_dir = 'smarty/templates_c/';
    $smarty->cache_dir = 'smarty/cache/';
    $smarty->caching = 1;
    $smarty->assign('title', 'My Title');
    $smarty->assign('intro', 'The intro paragraph.');
    $smarty->assign('list', array('cat', 'dog', 'mouse'));

    My Template (index.tpl)

    Title: <?=$title;?> <br />
    List: <br />
    <?php foreach ($list as $item):?>
    <?=$item;?> <br />
    <?php endforeach; ?>

    My Template object creation (index.php)

    $tpl =& new Template();
    $tpl->assign('title', 'My Title');
    $tpl->assign('intro', 'The intro paragraph.');
    $tpl->assign('list', array('cat', 'dog', 'mouse'));


    The time results shown below, were measured with average results to have a more accurate benchmark.
    The benchmarking was made in a Celeron 2400Mhz with 512Mb of RAM.
    The Y axis corresponds to the average time in seconds per request and the X axis to the number of requests.


    You can download the source code here.
  • Debian GNU/Linux 3.1r0 (finally) released

    By Nuno Mariz, on 7 June 2005 @ 09:23
    Debian -- The Universal Operating System
    Debian GNU/Linux 3.1r0 (Sarge) has been released to the ftp mirrors. The full download is available on 14 CDs or 2 DVDs.

    This release includes a number of up-to-date large software packages, such as the K Desktop Environment 3.3 (KDE), the GNOME desktop environment 2.8, the GNUstep desktop, XFree86 4.3.0, GIMP 2.2.6, Mozilla 1.7.8, Galeon 1.3.20, Mozilla Thunderbird 1.0.2, Firefox 1.0.4, PostgreSQL 7.4.7, MySQL 4.0.24 and 4.1.11a, GNU Compiler Collection 3.3.5 (GCC), Linux kernel versions 2.4.27 and 2.6.8, Apache 1.3.33 and 2.0.54, Samba 3.0.14, Python 2.3.5 and 2.4.1, Perl 5.8.4 and much more.

    This is the first Debian release that includes (1.1.3). It also features cryptographic software integrated in the main distribution. OpenSSH and GNU Privacy Guard are included in the default installation, and strong encryption is present in web browsers, web servers, databases, and many other applications available in this release.
  • My new assistant

    By Nuno Mariz, on 6 June 2005 @ 09:24
    My new assistant...
    It's a pleasure to present you, my new assistant. It is a she, with only 4 weeks. She starts to show some interest in my Linux Debian logo and becoming a real geek. She don't have a name for the time being, suggestions are welcome ;)