Creating a simple abstract model to reduce boilerplate code

Tags:

In a usual scenario involving models in PHP, you will have some repeating things: You will usually need getters and setters for the model’s properties, you will need to be able to construct the model from an SQL query or such, and you’ll also need to write SQL queries for the models. While none of this is very complex, it’s …

Ajax, high latency and user experience

Tags:

Most of us probably have used at least one website which bases some major functionality on Ajax. But have you ever used a such site, done something, then moved on to another page, only to come back later to realize what you just did was never saved? What happens to XMLHttpRequests in a high latency situation, and how to deal …

Looking back: Best of 2007

Tags:

I’ve been blogging over 2 years already. In 2007, I was blogging at my.opera, and later that year moved to this site. Let’s take a look at some of the best posts of 2007!

Closures coming in PHP 5.3 and that’s a Good Thing

Tags:

PHP 5.3 will be introducing closures to PHP. Closures, also known as anonymous functions, will allow you to declare functions “inline” and store them in variables. While the syntax may seem a bit weird compared to how it is in languages like JavaScript, closures will be a useful addition to the language

Zend_Acl part 3: creating and storing dynamic ACLs

Tags:

In this third post of the series, I’ll talk about using dynamic ACLs: How to store an ACL in a database, and construct it from there when needed. We will first look at a simple example with users and pages, and then we’ll have a more complex example, involving building a much more complex ACL with inheritance, role types and other stuff.

Practical uses for reflection

Tags:

You may have heard about the reflection feature in PHP. Simply put, it’s a way to get a list of methods in a class, a methods parameters, or other “internal” things like that. But how is this actually useful for any common task in application development?

Functional programming and Haskell

Tags:

I’ve been learning some Haskell for fun. Haskell is a functional language, so it’s quite different from other languages I know like PHP or C#. One of the main “ideas” of functional programming is immutability – in other words, you can’t change the value of a variable after you’ve defined it. How do you deal with this? Also, Haskell has …

Zend_Acl part 2: different roles and resources, more on access

Tags:

Applications often have different resources: For example, you might have pages, some user generated content like comments, and an admin area. You might also have files, or even real-life objects like a coffee machine.

In the context of Zend_Acl, access to resources is given to roles: A role might be a user’s name, a group a user belongs to, or just roles, which have been assigned to a user from the admin panel.

Since Zend_Acl only defines an “abstract” role, resource and privilege, how do we deal with all of these using it?

Asus Eee PC 901

Tags:

I recently bought myself an Asus Eee PC 901 netbook, with Linux preinstalled. It’s a fine piece of machinery, and here are some thoughts on its hardware, software and how it worked together with my other devices, which are mainly Windows based.

Zend_Acl part 1: Misconceptions and simple ACLs

Tags:

I’m going to be writing a weekly series of posts on Zend_Acl. This first post will clear up some common misconceptions regarding Zend_Acl, introduce creating ACLs for simple applications, and give some examples on using the ACL in both non-Zend Framework and Zend Framework applications.