Blog

  • 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...

    Features:

    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)

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

    Smarty object creation (index.php)

    require_once('lib/smarty/Smarty.class.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'));
    $smarty->fetch('index.tpl');
    
     

    My Template (index.tpl)

    <html>
    <body>
    <?=$this->includeTemplate("header.tpl");?>
    Title: <?=$title;?> <br />
    List: <br />
    <?php foreach ($list as $item):?>
    <?=$item;?> <br />
    <?php endforeach; ?>
    <html>
    <body>
    

    My Template object creation (index.php)

    require_once('lib/Template.php');
    
    $tpl =& new Template();
    $tpl->setTemplatesPath('templates/');
    $tpl->setCache(true);
    $tpl->setCachePath('cache/');
    $tpl->setCacheId('nuno');
    $tpl->setExpire(0);
        
    $tpl->assign('title', 'My Title');
    $tpl->assign('intro', 'The intro paragraph.');
    $tpl->assign('list', array('cat', 'dog', 'mouse'));
    $tpl->fetch('index.tpl');
    

    Results

    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.


    Download

    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 OpenOffice.org (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 ;)
  • Voyager 1 has left the building

    By Nuno Mariz, on 26 May 2005 @ 01:22
    Voyager - Spacecraft
    Voyager 1 has officially left the solar system, having crossed the so-called termination shock in December last year. The craft crossed the boundary 94 astronomical units (the distance from the Earth to the sun is one AU) from the sun, according to NASA researchers based in Washington DC.
    Read more at The Register.
  • Learn Portuguese from a Rails application

    By Nuno Mariz, on 18 May 2005 @ 09:42
    Tim Case has recently launched theVerbalizer. It’s a learning tool for getting into Portuguese using a method of remembering verbs as the prime driver. You can find more information in here.
  • Oracle Launches new PHP Developer section on the OTN

    By Nuno Mariz, on 9 May 2005 @ 09:57
    PHP Developer Center
    After one of the major database company (SAP recently launched a new PHP Development Forum), Oracle launches new PHP Developer section on the OTN.

    Among other things you can read this interesting guides:
    Installing Apache, PHP, JDeveloper, and the PHP Extension on Linux

    Installing PHP and the Oracle 10g Instant Client for Linux and Windows

    Installing Oracle, PHP, and Apache on Linux

    Installing Oracle, PHP, and Apache on Windows 2000/XP

    Set Up Oracle Database 10g and PHP on Mac OS X

    Is great to see that large companies are becoming aware that PHP has moved from a thriving open source project to an enterprise solution for web applications.
  • Debian Sarge Freeze Is Now Official

    By Nuno Mariz, on 3 May 2005 @ 23:00
    Debian -- The Universal Operating System
    According to Debian Planet, the Sarge freeze(finally) is now official and a May 30 release date has been set.
    The timeline for the release is as follows:

    3rd May: Freeze time and security support now available for testing 5-8th May: BSP to bring bug count down from ~85 to ~60/70 15th May: Debian installer finalised 27th May: Zarro RC boogs 30th May: Release

    It's great news for our favourite linux distribution ;)
  • Developing a RSS Reader with Java (JFC/Swing)

    By Nuno Mariz, on 29 April 2005 @ 10:55
    Java Technology
    I have a new personal project in mind. The idea is to improve my Java skills by developing a desktop application to read and manage my personal RSS feeds. Yes. There are several applications that do this, even in Java, just like RSSOwl that uses SWT for the widgets. The application will have the same features as Akregator, obviously not all on the first release.
  • Desktop Java Features in Mustang

    By Nuno Mariz, on 22 April 2005 @ 23:34
    The next release of Java with the codename Mustang has some significant enhancements for desktop usage, including improved OS L&F, text anti-aliasing modes, more and improved graphics hardware usage, threading improvements, etc.
    You can check the full article, or go to the Mustang project homepage for more details.