学以致用

focus on Python , C++, and some interest in Go and R

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年6月23日

摘要: 使用远程连接mysql的时候碰到这样的错误:Host is not allowed to connect to this MySQL server。简单的解决方式如下:(1)修改表。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"mysql -u root -p按照提示输入密码mysql>use mysql;my 阅读全文
posted @ 2011-06-23 10:59 Jerry.Kwan 阅读(619) 评论(0) 推荐(0) 编辑

2011年6月17日

摘要: 在Win7下将Sphinx安装成windows服务时碰到如下错误:Install the searchd system as a Windows service:C:\Sphinx\bin> C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf.in --servicename SphinxSearchInstalling service...FATAL: OpenSCManager() failed: code=5, error=Access is denied.究其原因是因为Win7(也包括Vista)中将adm 阅读全文
posted @ 2011-06-17 14:08 Jerry.Kwan 阅读(2898) 评论(0) 推荐(0) 编辑

2011年6月14日

摘要: import inspectdef get_current_function_name(): return inspect.stack()[1][3]class MyClass: def function_one(self): print "%s.%s invoked"%(self.__class__.__name__, get_current_function_name())if __name__ == "__main__": myclass = MyClass() myclass.function_one()动态获取当前运行的函数名很方便,特别是对于 阅读全文
posted @ 2011-06-14 15:10 Jerry.Kwan 阅读(20050) 评论(0) 推荐(1) 编辑

摘要: kill -9 `ps -ef|grep “processname” | grep -v "grep"|awk '{print $2} '`其中processname就要要kill的进程名 阅读全文
posted @ 2011-06-14 11:30 Jerry.Kwan 阅读(1489) 评论(0) 推荐(0) 编辑

2011年6月13日

摘要: pytest Democonftest.py# -*- coding: utf-8 -*-import threadingimport subprocessimport timeimport pytestdef run_with_timeout(timeout = None): def _decorator(f): def _wrapper(*args, **kwargs): def _f(*args, **kwargs): try: _result = f(*args, **kwargs) except Exception , e: thread._exception = e else: t 阅读全文
posted @ 2011-06-13 15:37 Jerry.Kwan 阅读(716) 评论(0) 推荐(0) 编辑

2011年6月12日

摘要: If the languages were not installed during the installation, the same can be installed by YUM command. Use following command to install Hindi and Chinese support. # yum groupinstall {LANGUAGE-support}# yum install "@Hindi Support"# yum install "@Chinese Support"Use yum grouplist 阅读全文
posted @ 2011-06-12 15:05 Jerry.Kwan 阅读(484) 评论(0) 推荐(1) 编辑

摘要: 要使用easy_install安装pytest,应该先在CentOS下安装setuptools,通过如下命令完成:yum install python-setuptools安装完setuptools后,执行:easy_install pytest即可完成pytest安装 阅读全文
posted @ 2011-06-12 14:56 Jerry.Kwan 阅读(701) 评论(0) 推荐(0) 编辑

2011年6月10日

摘要: [root@bogon test]# vi /etc/sysconfig/i18nLANG="zh_CN.GB18030"LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN" SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en" SYSFONT="lat0-sun16"重启系统即可。如果还是不行,可以这么做:1、console终端乱码在/etc/profile文件的最后一行添加如下内容:export LC_ALL="z 阅读全文
posted @ 2011-06-10 13:46 Jerry.Kwan 阅读(819) 评论(0) 推荐(0) 编辑

摘要: import psycopg2Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/psycopg2-2.4.1-py2.4-linux-x86_64.egg/psycopg2/__init__.py", line 71, in ? from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWIDImportError: 阅读全文
posted @ 2011-06-10 08:13 Jerry.Kwan 阅读(4161) 评论(0) 推荐(0) 编辑

2011年6月7日

摘要: libkyototycoon.so.2: cannot open shared object file: No such file...Solution:sudo vim /etc/ld.so.confadd the following : /usr/local/libsudo ldconfigafter that , it should working. 阅读全文
posted @ 2011-06-07 13:43 Jerry.Kwan 阅读(377) 评论(0) 推荐(0) 编辑