Thursday, July 8, 2010
Thursday, July 1, 2010
How to export only data using mysqldump and grep?
I just found a way to export only data using mysqldump:
mysqldump -u root -p --skip-opt --skip-set-charset --skip-quote-names --skip-tz-utc --skip-add-drop-table --skip-add-drop-table --skip-comments --no-create-info --skip-add-locks --skip-triggers databasename table1 table2 > data.sql
Now data.sql will contain only the insert statements but needs a bit of cleanup:
grep -iv '!4' data.sql > final_data.sql
This should have only insert statements and nothing else.
There might be some other better way!! but this works for me :P
mysqldump -u root -p --skip-opt --skip-set-charset --skip-quote-names --skip-tz-utc --skip-add-drop-table --skip-add-drop-table --skip-comments --no-create-info --skip-add-locks --skip-triggers databasename table1 table2 > data.sql
Now data.sql will contain only the insert statements but needs a bit of cleanup:
grep -iv '!4' data.sql > final_data.sql
This should have only insert statements and nothing else.
There might be some other better way!! but this works for me :P
Wednesday, May 19, 2010
Probability simulation
Another simulation of an example from Feynman's lectures on Physics.
A coin is tossed 30 times and the no of times a head appears is counted. This experiment is then repeated 100 times. you can see that the no of heads always hover's around 15. It means that out of 30 tosses, the no of heads will be always around 15. Weird! :)
Monday, May 3, 2010
When the sun comes up, you better start running
Every morning in Africa, a gazelle wakes up.
It knows it must run faster than the fastest lion or it will be killed.
Every morning a lion wakes up.
It knows it must outrun the slowest gazelle or it will starve to death.
It doesn't matter whether you are a lion or a gazelle.
When the sun comes up, you better start running.
(An African proverb mentioned in 'The world is Flat' by Thomas L Friedman)
It knows it must run faster than the fastest lion or it will be killed.
Every morning a lion wakes up.
It knows it must outrun the slowest gazelle or it will starve to death.
It doesn't matter whether you are a lion or a gazelle.
When the sun comes up, you better start running.
(An African proverb mentioned in 'The world is Flat' by Thomas L Friedman)
Friday, April 30, 2010
Flex and Physics
Thought of animating this law of conservation of energy example from 'The Feynman Lectures on physics':
Even after all the movement all the objects remain in the same position. This is of course assuming that there is no loss of energy in between.
Even after all the movement all the objects remain in the same position. This is of course assuming that there is no loss of energy in between.
Wednesday, April 28, 2010
Mr Mandela
Today, I finished reading Nelson Mandela's auto-bio – 'A long walk to freedom'. What a man! I felt obligated to purchase this book while I was staying in Johannesburg :)
I wonder what would have happened in South Africa if not for Mandela !! Just imagine India without Gandhi. I think Mandela has gone through more pains than Gandhi did for India. 27 years in jail is no joke. Just a curious observation – both Mandela and Gandhi were lawyers by profession. Lawyers have to fight by profession. They have no other choice. I think in a natural way they extend it outside their profession as well.
I still remember that as a kid, we were watching TV at home and saw a sudden text message on the screen that Mandela has been released after being in jail for 27 years. Dad told that he was a freedom fighter.
While working at Bank of Athens (a Greek Bank) in Johannesburg, There was a Management committee which I had to attend and suddenly an old man in suit entered into the board room. I dont know why, but by reflex I stood up as a matter of showing respect. This old man was George Bizos who served many times as a lawyer to Mandela. I am proud that I could atleast meet Mr. Bizos if not Mr. Mandela :) Mr. Bizos is on the board of Bank of Athens and is a Greek himself.
I think Mr. Mandela is a great negotiator and who had one and only goal - the freedom of South Africa from the shackles of Apartheid. He did acheive it in the end.
Monday, April 19, 2010
The argumentative Indian
Just finished reading 'The argumentative Indian' by Amartya Sen. Its quite an interesting read and the author touches on many subjects such as education, religion, identity, the importance of reasoning, culture, women vs men, use of nuclear power, secularism, calendars, science and technology.
Subscribe to:
Posts (Atom)