In writing and troubleshooting a web based PHP application that (among other things) installs instances of software, I realized that the user was receiving no feedback as the installation progressed. However, several logs were being produced from system calls, so I set these up to tee the output and replaced my system() calls with passthru() calls.
Zend Framework's FlashMessenger is a well meaning and generally well constructed object, but which doesn't behave quite as I'd like, so I created this PriorityMessenger. My reasons for doing so center on the following two issues.
I had several hacks in place in various Zend Framework based project for outputting plain text on a form and decided at long last to work from within the system again. The only solution that made sense to me was to create a Zend_Form_Element_Xhtml object that output as its value plain escaped text. Decorators can be added in the normal way to remake this control in as many forms as one might wish.
I was working on a RoR project and become comfortable with yaml files, so was disappointed to discover that Zend Framework doesn't provide support for yml files out of the box. Therefore, I've banged out the following Config_Yaml code, which is based largely on the Zend_Config_Xml and Zend_Config_Ini objects. I've implemented all of the Zend_Config functionality as of ZF version 1.7.8. If you see anything missing, please do let me know!
Since I was on a role with writing the ZExt Config Yml and ZExt_Config_Writer_Yaml objects, I decided to try something just a little off the beaten track. ZExt_Config_Any allows one to specify a config file of any supported type, leaving off the file extension, and having it correctly build the Zend_Config object. e.g., given the file "../application/config", this object will look in "../application/" for a xml, yml, and ini file, loading the first one it discovers using the appropriate object type.
After writing the Zend Config Yml and Zend_Config_Any objects I realized that I wished to convert my existing ini files over to yml format, and so I banged out this code. I didn't really care for the format that the syck code generated, so have included a the option of passing in a boolean to format in my preferred style - see the inline documentation for an example of this.
I was fiddling around on a project and created this associative array implosion function that incorporates several of the ideas from the php.net documentation's entry on implode, but which also adds a whack of nifty options. Documentation and examples are included in-line.
This little object is a canned and generic validator for Zend Framework. It is intended for use with Form Elements, but it should work fairly broadly. The basic need it addresses is to validate that one field value matches another (e.g. password/email and an associated validation field, a captcha challenge, etc.). I looked hard for a ready made answer to this issue, but after much searching and failed experimentation with other canned solutions I decided to write my OWN generic answer to the problem.
[img_assist|nid=28|title=|desc=|link=node|align=right|width=83|height=100]I coded this assignment to perform CRC calculations against arbitrary data strings using standard polynomials and r values as can be seen in this screenshot. One may also select the Custom option to enter other calculation values. The textbox allows the user to enter strings to run the CRC against. For fun, I setup displays in binary, decimal, and hex for the polynomial and result values. In the documentation that follows, I explain the code that performs the calculations, but the full source code may be downloaded via the link at the top of the page.
Ok - I got tired of repeatedly modifying my favorite duplicate deletion algorithm for whatever table I happen to be working with at the time. This code is the result of that frustration. It provides hassle free locating and reporting (or deletion) of duplicate rows in a SQL table based on the uniqueness of a column or columns that the user provides with a few nifty hands-off features. The actual deletion method employed is a correlated subquery, so I must locate or create a column of unique values.