Mirmo Dynamics

To content | To menu | To search

Thursday 21 January 2010

The 2.0 resume

With the emergence of new web-based developper tools like Github and Stack Overflow. Building a concrete resume has never been so easy.

If you're French (or maybe there have been attempts as well in other countries but I've not heard of them), and working in IT, you must have already seen those crappy video-resume attempts, so-called 2.0 resumes meant to show off one's mastering of bleeding edge technologies. Why were those attempts miserable failures ? Apart from being ridiculous, they did not demonstrate anything. Anyone can fire up any newbie-friendly video editing software and come up with a video or flash based resume, or even build a dynamic one using PHP, python, javascript or something.

With Github for example, not only can they see the result of your work, but they can see your real work, the actual code you wrote, the project you participed in, the actual code you contributed. In a nutshell, they can truly see what you're worth (that is, technically speaking). Stack Overflow, and LinkedIn Q&A before it, etc, has the same quality. They make you go public.

In an industry where profiles and adaptability matter at least as much as pure skill, having a way to see how people work, what project they get involved in and how they behave with fellow developers is an invaluable resource for recruiters. So here's one piece of advice I'd give to any developer looking forward to being hired: work your numeric identity:

  • Answer questions on Stack Overflow and/or LinkedIn Q&A
  • Host your projects on public websites like GitHub or CIA.vc
  • Contribute to opensource projects (not only it permits you to show off your skill, but you are going to learn stuff as well)

And Don't forget to include them in your online resume through RSS/Atom feeds or direct link to your profiles!

Thursday 10 December 2009

Introducing IPS, a PHP interactive shell

It's been a while now since I first looked up for an interactive PHP shell. There quite a lot of projects in the wild, such as PHP_Shell, PHPInteractiveTerminal, iphp, phpsh, etc, but none that would actually satisfy me (either they didn't fulfill my requirements or they were only toy projects or...). Until today ! I am very pleased to announce PHPInteractiveShell, a (nearly) full-featured interactive shell for PHP.

Key features include:

  • Fault tolerant: will not die on fatal errors
  • Readline support (only history for now)
  • Multiline support: start your if on a line and finish it on another
  • Plugins support: easily extend the shell capabilities
  • Bootstrap support: easily setup an environment inside your shell
  • Config file support: easily configure your shell behavior

The whole thing is still in beta stage, so feel free to fork it, play with it and report any issue!

Tuesday 1 December 2009

The symfony 2009 advent calendar: "More with symfony"

I am very pleased to relay that news: the symfony 2009 advent calendar is now available on the symfony project website:

It has been a tough work from all the people involved in this project (including me ;), and I'm really happy to see that it's finaly on the tracks :-)

Fri 23 October 2009

New blog style

Unless you read this from an RSS aggregator, you have certainly noticed the new style on this blog, thus making this post useless (that is why I actually hope you read this through an aggregator).

Ok so this might not be the prettier blog style you've ever seen, but I kind of like it, I made it myself (actually, it's heavily inspired from readability) and it's, well, readable.

Please keep your comments for yourself, unless you really have an usability problem :-)

ps: this is also an I'm still alive post.

Thursday 15 October 2009

Symfony Pot, le mercredi 21 octobre à Paris

Discuter de symfony entre geeks autour d'une (ou plusieurs) bière(s), ça vous tente ? Alors rendez-vous le mercredi 21 octobre au Hall's Beer, un bar a bière fort sympathique à la carte des bières fort conséquente, situé d'une manière fort convenante à Chatelet les Halles, 68 rue Saint Denis très exactement (lien google map pour les fainéants). On peut aussi y manger pour ceux qui ont faim.

Début des hostilités à 19h. Venez nombreux !

PS: ceux qui viennent auront l'occasion de discuter d'un projet francophone de grande envergure autour de symfony (il y a un indice caché dans ce post).

Wednesday 14 October 2009

Dynamic directory with sfValidatorFile

Say you have a form with a file upload (field image of your model for example), and that you want to save your file in a directory depending on its filename. For example, the file foobar.jpg shall be stored in fo/ob/foobar.jpg. All you have to do is implement a generateImageFilename method in your model:

  public function generateImageFilename(sfValidatedFile $file)
  {
    $filename = $file->generateFilename();
    return sprintf('%s/%s/%s', substr($filename, 0, 2), substr($filename, 1, 2), $filename);
  }

And voila !

For more information on what's happening there, see sfFormDoctrine::saveFile() (around line 510 of plugins/sfDoctrinePlugin/lib/form//sfFormDoctrine.class.php)

Wednesday 1 Jul 2009

Help Symfony: fix one bug per day and win some gifts !

Today is the first day of the "1 day / 1 ticket" Symfony event.

Starting from today, each ticket you close (or help closing) from this list by either submitting a patch, submitting unit tests, etc will earn you points. At the end of the month, gifts are attributed to people with the most points.

This is a fun and exciting way to help your (hopefuly) favorite opensource project ;)

For more details on rules, please see the official page.

May 15 Jun 2009

subversion, tags and externals

It's been brought to my attention today (by my fellow developper hartym) that there is a HUGE problem with tags in subversion.

The problem is very simple, when you create a tag for your project, and that your project uses svn:externals (quite a common situation), externals in the tags ARE NOT FROZEN. Which means that, if you checkout your tag at a T time, and an external gets modified at T+x, a checkout at T+x will not be the same than the one at T.

Wow.

I'm going to seriously consider switching to git.

Sun 14 Jun 2009

Debriefing Symfony Live 2009

Bon ben voilà, vendredi dernier était le grand jour pour moi: ma première conférence. Que dire, sinon que les conditions n'auraient pas pu etre pires ? J'avais déjà un peu les chocopétoches, parceque perso parler en public, j'ai un peu du mal, je n'étais pas non plus entièrement satisfait des slides, mais j'imagine que c'est normal, et puis je parlais devant pas mal de personnes qui m'impressionnent un peu. Bref, autant dire que vers 8h30 (ma conf étant a 9h), je faisais pas trop le fier.

8h30, c'est l'heure à laquelle mon portable a sonné pour m'annoncer que mon co-conférencier serait à la bourre. Ok super, c'est lui qui a la dernière version des slides, c'est lui qui fait la première partie, wow, trop bien. Ni une ni deux, j'en parle à mon boss, qui décide de swapper sa conf (10h) avec la mienne. Le coeur léger (malgrès le fait que parler après mon boss, ça me foutait un peu les boules (il parle très bien)), je m'en vais décharger ma haine sur twitter.

8h58, mon boss vient me voir: écoute, les gens viennent voir symfony 2, là y'a pas tout le monde, si on leur dit a 10h quand ils vont arriver que ben désolé symfony 2 c'était à 9h finalement, ça le fait pas, donc tu vas faire ta conf. Décomposition. Mais je vais remplacer Hugo dans ta conf.

Ok. Très bien. Je vais brancher mon pc sur le rétro, obligé de rebooter sous windows pour avoir la sortie VGA qui marche (on ne ricane pas dans le fond, et oui ça doit surement marcher sous linux, mais pas trop le temps de chercher là), je ressors le vieux PDF des slides de y'a un mois, et zou, on part en petite impro. Fabien (mon boss) commence à parler, c'est chouette, ça se passe bien, jusqu'a environ une vingtaine de slide, où on se rend compte que, ben, y'a plus de slides. Gros gros moment de solitude. A partir de là, c'est freestyle complet.A mon tour de parler, la gorge désséchée, une petite tremblote de la main qui tient le micro, mais ça va, j'arrive quand meme a débiter mon petit laius, à quelques oublis près.

On finit sur la petite séance de questions, qui s'est plutot bien passé (merci à la personne qui a parlé de code coverage, c'est typiquement le truc qui était dans les slides et que j'ai oublié).

Bref, au final, je ne suis pas mort, personne ne m'as hué à la sortie, et ça me fait une expérience vraiment enrichissante du blablatage en public.

Quelques leçons que j'ai tiré de tout ça:

  • toujours, TOUJOURS, etre pret à etre laché seul dans la nature, meme si on a une confiance aveugle en son co-conférencier, on ne sait jamais ce qui peut arriver
  • NE PAS se mettre devant le rétroprojecteur, ça illumine
  • parler en public, quand on maitrise assez son sujet, c'est pas si sorcier que ça

Et surtout, ce que je retiendrais le plus: je pense que ce qui me faisait le plus peur avant la conf, c'était le public. Quand on parle en public, on peut penser avoir à défendre son steack, et le défendre contre qui ? le public. Il n'en est rien. On est meme au contraire en position de force par rapport au public, parcequ'on possède une connaissance qu'il convoite (sinon il ne serait pas là). Donc voilà, le public, ce n'est pas l'ennemi, c'est un ami qui nous veut du bien.

Dernière chose: ça me désole vraiment que la conf ce soit déroulée comme ça, et pour m'excuser, je vais publier une petite série d'articles sur les tests unitaires et fonctionnels, avec notament les exemples présents dans les slides qui n'ont pas pu etre montrés. Stay tuned.

PS: Les conférences étaient filmées, elles seront mises en lignes fin de semaine prochaine sur http://www.phptv.fr/

Quelques photos en attendant:

Wednesday 6 May 2009

Speaking at Symfony Live 09

For those not following me on twitter (shame on you), I will be speaking about unit and functional testing in Symfony (with a tiny bit of continuous integration too) at Symfony Live 2009. I will not be alone since my workmate Hugo Hamon will be under the spotlights with me. Also, the talk will be given in french.

Hope to see you there :)

Thursday 2 Apr 2009

SQLSTATE[HY000]: General error: 1005 Can't create table '*' (errno: 150)

You may or may have not already stumbled upon this rather obscure error message (no, I'm not starting a serie on obscures error messages). Well the first thing to think when you encounter this is your foreign keys. This message generally denotes a failure in foreign keys creation, for example when the two columns you are trying to link are not of the exact same type (that is, you can't link an integer(4) to an integer(11)).

Now what if you are absolutely certain that your two columns are of the same type ? I just had the problem with this piece of doctrine schema (simplified for example purpose):

Media:
  columns:
    image:           { type: string(255), notnull: true, unique: true }

ExplorationMission:
  columns:
    probe_image:         { type: integer, notnull: true }
  relations:
    ProbeImage:          { class: Media, local: probe_image, foreign: id, onDelete: 'SET NULL' }

Can you spot the problem ?

It's rather obvious when you know it, but I spent rather some time cursing mysql in vain. The point is that there is a major logic error in this schema. it declares the probe_image as NOT NULL while it gently asks the FK to set it null on delete. See ?

Hope it saves some frustration :-)

Tuesday 31 Mar 2009

Ajax query failing unexpectedly ?

I was gently doing some ajax black voodoo when I came upon this obscure-ish error in my firebug console:

Error: uncaught exception: [Exception... "Component returned failure code: 0x805e000a [nsIXMLHttpRequest.open]"  nsresult: 0x805e000a (<unknown>)"

What the fuck I though. And then after some (useless) firefox rebooting, I decided to ask the all-mighty Google.

No shit, he said, I know what you are talking about, and thou shall find more informations at this place, and to point me to this thread, where you can read the following:

AdBlock Plus was killing it HAH!

And then I disabled AdBlock Plus, and exactly as the writings told, it worked.

May 30 Mar 2009

Customizing actions in symfony's admin generator

A quick tip about symfony's admin generator: if you want to have a custom action, with the following generator.yml bit for example (actions prefixed with an underscore are builtin admin-gen actions):

form:
  actions:
    _delete:  ~
    _cancel:  ~
    _save:    ~
    _save_and_add: ~
    custom: ~

You can totally customize the link generated for this action (to add javascript for example) using the generator helper in your module's lib/ directory:

[php]
public function linkToCustom($object, $params)
{
  return '<a href="#" onclick="console.log(\'woohoo\'); return false;">log woohoo</a>';
}

You get passed the current object as an argument, and whatever parameters you passed in the generator.yml:

    custom: { label: 'WOOHOO' }
[php]
public function linkToCustom($object, $params)
{
  return '<a href="'.url_for($this->getUrlForAction('custom')).'" onclick="console.log(\'woohoo\'); return false;">'.__($params['label']).'</a>';
}

Also, as you can see that standard helpers are available too.

Fri 20 Mar 2009

Symfony Live les 11 et 12 Juin 2009

Sensio Labs organise les 11 et 12 juin l'événement Symfony Live. Voilà tout est presque dit, cliquouillez le lien pour plus d'infos.

Symfony Live Flyer

Wednesday 18 Mar 2009

Automatically cd to a symfony project's root in vim

I made a little vimscript to automatically cd to the project root of a symfony project. It makes it easier for me to use the ctags :-)

"-------------------------------------------------------------------------------
"  Description: Finds and cd to the symfony root of the project
"    Copyright: Copyright (C) 2009 Geoffrey Bachelet
"   Maintainer: Geoffrey Bachelet
"      Version: 1.0
"-------------------------------------------------------------------------------

if exists('find_symfony_root_loaded')
  finish
endif

let find_symfony_root_loaded = 1

if ! exists('find_symfony_root_symfony_executable')
  let find_symfony_root_symfony_executable = 'symfony'
endif

" root detection when opening a new vim seems to work
" only if these two events are bound. not sure why.
autocmd BufWinEnter,BufRead * call FindSymfonyRoot()

function FindSymfonyRoot()
  let l:cwd = GetAbsoluteDirname(@%)
  let l:symfony_root = findfile(g:find_symfony_root_symfony_executable, l:cwd.';')
  let l:symfony_root = GetAbsoluteDirname(l:symfony_root)
  if strlen(l:symfony_root) != 0
    execute 'cd '.l:symfony_root
  endif
endfunction

function GetAbsoluteDirname(path)
  let l:path = a:path
  " gets the dirname
  if !isdirectory(l:path)
    let l:path = strpart(l:path, 0, strridx(l:path, '/'))
  endif

  " makes it absolute
  if match(l:path, '/') != 0
    let l:path = getcwd().'/'.l:path
  endif

  return l:path
endfunction

note for later: add vimscript support to geshi

Or see the highlighted version on gist.

Tuesday 17 Mar 2009

Rewrite rule to add missing www

  RewriteEngine on
  RewriteCond %{SERVER_NAME} !^www\..*$
  RewriteRule ^/(.*)$ http://www.%{SERVER_NAME}/$1 [L,QSA,R=302]

From the manual, using %1 as a back reference from the RewriteCond in the RewriteRule should work, but it didn't on my installation. Weird.

Thursday 12 Mar 2009

How to render a partial in an action with symfony 1.1+

[php]
public function executeFoobar()
{
  return $this->renderPartial('my_partial');
}

This is an attempt to take over the first place on google for the query how to render partial action symfony.

Tuesday 10 Mar 2009

Using the timestamp data type in doctrine fixtures

Please note that to be valid, you have to enclose the value within single quotes. For example, say you have the following (totally useless) schema:

Foobar:
  columns:
    published_at: { type: timestamp }

And you want to create fixtures for this table. You might go this way (please also note that symfony allows php in fixtures files):

Foobar:
  foobar_1:
    published_at: <?php echo time(); ?>

Which won't work, since the Doctrine_Validator_Timestamp expects a date in the Y-m-d H:i:s format. So maybe you'll try this one:

    published_at: <?php echo date('Y-m-d H:i:s'); ?>

Which still doesn't work, since the value gets converted to an unix timestamp.

The right way is (note the enclosing single quotes):

   published_at: '<?php echo date('Y-m-d H:i:s'); ?>'

Yay o//

This behavior is explained in this ticket might help.

Sun 8 Mar 2009

having fun with vim, an event tracker

The idea of this script came by realizing that the main reason I (almost) never fill my timesheet, is because I just forget it. How easier could it be if my editor (namely vim) could fill it for me ? Or at least, help me fill it. This script is meant to help this process. It will hook to every configured event (in the code below, BufRead and BufNewFile) and add a log line to the log file. Easy heh ? Of course, the script it self won't be of much use, I'll have to add some more events to track as well as writting some kind of frontend for it, with reporting & all.

if exists('trackloaded')
  finish
endif

" list of autocmd events:
" http://www.vim.org/htmldoc/autocmd.html#autocmd-events
let trackevents = ['BufRead', 'BufNewFile', 'BufEnter', 'BufWrite', 'BufLeave']
let trackfile   = '/tmp/timetrack.dat'
let trackloaded = 1

for event in trackevents
  execute 'autocmd '.event.' * call Track("'.event.'")'
endfor

unlet event

function Track(event)
  let l:filename = @%
  if l:filename != g:trackfile
    if match(l:filename, '/') != 0
      let l:filename = getcwd().'/'.l:filename
    endif
    silent execute '!echo `date +\%s` '.a:event.' '.l:filename.' >> '.g:trackfile
  endif
endfunction

You might note from this snippet that I'm not very comfortable with vimscripting :-) If you have a better way of doing this (I'm thinking mostly about the file writting here), don't hesitate to tell me.

Wednesday 25 February 2009

symfony api opensearch plugin

In case you didn't notice, as of today (well, yesterday really) the symfony's api documentation features an opensearch plugin with autocompletion, that you can use straight from the comfort of your favorite browser (given that it supports the opensearch standard, which is the case for at least firefox and IE, although you won't get autocomplete in this last case).

More informations on the symfony blog.

- page 1 of 39