My Log (天道酬勤)

Thu, 27 Sep 2007

Recently, I found Google Notebook is very easy to use. So I decided to switch to Google Notebook to record my tips and notes...

Fri, 31 Aug 2007

If you are getting a blank (grey) window with some java applications under Beryl, just add the following line to your /etc/profile.

export AWT_TOOLKIT="MToolkit"

Thu, 30 Aug 2007

This is a working method. Still, one thing need to be mention:

Latest Beryl updates (0.2.1.) doesn't work anymore (use beryl —version to check).

In synaptic, do a Search for -> "beryl" and set all beryl packages back to 0.2.0 by selecting each package and going to Package -> Force Version and select 0.2.0 to downgrade them. After downgrading them you should lock the versions by selecting each package and going to Packages -> Lock Version.

EDIT: If there isn't a previous version that means that the universe repo is not holding the 0.2.0 version so you will have to temporarily disable the universe repo and add a 3rd party beryl repo to install 0.2.0.

Wed, 29 Aug 2007

;; 在shell-mode下ls显示的乱码, 那些乱码应该是用来控制颜色的,请问如何设
;; 置既能在emacs中显示颜色,又能在终端使ls显示颜色.
(ansi-color-for-comint-mode-on)

Tue, 28 Aug 2007

For some reason, I have to "sudo run iwpriv ath0 mode 2" to get this wireless card work. To avoid run this command each time when I start ubuntu, do these:

1. vi ~/ath0up

#!/bin/bash
iwpriv ath0 mode 2

2.

chmod +x ~/ath0up

sudo su
cp ~/ath0up /etc/init.d/

. register the script to be started at boot with:
update-rc.d ath0up defaults

. unregister the script with:
update-rc.d -f ath0up remove

1. On local machine

mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key ("your_local_home"/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
...
...
...
...

2. Setting public key to the remote machine

scp ~/.ssh/id_rsa.pub zma@foo.cis.jhu.edu:.ssh/
ssh zma@foo.cis.jhu.edu
% chmod 700 .ssh
cat id_rsa.pub >> .ssh/authorized_keys
chmod 644 .ssh/authorized_keys

3. logout and login again :-)

modprobe ibm_acpi experimental=1
cat /proc/acpi/ibm/fan

That last command should display the current status and speed of your fan, provided ibm_acpi was loaded successfully and it has fan control support. From here to set the fan speed manually you can do the following (as root) (you can set the fan speed from 0 to 7) Code:

echo level 7 > /proc/acpi/ibm/fan

to set it back to auto just use:

echo level auto > /proc/acpi/ibm/fan

Here is a description of gnuserv:

gnuserv allows you to attach to an already running Emacs. This allows external programs to make use of Emacs' editing capabilities. It is like GNU Emacs' emacsserver/server.el, but has many more features.

To install gnuserv in ubuntu 7.04

1. Go to here to download the deb file, then install it (Note: it looks like emacs21 is one of its dependency).

2. cp -r /usr/share/emacs/site-lisp/gnuserv /home/zma/.emacs.d/site-lisp/

3. Add the following into .emacs

(add-to-list 'load-path "~/.emacs.d/site-lisp/gnuserv")

(autoload (quote gnuserv-start) "gnuserv-compat"
    "Allow this Emacs process to be a server for client processes.
This starts a gnuserv communications subprocess through which
client \"editors\" (gnuclient and gnudoit) can send editing commands to
this Emacs job.  See the gnuserv(1) manual page for more details.

Prefix arg means just kill any existing server communications subprocess."

    t nil)

(set-variable 'gnuserv-program "/usr/bin/gnuserv")

;; start server
;; (server-start)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))
(add-hook 'server-switch-hook 'raise-frame)

Sun, 26 Aug 2007

我是用 unison 来同步 ubuntu 里 windows 分区上的文件和服务器的文件的,但 是 windows 分区上的文件在 ubuntu 中的权限是 useless 的,而且不能更改。 因为 unison 不能更改 local 文件(夹)的权限,所以每次同步都 failed。To avoid this problem, just put the following into .prf file.

# Turn off permission and resource handling
perms = 0

Sat, 25 Aug 2007

Put following into ~/.xmodmap

remove Lock = Caps_Lock
remove Shift = Shift_R
keysym Shift_R = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
add Shift = Shift_R

Restart X, if still does not work, then put the following into ~/.bashrc

xmodmap ~/.xmodmap

Sun, 12 Aug 2007

Control Panel -> Fonts -> Files -> Install New Font

Create a new .bat file with the following content:

@echo off
start D:\HOME\bin\PuTTY\putty.exe -load CIS -pw "yourpasswd"

Thu, 09 Aug 2007

Wed, 08 Aug 2007

1. List all available printer

$ lpstat -a [RET]

2. To set default printer, put the following into ~/.bashrc

# set default printer
PRINTER=clrk320-hp4600; export PRINTER

3. To print to the default printer, use

$ lpr filename [RET]

To print to other printers, say clrk320-dplx-hp4600, use

$ lpr -Pclrk320-dplx-hp4600 filename [RET]

4. Some UNIX/Liunx commands about printing

. To view the spool queue for all/default/particular printer
  $ lpq -a [RET]
  $ lpq [RET]
  $ lpq -Pprinter_name [RET]

. To list the print jobs for user zma
  $ lpq zma [RET]

. To cancel job,
  $ lprm -Pprinter_name job_code (the job_code is in the status list)
  $ lprm - [RET] (cancel all of your print jobs)

. To see the default printer,
  $ lpstat -d

. To print 2 copies
  $ lpr -#2 filename [RET]

5. Customizing Your Printouts

The lpr command is a no-frills way to print your files. It doesn't do any fancy formatting; it just dumps your file on the printer. If you'd like to format your printout (paginate, add a title, set margins, or control the page length), you can use the pr command in conjunction with lpr. By default, pr will add page numbers and a title consisting of the file's name and the date and time it was last modified. But you can do lots of other fancy formatting as well. Here are some of the options that pr supports:

-d              Double-space the printout.
-h <my title>   Specify a title for the page header (the default is the file name).
-Ln             Set the page length to n lines (the default is 66).
-On             Set the margin to n characters (the default is 8).
-T              Suppress the page header.

Typically, the output from pr is sent only to your printer (by piping the output to lpr, as shown in the following examples), but if you leave off the lpr step, you'll see the output on the screen instead. Here are some examples using the pr command to print a file named panda97.txt—for example, with no options specified, just adding page numbers and the default title (file name and date):

$ pr panda97.txt | lpr

Here we've specified a more meaningful title for the printout:

$ pr -h "Financial Report" panda97.dat | lpr

And now we've set the page length to 55 lines, set the margin to 5 spaces, and added double-spacing:

$ pr -h "Financial Report" -l55 -o5 -d panda97.dat | lpr

6. Emacs printing in Linux

M-x print-buffer [RET]
    print the current buffer with page numbers and headers

M-x lpr-buffer [RET]
    print the current buffer with no additional print formatting done to the text

To print in PostScript form

M-x ps-print-buffer
M-x ps-print-region

M-x ps-print-buffer-with-faces
M-x ps-print-region-with-faces
    color printing, have problem when using color-theme with dark background

M-x ps-spool-buffer
M-x ps-spool-region
M-x ps-spool-buffer-with-faces
M-x ps-spool-region-with-faces
    Not printing, but generate PostScript file in a buffer named *PostScript*

Tue, 07 Aug 2007

scp is used when copy files from/to sever. The command for copying a.txt to home directory on server is

 scp a.txt zma@foo.cis.jhu.edu:.

The annoying part is you have to input zma@foo.cis.jhu.edu every time. To avoid this, add the following into ~/.ssh/config (if using cygwin, it's /home/zma/.ssh/config)

Host cis
HostName foo.cis.jhu.edu
User zma
ForwardAgent yes

Host ams
HostName jesse.ams.jhu.edu
User ma
ForwardAgent yes

Now, the above command becomes

scp a.txt cis:.

Similarly, now one can use

ssh cis

Isn't cool? :-) For more information, see man ssh_config

Starting vi:

Command             Description
vi file             start at line 1 of file
vi +n file          start at line n of file
vi + file           start at last line of file
vi -r file          recover file after a system crash

Saving files and quitting vi

Command             Description
:e file             edit file (save current file with :w first)
:w                  save (write out) the file being edited
:w file             save as file
:w! file            save as an existing file
:q                  quit vi
:wq                 save the file and quit vi
:x                  save the file if it has changed and quit vi
:q!                 quit vi without saving changes

Moving the cursor:

Keys pressed        Effect
h                   left one character
l or <Space>        right one character
k                   up one line
j or <Enter>        down one line
b                   left one word
w                   right one word
(                   start of sentence
)                   end of sentence
{                   start of paragraph
}                   end of paragraph
1G                  top of file
nG                  line n
G                   end of file
<Ctrl>W             first character of insertion
<Ctrl>U             up 1/2 screen
<Ctrl>D             down 1/2 screen
<Ctrl>B             up one screen
<Ctrl>F             down one screen

Inserting text:

Keys pressed        Text inserted
a                   after the cursor
A                   after last character on the line
i                   before the cursor
I                   before first character on the line
o                   open line below current line
O                   open line above current line

Changing and replacing text:

Keys pressed        Text changed or replaced
cw                  word
3cw                 three words
cc                  current line
5cc                 five lines
r                   current character only
R                   current character and those to its right
s                   current character
S                   current line
~                   switch between lowercase and uppercase

Deleting text:

Keys pressed        Text deleted
x                   character under cursor
12x                 12 characters
X                   character to left of cursor
dw                  word
3dw                 three words
d0                  to beginning of line
d$                  to end of line
dd                  current line
5dd                 five lines
d{                  to beginning of paragraph
d}                  to end of paragraph
:1,. d              to beginning of file
:.,$ d              to end of file
:1,$ d              whole file

Searching for text:

Search              Finds
/and                next occurrence of ``and'', for example, ``and'', ``stand'', ``grand''
?and                previous occurrence of ``and''
/^The               next line that starts with ``The'', for example, ``The'', ``Then'', ``There''
/^The\>             next line that starts with the word ``The''
/end$               next line that ends with ``end''
/[bB]ox             next occurrence of ``box'' or ``Box''
n                   repeat the most recent search, in the same direction
N                   repeat the most recent search, in the opposite direction

Searching for and replacing text:

Command                   Description
:s/pear/peach/g           replace all occurrences of ``pear'' with ``peach'' on current line
:/orange/s//lemon/g       change all occurrences of ``orange'' into ``lemon'' on next line containing ``orange''
:.,$/\<file/directory/g   replace all words starting with ``file'' by ``directory'' on every line from current
                          line onward, for example, ``filename'' becomes ``directoryname''
:g/one/s//1/g             replace every occurrence of ``one'' with 1, for example, ``oneself'' becomes ``1self'',
                          ``someone'' becomes ``some1''

Matching patterns of text:

Expression          Matches
.                   any single character
*                   zero or more of the previous expression
.*                  zero or more arbitrary characters
\<                  beginning of a word
\>                  end of a word
\                   quote a special character
\*                  the character ``*''
^                   beginning of a line
$                   end of a line
[set]               one character from a set of characters
[XYZ]               one of the characters ``X'', ``Y'', or ``Z''

Mon, 06 Aug 2007

1. ~/.screenrc - screen configuration

hardstatus alwayslastline
hardstatus string '%{= bG}[ %{G}%H %{g}][%= %{= bw}%?%-Lw%?%{r}(%{W}%n
*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{W}%d %M %{W}%c %{g}]' # oneline
escape `` # change ctrl-a to `
vbell off # turn off visual bell

To configure hardstatus string, look "STRING ESCAPES" session in screen manpage. Currently, the first two lines are disabled.

2. Commands

Command	      Effect
screen -S     When creating a new session, specify a meaningful name
screen -x     Attach to a not detached screen session (Multi display mode)
C-a "         Show list of terminals managed by Screen
Esc           Close the list window
C-a c         Create a new terminal window
C-a K         Kill current terminal window
C-a p         Return to the previous
C-a S         Split the term vertically into two regions
C-a X         Kill the current region
C-a <Tab>     Focus the newly created region
C-a -         Resize this region and make it 3 lines smaller
C-a 1         Show the first window in this region
C-a d         Detach the Screen session
C-a A         Set window title
C-a x         Lock session
C-a [         Enter scrollback/copy mode (h j k l to move cursor, space to set mark)
C-a Esc       Same with C-a [
C-a ]         Paste buffer
C-a ?         Show key bindings/command names

3. lscreen

Save the following in ~/bin/lscreen, and run "chmod 755 lscreen"

#!/bin/bash

# filters the screen -ls output to show the sesssions
sessions=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p'`
res=`echo "$sessions" | wc -w`

if [[ "$res" == "0" ]]
then
        echo "  No existing SCREEN session to reattach to..."
        exit
fi

echo ''
echo "  CURRENT SESSIONS"
echo "  ------------------------"
#screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p' | cat -n
echo "$sessions" | cat -n
echo "  ------------------------"
echo ''

#prompt for the session to join
echo -n "  Reattach to session: "
read session


#attach to specified session
linenum=0
name=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p' |
while read line
do
 let "linenum += 1"
 if [[ "$linenum" -eq "$session" ]]
 then
        echo $line
        break
 fi
done`

if [[ "$name" != "" ]]
then
   screen -d -r "$name"
else
   echo "  Could not reattach to '$session'"
fi

References: Screen: Tips & Tricks, TIP Using screen, and Screen power tips.

;; disable menubar and format mode-line and header-line
(menu-bar-mode -1)

(setq default-mode-line-format
       (list "-"
        'mode-line-mule-info
        'mode-line-modified
        ;; 'mode-line-frame-identification
        "   "
        '(-3 "%p")
        '(line-number-mode " (%l, %c)")
        "   %[("
        '(:eval (mode-line-mode-name))
        'mode-line-process
        'minor-mode-alist
        "%n"
        ")%]--"
        'global-mode-string
        "-%-"))

(setq default-header-line-format
      (list
       " %b   "
       '(:eval (substring
                (system-name) 0 (string-match "\\..+" (system-name))))
       ":"
       'default-directory
       )
      )

Sun, 05 Aug 2007

(define-key ctl-x-map "2" 'split-window-vertically)
(define-key ctl-x-map "3" 'split-window-horizontally)
(define-key ctl-x-map "}" 'enlarge-window-horizontally)
(define-key ctl-x-map "{" 'shrink-window-horizontally)
(define-key ctl-x-map "-" 'shrink-window-if-larger-than-buffer)
(define-key ctl-x-map "+" 'balance-windows)
(define-key ctl-x-4-map "0" 'kill-buffer-and-window)

Fri, 03 Aug 2007

Open C:\cygwin\usr\X11R6\bin\startxwin.bat and comment on this line

REM %RUN% xterm -e /usr/bin/bash -l

This package enables incremental-searching on minibuffer history.

Put this code into your .emacs:

(require 'minibuf-isearch)

C-r in the minibuffer starts minibuf-isearch-mode minor mode. In this mode, you can type:

Non-control characters: to incremental-search. The matched part is highlighted.

C-r: to search backward the word you typed.

C-s: to search forward.

C-h, DEL, BS: to delete the last type and search again.

C-g: to abort isearching. The initial content of the minibuffer is restored.

C-m, C-j, RET, etc.: to exit this minor mode.

Thu, 02 Aug 2007

\parindent=0in

\hangindent=0.7cm detail

The default itemize in LaTeX have large spaces between lines, to solve this problem use the following

\newenvironment{packed_itemize}{
\begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}

Wed, 01 Aug 2007

To get accents, precede the character with the accent by an escape quote of the appropriate kind (left, right, or double). For example,

\'a -> á

\"a -> ä

\`a -> à

\^a -> â

There are two configuration files. They are:

C:\CTeX\texmf\miktex\config\miktex.ini

C:\CTeX\localtexmf\miktex\config\miktex.ini

But the first one can be overwritten by the MiKTeX Update Wizard. Hence we will modify the second one to add new search path.

[TeX]
;; Editor=winedt "[Open('%f');SelPar(%l,7)]"
Editor=emacs +%l "%f"

;; adding more in search path
[BibTeX]
Input Dirs+=;D:\HOME\research\references//
[LaTeX]
Input Dirs+=;D:\HOME\.TeX\//
[pdfLaTeX]
Input Dirs+=;D:\HOME\.TeX\//

To test whether an input file can be found via the configured search path, input findtexmf zma.bib in cmd. If the search succeeds, then initexmf reports absolute path to the file, as in:

> findtexmf zma.bib
D:\HOME\research\references\zma.bib

Note: Settings specified in the local configuration file (the second one) take precedence over those specified in the main configuration file (the first one).

Mon, 30 Jul 2007

export PS1="\n\u@\H:\w\n$ "

\n  newline
\u  the username of the current user
\H  the hostname
\w  the current working directory, with $HOME abbreviated with a tilde

Note: For more information about decoding, man bash and search prompting.

1. Can not recall command history

touch ~/.bash_history; chmod a+rw .bash_history
2. 已经在 .bashrc 中设置了 alias,却不能用

原因:There are two types of shells: the login shell and the basic shell.

When you start a terminal, generally you get a login shell. When you issue a direct command to ssh (e.g., ssh foo@host 'cat /proc/cpuinfo'), you get a basic shell.

.profile/.bash_profile are executed in the login shell scenario. This is where you want to put your stuff that requires interactive stuff: e.g., color ls, specialized tab completion, etc.

.bashrc is executed in the other scenario. this is where you will want to put your basic functionality such as shell functions that you commonly call and whatnot.

It is often common for the .bashrc to be sourced in the .bash_profile for this reason. .bashrc is the bare minimum, where .bash_profile is the full glory.

Packages on any unix system that modify your profiles will act this way and it's important that the separation be respected, because you'll be surprised how often you /don't/ have a login shell.

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# The if ... fi block is a shell script meaning that if .bashrc exists,
# then run it now.

Fri, 27 Jul 2007

1. Stylish

Customize the look of the application and of websites with Stylish, a user styles manager.

几个有用的 Styles:

 . Colorize Firefox 2.0 Active Tab
 . WellRounded 2
 . Gmail - Adjust Foot Notes (把后半部分注释掉)
 . Gmail - hide bold spam count
 . Gmail - attachment icon replacer
 . Google (all) - colored hover
 . Google - remove ads
 . Google - widen the searches display
 . Sleek Gmail (Gamil logo 被改,参考 Gamil logo - Remove beta & talk 稍加改动)

For more styles, look here.

2. Greasemonkey

Allows you to customize the way a webpage displays using small bits of JavaScript.

几个有用的 User Scripts:

 . Gmail Macros
 . Gmail Conversation Preview
 . Gmail Air Skin
 . Clean Gmail Print
 . Gmail Full Width
 . Gmail + Google Calendar

For more user scripts, right click on the Stylish icon in bottom-right panel of Firefox, then choose "Find Stylish for this Page".

Thu, 26 Jul 2007

1. 到 这里 下载 STHeiti 字体

2. 把字体解压到/usr/share/fonts/truetype

3. 设置 STHeiti.ttf 可读权限:

sudo chmod a+r /usr/share/fonts/truetype/stheiti.ttf

4. sudo fontconfig-voodoo -f -s zh_CN

5. 设置 STHeiti 为首选中文字体

sudo gedit /etc/fonts/language-selector.conf

找到下面内容所在行(共有三处):

<family>Bitstream Vera Serif</family>

下面一行添加:

<family>STHeiti</family>

6. 刷新字体缓存:

sudo fc-cache -f -v

5. 打开 “系统-首选项-字体” 面板,在 “字体渲染” 选项中选择 “最佳形状”, 在 “细节” 里面把平滑选择为 “次像素(LCD)”。

在安装了华文黑体后,Firefox 里中文显示没有任何问题,但是当浏览中英文混编的网页 时,英文很不清楚。为了解决这个问题,我们可以安装 Lucida Grande 字体,并让 Firefox 使用这种字体。具体安装步骤如下:

1. 到 这里 下载字体

2. 把字体解压到/usr/share/fonts/truetype

3. 设置 STHeiti.ttf 可读权限:

sudo chmod a+r /usr/share/fonts/truetype/Luc*

4. 刷新字体缓存:

sudo fc-cache -f -v

5. 打开 Firefox -> Edit -> Preferences -> Content -> Fonts & Colors -> Advanced:

Fonts for "Western" and "Simplified Chinese" 里,可以选成 Lucida Grande 都选成 Lucida Grande 。

Fri, 20 Jul 2007

Add following to ~/.bashrc

# alias
alias u.r='p=`pwd`; cd ~/.unison; unison research.prf; cd $p'
alias u.p='p=`pwd`; cd ~/.unison; unison public_html.prf; cd $p'
alias u.e='p=`pwd`; cd ~/.unison; unison emacs_abbrevs.prf; cd $p'

Thu, 19 Jul 2007

1. Download and install the Real VNV free edition from here.

2. In putty, go to Connection -> SSH -> Tunnels

. Input source port (any 4 digit number, for example 5902).

. Input Destination - localhost:5907 (or vncserver's display # + 5900). Then click Add.

3. Save and open putty.

4. Open VNC Viewer, and input localhost:5902

For details, look here.

Sun, 15 Jul 2007

1. Download and install WebSphere Everyplace Micro Environment (WEME). Look here for instruction.

2. Download the Gmail for mobile application by pointing your browser (not the JVM) to

http://gmail.com/app/v1.1.0/L1/gm-Generic-Advanced_MIDP2.jad (for v1.1.0)

or

http://gmail.com/app/v1.1.0/en/gm-Generic-Advanced_MIDP2.jad (for v1.0.0)

3. Tune some parameters according this webpage.

Fri, 15 Jun 2007

安装路径由deb包自己决定synaptic只是个图形化的下载壳子,安装实际上还是dpkg 。

可以用synaptic只下载不安装,然后到/var/cache/apt/archives里面用dpkg命令自行安装,安装时候可以指定安装路径,具体请用"dpkg —help"查看相关帮助信息

Fri, 08 Jun 2007

1. 编辑注册表

\HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Emacs\command (如果没有 new -> key 建之)

然后把 command 项右边的默认值设为:

D:\Emacs\Emacs22.1\bin\emacsclientw.exe -n —server-file=D:\HOME\.emacs.d\server\server "%1" -a D:\Emacs\Emacs22.1\bin\runemacs.exe

2. ~/.emacs 中添加

(server-start)

3. HotKeyPlus 中 Emacs 键设置

D:\Emacs\Emacs22.1\bin\runemacs.exe

Sun, 03 Jun 2007

Fri, 01 Jun 2007

i         Check new email and send messages in +queu
C         In Summary mode, change inbox
C-c C-o   In Draft mode, change "From:" mail address
q         Suspend Mew then switch to another buffer. All buffers of Mew
          remain, so you can resume with buffer operations.
Q         Quit Mew. All buffers of Mew are erased.
g         Go to another folder
C-c C-a   Add attachment
          then type 'c' to attach

For more details, look the Mew Manual.

Mon, 28 May 2007

  1. Sensitivity represents the proportion of truly diseased persons in a screened population who are identified as being diseased by the test. It is a measure of the probability of correctly diagnosing a condition.
  2. Specificity is the proportion of truly nondiseased persons who are so identified by the screening test. It is a measure of the probability of correctly identifying a nondiseased person.

The position of the cut-off determines the number of true positives, true negatives, false positives, and false negatives. As you increase your sensitivity (true positives) and can identify more cases with a certain condition, you also sacrifice accuracy on identifying those without the condition (specificity).

A Receiver Operating Characteristic (ROC) curve is a graphical representation of the trade off between the false negative and false positive rates for every possible cut off. By tradition, the plot shows the false positive rate (1-specificity) on the X axis and the true positive rate (sensitivity or 1 - the false negative rate) on the Y axis.

The accuracy of a test (i.e. the ability of the test to correctly classify cases with a certain condition and cases without the condition) is measured by the area under the ROC curve. An area of 1 represents a perfect test, while an area of .5 represents a worthless test. The closer the curve follows the left-hand border and then the top border of the ROC space, the more accurate the test; the true positive rate is high and the false positive rate is low. Statistically, more area under the curve means that it is identifying more true positives while minimizing the number/percent of false positives.

Look here for more.

A Receiver Operating Characteristic curve (Zweig, 1993) summarizes the performance of a two-class classifier across the range of possible thresholds. It plots the sensitivity (class two true positives) versus one minus the specificity (class one false negatives). An ideal classifier hugs the left side and top side of the graph, and the area under the curve is 1.0. A random classifier should achieve approximately 0.5 (a classifier with an area less than 0.5 can be improved simply by flipping the class assignment). The ROC curve is recommended for comparing classifiers, as it does not merely summarize performance at a single arbitrarily selected decision threshold, but across all possible decision thresholds.

The ROC curve can be used to select an optimum decision threshold. This threshold (which equalizes the probability of misclassification of either class; i.e. the probability of false-positives and false-negatives) can be used to automatically set confidence thresholds in classification networks with a nominal output variable with the Two-state conversion function.

Sat, 26 May 2007

Fri, 25 May 2007

命令                                 按键          说明
view-register                                    查看一个寄存器中的内容
point-to-register                   C-x r SPC    保存point
jump-to-register                    C-x r j      跳到保存的point。如果是一个文件,而且这个文件已经关闭,会重新打开
copy-to-register                    C-x r s      保存一个文本区域
insert-register                     C-x r i      插入寄存器中的文本,如果用C-u调用,会把point放到插入文本末尾
append-to-register                               向寄存器中增加文本,如果用C-u调用,会删除当前区域
prepend-to-register                              在寄存器的前端增加文本
copy-rectangle-to-register          C-x r r      保存一个矩形区域
window-configuration-to-register    C-x r w      保存当前frame的窗口状态
frame-configuration-to-register     C-x r f      保存frame的状态
number-to-register                  C-x r n      使用C-uN来把数字N放到寄存器中
increment-register                  C-x r +      增加寄存器中的数字

Wed, 23 May 2007

C-M-n
C-M-p

Mon, 21 May 2007

C-j  Select the current prompt as the buffer.
     If no buffer is found, prompt for a new one.

C-s  Put the first element at the end of the list.
C-r  Put the last element at the start of the list.
TAB  Complete a common suffix to the current string that matches all buffers.
     If there is only one match, select that buffer.
     If there is no common suffix, show a list of all matching buffers in a separate window.
C-e  Edit input string.
C-t  Toggle regexp searching. (e.g. "C-t *.r$" 显示以 .r 为扩展名的文件)
C-p  Toggle between substring and prefix matching.
C-c  Toggle case-sensitive searching of buffer names.
  ?  Show list of matching buffers in separate window.
C-k  Kill buffer at head of buffer list.
C-a  Toggle ignoring buffers listed in `ido-ignore-buffers'.
C-h v major-mode

or

M-x ibuffer /m

Thu, 10 May 2007

1. dired buffer 中最常用的一些键:

n, p, ^, RET, <, >  ;; 浏览
m, % m, t, * !, u   ;; 标记
C, D, R, M, !       ;; 操作

F                   ;; 一口气打开所有文件(太多了,就要加 C-u)
r                   ;; 直接在 dired buffer 里修改文件名(by wdired)

C-x C-j             ;; 跳到当前文件所在目录的 dired-mode 中

;; M-x describe-mode 可以发现更多快捷键。

2. dired 相关设置:

;; dired 直接修改文件名
(require 'wdired)
(autoload 'wdired-change-to-wdired-mode "wdired")

(define-key dired-mode-map (kbd "r") 'wdired-change-to-wdired-mode)

;; 进入退出不同 dir 时,不生成新的 dired buffer
(require 'dired-single)

(define-key dired-mode-map (kbd "RET") 'joc-dired-single-buffer)
(define-key dired-mode-map (kbd ".") 'joc-dired-single-buffer)
(define-key dired-mode-map (kbd ",") '(lambda () (interactive) (joc-dired-single-buffer "..")))

;; 对文件夹操作时, 使支持递归
(require 'dired-x)
(setq dired-recursive-copies 'always
      dired-recursive-deletes 'top)

;; 以下是当你在 dired buffer 里按 ! 时的情景。



(defun my-start-process-shell-command (cmd)
  "Don't create a separate output buffer."
  (start-process-shell-command cmd nil cmd))

;; redefine this function to disable output buffer.
(defun dired-run-shell-command (command)
  (let ((handler
         (find-file-name-handler (directory-file-name default-directory)
                                 'shell-command)))
    (if handler (apply handler 'shell-command (list command))
      (my-start-process-shell-command command)))
  ;; Return nil for sake of nconc in dired-bunch-files.
  nil)


(setq dired-guess-shell-alist-user
      `((,(regexp-opt
           '(".mp3" ".ogg" ".wav" ".avi" ".mpg" ".dat" ".wma" ".asf" ".rmvb"))
         (progn (emms-add-file (dired-get-filename))
                (keyboard-quit)))

        (,(regexp-opt
           '(".gif" ".png" ".bmp" ".jpg" ".tif"))
         "xzgv")

        (".htm[l]?" "firefox")
        (".dvi" "xdvi")
        (".rar" "unrar x")
        (".pdf" "xpdf")
        (".ppt" "openoffice")))

;; sort:directories first (emacswiki 上某君之作)
(defun sof/dired-sort ()
  "Dired sort hook to list directories first."
    (save-excursion
       (let (buffer-read-only)
            (forward-line 2) ;; beyond dir. header
                 (sort-regexp-fields t "^.*$" "[ ]*." (point)
                 (point-max))))
      (and (featurep 'xemacs)
             (fboundp 'dired-insert-set-properties)
                    (dired-insert-set-properties (point-min) (point-max)))
        (set-buffer-modified-p nil))

(add-hook 'dired-after-readin-hook 'sof/dired-sort)

;; sort 还有个 sort map 的东西, 在 emacswiki 上有。我就不贴出来了。。

;; _+ only show last three columns in dired mode
(defvar wcy-dired-mode-hide-column-regex
  "^\\s-\\{2\\}[drwx-]\\{10\\}\\s-+[0-9]+\\s-+\\sw+\\s-+\\sw+"
  "doc")
(defun wcy-dired-mode-hide-column ()
  (interactive)
  (when (eq major-mode 'dired-mode)
    (save-excursion
      (save-match-data
        (goto-char (point-min))
        (while (re-search-forward wcy-dired-mode-hide-column-regex nil t nil)
          (let ((o (make-overlay (match-beginning 0) (match-end 0))))
            (overlay-put o 'invisible t)
            (overlay-put o 'priority 0)
            ;;(overlay-put o 'face '(foreground-color . "red"))
            (overlay-put o 'id 'wcy-dired-mode-hide-column)))))))

(defun wcy-dired-mode-show-column ()
  (interactive)
  (when (eq major-mode 'dired-mode)
    (mapc (lambda (o)
            (if (eq (overlay-get o 'id) 'wcy-dired-mode-hide-column)
                (delete-overlay o)))
          (overlays-in (point-min) (point-max)))))
;; 注意和 (add-hook 'dired-after-readin-hook 'sof/dired-sort) 的冲突要保证
;; dired-after-readin-hook 中 wcy-dired-mode-hide-column 在 sof/dired-sort 之后
(when (eq system-type 'windows-nt)
  (add-hook 'dired-after-readin-hook 'wcy-dired-mode-hide-column t nil))

;; display Explorer's context menu in dired
(defun w32-context-menu (filename)
  (start-process-shell-command "context" "*context*" "context" filename))

(defun w32-context-menu-dired-get-filename (event)
  (interactive "e")
  ;; moves point to clicked row
  (mouse-set-point event)
  (w32-context-menu (concat "\"" (dired-get-filename) "\"")))

;; Bind RMB
(define-key dired-mode-map [mouse-3] 'w32-context-menu-dired-get-filename)

;; When not in dired, I use this:
(defun w32-context-menu-current-buffer ()
  (interactive)
  (w32-context-menu (concat "\"" buffer-file-name "\"")))

(global-set-key "\C-cc" 'w32-context-menu-current-buffer)

For more information about the last part, see here.

3. Windows 系统中,文件关联问题,look here 。添加 (require 'w32-browser) 到 .emacs 中。在 Dired 中打开文件按F3就可以了。

Wed, 09 May 2007


M-x replace-string C-q C-M RET

The C-q will allow you to type ^ (control) characters into the input buffer.

Another method is to use dos2unix command in shell.

;; _+ key binding
(global-set-key (kbd "C-x C-b") 'ibuffer)

按 C-x C-b 打开 ibuffer 的界面,ibuffer的最基本的功能是切换 buffer 。当然还 有一些其他比较不错的功能。

1. /m  默认提示的是当前行 buffer 的 major mode , 回车。这样就只显示 major mode 相同的 buffer 了。还可以自己输入
       major mode 的名字,可以用 TAB 键自动补齐。

2. //  全部显示。

3. m  mark buffer; u unmark buffer 。

4. t  toggle mark 。

5. ** unmark all 。

6. D  mark buffer as Delete; x delete buffers marked as D mark 。

For more information, see here.

1. comment-or-uncomment-region

;; _+ 注释当前行
(defun my-comment-or-uncomment-region (&optional line)
  "This function is to comment or uncomment a line or a region"
  (interactive "P")
  (unless (or line (and mark-active (not (equal (mark) (point)))))
    (setq line 1))
  (if line
      (save-excursion
        (comment-or-uncomment-region
         (progn
           (beginning-of-line)
           (point))
         (progn
           (end-of-line)
           (point))))
    (call-interactively 'comment-or-uncomment-region)))
;; bind it
(global-set-key (kbd "C-;") 'my-comment-or-uncomment-region)

;; 注释后自动indent
(setq-default comment-style 'indent)

2. 两个 buffer 间切换

(global-set-key [(control ?\.)] 'ska-point-to-register)
(global-set-key [(control ?\,)] 'ska-jump-to-register)
(defun ska-point-to-register()
  "Store cursorposition _fast_ in a register.
Use ska-jump-to-register to jump back to the stored
position."
  (interactive)
  (setq zmacs-region-stays t)
  (point-to-register 8))

(defun ska-jump-to-register()
  "Switches between current cursorposition and position
that was stored with ska-point-to-register."
  (interactive)
  (setq zmacs-region-stays t)
  (let ((tmp (point-marker)))
        (jump-to-register 8)
        (set-register 8 tmp)))

3. 移动光标到指定字符

;; _+ go to char
(defun wy-go-to-char (n char)
  "Move forward to Nth occurence of CHAR.
Typing `wy-go-to-char-key' again will move forwad to the next Nth
occurence of CHAR."
  (interactive "p\ncGo to char: ")
  (search-forward (string char) nil nil n)
  (while (char-equal (read-char)
		     char)
    (search-forward (string char) nil nil n))
  (setq unread-command-events (list last-input-event)))

(define-key global-map (kbd "C-c a") 'wy-go-to-char)

4. 指定模式下的 Key Binding

;; _+ some local key binding
(add-hook 'inferior-ess-mode-hook
          '(lambda ()
             (define-key inferior-ess-mode-map (kbd "<up>")
                         'comint-previous-input)

	     (define-key inferior-ess-mode-map (kbd "<down>")
	       'comint-next-input)

	     (define-key inferior-ess-mode-map (kbd "C-<up>")
	       'comint-previous-matching-input-from-input)

	     (define-key inferior-ess-mode-map (kbd "C-<down>")
	       'comint-next-matching-input-from-input)

             ))

Thu, 03 May 2007

Put the following at the end of .emacs

(defun w32-restore-frame ()
"Restore a minimized frame"
(interactive)
(w32-send-sys-command 61728))

(defun w32-maximize-frame ()
"Maximize the current frame"
(interactive)
(w32-send-sys-command 61488))

(w32-maximize-frame)

If minibuffer is too big, then in [HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs] add a new String Value EMACS.Toolbar = 0.

Wed, 02 May 2007

Fri, 27 Apr 2007

Download Lauchy here.

Sat, 21 Apr 2007

这两天,每次在打印或是 page setup 的时候,Firefox 就 freezes 了。Google了一 下也没有找到答案,暂时的解决方法是,到

C:\Documents and Settings\zma\Application Data\
下,把 Mozilla 这个文件夹删除,然后重新配置一下 Firefox 就可以了。

Wed, 18 Apr 2007

Switch sound file conversion software is an audio file format converter for Windows or Mac. It can convert audio files from many different file formats into mp3 or wav files including wav to mp3, mp3 to wav, wma to mp3 and much more (see the supported formats list below).

Download Switch here.

1. My Computer -> View -> Details

2. My Computer -> Tools -> Folder Options -> View -> Apply to All Folders

Mon, 16 Apr 2007

Tools -> Options -> Main -> Check Now

工具 -> 浏览器支持 -> 添加 Firefox 支持

Wed, 11 Apr 2007

;; rectangle
(require 'rect-mark)
(global-set-key (kbd "C-x r C-@") 'rm-set-mark)
(global-set-key (kbd "C-x r C-x C-x") 'rm-exchange-point-and-mark)
(global-set-key (kbd "C-x r C-w") 'rm-kill-region)
(global-set-key (kbd "C-x r M-w") 'rm-kill-ring-save)
(global-set-key (kbd "C-x r C-y") 'yank-rectangle)

举行操作时,只需在一般操作前加上 C-x r 即可。

Mon, 09 Apr 2007

%a    This stands for the abbreviated name of the day of week.
%A    This stands for the full name of the day of week.
%b    This stands for the abbreviated name of the month.
%B    This stands for the full name of the month.
%c    This is a synonym for `%x %X'.
%C    This has a locale-specific meaning. In the default locale (named C), it is equivalent to `%A, %B %e, %Y'.
%d    This stands for the day of month, zero-padded.
%D    This is a synonym for `%m/%d/%y'.
%e    This stands for the day of month, blank-padded.
%h    This is a synonym for `%b'.
%H    This stands for the hour (00-23).
%I    This stands for the hour (01-12).
%j    This stands for the day of the year (001-366).
%k    This stands for the hour (0-23), blank padded.
%l    This stands for the hour (1-12), blank padded.
%m    This stands for the month (01-12).
%M    This stands for the minute (00-59).
%n    This stands for a newline.
%p    This stands for `AM' or `PM', as appropriate.
%r    This is a synonym for `%I:%M:%S %p'.
%R    This is a synonym for `%H:%M'.
%S    This stands for the seconds (00-59).
%t    This stands for a tab character.
%T    This is a synonym for `%H:%M:%S'.
%U    This stands for the week of the year (01-52), assuming that weeks start on Sunday.
%w    This stands for the numeric day of week (0-6). Sunday is day 0.
%W    This stands for the week of the year (01-52), assuming that weeks start on Monday.
%x    This has a locale-specific meaning. In the default locale (named `C'), it is equivalent to `%D'.
%X    This has a locale-specific meaning. In the default locale (named `C'), it is equivalent to `%T'.
%y    This stands for the year without century (00-99).
%Y    This stands for the year with century.
%Z    This stands for the time zone abbreviation.

For more details, look here.

;; _+ insert current date
(defun my-insert-date ()
  (interactive)
  (insert (format-time-string "%a, %2d %b %4Y" (current-time))))

 (global-set-key (kbd "<f9> d") 'my-insert-date)

Fri, 06 Apr 2007

Tired of reaching for your volume knob every time your mp3 player changes to a new song? MP3Gain analyzes and adjusts mp3 files so that they have the same volume.

MP3Gain does not just do peak normalization, as many normalizers do. Instead, it does some statistical analysis to determine how loud the file actually sounds to the human ear. Also, the changes MP3Gain makes are completely lossless. There is no quality lost in the change because the program adjusts the mp3 file directly, without decoding and re-encoding.

Download

Wed, 04 Apr 2007

Look here for details.

Look here for details.

Mon, 02 Apr 2007

In address bar, input "about:config", change value of "browser.tabs.loadDivertedInBackground" to ture.

Refresh current buffer in Emacs: C-x-v
mark-whole-buffer: C-x h

1. Changing the Font Once and for All Under Windows

- First, enter the following code into a buffer for evaluation. If you want to keep it permanently, add it to your .emacs file.

(if (eq window-system 'w32)        ; emacs 20 & up
    (defun insert-x-style-font()
      "Insert a string in the X format which describes a font the
user can select from the Windows font selector."
      (interactive)
      (insert (prin1-to-string (w32-select-font)))))

- Evaluate it

- Create a file call emacsfont.reg in home directory, enter the following:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs] "EMACS.FONT"=

With the cursor still after the equals sign, execute M-x insert-x-style-font. Choose the right font and size you want, emacs will insert corresponding code. Save and quit emacs. Run emacsfont.reg in windows by double click it. Open emacs, you'll see the font size is changed.

2. Changing the Font Once and for All Under UNIX

To change the font for the current session in GNU Emacs, simply press Shift and the first mouse button. This brings up a menu with fonts, choose the one you want. In UNIX applications, defaults are configured in the file called $HOME/.Xdefaults or something similar (it depends on your UNIX system). This file contains a database of user preferences for the programs running in X Window. For a description of this file see the manual page for the program called xrdb. Inserting the following line into this file changes the font in Emacs:

Emacs*font:8x13

For more information, see here.

In Yap, View -> Options -> Inverse Search -> Command line:

"C:\Emacs\emacs\bin\emacsclientw.exe" +%l %f

or

"C:\Emacs\emacs\bin\emacsclientw.exe" +%l "%f"

For more information about the format, run

"C:\Emacs\emacs\bin\emacsclientw.exe" --help
  1. 最基本的东西
C-s 开始正向查找
C-r 开始方向查找
  1. 这两个命令进入了查找模式,在 Emacs 中的术语叫做 Incremental Search,也就 是在你输入要查找的字符的时候,同时高亮显示找到的部分。在查找模式下的一些 操作。下面的操作都是先按 C-s 或者 C-r 后,进入 Incremental Search Mode 之后的操作。

    C-r , C-s , 分别是向前查找和向后查找当前输入的内容。如果当前内容是空的, 也就是说你连续两次输入 C-s,那么就是 "查找下一个 (Find next)" 的操作。第 一次是C-s 把你带入了 Incremental Search Mode,第二次的 C-s 表示查找上一 次查过的东西。C-r 类似,只不过方向相反。

    C-w 查找光标除所在的单词。例如, 你可以输入 C-r 然后马上输入 C-w ,光标所在位置的单词就自动变成了 要查找的内容。多次输入 C-w 后面 的单词就会一个一个的变成了查找内容一部分。

    C-w 还可以和上面介绍的 C-s C-r 配合使用。C-s 进入 Incremental Search Mode. 然后输入void f 然后光 标会停留在一个 void f 的单词上,也许是 void far,然后用 C-s 或者 C-r 找到某个 void f 的地方,然后 C-w 就可以把 f 后面的单词补全了。

    C-y 把光标所在位置到行尾的部分作为查找内容。和 C-w 类似,只不过输入的不是一个单词,而是整整一行。 M-y 把 kill ring 中的东西输入为当前要查找的内容。

    M-c 切换大小写敏感。 M-r 切换是普通查找还是正则表达式查找。 M-e 编辑要查找的内容

    Incremental Search 会随着用户的输入不断的改变光标的位置,有的时候很讨厌,那么就可以 M-e 编辑要查 找的内容,然后按 Enter 回到 Incremetal Search。

    M-n M-p 浏览查找历史纪录,可以查找以前查找过的内容。 C-q C-j 查找多行文字。如果你要的查找的内容是多行文字,也就是说,查找内容中含有换行字符 C-j 但是, Enter 键又作为结束查找的操作,一按 Enter 就退出了查找模式了。那么 C-q C-j 可以解决这个问题。可以 查看如何输入特殊的控制字符。

  2. 用 Nonincremental Search 查找。 如果不习惯 Incremetal Search 的方式,那么可以 C-s <RET> 那么就用 Nonincremental Search 的方式查 找,这种查找方式和普通的编辑器几乎一样。

Fri, 13 Mar 2007

  1. Try to configure all packages that are un-configured:
sudo dpck --configure -a
  1. Try to let apt-get remove all problematic packages automatically:
sudo aptitude -f remove
  1. Rerun this after running the command above:
sudo dpak --configure -a

Sun, 25 Feb 2007

  1. Elementary Concepts in Statistics
  2. Topics in Multivariate Analysis
  3. UCLA Statistical Computing Resources
  4. UCLA Online Seminars and Classes

Fri, 23 Feb 2007

Download driver here

After install the printer, in Control Panel -> Printers and Faxes -> printer CH320 -> Properties -> Configure, choose Duplexing Unit.

There are two basic ways to change font sizes in Latex:

- To change the basic font size used all the way through your paper, put either "11pt" or "12pt" in your \documentclass line. For example, if you had:

\documentclass{report}

but you wanted to use 12pt type (10pt is the default), you would change it to:

\documentclass[12pt]{report}

- To change just a part of your paper into a different font size, you can use some of the sizing environments. In increasing size, they are:

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

The case is important in these commands. Also, in some document styles, some of these commands may produce the same size font. For example, if you wanted to just make a small part of your text in a different font, you would use something like:

This is in normal text, while these words are in {\large large text}.

Or, if you wanted to put a larger region in a different size, you'd use something like:

\begin{small}
this will all be in small text
this too.
etc..
\end{small}

Mon, 25 Dec 2006

Install cygwin in C:\cgwin, with following packages

Devel:
	gcc-g77
	make
Net:
	openssh
	rsync
Shells:
	tcsh (bash)
Text:
	aspell
	enscript
	more
X11:
	 (no subdirectories, select install for the whole package; the
	 default option isn't quite enough for what I'm doing)

Get EmacsW32+Emacs (EmacsW32 - an add-on to Emacs for MS Windows) here

Get AUCTeX for MS here

Assume MiKTeX, GSview, gs are installed (It's a good idea to install them in one directory, such as C:\CTeX )

Install EmacsW32+Emacs in the default directory - C:\Emacs

Set HOME and PATH,

HOME = C:\

PATH =
C:\Program Files\R\R-2.4.0\bin;
C:\Emacs\emacs\bin;
C:\CTeX\Ghostgum\gsview;
C:\CTeX\gs\gs8.51\bin;
C:\CTeX\gs\gs8.51\lib;
C:\Program Files\Adobe\Reader 8.0\Reader;
C:\cygwin\bin

Assume cygwin is installed (with Devel installed, since we need 'make'). In cygwin, go to directory of auctex.

 GS="C:/CTeX/gs/gs8.51/bin/gswin32c.exe" ./configure
 --prefix='C:/Emacs/emacs' --with-texmf-dir='C:/CTeX/localtexmf'
 --with-lispdir='C:/Emacs/site-lisp'
Note:
The above command is in one line. For more information, refer here

make

make install

Put the following in ~\.emacs

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(require 'tex-mik)

Note: start Emacs, if can not find tex-site.el, edit
C:\Emacs\site-lisp\auctex.el, change

(expand-file-name "../../../tex-site.el" (file-name-directory load-file-name)))

to

(expand-file-name "tex-site.el" (file-name-directory load-file-name)))

In ~/.emacs, add the line

(setq-default ispell-program-name"aspell")
   -- then emacs knows to use aspell instead of ispell

In XP environment variables, make sure that PATH contains c:\cygwin\bin\
  --  now XP knows where to find aspell.exe
Note:
If want ispell for windows, look here

Emacs/Cygwin Customizations, look here

Printing — Refer C:\Emacs\EmacsW32\lisp\w32-print.el

Sun, 23 Dec 2006

Copy: Ctrl + insert

Paste: Shift + insert

ln -s "/cygdrive/c/Documents and Settings/username/My Documents/" ~/My_Documents
ln -s "/cygdrive/c/Documents and Settings/username/Desktop" ~/Desktop
ln -s "/cygdrive/c/" /c

Sat, 22 Dec 2006

emacs /etc/passwd

find /home/zma, change it to /cygdrive/c/zma

Thu, 07 Dec 2006

Sun, 02 Dec 2006

sudo apt-get install build-essential
sudo apt-get install linux-headers-`uname -r`

sudo apt-get install alien
alien -d VMwareTools-5.5.2-29772.i386.rpm
sudo dpkg -i vmwaretools_5.5.2-29773_i386.deb
sudo vmware-config-tools.pl

Tue, 21 Nov 2006

Sun, 10 Nov 2006

ps2eps -l -B -s b0 -c -n filename

 or

ps2eps -l -B -s b0 -F filename

Tue, 14 Nov 2006

ls -lt | head

Mon, 13 Nov 2006

ls -1 | wc -l

This uses wc to count of the number of lines (-l) in the output of ls -1. (It doesn't count dotfiles.)

Sun, 29 Oct 2006

wget http://www.cis.jhu.edu/~zma/images/mozilla_icons/document.png
wget http://www.cis.jhu.edu/~zma/images/mozilla_icons/mozilla-firefox.png

sudo cp mozilla-firefox.png /usr/share/pixmaps/mozilla-firefox.png
sudo cp mozilla-firefox.png /usr/share/pixmaps/mozilla-firefox.xpm
sudo cp mozilla-firefox.png /usr/lib/mozilla-firefox/icons/default.xpm
sudo cp document.png /usr/lib/mozilla-firefox/icons/document.png
sudo cp mozilla-firefox.png /usr/lib/mozilla-firefox/chrome/icons/default/default.xpm

Restart X using "Ctrl+Alt+Backspace"

Fri, 22 Sep 2006

Syetem -> Administration -> Language Support, tick Chinese

sudo sh -c "echo 'export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE="scim"
scim -d ' > /etc/X11/Xsession.d/95xinput"
sudo chmod +x /etc/X11/Xsession.d/95xinput

Restart X

Wed, 13 Sep 2006

"The goals of science and society, which statisticians share, are to draw useful information from data using everything we know. The particular angle of mathematical statistics is to view data as outcome of a random experiment that we model mathematically." — B+D Mathematical Statistics

Fri, 08 Sep 2006

aaa bbb ccc
ddd eee fff
... ... ...

cat a.txt | awk '{print $1 " " $3}'

 or

cat a.txt | tr -s ' ' | cut -d ' ' -f 1,3

Wed, 06 Sep 2006

I tried ndiswrapper, using windows 98 driver, not work. Add the following line to the file /etc/modprobe.d/options

options acx firmware_ver=1.2.0.30

Then restart the driver:

sudo rmmod acx
sudo modprobe acx firmware_ver=1.2.0.30

Then it is just a simple matter of configuring the interface by adding these lines to /etc/network/interfaces (you will need to alter the IP numbers for your own network setup of course):

# Wireless networking
auto wlan0
iface wlan0 inet static
address 192.168.0.11
netmask 255.255.255.0
gateway 192.168.0.1
wireless-mode managed
# wireless-keymode open
# wireless-key
wireless-essid
dns-nameservers 192.168.0.1

Finally, start the interface:

sudo ifup wlan0

Tue, 05 Sep 2006

Limit the number of files sent to mv at a time by using the xargs -l option. The following command sets a limit of 56 files at time, which mv receives:

find ./ -type f -print | xargs -l56 -i mv -f {} ../