In linux, there is no professional acrobat avaible, which means that sometimes if you edit your pdf files, for example, merge, split pdf files, you may not have clue to do that. Lots of ppl in the net would recommend "pdftk" (pdf toolket) for you. I try to install, but some lib is needed. I have no time to install other dependent lib so I recalled I have a java tool: Multivalent. Just google it and find its page.
Usage:
java -classpath ~/Multivalent20060102.jar tool.pdf.Merge file1.pdf file2.pdf ...
That is it. You also can split your pdf file to separated ones. Of course, you need to download Multivalent20060102.jar from somewhere of the net. Yes, you can use "convert" to merge, but bad resolution and very slow, not recommended.
Friday, November 30, 2007
linux: how to merge/split pdf files
Wednesday, November 28, 2007
linux:how to download a whole site by wget
wget -r -p -np -k http://Your.Website.ToBeDownloaded.com
Tuesday, November 20, 2007
Linux: gaim: how to change lib of smiley
Go to the place where your gaim searches for:
/usr/share/pixmaps/gaim/smileys/default/
in my lap.
Edit the file: theme.
Sunday, September 30, 2007
emacs: how to delete a block of region
Mark (Ctrl+Space) the beginning of first line and move cursor to the the last line, and move it to the right n chars. Then do “Alt+x kill-rectangle” (Ctrl+x r k). This command can be used to delete any rectangular block of text, not just at the beginning of lines.
From: http://xahlee.org/emacs/emacs.html
Tuesday, September 25, 2007
Linux:command: vim
加密和解密
加密和解密文件
在命令模式输入“:X”命令,接着输入密码、确认输入密码,最后输入“:wq”命令保存退出。文件就已经被加密了。
经过上面方法加密后的文件变成密文文件。要阅读原来的明文,则在打开文件后,会提示用户输入密码。如果密码输入正确,就能看到原来的明文。另外可以看到,在最后的状态行上有此文件已被加密的提示。
取消加密
取消加密的方法很简单。在命令模式输入“:X”命令,首先会提示输入密码,这时直接敲回车键。接下来在提示重复输入密码时也直接敲回车键,最后输入“:wq”命令保存退出。这样文件的加密就被取消了。
注意,以上加密方法是运行在Red Hat Linux 9.0上的vim中。在其它平台可能略有差异,请以实际平台或版本的帮助为准。
From http://www.bitscn.com/linux/command/200604/6563.html
Linux:command: some useful text commands
uniq
(=unique-----唯一的)去掉已排序的文件中的重复行。例如:sort myfile | uniq
fold –w 30 –s my_file.txt > new_file.txt
用空格将文本文件 my_file.txt 中的每行截成30个字符,并输出到 new_file.txt.
fmt –w 75 my_file.txt > new_file.txt
格式化文件中的每行为75个字符。把超过75个字符的行截短,把少于75个字符的行补齐,但不会移去空行。
nl myfile > myfile_lines_numbered
给文件 myfile 的每行标上行号。把结果输出给文件 myfiles_lines_numbered。
indent –kr –i8 –ts8 –sob –l80 –ss –bs –psl “$@” *.c
通过插入或删除空格来改变“C”源码的外观。上面例子里格式的选项是和 Linux 内核的源码的风格是一至的(script /usr/src/linux/scripts/Lindent)。 看 man indent 来了解各个选项的意义。存在的文件先被备份然后就被格式化好的文件给替代了。
rev filename > filename1
打印文件 filename,每行字符以相反顺序显示。上面的例子里结果直接输入到文件 filename1。
shred filename
用垃圾字符重复并覆盖文件 filename 的内容,使任何人都无法再去阅读文件的内容。
paste file1 file2 > file3
按行把两个或多个文件合并,用
如果文件 file1 的内容是:
1
2
3
并且文件 file2 的是:
a
b
c
d
那么结果 file3 里的内容就该是:
1 a
2 b
3 c
d
join file1 file2 > file3
把两个文本文件里有相同域的行连成一行。Join 和数据库的“表连接”操作是类似的,但它只是对两个文本文件进行操作。默认的分界符是空格。如果你想用其它的操作符,你可用 man join 去查看里面的选项。
如果 file1 里的内容是:
1 Barbara
2 Peter
3 Stan
4 Marie
并且 file2 的是:
2 Dog
4 Car
7 Cat
那么结果 file3 就该是:
2 Peter Dog
4 Marie Car
des –e plain_file encrypted_file
(=”Data Encryption Standard” 数据加密标准)加密文件 plain_file。你会被要求输入一个键值用于加密算法使用。加密后的结果存放到文件“encrypted_file”。解密就用:
des –d encrypted_file decrypted_file.
gpg
“Gnu Privacy Guard-----GNU 的私人警卫”—一个和 PGP(“Pretty Good Privacy”)功能一样的免费软件。gpg 比 PGP 更安全并且没有使用有专利的算法。gpg 主要用于给你的 email 加签名并且检查其它信息的签名。你也可用它来给你的信息加密解密。http://www.gnupg.org/上有所有的详细信息,包括一个易读和详细的手册。
开始,我需要一对匙值:个人匙和公共匙。个人匙用于给我的信息签字。公共匙用于传给他人来确认我的信息的签名在他们收到我的信息后来确认我的信息的签 字。(某人还可用公共匙来给信息加密这样这个信息就只能通过我的个人匙加密并阅读)。我用下面的命令来生成这一对匙值:
from http://www.networkdictionary.cn/software/Linux75.php
Tuesday, September 18, 2007
Linux:command: use chown to change owner of a file or directory
The command chown is used to change the owner of a file/directory. For example:
chown -hR zhiyil:zhiyil /work
(change owner of /work to zhiyil and group is zhiyil either)
Sunday, August 26, 2007
Saturday, August 25, 2007
Linux:commands: how to kill jobs in background
If you have jobs running in background, you could kill them by the easier way than finding their PID and kill them. Just use the command jobs to find which job is running in background, and then pick up the job you want to kill, use kill %1 (here 1 is the job number)
Saturday, August 18, 2007
D0: code management link
This is a link to get started with D0 code management
Monday, August 13, 2007
Latex: a good link to description of commonly used Latex packages
Some commonly used LaTeX packages are described at this link (in Chinese), including the package how to create shadow effect of fonts.
Network: a problem about 'Connection reset by peer'
When I log in a remote computer by ssh from my home and if I keep it inactive for a while (for example, 10 mins), I often was kicked out with the message, for example:
=====================
Read from remote host jasper-clued0.fnal.gov: Connection reset by peer
====================
This happened probably because a firewall or other packet filtering device (such as your router) drops idle connections after a certain period of time.
------------------------------------------
A solution based on the ssh server side can be found here (Dugan provided me with this solution):
http://www.brandonhutchinson.com/OpenSSH_ClientAliveInterval.html
Simply speaking, the solution is add a line
ClientAliveInterval 300
in the file:
/etc/ssh/sshd_config
and reload the sshd server configuration with
/sbin/service sshd reload
--------------------------------------
Another solution based on client side provided by my colleage Horst at Fermilab is: to add
echo 300 > /proc/sys/net/ipv4/tcp_keepalive_time
into the file /etc/rc.local
Wednesday, August 8, 2007
latex: how to post text and graph on absolute position on one page
I copied the introduction from its home page http://nxg.me.uk/dist/textpos/ :
Textpos
Lay out text and graphics at arbitrary positions on the LaTeX page.
The textpos home page is at http://purl.org/nxg/dist/textpos
Version 1.7d, 2007 March 30.
This package facilitates placing boxes at absolute positions on the LaTeX page. There are several reasons why this might be useful, but the main one (or at least my motivating one) is to help produce a large-format conference poster. Other applications include placing material within, say, figures.
This package provides a single environment, which contains the text (or graphics, or table, or whatever) which is to be placed on the page, and which specifies where it is to be placed. The environment is accompanied by various configuration commands. See the manual (pdf).
Wednesday, July 25, 2007
Linux.shell.command: two usages of 'less'
As you know, 'less' is a very useful tool to view text files. Today I realize the two more functions new for me:
- You could use less to open more than one file in the buffer, just by ":p" or ":n" etc. to switch them
- If you have more than 1 key words to search, just use the way /wordone|wordtwo|wordmore and then enter, thus those 3 key words will be highlighted in the text body.
Friday, July 20, 2007
Linux:shell:grep how to use grep's result
mystr="IloveChina"
echo $mystr |grep China
echo $? #this will return 0
echo $mystr |grep USA
echo $? #this will return 1
#so you could use this returned value to justify if grep found the string.
# Or you use how many searched results returned to do this, for example,
echo $mystr |grep -c China # return 1 to you
echo $mystr |grep -c USA # return 0 to you
# so simply, you can use the number to justify if you found the results like
if [ `echo $mystr |grep -c China` -ge 1 ]; then
echo "Yes, you are"
fi
Saturday, June 23, 2007
Latex: how to use conditional compilation
If you want to use condition to control your texts, better to use \ifthenelse.
Usage in pre-docu:
\usepackage{ifthen}
\newboolean{yourBoolVar}
\setboolean{yourBoolVar}{boolval} % boolvar=true or false
Usage in main body:
\ifthenelse {\boolean{yourBoolVar}}
{if true, go this code} {if false, go this}
Thursday, June 21, 2007
Linux:compress: restrictions about zipped tar files
From the tar's user guide:
Notice also, that there are several restrictions on operations on compressed archives. First of all, compressed archives cannot be modified, i.e., you cannot update (--update (-u)) them or delete (--delete) members from them. Likewise, you cannot append another tar archive to a compressed archive using --append (-r)). Secondly, multi-volume archives cannot be compressed.
Linux:software: How to merge multiple pdf files into one
Use the command in Linux to merge some PDF files into one:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=firstANDsecond.pdf -dBATCH first.pdf second.pdf
Use it, you have two packages installed in your system
Link: Ghostscript download
Link: PDFtk download
Tuesday, June 5, 2007
Linux: alias: shell: define your alias in Linux
Except /etc/profile, ~/.bashrc and ~/.bash_profile, you can add alias into the file:
/etc/profile.d/alias.sh (or alias.csh for c shell)
This file is effective for all users like /etc/profile.
Monday, June 4, 2007
Software: root: tmva: how to install it...
TMVA is a Toolkit for Multivariate Data Analysis with ROOT.
web page: http://tmva.sourceforge.net/
After compiling and before running your code/macros, please make sure your lib is loaded!
Saturday, June 2, 2007
Software:programming: how to use auto-complete in xemacs
If you are programming, it will be very convenient to ask your editor to auto-complete words for you! Time-saving! In xemacs (I didn't try it in emacs), you could use shortcut: alt+/
Wednesday, May 30, 2007
Research:D0:cafe:top_cafe: topology variables in top_cafe package
We have lots of topological variables used: I have to remember them all :-(
00055 double TopTopologicalVariables::Centrality() const
00056 {
00057 return Ht()/H();
00058 } // Centrality()
00059
00061 double TopTopologicalVariables::Aplanarity() const
00062 {
00063 ensurePV();
00064 return 1.5 * (*_pv)[2]; // alternative syntax: ... * _pv->operator[](2)
00065 } // Aplanarity()
00066
00068 double TopTopologicalVariables::Sphericity() const
00069 {
00070 ensurePV();
00071 return 1.5 * ( (*_pv)[2] + (*_pv)[1] );
00072 } // Sphericity()
Monday, May 28, 2007
Research:WestGrid:Reprocessing: sam cannot find the name zhiyil
When I submit jobs (d0 data p20 reprocessing) to westgrid, once my keberos expired, I have to type my password again to re-create keberos certificate. However, even I type correct password, I was still given the following error: zhiyil cannot be found.
The solution should be:
kdestroy
and
remove the file /tmp/PROXY_zhiyil
But sometimes they are not working. Confused....
==============
Traceback (most recent call last):
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/bin/samg", line 179, in ?
sys.exit(main(sys.argv))
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/bin/samg", line 175, in main
command_function(arguments)
File "samg_submit.py", line 262, in samg_submit
File "samg_submit.py", line 133, in translate
File "samg_submit.py", line 157, in translateDoc
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/lib/jim_client/mergejob.py", line 862, in checkSemantic
samgjob.Doc.checkSemantic(self)
File "/home/parag/wspace/samgrid/V7/JIMSUITE/jim_client/lib/jim_client/samgjob.py", line 828, in checkSemantic
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/lib/jim_client/mergejob.py", line 887, in createAttribute
attr = Attribute.factory(token, self.context)
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/lib/jim_client/mergejob.py", line 515, in factory
newDefname,snapId=context.createDatasetfromDimension(tokenValue)
File "/export/D0_products/ups/prd/jim_client/NULL/v3_0_1/lib/jim_client/mergejob.py", line 326, in createDatasetfromDimension
sam_user = jim_client_util.getUserName()
File "/home/parag/wspace/samgrid/V7/JIMSUITE/jim_client/lib/jim_client/jim_client_util.py", line 177, in getUserName
File "sam_common_pylibSamCommand/BlessedCommandInterfacePlaceHolder.py", line 81, in __call__
File "sam_common_pylibSamCommand/CommandInterface.py", line 251, in __call__
File "sam_common_pylibSamCommand/SamCommandInterface.py", line 243, in apiWrapper
File "sam_user_pyapi/src/samUtility.py", line 317, in implementation
File "sam_common_pylibSamCorba/SamServerProxy.py", line 257, in _callRemoteMethod
File "sam_common_pylibSamCorba/SamServerProxyRetryHandler.py", line 266, in handleCall
SamException.SamExceptions.PersonNotFound: GridSubject with name '/DC=gov/DC=fnal/O=Fermilab/OU=People/CN=Zhiyi Liu/USERID=zhiyil' not found.
Saturday, May 26, 2007
Research:D0:caf_util: about processor EMJetMatching
The processor EMJetMatching doesn't throw any events away, basically, it just tries to loop all EM objects which may be in the cone with a jet. Here if EM and Jet are in the jet cone, then label this JET as EM, say, change flag isEM() true, if not, label isEM() as false. Why? Since we isEM() is set as reconstructing, so it may not be right.
The processor EMJetMatching is based on the class SelectUserObjects. The latter has documentation as below.
/**
* Select objects based on a user defined cut.
*
* The cut is supplied by the user by overriding the
* virtual selectObject(const T& obj) method.
*
* To use this class, inherit from it, passing the desired
* object type to the base class:
*
* class MySelector : public SelectUserObjects
*
* Then override the selectObject(const TMBJet& obj) method.
* The user can also override two more methods (which do nothing
* by default):
*
* void before(Collection
* void after(Collection
*
* Configuration options:
*
* - .From: OldBranchname [required]
* - .To: NewBranchName [required]
* - .RejectedBranch: NewBranchName for the rejected objects [default none]
* - .Tree: OutputTreeName[default: name()]
* - .Variables: Member variable list [default: all]
*
* - .LoadAll: Load whole object before it is copied [default: 1]
* You should probably never change this if you don't know exactly
* what you are doing.
*
* \ingroup cafe
*/
Monday, May 21, 2007
D0:software:network: my laptop is blocked
Fnal has a network policy, and my laptop is blocked since I open X window without certificates. The method to solve it is to import certificate to my browser. Follow the instruction on the given link. but I don't have kx509 installed. I cannot find any on network (since links are dead), so I find there is kx509 installed and copy it and its corresponding libs to my local laptop. and run the script get-cert.sh with -i, works.
Sunday, May 20, 2007
D0:MET: how to get access to right MET
In D0 framework, MET issue is very tricky. I am sick of how to get access to it and always spent lots of time on it. Here, I would try my best to clarify it:
- MET has several components: CH, JES, MU, Bad Jets. Based on your study, you could choose different configuration, usually, we use:
CH+JES+EM+MU
-However, for JES, we have corrJet, corrmuJet, smear_corrJet, smear_corrmuJET etc, here Jet is JCCA or JCCB. For MU, we have MU or CALOMU.
- But a point making things more complicated is: in JES, sometime we apply muon correction which may be counted later in MET, in order to avoid double contributions from muon correction, we should keep in mind it!!
Friday, May 18, 2007
英文标点符号翻译大全
+ plus 加号;正号
- minus 减号;负号
± plus or minus 正负号
× is multiplied by 乘号
÷ is divided by 除号
= is equal to 等于号
≠ is not equal to 不等于号
≡ is equivalent to 全等于号
≌ is equal to or approximately equal to 等于或约等于号
≈ is approximately equal to 约等于号
< is less than 小于号
> is more than 大于号
≮ is not less than 不小于号
≯ is not more than 不大于号
≤ is less than or equal to 小于或等于号
≥ is more than or equal to 大于或等于号
% per cent 百分之...
‰ per mill 千分之...
∞ infinity 无限大号
∝ varies as 与...成比例
√ (square) root 平方根
∵ since; because 因为
∴ hence 所以
∷ equals, as (proportion) 等于,成比例
∠ angle 角
⌒ semicircle 半圆
⊙ circle 圆
○ circumference 圆周
π pi 圆周率
△ triangle 三角形
⊥ perpendicular to 垂直于
∪ union of 并,合集
∩ intersection of 交,通集
∫ the integral of ...的积分
∑ (sigma) summation of 总和
° degree 度
′ minute 分
″ second 秒
℃ Celsius system 摄氏度
{ open brace, open curly 左花括号
} close brace, close curly 右花括号
( open parenthesis, open paren 左圆括号
) close parenthesis, close paren 右圆括号
() brakets/ parentheses 括号
[ open bracket 左方括号
] close bracket 右方括号
[] square brackets 方括号
. period, dot 句号,点
| vertical bar, vertical virgule 竖线
& ampersand, and, reference, ref 和,引用
* asterisk, multiply, star, pointer 星号,乘号,星,指针
/ slash, divide, oblique 斜线,斜杠,除号
// slash-slash, comment 双斜线,注释符
# pound 井号
\ backslash, sometimes
escape 反斜线转义符,有时表示转义符或续行符
~ tilde 波浪符
. full stop 句号
, comma 逗号
: colon 冒号
; semicolon 分号
? question mark 问号
! exclamation mark (英式英语) exclamation point (美式英语)
' apostrophe 撇号
- hyphen 连字号
-- dash 破折号
... dots/ ellipsis 省略号
" single quotation marks 单引号
"" double quotation marks 双引号
‖ parallel 双线号
& ampersand = and
~ swung dash 代字号
§ section; division 分节号
→ arrow 箭号;参见号
Saturday, May 12, 2007
Linux: installation: how to solve the problem: autochk program not found-------skipping autochk
Today I help my girlfriend to install the 2nd operating system since she is always bothered by virus under Windows xp. So I decide to help her to install Mandriva 2007 which is the easy-going distribution in the Linux world for a beginner. I ever installed double systems many times and have some ideas how to avoid tricky things like problems caused by partitions.
Now I will briefly describe the entire steps for other people's reference. First, in windows, I learned partitions by PartitionMagic and try to release a space for Linux installation. This is pretty simple, but I would strongly recommend to backup the table before you may do unrecovered and dangerous things. Okay, thus a space has been built for Linux with the format ex3. And then restart. Insert Mandriva DVD installtion disk to start install as usual. Make sure to pay more attention on partition part! You could use existing partition which just was released from Windows by PartitionMargic or you use 'custom mode' (note: even use this mode, you have to build a free space before doing that since Linux can destroy your data). Okay, thus we have a new system! But a tricky problem is comming as transfering to Windows! The problem is: when I try to start Windows XP, after flashing Windows startup bar, I was given a blue screen with words: program autochk.exe not found ===== skipping authochk and then restart to new loop. Calm down and try to search internet for useful stuff. This can be solved. At last, I think I find the answer. The source is from the partition of Windows has been hidden. What you do is just to unhidden it! The method here is a bit different from the useful message below (I got the basic idea from it).
1. In the terminal of Linux, type as a rooter:
fdisk -l /dev/hda
(thus you are given a partition table, you should see the windows partition as hidden, please copy the table for backup in case of making mistakes), then run:
fdisk /dev/hda
type t to enter a mode to change ID from 17 to 7. Then done! I don't have too much time to write it down. Please refer to Chinese version from other body.
=============================================
WinXP下安装Linux9.0实战
摘自 精彩奇讯 开化党 2005-04-28 13:07
http://www.sun126.com/bbs/ccb/index.cgi
暑 假正是我们这些计算机迷学习实战经验的最好时机,所以我选择了一只想要学习的RedHatLinux9.0作为这个暑假的学习重点。但是在安装Linux 的过程中,我先后遇到了很多棘手的问题,我翻阅了一些相关书籍,上网查找资料,经过了一整天的努力,终于实现了WinXP和Linux的双系统。而且最重 要的是,对以前的WinXP系统没有什么影响。现在,我就将我安装过程中总结出来的经验分享给大家。
我的硬盘是 40G的,分为CDEF四个分区,WinXP就安装在C盘里面。我的D盘为8G,正好可以安装Linux。于是我将D盘的资料移动到F盘里面,并用分区工 具PartitionMagic8.0把D盘改成主分区。由于Linux需要一个相当于内存的两倍大小的swap分区,而且越*近硬盘前面的主面就越好, 因此我用分区工具在刚才删除掉的D盘的空闲空间的前面部分分出一个256M的LinuxSwap分区(因为我的内存为128M)。然后将剩余的空闲空间格 式化成Linux可以用的ext3文件系统。这样,分区准备工作就完成了。
接着,我就开始用 RedHatLinux9.0的安装盘安装Linux,在分区的时候,选择手动分区,这是只要将以前分好的ext3挂在"/"目录就可以继续安装了。安装 的时候要记住管理员的密码,特别注意的是管理员的账号是root,而不是我们平常Windows里面的Administrator或者Admin。至于多 系统引导,我采用的是简单的GRUB。由于Linux9.0采用了简体中文图形安装界面,安装过程还是比较简单的。
安装 完以后就能顺利进入Linux操作系统了。但是,这时候我发现位于硬盘第一个分区(hda1)的WinXP不能启动了,启动过程中会出现autochk program not found-------skipping autochk的字样,然后就自动重启,而且总是重复这样的现象,就连安全模式都进不去。
在查阅相关资料以后,发现应该 是第一个分区被隐藏掉了(Hidden)。于是,我用root账户进入了Linux,修改/boot/grub目录里面的grub.conf文件,在 Title WindowsXP下面加上了一句Unhide (hd0,0)。可是重新启动以后还是出现不能启动的问题。在经过多次尝试后,我打算换一种方法。
于是我想到了 Linux安装盘中的救援模式(Linux Rescue Mode),我把第一张安装盘放到光驱里面,从光盘启动,键入linux rescue后回车,进入了救援模式。用fdisk -l /dev/hda命令发现hda1的System为(Hidden)HPFS/NTFS,只要把这个改成HPFS/NTFS就可以了。用fdisk /dev/hda命令开启fdisk模式。用t命令选择hda1后输入7然后回车(7在这里就是代表的HPFS/NTFS,而以前的(Hidden) HPFS/NTFS的ID为17)。紧接着,输入w保存当前硬盘分区信息,再输入exit就可以退出救援模式了。同时,系统也重新启动(记得这时候将安装 盘拿出来,或者在Bios设置里面把第一项Boot改为硬盘启动)。而且我已经能够进入WinXP了。
可是,我发现这时候的WinXP只有4种颜色,而且在桌面设置里面只有800*600一种分辨率,不过,这只是小问题,只要将显卡的驱动程序重新安装一遍就可以了。
至此,可以说是大功告成,在没有影响到以前的WinXP的情况下,我安装上了Linux操作系统。希望我的这些经验能够给将要安装学习Linux的朋友们一些帮助。也希望有越来越多的人加入到学习Linux的行列中来。
Monday, May 7, 2007
Linux:ssh: how to use ssh command remotely
Usually, when you want to run a command on a remote computer, you have to log in first. If you have ssh, you can use remote-command way:
ssh your.remote.computer.com yourCommandHere
For example,
ssh smart.phys.sfu.ca date
Friday, May 4, 2007
Research:D0:Triggers: how to get report of certain triggers or trigger list
Now D0 users don't need so-called authentication to get trigger report. The basic approach is
- visit D0 work page: http://www-d0.fnal.gov/atwork/index.html
- Click TriggerMeister
- Click Trigger Database
Friday, April 27, 2007
ROOT: how to change palette color
root [2] gStyle->SetPalette(1)
root [3] eqcd->Draw("mucalmet:metsig", "Nisotrk!=0","colz")
Tuesday, April 24, 2007
Linux:shell: how to exchange case of letters
If you wanna exchange between the upper case of one string and the lower case, you could use the command
echo "ThisIsAnExample" | tr 'a-z' 'A-Z'
and
echo "ThisIsAnExample" | tr 'A-Z' 'a-z'
Saturday, April 21, 2007
Emacs: how to indent and automatically complete
- indent: first select the region what you want to apply indenting (if selecting all, use C-x h). and then use C-M-\ to indent
- complete auto: M-/ , this is very useful.
Friday, April 20, 2007
Latex: how to comment out lines in emacs
If you are editing a latex file by using emacs, then how to comment out lines and uncomment out lines? As you know, commenting out is just add '%' before the lines and uncommenting is remove '%' before the lines.
People said:
It is often necessary to comment out temporarily a region of TeX or LaTeX code. This can be done with the commands C-c ; and C-c %. C-c ; will comment out all lines in the current region, while C-c % will comment out the current paragraph. To uncomment, simply type C-u - C-c ; to uncomment all lines in the region, or C-u - C-c % uncomment all comment lines around point.
But I find an easier way: just use C-c ; to switch. For example, you have 3 lines without '%', then use C-c ; to add '%', then to uncomment, just use C-c ; again! Remember, before using the keys, to mark your region which you wanna (un)comment.
Linux: gaim and QQ
Gaim 2.0.0beta6 in linux starts to support QQ. So we could use it to connect with our friends by QQ. :-)
http://www.pidgin.im/
Linux: how to show Chinese charactors using gedit
'gedit' is an editor in Linux. It has been internationalized and is an excellent software. In order to show or type Chinese by it, need to select some Chinese codings like GB Hz, GB 2312 ect. First, you open a blank file, when you save it, you will be asked that what kind of coding you wanna use, please pick any one of Chinese code. Do NOT use 'AutoDect', sometimes it is not working.
Wednesday, April 18, 2007
Research: remove merged files on Westgrid
Once files produced on Westgrid have been merged, should remember to remove for keeping durable space light. To do this:
- Log in blackhole by my account same as SFU's
- sudo su sam (run this for getting permission, note!! input my SFU password)
- Go to Yann's directory (home)
- Run the clean script.
Tuesday, April 17, 2007
Linux:exmacs: diff or compare
Move around | Toggle features | Manipulate
=====================|===========================|=============================
p,DEL -previous diff | | -vert/horiz split |a/b -copy A/B's region to B/A
n,SPC -next diff | h -hilighting | rx -restore buf X's old diff
j -jump to diff | @ -auto-refinement | * -refine current region
gx -goto X's point| | ! -update diff regions
C-l -recenter | ## -ignore whitespace |
v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X
-scroll lt/rt | X -read-only in buf X | wd -save diff output
~ -swap variants | m -wide display |
=====================|===========================|=============================
R -show registry | = -compare regions | M -show session group
D -diff output | E -browse Ediff manual| G -send bug report
i -status info | ? -help off | z/q -suspend/quit
-------------------------------------------------------------------------------
For help on a specific command: Click Button 2 over it; or
Put the cursor over it and type RET.
Linux: chinese input method
My laptop has this method available, however, since the reason I mentioned in the last entry (notification area is not set on the panel), I cannot find it.
Here I am not gonna talk how to install it. Just say how to use it: open one program, right-click, find an entry 'Input method' and being ready to input.
After installing scim, make sure add the following lines into the file '~/.xinitrc'
scim -d
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE="scim"
export QT_IM_MODULE=scim
so that you don't need other settings.
Linux: notification area
I am using Mandriva 2007. Since I installed that, I could not find icons that I launched every time. For example, I start "scim" (Smart Chinese Input Method), no any icon shows up. Also, 'network appel', it is always there (been started) but I don't know where it is (open its window). They are started, but because I didn't put a 'notification area' on the panel, they are not seen!! Today I suddenly realized that! And more icons running are over there such as 'network', 'power management', ...
Thursday, April 12, 2007
Linux: ssh welcome text
Add your SSH welcome information to the file /etc/motd.
Fun: image to ascii codes
Here a list of available sites/softwares providing convertion from image to ascii.
http://dmoz.org/Arts/Visual_Arts/ASCII_Art/Software/
and a good one:
http://ascii.mastervb.net/
Tuesday, April 10, 2007
Research:Cafe: use cafe in interactive mode
Long time not to use cafe interactive mode. Now to remind lines:
cafe::Event evt;
TTree * tree= TMBTree;
evt.setBranchAddresses(tree);
tree->LoadTree(10);
cafe::Collection
...
Saturday, April 7, 2007
VJets: task status
- Has been installed packages needed. It seems working well.
- Get email from Marc-Andre, should start to generate root nutples
Thursday, April 5, 2007
ROOT: how to set your style as starting root
Edit the file: ~/.rootrc and add one line like:Rint.Logon: YourLogonFile.C
YourLogonFile.C can be anywhere.
By the way, if you want to know what the default settings are as starting root, just log in root to type:gEnv->Print()
Here you go ...
Programming: Emacs: delete a line
Delete a line in emacs: M-0 C-k (backward) and C-k (forward). M-0 is Alt plus zero, C- is Ctrl-.
Wednesday, April 4, 2007
Research: how to get luminosity
http://www-d0.fnal.gov/computing/data_quality/d0_private/forusers.html
and
https://plone4.fnal.gov/P1/D0Wiki/physics/top/howto-lumi?portal_status_message=Welcome%21+You+are+now+logged+in.
(in D0wiki) and
http://www-d0.fnal.gov/d0dist/dist/packages/lm_tools/devel/doc/
(lm_tools getLuminosity)
Tuesday, April 3, 2007
D0: configure file
Old version of caf has a bad feature that it cannot remove space after a string in configure files. It will be bad when the line end is file name or string-like configure. So use the script to check:
./top_cafe/scripts/check_configs.sh
Monday, April 2, 2007
Linux: how to password-less ssh
If you log in some severs by ssh frequently, you may not like to input your password every time, why not set up password-less ssh? Okay, let me to classify some words:
- client: the computer where you are right now.
- server: the computer into which you like to log
1. Key pair generation on client.
ssh-keygen -t rsa
(don't input any passphrase when you are required to input)
Thus you get two files under ~/.ssh (private key file: id_rsa and the public key: id_rsa.pub)
2.Copy the public key file to server (under the directory: ~/.ssh) and append it to the file authorized_keys. For secruity, do
chmod 600 authorized_keys
3.Okay.
More detailed and accurate descriptions are available here.
Research: how to get files from sam
Look here for info how to get files from sam:
http://www-d0.fnal.gov/Run2Physics/wz/docs/howto/get_file_from_sam.txt
Linux: how to check version of linux
You have two ways:
1. uname -a
2. cat /proc/version
The 1st one tells you kernel version while the 2nd one tells you distribution version.
Sunday, April 1, 2007
SHELL: add head to a bash script
Every time when you write shell script, it is sick to type the same head on every script? If you are, try this small script to add head to your code.
#!/bin/sh
help(){
echo "Usage: "
echo " `basename $0`
echo " `basename $0` -h "
exit 1
}
if [ $# -lt 1 ] || [[ $1 = -h ]]
then
help
fi
echo " "
echo "Input the title of your code:"
read line
newline[0]='#!/bin/sh'
newline[1]="#######################################"
newline[2]="# $1"
newline[3]="# $line"
newline[4]="# "
newline[5]="# Created by Your name (you@email.com)"
newline[6]="# on `date`"
newline[7]='# Usage: '
newline[8]='# '
newline[9]='# Modifications: '
newline[10]='# '
newline[11]='#######################################'
newline[12]=' '
newline[13]='help() {'
newline[14]=' echo ""'
newline[15]=' echo "Usage: $0 <>"'
newline[16]=' echo " <>"'
newline[17]=' echo " -h or no-args for this help info."'
newline[18]=' echo ""'
newline[19]='}'
newline[20]='if [[ $1 == "-h" ]] || [ $# -lt 1 ]'
newline[21]=' then'
newline[22]=' help'
newline[23]=' exit 0'
newline[24]='fi'
#this total value must be equal to the last index!!!
total=24
index=0
while [ $index -le $total ]
do
((iline=index+1))
sed -i "${iline}i\\${newline[$index]}" $1
((index+=1))
done
SHELL: a very good e-reference about bash
An excellent reference about bash is here. It descripts bash in a very detail. I have some small bash scripts. Later I will post them here for sharing.
Thursday, March 29, 2007
Software: alternative for visio
Under linux, you could use several drawing softwares to draw like: dia, kivio etc. A useful site for os alternative stuff is here.
Tuesday, March 27, 2007
ROOT: THStack
Using the class THStack in root, you also use the option not to stack histograms on your canvas.
hs->Draw("nostack"); //no stack
Sunday, March 25, 2007
Research: how to download references out of SFU
Happenedly I need to download references out of SFU campus. One right way I have to follow is: find the jounal where destination reference is from on SFU library web page; connect the web page of the journal by SFU link; go to the place to find your journal. This is pretty easy when you are sitting your office on campus since all offices have unlimited access to those journal web pages. If you are home, you have to follow the rountine above. One easy way I just found is: if the linke of your reference is: http://prola.aps.org/abstract/PRB/v15/i2/p964_1
without SFU access permission. What you can do is change the link above to:
http://prola.aps.org.proxy.lib.sfu.ca/abstract/PRB/v15/i2/p964_1
Note: I add a new part ".proxy.lib.sfu.ca" in red. Thus you could input your SFU account and password to download the reference if SFU library bought this journal.
Thursday, March 22, 2007
Research: an useful reference
Click here for an useful online lecture of Statistical Thermodynamics of Materials
Wednesday, March 21, 2007
ROOT: how to use Scan
In ROOT (http:root.cern.ch), if you wanna to open remote root file and browse its structure or data, it is very slow if using tree->Draw() method. So, you could use tree->Scan() to browse data:
For example:
tree->Scan("a:b:c","","colsize=30 precision=3 col=::20.10:#x:5ld");
Will print 3 columns, the first 2 columns will be 30 characters long,
the third columns will be 20 characters long. The printing format used
for the columns (assuming they are numbers) will be respectively:
%30.3g %30.3g %20.10g %#x %5ld
Software: group by thread
In evolution (an email client software in linux), you could use ctrl+T to group your email by thread. Sometimes you cannot find email in order of receiving time, try to close this grouping.
Latex: How to use Bibtex in latex
Bibtex is a good choice when you have lots of references needed to be cited in different publications. You could build a base using bibtex and cite it in LaTeX.
In the *.tex file,
\nocite{*} %this means that listing all items in the bib file even though you didn't cite them.