Sunday, 23 November 2008

Oblivion

So, I've been playing Oblivion a lot lately. What's that? A Windows game? Well, don't panic, I've been playing under Wine. It works perfectly with only the occasional crash. I've never played it under Windows so I don't know if this is usual or not but it wouldn't be the first windows game to have "issues".

Anyway, here a few tricks I've discovered.

1) Inventory woes

You don't need to play for long before you realise that you can't carry around anywhere near as much stuff as you want to and you are forced to discard stuff. This sucks.

Apparently, you can get around this by purchasing a house which is great but what about early in the game when you don't have the funds to do this? Well, what I've been doing is this;

Follow the main quest straight away until you get to the point where you have delivered the Amulet Of Kings to Jauffre. Go through the dialog and make sure you click on "Assistance". He will show you a chest full of stuff and invite you to take what you like. Well, I thought, I have some stuff that I am carrying around that I don't need right now so maybe I'll just pop that stuff in the chest. So far I've played for several hours with multiple saves and everything is still there, so I reckon that this will do as a storage facility until such a time that I can buy myself a house!

2) Invincible Meat Shield

Still on the main quest, you need to complete those up to the point where you are tasked with delivering Brother Martin to the Cloud Ruler Temple. Martin will start following you from that point. Cool, so now you can go dungeon exploring with Martin tagging along. He can't die and he will fight pretty well. You can keep this up for as long as you like I reckon as long as you don't go to the Cloud Ruler Temple.

Sunday, 19 October 2008

OOPS!


It seems someone at Telstra Bigpond is not managing their SSL cert's properly . . .

Thursday, 16 October 2008

Posting code to blogspot

I just found out how to post code snippets to blogspot

Use the (pre) & (code) tags to denote code segments (using normal html <> style tag brackets instead of the round ones used here)

(pre)(code)
Source code goes here
(/code)(/pre)


Once we replace the round tags we get output like this

Source code goes here

Tuesday, 16 September 2008

The End Of An Era

Sad news.

It seems the inmates have taken over the asylum over at my favourite tech news site, "The Register".

After nearly ten years of reading their site on a daily basis their horrendous new fixed width format is so utterly terrible that the site is no longer pleasant to read and I have to give up reading it.

They received a torrent of complaints to the comments section of their explanatory article entitled "OMFG what have you done?" and this is despite actively censoring many commenters. I myself was censored three times before I gave up and resorted to impotently whining about it on a blog that nobody reads. Other posters complained of the same censorship too, but maybe their moderators were so inundated with comments that many of them just fell into the bit-bucket at the end of the conveyer.

It doesn't matter anyway. It's their site, they can fcuk it up any way they please. It's hard to imagine why they would want to inflict such an appalling design on their readers but it seems they're quite willing to do so.

I have no idea what their motives are, other than change for change sake.

Idiots.

Tuesday, 5 August 2008

apt-get update GPG errors

I have a small network and I use apt-cacher as an apt proxy to save having to download the same thing multiple times. I also use an unofficial Ubuntu mirror that my ISP provides because I am on a capped plan and use of their repository does not count towards my downloads.

Unfortunately I have an occasional problem where aptitude decides that my GPG key is bad and I get errors like this on my local proxy;

W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used.GPG error: http://apt-proxy hardy-backports Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key

Now, I'm not sure whether the problem is with my local proxy or the ISP's mirror but to fix it I need to issue the following command;

sudo apt-get update -o Acquire::BrokenProxy=true

Everything should be OK from there. If you still have problems, I have also sometimes found that if 'sudo apt-get update' fails, using 'sudo aptitude update' instead works.

I have no idea why.

Saturday, 2 August 2008

Speeding up Firefox 3

1. Type “about:config” into the Firefox address bar and hit Enter.

2. Alter the following entries like so:

Set “network.http.pipelining” to “true”
Set “network.http.proxy.pipelining” to “true”
Set “network.http.pipelining.maxrequests” to "30"

3. Right-click within the browser and select New-> Integer.

Name it “nglayout.initialpaint.delay” and set its value to “0".

For more info check out this site.

Sunday, 27 July 2008

Sharing a mouse and keyboard with Synergy

If, like me, you have two computers on your desk with two keyboards and two mice and find yourself occasionally typing something on the wrong computer or clicking with the wrong mouse then this tip is for you.

First you need to install synergy on both computers;

sudo apt-get install synergy

Then choose one of the two to be the "server". You will use the keyboard and mouse that is connected to this computer. In this example the two PC's are side by side.

You will only need a configuration file on the server PC. Create one;

sudo vi /etc/synergy.conf

# sample synergy configuration file
#
# comments begin with the # character and continue to the end of
# line. comments may appear anywhere the syntax permits.

section: screens
server_pc:
client_pc:
end
section: links
server_pc:
left = client_pc
client_pc:
right = server_pc
end

Where server_pc and client_pc are the names of the two computers.

For example, my server PC is called "jupiter" and the client is called "saturn". The server is on the right (client on the left)


# sample synergy configuration file
#
# comments begin with the # character and continue to the end of
# line. comments may appear anywhere the syntax permits.

section: screens

earth:
saturn:

end

section: links
earth:
left = saturn

saturn:
right = earth
end


You can test the the setup with these commands;

On the server:

synergys -f --config /etc/synergy.conf

On the client:

synergyc -f server_pc

To start synergy automatically when gnome starts;

sudo gedit /etc/gdm/Init/Default

Add these lines just before the "sysmodmap=/etc/X11/Xmodmap" line:

On the server:

SYNERGYS=`gdmwhich synergys`
if [ x$SYNERGYS != x ] ; then $SYNERGYS --config /etc/synergy.conf
fi

On the client;

SYNERGYC=`gdmwhich synergyc`
if [ x$SYNERGYC != x ] ; then $SYNERGYC server_pc
fi

This starts synergy at the gnome login screen. Once you log in gnome kills the server so you need to start it again for your user session;

sudo gedit /etc/gdm/PreSession/Default

Add the same lines this time just before the "XSETROOT=`gdmwhich xsetroot`" line;

On the server:

SYNERGYS=`gdmwhich synergys`
if [ x$SYNERGYS != x ] ; then $SYNERGYS --config /etc/synergy.conf
fi

On the client;

SYNERGYC=`gdmwhich synergyc`
if [ x$SYNERGYC != x ] ; then $SYNERGYC server_pc
fi

Once you restart gnome on both the PC's you should be able to move the mouse left and right between the two screens. Keyboard focus will follow the mouse pointer.

Saturday, 26 July 2008

Dual-booting with Grub

On one of my PC's I still dual boot to Windows. Most of the online guides to dual booting instruct you to install Windows first and then install Linux and let Linux modify your boot sector accordingly.

I don't like doing it this way partly because I am an uber-geek and like to do stuff the hard way but also because i have a special setup whereby I can boot natively into Windows or I can boot the same Windows installation from within a vmware virtual machine which is neat. I might describe how to do that one day.

Anyway, to do this, Windows must be on its own separate drive and both Windows and Linux must use their own boot loaders and both must believe that they are booting from the primary hard disk.

To achieve this we must fool Windows into thinking that it is on the primary drive even tough it is on a secondary.

To do this we simply add the following stanza to /boot/grub/menu.lst

title Windows
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader +1

NOTE: The "map" lines have a 'space' between (hd0) (hd1). You will get "GRUB: Error 11: Unrecognized device string" error without that space.

If you want to hide/unhide partitions also add;
hide (hd0,0)
unhide (hd0,0)

Once you’ve made the change just update Grub with this command:

update-grub

When you reboot, you should see an option to boot Windows.

Notes:
For this to work, you must have a hard disk with a bootable, working copy of Windows on it. For example, install the HDD in your PC as the first drive (master) and install Windows. If it boots OK when you are done then remove the disk and install the one that has[will have] Ubuntu on it and set the Windows drive as slave. Modify grub as above and everything should be hunky-dory. (Disclaimer; If you muck any of this up it could render your PC unbootable and cause you much distress and possibly anger. It is your responsibility to ensure that you know what you are doing when mucking about inside your PC. For further info see this)

HOWTO: Mounting SSH directories

If you want to mount a directory on a remote PC then here is what you do.

Of course, to mount a folder via ssh the server must be running as a ssh server.

sudo apt-get install openssh-server

It is not necessary, but I strongly recommend that you set up passwordless ssh logins between the server and the client. The linked guide describes setting up SSH keys between two root users, so you do need to ensure that you configure things correctly for whatever pair of users you intend to use here.

From here on, all of the configuration we need to do is on the client.

1. Install SSHFS;

sudo apt-get install sshfs

2. Use the modprobe command to load fuse into the kernel;

sudo modprobe fuse

3. Set up the appropriate users & permissions;

sudo adduser username fuse
sudo chown root:fuse /dev/fuse
sudo chmod +x /bin/fusermount


If you've added yourself to the fuse user group, you need to logout and back in at this point.

To mount the home directory of "user";

sshfs user@host: mountpoint

Eg.

sshfs brett@server: ~/server_home

You can add a path after the colon.

Eg. to mount the "share" directory on the server (ie. /home/brett/share)

sshfs brett@server:/share ~/share

UPDATED: By default, only the user who has mounted the share has access to it. To allow access to root add the following option;

-o allow_root

For all users;

-o allow_other

To mount the share as read only;

-o ro

Eg. to mount the "share" directory on the server as read only and available to all users;

sshfs -o allow_other -o ro brett@server:/share ~/share

And that is all you need to do! Easy Peasy!

Backing up a directory

This method backups only files that have changed since the last backup. If a file has been deleted it will delete the equivalent file in the backup folder.

rsync -a source_directoy --delete destination

Usually, the backup location will be another PC, which can be done like this;

rsync --rsh=/usr/bin/ssh source_dir destIP:/destination_dir

eg:
rsync --rsh=/usr/bin/ssh ~ 10.1.1.2:/usr/backups/brett
will back up your home directory

Notes:
You can use a name instead of an IP address
Exclude unwanted files with the --exclude="filename" argument;
The above example will require a user account using the same name on both PC's
The destination PC will require ssh server software

sudo-apt-get install openssh-server

Bit-Copy a Hard Disk Over A Network

This method creates a disk image file for the backup using dd and nc (netcat). See also rsync

On the server (destination of the image file)
nc -l 5000 | of=disk.dd.gz

On the PC (disk to be backed up)
dd if=/dev/sda | gzip -9 | nc -q 5 hostname 5000

5000 is the listen port, you can choose any unused port you like

To restore the disk;

On the receiver (where the physical disk is)
nc -l 5000 | gunzip | dd of=/dev/sda

On the server (where the disk image is)
dd if=disk.dd.gz | nc -q 5 hostname 5000

Thursday, 10 July 2008

Creating an ISO image from a directory

If you want to create an ISO image from the files contained inside a directory you can use mkisofs;

mkisofs -J -r -o filename.iso path/to/files

If you get an error that the file will be bigger than 4GiB-1 then use this command;

mkisofs -allow-limited-size -udf -J -r -o filename.iso path/to/files

Tuesday, 8 July 2008

Switching between versions of Java

If you install Sun Java you may end up with two versions of java on your system. To select which one is active use this command;

sudo update-alternatives --config java

Thursday, 3 July 2008

Converting an RPM to a DEB

Sometimes the software you want to install is not available in the Ubuntu repo's and when you find it on the web you discover that "oh noes, it's only available as a Red Hat "rpm"

Never fear, it is usually possible to convert the rpm to a deb using alien. This should be done as a last resort however, it's always better to use a native deb package wherever possible.

The alien package is available from the multiverse repository. If you need to enable this repo see this post here

Install alien;

sudo apt-get install alien

To convert an rpm;

alien --to-deb --scripts package-xyz.rpm

As always, you should change package-xyz to the name of your package,

Thursday, 26 June 2008

Adding repositories

Ubuntu ships pre-configured to connect to the standard repositories.

A lot of extra packages are available from the "universe" and "multiverse" repositories.

You can add these by editing the file /etc/apt/sources.list (backup the original file first!)

gksu cp /etc/apt/sources.list /etc/apt/sources.list.bak
gksu gedit /etc/apt/sources.list

The sources.list file can look a bit daunting to the novice. Essentially there are four "sections" in each repository, they are;

hardy
hardy-updates
hardy-backports
hardy-security

Note: If you are using another release, replace "hardy" with the name of your release.

There are also four primary repositories;

main
restricted
universe
multiverse

The default sources.list file uses a seperate line for each repository and section. Most of the extra lines you require are already included but are commented out. You can uncomment them by removing the # from the beginning of each line that starts with "deb"

It is also possible to neaten things up by just adding all the repositories to a single set of four lines and simply removing everything else from the file (assuming you did the backup above!)

A simple sources.list using the repository at the main ubuntu site (http://archive.ubuntu.com) would be;

deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse

After you have made the changes and saved the file you need to tell the system to update the repository information;

sudo apt-get update

Now you have access to a whole lotta extra software goodness!

Tuesday, 6 May 2008

Packages

Traditionally on Linux systems, if you wanted to install a software package, you were required to obtain the source code and compile it using the compiler that was included in your system. This is still possible today, and hardcore geeks will still tell you it is the best way to maintain your system.

This may be true, but it is also more difficult for novice users and less convenient, especially when you need to update a package.

Fortunately, most modern linux distributions include software systems known as "package managers" which allows you to install pre-compiled binaries and avoid all that mucking about.

Ubuntu, being based on the debian distribution uses "deb" packages for installing binary packages.

While it is possible to download a deb file from the internet and install it (like installing an exe under that other OS), it is much better wherever possible to use your distributions online repositories to avoid being plunged into "dependency hell

In ubuntu, the easiest way to install software packages is by using "Add/Remove" on the "Applications" menu.

A lightly more advanced way is by using "Synaptic Package Manager" which can be found under "System>Administration"

On the command line you can use the apt-cache command to search for a package or apt-get to install and remove packages.

To search for a package using a text string;

apt-cache search | grep search_text

To install a package named "package"

sudo apt-get install package


Next we will look at adding extra software repositories.

Saturday, 26 April 2008

Introduction

A place for all the tips and tricks I've learned or gleaned while using Ubuntu Linux

I'm currently using 8.04 (Hardy Heron) but most of the tips should work on older releases as well as any debian based distro's.

Although I might occasionally mention graphic tools, I tend to prefer the command line so most of my tips are command line based using text editors.

Generally speaking, if I use italics in a sample command, the italics indicate a generic term that needs to be changed to suit your particular purpose. For example;

To view the manual page for a command in the linux shell;

man command