Add Apache Ant to PDT

I’ve been looking for this for a while: how to add Apache’s build tool Ant to Eclipse when it is not available to add as a view.

When you download and run the standard PDT for example, it is not available.

The answer seems to be: install the Eclipse Java Development Tools.

This may not be the ideal way but if you want to do this through the “Install New Software…” menu, it seems to be the only one.

Just select “Work with: Galileo” (or whatever your Eclipse version is) expand “Programming Languages” and select “Eclipse Java Development”.

After the installation completes you can add Ant as a view.

Project: Google Maps members overview

Another project: last week I finalized a Google Maps integration with an overview of my client’s members and the status of their membership.

VSK (or the Vlaamse Scholieren Koepel) manage their member schools through a web interface and because they had addresses of each school, it was a logical step to show them on a Google Maps overview:

vlsk-members-google-maps

While the result will definitely come in handy for them, implementation is not spectacularly difficult. The fact that the hosting was fixed on PHP 4.x caused a bit more “fun” though!

This can save some time searching: to center a map on a set of markers (like with the county selection above) your must first center it on a set of fixed coordinates.

Zend Server, a first impression

Zend Server

I finally tried Zend Server Community Edition as a replacement of WampServer (or XAMPP) for local development.

While Zend Server proposes to be the perfect solution for any environment, I specifically tried it as a development stack on Windows machines. The use and usefulness of course completely differ in any other scenario.

First of all (and of great importance if you ask me): it is clean, simple and easy to use from A to Z. The installer provides the right options but not too many, the dashboard (control panel) is slick and provides quick access to settings you don’t often find in any other “server packages” and last but not least it performs much better due to the use of FastCGI on Windows.

2 less-frequently used features I missed though:

  • A way to set up VirtualHosts in the dashboard.
  • A WampServer-like way to switch between PHP (and in a lesser extend Apache) versions.

In total, the fine packaging almost got me convinced to replace WampServer.

Almost… because the choice for FastCGI on Windows also has one major disadvantage: you cannot use php_value settings inside your Apache/VirtualHost configuration. I especially like this since it avoids setting include_path, display_errors, upload_max_filesize and the like inside your scripts or .htaccess (which in some setups causes it to be parsed at every request).
Doing this in Zend Server on another platform isn’t a problem, since they use the PHP Apache module instead of CGI but that means you do not have similar environments and that is the complete opposite of what we want.

So it ended with a deinstallation. On the other hand: I can really see the benefit of this package for live/production environments. With it’s included optimization tools it takes a lot of configuration hassle away.

Google results right-click FireFox reset

When you use FireFox, you might notice that the Google search results show a different URL once you click on a link.

Google has been experimenting/implementing/… this for quite some time now but apparently not in all countries/browsers/users/… simultaneously?

It is caused by some JavaScript script that re-routes the link through Google in order for them to be able to track clicks. Although I can imagine some people make a fuss about this, personally I do not care as long as the results are good.

But this becomes annoying once you right-click a link to copy it (e.g. in an e-mail): I want to send the original URL and it sounds a bit strange to track other people clicking on my search result (for some good reason it probably makes sense to Google though).

You can easily avoid this (at least in FireFox) with a Greasemonkey script. Scripts have been available for some time, but I made a simple one with jQuery that does the trick for me.

Download or install jQuery Google click tracking removal script.

Lego-like electronic components

Looking for a new hobby? Enjoyed playing with Lego when you were little?

The Google Reader sign-in page can be addictive: the poplar blog posts that appear there are often funny and interesting. Like this one yesterday: Introducing the Illuminato X Machina.

Apparently Liquidware is a company/organisation that manufactures electronic components in an open source spirit. You have all kinds of components that you can plug together and that are programmable with the available C++ IDE for Windows or Mac.

Their latest product is the Illuminato X Machina from the blog post above, which is basically a small motherboard with a 72 MHz CPU, storage and interfaces and which can be attached to other cells to increase computation power.

A early funny (geeky) example of the possibilities:

You can order any component separately or in starter kits from the Liquidware shop. I believe Christmas is on it’s way!

Use standards

Use standards

No, you guessed wrong. This will not be the nth post about W3C standards.

Well, maybe one paragraph: while I know the use of W3C standards is favourable, the usability of your project/application should be your number one priority. Not adherence to a standard which would render your application unusable for (a part of) your audience. Every once in a while people tend to forget this. Of course no one will argue that W3C standards actually are a blessing.

But, this post is mainly about 2 simple standards:

  • The ISO 639 standard for representing languages. Please use “en” or “fr” in your database, routing, scripts,… . It is unbelievable how many times people pick something like “FR” or “F”.
    Next time, consult the ISO 639-1 list.
  • The ISO 3166 standard for representing countries. Same case: please use “US”, “FR” or “BE” or use the ISO 3166-1 list.

Additionally, use the Unicode CLDR list when working with locale’s (e.g. nl_BE).

Standards in general provide a major productivity benefit: you do not have to lose time discussing, implementing, mapping,… other peoples personal preferences (whether or not their choice can be motivated).

This also applies to coding standards/guidelines. We have probably all had (or will have) discussions about them once in our life because there are no “official” ones as far as I know. Specifically about PHP: please (yes, I am on my knees right now) use one of the major ones that are already available: e.g. Zend Framework (my preference because it is or will become the industry standard), PEAR or … . Do not create your own flavour (I do not have to explain why this does not make sense).

A hot topic at your company, project or team? Have a look at Weble Subversion hosting: you can force a list of predefined guidelines/standards by a mouse click. This will prevent SVN users from committing their code if it does not comply and, in such a case, an overview of the deviations will be displayed.

Practical use of QR codes

Popular and widespread in Japan, QR codes (a variant of the well-known bar-codes) certainly provide many opportunities.

strictlyphp-qr-code

The QR code was invented by Denso Wave, Inc of Japan in 1994. They appear on many product packaging in addition to “normal” bar-codes for shipment tracking and other purposes. When scanned, these codes can return numbers and text (e.g. the URL to this blogpost in the example image). The camera on your mobile phone and dedicated scanning software do the rest of the magic.

While their ability to be a link between the “online” and “offline” world can provide many opportunities, it hasn’t really become the hype it could be outside of Japan. Practical implementations are rare. Most likely because of the lack of knowledge by the broad public. Although QR reader software is freely available and a July ‘09 research by the University of Essex stated that 68% of UK phone owners can install such an application, most have not.

The biggest difference between the numerous free QR readers (for about any phone brand/model) may be the image quality needed to recognize a code. I’m happy with the  speed of NeoReader but there are also Kaywa Reader and QuickMark barcode reader (among others).

Besides Wordpress plug-ins and support in the Google Charts API, there is a PHP library but support in the Zend Framework could stimulate its use even more (Zend_Gdata_Chart anyone)?

Some more implementations:

One useful tip is to shorten URLs through one of the many URL shortening services there are. This generates a smaller, less prominent QR code.

PPC campaign for Bed and Breakfast

The name or URL strictlyPHP may not immediately reveal I have a second online passion: Web Analytics.

I am more than aware a proper site would help clarify what I do and it’s certainly on the list, but for now, a short description: besides PHP/Web development, I try to invest as much time as possible in Web Analytics. In my case summarized as: website optimization using Google Analytics.

I am extremely fascinated by the information you can derive from analysing data/traffic. I like to pin-point possible usability issues, missing information or missed opportunities to improve site conversion performance. Related to that, targeted AdWords PPC (Pay-Per-Click) campaigns are lots of fun too!

De Pastorie in Haspengouw

And that is what made me write this post: I just started a new Google PPC campaign for a small Bed and Breakfast in Haspengouw (Belgium) targeted to Belgian and Dutch people.

The conversion action is of course the use of the contact form and as results are coming in, it’s doing well. I did a small site rebuild in advance so not everything can be compared to the past, but the amount of new not-bouncing visitors has almost doubled and conversions (of course!) follow the same path. While traditionally March and April were their best months, July is coming close.

Conversions via phone are currently not measurable but it’s easy to ask the person that handles them if an increase is visible (audible?). You could do this properly by asking those people if they visited the website before. Logging that somewhere would allow you to combine this data without to much hassle.

Now, don’t forget to visit De Pastorie yourself! Even if it is only for a drink on their terrace.

Or even better: if you like to receive an actionable optimization report for your site or launch a PPC campaign together to increase traffic: don’t hesitate and send me a message.

FireFox 3.5 Pagerank plugin

The upgrade to the new FireFox 3.5 causes the nice Live Pagerank plugin by Martin of raketforskning to be deactivated.

firefox-pagerank-add-on

Although his URL means “rocket science”, his site seems to be down so I wouldn’t expect an updated version too soon.

Luckily a nice guy named Daniel Olivares has created a new version which runs on FireFox 3.5.

If you own one or more sites the little number that appears in the FireFox status bar is an addiction. The Google Toolbar offers the same, but of course you don’t want the whole package and that’s why this add-on is so popular.

Edit: at the time of writing this new version worked, but it seems like it no longer does. Neither does the one downloadable on the official plugins site (although some users report it does, e.g. with firefox 3.7).

View specific JavaScript with Zend Framework

Because Zend Framework (and in this case also the MVC part) lets you choose how you structure your project, you may have doubted about where to place client-side JavaScript scripts.

icon_javascript

Personally, I place application-wide scripts in something like /media/js/application.js, but in many cases you have scripts that are only applicable to a certain view. Of course we want to avoid having a JavaScript file for each view somewhere in a general JS folder like /media/js.

Putting the JavaScript straight into the view also isn’t optimal since Zend_Layout can for instance put more HTML below it and client-side scripts should be right before the </body> tag.

I thought it would be nice to be able to have [viewname].js files inside the views/[controller] directories. E.g.:

/application
  /controllers
     BugController.php
  /views
     /bug
        index.phtml
        index.js

That makes development easier since your view-specific scripts are still as close to your view as possible, but separated in a .js file so your IDE/editor can parse them as JavaScript. In my case I thought it would also be nice if the .js file would be parsed like the view itself meaning that any variables assigned to the view can also be used in the JavaScript file.

The Zend_Controller_Action postDispatch() method provides a possibility to parse and include the client-side script into the inlineScript view helper where it belongs:

public function postDispatch()
{
    $request = $this->getRequest();
    $controllerName =  $request->getControllerName();
    $actionName =  $request->getActionName();
    foreach ($this->view->getScriptPaths() as $path) {
        $fileName = $controllerName . DIRECTORY_SEPARATOR
            . $actionName . '.js';
        if (file_exists($path . $fileName)) {
            $view = clone $this->view;
            $script = $view->render($fileName);
            $this->view->inlineScript()->appendScript($script);
        }
    }
}

As you can see, the regular view script is cloned so that the same information is passed to the JavaScript file.

The only thing you now need to do is subclass Zend_Controller_Action, paste in the code above and use that new class in your controllers:

class MyController extends My_Controller_Action {}

Happy JavaScripting!