2010年12月29日星期三

Identify the Vendor from MAC Address for wifi devices

http://www.coffer.com/mac_find/?string=intel

2010年12月27日星期一

MadWifi: linux driver for wireless ethernet card

MadWifi 'First Time User' HOWTO

http://madwifi-project.org/wiki/UserDocs/FirstTimeHowTo

How to build the ad-hoc network:

https://help.ubuntu.com/community/WifiDocs/Adhoc
https://help.ubuntu.com/community/WifiDocs/Driver/Madwifi

Specifically, for Atheros card, the restricted Madwifi driver supports adhoc mode through the creation of a new VAP.


1. remove the ath_pci module with modprobe
$ sudo modprobe -r ath_pci

2. Now re-insert the module with the option of creating it in ad-hoc mode:
$ sudo modprobe ath_pci autocreate=adhoc

3. then, build a ad-hoc network by assigning the different IP addresses for different host computer:
$ sudo iwconfig eth0 essid 'NAMEofAdhoc'
for example, for the first computer,
$ sudo ifconfig eth0 169.254.114.102 netmask 255.255.0.0
for the second computer,
$ sudo ifconfig eth0 169.254.114.103 netmask 255.255.0.0

Using the following command to change the frequency:
$ sudo iwconfig eth0 freq 2.462G

Iperf: a tool to measure the bandwidth and the quality of a network

How to install and use iperf
http://openmaniak.com/iperf.php

The source code is available at:
http://sourceforge.net/projects/iperf/

iperf(1)

NAME

iperf - Modified version of a tool for measuring maximum TCP and UDP bandwidth in the sense that also a bandwidth for TCP may be specified

DESCRIPTION

This program iperf is the modified version of the original iperf program. This version allows that also a bandwidth for TCP may be specified. This can be done with the option -a which was not available in the original version.

USAGE

Usage: iperf [-s|-c host] [-p port] [-t secs] [-w bytes] ...
iperf [-h|--help] [-v|--version]

Client/Server:
-f, --format [kmKM] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-l, --len #[KM] length of buffer to read or write (default 8 KB)
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)
-p, --port # server port to listen on/connect to
-u, --udp use UDP rather than TCP
-w, --window #[KM] TCP window size (socket buffer size)
-B, --bind bind to , an interface or multicast address
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm
-V, --IPv6Version Set the domain to IPv6

Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon

Client specific:
-a, --tcp_bandwidth \ for TCP, bandwidth to send at in bits/sec
#[KM] (default no bandwidth limit used)
-b, --bandwidth #[KM] for UDP, bandwidth to send at in bits/sec
(default 1 Mbit/sec, implies -u)
-c, --client run in client mode, connecting to
-n, --num #[KM] number of bytes to transmit (instead of -t)
-t, --time # time in seconds to transmit for (default 10 secs)
-F, --fileinput input the data to be transmitted from a file
-I, --stdin input the data to be transmitted from stdin
-P, --parallel # number of parallel client threads to run
-S, --tos # set type-of-service for outgoing packets
-T, --ttl # time-to-live, for multicast (default 1)
-W, --windowSizeSuggest Run the client so as to suggest a suitable window size (default off)

Miscellaneous:
-h, --help print this message and quit
-v, --version print version information and quit

[KM] Indicates options that support a K or M suffix for kilo- or mega-

The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_, such as IPERF_BANDWIDTH.

Report bugs to

ORIGINAL IPERF DOCUMENTATION

http://dast.nlanr.net/Projects/Iperf/
The documentation.
http://dast.nlanr.net/Projects/Iperf/iperfdocs_1.6.html
The Iperf V. 1.6 User Docs.

SEE ALSO

jperf(1)


http://staff.science.uva.nl/~jblom/gigaport/tools/man/iperf.html

2010年12月25日星期六

2010年12月23日星期四

More about adding a user in linux

Some distro configures useradd / adduser commands to create a directory while adding a user account. I suggest you use -m switch to create home directory for new user.
Code:
useradd -m -s /bin/bash userName
passwd userName
To solve your current problem, login as root and create directory manually:
Code:
cd /home
ls -l
mkdir scheiber
chmod 0700 scheiber
chown -R scheiber:scheiber scheiber


To check the permission:
http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/

python tutorial

http://docs.python.org/tutorial/controlflow.html#SECTION006720000000000000000
http://bytes.com/topic/python/

2010年12月22日星期三

Merry Christmas & Happy New Year

New year comes as expected.
All the happiness and love with you!

2010年12月21日星期二

Set Failed on device wlan

For some wireless adapters, we can set the monitor mode, in order to capture all the headers information and transmission by others over the air.

According to wireshark wiki, the following command is used in linux:
sudo iwconfig wlan1 mode monitor

But I kept receive the error message "set Failed on device wlan1".

Finally, I found that I need turn the device off first by
sudo ifconfig wlan1 down
sudo iwconfig wlan1 mode monitor
sudo ifconfig wlan1 up.

Then it rocks as you want now :)

2010年12月19日星期日

HowTo:Checkout SVN in Windows ZZ

http://vegastrike.sourceforge.net/wiki/HowTo:Checkout_SVN
http://vegastrike.sourceforge.net/wiki/HowTo:Checkout_SVN#Tortoise_SVN

2010年12月10日星期五

mbr被破坏无法进入ubuntu 9.10 ZZ

进入LiveCD 打开终端:
sudo fdisk -l查看磁盘信息。   找到 / ,/boot的对应分区。
我这里是/dev/sda11 在/ , /dev/sda3在/boot.

接着我们来挂载:
sudo mount /dev/sda11 /mnt
sudo mount /dev/sda3 /mnt/boot (如果没有对/boot单独分区的话请别打这条了)
sudo grub-install --root-directory=/mnt /dev/sda

最后重启进入ubuntu打开终端输入 update-grub2

2010年12月9日星期四

Configuring Ubuntu Linux Remote Access using SSH ZZ

http://www.techotopia.com/index.php/Configuring_Ubuntu_Linux_Remote_Access_using_SSH

http://principialabs.com/beginning-ssh-on-ubuntu/

bbn code

Ported from gr.hier_block to use gr.hier_block2 and from flow_graph to top_block

http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg15066.html
http://1010.co.uk/org/notes.html
http://old.nabble.com/BBN%27s-802.11b-code-td18136664.html

The quick solution is: change io_signature (1,2,...) --> in_signature(1,1,...)
and recompile. :)


-----------------------------------------
Install BBN code for USRP2 @ Ubuntu 9.04 + XCVR2450

svn co https://www.cgran.org/cgran/projects/bbn_80211/branches/usrp2_version bbn_80211
cd bbn_80211/
./bootstrap && ./configure && make
sudo make install

If there are errors when doing "make" on bbn, like:
bbn_tap.cc:: ‘printf’ was not declared in this scope
bbn_tap.cc: ‘fprintf’ was not declared in this scope
....
It is probably the problem of GCC version.

The solution is to add the following declaration on top of each cc files.
#include
#include


#include






Install gnuradio 3.2.2 in Ubuntu 10.04

http://rainflyking.blogspot.com/2010/11/install-bbn-and-gr322-in-ubuntu1004.html

2010年12月8日星期三

Dell E6410 install Ubuntu 10.04

http://blog.csdn.net/wdove/archive/2010/10/26/5968013.aspx
http://www.downloadatoz.com/driver/articles/fix-dell-latitude-e6410-black-screen-during-ubuntu-10-04-installation.html

2010年12月6日星期一

Export figure to pdf in Matlab ZZ

In LaTex, if the figure is in pdf format, you can click pdfLaTex just once to generate the output. Otherwise, if the figure is in eps format, you have to click button three times to do the same thing by using the LaTex -> dvi2ps -> ps2pdf workflow.

http://jinghaoxu.blogspot.com/2007/04/export-figure-to-pdf-in-matlab.html

The good thing is, Matlab can export figure to pdf format. Unfortunately, when saving a figure to a pdf file in Matlab, you'll find the figure doesn't fit the layout very well, i.e. there is a large margin from the figure to the page boundary. Those margins will be inserted into the LaTex output when you include these pdf figures.

A solution is:
1) After you plot the figure in Matlab, go to 'File->Export Setup', input the size of the output you want, e.g. Width: 6 inches, Height: 5 inches. Then click 'Apply to Figure' button.
2) Don't close the 'Export Setup' window. Go to 'File->Print Preview->Paper', input the same size in the Width and Height options.
3) Don't close the 'Print Preview' window. Go back to the 'Export Setup' window, and click 'Export', then select pdf format and save it.
4) Check the output pdf file, you'll see it is perfect.

latex 单行或多行公式的排版ZZ

from : http://www.boyeut.com/2007/05/equation.html

1.自动编号的单行公式环境是
\begin{equation}

\end{equation}

不参与自动编号的单行公式环境:
\[

\]

人工编号的单行公式可以使用Tex原有的行间公式标记
$$公式 \eqno 编号 $$ 将编号放在右边
$$公式 \leqno 编号 $$ 将编号放在左边

引用时候可以直接用$编号$即可。

例如,$$a^2+b^2=c^2 \eqno (**)$$
由公式($**$)即可得到结论。

一般情况下,行间公式 $$…$$也可以用\[…\]表示
但对于这种人工编号的公式,不能用\[..\]代替$$…$$.

2.单个公式很长,需要换行,但仅允许生成一个编号时,可以用split命令

\begin{equation}
\begin{split}
a &= b \\
c &= d
\end{split}
\end{equation}

注意:每行只允许出现一个“&”,使用split命令后,编号上下居中显示。

3.多行公式:

\begin{eqnarray}
左 & 中 & 右\\
左 & 中 & 右\\

\end{eqnarray}
该环境对多行公式每行都加自动编号,如果相对某行不加编号,可在换行之前添加命令\nonumber

如果要改变公式的自动编号,可以重设计数器初始值:
\setcounter{equation}{数}
下一个编号自动加1。

4.方程组的排版:
多个公式,每个公式自动编号。

1) gather环境
是下面align环境的一种特殊情形。
\begin{gather}
a &= b \\
c &= d \\

\end{gather}
>>1.如果其中某几行使用同一个编号,则需要内嵌一个split环境。
>>2.命令\notag可使当前行不编号。
2) align环境
可使几组公式并排在一起,即在同一行显示多个公式,方法是跟以前一样,使用”&”对齐。
可替代gather环境。
3) 以上几种方程组环境,无论每个公式多小,都会占满一行。使用相应的\gathered,\aligned环境,则只占据公式的实际宽度,整体作为一个特大的符号与其他符号一同处理。
这个结构还可以添加位置参数,以决定与其他符号的竖直对齐方式(b,t)。而且这种环境不再具有自动编号功能。

例如:
\begin{equation}
\left.
\begin{aligned}[b]
a &= b+c \\
d &= b+c
\end{aligned}
\right\}
\Longrightarrow
\qquad a=d
\end{equation}

这里更正参考文献中P149页的一个小错误。就是\right}应该改为\right\}.

【参考文献】
1.陈志杰等,LATEX入门与提高(第二版),高等教育出版社,2006.5

2010年12月2日星期四

python tutorial video

http://showmedo.com/videotutorials/python

2010年11月30日星期二

Doodle for scheduling the event

http://doodle.com/BSPpgit4vnpem3uh

2010年11月29日星期一

How to use iwconfig

http://linux.die.net/man/8/iwconfig

running OFDM on USRP2

The example provided with the gnuradio codebase requires small
modifications in order to work with USRP2. You can try with the
modifications I made:

www.cs.ucsb.edu/~veljko/downloads/ofdm_example.tar.gz

In my case with XCVR2450 daughter boards running the following works fine:

transmitter:
benchmark_ofdm_tx_new.py -f 2.45G --tx-amplitude 0.9 -M 8 -s 200 -m
bpsk --fft-length=512 --occupied-tones=80 -i 64 --tx-gain=10
--cp-length=128

receiver:
benchmark_ofdm_rx_new.py -e eth1 -f 2.45G -m bpsk --fft-length=512
--occupied-tones=80 -d 64 --rx-gain=30 --cp-length=128

You can try with the transmitter only first and usrp2_fft.py on the
other end, just to see if there's something getting transmitted and if
it looks like OFDM.

cheers,


veljko


http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg22592.html
http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg22793.html
http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg22609.html
http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg22811.html

A few more from Bin Zan:
http://old.nabble.com/the-gnuradio-ofdm-receiver-td27526241.html#a27526241
http://old.nabble.com/question-about-ofdm-subcarrier-mapping-td27630888.html#a27630888
http://old.nabble.com/user/UserPosts.jtp?user=1589439

2010年11月24日星期三

TinyOS tutorial and Mote-PC communication

http://docs.tinyos.net/index.php/TinyOS_Tutorials

Mote-PC communication
http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder

Berkeley tutorial lessons: (* recommended)
http://webs.cs.berkeley.edu/tos/api/tinyos-1.x/doc/tutorial/lesson1.html

gnuradio in Matlab now!!

http://www.mathworks.com/help/toolbox/commblks/rn/bsjl8d4.html#bsjrdu7

2010年11月23日星期二

Google 阅读器键盘快捷键 ZZ

Google 阅读器键盘快捷键

浏览
对条目采取行动

j/k:
下一个/上一个条目
s:
为条目加注星标

空格:
下一个条目或页面
l:
喜欢条目

+ 空格:
上一个条目或页面

=:
提高放大倍数

-:
降低放大倍数


t:
标记条目

n/p:
向下/向上扫描条目(仅列表)
e:
通过电子邮件发送条目

+ n/p:
下一个/上一个订阅
+ s:
共享条目

+ x:
展开文件夹
+ d:
共享条目并添加注释

+ o:
打开订阅或文件夹
v:
查看原始内容

或键:
展开/折叠条目(仅限列表)

c:
添加评论

+ c:
查看评论

m:
将条目标为已读/未读

+ a:
全部标为已读

+ t:
打开“发送到”菜单

跳转
应用程序

g 然后 h:
转到主页
r:
刷新

g 然后 a:
转到所有条目
f:
切换至全屏模式

g 然后 s:
转到加星标条目
u:
hides/unhides the left hand side module

g 然后 + s:
转到共享条目
1:
切换至扩展视图

g 然后 u:
打开订阅选择器
2:
切换至列表视图

g 然后 t:
打开标签选择器
/:
将光标移动到搜索框

g 然后 + t:
转到趋势页
a:
添加订阅

g 然后 d:
转到查找页
依次键入 g 和 f:
打开朋友选择器

依次键入 g 和 +f:
转至朋友的共享条目

依次键入 g 和 c:
转到评论视图

依次按 g 和 e:
开始探索

依次按 g 和 p:
转到热门条目

2010年11月21日星期日

xG Technology: xMax CR technology

xG Technology: xMax

With xMax xG Technology translates the concept of mobile phones to the (unlicensed) band of 900MHz. The core of xMax technology is it capability of sensing for other systems in the band and determine if interference has reached unacceptable levels, and in such case change band. This process can be carried out up to 33 times a second. The main practical problems a product of this kind has to deal with are synchronization issues and robustness of the detection scheme.

While xG Technology webpage mainly offers a high level description of this cognitive radio technology, it also points out some characteristics of the physical layer:
  • Handover decisions are made by fussing multiple samples and measurements. This allows the system to avoid unnecessary band switches due to a temporary interference or degraded network conditions.
  • Compared to this the modulation is very simple: xMax uses a conventional single carrier modulation with BPSK modulation. However it allows the bonding of multiple of these single carriers channels working in different bands. Then, while the technology supports up to 1Mbps per channel with BPSK modulation, it allows the use of 18 RF channels simultaneously, and thus it can achieve up to 18Mbps. Higher rates could be achieved by employing adaptive modulation instead of BPSK.
http://www.xgtechnology.com/

Some other commercial products on CR are summarized as follows:
http://spectralholes.blogspot.com/2010/11/cognitive-radio-products.html

2010年11月20日星期六

able to receive OFDM 802.11g raw data

By setting up two USRP2 communication through SMA cable.

Transmitter: ftw_802.11_ofdm_tx code
$ sudo ftw_ofdm_tx.py --interface=eth0 --mac-addr=USRP2 MAC ADD --gain=10 --freq=2.412e9 --interp=5 (default for 802.11a/g) --payload="YOUR Message" --regime=3(QPSL, r=0.5) --repetition=100000 (number of frames to send) | sudo tee /YOUR location/output.txt

Receiver: observed by usrp2_fft.py

Next step is to collect all the features of OFDM.

802.11 network on campus damn sucks!!!

as titled.

Learn Python The hard way

http://learnpythonthehardway.org/index

2010年11月18日星期四

C++ tutorial

http://www.cplusplus.com/doc/tutorial/

2010年11月15日星期一

beacon message in 802.11 ZZ

Beacon frame is one of the management frames in IEEE 802.11 based WLANs. It contains all the information about the network. Beacon frames are transmitted periodically to announce the presence of a Wireless LAN network. Beacon frames are transmitted by the Access Point (AP) in an infrastructure BSS. In IBSS network beacon generation is distributed among the stations.

[edit] Components of a Beacon frame

Beacon frame consist of MAC header, Frame body and FCS. Some of the fields are enlisted below.

  • Timestamp
After receiving the beacon frame all the stations change their local clocks to this time. This helps with synchronization.
  • Beacon interval
This is the time interval between beacon transmissions. The time at which a node (AP or station when in Ad-hoc) must send a beacon is known as Target Beacon Transmission Time (TBTT). Beacon interval expressed in Time Unit (TU). It is a configurable parameter in the AP and typically configured as 100 TU [1].
  • Capability information
Capability information field spans to 16 bits and contain information about capability of the device/network. Type of network such as AdHoc or Infrastructure network is signaled in this field. Apart from this information, it announce the support for polling, encryption details also.
  • SSID
  • Supported rates
  • Frequency-hopping (FH) Parameter Set
  • Direct-Sequence (DS) Parameter Set
  • Contention-Free (CF) Parameter Set
  • IBSS Parameter Set
  • Traffic Indication Map (TIM)
--------------------------------------------------
More detail of beacon content can be accessed from:
http://www.wi-fiplanet.com/tutorials/print.php/1492071

2010年11月12日星期五

SVN to control the version of project codes (ZZ)

http://www.abbeyworkshop.com/howto/misc/svn01/

Subversion Cheat Sheet

This Subversion cheat sheet was created during the initial setup of Subversion on Apache 2.0 on Windows and Mac OS X. A detailed tutorial covering most of the features of Subversion can be found in the online Subversion book. However, to make Subversion more useful for me, I created this Readers' Digest version.

Create a Repository

To store projects in Subversion, first you must create a repository. This must be done to a local drive on a local machine. Creating a repository on a network drive is not supported. To create a repository type:

UNIX

svnadmin create /path/to/repository

Windows

svnadmin create d:/path_to_repository

By default this sets up a Berkeley database to store the repository. Individual projects should be created as subdirectories of the repository directory (see the next section). Notice that the Windows version includes a drive letter, but also uses forward slashes instead of back slashes. The forward slashes are required even on Windows.

Add a New Project - svn import

To add a project, the Subversion documentation suggests that you create a directory structure like the following:

Picture of the Directory Structure

A root project directory contains three subdirectories, branches, tags, and trunk. Your files and directories are stored under the trunk directory.

Create the directories as described. Assuming the project directory is a subdirectory of the current directory, you would enter the following command

UNIX

svn import project file:///repository_name/project -m "First Import"

Windows

svn import project file:///d:/repository_name/project -m "First Import"

Network

svn import project http://host_name/svn_dir/repository_name/project -m "First Import"

Notice the Network example includes an svn_dir. This assumes you are using Apache 2.0 and the Subversion modules. When setting up Subversion on Apache, a virtual directory is created on the server that points to your repository directory. More information on Apache 2 setup is described later in this document.

This creates the initial project which you can work from. To get the files under version control, you must checkout a project to begin working on it.

Checking Out a Project - svn checkout

To start using the version control features check out a project into your local working directory. This is done with the following command:

UNIX

svn checkout file:///repository_name/project/trunk project

Windows

svn checkout file:///d:/repository_name/project/trunk project

Network

svn checkout http://host_name/svn_dir/repository_name/project/trunk project

In these examples, project is the name of the directory where you want to store the checked out project on your local file system.

Getting a List of Projects - svn list

To get a list of the current projects stored in a repository, you can use the following command.

UNIX

svn list --verbose file:///repository_name/project

Network

svn list --verbose http://host_name/svn_dir/repository_name/project

This will show you a list of each project directory in that repository.

Reviewing Changes - svn status

To see what files you have changed or added to your checked out work, use the update command:

UNIX

svn status

This command will give you a listing of new files, files that have been changed, and files that have been deleted. New files or deleted files must be added or removed using the add and delete commands (see more below.)

Adding New Files and Directories - svn add

When you add a new file or directory to a project that has been checked out, you must tell Subversion to include that file or directory in its version control.

UNIX

svn add file_or_dir_name

Adding a directory will add the directory and all the files and directories in it. However, this does not add the file or directory to the repository, you must still issue a commit to update the repository.

Deleting Files and Directories - svn delete

If you can add, you can also delete. If you wish to remove a file your directory from be versioned, you use the delete command:

UNIX

svn delete file_or_dir_name

Like add, you must perform a commit before the file is actually deleted from the repository.

However, the delete command does have another option not found in add. With the delete command you can remove files or directories from the repository. For example, the following command would remove a project and all the files under it.

Network

svn delete -m "Deleting project dir" http://localhost/svn_dir/repository/project_dir

This version of the command comes in particulary useful if someone has accidently imported files into the wrong place (I wouldn't know about that myself of course.)

Committing Changes - svn commit

Once you have added, deleted, or changed files or directories, you can then commit those changes to the repository. This command is pretty straightforward:

Network

svn commit -m "Saving recent changes" http://localhost/svn_dir/repository/project_dir

Updating Your Local Files - svn update

If you have a set of files checked out and would like to update them to the most recent version of files in the repository, use the update command.

Network

svn update

If there are newer files in the repository, they will overwrite any files you have locally. Before using this command, you may want to use the svn diff command to find out what the differences are between your local files and the repository.

Tagging Projects or Creating Project Specific Versions

Subversion does not track the version numbers for individual projects automatically. Instead, it tracks each update to the repository and tracks the versions of these updates. To create interim project releases, you must create "Tags" which identify a specify version of a project. This is done by making a virtual copy of a project in the tags directory. For example:

svn copy http://host_name/repos/project/trunk http://host_name/repos/project/tags/0.1.0 -m "Tagging the 0.1.0 release of the project"

This creates a sort of bookmark or snapshot which records the current state of the project. Then, you can checkout the project in this state at any time by simply referring to that release number.

To get a list of the releases for a project.

svn list http://192.168.0.4/svn/repos/prj1/tags
0.1.0/

Then to check out a release you would type:

svn list http://192.168.0.4/svn/repos/prj1/tags/0.1.0

A  0.1.0\dir1
A 0.1.0\dir1\file3
A 0.1.0\dir1\file4
A 0.1.0\file1
A 0.1.0\file2
A 0.1.0\textfile.txt
A 0.1.0\file3
Checked out revision 13.

Since the project has been saved in the tags directory. Release 0.1.0 can be retrieved at any time in the future.

Basic Apache Setup

You must use Apache 2.0 to install Subversion. Just compile and copy or copy the Subversion Apache module into the Apache modules directory. The following two files must be uncommented or added to the httpd.conf file:

  LoadModule dav_module         modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so

Next, you must setup a location directive in the httpd.conf file to associate a directory with Subversion repositories. This example uses the SVNParentPath setting to point to a parent directory which contains repository subdirectories. This is convenient as it allows you to add as many repositories as you need without having to restart Apache or modify the httpd.conf file.

  
DAV svn

# All repos subdirs of d:/svn
SVNParentPath D:/svn

Note:When using Fink to install Subversion on Mac OS X, the Subversion Apache module is stored in the Fink package listing with the prefix: libapache2. The package full name is libapache2-mod-svn. If you are using Fink, it will automatically install the modules into the correct directory.

General Notes

Below are a list of notes from initial setup and testing.

  • Subversion versions the repository, not individual projects. For example, I have two projects, project 1 and project 2, and check out each project when the current repository version is 3. I make changes to each project and commit those changes back to the repository. For each change, the revision number is incremented in the repository and its current version is now 5. The current revision of each project will also be 5 as they have no separate revision number.
  • To setup the Subversion module on Apache for Windows, I had to give the Apache Service access to the local file system. This is done on Windows by setting up a login account for the service. Setup an account in the Users application in Control Panel, make sure to set the password. Once this is done, go to the Services tool in Control Panel. Change the login for the Service to the account you created. XP will automatically give the Login as a Service privilege to the account (the OS must do this as the tools are not available XP Home, only in XP Pro). Once you do this and start and stop the Apache Service, you should be able to read and write to the repository directories. Note: Setting up a log in account for a Service can create a security hole. Consider your security requirements before doing this.
  • Individual files and directories that did not exist during the initial import, must be added individually using the svn add command.

2010年11月10日星期三

硬盘安装Ubuntu 9.04 实现Ubuntu 和 windows 双系统共存

http://blog.csdn.net/youngway520/archive/2009/10/13/4662258.aspx

http://www.linuxidc.com/Linux/2009-11/23078p3.htm

2010年11月4日星期四

BBN code

bbn802111_cop/branches/usrp2_version/gr-bbn/src/examples$ bbn_80211b_rx.py -b -f 2.412G -d 4 -v | tee regression_unsync_01.txtfind_usrps

TinyOS search engine

http://www.google.com/cse/home?cx=000490616372089452102%3Ajdf9nzpy7se

2010年10月27日星期三

Run Matlab in Linux

@ Ubuntu

You can use the matlab by using "ssh -X nam@lion.cs.uh.edu".
After logging in, you can type "matlab" to activate the program.

@ Window

Install PuTTY and Xming

Setting up X11 tunneling

First of all make sure that you have a recent version of PuTTY which supports X11 tunneling. You can get it from this page.

It is now time to bring up PuTTY, so do so! Select the category "Connection/SSH/Tunnels". Check the "Enable X11 forwarding" box and fill out the text field below with the address of your X11 server. The format is either "IP address:display" or "host name:display". You will most likely be using display 0 (zero), but you will probably know if not. If your X11 server is not running on the local computer, you must be able to trust the network between your local machine and your X11 server. If your X11 server runs on the same computer as PuTTY, put "127.0.0.1:0" in the text box.

2010年10月26日星期二

Debian networking setup ZZ

http://www.debian-administration.org/articles/254

An introduction to Debian networking setup

Posted by Steve on Sun 25 Sep 2005 at 13:32

Under Debian networking is pretty comparable to other distributions of GNU/Linux, especially in areas such as DNS setup. However if you're new to the distribution you might not know where things are set. This brief introduction to networking will show you how it works.

Most likely there are only four things you will care about:

  • Setting up your hostname
  • Setting up DNS.
  • Setting up your IP address.
  • Setting your default gateway.
Setting your hostname

Setting up your hostname upon a Debian installation is very straightforward. You can directly query, or set, the hostname with the hostname command.

As an user you can see your current hostname with:

skx@lappy:~$ /bin/hostname
lappy

To set the hostname directly you can become root and run:

/bin/hostname newname

When your system boots it will automatically read the hostname from the file /etc/hostname - so if you wish to make a permanent change then you should edit that file, and your change will then be made at bootup time automatically.

Setting up DNS

When it comes to DNS setup Debian doesn't differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static lokups.

To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.

For example a machine which should perform lookups from the DNS server at IP address 192.168.1.1 would have a resolv.conf file looking like this:

search my.flat
nameserver 192.168.1.1

(Here the search my.flat causes lookups of hostnames to have my.flat appended to them. So lappy would be looked up as lappy.my.flat)

Setting up your IP address.

The IP addresses associated with any network cards you might have are read from the file /etc/network/interfaces. This file has documentation you can read with:

man interfaces

A sample entry for a machine with a static address would look something like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.90
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

Here we've setup the IP addresss (192.168.1.90), the default gateway (192.168.1.1), and the netmask.

For a machine running DHCP the setup would look much simpler:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

(If you're using a DHCP based setup you must have a DHCP client package installed - usually one of pump or dhcp-client.)

If you make changes to this file you can cause them to take effect by running:

/etc/init.d/networking restart
Setting your default gateway.

If you read the previous section then you'll see that the default route for a host with a static IP address can be set in /etc/network/interfaces.

If you wish to view your current default route/gateway then you can run:

lappy:~# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

Alternatively you can use the route command:

lappy:~# /sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default router 0.0.0.0 UG 0 0 0 eth0

(Here the see the hostname router instead of the IP address 192.168.1.1 - to avoid that run "/sbin/route -n").

To change your default route you must first remove the current one:

/sbin/route del default gw 192.168.1.1

Once this has done you'll have no gateway and be unable to talk to non-local hosts.

Add the new route with :

/sbin/route add default gw 192.168.1.100
Share/Save/Bookmark

Start reading the books regularly!!!

1) Python

2) Detection and Estimation theory

Regularly reading books at morning

Using SSH to zip files

tar.gz is better for linux

so, to compress
tar -cvzf filename.tar.gz /home/path
and to decompress
tar -xvzf filename
Upload the file to server:
scp file user:password@host:/path

2010年10月21日星期四

Classify the channel environment

The possible solutions includes:

1) Using Kolmogorov-Smirnov test
--> Try to find the difference D on the CDF of received envelope
--> In our case, we can compute received signal envelope by using RSSI and noise floor over some time period.
--> Two Ds are needed to classify three channel models.
--> Cons: computation complexity; the threshold is a critical parameter
http://www.physics.csbsju.edu/stats/KS-test.html


2) Kurtosis index
--> not only for classification, but also identify the quality of link (seem to reflect SNR)
--> Kurtosis is the degree of peakedness of a distribution.
http://mvpprograms.com/help/mvpstats/distributions/SkewnessKurtosis
http://davidmlane.com/hyperstat/A53638.html
http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm

I believe we can use both Skewness and Kurtosis to classify, even for a fine classification.

CGRAN link for gnuradio

https://www.cgran.org/

Fix MBR for Ubuntu ZZ

在win7下卸载ubuntu直接删除ubuntu的分区会导致grub破坏,开机进不了系统,修复方式如下:

第一种方法:
1.下载fixmbr工具,放在c盘,利用命令提示符,进入软件所在目录,cd c:\fixmbr (cd后面一个空格)

2.输入 MBRFix /drive 0 fixmbr /yes

3.重启,发现直接进入win7,现在可以格式化ubuntu所在分区了
这种方法中下载的fixmbr工具必须是最新版,不然在win7下用不起来
第二种方法:
用带dos的启动盘或者启动u盘启动到dos,运行 fdisk /mbr
第三种方法:
用win7或者vista的光盘修复,从光盘启动,然后选择修复系统,再选择命令提示符,输入:bootrec /fixmbr提示完成后继续输入:bootrec /fixboot

2010年10月18日星期一

To be a good Phd student ZZ

Work hard and play hard!

Be focused especially in face of stumbling blocks

Disciplined in time management

Pace your publication

More theory courses at the early stage


----------- from my advisor's note

2010年10月9日星期六

Networking Over White Spaces (KNOWS)

To the best of our knowledge this is the first urban WSN. (Click here for deployment pictures)

Technologies tested include:

    • An opportunistic data network in the UHF and VHF bands
    • Channel occupancy database service with real-time Longley-Rice RF propagation modeling over NASA Terrain Data
    • Coexistence with wireless microphones
    • Handling mobile clients
    • Varying channel widths to accommodate varying needs of the application

http://research.microsoft.com/en-us/projects/KNOWS/deployment.aspx

Connecting to multiple IEEE 802.11 networks with one WiFi card

virtualwifi

http://research.microsoft.com/en-us/um/redmond/projects/virtualwifi/

2010年10月7日星期四

I am Back :)

Just come back from China and enjoy a great long vacation :)

Start working hard for the brand new life!

2010年9月1日星期三

LaTeX Tips ZZ

http://www.bgu.ac.il/~sgabriel/latextips.html

Contents:

Math

Compound math symbols

To produce a compound math symbold, e.g., a right arrow with, e.g., the text 'Lemma 1.2' on top, use:
$\stackrel{\mbox{\tiny Lemma 1.2}}{\Rightarrow}$
Another example:
$\stackrel{def}{\equiv}$

Overbrace/Underbrace

To have math with overbrace or underbrace, use:
$\overbrace{x+y}^{sum}=\underbrace{x \cdot y}_{\mbox{product}}$

Multi-valued Functions

To state a multi valued function, use:
$$
z = \left\{
\begin{array}{ll}
1 & x >0 \\
0 & \mbox{otherwise}
\end{array}
\right.
$$

Equation arrays with (some) equation numbers

The eqnarray environment produces a math-mode environment with an array of 3 columns aligned {rcl}. E.g.
\begin{eqnarray}
|O| & \leq & |O \setminus A| + |A| \leq \label{eq:start} \\
& \leq & |A| + |A| \leq \nonumber \\
& \leq & 2|A|
\end{eqnarray}
Notice the \nonumber on the second line which omits the number. If all lines should be number-less, you can use \begin{eqnarray*} instead of \begin{eqnarray}.

Page Settings

Fullpage

In order to have text written on entire page, consider using the fullpage package, with the additional
\addtolength{\voffset}{-1.0cm}
\addtolength{\textheight}{3.5cm}

Explicitly Determining Page Margins

Consider using the geometric package, e.g.
\usepackage[hmargin=2.5cm,vmargin=4cm]{geometry}
produces 2.5cm left/right margins, and 4cm top/bottom margins (no need to manipulate any other offsets or heights).

Headers and Footers

Use the fancyhdr package, e.g.
\usepackage{fancyhdr}
\pagestyle{fancy} % sets the pagestyle to use fancy headers
\fancyhead{} % clear header
\fancyfoot{} % clear footer
\fancyfoot[CO,CE]{\thepage} % replaces the page number to the [C]enter of the footer, in both [O]dd and [E]ven pages
\fancyhead[LO,LE]{ABC} % puts 'ABC' on the header's [L]eft side, on both [O]dd and [E]ven pages
\fancyhead[CO,CE]{DEF} % puts 'DEF' on the header's [C]enter, on both [O]dd and [E]ven pages
\fancyhead[RO,RE]{GHI} % puts 'GHI' on the header's [R]ight side, on both [O]dd and [E]ven pages
One can of course distinguish between the header/footer that appears on odd and even pages.

Line Numbers

In order to have line numbers on the output, consider using the (somewhat buggy, but pretty straightforward) lineno package.

Put \linenumbers to have linenumbers run through the entire document, or \pagewiselinenumbers to have linenumbers reset to 1 at every page. Put either of these commands where you want the linenumbers to begin.

Watermarks and 'draft' version

In order to have a watermark sentence (e.g. ''Draft''), use the draftcopy package, with the additional parameters:
\usepackage[...]{draftcopy}
Where instead of [...] use a comma-separated list of parameters taken from the following:
none
Dont print DRAFT across any page
first
Print DRAFT across first page only
firsttwo
Print DRAFT across two first pages only
all
print DRAFT across all pages
bottom
print DRAFT on the bottom of all pages
bottomafter
print DRAFT on the bottom of all pages following the ones who have DRAFT across
light
print DRAFT in light gray
dark
print DRAFT in dark gray
In order to choose the sentence printed (instead of DRAFT), use the command
\draftcopyName{...}{...}
where the first argument is the sentence to be printed, and the second argument is the scaling factor (start from about 50). This command should appear before the \begin{document} command.

Slides

printing slides k-up

To print slides in k-up, use the unix command
psnup -r -k presentation.ps presentation_k.ps

Tables

vertical spacing - space between rows

To adjust the vertical space between rows, i.e. - increase the space between the text and the top/bottom \hline commands, put the following in the preamble:
% Adds a space between the text and the [T]op \hline
\newcommand\T{\rule{0pt}{3.1ex}}

% Adds a space between the text and the [B]ottom \hline
\newcommand\B{\rule[-1.7ex]{0pt}{0pt}}
one can then use \T and/or \B inside a cell in the row, i.e. after some text in the row, to get extra space between the text and the \hline. These commands will not work if placed between rows. E.g.
\begin{tabular}{ll}
\hline
% \T and \B would not work if it is placed here (needs to go inside cell)
Col1 \T \B & Col2 \\
\hline
$\sqrt{\frac{1}{2}}$ \T & more space from top \verb+\hline+ \\
$\sqrt{\frac{1}{2}}$ & no added space \\
$\sqrt{\frac{1}{2}}$ \B & more space from bottom \verb+\hline+ \\
\hline
\end{tabular}
and
\begin{tabular}{ll}
\hline
Col1 & Col2 \\
\hline
$\sqrt{\frac{1}{2}}$ & no extra space from top \verb+\hline+ \\
$\sqrt{\frac{1}{2}}$ & no added space \\
$\sqrt{\frac{1}{2}}$ & no extra space from bottom \verb+\hline+ \\
\hline
\end{tabular}

Fixed width columns

To have fixed width columns, the simplest way is to use the 'p' alignment argument (instead of r/c/l). E.g.
\begin{tabular}{p{1in}p{2in}}

Figures

Images with math (via xfig)

To create images using xfig with math text, do the following:

In xfig:
  • Choose text, and make sure the following settings are set:
    • Under Text Flags in the bottom, make sure the Special Flag is Special (and not Normal). This can be automated by using the flag
      -specialtext -latexfonts -startlatexFont default
      when invoking xfig.
    • In Pen Color, make sure the color is Default (and not Black which is usually the case when you start xfig).
  • Write the text you like. If you want to write in math mode, make sure to write things between \$'s.
  • Save the image as .fig file.
  • Export the image to both .pstex and .pstex_t. In new versions of xfig this is done automatically by choosing Combined PS/LaTeX (both parts).
Afterwards:
  • Make sure the two generated files are in your working directory.
  • Use the graphics package.
  • Use the following code to insert a figure named fig.pstex_t, with a scaling factor 0.5
     \begin{figure}[h]
    \begin{center}
    \scalebox{0.5}{\input{fig1.pstex_t}}
    \caption{This is figure 1}
    \label{fig:fig1}
    \end{center}
    \end{figure}

Inserting an .eps figure

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{epsfig}
\begin{document}
\begin{figure}[h]
\centerline{
\epsfig{file=epsfig.eps, scale=0.5}
}
\caption{Some EPS figure}
\label{fig:fig1}
\end{figure}
\end{document}

Converting PStricks/pstex_t to EPS

Assuing the pstricks-figure/pstex_t is in file figfile, use a latex file (say, texfigfile.tex) containing:
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{epsfig}
\begin{document}
\thispagestyle{empty} % omits page numbers.
\input{figfile}
\end{document}
The \thispagestyle{empty} is necessary for the bounding box to be defined properly by dvips. Then do
latex texfigfile.tex
dvips texfigfile.dvi -E
Note: the generated file might be a .ps file. However, one can still insert it like any other .eps figure.

Images with pdflatex

Converting images to .pdf
When using pdflatex, images should be converted to .pdf.
  • Converting .eps to .pdf:
    use epstopdf.
    Note that you might need to adjust the bounding box of the .eps file before performing the epstopdf. This can be done manually by opening the .eps file in GhostView, checking the coordinates of the lower-left and upper-right boundries of the actual figure, opening the .eps file in any text editor, and changing the bounding box to the correct coordinates.
  • Converting .pstex_t and .pstex directly to .pdf:
    use the UNIX script pstex2pdf defined by:
     #!/bin/csh
    echo "epstopdf $1.pstex"
    epstopdf $1.pstex
    perl -p -i -e "s/.pstex//;" $1.pstex_t
Inserting an image
One should add to the preamble
\usepackage{epsfig}
\usepackage{graphics}
To insert an image, named e.g. pdffig.pdf, use:
\begin{figure}[h]
\centerline{
\includegraphics[scale=0.5]{pdffig}
}
\caption{Some caption}
\label{fig:pdffig1}
\end{figure}
Note that the 'original' files, i.e., the .pstex_t|.pstex|.eps files, should be present in the working directory as well.

pstex missing

When using the Combined PS/LaTeX format in exporting from xfig, two files are generated:

[figname].pstex - contains the graphical information. This is basically an .eps file.

[figname].pstex_t - contains the latex text information.

The [figname].pstex_t file uses \includegraphics{[figname].pstex} to include the graphical info. When compiling from different directories, it is important to make sure that right path appears in the \includegraphics command, namely, that it has the form \includegraphics{PATH/[figname].pstex}

Inserting .jpg images

To insert an image, named e.g. image.jpg, use:
\begin{figure}[h]
\centerline{
\includegraphics[width=120mm]{image.jpg}
}
\caption{Some caption}
\label{fig:image1}
\end{figure}
Remember to specify the 'width' argument.

Algorithms

General use

To use the algorithm environment, use the packages
\usepackage{algorithm}
\usepackage{algpseudocode}
An example of an algorithm is given by:
\begin{algorithm}{}
\caption{MyAlgorithmName (...arguments...)}
\label{alg:myalgorithmname}
\begin{algorithmic}[1]
\For{all ...}
\State do ...
\EndFor
\State return ...
\end{algorithmic}
\end{algorithm}

Changing the type of caption

Sometimes one wants to use the algorithm environment so that instead of Algorithm, one has a different caption, e.g. Protocol, Heuristic, etc. To do this, use the line
\floatname{algorithm}{[New Name]}
just before the algorithm code. E.g., to produce a Protocol, use
\floatname{algorithm}{Protocol}
\begin{algorithm}{}
\caption{MyProtocolName (...arguments...)}
\label{alg:myprotocolname}
\begin{algorithmic}[1]
...
\end{algorithmic}
\end{algorithm}

Bibliography

Using a BibTeX file

To insert the bibliography from a .bib file (e.g. mybib.bib), add the commands
\bibliographystyle{plain}
\bibliography{mybib}
For different styles, see http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html

Producing all entries in the .bib file

To produce the list of all entries in the .bib file, add the command
\nocite{*}
just before the \bibliography{mybib} command, where the bibliography file is mybib.bib.

Contorling bibliography paramaters

The natbib package provides multiple functionalities. E.g.
\setlength{\bibsep}{2pt}
determines the space between bib entries.
\renewcommand{\bibfont}{\small}
determines the font used for bib entries.

Contorling bibliography section header

To change the text in the bibliography section header (e.g., to produce 'Bibliography', instead of 'References'), use
\renewcommand\refname{Bibliography}
just before the bibliography section.

PDF

From .tex to A4 .pdf

To produce a pdf for paper size A4, make sure the \documentclass command is defined properly, e.g.,
\documentclass[a4paper,11pt]{article}
Use dvips with the switch
-G0 -Ppdf -t A4Size
followed by ps2pdf with the switch
-sPAPERSIZE=a4
This solves the problem of having incorrect header/footer margins.

Fonts

Highlighting text

To produce highlighted text use the soul package, and put the highlighted text in an \hl{...} environment (the default is yellow highlighting). I.e., use
\usepackage{color,soul}
...
This text would be \hl{highlighted} now.
If one omits the color package, the \hl{...} environment produces an underline.

User Defined Font Size

Sometimes, the predefined \normalsize, \small, \huge, etc., font sizes do not suffice. To produce a userdefined font size one can use the command:
\newcommand{\myfontsize}{\fontsize{9}{11}\selectfont}
where the first argument gives the height of the font (in pt), and the second argument gives the height of the line (in pt).
E.g., the above \myfontsize produces a fontsize that is between \small and \tiny.

Matlab Tips ZZ

http://www.bgu.ac.il/~sgabriel/matlabtips.html

Contents:

Run Matlab in the Background

Unix C-shell Script

Save the following script in a file, say matlab-in-background, and make it executable:
#!/bin/csh -f
unsetenv DISPLAY
nohup matlab < $1 > $2 &

Usage

Run the command:
matlab-in-background [input] [output]
where [input] is the script file to run by matlab, and [output] is the file to which the output should be dumped into.

Misc Tips

functions on a field in an array of structures

Assume a structure, e.g., packet, with the fields
packet.arrivalTime
packet.departureTime
Assume an array of structures, e.g., traffic, where for every i, traffic(i) is a packet. To compute a function of one of the fields, over all structures in the array, use the cat() function. E.g., in order to compute the maximum arrival time of a packet in the traffic, use:
max(cat(1,traffic.arrivalTime))
This concatenates the values of the field arrivalTime of all entries in the traffic structure array into a 1-dimensional matrix, thus enabling running the max() function on the array of reals.

2010年8月26日星期四

enovo Think产品IWS(全球联保)申请指南 ZZ

http://www.weigblog.com/2008/07/18/apply-lenovo-think-iws.html

2010年8月16日星期一

ubuntu 10.04 problem: Kernel panic - not syncing

After updating the package lists in Ubuntu 10.04 as well as BIOS (probably),
there is the error messenger when booting from Ubuntu, as follows:
[ 1.901413] Kernel panic - not syncing : VFS: Unable to mount root fs on unknown-block(0,0)

The reason of the problem: it seems like the linux image(or Kernel) file on disk is broken.

The way to solve: (try to recompile the kernel in your system.)
cd /boot/
mkinitramfs -o initrd.img-2.6.34-rc6-custom 2.6.34-rc6-custom
update-grub
reboot the system.

There you go! :)

2010年8月14日星期六

Install GNU Radio on Mac OS X (ZZ)

http://staff.washington.edu/jon/gr-osx/gr-osx.html

maintained by this amazing biology guy
wow~~

How to use CP command in linux (or ubuntu) ZZ

To make a copy of a file in the current directory, enter:
cp prog.c prog.bak

To copy a file in your current directory into another directory, enter:
cp jones /home/nick/clients

To copy all the files in a directory to a new directory, enter:
cp /home/janet/clients/* /home/nick/customers
To copy a directory, including all its files and subdirectories, to another directory, enter:
cp -R /home/nick/clients /home/nick/customers

To use pattern-matching characters to copy files, enter:

cp programs/*.c .
This copies the files in the programs directory that end with .c to the
current directory, signified by the single . (dot). You must type a
space between the c and the final dot.

2010年8月10日星期二

Andriod applications

http://blog.csdn.net/Android_Tutor

How to restore the Ubuntu/XP/Vista/7 bootloader (Updated for Ubuntu 9.10) ZZ

This How-to is for windows dual booters who reinstall an operating system only to find that it has taken away access to their other operating system.
Whether you want to restore the XP, Vista, 7 or Ubuntu (Grub) bootloader, this guide will walk you through it.

All three parts of this tutorial require that you boot from a cd. If you don't know how to do this, check here.

If you have made a mistake and want to revert the changes, simply follow the instructions for reinstalling the previous bootloader. For example, if you have installed vista over ubuntu, try to get the ubuntu bootloader back, but want to get the vista bootloader back, simply follow my instructions for installing the vista bootloader.


How to restore the Ubuntu grub bootloader (9.10 and beyond)

First you need to find out what your drives are called. You can do this by going to a terminal and typing:
Code:
sudo fdisk -l
From that you need to find the device name of your Ubuntu drive, something like “/dev/sda5″.
So, still in the terminal, type:
Code:
sudo mkdir /media/sda5

sudo mount /dev/sda5 /media/sda5
And then, to reinstall the grub:
Code:
sudo grub-install --root-directory=/media/sda5 /dev/sda
Push enter and you’re done! Of course you need to replace “/dev/sda5″ and “/dev/sda” with what you found in the fdisk output.

How to restore the Ubuntu grub bootloader (9.04 and older)

First of all, all credit for this part of the tutorial goes to catlet. I am simply rewriting his tutorial to have all three bootloaders in this tutorial.

So, lets begin. To restore the grub, you must boot off the ubuntu live cd. Any ubuntu live cd will do.

Once there, open a terminal (Applications>Accessories>Terminal) and type this:

Code:
sudo grub
Next, you need to find which hard drive ubuntu and the grub is installed to. You do this by running this command:

Code:
find /boot/grub/stage1
Take note of what it returns (something like (hd0,1).)

Now you need to tell Grub where it is installed. Using the output of the last command, change this one and run it:

Code:
root (hd,)
Replacing and with what you got back before. For example, if "find /boot/grub/stage1" gave me "(hd0,1)", you would run "root (hd0,1)"

Ok, so thats the configuration over and done with. Now we just need to run one command to install the Grub to your hard drive:

Code:
setup (hd0)
Now to quit and check if it has worked:

Code:
quit
Code:
sudo reboot
Make sure you have taken the live cd out of your disc tray. All going well, you should start back up and see the grub once again.


How to restore the Windows XP bootloader

For this you will need your Windows XP installation CD. Boot into it now.

You will get to a part where it asks if you want to repair or recover. To do so, press "r".

If prompted, enter your Windows XP administrator password. This will leave you at at a command line, so type in the following two commands:

Code:
fixboot
Code:
fixmbr
Then type
Code:
exit
then remove your XP cd. If everything has gone well, you should come to your XP bootloader.


How to restore the Windows Vista or 7 bootloader

To restore the Windows Vista/7 bootloader, you must first boot off your Windows Vista/7 installation DVD.
If you have one of the many OEM computers that didnt come with a Vista/7 installation disk, you can get the same effect with a Vista recovery disk, which you can download for
Vista or Win 7.
When you get to the Regional settings, select your Location/Keyboard setting then click next. On the next page you must click on "Repair your computer."

On the next page, if it finds your Windows Vista/7 installation, make sure it is UNSELECTED before clicking next.
Then click on "Command prompt". From there, type in the folowing:

Code:
bootrec.exe /fixboot
Code:
bootrec.exe /fixmbr
Now close the two windows and click "Restart."

Take out your Vista/7 DVD and hopefully, you will be left with your Windows Vista/7 Bootloader.

2010年8月9日星期一

ubuntu崩溃后怎么挽救数据ZZ

1.首先从livecd启动
2.非wubi安装(假设安装到第一个扩展分区),挂载分区,将数据导出来。
代码:
sudo mount /dev/sdaX /mnt

3.wubi安装(假设安装到第一个扩展分区),先挂载分区
代码:
sudo mount /dev/sdaX /mnt

接下来用loop设备挂载虚拟磁盘文件,再将数据导出来。
代码:
sudo mount /mnt/ubuntu/disks/root.disk /media -o loop

2010年8月5日星期四

Reinstalling GRUB 2 (ZZ)

https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD

重装Windows7后,Ubuntu无法启动的解决方案ZZ

经过不懈的努力与查论坛资料,找出了可行的一套方案
需要注意的是,与重装XP不一样,因为Longhorn系列的系统引进了bcd启动的bootmgr机制,
和过去XP与之前时代的boot.ini是完全不同的,所以相对于Vista和最新的Windows 7系统来说,boot.ini不行

废话少说下面就是方案
---------------------------------------------
如果你有LiveCD,那么就会很容易解决
随光盘启动,在终端下输入
代码:
sudo su

密码确认再输入
代码:
grub


随后在grub>提示符下输入
代码:
root (hdx,y)
setup (hdx)

请注意,这里的x是指硬盘号,y表示分区号
通常情况下,我们只使用一个硬盘,因此x为0
分区号,我们假设你的ubuntu在第n个分区,那么y=n-1
我的ubuntu在分区5上,因此我需要输入
代码:
root (hd0,4)
setup (hd0)

关于到底是第几个分区的问题,如果你不清楚,那么可以挨个地试,1,2,3,4,5...



如果你没有LiveCD,那么需要做更多的工作
1.下载grub4dos,下载地址:http://sourceforge.net/projects/grub4dos
2.解压后,将grldr与grldr.mbr文件复制到C盘根目录下
3.在Vista下找到 开始-附件-命令行,在命令行这一项上面鼠标点击右键选择“使用管理员权限运行”
4.在cmd下输入如下命令:
代码:
bcdedit /create /d "GRUB" /application bootsector

系统会返回一个长串的id号,下面需要用到这个变量,继续输入
代码:
bcdedit /set {id} device partition=C:
bcdedit /set {id} path \grldr.mbr
bcdedit /displayorder {id} /addlast

注意!这里的{id}就是上面获得的变量,请注意小心核对输入,输错一个就基本面临崩溃了

5.下载一个可以在windows下查看linux分区的工具
关于这个问题,我不知道是否是我系统的关系,无法用explore2fs来查看ext3分区,通常你可以下载explore2fs这个工具在windows下查看ubuntu的分区。下载地址:http://www.chrysocome.net/downloads
我个人推荐另一款工具,因为explore2fs无论如何我都用不了,地址:http://www.eisoo.com/cn/professional/diskgenius/download.htm
这个工具叫做DiskGenius

6.通过这个工具,将ubuntu分区上,/boot/grub/menu.lst文件复制到C盘根目录下
7.重启系统,在系统选单中选择GRUB
8.进入Ubuntu后,你可以在终端上重复我开头时livecd提到的操作
sudo su
grub
root (hdx,y)
setup (hdx)
详情请看上面的livecd时的操作
9.Done

这样,工作就完成了,加入你重新安装的vista或windows7并不在原先的分区上,那么你可以进一步在你的ubuntu下修改menu.lst。另外,如果你觉得windows选单下的GRUB变得多余,你可以用easyBCD工具去除。

我感觉很奇怪的时,以上cmd命令行操作中的内容虽然确实也可以用easyBCD等工具来完成,但是我用easyBCD做出来的引导老是出问题,我也就没有去细想问题出在哪儿,总之直接用上面的方法就好了
这则方案参考了http://forum.ubuntu.org.cn/viewtopic.php?f=139&t=148913&start=15 这张帖子里面,fishtear的方法,不过他们那个时wubi安装的就是了。

2010年8月3日星期二

Install Win 7 from XP without using CD Drive

  1、下载windows 7 7057ISO镜像(RC或RTM),用虚拟光驱拷贝至非C盘(如D:\7057)

  2、把D:\7057目录下的bootmgr和boot目录(其实只要里面的boot.sdi和bcd文件)拷贝到c盘根目录下,并在C盘根目录下建 个sources文件夹。(XP下不需要取得管理员权限)

  3、把D:\7057\sources下的boot.win复制到C盘刚建的sources文件夹

  4、用管理员身份运行cmd,然后输入c:\boot\bootsect.exe/nt60 c: 提示successful(即成功了!)

  5、关闭cmd窗口重启计算机,自动进入安装界面,选择安装语言,同时选择适合自己的时间和货币显示种类及键盘和输入方式

  6、出现“开始安装界面”,(要注意了,不点击“现在安装”)点左下角“修复计算机”(repair mycomputer),进入"系统恢复选择",选择最后一项"命令提示符"(commandprompt),进入DOS窗口

  7、输入“D:\7057\sources\setup.exe“(不带引号),开始安装

  8、选择安装语言、格式化C盘,就OK了

2010年8月2日星期一

Convert the data between matlab and gnuradio

-. Moving Data from MATLAB to GNU Radio

write_float_binary() : write the float value in matlab to the binary data in gnuradio.
write_complex_binary() : write the complex value in matlab to the binary data in gnuradio.

-. Moving the data from GNU Radio to Matlab:
read_float_binary()
read_complex_binary()

All the above functions are with extended name "*.m", which can be found in the folder "~/gnuradio/gnuradio-core/src/utils/"

2010年7月21日星期三

gnuradio functions and classes

To see all the definition of functions,
http://gnuradio.org/doc/doxygen/

2010年7月15日星期四

TinyOS programming assignments in Harvard Univ

http://www.eecs.harvard.edu/~mdw/course/cs263/assn1.html

2010年7月14日星期三

Locate something in Linux

If you try to find the term in anything documents in your computer,
and output the results,

We can use the basic *nix command line tools:

$ find . -print | xargs grep FILENAME

2010年7月12日星期一

Tutorial on setting DHCP and static IP

http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

2010年7月11日星期日

Capturing Signals in GNU Radio (ZZ)

Storing Data into a File
The output of any block (including the USRP) can be stored into a data file. Insert the following commands into the Python script:

audiodata = gr.file_sink(gr.sizeof_float, “audio.dat”)
self.connect(src0, audiodata)

This creates a sink named audiodata which will store its data (binary) into a file called audio.dat. The sink is then connected to the source or block that will be outputting the data to be collected. In this example we have used src0 to represent a source. In the event that the source/block outputs complex data, use

audiodata = gr.file_sink(gr.sizeof_complex, “audio.dat”)



Converting the Binary File to a MATLAB Readable Form

The file created above contains binary data that MATLAB (or Octave) does not know how to read. There is a set of .m files in gnuradio-core/src/utils that perform the needed conversions. In the case of a binary data file that contains floating-point data use:
read_float_binary.m

In the case of a binary file that contains complex data use
read_complex_binary.m

From Octave you can run these with:
audio1 = read_float_binary(‘audio.dat’);

and the resulting data will appear in a matrix called audio1.


Plotting the Data with Octave
You can create a plot of this data in Octave (assuming Gnuplot is also installed) with:
plot(audio1)

Plotting the Data with MATLAB
If you would like to create a data file that is readable by MATLAB you need to save the audio1 data in a MATLAB readable file. This can also be done from within Octave using:
save (“-v7”, “audio2.mat”, “audio1”)

The file audio2.mat can now be imported into MATLAB (Mac or PC).

2010年7月9日星期五

Helpful Python References

Change the permission of file in linux

Add the new user account for linux:

Useradd id

-. Changing file owner or group : chown, chgrp

For instance, if George decides to give ownership of myfile to Robert, he can simply type:

chown robert myfile

Also, if Robert later on decides to make the file only available to members of the group "SeniorAdmin" group rather than to those of the group "Administrators", he can type:

chgrp senioradmin myfile

(Yale Uninversity) Stephen C. Stearns 教授給研究生的建議 相見恨晚啊ZZ

Always Prepare for the Worst.

Some of the greatest catastrophes in graduate education could have been avoided by a little intelligent foresight. Be cynical. Assume that your proposed research might not work, and that one of your faculty advisers might become unsupportive - or even hostile. Plan for alternatives.

Nobody cares about you.

In fact, some professors care about you and some don't. Most probably do, but all are busy, which means in practice they cannot care about you because they don't have the time. You are on your own, and you had better get used to it. This has a lot of implications. Here are two important ones:

1. You had better decide early on that you are in charge of your program. The degree you get is yours to create. Your major professor can advise you and protect you to a certain extent from bureaucratic and financial demons, but he should not tell you what to do. That is up to you. If you need advice, ask for it: that's his job.

2. If you want to pick somebody's brains, you'll have to go to him or her, because they won't be coming to you.

You Must Know Why Your Work is Important.

When you first arrive, read and think widely and exhaustively for a year. Assume that everything you read is bullshit until the author manages to convince you that it isn't. If you do not understand something, don't feel bad - it's not your fault, it's the author's. He didn't write clearly enough.

If some authority figure tells you that you aren't accomplishing anything because you aren't taking courses and you aren't gathering data, tell him what you're up to. If he persists, tell him to bug off, because you know what you're doing, dammit.

This is a hard stage to get through because you will feel guilty about not getting going on your own research. You will continually be asking yourself, "What am I doing here?" Be patient. This stage is critical to your personal development and to maintaining the flow of new ideas into science. Here you decide what constitutes an important problem. You must arrive at this decision independently for two reasons. First, if someone hands you a problem, you won't feel that it is yours, you won't have that possessiveness that makes you want to work on it, defend it, fight for it, and make it come out beautifully. Secondly, your PhD work will shape your future. It is your choice of a field in which to carry out a life's work. It is also important to the dynamic of science that your entry be well thought out. This is one point where you can start a whole new area of research. Remember, what sense does it make to start gathering data if you don't know - and I mean really know - why you're doing it?

Psychological Problems are the Biggest Barrier.

You must establish a firm psychological stance early in your graduate career to keep from being buffeted by the many demands that will be made on your time. If you don't watch out, the pressures of course work, teaching, language requirements and who knows what else will push you around like a large, docile molecule in Brownian motion. Here are a few things to watch out for:

1. The initiation-rite nature of the PhD and its power to convince you that your value as a person is being judged. No matter how hard you try, you won't be able to avoid this one. No one does. It stems from the open-ended nature of the thesis problem. You have to decide what a "good" thesis is. A thesis can always be made better, which gets you into an infinite regress of possible improvements.

Recognize that you cannot produce a "perfect" thesis. There are going to be flaws in it, as there are in everything. Settle down to make it as good as you can within the limits of time, money, energy, encouragement and thought at your disposal.

You can alleviate this problem by jumping all the explicit hurdles early in the game. Get all of your course requirements and examinations out of the way as soon as possible. Not only do you thereby clear the decks for your thesis, but you also convince yourself, by successfully jumping each hurdle, that you probably are good enough after all.

2. Nothing elicits dominant behavior like subservient behavior. Expect and demand to be treated like a colleague. The paper requirements are the explicit hurdle you will have to jump, but the implicit hurdle is attaining the status of a colleague. Act like one and you'll be treated like one.

3. Graduate school is only one of the tools that you have at hand for shaping your own development. Be prepared to quit for awhile if something better comes up. There are three good reasons to do this.

First, a real opportunity could arise that is more productive and challenging than anything you could do in graduate school and that involves a long enough block of time to justify dropping out. Examples include field work in Africa on a project not directly related to your PhD work, a contract for software development, an opportunity to work as an aide in the nation's capital in the formulation of science policy, or an internship at a major newspaper or magazine as a science journalist.

Secondly, only by keeping this option open can you function with true independence as a graduate student. If you perceive graduate school as your only option, you will be psychologically labile, inclined to get a bit desperate and insecure, and you will not be able to give your best.

Thirdly, if things really are not working out for you, then you are only hurting yourself and denying resources to others by staying in graduate school. There are a lot of interesting things to do in life besides being a scientist, and in some the job market is a lot better. If science is not turning you on, perhaps you should try something else. However, do not go off half-cocked. This is a serious decision. Be sure to talk to fellow graduate students and sympathetic faculty before making up your mind.

Avoid Taking Lectures - They're Usually Inefficient.

If you already have a good background in your field, then minimize the number of additional courses you take. This recommendation may seem counterintuitive, but it has a sound basis. Right now, you need to learn how to think for yourself. This requires active engagement, not passive listening and regurgitation.

To learn to think, you need two things: large blocks of time, and as much one-on-one interaction as you can get with someone who thinks more clearly than you do.

Courses just get in the way, and if you are well motivated, then reading and discussion is much more efficient and broadening than lectures. It is often a good idea to get together with a few colleagues, organize a seminar on a subject of interest, and invite a few faculty to take part. They'll probably be delighted. After all, it will be interesting for them, they'll love your initiative - and it will give them credit for teaching a course for which they don't have to do any work. How can you lose?

These comments of course do not apply to courses that teach specific skills: e.g., electron microscopy, histological technique, scuba diving.

Write a Proposal and Get It Criticized.

A research proposal serves many functions.

1. By summarizing your year's thinking and reading, it ensures that you have gotten something out of it.

2. It makes it possible for you to defend your independence by providing a concrete demonstration that you used your time well.

3. It literally makes it possible for others to help you. What you have in mind is too complex to be communicated verbally - too subtle, and in too many parts. It must be put down in a well-organized, clearly and concisely written document that can be circulated to a few good minds. Only with a proposal before them can they give you constructive criticism.

4. You need practice writing. We all do.

5. Having located your problem and satisfied yourself that it is important, you will have to convince your colleagues that you are not totally demented and, in fact, deserve support. One way to organize a proposal to accomplish this goal is:

a. A brief statement of what you propose, couched as a question or hypothesis.

b. Why it is important scientifically, not why it is important to you personally, and how it fits into the broader scheme of ideas in your field.

c. A literature review that substantiates (b).

d. Describe your problem as a series of subproblems that can each be attacked in a series of small steps. Devise experiments, observations or analyses that will permit you to exclude alternatives at each stage. Line them up and start knocking them down. By transforming the big problem into a series of smaller ones, you always know what to do next, you lower the energy threshold to begin work, you identify the part that will take the longest or cause the most problems, and you have available a list of things to do when something doesn't work out.

6. Write down a list of the major problems that could arise and ruin the whole project. Then write down a list of alternatives that you will do if things actually do go wrong.

7. It is not a bad idea to design two or three projects and start them in parallel to see which one has the best practical chance of succeeding. There could be two or three model systems that all seem to have equally good chances on paper of providing appropriate tests for your ideas, but in fact practical problems may exclude some of them. It is much more efficient to discover this at the start than to design and execute two or three projects in succession after the first fail for practical reasons.

8. Pick a date for the presentation of your thesis and work backwards in constructing a schedule of how you are going to use your time. You can expect a stab of terror at this point. Don't worry - it goes on like this for awhile, then it gradually gets worse.

9. Spend two to three weeks writing the proposal after you've finished your reading, then give it to as many good critics as you can find. Hope that their comments are tough, and respond as constructively as you can.

10. Get at it. You already have the introduction to your thesis written, and you have only been here 12 to 18 months.

Manage Your Advisors.

Keep your advisors aware of what you are doing, but do not bother them. Be an interesting presence, not a pest. At least once a year, submit a written progress report 1-2 pages long on your own initiative. They will appreciate it and be impressed.

Anticipate and work to avoid personality problems. If you do not get along with your professors, change advisors early on. Be very careful about choosing your advisors in the first place. Most important is their interest in your interests.

Types of Theses.

Never elaborate a baroque excrescence on top of existing but shaky ideas. Go right to the foundations and test the implicit but unexamined assumptions of an important body of work, or lay the foundations for a new research thrust. There are, of course, other types of theses:

1. The classical thesis involves the formulation of a deductive model that makes novel and surprising predictions which you then test objectively and confirm under conditions unfavorable to the hypothesis. Rarely done and highly prized.

2. A critique of the foundations of an important body of research. Again, rare and valuable and a sure winner if properly executed.

3. The purely theoretical thesis. This takes courage, especially in a department loaded with bedrock empiricists, but can be pulled off if you are genuinely good at math and logic.

4. Gather data that someone else can synthesize. This is the worst kind of thesis, but in a pinch it will get you through. To certain kinds of people lots of data, even if they don't test a hypothesis, will always be impressive. At least the results show that you worked hard, a fact with which you can blackmail your committee into giving you the doctorate.

There are really as many kinds of theses as their are graduate students. The four types listed serve as limiting cases of the good, the bad, and the ugly. Doctoral work is a chance for you to try your hand at a number of different research styles and to discover which suites you best: theory, field work, or lab work. Ideally, you will balance all three and become the rare person who can translate the theory for the empiricists and the real world for the theoreticians.

Start Publishing Early.

Don't kid yourself. You may have gotten into this game out of your love for plants and animals, your curiosity about nature, and your drive to know the truth, but you won't be able to get a job and stay in it unless you publish. You need to publish substantial articles in internationally recognized, refereed journals. Without them, you can forget a career in science. This sounds brutal, but there are good reasons for it, and it can be a joyful challenge and fulfillment. Science is shared knowledge. Until the results are effectively communicated, they in effect do not exist. Publishing is part of the job, and until it is done, the work is not complete. You must master the skill of writing clear, concise, well-organized scientific papers. Here are some tips about getting into the publishing game.

1. Co-author a paper with someone who has more experience. Approach a professor who is working on an interesting project and offer your services in return for a junior authorship. He'll appreciate the help and will give you lots of good comments on the paper because his name will be on it.

2. Do not expect your first paper to be world-shattering. A lot of eminent people began with a minor piece of work. The amount of information reported in the average scientific paper may be less than you think. Work up to the major journals by publishing one or two short - but competent - papers in less well-recognized journals. You will quickly discover that no matter what the reputation of the journal, all editorial boards defend the quality of their product with jealous pride - and they should!

3. If it is good enough, publish your research proposal as a critical review paper. If it is publishable, you've probably chosen the right field to work in.

4. Do not write your thesis as a monograph. Write it as a series of publishable manuscripts, and submit them early enough so that at least one or two chapters of your thesis can be presented as reprints of published articles.

5. Buy and use a copy of Strunk and White's Elements of Style. Read it before you sit down to write your first paper, then read it again at least once a year for the next three or four years. Day's book, How to Write a Scientific Paper, is also excellent.

6. Get your work reviewed before you submit it to the journal by someone who has the time to criticize your writing as well as your ideas and organization.

Don't Look Down on a Master's Thesis.

The only reason not to do a master's is to fulfill the generally false conceit that you're too good for that sort of thing. The master's has a number of advantages.

1. It gives you a natural way of changing schools if you want to. You can use this to broaden your background. Moreover, your ideas on what constitutes an important problem will probably be changing rapidly at this stage of your development. Your knowledge of who is doing what, and where, will be expanding rapidly. If you decide to change universities, this is the best way to do it. You leave behind people satisfied with your performance and in a position to provide well-informed letters of recommendation. You arrive with most of your PhD requirements satisfied.

2. You get much-needed experience in research and writing in a context less threatening than doctoral research. You break yourself in gradually. In research, you learn the size of a soluble problem. People who have done master's work usually have a much easier time with the PhD.

3. You get a publication.

4. What's your hurry? If you enter the job market too quickly, you won´t be well prepared. Better to go a bit more slowly, build up a substantial background, and present yourself a bit later as a person with more and broader experience.

Publish Regularly, But Not Too Much.

The pressure to publish has corroded the quality of journals and the quality of intellectual life. It is far better to have published a few papers of high quality that are widely read than it is to have published a long string of minor articles that are quickly forgotten. You do have to be realistic. You will need publications to get a post-doc, and you will need more to get a faculty position and then tenure. However, to the extent that you can gather your work together in substantial packages of real quality, you will be doing both yourself and your field a favor.

Most people publish only a few papers that make any difference. Most papers are cited little or not at all. About 10% of the articles published receive 90% of the citations. A paper that is not cited is time and effort wasted. Go for quality, not for quantity. This will take courage and stubbornness, but you won't regret it. If you are publishing one or two carefully considered, substantial papers in good, refereed journals each year, you're doing very well - and you've taken time to do the job right.

Acknowledgements Thanks to Frank Pitelka for providing an opportunity, to Ray Huey for being a co-conspirator and sounding board and for providing a number of the comments presented here, to the various unknown graduate students who kept these ideas in circulation, and to Pete Morin for suggesting that I write them up for publication.

Some Useful References.

Day, R.A. 1983. How to write and publish a scientific paper. 2nd ed. iSi Press, Philadephia. 181 pp. wise and witty.

Smith, R.V. 1984. Graduate research - a guide for students in the sciences. iSi Press, Philadelphia. 182 pp. complete and practical.

Strunk, W. Jr, and E.B. White.1979. The elements of style. 3rd Ed. Macmillan, New York. 92 pp. the paradigm of concision.