Tuesday, December 4, 2007

Coolest bugs

The URL gives a list of 10 cool bugs caused by software/hardware glitches..

http://news.zdnet.com/2424-9595_22-177729.html

.

Thursday, October 18, 2007

Damn Small Linux, aka DSL

Ever wanted a really small Linux live CD? This is the perfect one.
http://damnsmalllinux.org/
It supports the X windowing system, and comes with Firefox web browser, a VNC viewer, basic word processors, media players, USB support and in short, everything you will need out of a basic computer.
And the punch line is its amazingly small size of ~ 50mb!

.

Wednesday, October 10, 2007

BonaFide OS Development

A place all you folks interested in operating systems should check out !
Some good documents on Operating Systems, oriented at the lesser discussed practical side.

http://www.osdever.net/goal.php

.

Sunday, September 30, 2007

The Minix3 Operating System

This is an Operating System created and maintained by Prof. Andrew S Tanenbaum, for use in the academia to provide students with first hand experience on OS code. Also among the design goals thankfully are readability, modularity, and control over code size.

http://www.minix3.org/

A good blog on minix
http://www.minixtips.com

Earliest posts:
http://www.minixtips.com/2006_06_01_archive.html

.

UIUC Choices

This is a research project going on at the University of Illinois, Urbana-Champaign, into developing an Object Oriented Operating System, called Choices. The various links of interest are

.

Thursday, May 24, 2007

Python References

[This post has been translocated from my python blog to this blog, as I'm planning to close down my python blog.. It's not seeing much attention from me anyways :D ]

Hm.. Now where do I learn python from.

Well, I started with the book "A Byte of Python" [pdf]. This book is a concise and succinct tutorial for someone who has a background in some or other programming language. I would recommend it to anyone who wishes to learn python, and you can learn from this book in under two weeks even at a relaxed pace of learning.

Likewise, the book "Dive into Python" also seems to be a good resource. I must admit I haven't dived into the book much to make a more accurate comment.

The python official website can be found at http://www.python.org . You can download the version of python for your particular operating system. Python is free !

You will also find Python documentation available for download at the site. [http://www.python.org/doc/] There's one particular tutorial in this documentation [online copy @ http://docs.python.org/tut/tut.html]. The tutorial is very exhaustive and will make you pretty much the guru of Python. However, on the flip side, I found the tutorial a little too involved. If you can bolster the patience to pore through it, there's nothing like it.

Have fun charming the python !

Wednesday, May 23, 2007

The Python programming language

[This post has been translocated from my python blog to this blog, as I'm planning to close down my python blog.. It's not seeing much attention from me anyways :D ]

Python was a buzzword around that time. Like an intelligent babe, this language was being exalted as simple and yet tremendously powerful. Well I never bothered; but instead just cleaved to the faith that the prodigious C++ was _the_ panacea for all programming imbroglio.

That went on until I stumbled upon this book: 'Byte of Python' by Swaroop C H [http://www.byteofpython.info/]
And that day, I was bitten.

Well, my old buddy C++ is still my best buddy because she is the most adaptable and reliable programming language that I've learned. In fact C++ and her object oriented lineage teaches you to think of programming situations from an entirely different perspective than what used to be conventional. C++ made you think more like you normally would.

But then Python too borrows heavily from the same Object oriented approaches and additionally allows you the flexibility of more expressive expressions and concise statements. Also somewhere in her lineage python had some functional programming ancestry which allows scope for expressing certain situations more flexibly.

So.. What exactly is this python?

Well I'd qualify python by the following salient features
- It's an interpreted programming language.
- It's a language which uses type inference and dynamic typing, which means you needn't specify the type of variables at compile time, and variables can be assigned values of different types without having to worry too much about the risks involved.
- It's an object oriented programming language.
- Seasoned with condiments from functional programming, it delivers that flexibility too, without the concomitant obscurity associated with functional languages.
- It has a _huge_ standard library base catering to almost all conceivable requirements.
- It is concise and succinct, reducing code size to probably 30% of the C++ analogue.

On the whole, it's one hell of a language.

Sunday, April 29, 2007

[python] image converter

[This post has been translocated from my python blog to this blog, as I'm planning to close down my python blog.. It's not seeing much attention from me anyways :D ]

The following is a code for an image format converter cum resizing program. It takes a source directory, a destination directory and a target file format as parameters and converts all images in the source directory to the target format and writes them at the destination, after resizing them.


This is only a prototypical version and is rather rigid. You might have to modify it to suit your requirements.

Also note that the program requires Python Image Library (PIL) installed in addition to python.

import os
import Image

def imageConvert (source, dest, ext):
if os.path.isdir(source) and os.path.isdir(dest):
result = [True,[]]
for i in os.listdir(source):
if os.path.isdir(source + os.sep + i) == False:
outfile = dest + os.sep + \
os.path.splitext(i)[0] + ext
infile = source + os.sep + i
if infile != outfile:
try:
im = Image.open(infile)
if ( im.size == (1024,768) ):
# Landscape Image
im = im.resize( (640,480) )
elif ( im.size == (768,1024) ):
# Portrait Image
im = im.resize( (480,640) )
im.save(outfile)
#Image.open(infile).save(outfile)
except :
result[0] = False
result[1].append('cannot convert %s'\
% infile)
return result
else:
return [False, ['Error, either the source or the' + \
'destination given is not a directory']]

def main ():
source = raw_input('Enter source directory: ')
dest = raw_input('Enter destination directory: ')
ext = '.' + raw_input('Enter file format extension: ')
r,l = imageConvert ( source, dest, ext )
if r == False:
for i in range(len(l)):
print l[i]

if __name__ == '__main__':
main()

Friday, January 12, 2007

[Python] Permutations of a string

[This post has been translocated from my python blog to this blog, as I'm planning to close down my python blog.. It's not seeing much attention from me anyways :D ]

Given a string of any length, this python program generates all permutations of the characters in the string. The program is capable of taking care of repeated occurrences of the same character


count = 0 # a global counter to give a unique id to each permutation
# that is generated


def constructDict (s):
"""Constructs the dictionary.

Constructs the dictionary of
unique character to no-of-occurance mapping.
"""
d = {}
for i in range(0,len(s)):
try: # if the character is already present
d[s[i]] = d[s[i]] + 1 # increment its count
except: # if the character is not already presetn
d[s[i]] = 1 # put it in and set its count as 1
return d


def recursivePermuter ( d, strSoFar, maxDepth, thisDepth = 0 ):
"""Constructs all permutations.

d: the dictionary
strSoFar: the prefix part of the string which
has been constructed so far
maxDepth: this is same as the length of the
user input string
thisDepth: this level of recursion (Default value 0)

Each place in the permutation can be occupied by
an "available" character. An "available" character is
one whose value in the dictionary d is not zero.
When we use/borrow an available character, we decrement
its value in the dictionary; and when we backtrace/return
the available character, we restore its value by
incrementing once.
"""
global count
if (thisDepth == maxDepth): # if we have completed one permutation
count = count + 1
print str(count) + ": " + strSoFar
return
for key,value in d.items():
if value == 0:
continue
# all elements in d with value > 0 are "candidates" to go
# into this place.. We give each a chance systematically..
d[key] = value - 1
recursivePermuter ( d, strSoFar + key, maxDepth, thisDepth + 1 )
d[key] = value


def __main__ ():
"""The perpetrator of all evil.
"""
s = raw_input("Enter String: ") # get the user input string
d = constructDict(s) # construct the dictionary
recursivePermuter(d, "", len(s)) # despatch to the guy
# who churns out permutations


# you have to explicitly call the main
# main, in python is a convention rather than
# a mandate..
__main__()


How it works..

  1. get all the unique characters in a pool of pairs, each pair (symbol, no_of_occurances)
  2. consider each permutation as a set of n blanks, n = strlen(given string)
  3. for each position/blank in the permutations,

    1. we pick a symbol to go into that blank.. In picking, we reduce the number of occurance..
      So obviously also note that we may not pick a symbol whose number of occurances is already zero.
    2. now we go down the line to the next blank and repeat 3 //this is a recursive step..
    3. once the recursive function returns, we return the symbol we had borrowed for this instance
      of the recursive function.. We do so, by incrementing the number of occurances by one ..