Taming PYTHONPATH in PyCharm and IntelliJ

PyCharm and IntelliJ have some odd defaults that can mask mistakes until they hit CI.…

Keep reading

Using pyenv and pyenv-virtualenv on OSX

Until recently I relied on OS X native python for anything 2.7.x and Homebrew’s python3 for anything 3.x.x. As already implied by the lots of ‘x’-es: Far from ideal. But it worked. Until I accidentally ran a brew upgrade which put my python 3 version to a bleeding edge 3.6.0. Newer than what’s provisioned on our stack and besides that I ran into some errors when installing requirements in a new virtualenv that I suspected to be related to the python version bump.…

Keep reading

Moving from Wordpress to Hugo

For some years my blog has been inactive. Now this could imply that ‘not much was happening’ on a professional level but that hasn’t been the case, on the contrary. Recently I’ve been thinking about adding new content and it became clear that my old Wordpress setup wasn’t the best fit anymore for my needs. Several people I know have been very positive about Hugo and the webserver Caddy so I decided to give that a try.…

Keep reading

DDD using Doctrine 2: A case study

Nowadays developing web applications usually requires a flexible process due to changing business logic, shifting priorities or new insights. Besides choosing the right methodology this also requires designing the application in such a way that this flexibility can be achieved.

Domain Driven Design fits this process as it isolates business logic in the Domain layer and separates it from infrastructure and presentation layers. Questions like where or how to store data or what to build (website, mobile app, API) can be addressed separately.

Doctrine 2 provides PHP developers with a powerful tool to create a Domain layer that contains business logic that is easy to unit test and therefore easy to expand upon in iterations.

In this article I will show how to implement a specific case using Doctrine 2. Full code accompanying this article can be found on GitHub.

Keep reading

DPC 2011 preview

The yearly dutch PHP event is getting close so time to check out the schedule. Once again there are lots of interesting sessions to choose from so I probably will miss some of the good stuff. Mixing ‘simply interesting’ and ‘directly usable in day-to-day job’ results in the preliminary list: Day 1 TDD and Getting Paid – Because indeed TDD is good and can be hard to keep doing thoroughly Pursuing practices of Domain-Driven Design in PHP – Fits both the ‘interesting’ and ‘directly usable’ categories.…

Keep reading

Usability: Autofocus and not breaking the backspace-button

A while ago during a project we were asked to implement autofocus on the generic search field that every page in the application has. At a first glance a pretty straightforward task, from a technical perspective that is. Not from a user perspective, as indicated by a colleague mentioning his dislike of such autofocus fields “because they prevent backspace going to the previous page”. In this post I will outline some usability considerations and conclude with a jQuery plugin that will take away some of the possible hindrance of autofocusing a field.…

Keep reading

Fixing mysqldump on Zend Server CE on OS X

A while ago I installed Zend Server Community Edition on OS X which was pretty straightforward. It was only recently that I found out that, as opposed to mysql which worked fine, mysqldump didn’t work correctly and terminated with the error: ``A while ago I installed Zend Server Community Edition on OS X which was pretty straightforward. It was only recently that I found out that, as opposed to mysql which worked fine, mysqldump didn’t work correctly and terminated with the error:…

Keep reading

Dutch PHP Conference (DPC) 2010

Past weekend the Amsterdam RAI was the centre of the PHP universe as there the 2010 edition of the Dutch PHP Conference was held. Similar to past year it consisted of two presentation days, which I attended, preceded by a tutorial day. Among the presentations I attended on the first day were: Kevlin Henney’s keynote presentation, titled 97 Things every programmer should know. I suppose every attendant will have recognised some of the things he addressed, like “Do lots of deliberate practice” or “Hard work does not pay off”.…

Keep reading

Zend_Form: Building dynamic forms

In my previous post about Zend_Form I showed how, using Zend_Form, a form’s structure can be separated from it’s presentation and how to use custom Decorators and Validators. The example used showed a form that is tightly coupled to a record in a database: One form edits one record. There are however numerous occasions where no ‘one to one’ connection exists and where the fields that need to be shown are not predetermined.…

Keep reading

Using Zend_Form without Zend Framework MVC

Most components of Zend Framework can be used without using the entire framework and Zend_Form is no exception. It’s a versatile component that can be customized to great extent. The payoff is that seemingly easy tasks can seem quite complex to complete and involve concepts like Decorators and View Helpers. Complexity is increased by the fact that most tasks can be achieved in multiple ways. Forms in general are elements where a lot of parts of an application ‘meet’: Frontend code (HTML/CSS), behavior (JS) and backend processing (validation, filtering and storage).…

Keep reading