Recently in LAMP Category

lucid安装scribe手记

| No Comments | No TrackBacks

 

首先apt-get install必须的依赖
apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
在thrift.apache.org上下载0.7.0版本的thrift
./configure --with-ruby=no
make
make install
然后cd contrib/fb303
./bootstrap.sh
make
make install
安装fb303是必须的,否则scribe无法编译
scribe是从git上获取的
安装步骤同fb303
 
编译好scribe之后,运行src/scribed examples/example1.conf,能正常运行即为编译成功
如果遇到src/scribed: error while loading shared libraries: libthrift.so.0: cannot open shared object file: No such file or directorycuw错误,将/usr/local/lib/libthrift.so.0 append到/etc/ld.so.conf并执行ldconfig即可
 
之前安装失败, google半天收到不少误导...结果发现把thrift && fb303 && scribe的文件中apache::thrift和namespace apache都替换成facebook::thrift和namespace facebook也能编译...仔细看了下才知道要先安装fb303

php使用imagek时segment fault

| 1 Comment | No TrackBacks

 

在ubuntu 10.04.2 LTS 64bit下使用apt安装的imagemagick和php/imagick, 在处理图片的时候会segment fault退出。
strace显示是处理完毕munmap出现的segment fault...
处理方式是显式设定OMP_NUM_THREADS=1, 是imagemagick使用的libgomp seg faulting。
openmp的committee说openMP在与其他线程模型一块工作时行为未定义...
所以想正常的用,要么编译的时候disable掉openmp, 要么显式export OMP_NUM_THREADS=1, 因为没有一个能在运行时关掉openmp的方法
悲催的是--disable-openmp选项由于经常link失败, 而imagemagick也没有针对这个问题提供2个版本的编译脚本...so

dokuwiki的noindex和nofollow疑问

| No Comments | No TrackBacks

dokuwiki的页面很多都是<meta name="robots" content="noindex,nofollow"/>

默认设置下,在页面修改5天后才会改成index和follow

When creating/modifying a page allow search engines to index it after this time (in seconds). This works by adding <meta name=“robots” content=“noindex,nofollow” /> in the output if the specified time hasn't elapsed.

参考链接:

doku config:indexdelay

doku config:relnofollow

关于Readability

| No Comments | No TrackBacks

一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到

#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

原因是当你给一个timestamp设置为on update current_timestamp的时候,其他的timestamp字段需要显式设定default值

但是如果你有两个timestamp字段,但是只把第一个设定为current_timestamp而第二个没有设定默认值,mysql也能成功建表, 但是反过来就不行...参见这里

参考文章:

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?

MySQL的timestamp类型自动更新问题

mysqldoc - timestamp

数据库字段复用的基本原理与示例

| 1 Comment | No TrackBacks

 

一、逻辑代数基础:
 
1,数字用二进制表示,所有可能出现的数只有0和1两个。
2,基本运算只有“与”、“或”、“非”三种。
 
与运算定义为:(用 & 表示与运算)
 
0 & 0 = 0 
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1
 
可以简单理解为:只要有一个0,结果就是0,和乘法类似。
 
或运算定义为:(用 | 表示与运算)
 
0 | 0 = 0 
0 | 1 = 1
1 | 0 = 1
1 | 1 = 1
 
可以简单理解为:只要有一个1,结果就是1,和加法类似。
 
二、逻辑运算示例:
 
01111010101010101111111111111111 & 1100000 = 1100000
 
一般可以理解为:
 
如果要获取一个数字某N位的数值,只需要将这个数字与2的N-1次方(掩码)进行与运算即可。

解决php soap wsdl error一例

| 1 Comment | No TrackBacks

备忘,查了半天:
客户在访问我提供的WebService(预定义,即WSDL模式)的时候,在Linux服务器上运行example的时候是ok的,但是在他的windows开发机上运行失败。
报了俩错:
WARNING是I/O warning : failed to load external entity,
FATAL ERROR是: Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:Couldn't load from 'somewhere' in somefileStack trace: #0 somefile: SoapClient->SoapClient('https://tg.qq.c...', Array) #1 {main} thrown in somefile on line 

官方文档说requirements是GNOME Xml Library, 就是libxml必须高于2.5.4
但是实际上WSDL的SoapClient还必须加载cURL模块,如果服务端是https,则还需要加载openssl模块
在windows下就是需要php_curl.dll和php_openssl.dll, curl同时依赖于libeay32.dll, ssleay32.dll, openssl依赖于libeay32.dll

accesslog中好玩的一些东西

| 1 Comment | No TrackBacks

闲的无聊看自己的access log, 发现几条好玩的记录:

61.143.61.81 - - [18/May/2010:04:37:04 +0800] "GET /cert/bazs.cert HTTP/1.0" 404 212 "-" "Mozilla/4.0"
222.81.81.128 - - [21/May/2010:13:26:05 +0800] "GET /cert/bazs.cert HTTP/1.0" 404 212 "-" "Mozilla/4.0"
202.101.104.125 - - [22/May/2010:07:46:02 +0800] "GET /cert/bazs.cert HTTP/1.0" 404 212 "-" "Mozilla/4.0"

cert/bazs.cert 是宫刑部的爬虫么?

============华丽的分割线============

63.220.4.250 - - [23/May/2010:00:20:51 +0800] "GET /include/dialog/zhmnselect_soft_post.php HTTP/1.1" 404 237 "-" "Mozilla/4.0"
63.220.4.250 - - [23/May/2010:00:20:51 +0800] "GET /include/dialog/select_soft_post.php HTTP/1.1" 404 233 "-" "Mozilla/4.0"

select_soft_post.php 是dedeCMS5.5中的文件, 貌似是有个页面变量未初始化的bug...

============终于是个大陆的爬虫了============

218.65.59.6 - - [23/May/2010:04:17:17 +0800] "GET /pgjxupfile.htm HTTP/1.1" 404 212 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:18 +0800] "GET /upfile.htm HTTP/1.1" 404 208 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:18 +0800] "GET /upfile.htm HTTP/1.1" 404 208 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:18 +0800] "GET /cvqwupfile_adpic.asp HTTP/1.1" 404 218 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:19 +0800] "GET /upfile_adpic.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:19 +0800] "GET /upfile_adpic.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:19 +0800] "GET /edyzupfile_article.asp HTTP/1.1" 404 220 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:20 +0800] "GET /upfile_article.asp HTTP/1.1" 404 216 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:20 +0800] "GET /upfile_article.asp HTTP/1.1" 404 216 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:20 +0800] "GET /uzafupfile_flash.asp HTTP/1.1" 404 218 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:21 +0800] "GET /upfile_flash.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:21 +0800] "GET /upfile_flash.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:21 +0800] "GET /ewpqupfile_photo.asp HTTP/1.1" 404 218 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:22 +0800] "GET /upfile_photo.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:22 +0800] "GET /upfile_photo.asp HTTP/1.1" 404 214 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:22 +0800] "GET /nrdrupfile_soft.asp HTTP/1.1" 404 217 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:23 +0800] "GET /upfile_soft.asp HTTP/1.1" 404 213 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:23 +0800] "GET /upfile_soft.asp HTTP/1.1" 404 213 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:23 +0800] "GET /kypxupload.asp HTTP/1.1" 404 212 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:24 +0800] "GET /upload.asp HTTP/1.1" 404 208 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:24 +0800] "GET /upload.asp HTTP/1.1" 404 208 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:24 +0800] "GET /axwwupload_Dialog.asp HTTP/1.1" 404 219 "-" "Mozilla/4.0"
218.65.59.6 - - [23/May/2010:04:17:25 +0800] "GET /upload_Dialog.asp HTTP/1.1" 404 215 "-" "Mozilla/4.0"
 

global-htags安装备忘

| No Comments | No TrackBacks

os: ubuntu 9.04
htags: 5.6.1 (apt-get install global)

运行global-htags(manual)生成html文件时,提示缺少文件

htags: skeleton file '/usr/share/gtags/global.cgi.tmpl' not found.

除了global.cgi.tmpl之外,还缺少bless.sh.tmpl和style.css, 这三个文件没有打包。
详细地址参见: http://cvs.savannah.gnu.org/viewvc/global/global/htags/
而gtags本身已经废弃了,所以需要创建gtags目录
mkdir -p /usr/share/gtags/
wget http://cvs.savannah.gnu.org/viewvc/*checkout*/global/global/htags/global.cgi.tmpl.in
wget http://cvs.savannah.gnu.org/viewvc/*checkout*/global/global/htags/bless.sh.tmpl
wget http://cvs.savannah.gnu.org/viewvc/*checkout*/global/global/htags/style.css

懒得下载的话,自行编译也可以 -_-#!

==========分割线==========

htags页面搜索提示500 International Error

在Apache2的ErrorLog提示Premature End of Script Headers, 解决办法是:
将HTML/cgi-bin/global.cgi第一行的 #! @PERL@ 改成 #!/usr/bin/perl

如果搜索时提示Error: Tag file (GTAGS) not found. 需要检查GPATH, GRTAGS, GSYMS, GTAGS四个文件是否在HTML的同级目录

==========分割线==========

遗憾的是: htags在php方面只支持php4, 未表明支持php5, 似乎是对php的oo没有支持

==========分割线==========

windows下的sshfs client

| No Comments | No TrackBacks

sshfs是基于GNU/Linux和fuse的软件,大家都很熟悉,不熟悉可以参考这里.

sshfs一般都是在Linux上使用, 但是sshfs client有一个windows实现, 名叫dokan. 官方网站说支持xp, vista和2k3。一般来说win7下使用兼容模式可以跑legacy程序,不幸的是dokan不行.  兼容模式可以运行,但是没法读取,CPU全满。在2k3下dokan倒是跑的挺好.

--------

要不是samba协议没法在公网跑...实在是不想折腾sshfs@windows这种不靠谱的玩意啊