Archive for January 2009

 
 

PHP development training

Yesterday I gave a PHP enterprise development introduction to the nice people at zap all people about the various tools available to be more productive, produce better results and have more PHP fun.

While I don’t like to call it “enterprise” development because anyone can work this way (In most projects for my clients I am the only developer), enterprises are of course obliged to work in a more structured way.

The topics we discussed were:

  • Local development (with WAMPSERVER, on Windows in this case)
  • Debugging with Xdebug
  • Eclipse IDE (PDT and others)
  • Subversion
  • mod_rewrite
  • Zend Framework (& OO best practices)
  • Unicode (UTF-8)
  • ORM (although we were out of time by then)

There are probably numerous other tools and standards that could improve PHP projects, so I of course don’t state this is the perfect list. In my humble opinion, working with an environment similar to this one could give awesome results (especially in a team, but again, also as a single developer).

Something I didn’t mention was a useful bugtracker. Although, for my own projects, I prefer a simple todo-list. Maybe that’s something for a future session.

Any other suggestions to the list are highly appreciated.

Logitech Wave keyboard

Logitech Wave keyboard

Once in a while you buy something you’re extremely happy with and this belongs certainly to that category.

The Logitech Wave keyboard.

Great feeling; ergonomic, but not to the extreme. Useful special keys but not too many. And it is wired (I don’t understand the use of wireless keyboards and/or mouses).
Note: an Azerty BE version is also available.

In the 8 months that I’m using it, the letter S is a bit worn off (hrmm… what would be the cause of that) but it has been worth every cent for me!

UTF-8 encoded data in PHP and MySQL

unicode

Since every developer has probably struggled with data encoding once in their career, a short summary “how to get your data in and out of a MySQL database with PHP”:

  • When you create your MySQL database, set the collation to one of the UTF-8 options (e.g.: utf8_general_ci). If you have no rights to create or change your database, do this on the table level.
    Note: if you use phpMyAdmin, it’s good to set your “session” encoding to UTF-8 before you sign in (although I believe this is now the default). Otherwise perfectly good data could look weird.
  • Secondly, when you create a database connection in PHP, be sure to set the character set of your connection to UTF-8 by executing

    SET NAMES 'utf8'

    (notice the missing dash). Some extensions/adapters may have a method to do this (e.g. PDO) or allow you to pass it as an option.

  • Third, save your PHP script/file as UTF-8 no-BOM (no byte-order mark since UTF-8 does not have byte order issues).
  • Last, but most important & applicable to many more projects: set the charset of your page through the HTTP header. e.g.:

    header('Content-Type: text/html;charset=utf-8');

    Note: do not use the <meta> tag (solely) for this.  Only using the meta tag causes most browsers to start re-parsing your content once they notice it’s UTF-8 instead of their default assumption. This only slows down page loading.

This post is certainly not meant to be a Unicode manual but it can be a quick reference when you every wonder why you see those strange characters in your database.

Migrate from a text editor to an Eclipse PHP IDE

eclipse

More than a year ago I got convinced by a colleague to leave my favorite text editor behind and make the switch to an IDE (Integrated Development Environment) for PHP project development.

In my opinion there is only one IDE for PHP: Eclipse. PDT, PHPEclipse, Aptana Studio or Zend Studio are all more or less Eclipse plugins that convert the Eclipse IDE in a PHP development environment. Once you get used to it, your projects will benefit one way or another.

In reality, I still use NotePad++ a lot. It may be best to still link PHP files on your OS to an editor because IDE’s are not made for quick edits.

But, in case your in an upgrade process or just want to improve your set-up, read this article:

Getting Started with Eclipse PHP Development Tools (PDT)

It could have definitely saved me some time as I took exactly the same steps and use the same plugins. Besides the Zend Debugger that is, as I haven’t found a use for it yet.

I have only one wish: a simplification of the whole Eclipse & plugins project structure. I still don’t understand why I can’t easily upgrade between versions and why so many upgrade options are available. For me, the upgrade process has only proven to be useful for bug fixes and plugin upgrades.

Related post:
How to configure PDT

Movie theater usability blunder

The biggest Belgian movie theater group, Kinepolis, has had a terrible history when it comes to their website. But today I was really amazed how they scr*wed it up this time.

I must admit, I usually don’t have time to watch movies so the site may have been brand new. I tried to have a look at which movies run in my local cinema and when you click on the listing of a theater, you get a page like this.

While one would expect this is a (X)HTML listing, their web company actually managed to develop this in Flash. Let’s assume they had a solid reason for this. Maybe they were on the edge of bankruptcy and Adobe promised them a bailout in return of a commitment to Flash applications. Must be something like that.

Anyway, I want to be forgiving and look past the use of Flash. But the worst thing is it could have gone by without my notice if it didn’t try to middle-click the entries in the list. Because it’s Flash, it causes a scroll cursor to display instead of opening the movie in a new tab!

I am probably not the only person that uses new tabs a lot to compare links. Even if there are only a limited number of people with a middle-click-autism like me, it’s a sad sad sad thing for Kinepolis.

Since I still don’t know which movie I want to see, let’s have a look at what their competitors have to offer.

High PPC bids can cause negative results

Your instinct may tell you that the higher you rank on a search engine, the better the results will be.

But that is not always the case. If you’re not ranked number one for a broad keyword (e.g. for “widescreen monitor” – as opposed to “review samsung widescreen monitor”), this can give you higher quality visits than the magic top spot. When you look at bounce rates for instance you could get better results for lower (but of course still high) rankings. And it also applies to conversions.

This is explained by the broad nature of the keyword. People that are looking for something specific will (also) look further down the results and will thus have a higher affinity with your content as opposed to all visits the number one ranking generates.

It is certainly useful in light of PPC (e.g. Google Adwords) bids.
When you look at these bounce rates based on the add positions of a broad keyword, you get the picture:

keyword_position_bounce_rate

It’s important to note that the Top1, Side 1, Side 2 and Side 3 all generated a comparable amount of clicks during a 2 month period. As you can see, the Top 1 position (in theory the best place) causes significantly more bounces.

So if you don’t bid for that number one spot and end up in the middle you may just be happier with the results.

The opposite is true for very specific (and/or localized) keywords.

So to conclude this post:

  • Bid high for specific keywords (but highly specific keywords are usually inexpensive).
  • If you bid for broad keywords, bid average.

Of course, every statement has it’s exceptions: use your analytics tool to find out what suits you best.

Blog traffic in 2008

It was a lot of fun to track Google Analytics last year. Since I started writing this blog in mid 2008, traffic to my one-page site has been increasing.

Have a look at the visitors graph:

 Traffic 2008

Can you tell when this blog was launched?

It’s interesting to see the different implications each post had. For instance, one of the first about uppercasing the first letter of a MySQL result value, has brought 313 visitors to this site (through almost as many search phrases) while the one about a Euro conversion rate feed brought none.

As a side note: close to 63% of these visitors used FireFox.

Besides that, bounce rate is at an extremely high 75%. While this is normal since the only thing this site has to offer is that once specific piece of information someone was looking for, it should be fairly easy to have visitors browse through more than one page.

If time was on my side and I would be short on work, that would probably be a fun challenge!

It’s great to use these experiences in other projects though.

Free office space in Hasselt

You’ve probably always wanted to have a real office to separate your private life from your professional activities.

So yes, you read that right! Besides the fact that it is not actually free, it is all true. Well, it’s also almost for free. Certainly if you look at what you get in return:

  • Funny colleagues.
  • A magnificent view.
  • And of course… Rautemusik!

Don’t hesitate: get your office space in Hasselt (Dutch) while it is still available.