2012年7月27日 星期五

Python print exception message

        try:
                mainFUN()
        except :
                print 'Exception occur.. '
                #-- MyDebug
                import sys
                import traceback
                print "Unexpected error:", sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]

2012年7月26日 星期四

Python Debug


 Execute command:

python -m pdb foo.py


A. next line
n

B. Set the break point
 b 3


C. run to break line
r










Reference:
http://fcamel-life.blogspot.tw/2011/07/python-debug.html

2012年7月25日 星期三

Python uninstall

python setup.py install --record files.txt And when you find out the list is complete: cat files.txt | xargs rm -rf


Reference: http://stackoverflow.com/questions/1550226/python-setup-py-uninstall

2012年7月23日 星期一

Eclispe HightLight Pattern

ATL + SHIFT + O

Reference: http://stackoverflow.com/questions/6148481/eclipse-with-java-wont-display-matching-variables

2012年7月19日 星期四

Move File Name By Speceial Format

mv $file ${file%.snp}_snp.txt

Zip Include your wante file

zip -r xxx . -i xxx/*.snp;

2012年7月16日 星期一

awk print thousand format

export TK_USE_CURRENT_LOCALE=1
awk 'BEGIN { printf("%'\''10d\n",123456)}'

reference http://www.mkssoftware.com/docs/man1/awk.1.asp

2012年7月2日 星期一

Distinct

SELECT DISTINCT table_column1, table_column2···
FROM table_name;
可以將資料只有一筆,
避免重複,


distinct column




Group By Having

Group By: is seperating the  data query condtion,
having: is the filter condition after the group,
Aggregation function: using in group query


-- 使用 group 找出相同內容
select i.sample  ||  '.' || i.chr || '.' || i.pos || '.' || i.type as mykey,
count(i.sample  ||  '.' || i.chr || '.' || i.pos || '.' || i.type) as counts
from gra.gra_indels_het_homo_target_testDel as i
group by i.sample  ||  '.' || i.chr || '.' || i.pos || '.' || i.type
having  count(i.sample  ||  '.' || i.chr || '.' || i.pos || '.' || i.type) > 1



reference:
http://news.csdn.net/n/20061123/98120.html
http://tomkuo139.blogspot.tw/2008/11/group-by-having.html