Zend Framework certified!

Zend Framework Certified Engineer LogoToday I passed the Zend Framework certification. From now on I can call myself Zend Framework Certified Engineer.

I followed the Zend Certification training at Ausy/Dataflow. Gauthier Delamarre is an excellent teacher, and he helped me very good to prepare for the examination. Though it is my opinion that with only the training you cannot pass. It requires a lot of experience with the ZF, and you have to study the online reference guide really good.

Some tips for anybody who wants to do the certification:

  • know the output of every function,
  • know which and how many parameters every function requires, but also know the optional parameters,
  • know what happens if something goes wrong (does ZF throw an Exception or do you get a Fatal Error, a warning,…),
  • know the configuration settings (for example Frontend and Backend Caching have a lot of settings),
  • study the reference guide in depth!

Be faster in Eclipse PDT

A tip for all PHP developers using Eclipse PDT:
if you want to type a class name, for example “Zend_Controller_Request_Http”, you can just type “ZCRH“, and the Eclipse code assist will suggest “Zend_Controller_Request_Http”.

This works also in Zend Studio for Eclipse.

var_dump() in Firebug

In my previous post I talked about query profiling in Firebug with FirePHP. Today I will talk about another feature from the Zend Framework and FirePHP: logging.

Again, it’s very simple:

  • create a new Zend_Log
  • add the Zend_Log_Writer_Firebug to it
$log = new Zend_Log();
$log->addWriter(new Zend_Log_Writer_Firebug());
$log->debug($something);

This will behave like var_dump(), with these differences/improvements:

  • the output is displayed in Firebug
  • the HTML output doesn’t change
  • also for Ajax calls; no var_dump() info visible in the output from the Ajax call
  • the output has a nice layout

Remark: to use this, you need Firebug and FirePHP

Quick query checks with Firebug

Firebug gets better and better!
One of my last discoveries is Zend_Db_Profiler_Firebug. With this great feature of the Zend Framework it is possible to check queries in Firebug.
Step 1: install Firebug + FirePHP and activate the Console and Net tab
Step 2: activate Zend_Db_Profiler_Firebug in the application:

resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
resources.db.params.profiler.enabled = true

For example enable it in development environment, and disable it in production.
Step 3: refresh your application, and see the queries appear in Firebug: you see the duration of all queries, and for each query individually, all parameters passed to the query and the total number of queries.

If you don’t want to use MySQL Proxy, this is a good alternative to check queries!

I have no hard data to prove it, but I don’t have the impression that it slows down my applications.
Does anybody know more about the performance of Profiler_Firebug?

Does gzdecode() exist or not?

The first step, encoding, was very easy. I used “gzencode()” and everything worked fine. Then I wanted to use the decoding function “gzdecode()” and I got this message “Fatal error: Call to undefined function phpdecode() “.

I go back to php.net, and there I see that the function gzdecode is documented, and no specifications are given which PHP version is needed, which extra extensions need to be installed etc. And since gzencode works fine, gzdecode should work fin too, isn’t it?

I google a little, and I find very little information. The best thing I see is this, on bugs.php.net. This issue is closed since 2006, and has one comment: “Implemented for PHP-6”.

So, why is gzencode() available in PHP5, en gzdecode() only in PHP6?
And because PHP6 is not out yet, what is the best solution: use other function (gzcompress() and gzdecompress(), gzinflate() and gzdeflate()), or use one of the meny alternative gzdecode() functions that user on php.net have written?

Zend Framework: partial() and render()

partial() will render a view script, and render() will render a view script. So… which one do I have to use?

All depends on the variable scope.

Render()

The render() function will render the given view script within the variable scope of the script is was called from.

$this->render('script.phtml');

Partial()

partial() will also render the given view script, but you can define a special variable scope: you can pass all requested parameters in an array.

$this->partial('script.phtml', array('var1' => 'value 1', 'var2' => 'value 2'));

This can be very useful to use a view script in a loop.

Ignore option in Zend_Translate

My project is under version control with SVN. Although SVN is very usefull, it generates a lot of files, and sometimes this makes the performance bad.

Take for instance Zend_Translate. I use Qt to handle all translations. Qt will scan a given directory for all translation files, and so it will also scan all .svn directories.

resources.translate.data = APPLICATION_PATH "/locale"
resources.translate.adapter = Qt
resources.translate.options.scan = directory

While debugging my application, I discovered a very useful option to ignore all .svn directories:

resources.translate.options.ignore = ".svn"

Very useful option.
Off course it is possible to add more directories or files to ignore.

UPnP on NAS finally works

UPnP logoAfter 6 months, I got the UPnP network media streamer on my NAS (D-Link DNS-323) finally working.

The problem was that none of my media files was accessible on the network over UPnP. I could easily find the files with a file browser, but none of my UPnP clients detected any files.

Finally D-Link released a new firmware upgrade to version 1.08 with two fixes for the UPnP server:

  • UPnP AV can handle long file names and in file names with spaces
  • UPnP AV server will skip corrupted file instead of stopping the scan process

Now I can see where the problem was. Most of my media files have spaces in their names.

Good job for D-Link that it’s fixed now, but still a little too late…

First Aid license

Logo Het Vlaamse KruisFrom September 2009 till March 2010 I followed a First Aid course from Het Vlaamse Kruis in Grimbergen. After 2 exams (one for the basic first aid, and one for advanced first aid), I received my diploma yesterday at the city hall of Grimbergen.

Thanks to all the volunteers for all their time in preparing the course! It was very interesting, and I had a lot of fun!

Edit: I found some articles from news websites: