Martin @ Blog

software development and life.


Archive for October, 2007

HTML Purifier

Kore Nordmann explains why in his opinion one shouldn’t use BBCode for comments and forums. I think he has a point, but it only holds when the BBCode is parsed using regular expressions, as he explains in another article. Actually, you’re not really parsing the BBCode when using regular expressions, because it is pattern matching. He explains why it makes no difference to use HTML syntax instead of BBCode syntax. Obviously, he has a very good point, because the BBCode syntax is not well defined, while HTML syntax – especially for the things that normally are allowed in blog comments or on forums – are well defined and known by many people.

An intresting observation is that, even despite the good explanation of the problem with BBCode – a false sense of security when parsing it with regexps – is that people demonstrate in the comments that they really don’t understand it. For example, one comment states that it is almost impossible to block all not allowed HTML using blacklists… Obviously, one shouldn’t use blacklists, but whitelists. By default, all < and > should be replaced by &lt; and &gt;.

HTML Purifier is a library that parses HTML and uses a whitelist to allow certain HTML tags and attributes. Why should one develop something like this from scratch when there is alreay a library available?

Accessing properties in PHP objects

Today, I stumbled upon a weblog post of Jeff Moore on the way properties of objects should be accessed in PHP. Accidently, I thought a little about this problem myself last week because I’m working on a small project which uses a large number of data objects. Jeff Moore argues that you should not use $object->set($name, $value) or $object->get($name) to modify properties, because it does not add anything. I agree completely with that (and I’ve never used this technique myself). He recommends accessing properties directly or using setXxx($value) and getXxx() to access properties (where Xxx is the name of the property).
An intresting discussion arises in the comments where some people argue to use getter and setter methods, while others defend direct accessing the properties. I’m not sure on which side I am standing, but I think it depends on the purpose of your class.

For example, in a hobby project I’m currently working, I have quite a number of data objects (in fact models) which are generated dynamically using some kind of object-relational mapper. The properties of the objects are the fields of the table in the database the object is representing. I think in such a case, it is valid to access the properties directly. Other languages and frameworks (e.g. Ruby on Rails) use a similar strategy. I think it is also valid to use this technique, because since PHP 5, the language provides magic methods (__set and __get) which enables the developer to override the properties when necessary. This way, it is possible to modify the implementation without breaking the API of the class and as such keep the objects’ loose coupling. I think classes which are more behavioural (and not a representation of data) it makes more sense to use setter and getter methods, because you hide the implementation completely.

Room 11

Yesterday evening, we visited a performance of the Dutch band Room Eleven in the Effenaar. Room Eleven is a relatively new band (their first album was released in 2006) and consists of very skillful artists. I think it was one of the best concerts I’ve been to, and I can really recommend them. In my opinion there are not very much good bands in the Netherlands, but this one is the exception to this rule. They play a mix of Jazz, Funk, Bossa Nova and pop, but has also some influences from other styles, like gipsy music. It’s very refreshing and the passion for music really flows through the venue. The singer, Janne Schra, who apparently also write most of the music, has a very strong voice ranging from very intimate to really high notes. The other musicians, a guitarist, drummer/percussionst, bas player (who actually plays on an acoustig bass!) and keyboard player (using a Rhodes, Hohner and grand piano) are really good. I recommend buying their album Six White Russians and a Pink Pussycat.

You can listen to some examples on

Dutch Design Week 2007

This week is the Dutch Design Week 2007 in Eindhoven, the Netherlands. Throughout the entire city are exhibitions and lectures on topics related to art and design. The most interesting locations during this week are Strijp S, an industrial complex consisting of former Philips factories and now transformed into a center for artists and cultural activities, the Witte Dame, also a former Philips factory and currently the home of the Design Academy and the campus of the Eindhoven University of Technology. Last Tuesday, I visited the Dutch Design Week with some Industrial Design students which I happen to know. I think it is very inspiring to see the idea’s of other people with regard to design and art. Strijp S was the most intersting in my opinion, but the graduation gallery of the Design Academy also had some inspiring ideas.

We also visited Little Mountain. This is a creative environment for starting design companies (mostly individual designers). The interesting part of this, is that it is a commercial company providing low-cost facilities for young designers. The people which have their office here, do not only pay rent, but also has to commit four hours a week on projects in which all companies in the building participate.

Obviously, I made some pictures of the various exhibitions, which can be found in the gallery.

Dutch Design Week 2007 Flying drawers

The Gimp 2.4

The developers of the Gimp project released version 2.4 today. It seems to contain a lot of improvements, including a tool to extract foreground objects from their background (like Photoshop can already do for a very long time), full-screen editing of photo’s and improved selection tools. The looks of the application is also improved. All in all it seems like a very big improvement over the previous Gimp version and I think it is a little bit more capable in competing with Photoshop, especially since the program now also includes support for color management and color profiles, which was also a standard complaint when people suggested Gimp as a Photoshop alternative. While releasing the 2.4 version of the Gimp, the web developers of the project also updated the website giving it a new look. Also a big improvement over the previous look in my opinion!

Mac mini EOL?

According to AppleInsider the Mac mini is nearing end-of-life this month. The site reports that Apple resellers do not get new supply of the mini computer. I wonder if the Mac mini will dissappear completely from Apple’s product list, or that a replacement will be announced. The Mac mini is a nice computer for people to get familiar with Mac OS X without paying a premium price. The current models are quite fast and should be at least sufficient for most people who only use their computer for browsing the Internet, editting family pictures and doing some word processing. The first generation Mac mini’s, the ones with the G4 processor, were a little slow, but the current models have Core Duo processors, which are identical to the ones in the MacBook. Only time will tell, I guess.

Hello from Eindhoven!

‘Hello from Seattle’ is Microsoft’s alternative on the Zune to the ‘Designed by Apple in California’ that is printed on the packaging of Apple products. I think it is a bit of sad in a way an indicator that Microsoft is actually losing its leading position on the IT market. I don’t think it is a very good sign that you have to imitate (or react, depending on your view) this kind of gimmicks of the competitor.

Last weekend was quite busy. We went to the Efteling because the employer of my girlfriend was having a family day there. It was very nice, especially because the weather was exeptional good for this time of the year.

I also read today about a new mainbord from ASUS which incorporates a embedded Linux installation for configuring the system and also provides some functionality, such as Skype. I think it is a nice idea, but unfortunately, it is a little expensive with a price of 360 dollars. You can buy a complete system for that money.

Rikkert Koppes has created a library which enables some Web Forms 2.0 elements for existing browsers. Not all additions are implemented and some parts, like css pseudo classes, work a little different than in it will be in the ‘real’ WF2 implementtions, but it is a very nice start and I think it can definitely be useful in web applications (especially the various date controls).

Novell creates fork

It seems that Novell created a fork of The cause of this action is the fact that the Sun Microsystems currently controls the entire development process of and requires contributers to transfer code ownership to Sun. Some of them, for example the creator of a linear solver for OO.o Calc refuses to do so. Novell now provides a version of OO.o which incorporate these patches. I’m not sure if this will benefit the development of in a significant and positive way. It is a shame that Sun is making all key decisions with regard to the future of and as such preventing the developer community introducing novel ideas.
I still think that OO.o is missing an opportunity by effectively building an MS Office clone instead of a Office suite which implement the same functionality in a better (or at least different) way.

Microsoft winner of ‘Best campaigner against OOXML’

I think this post is rather funny. I think it is also noteworthy that Microsoft is also the owner of a ISO standard proposal with the largest number of comments…

Whieee!! A Wii

I noticed I did not mentioned yet that since a few weeks I own a Wii. My girlfriend gave me one for my graduation (which obviously made me very happy and was very sweet 🙂 ). Since I didn’t use a Wii before I got my own, I was eager to experience the machine. I had read about it on the internet, but my expectations were not very high, considering the fact that I saw some hypes before which where disappointing when I tried it my self. Howeve, Nintendo did a very good job with the Wii. Controlling the device using the Wii-mote (the wireless remote control) works very well. You can just point to your TV to control the cursor. Combined with the Nunchuk it enables innovative ways to play games, such as boxing by just do punch movements, and tennis by just make the movements one normally makes when trying to hit a tennis ball with a tennis racket.

Currently, I own four games:

Wii Sports
The game that ships by default with the Wii. It contains a number of small games, such as tennis, golf, baseball, bowling and boxing. It uses the possibilities of the Wii-mote to its full extend (of course) and is very entertaining. Especially with multiple players it is very nice
Extreme Truck
This is an arcade truck racing game. It was very cheap, but is nice to play. Controlling your car is done by using the Wii-mote like a steer. This makes it very natural to play, because most people have the tendency to move nonetheless to the direction the car should go to when playing it on another system. The Wii uses this motion to actual control the truck. The simulation is not very realistic, but that’s ok.
A very nice game, but doesn’t use the controllers to their full extend. However, the Nunchuk makes it easier to play these kind of games compared to other consoles, I think.
I didn’t play this game very much, but it seems nice.

I’m planning to buy some additional games. Resident Evil 4 should be very nice according to stories of other people. I also want to buy some Mario games, such as Mario Party 8 and Super Paper Mario. And of course the braintraining game Brain Academy Wii Edition.

You are currently browsing the Martin @ Blog blog archives for October, 2007.