Sunday, December 28, 2008

Adding something to the startup scripts.

Just penning this down because I am afraid I'm quite likely to forget !

First off, create a script in /etc/init.d/ which you want to be executed at startup.

Next, use the update-rc.d command

update-rc.d [script-name] start [seq-num] [list-of-run-levels]
[seq-num] = 0 - 99
[list-of-run-levels] = separated by space, and terminated by "."

.

Saturday, December 27, 2008

Installing 32 bit programs on 64 bit machines (.deb packages)

Was trying to install adobe reader on my ubuntu 64bit box, and came across issues with 32 bit and 64 bit. Apparently, there's this program "getlibs" which will download all required libraries that your application needs. So if you need to install an i386 deb package, first force install it

dpkg -i --force-all package-name.deb

Then get all the libraries required by the executable

getlibs /path/to/executable

Getlibs can be obtained from http://www.boundlesssupremacy.com/Cappy/getlibs/getlibs-all.deb
I gues, it should also be in the ubuntu repository. You should be able to do an

apt-get install getlibs

For more info, refer to the thread http://ubuntuforums.org/showthread.php?t=474790

.

Friday, December 26, 2008

Skype on ubuntu 64 bit

Upgraded my laptop to ubuntu 8.10 64 bit today. The Microphone works finally !!
Decided to install skype but apparently, the skype download page doesn't give a link to skype for 64 bit linux. The 32 bit version wouldn't install with gdebi ! Searched a bit online, and came across this page:
http://ubuntuforums.org/showthread.php?t=432295

The gist of the page is

sudo apt-get install ia32-libs lib32asound2 libasound2-plugins; wget -N boundlesssupremacy.com/Cappy/getlibs/getlibs-all.deb; wget -O skype-install.deb http://www.skype.com/go/getskype-linux-ubuntu-amd64; sudo dpkg -i skype-install.deb; sudo dpkg -i getlibs-all.deb; sudo getlibs -p libqtcore4 libqtgui4 bluez-alsa
NOTE: That is the procedure for 8.10. For others it may be different.

Also, I'm not sure, but I guess, this link will work:
http://www.skype.com/go/getskype-linux-ubuntu-amd64
If anyone's trying to install 64 bit skype, please download that from the above link and try installing with gdebi / dpkg. If it works, that's actually a better option I suppose. Please post a comment, if did/did-not work for you!

.

Saturday, November 22, 2008

weird bug with ctrl, alt, shift keys going haywire after running vmware on ubuntu

If I use ctrl+alt+enter to full-screen a vm in vmware, then when I return to the host, my special keys - ctrl, alt, and shift - will stop working !

The "xmodmap" command can be used to see the keycodes assigned to the modifiers. When the keys are working fine,
root@vmathew-laptop:~# xmodmap
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x6d)
mod1 Alt_L (0x40), Alt_R (0x71), Meta_L (0x9c)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x7f), Hyper_L (0x80)
mod5 Mode_switch (0x5d), ISO_Level3_Shift (0x7c)
Now, once I run a vm in vmware and use ctrl-alt-enter, to full-screen it, and then come back to the host (ctrl-alt), the output goes.
root@vmathew-laptop:~# xmodmap
xmodmap: up to 1 keys per modifier, (keycodes in parentheses):

shift
lock
control
mod1
mod2
mod3
mod4
mod5
The fix is to use the "setxkbmap" command. This will restore the keycodes for the modifier keys.

[Ref]
http://ubuntuforums.org/showthread.php?t=792737
http://ubuntuforums.org/showthread.php?p=4990785

.

Friday, November 7, 2008

Remote procedure calls are SO EASY !! (XMLRPC / Python)

I just love python !
And the XMLRPC implementation for python just made me fall in love with it. (Ok, XMLRPC is language independent, but I just loved the python implementation)

A bit of context; we were discussing the paper "Implementing Remote Procedure calls" (Link), in our CS736 / Advanced Operating Systems class. I was skeptical of the whole idea since I was wondering why in the world would anyone use this, when the socket api is so neat and clean.

I was wrong !

My CS740 / Advanced Networks project mate, Ian Rae, pointed me to XMLRPC within the context of our networks project. And I realized how simple and elegant programming RPC can be.

The gist of the code is as follows:
Server:
from SimpleXMLRPCServer import SimpleXMLRPCServer

def poke(n):
print "I was poked %d times" % n
return ("dumb_server", "8000")

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(poke, "poke_the_server")
server.serve_forever()
Client:
import xmlrpclib

proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
reply = proxy.poke_the_server(3)
print "The server %s is listening on port %d" % (reply[0], reply[1])
Reference: http://docs.python.org/library/xmlrpclib.html

.

Thursday, November 6, 2008

Using pipes with python.

This lists a bit of code I developed to use pipes with python
import os
import sys

def function():
r1,w1 = os.pipe()
r2,w2 = os.pipe()
if (os.fork() == 0):
# we're the child
os.close(1)
os.dup2(w2,1)
os.close(0)
os.dup2(r1,0)
sys.stdin = os.fdopen(0)
sys.stdout = os.fdopen(1,'w')
os.execl("/bin/bash")
else:
# we're the parent
to_child = os.fdopen(w1,'w')
from_child = os.fdopen(r2)
to_child.write("ls\n")
to_child.flush()
to_child.write("echo hi\n")
to_child.flush()
temp = from_child.readline()
while temp:
print temp
temp = from_child.readline()

function()
The only problem with this code at the moment is, I don't know how to get readline() to return when there's nothing to read. In short, we always end up hanging!

A much simpler way to achieve the effect of the above would be to use the popen3 function.
>>> import os
>>> i,o,u = os.popen3("/bin/bash")
>>> i.write ("ls\n")
>>> i.flush()
>>> o.readline()
'bin\n'
>>> o.readline()
'Desktop\n'
>>> o.readline()
'Documents\n'
>>> o.readline()
'mounting-vmdk.pdf\n'
>>> o.readline()
'order-cardbus-to-express.pdf\n'
>>> o.readline()
'public_html\n'
>>> o.readline()
'vmware\n'
>>> o.readline()
# at this point, again we hung !!
The problem with readline hanging still exists, but the code's much simpler

.

Mouting partitions with losetup

References (previous posts):
Virtual Drives on Linux
Playing with mount and loopback devices
Encrypted Filesystems

One issue I faced with using loopback devices to mount hard disk images was that everything works fine as long as you have the disk image as one single filesystem. But if you use fdisk on the loop back device and created partitions, then I could not quite figure out a way to mount these.

One intuitive way to do this would be as described in http://vytautas.jakutis.lt/node/26 . In brief, what they do is:
# rmmod loop
# modprobe loop max_part=63
# losetup -f /path/to/your/disk/image.raw
# mount /dev/loop0p1 /mnt/path
Unfortunately, that doesn't work for me. The max_part=63 parameter is rejected by modprobe for me. Guess something else needs to be enabled/compiled-into my kernel for me to support this. (My kernel qualifies by the version info they give there, though)

But then, there's a simpler option. One can specify an offset in the file where the loop back device should begin. From what I've gathered, the first sector, sector 0 in a disk contains the partition table I guess. And then, the first partition starts at sector 1, and ends at sector n. The next from n+1 to n+m and so on.

So if we specify the start sector's byte offset (start_sector * 512 normally) as the offset for the loop back device, we can access the particular partition.
Reference: http://www.docunext.com/blog/2007/07/08/losetup-working-with-raw-disk-images/

So say if we have a disk image data.raw, ( say we used qemu_img to create this from a vmware vmdk disk) then we can attach the whole disk to a loop device and run fdisk to get the start sector of the partition
vmathew:/data/vmathew/vmware/dsl # losetup /dev/loop0 data.raw
vmathew:/data/vmathew/vmware/dsl # fdisk /dev/loop0

Command (m for help): p

Disk /dev/loop0: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb96bb154

Device Boot Start End Blocks Id System
/dev/loop0p1 1 63 506016 83 Linux
/dev/loop0p2 64 130 538177+ 83 Linux

Command (m for help):
But note here that the units displayed is cylinders. Our second partition starts at cylinder 64, but we don't know the exact sector. To find this information
Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/loop0: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xb96bb154

Device Boot Start End Blocks Id System
/dev/loop0p1 63 1012094 506016 83 Linux
/dev/loop0p2 1012095 2088449 538177+ 83 Linux

Command (m for help):
Now we quit the fdisk tool. We have our start sector = 1012095. So our start offset = 1012095*512 = 518192640. Thus to mount this file, we first detach the loopback and create it at this offset, and then just mount it.
Command (m for help): q

vmathew:/data/vmathew/vmware/dsl # losetup -d /dev/loop0
vmathew:/data/vmathew/vmware/dsl # losetup --offset 518192640 /dev/loop0 data.raw
vmathew:/data/vmathew/vmware/dsl # mount -t ext3 /dev/loop0 temp/
vmathew:/data/vmathew/vmware/dsl # ls temp/
jklh.txt lost+found
vmathew:/data/vmathew/vmware/dsl #
Additionally, checkout the manpage on qemu-img (you need qemu installed) to learn to use this gorgeous converter which can convert between some standard disk image types.

.

Monday, November 3, 2008

Merging PDF files

This was something I used hit a dead end on quite often.
Now that I found it, I'm posting it here..

It's basically ghostscript to the rescue
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf ...
Source (yeah, I'm "plagiarizing" !! )
http://ansuz.sooke.bc.ca/software/pdf-append.php

.

Thursday, October 16, 2008

Damn Small Linux

This one's more of a rambling.
For use with condor, I have to setup a small virtual machine with linux on it..
So I'm choosing DSL and my experiences are being blogged down here.

The first issue I faced was installing DSL to disk.
To do this
1. right click on the desktop
2. choose Apps > Tools > Install to hard drive.
Note: install to hard drive may fail if your VM doesn't have plenty of memory. So start up the VM with say 320 MB or more of memory, do the hard disk install and then cut back on memory to say 64MB.

The next issue was setting up the VM so that ssh access is enabled at startup
To do this
update-rc.d ssh defaults 20
The third issue was how to install more packages in dsl
This can be done using the MyDSL extensions to DSL
http://www.ibiblio.org/pub/Linux/distributions/damnsmall/mydsl/
http://distro.ibiblio.org/pub/linux/distributions/damnsmall/mydsl/

.

Thursday, July 24, 2008

Free man's recipie (Open source alternatives for common windows programs)

Bought an Acer Extensa 4620Z laptop for my mother a few days back. My mom's used to windows, and so I had to get her a genuine copy of Microsoft Windows XP Home Edition. However, that's the only piece of software I bought by paying money. Everything elese, I have freeware alternatives..

Here's the list

1. ImgBurn: http://www.imgburn.com/
This's a freeware (not open source) CD/DVD writing tool that supports all usual features. And guess what, it's extremely lightweight. The install file size is just 1.84 MB !!
Advantages:
- supports normal CD/DVD writing, erasing, creating and burning images etc.
- can be used with rewritable discs.
Disadvantages:
- presently does not support multi-session.

2. OpenOffice: http://www.openoffice.org/
A free and opensource alternative for Microsoft Office and numerous other office suites.
- has feature parity with most of microsoft office. Not yet a match for the latest versions of office, but fits the bill for ALL normal usage one can anticipate.
- supports microsoft office document formats as well as a much more compressed native document format.
- supports exporting documents directly to pdf.

3. Mplayer: http://www.mplayerhq.hu/
free and opensource. The media player that truly plays anything.
I found support for all formats that I could think of ! Even windows proprietary codecs are supported by wrapping over the dlls.
And the best part is the numerous keyboard shortcuts ( Link ) The player allows syncing audio and video even when the original file's in error, subtitles, advanced seek capabilities, frame by frame advance, playlists and almost everything you will ever need.
I rate this software better than ALL other media players, whether opensource/free/proprietory.

4. Firefox: http://www.mozilla.com/firefox/
free and opensource. They call it the fastest browser on earth. I'd say, it's the best browser on earth. It's fast, extremely light weithgt, fully standard compliant, and feature packed. Even windoze internut exploder wouldn't come close to it.. Only, there are moron website administrators who still build websites with windows proprietory widgets which only work with the nut exploder. That aside, you will never need another browser if you have Firefox !
That firefox is the most favored browser among techie community says it all !

5. IZArc: http://www.izarc.org/
A free archiving (.zip, .tar.gz, .rar, .cab etc) software. It supports a much more broad spectrum of formats than winzip and others. And its perfectly free, there's not even an optional registration unlike with winzip. And I'ven't used another archiving software other than this, within a windows environment, for the past 5 years..

6. AVG Antivirus: http://free.avg.com/
free for personal use. If you run windows and you're sane enough, then you better have an antivirus. And AVG suits one's normal antivirus requirements.. And it's FREE.
Recently, this free factor has increased AVG's popularity greatly. I know a lot of people who run AVG free edition. And when an antivirus gets to be more popular, it's list of know viruses also becomes more exhaustive :)

7. Mozilla Thunderbird: http://www.mozilla.com/thunderbird/
free and opensource. Thunderbird is a very good email and usenet client. And with the lightning (http://www.mozilla.org/projects/calendar/lightning/)plugin, it supports a calendar too ! Forget outlook and such fancies..

8. PDF Creator: http://www.pdfforge.org/, http://sourceforge.net/projects/pdfcreator/
free and opensource. Adobe PDF (.pdf files) is the best portable format for carrying documents. Almost every platform supports it. It's presentation is in a print-format. And once created, it is viewed in a viewer program like acrobat and hence will not be modified accidentally.
But how does one create pdfs?
With PDFCreator, a (simulated) printer gets installed onto your computer, and whatever you print to that printer is saved as a pdf file. So "if it can be printed, it can be made into a pdf" !!

.

Thursday, July 10, 2008

And the dictionary talks !

By now I have made dictionary.com my default dictionary. It's good, and gives most information I require.

Today, I also realized that it includes a recording for the word's pronunciation too.

I mean, the last I checked the little speaker icon next to the word was when I used to use windoze, and at that time I don't remember it working. (guess it was a premium service)

But today, I clicked on the speaker icon out of some un-fathomable curiosity, and it worked !!

Other lovely aspects of the dictionary:
- firefox search engine plugin available.
Hence search is just a CTRL-T + TAB + a few CTRL-arrow_keys away.
- Companion sites: encyclopedia, thesaurus etc.

.

Tuesday, June 24, 2008

NVIDIA and ATI on openSUSE 11.0

Sorry, this one's mostly a rambling bucket of links and a newsgroup post replicated.
Subject: NVIDIA and ATI on openSUSE 11.0
From: houghi
Date: Wed, 18 Jun 2008 20:34:23 +0530
Newsgroup: alt.os.linux.suse

With the coming of 11.0 juste hours away now, many people will be asking
on how to install NVIDEA and ATI.

This is the posting that explains it all.

The URL with the information
http://dev.compiz-fusion.org/~cyberorg/2008/06/13/getting-nvidia-and-ati-drivers-on-opensuse-110/

The text version:
ATI drivers 1-click-install : http://opensuse-community.org/ati.ymp
NVIDEA drivers 1-click-install : http://opensuse-community.org/nvidia.ymp

Via the command line:
su -c "OCICLI http://opensuse-community.org/ati.ymp"
su -c "OCICLI http://opensuse-community.org/nvidia.ymp"
This also shows on how to use the _OneClickInstall_on_CLI_

Another via cli:
zypper sa http://download.nvidia.com/opensuse/11.0 nvidia
zypper in x11-video-nvidiaG01

zypper sa http://www2.ati.com/suse/11.0 ati
zypper in x11-video-fglrxG01

No manual configuration of xorg.conf or switching on Xgl required to get
compiz goodness, just launch simple-ccsm and enable compiz from there
after installing the drivers.

Missing window titles on compiz:
http://forums.suselinuxsupport.de/index.php?showtopic=61418

openSUSE XGL page:
http://en.opensuse.org/Xgl

An appeal for open drivers for linux
http://uk.news.yahoo.com/vdunet/20080623/ttc-linux-developers-push-for-open-drive-6315470.html

My experiments with compiz (failed):
http://varghese85-cs.blogspot.com/2008/06/compiz-on-thinkpad-t43-using-opensuse.html

.

Some good way to search

Search this string:

-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "Nirvana"

What it basically does is to find file listings of type wma or mp3 for Nirvana songs. One can modify it to search for any particular file one might want to find on ftp servers and that sort.

Source: http://www.employees.org/~smitha/myblog/?q=node/46

.

Monday, June 16, 2008

Finally Tuxed

This is more on a personal note. If you have been reading this blog, you'd know that I had plans to buy a Compal JFL 92 based laptop and go linux on it and say good bye to windows once and for all, when I go to Wisconsin for my Masters.

Well, as it turns out, the linux migration got expedited ! Special thanks to my colleague and cab-mate Smitha Narayanaswamy who inspired me to do it right off and guided me a lot with locating complementary tools on linux to fit in with the cisco workflow model which mostly is based on Windows.

Although there are a few requirements for which I need to resort to windows on virtualbox, I've mostly been successful in extricating myself out of that OS dependency.

.

VirtualBox on OpenSUSE 10.3

This is a good intro to installing and using VirtualBox on OpenSUSE 10.3
http://linux.derkeiler.com/Mailing-Lists/SuSE/2008-02/msg00889.html

Basically, the virtualbox which comes bundled with opensuse is the OSS version which doesn't work very well on various fronts. So unintall it..

Then download the prebuilt binary for OpenSUSE 10.3 available at http://www.virtualbox.org/ and install it.

Next, add whichever usernames you want to give access to virtual box to the group vboxusers (easiest done through yast2)

Now run the command "virtualbox" and enjoy !

.

Sunday, June 15, 2008

Compiz on thinkpad (T43) using OpenSUSE 10.3

Out of the box, OpenSUSE 10.3 detects the graphics card on IBM Thinkpad T43 as ATI Radeon M300 something. That's the default driver bundled with OpenSUSE. And quite expectably, the driver does not support 3D, direct rendering etc. That translates to No Compiz.

However, there seems to be fixes for the same. In fact, at this writing, I'm halfway through the process (having successfully switched to an ATI furnished driver which detects the card properly and allows 3D and direct rendering.) Keeping this as a record of what I do, so that folks as clueless as I was when I started out can make good use of this and do the work faster :)

The step 1. is to go to http://en.opensuse.org/ATI and download the version 8.0.* of the ATI drivers available there. The one click install is what I did. (You might need to add the Opensuse OSS repository to your Yast2 > Software > Software Repositories. The repo maybe found at http://download.opensuse.org/distribution/10.3/repo/oss/ )

Next, once the one-click install is over, do
# aticonfig --initial
as root.

Now, you can run "sax2 -r" as root and you will see the card detected as ATI Radeon X300. Also, CTRL+ALT+BACKSPACE will restart the X server for you with the updated configuraion.

Next, in /etc/X11/ open the file xorg.conf, and at the bottom add the following lines
Section "Extensions"
Option "Composite" "Enable"
Option "DAMAGE" "Enable"
EndSection
(The extensions section might already be there, in which case add/update the options there)
These lines take care of the errors
compiz (core) - Fatal: No composite extension
and
compiz (core) - Fatal: No DAMAGE extension

At this point, 3D works. (Small issues though, like the arcade game "Chromium B.S.U." hangs the system immediately on launch) However, "compiz --replace" still doesn't. Working on fixing this now.

(For nvidia cards, drivers can similarly be found at http://en.opensuse.org/Nvidia.)
========= ========= ========= ========= ========= ========= ========= =========

I gave up !

The ATI Driver seems to be buggy. Although the above procedure will get you 3D enabled, with beautiful effects and shadows and all that, it makes the system highly unstable.

For example, the chromium game crash I mentioned above. And also, once when I locked the computer, I guess some OpenGL screen saver would have started.. And this (!) crashed the comp !

So I removed the ATI drivers and reverted to the SUSE supplied stable drivers; no 3D but stable as ever.. Hopefully my Compal JFL 92 will work perfect with OpenSUSE 11.0 on that front.. (!)

--

[1] http://tombuntu.com/index.php/2008/04/28/workaround-for-pink-shadows-with-compiz/

.

Friday, June 6, 2008

Firefox has a 21% global market share.

A long long time ago (in computer science terms, that translates to 26 years) the Mosaic web browser was developed at the National Center for Supercomputing Applications, University of Illinois - Urbana-Champaign.

Soon mosaic became Netscape communicator and became among the most successful web browsers. However this was not to stay with Microsoft upsetting the bandwagon with their free Internet Explorer ( a.k.a. Internut Exploder in the anti-microsoft circles; in fact, wikipedia redirects Internut Exploder to Internet Explorer :D ) which was bundled along with the Windows operating system.

The United States vs. Microsoft lawsuit was settled mostly in favor of microsoft. Pursuant to AOL takeover of Netscape, the Mozilla Foundation, which had already been set up as a subsidiary of Netscape, was made a separate entity.

And Mozilla made the Mozilla application suite which today goes by the name Mozilla SeaMonkey. Some of the brilliant intellectuals at Mozilla soon decided that commercial requirements have resulted in a drastic feature creep into Mozilla, bloating up the application suite. Hence, Firefox was spun off as an experimental branch to combat this.

Firefox version 1.0 was released on November 9, 2004. Since then, it's adoption by the market has been dramatic.

Today, Mozilla firefox holds a whopping 21.1 % of the global browser market share.. A place which was dominated by over 90% by the Microsoft Internet Explorer !!!

Way to go!!

On a subtler note, what will become of the GNU IceWeasel vs Mozilla Firefox, is another question only time can tell though.

.

Thursday, June 5, 2008

Mozilla Thunderbird, sorting threads by the newst email in the thread

One of the annoying issues I was facing with mozilla thunderbird email client was that when I opt to have emails grouped into threads (conversations), the threads are sorted according to the Date and time of the earliest/oldest email in the thread. So if someone replies to a thread a month after the oldest email in that thread, the thread will have an unread message in it, but I won't notice it because it's not among the topmost few threads in my inbox.

Figured out the fix now, to have threads sorted by the date and time of the newest email in it.

View > Sort By > Threaded.

Wonder why thunderbird doesn't have this as the default setting.

Anyways, now when someone replies to an old thread, that entire thread gets brought to the top in my inbox, making it impossible that I miss a mail.

PS: I know this sounds a silly post; but if you use thunderbird, you'll know how annoying this is. In fact, google shows there are people who quit thunderbird for this singular reason.

.

Wednesday, June 4, 2008

Sending email (smtp) using python

bash$ python
Python 2.1.1 (#1, Dec 29 2004, 11:06:29)
[GCC 3.3.3] on linux2
Type "copyright", "credits" or "license" for more information.
>>>
>>> # First we need to import smtplib, which we use for sending email
>>>
>>> import smtplib
>>>
>>> # Next we compose the message we want to be sent, in MIME format.
>>> # You can go ahead and include attachments or whatever.
>>> # One quick way would be to use MS Outlook or something to compose
>>> # the message, then save it as .eml, and copy the source.
>>> # Note here that "From:", "To:", "Cc:" etc are what your recipients
>>> # will see in the header, but does not reflect on who the message is
>>> # actually from, or is actually sent to.
>>> # The message only goes to people who you specify in the sendmail() call.
>>> # Note also that the \r\n pattern should separate each field in the header
>>> # and the \r\n\r\n separates header from the body.
>>>
>>> message = """From: John Dove <john@dove.com>\r\nTo: John Dove <john@dove.com>\r\nCc: Jane Dove <jane@dove.com>\r\nSubject: Hi!\r\n\r\n
... Hi John,

...
... How are you doing man?
... Just mailing in to let you know that I exist..
... Just woke up when you were loitering around in the pantry :D
...
... /your alter-ego(2)
... """
>>>
>>> # Now we initiate the smtp connection
>>>
>>> mailServer = smtplib.SMTP("smtp.server.com")
>>>
>>> # Now we actually send the email..
>>> mailServer.sendmail("sender@somewhere.com", ["recipient1@somewhere.com",
... "recipient2@somewhere.com", "john.dove@somewhereelse.com"], message);

{}
>>> # Now that we are done, we 'hang up' the connection
>>>
>>> mailServer.close()
>>>
>>> # bbye :D
>>>

Reference:
http://www.eskimo.com/~jet/python/examples/mail/smtp1.html

.

Sunday, May 25, 2008

Cscope

I was first introduced to cscope through my job at Cisco. At that time, I never cared much about it. But now I realize it's one of the major productivity enhancement tools where source navigation through a pile of code written by many other people is concerned.

http://cscope.sourceforge.net/

This document provides a tutorial on how to set up cscope for large projects, using the example of the linux kernel.

http://cscope.sourceforge.net/large_projects.html

And this document teaches how to use cscope very efficiently from within vim.
http://cscope.sourceforge.net/cscope_vim_tutorial.html

Also, there are many other frontends to csope besides the simple ncurses based one. Try kscope.

http://kscope.sourceforge.net/

.

Tuesday, May 6, 2008

Next Laptop PowerPro P 11:15 (based on Compal JFL92)

In a previous post I was looking at my next laptop and considering Sager NP 2092 for the same. ( http://varghese85-cs.blogspot.com/2008/03/next-laptop-sager-np2092.html )

This laptop is a Sager rebranding of the Compal JFL92 laptop. However, since I read on a few forums about sluggish customer support from Sager, I was getting a bit worried.

Now I realize that PowerNotebooks.com (http://www.powernotebooks.com/), the retail outlet from where I planned to buy the Sager NP2092 has an in-house rebranding of the Compal JFL92: PowerPro P 11:15 (http://www.powernotebooks.com/category.php?catId=78#id2269)

PowerNotebooks.com is an online retailer for whom I found the customer ratings to be impeccably excellent. The company seems top notch, and hence I am happy that I can get the Compal JFL92 which I wanted, with a reasonable assurance of reliable customer support.

Customisations I am going for:
- 1680x1050 WSXGA+ MATTE LCD
- Intel Core 2 Duo 2.1 GHz processor
- 2GB (2x1GB) memory
- 250GB SATA 5400rpm hdd
- Bluetooth
- RainShield Backpack black/silver
- NO Windoze XP / Vista (I'll run OpenSUSE 11.0 !!)

Also, check this thread (http://forum.notebookreview.com/showthread.php?p=3320508)
Owners of Compal JFL92 have confirmed linux compatibility for the JFL92. Hence I'm delighted.

Other pertinent posts (these are on the IFL90 though)
http://lddubeau.com/avaktavyam/linux-on-a-compal-ifl90/
http://tiago.estima.googlepages.com/Install_log_Linux_OpenS.html

--------- --------- --------- --------- --------- --------- --------- ---------
This one seems to be the same compal JFL92 with ubuntu pre-installed.
(Check the last option, titled "Serval Performance")
http://system76.com/index.php?cPath=28

.

The Linux Kernel book

http://www.linuxhq.com/guides/TLK/tlk.html

Looks like a good resource to learn the linux kernel..

.

Wednesday, April 30, 2008

gparted vs partition magic

Guess Partition magic is familiar to most folks around.

However, I wanted an Free Open Source solution addressing the same purpose.

My searches have led me to parted
(http://www.gnu.org/software/parted/index.shtml)
and it's gui-enabled frontend gparted
(http://gparted.sourceforge.net/)

There's a gparted live cd,
(http://gparted.sourceforge.net/livecd.php)
which is a bootable linux cd which takes you straight to the gparted gui.

Also, gparted is available on the "SystemRescueCd" liveCD distribution.
(http://www.sysresccd.org/Main_Page)

Also, here's a good link on using gparted to partition hard drives on Windows Vista preinstalled laptops.
(http://www.howtogeek.com/howto/windows-vista/using-gparted-to-resize-your-windows-vista-partition/)

.

Saturday, April 26, 2008

Video lectures on computer science

http://freescienceonline.blogspot.com/

.

Programming from the ground up

An apparently good resource for programming in assembly under linux.

Bartlett, Jonathan - Programming from the Ground up

This is the first book I've seen so far on assembly programming using the gnu toolset.
And the book is available as soft copy under GPL

http://programminggroundup.blogspot.com/2007/01/programming-from-ground-up.html
http://savannah.nongnu.org/projects/pgubook/

Thanks again to my friend Haynes for pointing me to this.

.

Thursday, April 3, 2008

Devpit

This looks like a repository for all kinds of developer's info (*nix primarily)

http://devpit.org/wiki/Main_Page

As they describe themselves: http://devpit.org/wiki/Devpit:About

.

Monday, March 31, 2008

xournal - just what I wanted !!

I have had two independent requirements for wish I have long wished I had some applications.

One was for note taking.. I was trying to use notepad for note taking.. But then, unlike on a notebook, there was no quick way for drawing rough figures alongside my notes.. Paint wouldn't fit the bill either because, I can not go on taking notes endlessly.. And now that I'm moving on to linux (with bias for KDE) kate and krita are the analogues, and they wouldn't fit the bill either.

The second was regarding PDF files.. I was finding a major difficulty in getting accustomed to PDF files rather than printed matter because I could mark, highlight, underline etc; annotate in general, on printed matter, but not on pdf files.

One fine day, I was browsing through the kmenu on my opensuse virtual box, and bingo ! I came upon xournal. The claims were big, but the default version bundled with OpenSUSE 10.3 didn't work.

Somehow, I'm grateful that my lazybones didn't kick in, but instead I searched an located the sourceforge site for the xournal project: http://xournal.sourceforge.net/

From there, I got the latest version source+binary package, and installed that.. And yes! all my problems are solved. The software allows me to take notes, and draw on the same canvas; take notes on multiple A4 pages, bundled as a book; open a pdf and annotate the same; and export my notes/my annotated pdf back to pdf !

In sum, xournal is simply what I've been looking for !!!

--------- --------- --------- --------- --------- --------- --------- ---------
Monday 2008-03-31 12:14 UTC+5:30

On a further note; how to handle pdf encrypted files..
[Attribution] This I took from a post on the sourceforge xournal forum.
The pdftops command can be used to decrypt and convert a pdf to a ps file.
pdftops -upw {password} file.pdf file.ps
Thereafter, the ps2pdf command can be used to convert the ps back to an unencrypted pdf.
ps2pdf file.ps file.pdf 
Note that, xournal doesn't come into the picture here at all.

.

Sunday, March 30, 2008

Skype to the rescue ?

In my linux migration, one of the biggest obstacles I have been facing was the lack of a reliable, free messenger allowing voice and video.

Looks like skype will solve that problem for me.

Skype has versions for linux as well as windows. Just installed the linux version; voice works fine.. Can't check out video right now as I don't have a linux compatible webcam..

Anyways, if I can get my parents to use skype too, then one major issue gets sorted out..
And as a bonus, skype allows conference calls too !

.

Webmin for configuring linux

Had tried Debian Etch, and was wondering how to configure firewall etc using GUI.

Looks like Webmin is a good solution

However, for now I guess I'll stick with opensuse.
Somehow liked it more than any other distros so far.

.

Saturday, March 29, 2008

L4 microkernels

So much for the monolith that the linux kernel has become!
Stallman and team are working on speeding up hurd on top of the mach microkernel..

But then, mach is a first generation microkernel..
And subsequently, the L4 was designed to overcome the insufficiencies of mach.

Looked at this wikipedia page on l4 microkernels: L4 Microkernel Family
It took me to Fiasco (http://os.inf.tu-dresden.de/fiasco/), a GPL variant of L4.
And know what !
- Fiasco's done in C++ !
- There's an ongoing GNU project for Hurd on L4 !

The TUDOS wiki page
http://wiki.tudos.org/Main_Page

Planning to learn more on L4..
Although I must confess, my learning ventures are not progressing the way I want them to,
this one being built on C++ should help I hope..

More links:
The home of the l4 community: http://www.l4hq.org/

--------- --------- --------- --------- --------- --------- --------- ---------
Sunday 2008-03-30 22:53 UTC+5:30

Somehow I felt I should include this here as a tribute to the genius
Prof. Dr. Jochen Liedtke
http://i30www.ira.uka.de/aboutus/people/liedtke/inmemoriam.php

.

Thursday, March 27, 2008

Encrypted filesystems

This one's further to my two previous posts concerning losetup
1. Virtual Drives on Linux
2. Playing with mount and loopback devices

Here we try to create encrypted file-systems using the dm_crypt modules.
These are the wikipedia links for cryptoloop and it's successor dm_crypt.

In the earlier cases, we have a file-resident filesystem. We interface it with a loopback device to access it as a device, and the mount it to access it.Now, we incorporate one more block; one which acts as our encryption layer.
Ok, that's enough of the theory; lets roll up our sleeves and get our hands dirty.
So first, we create a 100 mb file for our filesystem
dd if=/dev/zero of=testfile bs=512k count=200
Next, we attach that to a loopback device
losetup /dev/loop0 testfile
Now, we add our encryption layer
cryptsetup -c aes -y create secret /dev/loop0
Or you might use aes-cbc-essiv:sha256 for encryption layer.

Note that in the above, -y option will cause the passphrase to be asked twice for verification. The above command will result in /dev/loop0 being mapped post encryption to the device /dev/mapper/secret.

The command is the same each time you need to mount the loop device; only, the first time you give the passphrase, it becomes _the_ passphrase.

(Internally, cryptsetup doesn't seem to care if your passphrase matches what you used earlier. It just dumbly setups up the encryption layer with the passphrase you provde. So, if you give the correct passphrase second time and every subsequent times, you can access what you already have on the device. If you give a wrong passphrase, you can't. Eitherways, cryptsetup doesn't care! But then, if your passphrase is wrong on second and subsequent times, mount won't work as it can't make sense out of the superblock)

Also, to use a native partition as the encrypted filesystem, instead of a file-resident-filesystem, use the appropriate device name instead of /dev/loop0. In such a case, the previous steps can be omitted.

Next, you make a filesystem on the device; We'll use ext2. Note that you do this only the first time. Subsequent times, you can just skip this step as you already have the filesystem set up.
mkfs -t ext2 /dev/mapper/secret
Now, we mount the device
mount -t ext2 /dev/mapper/secret {mount-point}
Once mounted, you can use the device just like any other device. The encryption and decryption are transparent to you.

Once you are done, you need to clean up

Unmount the device secret
umount {mount-point}
Disassociate the crypto layer
cryptsetup remove secret
sync
You need to atleast do the above cleanup steps to prevent the misuse of your encrypted filesystem, and to preserve its integrity. This next step of disassociating the loopback device is optional, unless you need to reuse the loopback device for something else.
losetup -d /dev/loop0
There are many other options other than "cbc" for the encryption algorithm. Please refer to the cryptsetup manpage and to various related online pages for the options and their advantages.

The dm_crypt wiki for further details: http://www.saout.de/tikiwiki/tiki-index.php

Likewise, if you need to use a physical drive / partition rather than a flat file, you will need to know the device that linux maps it to. Use the command
dmesg | tail
to find the device corresponding to the removable drive you plugged in.

--------- --------- --------- --------- --------- --------- --------- ---------
Friday, 2008-03-28 22:59 UTC+5:30

Additional to that
1. My friend had to
modprobe dm_crypt
modprobe dm_mod
before this would work for him

2. to change password of the encrypted device (say /dev/loop0 )
# create a device mapping using the old password
# remember to use old password here
cryptsetup -c aes -y create secret-old /dev/loop0

# create another device mapping using the new password
# remember, this will be your password hereafter
cryptsetup -c aes -y create secret-new /dev/loop0

# now copy block-by-block from old mapping to new mapping
dd bs={block-size} if=/dev/mapper/secret-old of=/dev/mapper/secret-new

# cleanup
# Actually you can remove the old mapping and continue using the
# new mapping if you'd like
cryptsetup remove secret-old
cryptsetup remove secret-new
References
[1] http://forums.gentoo.org/viewtopic.php?t=163762

.

Monday, March 24, 2008

Virtualization and Virtual machine monitors

pages on this topic..

Hypervisors a.k.a. Virtual Machine Monitors

The XEN Hypervisor

x86 virtualization

Virtual Machine

VirtualBox (this one's GPL)

This also seems like a viable research area !

.

Sunday, March 23, 2008

Printing to pdf file on linux

The easiest way to do it is
1. Print whatever to file.. This produces a ps file (.ps extension preferred)
2. Convert the postscript to pdf with ps2pdf command
However, I also wanted to try setting up a pdf printer, primarily because I remember the redhat 9, which I used to use once a long long time ago, to have had one.
To do it this way on OpenSuSE 10.3
1. Download and install the cups-pdf package.. You can find an RPM if you search on http://rpmfind.net.. OpenSuSE 10.3 doesn't seem to have an rpm for this.
2. If using kde, go to: kmenu > utilities > printing > manage printers. Gnome should have something similar.
3. There, choose to add a new printer..
4. In the step 1 there, choose the "Virtual PDF printer"in the detected list.
5. In the step 2 there, choose "Generic" for manufacturer, "postscript printer" or "PostScript color printer rev4" as model, and "Standard" as driver..
6. Apply.. Your new printer should now become listed
7. Right click on the new printer and choose properties. There, fiddle around and configure things as you want. Once you are done, click print test page.
8. The pdf generated is saved to your home folder.

Now on, you can use this printer to print to pdf file from any application. The generated pdf is saved in your home directory with the filename ".pdf"
.

A tab on linux preinstalled and NO-OS pcs

As it's not particularly helpful that the standard vendors etc keep their Linux preloaded laptop pages not properly linked to the main page, I've decided to make this collection

Do help me make it bigger :) Post a comment if you find other URLs

Lenovo thinkpad on Linux

Dell on Ubuntu

ASUS Eee PC (catch: this is a 7" screen, 2gb-8gb solid state hard drive)

Will be updated with more !

.

OS Support for Intel Wireless cards

Found this link upon a bit of googling..
Am thinking 4965 a/g/n card and was worried if that is supported on linux..

http://www.intel.com/support/wireless/wlan/sb/CS-025330.htm

Posting it here to keep a tab on it..

.

Playing with mount and loopback devices

Here, I managed to mount some swap space through a file, which I mounted as a loopback device

# creating the file to setup the swap on.
varmathe@opensuse103-vm:~> dd bs=1024 if=/dev/zero of=./testfile count=102400
102400+0 records in
102400+0 records out
104857600 bytes (105 MB) copied, 4.25891 s, 24.6 MB/s

# for the rest, I need to be root
varmathe@opensuse103-vm:~> su
Password:

# mounting the file as a loopback block device.
opensuse103-vm:/home/varmathe # losetup /dev/loop0 testfile

# formatting the device as swap space
opensuse103-vm:/home/varmathe # mkswap /dev/loop0
Setting up swapspace version 1, size = 104853 kB
no label, UUID=853895fe-e4cf-4741-8106-cc7e88f89210

# asking linux to use that too for swap
opensuse103-vm:/home/varmathe # swapon /dev/loop0


Here is another example where I manage some more playing around with losetup


# Creating a 10 mb disk image. It's just a file of size 10mb full of zeros.
varmathe@opensuse103-vm:~> dd bs=1024 if=/dev/zero of=./testfile count=10240
10240+0 records in
10240+0 records out
10485760 bytes (10 MB) copied, 1.03734 s, 10.1 MB/s

# Now on, I'm root
varmathe@opensuse103-vm:~> su
Password:

# Setting up the loop device
opensuse103-vm:/home/varmathe # losetup /dev/loop0 ./testfile

# Creating an ext3 filesystem on the loop device.
opensuse103-vm:/home/varmathe # mkfs -t ext3 /dev/loop0
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
2560 inodes, 10240 blocks
512 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=10485760
2 block groups
8192 blocks per group, 8192 fragments per group
1280 inodes per group
Superblock backups stored on blocks:
8193

Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

# creating a folder to mount the device on.
opensuse103-vm:/home/varmathe # mkdir test-point

# mounting..
opensuse103-vm:/home/varmathe # mount -t ext3 /dev/loop0 ./test-point/

# Dumping a file there..
opensuse103-vm:/home/varmathe # cd ./test-point/
opensuse103-vm:/home/varmathe/test-point # ls
lost+found
opensuse103-vm:/home/varmathe/test-point # cat > testfile.txt << EOF
> this is a test file to check the making of
> the filesystem with loop devices thing
> hope this thingy will work
> if it does, this file will be reclaimable
> when I remount this filesystem
> EOF
opensuse103-vm:/home/varmathe/test-point # ls
lost+found testfile.txt

# Unmounting the device..
opensuse103-vm:/home/varmathe/test-point # cd ..
opensuse103-vm:/home/varmathe # umount test-point/

# Disassociating the loopback..
opensuse103-vm:/home/varmathe # losetup -d /dev/loop0

# Reassociating..
opensuse103-vm:/home/varmathe # losetup /dev/loop0 ./testfile

# mounting again..
opensuse103-vm:/home/varmathe # mount -t ext3 /dev/loop0 ./test-point/

# Ah yes, it's all still there..
opensuse103-vm:/home/varmathe # cd test-point/
opensuse103-vm:/home/varmathe/test-point # ls
lost+found testfile.txt
opensuse103-vm:/home/varmathe/test-point # cat testfile.txt
this is a test file to check the making of
the filesystem with loop devices thing

hope this thingy will work
if it does, this file will be reclaimable
when I remount this filesystem


Thursday, March 20, 2008

Debian KDE

To install Debain Linux with KDE on your system, use the command

install tasks="kde-desktop, standard"

at the boot prompt.

If you would also like to make use of the graphical installer, you can try the command

installgui tasks="kde-desktop, standard"


Reference
http://pkg-kde.alioth.debian.org/kde3.html

.

Wednesday, March 12, 2008

Writing bootsector - The GNU "as" (aka gas) way

My friend Haynes pointed me to this quick hands on tutorial..

http://susam.in/articles/boot-sector-code.php

Simple, brief and neatly explained tutorial on how to write bootsectors with GNU tools for the x86 architecture.


Also, objcopy can be used to convert between binary formats.

--------- --------- --------- --------- --------- --------- --------- ---------
Sunday 2008-03-30 02:19 UTC+5:30

I used the snippet of code given at the above webpage
# Author: Susam Pal 
#
# To assemble and link this code, execute the following commands:-
# as -o char.o char.s
# ld --oformat binary -o char char.o
#
# To write this code into the boot sector of a device, say /dev/sdb:-
# dd if=char of=/dev/sdb
# echo -ne "\x55\xaa" | dd seek=510 bs=1 of=/dev/sdb

.code16
.section .text
.globl _start
_start:
mov $0xb800, %ax
mov %ax, %ds
movb $'A', 0
movb $0x1e, 1
idle:
jmp idle
Assembled and linked the same using the commands given in the comment part of the code.
Then, had the ".com" file pushed into a floppy image file. And it worked !

When I pushed the binary into a floppy image formatted as "mkfs -t vfat", the filesystem went corrupt
even though the booting was successful. When I tried formatting the floppy as ext3, everything worked
and the filesystem was also preserved. Wondering why writing the bootsector corrupted the vfat filesystem.

Used qemu to test the stuff !!

.

OpenSuSE 11.0 on Jun 19

http://en.opensuse.org/Roadmap/11.0

Target release date for OpenSuSE 11 is jun 19th 2008 !!

Waiting for this !!

.

Tuesday, March 11, 2008

GNU as a.k.a. Gas

My first assembly program ..
Ah it sux, but demonstrating how to use Gas, gdb etc. with a program which is too simple, anyone would understand..
varmathe@opensuse103-vm:/temp/varmathe> cat test.S
/*
* First gas assembly program by Varghese Mathew !
* simply to add two numbers on the x86
* Purpose: demonstrate the usage of gas, gdb etc
*/

.global main /* define the main to be callable from libc */
.text /* text segment */
main: /* the prodigal main function */
movl $100, %eax # load 100 in eax
movl $200, %ebx # load 200 in ebc
addl %eax, %ebx # add the two and store in ebx

/* the end */

varmathe@opensuse103-vm:/temp/varmathe>
varmathe@opensuse103-vm:/temp/varmathe>
varmathe@opensuse103-vm:/temp/varmathe> gcc -g test.S
varmathe@opensuse103-vm:/temp/varmathe>
varmathe@opensuse103-vm:/temp/varmathe> gdb a.out
GNU gdb 6.6.50.20070726-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb)
(gdb) break main
Breakpoint 1 at 0x8048394: file test.S, line 10.
(gdb) run
Starting program: /temp/varmathe/a.out

Breakpoint 1, main () at test.S:10
10 movl $100, %eax # load 100 in eax
Current language: auto; currently asm
(gdb) info registers
eax 0x1 1
ecx 0xbfa61264 -1079635356
edx 0xbfa61200 -1079635456
ebx 0xb7edbff4 -1209155596
esp 0xbfa611dc 0xbfa611dc
ebp 0xbfa61238 0xbfa61238
esi 0xb7f25ca0 -1208853344
edi 0x0 0
eip 0x8048394 0x8048394

eflags 0x200246 [ PF ZF IF ID ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
(gdb) info reg eax
eax 0x1 1
(gdb) info reg ebx
ebx 0xb7edbff4 -1209155596
(gdb) n
11 movl $200, %ebx # load 200 in ebc
(gdb) info reg eax
eax 0x64 100
(gdb) info reg ebx
ebx 0xb7edbff4 -1209155596
(gdb) n
12 addl %eax, %ebx # add the two and store in ebx
(gdb) info reg eax
eax 0x64 100
(gdb) info reg ebx
ebx 0xc8 200
(gdb) n
0x080483a0 in __libc_csu_fini ()
(gdb) info reg eax
eax 0x64 100
(gdb) info reg ebx
ebx 0x12c 300
(gdb) c
Continuing.

Program exited with code 0144.
(gdb) q
varmathe@opensuse103-vm:/temp/varmathe>


.

Sunday, March 9, 2008

Usenet newsgroups / NNTP

What do I say, a powerful but forgotten resource !

To all my friends who read this page, try the usenet newsgroups.

To try..
1. Download and Install mozilla thunderbird.
2. Click cancel when it initially asks you to set up an account (just to do it the "usual" way)
3. go to Tools > Account Settings, for windoze (maybe so named because it puts the brain to sleep)
or to Edit > Account Settings, for Linux (ah even she's not the best courtesan, waiting for hurd)
4. There, click on the Add account button.
5. choose newsgroup account, and next.
6. Enter the name you want displayed, and a syntactically valid email address; next.
7. NNTP server "aioe.cjb.net"; next
Thank god, there's someone hosting a free server allowing posting..
If you know more, please add as a comment..
8. Give a name if you want to, or use the default; finish.
9. Now you have an aioe.cjb.net entry on your left pane. Right click on it and choose subscribe.
10. Subscribe to "alt.test"
11. now, you have an alt.test entry under aioe.cjb.net on the left pane. Click on it. It will ask you to download headers. Choose to download some 10 or so max.
12. Now, while having the alt.test folder selected, click on the write button on the top left. compose a test post and send it to alt.test.
13. After sometime / once you open and close thunderbird, your post should show up in alt.test.

Configure thunderbird further to check the news group for new messages on startup and every 10 minutes etc. I'm not detailing these.. Also download a larger number of headers if you want to browse archives

alt.test is a newsgroup for sending test posts etc.. it's not worth browsing the alt.test archive.. people use it to send test posts to verify connectivity. now that you have the newsgroups set up, you can unsubscribe from this group..

Check out the many wonderful groups ranging from comp.os.minix to comp.lang.c++ to alt.os.development to alt.hobbies.* to sci.math.* to misc.kids.pregnancy to whatever you want !

You will be overwhelmed by the expanse of the resource which you never until now knew existed !

--------

On further thoughts, the server "textnews.news.cambrium.nl" might be a better choice for digging archives, but you can't post - it's read only.. or you can use the google groups thingy to dig deepest.. But posting the usenet way far surpasses the google groups experience.

--------

A page on usenet http://www.openusenet.org/

some paid news-servers (keeping a track, just in case i need later in life.)

http://www.newsfeeds.com/ Uses a seemingly secure payment gateway.

http://www.octanews.com/ have to give credit card info directly - is this safe ?
http://www.teranews.com/ have to give credit card info directly - is this safe ?
http://www.bubbanews.com/ have to give credit card info directly - is this safe ?

This one's free but seems to be down often http://www.readfreenews.net/

A further list of servers http://news.aioe.org/spip.php?article26

.

Linus vs. Tanenbaum

Found couple of links for the 1991 ish time mega debate between Linus Torvalds and Andy Tanenbaum on Microkernel vs. Monolithic kernel.

On groups.google.com

A hosted version

I really got to say, that guy Andrew Tanenbaum is a visionary !! But alas, the world is a non-pseudo random number generator !

.

Saturday, March 8, 2008

alt.os.development

Hit upon this usenet newsgroup through some other osdev website. Seems like a hangout for hobbyist OSDevelopers.

And this is a compilation of various content, sites etc that came across through alt.os.development over time.. Looks good, looks huge.. :D
http://www.aarongray.org/AODUBL/bookmarks.html

comp.os.minix is also a good hangout; though this one's specifically for minix, historically, it's where linux was born :D

.

The PC booting process

A certain mjvines had this explanation as a comment in his bootsector tutorial example. Thanks to him.. Just pasting it here lest I forget at a later point in time.

; Here's a quick summary of what the BIOS does when booting up.
;
; 1) Loads Sector 1, Track 0, Head 0 of the boot drive( A or C ) to
; absolute address 07C00h-07DFFh
;
; 2) Checks the 16 bit word at absolute address 07DFEh for AA55h. This is
; the boot signature and is used by the BIOS to ensure that the sector
; contains a value bootsector.
;
; If this signature isn't present, the BIOS will display a message like
; "Operating System Not Found"
;
; 4) Loads DL with
; 00h if the boot sector was loaded from drive A,
; 80h if the boot sector was loaded from drive C
;
; This way, the bootsector can determine which drive it was booted from.
;
; 5) Jumps to 0000:7C00h, which is the start of the bootsector

Link: http://gaztek.sourceforge.net/osdev/boot/index.html

And on top of that, remember reading somewhere.. A CD boot is done by actually having a floppy image at the beginning of the cd.. This floppy image is loaded as a ramdisk and the ramdisk is used for the booting.. Can't remember the reference nor the exact details off the top of my head right now :(
Update: Found one reference now http://www.tldp.org/HOWTO/Bootdisk-HOWTO/cd-roms.html
http://en.wikipedia.org/wiki/El_Torito_(CD-ROM_standard)

While still on bootloaders, a good tutorial on using grub by Christopher Giese.
http://my.execpc.com/%7Egeezer/osd/boot/grub-how.txt

.

Friday, March 7, 2008

osdev/crossgcc first try

Started working on learning to build a custom OS. First step is the cross compiler. Went to the GCC Cross-Compiler page on osdev-wiki. That page lists the steps to get my cross compiler up and running.

Got the binutils, gcc-core and g++ sources.. Created a new login on my linux box and set it up as recommended in the LFS tutorial, to have minimal environment.. This was my pure whim :D.

Then went by the steps mentioned in the osdev page; made my binutils; made my gcc.. Then came the problem.. What libc to use?

Tried PDClib but found it lacking in cross compilation support etc.
Then got a newlib downloaded and built that.. It seems to have worked..

Then recompiled the gcc with headers.

And once all that was done, your's truly tried to compile a very simple .c file using the cross-compiler..

The linker failed saying no crt0.o !

crt0.o

hm.. vaguely remember something about crt0.o from my hardware classes at NITC.. or was it from some unix system programmer's reference I read back at college?

Anyways.. searched on the osdev wiki.. Hit a page on how to install "newlib" !! Now that could have helped me a little earlier :D.. I just broke my head figuring out what was already documented :D..
doesn't harm.. things learned the hard way stick longer :)

But coming back, somebody had cooked up a simple crt0.S on that page.. used that..

And know what! IT WORKED !!

Well, not exactly.. ld still cribs about missing syscall wrapper function definitions..
I need to take the newlib-libc-documentation, go to chapter 12 - Syscalls, and then either implement wrappers for each of those syscalls (thankfully not too many) aimed at my kernel (ah, but I still haven't even started thinking about it !! ) .. or I have to provide a set of stubs for those syscalls .. or maybe route those syscalls to my hosts syscalls ( possible in this case because my host is a Centrino processor, and my cross compiler target is i586 :D )

Anyways.. so far so good..

But there are some things which still worries me..
1. I still don't know shit about that newlib internal implementation and it's source is over 11 Megs !!
2. I did a "du -sh" on the final build environment I have (excluding all intermediate files) and it's a whopping 162 Megs.. Guess programmers really have lost the ability to make efficient code, as Andrew Tannenbaum puts it.
3. What if the present generation who maintains glibc, gcc, binutils, newlib etc dies out and it's the next generation's turn to maintain all of that.. my generation's turn.. Will there be anyone left who has a holistic understanding of all that code to maintain it ?

Ah, but I'm a small fry making too much noise; and staying up at 4:30 AM to set up a cross compiler.. no wonder I'm an oddity.. maybe that explains why I still don't have a girlfriend :D

.

A collection of free clip-art images on the web..

http://www.wpclipart.com/

.

Links for Operating System Development

Sorry, this is a bit unorganized.. I'm just starting out on this arduous peregrination :D.. Hope to keep the momentum going.. If that happens, you can hope to see more detailed step by step, for the dummies instructions here.. But till then..

OSDev.org

The Operating System Resource Center

Gareth Owen's OSDev site at sourceforge

Bran's Kernel Development

How to write your own OS: part 1, part 2.

http://my.execpc.com/~geezer/osd/index.htm

http://www.osdever.net/


Assembly Language: intel x86

The Art of Assembly Language

Linux assembly guide

Links for assembly programming

http://library.n0i.net/hardware/

.

Wednesday, March 5, 2008

Full Screen issue with mplayer

I was having a small issue with mplayer.. When I full screen the video, the whole screen is occupied, as in the screen goes black, but the video is played still at the original resolution in a small rectangle in the center.

As always, google saved the day..

http://ubuntuforums.org/archive/index.php/t-204.html

A "-zoom" parameter needs to be passed to mplayer, to zoom the video to the window size.

Alternatively, a config file can be set up for mplayer as

##
## MPlayer config file
##
## This file can be copied to /usr/local/etc/mplayer.conf and/or ~/.mplayer/config .
## If both exist, the ~/.mplayer/config's settings override the
## /usr/local/etc/mplayer.conf ones. And, of course command line overrides all.
## The options are the same as in the command line, but they can be specified
## more flexibly here. See below.
##

vo=xv # To specify default video driver (see -vo help for
# list)
ao=oss # To specify default audio driver (see -ao help for
# list)

fs=no # Enlarges movie window to your desktop's size.
# Used by drivers: all

vm=yes # Tries to change to a different videomode
# Used by drivers: dga2, x11, sdl

bpp=24 # Force changing display depth.
# Valid settings are: 0, 15, 16, 24, 32
# may need 'vm=yes' too.
# Used by drivers: fbdev, dga2, svga, vesa

zoom=yes # Enable software scaling (powerful CPU needed)
# Used by drivers: svga, x11, vesa

#double=yes # use double-buffering (recommended for xv with
# SUB/OSD usage)

# monitoraspect=4:3 # standard monitor size, with square pixels
# monitoraspect=16:9 # use this for widescreen monitor! non-square pixels

##
## Use GUI mode by default
##

gui = yes
The zoom=yes line is what we need to fix the issue.
And on that "Powerful CPU needed" line, a 640x480 DivX video zoomed to 1024x768 will probably require a 1.2 GHz processor at most.

.

Next Laptop.. Sager NP2092 ?

This post has been obsoleted by http://varghese85-cs.blogspot.com/2008/05/new-laptop-powerpro-p-1115-based-on.html
--------- --------- --------- --------- --------- --------- --------- ---------

Had been thinking sometime about which laptop to buy when I go for higher studies. Had a fixation for the IBM Thinkpad. Was planning to buy it.. And the Lenovo T61 can be bought direct from Lenovo with Linux preloaded rather than the Microsoft Proprietory OS. Yet only flaw was, that does not have an integrated webcam.

Further hunting has led me to this laptop, Sager NP 2092
http://www.powernotebooks.com/category.php?catId=78#id2296

Sager, as wikipedia mentions it, is a retailer specializing in performance laptops for gaming purposes. And of-course, a performance laptop for gaming is a performance laptop for any conceivable purpose :D

The ODM of the specified laptop is Compal which is the world's second largest laptop maker. This particular Sager laptop is built on top of the Compal JFL 92..

Pictures: http://www.powernotebooks.com/specs/images/2090/

Found this blog on installing linux on the immediate predecessor model of this laptop
http://lddubeau.com/avaktavyam/linux-on-a-compal-ifl90/

Planning to buy the laptop from powernotebooks.. They seem to have a good reputation online.. And most importantly, they sell the "NO-OS" version of the laptop, so I won't need to pay microsoft for a license which I will not use anyway.

Further reading..
About "Brands" for laptops: http://www.powernotebooks.com/articles/index.php?action=fullnews&id=17
About the dead-pixel policy:
http://forum.notebookreview.com/archive/index.php/t-85367.html
http://forum.notebookreview.com/showthread.php?t=62496
http://forum.notebookreview.com/showthread.php?p=1404255

Also, Hum X ground loop eliminator, if I understand right, is a piece of circuitry integrated into the plug-point, and not into the notebook. Hence I guess, I'll not buy it right off, and buy it if I find a need for it later..

.

Monday, March 3, 2008

Ext2Fsd vs NTFS-3g

A tool to mount ntfs devices on linux. I have tried it out.. works fine both for reading and writing.

http://www.ntfs-3g.org/

You might have to compile the thingy from source.. but it's rather simple.. and compiled without any issues on my OpenSuSE 10.3 installation.

But then, I've started thinking.. If I'm planning to keep a pure linux box (Yeah yeah, I caught Penguinitis ! ), then I might as well have my storage devices as ext3 and get an ext3 driver for windows..

Tried wikipedia on Ext3, and bingo! it had a link to the sourceforge project developing a windows driver for using ext3 devices.

http://sourceforge.net/projects/ext2fsd/
http://www.ext2fsd.com/

Albeit the name it fully supports ext3 devices..

Once you install it, you need to go to it's "Ext2 volume manager".
From that
1. File -> Enable Ext2Mgr autostart
2. Tools -> Service Management : and start the service.

Once these are done.. plug in your ext3 devices and use them like any other storage media on windows.

I converted my 2GB usb pen drive to ext3 and am using that on windows with ext2fsd.. Call it "Proof of Concept" for myself in my tux migration drive.. :D

.

Sunday, March 2, 2008

Linux support matrix for webcams

This site gives support matrix and driver information about
using webcams with linux

http://linux-uvc.berlios.de/

Unfortunately for me, I have a
"046d:08c7 - Logitech Quickcam OEM Cisco VT Camera II"
:(

--------- --------- --------- --------- --------- --------- --------- ---------
Sunday 2008-03-30 12:19 UTC+5:30

A link about setting up logitech webcam for OpenSuSE 10.3
http://forums.quickcamteam.net/showthread.php?tid=212

Another link on logitech webcams
http://www.quickcamteam.net/hcl/linux/logitech-webcams

.

Friday, February 29, 2008

Virtual drives on linux

One of the issues I was facing in my linux migration efforts was how to create and use virtual drives, so that I can mount ISO images of CDs etc.

So here is how to do it..

Virtual devices are achieved in linux using loop devices.
To create a new loop device, we use the losetup command. For eg. say we need to mount the cd image file /temp/varmathe/damn-small-linux.iso ad a cd drive. Here is how to do it.

1. Locate the first available loop device
opensuse103-vm:/temp/varmathe # losetup -f
/dev/loop0
2. Associate this device node to the iso file
opensuse103-vm:/temp/varmathe # losetup /dev/loop0 damn-small-linux-3.4.4.iso
3. Now mount the cd somewhere on our filesystem hierarchy.
opensuse103-vm:/temp/varmathe # mount -t iso9660 /dev/loop0 /mnt/vcd
opensuse103-vm:/temp/varmathe # cd /mnt/vcd
opensuse103-vm:/mnt/vcd # ls
boot index.html KNOPPIX lost+found
Additionally, it might be a wise idea to mount cd/dvd images etc as read only..

4. Use the volume.. (he he :D )

5. Now that we are done and want to unmount the device and release the file
opensuse103-vm:/temp/varmathe # umount /mnt/vcd
opensuse103-vm:/temp/varmathe # losetup -d /dev/loop0
The -d option detaches the file from the loop device

Steps 1,2, and 3 can be combined into a single step as
opensuse103-vm:/home/varmathe # mount -t iso9660 -o loop /temp/varmathe/damn-small-linux-3.4.4.iso /mnt/vcd
While the above single step approach looks like it should have been explained first; I deliberately explained the broken approach for a reason. If you only need the device node, say for eg, to pass that on to a virtual machine; then you don't need to do the mount.. The "losetup" steps alone would do.

.

Wednesday, February 20, 2008

C++ language standards

Find the official standards for the language at

http://www.open-std.org/jtc1/sc22/wg21/

A GPL licensed thorough c++ reference

http://www.icce.rug.nl/documents/cplusplus/

A bunch of open source c++ libraries

http://www.boost.org

.

Wednesday, February 13, 2008

Setting up qemu with networking on a linux host

I wanted to install Qemu with networking enabled on my linux box (Which incidentally is on a Virtual Machine built on vmware). Through the setting up process, I had a tough time figuring out how to go about with the whole thing as I could not find any single document which precisely described what I wanted. But anyways, now I've figured it all out.. And so I've decided to share whatever I've garnered with you through this post.

Objective: To set up Microsoft Windows XP on a Qemu simulated PC with an OpenSUSE 10.3 linux box serving as host.

Host machine: OpenSUSE 10.3 linux on Intel i386 based PC

Packages used:
qemu-0.9.1-i386.tar.gz : http://fabrice.bellard.free.fr/qemu/
vde2-2.1.6.tar.gz : http://vde.sourceforge.net/

I wanted to compile qemu from source, but apparently qemu needs the gcc3.x compilers whereas OpenSUSE 10.3 I have on my system has the gcc4.x version.

Step1: extract qemu-0.9.1-i386.tar.gz int '/' as root.

Step2: extract vde2-2.1.6.tar.gz into a temporary location and build it
./configure
make
and then as root

make install
Step3: (As root) set up a VDE switch with one port connected to the host using a tap interface
host$ vde_switch -s /tmp/switch -tap tap0 -m 666 [-daemon]

The "-daemon" part is option; it will cause vde_switch to run in the background, whereas, if you do not give it, you get access to the switch console
Step4: (As root) set up an ip address for the newly created tap interface on the host
host$ ifconfig tap0 10.0.0.1
Step5: set up our virtual machine. For this,
5.1 Create a working directory for the machine and copy bios files into it.
host$ mkdir qemu-vm
host$ cd qemu-vm
host$ cp /usr/local/share/qemu/{bios,vgabios-cirrus}.bin ./
5.2 Create a disk for the machine.
host$ qemu-img -f qcow win-xp.qcow 4G
5.3 Now start the virtual machine as follows, with the windows-XP CD in the /dev/cdrom drive. Have the Product key ready at hand.
host$ vdeqemu -L . -m 128 -boot d -hda win-xp.qcow \
-cdrom /dev/cdrom -soundhw all -localtime -M pc \
-net nic,vlan=0 -net vde,vlan=0,sock=/tmp/switch
here, "-m 128" gives the virtual machine 128 mb RAM
"-boot d" makes cdrom as the default boot device.. Later you can set this to "-boot c" once you have an OS installed on the hard disk, to make hard disk as the default
"-net nic,vlan=0" adds one network interface card onto the virtual machine
"-net vde,vlan=0,sock=/tmp/switch" connects the above NIC to the switch we created.

5.4 When the system boots up, install windows on this guest machine. You will notice that it has one ethernet adapter for which the cable is already plugged (to our switch as we specified).

5.5 Configure IP address on this interface so that this interface is on the same Network (subnet) as the host's tap interface. In our case, we use "10.0.0.2" as the IP. Also set the guest's default gateway as 10.0.0.1 and provide your service provider's DNS ip to the guest.
Step6: Now you can try pinging 10.0.0.1 from the guest and 10.0.0.2 from the host. You will see that the pings go through successfully. However, the guest still cannot access the internet. For this we need to set up NAT (Network Address Translation) on the host ( or some form of bridging b/w the tap0 interface and the host's eth0 interface)

Step7: (As root) Set up the NAT.
host$ echo "1" > /proc/sys/net/ipv4/ip_forward
host$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
host$ iptables -A FORWARD -i tap0 -o eth0 -j ACCEPT
host$ iptables -A FORWARD -i eth0 -o tap0 \
-m state --state RELATED,ESTABLISHED -j ACCEPT
Now we are up and running!!



References:
[1] http://wiki.virtualsquare.org/index.php/VDE_Basic_Networking

.