Sjoerd Maessen blog

PHP and webdevelopment

ImageMagick installing and exploring it, a good alternative for the GD library

without comments

Although PHP GD library handles basic image operations quite good, you have probably run into the limitations of GD library as well, it is often slow, memory intensive and a bit complicated to use for advanced image effects. ImageMagick however is a very good alternative. It is an opensource software suite licensed under a BSD style license from IM itself. ImageMagick provides in all functionality that can be accomplished with the GD library but even goes a step further with support for more advanced image edit techniques. An example of such a technique is the recently added “liquid scaling” feature, this is a content aware scaling option. Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

July 19th, 2010 at 7:20 am

Posted in API,Server

Tagged with ,

Git tutorial, getting started with Git

without comments

Below is a short comprehensive description of getting Git up and running in just a few minutes. I personally use OSX as a development machine and so the installation part of Git will cover an installation on OSX. If you like to install Git on another platform please take a look at the Git installation documentation. There are a lot of other ways to install Git, but the one described below seems to bring the least hassle on OSX.
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

June 14th, 2010 at 7:23 am

Posted in Server

Tagged with ,

Input validation with filter functions

with 2 comments

Introduction
Although PHP has a lot of filter functions available, I found that still to many people are using (often incorrect) regular expressions to validate user input. The filter extension is simple, standard available and will fulfill the common validations. Below some pratical examples and things to consider when working with PHP filter functions.
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

June 3rd, 2010 at 8:27 am

Posted in Security

Tagged with , ,

Tips that prevent your mailing being marked as ‘spam’

with one comment

Introduction

The last couple of weeks I was working on writing a mailing/newsletter system myself. One of the first questions that came up was “how do I prevent that my newsletter will be marked as spam”. Although this article has nothing to do with PHP I still like to put it in the spotlight. I will give some tips on how to avoid your mail being marked as spam, some you will know, others you won’t.

How is determined if my email is spam?
Mostly this is done by so called spam filters (server side or client side), some well known examples:

Some of them work with the Bayesian filter. This filter is one of the Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

May 3rd, 2010 at 7:13 am

Posted in Mail

Tagged with , ,

PHP alternative, lazy syntax

without comments

Alternative, lazy what?

Consider the next example:

  1.  
  2. < ?php foreach($aNewsItems as $oItem) {
  3.      echo ‘<li>’;
  4.      echo ‘<a href="/news/’.$oItem->id.‘-’.$oItem->rewrite.‘.html">’.$oItem->title.‘</a>’;
  5.      echo ;
  6. } ?>
  7.  

We could write the above like this: Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

April 12th, 2010 at 7:22 pm

Posted in syntax

Tagged with ,

Passing the Joel test – step 1 setting up a versioning system for Windows

without comments

Until the last PHP conference I attended (the PHP benelux conference 2010) I used an normal Windows XP installation with a Zend Server CE installation on it at home, and yeah it worked. At the office we already used versioning, bug tracking and some other Joel points. I could see the advantages clearly, even if I was developing on my own at home but I just couldn’t find time and motivation to start converting my home server to something more serious. That is until I attended a track on the Joel test of lornajane. (Slides are available here). I thought it would be a nice idea to keep my Windows installation on the server during this adventure to pass the Joel test. Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

March 20th, 2010 at 10:00 am

Posted in IDE,Server

Tagged with , ,

Introduction into SOAP, setting up a simple webservice with PHP SOAP

without comments

I was asked to create a simple webservice that would allow us to transfer a intranet post to an external CMS. In this post I will explain the steps you must take to set-up a simple webservice with the PHP SOAP extension.

The first step, create a simple class that we will use to request data from
We will create a class with one method that returns a string with the parameter we called it. The method will accept one parameter and will check if the value is correct.
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

February 11th, 2010 at 1:26 pm

Posted in SOAP

Tagged with

Limit the number of newlines in a string

without comments

A very short blog post this time. I often use the following short function to limit the number of breaks/newlines in comments that people can submit on a news article or other user input. You can easily limit the number of characters in a comment by using the PHP strlen function, but the comment can still use a lot of vertical space on your website if the user uses 5 breaks in his comment. See the function below to prevent this type of comments:
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

January 28th, 2010 at 10:44 pm

Posted in Regexp

Tagged with , , ,

Using the Google currency converter

without comments

For a project I’m working, I needed to get shipping rates from the UPS API (a blog post about this will follow soon).

The problem I ran into was that the UPS API returns the shipping rates with the currency of the country where the rates for are asked, so you can’t force it to always return the rates in EUR.

One solution to convert the prices is to make a very big array with all currency rates in it. I then would maintain the array every day at 9′o clock to check if the rates weren’t changed. Right, that’s not an option.
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

January 11th, 2010 at 8:56 pm

Posted in API

Tagged with ,

8 Netbeans tips to speed up development

without comments

Netbeans is a great editor, below some tips to get the best out of it.

Use the shortkey for “Last Edit Location” default: CTRL+Q
Often I’m editing file and browse to another location inside the file. To go back to where I was Last Edit Location is a nice feature, it replaces the use of ctrl-z + ctrl-y to go to the previous location without changing anything. By htting the key multiple times all edit locations will be traveled.
Read the rest of this entry »

  • Share/Bookmark

Written by Sjoerd Maessen

December 15th, 2009 at 12:58 pm

Posted in IDE

Tagged with ,