Archive for May 2007

MySQL and Merge Table


Hi, this is just an information, i need to keep it over here for my future reference. How to a table with the data collected from two different tables?

Mysql offers the MERGE option. a MERGE table is a collection of identical MyISAM* tables those can be used as one! Identical means, all tables shud have identical columns and index Information.

here is what the query I have used to test it.

create database pandian;

use pandian;
/*table 1,mumbai*/
create table mumbai
(first_name varchar(30),
amount int(10));

/*table 2,mumbai*/
create table delhi
(first_name varchar(30),
amount int(10)
);

/*Insert data*/
insert into mumbai values (‘ranjini’, 75);
insert into mumbai values (‘angel’, 55);
insert into mumbai values (‘mahendran’, 55);
insert into mumbai values (‘veera’, 55);
insert into mumbai values (‘pandian’, 55);
insert into mumbai values (‘balu’, 55);

insert into delhi values (‘kavitha’, 25);
insert into delhi values (‘raman’, 68);
insert into delhi values (‘anbu’, 45);
insert into delhi values (’selva’, 98);
insert into delhi values (‘nalini’, 25);
insert into delhi values (‘amutha’, 36);

/*new table with the data from mumbai and delhi*/
create table total (
name varchar(30),
cash int (10)
) type=merge union=(mumbai, delhi);

/*check whether any changes made to individual tables are getting reflected in the total table, wow yes!*/
insert into delhi values (‘richard’, 75);

/*what will happen if the resultant table is of different structure??*/
create table total_different (
name varchar(15),
cash int (10)
) type=merge union=(mumbai, delhi);
/*
oops.. Gone!

Unable to open underlying table which is differently defined or of non-MyISAM type or doesn’t exist
*/

FastHashMap – a map for multithreaded environment

when we need a map kind of object, there are several options. while working with threads, there arises an issue, we are going for HashTable. When we use Hashtable, one thread has to wait with some other thread is playing with the map, which is unnecessary. One of my team mate had used some classes from beanutils for someother purpose. when going thro the API of the commons-beanutils before adding it to classpath (lazy fundoo, havnt looked at this api before!), I found org.apache.commons.collections.FastHashMap.

It has a field called ‘
fast' which decides the read property of the map. If the map is at fast mode, then read occurs concurrently, which will increase our reading capability. as the definition says, we can enable or disable fast mode. I havnt tested this. need to do it.

Political Parties give second thought on second term for APJ Abdul Kalam

———- Forwarded message ———-
From: Get Kalam Back <pramodh@getkalamback.com>
Date: May 6, 2007 10:04 AM
Subject: Political Parties give second thought on second term for APJ
To: barathee@gmail.com

Dear barathee,

The Rashtrapati Bhavan will soon have a new occupant. – CNN IBN

Politicians are tightlipped about their choice for President

Hunt for India’s first citizen is picking up pace,

  • The BJP has been maintaining a conspicuous silence on the issue.
  • Kalam is not exactly the hot favourite with the Congress.
  • One party that’s come out openly against Kalam’s second term is the Left.

(Note: The CPI-M had opposed Kalam’s nomination in 2002 and promises to do so again this time.)

WHY ?

The political parties are aware that the next President may
have to play a crucial role if the 2009 General Elections
throw up a hung Parliament. Therefore, the parties would
obviously prefer a nominee it can rely on, politically.

No one has become a President for the second time after Dr Rajendra Prasad.
And if history repeats itself, the consensus on Kalam looks difficult.

From GetKalamBack.com CAMPAIGN, we request only two action from your side:

1. If you have not voted in the campaign, please CLICK HERE TO VOTE. This is very important.
2. Enter details of your friends (atleast 10) in the email you will get.

barathee, we deserve what we give. Let us put out our efforts to have a
Visionary like Dr Kalam as the First Citizen for another Five Years.
We will send the letters of the Campaign on May 7 to the political parties.
The time has come to play our role in choosing what and whom we want.

Regards,
Pramodh Mysore

NOTE:
FORUM: We have created a FORUM for you to
discuss the issue of Second Term for President Kalam. Please give your opinion
by going to the Forum.
NEWS: We have also the latest news on Dr Kalam’s various visits and his second Term.
Please visit NEWS
www.GetKalamBack.com News: More than 350,000 people have registered. We require
atleast a million votes for us to send as the collective opinion of the people. So, please send
it to more friends.


—————————————————
*Free* software is a matter of liberty not price. You should think of “free” as in “free speech”.

May Day – 2007