帐前卒专栏

code, software architect, articles and novels.
代码,软件架构,博客和小说

这个可能不是大家常用的命令。但是这个是自己这几天常在用的命令。

首先是找些国内的源:(将下面的一段复制粘贴到你的source.list中,你也可使用创建一个新文件然后再去覆盖的方法。注意这里要在命令前使用sudo )

deb cdrom:[Xubuntu 8.04 Hardy Heron - Release i386 (20080422.1)]/ hardy

main multiverse restricted universe

deb cdrom:[Xubuntu 8.04 Hardy Heron - Release i386 (20080422.1)]/ hardy

main multiverse restricted universe

See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

newer versions of the distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ hardy main restricted

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy main restricted

Major bug fix updates produced after the final release of the

distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

team, and may not be under a free licence. Please satisfy yourself as to

your rights to use the software. Also, please note that software in

universe WILL NOT receive any review or updates from the Ubuntu security

team.

deb http://cn.archive.ubuntu.com/ubuntu/ hardy universe

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy universe

deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates universe

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates universe

N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

team, and may not be under a free licence. Please satisfy yourself as to

your rights to use the software. Also, please note that software in

multiverse WILL NOT receive any review or updates from the Ubuntu

security team.

deb http://cn.archive.ubuntu.com/ubuntu/ hardy multiverse

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy multiverse

deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

Uncomment the following two lines to add software from the ‘backports’

repository.

N.B. software from this repository may not have been tested as

extensively as that contained in the main release, although it includes

newer versions of some applications which may provide useful features.

Also, please note that software in backports WILL NOT receive any review

or updates from the Ubuntu security team.

deb http://cn.archive.ubuntu.com/ubuntu/ hardy-backports main restricted

universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-backports main restricted

universe multiverse

Uncomment the following two lines to add software from Canonical’s

‘partner’ repository. This software is not part of Ubuntu, but is

offered by Canonical and the respective vendors as a service to Ubuntu

users.

deb http://archive.canonical.com/ubuntu hardy partner

deb-src http://archive.canonical.com/ubuntu hardy partner

Line commented out by installer because it failed to verify:

deb http://security.ubuntu.com/ubuntu hardy-security main restricted

Line commented out by installer because it failed to verify:

deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted

Line commented out by installer because it failed to verify:

deb http://security.ubuntu.com/ubuntu hardy-security universe

Line commented out by installer because it failed to verify:

deb-src http://security.ubuntu.com/ubuntu hardy-security universe

Line commented out by installer because it failed to verify:

deb http://security.ubuntu.com/ubuntu hardy-security multiverse

Line commented out by installer because it failed to verify:

deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse

deb http://medibuntu.sos-sts.com/repo/ hardy free non-free

deb-src http://medibuntu.sos-sts.com/repo/ hardy free non-free

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe
multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe
multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted
universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted
universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted
universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted
universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted
universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted
universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse
restricted universe
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe
multiverse

deb http://debian.ustc.edu.cn/ubuntu/ hardy main restricted universe
multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main restricted universe
multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main restricted universe
multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main restricted universe
multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main restricted universe
multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main restricted universe
multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main restricted
universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main restricted
universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main restricted
universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main restricted
universe multiverse

替换掉etc/apt/source.list, 然后使用 sudo apt-get update

然后下个subversion,使用sudo apt-get apt-get install subversion

首先从网上用svn checkout svn://URL [where to store]

不过因为网络的原因,很有可能它会说没有这个URL

其实你也可以用移动硬盘直接把别人checkout之后的代码copy过来。同样含有svn信息。

然后如果代码有更新,到你的代码的顶级目录下使用:svn update.如果这里说你的client太old,那么就下个最新的svn.

下面是改代码阶段。

你改动了很多代码…你如果记得所有代码的位置,可以删除后再使用 svn update. 但是这个方法很笨。

你也可以使用svn revert [foldername or filename]

如果你svn update之后,发现突然编译失败了.那么可能有个小孩把错误的代码commit到了svn数据库中。

你可以使用svn log | more 命令还看看你想恢复到那个版本。

然后呢,再使用svn up -r 22323 比如这里版本为r22323那么svn就会回退到那个r22323版本

如果你想打一个patch包或diff包。使用 svn diff [path] > [filename]

path 是你想diff的目录,filename是最后生成的patch包名字.

如果你想快速的找一个代码文件在什么位置,使用

find [folder] -name ‘filename’ 这里的filename可以使用正则表达。

如果你不知道哪个变量或者函数在什么位置,或者那些文件使用了这个变量,那么使用

grep -i ‘varialbe’ filename

或者

grep -i ‘variable’ ./*  (这里说查找当前文件夹下的所有文件)

输入:cd 到 当前vmware所在目录

vmware-vdiskmanager.exe -x 1GB myDisk.vmdk

如果输入这个命令出错的话,输入下面的命令:

vmware-vdiskmanager.exe -r myDisk.vmdk -t 0 myDestDisk.vmdk

这个命令是克隆命令,建一个可以增长空间的vmdk

然后再输入:

vmware-vdiskmanager.exe -x 1GB myDestDisk.vmdk

done

最近新装了机器。然后装了Oracle 9i,然后又装了jdk6.0,再后来我运行eclipse。结果发现问题. 报出:

Required Java Version 1.4.1 Available 1.3.1

后来发现原来Oracle安装过程中装入了jdk1.3版本的。然后再安装jdk6.0 eclipse就找不到相应的高版本的jdk。

解决方案:

在eclipse.exe 文件夹所在处创建一个start.bat 文件:

eclipse.exe -vm “C:/Program Files/Java/jre1.6.0_03/bin/javaw.exe” -data
“D:/eclipse/workspace”

如果这时点击start.bat文件。也可以运行eclipse。但是会有黑屏。

解决方法:

创建一个a.vbs文件

然后写入:

Set shell = Wscript.createobject(“wscript.shell”)
a = shell.run (“start.bat”,0)
保存。

点击a.vbs就可以运行了…

这当然是在xp环境下…在linux下…写和bat差不多的bash脚本即可。

在windows XP的运行里输入:

telnet towel.blinkenlights.nl

然后等待…

看到文本方式的星战…

在浏览器的地址栏中输入:

javascript:alert(document.lastModified)

然后回车…

改动一下排列的代码,迅速变成组合问题的求解:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

def perm(n,m,current,lists=[]):
if m == len(lists):
return 1
sum = 0
for i in range(current,n+1):
if i not in lists:
sum+=perm(n,m,i+1,lists+[i])
return sum

n,m = [int(i) for i in raw_input().split()]

print (perm(n,m,1))


python 上手果真比较快…

用python写代码果然很简练

def perm(n,m,lists): if(m == len(lists)): print ’ '.join(map(str,lists))
return 1 sum = 0 for i in range(1,n+1): if i not in lists: sum +=
perm(n,m,lists+[i]) return sum number = [int(i) for i in raw_input().split()]
perm(number[0],number[1],[])

用习惯了c/c++和java,用python的确不能得心应手…有时候不懂语言才好…

首先static变量只有一次初始化,不管在类中还是在函数中…有这样一个函数:

void Foo() { static int a=3; // initialize std::cout << a; a++; }

这里的static int a=3只执行了一次。在main中调用Foo()两次,结果为34.将上面的函数改为

void Foo() { static int a; a=3; // not initialize std::cout << a; a++; }

同样在Foo()中调用两次.结果为33

在类中使用非const的static类成员变量。初始化时要使用typename classname::variablename = value的形式

例如:

class myClass { public: static int a; myClass() { } }; int myClass::a = 3; //
here initialize int main() { cout << myClass::a; return 0; }

如果使用的是const类型的static变量,那么就要在类中初始化:

class myClass { public: const static int a=3; // here initialize myClass() { }
};

如果是模板中使用非const的static的变量…那需要根据具体类型初始化。

例如 int myClass::a = 4;那么如果你调用的是cout << myClass::a,那一定会编译出错的。

因为模板是不是具体类型,myClass, myClass才是一个具体类型,而一个类静态成员在特定类中被初始化一次。这样就好理解了。

人们经常问这样的问题,人活着为了什么?就如人出生所具有的原始渴望一样,这个问题也常在人们心间涌动,
但对于大多数人生一帆风顺,没有面对过死神考验的人们来说,这个问题始终难有清晰的答案来使自己信服。所以对活着的问题是多了一些娱乐,而少了一份严肃。

她,一个名叫唐雨寒的 23
岁女孩,刚走出大学校门半年,准备在社会的大舞台追逐自己的梦想的时候,却过早地感受到了生命的沉重。一场突如其来的白血病将她的梦想击碎 ,如今的她只能静静躺在
病床上与那个恐怖的杀手做着生命的较量。发病前的一个月里,走几分钟路她便会感觉气喘嘘嘘,她也常常因腰痛而在半夜里痛醒过来,这个本来坚强的女孩还以为是初涉工作的
不适,直到大家都沉浸在新年的气氛里,一次突然的晕倒将这个噩耗带给了她,带给了她的父母,也带给了她所有的亲戚朋友。原本应该欢乐的新年却让每个人心里布满愁云,也
让她承受着前所未有的打击。

她也和我们一样,也曾满怀壮志去为人生打拼,毕业时的豪言壮言犹在耳边,可不战胜病魔,她怎么能和我们一起并肩战斗?她是家里惟一的女儿,父母对自己的女儿的未来了充
满期待,可不战胜病魔, 她怎么能满足一对普通父母的心愿。一次次化疗使这个原本美丽的女孩变得面目全非,面对死神的挟持,她显得筋疲力尽,我们再难见她往日的笑容
。巨额的治疗费用是这个并不富裕的家庭难以承受的,一个原本幸福的家庭也陷入无尽的恐慌之中。

病魔并不那么可怕,只要我们有战胜它的勇气与决心,病魔的肆虐让我们思索活着的意义。人活着就会有永远不会消失的笑容,一个梦想就会继续下去。
人活着就不会使一个家庭陷入残缺,也不会使一段段友谊变成伤心住事。人为什么活着?不如在心底问为什么要向死神屈服呢?活着多好啊。

一个家庭的力量是弱小的,为战胜巨大的病魔,这需要我们每个人伸出自己的援手,与她站在一起,汶川大地震时流传着这样一句话:一个大灾难除以 13
亿就变得很小了,一个小小的爱心乘以 13 亿就是无穷大爱。我想“只要人人都献出一份爱”,那就会汇成爱的海洋,这个美丽的女孩就会重新回到我们美好的生活当中
来。让我们一起祝愿她坚定战胜病魔的信心,早日康复,至少还有我们在关心着她。

各位亲爱的校友,在我们正在享受牛年牛市的喜悦、沐浴春天气息到来的时候,我们身边的一位可爱的学妹正在与病魔殊死抗争着。

唐雨寒

雨寒家在湖南郴州,为家中的独生女,母亲下岗多年。 2008 年 12 月,雨寒在重庆出差期间连续身体不适,在重庆就医后并无好转。 2009 年
1 月 11 日 ,雨寒突然在家中晕倒,送至广州中山三院救治后,被确诊为白血病,病情非常严重。 2009 年 1 月 14 日
,雨寒转院至广东省人民医院血液科,并被确诊为急性髓性白血病。

现在,雨寒正在接受第一阶段化疗。整个治疗过程需要多个化疗疗程,痛苦而漫长,而且直到找到合适骨髓才能进行骨髓移植手术。期间治疗费用高昂,一个七天周期的疗程约需
五万元费用;如找到合适骨髓,手术费则高达 40 万左右。由于大部份治疗用药都不在社保报销范围内,治疗所需的费用,对于这个家庭来说,无疑是一个天文数字。

病魔也许可以夺去生命的健康,但却不能夺去校友间的真情。让我们深圳的校友团结起来、发动起来,平时少抽一包烟、聚会少点一道菜、夜晚少泡一次吧、出行少打一次车,省
出来的钱就完全能够挽救一个我们身边的亲人。再小的善心乘以我们在深上万名湖大校友也将成为一片爱的海洋,捐资不论多少,善举不分先后,贵在有一份真挚的爱心。她需要
您、需要我、需要我们大家伸出双手。

为了帮助雨寒度过难关,为了分秒之间的生存机会,我们呼吁所有能够听到的人,我们期待所有人的关注,我们和雨寒全家一样,急切的盼望着、感激着您的善良。

您可以通过以下方式献出爱心 :

直接将捐款款项打入唐雨寒的银行卡,帐号信息如下:

帐户姓名:唐雨寒

帐户卡号: 6013 8219 0005 2343 030

开户行: 中国银行广州天文苑支行

注意: 所有捐款的校友请发送邮件到 [email protected] 或短信 13682606046 ,注明:捐款人姓名、金额以方便统计、公示及感激。

并急寻 AB 血型的校友,深圳捐款或献血联系人:万其鹏 13682606046

0%