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.

Saturday, March 24, 2012

[转载]Matlab向量化优化小结


1、给定一个列向量v1,和一个行向量v2, 计算矩阵M,使得M(i, j) = v1(i) + v2(j)。一种常用的向量化实现:m = length(v1);
n = length(v2);
M = repmat(v1, [1, n]) + repmat(v2, [m, 1]);

Tuesday, February 28, 2012

关于Matlab找不到vs2008或vs2005编译器的解决办法

http://blog.csdn.net/zokie/article/details/6240088

机器上安装了matlab2009a和vs2008 ,今天想要编译一个工具箱,可是在运行mex -setup是只有一个matlab自带的Lcc可选。在网上找了很久,原来是matlab在识别vs的编译器时,使用的是"version"英文,而vs08显示的版本信息是"优化编译器"五个汉字,匹配不上,所以找不到。

解决办法很简单(虽然找了很久),用记事本打开matlab/r2009a/bin/mexsetup.pm文件,找到 correc_version函数(第477行),将这个函数中的return ($version =~ /Version.$versionNumber/i);改成return ($version =~ /优化编译器.$versionNumber/i);即可。

Thursday, February 23, 2012

在windows下运行Felzenszwalb的Discriminatively Trained Deformable Part Models matlab代码

http://blog.csdn.net/pozen/article/details/7023742


Felzenszwalb的Discriminatively Trained Deformable Part Models  URL:http://www.cs.brown.edu/~pff/latent/

据说是目前最好的object detection method。我自己试了一下,效果真的不错。不过代码只可以在unix/linux/mac上运行。

(Pascal voc 近两届obj detection冠军的方法都是基于此框架的,但是别人的研究是不公开的,顺便表示一下不满)

但是呢,只要稍作修改就可以在windows上跑啦:

1,dt.cc 添加一句:#define int32_t  int

2,features.cc &  resize.cc中添加:

     #define bzero(a, b) memset(a, 0, b) 
     int round(float a) { float tmp = a - (int)a; if( tmp >= 0.5 ) return (int)a + 1; else return (int)a; }

3,resize.cc中:  alphainfo ofs[len]; 这句改成:alphainfo *ofs = new alphainfo[len];  当然在同一作用域后面加上:delete []ofs

4,compile.m中:结尾加上mex -O fconv.cc

% use one of the following depending on your setup
% 1 is fastest, 3 is slowest

% 1) multithreaded convolution using blas
% mex -O fconvblas.cc -lmwblas -O fconv
% 2) mulththreaded convolution without blas
% mex -O fconvMT.cc -o fconv
% 3) basic convolution, very compatible
% mex -O fconv.cc -o fconv
mex -O fconv.cc

其他几个fconv用了其他平台的multiThread在windows上跑不起!

 

改了上边的几个地方后,就可以运行了。跑demo.m看效果吧,,,

Thursday, February 9, 2012

Connect to Ubuntu 11.04 from Windows via Remote Desktop

From: http://www.liberiangeek.net/2011/06/connect-to-ubuntu-11-04-from-windows-via-remote-desktop/



Last week we showed you how to use Remote Desktop Protocol (RDP) to connect from Ubuntu to Windows 7. Today, I will show you how to use the same Remote Desktop Protocol to connect from Windows to Ubuntu 11.04 Natty Narwhal. If you ever wanted to connect to Ubuntu via Remote Desktop Connection, then this tutorial will help you do that.
There are many ways to connect to Ubuntu from Windows and RDP protocol is just one of the many ways.

Getting started:

To get started, press Ctrl – Alt – T on your keyboard to open Terminal. When Terminal opens, type the command below to install xrdp server.
 
 sudo apt-get install xrdp
natty_xrdp

Ubuntu PIL JPEG support

from: http://dimamoroz.com/blog/3-ubuntu-pil-jpeg-support/


Ubuntu PIL JPEG support


Got an IOError exception, while trying to process image using PIL, with a next error message:

encoder jpeg not available

PIL is installed within python virtual environment. Figured out, I have no development files for libjpeg installed, so PIL compiles without JPEG support.

The solution is to:

$ sudo apt-get install libjpeg62-dev

Notice: 62 is from libjpeg version 6.2, so it may vary.

Finally, recompile PIL:

pip install -U PIL

PIL has JPEG support for now and everything works like a charm.

/*************************************
I also did this before this work:
************************************/

I had the same problem, but I needed to make symbolic links to find the needed libraries:
$ cd /usr/lib
$ sudo ln -s x86_64-linux-gnu/libjpeg.so
$ sudo ln -s x86_64-linux-gnu/libz.so
$ sudo ln -s x86_64-linux-gnu/libfreetype.so

Wednesday, February 8, 2012

How to install the latest stable git release on Ubuntu 10.04 LTS

From http://adammonsen.com/post/665

March 21, 2011

How to install the latest stable git release on Ubuntu 10.04 LTS

Filed under: Default — adam @ 11:39 am PST

I want a very stable desktop, so I'm using Ubuntu 10.04 "lucid lynx" LTS (long-term support). I also want features of the latest version of git. I ran these commands to grab the latest stable git release without futzing with any manual downloading or dpkg.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Thank you, Anders Kaseorg!

Distribution packages in a release typically lag behind those released by upstream maintainers. This is expected: part of what makes a release stable is intentionally not introducing changes. PPAs (personal package archives) are a handy way to get at packages not already present in the distribution/release you are using. Backports are handy too, but I didn't see the latest git in there for Ubuntu 10.04.

Back in the old days I used to manually scour some combination of rpmfind, DAG, Dries, ATrpms, rpmforge, (and others!) to find the right packages and dependencies.


Tuesday, February 7, 2012

Ubuntu broadcom 4313 无线网卡无法使用的解决办法

用wicd解决了,很好用。

原文地址:http://qiudao.sinaapp.com/?p=185

原文:

Ubuntu broadcom 4313 无线网卡无法使用的解决办法

新安装了ubuntu 11.10,无线网卡无法启用,网上搜寻良久,得到以下解决办法:

sudo rmmod acer-wmi

这样就可以打开无线了!无线信号也会出来 ,但是有一个问题就是,只要机器一重启,那个文件又被修改回来了!

解决每次重启之后文件又自己恢复的方法是:

blacklist acer-wmi
这个命令加入到/etc/modprobe.d/blacklist.conf文件最后即可。

以上解决方法来自:

http://forum.ubuntu.org.cn/viewtopic.php?t=328097

---------无敌分割线---------------------

以下摘录其它的解决方法。经尝试,方法1有用,但得用wicd才能连接,而在系统提示里没有相关的连接信息。

http://www.luochunhui.com/id/1258

在升级ubuntu 11.04之后,无线网卡无法找到了。原本以为是我的个案问题,没有将其解决办法share出来,今天听到另一童鞋也出现了这个问题,于是写下。

升级后症状:
1. 无法连接无线网络,在net manager中显示无线网卡禁用 disabled.
2. 不管怎么按无线网络硬开关或点击启用无线网络,都无法点亮无线网络指示灯。

解决办法:
1. 换一个无线网卡管理器: wicd
sudo apt-get install wicd
接下来 ctrl+F2, 键入wicd,并打开。
在面板中应该可以找到你的无线网卡。启用并连接。

如果在1中还是无法找到无线网卡,则需要进行一下网卡开启设置。

2. 使用rfkill 开启开关:
rfkill list
应该可以看到无线网卡,及其软硬开关状态。如果是hard block为true,则按计算机无线网络硬开关开启(部分机器,如果是在windows进行的硬关闭,则linux无法开启,得回到windows开启 后,再进入linux)。如果soft block为true, 则使用命令开启:
rfkill unblock 0 #0为你的无线网卡编号,在rfkill list中可以看到。

3. 开启网卡
sudo ifconfig wlan0 up
如果遇到 RFKILL错误,重试第二步,并等待2分钟。

4. 回到第一步进行刷新,查看是否找到无线网卡。

在本人机器上,重新启动后,偶尔需要重新设置第2,3步。尚没有自动设置。以上办法仍旧是一个临时方案。
最终还得等待ubuntu官方更新。



Dan XIE

Saturday, December 3, 2011

Frontiers in Computer Vision


http://www.frontiersincomputervision.com/

Organizers

  • Alan Yuille, UCLA
  • Aude Oliva, MIT

Advisory Board

  • David Forsyth, UIUC
  • William Freeman, MIT
  • Martial Hebert, CMU
  • Anil Jain, MSU
  • Daniel Kersten, UMN
  • Daphne Koller, Stanford
  • Yann LeCun, NYU
  • Jitendra Malik, UC Berkeley
  • Antonio Torralba, MIT
  • Rick Szeliski, Microsoft

Sunday, November 27, 2011

如何用DOS命令,获取一个目录下的文件数目

http://blog.csdn.net/greenerycn/article/details/1526494

※ 来源:・水木社区 http://newsmth.net・[FROM: 218.247.129.*]

发信人: nwn (Lie), 信区: DOS
标  题: Re: 如何用DOS命令,获取一个目录下的文件数目?
发信站: 水木社区 (Fri Mar  9 09:54:55 2007), 站内

dir /b | find /v /c "$$$$" > 1.log
该结果统计当前目录下的文件和目录数。

如果只需要文件,使用 dir /b /a-d | find /v /c "$$$$" >1.log
--
※ 来源:・水木社区 newsmth.net・[FROM: 125.46.17.*]

今天去水木看到的.果然强.我来解释一下意思

dir /b  使用空格式(没有标题信息或摘要)。

dir /a-d /a是显示具有指定属性的文件。d是目录,-d就是去掉目录

通道符,把dir /b的输出当中后面find的输入

find

/v 显示所有未包含指定字符串的行。

/c 仅显示包含字符串的行数

"$$$$" 特殊字符,一般文件中都没这个字符,不过可以用$$$$来命名文件夹,所以我建议用冒号,这个不能当作文件夹或者文件的名字.

> 输出到

1.log  文件

 

这个比较好:dir /b | find /v /c ":" > 1.log

Saturday, November 19, 2011

SIFT算法学习心得


SIFT算法学习心得


这篇文章主要介绍 SIFT 算法。希望通过对 SIFT 算法的总结来更加深入地了解"尺度不变特征变换",除此之外,也加深来对 SURF 算法的理解。
附件:SIFT—Scale Invariant Feature Transform
1 SIFT 发展历程及主要思想
SIFT算法由D.G.Lowe 1999年提出,2004年完善总结。后来Y.Ke将其描述子部分用PCA代替直方图的方式,对其进行改进。是一种提取局部特征的算法,在尺度空间寻找极值点,提取位置,尺度,旋转不变量。
2 SIFT算法的主要特点
a) SIFT特征是图像的局部特征,其对旋转、尺度缩放、亮度变化保持不变性,对视角变化、仿射变换、噪声也保持一定程度的稳定性;
b) 独特性(Distinctiveness)好,信息量丰富,适用于在海量特征数据库中进行快速、准确的匹配;
c) 多量性,即使少数的几个物体也可以产生大量SIFT特征向量;
d) 高速性,经优化的SIFT匹配算法甚至可以达到实时的要求;
e) 可扩展性,可以很方便的与其他形式的特征向量进行联合。
3 SIFT算法步骤:
1) 检测尺度空间极值点;
2) 精确定位极值点;
3) 为每个关键点指定方向参数;
4) 关键点描述子的生成

Monday, November 14, 2011

eps/png等图片格式相互转换

http://hi.baidu.com/sxpspace/blog/item/b3783cdeedf8d45194ee37c2.html
png,jpeg,gif和eps格式的互转问题

windows平台

常用latex的朋友,通常要把我们遇到的jpeg,png,gif格式转换为eps格式,下面为之说明下,望对您有所帮助。

将jpeg,png,gif转换为eps格式,推荐使用bmeps命令行工具,比起用鼠标点来点去,好用得多,对多文件处理,更是方便。它已包含在ctex安装包中。
更多请见其帮助。
bmeps -h          获得帮助。

Sunday, October 30, 2011

[转载]R语言矩阵运算

主要包括以下内容:
创建矩阵向量;矩阵加减,乘积;矩阵的逆;行列式的值;特征值与特征向量;QR分解;奇异值分解;广义逆;backsolve与fowardsolve函数;取矩阵的上下三角元素;向量化算子等.

1   创建一个向量
在R中可以用函数c()来创建一个向量,例如:
> x=c(1,2,3,4)
> x
[1] 1 2 3 4