 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Michelangelo van Dam's Blog: Throwing and catching exceptions
by Chris Cornutt October 14, 2008 @ 14:32:59
Michelangelo van Dam has written up a quick introductory post on his blog about the process around throwing and catching exceptions in your apps.
One thing that I noticed was that although the code was well written [in the Zend Framework], implementing coding standards and best practices on many of the classes, I did notice a wrong usage of throwing exceptions (the try - catch statements).
He gives a few examples - catching a "divide by zero" the right and wrong way, how to grab/handle the message that comes along with the exception and how to define your own custom exception handler to help your code do more useful things with the errors it might throw.
voice your opinion now!
throw catch exception introduction custom handler
Daniel Cousineau's Blog: Quickie Module-specific Error Controllers in Zend Framework (1.5)
by Chris Cornutt August 12, 2008 @ 07:56:17
Daniel Cousineau has posted a "quickie" over on his blog today dealing with error controllers in a Zend Framework application.
In my quest to do some alterations on ZF error handling (in particular, render the view if the action or controller is not found, makes it real easy for my designer to prototype) I had the desire to be able to allow modules to have their own ErrorControllers. Unfortunately, the Zend_Controller_Plugin_ErrorHandler() default does not allow for this and I didn't really want to extend that class (I planned on handling the rendering in the ErrorControllers) so I wrote up a quick plugin.
His plugin (code included in the post) hooks into the routeShutdown part of the routing process and overrides the default error handler for the module to pass the request off to his custom one.
voice your opinion now!
zendframework module controller error handler routeshutdown
Dhiraj Patra's Blog: Caching PHP Programs with PEAR
by Chris Cornutt August 07, 2008 @ 12:58:09
In a recent post to his blog Dhiraj Patra looks at the caching functionality that PEAR has to offer via the PEAR Cache package.
Caching is currently a hot topic in the PHP world. Because PHP produces dynamic web pages, scripts must be run and results must be calculated each time a web page is requested, regardless if the results are the same each time. In addition, PHP compiles the script every time it is requested. [...] PEAR's Cache package offers a framework for the caching of dynamic content, database queries, and PHP function calls.
He talks a bit about what kind of methods are included with the package and shows examples of how it works for function call caching, caching the output from the script execution and how to implement your own custom caching extension of the main code to make it even more flexible.
voice your opinion now!
pear cache tutorial function call output custom handler
DevShed: Developing a Modular Class For a PHP File Uploader
by Chris Cornutt April 16, 2008 @ 13:28:49
DevShed has posted the final part of their series looking at the handling of file uploads in PHP5. This last installment shows how to take what yuou've learned so far and make things a bit more modular.
At this stage, you've hopefully recalled how to build an expandable file uploading application with PHP 5 that uses only one custom function to transfer a target file from a client machine to a predefined web server. However, in the beginning, I said that I was going to teach you how to develop a brand new file uploading application using an object-oriented approach.
The finish off the FileUploader class they were working on previously and show some testing examples of it in action.
voice your opinion now!
modular object file upload handler tutorial
PHPClasses.org: A PHP killer feature - Streams abstraction
by Chris Cornutt February 01, 2008 @ 15:36:24
On the PHPClasses.org website there's a new entry covering, among other things, one handy feature PHP includes to let developers read and write their data more flexibly - streams.
This article explains what are stream handlers and how they simplify PHP developers lives by allowing PHP applications to easily read and write data from containers, like remote Web pages or e-mail messages, as if they were files. [...] The article also presents more examples of cool stream handlers classes submitted to the PHPClasses site by several authors.
He describes the abstraction that the streams interface allows, how they can make your life easier, a real-life example of streams in action (working with POP3) and some of the classes that have been contributed to PHPClasses.org that use them.
voice your opinion now!
streams abstraction class example pop3 handler streams abstraction class example pop3 handler
Ian Selby's Blog: Weird PHP Seg Faults & Custom Session Handlers
by Chris Cornutt September 18, 2007 @ 10:27:00
In recent work, Ian Selby came across something odd - a setup where PHP was segfaulting without any real indication of where the error might be:
Starting to get a little frustrated, I took a peek at my error logs (/var/log/httpd/error_log for the unitiated), and discovered a wonderful message [about the segfault]. As any person scratching their head would do, I hit up google.. to no real avail. Just a bunch of php bug reports. So, what happened, and how did I fix it?
After searching through the code and narrowing down where it could be, the culprit looked like a custom session handler he was using. It uses MySQL to store the sesion information and, unfortunately, when Ian had compiled the server he didn't let PHP know about his unique setup.
His default installation was trying to use the default MySQL information (including the socket) to reach the database. Obviously failing, the server simply gave up and segfaulted. Thankfully, all it takes it a recompile with a few extra parameters and you're back in business.
voice your opinion now!
segfault custom session handler mysql default configure segfault custom session handler mysql default configure
|
Community Events
Don't see your event here? Let us know!
|