270489 items (513 unread) in 24 feeds
CNN
(16 unread)
MSNBC
(29 unread)
PHP
(61 unread)
Deals
(377 unread)
Tech
(6 unread)
Web Development
(4 unread)
CNN Money
(19 unread)
Frugal Blogs
(1 unread)
Small but nice changes to the blog:
I’m still annoyed by how infrequently RSS widgets update, solution forthcoming.
For the past month, I've been immersed in PHP 5.3 as I and my team have started work on Zend Framework 2.0. PHP 5.3 offers a slew of new language features, many of which were developed to assist framework and library developers. Most of the time, these features are straight-forward, and you can simply use them; in other cases, however, we've run into behaviors that were unexpected. This post will detail several of these, so you either don't run into the same issues -- or can capitalize on some of our discoveries.
Caching is one of the things recommended whenever something is slow — "Your [database, website, server]? Well, duh! You need a cache!".
All things aside, it's not always easy to cache stuff. I find myself often in situations where I can't cache at all or where a caching solution is complex as hell to implement. All of the sudden you need to dissect your page and lazy load half of it with Ajax — bah. And that's just because those users never want to wait for a cache to expire or invalidate. They just expect the most recent ever! :-)
Sometimes however, caching can be so trivial, it even hurts.
Bypass the application serverThere are lots of different techniques and strategies to employ when you start to think about caching. The fastest albeit not always available method is to bypass your app server stack completely. And here's how. :-)
An exampleMy example is a pet project of mine where I display screenshots of different news outlets which are taken every 3 (three) hours — 0:00, 3:00 AM, 6:00 AM, 9:00 AM, 12:00 PM, 3:00 PM, 6:00 PM, 9:00 PM and so on. In between those fixed dates, the page basically never changes and why would I need PHP to render a page if it didn't change since the last request?
Correct, I don't! :)
And here's what I did to setup my cache:
1.3.x (!) and mod_php5docroot/home.phpDirectoryIndex index.html home.php*/10 * * * * fetch -q -o docroot/index.html [example.org] The home.php does all the PHP funkyness whenever I need a fresh rendered version of my website to track an error, or adjust something.
If I ever delete my cache (index.html), my website will still be available. The DirectoryIndex will use home.php next and the request will be a little slower and also more expensive on my side, but the website will continue to work.
The cronjob will issue a HTTP request (GET) using fetch against my homepage and save the result to my index.html. It's really so simple, it hurts. Currently, this cronjob is executed every 10 minutes so I can fiddle with the design and deploy a change more easily, but I could run that cronjob every hour or every few hours as well.
If you don't have fetch, try the following wget command:
wget -q -O docroot/index.html [example.org]
Fin
That's all, a really simple cache which bypasses your application server. Enjoy!
If you're in for another nifty solution, I suggest you read Brandon Savage's article on caching with the Zend Framework and/or take a look at nginx+Memcached">[HttpMemcachedModule">nginx+Memcached] .
As earlier announced in my April Fools' announcement and on Xdebug's twitter feed, I'm now releasing Xdebug 2.1.0RC1. This is the first Release Candidate and it addresses a number of issues found in the latest beta. As I usually do in release announcements, I will also be introducing a new feature in Xdebug 2.1 in this one.
In an article that I wrote a few months ago, I illustrated a few different reasons on why the shut-op operator (@) should be avoided. Although there are a few cases where it simple can not be avoided if you want to write notice-free code, the main reason why this operator should be avoided, is because it makes debugging quite a bit more difficult if errors are hidden.
Xdebug is a debugging aid to make debugging easier. So from version 2.1.0 there is a new configuration setting — xdebug.scream — that simply disables the effects of the @ operator. That means that all errors will be shown, of course, still listening to the error_reporting and display_errors settings. This functionality is not a novel thing, and the idea was lifted from the PECL scream package. However, I think this functionality fits in very well with all the other things that Xdebug has to offer.
Just to mention it once more, I have no intention of making Xdebug closed source. I spend a considerable amount of time in adding new features and addressing issues, so I would appreciate it that if consider a donation in case Xdebug has saved you time and effort in debugging your application. If you have comments or suggestions to improve Xdebug, please write to the mailinglist.
A few days ago I made the first beta release of the D-Bus extension that I have been working on for a while. D-Bus is a message bus system, a simple way for applications to talk to one another. I started working on this because my cellphone, an OpenMoko FreeRunner. This cellphone (or rather, a mobile Linux computing device) implements freesmartphone.org APIs to talk to all the hardware that is available on the device. This includes GSM and SIM card interfaces, but also GPS, Audio and PIM services.
However, many other applications on the Linux desktop speak D-Bus. This includes system services such as the notification daemon, the screen saver and hardware plug-in detection as well as desktop applications such as Pidgin and Empathy.
I've given a presentation on the extension at the PHP London conference earlier this year, and will also be speaking on this subject as part of the "PHP Inside" and "PHP on the D-Bus" talks at Tek-X (Chicago, May 18-21), International PHP Conference Spring (Berlin, May 30-June 2) and the Dutch PHP Conference (June 10-12).