I’m excited to announce that we launched Binpress (I’m a co-founder), a marketplace for source-code where web developers can buy and sell source-code from each other.
To kick start our launch, we’ve organized a programming contest with over $40k in cash and prizes, sponsored by companies such as Google, Amazon, PayPal and Zend. Check out the contest site, and join if you think you have what it takes – the contest will run until 24th of Feb., so get cracking!
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.
Continue reading Zend Framework dependency manager
The legal aspects of selling software are, for the most part, pretty vague for most developers. During preparations for launching our software market, Binpress, I absorbed a lot of information from our very good copyright attorney and got to understand much better the nuances of software licensing. Here are some of the lessons I learned.
Continue reading Software licenses for dummies
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');
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.
Multiple row operations are in common use in a normalized application databases as one database entity is often linked to multiple sub-entities (for example a user and his tags). By row operations I’m referring to write queries, namely UPDATE and INSERT queries (DELETE is less interesting so I’ll leave it out for now).
Too often I’ve seen such queries ran in long loops one at a time, which is very bad for performance (as I will show here) and sometimes equally bad for integrity (if the process is interrupted). So what are the alternatives?
Continue reading Multiple row operations in MySQL / PHP