Archive for the xhtml Category

Logo

L’atelier sur XSLT proposait une découverte rapide du langage avant de passer directement aux exemples.

Un même fichier XML a été utilisé pour les différents cas d’utilisation de XSLT pour produire du HTML : côté client avec le navigateur qui effectue la transformation, sur la machine avec xsltproc et côté serveur avec PHP.

Click to continue reading

Logo

Les ateliers du lundi deviennent progressivement un rendez-vous important dans la semaine d’AF83. Avant-hier, nous avons pu assister aux 3 sessions annoncés dans le post précédent. La première concernait le protocole HTTP. Ori nous a expliqué l’histoire du protocole HTTP, les différentes versions et les règles de compatibilité entre versions, la RFC 2616, les différentes méthodes HTTP et les headers les plus courants… bref, tout ce qu’il savoir sur HTTP et bien plus encore. Pour ceux qui voudraient passer aux travaux pratiques, je conseille les plugins firefox Live HTTP headers et Firebug (onglet réseau).

La seconde session sur les mondes virtuels était très dynamique. Thierry nous a montré les vidéos de ce qui ce fait actuellement dans les mondes virtuels comme SecondLife, et surtout, il nous en a mis plein la vue avec les vidéos de la prochaine génération de moteurs. Enfin, j’ai présenté une session sur UNIX Toolbox. Vous pouvez télécharger les slides au format OpenOffice ou au slides au format PDF.

Les ateliers continuent, avec dès lundi prochain (le 4 août), 2 sessions : la première, à 10H30, animée par Michel, sera consacrée au langage de balisage DocBook (très utile pour écrire de la documentation technique), et la seconde, à 11H30, est la très attendue présentation par Lucas sur l’hébergement de sites web.

La semaine suivante, le 11 août plus précisement, vous pourrez assister à 3 sessions :

  • à 10h30, Romain présentera le fonctionnement du re-nouveau service HCL ;
  • à 11h30, Pierre nous exposera les techniques de référencement/SEO ;
  • à 12h30, Olivier animera un atelier sur les bonnes pratiques sur les tickets Trac.

Et on enchaîne la semaine d’après, le 18 août donc, avec toujours plus d’ateliers :

  • à 10h30, Michel nous fera découvrir la puissance de XSLT
  • à 11h30, Charles-Henri nous révélera des astuces sur ViM avancé
  • à 12h30, il y aura probablement une session, mais cela reste à confirmer…Voilà, je crois que tout est dit…

Ha, non, encore une dernière chose : cela se passe au 64, 2ème étage à gauche.

Click to continue reading

I looked for a nice clean class implementation in PHP for embedding videos from youtube and such and could not find anything that was nice enough. So here is my take on embedding videos in php.
As the embed code is reconstructed it should be safe enough put probably some more checks need to be done after extracting the id to see there is nothing hostile there.

Configuration:
This class requires the SpyC library to read the cobnfiguration file. The library is assumed to be in the SITEBASE/include/yaml/ directory.

PHP:
  1. define('SITEBASE', '/var/www/mysite'); // path to the root of the site (not forcefully public)
  2. define('VIDEO_EMBED_CONFIG_FILE', SITEBASE.'/config/video_embed.yaml'); //path of video embed config file
  3. define('DEBUG', true); //to activate debug mode and false for production usage. it will write to a log file when something goes wrong but should not produce exceptions in production enviroment

USAGE
note: The embed code may either be embed or url

PHP:
  1. $embed='http://www.youtube.com/watch?v=h2EUW_rgDVo';
  2. $videoEmbed = new VideoEmbed($embed); //optional width and height may be passed to the constructor
  3. print($videoEmbed->embed);
  4. $videoEmbed->width = 240; // resize
  5. $videoEmbed->height = 120;
  6. print($videoEmbed->embed); // resized video
  7. print($videoEmbed->thumb); // get thumb url

the other public properties are: ->id, ->type, ->url, ->width and ->height
note that magic getters and setters are used to make ->id, ->type, ->url read only

TODO: thumbnails should be cached locally
TODO: Create unit tests (for the moment test_VideoEmbed(); does some testing)

The video services are configured in the configuration file (video_embed.yaml), form:

---
embedTemplate: default embed template
defaultWidth: default width
defaultHeight: default height
services:
    servicename:
        urlPattern: pattern to distinguis between services
        embedUrlTemplate: template (used with sprintf) for construvting the player url
        thumbnailUrlTemplate: template to find thumnbail by video ID (used with sprintf)
        thumbnailUrlExtractPattern: if present the thumbnailUrlTemplate is assumed to be a text resource, and this is a regexp to extract the thumnbail from it
        extractPattern: regexp pattern to extract
        apiUrl: api url (not used for the currently supported services)
        defaultWidth: service default width
        defaultHeight: service default height
		embedTemplate: specific embed template (not used for the current supported services)

Example configuration file for google video youtube and dailymotion (if you configure it for other services please post the config)... :)

---
embedTemplate: <object width="%2$s" height="%3$s" ><param name="movie" value="%1$s"></param><param name="wmode" value="transparent"></param><embed src="%1$s" type="application/x-shockwave-flash" wmode="transparent" width="%2$s" height="%3$s"></embed></object>
defaultWidth: 425
defaultHeight: 350
services:
    youtube:
        urlPattern: youtube.com
        embedUrlTemplate: http://www.youtube.com/v/%1$s&rel=1
        thumbnailUrlTemplate: http://i.ytimg.com/vi/%1$s/default.jpg
        extractPattern: /youtube\.com\/(v\/|watch\?v=)([\w\-]+)/
        apiUrl: http://www.youtube.com/api2_rest
        defaultWidth: 425
        defaultHeight: 350
    google:
        urlPattern: video.google
        extractPattern: /docid=([^&]*)/i
        embedUrlTemplate: http://video.google.com/googleplayer.swf?docId=%1$s
        thumbnailUrlTemplate: http://video.google.com/videofeed?docid=%s
        thumbnailUrlExtractPattern: '/

And here is the code :Complete class code with readme and configuration file

The code referes to a debug function, you can use:

PHP:
  1. function debug_log($msg, $file = "debug")
  2. {
  3.     $dbg = "";
  4.     if (SITE != '[PROD]') {
  5.         $bts = debug_backtrace();
  6.         foreach($bts as $bt) {
  7.             $path = str_replace(SITEBASE, '', $bt ['file']);
  8.             $dbg .= $path . " line " . $bt['line'] . " (function " . $bt['function'] . ")\n";
  9.         }
  10.         $handle = fopen(SITEBASE . "/../log/{$file}.log", "a");
  11.         fwrite($handle, strftime("%Y-%m-%d %H:%M:%S  ") . $dbg . $msg . "\n------------------\n");
  12.         fclose($handle);
  13.     }
  14. }

Click to continue reading

Voilà la présentation qui a été faite lors du ParisWeb 2007. Pas trop de texte là donc si vous n'avez pas participé vous risquez de ne pas tout comprendre...

La présentaiton -The long talk - Microformats pour le web comme plateforme de communication

Click to continue reading

OpenID

Achieving Single Sign On (SSO) in a decentralized way (anyone can be an Identity Provider) with an open technology (anyone can contributre, no patent fees) is great.

But from the enduser's perspective OpenID is nearly pointless : forms auto-filling and session cookies make sign up/in really easy.

Yet there are further rooms for OpenID to grow :

  • SSO remains a real issue on mobile devices where browsers have not yet forms auto-filling and keyboards are small.
  • OpenID is good for login in a social network ... not to access your bank account. A real and useful SSO should allow you to log in any website. A trust layer for OpenID is beeing specified trouh the PAPE Extension (Provider Authentication Policy Extension) : a website will be able to request from an OpenID provider a certain level of authentification. Here again, mobile has a role to play.

Using OpenID log in, you can transmit some data about yourself. OpenID 1.0 (through Simple Registration Extension) permits very simple data transmission (email, nickname, date of birth ...). OpenID 2.0 comes with an improved scheme : the Attribute Exchange extension. But all this implies your data are centralized within your OpenID Provider. Here is where OpenID technolgy ends : Your data is spread across multiple websites ... Other protocols are needed for you to access them all.

Portable Social Network

Not having to re-import / invite all your friends / relationships (that is your "social graph") when joining a new social network ... this concept is referred to as Social Network Portability.

Microformats provide a solution. While joining a new social network, your should be able to link to your existing pages on Facebook, LinkedIn, Twitter etc. As these pages should include microformats such as XFN "rel=friend" links any machine can parse them and find out about your friends.

Beyond relationships : Data portabilty

Friends is not just all .. From within any website you should be able to access photos from your Flickr account, contacts from your Plaxo address book, events from your Google Agenda etc.

OAuth is all about this : having a website access your data from another site .. without having to give your password away. It uses redirections allowing the user to log in anothersite, OAuth having data exchanged behind the scene.

OpenID, OAuth, Microformats : how does it fit all together ?

There is an interesting link between OpenID and Microformats : as you OpenID identity (for a given profile) falls into one single URL, it is wise to have all your links to social networks on this page (using XFN "rel=me" tags). Some OpenID providers (such as ClaimID) allow their users to do so.

OAuth and OpenID share their openess and the use of redirections. But they don't need each other. From the enduser perspective, the OAUth process can be eased if both site implement OpenID.

This is the beginning ... Many websites were supposed to implement OpenID .. but still don't. OAuth has just been released and has not been really implemented yet. Some issues have still not been addresses : data encapsulation ? GData ? what about synchronisation ?

As AF83 is concerned, we can foster this move towards fluid and open-standard based personal information transmission by allowing for OpenID sign in / up, make our web pages more semantic by using microformats and (not that easy) provide an OAuth API to our users data.

Click to continue reading

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.0 License.