Ubuntu 12.04 LTS 中文输入法的安装

作者:Rui 发布时间:September 9, 2015 分类:Linux,CLOUD 浏览:690 No Comments

安装 Ubuntu 12.04 着实费力一番功夫,老是在用 Ubuntu 来引导 Windows,结果 Ubuntu 倒是能用,一进入 Windows 就蓝屏,于是又重装 Windows 好几遍…直到后来认识了 EasyBCD 我才走上正途…

我装的是英文版的 Ubuntu12.04,如果安装中文版,会自动安装中文输入法,这篇文章也是为了以后重装 Ubuntu 做一个准备

废话不多说,进入正题:

第一步:安装语言包

进入 “System Settings”

1.png

找到 “Language Support” 那一项,点击进入
1.png

阅读剩余部分...

Ubuntu 14.04 国内更新源

作者:Rui 发布时间:September 9, 2015 分类:Linux,CLOUD 浏览:904 No Comments

1、备份源

# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、编辑源文件/etc/apt/sources.list,并添加以下地址

# sudo gedit /etc/apt/sources.list

网易163源:

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 

搜狐源:

deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse

oschina源:

deb http://mirrors.oschina.net/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-backports main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.oschina.net/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.oschina.net/ubuntu/ trusty-updates main restricted universe multiverse

3、 更新源索引,使新源生效

# sudo apt-get update

4、其他版本的源
只要将trusty 换成相应的版本的代号即可

更多国内源请参考:

http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8#Precise.2812.04.29.E7.89.88.E6.9C.AC

Git中reset与revert的使用

作者:Rui 发布时间:September 9, 2015 分类: 浏览:632 No Comments

1. reset(版本撤回)

格式:

git reset [-q] [<commit>] [--] <paths>... 
git reset (--patch | -p) [<commit>] [--] [<paths>...] 
git reset (--soft | --mixed | --hard | --merge | --keep) [-q] [<commit>]

用法:
git reset --mixed 回退commit,保留源码,默认方式.
git reset --soft 回退至某个版本,只回退commit信息
git reset --hard 彻底回退至某个版本
回退所有内容到上一个版本 git reset HEAD^
回退a.py这个文件的版本到上一个版本 git reset HEAD^ a.py
向前回退到第3个版本 git reset –soft HEAD~3
将本地的状态回退到和远程的一样 git reset –hard origin/master
回退到某个版本 git reset 057d
回退到上一次提交的状态,按照某一次的commit完全反向的进行一次commit git revert HEAD

2. revert(撤销操作)

撤销某次操作,此次操作之前的commit都会被保留. git reset 是撤销某次提交,但是此次之后的修改都会被退回到暂存区.

阅读剩余部分...

Hibernate JPA 联合主键

作者:Rui 发布时间:September 9, 2015 分类:JAVA,Hibernate 浏览:844 No Comments

两个或多个字段组成的主键,我们叫联合主键,在JPA中定义联合主键需要单独定义一个主键类来表示联合主键。

下面是定义一个主键类:

public class UserRolePk implements Serializable {
    public User user;
 
    public Role role;
 
    public UserRolePk() {}
 
    public int hashCode() {
        return (this.user.id + "_" + this.role.id).hashCode();
    }
 
    public boolean equals(UserRolePk userRolePk) {
        return this.user.equals(userRolePk.user) && this.role.equals(userRolePk.role);
    }
}

阅读剩余部分...

SSH Password-less login

作者:Rui 发布时间:September 9, 2015 分类:Linux,CLOUD 浏览:710 No Comments

工作中有管理多台Linux主机,经常SSH远程登录其他主机,每次输入密码比较麻烦,SSH Password-less login 是解决这个问题比较好的方法之一。该文章记录一下SSH Password-less login 的具体使用步骤。

####设置环境

SSH client : 10.147.15.71
SSH Remote Login Server: 10.147.6.205

该示例中,我们要设置从 IP 71的服务器SSH 自动登录205的服务器

Step 1: 创建 Authentication SSH-Kegen Keys – (10.147.15.71)

# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xp017734/.ssh/id_rsa): [Press enter key]
Created directory '/home/xp017734/.ssh'.
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Press enter key]
Your identification has been saved in /home/xp017734/.ssh/id_rsa.
Your public key has been saved in /home/xp017734/.ssh/id_rsa.pub.
The key fingerprint is:
5f:ad:40:00:8a:d1:9b:99:b3:b0:f8:08:99:c3:ed:d3 xp017734@cbjlx9438
The key's randomart image is:
+--[ RSA 2048]----+
|        ..oooE.++|
|         o. o.o  |
|          ..   . |
|         o  . . o|
|        S .  . + |
|       . .    . o|
|      . o o    ..|
|       + +       |
|        +.       |
+-----------------+

阅读剩余部分...