Archive for the ‘Zend Framework’ Category

(mis-)Adventures with Amazon Simple Email Services (SES)

Wednesday, March 23rd, 2011

Amazon has recently launched a new service as part of its web-services offerings - Amazon Simple Email Service (or SES for short), an HTTP API for sending Emails. The main selling points are Amazon's usual scalability power, as well as a relatively low price point for sending Emails (10 cents per 1000 Emails, not counting bandwidth). They also promise to improve deliverability using filters and feedback loops.
(more…)

Zend Framework dependency manager

Tuesday, November 2nd, 2010

Reusing Zend Framework based code can be a bit of a pain - you do not want to include the entire framework just for a few classes, yet tracking down the dependencies needed to run your code can be time consuming and it's hard to tell if you aren't missing anything.

To overcome those issues, I wrote a utility class to automatically resolve Zend Framework dependencies by fetching them from the online SVN repository when they are needed (and then storing them locally). The class is available for download from Binpress under the MIT license.

(more…)

On the pitfalls of date validation with the Zend Framework

Monday, June 21st, 2010

I'm writing this post as a warning for people using Zend_Date to validate dates, either as a standalone or as a validator in a chain. I've been using Zend_Validate_Date validator, which uses the Zend_Date::isDate() method internally, for a while now - mainly for form processing.

I've recently completed a project where a very bizarre bug would occur on some machines, and I wasn't able to reproduce it myself on any test machine that I tried. The bug manifested in a calendar system we built for the project, and in certain situations form submissions would not pass the date validation through Zend_Validate_Date, despite using the exact same input that was passing on the test machines.

After bringing in one of the "affected" machines for testing, I used the process of elimination to determine the problem originates in the Zend_Date::isDate() method, which has different behavior on different machines.

Zend_Date tries to validate dates according to a given format (with a default fallback). The dangerous behavior is that it tries to convert the given format to a localized format using Zend_Locale. Zend_Locale attempts to detect automatically the locale of the requesting client, and it appears that on the machines that were exhibiting the bug, a different locale was determined than those I was testing it on.

Despite trying to validate a non-localized format (to be exact, the MySQL timestamp format - YYYY-MM-dd HH:mm:sss), it was being converted on the affected machine sdue to the auto-detection by Zend_Locale (on a side note - it was happening on Internet Explorer 8 on Windows 7). To avoid this issue, I set the locale for all requests manually to en_US, since I don't have any other use for Zend_Locale in the application. I put the following lines in the bootstrap -

$locale = new Zend_Locale('en_US');
Zend_Registry::set('Zend_Locale', $locale);

As recommended by the manual to achieve this effect.

In my opinion, the Locale should be not be auto-detected by default - it should be an opt-in feature if it affects other components behind the scenes.

Zend Framework certification

Tuesday, December 30th, 2008

Today I took and passed the Zend Framework certification exam. A possible project involving Zend might be materializing in the near future, and this was a requirement from one of my contractors (OpenIT). Being that they offered to sponsor the cost, I had no reason not take it.

As I found no concrete online information on the test (and the guide link from Zend doesn't work), I might as well elaborate a little for the benefit of future test takers reading this blog -
(more…)

Profiling queries with Zend_Db and optimizing them by hand

Sunday, October 12th, 2008

Database performance is one of the major bottlenecks for most web applications. Most web developers are not database experts (and I'm no exception), there are however several basic methods to analyze and optimize database performance without resorting to expert consultants (such as those, whose founders blogs are an invaluable source of MySQL knowledge).
(more…)