How to set up SSH key based authorization configuration(Easy steps…)

1. Generate rsa public key
ssh-keygen -t rsa
2. Upload the public key to server
scp id_rsa.pub user@server:location
3. Logon to server
ssh user@server
4. Stream the public key content to the authorized_key file
cat id_rsa.pub >> ~/.ssh/authorized_keys
Done
Posted in Linux World | Leave a comment

关于Thinkpad W510 ubuntu下睡眠唤醒后小红点中键失效的解决办法

这个bug的情况是这样的:

当ubuntu睡眠唤醒之后,小红点中键失效了

在论坛里找的多数解决方案是用gpointing-device-settings设置,但是这个是设置让小红点中键生效,而解决不了睡眠唤醒后小红点的悲剧…

关于Thinkpad的bug的解决办法呢,还是要看Thinkwiki,不过虽然我找到了下面这篇文章,可是仍然没有解决问题…

链接:http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint

接下来我搜到了这样一篇文章,算是解决了这个问题。

链接:http://psung.blogspot.com/2010/04/thinkpad-trackpoint-scrolling-in-ubuntu.html

具体步骤如下:

创建并修改文件

sudo vim /usr/share/X11/xorg.conf.d/20-thinkpad.conf

修改文件内容:

Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TrackPoint"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection

重启gdm

ctrl+alt+F1 进入终端
sudo /etc/init.d/gdm restart

问题解决~

Posted in Linux World | Leave a comment

关于Thinkpad W510 ubuntu睡眠的bug临时解决方案

这个在Thinkwiki里有提到:

http://www.thinkwiki.org/wiki/Category:W510

Suspend not implemented yet in USB 3.0 (xhci) driver – system cannot suspend unless driver is unloaded first – https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

看情况呢,是跟USB 3.0的驱动有关,所以我觉得很有可能带有USB 3.0端口的笔记本都会遇到这个问题…

临时解决方案是这个链接的42楼:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

以下是操作步骤:

创建或修改这个文件:

sudo vim /etc/pm/sleep.d/05_xhci

添加或修改文件内容:

#!/bin/sh
# Fix some issues with USB3
 
if [ "$1" = "suspend" ]
then
modprobe -r xhci_hcd
fi
 
if [ "$1" = "resume" ]
then
modprobe xhci_hcd
fi

修改文件权限(不确定是否为必须):

sudo chmod 755 /etc/pm/sleep.d/05_xhci

问题解决~

Posted in Linux World | Leave a comment

CSE634大作业时关于opencv的一些资料

Opencv中文 http://www.opencv.org.cn/index.php/首页

Opencv Basic structure http://opencv.willowgarage.com/documentation/basic_structures.html

Opencv 中文论坛 内存问题: http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=11678

Opencvx  on Google Code http://code.google.com/p/opencvx/

Opencv笔记 查找轮廓 http://westice.javaeye.com/blog/721225

Opencv教学 手势识别 http://rickykwan.iworkshop.com.hk/2010/01/375.html

Opencv人脸检测及示例 http://www.javaeye.com/topic/463668

百度知道 Opencv手势识别系统 http://zhidao.baidu.com/question/153472412.html?push=ql

Opencv轮廓提取 http://www.cppblog.com/qianqian/archive/2009/07/27/91390.html

手和手指检测 http://www.openframeworks.cc/forum/viewtopic.php?f=8&t=1916

Opencv 2.0 Reference http://opencv.willowgarage.com/documentation/index.html

Opencv的一些经验总结 http://hi.baidu.com/wmsunny/blog/item/8ddeb1dfc22f4e5d95ee375e.html

轮廓的查找,表达,绘制 http://www.cnblogs.com/xrwang/archive/2010/03/20/1666684.html

The condensation algorithm http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/ISARD1/condensation.html

P.S. 附加一个

关于wxWidgets的类型转换: http://blog.csdn.net/puny/archive/2008/09/04/2882546.aspx

Posted in OSU的学术生活 | Leave a comment

关于Virtualbox设置共享文件夹的方法

1.在linux下建立一个共享文件夹,并记录下它的路径。

2. 在Virtualbox虚拟机关机状态下,选择Settings->Shared Folders,把上步共享文件夹添加到路径中去。

3. 开机之后,选择 我的电脑->映射网络驱动器,路径写\vboxsrv共享文件夹的名字

O了

Posted in Linux World | 3 Comments

Thinkpad touchpad打开双指滚动的方法

网上搜索了好多,常见的结果在我这里不起作用

比如用synclient -m 50这样的句子,系统给我的回复是:

Can't access shared memory area. SHMConfig disabled?

尝试了好多如何打开SHMconfig的方法,网上主要分两种:

1. 修改xorg.conf

2. 修改hal的policy

我这里都不行,始终无法打开

最后终于找到这样一个帖子(8楼有解决办法)

我把它贴到这里,大家可以参考一下
1. Install “Pointing Devices”

2. Open System / Preferences / Pointing Devices and disable Vertical and Horizontal Scrolling.

3. Open a terminal (ctrl + alt + t) and execute this commands:
Code:

synclient HorizTwoFingerScroll=1
synclient VertTwoFingerScroll=1
synclient EmulateTwoFingerMinZ=40
synclient EmulateTwoFingerMinW=8

4.Open a terminal (ctrl + alt + t) and execute this commands:
Code:

gconf-editor

5. Navigate and find this key: /desktop/gnome/peripherals/touchpad/scroll_method

6. Assign the value ’2′

7.Open a terminal (ctrl + alt + t) and execute this commands:
Code:

cat /usr/share/X11/xorg.conf.d/50-synaptics.conf

8. Copy the Identifier name, in my case, it was “Touchpad catchall”
Code:

Identifier "touchpad catchall"

9. Execute this command, as a Super User.
Code:

sudo gedit /usr/share/X11/xorg.conf.d/50-twofingerscroll.conf

10. Write this, making sure to put your Identifier.
Code:

Section "InputClass"
Identifier "touchpad catchall"
MatchProduct "SynPS/2 Synaptics TouchPad"
MatchDevicePath "/dev/input/event*"
Option "VertTwoFingerScroll" "on"
Option "EmulateTwoFingerMinW" "8"
Option "EmulateTwoFingerMinZ" "40"
EndSection
Posted in Linux World | Leave a comment

Thinkpad W510 + ubuntu10.10的一些配置

自从做毕设转到archlinux以后,好久都没有用过ubuntu了,目睹了ubuntu 10.04和ubuntu 10.10的推出

前两天终于把ubuntu 10.10装到机器上了

“终于”二字是有原因的,我下载了好几个发行版的镜像,打算做到U盘里,然后U盘启动,后来发现,不论我用什么软件或者镜像,U盘启动都无法成功

说是找不到介质,我查了一下,大约是U盘启动很多时候都会遇到的问题,boot device not showing up after 30 seconds and thrown into ramfs$

archlinux 论坛上有关于此的讨论 https://bbs.archlinux.org/viewtopic.php?pid=600013

以及这篇文章提到的解决办法

我照着里面的解决方法试了一下,失败

无奈之后,只能买了一盒可以刻录的CD-Rom,刻了一张盘,装上去了。

关于ubuntu-indicator的一些改动

这个东西很有意思,是ubuntu10.04换UI推出的?(我好久都不用ubuntu了,具体历史记不太清楚了…)

这个东西很好用,把邮件,IM, SNS都集成在了一起,节约面板空间,很好的一个小东西

不过话说回来,自带的evolution实在是没用用过,无奈之下,只有到网上寻找解决方案

删除evolution:

sudo rm /usr/share/indicators/messages/applications/evolution

对于我想使用的thunderbird来说,我是这样做的

sudo mv /usr/share/indicators/messages/applications/evolution /usr/share/indicators/messages/applications/thunderbird

然后把里面的内容替换为

/usr/share/applications/thunderbird.desktop

就可以了

关于Thinkpad W510的小红点儿鼠标中键的解决办法:

安装gpointing-device-settings这个东西

然后再System->Preferences->Pointing devices里面,就可以修改了

修改IBM Trackpoint把Use wheel emulation选中,button选择2,再把Enable vertical scroll选中就可以了

目前touchpad的多点触摸我还没有搞定,以后再试试

P.S.说点儿题外话

今天没有去看OSU每年一度的为了Beat Michigan而表达死战之决心的跳湖而表示遗憾…

主要原因是昨天为了准备考试,在图书馆待了一夜,我怕我再去跳个湖,可能就真成跳湖的了…

室友去了,玩的很high的样子,去年据说有1W多人跳湖,平时如果跳湖的话,是违法的,将会受到监禁+做社区服务+罚款等等处罚。

每年,只有为了这次盛大的比赛而跳湖是个例外,警察们不光不去抓人,还要保护大家,恩,有点儿意思~

据说明年Columbus不是主场了,所以,可能明年看到跳湖的机会也不大了….

在图书馆我还发现,老美什么时间自习的人都有啊…有个哥们1点去的,4点回家了,看的我无比羡慕…

有些遗憾,不过人生哪有那么完美的,有点儿遗憾生活才有乐趣嘛~

刚才睡醒,信笔涂鸦几句,继续去睡了,养足精神,明天继续拼Project。

Finish.

Posted in Linux World | 6 Comments

20101031万圣节

西方的万圣节,类似于中国的鬼节吧,据说本科生包了一个酒吧,有party,据说化妆好了可以免费进,不过没去,这个热闹就不去凑了~

室友同学送给了室友一个南瓜灯,我也趁机合了个影,哈哈~

2010万圣节

2010万圣节

Posted in Calm Life | 5 Comments

20101012

来美国整整一个月了,发两张最近用手机拍的照片,纪念一下~

(2011注:blog重新安装,两张照片找不到了…sigh)

Posted in Calm Life | Leave a comment

Python学习笔记(二)

关于Python内建数据类型Dict,List,Tuple
Dict
Dict定义了one to one between key and values。
Dict的声明:

1
2
3
>>> d={"key":"value"}
>>> d
{'key': 'value'}

Dict是大小写敏感的:

1
2
3
>>> d["Key"]="value"
>>> d
{'Key': 'value', 'key': 'value'}

Dict支持多种数据类型:

1
2
3
>>> d[1]="one"
>>> d
{1: 'one', 'Key': 'value', 'key': 'value'}

从dict中删除条目以及清空条目:

1
2
3
4
5
6
7
8
9
>>> d[1]="one"
>>> d
{1: 'one', 'Key': 'value', 'key': 'value'}
>>> del d[1]
>>> d
{'Key': 'value', 'key': 'value'}
>>> d.clear()
>>> d
{}

List
List有点儿Java中ArrayList的感觉
List的声明:

1
2
3
4
5
6
>>> list=[]
>>> list
[]
>>> list=["one","two","three","four","five"]
>>> list
['one', 'two', 'three', 'four', 'five']

List带有负数索引,算法是List[-n]==List[len(List)-n]
for example

1
List[-3]=List[5-2]==List[2]

切割List

1
2
3
4
5
6
7
8
>>> list
['one', 'two', 'three', 'four', 'five']
>>> list[1:3]
['two', 'three']
>>> list[1:-1]
['two', 'three', 'four']
>>> list[0:3]
['one', 'two', 'three']

其中,切割的时候,list[first_value,second_value]中,包括从list[first_value]的值但小于list[second_value]的值。
还有种缩写体:

1
2
3
4
5
6
>>> list[:3]
['one', 'two', 'three']
>>> list[3:]
['four', 'five']
>>> list[:]
['one', 'two', 'three', 'four', 'five']

这种情况中,冒号如果左边为空就是从0开始,右边为空就是从List右边结尾处开始,左右都为空的话,就是整个List
向List里面添加元素

1
2
3
4
5
6
7
8
9
>>> list.append("new")
>>> list
['one', 'two', 'three', 'four', 'five', 'new']
>>> list.insert(2,"new")
>>> list
['one', 'two', 'new', 'three', 'four', 'five', 'new']
>>> list.extend(["extend","elements"])
>>> list
['one', 'two', 'new', 'three', 'four', 'five', 'new', 'extend', 'elements']

其中append()方法是向List结尾处添加元素,insert(first_value,second_value)是插入元素,first_value是插入位置,second_value是插入的值。
extend()方法是连接List,例子中["extend","elements"]是另一个List
关于appendextend的区别

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
>>> list=['a','b','c']
>>> list
['a', 'b', 'c']
>>> list.extend(['d','e','f'])
>>> list
['a', 'b', 'c', 'd', 'e', 'f']
>>> len(list)
6
>>> list[-1]
'f'
>>> list=['a','b','c']
>>> list.append(['d','e','f'])
>>> list
['a', 'b', 'c', ['d', 'e', 'f']]
>>> len(list)
4
>>> list[-1]
['d', 'e', 'f']

其中,如果append和extend的参数都是一个的话,这俩应该是没有区别的,但是,要是参数为多个,就有区别了,extend将它的参数视为list,extend的行为是把这两个list接到一起,append是将它的参数视为element,作为一个整体添加上去的。
List里可以有任意的数据类型,所以,要分清这俩函数的区别。
List中的查找

1
2
3
4
5
6
7
8
9
10
11
12
>>> list
['one', 'two', 'new', 'three', 'four', 'five', 'new', 'extend', 'elements']
>>> list.index("five")
5
>>> list.index("new")
2
>>> list.index("li")
Traceback (most recent call last):
File "", line 1, in
ValueError: list.index(x): x not in list
>>> "li"in list
False

其中,index方法是查找该元素第一次出现的位置,然后返回它的脚标。
假若元素没有找到,python会报错提示。判断元素是否在List里,用in这个方法,在的话,返回True,不在,返回False。
List的删除:
用remove方法。
List的操作符:

1
2
3
4
5
6
7
8
9
10
11
12
>>> list
['a', 'b', 'c', 'd', 'e', 'f']
>>> list=list+['example','new']
>>> list
['a', 'b', 'c', 'd', 'e', 'f', 'example', 'new']
>>> list+=['another']
>>> list
['a', 'b', 'c', 'd', 'e', 'f', 'example', 'new', 'another']
 
>>> list=['1','2']*3
>>> list
['1', '2', '1', '2', '1', '2']

其中,“+”操作符跟extend方法相近,”*”类似于一个重复操作器(repeater)。
List=[‘1’,‘2’]*3和List=[‘1’,‘2’]+[‘1’,‘2’]+[‘1’,‘2’]相等。
Tuple
Tuple的声明:

1
2
3
4
5
6
7
8
9
>>> tuple=("one","two","three","four","five")
>>> tuple
('one', 'two', 'three', 'four', 'five')
>>> tuple[0]
'one'
>>> tuple[-1]
'five'
>>> tuple[1:3]
('two', 'three')

类似List,不过,要注意,这里用的是圆括号。
Tuple里没有方法,这个要注意!!!
Tuple属于元素固定的List,并且运行起来比List快,假如你需要写一些需要保护的数据,可以考虑它~

Over~

Posted in Other Technology | 1 Comment