Locking Ubuntu Gnome Panel

Children have a knack for messing up anything tidy. Unlike their rooms, and the car, however, your computer can be kept orderly – at least in part. On Ubuntu, it is possible to lock down the panels (the top and bottom bars with icons and menus).

Firstly, get System Tools>Configuration Editor displaying. Do this from System>Preferences>Main Menu.

Once the menu item is available, go to System Tools>Configuration Editor>apps>panel>global>locked_down and tick it. In Karmic there appears to be no need to reboot or restart Gnome. It is not too painful to undo this, make some changes, and relock it if necessary.

Making custom emblems for Ubuntu

Have you ever wanted to make your own emblems for Ubuntu? It is very easy. Just use the GIMP (or something similar) to make a png image (make it at least 40x40px) and then open nautilus (e.g. Places>Home Folder>Edit>Backgrounds and Emblems and add it. I store all my emblems in ~/Pictures/emblems. For a brilliant overview of adding emblems etc visit http://www.go2linux.org/How-Customize-Ubuntu-with-Backgrounds-and-Emblems.

Karmic RC sound problem

Installed Karmic release candidate. Trying to play various media. Oops. Attempts to get plugins for Firefox failed but fortunately I know the magic trick:

sudo apt-get install ubuntu-restricted-extras

OK. But no sound to hear the media with. I seemed to fix the problem with two small changes under System>Preferences>Sound>Output. I changed the device for sound output from one option to the other (both labelled “Internal Audio Analogue Stereo”) AND the connector from “Amplifier” to “No amplifier”. No idea why those weren’t set correctly for my system from the get-go and no idea why they’re relevant – just grateful to be hearing sound :-). My soundcard is a Soundblaster Audigy 2.

BTW the command cat /proc/asound/card0/codec#* | grep Codec didn’t work for me as the only thing similar in the rough location was cat /proc/asound/card0/codec97#0/ …

64-bit Jaunty guest on 32-bit Jaunty host with VirtualBox

If your processor supports 64-bit you can run a 64-bit OS on top of your 32-bit OS using VirtualBox. Which can be very useful e.g. for testing an application you are developing in different environments.

Your CPU must support 64-bit. To test (thanks http://www.cyberciti.biz/faq/linux-how-to-find-if-processor-is-64-bit-or-not/):

grep flags /proc/cpuinfo

and look for lm (long mode) .

Your BIOS must support 64-bit. I believe it will usually be set correctly if using something like a Core 2 Duo CPU but that needs confirmation.

Install a 64bit version of Linux. NB the correct Ubuntu package will say AMD64 even if it is for an Intel CPU because of some licensing deal. E.g. “Alternate install CD for 64-bit PC (AMD64) computers (standard download)” is still the correct option even if using an Intel Core 2 Duo CPU.

Apparently, “A 64 bit host CPU is not enough to run 64 bit guests (in contrast to VMWare). It must also have virtualization extensions. ” (https://help.ubuntu.com/community/VirtualBox/Installation). See http://en.wikipedia.org/wiki/X86_virtualization for a list of supported CPUs.

To confirm your OS is 64-bit

uname -a

Finally, here is relevant information from the VirtualBox User Manual:

Starting with Version 2.1, you can even run 64-bit guests on a 32-bit host operating
system, so long as you have sufficient hardware.
In particular, 64-bit guests are supported under the following conditions:
1. You need a 64-bit processor with hardware virtualization support (see chapter 1.2, Software vs. hardware virtualization (VT-x and AMD-V), page 11).
2. You must enable hardware virtualization for the particular VM for which you want 64-bit support; software virtualization is not supported for 64-bit VMs.
3. If you want to use 64-bit guest support on a 32-bit host operating system, you must also select a 64-bit operating system for the particular VM. Since supporting 64 bits on 32-bit hosts incurs additional overhead, VirtualBox only enables this support upon explicit request.

and

VirtualBox’s 64-bit guest support (added with version 2.0) and multiprocessing (SMP, added with version 3.0) both require hardware virtualization to be enabled. (This is not much of a limitation since the vast majority of today’s 64-bit and multicore CPUs ship with hardware virtualization anyway; the exceptions to this rule are e.g. older Intel Celeron and AMD Opteron CPUs.)

Ubuntu Karmic Alpha 5 Editing GRUB2

I used to know how to edit /boot/grub/menu.lst to change the order of Operating Systems (e.g. Windows XP, Ubuntu Jaunty, Ubuntu Karmic, and Kubuntu Jaunty), set the default, and set the delay. But with alpha 5 of Ubuntu Karmic that has all changed with the introduction of GRUB2. Here’s what I did instead.

Your goal is to change /boot/grub/grub.cfg but you shouldn’t do that directly. You should change some config files and then run a special grub update command.

Open one of the config files for other OSs (as root):
sudo gedit /etc/grub.d/30_otheros
[update]
sudo gedit /etc/grub.d/30_os-prober

I commented out redundant entries e.g. different kernel versions, and then saved it.

Then edit the main grub config file:
sudo gedit /etc/default/grub

I changed the relevant line to:
GRUB_DEFAULT = 4
so that the 5th item (0,1,2 …) would boot by default.

Finally, run the grub update command to regenerate /boot/grub/grub.cfg:
sudo update-grub

You can check the result in /boot/grub/grub.cfg to see everything went well.

Not a lot trickier than under plain GRUB and apparently GRUB2 has a lot of possible benefits depending on your circumstances (http://www.gnu.org/software/grub/grub-2.en.html).

BTW GRUB2 has attracted some controversy and there are some interesting points in the following article and its comments (http://aronzak.wordpress.com/2008/09/30/stay-away-from-grub2/).

Printing Scripts from Eclipse in Ubuntu

Printing scripts can be very useful – but not if the font size is enormous. Unfortunately, eclipse (3.4.1) under Ubuntu (Jaunty) had exactly this problem (see also http://www.coderanch.com/t/106543/IDEs-Version-Control-other-tools/Printing-eclipse). A solution I found was to shrink the font, print, and then restore the font. Given that I hardly ever want to print scripts (only when I’m really, really stuck and dealing with a complex piece of code) this is an acceptable workaround.

But how do you change the font? Doug Hughes supplied the answer here – (http://www.alagad.com/go/blog-entry/changing-the-font-size-in-eclipse). In Ubuntu it is Window>Preferences>General>Appearance>Colors and Fonts>Text Font. Because of the hundreds of options available, it can be very difficult to find the ones you need most.

Full-screen Warcraft under Wine

Dimitar Boichev shows how you can play games like Starcraft and Warcraft in full-screen under WINE in his Full Circle article (Better Game Speed With X).

Here is what worked for me (minor changes from what Dimitar did):

sudo gedit /etc/X11/Xwrapper.config

Change:

allowed_users=console
to
allowed_users=anybody

Then save and quit.

Applications>Wine>Configure Wine select the game you want under applications and then, under Graphics, make sure you untick “Emulate a virtual desktop”.

I also copied /etc/X11/xorg.conf as /etc/X11/only_one_monitor.conf so that I could handle my dual monitor setup by playing Warcraft full-screen in one monitor only. I needed to change:

"TwinView" "1"
to
"TwinView" "0"
i.e. turn dual (twin) view off

Then I created a bash script with the following content (NB to use your username and the correct path to your game) and saved it to my desktop:

#!/bin/bash
X :2 -ac -terminate -config only_one_monitor.conf & sleep 2
DISPLAY=:2 nice -20 env WINEPREFIX="/home/username/.wine" wine "c:\Program Files\Warcraft III\Warcraft III.exe"

NB there are only 3 lines – the line starting DISPLAY goes to the end.

Then make the bash script executable (under the file’s Properties>Permissions>Execute – tick the tickbox). Double click it and select run to enjoy full-screen Warcraft etc.

Ctrl+Alt+F7 and Ctrl+Alt+F9 lets you switch between X windows.

One further way of improving your Ubuntu Warcraft experience – grab the latest patches. Then there will be no need to have the CD in the tray to play plus some other enhancements. NB not to confuse Warcraft The Frozen Throne (TFT) with Reign Of Chaos (ROC).

A key link is here – http://www.tipsfor.us/2009/06/04/install-warcraft-3-on-ubuntu-linux-a-visual-guide/ thanks to Brian. You can also grab some nice icons.

For reference, the files I needed were War3ROC_122a_English.exe and then War3Patches_ROC_122a_123a_enUS.exe.

Using Xsane without going Insane

Xsane works well enough once you figure out the interface. Whatever you do, don’t accidentally mess the colour settings up ;-). Here is a tentative set of instructions for mass scanning of photos my mother put together using Xsane on Intrepid. I’ll expand upon them later from a machine with a scanner on it:

Applications>Graphics>X-Sane
Choose appropriate scanner

Within X-Sane, Preferences
Window – Show Preview
Viewer – change to SAVE if doing multiple
Choose folder for saving to
Choose TIFF
Choose COLOR or GREY
Choose 300 for Dots per inch

SCAN

PREVIEW
Acquire preview then crop

PREFERENCES Name file in folder
Scan
Check folder

Screencasting sound jumbled – solved

gtk-recordmydesktop is brilliant and easy to use. You just open it and press record. Click a button on the top panel to stop it. Simple! Then you have a video screencast of whatever you were demonstrating on your desktop.

Installation is a breeze on ubuntu with:

sudo apt-get install gtk-recordmydesktop

Unfortunately I had a problem recording sound. I changed the Advanced>Sound>Frequency setting to 48000 but it still didn’t work. It worked fine BTW on my Jaunty notebook without any changing from the default settings. The answer was interesting to say the least. Under device, it said DEFAULT in capitals. Give yourself points if you can guess in advance where this is going ;-). Anyway, if you put something like CA0106 in instead it would produce an error message “Recording is finished. recordMyDesktop has exited with status: 768. Description:Could not open/configure sound card.” DEFAULT didn’t produce this problem. It simple jumbled / garbled the sound so it all appeared in the first few seconds of the screencast.

Solution: set the device to default instead of DEFAULT ;-). I was able to test it both ways back and forth and that was (unbelievably) it. I hope this helps somebody.

P.S. I should also mention I had changed ; default-sample-rate = … to default-sample-rate = 48000 in /etc/pulse/daemon.conf and made sure I was using PulseAudio as the Sound capture under System>Preferences>Sound. It can be hard to tell excatly what is was, or what combination of things, resulted in success and I’m going to leave it well enough alone for now and get screencasting 😉