1. 日期输出格式化所有日期、时间的api都在datetime模块内。1. datetime => stringnow = datetime.datetime.now()now.strftime('%Y-%m-%d %H:%M:%S')输出2012-03-05 16:26:23.870105strf... Read More
posted @ 2014-04-24 11:08 siyed Views(210) Comments(0) Diggs(0) Edit
MySQLdb/mysql-python安装时EnvironmentError: mysql_config not found Read More
posted @ 2014-04-22 18:41 siyed Views(626) Comments(0) Diggs(0) Edit
在redis 中存储中文,读取会出现乱码(其实不是乱码,只是不是我们存的中文显示)1 redis> set test "我们" 2 OK 3 redis> get test 4 "\xe6\x88\x91\xe4\xbb\xac" 如何在get时取到它的中文呢?只需要在redis-cli 后... Read More
posted @ 2014-04-21 12:08 siyed Views(7240) Comments(0) Diggs(1) Edit
1 $info["fulltext"] = preg_replace_callback(2 $search2,3 function($matches) use ($search, $uniq) {4 return preg_replace($search,$uniq,$matches[0]);5 },6 $info["fulltext"]7 ); Read More
posted @ 2014-04-08 13:39 siyed Views(126) Comments(0) Diggs(0) Edit
location/keywords {indexindex.php;try_files$uri$uri//keywords/index.php?q=$uri&$args;}apache:.htaccess 1 Options +FollowSymLinks 2 IndexIgnore */* 3 RewriteEngine on 4 #RewriteCond %{REQUEST_URI} !^.*(\.htm|\.xml|\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.GIF|\.PNG|\.JPG|\.JPEG|\.DAT|\.dat|\.php)$|.* Read More
posted @ 2014-04-08 09:30 siyed Views(830) Comments(0) Diggs(0) Edit
/** * GBKASCII转换成utf8 */ public function to_utf8($str){ $detect = array('ASCII', 'GBK', 'UTF-8'); $encoding = mb_detect_encoding($str, $detect); $str = mb_convert_encoding($str, 'UTF-8', $encoding); return $str; } Read More
posted @ 2014-04-04 17:58 siyed Views(199) Comments(0) Diggs(0) Edit
1 class cls_image { 2 var $error_no = 0; 3 var $error_msg = ''; 4 //var $images_dir = IMAGE_DIR; 5 //var $data_dir = DATA_DIR; 6 var $images_dir = GOODS_PATH1; 7 var $data_dir = GOODS_PATH1; 8 var $bgcolor = ''; 9 var $type_maping = array( 10 1 =... Read More
posted @ 2014-03-18 15:53 siyed Views(438) Comments(0) Diggs(0) Edit
1 0, 48 'msg' => '' 49 ); 50 51 /** 52 * 要使用这个类,你一定要在php的ini文件中进行fastdfs的配置 53 * 54 * @throws FastDFSException 55 */ 56 public function __construct() { 57 $configFile = ''; 58 $ini = parse_ini_file(p... Read More
posted @ 2014-03-18 15:30 siyed Views(2768) Comments(0) Diggs(1) Edit
--1 MongoDB 使用的锁 MongoDB 使用的是“readers-writer”锁,可以支持并发但有很大的局限性,当一个读锁存在,许多读操作可以使用这把锁,然而, 当一个写锁的存在,一个单一的写操作会 exclusively 持有该锁,同时其它读,写操作不能使用共享这个锁;举个例子,假设一个集合里有 10 个文档,多个 update 操作不能并发在这个集合上,即使是更新不同的文档。--2 锁的粒度 在 2.2 版本以前,mongod 只有全局锁;在 2.2 版本开始,大部分读写操作只锁一个库,相对之前版本,这个粒度已经下降,例如如果一个 mongod 实例上有 5 个库,如果只对一个 Read More
posted @ 2014-03-14 15:39 siyed Views(831) Comments(0) Diggs(0) Edit
1.centos Sphinx 先安装 yum install postgresql-libs yum install unixODBCCoreSeek 安装:http://www.coreseek.cn/products-install/install_on_bsd_linux/##中文测试环境检查:$ locale##以下为核心项,locale为zh_CN.UTF-8,就可以正常显示和输入中文;locale设置功能由操作系统自身支持,BSD/Linux均可开启;该功能,不是coreseek提供的!!!##如果不能正常显示中文,则后面的中文测试部分无法正常进行,但不会影响coreseek的. Read More
posted @ 2014-03-12 13:57 siyed Views(204) Comments(0) Diggs(0) Edit