Friday, December 12, 2008

How I set right non-functional spell-checker in OpenOffice.org3

Spell Checker was not working in my install of OpenOffice.org3 on Slackware 12.1. Wrongly spelt words were not being highlighted. Pressing F7 after selecting text containing spelling-errors was not detecting any errors. After a lot of skulduggery and quite a bit of googling, I realized that the problem was some how related to locales, hence I added the following line to /opt/openoffice.org3/program/soffice -

export LANG=en_US

Now spell checker works!

Sunday, August 31, 2008

Empty Applications Menu? Repopulate it.

All of a sudden, one fine morning I found that the Applications Menu in GNOME on my Ubuntu 8.04 laptop was empty. When I clicked on the Applications Menu, all I got was a small rectangular box, about a few pixels in dimensions. I found a solution to this, (the solution was the first result that Google threw at me). This problem seems to occur when there is not much hard disk space left. When this occurs, you are unable to run alacarte even from command prompt.
The solution is to delete the file from ~/.config/menus/ directory.
$rm ~/.config/menus/
After this the Applications Menu is restored.

Saturday, August 23, 2008

ls tips - 1

Sometimes it becomes necessary to search for all files that end in a particular character, like, for example a digit. The following command will list out all files that have filenames ending in a digit -
$ ls | grep '[0-9]$'

It is essential that the $ symbol is placed after the paranthesis. This $ symbol will cause grep to look for the digits from 0 to 9 at the end of the filename.
A better way would be -
$ ls | grep '[[:digit:]]$'

Similarly, if you want to search for filenames that begin with a digit, here is the command -
$ ls | grep '^[0-9]'

$ ls | grep '^[[:digit:]]'

This will list all filenames that begin with a character.

Friday, August 22, 2008

Giving Maximum processing time to any process

To give maximum processing time to any process, first the PID of the process has to be determined using the command ps. Say you have firefox running and you want to determine its PID.
$ ps -A | grep firefox

on my system gives the following output
12845 pts/0 00:04:00 firefox

so 12845 is the required PID.
By issuing the following command we can give maximum priority (-20) to the particular process -
$ sudo renice -20 12845
This can be ascertained using the 'top' command.

Re-installing GRUB in Ubuntu

Imagine a scenario, wherein you have installed a brand new distro on a system that already has some other distro installed. You have properly configured the GRUB to enable you to multi-boot. Now for some reason, you do not like the GRUB of the distro that was last to be installed, you want to revert back to the previous one. So what do we do now?
The solution is to boot into the required distro from the GRUB menu and then follow these steps -
1. Login as root from the command prompt and enter the following command
# sudo grub
grub > find /boot/grub/stage1

Let us say, the command returns (hdx,y).
2. Then enter the following commands -
grub > root(hdx,y)
grub > setup (hdx)
grub > quit

That's it! When you reboot, you'll be presented with the previous GRUB screen.

Thursday, July 31, 2008

Getting the Touchpad to work in Slackware!

This is how I got the touchpad on my laptop to work using synaptics.

After installing synaptics, the following lines have to be added to /etc/X11/xorg.conf. Before fiddling with xorg.conf, it is always suggested that you take a backup of the file -

# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old

The lines to be added to xorg.conf are as follows -

Section "Module"
Load "synaptics

Then in the "InputDevice" Section -

Section "InputDevice"

Identifier "Synaptics Mouse"
Driver "synaptics"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
Option "LeftEdge" "1700"
Option "RightEdge" "5300"
Option "TopEdge" "1700"
Option "BottomEdge" "4200"
Option "FingerLow" "25"
Option "FingerHigh" "30"
Option "MaxTapTime" "180"
Option "MaxTapMove" "220"
Option "VertScrollDelta" "100"
Option "HorizScrollDelta" "100"
Option "MinSpeed" "0.09"
Option "MaxSpeed" "0.18"
Option "AccelFactor" "0.0015"
Option "SHMConfig" "on"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"


Then in the "ServerLayout" Section

Section "ServerLayout"

Input Device "Synaptics Mouse" "CorePointer"


After this reload the "psmouse" module as follows -

$ sudo modprobe -r psmouse
$ sudo modprobe psmouse

This should be added to your startup scripts.
The touchpad should be working after you reboot.

Sunday, July 20, 2008

Command Line Music Player!

mpg321 can be used to play mp3 files from command line. We can even create a playlist of all the songs stored in various directories and play the list via mpg321. If your songs are stored in various folders, the folder names can be appended to the file-names using the following script. First of all the spaces have to be removed from the file names (as described in a previous post). Then we can create the following script -

for i in *;
b=`echo $PWD\`$i;
echo $b >> playlist; # the file names are stored in "playlist"

this way the names of all the files in all the subdirectories will be stored in "playlist" along with the appropriate path. Then we can play the list
as follows -

$ mpg321 --list playlist -z # -z for shuffle mode

That is it! Enjoy your music! Here we are assuming that all files are stored in various subdirectories of one parent directory, say 'music'. The script has to executed from the directory 'music'.

Samsung ML 2010 on Slackware 12.1

The Samsung ML 2010 is automatically configured on Ubuntu, however on Slackware 12.1, the Samsung Unified Driver fails to install with the following error -

Unable to restart cups, script not found.

After going through the install script in the cdroot/Linux directory created by untarring the driver, if found that the para - restart-cups() in the script reads as follows -

elif test -e /etc/init.d/cupsys; then

it is obvious that the installer wouldn't work. So I changed it to

elif test -e /etc/rc.d/rc.cups; then

Moreover, the driver to be used for this printer is the one for 2150 and not 2010, that is the right driver is ML-2150 SPL II instead of ML-2010.

Saturday, July 19, 2008

Removing spaces from file names!

The following script, which I found here after an hour of googling, can be used to remove spaces and replacing them with any character (like '_') from file names

$ for f in *; do
> file=$(echo $f | tr ' ' _)
> [ ! -f $file ] && mv "$f" $file
> done

Command line utility to print a Calendar

$ cal

will print out a calendar for the current month on the screen.

$ cal 2008

will do the same for the year 2008.

$ cal 03 2008

will do the same for the month of March, 2008. If, however, we want to print the calendar as a .ps file, we can use the pcal utility.

$ pcal -w 2008 -s 0:0:0 -P a4 >

We can convert this .ps file to .pdf using

$ ps2pdf 2008.pdf

Command Line Calculator!

To do small calculations without starting your calculator utility here is a small trick. Suppose you want to multiply 2 and 3, do this -

$ echo $[2*3]

However if you wanted to divide 2 by 3

$ echo $[2/3]

would give a '0'.

We can still make use of the command line to get the correct answer. We have to use 'bc'. Like this -

$ echo '2 / 3' | bc -l

Here is the output -


Friday, July 18, 2008

Magic Keys (Alt + SysRq)

When your Linux install completely refuses to respond and no amount of coaxing and cajoling brings it back to life you can try -
  • Alt + SysRq + k
This will kill all running programmes and will drop you back to the login screen.

Even this fails? The try this -

  • Alt + SysRq + r + e + i + s + u + b
This is easy to remember with the help of the mnemonic "Raising Elephants Is So Ultra Boring".

Explanation -
  • Alt + SysRq + r = raw keyboard mode
  • Alt + SysRq + e = ends all programmes
  • Alt + SysRq + i = kills all programmes that did not terminate nicely
  • Alt + SysRq + s = syncs the disks
  • Alt + SysRq + u = remounts all filesystems as read-only
  • Alt + SysRq + b = reboots
But for this to work two things are required
  1. Your kernel must support magic keys
  2. The following line must be appended to /etc/sysctl.conf
  • kernel.sysreq=1
So when your Linux box simply refuses to respond (yes, even a Linux box does sometimes act up), you can safely tide over the situation if you follow these instructions.

Thursday, July 17, 2008

How I configured Wireless Internet on my Slackware 12.1 installation!

I have a Broadcom Wireless card on my Acer Aspire 5100 laptop running Slackware 12.1.
This is how I configured a wireless network -
  1. Downloaded and installed ndiswrapper from Linuxpackages site.
  2. Copied the card drivers from Windows. The drivers are bcmwl5.inf and bcmwl5.sys.
  3. Then I installed the drivers using ndiswrapper as
    $ ndiswrapper -i bcmwl5.inf
  4. To check whether the drivers have been properly installed, issue the following command
    $ ndiswrapper -l
    the driver should be listed here.
  5. Then we have to make sure that /etc/rc.d/rc.netdevice loads ndiswrapper
  6. Edit /etc/rc.d/rc.inet1 to incorporate the wireless card details like essid, key etc.
  7. unload the following modules - b43 and ssb using the following commands
    $ sudo modprobe -r b43 ssb
  8. Load bcm43xx and ndiswrapper
    $ sudo modprobe bcm43xx
    $ sudo modprobe ndiswrapper
  9. Restart the network as
    $ sudo /etc/rc.d/rc.inet1 wlan0_restart
  10. Bring up the wlan0 interface as follows -
    $ sudo ifconfig wlan0 up
That's it. The wireless internet connection was up and running!

Using ffmepg to convert a '.rm' file to '.mp3' format

Ffmpeg is a nifty command line utility. Among the various things it can do, converting a '.rm' file to '.mp3' format is one. I was looking for a utility to convert a beautiful Telugu song in .rm format to .mp3 format. Ffmpeg came to my rescue.

I keyed in the following in a terminal and I was through in a jiffy -
    $ ffmpeg -i filename.rm filename.mp3