home icon contact icon rss icon last FM icon facebook icon LinkedIn icon Delicious icon twitter icon

Wok Cooking

For St Paddy's night, you drink lots of Guinness and perhaps eat an Irish meal.

But yesterday was an unusual St Paddy's night. Before going to drink some Gallia at La Plage, we went to Wok Cooking. It's a asian restaurant where you choose every ingredient you want (and can fit in the bowl you have been given), you choose your sauce, and then a chef will cook all this in front of you in a wok.

My own bowl of wok

This was good and very satiating (though a bit expensive), but more than that, seeing the chef cooking your meal is unusual and worth seeing.

Concerts and photos

So I got a brand new Canon 500D. Awesome. Now I have to practice and take photos. It seems so easy to press the shutter and have a beautiful image. But believe me, there are other things we may have to know before pretending to take some acceptable photos.

I will post here some of mine. I sincerely hope that we will see improvements in some later posts...

Here are 2 photos from a concert at Le Point Ephémère, in Paris. The first part was Transfer, followed by the amazing Esben and the witch.

Concert halls are very dark, with few very bright parts (under the spot lights). People on stage move constantly. As a noob, I don't know how to take a good photo in such bad conditions. I think I have to choose a very large aperture (to catch all the light available) and a very small exposure (to avoid fuzziness). But there must be something else because all my pictures are noisy in the dark parts.

You can find more of my pictures of Transfer and Esben and the witch on my Flickr account.

But if you really want some great concert photos, Robert Gil is your man. He took some of Esben, check out this guy's work. I see him at every concert I go to and he's awesome.

RVM tips - Tell me my ruby version !

Now that Rails 3 is out, I'm starting to use it on recent application. But I also have some work to do on older applications from time to time.

The first annoying thing is that older applictions are built for Ruby 1.8.6 and Rails 3 works with Ruby 1.9.2. The other thing is that the rails command is radicaly different from Rails 2.3.8 to Rails 3.

Using RVM, I'm able to easily switch from one Ruby version to another and from one gems configuration to another. And this depending on the shell I am on.

The counterpart of this is that I'm very confused and never know on which configuration my shell is currently. So I needed a clear way to know it. It would be great if the prompt can tell it to me. Here is how to do that with bash :

# Copy this in ~/.bashrc
    __ruby_ps1 ()
    {
        local g=`ruby -v | cut -d' ' -f2`

        if [ -n "$1" ]; then
            printf "$1" "${g}"
        else
            printf "(%s)" "${g}"
        fi
    }

    export PS1='\u@\h$(__ruby_ps1):\w\$ '

OSDC.fr - Schedule

Samedi 9 et dimanche 10 octobre 2010 (dans 8h, en gros) si tiendrons la 2eme édition de l'OSDC.fr à la Villette.

Afin de bien préparer mon week end, et en volant une idée originale de Sunny, j'ai identifié les présentation que je voulais suivre à grand renfort de monospace.

1 caractère == 5 minutes
[A] : Agora
[N] : Classe Numérique
* : durée de la présentation
- : je serais à la présentation du dessus

Samedi matin : 
10h00 [A] Discour
**10H10
  10h10 [A] Presentation sponsors
  *****10h35
        10h40 [A] Nouveautés de la version 9 de PostgreSQL
        ********11h20
        --------
        10h40 [N] Listen and look at your PHP code‎
        ********11h20
                 11h25 [A] Introduction à Riak
                 ****11h45
                 11h25 [N] COMET, l'autre direction du web‎
                 ****11h45
                 ----
                  11h50 [A] Présentation de Gephi, logiciel de visualisation de graphes‎
                  ********12h30
                  --------
                  11h50 [N] Présentation de Symfony2
                  ********12h30

Samedi après midi :                
14h [A] Organisation du projet PostgreSQL‎
********14h40
--------
14h [N] Services web SOAP et REST avec symfony‎
********14h40
         14h45 [A] Wrangling Git: Advanced Tips and Tricks‎
         ********15h25
         --------
         14h45 [N] Plone 4, le CMS haut de gamme‎
         ****15h05
             15h05 [A] Comment déployer des démos Drupal, Plone ou OpenERP en 1 clic‎
             ****15h25
                  15h30 [N] Git::Repository: contrôler Git depuis Perl‎
                  ********16h10
                  15h30 [N] Choisir un outil CMS‎ 
                  ********16h10
                  --------
                              16h30 [A] ooc
                              ********17h10
                              --------
                              16h30 [N] Plack
                              ********17h10
                                       17h15 [A] NodeJS
                                       ********17h55
                                       --------
                                       17h15 [N] Le développement web avec Perl Dancer
                                       ********17h55


Dimanche matin :
10h00 [A] Accueil
**10h10
--
  10h10 [A] Présentation du langage Clojure‎
  ****10h30
  ----
  10H10 [N] Can we beat Perl hash table‎
  ****10h30
       10h35 [A] Hard-core bug reporting‎
       ****10h55
       10h35 [N] Spore, une spécification pour des clients ReST‎
       ****10h55
       ----
             11h05 [A] Tracing and profiling production code with SystemTap‎ 
             ********11h45
             11h05‎[N] Redis
             ********11H45
             --------
                      11H50 [A] Chef: cuisiner ses infrastructures‎
                      ********12h30
                      11h50 [N] Introduction à Smalltalk‎ 
                      ********12h30
                      --------

Dimanche après midi :
14h [A] Langage de programmation Go‎
********14h40
--------
14h [N] Web Development with Seaside‎
********14h40
         14h45 [A] Perl 6: there's some madness to the method after all‎
         ********15H25
         --------
         14h45 [N] Développement dynamique avec Pharo‎
         ********15h25
                  15h30 [A] Perl 6 Signatures: The Full Story‎
                  ********16h10
                  15h30 [N] Programmer des robots et des systèmes embarqués avec Smalltalk‎
                  ********16h10
                  --------
                             16h25 [A] Taking Rakudo Forwards: What I'm Hacking On‎ 
                             ********17h05
                             16h25‎[N] L'animation web en demo‎ 
                             ********17h05
                             --------
                                      17h10 [A] Présentations éclairs‎
                                      ********17h50
                                      --------
                                      17h50 [N] Discours de clôture‎
                                      **18h00
                                      --

Thermomix

Pour moi le Thermomix était un robot de cuisine des année 80 pour réduire en bouilli n'importe quel aliment. Un peu comme le Blender, sauf que le Blender, lui broie aussi des iPhones et des lingots d'or.

En fait le Thermomix est maintenant un formidable outil de cuisine à tout faire. La preuve en est, ce plat préparé par ma nouvellement belle-soeur, Claire. Pâtes, haché de légumes vapeurs et coulis de tomates. Le tout fait au Thermomix. Mais à quoi servent les casseroles ?

Et en plus c'est bon.

La montagne, ça vous gagne.

En septembre dernier, j'avais déjà fait une tentative. Concours de circonstances professionnelles et privée, des nuits blanches ou presque, je n'étais pas en forme. Et puis la course était plus dure. J'avais eu du mal à aller jusqu'à Adèle Planchard, et la glace bleue de fin de saison m'avait effrayé.

Cette fois ci ce fut différent. Bien préparé, bien en forme, en début de saison. C'est plus simple il y a plus de neige. Alors j'y suis arrivée, au sommet, en haut de l'Aiguille du Tour.

D'abord au refuge Albert 1er, bien plus accueillant qu'Adèle, pour y passer la nuit. Puis, le ledemain, au col supérieur du Tour après une belle pente en neige. Enfin l'escalade vertigineuse du pic.

Pour les curieux, il y a des photos pour ceux qui ont une vie privée et ceux qui n'en n'ont pas.

Building a streaming mp3 player

I wanted to write a post on an open source old initiative to build Flash application without any Adobe stuff : mtasc. This is for later.

For a professionnal project, I had to make a mp3 streaming player for some famous french radios. And remember I hate Flash.

I was tempted to try it with Javascript, you know, with something like :

<script>
function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
}
</script>

And then :

<embed src="success.wav" autostart=false width=0 height=0 id="sound1" enablejavascript="true" />
    <form>
        <input type="button" value="Play Sound" onClick="EvalSound('sound1')">
    </form>

But even if I wasn't sure that stremed mp3 (you know, endless files) were compatible with this, some Facebook specific required features prevent me to go further. I had to use Flash.

Since I don't have any licence for using Flash IDE, I've found mtasc. And started to code the player with actionscript 2. The code to load and play a sound is pretty simple :

public class SoundPlayer {

    private var _sound:Sound;
    private var _soundUrl:String;

    public var isPlaying:Boolean = false;
    public var isLoaded:Boolean = false;

    public function SoundPlayer(soundUrl) {
        _soundUrl = soundUrl;
    }

    public function preLoadSound():Void {
        this._sound = new Sound();
        this._sound.loadSound(_soundUrl, true);
    }

    public function play():Void {
    if (!this.isLoaded) {
        this.preLoadSound();
    }

    if (!this.isPlaying) {
        this._sound.start(0, 1);
    }

        this.isPlaying = true;
    }

    public function stop():Void {
        this._sound.stop();
        this.isPlaying = false;
        this.isLoaded = false;
    }
}

And this was good. We went to test it on various computer configurations and it apear that some plugins on Internet Explorer 7 and 8 where causing the browser to freeze and relaunch. We identified this list of plugins, but I'm sure there is some others:

  • WsftpBrowserHelper Class
  • RealPLayer Downloader and record
  • AcrolEHlprObj Class

At first, I thought it was mtasc that didn't compile properly the Sound object, but I tried to compile it with the Flash IDE under the latest Flash versions (> 10) and that didn't resolve the bug.

The answer was to translate the code from ActionScript 2 to ActionScript 3. ActionScript 3 add a new Sound class and Event listener to control it. The code in ActionScript 3 is something like:

package streamPlayer {

    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.media.SoundTransform;
    import flash.media.SoundLoaderContext;
    import flash.net.URLRequest;

    public class SoundPlayer {
        private var _sound:Sound;
        private var _channel:SoundChannel;
        private var _soundUrl:String;

        public var isPlaying:Boolean = false;
        public var isLoaded:Boolean = false;

        public function SoundPlayer(soundUrl) {
            _soundUrl = soundUrl;
        }

        public function preLoadSound() {
            this._sound = new Sound();
            var req:URLRequest = new URLRequest(_soundUrl);
            var context:SoundLoaderContext = new SoundLoaderContext(100, true);
            this._sound.load(req, context);
        }

        public function play() {
        if (!this.isLoaded) {
            this.preLoadSound();
        }

        if (!this.isPlaying) {
            this._channel = this._sound.play();
        }

            this.isPlaying = true;
        }

        public function stop() {
            var transform:SoundTransform = this._channel.soundTransform;
            transform.volume = 0;
            this._channel.soundTransform = transform;
            this._sound.close();
            this.isPlaying = false;
            this.isLoaded = false;
        }
    }
}

And it work perfectly well!

Timezone, one of the developer's plagues

Timezones, along with charset and multi-browser support, are a pain in the ass to deal with.

With rails, since 2.1, timezones are supported by default via the config.time_zone option :

# config/environment.rb
config.time_zone = ‘UTC’

You can configure it to something else like :

# config/environment.rb
config.time_zone = 'Paris'

Or in the controller, per user basis :

# controllers/application.rb
before_filter :set_time_zone

def set_time_zone
    Time.zone = @current_user.time_zone if @current_user
end

With all this, rails and active record handle timezones for you. But be very careful when building SQL queries by hand.

ActiveRecord converts dates to UTC timezone before saving them to the database, and convert them back to the current timezone when you load the record from the database. And this can lead to something strange when doing queries like:

User.all(:conditions => ["created_at > ?", Date.today.at_beginning_of_day])

ActiveRecord converts date, but only when saving or loading records. But you can deal with it if you don't forget timezones:

User.all(:conditions => ["created_at > ?", Time.zone.now.at_beginning_of_day])

Something strange is that Rails adds timezone support to the Time class, but not to the date calculations:

>> Time.zone = 'Paris'
>> Date.today.to_s(:db)
=> "2010-02-05"
>> Time.now.to_s(:db)
=> "2010-02-05 00:07:49" # The same date everywhere
>> Time.zone.today.to_s(:db)
=> "2010-02-05"
>> Time.zone.now
=> Fri, 05 Feb 2010 00:06:13 CET +01:00 # All is right here

Let's make some calculations :

>> Time.zone.today.at_beginning_of_day.to_s(:db)
=> "2010-02-05 00:00:00" # Seems to be ok, but
>> Time.zone.now.at_beginning_of_day.to_s(:db)
=> "2010-02-04 23:00:00" # Woot ! the database is still yesterday !

Something you can do if you absolutely need to use Time.today (something stolen from Barry Hess):

class ::Date
  def beginning_of_day_in_zone
    Time.zone.parse(self.to_s)
  end
  alias_method :at_beginning_of_day_in_zone, :beginning_of_day_in_zone
  alias_method :midnight_in_zone, :beginning_of_day_in_zone
  alias_method :at_midnight_in_zone, :beginning_of_day_in_zone

  def end_of_day_in_zone
    Time.zone.parse((self+1).to_s) – 1
  end
end

Facebook Developer Garage - LeWeb09 edition

Yesterday, tuesday december 10th, took place at LeWeb09 a Facebook Developer Garage.

It's an event where local Facebook Application and Facebook Connect developers join together and share on their works. This year, a team of Facebook representatives came from the US to meet local developers and answer specific questions. As a social marketing agency, Sociabliz was naturaly there to share its experience of Facebook development.

I gave a talk on YAPS and other tools i've build to encourage Javascript based UI over Flash based UI in Facebook Application. You can find here the slides of Deep into FBJS. All the event was also live on UStream so you can watch it at this url : http://www.ustream.tv/recorded/2843545 (talks start around 0:50, mine is between 1:19 and 1:35).

The live demo can be found on the yaps demo application

I hate watching me again, I feel so stupid. My english seems so bad, I'm kind of ashamed. Speaking english in front of a hundred people was much harder than I expected. Finding the good words is sometimes painful. Anyway, the talk was good, everybody understood it or at least the slides where helpful.

Berlin & blockcamp

Nan, y a pas de rapport. J'suis en retard, c'est tout.

Berlin

Le week end avant-dernier (20-23 novembre), Charlotte et moi sommes parti passer 4 jours à Berlin.

En un mot : unwahrscheinlich !

Bon, pour faire vite, façon carte postale, nous avons décollé de Paris à 6h30, pour atterrir à Berlin vers 8h. Ensuite, train vers le centre ville, visite de l'hôtel et dépôt des bagages, petit dèjeuner à Hackesher Markt, traversée de l'île des Musée, descente de Unter den Linden jusqu'à la porte de Brandebourg, visite du Bundestag et de sa coupole, admiration de la Hauptbahnhof, petite bière au café de la Hamburger Bahnhof et visite de celui ci (musée d'art contemporain). Pour le soir nous avons rejoins Manu accompagné de kiddik et de Johnathan (venus de Copenhague) pour aller manger des raviolis russes dans un resto bulgare, puis pour aller boire un coup non pas au huit millimètre, mais dans un autre bar, typé ancienne Allemagne de l'est.

Le lendemain, levé assez tard pour aller manger des currywurst, voir Checkpoint Charlie, sortir en courant du musée du même nom, vagabonder du coté d'un morceau de mur puis entre les tours de Potsdamer Platz, admirer le chapiteaux du Sony Center et les pub géante d'Intel et Microsoft, et enfin aller boir une bière avec le même Manu dans un bar pas pour touristes dans les tréfonds de Rosenthaler Strasse. Ensuite après une tentative raté de resto, nous avons mangé italien sur la même rue et bu dans un bar à la serveuse sympathique.

Le dimanche, levé plus tôt, nous avons entrepris une journée musées, avec l'ancienne galerie nationnalle, la nouvelle galerie nationnalle et la pinacothèque. Nous avons loupé de peu Bill Kaulitz pour la première d'Arthur und die Minimoys, pour aller manger dans un White Trash Fast Food à la carte hilarante et boire des tequila sunrise et des gin tonic dans le même bar que la veille.

Enfin, le dernier jour, après une visite d'un squatte artistique sur Orianenburger Strasse, nous sommes allés jusqu'à Bellevue et traversé le Tiergarten (en passant par la colonne de la victoire) pour rejoindre Potsdamer Platz. Enfin il a fallu prendre le train pour l'aéroport, non sans encombres du à des travaux et des changements de ligne en teuton. L'atterrissage à Orly fut un peu mouvementé pour cause de météo défavorable et le pilote s'y est pris à deux fois pour poser l'appareil sans dégât.

Pour les photos, c'est sur facebook, avec les commentaires, ou sur imeuble, sans rien.

Blockcamp

Rien à voir, puisqu'il s'agit ici d'un série de mini conférences portant sur Ruby et sur Smaltalk.

Samedi dernier (28 novembre), cet événement a réuni à l'Insia des gens de ces deux mondes. J'y ai rencontré oz, Jean, Renaud, Ol, Damien et d'autres habitués comme Jean Francois (merci à lui pour l'organisation) et Shingara.

J'y ai parlé de ruby et de temps réel. L'effet démo de ce sujet que je ne maîtrisais pas n'a pas manqué : impossible de connecter un vidéo projecteur et la carte Arduino ne répondait pas aux signaux d'upload... Malgré cela, les discussions qui s'en sont suivis ont été très intéressantes. Pour ceux qui veulent, les slides sont là.

Dans la journée, j'ai pu assister à une démo de l'étrange Seaside et de ses copains Magrite et Pier, ainsi qu'à eux présentation d'Ol sur MacRuby et Chef. Je regrette un peu de ne pas m'être plus intéressé au Smalltalk.

Il est à noter que c'était le premier événement que Sociabliz sponsorisait. J'espère que ce ne sera pas le dernier.

Un ami venu du Luxembourg a assisté à une partie des conférences et nous nous sommes rejoint ensuite pour aller manger grec à Cluny et écouter les Bec Bien zen à la péniche Bateau El-Alamein.

Away we go to tag

We went to see Away We Go. It was a good movie. Showing the joy and the sadness to be a familly, to have kids, to be in love with somebody. And the soundtrack is huge!

On our way home, we met Nicolas.

Nicolas is in love with Elsa. Elsa comes back from Lyon tomorrow, and tomorrow, Nicolas wants to be sure Elsa knows about his feelings for her. So we found him painting the wall in front of her window. And we helped him complete his work by putting stickers in the shape of letters.

Look at our first tag! Our first work of art!

Drunk (almost)

D'abord, on va là.

Ensuite, on boit. Du cidre, parce que la calédonian et la guinness c'est pas bon. Il y a là quelques potes, un pote d'un pote, une petite copine. Et du cidre, encore. Tout le monde n'est pas venu, la fête sera plus folle encore. On sort, on mange on va dans un autre bar, on revient.
On se moque d'une fille, elle me demande de la retrouver sur Facebook. Charmant, mais non, merci. En d'autres circonstances peut être.

 

 

 

 

 

On rentre, on se dit que dans 3h, on ouvre l'Apple Store. On voit ça et on prend un vélo.

Dodo.

Et on loupe l'ouverture de l'Apple Store. C'est pas grave il y avait trop de monde.

Custom facebook ajax will_paginate renderer

will_paginate is one of the most used rails plugin. It take care of pagination of a large collectoon of item, automatically limiting records to display. It also display a pagination bar, with next, previous and numbered pages.

The fact is that by default, links are just normal link to relative path. It what you want most of the time. Some times you want some AJAX. There is many different way to do it. But some times, you want some AJAX in a Facebook Application...

Here is how I do it.

# In RAILS_ROOT/app/helpers/remote_link_renderer.rb
class RemoteLinkRenderer < WillPaginate::LinkRenderer
  def prepare(collection, options, template)
    @remote = options.delete(:remote) || {}
    super
    @options[:params].is_a?(Hash) ? @options[:params].merge({:only_path => false, :canvas => false}) : @options[:params] = {:only_path => false, :canvas => false}
  end

protected
  def page_link(page, text, attributes = {})
    @template.link_to(text, "#", :onclick => "#{@remote[:method_name]}({url: '#{url_for(page)}', container: '#{@remote[:container]}', parameters: { type: '#{@remote[:type]}' }}); return false;")
  end
end

will_paginate allow us to use different renderer in order to customize our pagination. I've build one here. The prepare method is called by will_paginate to let us initialize our renderer before rendering anything. The main thing is to prepare url_for to return absolute, non canvas url because the Facebook FBJS AJAX proxy doesn't allow anything else.

In the page_link method, we generate links displayed by will_paginate. We can't set the href attribute to the url because again, the Facebook FBJS AJAX proxy doesn't allow anything but # here. And since in Profile Boxes and Tabs, we can't use onLoad event, we use onClick in order to call our AJAX builder. Parameters of that function are specific to my need, but it's just to show you that we can pass in variables and build a custom link.

Here is a sample code showing the way to specify our renderer to will_paginate.

# Somewhere in the view
<%= will_paginate users, :renderer => 'RemoteLinkRenderer' , :remote => {:method_name => 'ajaxizer', :container => container, :type => type}, :previous_label => "precedent", :next_label => "suivant" %>

Paris Carnet

Hier soir, Charlotte et moi sommes allé à notre premier paris-carnet.

Quel drôle d'événement que ce paris-carnet ! Il y a ce bar, où quelques blogueurs de Paris et d'ailleurs se rencontrent. Il y a ces blogueurs célèbres et influents. Il y a nous au milieu, anonyme. Il y a quelques têtes connues. Il y a beaucoup de geeks, mais aussi des gens normaux. Il y a cette bière qui n'a pas le même goût parce qu'on parle. Il y a ces rencontres

Et c'est pratique parce que c'est pas loin de chez nous. Peut-être qu'on y retournera.

Stage Ruby/Rails

Allez, un peu de pub.

Pour aller directement au but : nous cherchons un stagiaire pour du développement ruby (ruby on rails principalement) entre septembre 2009 et juillet / août 2010.

Sociabliz est une jeune société de marketing spécialisée dans les réseaux sociaux (Facebook principalement, mais aussi MySpace, Twitter, ...) basée dans le centre de Paris.

Nous avons plus de 3 ans d'expérience web et ruby et nous sommes maintenant riches d'une expérience d'un an dans le développement d'applications à forte composante sociale.

Nous participons beaucoup aux événements sur le sujet dans les environs de Paris (tant du coté spectateur que du côté acteur) et sommes également actifs dans le domaine de l'open source pour partager nos connaissances.

En terme de sujet de stage : il s'agira de rejoindre une équipe réduite, jeune et dynamique, pour participer au développement et à l'optimisation technique d'applications web. L'objectif est de proposer des applications évolutives et le plus intégrées possible à l'expérience Facebook habituelle.

En parallèle de ce projet, quelques chantiers internes annexes seront à mettre en place (outils analytiques, ...).

Les chantiers sont nombreux et le candidat sera amené rapidement à être responsable de certains d'entre eux de manière autonome (mais toujours accompagné par un référent en fonction du sujet).

Tout cela en Ruby on Rails, dans des méthodes agiles et en TDD (test driven development).

Une rémunération est prévue, variable suivant le profil du candidat.

Vous pouvez nous contacter à : contact [chez] sociabliz [point] com.