Staring X applications through an ssh tunnel

If you encounter the problem of being unable to start an X application through an ssh-tunnel and run into an error message similar to

Can't open display

or

RuntimeError: could not open display

you should check

  • that you used ssh -X[...] to enable X11 forwarding when connecting to the server
  • that the xauth-package is installed correctly on your server

xauth is used to edit and display the authorization information used in connecting to an X server.

For example, after installing a minimalistic CentOS the xorg-x11-xauth package is not necessarily installed as well.

The solution is quite simple:

yum install xorg-x11-xauth

does the trick! You may have to reconnect to give xauth the opportunity to create a new authority file for you user (~/.Xauthority)

Fix for Cursor Keys in VMware server

      No Comments on Fix for Cursor Keys in VMware server

To make the Arrow Keys (and other cursor control) work in VMware 1.0.x server:

cat >> /etc/vmware/config <<EOF
xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu
EOF

You can of course change vmware’s configuration per user (not globally!) by pasting the keycodes in ~/.vmware/config

Found in chrisdew’s blog

Using ssh-keygen & ssh-copy-id

      2 Comments on Using ssh-keygen & ssh-copy-id

Just because I always forget:

Step 1: Create public and private keys using ssh-keygen

[user@Host ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): 
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
0d:d2:94:07:93:a9:48:b9:33:73:fb:f1:6e:33:ce:d7 user@Host
The key's randomart image is:
+--[ RSA 2048]----+
|     .  +=       |
|    o  o+..      |
|   . o..o.       |
|    * o. o       |
|     = .S .      |
|      . .        |
|       . o   .   |
|        ..= . E  |
|         +++     |
+-----------------+

Step 2: Copy the public key to remote-host using ssh-copy-id

Now here comes the awesome part: You don’t have to scp the public key to your remote host and cat it into ~/.ssh/authorized_keys. Instead, you can use ssh-copy-id

[user@Host ~]$ ssh-copy-id -i .ssh/id_rsa.pub user@remote-host
user@remote-host's password: 
Now try logging into the machine, with "ssh 'user@remote-host'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Customizing Gnome keyboard shortcuts

      No Comments on Customizing Gnome keyboard shortcuts

It’s possible to define keyboard shortcuts for your own commands in addition to the predefined Gnome actions. Since metacity is Gnome’s default window manager, you have to edit the metacity keys in your GConf configuration system. The easiest way is doing it with the gconf-editor (although you can of course edit the xml-definition in ~/.gconf/apps/metacity/ by hand).

So open your gconf-editor and navigate to the tree ‘/apps/metacity/global_keybindings’. Assign a shortcut to one of the keys run_command_1 to run_command_12, e.g. Alt + F9.

Now you have to tell metacity, which command to run. In the corresponding key run_command_1 to run_command_12 under ‘/apps/metacity/keybinding_commands’ you specify the command that you want to attach to the shortcut.

An Example: We want to start xmms when XF86AudioPlay is pressed, so we have to alter the keys as follows

/apps/metacity/global_keybindings/run_command1  =  XF86AudioPlay
/apps/metacity/keybinding_commands/command1     =  xmms -t

Of course, this only works with the default windows manager metacity. If you use a composition-manager like Compiz or Beryl, your mileage will vary.

Continue reading

Writing long articles w/ TOC

      No Comments on Writing long articles w/ TOC

Saw my last article about RF remotes and Fedora? Noticed the box in the top right corner containing a table of contents? Pretty cool, huh?

This really nice plugin by Hackadelic parses your headings automatically and puts them into a TOC-box. It’s even collapsable and you can change its position through shortcodes within the post.

Continue reading

RF remote with Fedora 10

      3 Comments on RF remote with Fedora 10

Remote controls for PCs are really great. With an ordinary remote for just a few bucks you can control almost everything on your PC while sitting on your couch. Well, thanks to lirc, of course. But most of them have one major design flaw: They’re infrared based, i.e. remote controls transmit data on an modulated infrared beam to your IR-receiver. Even a (think) sheet of paper can block the beam. So your remote always has to be within visual range of your receiver.

But there are some remotes out there which use a 433MHz beam instead of the short-waved IR-beam. For example this one by X10

RF Remote by X10

Continue reading

Syntax highlighting reloaded

      1 Comment on Syntax highlighting reloaded

Recently (well, yesterday to be exact) I was really sold on a a syntax highlighting plugin for WordPress called WP-Syntax. Basically, I am still. It is still easy to use, looks good and comes with a huge variety of supported languages.

But if you ask the WordPress-guys it isn’t first choice. In their FAQ they point you to Alex Gorbatchev’s syntaxhighligher Google Code project. There are quite a lot of implementations availible including three different plugins for WordPress. So I looked a little closer at SyntaxHighlighter Evolved and I must admit that it is really nice.

public class Hello {
   public static void main(String[] args) {
      /* This line is highlighted. */
      System.out.println("Hello world!");
   }
}

Especially the line highlighting is very nice. It doesn’t support as many languages as WP-Syntax, but as I mainly use it for Java snippets that shouldn’t be a major problem.

Syntax highlighting ftw!

      1 Comment on Syntax highlighting ftw!

I just ran into WP-Syntax which is a syntax highlighting plugin for WordPress using GeSHi. It supports a wide range of popular languages (including of course Java!).
Examples? Here we go:

1
2
3
4
5
public class Hello {
   public static void main(String[] args) {
      System.out.println("Hello world!");
   }
}

Pretty cool, huh?