一、SVN启动

[root@localhost ~]# mkdir /data/svn
[root@localhost ~]# svnadmin create /data/svn/test
[root@localhost ~]# svnserve -d -r /data/svn/test --listen-port 3700
[root@localhost ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.1.69:59878 0.0.0.0:* LISTEN 1676/sshd
tcp 0 0 0.0.0.0:3700 0.0.0.0:* LISTEN 29913/svnserve

-r: 配置方式决定了版本库访问方式。

--listen-port: 指定SVN监听端口,不加此参数,SVN默认监听3690

由于-r 配置方式的不一样,SVN启动就可以有两种不同的访问方式

方式一:-r直接指定到版本库(称之为单库svnserve方式)

svnserve -d -r /data/svn/test

在这种情况下,一个svnserve只能为一个版本库工作。

authz配置文件中对版本库权限的配置应这样写:

[groups]
admin=user1
dev=user2 [/]
@admin=rw
user2=r
* = 其他用户没有权限

使用类似这样的URL:svn://192.168.0.1/ 即可访问test版本库。

方式二:指定到版本库的上级目录(称之为多库svnserve方式)

svnserve -d -r /data/svn

这种情况,一个svnserve可以为多个版本库工作

authz配置文件中对版本库权限的配置应这样写:

[groups]
admin=user1
dev=user2
[test:/]
@admin=rw
user2=r [test01:/]
@admin=rw
user2=r

如果此时你还用[/],则表示所有库的根目录,同理,[/src]表示所有库的根目录下的src目录。

使用类似这样的URL:svn://192.168.0.1/test即可访问test版本库。

二、创建版本库

[root@localhost ~]# svnadmin create /data/svn/test
[root@localhost ~]# ll /data/svn/test
total 24
drwxr-xr-x 2 root root 4096 Feb 26 11:10 conf
drwxr-sr-x 6 root root 4096 Feb 26 11:10 db
-r--r--r-- 1 root root 2 Feb 26 11:10 format
drwxr-xr-x 2 root root 4096 Feb 26 11:10 hooks
drwxr-xr-x 2 root root 4096 Feb 26 11:10 locks
-rw-r--r-- 1 root root 229 Feb 26 11:10 README.txt

svn目录说明:

  • dav目录:是提供apache与mod_dav_svn使用的目录,让他们存储内部数据
  • db目录:就是所有版本控制的数据存放文件
  • hooks目录:放置hook脚本文件的目录
  • locks目录:用来放置subversion建库锁定数据的目录,用来追踪存取文件库的客户端
  • format文件:是一个文本文件,里面只放了一个整数。表示当前文件库配置的版本号
  • conf目录:是这个仓库的配置文件(仓库的用户访问账号、权限等)

进入/opt/svn/runoob01/conf目录 修改默认配置文件配置,包括svnserve.conf、passwd、authz 配置相关用户和权限。

1、svn服务配置文件svnserve.conf

svn服务配置文件为版本库目录中的文件conf/svnserve.conf。

[root@localhost test]# cd conf/
[root@localhost conf]# ls
authz passwd svnserve.conf
[general]
# anon-access = read 定义非授权用户的访问权限,有三种方式: none 、read 、write ,设置为none限制访问,read为只读, write为具有读写权限,默认为read。
# auth-access = write 定义授权用户的访问权限,有三种方式: none 、read 、write ,设置为none限制访问, read为只读, write为具有读写权限,默认为write 。
# password-db = passwd 定义保存用户名和密码的文件名称,这里为passwd,和该文件位于同一目录。
# authz-db = authz 定义保存授权信息的文件名称,这里为authz,和该文件位于同一目录。
# realm = My First Repository 定义客户端连接时的“认证命名空间”, Subversion会在认证提示里显示,并且作为凭证缓存的关键字。 [sasl] 用于标识是否进行SASL加密处理
# use-sasl = true 是否开启sasl
# min-encryption = 0
# max-encryption = 256
变量min-encryption和max-encryption控制服务器所需要的加密强度。

2、用户名口令文件passwd

用户名口令文件由svnserve.conf的配置项password-db指定,缺省为conf目录中的passwd。该文件仅由一个[users]配置段组成。

[users]配置段的配置行格式如下:

[users]
# harry = harryssecret
# sally = sallyssecret

3、权限配置文件

权限配置文件由svnserve.conf的配置项authz-db指定,缺省为conf目录中的authz。该配置文件由一个[groups]配置段和若干个版本库路径权限段组成。

[groups]配置段中配置行格式如下:

[groups]
g_admin = admin,thinker [admintools:/]
@g_admin = rw
* = [test:/home/thinker]
thinker = rw
* = r

三、SVN检出操作

[root@localhost ~]# svn checkout svn://192.168.1.69:3700/test --username=user01
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'user01': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Checked out revision 0.
[root@localhost ~]# ls 检出成功后在当前目录生成test文件夹
anaconda-ks.cfg install.log install.log.syslog test
[root@localhost ~]# ll test/
total 0

查看版本库信息

[root@localhost ~]# svn info svn://192.168.1.69:3700/test --username=user01
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'user01': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Path: test
URL: svn://192.168.1.69:3700/test
Repository Root: svn://192.168.1.69:3700/test
Repository UUID: d120c548-f91f-4039-8278-1648c0339d64
Revision: 0
Node Kind: directory
Last Changed Rev: 0
Last Changed Date: 2018-02-26 11:10:56 +0800 (Mon, 26 Feb 2018)

四、SVN提交操作

[root@localhost ~]# cd test/
[root@localhost test]# ls
[root@localhost test]# vim hello.html
[root@localhost test]# svn status
? hello.html

此时hello.html的状态为?,说明它还未加到版本控制中。

将文件readme加到版本控制,等待提交到版本库。

[root@localhost test]# svn add hello.html
A hello.html
[root@localhost test]# svn status
A hello.html

此时hello.html的状态为A,它意味着这个文件已经被成功地添加到了版本控制中。

为了把hello.html存储到版本库中,使用commit -m加上注释信息来提交。

如果你忽略了 -m 选项, SVN会打开一个可以输入多行的文本编辑器来让你输入提交信息。

[root@localhost test]# svn commit -m "Hello"
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'user01': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Adding hello.html
Transmitting file data .
Committed revision 1.

现在hello.html被成功地添加到了版本库中,并且修订版本号自动增加了1。

五、SVN解决冲突

版本冲突原因:

假设 A、B 两个用户都在版本号为 100 的时候,更新了 kingtuns.txt 这个文件,A 用户在修改完成之后提交 kingtuns.txt 到服务器, 这个时候提交成功,这个时候 kingtuns.txt 文件的版本号已经变成 101 了。同时B用户在版本号为 100 的 kingtuns.txt 文件上作修改, 修改完成之后提交到服务器时,由于不是在当前最新的 101 版本上作的修改,所以导致提交失败。

使用admin用户修改hello.html
[root@localhost test]# cat hello.html
HelloWorld! http://www.test.com/tong
[root@localhost test]# cat hello.html
HelloWorld! http://www.test.com/tong
[root@localhost test]# svn diff
Index: hello.html
===================================================================
--- hello.html (revision 1)
+++ hello.html (working copy)
@@ -1 +1 @@
-HelloWorld! http://www.test.com/
+HelloWorld! http://www.test.com/tong
提交修改
[root@localhost test]# svn commit -m "Tong"
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Sending hello.html
Transmitting file data .
Committed revision 2.
使用user01继续修改hello.html
[root@localhost test]# svn diff
Index: hello.html
===================================================================
--- hello.html (revision 1)
+++ hello.html (working copy)
@@ -1 +1 @@
-HelloWorld! http://www.test.com/
+HelloWorld! http://www.test.com/test
[root@localhost test]# cat hello.html
HelloWorld! http://www.test.com/test
尝试提交
[root@localhost test]# svn commit -m "Hello02"
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Sending hello.html
Transmitting file data .svn: Commit failed (details follow):
svn: File '/hello.html' is out of date

这时我们发现提交失败了。

因为此时,Hello.html 已经被admin修改并提交到了仓库。Subversion不会允许user01提交更改,因为admin已经修改了仓库,所以我们的工作副本已经失效。

为了避免两人的代码被互相覆盖,Subversion不允许我们进行这样的操作。所以我们在提交更改之前必须先更新工作副本。所以使用update命令,如下:

[root@localhost test]# svn update
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Conflict discovered in 'hello.html'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options: mc
G hello.html
Updated to revision 2.

这里输入"mc",以本地的文件为主。你也可以使用其选项对冲突的文件进行不同的操作。

默认是更新到最新的版本,我们也可以指定更新到哪个版本。

svn update -r6

此时工作副本是和仓库已经同步,可以安全地提交更改了

[root@localhost test]# svn commit -m "change Hello02"
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Sending hello.html
Transmitting file data .
Committed revision 3.

六、SVN版本回退

[root@localhost test]# cat hello.html
HelloWorld! http://www.test.com/test?
[root@localhost test]# svn status
M hello.html
[root@localhost test]# svn revert hello.html
Reverted 'hello.html'
[root@localhost test]# svn status
[root@localhost test]# cat hello.html
HelloWorld! http://www.test.com/test

revert 操作不单单可以使单个文件恢复原状, 而且可以使整个目录恢复原状。恢复目录用 -R 命令,如下:

svn revert -R test

但是,假如我们想恢复一个已经提交的版本怎么办。

为了消除一个旧版本,我们必须撤销旧版本里的所有更改然后提交一个新版本。这种操作叫做 reverse merge。

首先,找到仓库的当前版本,现在是版本22,我们要撤销回之前的版本,比如版本21:

svn merge -r 22:21 hello.html

七、SVN查看历史信息

通过svn命令可以根据时间或修订号去除过去的版本,或者某一版本所做的具体的修改。以下四个命令可以用来查看svn 的历史:

  • svn log: 用来展示svn 的版本作者、日期、路径等等。
  • svn diff: 用来显示特定修改的行级详细信息。
  • svn cat: 取得在特定版本的某文件显示在当前屏幕。
  • svn list: 显示一个目录或某一版本存在的文件。

(1)svn log

可以显示所有的信息,如果只希望查看特定的某两个版本之间的信息,可以使用:

查看当前版本号
[root@localhost test]# svn info
Path: .
URL: svn://192.168.1.69:3700/test
Repository Root: svn://192.168.1.69:3700/test
Repository UUID: d120c548-f91f-4039-8278-1648c0339d64
Revision: 2
Node Kind: directory
Schedule: normal
Last Changed Author: admin
Last Changed Rev: 2
Last Changed Date: 2018-02-26 12:08:37 +0800 (Mon, 26 Feb 2018) [root@localhost test]# svn log -r 1:2
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
------------------------------------------------------------------------
r1 | user01 | 2018-02-26 12:01:34 +0800 (Mon, 26 Feb 2018) | 1 line Hello
------------------------------------------------------------------------
r2 | admin | 2018-02-26 12:08:37 +0800 (Mon, 26 Feb 2018) | 1 line Tong
------------------------------------------------------------------------

如果只想查看某一个文件的版本修改信息,可以使用 svn log 文件路径。

[root@localhost test]# svn log hello.html
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
------------------------------------------------------------------------
r3 | admin | 2018-02-26 12:13:32 +0800 (Mon, 26 Feb 2018) | 1 line change Hello02
------------------------------------------------------------------------
r2 | admin | 2018-02-26 12:08:37 +0800 (Mon, 26 Feb 2018) | 1 line Tong
------------------------------------------------------------------------
r1 | user01 | 2018-02-26 12:01:34 +0800 (Mon, 26 Feb 2018) | 1 line Hello
------------------------------------------------------------------------

如果希望得到目录的信息要加 -v。

如果希望显示限定N条记录的目录信息,使用 svn log -l N -v。

[root@localhost test]# svn log -l 2 -v
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
------------------------------------------------------------------------
r2 | admin | 2018-02-26 12:08:37 +0800 (Mon, 26 Feb 2018) | 1 line
Changed paths:
M /hello.html Tong
------------------------------------------------------------------------
r1 | user01 | 2018-02-26 12:01:34 +0800 (Mon, 26 Feb 2018) | 1 line
Changed paths:
A /hello.html Hello
------------------------------------------------------------------------

(2)svn diff

用来检查历史修改的详情。

  • 检查本地修改
  • 比较工作拷贝与版本库
  • 比较版本库与版本库

如果用 svn diff,不带任何参数,它将会比较你的工作文件与缓存在 .svn 的"原始"拷贝。

[root@localhost test]# svn diff
Index: hello.html
===================================================================
--- hello.html (revision 3)
+++ hello.html (working copy)
@@ -1 +1 @@
-HelloWorld! http://www.test.com/test
+HelloWorld! http://www.test.com/test?123456

比较工作拷贝和版本库

[root@localhost test]# svn diff -r 2 hello.html
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Index: hello.html
===================================================================
--- hello.html (revision 2)
+++ hello.html (working copy)
@@ -1 +1 @@
-HelloWorld! http://www.test.com/tong
+HelloWorld! http://www.test.com/test?123456

比较版本库与版本库

[root@localhost test]# svn diff -r 1:2 hello.html
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
Index: hello.html
===================================================================
--- hello.html (revision 1)
+++ hello.html (revision 2)
@@ -1 +1 @@
-HelloWorld! http://www.test.com/
+HelloWorld! http://www.test.com/tong

(3)svn cat

如果只是希望检查一个过去版本,不希望查看他们的区别,可使用svn cat

[root@localhost test]# svn cat -r 2 hello.html
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
HelloWorld! http://www.test.com/tong

(4)svn list

可以在不下载文件到本地目录的情况下来察看目录中的文件:

[root@localhost test]# svn list svn://192.168.1.69:3700/test
Authentication realm: <svn://192.168.1.69:3700> test
Password for 'admin': -----------------------------------------------------------------------
ATTENTION! Your password for authentication realm: <svn://192.168.1.69:3700> test can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details. You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
hello.html

SVN使用—常用命令及避免冲突的方法的更多相关文章

  1. 03-Git常用命令演示、冲突演示

    Git常用命令演示 Git的的思想其实和SVN还是蛮像的,可以参考之前svn文章一起加深了解. 新建一个user2目录,clone下代码. 修改readme.txt git status 可以看到re ...

  2. linux svn客户端 常用命令

    查看文件或者目录状态: [root@v01 ~]# svn status online/ #正常情况下没显示 [root@v01 ~]# svn status online/ #如果有变动会有如下显示 ...

  3. SVN客户端常用命令

    1. 将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如: cd /home/www  #进入准备获取的项目路径 svn checkout svn: ...

  4. CentOS系统下安装SVN及常用命令

    1.SVN的安装: yum install subversion 2.服务端命令 svnserver -- 控制svn系统服务的启动等 svnadmin -- 版本库的创建.导出.导入.删除等 svn ...

  5. SVN 部分常用命令

    1. svn status 提交前显示出本地文本和版本库文本的区别 [url=] L abc.c # svn已经在.svn目录锁定了abc.c M bar.c # bar.c的内容已经在本地修改过了 ...

  6. svn的常用命令

    svn :看log.版本库.增删.提交 (1)svn up //代码更新到最新版本. (2)svn checkout //将代码checkout出来. (3)svn revert -R ./ //将代 ...

  7. svn版本控制常用命令

    查看未提交的文件(含新增的和修改过得) svn status   检出代码 svn checkout svn://192.168.0.10/v2019.1/spark \ /Users/zhangsa ...

  8. Vi/Vim常用命令(附快捷切换方法)

    vi/vim有两种模式,正常(命令行)模式 和编辑模式,在命令行模式下,任何键盘输入都是命令,在编辑模式下,键盘输入的才是字符. 启动/关闭Vi/Vim 启动:vi 打开 Vi/Vim编辑器vi 文件 ...

  9. Windows下查看端口常用命令以及关闭端口的方法

    1.C:\Users\JavaKam> netstat -ano|findstr 1099 TCP LISTENING TCP [::]: [::]: LISTENING 2.出现: C:\Us ...

随机推荐

  1. page coloring小结

    页着色是一种通过选择性物理页分配来实现把虚存映射到特定cache位置的软件方法. 最早引入页着色概念是在计算机体系结构,是为了解决地址别名问题引入的. 首先对cache是使用虚拟地址还是物理地址的问题 ...

  2. linux 知识点拾遗

    文件名称 在 Linux 底下,每个档案或文件夹的文件名称最长能够到达 255 的字符,加上完整路径时,最长可达 4096 个字符; 因为 Linux 在文字接口下的一些指令操作关系,一般来说,您在设 ...

  3. crontab读不来环境变量

    无法识别java nohup: failed to run command `java': No such file or directory 那么在shell中加两行即可解决 . /etc/prof ...

  4. 蓝桥杯 第三届C/C++预赛真题(3) 比酒量(数学题)

    有一群海盗(不多于20人),在船上比拼酒量.过程如下:打开一瓶酒,所有在场的人平分喝下,有几个人倒下了.再打开一瓶酒平分,又有倒下的,再次重复...... 直到开了第4瓶酒,坐着的已经所剩无几,海盗船 ...

  5. 设置label中的对齐方式

    QLabel.setAlignment (self, Qt.Alignment) 下面查看Qt.Alignment: Qt.AlignmentFlag This enum type is used t ...

  6. Oracle之完全卸载

    1. 开始->设置->控制面板->管理工具->服务 停止所有Oracle服务. 2. 开始->程序->Oracle - OraHome81->Oracle I ...

  7. win 8升级win8.1的几个问题

        对于习惯了win7来说的小朋友,win8的使用简直有种想砸电脑的冲动啊,特别是玩游戏的小朋友,win8各种bug.对于游戏.咳咳,我只是多说了,我们都是爱学习的好孩子,少玩游戏,少撸.简单说一 ...

  8. Java中匿名内部类

    匿名内部类也就是没有名字的内部类 正因为没有名字,所以匿名内部类只能使用一次,它通常用来简化代码编写 但使用匿名内部类还有个前提条件:必须继承一个父类或实现一个接口 实例1:不使用匿名内部类来实现抽象 ...

  9. angular-ui-bootstrap 日历控件国际化

    angularjs-angular-ui-bootstrap-changing-language http://stackoverflow.com/questions/19671887/angular ...

  10. idle命令行按ALT+P重复调出上个语句

    idle命令行按ALT+P重复调出上个语句