My First Mashup
July 27th, 2007 by Ivo
I have been inspired by Cal Evans' mashup experiment, which he did a presentation on at the Dutch PHP Conference last month.
Also, I was annoyed with having to consult many different resources when I plan a business trip.
So I began building frekfly, my own little mashup.
Version 1
The first version, which took me only a few hours to built, offered only a google map, basic weather information, flickr images and currency conversion. To built this, I used the following tools:
- PHP5's Webservices API, which made it possible to consume webservices with only very few lines of code.
- The Flickr API to retrieve images
- Google Maps for the map display
- Some webservicex services, for weather, geographical and currency information.
- Zend Framework, mainly for its Zend_Service_Flickr class, which makes consuming the flickr rest service easy.
- ATK, for its debugging console and file-caching.
It's really easy to construct an application like this in PHP, given that a few lines of code give you access to any available webservice. The first version of the app did not even use a database, everything was retrieved from webservices and cached in files.
Version 2
Then, I wanted more. When I travel for work, I usually need hotels that are located close to the airport, so I looked for a webservice that could provide me with hotel information. I requested access to the API at expedia, but they have a manual approval process and I'm still waiting for a response. Luckily the people at booking.com were a lot more helpful and they provided me with an iframe based interface to their hotel reservation engine, and they even styled their pages according to the design (well ok, that's not really a design yet, is it
) of frekfly.
The only thing missing from their API was the ability to search by latitude and longitude, which was my close-to-the-airport criterium. However, they kindly send me a dump of their hotel database including the coordinates.
So in version 2 I had to add a database, and I used the database abstraction layer of ATK to easily access it.
Version 2 is what is currently online. I may post some code examples of the webservice interfaces later on, because I found this to be a very instructive experience.
Future plans
In the next version, I want to add other nifty web-two-point-oh features to the site, including the ability to have visitors enter comments and details, so they can help complete the airport information. (such as 'are there better restaurants before or after security?'). Here I plan to use the JSON functionality of Zend Framework, to make this very 2.0-ish.
Issues to deal with
One of the major disadvantages of mashups is the fact that you're dependent on external systems. At night, the site is hardly usable because webservicex is very busy at that time and gives a lot of timeouts. Of course, this is countered by caching, but I can't cache every output for every airport on the planet, so caching is based on a 'retrieve the first time its needed' approach. So that's a disadvantage at this point.
Another interesting issue you have to deal with when writing mashups is standardization in naming, or rather, the lack thereof. For example, I consult 2 different webservices and a few file based airport resources to get airport information, but each of them use different names for the same airport. Where possible, I use the official 3-letter IATA code, but some of them do not support that.
So instead of actually matching data from different sources, you have to use a more probabilistic approach, where you say "hmm, 'Schiphol Airport Amsterdam' and 'Amsterdam, Schiphol' are probably the same airport.
I had a similar issue with the weather service; it doesn't support latitude and longitude, so what it does is 'guess' what the nearest weatherstation is, based on the airportname, the nearest town name, the biggest city close to the airport and finally the country capital if all else fails.
These are all issues to deal with in a mashup-based application, and I would encourage everyone to built a mashup at some point, because it teaches you things that you don't usually encounter with standard mysql+php based websites.
Dutch PHP Conference 2007
May 18th, 2007 by Ivo
Ever since the International PHP Conference Spring Edition was cancelled last year, and moved to Germany this year, we've been planning to do a replacement conference for the Dutch PHP community.
We've worked hard the past few weeks to pull this together, and I am happy to announce that on June 16th, we will have the first instalment of the official Dutch PHP Conference!
The conference is oranised by Ibuildings with the help of Zend, and is targeted at a Dutch audience. We are still finalizing the program but we already have quite a lineup, with speakers such as Cal Evans, Lukas Smith, Kevlin Henney and Gaylord Aulke (all present in the PHP card deck
).
In total there will be 12 presentations divided over 3 parallel tracks. The Dutch PHP Usergroup will arrange an exhibition area where open source PHP project can show off their projects.
Following the example of the UK PHP Conference we are keeping the price low, at 75 euro if you register before the first of June. Registrations will start on monday, but you can already have a look at the conference web site:
Games to play with php playing cards
May 3rd, 2007 by Ivo
A few weeks ago Matthew gave me a deck of php playing cards and there's been some kind of weird poll going on over here regarding the Queen of Clubs, aka Joyce Park.
The picture in this card looked kind of weird, so someone started a discussion whether Joyce is either a) wearing a yellowish t-shirt with a black trim, or b) it's not a t-shirt and she's wearing a black necklace. (See picture here).
It seemed that everyone had an opinion and, nerdy as we are, soon there was a poll up on one of our whiteboards. The losers would buy the winners candybars.
Eventually, there were 9 of us (including me) that voted for the shirt, and only 4 that voted for the necklace. It's clearly a shirt in the picture. Right?
Yesterday, finally, using the obscure means of posting a comment to Joyce's blog, coworker Peter found out the truth.
So I've lost a Mars.
But this smelled fishy. There appears to be an original picture in which the distinction is clearly visible. It appears that the card has been heavily photoshopped. No wonder her necklace turned into a shirt.
So bottom line: Cal, you owe me a Mars.