Two prisoners were sentenced to death by King Xuan of Zhou and were
kept in two different inaccessible cells. They were to be put to the
gallows the day after. However, King Xuan wanted to give them a last
chance. Since he was very fond of riddles, he came up with one for the
prisoners which if they solved, they would be set free. The prisoners
were told that they would be put into a single cell for a day when they
can discuss their strategy, after which they would again be sent back
to their respective cells. One of the prisoners would then be given 5
playing cards out of the pack of 52 cards. He can send four of these
five cards to the other prisoner through the jailor one by one after
which the second prisoner has to guess the one card (number and suit)
which is left with the first prisoner. If he guesses right, both the
prisoners would be set free but if not they would be hanged the same
day.
What strategy could they possibly come up with which could save them?
To know the solution .
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
Recently, I came across this scenario that when ever I open any word files which copy from different system, word getting crashed with error ‘Microsoft Word has encountered a problem and needs to close error’ . After a small search, I figured out that it is well known issue to the rest of world.
Checking Microsoft web site for the problem, it told me it was the normal.dot template that was corrupted, but how could the normal.dot template could be corrupted when it never had been open before? Then I realized the problem; Microsoft word was open when I ran the File and Settings Transfer Wizard on the old computer, and because of that a temporary normal.dot got copied to the new computer.

that (picture above) temporary normal.dot file is created when word is open, and if you run the File and Settings Transfer wizard while it is open, it will get copied to the new computer, creating conflicts in the new computer with word.
The normal.not file can be found at your computer profile path at: C:\Documents and Settings\yourprofilename\Application Data\Microsoft\Templates if you are having the same issue I had, delete everything under the template folder.
Microsoft word will recreate the files automatically when you open it up. Remember that is not a good practice to have applications open when you run Files and Settings Transfer Wizard on computers to transfer data.

Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
If you get this error while trying to create a foreign key, it can
be pretty frustrating. The error about not being able to create a .frm
file seems like it would be some kind of OS file permission error or
something but this is not the case. This error has been reported as a
bug on the MySQL developer list for ages, but it is actually just a
misleading error message.
In every case this is due to something about the relationship that
MySQL doesn’t like. Unfortunately it doesn’t specify what the exact
issue is. Here is a running list of causes that people have reported
for the dreaded errno 150. I’ve tried to put them in order based on the
frequency that I hear about a particular cause.
You may want to start by running the MySQL command “SHOW INNODB
STATUS” immediately after receiving the error. This command displays
log info and error details. (Thanks Jonathan for the tip)
Known Causes:
- The two key fields type and/or size doesn’t match exactly. For
example, if one is INT(10) the key field needs to be INT(10) as well
and not INT(11) or TINYINT. You may want to confirm the field size
using SHOW CREATE TABLE because Query Browser will sometimes visually
show just INTEGER for both INT(10) and INT(11). You should also check
that one is not SIGNED and the other is UNSIGNED. They both need to be
exactly the same.
- One of the key field that you are trying to reference does not have
an index and/or is not a primary key. If one of the fields in the
relationship is not a primary key, you must create an index for that
field.
- The foreign key name is a duplicate of an already existing key.
Check that the name of your foreign key is unique within your database.
Just add a few random characters to the end of your key name to test
for this.
- One or both of your tables is a MyISAM table. In order to use
foreign keys, the tables must both be InnoDB. (Actually, if both tables
are MyISAM then you won’t get an error message - it just won’t create
the key.) In Query Browser, you can specify the table type.
- You have specified a cascade ON DELETE SET NULL, but the relevant
key field is set to NOT NULL. You can fix this by either changing your
cascade or setting the field to allow NULL values. (Thanks to Sammy and
J Jammin)
- Make sure that the Charset and Collate options are the same both at
the table level as well as individual field level for the key columns.
- You have a default value (ie default=0) on your foreign key column (Thanks to Omar for the tip)
- One of the fields in the relationship is part of a combination
(composite) key and does not have it’s own individual index. Even
though the field has an index as part of the composite key, you must
create a separate index for only that key field in order to use it in a
constraint. (Thanks to Alex for this tip)
- You have a syntax error in your ALTER statement or you have
mistyped one of the field names in the relationship
- The name of your foreign key exceeds the max length of 64 chars.
The MySQL documentation includes a page explaining requirements for foreign keys.
Though they don’t specifically indicate it, these are all potential
causes of errno 150. If you still haven’t solved your problem you may
want to check there for deeper technical explanations.If you run into
this error and find that it’s caused by something else, please leave a
comment and I’ll add it to the list.
To Find detailed error message in Mysql
If you get for example:
ERROR 1005 at line 12: Can’t create table ‘./database/users.frm’ (errno: 150)
You can find out the real reason by executing bin/perror 150 in the MySQL directory.
This will give you a nice error message:
MySQL error: 150 = Foreign key constraint is incorrectly formed
Collected from here directly.
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
After my upgrade to hardy, firefox always starts with offline mode and it’s really hectic to keep change it back to online and refresh the each saved session tabs.
Also in parallel, I find my NM (network manager) applet showing status as not connected even though I connect by dhcp setting through dhcp-client.
After googling for some time, I understood that above too are inter-related. Firefox checks the nm status through d-bus and based on that it’ll change the mode while starting. Same is the case with pidgin, evolution and other internet based applications. So, issue lies with nm applet as it’s not showing the correct status even though I connect by dhcp config.
Finally, I figured out the fix for this.
I disabled roaming mode for wired connections from the Network manager and then enabled automatic configuration (DHCP) option. Now, everything started working. Firefox starts online mode now.
What a default config. Ubuntu release should have come by the proper default config atleast for very commonly used things like NM etc.
Also, I found that the issue not exists in earlier versions of firefox as well as NM. Also, by down-grading the kernel version fixed this. But, of all these, the above one is the easiest.
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
Name
find — Searching for files and possibly executing commands on them
Examples
-
To list all files below a given directory, say /home/user/some-directory
find /home/user/some-directory
-
To find all pdf files below that directory
find /home/user/some-directory -name “*.pdf”
-
To find files containing “tutorial” in their name
find /home/user/some-directory -name “*tutorial*”
-
To find files below the current directory changed in the last 3 days
find . -ctime -3
-
To find files that haven’t changed in the last 365 days
find . -ctime +365
-
To find all unreadable files in the current directory
find . ! -perm +444
-
Same as above, but limit to the current directory and one subdirectory deep
find . ! -perm +444 -maxdepth 2
-
Make all the files found in the above search readable by user and group (Assumes that you are the owner of all such files or that you are root)
find . ! -perm +444 -maxdepth 2 -exec chmod ug+r {} \;
-
Two ways of searching for all .c or .h files that contain the string “gtk”. The two methods are equivalent, although xargs has mutliple options that could be used to alter its behavior and thus would be considered the more flexible method.
grep “gtk” `find . -name *.[ch]`
find . -name *.[ch] | xargs grep “gtk”
Collected from gnome developer site.
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
Similar exceptions are :
1. java.io.IOException: Io exception: Unexpected packet
2. java.sql.SQLException: Protocol violation
3. java.sql.SQLException: Io exception: Bad packet type
4. java.sql.SQLException: Bigger type length than Maximum
5. java.sql.SQLException: Io exception: Invalid Packet Lenght
6. java.sql.SQLException: Closed Connection
7. java.sql.SQLException: Closed Statement
8. java.sql.SQLException: Refcursor value is invalid
9. java.sql.SQLException: Io exception: Size Data Unit (SDU) mismatch
10. java.sql.SQLException: Must be logged on to server
All these occur almost with same reason. It is caused when more than one thread is trying to make simultaneous use of the thin Oracle JDBC driver via the same Connection object.
To correct this problem we have to ensure that only one thread of execution was making use of the JDBC driver at a time through the same Connection OR upgrade to a later version of the driver.
Further investigation says, with JDBC driver version is 9.2.0.2.0 it is reproducible and 9.2.0.3.0 is free from this. Any ways, it is advisable to go with latest jdbc driver version i.e. 10.2.0.4 which can solve this issue.
Multi-thread programming needs this as quick note.
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
An interesting exception faced while parsing xml content. Also, on further analysis on this error caused below similar issues started to raise.
Another similar exception is:
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence
Here, I am trying to parse an xml string using byte array from the xml string, and give that array as input to xml reader stream. I have used java.lang.String.getBytes() for this.
Unfortunately, I got a chinese (other UTF-8) characters as a value of one node in the xml. Hence, I got up with the above error. Later, I found that getBytes() method supports only the western encoding, not UTF-8. So by using java.lang.String.getBytes("UTF-8") method, we solved the issue.
Good to note this in XML Programming
.

Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
When you are working with an MNC, it’s pretty common to have interactions with onsite team Vs offsite teams. Problems comes when your calender tool not properly convert the appointments between the time zones. These are the very common Time conversions used perticularly by professionals from Indian Sub Continent.
Time Zone Standard Time & Summer Time Daylight Saving
India Standard Time (IST) +5.5 hours
Eastern Standard Time (EST)(EDT) -5 hours -4 hours
Central Standard Time (CST)(CDT) -6 hours -5 hours
Mountain Standard Time (MST)(MDT) -7 hours -6 hours
Pacific Standard Time (PST)(PDT) -8 hours -7 hours
For example, to convert between IST and PST, from the above table you can easily figure out that the difference between those two time zones is 13.5 hours.
ie. Today 9 AM (IST) = Prev Day 7:30 PM (PST)
Simple rule is: PST is 13.5 hours behind IST.
So to catch a person in PST between 6AM to 6PM from IST is very difficult in day time
. As it comes to next day 7:30PM to next next day 7:30AM from IST.
Hope it helps you. For more time zones http://www.souledout.org/nightsky/time/ut.html .
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
In my PL/SQL procedure I had to add a text including newline (\n in
java, ascii #10) in a text to be read by a java application. Tried with
the code
l_text := 'hello\nworld';
This did not work, the \n character behaves clearly different in PL/SQL than
in Java and only wrote ‘\n’, probably the same as writing a String in
Java using \\n. To add the newline character, I had to use chr(10),
that worked.
l_text := 'hello' || chr(10) || 'world';
I guess the same goes for newline-carriage return as well, in Java \n\r in PL/SQL writes char(10) || chr(13).
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags:
I’m not big fan of cricket game. Also, this is my first post to publish on cricket game. But where ever you go, you see very few people to get inspired. Such personalities need this piece of appreciation to let world know about him.


It all started on the night of 27 November 1993. India were playing
against WI in the finals of Hero Cup in Eden Gardens. I was just eight
years old then. After a small but entertaining partnership between
Sachin and Kapil, India had put a target of 226 for WI. After a solid
start they just tumbled and fell like dry leaves to the magic of a
bespectacled young man. Accurate and unerring, his deliveries one after
the other kept on asking questions to the WI batsmen who had no clue how
to play them. Soon they had given up and he had picked up 6 wickets for
12 runs. He takes the last six wickets in less than 5 overs; it is still
India’s best bowling performance in ODIs. Indian won Hero cup and he
became the Hero in my heart. The man, Anil Kumble, is my favourite
cricketer over the past 1 and 1/2 decade.
We are really lucky to be in a generation which is a golden era for spin
bowling. Three world class spinners, Kumble along with Murali and Warne,
ruled the cricketing world over the past 15 years. They had shown the
world that spinners can be match winners. Of the three Kumble is
distinct. He did not have the flair of Warne or guile of Murali but he
competed with them through out this period. He certainly is not a bug
spinner of the ball, but as he said the difference between the middle of
the bat and edge is just 1 inch. You need not be a big turner of the
ball to beat the edge. Even if you compare the records of Warne and
Kumble, Kumble had picked up 4.68 wickets per match when compared to
Warne’s 4.88 per match. He was the first bowler to reach 300 wickets in
ODIs among the three. And he had one test century that the other two did
not have. In fact he was the only one to score a century in 500+ wicket
club. People say Kumble has picked up lot of wickets on sub continent
where the pitches assist spinners. But one has to realize the fact that
even Warne picked up majority of his wickets against SA and England who
did not know that a cricket ball can spin. When Murali picked up
majority of his wickets against cricketing minnows like Zimbabwe and
Bangladesh, Kumble had major success against the world champions
Australia and Pakistan, who are the second best players of spin after
India. This is not to show that Kumble is more than Warne or Murali but
just to tell that he is not less. If warne is blessed and Murali has it
by birth, Kumble is the one who showed that hard work pays. He
simplified the art of spin bowling just like an expert mathematician
does when solving complex problems.
I liked Kumble when I was not aware of the golden past of Indian spin,
the spin quartet. E.Prasanna once said that Kumble would not even get a
chance a play international cricket if he had played during their time.
Even then Kumble’s record was better than the spin quartet put together.
Four spinners put together averaged just above 4 per match compared to
Kumble’s 4.68. Having said that I should accept the fact that those four
spinners were really quality players. He also holds the record for
highest number of LBWs and Caught and Bowleds in Test cricket.
Incidentally his last two wickets in test cricket are LBW and Caught and
Bowled respectively.
Anil kumble is inarguably the greatest match winner for India. As
cricinfo has put it, No bowler in history won India more Test matches
than Anil Kumble, and there probably hasn’t been a harder trier either.
He has literally won many matches for India during the time when India
was considered unbeatable in their home soil under Azhar. People who
comment that Kumble’s record outside subcontinent is not that good have
to understand the fact that before Rahul Dravid had a golden run at
No.3, Indian batsmen seldom scored in test matches outside India. When
Indian batǪing started performing better outside India, Kumble’s record
outside India has also improved. 20+ wkts in Australia, despite being
treated as a backup for Harbhajan; he got a chance only after Bahajji
was inhured in that series, in 2003 is an example. His subtle variations
in pace, length combined with a clever use of crease earned him great
success. Though he is not a big turner of the ball, he has made the
batsmen dance on their toes with his deliveries. Though he does not know
how to spin a ball, he has made cricket records spin around his career.
In a brilliant though always downplayed career Kumble claimed virtually
every Indian record. After his shoulder injury in 2000, Kumble has
improved a lot as a bowler and added more varieties under his
repertoire. He is arguably the best bowler for flippers in his generation.
Inspite of all his achievements, he was always underrated. As an ad
agency once commented, Kumble is not an advertising material. There were
no huge celebrations when he broke Kapil’s record or picked up 10 wkts
in an innings. But he has never complained. Even after announcing his
retirement he did not cry upon officials or fellow players. In his
career of 18 years, he was not summoned even once. As Tony Greig said,
If you ask anybody about Kumble, you will hear only good about him. Ask
Lara & Inzamam, who thwarted all spinners but Kumble, and they will
testify for his greatness. This tells a lot about his character and
ability. To conclude, India may produce another Dravid, Ganguly or
Laxman, but Kumble is once in a life time player. We may not see a
spinner creating records without spinning a ball.
– Most of this content was taken from a mail sent by my friend Anil who is deadly fan of Cricket and Kumble.
Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: