How-To

Inject Dojo Bookmark

Sometimes it can be handy to inject Dojo into pages that would not otherwise have it. I’ve used this so I can use dojo.query() on a page to select DOM objects while testing a parser in a different language.

Zend Framework Doctrine Model Autoloader

There have been several tutorials outlining how to autoload Doctrine Models using the Zend_Loader_Autoloader. However, none of these have permitted Zend / PEAR style naming conventions for models. I prefer to use these conventions because, although it makes my model names longer, the “name-spacing” gives a certain degree of organization and order to the application.

Building a PHP Publish / Subscribe System

First post in a while. I have been busy working on some large application and finishing up my Computing Science Degree. Now that the piece of paper is safely secured above my fireplace, I’ve been trying to find time to do a new post.

I have been building a large application and one of the requirements is to trigger a certain action when an event happens. For example, trigger the sending of an alert email when a database row is updated. Some programmers may be tempted to simply hard-code this functionality into the model class, however this doesn’t give very strict class encapsulation, and can quickly become un-maintainable.

Per Module Zend_Layout

Sometimes when you are building a web application, you want to use different layouts for different parts of the site. For example, in a content management system, you may want one layout for normal users and another, completely different layout for site administrators.

Cache-Control with Zend Framework

Today I was optimizing a site that uses heavy PHP and Ajax. I wanted to reduce the amount of data that was being sent from the server. To put this in perspective, if there were no cache hits in a page load there would be a total of 755 KB pulled down over 123 requests.

Gentoo blacklist.py init Script

I have several servers which run an assortment of http, svn, ssh, and ftp services. One of the largest annoyances are automated breaking scripts pounding my services. Recently, I have been looking into blacklist.py: a handy python script written by Reto Glauser, which monitors syslog-ng logs looking for possible break-in attempts. The script uses iptables to block future traffic from suspicious IP’s for a specified amount of time.

Zend JSON-RPC with Dojo Howto

I have been using the Dojo toolkit as my Javascript library of choice since back in early 2006 when it was still around version 0.4. Since then, the project has made tremendous strides including the release of version 1.0 and 1.1 with 1.2 on the way. At the beginning of 2008 I started using the Zend Framework to build MVC PHP applications and, with the release of 1.5, it has become my PHP framework of choice.

To my delight, the Zend Framework and Dojo have recently announced a partnership which will lead to tighter integration of these two great open source frameworks.

Adblock Plus, Greasemonkey For Firefox 3 Beta 5

I love Adblock Plus – I refuse to use the internet without it. I also quite enjoy Greasemonkey. Unfortunately, neither is yet compatible with the new Firefox 3b5. I got tired of waiting so I took measures into my own hands.

Automatically Require Dijit Widgets

Recently I have been playing with the dojox.dtl: the javascript port of the Django templating engine. So far I am quite impressed, not only is it fast and full featured, but by writing a wrapper class it is easy to make it behave like server side templating systems: you specify a template and pass it an object and it will render that object according to the template rules.

Cookie Injection Using Greasemonkey

There are several Firefox plugins which allow the user to manipulate their browser cookies. However, most of these plugins force the user to manipulate cookies individually. This can become tedious if the user is simply “importing” cookies from, say, a wireshark dump.

The CookieInjector userscript simplifies this process, by allowing the user to copy-paste the cookie portion of the dump and have the cookies from the dump automatically created on the currently viewed web page.