Month: February 2012

Project-Specific Vim Configuration

Usually, we have our own vim configuration in the file ~/.vimrc What if we want one for our project? For example, we are working on certain project which needs to read in a tags file. Well, here is a possible solution. You put a line at then end of your ~/.vimrc file source ./.project.vim Then

tail -n

Quite useful trick, when you want to get rid of the first certain lines of the output/file. $tail -n +2 tail prints out the result starts from the 2nd line. When you use the “find” command to generate a file list under certain folder, this is quite easy to eliminate the folder path at the

Draw ROC Curve

A piece of fairly simple Matlab script to draw the ROC Curve from an array of scores and an array of labels. function [Tps, Fps] = ROC(scores, labels) %% Sort Labels and Scores by Scores sl = [scores; labels]; [d1 d2] = sort(sl(1,:)); sorted_sl = sl(:,d2); s_scores = sorted_sl(1,:); s_labels = round(sorted_sl(2,:)); %% Constants counts


用C/C++处理数据的时候,如果数值比较大就得注意数据类型。比如这个log函数的问题。 log接受double类型的参数,而logf接受float类型。 比如这段代码: #include #include int main() { double x = 4.4e52; printf("log(%lf) = %f\n", x, log(x)); printf("log(%lf) = %f\n", x, logf(x)); return 0; } linux/gcc下的输出是 log(43999999999999999701721741671911630964315171445538816.000000) = 121.216029 log(43999999999999999701721741671911630964315171445538816.000000) = inf