Tuesday, December 16, 2008

install xen on ubuntu

enviroment: ubuntu 8.04 server

1. install required packages

a. apt-get install ubuntu-xen-server
b. apt-get install vnc4server


2. configure win01.cfg

kernel='/usr/lib/xen/boot/hvmloader'
builder='hvm'
memory='1024'
device_model='/usr/lib/xen/bin/qemu-dm'

# since xen3.2, file:/ is obseleted.
disk=['phy:/dev/loop0,ioemu:hda,w',
'phy:/dev/loop1,ioemu:hdc:cdrom,r']

name='win01'

vif=['type=ioemu,bridge=eth0']

# boot from cdrom
boot='d'
vnc=1
vnclisten='0.0.0.0'
vncviewer=1
sdl=0

# usb mouse
usb=1
usbdevice='tablet'


3. create disk

dd if=/dev/zero of=/home/xen/disk.img bs=1M count=8192
losetup /dev/loop0 /home/xen/disk.img
losetup /dev/loop1 /home/xen/w2k3.iso

4. xm create win01.cfg

Thursday, November 27, 2008

data center for differnet applications

There are three different data centers:
1. for web services such as kaixin001.com, douban.com, ...
2. for data mining platform
3. for MMORPG (网游)

For 1st type:

Application logic is relatively simple
Transcation is not necessary
latency V.S. Throughput
Each application uses Ad-hoc way to provide
- blob stroage - photo, image, music
- table storage - user profile, tags,
- computing - sns graph compute, user behavior mining, global summary (tag cloud, hot topics)

flexible & uniform platform
amazon web service, google app engine, windows azure

For 2nd type: we are actually building...

For 3rd type, MMORPG (网游)
- expensive and low efficiency solution (HPC)
- big business impact
- virtual world game (secondlife, hipihi)

Monday, October 13, 2008

gnuplot and dvipdfm

dvipdfm doesn't correctly handle an eps figure whose lower-left corner is not at (0,0). To solve this problem, you need change -dEPSCrop to -sPAPERSIZE=jisb0 /dvipdfm/config/config

see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=428014

Wednesday, September 24, 2008

sync time between a cluster of window servers

==================
最简单的方法域服务器进行时间同步
net time /domain:fareast /set /y

查看本地时钟偏差
w32tm /stripchart /computer:time.windows.com /samples:5

==================
1. setup a windows server as ntp server (配置 Windows 时间服务以使用内部硬件时钟)

a. under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\
b. set AnnounceFlags to 0x5
c. run ntpserver
under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\
set Enabled to 1
d. net stop w32time && net start w32time

2. sync clients to server's clock.

a. net time /setsntp:server_IP
b. Internet time -> update now.

reference:
http://support.microsoft.com/kb/314054

Wednesday, August 27, 2008

enable hibernate in vista for desktop

1. powercfg -h on
2. disable hybrid sleep in control panel.

reference: Turn off a computer: FAQ

Friday, July 18, 2008

Enable Mouse Wheel for vmware linux guest

在Debian下首先需要安装xserver-xorg-input-vmmouse,
然后再修改/etc/X11/xorg.conf

Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
EndSection

Thursday, July 17, 2008

Right click for Command Prompt (in Vista)

Add the following entries to your registry - you'll be able to right click and open any folder at the command line.

[HKEY_CLASSES_ROOT\Folder\shell\command]
@="Command & Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\command\command]
@="cmd.exe /K cd %L"

Friday, May 30, 2008

安装Canon打印机(cups)

1. 安装cups系统
cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps

Canon2900打印机使用capt驱动,需要进行特殊安装。
2. 下载最新的驱动
http://software.canon-europe.com/software/0028622.asp CAPTDRV160.tar.gz
3. 解压, 安装deb包
cndrvcups-common_1.60-1_i386.deb
cndrvcups-capt_1.60-1_i386.deb
4a. 进入cups web管理界面,添加打印机,注意选择对应的PPD文件。

4b. 命令行方式
I. Connect to samba
/usr/bin/smbclient -L NGN_PRINTER -U share
II. /usr/sbin/lpadmin -p ngnprinter -v smb://user:passwd@NGNPRINTER/CanonLBP1120 -P /root/CNCUPSLBP1120CAPTJ.PPD
/usr/bin/enable ngnprinter
/usr/sbin/accept ngnprinter
/usr/sbin/lpadmin -d ngnprinter

Wednesday, May 28, 2008

debian sarge to etch distribution upgrade

1. back up old system
dpkg --get-selections “*”

2. add new sources to /etc/apt/sources.list

3. Upgrading packages

# apt-get update
# apt-get install aptitude
# aptitude -f --with-recommends dist-upgrade

当遇到kernel的时候,选择删除。但是一定要选择安装新Kernel,否则系统无法启动。

参考:Upgrade Sarge to Etch

Tuesday, May 06, 2008

互联网带宽瓶颈和收费问题

据电信专家舒华英透露,目前宽带上95%的收入只占了5%的带宽,5%的收入来自于95%的带宽。类似BT下载等都无法为运营商带来收入,却使用了很高的带宽。而短信彩铃、语音通话等占带宽很低,收入却高。结果导致运营商不愿意扩容。


信产部官员表示要防宽带塞车但不封杀P2P

Thursday, April 24, 2008

cygwin on windows xp

由于以后要逐渐开始使用windows操作环境,现在开始熟悉cygwin下面的操作:

安装
1. 从http://cygwin.com 下载setup.exe运行
2. 选择Direct Connection
3. 选择安装的Packages
4. 安装

配置
1. 使用cygwin中的rxvt
2. 创建快捷方式

C:\cygwin\bin\rxvt.exe -e C:\cygwin\bin\bash.exe --login --rcfile %HOME%/.bashrc

Tuesday, April 22, 2008

HTC P6500试用

今天搞到一台HTC P6500,试用了一下,安装了如下软件:
1. 无线网络配置:笔记本和P6500都配置为Ad-hoc模式,笔记被配置为路由器。

2. Opera 8.60: HTC P6500的proxy有点问题,无论设置与否,wifi连接都不会试用proxy. opera 8.65只能试用系统默认配置,而8.60可以配置自己的代理。

3. 中文显式和中文输入法


参考http://gradinfo.net.edu.cn/~lgh/htcp6500/

Tuesday, March 04, 2008

论文进展

1. 经过一段时间的奋斗,前天终于把几个好些的部分写完了。现在只剩下最后一章了。
2. 今天把终结报告也发给老板了。希望能快点和他讨论,把终结报告的最终时间确定下来。
3. 下一步就是要把最后那一章写完了。大约分三步
a. 7号把实验搞定
b. 11号之前把论文初稿搞定
c. 18号吧修改后的初稿于交给老板。

继续加油!

末了贴张用gnuplot画的图吧

Friday, February 29, 2008

becoming linux kernel hackers (advice from Andrew Morton)

excepted from kernel trap.
interview took place on Feb. 14.

1. 做事情需要有目的,不能光看代码,需要动手,这就需要一个理由。
2. 现在的Linux开发的情况和2000年也许又不相同了,很多大公司加入
进来了。加入这些公司去开发内核可能才是可行的路径。
3. Andrew Morton最后一句话说的好,“There are many things to do,
and Linux doesn't really need thousands of people adding even more code.”
更多的人需要去做测试,做QA,做Bug fix.

What advice can you offer to people just learning to become kernel hackers?

Andrew Morton:
There is a great amount to learn, and you don't learn it by reading the
code, or by reading the mailing list. You have to actually get in
there and change something. It's only when you try to do the hands-on
things that you realize how much you don't know.

And to get hands-on, you need a *reason*.

Profile the kernel, try to fix a performance bottleneck.

Pick a neglected bug report off the kernel list, work it with the
originator, see if you can fix it.

Pick a neglected device driver or filesystem, try to improve it.

There are new block and net driver interfaces coming through in 2.5 -
pick a driver for which you have hardware and take care of it.

Don't spout off opinions on the kernel mailing list.

Ignore what the kernel developers say about C++.

If you need to write, say, a net driver then don't! First, take an
existing one and make it beautiful, or more correct, or twice as fast,
or add a feature. Then take that knowledge to the new driver.

One hot tip: if you spot a bug which is being ignored, send a
completely botched fix to the mailing list. This causes thousands of
kernel developers to rally to the cause. Nobody knows why this
happens. (I really have deliberately done this several times. It works).

Write a really good filesystem and VM performance measurement suite
which models real-world workloads. The existing ones are almost
useless for this, and this gap in the toolset makes it much harder to
tune filesystems, and to discover performance improvements and
regressions.

There are many things to do, and Linux doesn't really need thousands
of people adding even more code.

Hotspot@HOME and T-mobile's UMA plan


UMA简单来说就是GSM+Wifi的双模手机。允许用户在适当的时候
将通话在GSM和Wifi网络之间切换。现在T-mobile已经在北美开始
提供这种服务,Cingular是第一家。

我这里关心的是通过Wifi+Internet的链路网络是否会发生拥塞?
是否有区别服务?

Wednesday, February 27, 2008

vim中的中文行重排

今天进入博士论文写作的第2天,由于之前emacs编辑器无法输入
中文,只好新换了vim编辑器。

原来在emacs中C-q可以对段落进行重排,保持每行字符数不超过80个
英文字符。换到vi以后发现对应的命令是gq), 但要想实现中文重排,
还得安装一个插件。

从Edward G.J. Lee的vim介绍第3.6节摘录如下:


重排的功能本不是編輯器的主要功能,而是文書排版軟體的工作,
但簡單的重排也是很方便,對於中文而言,處理上得多花些工夫,
對於希望有中文重排功能的朋友,可下載 Vim script 來使用:

http://info.sayya.org/~edt1023/vim/format.vim


這是修改自日本朋友的貢獻。把他置於 $VIMRUNTIME/plugin 目錄下,
重新開啟 vim 就會生效,對於 J 及 gqap 都會考慮中文的細節。

Tuesday, February 26, 2008

Skype中D-Bus的使用

D-Bus是用于应用程序之间通信的一种方式,如果一个应用程序
支持D-Bus的话,意味着这个程序的某些API可以被export
出来了,其它应用程序可以通过D-Bus协议调用这些API。
(感觉这个功能优点类似RPC),另外应用程序还可以向D-Bus
发送消息,其它程序可以向D-Bus注册接收该消息。比如,
pidgin可以将用户上下线事件做为D-Bus消息传输出来。

对于skype而言,可以由其它应用程序调用打给某个用户打电话。
一种方法:

dbus-send \
--session \
--type=method_call \
--print-reply \
--dest=com.Skype.API \
/com/Skype com.Skype.API.Invoke \
string:NAME\ hello\ string:PROTOCOL\ 5\ string:CALL\ echo123


另一种方法:

skype-action-handler skype:echo123?call

其中skype-action-handler可以在Skype API on Linux
下载。

上面这些方法没有在skype 2.0 beta上测试成功。总的来说,
D-Bus还是优点用处的。因为它能调用应用程序内部的API,也能
监听程序发出的消息。

Sunday, February 24, 2008

WAPI 大事记

引子:2003年5月12日无线局域网国家标准WAPI由信息产业部报送国家标准化管理委员会正式颁布。11月26日,相关部门发布公告宣布强制性国家标准自2003年12月1日起开始实施,并规定到2004年6月1日,未获得强制性产品认证证书和未施加中国强制性认证标志的无线局域网产品将不得出厂、进口、销售或者在其他经营活动中使用。相关国内国外厂商必须和经过认证的国内企业进行技术合作才能获得加密标准。

由此,西安西电捷通无线网络通信有限公司发起制定的WAPI无线局域网安全协议成为了中国自主知识产权标准化、产业化的一个焦点事件,进入公众的视野。随后,

1. 中国政府的强硬措施随即遭到了来自海外的强力抵制,2004年1月,美国无线局域网标准组织WIFI联盟主管埃顿向路透社表示,如果在6月强制执行的生效期限前没有折中方案的话,将考虑停止向中国销售WIFI芯片,这样的言论终于将矛盾引向全面升级。

2. 2004年年初,针对美国方面的芯片禁运压力,中国芯片企业开始拿出可以替代美国WIFI芯片的产品。

3. 4月22日,中美双方贸易谈判之后宣布WAPI标准强制实施被无限期推迟。

4. 2004年12月7日,SC6形成决议,将WAPI和美国IEEE 802.11i一同进入提案流程,并被列入明年2月的SC6,第一工作组的工作会议议程,有望成为国际标准。

5. 2005年12月30日,国家密码管理局召集20多个国内厂家开会,正式宣布将向全球公布加密算法。

6. 2005年12月30日,财政部、国家发改革、信息产业部联合印发《无线局域网产品政府采购实施意见》的通知。根据实施意见,各级国家机关、事业单位和团体组织用财政性资金采购无线局域网产品和含有无线局域网功能的设备时,应当优先采购符合国家无线局域网安全标准(GB 15629.11/1102)的产品。 美国网件公司北方区产品经理惠宏飞表示,目前无线产品主要应用于教育、酒店、SOHO三方面,其中只有部分教育采购被纳入政府采购范畴,大约只占整体市场的10%。

7. 2006年3月7日,由发改委、信产部及科技部三大部委牵头建立,22家企业参与的WAPI产业联盟成立。

8. 2006年3月8日,WAPI未能在国际标准化组织获得通过,IEEE 802.11i则以高票通过。

9. 2006年6月8日,WAPI代表团退出ISO针对WAPI标准投票结果召开的“投票分析会”。

其它一些事实:
“2004年公司进入WAPI与802.11兼容网卡项目样机测试阶段,标准推行搁置后,该产品项目就已停掉,等待进一步市场消息。” 其实“停止步伐”的不止武汉汉网一家。记者在调查中了解到,上海思波通讯、深圳朗科、上海昂凯软件、福建星网锐捷、四川南山之桥微电子等数家一度想在WAPI项目中有所作为的公司都基本将项目处于“静观其变”的状态。

一位不愿透露姓名的某公司负责人告诉记者,该公司大量投资都已付之东流。项目搁置两年后,很多人员离开公司。另外一些公司规模不大、管理松散,对技术文档、材料管理不善,想恢复到2004年的“状态”还需要一个过程。

Monday, February 18, 2008

alsa on linux

终于今天把linux下声音的问题解决了,原来之前
flash, mplayer播放不了声音是由于alsa-base
没有安装和配置的原因。

在etch下安装和配置alsa很简单,只需要安装
alsa-base,然后运行alsaconf就行了。

Sunday, February 17, 2008

aiglx and compiz/beryl under debian etch

终于在Debian Etch上安装了compiz 3D 窗口管理器,
Xorg 7.1 (aiglx enabled) + compiz 0.2.2.

0.2.2的compiz版本还比较低,但基本的3D功能都能实现,
现在唯一的缺憾就是因为没有鼠标滑轮,不能实现窗口透明度
的设置。

这里需要说明的是,Novell最先推出的xgl是一种比较独立的
X server, 不太容易安装。而Redhat推出的aiglx对Xorg的
改动比较小,因此就被集成在Xorg 7.1中了。所以,现在
安装compiz只需要安装compiz和mesa-dri,然后对/etc/X11/xorg.conf
进行一下简单配置就可以了。

安装的方法参照
[1] A short introduction about Compiz
[2] Debian HOW-TO: AIGLX+Compiz


P.S. 由于compiz的版本太低,效果太少,现在改成beryl 0.2了,
安装方法也非常简单,
参考
[1] Debian HOW-TO: AIGLX+Beryl

Tuesday, February 12, 2008

ThuThesis的安装

今天计划开始写博士论文了,使用latex的thuthesis模板来写。
thuthesis在debian下的安装还是比较方便的

1. 在source.list添加源
deb ftp://ftp3.tsinghua.edu.cn/mirror/debian/debian-unofficial sid misc

2. 安装latex-cjkaddons, latex-thuthesis-gbk, tex-cjkfonts

3. 从windows系统中拷贝6种所需字体,simsun, simhei, simkai, simli, simyou, simfang.
使用make-fpkg制作latex所需的字体文件,然后安装。

ok!

Wednesday, January 09, 2008

openid and phishing

OpenID是一项新的用于简化用户登录网站的认证系统。它的基本思想是
用于在一个地方维护身份认证信息。登陆网站时只需要出示那个身份认证信息,
无须向登录网站进行认证过程。网站将认证用户身份的过程交给了第3方去做。

这里有OpenID认证过程的David P. Janes的一个介绍,OpenID: summing up. OpenID Wiki介绍了有关OpenID协议的更多细节。为了保证认证成功,登录网站和提供身份认证网站之间必须要有一个secret。

OpenID: Phishing Heaven谈倒了OpenID认证过程中phishing的问题。登录网站在认证用户的时候,会使用URL redirect使用户转到一个假的认证网站去完成认证过程,并在其中窃取用户密码。

另外一个问题,就是用户必须很相信OpenID服务器,用户的账号会用于登录很多网站。

Saturday, January 05, 2008

linux kernel compiling & install under debian

make-kpkg way: see Creating custom kernels with Debian's kernel-package system

non make-kpkg way,
refer to Debian Linux Kernel Handbook and Linux Kernel HOWTO (a little bit outdated).

1. make dep clean modules modules_install bzImage
2. update-initramfs -k kernel-version -c
3. cp arch/i386/boot/bzImage /boot/linux-kernel-version
4. update-grub