After the crisis and the future of science

Great talk about the crisis and the disciplines in science that will drastically change for the next few years, with an excellent orator, Juan Enriquez:


Weeklog 2009/16

Below, a short list of links that caught my attention this week:

Confessions of a real estate agent, on how real estate agents contributed to the financial meltdown.

How our salaries are changing since the beginning of the current crisis.

Partying like it's 2008 in Germany, where consumer spending and car sales are up.

What would the world look like by 2050, future wars, climate and other predictions.

Court jails Pirate bay founders, sentenced to a year in prison and a fine of $4.5 Mio.

Iran in the 1970s before the Islamic Revolution, in pictures.

Wilders announces Fitna sequel, with filmmaking assistance from Hollywood.

Oracle to buy Sun for $7.4 milliard, bringing Sun's stock up 36% today.


Credit Crisis Explained - The Animation

Everything you wanted to know about the Credit Crunch and never dared to ask, via Laughing Squid.


Anyone who thinks LHC will destroy the world is a twat

The LHC is ready, and will start operation early tomorrow, 9am CET, Wednesday 10th of September (Webcast), while the first collisions will start on October 21st, so sorry to disappoint, but no end of the world yet.

LHC stands for Large Hadron Collider, spans along the Swiss and French borders, and it's the largest particle accelerator, and with a circumference of 27km long, the biggest machine ever built. The purpose is pure research, used to test several high energy physics theories, being probably the most famous one the (non) existence of the Higgs Boson, or so-called God Particle.

The title of this post is a reference to an interview with Brian Cox where he tried to debunk the myth that the LHC would destroy the world.

As far as I can remember, the myth was started by two American nuts, a lawyer and a self-called scientist with a lawsuit against CERN in the US, trying to bring to a standstill the construction of the LHC by stopping shipments from Fermilab to CERN.

In the last few weeks we have been flooded with articles written by poorly informed journalists predicting the end of the world for tomorrow, in a shameful sort of apocalyptic pamphlets ("Are we all going to die Wednesday" and comments), getting to the point where CERN employees have received death threats, mainly due to the fact that the LHC might create tiny black holes that would quickly decay.

To be honest, I think the "You are evil and dangerous and you are going to destroy the world" quote in the article perfectly shows the faint-heartedness of our society, where the mass never wants to take a risk to advance in any field, as we have seen many times through history.

Just because you fear what you don't understand, here's very interesting video by Brian Cox explaining what is and what is the purpose of the LHC: Brian Cox on CERN's supercollider. The talk is great, and you can definitely see he loves about what he is talking about, and what is more important, he is able to explain what all the LHC is about to regular people.


Merge a branch with the trunk in Subversion

I restart my blog posting activity by sharing with you a little cookbook that may be useful if you use Subversion to manage your source code repository.

If you are using Subversion, you most likely have already created (or thinking of creating) branches to manage different versions of your source code.

When the time comes to merge my changes between branches or a branch and the trunk, I always forget the syntax, so here's a small step by step merge execution.

I am assuming you have checked out both the branch and trunk from your subversion repository. If you haven't done so, you can easily checkout with:

svn co <repository>

First of all, go to the branch main directory, and execute the following:

svn log --stop-on-copy

The last entry is the version number corresponding to the creation of the branch, and looks something like the following:

r2887 | daniel | 2008-03-25 12:20:52 +0100 (Tue, 25 Mar 2008) | 1 line
Creation of new branch for version 1.6. ------------------------------------------------------------------

So, we have found out that the version is 2887. Now, change directory to the trunk, and execute the following command:

svn up

The output of this command should be something like:

At revision 3117.

Basically, that means that we have to merge the changes from revision 2887 to 3117, using the following command:

svn merge -r2887:3117 https://<repository>/branches/<version>

Now, you should check the changes performed to your local copy, and resolve any change conflicts that may appear.

Once you have verified that the changes are correct, you can check in with the usual svn ci.


MacBook Air: The ultralight laptop from Apple

Yesterday, Steve Jobs unveiled the new MacBook Air, as I'm sure you all know, following a week of rumors that this time were true, even having a photoshopped picture of the Air surprisingly similar to the end product. Apart from that, a new Apple TV with updated HDTV support has been launched, and an Airport Extreme with a 500GB or 1TB "server grade hard disk drive" on it (think of wireless Time Machine), called Time Capsule (I love the name!).

So, the MacBook Air. The machine is less than 2cm thick (0.4 cm in its thinnest side, and 1.94cm in the thickest), and weights about 1.3kg.

Among the things I also like is the CPU (a standard Core 2 Duo 1.6 or 1.8GHz), which apparently had to be reduced 60% in size compared to the Core 2 Duo that other MacBooks have, and that Apple reportedly persuaded Intel to build it for them.

The standard (non expandable) RAM memory is also enough (2GB), and the battery life (apparently having wireless on) is a whopping 5 hours.

As for the rest of the features, it is pretty much a small MacBook Pro (iSight, Bluetooth, Backlit keyboard, Micro-DVI output).

Another great feature is the inclusion of an iPhone-like, bigger than usual trackpad. It allows you to scroll, zoom, pinch, rotate... the whole deal.

It only has one USB and no Optical Drive, though, which I find completely understandable just by looking at its size. And I don't miss the Optical Drive, specially in such a small form factor laptop.

No Ethernet adaptor either, but again, I understand as this is a travel laptop, the Air is supposed to work with AirPort, and leave the cables behind.

Apple has come up with an already well known but improved feature to resolve the lack of a SuperDrive. All you have to do is enable CD/DVD sharing on a computer with one (apparently you have to install additional software if it's a PC) and it will automagically appear on Finder, so you can install all the software you need (it even works if you want to reinstall Leopard, for instance).

As for the things I like less are, for instance, the size of the hard drive (80GB), and the price of the super-fast 64GB SSD optional disk (about EUR 900). The battery is sealed, as in the iPhone, so you can't get a replacement and change it yourself if you want.

In a few words, this is a travel laptop, it's great to carry it around, has good battery life and you can work exactly the same as in a MacBook Pro. I'm already picturing myself working on it in an Airport Lounge.

Just so you know, I'm getting one already, so I'll let you know how it performs.


Hallo aus Zürich

For those of you who don't know where I am, and wondering why the hell I am and why aren't your e-mails answered as soon as usual, here it is: I have recently moved to Zürich, and my Internet connection is a bit "unstable".

While waiting for Cablecom to deliver my cablemodem, I usually go to a nearby Starbucks and drink a Green Tea while enjoying the 30 minute free Internet. Also, I have discovered that the connections that are already active do not get disconnected after those 30 minutes, so one can open a SSH tunnel and bypass that limit - but I'm not suggesting anything at all ;-)


My Review of Leopard

I have been using Leopard, Apple's last überfeline, for more than a week now. It is without any doubt, the best operating system I have ever used.

Leopard is the natural successor to Tiger, which basically improves its older brother and adds some other very interesting features.

I recently bought an iMac, so I got it almost free (~EUR 9). The only bad thing is that it is only an update DVD (i.e. you need Tiger to install it), and that it comes without the fancy retail box. Apart from that, it's the real thing. If you have bought an Apple computer after October 1st, you are entitled to your almost free copy of Leopard. Check the Up-to-Date site.

Most of the Apple-made applications seem to run faster (particularly Safari, iTunes and iPhoto).

Time Machine is astonishing. As easy as 1-2-3.

Once you connect a Firewire or USB disk to the Mac, a menu automatically pops up asking you whether you want to use the disk as the Time Machine Backup Disk. If you answer affirmatively, an initial copy starts, which in my case, took less than an hour.

The great thing is that Time Machine doesn't require the disk to be dedicated to it. You still can use it to store other files. Time Machine just creates a folder called Backups.backupdb, where you can browse through the snapshots, stored in folders identified by date and time of backup.

By default, Time Machine backups the incremental changes on your disk in one hour intervals.

When you click the Time Machine icon on the Dock, whether you have a Finder window open, iTunes, iPhoto, Mail, or any other supported application, the already well known space animation starts and lets you restore previously deleted files.

Spaces is VirtueDesktop replacement, only it works better and is perfectly integrated.

Terminal has tabs now, and several other aesthetic changes. I was using iTerm on Tiger, and trashed it almost instantly after seeing Terminal.

QuickLook allows you to preview almost any type of file without opening the actual application.

Mail lets you write Notes and To-Do's. Unfortunately, it doesn't currently sync with the iPhone.

iChat allows desktop sharing, document sharing, video sharing. And you can be in the Tour Eiffel for free. Really cool.

Finder has now CoverFlow. I personally don't use it, as I think it's easier to browse through files shown as icons, but may be useful for somebody who wants to see previews of the files of a folder at a glance.

Some other extra details:
- iCal's icon on the Dock now displays the current date, and not a static icon as it did on Tiger. Nice detail.
- Dictionary now also searches on the Wikipedia.
- Spotlight returns dictionary entries as well.
- Preview now allows you to resize images.

The only issue I've had so far is that MySQL ceases working, a recognised MySQL bug. Apparently, the update to Leopard messes up the mysql directory permissions. It can be fixed by manually chown(ing) the mysql directory:
chown -R mysql /usr/local/mysql-5.0.45-osx10.4-i686/

But the PreferencePane is definitely broken. You will have to start MySQL running /usr/local/mysql/bin/mysqld_safe & from the Terminal. meets iPhone

We have been developing a new web interface made for iPhone (which should also work for those of you who have another mobile internet device), for iPhone.

The great thing is that you can have all your files on the go. Just upload your documents to and you will have them on your iPhone wherever you go!

Once you log in the first time on your iPhone to, you will be presented with the following screen:

In your home page, in a similar way to the standard web interface, you will be able to see all the files and subfolders you have inside a folder, and navigate through them.

Once you touch a file, it will open instantly in Safari, provided that it is a supported file. Safari currently supports PDFs, Images, Text files, Office files (Word, Excel and PowerPoint files), MP3, AAC, and some QuickTime video formats.

Another great feature is live search. where you will be able to search within your files (public search is coming soon).

I hope you like it as much as I do. Please give it a try and post your suggestions either here on in the forums.


Setting up database replication on MySQL

Database replication is, as the americans would say, quite awesome. It provides, for one, an always fresh database backup. But most of the time you won't do it for backups. The greatest thing about database replication is that you can use it for load balancing.

Just replicate the database onto another server, and you have two atabase servers for SELECTs and you can leave the master for INSERTs, DELETEs and UPDATEs. The only bad thing about this is that you will need different connections for read and write (nothing that Dr. Nic's magic can't resolve), and you must have a fast connection between the two servers or you may have records that don't show up instantly when you store them (that's bad for a web application).

First of all, I'm supposing you already have a production database running in a server. If you start from scratch with several database servers, then it's much easier, as you don't have to dump/restore databases.

Go to your master server (let's say her name is scherie), and edit /etc/mysql/my.cnf:

Make sure you have set server-id to 1:

server-id = 1

You need to uncomment the bind-address line, as we need port 3306 open for our slave:

#bind-address =

By default, Debian for instance, already saves the transaction log. Uncomment or add it if you don't have it:

log_bin  = /var/log/mysql/mysql-bin.log

Add a line for the database that will be dumped to the binary log:


You can now restart the database:

scherie:~# /etc/init.d/mysql restart

Open a mysql client, and create a new user called replication_user (change this to whatever you want):

scherie:~# mysql -u root -p

mysql> grant replication slave on *.* to 'replication_user'@'%' identified by 'password';

Now we have to lock temporarily the database while we proceed to dump it, so we have the correct binary log offset (Position).

mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

mysql> show master status\G;
*************************** 1. row ***************************
File: mysql-bin.00002
Position: 230
Binlog_Do_DB: database_to_be_replicated

1 row in set (0.00 sec)

Don't close the mysql client
. Leave the terminal open, otherwise, the database will be unlocked. Write down the File and Position values, we will need them later.

Dump the database (you could use load data from master, but it's deprecated and will be removed in the future).

scherie:~# mysqldump -u root -p database_to_be_replicated > database_to_be_replicated.sql
Enter password:

Once dumped return to the open terminal, and unlock tables:

mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;

It would be a good idea to compress the database dump before transferring it:

scherie:~# bzip2 database_to_be_replicated.sql
scherie:~# scp database_to_be_replicated.sql daniel@athena:

You should also allow access from the slave to the master server, but block it otherwise (basic iptables rules):

-A INPUT -s ip_of_slave_server -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -j REJECT --reject-with icmp-port-unreachable

You're done with the master configuration. Let's open a terminal to our slave server (let's say she is called athena):

Check whether we have access to the master:

athena:~# mysql -u replication_user -p -h scherie
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 38
Server version: 5.0.45-Debian_1-log Debian etch distribution

We can restore now the database dump from the master:

athena:~# bzip2 -d insolitus.sql.bz2
athena:~# mysql -u root -p insolitus < insolitus.sql
Enter password:

Add the following data to the slave's my.cnf, under the [mysqld] section:

server-id                   = 2
master_host             = ip_of_master_server
master_user             = replication_user
master_password    = password
replicate_do_db       = database_to_be_replicated

Restart mysql:

athena:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.

Connect as root to our slave server:

athena:~# mysql -u root -p

Stop the slave:

mysql> slave stop;
Query OK, 0 rows affected (0.00 sec)

Now, we need those File and Position parameters we got from the master, change the values on master_log_file and master_log_pos for those you wrote down previously:

mysql> change master to master_host='ip_of_master_server', master_user='replication_user', master_password='password',master_log_file='mysql-bin.000002', master_log_pos=230;
Query OK, 0 rows affected (0.01 sec)

We start the slave:

mysql> slave start;
Query OK, 0 rows affected (0.00 sec)

Now, if we issue a show slave status, you should see the following variables to 'Yes':

mysql> show slave statusG;

          Slave_IO_Running: Yes
          Slave_SQL_Running: Yes

If you have Slave_IO_Running set to No, you haven't probably locked correctly the database prior to dumping it. You will have to repeat the dumping process locking correctly the database.

If everything is correct, your database will be automatically replicated. Doing a simple show processlist; in either the master or the slave will show whether the communication is working.

You can also take a look at the full guide to replication at the MySQL official site.



About is a blog about technology, opinion and random thoughts written by Daniel Alvarez, a computer engineer currently living in Zurich, Switzerland.


User Functions



Lost your password?

Latest posts

Stories last 24 hours

No new stories

Comments last 2 days

No new comments

Trackbacks last 2 days

No new trackback comments

Links last 2 weeks

No recent new links