Working with people living in different timezones.

August 17th, 2010 by Jérôme 2 comments »

I just spent the last 10 days working for a customer in the USA (in the Alexa top 500 in the US actually) and I was “debriefing” so why not share the experience
feedback ? :) The problem was how to work with people living in different timezones ?

The following list of could help you :

  1. http://www.timeanddate.com/ is priceless, especially the meeting planner.
  2. Send emails for everything. That could be seen as over communication but it is preferable to send an email to say “Hey I get this problem” and then send an email 2 hours later to say “Hey I fixed this problem” rather that saying and let people you work with without informations that might be relevant later during the day (or the week). Especially if people need this information during your sleep hours.
  3. Be available. That does not mean you have to wake up at 5am and got to sleep at 11pm, that just means that if your collaborator(s) need you for a couple of minutes then do not refuse a call unless you have a really good argument/excuse. You and your collaborators know that at some point you (or them) will have to either wake up (very) early or go to bed (very) late. People usually respect that and meetings tend to be quick and focused.
  4. Think about the next day. The great thing when you work with different timezones is that production (almost) never stops. So you can go to bed after
    your day and when you wake up in the morning you see new stuff being done, new features implemented. That is a great productivity booster, but sometimes that can get really confusing. So when you work on monday, think about what you will have to do on tuesday and send an email in order to synchronize with the rest of the team in order to avoid any overlap.
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Generating an execution trace for a PHP script with Dtrace

August 12th, 2010 by Jérôme No comments »

Here is a small Dtrace script I used to generate the execution trace of a PHP script running in a terminal :
(executiontrace.d)

#! /usr/bin/dtrace -s
#pragma D option quiet
#pragma D option switchrate=10

BEGIN
{
    printf("TRACE START [%Y]\n", walltimestamp);
    self->depth      = 0;
    self->time_last  = 0;
}

/**
 * program begins, so {main}
 */
php*:::function-entry
/copyinstr(arg0) == ""/
{
    printf(
        "%d\t -> {main}() %s:%d\n",
        /* well, just zero :-)  */
        0,
        /* source file, you can use basename(copyinstr(arg1)) if needed */
        copyinstr(arg1),
        /* line number*/
        arg2
    );

    self->time_last = timestamp;
}

/**
 * start any other function that is not {main}
 */
php*:::function-entry
/copyinstr(arg0) != ""/
{
    self->depth += 2;

    printf(
        /* string format */
        "%d\t %*s %s%s%s() %s:%d\n",
        /* time delta (microseconds)*/
        (timestamp - self->time_last) / 1000,
        /* indentation   */
        self->depth, "->",
        /* class name, if available */
        copyinstr(arg3),
        /* scope operator, if available */
        copyinstr(arg4),
        /* function name, always available */
        copyinstr(arg0),
        /* source file, you can use basename(copyinstr(arg1)) if needed */
        copyinstr(arg1),
        /* line number*/
        arg2
    );

    self->time_last = timestamp;
}

/**
 * end of any other function that is not {main}
 */
php*:::function-return
/copyinstr(arg0) != ""/
{
    self->depth -= 2;
}

END
{
    self->depth = 0;
    printf("TRACE END [%Y]", walltimestamp);
}

It looks like an Xdebug trace (without the memory usage / delta) but since Dtrace and Xdebug do not operate at the same level the results are quite different.

If you want to test this script you can use for example the following (nestedfunctions.php) :

<?php
function parent()
{
 new DirectoryIterator( __DIR__ );
 child();
}
function child()
{
 sleep( 1 );
}
function launch()
{
 parent( );
}
function foo(){}
launch(  );
foo();
sleep( 2 );
foo();
launch();
foo();
?>

And by running the following command :

sudo dtrace -s executiontrace.d -c "php nestedfunctions.php"

You should get a result like this (do not forget to hit <Ctrl-c> in order to exit from Dtrace).

TRACE START [2010 Aug 12 10:44:27]
0     -> {main}() [...]/testnestedfunctions.php:0
669     -> launch() [...]/testnestedfunctions.php:21
24       -> parent() [...]/testnestedfunctions.php:16
37         -> DirectoryIterator::__construct() [...]/testnestedfunctions.php:5
286         -> child() [...]/testnestedfunctions.php:6
21           -> sleep() [...]/testnestedfunctions.php:11
1000158     -> foo() [...]/testnestedfunctions.php:22
32     -> sleep() [...]/testnestedfunctions.php:23
2000097     -> foo() [...]/testnestedfunctions.php:24
32     -> launch() [...]/testnestedfunctions.php:25
21       -> parent() [...]/testnestedfunctions.php:16
32         -> DirectoryIterator::__construct() [...]/testnestedfunctions.php:5
141         -> child() [...]/testnestedfunctions.php:6
20           -> sleep() [...]/testnestedfunctions.php:11
1000111     -> foo() [...]/testnestedfunctions.php:26
^C
TRACE END [2010 Aug 12 10:44:34]

I tried to add as much comments as possible in order to make the script clearer.

Please note that if you run this script on production you will get a lot of output because the script does not filter on any pid so Dtrace will aggregate results across multilple Apache processes. It is up to you to use the correct predicate to filter on the PID you want in order to limit the result set.

Hope that helps :)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

A comparison of the difference between the french and the US culture in IT.

August 9th, 2010 by Jérôme 2 comments »

Disclaimer :

This blog post is based upon my experience, it does not pretend to generalize anything for one culture or another.

I have the chance to work for awesome customers in both France and the USA and that gives me the opportunity to work with people with different cultures and mindsets. So I thought that could be interesting to write down my experience with these two cultures and try to describe the differences.

There is one sure thing : American people care about IT, not only because it makes your life simpler or because this is serious business, but also because they simply invented it. If you have a look at the last decade you’ll see that almost any major technological invention comes from the USA. If you have a look at the Alexa top 20, you’ll see that almost all websites are from American companies.

American people are what I call superlative oriented, everything has to be great, awesome, excellent etc, etc. They are in constant need for heroes and rock stars. In my opinion this is a bit too much, but that is the way they are and I respect that.

On the project management side, one great thing is that most project managers (I have worked with, cf the disclaimer ;) ) actually have a real technical background. I remember one day there was a problem on a big website and the editor in chief (yes, the editor in chief, they guy who care about contents, not tech) told me something like “I think there is an issue with mod_rewrite, most likely a regex, can you please have look at it ?”. And guess what ? He was right. If I compare with my experience in France, there was a small problem with an import system that had to be fixed quickly and the project manager told me pedantically “There must be an infinite loop somewhere” …

There is one main difference between the american and the french culture and I am not sure it will disappear in the next few years. American people have a deep respect for developpers (or engineers the word does not really matters here) whereas in France being a developper makes you be that weird guy who writes lines of code nobody else have a clue about. No matter what you say you are a “geek” so who would think you say interesting things anyway ? In France real men become project managers. It is acceptable to write code for a few years after being graduated (the lesser, the better) but at some point, you have to “grow up” and be a manager. I actually can not imagine the CTO of a big IT company going to the sysadmin’s office and say them “you are useless”. Think that can not happen in France ? It actually did I was there when that happened and that was not a a small company, that happened at a very big company I used to worked for from times to times.

American people (well, people living in an english speaking country) have an strong (who said unfair ? :) ) advantage, every technical documentation / article / paper, well everything is written in english. If you have a look at how your program is built, it is all in english as well (if/then/else, while, for loop, function names, class names, etc, etc). So programming gets a bit more “natural” because they do not have to do any translation effort. And that gives them the opportunity to dive into any technology in record time.

On the contrary, French people have to make this effort all the time, it is no big deal when you to do this on a daily basis, but still this is not natural. This is why I personally think that the very first language any french developper should know is English, nothing else.

Everything is not of course black and white, and we have the chance to have pretty big websites in France as well like Meetic Dailymotion Netvibes (BTW : I would love to work you :) ) for example. But I am not sure we will see (even though I’d love too) a lot of websites of that dimension emerging quickly in the future in France.

I know this post is a bit messy but this is all I can do for the moment given my spare time. Any feedback welcome :)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Finding syscalls generated by PHP functions with Dtrace

August 4th, 2010 by Jérôme 2 comments »

I wanted to check a list of syscalls that are generated by PHP for a bunch of functions. Dtrace saved the day again, in 10 minutes I had all I needed.

Here is a PHP script you can use for testing (syscalls.php) :

<?php
file_exists( __FILE__ );
file_get_contents( __FILE__ );
chdir( __DIR__ );
dir( __DIR__ );
getcwd();
opendir( __DIR__ );
scandir( __DIR__ );
new DirectoryIterator( __DIR__ );
stat( __DIR__ );
is_readable( __DIR__ );
is_writable( __DIR__ );
file_put_contents('/tmp/foo.txt', 'foo');
?>

And the small Dtrace (syscalls.d) script I used:#!/usr/sbin/dtrace -s

#pragma D option quiet

php*:::function-entry
/pid == $target && arg0/
{
 printf( "%s%s%s\n", copyinstr(arg3), copyinstr(arg4), copyinstr(arg0) );
 self->follow++;
}

syscall:::entry
/self->follow > 0/
{
 printf("  ->%s\n", probefunc);
}

php*:::function-return
/pid == $target && arg0/
{
 self->follow -= self->follow == 0 ? 0 : 1;
 printf("\n");
}

You can test the script by running :

sudo dtrace -s syscalls.d -c "php syscalls.php"

And you should get a list like this (at least on Mac Os X)

file_exists
 ->access

file_get_contents
 ->lstat
 ->lstat
 ->open
 ->fstat
 ->lseek
 ->fstat
 ->read
 ->read
 ->read
 ->close

chdir
 ->chdir

dir
 ->open_nocancel
 ->fcntl_nocancel
 ->__sysctl
 ->fstatfs

getcwd
 ->open_nocancel
 ->fstat64
 ->fcntl_nocancel
 ->close_nocancel
 ->stat64

opendir
 ->open_nocancel
 ->fcntl_nocancel
 ->fstatfs
 ->close_nocancel

scandir
 ->open_nocancel
 ->fcntl_nocancel
 ->fstatfs
 ->getdirentries
 ->getdirentries
 ->close_nocancel

DirectoryIterator::__construct
 ->open_nocancel
 ->fcntl_nocancel
 ->fstatfs
 ->getdirentries

 ->close_nocancel
stat
 ->stat

is_readable
 ->access

is_writable
 ->access

file_put_contents
 ->lstat
 ->lstat
 ->readlink
 ->lstat
 ->lstat
 ->open
 ->fstat
 ->lseek
 ->write
 ->close

If I have time I’ll post more Dtrace scripts useful for analysing what PHP does.

‘Hope that helps :)

Edit :

I fixed a small bug for the DirectoryOperator class.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

(Open)Solaris hosting : any recommendations ?

August 3rd, 2010 by Jérôme 3 comments »

Ok, Zones + Dtrace + ZFS is all I need. I already had the chance to work with Sun servers and they are just awesome. This is why I decided to look for a hosting provider that … provides (Open)Solaris hosting. That can be shared hosting or VPS for now but I hope that in a few month I will need a dedicated machine. Is there anyone who has any recommendation about a particular provider ? I found http://entic.net/OpenSolaris http://www.gridzones.com/ and http://www.connectria.com/solaris.html so far.

By the way why do not more companies provide Solaris hosting offers ?

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Sphinx, documentation made easy

August 1st, 2010 by Jérôme 5 comments »

I just wanted to promote a fantastic documentation tool called Sphinx. I have been using it for more than 6 months now and I am more than happy with it. What makes Sphinx so unique is that it makes actually you love writing documentation I use it for almost anything now, from writing specifications to documentations for deliverables I send to my customers. And the result is not just awesome, it just look professional (IMHO). I use the Flask theme which I think provide a better readability than the default ones.

As an example, here is what the Apache Zeta Components documentation looks like when generated with Sphinx using the Flask theme

As a long time docutils user, learning the few Sphinx specific constructs was a piece of cake. If you already know or worked with the RST syntax then using Sphinx should not be a problem at all. If you would like to convince your manager(s) to use Sphinx just say that the official Python documentation uses it, so does the official Symfony documentation.

Happy documenting :)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Come on Mr Arrington …

July 17th, 2010 by Jérôme 1 comment »

Dear Mr Arrington,

I just read the following blog post on Techcrunch : Breaking: French Government Still Can’t Get France.fr live

Even though you have a point about france.fr being down for days right after its launch, you did not need a blog post on Techcrunch for that, there is a simple word to explain this failure : incompetence.

What is absolutely pointless in your article is this :

If the country’s experience with building aircraft carriers is any indication of their ability to build websites, we should see it limping along sometime in 2013.

Let’s skip the aircraft carriers thingy because it is absolutely out of topic here.

French people not able to do websites ? Do people behind Dailymotion, Netvibes, Skyblog, Seesmic, Deezer come from Mars ? You can love or hate the service but you can not say that french people can not make websites.

By the way, showing the list of wars France lost is also useless, unless you want to talk about Vietnam and Irak ;) If ever someone read this blog post and uses the WW2 argument, I would recommend this person to read a history book first so he can understand why the USA entered into the conflict. Reading a bit on Lafayette is recommended as well.

So please Mr Arrington, do what you do well i.e publishing news about tech and the Internet in general and stop the rest.

Best Regards,

PS : if ever this website goes down after a while due to the incoming traffic this is because it is hosted on a cheap shored host I do not quite care about not because it is French.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Collectd and Varnish user ? We need your feedback

July 15th, 2010 by Jérôme 4 comments »

If you use collectd and would like to monitor your Varnish instance(s), this blog post is for you. The new Varnish plugin for collectd is ready, however we would love to get feedback from you. The plugin has already been pushed on production on Camp To Camp and the feedback is really positive so far. However it is always good to get more feedback from different people using collectd and Varnish in different contexts.

How can you help ? Simply run the Varnish plugin on one of your production (or test) server(s) and provide feedback, and ideally some graphs :)

Installing the Varnish plugin for Collectd is really trivial :

1. run git clone http://github.com/octo/collectd.git

2. compile collectd as you would normally do, do not forget the –enable-varnish flag

3. configure the Varnish plugin in collectd.conf, as explained in the configuration synopsis

4. start collectd

For more information, feel free to read and/or comment the dedicated wiki page .

Feedback can be provided as you wish, either by sending an email to the mailing-list or directly to me <jerome.renard @ gmail.com>

Thanks in advance for your feedback.

:)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Fixing user infos in git commits

June 29th, 2010 by Jérôme 1 comment »

After I easily switched from Mercurial to Git, I needed to update the committer’s name and email adress. I found that using git filter-branch could help me.

Here is what I did :

git filter-branch --env-filter \
'export GIT_AUTHOR_NAME="Foo" ; GIT_AUTHOR_EMAIL="foo.bar@example.com"'

And git updated the author’s name and author’s email for every commit.

‘Hope that helps :)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Easy switch from Mercurial to Git

June 29th, 2010 by Jérôme 2 comments »

For a project I am currently working I needed to switch from Mercurial to Git.

I used the method described below, that is really trivial and it works just fine.

Download  fast-export and extract it wherever you want.

Run the following commands :

mkdir git.migration && cd !$ && git init
/path/to/fast-export/hg-fast-export.sh -r /path/to/your/mercurial/repository

And wait for a few minutes/seconds, depending on the size of your repository. In the end of the process you should get a result like :

git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:      10000
Total objects:         5426 (       566 duplicates                  )
 blobs  :         1990 (       453 duplicates       1454 deltas)
 trees  :         3027 (       113 duplicates       1762 deltas)
 commits:          409 (         0 duplicates          0 deltas)
 tags   :            0 (         0 duplicates          0 deltas)
Total branches:           1 (         1 loads     )
 marks:           1024 (       409 unique    )
 atoms:           1030
Memory total:          2540 KiB
 pools:          2149 KiB
 objects:           390 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize =   33554432
pack_report: core.packedGitLimit      =  268435456
pack_report: pack_used_ctr            =          1
pack_report: pack_mmap_calls          =          1
pack_report: pack_open_windows        =          1 /          1
pack_report: pack_mapped              =    7542871 /    7542871
---------------------------------------------------------------------

Now run :

git checkout

Done.

‘Hope that helps :)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)