2011年12月21日
摘要: php中文字符串长度及定长截取问题使用str_len("中国") 结果为6,php系统默认一个中文字符长度为3,可改用mb_strlen函数获得长度,mb_substr函数截取字符mb_strlen($str, "utf-8"); //1汉字为1字符mb_strlen($str, "gb2312"); //系统会认为1汉字为2字符mb_strlen($str); //如果没有添加,系统会认为1汉字为3字符int mb_strlen ( string str [, string encoding] )string mb_substr ( 阅读全文
posted @ 2011-12-21 18:38 架构师刀哥 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 相关参考资料: http://man.cx/start-stop-daemon(8) http://cronolog.org/usage.html http://book.opensourceproject.org.cn/lamp/ruby/railscook/opensource/0596527314/i_0596527314_chp_13_sect_6.html安装cronologcronolog是个简单的日志切分插件,常见的经典应用就是切分apache的单个庞大日志,按日期保存安装:----------------------------------------------------- 阅读全文
posted @ 2011-12-21 18:18 架构师刀哥 阅读(254) 评论(0) 推荐(0) 编辑
摘要: python编码规范http://google-styleguide.googlecode.com/svn/trunk/pyguide.html判断对象是否含有某属性if hasattr(object, 'attribute')反射获取类实例globals()['ClassName']()python日期转换字符串到日期: import time timeInDate = time.strptime(timeInStr,"%Y-%m-%d %H:%M:%S") 日期到字符串:timeInStr = time.strftime("%Y 阅读全文
posted @ 2011-12-21 17:25 架构师刀哥 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 用命令查询系统是32位还是64位getconf LONG_BIT or getconf WORD_BIT例如:[root@sy02 /]# getconf LONG_BIT64file command例如:[root@sy02 /]# file /bin/ls/bin/ls: ELF 64-bit ... 阅读全文
posted @ 2011-12-21 16:55 架构师刀哥 阅读(406) 评论(0) 推荐(0) 编辑