Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    How to fix “MySQL server has gone away” (error 2006)

    25th December 2008

    Source: George from vbulletin team.

    Two most common reasons (and fixes) for the MySQL server has gone away (error 2006) are:

    1. Server timed out and closed the connection. How to fix: check that wait_timeout variable in your mysqld’s my.cnf configuration file is large enough. On Debian: sudo nano /etc/mysql/my.cnf, set wait_timeout = 600 seconds (you can tweak/decrease this value when error 2006 is gone), then sudo /etc/init.d/mysql restart. I didn’t check, but the maximal value for wait_timeout might be around 28800 seconds (8 hours).
    2. Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf file. On Debian: sudo nano /etc/mysql/my.cnf, set max_allowed_packet = 64M (you can tweak/decrease this value when error 2006 is gone), then sudo /etc/init.d/mysql restart.

    If you get MySQL server has gone away (error 2006) when using MySQL ODBC driver – give this hint a try.


    Posted in *nix, how-to, Software | 52 Comments »

    How to print a single page from PDF file using Linux command line interface (CLI)

    30th October 2008

    There are several ways to do that, I’ll describe the one which worked for me. Please note, that printing from CLI has an advantage of being able to print out something at work from the comfort of your home and ssh :) (provided that the printer is on and is loaded with paper).

    To extract a single page (or a range of pages), I used pdftops:
    Read the rest of this entry »


    Posted in *nix, how-to, Software | 2 Comments »

    Debian, fgl_glxgears: Using GLX_SGIX_pbuffer… Segmentation fault

    1st October 2008

    If you get Segmentation fault when trying to run fgl_glxgears in your Debian desktop environment, most often this would mean that 3D acceleration isn’t enabled.

    For the case of ATI (and ATI Mobility) Radeon series, the easiest procedure would be (doing all as root, or prepending sudo to all commands):

    1. aptitude update, to ensure you’ve got the list of latest packages
    2. aptitude install fglrx-driver fglrx-control fglrx-kernel-src, for the actual driver; I also installed fglrx-atieventsd and fglrx-glx (these are driver-recommended packages)
    3. aptitude install module-assistant, required for building the kernel module
    4. module-assistant prepare, to verify that you have everything needed for the module build procedure
    5. module-assistant update
    6. module-assistant auto-install fglrx, to build and install the fglrx kernel module
    7. depmod -a
    8. modprobe fglrx, to load the fglrx kernel module
    9. aticonfig ––initial, to configure ATI’s device section in /etc/X11/xorg.conf (for more options, see aticonfig ––help)
    10. reboot

    Read the rest of this entry »


    Posted in *nix | 5 Comments »

    Installing libsbml on Debian (to make iBioSim start)

    30th August 2008

    There’s a troubleshooter for Ubuntu, which (expectedly) works quite the same for Debian (lenny in my case).

    I’m installing libsbml to make the iBioSim tool work under Debian GNU/Linux. First thing I had to do was to make Sun’s java interpreter do all the java interpretation work instead of gcj: sudo update-java-alternatives -s java-6-sun (this assumes you do have java-6-sun installed).

    Installing libsbml moved me one step further, now I’m getting another error from iBioSim:

    Exception in thread "main" java.lang.NoClassDefFoundError: biomodelsim/BioSim
    Caused by: java.lang.ClassNotFoundException: biomodelsim.BioSim
            at Method)
            at java.lang.ClassLoader.loadClass(
            at sun.misc.Launcher$AppClassLoader.loadClass(
            at java.lang.ClassLoader.loadClass(
            at java.lang.ClassLoader.loadClassInternal(

    This yet has to be fixed somehow.

    If Zhou Xin’s blog becomes for any reason inaccessible (or moves to his own domain), below is the extract of the instructions from his post on how to install libsbml on Debian/Ubuntu Linux:
    Read the rest of this entry »


    Posted in *nix, Links, Science, Software, Systems Biology | 3 Comments »

    Iceweasel/Firefox 3: how to work-around random/erratic right-click action

    19th July 2008

    Update: as of FireFox/IceWeasel 3.0.14, this bug appears to be fixed.

    When right-clicking many links in FF3/IW3, it quite often happens so that a random action is performed instead of opening the context menu (bug report).

    One of the solutions work-arounds (suggested by Andre Pirard) is to slow-right-click, that is to hold the right mouse button down until the menu actually appears, then – and only then – release it. Or, you can even slow-right-click, move the pointer over the desired menu item, and then release – that will perform the desired action in a single long right click (instead of more common single right click with a following single left click.)

    Alternative workaround (found at the bug report page): install the mouse gestures add-on, and restart firefox. Tested: works for me.

    This bug/behaviour is otherwise unsolved.


    Posted in Misc, Web | 8 Comments »

    Drupal theme development: where to start

    8th June 2008

    Simplest way to develop your custom Drupal theme is to start with some skeleton/wireframe theme.

    In this post, I’m briefly reviewing 4 themes (atck, blueprint, framework, and zen), made specifically to serve as theme developer’s starting point. All 4 are listed with their features (as per Drupal project page of each one), with my personal “impressions” (not based on actual use experience, yet). There’s also my choice and order of preference for the 4 candidates at the end.
    Read the rest of this entry »


    Posted in Drupal, Links, Notepad, Software, Web, XHTML/CSS | 8 Comments »

    Convert MySQL database from one encoding/collation into another

    8th February 2008

    Most frequent use: convert database from latin1_swedish to utf8_general_ci.
    Original script found at: MySQL and UTF-8.

    Update: the original script had an error, it would generate queries likes this one (note the bold part):

    ALTER TABLE `links` CHANGE `link_rel` `link_rel` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT NULL;

    This is clearly wrong syntax (and logic). I fixed this by making comparison to NULL strict (with three equal signs instead of two):

    // Does the field default to null, a string, or nothing?
    if ($row['Default'] === NULL)

    Update 2: based on comment by banesto, I modified the script; now it does not require specifying the from_collation, it’s sufficient to specify to_collation (which will be used for all the fields and tables). The modified code is:

    if ($row['Collation'] == ” || $row['Collation'] == $convert_to)

    Update 3: the long-lasting, re-appearing NOT NULL DEFAULT NULL problem is finally fixed.

    Update 4: incorporated Russ’s fix to skip numeric fields (in order to leave autoincrement values intact).

    Here’s the script itself: (to copy-paste: first click the “Plain text” header)
    Read the rest of this entry »


    Posted in Links, Notepad, PHP, Programming, Web | 59 Comments »