derick rethans  eZ systems employee

› Detecting Timezone By IP

Through Planet PHP I found an article on Pre-populating forms with the timezone. I'd normally add a comment instead, but the comment would almost be larger then the original post, so I am instead writing up an entry myself. The post describes several ways to obtain the user's timezone and use that to pre-fill a form. None of them are working properly though. I'll try to explain for each of them why not, but first of all it is important to know what a timezone actually is.

A timezone is a set of rules that determines the UTC offset for different times around the year for a specific location. Because of daylight savings time, a specific location can have two (or more) different UTC offsets depending on what point in time you look at it. Some areas might have had different rules in the past, even in the same country. An example here is China, where currently there is only one timezone, but previously there were multiple. Thus there are different timezones for the different locations in China, even though the current UTC offset is the same for all of them. Timezones are identified by Country/City or Country/Subcountry/City.

The offering by MaxMind allows you to link a country/region combination to Timezone identifier. For the US it subdivides this per state even. However, it misses the different timezones for Russia, Australia and even Indiana, USA.

IP2Location only provides a single UTC offset per IP range, totally ignoring daylight savings time.

The Hostip.info solution I can't access because phpclasses requires some stupid registration.

As for the author's own solution, using JavaScript, is flawed at least partly as well. In his example JavaScript only returns a UTC offset. Luckily it is possible to detect the correct timezone quite a bit better by using some of PHP's functionality. The following bit of code uses both the UTC offset and the timezone abbreviation to find out the user's timezone:

<?php
if (!isset($_GET['tzinfo'])) {
?>
<html>
<script type="text/javascript">
var d = new Date()
var tza = d.toLocaleString().split(" ").slice(-1)
var tzo = d.getTimezoneOffset()
window.location = window.location + '?tzinfo=' + tza + '|' + tzo
</script>
</html>
<?php
} else {
list( $abbr, $offset ) = explode( '|', $_GET['tzinfo']);
echo timezone_name_from_abbr( $abbr, $offset * -60 );
}
?>

This is still not perfect of course, because it would for example give the same result for most of Europe (Europe/Berlin).

Figuring out the user's timezone can be done by using a high-accuracy database of IPs to lat/longitudes such as hostip.info and MaxMind offer, as well as a mapping from location to timezone. The latter however, is not available as far as I know. If however a data file that has proper definitions of the different timezone boundaries exist (mostly, on a per-province level would be enough), then such a tool can be easily build. I saw that OpenStreetMap has such a map, but I can't really find the raw data for that unfortunately. It would however, be awesome to have such a data file.

06/05/2008 10:09 pm (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans  eZ systems employee

› Xdebug finally in Debian

Since a few days, there is a new package in Debian: php5-xdebug. After a few years of talking licenses, due to the help of Martin Meredith and François Marier Xdebug can finally be installed with apt-get. See the synaptic screen shot as well:

06/05/2008 2:30 pm (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

maxime thomas

› jQuery Challenge - Part1

During a mission, I discovered jQuery : a javascript library providing facilities and strong functionnalities to static web pages.

jQuery

The use of this library is very simple. It has been made to use the developper's life and specially the maintenance of functionnalities. The javascript entered is shorter and more simple. It has few concepts so it is very quick to learn.

There is only one entry point in jQuery : the $ function. It allows you to access some standard functions to select nodes in the DOM, to manipulate them or to handle events.

The selectors are very useful because you can select almost every item in the DOM using id, css class or javascript variable name. Then, if there is more than one occurence, the function will result an array. Moreover, you can use XPath expression as filters, to reduce the number of object returned.

The strength of jQuery is the chainability of the functions. It allows to increase readability and maintenance of a javascript. You can also combine jQuery with classical JavaScript scripts.

The Challenge

To test this library, I've decided to develop an eZPublish extension integrating the jQuery library.

As a user case, I've chosen the Facebook tagging functionnality : you choose a picture, you tag your friends, you save it, hovering the head of a friend, the name is shown...

I have first worked offline to design the javascript. Here's a snapshot of what I have done : image gallery

Conclusion : it's very easy to come to grips with jQuery and a bit hard to debug. So I've searched and found a plugin to debug my script. See below.

Other interresting libraries...

I also heard about the ExtJS library which is a professional javascript library providing user interface components to build professional applications. jQuery is also experimenting this way by launching jQuery UI. It will be at the end equivalent I guess, but you will be able to still use the jQuery library as an independant library.

Ressources

Here's some ressource :

jQuery : http://www.jquery.com

Visual jQuery : http://www.visualjquery.com/1.1.2.html

Dump Plugin for jQuery : http://www.netgrow.com.au/files/javascript_dump.cfm

Javascript benchmark : http://flesler.blogspot.com/2008/04/benchmarking-javascript-variables-and.html

02/05/2008 11:27 pm (UTC)   Maxime Thomas   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans  eZ systems employee

› Location for PHP Vikinger

We've now found a definite location for PHP Vikinger. It will be at one of the old factory buildings here at Klosterøya, close to eZ Systems' offices. The room has about space for 80 people, and has a nice view over the river southwards. About 20 people from Norway, Iceland, the UK, Germany and Denmark have signed up so far. This means there is still plenty of space for you! See http://phpvikinger.org for more information, and the invitation.

02/05/2008 10:54 am (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans  eZ systems employee

› Firefox and 64 bit Java Plugin

Because the lazy bastards at Sun still didn't manage to make a 64 bit version of their Java plugin, you have to go through all sorts of hoops to make it actually work. Normally I wouldn't really care about this, but unfortunately my bank decided to require Java working in the browser for authentication. Four hours of my time later, I managed to get it working. To save others from some of the pain, here is how I did that:

1. Download from ftp://ftp.tux.org/pub/java/JDK-1.4.2/amd64/ the file j2sdk-1.4.2-03-linux-amd64.bin.

2. I downloaded it to ~/install, so go into that directory and run:

chmod +x j2sdk-1.4.2-03-linux-amd64.bin

3. Run:

./j2sdk-1.4.2-03-linux-amd64.bin

and wait until it's done installing (make sure it mentions "Uncompressing Blackdown Java 2 Standard Edition SDK v1.4.2-03" at some point).

4. Now, to make it work as a plugin, you have to link (not copy, as that makes the browser crash) the plugin to your mozilla directory. For me:

cd /home/derick/.mozilla/plugins
ln -s /home/derick/install/j2sdk1.4.2⇢
  /jre/plugin/amd64/mozilla/libjavaplugin_oji.so .

5. Restart the browser and check whether the blackdown java plugin shows up if you go to about:plugins.

30/04/2008 2:13 pm (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

community news (ez.no)  eZ systems employee

› eZ Publish Community Developer Day, June 18th, 2008

On behalf of the eZ Labs team, you are cordially invited to eZ Publish Community Developer Day on the 18th of June, 2008 in Skien, Norway.

This is the fifth meeting in a little over a year. We decided to add a full morning of tutorials and break-out sessions on eZ Components, eZ Publish and extensions. Contrary to last year, the Developer Day will be organized separately from the PHP Vikinger event, so people who want to attend both events and the conference will be able to do so.

The afternoon on the 18th will consist of a few more talks by community members followed by a barcamp. In between, lunch will be offered for free

Read below for the (draft) agenda and registration information (registration is required). The registration form allows for submitting proposals for a talk and/or subjects you would like to see treated during the barcamp.

See you in Skien!

29/04/2008 4:27 pm (UTC)   Community news (ez.no)   View entry   Digg!  digg it!   del.icio.us  del.icio.us

bruce morrison

› What's happening with eZ Publish?

If you want to know what's happening with eZ publish then it seems that the Paris Developer day was the place to be. You can read Damien Pobels excellent write up of the event (French). If like me your French is limited to "hello", "goodbye" and asking for a beer here's an English translation via google translate. Not perfect but you'll get the idea. Thanks Damien!
28/04/2008 2:11 am (UTC)   Bruce Morrison   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans  eZ systems employee

› Unicode fun

˙ǝʞoɾ slooɟ s,lıɹdɐ ʇxǝu ǝɥʇ ʇuǝɯǝldɯı oʇ ʇuɐʍ noʎ ɟı unɟ - sıɥʇ ǝʞıl ƃuıɥʇǝɯos sı ʇlnsǝɹ ǝɥʇ ˙ǝsɹǝʌǝɹ puɐ 'uʍop ǝpısdn ʇxǝʇ sʇnd ʎllɐnʇɔɐ ʇɐɥʇ ʇdıɹɔs ɐ ǝɯ ǝʌɐƃ lɐdoƃ oƃɐ ǝɯıʇ ǝɯos ˙ǝɯıʇ ǝɯos ǝʇınb ɹoɟ ǝpoɔıun puɐ sʇǝs ɹǝʇɔɐɹɐɥɔ ɥʇıʍ ƃuıʎɐld uǝǝq ǝʌ,I

27/04/2008 2:49 pm (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans  eZ systems employee

› PHP Vikinger unconference open for registration

The PHP Vikinger unconference, to be held in Skien, Norway on June 21st is now open for registration. You can find the full invitation and announcement here, but I will repeat the highlights.

First of all, this is a free event, but we do require you to register for it to see whether we would have enough space. Places to sleep, and getting to Skien should be arranged by yourself. We made a information page with some suggestions though. The Norwegian PHP User group has reports and videos from last year. The unconference open for all, from beginners to advanced PHP users. At the moment there are about 12 registrations, from people from Norway, Germany, Iceland and the UK. Hope to see you here!

27/04/2008 10:38 am (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

damien pobel

› eZ developer day à Paris le 17/04/2008

Voici un compte rendu du eZ developer day du 17/04/2008 qui s'est déroulé dans les locaux de Sun Microsystems réunissant une cinquantaine de développeurs intéressé par le CMS eZ Publish . Nous avons tout d'abord eu droit à une première présentation de la stratégie "Open Source" de Sun. Rien de très intéressant techniquement parlant, si ce n'est quelques fonctionnalités avancées d'Open Solaris comme le système de fichiers ZFS ou la solution de virtualisation et une volonté affichée avec l'ouverture de Solaris de concurrencer les distributions Linux autant au niveau professionnel avec des niveaux de support avancés qu'au niveau communautaire.

La suite était heureusement nettement plus intéressante. Comme en octobre dernier Paul Borgermans nous a présenté la roadmap des différents produits eZ (eZ Publish, eZ Components , eZ Flow, eZ Find , ...). Le moins qu'on puisse dire est que de grosses évolutions voire des révolutions sont en marche au moins au niveau d'eZ Publish.

La version 4.1 d'eZ Publish

Cette version devrait voir apparaître le très attendu Online Editor basé sur TinyMCE bien plus configurable et souple que l'actuel. La compatibilité avec l'existant sera assuré de manière transparente. Cette version verra aussi le retour de la compatibilité avec Oracle, le support de Solaris 10 ou encore une fonctionnalité d'expiration des mots de passe développé par un partenaire.

Une extension fournissant un flash permettant l'upload massif sera également fournie. La démonstration était vraiment bluffante, ce sera une alternative très intéressante au WebDAV , protocole qui manque cruellement de client fiable en particulier sous Windows.

La version 4.5 d'eZ Publish

Cette version verra beaucoup de changements internes selon 2 axes principaux

  1. L'intégration des eZ Components
  2. L'amélioration de performances

Le second étant en partie remplie par le premier. en vrac les nouveautés annoncées sont les suivantes :

  • allègement du code kernel en déplaçant plusieurs fonctionnalités dans des extensions permettant leur activation/désactivation simplement
  • nouveau système de template et donc de surcharge (override) bien plus performant. Paul citait un exemple d'un template complexe qui s'éxécute 20 fois plus rapidement avec le nouveau système !
  • amélioration du système de cache pour le rendre plus granulaire. Une possible implémentation de la norme ESI (Edge Side Includes) a également été évoquée pour être compatible avec Akamaï ou le reverse proxy Varnish .
  • support de IIS avec PHP en mode FastCGI ainsi que de MS SQL. D'autres SGBD pourrait également être supporté l'écriture de la couche d'interface nécessaire
  • introduction des "object states" personnalisables permettant de brancher facilement l'exécution d'un processus de workflow externe
  • refonte du fichier index.php dans le but de l'alléger et de le rendre plus performant mais aussi de pouvoir y brancher l'exécution d'un script sans passer par toute la pile d'eZ Publish lorsque le besoin de performances est important
  • réécriture du système multi-lingue et des URL alias car le code est actuel est complexe et est basé sur des opérations bit à bit en base de données ce qui compromet la portabilité sur différent SGBD
  • "dé-normalisation" de la base de données, en particulier dans un premier temps la gestion des utilisateurs permettant de supporter plus d'utilisateurs. La "dé-normalisation" au niveau des contenus a également été abordée mais reste pour le moment un projet à plus long terme...

ouf ! voila déjà une belle et ambitieuse liste rien que pour eZ Publish ! Cette version devrait paraître avant la fin de l'année.

eZ Find, eZ Flow, eZ Components

eZ Find 1.1 apportera la recherche par facets dans le courant du second trimestre 2008. La version 2.0 sera une réécriture complète via le composant Search des eZ Components de manière à profiter de l'ensemble des fonctionnalités de Solr .

De nouvelles version d'eZ Flow et d'eZ Components sont annoncées pour la eZ conférence en Norvège au mois de juin . Enfin, eZ Flow 2.0 est également annoncée pour la fin de l'année.

BarCamp !

L'après midi s'est terminé par un barcamp axé sur les questions apportées par les différents participants. Chacun a pu échanger sur ses "recettes de cuisine" eZ Publish, je retiens plusieurs points très en vrac :

  • PHP 5.3 apporte des gains significatifs de consomation mémoire
  • Le mode cluster d'eZ Publish pose souvent problème (d'où les améliorations annoncées). Des solutions de contournements ont été mises en place par plusieurs prestataires.
  • La gestion des utilisateurs est parfois problématique (volume, synchronisation LDAP, ...), là aussi des améliorations sont en cours.
  • Enfin au niveau du volume de contenus possibles dans eZ Publish, Paul explique qu'avec du bon matériel eZ Publish est capable de gèrer un million de contenus sans vrai problème même si c'est dépendant de l'organisation de l'aborescence.

Bon au final, mon sentiment sur cette après midi fort instructive est que le développement d'eZ Publish tente de combler les lacunes au niveau des (très) gros sites autant en terme de volume qu'en terme de performances.

26/04/2008 8:38 pm (UTC)   Damien Pobel   View entry   Digg!  digg it!   del.icio.us  del.icio.us

eZ publish™ copyright © 1999-2005 eZ systems as