My Blog List

Thursday, August 13, 2015

swapping caps lock and control keys

from http://www.kodiva.com/post/swapping-caps-lock-and-control-keys
I test it on Windows 7, Windows 8 and Windows 10.

Works in: Windows XP, Windows Vista, Windows 7


In our opinion this is the best way to swap the control and caps lock keys in Windows because you don't have to rely on any external program and the registry edit works 100% perfectly (for the paranoid). 

Why should one bother changing the caps lock and control keys, what's wrong with the control key where it is? After extensive testing, our conclusion is that - if you use the control key a lot (like in Emacs or Vim), then you should definitely swap the control and caps lock keys as it's extremely ergo-dynamic to have the control key in the home row.
  1. Click Start -> Run
  2. Type: regedit, and click OK
  3. Go to: HKEY_LOCAL_MACHINE -> System -> CurrentControlSet -> Control -> KeyBoard Layout
    Note: KeyBoard Layout, and not KeyBoard Layouts
  4. Right-click: Keyboard Layout, and select New -> Binary value
  5. Rename: New Value #1 -> Scancode Map
  6. Right click: Scancode Map -> Modify
  7. 0000  00 00 00 00 00 00 00 00
    0008  03 00 00 00 1d 00 3a 00
    0010  3a 00 1d 00 00 00 00 00  
    0018
    
  8. Close regedit and restart your computer


Friday, March 22, 2013

matlab 有关figure的问题


matlab 有关figure的问题  

2011-08-01 15:51:16|  分类: matlab |字号 订阅
1.在ppt用到一些曲线copy figure,这个操作在菜单edit下。
但是最初matlab默认的figure背景属性为灰色,但是我们希望得到的是白色的。以下操作可以实现:
(1) figure('color','w');
(2) figure('color',[1 1 1]);
(3) set(gcf,'color','w');
(4) set(0,'defaultfigurecolor','w') (这是最简单的一种方法:只需要设置默认的figurecolor)

2.设置plot的属性
xlabel() ylabel() 设置横纵坐标轴的标签
xlim() ylim() 设置横纵坐标的表示区间
title() 设置figure的title

Tuesday, July 17, 2012

libmysqlclient_r.so.16: cannot open shared object file

转载1

http://www.xieyanfu.com/?p=153

前端时间把系统升级成 ubuntu 12.04,今天在执行之前写的一个 Python 爬虫程序时,突然报出 ImportError: Error loading object 'crawler.pipelines.MysqlPipeline': libmysqlclient_r.so.16: cannot open shared object file: No such file or directory 这个错误。
原来 ubuntu 12.04 把 libmysqlclient 16 升级成了 libmysqlclient 18,所以才导致这个问题,一个偷懒的解决办法如下:
cd /usr/lib/i386-linux-gnu/
sudo ln -sf libmysqlclient_r.so.18 libmysqlclient_r.so.16
如果你有更好的解决办法,欢迎分享!

转载2

转载3


我的问题

我的问题用这两个方法都不能解决,Ubuntu升级到了12.04,mysql升级到了5.5。和1不一样的是我的是64位系统,路径不一样,用locate查找。
综合起来是这样
$sudo updatedb
$locate libmysqlclient_r.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18.0.0
$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.16

到此,解决了。

Wednesday, April 18, 2012

最简单的方式使用Discriminatively Trained Deformable Part Models训练自己的模型 zz

最简单的方式使用Discriminatively Trained Deformable Part Models训练自己的模型


最简单的方式使用Discriminatively Trained Deformable Part Models训练自己的模型(原创,适合没有linux基础和matlab基础的人)

最近尝试使用Pedro FelzenszwalbDiscriminatively Trained Deformable Part Modelshttp://www.cs.brown.edu/~pff/)训练自己的模型,因为基本没用过matlablinux,所以开始比较糊涂,后来看了pozenhttp://blog.csdn.net/pozen/article/details/7023742,收获很大,所以自己尝试了一下,现在已经跑起来了。

Pozen的工作还是主要讲怎么在windows下训练,其中怎么准备数据说的不是很清楚,我这里稍微补充一下吧。(注意:我是在linux下跑的,windows下还要参考pozen的工作)

Monday, April 9, 2012

stringstream的用法


【本文来自】http://www.builder.com.cn/2003/0304/83250.shtml
http://www.cppblog.com/alantop/archive/2007/07/10/27823.html
使用stringstream对象简化类型转换C++标准库中的<sstream>提供了比ANSI C的<stdio.h>更高级的一些功能,即单纯性、类型安全和可扩展性。在本文中,我将展示怎样使用这些库来实现安全和自动的类型转换。
为什么要学习
如果你已习惯了<stdio.h>风格的转换,也许你首先会问:为什么要花额外的精力来学习基于<sstream>的类型转换呢?也许对下面一个简单的例子的回顾能够说服你。假设你想用sprintf()函数将一个变量从int类型转换到字符串类型。为了正确地完成这个任务,你必须确保证目标缓冲区有足够大空间以容纳转换完的字符串。此外,还必须使用正确的格式化符。如果使用了不正确的格式化符,会导致非预知的后果。下面是一个例子:
int n=10000;
chars[10];
sprintf(s,”%d”,n);// s中的内容为“10000”

到目前为止看起来还不错。但是,对上面代码的一个微小的改变就会使程序崩溃:

int n=10000;
char s[10];
sprintf(s,”%f”,n);// 看!错误的格式化符
在这种情况下,程序员错误地使用了%f格式化符来替代了%d。因此,s在调用完sprintf()后包含了一个不确定的字符串。要是能自动推导出正确的类型,那不是更好吗?
进入stringstream
由于ns的类型在编译期就确定了,所以编译器拥有足够的信息来判断需要哪些转换。<sstream>库中声明的标准类就利用了这一点,自动选择所必需的转换。而且,转换结果保存在stringstream对象的内部缓冲中。你不必担心缓冲区溢出,因为这些对象会根据需要自动分配存储空间。

Sunday, March 25, 2012

You and Your Research

http://www.paulgraham.com/hamming.html



Richard Hamming: You and Your Research

Talk at Bellcore, 7 March 1986

The title of my talk is, ``You and Your Research.'' It is not about managing research, it is about how you individually do your research. I could give a talk on the other subject-- but it's not, it's about you. I'm not talking about ordinary run-of-the-mill research; I'm talking about great research. And for the sake of describing great research I'll occasionally say Nobel-Prize type of work. It doesn't have to gain the Nobel Prize, but I mean those kinds of things which we perceive are significant things. Relativity, if you want, Shannon's information theory, any number of outstanding theories-- that's the kind of thing I'm talking about.

Now, how did I come to do this study? At Los Alamos I was brought in to run the computing machines which other people had got going, so those scientists and physicists could get back to business. I saw I was a stooge. I saw that although physically I was the same, they were different. And to put the thing bluntly, I was envious. I wanted to know why they were so different from me. I saw Feynman up close. I saw Fermi and Teller. I saw Oppenheimer. I saw Hans Bethe: he was my boss. I saw quite a few very capable people. I became very interested in the difference between those who do and those who might have done.