2009年3月

课程设计-“MFC计算器”附程序源码和设计报告

这学期的其中一本课程是Windows程序设计,用的是微软自家MFC框架,反正一切的一切都TMD水得不能再水了。因为该科目是考核而不是考试。弄两个课程设计就可以过关了,第一个弄计算器,第二个弄五子棋。今天上实验课的时候交了作业,尽然还是A,我自认为做得垃圾。因为很多东西可以用到的,但是都没有用。老师讲得也少,只有自己猛看教材:

课程设计-“MFC计算器”附程序源码和设计报告

程序的界面以前上过图的,不过现在加入了XP style,看起来要比以前性感多了:

课程设计-“MFC计算器”附程序源码和设计报告

以前我是一个版本控,无论是系统还是软件都用最新的,包括Visual studio都用2008,现在看来也无所谓,反正老版本的弄得来了,新版本了也差不多,增加的新的特性也不一定是最需要的。哎,说远了,源码和报告有一定的不一致,因为是先交的报告,然后交的程序,程序后来有少部分的改进。好,下载地址:http://tunps.com/lab/mfc_calc.rar

暮光之城 [Twilight] 字幕笔记

twilight n.暮光,黄昏;暮年,晚期,衰落时期
erratic adj. 飘忽不定的,不稳定的
harebrained adj. 轻率的,欠考虑的,粗心的 hare本来是野兔的意思。
got a plane to catch 得赶飞机
under a near constant cover of clouds and rain,那里笼罩着乌云和雨
doesn't hover 不踌躇,翻译过来就是爽快的意思。
come all the way down the road,一路赶过来
ankles,脚踝
buy off 收买,买下
be down with sb. 和sb.是一伙的
you're the bomb.你是一个爱吹嘘的人。
clutch 离合器
tan [C] brown colour of the skin after exposure to the sun 晒黑的肤色
home girl 邻家女孩
feature ,~ (on sb/sth) (in newspapers, on television, etc.) a special article or programme about sb/sth 特刊
don't bring it up again.别再提了。
got your back 支持你
editorial n.社论
eating disorder,a medical condition in which you do not eat a normal amount of food and are ill because of this,暴饮暴食
skinny **瘦
**foster
收养的 foster kids
gorgeous 漂亮,迷人
tag along 尾随,跟随
repel **使厌恶
**county

mill 工厂
mitosis [U] (biology) the process of cell division
prophase 分裂前期
anaphase 分裂中期
metaphase 分裂后期
contact lens 隐形眼镜,a small round piece of thin plastic that you put on your eye to help you see better
fluorescence 荧光效应
trauma 外伤
prom (US) (often formal) dance, esp one held by a class in high school or college (通常为隆重的)舞会(尤指高中或大学班级举办的).
non-refundable ticket 不能退的票
compost 肥料
adrenaline 肾上腺素
zero weirdness.完全不奇怪
foam 泡沫(材料)
edible art 食用艺术
whiplash, a hit with a whip(鞭子)
radioactive 发射性的
kryptonite,a type of rock that comes from the planet Krypton in the Superman stories. It is harmful to Superman.
put off **隐瞒
**hang out
出去,出行
all the way out here 一路赶来这儿
keep sb. company. 陪陪sb.
descendant 后代,后裔< --->ancestor
treaty 条约
inane 无聊的,愚蠢的
rip heads off 把头拧下来
rip sth. apart 把sth.撕碎
vile 卑鄙的
repulsive 厌恶的
put seatbelt on 系上安全带
ravioli [U] (Italian dish of) small square cases of pasta filled with meat, cheese, etc and usu served with a sauce (意大利式)方形饺(用肉﹑ 乳酪等做馅, 通常加调味汁食用).
low-lives 人渣
camouflage 伪装
predator 食肉动物
scent 气味
venom 毒液
excruciating 极其痛苦的
have the restraint to do that.能控制住做...
frenzy 疯狂
dent **凹痕
**coffin **棺材
**dungeons **地牢
**moat **壕沟,深沟
**get a whiff of sth.
尝尝sth.
implicated 被牵连
hold on tight 抓紧点
bare footprint 赤脚印
sheriff **县治安官
**buddy
兄弟,朋友
yahoo coarse brutish person 粗鲁的人
Indie music refers to rock or pop music produced by new bands working with small, independent record companies. (mainly BRIT)
territory 领土
wicked 诡异的
curve 曲线的
obsession 困扰
cobbler 馅饼
unparalleled sense 超能力
lethal 致命的
underestimate 低估
stubborn 固执的
feeble 无力地
avengevt.为…复仇;(on)向…报复

体验安装Debian Lenny

需要软件:
Vmware Workstation 6.5.1 (到Verycd下载
debian-500-amd64-DVD-1.iso (推荐个快的镜像
安装并打开Vmware Workstation,Help->About Wmware Workstation看看版本:

File->New->Virtual Machine->Typical->Installer disk image file(iso)指定为Debian-500-amd64-DVD-1.iso所在位置->Next->Linux->Version选择Other Linux 2.6.x kernel 64-bit(因为我是64位的机子:))->Virtual machine name:debian5 ->Location:D:\vmdebian5 ->Next->Maximum disk size:10GB->Next->Finish。这样我们的虚拟机就配置好了。

重启动按ESC,启动设备选择CD-ROM,这就我们就进了debian的安装界面了:

有Install和Graphical Install两种安装模式,机子猥琐点的就Install,牛X点的就Graphical Install , 我自认为4200+还不是很猥琐,且适合我这种newbie。

很久没有玩Lin,发现自己落后了,debian的界面真TM让人倍感亲切啊~Holy Awesome~~语言选择 简体中文 -> 继续 -> Choose Language(中文) ->继续 ->键盘布局(美国英语) -> 然后系统自动探测和挂载CD-ROM,查看里面的套件库(repository)  -> 主机名(刚才看了电影Sex Drive,就叫stiff-cock吧) ->继续 -> 域名(localdomain) -> 继续->这个时候系统正在获取服务器时间,由我校的网络情况来看,直接点“取消”-> 接下来是比较关键的分区了,选择“手动”用Diskdruid来分区,貌似没有必要用LVM(Logical Volume Management),如果不是用来做服务器的话。->继续。

选中SCSI1那个,继续,是否创建新的分区表(是) -> 继续 -> 选中空闲空间 继续, 具体的分区方法不讲了,我分了2个区:1GB的Swap和剩下所有分区作为根分区(Ext3 FS),如图:

“分区设定结束并将写入磁盘” ->继续 ->“将改动写入磁盘(是)” ->继续 ,根据我的经验来看,10GB的主分区也不显得多,因为所有debian的套件加起来有4.5个4.37左右的大小,也就是4.5 X 4.37 约=20GB ,囧~ 以后不出意外不会进X-Window,除非有时间研究gtk~ (废话一句,现在俺在学MFC),

接下来设置root的密码和自己创建一个普通用户和密码,一般我都这样设置:
username: root   password:x
username:tps     password:x
有些人觉得不安全,我觉得无所谓,反正都是做实验用,被黑了那是RPWT。

接下来问你时候扫描其他的CD/DVD媒介来安装,如果你就Debian-500-amd64-DVD-2.iso到Debian-500-amd64-DVD-5.iso 就一个一个的加载进去吧,

我就点否了,继续 ,接下来问俺们是否使用网络镜像,饿,Drcom的朋友直接“否” 继续 ->接下来点虚拟机的网卡托盘,Disconnect掉,否则会循环询问“是否用网络镜像”-> 接下来询问“是否参加软件包流行度调查?”->“否”,继续。

接下来选择要安装的软件,默认“桌面环境”和“标准系统” 已经勾选,我再添加个“Web服务器” “SQL数据库” ,免得以后安装apache,mysql麻烦。

接下来就是不长不短的安装时间,以安装套件数量而定。我突然发现左下角有个屏幕截图按钮。挺方便那些做安装教程,和安装的时候碰到问题的人。在安装的过程中,我吃上了“阿明菊花香瓜子”,比恰恰的烂瓜子少,且颗粒饱满,推荐食用,不要记错牌子哦,不是“菊爆香瓜子”哈~

好了安装的尾声叫我们是否GRUB安装到MBR,习惯性的我喜欢用GRUB引导其他系统,所以选“是”,重启动,来到登陆界面:

只能用普通用户登陆,要获得root权限,自己sudo,su

进来了:

为了达到更好的显示效果,需安装Vmware Tools,VM->Install Vmware Tools,然后Guest OS以CD的形式自动挂载到/media/cdrom0

Alt+F2 输入gnome-terminal
$cd /media/cdrom
$ cp *.tar.gz /home/tps/
$cd /home/tps
$tar zxvf *.tar.gz
$su 输入root密码

apt-get -y install binutils kernel-package  linux-headers-2.6.26-1-amd64

./vmware-tools-distrib/vmware-install.pl

接下来运行Vmware公司为咋们提供的傻瓜perl安装脚本,一路敲Enter,输入yes

当出现"What is the location of the directory of C header files that match your running kernel?" 输入/usr/src/linux-headers-2.6.26-1-amd64/include/
(kernel版本可以通过uname -a得到),接下来到了这样的提示:

None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes]

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

Your kernel was built with "gcc" version "4.1.3", while you are trying to use
"/usr/bin/gcc" version "4.3.2". This configuration is not recommended and
VMware Tools may crash if you'll continue. Please try to use exactly same
compiler as one used for building your kernel. Do you want to go with compiler
"/usr/bin/gcc" version "4.3.2" anyway? [no]

大概意思就是说没有找到适合俺们2.6.26-1-amd64内核的vmmemctl模块,需要自己编译,但是编译内核的gcc版本必须要和编译这个模块的版本符合,2.6.26-1-amd64用的是gcc 4.1.3编译的,而当前系统默认使用4.3.2,因为/usr/bin/gcc 是/usr/bin/gcc-4.3的软链接:
stiff-cock:/usr/bin# file /usr/bin/gcc
/usr/bin/gcc: symbolic link to `gcc-4.3'

在这里找到解决办法:
http://yuanfarn.blogspot.com/2008/10/debian-testing-on-vmware-workstation.html

所以不要使用4.3强制编译,因为我尝试了,会出现两个make的错误,所以运行这个先定义CC变量:
#CC=/usr/bin/gcc-4.1 ./vmware-tools-distrib/vmware-install.pl

接下来自动编译vmmemctl ,vmhgfs,vmxnet modules,然后更新initramfs:
update-initramfs: Generating /boot/initrd.img-2.6.26-1-amd64
然后系统再编译了一个叫vmblock.o的非内核模块~

然后:
[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
[yes]

Vmware文件系统同步驱动,实验性的东西,可以尝试,yes~
接下来vmci,vsock。

None of the pre-built vsock modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vsock module for
your system (you need to have a C compiler installed on your system)? [yes]

Extracting the sources of the vsock module.

Building the vsock module.

Using 2.6.x kernel build system.
make: Entering directory /tmp/vmware-config0/vsock-only'<br /> make -C /lib/modules/2.6.26-1-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules<br /> make[1]: Entering directory/usr/src/linux-headers-2.6.26-1-amd64'
CC [M]  /tmp/vmware-config0/vsock-only/linux/af_vsock.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/driverLog.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/util.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/vsockAddr.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "VMCIDatagram_CreateHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIDatagram_DestroyHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIEvent_Subscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCI_DeviceGet" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIMemcpyFromQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIQueuePair_Detach" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCI_GetContextID" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIDatagram_Send" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIQueuePair_Alloc" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIEvent_Unsubscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: "VMCIMemcpyToQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
CC      /tmp/vmware-config0/vsock-only/vsock.mod.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.ko
make1: Leaving directory /usr/src/linux-headers-2.6.26-1-amd64'<br /> cp -f vsock.ko ./../vsock.o<br /> make: Leaving directory/tmp/vmware-config0/vsock-only'
Unable to make a vsock module that can be loaded in the running kernel:
insmod: error inserting '/tmp/vmware-config0/vsock.o': -1 Unknown symbol in module

There is probably a slight difference in the kernel configuration between the
set of C header files you specified and your running kernel.  You may want to
rebuild a kernel based on that directory, or specify another directory.

The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and
host.  The rest of this software provided by VMware Tools is designed to work
independently of this feature.  If you wish to have the VSOCK feature  you can
install the driver by running vmware-config-tools.pl again after making sure
that gcc, binutils, make and the kernel sources for your running kernel are
installed on your machine. These packages are available on your distribution's
installation CD.
[ Press the Enter key to continue.]

接下来选择分辨率"[19]   1440x900"(19寸宽屏最佳resolution)
然后自动重启动X,使用这个config:"/tmp/vmware-config1/XF86ConfigLog.5435"

打开Iceweasel ,字体默认sans-serif 改为WenQuanYi Bitmap,效果(1400x900):

然后重启动一下机子,点VM->Setting ->Option ->Shared Folders(Always Enable) ->Add一个 ,
Name:share
Host path:D:\vmdebian5\share
然后在debian里面sudo mount -t vmhgfs .host:/  /mnt/hgfs/
D:\vmdebian5\share和/mnt/hgfs/就是同一个目录~可以用来在Host OS和Guest OS中传文件,同步文件~

为了对Debian GNU/Linux 5.0 有更加深入的了解,翻译了一下这个:
http://debian.org/News/2009/20090214