Topics: Linux

VirtualBox host IP address and hostname

When you are using NAT in your virtual machine (which you should), the host's IP address is:

10.0.2.2

You'll need it to access shared folders or your host's web server when testing pages in IE.

Fun fact: You could also use vbox.srv – that's the corresponding hostname.

MySQL shell: Enable UTF-8

When you do a script/dbconsole -p, your MySQL shell will already be using UTF-8. When you call it yourself using mysql, it may not be enabled.

You'll notice that when you get ASCII salad and/or question marks instead of special characters.
Example: Hlavn� m?sto Praha instead of Hlavní město Praha.

You need to manually switch on UTF-8, in the MySQL console:

SET NAMES 'utf8';
External content

Convert Virtualbox .ova Image to .ovf

The .ova file format is a tar file with a .ovf file inside.

tar xvf virtualboximage.ova

Ubuntu: Reload Gnome panel while keeping user session

Sometimes you need to restart the Gnome panel, e.g. when you installed a new Gnome panel widget but the widget list was cached before.

You often don't want to do sign out and back in for this. Instead, just run:

killall gnome-panel

This will terminate all gnome-panel processes. On my machine (Ubuntu 11.04) the panel then restarted itself after a moment.

If the panel does not automatically come back, press Alt+F2 to bring up the Gnome "run" box and start gnome-panel from there.

External content

Skype For Linux With Tabs Support Using SkypeTab NG

SkypeTab-NG (NG stands for Next Generation) is a tool that adds tabs to Skype for Linux. Besides providing a tabbed chat window, the SkypeTab-NG also embeds both the conversation and the main Skype windows in a single window.

"Require group" doesn't work with Ubuntu's default Apache installation

If you want to use Require group $GROUPNAME on your default Apache installation like this:

<Directory "/var/www/foobar">
    Order allow,deny
    Allow from all
    Options None
    AllowOverride all
    AuthName "Area 51"
    AuthType Basic
    AuthBasicProvider external
    AuthExternal pwauth
    Require group admin
</Directory>

You need to first install libapache2-mod-auth-sys-group. You don't get any error message if you haven't installed it but it doesn't work.

sudo apt-get install...

Fix [RubyODBC]Cannot allocate SQLHENV when connecting to MSSQL 2005 with Ruby 1.8.7. on Ubuntu 10.10

I followed this nice guide Connecting to MSSQL with Ruby on Ubuntu - lambie.org until I ran in the following errors:

irb(main):001:0> require "dbi"; dbh = DBI.connect('dbi:ODBC:MyLegacyServer', 'my_name', 'my_password')

DBI::DatabaseError: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
  from /usr/lib/ruby/1.8/dbd/odbc/driver.rb:36:in `connect'
  from /usr/lib/ruby/1.8/dbi/handles/driver.rb:33:in `connect'
  from /usr/lib/ruby...

Find out your SSH key's fingerprint (e.g. to authenticate on GitHub)

If you want to know your public key's fingerprint, do this:

ssh-keygen -lf ~/.ssh/my.key.pub

This may be necessary to authenticate your key on GitHub because of recent events – you need to do that if you get an error like this when talking to them (to pull etc):

``` ERROR: Hi foobear, it's GitHub. We're doing an SSH key audit. Please visit https://github.com/settings/ssh/audit/… to approve this key so we know it's safe. Fingerprint: ab:cd:ef:… fatal:…

Make Capistrano use SSH Key Forwarding

When deploying code with Capistrano (depending on your configuration) at some point Capistrano tries to check out code from your repository. In order to do so, Capistrano connects to your repository server from the application server you're deploying to with SSH. For this connection you can use two SSH keys:

  • the user's ~/.ssh/id_rsa [default]
  • the very same key you used for connecting to the application server - forwarded automatically to the git repository.

If you prefer the second way, add this to deploy.rb:

ssh_options[:forwar...

Get rid of dead keys under XFCE

Under XFCE keys like tilde are dead by default, which is impractical for programming and terminal work. To get rid of dead keys, open your Settings Manager and go to Keyboard. Under the Layout tab you can keyboard layouts like "German (eliminate dead keys)".

There is still a way to type accented characters.

External content

davetron5000/methadone - GitHub

Framework to write command-line apps in Ruby. Comes with a nice way of processing parameter options, some utility classes and Cucumber steps for testing your CLI app.

Solve: Unable to send PGP/GPG encrypted e-mail with Enigmail

So you changed your GPG key (e.g. because it expired) and Thunderbird won't send any more encrypted e-mails with Enigmail?
Your key is showing up in the key management window but does not seem to work?

Fix Thunderbird settings

If you get errors like "encryption failed: public key not found" your account settings point to the wrong key ID.

Fix it by navigating to: Edit → Account settings → Your account → OpenPGP Security.
You will find the old key ID there which of course is no longer valid (and you may…

Linux: Mount second encrypted HDD automatically without entering a password

This is one possibility to do this. There are other and maybe even better ways to do this.

  1. Generate a key for your encrypted harddisk:

    dd if=/dev/random of=/home/bob/keyfile_sdb1 bs=4096 count=1
    
  2. Then add your keyfile to encrypted harddisk: How to change your dm-crypt passphrase (step 3)

  3. Create a mountpoint:

    mkdir /mnt/space
    
  4. Create a script e.g. in your homedirectory (/home/bob/mount_sdb1.sh):

    #!bin/bash
    
    ...
    

TeamViewer 7 finally works with multiple screens under Linux

TeamViewer 6 and lower had an issue where they would see a multi-monitor Linux setup as a single wall of pixels. This is fixed in version 7. The guest can now select the currently active screen from the TeamViewer menu.

Using Vim to repair files with incorrect character encoding/representation

Consider you have a file that uses improper encoding on special characters. Example: You see the latin1 version "ñ" for the UTF-8 "ñ" but the file itself is stored as UTF-8 (meaning that the UTF-8 bytes are doubly encoded).

You can fix that easily with Vim:

vim broken.file

Now you tell vim that the file's encoding is actually latin1 (you can see what Vim is currently using by saying only :set fileencoding):

:set fileencoding=latin1

Write and reload the file:

:w
:e

All should be good now.

Adjust to your n…

Right-align or center panel items in XFCE

  • Add a separator between left-aligned and right-aligned items.
  • In the separator properties, set the style to "Transparent" and check "Expand".
  • The separator will now grab all available space and hence push the right-hand items into the corner.

You can also use this trick to center panel items by using two separators (one on the left, one on the right side).

Ubuntu 11.10: Playing sound over front and back panel (or headphones and speakers) at once

I have a pair of headphones connected to my desktop's back panel and a headset connected to the front panel. I used to play sound over both outputs, but this suddenly stopped working this week.

Apparently, (perhaps through some update) "jack sensing" got turned on, which disables the back panel as soon as you connect something to your front panel audio jack.

To disable this feature, I used alsamixer (use the arrow keys to navigate right to "auto mute", and disable with the up key). For some reason the corresponding checkbox in the `gnome…

How to manage Thunderbird mailing lists

You can group contacts using a mailing list in Thunderbird for easier access and less trouble when trying to find out who to send a message to. Here is how to do this:

  1. Open your Thunderbird address book
  2. Press the "New List" button
  3. Choose a name for your list and add contacts. There will be auto completion from your address book.

When sending e-mails you can now add a recipient with the mailing list's name and the e-mail will be sent to all its members.

216 cards