Earth Hour

Sunday, April 17, 2011

Finding whether a Binary tree is BST or not

Hi folks!
It has been quite sometime since I posted on this blog. Anyways, yesterday a friend asked me this question, given a binary tree (not necessarily Binary Search Tree) find whether it is BST(Binary Search Tree) or not.
Well, the question is pretty straight forward. A small thought on the basic definition of BST will lead us to answer this. As we know, BST holds the property that for every node of the tree its left child (if exists) contains value strictly less than the current node and its right child (if exists) contains value strictly greater than the current code.
Now, if we implement the above logic we may end up marking the below tree as bst which is wrong:-

8
4 10
2 12

A little thought on this reveals the problem with above logic is we are not checking the range for every node. So here goes my C++ implementation (but pretty straight forward. Pardon the syntax errors) with range checking:-
Let the structure of every node is:

struct bst{
int val;
bst *left;
bst *right;
}

So now our function goes:

bool isbst(const bst *T,const int &start, const int &end){
if(!T)
return true; //trivially true for empty tree

if(start <= T->val && T->val <= end){ //check current node lies within range [start,end]
bool left = isbst(T->left, start,T->val-1); //check left subtree is bst
bool right = isbst(T->right, T->val+1,end); //check right subtree is bst
if(left && right)
return true;
}else
return false; //value out of range;

return false; //never reached
}


This function is called like : isbst(root_node, INT_MIN, INT_MAX);
INT_MIN here signifies -infinity and INT_MAX as +infinity
Feedback welcome :)

Wednesday, April 7, 2010

Finding the 'First Common Ancestor' in a Binary Tree

Just this morning, I received a basic question related to Binary Trees(not necessarily Binary 'Search' Trees) from a fellow at an algorithm forum. So here I am posting my solution to it.
The problem goes like this(pretty simple 1 line problem):- Given a Binary Tree (not necessarily Binary 'Search' Tree), its root and pointers to any 2 nodes of the tree, find out the first common ancestor of the Tree. A Node of the tree contains: data, left subtree pointer, right subtree pointer but no 'Parent pointer'.

Logic: Let 'A' and 'B' be the given too node whose common ancestor we have to find. Now perform an inorder traversal of the tree and at every node call the 'search(A)' function on the left subtree and search(B) function on the right subtree. When both the results are true, you can be assured that this current node is only the first common ancestor of A, and B,
Reason: Let the first common ancestor node be 'C'. Then below C on either of its subtree tree (left and right) one and only one of the nodes amongst A and B will be present and above the hierarchy of node C, both A and B will exist on just the 1 side.
Heres d pseudo code:


function getFirstCommonAncestor(root, A, B):
if root == NULL:
return NULL // the tree doesnt exists

// if the left subtree contains node A and the right subtree contains node B then we have found the first common ancestor
if(searchTree(root.left, A) and searchTree(root.right, B)):
return root

//else recursively find the common ancestor on its left and right subtrees and return if found
L = getFirstCommonAncestor(root.left, A, B)
R = getFirstCommonAncestor(root.right, A, B)

if L != None:
return L
if R != None:
return R

return None


Well, the algorithm is not so efficient but solves our purpose partially. I am yet to further include additional conditional checks and optimize the algorithm, but for most of the cases it works just fine. :)

Here goes the complete implementation in Python.

Note: Some of the extra checks are missing. You will figure that out yourself.

Bye for now.
Happy Coding !

Wednesday, March 31, 2010

Converting a BST to circular Doubly linked list

Yesterday, while browsing on internet I landed up on a good, yet very basic DS and algorithm problem. Its not that difficult to solve, but can go a little weird if you miss out or go wrong at 1 or 2 pointer changes. ok, so here goes the problem:

Given a Binary search Tree ( I assume here, that most of you are aware of it, by now at least. Others, may like to read this before reading this problem further). You have to create a recursive function, which takes a BST and returns the corresponding Circular Doubly linked list.

Ok. Lets consider a sample BST (Binary Search Tree)

a(5)
/ \
b(3) c(6)
/ \ \
d(2) e(4) f(7)

[Note: the letters 'a','b'... are the names given to the nodes and the value in the parenthesis indicates the numeric data of that node]

Now our objective is to make a recursive function which takes the above tree as input and returns a circular doubly linked list, somewhat like this:-

d(2)==b(3)==e(4)==a(5)==c(6)==f(7)==d(2) ( its circular)

here the 'left' and 'right' pointers of the Node of the BST, will be treated analogous to 'previous' and 'next' in the linked list.

A little thought to the problem, and I came up with following solution. Heres the intended function's pseudo code:-


function bstToList(root)
{
//for leaf node return itself ( case 1)
if (root.left == root and root.right == root)
return root

//no left subtree exist (case 2)
else if (root.left == root)
{
head2 = bstToList(root.right) //call recursively
root.right = head2
head2.left.right = root //head2.left refers to the last node in the list
root.left = head2.left
head2.left = root
return root
}

//no right subtree exist (case 3)
else if (root.right == root)
{
head1 = bstToList(root.left) //call recursively
root.left = head1.left //head1.left refers to the last node in the list
head1.left.right = root
root.right = head1
head1.left = root
return head1
}

//both left and right subtrees exist (case 4)
else
{
h1 = bstToList(root.left) //call recursively and find the head nodes of both sublists
h2 = bstToList(root.right)

l1 = h1.left //find last nodes of the sublists
l2 = h2.left

h1.left = l2 //join the ends of both sublists
l2.right = h1

l1.right = root //insert the root to the end of left sublist
root.left = l1

root.right = h2 //insert the right sublist to the right of root
h2.left = root

return h1 //return the head node

}
} //function ends


As evident, the function considers 4 major cases:-
1. When the current node(root) is a leaf node( a leaf node is one with no children)
2. When there exists no left subtree/child
3. When there exists no right subtree/child
4. When there exists both left and right subtree/child

In every call the function tries to append the current node to the already formed doubly linked lists at the appropriate position.( it can be easily figured out in the above code in case 4)

Here goes the complete implementation(its in Python, but can be understood, inspite of my terrible coding style):-


class node:
''' class to represent a node of BST/ linked list'''
def __init__(self, data):
self.data = data
self.left = self
self.right = self

def printBST(root):
'''prints the BST in an inorder sequence'''
if root.left == root or root.right == root:
print root.data, " ",
else:
printBST(root.left)
print root.data, " ",
printBST(root.right)

def printList(head):
'''prints the linked list in both directions
to test whether both the 'next' and 'previous' pointers are fine'''
#print forward direction
h = head
print '[%d]' % (h.data),
h = h.right
while h != head:
print '[%d]' % (h.data),
h = h.right

print ""
#print in reverse direction
h = head.left
print '[%d]' % (h.data),
h = h.left
while h != head.left:
print '[%d]' % (h.data),
h = h.left


def bstToList(root):
'''
main function to take the root of the BST and return the head of the
doubly linked list
'''

#for leaf node return itself
if root.left == root and root.right == root:
return root

elif root.left == root: #no left subtree exist
h2 = bstToList(root.right)
root.right = h2
h2.left.right = root
root.left = h2.left
h2.left = root
return root

elif root.right == root: #no right subtree exist
h1 = bstToList(root.left)
root.left = h1.left
h1.left.right = root
root.right = h1
h1.left = root
return h1

else: #both left and right subtrees exist
h1 = bstToList(root.left)
h2 = bstToList(root.right)

l1 = h1.left #find last nodes of the lists
l2 = h2.left

h1.left = l2
l2.right = h1

l1.right = root
root.left = l1

root.right = h2
h2.left = root

return h1




if __name__ == "__main__":

#create the sample BST
root = a = node(5)
b = node(3)
c = node(6)
d = node(2)
e = node(4)
f = node(7)

a.left, a.right = b, c
b.left, b.right = d, e
c.right = f

printBST(root)

print "\ncreating to double linked list"
head = bstToList(root);

printList(head)


I am sure this is not the best way to go, but it surely solve the problem in a recursive way. Comments welcome
Happy Coding! :~) @_@

Wednesday, March 24, 2010

IRC

For many of my friends who are not able to connect to IRC due to blocking of its ports, here is the application, which works on HTTP, you can join the desired Rooms and chat:-



(thanks to:http://webchat.freenode.net/)

Monday, March 22, 2010

Tablet War Begins

After the launching of a yet another success product from Microsoft, i.e. Windows 7, after Windows XP, which was one of the most successful of the MS products. MS came up with several new innovations in its new OS, including the "Multi Touch interface", although the concept was existing even before the launch of Win7, but it still was lacking a completeness, fully support and a tight integration with an OS. It literally warmed up the technical market. As you all might be aware of, now Ubuntu also comes with support for multi touch screen display. But with the onset of the OS' supporting multi-touch displays, the market seems to be hit by many Tablet PC products, like Apples hits the market by its new I-PAD, soon the race was caught up by NotionInks ADAM, and JKKs Hanvon to make things 'not so simple' to Apple.
Here I have compiled a list (not exhaustive) of features for these products:-


Note that, there are many more to join ( and probably joined already) the crowed of Tablet PC production. But whatever it is, one thing is sure, there is no limit to innovation and there is always infinite scope for doing the new.



Useful links:
http://www.iphoneinterest.com/adam-vs-ipad.html
http://jkkmobile.com
http://www.youtube.com/watch?v=7_1_ix4qP88&feature=player_embedded
http://www.notionink.com/

Disclaimer: The views expressed here are entirely my own and bear no intention to offend anyone. I am not against or for any company, organization or individual, but just express what I feel at the time of writing the post. Anyone is free to disagree with me and the ones who don't like my views are free not to read my blog ;)

Happy computing
Bye for now

Saturday, March 20, 2010

Ubuntu9.10 and Empathy

Alright, its been really a long time, since I posted anything to my blog. Many things happened in the meantime, and my computer was formatted a lot many times, and now I have an entirely different set of OSs. I installed Ubuntu 9.10, Karmic Koala, and to my surprise my beloved Pidgin IM Client was missing in it, which I was accustomed to. I tried to use Empathy but its been not even an hour and I downloaded Pidgin and installed it. But Somehow it seemed to be unstable on my IBM Thinkpad laptop. Unlike the previous times, it crashes frequently and soon I have to run away from it. I had no option but to explore the new Empathy. I soon was able to configure it to my taste. It not only has full support now for voice chat (unlike the previous times) but also comes in handy with the full and stable support for the desktop sharing with anyone over the internet, in just a click of the mouse!
Anyways, I know as soon as we install ubuntu or any other linux distro, where the beginners have to struggle a lot to initially hunt for a suitable client where they can talk to their google-talk contacts. So here are the google-talk settings which seem to work for me ( but I shall not be responsible if it doesnt turn out for you ). Ok, here it goes-
  1. Just Open your Empathy client ( I hope you know it, Applications-> Internet-> Empathy)
  2. Press F4 or Edit->Accounts and click Add button at the bottom of the left panel
  3. Select "Google Talk" as the account type and press "Create"
  4. Enter your login name along with the "@gmail.com" extension. Eg. if your login name is ABC then enter "ABC@gmail.com"
  5. Enter your password, in the space provided
  6. Click Advance to expand the options and fill the following details:
    1. Select the option "Encryption required (TLS/SSL)"
    2. Select the option "Ignore Certificate Errors"
    3. Leave "Resource" and "Priority" blank ( default value)
    4. Enter the "Server" as "talk.google.com"
    5. Enter the "Port" as "443"
    6. Select the "Use old SSL" option
  7. Click "Apply" and you are done

Empathy offers a lot of features, most of them are pretty much similar to the Pidgin, like (what I can think as of now)-
  1. Configuring and Using multiple Chatting accounts like Gtalk, IRC, ICQ, Yahoo, MSN etc. simultaneously
  2. Support for file transfer feature ( although you need to check the file transfer server for the accounts over which the file is meant to be transferred)
  3. Audio Call
  4. Video Call
  5. "Share My Desktop" feature
  6. Join Different Chat rooms
  7. Few Themes also come bundled with the application
  8. Another feature which I liked more than Pidgin was the ease it offers to set the status message for all accounts at once (ya, its true, you have to sacrifice the facility of being able to set different status messages on different accounts)
Here is a screenshot of the application, for those who want to know how it looks :)

http://www.desktoplinux.com/files/misc/gnome_empathy.jpg
Happy Chatting !

Friday, November 27, 2009

Using BFS to solve the minimum number moves problems

Often in various programming contests we find problems related to calculating minimum moves for some toy problems like "8-puzzle problem", where the step cost to move a block from 1 location to other is constant for every move (or analogous). Generally such problems can be tackled by BFS (it means Breadth First Search, for my friends who didn't know earlier) technique. Well, the concept is pretty simple for BFS. it refers to traversing a tree level wise, i.e. first level 0, then level 1, then 2, 3...
Eg.
1
/ \
2 3
/ \ / \
4 5 6 7
For a tree like the above, a BFS traversal guarantees the traversal order: 1->2->3->4->5->6->7
Though in a linked implementation of a tree, the BFS traversal is a bit trickier but for an array representation this is nothing but a straight traversal of the array sequentially.
Since in most of the programming problems, generally the tree is not known at the beginning, therefore the limit of the total number of nodes is uncertain. But, theres nothing to worry much, for the ArrayList in Java and vector classe in C++ are the way out. Well a generalized BFS traversal may look something like this, when the code to remove the repeated states is added to the main BFS logic:
(Note: its just a pseudo code)

fringe= a queue
closed= a set containing visited nodes
fringe.push(root_node_of_tree);
while( ! fringe.empty())
{
node n=fringe.pop();
if(goalTest(n)){
return solution(n);
}
if(!closed.contains(n)){
closed.add(n);
//add all children of n to fringe
}
}

Based on this below is my C++ implementation for finding out the minimum move sequence to solve the 8-puzzle problem. In this problem given a 3*3 matrix with numbers 1..8 filled in random 8 places among 9 in the matrix with 1 block empty. Our goal is to slide a block at a time in the empty place and finally arrange the puzzle back to sorted order, just like this
1 2 3
4 5 6
7 8 0
(Note: 0 indicates the empty block)

Here is my complete C++ implementation

Sunday, November 8, 2009

An Effective way of removing duplicates in a file

I remember just a few days back I was asked to design a program to remove duplicates from a file. Well the problem seems quite straight forward and simple to approach, but the real hidden question here lies in, how effective can anyone come up with an algorithm to solve this problem. Initially thinking on the tracks of using hashtables, maps, sets etc. I finally landed up designing a custom 'tree' implementation for getting almost the optimal solution which would remove duplicates from a file in a single iteration! (or in O(n) time, for my geek friends! )

Well while surfing internet, I later found that the tree concept I used to solve this problem is pretty much similar to a standard implementation called 'Suffix tree'. Here I am not going to explain you about suffix trees, you can find plenty of matter on this once you google it, rather, I would be explaining how my solution to this problem worked. Well, I don't claim it to be the most optimal implementation, I am sure, someone out there may come up with a solution better than mine. But this one solves the purpose just fine.

The logic here is to keep building the custom tree (which now we know is similar to suffix tree) as we go through the text. Here is the basic algorithm:
1) Iterate through the text and do the following steps
1.1) As the beginning of a new word is encountered, start matching it starting from the root node to its children, successively. along with buffering the current word as we proceed.
1.2) If a match is found, try to match the next character in the word with its children
1.3) If a match is not found, add another node representing the current character as a child to the current node.
1.4) When the word ends, and the last character is matched, check its 'final' tag.
1.4.1) if its true, it means the current word is the repeated one, so don't output the current buffer word
1.4.2) if its false, it means the current word is encountered for the first time, so output the current buffer and flush the buffer.

Eg. let the text be "CAT CAN BAT". The tree for this sentence will be -


ROOT
/\
C B
/ \
A A
/ \ \
T* N* T*

Note: the (*) mark represents the final state.

Here goes my C/C++ implementation

Sunday, October 25, 2009

Saturday, October 24, 2009

Dealing with a Strange Java Problem

Here is a strange problem encountered by me while experimenting with Java. Have a look at the following code sample:

interface test {

void fun();
}

public class Test implements test {

public void fun() {
System.out.println("Test.fun() called");
}

public static void main(String[] args) {
new Test().fun();
}
}



Can you find any problem with the above code sample? Well there really isn't any problem with the above code. Still when you try to run this on Windows systems the execution fails for Test class ( i.e. >java Test) throwing exceptions like:-

java.lang.NoClassDefFoundError: test (wrong name: Test)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
Exception in thread "main"
Exception in thread "main" Java Result: 1


And adding to the surprise, this program runs absolutely fine on Linux and other Unix based systems!

Ok so lets try to dissect the program and figure out what the problem is with this. Here is the possible explaination which I came up with.
Observing it a little carefully you can observe that the name of the interface is 'test' and class is 'Test' this makes them differ only in case. But what difference does it make to us? java is of course case sensitive, so we are free to chose names like that!
Well the answer is that, although java is case sensitive the underlying OS ( Windows) is not. Therefore the compiler (even though it wanted) couldn't create two separate .class files (one for interface, and other for the implementing class), because the other class file over-writes the previous one. In short, this problem arises because after compiling the above code, two class files: test.class and Test.class map only to a single file on windows, not two unlike the unix systems.
So be careful while getting trapped in such of hard-to-find bugs!

Saturday, September 5, 2009

Getting started with GNOME based OS (Linux)



Here is My Linux (Ubuntu9.04) Desktop's screenshot, to prove that theres nothing now which cannot be achieved in the world of Open-source. Linux now is no more limited to the community of computer geeks, but its increasingly becoming extremely user friendly proving it much suitable for the beginners as well. The time is gone when one needed to type long and cryptic commands in order to do anything they want on Linux & Unix systems. Though the command line alternatives are always there, leaving an entire world for the user to explore and learn! Everything is now offered in much more interactive and highly customizable GUI.
Thats the beauty of open-source- it can give you exactly what you want. Open-source products including Linux opens itself to change by anyone who uses it thereby giving the freedom and power to users. There are multiple Window Managers available for using with Linux. The most commonly used are -GNOME and KDE which generally comes integrated with most of the linux distributions.

Lets begin with our familiarisation with GNOME, Ubuntu9.04 Desktop ( but this might help you in other distros as well)
It displays a menu bar at the top containing menus for Application, Places and System on the left side of the bar along with the tray icons of the processes and a calendar, sound control and the Username being on the right side of the bar.
And a status bar at the bottom of the screen with the icon to Show the empty desktop minimizing all the currently opened windows, tabs of all the currently opened windows, a Desktop Switcher showing the available desktops and finally a Trash (where the deleted files reside giving option to restore back the accidently deleted files, until manually cleaned).

  • Application Menu: It contains Set of the applications installed and currently configured to be displayed in the menu format in different categories. It comes packed with a range of open-source applications preinstalled, like firefox for web browsing, Evolution as the email client, Pidgin as the chatting messenger, Totem and Rythmboxfor audio/video playing, GIMP ( my favourite!) for Image editing and a set of GNOME games!
  • Places Menu: It presents links to some of the predefined locations so as to reach there quickly.
  • System Menu: It presents the system specific tasks and configurations

Application and System menu can be manually altered by right clicking-> Edit Menu option.

Any system related information about the running processes or the present system memory and network usage etc. can be found anytime in System->Administration->System Monitor.

Ubuntu presents with an exhaustive list of open-source software for anyone to download from anywhere in the world from its central repository. This can be done in either of the following ways:
  • Applications->Add/Remove
  • System->Administration->Synaptic Package Manager
  • using command line utilities like apt-get :
    • sudo apt-get install

Some of the other utilities in which you would be interested to install are:
  • Opera (a web browser)
  • Netbeans IDE ( for programming in JavaSE, JavaME, JavaEE, C, C++, Javascript etc )
  • openssh ( for enabling remote login into the machine)
  • Thunderbird ( another email client like Evolution)
  • Avant Window Navigator ( enables a cool looking, highly customizable docking feature much like MAC )
  • GVIM text editor ( a GUI based vim text editor, for the people who are addicted to the cool and simple, our beloved VIM ! )

Happy Linuxing!

Saturday, August 22, 2009

Mother Nature


Here are the lines written by a 15 year school girl. It indeed reminds us of our long forgotten nature and provokes us to again ponder on our actions.

Mother Nature

The lap of soothing comforts for all
With selfless care for all
Where all worries vanish, with no blemish,
Where the delicate colours of the rainbow,
Stretch themselves in the sky,
Birds sing, high and higher they fly.
Trees bear sweet fruits of affection,
Rivers linger through cresses with anticipation
This, nature through its humble phase,
confers on man a graceful place.
Man today in his passionate greed,
cutting down trees without need,
The smoke looming high from chimneys,
Toxicants thrown into rivers by industries.
Exploring, exploiting, denuding, eroding...
Man is gradually destroying his own living.
Benumbing, choking the Mother Nature.
Forgetting all her cares and nurture.
Tomorrow someone will surely ask:
Who is Mother Nature?
The barren lands with no life?
Or the carcasses of early extinct animals?
Is it???
So, can't we be kinder to nature,
for all her care and nurture?
can't we strive today,
So that never comes this tomorrow.
So that Mother Nature never cease to grow.
Can't We???

--Anjali Sharma
( fortunately, who is my beloved sis )

GIMP (the GNU Image Manipulation Program) my favourite Open-Source Image Editor

This tutorial is meant to remove fears from the hearts of people who fear working on open-source tools. GIMP is an open-source Image manipulation tool used exhaustively, but not that much common with the students especially here at my college. It has an exhaustive set of tools to match any of your image editing needs, with and extremely intuitive interface and very easy to learn.
So lets get started. Here I present my first tutorial for building a cool name template with shiny table effect as shown below, to let them know how easy it is to work with GIMP for common requirements of students.


Here are the easy steps to create one-

1. Install and start GIMP editor in your favourite operating system. This is fairly easy in case of OpenSolaris and Linux flavours like Ubuntu, Fedora etc.

2. File -> New -> Choose desired size ( default 640*400 works fine for me ), and click OK
Now a white background is visible in the Image window.


3. Select Blend Tool and Gradient as FG to BG. Then keeping the CTRL key pressed drag a line from top to bottom on the image and you shall find something like this -->





4. Select the Text tool from Toolbar or press 'T' key shortcut. and drag a bounding rectangle on the image at the position you want to place the text. This will open a text box popup, type in the desired text here ( "I LOVE OPEN-SOURCE" in my case ). Check the "Use selected Font" option and select the desired font type ( Sans Bold in my case), size( 37 px in my case) and color ( Red in my case) from the drop down menu. This will create a new layer ( say Layer1 ), which will be listed in the Layers window and It will look like this now-->




5. Right click on the newly created layer with the name same as your text and select Duplicate Layer . This creates a duplicated layer ( say Layer2). Now with the original layer, Layer1 selected, go to
Filters -> Blur -> Gaussian Blur -> Select horizontal and vertical blur radius as anything between 12 px - 20px each. and click OK

6. Select Layer2 and choose Color as Green from the color chooser.



7. Select Filters-> Distorts -> Emboss -> select funtion as Emboss and Azimuth, Elevation and Depth to any suitable value ( 30, 45, 20 respectively in my case)
now this will look something like this->





8. Select Layer2 -> right click on it -> Duplicate Layer. This creates another duplicate layer of it ( say Layer3).

9. Now Select Layer3 -> Tools menu -> Transform Tools -> Flip Tool -> Select Flip type as Vertical and click on the text. This is invert the image.
Select the Move tool from the toolbar and position the vertically flipped text few pixels below the original text. It will look like this now--->






10. Select Layer3 -> right click on it -> Add Layer Mask -> select Transfer Layer's Alpha Channel -> click Add

11. Select Layer3 and then select Blend tool from the tool bar with Gradient as FG to transparent and using CTRL key draw a straight line from bottom to top anywhere in the image. This is make the reflection text only partially visible, like this->





12. Finally right click Layer3 -> Apply Layer Mask. This finishes our steps and we finally get the desired text, kept on a shiny table, and glowing in red light. Crop the image to remove unwanted space and thats all!

Hope you enjoyed the tutorial! Experiment and learn...



Tuesday, August 11, 2009

Yet another tremor shook the souls at Bhubaneswar.

Well it was around 2 o' clock night with most of the people deep in their sleep at KP3 hostel, when we were hit by yet another earth quake. Though it was mild here, but strong enough to shake awake few of my sleeping friends. I noticed about this major piece of action going on here, when two of my friends shook me with their full strength ( I guess it was no less than 10-12 on Richter scale ;) , which struck me when I was peacefully asleep ) , still not strong enough to make my nerves active. It took me another 10 minutes to realise what had happened. I could hear students shouting and yelling ( But this is not new to our hostel. We have full freedom of expression here :) ). But as the case with me, majority of us got to know about the event from the fellow mates, only after it was gone ( just like Indian Police! ). But whatever the case may be, this event triggered many hot talks and fuming discussions here among boys. I could listen to few words which popped up every now and then like -'earth-quake','tsunami' ( what ? TSUNAMI !!! I really am scared of it.. Can I make a boat out of my study table? or using bed would be better idea? :) )
These increasing terrorist activities, bomb blasts every now and then, and now earth-quakes, tsunami, drastic weather changes, global warming, pollution, Swine Flu! are they not signals by mother nature indicating something? It sounds like a threat to me. We all shall be wiped off from the crust if we continued our greedy actions..
But at such hard times, one deeply feels the need of the loved ones to stay next to us. It makes one realise the true worth of relationships.

Saturday, August 8, 2009

A Leap towards Open Source... We too are in the race !

Here is some good news for the open-source supporters.. KIIT-U finally started its endeavours towards going completely open-source. This year the new-comers would be introduced to work on open-source platforms and softwares. The initiation has been done by the Technical Leads of our college along with a set of 4th year guys including me :P , by setting up the new user group for the upcoming new open-source enthusiasts in our college, where they can find the answers to all their queries related to open-source softwares and Unix-based systems. Lets look forward with a hope that the freshers joining the insti would make use of this opportunity to the fullest. They would not only be provided with Unix based OS pre-installed on their systems, which they shall shortly be getting, but they will also enjoy the full support for the Open Source softwares on the local repository of our college. All the laboratories would adapt to the open-source alternatives thereby promoting the zeal of open-source among the freshies.
I really appreciate this campaign and am happy to be a part of this :) . I hope, soon I would be accompanied by all my fellow mates in this effort.

Monday, August 3, 2009

My Experiments with Java..

I am a guy who had Computer Science as his main subject in 12th standard and I still remember its since that time I developed a passion for programming languages. I remember the time we were taught Basic programming in school, there was nothing more boring than programming for me at that time. As the classes went by there haven't been any improvement in me, until I was introduced with C++ in 11th standard. I dont know what compelled me through it. May be the excellent teaching style of Hasan Sir, our beloved computer teacher :) We never realized that among so much fun and enjoyment in our Computer classes we were actually making our way through programming fundamentals and later on most of us would land up in there lives at places which would inextricably attached with programming. Well that was the beginning of programming for me, I would rather say.

Java... I remember I heard it for the first time in class 7th from my computer teacher. I didnt know anything more than just its name. At that time computers meant no more than a dull boring Black screens placed in our school labs, which knows some DOS commands, for me. Java seemed interesting.. :) or rather 'sounded' interesting! I decided to learn it sooner or later. But then we make so many plans in our lives when we are young. And as it happens with me always, I forgot even that. It wasnt until my B-Tech 1st year, that again the term 'Java' got refreshed in my mind. Actually it was an informal geeky (rather we all were trying to sound as geeky as possible!) conversations among friends at college hostel. There one of my dear friend put up this term & again I was reminded of my plans of childhood :) (sounds comical)

Well then it was the summer holidays of 2nd year and then I decided to try my hands out on something new. And what else can be it other than Java at that time. I just dived my college library and came out satisfied with a thich 1000 pages book on Advanced Java in hands. I happily took it home and then spent 2-3 days just to understand its starting 2-3 pages. :) It began with Multi-threading !!! that was the first topic I started with!
anyways.. it happens.. I kept on trying and consistently practicing all the programs and soon I had a large collection of my Java programs and gradually the 4 letters of 'Java' started getting clearer in my mind. And just few months more and I was the champ in Java among our friends !! ( i know I boast sometimes ) Another friend Raju, who started with C# at nearly the same time when I picked up Java, too started making cool applications in it. We used to spend hours together competing with each other, challenging each other on programming problems. He used to do it in C# and by now you all very well know what language I used:) ... This is called a healthy beginning. Later I self-studied JavaME an JavaEE, created applications ranging from stupid games to challenging problems. Here are few of my startup programs in Java. freely available and distributable, thats what open-source is all about! -

Saturday, August 1, 2009

Another KIIT-Sun Club get-together



It was only this Saturday ie 21st March'09 and the KIIT- Sun Club was all set to organize a Technical demo on OpenSolaris2008.11.
It was primarily focused for the 1st and 2nd year students who do not know the intricacies of the operating systems and the specialities of OpenSolaris, in order to equip them with the basic knowledge of OpenSolaris Operating System, but was equally open for interested students of all the years and branches. And to my surprize I got the students for the 3rd years also joining me in the talk and few were found much interested to know the correlation between modern Linux and opensolaris as they look alike to them.
I started with the history of opensolaris project and later on introduced them with the tools to be used late in that session i.e. Virtual Box. Smart IT students didn't take it any longer to understand the underlying basics and working of Virtual Box as most of them have already seen some kind of Virtualization agents earlier. Few seemed to be already using Virtual Box, but still they liked to listen to the basics of the concept of Virtualization. Testing entirely different and new operating systems on their Windows preloded systems provided by the college, have never been so easy and risk free for them. Watching the Guest operating system run inside the host machine was though some kind of a magic to few but nonetheless all were keen to know the steps to do it. After covering the basics I demonstrated the steps for building Virtual Machines inside Virtual Box and how can the guest OS be installed in it safely.
I later showed them Opensolaris working perfectly fine in the Virtual Box ( preinstalled on my computer). Then after giving them a brief overview of the opensolaris I talked about the exciting features and opensolaris like DTrace and promised them to carry on this topic in future sessions.

Friday, May 1, 2009

Its hot !

ufff.. hot summers.. its chilling out here
and I am feeling this place.. more like a cage..
this place will always be, the 1 which anyone would like to flee
But this hostel life has not really been totally wasteful
now look here we are taught so many good lessons-

> The calm and cool Birthday celebrations ( i hope u get it.) taught us the lesson of non-violence and brotherhood as never before.. The way we guys congratulate and greet others on their B'days ( well its the time which is much more awaited by all other than only d b'day boy ) .. m talkin abt d birthday bumps yar.. its way of living in a society. It shows the existence of immense intimacy between guys of King's Palace-3 . yeah thats what true friendship seems to me!
> The delicious food ( Oh Paneer!!! yummy. look I started developing a taste for it ). It teaches us to respect the food and be thankful to hostels mess authorities for the little we are getting in our hostels ( mind the word 'little') :)
as such paneer is the only source of energy here for vegetarians like me
> Watching movies even a day before exams doesnt really teach us anything but its just to tell that we are sharp enough to vomit in few tragic hours of exams all what in entire semester's class we never thought of giving an ear to.
Anyways its true that theres a beautiful dawn awaiting after a gloomy night.
> Games !!! oh yes. playing it whole night really helps a lot in building ones concentration and keeping ones mind from silly thoughts and earthly tensions. its a divine thing to do. and yes ofcourse it keeps your laptops from rusting.

I really feel everyone should atleast ones experience this hostel life, full of fun . among all this you really do discover some true friends with whom you would like to hang out ( else they are always ready to Hang you out and then get themselves hung too). u rarely find such idiots!

Friday, March 6, 2009

Netbeans Technical session

I organized an OSUM meeting in my campus on February 28 in which I discussed about various programmes by SUN Microsystems for the benefit of students and teachers like OSUM, SAI and gave a technical demonstration on project development using Netbeans6.5 which was the most interesting part of the session.

Since the audience I targeted were mostly second year students well trained in their curriculum subjects like C++ and Operating Systems but having little or no background knowledge of Java, but were much enthusiastic to learn it. So, I planned to show them how easily and quickly can the projects be developed using Netbeans without the need of having a strong command on the language.

I began by telling them how easy and fun would C++ programming be in Netbeans, and hence can be used for their daily assignments. I introduced Netbeans as the IDE which they shall be using exhaustively in most of their future projects. Bundled with JavaSE,JavaEE, JavaME, JavaScript, Ruby, application and database servers and much more, Netbeans offers support for just anything one can think of!
I developed a sample project each in JavaSE, JavaEE and JavaME by typing down minimum number of Java Code lines by just using other features of Netbeans like drag and drop etc. trying to keep the complexity of the project minimum, so that it can be easily understood by the audience.
Students were really fascinated to see ease of development it offers in Mobile application in JavaME, after watching the development of a 'Login and Welcome' application in which I just typed in a single line of Java Code!
Everyone was willing to adapt Netbeans as their IDE at the end of the session.
At the end their was a usual quiz session with exciting goodies to be won. Netbeans DVDs were distributed among the Club members so than they can experiment, play and learn.

Think anything Code anything

Wednesday, February 25, 2009

My first ever Session...

Here is something to share.
Last Sunday I conducted a little casual type of OSUM meeting just to brief up the interested students (especially of 2nd years) about SUN, its technologies, OSUM, SAI and the benefits its going 2 share with us. I got a mass of interested students (more than 50) attending the session (45 mins approximately) willingly!

I got amazed to know that though majority of them were not knowing of Java Programming
(since it was not in their course till now) but they had much enthusiasm to learn it and go for the Certifications as well!!!

Opposite to what I expected and adding to my astonishment, there were 5-6 people who came forward showing their extreme interest in going for SUN Certification in near future and are eager to derive benefits out of SAI !
Many were curious to know about various SUN Technologies which I assured them to be discussed in future OSUM meetings .


At the end I had a brief quiz. I asked few questions to them and the ones who came up with correct answer got SUN goodies ( Open Solaris Student pack, Netbeans DVD, SUN pen, SUN keyrings etc.)

Since it was my first demo I ever conducted. I was a bit nervous about it and a bit uncertain about the response. But it all went so well. Thus making me to think an urgent need of other such demos. I think I would be conducting another session very soon.
It boosted my confidence a lot... A nice and exciting experience altogether..