Thursday, July 01, 2010

Thunderbird settings

To set the default sort/view for folders to descending/threaded

mailnews.default_sort_order: 2 (1=ascending, 2=descending)
mailnews.default_view_flags: 1

Labels: ,

Friday, June 20, 2008

Dynamic terminal titles

I generally have multiple terminal windows open when working on linux and often it gets confusing figuring out which host/directory each terminal is in. The following lines in my .bashrc file get me dynamic titles for my xterm or gnome-terminal windows in linux or putty. Titles change every time I change directories, with my home directory (for ex. /home/atul) replaced with a '~'.

export SHORT_HOSTNAME=`hostname -s`
PROMPT_COMMAND='echo -ne "\033]0;$SHORT_HOSTNAME: ${PWD/$HOME/~}\007"'

Friday, September 29, 2006

GRUB reinstall woes

I recently had to reinstall Windows on my dual boot (Windows/Ubuntu 6.06) system. This of course wiped out the GRUB loader in the MBR. Now, the normal method of restoring GRUB is to do this:
1. Boot from your linux installation CD (In case of Ubuntu just go through the Start or Install Ubuntu routine till you get the desktop)
2. Open up a terminal and mount your boot partition
3. Switch the system root and do a grub-install to restore the grub from the boot partition on your MBR.

Now the normal commands to do this do not work in Ubuntu for some reason. For example, doing
$ sudo mkdir /mnt/ubuntu
$ sudo mount /dev/sda8 /mnt/ubuntu #(/dev/sda8 is my / partition)
$ chroot /mnt/ubuntu
$ grub-install /dev/sda #(install grub to the MBR)

This kept giving me errors like "/dev/sda: Not found or not a block device". After some searching I landed up at this Ubuntu Wiki page that lists a number of approaches to reinstall GRUB. Some of them still didn't work, but the one that did work is this:

1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty (Ctrl + Alt + F1).
3. Type "sudo grub"
4. Type "root (hd0,7)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda8, which translates to hd0,7 for grub).
5. Type "setup (hd0)", or whatever your harddisk number is.
6. Quit grub by typing "quit".
7. Reboot.


Happy GRUBbing :)

Labels: , , ,

Friday, July 21, 2006

Vim settings

My custom settings for {g}vim:
set ignorecase
set autoindent
set hlsearch
set incsearch
set shiftwidth=4
set softtabstop=4
set nowrap
set nobackup
set writebackup
set cindent
set lines=35 columns=100
:colorscheme desert

Tuesday, February 14, 2006

Adding users to mysql

MySQL's permissions differentiate access to a database by a user not only on the user name, but also on the location from which the user is accessing the database. For example, user "foo" accessing the database from the same machine as the mysql server may not be the same "foo" using it from a remote client. For this, the "user" table in the default "mysql" database has an extra field for "host" to specify the users and their permitted locations.

One can use the GRANT command to add new user and his location to the permitted users as follows:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
You can allow acces from a specific remote machine as follows:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'myremotemachinename' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
or to allow access from any remote machine, use the '%' wildcard:
GRANT ALL PRIVILEGES ON mydatabase.* TO 'foobar'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

Thursday, December 29, 2005

चाचणी

नवीन टेंप्लेट साठी चाचणी.

Friday, December 16, 2005

Mouse wheel scrolling in Linux

The default installation for Slackware Linux does not have mouse wheel scrolling enabled. This is what I did to enable mouse wheel scroll:

(You need to have root permissions for this procedure)
Open up the X-Server config file (/etc/X11/xorg.conf)
Find the mouse/input device section (generally identified by the Identifier "mouse")
Make sure it is using the IMPS/2 protocol. This can be done by adding or updating the Protocol option:
Option "Protocol" "IMPS/2"

You need to set up the server to recognise the wheel as another button on the mouse. This is done by setting the "Emulate3Buttons" option and the "Buttons" option to 5.
Option "Emulate3Buttons"
Option "Buttons" "5"

Finally, scrolling is enabled by setting the ZAxisMapping option
Option "ZAxisMapping" "4 5"

Restart the X-server (Ctrl+Alt+Backspace should do it) and the mouse wheel should start working.

Labels: ,