Site off-line error after changing mysql to mysqli on Drupal

Sometimes Drupal try to access MySQL using a wrong socket, i.e. /tmp/mysql.sock.

There are two solutions: creating a symbolic link from the wrong location to the right location, or change the php.ini (es. /etc/php.ini) to point to the right socket:

mysqli.default_socket = /var/lib/mysql/mysql.sock

This solution is more reliable, since the symbolic link to socket should be recreated at any system boot on solution #1.

See also:

Howto extract tracks from mkv and avi

This howto requires:

  • mplayer
  • mkvtoolnix
  • your Linux box 😉

Audio from Avi files (es. Xvid + MP3):

mplayer -dumpaudio "mymovie.avi" -dumpfile mymovie_audio_track.mp3

Tracks from Matroska MKV file:

List all tracks:

mkvmerge -i mymovie.mkv

File 'mymovie.mkv': container: Matroska
Track ID 1: video (V_MS/VFW/FOURCC, XVID)
Track ID 2: audio (A_VORBIS)
Track ID 3: audio (A_VORBIS)
Track ID 4: subtitles (S_TEXT/UTF8)
Track ID 5: subtitles (S_TEXT/UTF8)

mkvextract tracks *.mkv 3:mymovie_audio_track.ogg

Creates two files, mymovie_audio_track.ogg (track 3) and (track 4).

Howto merge *.001 to *.999 files on Linux

Someone give me some files named like this:, …,

Initially I think these was some multipart zip files, but they aren’t.


On your sudo / root shell type:

  • apt-get install lxsplit
  • lxsplit -j

This will install LX Split (a command line HJSplit version for Linux) found on repository to open (and create) these multipart files.

Netgear WG111 on Debian Lenny with ndiswrapper

Tested on: Debian Etch, Lenny/Sid (Testing), kernel 2.6

  1. Plug WG111 and type lsusb to verify hardware is plugged. You should get something like:
    Bus 003 Device 002: ID 0000:0000 NetGear, Inc. WG111 WiFi (v2)
    Bus 003 Device 001: ID 0000:0000
    Bus 001 Device 001: ID 0000:0000
    Bus 002 Device 001: ID 0000:0000
  2. On root shell, type:
    apt-get install module-assistant
    m-a prepare
    m-a a-i ndiswrapper
    modprobe ndiswrapper

    Now ndiswrapper module is loaded. (if you got a FATAL: Module ndiswrapper not found fatal error, repeat these steps)
  3. If interface is successfully modprobed, then type
    To create ndiswrapper module config files.
  4. Add
    to /etc/modules to load this module on boot.

  5. apt-get install wlassistant ndisgtk ndiswrapper-utils
    Install some utilities to configure wireless interface.
  6. Run ndisgtk (or type ndiswrapper -i /media/cdrom0/ndis5/netwg111.inf, where cdrom0 is Netgear driver disc)
  7. Select Netgear driver from CD-ROM (netwg111.inf): it’ll be copied automatically to /etc/ndiswrapper
  8. Copy other files under /media/cdrom0/ndis5 in /etc/ndiswrapper/netwg111/
  9. If interface is not detected, type ndiswrapper -m to write modprobe config files for it.
  10. Use gksu network-admin or gksu wlassistant to configure your wireless connection.

Tip: If after system upgrading you cannot access to wireless network, repeat step (2).

See also:

Optimize Amarok collection indexing using MySQL

By default, Amarok use SQLite to store collection informations. If you’ve a running MySQL or Postgre server on your machine, you can optimize Amarok collection indexing reducing retrieval time.
Amarok MySQL configuration

  1. Open a root shell (sudo bash) and run mysql
    mysql> create database amarok;
    Query OK, 1 row affected (0.00 sec)
    mysql> grant all privileges on amarok.* to 'amarok'@'localhost'\ 
    identified by 'type_here_your_password';
    Query OK, 0 rows affected (0.00 sec)
  2. Open Amarok and go to Settings > Amarok configuration > Collection and fill the database fields (watch screenshow)
  3. If you got an error don’t worry, simply force collection re-scan (Tools)

Now your music collection run on an efficient MySQL database.

VirtualBox OSE Debian install howto

Tested under:

  • GNU/Linux distro: Debian lenny/sid
  • Kernel: 2.6 (2.6.22-3-k7)
  • Architecture: AMD K7 (Athlon XP 1900+)

Prerequisites: make sure you’ve selected both lenny and sid repositories. In your /etc/apt/sources.list you must read something like this:

## Debian Unstable (sid)
deb sid main contrib non-free
deb-src sid main contrib non-free
## Debian Testing (lenny)
deb lenny main contrib non-free
deb-src lenny main contrib non-free

You can also add the Virtual Box repository:

deb etch non-free
deb lenny non-free

But achtung! It’s the Evil Proprietary Version. 😉

In this howto, I install the VirtualBox OSE (Open Source Editon) available in Debian repositories.

  1. # apt-get update (necessary if you changed /etc/apt/sources.list)
  2. # apt-get install virtualbox-ose virtualbox-ose-source virtualbox-ose-modules-2.6-k7 virtualbox-ose-guest-utils virtualbox-ose-guest-source Note: virtualbox Guest Additions should be installed only if you’re running a linux distro within a virtualbox (such a virtual machine is called “guest”)Change virtualbox-ose-modules-2.6-XXX with your architecture (486,686 ecc.). The 486 version is installed by default. This is a meta-package that download the latest version of virtualbox for 2.6 kernel on specified architecture.
  3. After installation, in order to run VirtualBox, you have to plug a kernel module named vboxdrv specific for your kernel. To do this:
    1. # apt-get install module-assistant
    2. # m-a prepare
    3. # m-a a-i virtualbox-ose If you’ve installed the binary version from, specify virtualbox instead virtualbox-ose
    4. # modprobe vboxdrv

    During module-assistant auto-install (m-a a-i) of vboxdrv module, kernel headers of the running kernel are used to create the module. Then modprobe add plug vboxdrv to the running kernel. If something going wrong in this phase, follow the on screen instruction from the module assistant. Make sure you’ve downloaded the right kernel headers (module assistant should automatically do this, i.e. installing linux-headers-2.6.22-3-k7 for linux-image-2.6.22-3-k7), elsewhere module build cannot be completed.

  4. Now you can try to run virtualbox-ose. After you’ve created and run a virtual machine, you can get a message asking you to check dmesg. Open a root shell and type dmesg | grep vbox. The error message ask you to add a kernel command line about NMI watchdog. If it’s your case, do this:
    1. # gedit /boot/grub/menu.lst
    2. Find a line like kopt=... and add, before all, the required command: nmi_watchdog=0 and save. DO NOT uncomment the line, update-grub make the dirty job for you.
    3. # update-grub
    4. Reboot
  5. Reading the dmesg, you find:
    $ dmesg | grep vbox
    vboxdrv: Trying to deactivate the NMI watchdog permanently...
    vboxdrv: Successfully done.

    This meant that NMI issue is solved.

  6. Now you can run successfully the virtual machine. Enjoy virtualization! 😉

After installation:

The vboxusers group
If you want to allow your unprivileged user to use virtualbox, do:
# sudo adduser `whoami` vboxusersAdd to vboxusers group any other user you want to use this.
Install VirtualBox Guest Additions on Guest
If you want to enable some advanced features, like mouse and screen resolution tweaks, you’ve to install VirtualBox Guest Additions in the guest virtual machine. If you run a Windows virtual machine, you can get the precompiled (.exe) installer from this dedicated Google Code projectAfter you reboot guest, VirtualBox enable the advanced functionalities, like seamless mode for mouse pointer and a wide range of resolution and colors for the emulated VM video card.
Update: Well, you can also download Guest Additions from the dropdown menu (Devices) of a running guest. You’ll get a CD image to mount on virtual machine with all the packages you’ve to install.
Note: Virtualbox guest additions on the “host” (real) machine has no effect: if during boot you get the “Not in a virtual machine” error from guest additions, it simply means that your OS run on a host machine, not in a guest one.

See also:

i can patch this!

*nix command of the day:

diff -Naur old new > new.patch

Where “old” and “new” are files or directories to patch.

Example (a Drupal patch for IDs duplication):

$ patch -p0<fapi-5.x-dupe-id_111719-151.patch
patching file includes/

Creating patch for Drupal:
diff -up original.php new.php > filename.patch

another example:

diff -up path/to/file/example.module path/to/file/exampleNew.module > mypatchname.patch

See also:

How to listen webpages with Konqueror

In Italian:

apt-get install festival
apt-get install festvox-ita*

Open Konqueror, go to the speech option in the tools menu (in Italian localization: Strumenti > Configura testo). Set a voice at your choice and check the sound settings.

After that, you can listen webpages through the speech tool menu via festival, it’s good to check website usability. Good listening!

See also: