Friday, January 29, 2010

The VNC Alternative of using Linux over Windows

A popular method of connecting to Linux Machine is via SSH (Secure Shell). This protocol of exchanging data over secure channel [1]. The beauty of this channel is that it could easily be extended to provide other facilities like SFTP (Secure File Transfer Protocol) or SCP (Secure Copy). One could get hold to a host of small applications from [2]. Another method to use is VNC (Virtual Network Computing) [3]. Its a desktop sharing method and uses remote frame buffer protocol.

The VNC alternative to using Linux over Windows can be used to enjoy Linux while still using Windows distribution. The only constraint is that one has to use an extra machine for Linux but the fact that we don't need to use any monitor, keyboard or mouse with it helps in both ease of use as well as house keeping (tuck away the Linux box under any table in your office and no one will know it exists).  The key to this idea are two simple commands on the two operating systems.

Linux Box

Step 1: Run vncserver command and  then vncpasswd command to set password for entry. The first command will give you "New 'X' desktop is HOST_NAME:DISPLAY_NUMBER".


Step 2: Install vncviewer from the website ( Then run the vncviewer and enter the information HOST_IP_ADDRESS:DISPLAY_NUMBER.  Clicking ok will prompt for password. Enter the password set using vncpasswd command. 
And boom ... one is able to use Linux X-Windows Graphical Interface over Windows Machine.



Two easy steps to installing Firefox 3.6 in Ubuntu 9.10

Browsing through google results for installing the latest release of Firefox 3.6 and Ubuntu 9.10 seems to be a headache. While it is extremely simple to install. Just go to the and click install. Go through the motions of downloading and clicking the downloaded archive tar.

 Simple is not it !

Wednesday, January 27, 2010

Two steps to using Assembly in Linux (ubuntu 9.10)

Most programmers shy away from assembly language. The reason is not that they don't have a solid background of assembly but that they don't know how to write code outside the simulators etc that they are familiar. Especially when it comes using assembly under linux.

It comprises two steps.

1. Compiling with assembler

The assembly language compiler in linux is as. The code to compile a program say helloWorld.s is the following
$ as helloWorld.s -o helloWorld.o

2. Linking and Executing the code

The output of assembling is object code which needs linking. The code for linking the object file "helloWorld.o".
$ ld -helloWorld.o -o  helloWorld.out
To execute the code we need to do the following.
$ ./helloWorld.out

The code for helloWorld.s is attached here and thanks to reference 1.

                           .global _start

        movl    $len,%edx       # third argument: message length
        movl    $msg,%ecx       # second argument: pointer to message to write
        movl    $1,%ebx         # first argument: file handle (stdout)
        movl    $4,%eax         # system call number (sys_write)
        int     $0x80           # call kernel

# and exit

        movl    $0,%ebx         # first argument: exit code
        movl    $1,%eax         # system call number (sys_exit)
        int     $0x80           # call kernel

.data                                   # section declaration

        .ascii  "Hello, world!\n"       # our dear string
        len = . - msg                   # length of our dear string

References :

Trial of Ruby in Ubuntu 9.10

 Ruby the pinnacle of OOP a language described as more object oriented than Python and more powerful than Perl by its creator Yukihiro Maksumoto. I set out to test it on my Ubuntu 9.10. Given ubuntu's excellent support and repositiories no wonder not only ruby but also ruby on rails was available in the respositories. I just had to shoot out the following commands.


$ sudo apt-get install ruby-full build-essentials
$ sudo apt-get install rails
$ sudo apt-get install vim-ruby
$ sudo apt-get install vim-rails

The same could be accomplished via the synaptic package manager in a more graphical environment by selecting System->Administration->Synaptic Package Manager. Then searching for the packages ruby and rails and selecting both and clicking "Apply".

Soon after installation I went ahead and wrote the following program to test the ruby language.  The benefit of installing vim-ruby and vim-rails is that it helps in using vi with syntax highlighting for ruby and rails.

if testString=~/^a*b*c$/
        print testString, " is in the language a*b*c\n"
        print testString, "is not in the language a*b*c\n"
if testString=~/^a*b*c$/
        print testString, " is in the language a*b*c\n"
        print testString, "is not in the language a*b*c\n"
 This completed the test of ruby in Ubuntu. More about ruby over rails later.

Tuesday, January 26, 2010

Upgrading Ubuntu from Hardy (8.04) to Karmic Koala (9.10) via Intrepid Ibex (8.10) and Jaunty Jackalope (9.04)

Realized my Hardy (8.04) on the desktop needs upgrading finally. Even though I had decided not to upgrade it until an LTS (Long Term Support) Ubuntu is released. Upgrading from Hardy (8.04)  to Karmic Koala (9.10) is not directly supported so the logical path is to do the following upgrades.

Step 1. Hardy (8.04) to Intrepid Ibex (8.10)

Step 2. Intrepid Ibex (8.10) to Jaunty Jackalope (9.04)

Step 3. Jaunty Jackalope (9.04) to Karmic Koala (9.10)

Each step follows similar pattern.

$ sudo do-release-upgrade

The same could be done via the graphical user interface (GUI) by selecting System ->Administration -> Software Sources , select Updates Tab and from release upgrade combo select  "Normal Releases". Then select System ->Administration -> Update Manager.

This is followed by countless mega bytes of download and hope that net keeps connected all along.

Monday, January 25, 2010

Desirable features in a text editor in Linux or Windows

The selection of editor and choice of editors is something Windows users cannot imagine let alone comprehend. Windows comes with at most two text editors and one word processor. Notepad and Wordpad come under the heading of text editors. Wordpad is quite useful in this respect and notepad is very handy. However if one wishes to do any advanced word processing one has to shift to Microsoft Word. No doubt various text editors like TextPad, Emacs for Windows , Vi for windows are available to download.

Linux flavors be it FreeBSD, Ubuntu, Solaris, Red Hat,Gentoo or countless others come with host of editors for text editing. What are the features one loves to have in a text editor
  • F-01. EASE of use
  • F-02. EASE of scrolling/ searching text
  • F-03. EASE of editing text
  • F-04 Language syntax highlighting / command menu
F-01 EASE of use
The best for satisfying F-01 is nano. The reason is that most of the command are very easy to remember moreover the commands mostly needed are continuously written at the bottom of the screen. More commands can be accessed via the Ctrl-G Help Menu.

F-02 Ease of scrolling/ searching text
Nearly all the editors support scrolling up and down via arrow keys which comes in handy. Page Up and Page Down is also very convenient for scrolling. This feature bring them all to an equal level. Search feature of vi is extremely effective. the only thing needed to be done is to go to the command mode and then write "/SEARCH_TEXT_GOES_HERE". Replace the SEARCH_TEXT_GOES_HERE with text to search and the cursor will go to the first occurence of the search text and then by simply input of "/" one can cycle through the rest of the occurrences. The "/" also provides elaborate mechanism for search and replace.

F-03 Ease of editing text
Basic editing text in all the editors more or less the same. Efficiency can only be improved by learning a couple of new commands. Here nano again takes the lead by providing the text editing commands at the bottom at all times.

F-04 Language syntax highlighting / command menu
Language highlighting is a feature which is altogether missing on Windows platform. The platform provides language syntax highlighting feature in its Visual Studio product line. That too for a particular range of product. While the Linux editors (nano being an exception) provide language syntax highlighting which comes in handy. The best part is that new language syntax are being continuously added. Some editors also provide features of integrating compilation with gcc and/ or other compilers.

The features list is not comprehensive but for the needs of an average user these are sufficient to be able to select an editor. In the end the jury is still out for the best editor but given user preferences / usage the best editor can be shortlisted via the above feature lists.

Sunday, January 24, 2010

Experiment :: FreeBSD on VMware Player on top of XP

Installing FreeBSD on top of XP via VMware Player. The experience is pretty nice until now. Installation steps were pretty simple.

1. Downloaded FreeBSD ISO from the website (
2. Then installed the ISO via VMware Player

The first reboot led me to a prompt $ and ability to run various commands. The next step is to install KDE. Started off installing KDE by executing the following command (make install clean) on the command line in the directory (/usr/ports/x11/kde4/). this led to downloading the kde from internet. Then since no proxy was setup therefore an error was encountered. This was solved by setenv http_proxy http://myproxyaddress:8080 .

The command line came up easily the only problem was that KDE failed to install and gave the error "undefined reference to vtable projectbuildermakefilegenerator". Trying to figure out what to do with this error. Tried to google, rebuild ports, reload ports and lets see what happens.

But overall again a nice experiment.

Later I tried pkg_add -r kde4

Friday, January 22, 2010

Why nano is still better than Vi? Pine or not ?

One of the classic debates amongst linux geeks is whether Vi is better than emacs and vice versa. I have used all three and personally I like nano. The reason is not functionality richness or any other performance metric but simply the fact that I had been using PICO (Pine Composer) for a long long time roughly five years. Pico was first developed in University of Washington and came along side the famous email program pine (Program for Internet News and Email). The skills developed while using pine to quickly check email and reply via pico have been instrumental in developing this skill set. I performed my data structures, operating systems and networking lab coding in the same pico editor and this lead to my constant hookup with pico. GNU's clone for pico is nano and this does not let me use vi and /or emacs. Even though vi is supremely more effective and productive than nano but history is on nano's side.

Thursday, January 21, 2010

Operating Systems Books Review

Last Summer I taught Data Structures and found it to be hardest subject to teach. Before teaching data structures I had either come across freshmen or handled mature students of final year or second half of third year. That was the first time I encountered students of second year (of course I teach Discrete Maths to second year students but that's completely new course) and had to teach them a course which strongly relied on concepts built in the previous course. Artificial Intelligence and elective courses mostly have their own pace and agenda therefore not hard to teach.

I am going to teach Operating Systems for the second time. Teaching Operating Systems from Tanenbaum's Modern Operating Systems looks like a cake walk for the teacher but a bed of thorns for the students. The question is how to make it further interesting? The alternate is to use Tanenbaum's book Operating Systems Design and Implementation. This would be complimented by MINIX OS developed by Tanenbaum.

Operating System Concepts by Silberschtaz & Galvin is also a nice review of Operating Systems Concepts and is a famous book with lecturers. A good reference book that I encountered is Solaris Internals by Jim Mauro & Richard Mc Dougall. I used it as reference book while teaching Computer Architecture in undergraduate classes. Part One is description of Kernel Primitives, Services. Part Two of the book elaborates the Solaris Memory System. The third and fourth part deal with comparatively hard subjects of Threads, Process and IPC and Files and File System. Overall the book is designed to be used to understand the underlying architecture of Solaris.

The most important question that an instructor needs to cater is the overlap between Operating Systems, Distributed Systems and to some extent Computer Networks. This is left as a topic for later post. However it sure is the dilemma of instructors at the end of the course while selecting topics.

Wednesday, January 20, 2010

VMware Player Gateway to Linux Experience

Recently I got a recommendation to use VMware Player to install linux. Ever since it has grown on me. I have install Ubuntu 9.10, edUbuntu, Ubuntu 7.10 and Gentoo. Especially the way it dynamically uses memory instead of reserving bulk of memory space. If i were to actually partition the hard disk and install all these OS I would have had to give up somewhere between 3GB ~ 30 GB. But now I am only using 11 GB of space. Apart from this benefit another amazing feature is that a separate IP address is available (even when connecting to a DHCP Server). This is not only keeps it clean and simple but also allows interaction with the guest OS via network interface. Another interesting feature is the automatic restoration of the virtual machine state. This feature comes especially handy when dealing with power failures or unintentional closing of the window.

The installation steps are pretty much simple.
1. Install VMware Player from the website (
2. Download the ISO and then use it. If you don't have the ISO use the CD-ROM and then either build an ISO from C/DVD using Roxio or similar software or directly install from the CD/DVD.
3. Follow steps on the screen just like you would in usual installation.