Friday, December 23, 2011

SVN notes

the simplest and to the point cheat sheet for SVN

http://www.abbeyworkshop.com/howto/misc/svn01/

one command which didnt work for me.. when i tried to commit "add a file to svn repository"

svn commit -m "Saving recent changes" http://localhost/svn_dir/repository/project_dir

I used the file name / folder instead of URL

svn commit -m " log for commiting" filename.sql

Mysql useful notes

to get only the DDL for all tables in Database without data

mysqldump -u -p -h host --no-data --skip-opt db

terrible issue i faced by using the above command.. the AUTO-INCREMENT and other options where not shown up in the dump .. im not going to use skip-opt ..

mysqldump -u -p -h host --no-data db

to get only the data-dump as inserts for a table

mysqldump -u -p -h host --no-create-info --skip-opt db table-name

sometimes your user access didnt allow to use mysqldump .. in this scenario use
--single-transaction
clause

to get the tables order by row count..

select table_schema,table_name,count(table_rows) from information_schema.tables where table_schema not in ('information_schema','performance_schema','mysql') group by 1,2 order by 1,3 desc;

Run sql as string from command line
mysql -u user -p -e ‘SQL Query’ Database_Name
to export to a file
mysql -u user -p -e ‘SQL Query’ Database_Name > filename


Performance pointers
Beware of running ANALYZE while there is some long running queries on the table.
In MySQl if you have a long running query accessing the table and you run ANALYZE TABLE, it is unable to access the table with lock until the first query completes. So Analyze will wait.
There is a good possibility that a long running query was triggered when we are trying to analyze the table. We can schedule all 'Analyze' specifically the tables serving end-user at off-time.

Wednesday, December 21, 2011

Extract / Get DDL of Hive tables

Recent issue I came across when we need to migrate Hive tables from one server to another.. (even from a dev to prod environment) as usual we havent preserved the DDL for the Hive tables present..

Googled and came across this jira https://issues.apache.org/jira/browse/HIVE-967

Step by step

1. download the HiveShowCreateTable.jar from jira
2. Copy it to the server which has Hive (even your local directory is fine)
3. Run as following (the syntax in the txt file of Jira doesnt work because of its reference to a non-existent jar file)

hive --service jar HiveShowCreateTable.jar com.media6.hive2rdbms.job.ShowCreateTable -D db.name=default -D table.name=poc_detail 2>/dev/null

ta..da.. we get the DDL of the provided table :-)

Thanks to Ed Capriolo who created this code..

Wednesday, December 7, 2011

Outliers by Malcom - book journal

Just to record my understanding, perspective of listening to the book 'Outlier'

The beginning of the book about an italian immigrant community in Pittsburg is a good start. How a certain community alone can evade the wrath of heart-attack the prominent killer of modern time.. Im interested more in this story since I myself has a high-cholestrol and my Dad died of stroke. The answers is typical to the author it seems. His perspective that the community and being belonging to the community avoids heart-attack and other diseases was appealing to me. Because I too saw men who are happier and who has a dont care attitude or self-sufficient lives longer. Anyway my learning ' have friends, be closer to your community, have a laugh and become content at some point in life :-)'

The other stories I liked is the 10000 hours of work all the successful people put into to became one.. like the beatles, bill gates, bill joyce and all the star sports people.
Although 10000 hours may seems distant .. it is possible in a distant timeframe.. Im turning 31 soon. say I spent a hour every working day during my past 8 years of professional life (8 x 24 x 12) = 2300.. i have a deficit of 7700 hours..
@ 2 hrs / day = 13 yrs
@ 3 hrs / day = 9 yrs
@ 4 hrs / day = 6.5 yrs
Being married and have a kid, even 4 hrs a day is a high cost (with so much distraction around).. but being a ambitious man I have to..The only way is to make my job a learning arena. This is the only time I can concentrate. The trick is to have a job which gives that..Lets see if I have the opportunity and luck to keep that for next 7 years from now..I would be 38 by that time :-)

Malcom is a strong advocate through out the book for the impact of culture and ethnicity on success.. I gotto think about mine to see what is there in my story although im not a outlier (maybe Im one considering my schoolmates and most from my childhood neighbours)
im fortunate to have graduated father and mother when most of the kids has none of them educated or one of them, my mom being a intelligent woman understands the need for education and puts so much time/money to teach me eventhough I didnt have nice teachers all through my life..Although I havent scored much in the examinations I certainly felt bright and intelligent. Choosing the IT as my engineering instead of more fashionable aerospace, marine or electronics...Thankful the IT industry boom in India and to land on right job which will later send me for a project to US..

The other very important learning I got is - why certain people are so outspoken and have the trick of getting anything they want. Its from their parents and environment / ethnicity.
Its good to expose children to many talents at an earlier stage, they might catchup something or they will understand how to cope with multiple things. Parents should be an example like giving freedom to children, spouse, listening manners. If possible send them to private school to get a good learing and have a oppurtunity to have more learning time.

according to outliers -- success is -- right man (willing to work and work hard) right time (grab the occasion) with right environment ( with the tools and oppurtunity) with right mindset (heriditary and ethnicity related) will seize to success!!