64 bit division

If you are trying to do this inside the kernel:
unsigned long long arg1, arg2;
arg1 = arg1/arg2;


and you get this error:
Unknown symbol __udivdi3

You ought to do this instead:
unsigned long long arg1, arg2;
unsigned long temp = arg1;
do_div(temp, arg2);
arg1 = temp;

Installing RPMs on Ubuntu

Method 1

1. Install rpm
$ sudo aptitude install rpm

Along with other things it would install rpm2cpio. (RPM and initramfs use the CPIO archiver)

2. Extract the contents of the RPM
$ rpm2cpio < some-package.rpm | cpio -i --make-directories --verbose

3. Copy over the required files to the different directories.



Method 2

1. Install alien
$ sudo aptitude install alien

2. Covert the .rpm to .deb
$ sudo alien --to-deb --scripts --verbose some-package.rpm

NOTE: Alien internally uses rpm2cpio, so make sure you have installed rpm.

--scripts : If the .rpm has scripts then you need to include those

3. Install the .deb file.
sudo dpkg -i some-package.deb

The advantage of converting it to .deb and installing using dpkg is that you can manage the install\uninstall\reinstall and version using apt\aptitude.

LCD monitor resolution

Got a new Samsung 22" 1920x1080 monitor and the default resolution being shown was 1280x800. Now with 8.04 I used to do dpkg-reconfigure xserver-xorg and it would redo the X11 configuration.

In Jaunty, the above command just configures the keyboard setting. In order to get the monitor to work with the correct resolution do

$ xrandr

This would probe the monitor and display the resolutions, then do the following

$ xrandr --output VGA --auto --above LVDS

emacs - indent entire buffer

c-set-style {chose the mode}
C-x h
C-M \


Line 2: selects the entire buffer
Line 3: changes the indentation

20 great GDM screens for Ubuntu

Awesome GDM screens for Ubuntu, here

Installing is very easy:

1. Click on the theme you like and download the archive.
2. Right click on your name on the upper right-side toolbar and select "Setup login screen"
3. Click on "Local" pane, then on the "Add" button, browse to the folder where you downloaded the archive (tar.gz) and then select the theme.

Bingo! you are done. logout and log back in!!

The best part is that you can select "Random from selected", pick the best ones and every time you login, it would be a different theme!

emacs client

When one instance of emacs is already running and you want to open files from command line into the same instance, use emacs client.

First, start the emacs server. Add the following line in your .emacs file:
(server-start)

Start emacs, and use emacs client from the command line to open the files in the already open emacs instance:
emacsclient -n filename

It helps to create an alias:
alias cemacs='emacsclient -n'
alias emacs='emacs &'