帐前卒专栏

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

今天和保增讨论了一个问题:如果感觉读6年博士是一种生命的浪费。你会选择放弃博士而用四年读研吗?(硕博连读的如果改为硕士要花4年读完,个人认为这是一种惩罚)如
果真的认为读博士是浪费,你会再浪费两年吗?

这让我想到一个经典的博弈问题。你已经投资某个项目并花了10000元,如果有人告诉你,你再追加10000元,你就可能连本带利赚回来。你会投钱吗?如果你再投钱,
有可能你的这个一万元和上一个一万元的待遇是一样的。你会再投钱吗?如果你不投钱,你过去的一万元就会泡汤。你会再投钱吗?大多数情况下我们会这样做:再投入一笔钱。

其实我们很难断定这样投钱下去会不会损失更大了。我们想要的只不过是把过去所投入的东西捞回来。其实这里需要更加理智的判断。但我们往往不那么理智。当第一笔钱投入结
束,我们应该估算下下一笔钱是否该投,以及第一笔钱的投入是否真正有效。我们不能单凭别人的一句话就投钱或者不投钱。

这其实就是一个投入和产出关系的模型。但是这个模型中,我们有可能越陷越深,难以自拔。当年老师说:如果你们明白了其中的道理。异地恋时,如果女方想留在男方。就一定
要在离别前一段时间,不停的让男方请客。这样男方会因为自己投入过多而一直牵挂女方。就可以有效的防止分手。有机会的同学可以试用一下(不管用不要找我)。

不过读不读博,读几年博…这的确值得探讨。俺老板说,在中国读博的确没有啥必要。因为读出来,你只能在中国成为这个方向上的第一。如果在国外读,那会成为全世界的第
一。想想也是这个道理。

1. They lived in a special world, built on courage and chivalvy and honor.
They pledged their lives to each other.  To fight for truth, to defend the
weak, to seek justice.
我们都有一个梦想去维持世界的公正,去锄强扶弱。我们都有一个梦想,为正义而战,为荣耀而战。这是一个骑士的世界,勇气,骑士精神,荣耀或许是很多人梦寐以求的。

2.  Some day my prince will come. But how did she know that?
从没有人会预言未来。为啥说我要等自己的唯一呢?或许只是因为现在的还不够标准。所以不能算王子。其实没有人知道自己的唯一何时会出现,以及会不会出现。

3. What’s the difference between rat and mouse. The only difference is hating
the light or not? or evil or not? or their looks? or braveness or not? No. 其实没
有人能分清是老鼠还是耗子。不是因为它们长的不同,不是因为他们内心是善良的还是邪恶的。它们其实没有任何区别。如果放下屠刀便能立即成佛,如果仇恨嫉妒便地狱初开。
幡然悔悟,永远不晚。一味执着则只能走向尽头。但是我们时常不是这样看到人与事。人丑则为恶,人美则为善。人人如此,从未有过例外。只有了解了人的真正内心,才能知道
真正的善恶。

4.When you heart breaks, it can grow back crooked. It grows back twisted and
gnarled and hard. Even as he changed, he still had longing. 我们时常有些东西是自己得不到的。但是
如果一味的执着,只能伤了自己。当心灵受到伤害,我们或不会想复仇,会不会变得麻木冷漠呢?但是麻木的内心背后,你还想得到你过去想要的东西吗?

5.In fact, you can have a good heart and not even know it.
有时候自己有什麽能力,自己都不知道。往往经历过一些事情,才知道自己拥有什么。

6. the forgiveness is the strongest thing a person could feel.  Because a
single act of forgiveness can change everything. 宽恕仇人,宽恕自己。如果不宽恕,生活总不能平静。

7. I am so sorry. 不能因为个人的仇恨,而祸及旁人。不能因为自己的悲伤而上关心自己的人悲伤。如果做了错事,一定要道歉。何时都不算晚。

英文名:

The tale of despereaux

很久以前的寓言故事:

讲述一只自小体弱多病叫 ** 德佩罗 ** ( ** Despereaux **
)的老鼠,梦想是变成一个英勇的骑士,在公主危难时拔刀相助。后来也展开冒险并实现了愿望的故事。

当然这个动画片时改编的。

我的使用的版本较老了.是excel2003的版本。开始先在两个框中输入数字

例如 A1 = 20

B1 = 30

然后再c1中输入 =A1-B1

然后点击键盘中的向右移动键。ok,结果是正确的.

然后再将c1改写为= A1/B1-1,回车

你就看到结果为0.

然后你不管怎么计算,这数就是不对,如果你计算A1/B1 ,就显示1

诡异的excel

这个解决方法是你重新开一个然后一次性输入= A1/B1-1,回车,然后再将结果copy回C1.

同步(这个应该是主流趋势,并且顺应了普适计算的潮流)
易用性(因为没有这么多高手,大家都是菜鸟,所以能吸引更多的用户)
windows 7 对vista做了优化,细节功能优化(这个也就是修复了很多bug)
态度决定一切。(这个是米卢老先生说的attitude is everything)
全身心投入(这个应该是干一行爱一行)
早了解,早准备,早尝试(这个应该叫笨鸟先飞)

分析完毕…

其实这次宣讲会本没有必要在中科院开。因为中科院几乎所有院系统一规定:出去实习者死!但是当然也有不法分子和有权有势者冒着杀头的危险去尝试。但是我想大多数人还是
胆小的。

另外实习即使是兼职也要有每周三天的时间,连续三个月。而且不含星期六星期天…很抱歉…可以明确的说除了逃课别无选择。当然7月份要进实验室…不想被砍头就勇于
去尝试吧…(虽然我一直没有看到被砍头的)

其实这次提问中有个很搞笑的事情发生,有人说…你们说的XX功能…linux不都实现了吗?

…当场哄笑…

其实我感觉,微软应该先做调研…然后再看看适不适合做宣讲会。

最近手头有三四个项目在同时开工。实验室又准备召唤我进去做事。这些项目虽然很多是分工协作,但是本人还是要挑大梁的…虽然不知道自己有没有那个资格。但是我习惯于
做组长了…

另外师姐让我帮她做实验。诡异的树结构,我自己编写然后调试就快晕了…自己果真不喜欢调试递归程序。那岂是一个痛苦了得!…bug不断呀!喜欢给别人报bug,
但是自己却不怎么喜欢去fix bug,看来是人性的必然。

最近学习心理学,发现很多事情都可以用心理学的知识加以解释。感觉很好很强大。例如我在写这篇blog,其实是我的潜意识早就写好了,只是由我的意识写出来给大家看。
虽然觉得很不可思议,但那确实是真的。有很多事情我们不明白原因,因为很多事情是出于我们的本能。当然我自己还是因果论者,有果必有因,有因必有果。如果有因无果,那
肯定是自己没有控制其他的因。如果有果无因,那一定是自己的分析能力太差。或许这个世界就这么简单.

昨天去同学家玩,同学说他想成为有钱人。他说想创业,想闯荡。我说你现在没有钱。当你有钱了,你或许不这样想了。我们不是因为习惯于稳定,而是在于你可能得到的东西的
价值比你将要失去的东西的代价差异悬殊。

最近开导别人。要凡事开心,要身体健康。想来想去自己却还有些时候不开心(或许是蜘蛛在我眼前飞过)。自己也还没能坚持锻炼身体。的确需要注意。或许,为自己活着比为
他人活着更有价值。也不知道我当时的想法是怎么来的,或许是墨家思想吧。但是为自己活着又稍显自私,而且还有人人为利,则皆不得利的博弈规则限制。或许,以德报德,以
直抱怨的模型更加符合现实需要。

想想很多哲理,眼前飘荡无数小人。显然,我还没有达到那个境界。

为了调用方便…我这里就全部写成Public的访问权限.虽然自己知道这样不好。

但是时间比较紧张。能省点力气就省点力气。

class Status { public: static enum stat{success, failure, duplicate,
overflow}; stat st; Status() { st = failure; } Status(stat s):st(s) { } Status
operator=(const Status& s) { if(this != &s) { this->st = s.st; } return *this;
} Status operator=(const stat & s) { this->st = s; return *this; } ~Status() {
} };

这里的调用应该这样写:

if(s.st == Status::overflow) { // do something }

1.首先装好你的Oracle 9i。然后再控制面板->管理工具->数据源(odbc)

2.双击数据源(odbc)->选择系统DSN->添加->Microsoft ODBC for Oracle , 数据源名称:chicoDB
(这个是用来在C#中写连接字符串用的), 服务器名称:chicoDB (这个是你安装Oracle的时候建立的sid名称即数据库名)。然后确定

3.打开你的pl/sql 建立几个表(新建->表)…我使用的system帐号登陆权限为SYSDBA,数据库为chicoDB.(不过使用PL/SQL好像不用
用户名密码也可以登陆)比如我建立的是client 表。我的所有者为system.在列中输入:CLIENTID (nvarchar(11)),ID(nvarc
har(11)),NAME(nvarchar(50)),SEX(char(1)),TEL(nvarchar(11)),INCOME(NUMBERIC),JO
B(nvarchar(50))。

4.建立一个c#工程项目,连接字符串这样写:const string connstr =
“DSN=chicoDB;UID=System;Pwd=zaqwsx;”;

前面要using System.Data.Odbc; 想建立连接的话就写:OdbcConnection cn = new
OdbcConnection(connstr);

const string connstr = “DSN=chicoDB;UID=System;Pwd=zaqwsx;”; OdbcConnection
cn= new OdbcConnection(connstr); cn.Open(); //
这里的基本上都是string类型,出了income是double String sqlInsert = “insert into System.client
values('” + clientId + “‘,’” + id + “‘,’” + name + “‘,to_char(’” + sex +
“‘),’” + tel + “',” + income + “,'” + job + “')”; OdbcCommand oc = new
OdbcCommand(slqInsert, cn); oc.CommandType = System.Data.CommandType.Text; int
rows =oc.ExecuteNonQuery(); System.Console.WriteLine(rows);// 打印被影响的行数 String
sql = “select * from system.client”; oc.CommandText = sql; OdbcDataReader
dbreader= oc.ExecuteReader(); //这个Reader好像不能脱机操作…(具体没有查) object[] o = null;
if (dbreader.HasRows) { o = new object[dbreader.FieldCount];
dbreader.GetValues(o); } // 这里你自己写个打印语句将查询出来的记录打印出来吧… dbreader.Close();
oc.Dispose(); cn.Close();

操作完毕…

这里要注意的一点,如果你在sql语句末尾加入了’;',那么Oracle就会报错。另外我本来想用OdbcParament来写.后来屡次失败。不知道愿意。有写出
来的且能运行的.帮忙贴在我的评论里。

0. 下载一个 [ jdk1.5版本 ](http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-
CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-1_5_0_18-windows-i586-p.ex
e?BundledLineItemUUID=1KhIBe.mgfsAAAEg5uQI93Ap&OrderID=6gVIBe.mONgAAAEg2uQI93A
p&ProductID=79FIBe.nKlMAAAEfLBlzHdQ4&FileName=/jdk-
1_5_0_18-windows-i586-p.exe) 的。并且如果Oracle与之冲突…就删掉Oracle的所有环境变量。虽然这样做有点过,但是我的确
受够了jdk1.6+eclipse3.1+oracle中的jre 1.1.3和
1.8.1版本的冲突。另外jdk1.6会与eclipse3.1在启动tomcat上冲突。我也不知道具体是什么原因。

1. 下载一个Eclipse 3.4 for J2EE版本的 [ http://www.eclipse.org/downloads/download.ph
p?file=/technology/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-
SR2-win32.zip ](http://www.eclipse.org/downloads/download.php?file=/technology
/epp/downloads/release/ganymede/SR2/eclipse-jee-ganymede-SR2-win32.zip)
2. 下载tomcat 5.5。 [ http://apache.cs.utah.edu/tomcat/tomcat-5/v5.5.27/bin
/apache-tomcat-5.5.27.exe
](http://apache.cs.utah.edu/tomcat/tomcat-5/v5.5.27/bin/apache-
tomcat-5.5.27.exe) ,下载一个 安装到默认目录。安装完毕之后,不要启动。另外注意,你启动monitor后再点击Exit,不代表服务关闭了。
你要选择Stop Service 才可以。
3. 下载xfire-1.2.6。 [ http://repository.codehaus.org/org/codehaus/xfire/xfire-
distribution/1.2.6/xfire-distribution-1.2.6.zip
](http://repository.codehaus.org/org/codehaus/xfire/xfire-distribution/1.2.6
/xfire-distribution-1.2.6.zip)
4. 在Eclipse中windows->preference->Server->Runtime Environments。点击add,选中tomcat
5.5, next, 浏览到你的tomcat 5.5的安装路径。然后Finish.
5. 新建一个工程(dynamic web project),取名为TestHelloWebService
6. 在此工程中添加一个新类:hello ,其package为test.
7. in hello.java中:
package test; public class Hello { public String hello() { return “hello”; } }

8. 在web.xml中之前添加
XFireServlet
org.codehaus.xfire.transport.http.XFireConfigurableServlet

XFireServlet /servlet/XFireServlet/ XFireServlet /services
/

9. 将xfire-1.2.6解压,然后将xfire-all-1.2.6.jar 和所有在xfire-1.2.6的lib中的jar
copy到WebContent/WEB-INF/lib下。
10.在WEB-INF中创建classes文件夹,并将META-INF文件夹移到classes文件夹下,
并在META-INF下创建一个xfire文件夹。在xfire中创建一个services.xml文件。
service.xml文件内容如下:

xmlns=“http://xfire.codehaus.org/config/1.0”> Hello http://localhost:8090/TestHelloWebService/services/Hello
test.Hello

其中name是你要提供service的类名
namespace 是你要访问的服务地址。这里我的端口因为与Oracle冲突所以不是8080.你自己改为你当时配置端口。
格式为:http://主机ip:端口号/项目工程名/services/类名
serviceClass是你的包名.类名
11.右击的工程->Run as-> Run on server. Finish。这里如果在eclipse之外还启动了tomcat就会报错。
12.访问 http://localhost:8090/TestHelloWebService/services/Hello?WSDL

13.如何访问WebService…你可以用c#,那是非常简单的…见一个C#工程,添加一个web reference.
然后就像你使用本地方法一样使用这个webservice.注意要using webservice的名字空间。对于非本地的webservice调用就比较麻烦。
有时还要使用用户验证。这里不详细介绍。

13.如果使用java来调用webService 流行的方法是使用axis。
http://topic.csdn.net/t/20030403/09/1612072.html
java里使用webservice 安装配置Axis
下载一个Axis1.4。下载地址http://ws.apache.org/axis/releases.html
解压Axis1.4.zip包,找到webapps目录下的axis文件夹,拷贝axis文件夹到Tomcat中的webapps文件夹下。

将Tomcat中的axis目录下的WEB-INF/lib中的所有的文件copy到Tomcat的common/lib目录中。(以后凡是要在axis的lib中添
加jar文件,都要copy一份到Tomcat的common/lib目录下)。

我的电脑->属性->高级->环境变量->系统变量(用户变量也可以)中添加:
TOMCAT_HOME
这里是你的TOMCAT安装目录。我的是C:/Program Files/Apache Software Foundation/Tomcat 5.5
反正这个目录下一定要有webapps

AXIS_HOME
%TOMCAT_HOME%/webapps/axis(TOMCAT的目录)

AXIS_LIB
%AXIS_HOME%/lib

AXISCLASSPATH
%AXIS_LIB%/axis.jar;%AXIS_LIB%/commons-discovery.jar; %AXIS_LIB%/commons-
logging.jar;%AXIS_LIB%/jaxrpc.jar;
%AXIS_LIB%/saaj.jar;%AXIS_LIB%/log4j-1.2.8.jar; %AXIS_LIB%/xml-
apis.jar;%AXIS_LIB%/xercesImpl.jar

修改或创建CLASSPATH ,在末尾加上:
%AXIS_LIB%/axis.jar;%AXIS_LIB%/commons-discovery.jar; %AXIS_LIB%/commons-
logging.jar;%AXIS_LIB%/jaxrpc.jar;
%AXIS_LIB%/saaj.jar;%AXIS_LIB%/log4j-1.2.8.jar; %AXIS_LIB%/xml-
apis.jar;%AXIS_LIB%/xercesImpl.jar

注意检查CLASSPATH是否正确:(有些软件会在用户变量区设置一个classpath,会有影响,如:XMLSPY)
在运行输入cmd,然后:Echo %CLASSPATH%
检查配置:
启动Tomcat,访问http://localhost:8090/axis/,
验证axis的是否工作:http://localhost:8090/axis/happyaxis.jsp如果正常显示表示正常。
14. 你要建立一个新的工程(一个常规的java工程即可)…创建一个包名test,添加一个类TestWebService
代码如下:
package test; import org.apache.axis.client.Call; import
org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType;
public class TestWebService { public static void main(String[] args) { try {
//还记得刚才的那个WebService的services.xml中的namespace吗? String endpoint =
http://localhost:8090/TestHelloWebService/services/Hello”; Service service =
new Service(); Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(“hello”); // 这里是的Hello类中的方法名(注意大小写)
call.setReturnType(XMLType.XSD_STRING); // 返回值类型。 Object[] o =
null;//如果你的方法中没有参数,那么就这样写吧。 String hello = (String) call.invoke(o);// 做方法执行。
System.out.println(hello); } catch (Exception e) {
System.err.println(e.toString()); } } }
网上的这段代码是用来调用一个float add(float a, float b)的方法。你现在应该知道怎么进行webservice调用了吧。
不管webservice提供的函数有没有参数,你应该都会调用了。
// Float i = new Float(1); // Float j = new Float(2); //
call.setOperationName(“add”); // call.addParameter(“i”,
org.apache.axis.encoding.XMLType.XSD_FLOAT, //
javax.xml.rpc.ParameterMode.IN); // call.addParameter(“j”,
org.apache.axis.encoding.XMLType.XSD_FLOAT, //
javax.xml.rpc.ParameterMode.IN); // call.setReturnType(XMLType.XSD_FLOAT); //
Float ret = (Float) call.invoke(new Object[] { i, j });

15.运行你的TestWebService试试。Done。(你刚才的webservice项目还在运行…,否则…)

真的很可惜,我过去使用的eclipse3.1,添加了很多plugin,死活都建不成webservice.再后来我使用Myclipse 4.0GA版本,还是看
不到webservice。或者运行时候后来有好心MM传给我MyEclipse5.0GA,结果报出灾难性崩溃…只得重装了jdk,并且下了较新的eclips
e.

我拥有宇宙
却也一无所有
因我无法了解一切未知
就如我无法放弃一切所知

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

首先是找些国内的源:(将下面的一段复制粘贴到你的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’ ./*  (这里说查找当前文件夹下的所有文件)

0%