Posts Tagged ‘ajax’

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.

ATK6 released

June 12th, 2007 by Ivo

Today it's exactly one year since ATK 5.6 was released. So the new release was long overdue.

It's finally here, along with a new website which has a lot less fuzz, and is more to the point.

The changelog is a whopping 1056 lines. This translates to rougly 300 changes for this release. We might say this is a new generation, which is marked with a new major version number, and a new default layout. And it finally has ajax support (the way you are used to in ATK: add a flag to add autocompletion to a field, add one line of code to make things refresh on the fly). Most of you have been using the nightlies for months now, so this may not be new for you, but many companies are still using 5.6 for their apps.

The new release can be downloaded here.

Given the amount of changes, upgrading might not be trivial. Consult the forum if you need help.

ATK 5.6.0 released

June 12th, 2006 by Ivo

We've just released ATK 5.6.0, the next stable version of the Achievo ATK framework. The new release can be downloaded here.

This release contains over 140 changes and improvements.

Some highlights of the changes since ATK 5.5:

  • 5 new attributes, from a simple attribute for manipulating URLS to a flexible calculator that can add columns containing arbitrary calculations of other attributes, and a generic attribute that can turn any other attribute into an internationalised data field.

  • A new 'shuttle' relation for easy selection of records in many-to-many relationships.
  • 2 new themes, 'macoslike' and 't3skin'. The latter creates a Typo3 4.0 look for ATK, useful for integrating ATK applications into a Typo3 environment.
  • An AJAX based generic data structure search functionality.
  • An atkMessageQueue for relaying messages to the user.
  • Many API enhancements (new methods, new features and new flags)

And many more fixes and improvements. The complete change log can be found on the release notes page.

Achievo 1.2.1 release and ATK news

May 30th, 2006 by Ivo

My decision to hand over project maintenance of the Achievo project has turned out to be a good one.

Since Sandy took over, we've had 3 new releases. A first release candidate for Achievo 1.2 was out when he was at the helm hardly one month, and yesterday, he released Achievo 1.2.1, which contains several important bugfixes for the 1.2 branch.

I've had several remarks from users who were 'glad the project was apparently still alive after months without a release'. I think the project would've died prematurely if Sandy hadn't taken over.

As a result of the takeover, I was able to finally take the time to do some other things I've been planning to do for a while now. I've written a Typo3 ATK bridge that makes it possible to develop Typo3 backend modules in ATK. This reduces Typo3 backend modules from hundreds of lines of code to the minimal amount of coding we're used to from using ATK. This extension is currently being tested internally and will be released with a howto soon.

Also, I'm finishing up ATK 5.6. It contains some interesting new features, among which is an atkCalculatorAttribute for arbitrary calculations on fields and an atkMlWrapper which can turn any attribute into an internationalised field (sponsored by our friends at Zicht). ATK 5.6 should be out within 2 weeks.

Finally I've been spending a lot of time on epointment.com. We're finally getting somewhere with the features we need. I will be writing a 'syncing Achievo with epointment.com' howto soon. Although at its current state, we have a lot of competition from the big guys, we're seeing quite an amount of interest from Dutch people (probably because Google Calendar only has an English interface at the moment), so we're coming along nicely. We're also talking to the guys from MarkThisDate for cooperation (open standards rule!).

The largest benefit for ATK will be that we're pushing the development of the Ajax functionality in the framework. In ATK 5.7 (which might become ATK 6) you can expect a lot of (optional, ofcourse) Ajax powered functionality such as autocompletion and Partial Page Rendering.

Tobias today had a post about the term 'Web 2.0'. He's not the first to disagree to using the term, but I feel that Web 2.0 is not about technology, it's a movement. So I felt compelled to write a reply to his post. Since the comment got rather lengthy, and expresses my opinion about Web 2.0, I thought it would be appropriate to post the comment on my blog as well. Here's Tobias' point:

'So, please, stop that stupid "Web 2.0" term. It simply sucks.'

And here is my reply:

I disagree. Technically, you're correct. Yes, the technology has been around much longer, and yes, the web technically consists of hypertext and other technologies.

But that is not what Web 2.0 is about. Web 2.0 is a movement, not a technology. It is the next generation of the internet. It is much broader than the set of technologies it is built upon.

For starters, it is the difference between the early, mostly static, web that was just a way of presenting information in various ways, and the new, more interactive, collaborative, way to deal with information on the web.

And it's not just about Ajax. It's also about how sites like Flickr, del.icio.us and digg.com thrive and make the web to the collaborative experience it currently is.

It's also about how RSS and podcasts provide new ways of distributing information.

In many ways, the web is growing up. What better techie-term to apply to that than 'Web 2.0'? If you ask me, the term fits perfectly.

Also, it's not about marketing. The best 'web 2.0' sites hardly do marketing. They grow because their communities embraced them for what they provide, for their usefulness.

Was the renaissance bullshit because paints and brushes already existed years before? No. So the fact that the technologies that make up Web 2.0 are older than the realisation that we're moving in a new direction does not make Web 2.0 bullshit either.

It's evolution.

It's combining existing technologies in creative ways and making them work in a way beyond what their inventors had thought of.

So please, stop the 'the web 2.0 is bullshit because the technologies already existed for years' bashing and start to realize that the internet *IS* evolving and maturing to a degree where we can truly speak of a 'next generation'.

We're all already a part of it, whether we want to or not.

Welcome to the future.

Together with comunication firm Effectiv we developed a marketing tool for Cirque du Soleil in ATK. For this application, we needed a better way to search through the myriad of data in their database. Peter solved this by adding a new nifty Ajax powered search functionality to ATK, that can be used to traverse all data, following relationships and exposing the entire database through a single interface.

An example of the type of searches that a user can do: 'show all employees that work in a department whose manager lives in a city that has at least 10.000 inhabitants'.

This functionality is available in the current nightly build. (This contains only the atk subdir, if you don't have an ATK app already, download the sample application first.)

Here is a screenshot:

screenshot

In this screenshot, I am looking for all employees whose manager is 'ivo', and that work in a department which is currently hiring. (this is taken from lesson 3 of the demo application)

In ATK tradition, to enable the functionality you need only one line of code. Just add the following code to any node (constructor or action_admin override):

$this->setExtendedSearchAction('smartsearch');

(Note1: if you do not have AF_SEARCHABLE attribs, make sure you set NF_EXTENDED_SEARCH to force display of the search bar. Note 2: in a future nightly this will be even easier through the use of a new NF_SMART_SEARCH flag)

Now, click the 'extended' link in your application's search bar to get the new search.

Another neat feature is the possibility to save and load sets of search criteria. To enable this, you need to have the atk_smartsearchcriteria table:

 
CREATE TABLE atk_smartsearchcriteria
(
  nodetype VARCHAR(100) NOT NULL,
  name VARCHAR(100) NOT NULL,
  criteria TEXT NOT NULL,
  PRIMARY KEY (nodetype, name)
);
 

Peter did a great job with this feature. I think this opens the road for advanced reporting functionality in ATK.