Tip of the Day: restart Opera without Dragonfly

Submitted by Frederic Marand on Thu, 2010-04-29 11:08

If you like Opera Dragonfly, as I do, you may have stumbled upon a small annoyance: if Opera is configured to start with the previous window, if you use Dragonfly in a separate window - maybe because you use a dual screen config - if you happen to close the main Opera window with Dragonfly still open, and close Dragonfly afterwards, then you will notice that Opera complies with your choices: when you restart it, it restarts with the main browsing window closed and Dragonfly opened.

At this stage, closing Dragonfly won't help, because Opera will faithfully restore it at every launch. Annoying. Luckily, there is a very simple workaround if you find yourself in that situation...

Optimizing strings in PHP ?

Submitted by Frederic Marand on Sun, 2010-04-25 11:07

Every so often, I get asked about whether it is really worth it to chase double quotes and constructs like print "foo $bar baz", and replace them with something like echo 'foo', $bar, 'baz', or even to remove all those big heredoc strings so convenient for large texts.

Of course, most of the time, spending hours to fine comb code in search of this will result in less of a speedup than rethinking just one SQL query, but the answer is still that, yes, in the infinitesimal scale, there is something to be gained. Even with string reformatting ? Yes, even that. But only if you are not using an optimizer.

Just don't take my word for it, Sara Golemon explained it years ago with her "How long is a piece of string" post, in 2006.

Quick tip: how to make CVS status actually usable

Submitted by Frederic Marand on Sun, 2010-03-21 16:42

Like any VCS, CVS is able to show the status of the current directory when compared with the repository from which it is checked out.

However, unlike SVN, GIT, or bzr, which by default show only a rather compact set of information, CVS provides already verbose information, with only an option to add even more, and no terse mode.

Luckily, piping its output through a few commands allows one to obtain such a compact cvs status display. I tend to use this, aliased to cvsst.

alias cvsst="cvs st | grep -vE 'revision|Sticky|^$|==|Commit' | sed -r 's/^File: |Status: //g'"

Drupal as one of the key Internet Technologies

Submitted by Frederic Marand on Tue, 2010-02-23 15:31

Received this Harris Interactive poll today, on behalf of Tarsus, the french company organizing the Solutions Linux expo.

One of the choices was a list of the top 30 Internet Technologies. And guess what ? For once, Drupal was on the list: first time I see it mentioned in this type of business context. Interesting.

Drupal among the top 30 internet technologies

Debug vanilla

Submitted by Frederic Marand on Fri, 2009-12-11 12:14

Most of the time, when working on some piece of code, I'll resort to the configured debugger in my current Zend Studio configuration. And you probably do too :-)

However, I often have to access debug-type information on live sites where installing a debugger is out of the question, and I find myself often resorting to parameter dumps like the following:
<?php
// lazy version for simple cases
function foo_bar($x, $y, $z) {
dsm(func_get_args());
// [...]

// less lazy version for more hairy cases
function foo_baz($x, $y, $z) {
dsm(array('in foo_baz, x' => $x, 'y' => $y, 'z' => $z));
// ...
?>

You've probably being using it too and, of course, after the first few dozen times, it becomes a bit used. So here's a tiny snippet that makes such dumps simpler to type and use :