- 2015-08-21: 50% less server load with MongoDB on the Drupal 7 site factory at France Télévisions
- 2015-07-15: Our first Drupal 8 production site at France Télévisions is live
- 2014-08-18: 400% speedup in 3 weeks for http://france3-regions.francetvinfo.fr/ : who said Drupal back-offices had to be slow ?
- 2014-02-07: Sotchi Olympics traffic not a problem for http://www.francetvsport.fr/ , which I rearchitected on Drupal 7 in 2013
- 2011-09-14: Completed migration of FranceInfo.FR from SPIP to Drupal
- 2011-07-13: The new social network features of Le Figaro are now powered by an OSInet-designed MongoDB implementation
- 2010-12-21: Madame Figaro brand new site by OSInet and others
- 2010-08-16: France.FR is back online with OSInet and Typhon
- 2010-06-15: the new France Culture, which OSInet helped reach its performance goals, is now online
A Gray code generator in PHP
For a recent case, I had to define the behaviour of a system with a lot of independent conditions to check, which could trigger any number of a set of messages and actions on data, and all of this based on a plain english (i.e. non algorithmic) description of the data, which only covered the most commons scenarios for these conditions, leaving lots of undefined combinations of inputs. What's one to do in such cases ?
During CS101, you probably learnt to build a Karnaugh map and reduce it in order to obtain reliable code in such cases. But for reduction to be actually doable by hand, you need to generate the Gray code by which to index it, and most online tools stop at 3x3, which wasn't sufficient. So here is the tiny contribution of the day: a Gray code generator in PHP. Nothing remarkable, just the kind of tool which takes 10 minutes to write, and you sometimes need to have at hand.
* Generate a $size-sized Gray code sequence on stdout
* Probably not performance-efficient, though, but sufficient for usual needs:
* 7 sec on a small server for a 20-bit code.
* (c) 2009 OSInet
* Licensed under the General Public License version 3.
$size = 10; // Number of bits of the code
$print = FALSE; // Set to TRUE to generate code on stdout.
$current = array_fill(0, $size, 0);
$pos = 0;
while ($pos < count($arValue))
if ($arValue[$pos] == 1)
if ($pos == count($value))
$ret = 0;
foreach ($arValue as $bit)
// ---- main -------------------------------------
$max = 1 << $size;
for ($i = 0; $i < $max ; $i++)
$s = '';
foreach ($current as $bit)
$s = $bit . $s;
if (numberOfOnes($current) % 2)
$pos = (1 + rightMostOne($current)) % $size;
// echo "pos = $pos\n";
$current[$pos] = 1 - $current[$pos];
$current = 1 - $current;