Posts Tagged ‘API’

A look at the hands of time.

August 29th, 2008

Those who can control time are truely bless or half human half god. Time cant be caught or captured ...

But then calendar came and god saw that it was right .. Lets take a jump back into the world of Google and talk about 3 API`s we could make a mess of uuh mashup :) .

Prototype Framework

The prototype framework is a really handy dandy light weight framework that allows you to do all sorts of things with a short syntax. It also extends the DOM to give you extra functions to work with while getting objects from the DOM. It is really easy to extend objects that you have on your HTML page. This is a typical prototype routine to extend for example a div.

JAVASCRIPT:
  1. Object.extend ($('somediv'), {
  2. function onclick ()
  3. {
  4. alert ('caught you clicking this div !!');
  5. }
  6. });

The $() is a really easy to use syntax but what ever you do, Avoid using this in loops because the $() method will grab the object from the dom and extend it with extra functions. So this will mean if you are using the $() syntax you will end up with low memory winch could in a bad situation crash your clients browser.

Google Calendar Services

Google calendar API`s are out for some time now they where one of the fist API`s released by Google who are based on there gdata system. Google offers there users a calendar management site at calendar.google.com im am a user of that website along with millions of others.Now with the Google callendar api it will mean that i will be abled to retreive my data from my own public stated agenda and user it any other website.

The API that i am going to use in this mashup will be the javascript version of this api  (there are others like java / .net / Php / Python / C). Examples of how to use the calendar API`s are available on the google code pages. The calendar API requires you to signup for a unique API key that can be used (just as with Google maps) to identify your host, to get that API key go here and follow the instructions to embed the link to the javascript API. If you ever have used an gdata based API from google you will find the API pretty straight forward and easy to use. Even learning the basics of the gdata api is a peace of cake. Im not going to much detail of how to code this but it will be entertain able to see how it will work together with the Google maps API.

Google Maps.

Well i dont think maps needs an introduction because every one has seen / heared used or experienced a Google map at a point in time. A few years already Google hosts this service at maps.google.com and since some time they offer the API to setup your own maps on your website. The documentation for the maps API can be found here, the first thing you need to do when deploying a map is getting a API winch you can use in your code to identify your website. You can get your API from this location and follow the instructions for embedding a link to the javascript API.

What will the mashup do ?

The mashup will be a utility that gives a change to look at the appointments that you have open and it will show the location of your appointment marked on a map with a standard marker. The source of the mashup can be found at this location. Because html in a Wordpress layout can be crappy i decided that the whole application will be Ajax`ed into this post (this will take a sec or 2 to load up).

Once again here is the source

Php does closures (part 2 plus namespaces)

August 25th, 2008

Later on in this post i will show you an example of something else that the php development team have added to the php platform winch is called namespaces. » Read more: Php does closures (part 2 plus namespaces)

Get some REST

August 17th, 2008

No no dont head to bed now because as addon to my "road to readable code" post we are going to discuss RESTfull web applications today. Representational State Transfer (REST) is an architectural style you could prefer web building your web application. As mentioned above REST is a style and not a standard. Building RESTful websites allows you as well as partner developers to understand the structure of a website better and quicker.

The most of the websites i write for my own usage are being developed with some REST structure in them. At the end of this blog post i will give you a demonstration of a website i still have to launch and a quick preview onto its API winch is also coded in a RESTful manner.

What is REST

Rest stands for Representational State Transfer and can be perfectly explained with some examples. Lets say our goal is to write a rich internet applications where users could signup and there profiles could be viewed. First users have do signup so the will be linked to

http://example.com/users/register

After winch they need to active the account on your website and they will be forwarded to the following location.

http://example.com/users/activate

Now while applications who do not use the REST style might have url`s looking like this 

http://example.com/registration.php?action=register

In my own opinion its mutch easier to understand url`s the REST way then the old fashion way.

 

Rest in Web service Design

If you are coding your own web service you also might want to think about the REST style and its relation in your application because you can bring the same structure back onto your apps. In the resources section of this post i will show you a video describing how to create a API service using a little rest.

The RPC-API for my web service for my website called "uptime god" is located in the /api/ subdirectory on my web server and uses /api/authorize to authorize the API key used by the client library. It also uses /api/getrecords/ to retrieve the uptime records from the web service. For more information view my video attached to this post.

The video


 

Would you help in Twitme Beta ?

View Results

Loading ... Loading ...

Phpvrouwen google gadget !

February 17th, 2008

We kennen het allemaal, zit je eindelijk thuis na een dag hard werken en wat doe je als eerst ? juistem .. research up to date blijven en spelen met code. Nu zon momend had ik dus ook en daaruit is de phpvrouwen google gadget geboren. Deze gadget laat de laaste posts zien op www.phpvrouwen.nl.

Het leuke hier van is dat je deze op je igoogle page kan zetten, van af nu volg je gewoon phpvrouwen van af het momend dat je je browser opstart want daar zijn wij !. Ik zal verder op in deze post wat meer informatie geven over de bron code en links naar de google API`s voor gadgets.

Gedachten over Gadgets

Voor ons programeurs is het altijd leuk om met dingen te spelen, Vooral als die je in de workflow van de dagelijkse ontwikkeling eigenlijk nooit zo zal gebruiken. Welnu ik ben net als de meeste van jullie in mijn dagelijks leven programeur van beroep, Ook wij hebben op de zaak vaak genoeg gedacht van Google maakt wel leuke API`s op zich maar wat zijn nu situaties waar je het zal kunnen (en willen) gebruiken ?. Ik denk dat er toch wat situaties zijn die het ontwikkelen van een website kunnen versnellen door het inzetten van Gadgets. Hier zijn 2 voorbeelden daar van.

  • Veel voorkomende klussen op meerdere domijnen
  • Als je een profielen site ontwikkeld.

De eerste optie is, stel je voor je hebt 1 klant maar meerdere websites bijvoorbeeld een klant die voor elk fidiaal zijn eigen website heefd. De situatie zou kunnen voor komen dat er een actie word gehouden voor deze winkelketen en door het invullen van een actie code zou de klant korting kunnen krijgen. In dit geval zou je een ajax scriptje er tegen aan kunnen gooien maar ook en dat is mischien wel beter een google gadget.

Deze gadget zal dan communiseren met de hoofd server en in vergelijking met Ajax is deze oplossing beter omdat het implanteren van deze gadget op elke site 1 regeltje aan code is.Het zal niet vaak voorkomen dat je voor je werk een profielen site ontwikkeld maar het kan zo eens voor komen. Google gadgets zijn in dit geval een erg welkom extratje want wie vind het niet prettig om leuke bonus dingetjes toe te voegen aan je website bijvoorbeeld het luisteren naar de favorite muziek van een persoon of een youtube filmpje. Hier kan je je gebruikers een rijke ervaring laten beleven door Gadgets toe te voegen aan je webpagina. Zo zie je maar er zijn best wel redenen om Gadgets intezetten en bovendien is het erg goed om de google API`s te leren als je eenmaal de basis leert kennen kan je zo een stap verder gaan eng gadgets combineren met google maps en of een publieke calender op de site van je klant (dit te vervanging een hoop van je javascript meuk).

Voeg de gadget to aan jouw iGoogle
Voeg toe aan Google

Javascript gebruikt in de gadget vind je hier en de code van de gadget zelf vind je hier

Om de phpvrouwen gadget op je eigen wegsite te plaatsen gebruik dan deze code:

JAVASCRIPT:
  1. <script SRC="http://gmodules.com/ig/ifr?url=http://www.phpvrouwen.nl/google/gadgets/latest.xml"></script>