6/23/2008

哈佛的凌晨四点


哈佛的凌晨四点(相信大家看过很多遍了,我发仅供个人励志用) 2008-03-24 00:12


1.现在睡觉的话会做梦 而现在学习的话会让梦实现
This moment will nap, you will have a dream; But this moment study,you will interpret a dream.

2.我无所事事地度过的今天是昨天死去的人们所奢望的明天
I leave uncultivated today, was precisely yesterday

perishes tomorrow which person of the body implored.

3.感到晚了的时候其实是最快的时候
Thought is already is late, exactly is the earliest time.

4.不要把今天的事拖到明天
Not matter of the today will drag tomorrow.

5.学习的痛苦是一时的 而没有学习的痛苦是一辈子的
Time the study pain is temporary, has not learned the pain islife-long.

6.学习不是人生的全部 但连学习都征服不了 你还能做什么?
The study certainly is not the life complete. But, sincecontinually life part of - studies also is unable to conquer, what butalso can make?

7.学习不是因为缺少时间而是缺少努力
Studies this matter, lacks the time, but is lacks diligently.

8.所有人的成功都不是偶然的
Nobody can casually succeed, it comes from the thoroughself-control and the will.

9. 无法避免的痛苦就去享受吧!
Please enjoy the pain which is unable to avoid.

10.早起的鸟儿有虫吃
Only has compared to the others early, diligently diligently, canfeel the successful taste.

11.成功并不属于每个人
Nobody can casually succeed

12.时间在流逝
HOW time flies

13.今天流下的口水将变成明天流下的泪水
Now drips the saliva, will become tomorrow the tear.

14. 像狗一样学习
The dog equally study, the gentleman equally plays.

15.如果今天不走的话 明天就要跑
Today does not walk, will have to run tomorrow.

16.为未来投资的人是对现实忠实的人
The investment future person will be, will be loyal to the realityperson.

17.学历就是金钱
The education level represents the income.

18.今天度过的一天明天就找不回来了
One day, has not been able again to come.

19.即使现在这一瞬间对手的书桌还堆满了书
Even if the present, the match does not stop changes the page.

20.No pains no gains不劳无获

6/17/2008

使用特定端口登录

$ ssh -p 22 user@hostname //使用端口22

ip地址的获取

flyriver@luoyang:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:15:c5:6a:e1:df
inet addr:xxx.xx.xxx.xxx

清空terminal的指令是clear

~$ clear

TCanvas指令后各个参数的意义

c1 = new TCanvas("c1","The Cascade example",200,10,700,900);

“c1”:名字
"The Cascade example": Title
200: 像素的左起点
10:像素的上起点
700,900:整个画布是700*900的像素

6/14/2008

root中函数调用问题的解决

发现root中函数调用跟C++中的没有区别。

void hello(char *name)
{
// print hello name
cout << "hello " << name << endl;
}


void air() //此处名字要跟文件名‘air.C’保持一致
{

Int_t j;

for(j=0;j<5;j++)
{

hello("World!");

}
}

6/12/2008

Filling Histogram with weight

Filling histograms

An histogram is typically filled with statements like:
       h1->Fill(x);
h1->Fill(x,w); fill with weight
h2->Fill(x,y)
h2->Fill(x,y,w)
h3->Fill(x,y,z)
h3->Fill(x,y,z,w)
这里的w是weight.

6/09/2008

root指数分布的产生方法

px=gRandom->Exp(36);
这里的px 就是一个符合exp(-x/36)分布的随机数。

6/06/2008

Reset and Debug

Reset:
gROOT->Reset()

  1. Calls destructors of all objects created on the stack
  2. Objects on Heap are not deleted, but pointer variable is disassociated
Debug:
  • .e continue to end of the function
  • .c continue to next breakpoint
  • .c 45 continue to line 45
  • .p print the value of var
  • .b 34 sets a break point at line 34
  • .db 34 removes the break point at line 34

root commands

运行.C命令
Usage: root [-l] [-b] [-n] [-q] [file1.C ... fileN.C]
Options:
-b : run in batch mode without graphics
-n : do not execute logon and logoff macros as specified in .rootrc
-q : exit after processing command line macro files
-l : do not show splash screen

root[0].?
this command will list all the CINT commands
root[1].X [filename]
load [filename] and execute function [filename]
root[2].L [filename]
load [filename]
root[3].ls
ls on current directory
root[4].pwd
list the current directory, canvas, and style.
root [5] TBrowser b
get the information of .root file

useful linux commands

tar -zxfv madwifi-cvs-20051025.tar.gz
Will uncompress the downloaded file

z means “Gunzip(uncompress) it before extracting, used on file ending in .tar.gz or .tgz”
x means “Extract the contents of the TAR file”
f means “Filename to follow”
v means “Verbose - display contents as it is tarring or extracting”

Open office.org的命令
oobase oodraw oofromtemplate ooweb
oomath 数学公式
oocalc 表格
ooffice 综合
ooimpress PPT
ooo-wrapper
oowriter 文档
Adobe Reader的命令
flyriver@luoyang:~$ acroread
This script is in the /Adobe/Reader8/bin

RealPlayer的命令
flyriver@luoyang:~$ realplay
This script is in the /usr/bin/RealPlayer

Evince的命令
flyriver@luoyang:~/Desktop/root_test/test$ evince test.pdf
这个软件适用于以下格式:
  • PDF
  • Postscript
  • djvu
  • tiff
  • dvi

6/05/2008

C++ compiler in linux

$ g++ helloWorld.cpp

$ ./a.out

6/04/2008

root 规律总结

类型 规律 例子
  1. Classes begin with T TTree, TBrowser
  2. Non-class types end with _t Int_t
  3. Data members begin with f fTree
  4. Member functions begin with a capital Loop()
  5. Constants begin with k kInitialSize kRed
  6. Static variables begin with g gEnv
  7. Static data members begin with fg fgTokenClient

root help文件内容

Note1: Cint is not aimed to be a 100%% ANSI/ISO compliant C/C++ language
processor. It rather is a portable script language environment which
is close enough to the standard C++.

Note2: Regulary check either of /tmp /usr/tmp /temp /windows/temp directory
and remove temp-files which are accidentally left by cint.

Note3: Cint reads source file on-the-fly from the file system. Do not change
the active source during cint run. Use -C option or C1 command otherwise.

Note4: In source code trace mode, cint sometimes displays extra-characters.
This is harmless. Please ignore.

CINT/ROOT C/C++ interpreter interface.
All commands must be preceded by a . (dot), except
for the evaluation statement { } and the ?.
===========================================================================
> [file] : output redirection to [file]
2> [file] : error redirection to [file]
>& [file] : output&error redirection to [file]
? : help
help : help
/[keyword] : search keyword in help information
Shell: ![shell] : execute shell command
Source: v <[line]>: view source code
V [stack] : view source code in function call stack
t : show function call stack
f [file] : select file to debug
T : turn on/off trace mode for all source
J [stat] : Set warning level [0-5]
A [1|0] : allowing automatic variable on/off
trace : turn on trace mode for class
deltrace : turn off trace mode for class
Evaluation: p [expr] : evaluate expression (no declaration/loop/condition)
Evaluation: s [expr] : step into expression (no declaration/loop/condition)
Evaluation: S [expr] : step over expression (no declaration/loop/condition)
{[statements]} : evaluate statement (any kind)
x [file] : load [file] and execute function [file](wo extension)
X [file] : load [file] and execute function [file](wo extension)
E <[file]>: open editor and evaluate {statements} in the file
Load/Unload: L [file] : load [file]
La [file] : reload all files loaded after [file]
U [file] : unload [file]
C [1|0] : copy source to $TMPDIR (on/off)
undo : undo previous declarations
lang : local language (EUC,SJIS,EUROPEAN,UNKNOWN)
Monitor: g <[var]> : list global variable
l <[var]> : list local variable
proto <[scope]::>[func] : show function prototype
class <[name]> : show class definition (one level)
Class <[name]> : show class definition (all level)
typedef : show typedefs
function : show interpreted functions
macro : show macro functions
template : show templates
include : show include paths
file : show loaded files
where : show current file position
refcount : reference count control on/off
cover [file] : save trace coverage
return [val] : return undefined symbol value
Run: S : step over function/loop
s : step into function/loop
i : ignore and step over
c <[line]>: continue
e : step out from function
f [file] : select file to debug
b [line] : set break point
db [line] : delete break point
a [assert]:
break only if assertion is true
O [0~4] :
Set bytecode compiler mode

Quit:
q : quit cint
qqq :
quit cint - mandatory

save :
call emergency routine to save important data

Notes for learning root 06/04/2008

TH1F :
histograms with one float per channel. Maximum precision 7 digits

Quit root (just in case)
root[0]>.q

Display the browser
root[1]>TBrowser b;

C++ 在root中使用时,基本规则不变只是具体的写法有些区别
具体为
第一个字母大写,然后加上"_t"
例如:
int-->Int_t
double-->Double_t
char-->Char_t

which I think it is totally stupid , but anyway , I need to follow their
rules if I want to use it.

6/03/2008

安装 root 的注意事项--亲身体会

真是不容易
1 先下载root 的源文件。
我用的是这个:root_v5.19.04.source.tar.gz
2 解压缩
tar -xvzf root_v5.24.00.source.tar.gz
之后产生了root的文件夹
3 安装
安装路径
set ROOTSYS to the `root' directory:
sh family:
$ export ROOTSYS=
/home/flyriver/downloads/root
   3.1 $  ./configure --help
3.2 $ ./configure linux //for intel 32 bit machine
( ./configure linuxx8664gcc)// for amd 64 machine

3.3 if gcc is not installed
$sudo apt-get install build-essential,libX11-dev,libxft-dev,xorg-dev

3.4$ make [or, make -j2 for dual CPU machines]
3.5$ make install

4 此时只能在这个文件夹下的目录下运行,若想让root在所有文件夹
下都可以运行,或者你就把文件解压缩/usr/local/bin然后安装,
或者你需要编辑库文件,/etc/ld.so.conf,需要管理员帐号,将
root的lib位置告诉它,也就是添加一行,
include /etc/ld.so.conf.d/*.conf
/usr/lib/atlas
/usr/local/lib
/home/flyriver/downloads/root/lib //此行为后来添加
5 这里还没有完,需要编译ld.so.conf,然后更改才能生效。
具体为在管理员帐号下运行 ldconfig指令
root@luoyang:/home/flyriver# ldconfig

终于,在折腾了三天之后,将root安装在自己的电脑上了,爽!!!!!

*************************************************************
如果上面的方法不起作用,你所需要做的是,编辑
.profile
文件


# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
之后 , 添加
PATH=/home/gyuan/downloads/root/bin:$PATH
export PATH
结束后,log off 然后 login 即可

下面是更详细的
  1. To add that PATH to every user but root, add the line(s) to /etc/profile
  2. To add that PATH to root, add those line(s) to /root/.profile
  3. To add that PATH to a specific user(s), add the line(s) to /home/user/.profile





运行 root的 先行步骤

以下指令只能保证root 在这个文件夹下可以使用
flyriver@luoyang:~/downloads$ export ROOTSYS=/home/flyriver/downloads/root

flyriver@luoyang:~/downloads$ export PATH=$ROOTSYS/bin:$PATH

flyriver@luoyang:~/downloads$ export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH

英文信封的写法

Step1
To address an envelope, print the return address neatly in the upper left-hand corner of the envelope.
Step2
Begin by writing the sender's name and/or the company's name on the first line of the address.
Step3
Add the sender's street address (include Ave., St. or Blvd., as well as apartment, office or suite number) or post office (P.O.) box number on the second line.
Step4
Include mail-stop numbers, for mail distribution within a large company, where an apartment or suite number would appear on the second line.
Step5
Print the city name followed by a space, the two-letter capitalized state abbreviation and the ZIP code (five-digit or ZIP+4) on the third line.
Step6
Include the country name, if necessary, in capital letters on the fourth line of the address.
Step7
Print the mailing address (the destination address) in the center of the envelope or package, putting each element of the address in the same order as outlined in Steps 1 through 6 above.
Step8
Attach proper postage to the upper right-hand corner of the envelope, on the same side of the envelope as the destination address and return address.