My Blog List

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