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:

  1. Log in blackhole by my account same as SFU's
  2. sudo su sam (run this for getting permission, note!! input my SFU password)
  3. Go to Yann's directory (home)
  4. 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 taus = evt.getTaus()
...

Saturday, April 7, 2007

VJets: task status

  1. Has been installed packages needed. It seems working well.
  2. 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-.

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
The procedure as follows:

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.

Locations of visitors to this page