星期二, 二月 24, 2009

Motto of Marie Curie

In life, nothing is to be feared. Everyghing is to be understaood.
                                                                                    -- Marie Curie

星期日, 二月 22, 2009

Latex表格制作全攻略

Latex表格制作全攻略

给出一个制作复杂表格的例子,制作表格主要用到\multicolumn,\multirow和\cline,其中,要使用\multirow,必须\usepackage{multirow}

如果要制作出如下图所示的表格:

table

则可以通过如下的代码:

\begin{table*}
\begin{tabular}{|c|c|c|c|c|}
\hline \hline
\multirow{2}{*}{Multi-Row} & \multicolumn{2}{|c|}{Multi-Column} & \multicolumn{2}{|c|}{\multirow{2}{*{Multi-Row and Col}} \\
\cline{2-3}
& column-1 & column-2 & \multicolumn{2}{|c|}{} \\
\hline
label-1 & label-2 & label-3 & label-4 & label-5 \\
\hline
\end{tabular}
\end{table*}

其中,multirow{2}{*}{text}的第一个参数表示行的数目,*表示由系统自动调整文字,text表示要写入的文字

multicolumn与multicolumn类似,功能是跨多列, \multicolumn{2}{|c|}{text}表示跨2行,文字采用中心对齐的方式,text是要写入的文字。

multicolumn和multirow可以组合使用,跨多行多列,只需要将multirow作为multicolumn的text即可。

最后,\cline用于画横线 \cline{i-j}表示从第i列画到第j列。

\hline画一整条横线。

星期四, 二月 05, 2009

Example .bashrc for ns-allinone-2.33 installation on Ubuntu 8.04

###### begin of .bashrc ########

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
alias ns2='/home/jianguo/ns-allinone-2.33/ns-2.33/ns'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

# LD_LIBRARY_PATH
OTCL_LIB=/home/jianguo/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/jianguo/ns-allinone-2.33/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/home/jianguo/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/jianguo/ns-allinone-2.33/bin:/home/jianguo/ns-allinone-2.33/tcl8.4.18/unix:/home/jianguo/ns-allinone-2.33/tk8.4.18/unix
NS=/home/jianguo/ns-allinone-2.33/ns-2.33/
NAM=/home/jianguo/ns-allinone-2.33/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM

######### end of .bashrc #########

Then use command ns2 instead of ns, such as: $ ns2 example.tcl

星期二, 二月 03, 2009

Install NS2 on Ubuntu 8.04 Hardy

This semester I got an assignment from Wireless/Mobile Computing lecture. It's all about NS2, the most popular network simulator. Today I tried to install it on my Ubuntu 8.04. And, here is the story :)

1. Download ns-allinone-2.33.tar from here.

2. Place it in somewhere, e.g. /home/programmer, then extract it.

$ cd /home/programmer
$ tar -xvf ns-allinone-2.33.tar

3. Download & install some packages from repository :)
$ sudo apt-get install build-essential autoconf automake libxmu-dev

4. Install the ns2
$ cd ns-allinone-2.33
$ ./install

5. Edit some paths ==a
$ gedit ~/.bashrc

Put these lines on that file. Off course, you might change /home/programmer for it depends on where you extract ns-allinone-2.33.tar.
# LD_LIBRARY_PATH
OTCL_LIB=/home/programmer/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/programmer/ns-allinone-2.33/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/home/programmer/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/programmer/ns-allinone-2.33/bin:/home/programmer/ns-allinone-2.33/tcl8.4.18/unix:/home/programmer/ns-allinone-2.33/tk8.4.18/unix
NS=/home/programmer/ns-allinone-2.33/ns-2.33/
NAM=/home/programmer/ns-allinone-2.33/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM

6. Validate it
$ cd ns-2.33
$ ./validate

7. (Optionally) Create a symlink, so that ns can be called from everywhere
$ sudo ln -s /home/programmer/ns-allinone-2.33/ns-2.33/ns /usr/bin/ns

8. Try to run it (and pray :)
$ ns

星期一, 二月 02, 2009

Windows + Cygwin + myNS2

Windows + Cygwin + myNS2

 

This document will show you how to install myNS2 (ns-2.28 + all my modules) on Windows platform (windows 2000 or windows XP). If you follow each step in this webpage, you can successfully run all the simulation scripts provided me without installing each module. (It includes TKN 802.11e EDCF module, NOAH routing, MFlood, CSFQ, Poisson traffic, wireless random uniform and GE error model, and tcldebug.)

 

2006/10/27 add “Evalvid-RA” and “IEEE 802.16 module for ns2 (from NIST)”.

 

[Cygwin]

1.      Download the cygwin.rar.

 

2.      Decompress the cygwin.rar

 

 

1.      Click the setup.exe to install cygwin.

 

2.      Because the language of operating system is Traditional Chinese. The text of button is shown in Chinese. But you don’t need to worry about this. I think it is shown in English in your computer. Just click “Next”.

 

3.      Then choose “Install from Local Directory”

 

4.      Click “Next”.

(Just keep the settings as they are.)

 

5.      Click “Next”

 

6.      Click “Browse” to choose where the software is. (Please choose “ftp%3a%2f%2fftp.nctu.edu.tw%2fWindows%2fcygwin”)

 

7.      Click “OK”.

 

8.      Click “Next” and you will see the figure shown as follows. In this window, the cygwin setup program let you choose what software you want to install.

 

9.      Click “View” first to make the word “Category “change to “Full”.

 

10.   XFree86-baseXFree86-binXFree86-progXFree86-libXFree86-etcmakepatchperlgccgcc-g++gawkgnuplottar and gzip must be chosen. For example, if I want to install XFree-86 base (upper figure), click the “Skip” of “New” column. The “Skip” will be changed to “4.3.0-1” (lower figure).

 

11.  Click “Next”.

(Please be patient. It may take a long time to finish the installation.)

 

12.   When setup is done, it will be shown as following figure. Click “Finish”.

 

 

13.   Click “OK” to finish the cygwin setup program.

 

[myNS2 setup]

1.      Click the icon on the desktop.

 

2.      For the first time execution, it will generate some environment parameter setting files. In this example, smallko is my login name to windows system. Therefore, the cygwin will create a folder named “smallko” under home directory. (The actual path for smallko folder is: c:\cygwin\home\smallko) It should be noticed that the login name can not have any space in your name. For example, “A  B” may cause errors when you install NS2.

 

3.      Download myNS2.

 

4.      Decompress the ns-allinone-2.28.rar.

 

5.      Move this folder under c:\cygwin\home\smallko. (P.S. smallko is my login name)

 

6.      Open a cygwin window

 

7.      Change the path to ns-allinone-2.28/ns-2.28

 

8.      Run the command “./configure; make clean; make

 

9.      Please be patient. It will take some time to finish the compilation.

 

10.  When it is done, it should look like as follows.

 

11.  To make sure that you have successfully installed myNS2, you need to check whether you can find ns.exe under ns-allinone-2.28/ns-2.28

 

12.  Copy the .bashrc to c:/cygwin/home/smallko

13.  Run the example script to test whether you have setup the path or not.

 

 

14.   If you see the error message like “ns command not found”, no worry about this. Sometimes even you have setup the path, but it does not work. You can copy the ns.exe (nam.exe) to the same place as the simulation script. Run the simulation with “./ns.exe” and it will be ok.

 


 

Author : Chih-HengKe

Website: http://140.116.72.80/~smallko

Email: smallko@ee.ncku.edu.tw

 

NS-2网络仿真学习资料【全】

Marc Greis' Tutorial for the UCB/LBNL/VINT Network Simulator "ns"
http://www.isi.edu/nsnam/ns/tutorial/index.html

以下摘自www.netforum.com.cn中season发表的文章:
一、常用资料:
欢迎大家踊跃共享NS资料:)
下载须知:请大家尽量不要用客户端下载,如果一定要用,那请你一定要保留备份,免得清空了信箱,后果比较严重的说。
公用信箱:nsshare@163.com
用户名:nsshare
密码:123456
资料列表:
1.NS29问之SeaSon解答 2月9日 (四) 359.61K
2.TCL&TK语言简介 12月11日 (日) 2.77M
3.GDB使用说明 12月10日 (六) 9.93M
4.Ns与网络模拟(pdf版) 12月1日 (四) 20.13M
5.ns mannal 中文版 11月22日 (二) 4.96M
6.NS与网络模拟 10月20日 (四) 4.50M
7.gdb 10月17日 (一) 13.95M
8.《Ns与网络模拟》书中源程序
updated 2006-4-1
9. 新手资料 by yinag
10. Bryan's NS-2 DSR FAQ
11. 一个trace分析工具:tracegraph by gamepause
12. AODV中各函数的简介 by ruonan
二、QQ群汇总(以下的为我测试可加入的,如果有人新建群后给我发消息,我添加到下面,方便更多人加入)
NS社区:14366184
NS仿真:19145282
NS交流3:11454597(NEW 2006-4-1)

三.常用网站资源
说明:以下的仅是在我学习NS过程中搜集到的一些有用的网站,希望能对大家有所帮助,大家如果发现比较好的网站,也希望向我提供,让更多的朋友受益,谢谢:)


一). NS常用基本网站
1. Maillist个人觉得是寻求问题答案最好的地方。
http://mailman.isi.edu/pipermail/ns-users/
2. 柯老师的网站,包含很多非常实用资源:安装,trace文件分析,源代码分析,添加新协议的途径等
http://140.116.72.80/~smallko/ns2/ns2.htm
3. NS本身的一些bug等信息,如果你的问题怎么都解决不了,可以来这里看看,或许会使你豁然开朗:)
http://www.isi.edu/nsnam/ns/ns-problems.html
4. NS by example-入门必读,强烈推荐!!!
http://nile.wpi.edu/NS/
5. ns_tutorial-入门的经典资料
http://www.isi.edu/nsnam/ns/tutorial/
6. ns-FAQ(极其经典,强烈推荐!!!包括:trace分析,Threshold,多场景模拟等)
7. NS2的trace格式分析,包括各个字段的含义
http://www.k-lug.org/~griswold/NS2/ns2-trace-formats.html
8. NS@WPI FAQ一些常见问题
http://nile.wpi.edu/NS/FAQ.html
9. 这里有很多有用的资源,推荐!
http://web.syr.edu/~dchen02/resources.htm
10. 卸载NS
http://mailman.isi.edu/pipermail/ns-users/2004-December/046262.html

(二). 常用结果分析工具

1. Gnuplot使用介绍
1) Gnuplot导读:http://learn.tsinghua.edu.cn/homepage/2001214728/Manual/95006/index.htm
2) Gnuplot详细说明:http://gnuplot.sourceforge.net/docs_4.1/node1.html

3) GNUPlot介绍: http://yinjilong.blogbus.com/logs/2004/11/509772.html

4) Gnuplot FAQ: http://www.gnuplot.info/faq/faq.html
2.Gawk使用介绍
awk详解:http://linux.chinaunix.net/doc/program/2005-02-03/1085.shtml

3.gcc使用说明
gcc使用指南:http://www.61ic.com/embed/kfhj/qt/200505/1330.html

4.Xgraph使用说明
XGRAPH:http://www.atl.external.lmco.com/projects/csim/xgraph/xgraph.html#anch1

三). 怎样添加新协议
1.Step by step教你怎样添加新协议,包括怎样修改trace格式,非常经典!http://ants.dif.um.es/masimum/nsrt-howto/html/nsrt-howto.html
2.怎样添加应用层协议,或者路由协议。
我正在写一个非常简单的入门级协议,马上就会发布。

四). 已经实现但尚未添加到NS的协议
1. 这个网站拥有大量的资源,包括各层协议源码,可以直接下载安装。http://www.isi.edu/nsnam/ns/ns-contributed.html
2. MAC 802.15.4 协议实现
http://ees2cy.engr.ccny.cuny.edu/zheng/pub/
3. 多播协议扩展
http://www.monarch.cs.cmu.edu/multicast_extensions.html
4. AODV-UU 协议下载
http://www.docs.uu.se/docs/research/projects/scanet/aodv/aodvuu.shtml
5.Leach协议
http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz
6.Cluster Based Routing Protocol
http://www.comp.nus.edu.sg/~tayyc/cbrp/
http://www.isi.edu/nsnam/ns/
http://www.isi.edu/nsnam/ns/tutorial/index.html
初学者教程,推荐 http://nile.wpi.edu/NS/
http://www.isi.edu/nsnam/ns/doc/index.html
http://w3.antd.nist.gov/wctg/manet/ns2-wctg.html



台湾 华玄明网际网路实验室http://ns2.mis.must.edu.tw/forum/index.php?s=1ff5b92897cb6fdf3db27d29ce5b0bb2

网络论坛 http://www.netforum.com.cn/default.asp

关于tcl的,不错http://www.tclchina.com/



parfait
01-18-2005, 12:34 PM
一个不错的介绍NS2的网站
http://www.isi.edu/nsnam/ns/

其中NS2帮助文档
http://www.isi.edu/nsnam/ns/doc/index.html

Network simulator v2 总结
经过两个多月的努力,终于在今天上午向老师交了终稿,可能还要修改一些东东吧。

不过大至已定。今天就把自己在学习Network simulator中学到的一些东东和有用的资料帖出来,以资已历:

有关NS使用:台湾柯志亨大哥的个人网站,我的入门就是从这里开始的http://140.116.72.80/~smallko/感觉台湾的网络模拟比大陆的先进,他们的研究所有专门的发布,有专门的课题,我们的好像是业余的!呵可,也许是我自己寡闻!

元智资工网络实验室http://netlab.cse.yzu.edu.tw/ 有很多例子,还有一个中文的类似Learning by Example的东西!

http://www.isi.edu/nsnam/ns/index.html这个我就不多说,必去的地方,上面有很多链接,很有用,英语够好的话多点点。NS by Example :英语http://nile.wpi.edu/NS/还有一个法国佬 的网站,也很不错,NS for beginner!

两个论坛:www.netforum.com.cn 大陆 http://ns2.mis.must.edu.tw/forum/forumdisplay.php?s=&forumid=3台湾华玄明网络际网络实验室--这个名字够N吧!

网络技术方面:

http://www.icir.org/floyd/ http://www-nrg.ee.lbl.gov/floyd/floyd.html
这个女老外太牛了,有TCP 方面的研究,有拥塞控制,新的TCP协议开发,最近我看上面还有mulitcast的,我自己的论文,做了两个月,最后才发现,人家1995年已经做过了,真是的,早知道,我就不用那么幸苦了。以后有机会多上去看看,还有,他带的研究生中,好像还有华人学生。呵呵。

组播方面:http://www.cse.nd.edu/~striegel/research/REU/04-Fall-Leimkuhler/index.htm stealth multicast. 还有http://www.cse.nd.edu/~striegel/research/GenMCast/index.html 是做GenMCast-- generic Mulitcast方面的!http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/ipmulti.htm IP multicast 方面的介绍!http://cs.baylor.edu/%7Edonahoo/ 没看明白!

一个QQ群,NS 网络技术方面的:5751793。

找了很多资料,感觉国内的大多是学生--而且是快毕业的学生,在做毕业论文时突击一下-----不好意思,我就是这样子------没有什么长久的发展。所以我们的论坛上,老是在问安装的问题。试想想,如果你安装都费那么大劲,你还能驾驭NS吗。NS只是一个工具而矣。

本来,想在网络方面有深层次的发展,不过天意弄人,优秀的网络公司都不理我,华为,北电,一一拒我,都快毕业的人了,只能找一个随便点的地方,安身先。以后,这辈子,可能--很难--再回到这方面来的。



可以从他的教程入手学习
http://www.isi.edu/nsnam/ns/tutorial/
bjy
01-18-2005, 01:41 PM
http://140.116.72.80/~smallko/ns2/ns2.htm

柯志亨(Chih-Heng, Ke),很棒的伙计,资料也比较全