The world according to Robin

A techno-related blog with tips and tricks, and the occasional rave about… anything!

Changing keyboard shortcuts in Ubuntu is fairly easy. First, check a rather limited list of commands by opening System -> Preferences -> Keyboard Shortcuts. If the task you want to assign a keyboard shortcut to is listed, simply change or assign a desired shortcut to the task and you are done. However, if you are like me, it is likely that your desired task (application, script, etc.) is not listed. In this case, you can use the Gnome Configuration Editor.

Let us change the default behaviour of Ctrl+Alt+Delete to open up the System Monitor instead of displaying the logout screen:

  1. Open Keyboard Shortcuts, go to Desktop, and change Log out from Ctrl+Alt+Delete to something else, for example Ctrl+Alt+Home.
  2. Press Alt+F2 and run gconf-editor.
  3. Maneuver to apps -> metacity -> keybinding_commands.
  4. Doubleclick a command key, for example command_1, and enter the command gnome-system-monitor. The full path may be necessary for a script or or other command (e.g., /home/username/myscript.sh).
  5. Maneuver to apps -> metacity -> global_keybindings.
  6. Doubleclick the run key corresponding to the command key in step 4, i.e., run_command_1, and enter the desired keyboard shortcut, Delete.

If you are running Compiz Fusion as your window manager, it may be that you must use the CompizConfig Settings Manager (CCSM) to change the keyboard shortcut. This method is even simpler:

  1. Go to System -> Preferences -> Advanced Desktop Effects Settings and select the Commands tab under General Options.
  2. Select the Commands arrow button and enter gnome-system-monitor in a command line, for example command line 0.
  3. Select the Key bindings arrow button and click the button corresponding to the same run command, i.e., Run command 0. Enable it and enter the desired shortcut key combination.

After completing the procedure above, Ctrl+Alt+Delete will now open the System Monitor, while Ctrl+Alt+Home will show the logout screen.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

When running Compiz Fusion as the window manager in Ubuntu and having the 3D cube enabled, there is a known bug in the Ubuntu distros that can cause video playback to only display a black or blue screen (the sound is fine). Apparently, the bug has to do with a conflict relating to the video output driver xv. Compiz Fusion prevents the video application to use the driver. A workaround is to change the video output driver of your video application, for example vlc, to x11. A procedure that worked for me is outlined below and was posted in the Compiz Fusion forum by user kevinmedina, who got his inspiration from Gremlinzzz, who posted a solution here.

Procedure:
GStreamer
(The default video player in Ubuntu, totem-gstreamer, and any video player that is based on the gstreamer backend)

  • Open a terminal and do
    gstreamer-properties
    
  • Click the Video tab.
  • Under Default Video Plugin select “X Window System (No Xv)”.
  • Click Test to verify that video playback is working (you should be able to see the standard TV testing colour stripes).
  • Click Close

VLC
(VLC is not installed by default; you need to search in the package manager, then install)

  • Start VLC and click on Settings, then Preferences.
  • Expand Video and then expand Output modules. You will notice several options for output device.
  • Select the item Output modules, and notice the checkbox at the bottom right that says Advanced options. Check the box, and now you have the option to select a different output device.
  • Pick X11 video output
  • Click on Save and you are set!

MPlayer
(Mplayer is not installed by default)

  • Start Mplayer
  • Right-click on the screen and select Preferences
  • Select the Video tab and under Available Drivers select “X11 (XImage/Shm)”
  • Click Save and restart the program for the setting to take effect.
  • Some users reported that MPlayer may not be able to show videos in full screen.

Xine

  • Start xine
  • Click File, then Configure and then Preferences
  • In experience_level select “Master Of The Known Universe” so that all available settings are visible.
  • Select the tab for video.
  • Under Driver select “xshm”.
  • Restart xine.
  • The same process enables Totem that has the totem-xine backend configured.

A screenshot of the 3D cube with working video (“One night in Paris”) is shown below:

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Free online chess at FICS

No comments

If you are tired of playing chess against your computer and/or do not have many friends who can or want to play chess, you may want to check out online chess. Perhaps the most popular free online chess provider is the Free Internet Chess Server (FICS). Logging on to one of their servers, you can play normal chess (lightning, blitz, standard) or variants such as suicide, atomic, or crazyhouse.

In order to play you should download a chess client. This is a graphical user interface (GUI) which typically provides all the necessary functionality and communicates with the chess server. Log in anonymously or with a username that you have registered at FICS, who also provide links to popular chess clients for Windows, Mac, or Unix/Linux. Good choices are Babaschess for Windows and eboard for Unix/Linux.

Being registered at FICS is highly recommended, as you get an official rating, comparable, but not identical, to those used by Kasparov (well, he is retired), Kramnik, Norwegian Magnus Carlsen (ranked fifth in the world) and others (check out the FIDE ratings). The server keeps track of your statistics such as number of games lost, drawn, or won, your rating in the various gameplays, as well as other details such as percentage of life online (!).

Steps to take:
1. Register a username (“handle”).
2. Download a chess client, for example Babaschess or eboard.
3. Connect to FICS via the chess client.

Useful commands:

help, help commands, finger, history, seek, match, tell

For more information, see Wikipedia.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
It would be nice to have a simple way of including Matlab source code in LaTeX documents. Fortunately, Florian Knorn has made an excellent solution with his LaTeX style-file (.sty), which can be downloaded (mcode.sty) at MATLAB Central.

You may want to open mcode.sty in a text editor for details on its usage. Basically, what you need to do, is as follows:

  1. Place mcode.sty in the same folder as your tex-file, or add it to your path (see the documentation of you TeX-installation).
  2. Add
    \usepackage[options]{mcode}
    

    to the preamble of your tex-file. Options include:
    bw if you intend to print the document (highlighting done via text formatting (bold, italic) and shades of gray)
    numbered if you want line numbers
    framed if you want a frame around the source code blocks
    final if you have “globally” set the draft option, the listings package will not output the code at all. To force it to do so anyway, load this package with the final option (passes the final option on to listings).

  3. Include Matlab source code in your tex-file by either including the entire *.m source file
    \lstinputlisting{/path_to_mfile/yourmfile.m}
    

    or placing snippets of source code in a lstlisting environment.

    \begin{lstlisting} % Example Matlab code for calculating hypotenuse
    % § $c = \sqrt{a^2+b^2}$ §
    a = 3;
    b = 4;
    c = sqrt(a^2+b^2);
    \end{lstlisting}
    
  4. Note: Inside code blocks you can ‘escape’ to LaTeX mode by using § YOUR LATEX CODE §, which is especially useful in comments.

In case the link to mcode.sty breaks in the future, you can download the style file below. Enjoy!

Download mcode.sty

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)