Fun with Rewrite rules and Zend Framework

Mariano April 25th, 2009

I ran into a problem with Apache’s mod_rewrite module this afternoon while setting up a Zend Framework web application. I had just setup a virtual host for my app and was setting up rewrite rules to forward requests to ZF’s front controller. However, I wanted requests for existing filesystem resources (such as CSS, JS, and image files) to be served directly by Apache, bypassing the Zend Framework.

 

Loosely following the ZF Quick Start Guide, I copied these rules into my VirtualHost configuration:
Continue Reading »

Identifying function usage in PHP code

Mariano July 24th, 2008

Its important for programmers to be able to quickly identify all usage of a function. Knowing where and how a function is called helps greatly in understanding the intent of the code and allows the programmer to refactor with confidence.

There aren’t any tools for PHP that identify function usage, the way one might do with Java using Eclipse. The recent release of Zend 6 for Eclipse comes closer with its refactor feature, but only refactors within a single file and not across a project.

I solve this need with a handy grep call. The following grep finds all usage and definitions of a PHP function, and omits results from .svn directories. Just replace FUNC_NAME with the name of the function you’re investigating.

Continue Reading »

Bike for Breath

Mariano July 18th, 2008

This is the 50 mile cycling route I rode with Lan, Dennis, and Jill during the “Bike for Breath” event on July 12, 2008. The route consists of moderate rolling hills, with the only steep climb being the short jaunt up Edgewood. The official ride map indicates 1,887 ft. of climbing - not much for a 50 mile route.

Bib, Bike for Breath 2008
Continue Reading »

Installing MacFusion

Mariano July 17th, 2008

I recently setup a new MacBook Pro for web development. While trying to mount a samba share I discovered MacFusion, an application that lets you treat various remote storage mechanisms as if they were folders on your local hard drive. MacFusion is built on top of MacFuse, which is the OSX port of the Linux based FUSE that facilitates building filesystems that run in userspace.

Continue Reading »

SVN notifications

Mariano July 9th, 2008

I’ve been investigating how to send notification emails when changes are committed in a Subversion repository. Two interesting options I found are svnnotify and svnmailer.

Continue Reading »

Organizing log files into date based directories

Mariano April 10th, 2008

I recently had to grep through a few hundred thousand log files in a single directory. The logs dated back several years and had never been organized into directories. In fact, there were so many log files that grep’ing the directory resulted in an “argument list too long” error. This error is described clearly here, and the quickest solution is to use find to pipe the filenames into grep using xargs:

find . -name "*.log" -print0 | xargs -0 grep "xyz"

Continue Reading »

The new VCR

Mariano April 3rd, 2008

The garage door opener is to me what the VCR was to my parents. After struggling with the garage door for a few hours, I decided I better write down some instructions.

I have a Craftsman garage door opener with three buttons on the controls. It uses rolling codes but aside from that all I can tell you is it sucks, its loud, and it never seems to do what I want it to, like opening.

Continue Reading »