Tuesday, August 28, 2007

think of a meaningful Onam

Festivals have special role in the society's integrity. We , all malayalees celebrate Onam . Its a memory of a humble King, who we believed in his visit to people of kerala every year. After the 6 years gap(+2 ,Btech) , I got a chance to celebrate Onam . I really enjoyed the taste of “payasam” ,which we got from our neighbors.. It is the celebration of the harvest tied with the memory of the golden age of prosperity .My mind went to my past school days...gathering flowers , competing for making "pookalam",playing with friends......lot to say . For a fun yesterday I searched for wikipedia entry of Onam…………..there isss,… http://en.wikipedia.org/wiki/Onam . Thus the old story of Mahabali had came to my mind again ...... Great Sacrifice and forgiveness. In wiki there is a sentence “Prana (life) and Maana (honour) are like the two eyes of a person. Even if life goes, honour should be protected. Knowing that the person that has come now is the Lord Himself, I should be the most fortunate one as the Lord, who gives everything to mankind, is seeking something from me."…. Onam is a good subject for meditation.

Saturday, August 25, 2007

why has Mahabali been behaving this much cruelty to P.J Joseph's Kerala Congress group??

In last year (2006 )onam season P.J Joseph had to resign from his Public Work Ministery Post in the light of Inspector-general P Sandhya's finding that there was some substance in the allegation that he had misbehaved to a woman co-passenger while flying from chennai to Cochi on August 3rd. In his vacancy T.V Kuruvila (Joseph's group)had posted as new Public Work Minister. ...But Mahabali is not ready to leave them. This year T.V Kuruvila is facing a big allegation in the controvecial land deal between his family and KGA Group in Rajakumari village of Idukki district.The problem is hoisted by the Idukki district collector Raju Narayanaswami.This will become a real head ache to Achu in comming days... - A person from his cabinet is facing an allegation that he has links with land mafia when govenment is going on movements against this land mafia....... At last we will reach in the same question - who can I trust??

Wednesday, August 8, 2007

Could Madhani’s release impact Kerala Politics???

On February 14, 1998, shortly before BJP leader L.K Advani 's poll meeting, a serial blast rocked Coimbatore. Fifty-eight people were killed and more than 250 were injured. Nine years later, when verdict in the case was delivered on August 1, the reactions were mixed. Peoples of Democratic Party chief Abdul Nasser Madhani's family and followers are happy. Madhani was acquitted along with seven others, while al-Umma founder S.A Basha and 152 ohters were found guilty of conspiracy.Madhani's home-coming is expected to change the profile of minority politics in Kerala. The LDF government headed by E.K Nayanar projected Madhani's arrest as acheivement. Though the ruling UDF passed a resolution in March 2005 seeking Madhani's release, an angry PDP allied with the LDF to help its return to power last years. However he said in his Kairali channel interview that PDP would work for social revolution and party derived strength from all backward sections, including the Dalits. Whatever may be the declaration, one thing is sure that return of Madhani will put Muslim League on backfoot. In his speech at Thiruvanadapuram on day after his release was flooded with his supporters. From his speech we can conclude that as of now PDP will continue its alliance with LDF.

Tuesday, August 7, 2007

Multithreaded programming in JAVA

Last days I spend a few time for understanding multithreaded programming in JAVA. In C language it is done by including the header file pthread.h and the function pthread_create use for creating a new thread.

All modern operating systems support multitasking. However there are two distinct type of multitasking: process based and thread based. In thread based multitasking environment, the thread is the smallest unit of dispatch able code. This means a single program can perform two or more tasks simultaneously.

Creating a thread in JAVA:
Java defines two ways in which this can be accomplished.

1. implement the Runnable interface
2. extend the Thread class itself

Implementing Runnable
The easiest way to create a thread is to create a class that implements the Runnable interface. Runnable abstracts a unit of executable code. To implement Runnable, a class need only implement a single method called run().

After implements Runnable, instantiate an object of type Thread from within that class. Thread defines several constructors. The that we will use

Thread (Runnable threadOb, String ThreadName)

After the new thread is created, it will not start running until we call its start()

class NewThread implements Runnable {
Thread t;

NewThread() {
t = new thread(this,”demo thread”);
System.out.println(“child thread: “ + t);
t.start();
}


public void run() {
try {
for(int i=5; i >0; i - -){
System.out.println(“child thread” + i);
Thread.sleep(500);
}
}catch(InterruptedException e){
System.out.println(“Child interrupted “);
}
System.out.println(“child exiting normally”);
}
}

class ThreadDemo {
public static void main(String args[]){
new NewThread();
try{
for(int i=5; i >0; i - -){
System.out.println(“Main thread”);
Thread.sleep(1000);
}
}catch(InterruptedException e){
System.out.println("Main thread interrupted");
}
System.out.println("main thread Exiting");
}
}

In this program main thread and child thread will count five to one downwords simultaneously. But execution of main thread will be completed only after completing child thread execution.Because of the thread delay given in for-loops. Main Thread finishes last, because the main thread sleeps for 1000ms, but child thread only for 500ms. In fact some older JVMs, if the main thread finishes before child thread completed, then the java run time system may “ hang”. In above program it is done by sleep. However it is hardly a satisfactory solution.
There are two ways to determine , whether a thread finished . First, call isAlive() on the thread. The isAlive() method returns true if the thre upon which it is called is still running. It returns false otherwise.
class NewThread implements Runnable {
Thread t;
String name;

NewThread(String threadName){
name = threadName;
t = new Thread(this, name);
System.out.println("newthread:" + t);
t.start();
}

public void run(){
try{
for(int i=5; i > 0; i--){
System.out.println(name +":" + i);
Thread.sleep(1000);
}
}catch(InterruptedException e){
System.out.println(name + "interrupted");
}
System.out.println(name +"exiting normally");
}

}
class Demojoin{
public static void main(String args[]){
NewThread ob1 = new NewThread("One");
NewThread ob2 = new NewThread("two");

System.out.println("thread one is alive" + ob1.t.isAlive());
System.out.println("thread two is alive" + ob2.t.isAlive());

try{
System.out.println("waiting for thread to finish");
ob1.t.join();
ob2.t.join();

}catch(InterruptedException e){
System.out.println("main thread interrupted");
}

System.out.println("thread one is alive" + ob1.t.isAlive());
System.out.println("thread two is alive" + ob2.t.isAlive());

System.out.println("main thread exiting");
}
}

In output of this program ob1.t.isAlive and ob2.t.isAlive are true at first call, since threads are running at that time. ob1.t.join and ob2.t.join will wait for the child thread to complete execution.Second call of ob1.t.isAlive and ob2.t.isAlive returns false,since child threads completed their execution.

Friday, August 3, 2007

A mystery man came to play in kerala politics

Last week kairali channel went for Farris Aboobecker who donated 60 lakh Rs for E.K Nayanar memorial foot ball play and who gave 1 crore Rs for P.T Usha 's sports school. Everybody thought that he might be an old person.But when I saw him in front of John Brittas (Kairali channel MD) , I surprised, I understood Farris is a young , handsome man. In this story , interesting thing is , Kairali channel is CPI(M) party channel.Why did this party channel take interest in this mystery man??......He was sending arrows against CM of Kerala in his first and second interview. At the same time he refused or intentianally go backward when Brittas asking him about his background and asset . But at present present one this is clear, he is main share holder of Deepika news paper.....This mystery man proved that he could play lot off politrics in kerala.....