Seriously, is OSX Lion a joke?

Posted on July 20, 2011

Seriously, OSX Lion is a joke, isinit?

I’m a huge fan of Apple products, and especially their OS for Mac, to me there is no better OS for my personal and professional usage. Mac OS X 10.7 (Lion) was released just this afternoon, 20th of July 2011, and in the next hour I already bought and downloaded the new fresh OS. Upgrade from my Mac OS X 10.6 (Snow Leopard) went well, I haven’t lost any of my data, and all of my applications are compatible with the new OS.

At first, I was especially excited about the security improvements, such as Filevault 2, Versions, and the ability to crypt Time Machine too. But now, I’m already very disappointed by Lion, on many points. I’ve been playing with Lion just for an evening, so the list of my disappointments might not be so exhaustive at the time I’m writing these lines, but here they are.

Give feedback to your users (PHP CLI coding)

Posted on July 17, 2011

Terminal PHP CLI

Whereas PHP’s main usage is to generate web pages, it can also be used as a scripting language in your shell (just like bash or python). To that purpose, you can use the CLI version of PHP (CLI standing for Command Line Interface).

The purpose of a CLI script is different, it’s not to generate a web page. Instead, it can be an automatisation task for your website or a maintenance task for your server. Therefore, of course, when you write a CLI script, you don’t output HTML, but instead you output short messages that will tell the user if the script went well or not.

This script can be run manually by you or a coworker, or a cron job can run it periodically. In all the cases, giving a feedback about the success or failure of your script is important. It’s not difficult, simply print a message and append a new line character to it (\n, not the HTML breaking line tag <br/>). I find my custom (and very simple) function println() (yes, inspired from Java :)) quite convenient for this. See code below:

Plan for an awesome life

Posted on July 4, 2011

I don’t often talk about my personal life, but my new life plan looks so special to me that I needed to share it online. To set up my background, I am 24, I graduated a Master of Science (e-Business) in Oxford last year, and I founded right away the website (french) with two other mates (french). I am now living in Strasbourg, France, and I pretty like my quality of life: I am a full time entrepreneur, I can adjust my working hours more or less the way I want (or not, because of course shit likes to happen during the weekend or in the middle of the night…), I am free to work anywhere as long as I’ve got my laptop and an access to the Internet, I earn enough to sustain myself, and I always have lots of fun with my friends here. But nevertheless…

I mentally gave myself 30 years old as a dead line for founding my family (or at least NOT BEFORE 30). I thus have 5 to 6 years to live an awesome life before I’m forced to have a stable life, get married and raise kids. 5 to 6 years that must be used the best way possible, because when the kids are born, I will be stuck for at least 20 years bringing them up.

Baguio rice terraces
Rice terraces in Baguio, Philippines

So here is the plan: travel the world, never stop to experience new countries and cultures until I reach 30. It’s not like holidays, since I’ll still be working my ass off every day from … from wherever I am staying. But since my work is flexible enough to do so, I feel I’d be so silly to spend my 6 remaining years of total freedom in the city I was born in…

Forex for beginners

Posted on May 19, 2011

Today, I’m taking the time to talk about my new project, It’s a website (in french only so far) whose aim is to teach Forex to very beginners, in a way it has not been done before. We really make Forex easy to learn for beginners, who can really start from the very beginning and end by reaching a good level in Forex trading. Our core business is divided into 3 main sectors.


Change Chrome search default language

Posted on December 7, 2010

The last day, I was given a brand new MacBook Pro at my new job. First thing to do: open Safari … in order to download Chrome! But I don’t know why (some traces of French settings?), the default search engine for Chrome was (french language), and not (english language). Impossible to change it in the list of search engines, and there was this google:baseurl setting (set to that I couldn’t overwrite. No way until I found the solution below.

Stop Chrome.

Open the following file (on Mac OS X, files is located elsewhere for Linux and Windows users):

vim ~/Library/Application\ Support/Google/Chrome/Local\ State

And look for the three following lines:

"StartupDNSPrefetchList": [ 1, "" ]
"last_known_google_url": ""
"last_prompted_google_url": ""

There, change the URL by the one you want (in my case I turned in

Restart Chrome.

The default language for google should be english now. At least, it worked for me 🙂

Minimize windows into application icon

Posted on December 2, 2010

I’ve just discovered this feature in Snow Leopard and it’s changing my life. It allows me to reduce a window into the application icon (in my dock), instead of going to the right of the dock next to the trash bin. I’m really happy of that feature especially because I’m keeping the MAMP window up every time, and I didn’t like to waste space in my dock for that!

To activate this feature, go to System Preferences, then to Dock, and check the box called Minimize windows into application icon. From now on, your windows will reduce and not take more space into the dock.

Screenshot of the dock preferences in Snow Leopard

Rotating your log files with logrotate

Posted on November 2, 2010

If you’re like me and you’re used to log what’s going on your web application, you might want to know how to rotate your log files just like Linux commonly does for its system logs. No need to code anything for that purpose, you can simply use the same software as your system: logrotate.

Attention: I wrote this post based on my personal server which is a Linux Debian 5.0 Lenny and logrotate 3.7.1, but it’s very likely that it works more or less the same way for any Linux server and version of logrotate.

When installing logrotate, it’s likely that it’s already designed to rotate some system logs (syslog, kern.log …), and in the case of a web server, it also rotates Apache or MySQL (access.log, error.log, mysql.log…). Having a quick look at the manual (#man logrotate), you’ll see you can easily tell logrotate to handle your own log files. Simply open /etc/logrotate.conf (or touch a new file in /etc/logrotate.d/ if it exists for your version), and add something like the following:
"/home/mysite/log/visitors.log" "/home/mysite/log/downloads.log" {
rotate 5
size 100k
/usr/bin/killall -HUP httpd

This example section will handle both visitors.log and downloads.log (you can add as many file locations as you wish). The options are:
  • rotate 5: it means it will rotate 5 times before deleting data
  • mail will send an email with the content of the latest log file before deleting it
  • size 100k: maximum size for a log file before rotating it
  • postrotate […] endscript: enclosed is a piece of script you want to be run after rotating logs
  • nocompress: add this line to prevent logrotate from compressing rotated log files

These are the main options for logrotate, but of course many others can be found, please read the manual for more.

And there you are, your custom log files are being rotated without having to code a custom PHP script 🙂

83/95 at contest Cascading Style Summer Refresh 2010

Posted on October 13, 2010

Not something to be proud of, but I ended 83rd on 95 competitors at the Cascading Style Summer Refresh 2010 contest organised by Alsacreations (french). Unless I gave a lot of efforts to make it HTML5 and W3C compliant, accessible, usable and optimised for slow connections, my lack of skills in Photoshop was fatal.

I’m not disappointed, in the sense that I don’t pretend to be a computer graphics expert. I’m just a hard core developer after all 🙂 Nevertheless, congratulations to the competitors, and be ready for the next contest, because I am ready and my Photoshop skills won’t stick to the current level!

Proposal: best practices for writing PHP

Posted on October 3, 2010

My motivation in writing this proposal comes from years of PHP practice, when I had to use other people’s code and their code looks like garbage so much that I wanted to throw it to the their face rather than using it. I can’t expect everybody to write clear code, but if I could turn the actual world in a world of beauty and smartness, I’d like people to follow the guidelines in this paper. Note that I didn’t pretend to write complete PHP good practices, as I’m just covering the writing aspect of PHP coding, with concerns such as readability and logic in the flow of code.

Good practices for PHP writing

strtolower and UTF-8

Posted on September 27, 2010
Charset issues is something that always made me go mad. And since I’m french and I’ve designed many french websites, it’s something I couldn’t escape, thanks to all these special chars we have in our language 🙂

Well, today an issue came up with the strtolower function. Look at what follows:

$t1 = 'Expérience';
$t2 = strtolower($t1);
echo $t2; // echos 'expience'

See? It drops the two letters “ér”. No matter why and how it processes (for more details about UTF-8/ISO issues, please use google), what matters is that it totally screwed up my beautiful string.

On, you can read this function uses the charset defined in the current locale. It means that whatever the encodage of your string is (UTF-8, ISO, …), even if you work with UTF-8 all along (database tables, database connection, page chars …), it will use the current locale charset anyway.

To this, I can see two options.