Saturday, September 23, 2006
This blog has been moved to a new domain. Please update your links/feeds to point to the new domain http://www.chandanr.net/blog
Monday, August 14, 2006
Detailed Dual Boot Configuration
If you have installed windows on a linux system and are not able to boot into your linux or vice versa then this article gives details steps for rescuing your system and configuring dual boot. In this article you can read "Suse Linux 10.1" as any linux distribution. 1. Insert the bootable SuSe 10.1 CD/DVD into the drive and boot the system from the CD. If your system doesnot boot from the CD, you have to make modifications to the priority of your CD drive in your system's bios boot settings. 2. On booting from the CD, choose the "Rescue System" option. Now image from the CD will be loaded to give you a rescue shell. 3. On the "Rescue login:" prompt enter "root". Now the rescue shell is ready for repair. 4. Run "fdisk -l" to display all the partitions in your hardisk(s). From this you can know on which partition you have installed linux and windows. Suppose if you have connected your harddisk as primary master then all its partition entries will be listed as /dev/hda*. Refer to Notes(1) if your hardisk configuration is different. If you have installed windows on primary partition of your harddisk then you would find an entry like -- "/dev/hda1 * 1 1216 9767488+ c W95 FAT32 (LBA)" If you have installed SuSe Linux on first logical partition then you would find an entry like -- "/dev/hda5 1217 2432 9767488+ 83 Linux" 5. After determining the partition on which SuSe linux is installed(in this case /dev/hda5), mount the partition. mount /dev/hda5 /mnt Now contents of the /mnt directory will correspond to the / directory of your installed SuSe Linux. 6. Open the GRUB's menu file(GRUB is the boot loader, which provides a choice for selecting the OS to boot into when your system is powered on) vim /mnt/boot/grub/menu.lst 7. Go to the end of this file and add the following entry for windows title Windows XP rootnoverify (hd0,0) chainloader +1(hd0,0) Save the modifications and close the file. You may get the following Warning message, which can be safely ignored "Can't write viminfo file /root/.viminfo". This is because while rescuing we have booted into the readonly filesystem in the CD. 8. Open the device map file of grub and make sure an entry for your hard disk is listed there. vim /mnt/boot/grub/device.map In this case you should find the following entry listed "(hd0) /dev/hda" 9. Now we are ready for the final step - installing grub. Run the following command: grub-install --root-directory=/mnt/ /dev/hda You may have to modify the above command if your hard disk configuration is different. Refer to Notes (1) for details. On successful installation you should get the following message - "Installation finished. No error reported" 10. Now we are done with the rescue. Remove the CD from the drive and reboot the system to get GRUB with newly added entry. Notes: 1. Hard disk configuration to device name mapping:- Primary Master: /dev/hda Primary Slave: /dev/hdb Secondary Master: /dev/hdc Secondary Slave: /dev/hdd 2. Partition numbers Usually a hard disk is divided into one primary partition and one extended partition. The extended partition is then divided among one or more logical partitions. Primary partition of a disk is numbered 1. (like hda1) Extended partition of a disk is numbered 2. (like hda2) Logical partitions of a disk are numbered starting from 5. (like hda5,hda6)
Sunday, August 13, 2006
Scripting always fascinates me. The thing i like about scripting is the ease with which you can get do something. The final code looks really neat and simple. Though scripting is cool, its needless to say that it has its own drawbacks. Nevertheless it is fun to write scripts to solve some simple problems.
We usually associate scripting with command line interface. But in the realm of GUIs and desktops we can think of different kind of scripting - the "Higher-level scripting". Higher-level scripting involves use of some protocols, like CORBA or DCOP, to interact with high level applications. CORBA (Common Object Request Broker Architecture) is an old classic example of interoperability protocol, which could be implemented to communicate between different applications. But CORBA implementations are usually slow, to be accepted for inter-application non-network communications. So KDE devised DCOP.
DCOP (Desktop Communication Protocol) is a simple protocol used for communication between various KDE applications. DCOP is a simple IPC/RPC mechanism built to operate over sockets. At a high level a KDE application registers with the dcop server, exposing some interface methods. Then inter-application communication is done through the dcop server by passing data in the form of serialised qt objects. KDCOP is a very simple graphical dcop browser and client. There is also a console dcop client called 'dcop'.
To demonstrate the use of the console dcop client i have written a trivial mashup script "Speak Clipboard". As its name says it speaks the contents of the clipboard. To use it just select some text in a browser (or any application) and then run the script to listen to the selected text. For easy access, you can create a shortcut and place it on your desktop sidebar.The code of "Speak Clipboard" is... #!/bin/bash if [[ $1 = "stop" ]] then dcop ksayit ksayit dcopStop exit fi message=`dcop klipper klipper getClipboardContents` dcop ksayit ksayit dcopSayText "$message"
In the above script I have used KSayIt, a text to speech front for KDE. KTTS (KDE Text to Speech) is a subsystem within the KDE desktop for conversion of text to audible speech. Text to speech configurations can be done in KDE using KTTSMgr application. It enables setting up various text-to-speech systems like 'festival'.
The example given is very trivial and may be done directly using already existing KDE apps. However we can create really cool KDE mashups using dcop. Just as REST (Representational State Transfer) is fueling the web-mashups, dcop can be used for building their desktop counterparts.Useful Links: DCOP: Desktop COmmunications Protocol Higher-level Scripting KTTS - KDE Text-to-Speech System Festival Speech synthesis system Article on festival Building Web Services the REST Way
Sunday, August 06, 2006
Today most of the manufacturers ship their products with only Windows drivers and client applications. This has become a major stumbling block for the adoption of Linux. The gadget manufacturers feel that it is not worth their effort to provide support to Linux platform for their devices. This lack of concern on their part has made the field of linux device drivers very interesting. With more and more gadgets coming into our lives, getting them to work in Linux will be a nice challenge. Once the numbers turn in favour of Linux, the customer-driven markets will drive the manufacturers to support linux. Till that time we should encourage individual efforts in this direction, and thereby driving the aboption of Linux. This is what makes Linux fun -- trying out new things, experimenting and thereby closely learning the internal system. Moto4Lin is one such effort to provide an interface for Motorolla mobile phones on Linux. I tried this out and it works very well. The application is great but however it is not very well documented(in english), i had to rely on Google translations to get it working. Moto4Lin can be used for exploring the mobile's filesystem and thereby provides an interface for data transfer. I am still figuring out how to access the phonebook and send messages from comp. I tried a couple of KDE apps, but still haven't been able to get them detect my phone. Instructions for installing Moto4Lin: 1. Download p2kmoto and moto4lin packages from here. Moto4Lin requires p2kmoto driver for accessing the filesystem of the phone. 2. Install p2kmoto package from source by running: ./configure && make && make install 3. You may have to add /usr/local/lib to LD_LIBRARY_PATH. export LD_LIBRARY_PATH=/usr/local/lib 4. Connect the phone to a usb drive using the data cable and test p2kmoto by running p2ktest. This lists the files stored in your phone. 5. moto4lin is a qt appllication, use the following steps to install it qmake && make && make install 6. Start moto4lin and configure the device if required. 7. Click the "Connect" button to connect to the phone. The filesytem of the phone can be browsed using the "File Manager". Useful links 1. Instructions for using Moto4Lin 2. Moto4Lin sourceforge Project
Saturday, July 08, 2006
I wanted to write this article for a long time. Today i have finally made my mind of inking it. When i try out something new, first thing i do is learn how to access the help system of that application. Here i would like to explore some well known ways of getting help in linux.
- If you are in a shell and want to know the usage of a command you can do so by passing it "--help" option. This lists various options that can be passed to the command and its expected behaviour. Its purpose is to give a brief description of the command and list its most frequently used options. It is not exhaustive documentation.
- To know more about the command you can look at its manual page. Easiest way to view the manual (man) page is by using the man command. As the name suggests this is like a manual of the command. It lists out all possible options that can be used with the command and its expected behaviour. But man pages are not very straightforward to follow. For newbies, man pages are often intimidating. They usually do not provide example usages of the command. However they serve the purpose of being precise and exhaustive manual of the program/utility/function they are documenting.
- To get saner and user friendly documentation we can check the command's info page. Usually info pages are more informative than manual pages. The biggest advantage of info pages is that they usually include example usage of the command. They also have hyperlinks, so we can jump from one info page to another, getting a clear understanding of the related terms. A command's info page can be accessed using the info command.
- Google. Ah, the obvious choice to find any unknown. There is also a linux specific google search channel which can be tried. You may find solutions to your problem in either a forum, mailing list or documentation/howto site.
- What if you don't have access to internet (highly improbable)? Anyways, in that can use the apropos command. It searches through manual descriptions of all the commands. This way we can find out the correct command to solve our problem.
- whatis is another useful command. It gives short (usually one line) description of the command. Infact the apropos command internally uses the whatis database.
- From vim you can directly open man page of a command/function used by pressing 'K' on it.
- konqueror has defined man and info protocols. So from konqueror we can view an info/man page of a command by typing info:command and man:command respectively. These html pages are generated using the info2html utility.
Saturday, June 24, 2006
How many times have you been bugged by a site which mandates you to register? Most of the time the registration process is painful, if not it asks for personal info like email address etc. Even though we fake these details we have to nevertheless go through the motions of creating a dummy account. With BugMeNot we need not do this anymore. It contains dummy logins for tons of sites. Yes, this is yet another Web 2.0 site. Users can post new logins, they can vote on the validity of the logins posted by others etc. BugMeNot can be accessed in many ways. There is a firefox plugin which gives bugMeNot context menu. The simplest way to use it is through this bookmarklet. Ofcourse some domains like blogger.com, google.com etc. are blocked to discourage spammers. To learn how to use bookmarklet read this wikipedia article.
Saturday, June 17, 2006
Suse Linux 10.1
This month's edition of Linux For You comes with Suse Linux 10.1 DVD. Going by the encouraging review in the magazine i tried this distro and was impressed by it right from the word go. Novell has packaged this very well. Most of the Linux distro installations these days are really trouble-free, so is Suse. Suse's installer is newbie-friendly. It hides all the bugging details beneath the expert menus and does a neat setup in default configuration mode. One thing which impressed me was the post-installation configuration. After installing the packages from the DVD, it configures the Internet, tests it by fetching the latest release notes from Novell's site and then it prompts for updating installed packages. On choosing this upgrade option it auto detects its package server, shows the list of upgradable packages, installs them and then optionally deletes the downloaded patches, leaving a clean updated system. Switching from FC2 i find a lot of interesting and new stuff to be explored in Suse 10.1, especially KDE 3.5 Trivia - In tribute to 42, SUSE Linux 10.1 was released on 11th May 2006 and dedicated to Douglas Adams on his fifth death anniversary.