用镜头记录,用心灵体验 | 订阅本站 | 所有笔记 | 亲和力设计 | 流量

DB2 学习笔记

博客话题:DB2,Linux,Web,业余无线电,户外,摄影,截拳道,Thankpad,其他

Web

Web 有关的一些技术与非技术话题,Web 2.0, 网站、日志等

Dreamhost 系统漏洞可导致帐户被完全控制

安全漏洞:已知任一Dreamhost注册用户的主email地址,即可获得对该帐户的完全访问权限。  适用范围:Dreamhost WebPanel 发现日期:2007-3-10 漏洞描述 在Dreamhost 注册的用户(包括免费帐户),均可通过修改自己的主email地址(primary e-mail contact address)为与系统中其他用户已设置的主email地址相同的方式,来获得对修改后的email地址原所属帐户的完全控制,被入侵用户正常的Dreamhost 服务不受影响,也不会受到任何警告和通知。 背景介绍 Dreamhost 的注册用户可以使用WebID 或者主email地址登录WebPanel...

安全漏洞:已知任一Dreamhost注册用户的主email地址,即可获得对该帐户的完全访问权限。 

适用范围:Dreamhost WebPanel

发现日期:2007-3-10

漏洞描述

在Dreamhost 注册的用户(包括免费帐户),均可通过修改自己的主email地址(primary e-mail contact address)为与系统中其他用户已设置的主email地址相同的方式,来获得对修改后的email地址原所属帐户的完全控制,被入侵用户正常的Dreamhost 服务不受影响,也不会受到任何警告和通知。

背景介绍

Dreamhost 的注册用户可以使用WebID 或者主email地址登录WebPanel ,管理帐户,WebID 由系统根据用户姓名自动生成,主email地址由用户在注册时提供,系统对两者都会进行唯一性检查,不允许重复。主email地址作为用户的联系方式,可以在profile 中随时进行更改,WebID 则不允许更改。

* NOTE-2: Each new Web ID MUST have a unique primary e-mail contact address! This is because you can log into the control panel either using your Web ID or your primary e-mail contact address. Also, the primary contact address is also the ONLY address that can be used for referrals! Additional address can also be added if you like, these can be duplicated across other Web IDs, but the primary contact address must be unique.

漏洞测试步骤 

  1. 模拟用户A:在系统中注册免费帐户test1作为被入侵测试帐户,WebID为test1,主email 为test1@domain.com,密码:“111111”
  2. 模拟用户B:在系统中注册免费帐户test2作为入侵测试帐户,WebID为test2,主email 为test2@domain.com,密码:“222222”
  3. 用户B:登录test2帐户,编辑profile,将主email 地址修由test2@domain.com改为test1@domain.com,保存成功,退出登录
  4. 用户B:检查test2@domain.com 收件箱,收到一封email地址变更通知
  5. 用户A:检查test1@domain.com 收件箱,未收到任何来自Dreamhost的通知
  6. 用户B:使用test1@domain.com 和密码“222222” 登录,登录成功,并且获得了与用户A 相同的访问控制
  7. 用户B:使用WebID test1 和密码“222222” 登录,登录成功,获得对原有用户B 的资源访问。
  8. 用户A:使用test1@domain.com 和密码“111111” 登录,一切正常

原因

在进行主email 变更时,系统未进行与注册步骤相同的email唯一性检查,致使作为用户唯一标识之一的主email 可能发生重复。Dreamhost 将会混淆两个原本完全不相关的帐户。结果是,用户A使用更改后的用户B的email 以及自己原有密码可以登录成功,并获得了用户B帐户的完全控制权,而那个不幸的用户B没有得到任何警告,他仍然可以使用自己的email 和密码正常登录自己的管理界面。

此时,Dreamhost WebID 并没有被搞混,用户A可以使用WebID 替代email,保持对自己原有帐户的访问。不过,很多用户大概不会留意WebID , 有两个地方可以查知自己的WebID:

  1. Dreamhost 发送的邮件主题,例如: [xxxxx 8729481] DreamHost Payment Receipt,xxxxx 就是WebID
  2. 登录WebPanel,进入Edit Profile,界面显示:"Welcome, xxxxx. Logout",这里也能找到WebID

已将此问题反映给了Dreamhost 的Support Team,在问题得到修复之前,此篇日志不会被发布。

我会保持关注。

更新 2008-02-26

Dreamhost 已经修复此漏洞,下面是在profile 中修改主email的错误提示。

You cannot make sample@domain.com your primary address because another account already has it as its primary address!

Posted by Alex at 12:02 PM | Comments (0) | Edit | Taged: Dreamhost (4), 安全漏洞 (1)

Firefox Extension 思维导图

因为图片太宽,要完整显示,请点击这里暂时禁止样式单。 恢复样式单,请点击这里,或者刷新本页。 最近几天看有关Firefox Extension 的开发,有很多知识链接,使用MindManager 做了这个思维导图,链接可以点击。 更新了链接,增加了浏览指引小图标...

因为图片太宽,要完整显示,请点击这里暂时禁止样式单

恢复样式单,请点击这里,或者刷新本页。

Firefox Extension Why use XUL? Why use XUL? http://www.mozilla.org/js/spidermonkey/ http://www.mozilla.org/js/spidermonkey/ http://kb.mozillazine.org/Setting_up_extension_development_environment http://kb.mozillazine.org/Setting_up_extension_development_environment http://xulplanet.com/tutorials/xultu/ http://xulplanet.com/tutorials/xultu/ http://developer.mozilla.org/en/docs/About_JavaScript http://developer.mozilla.org/en/docs/About_JavaScript http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide http://www.cat-snow.com/post/146.html http://www.cat-snow.com/post/146.html http://www.cat-snow.com/post/137.html http://www.cat-snow.com/post/137.html http://www.xulplanet.com/references/elemref/ http://www.xulplanet.com/references/elemref/ http://www.cat-snow.com/post/140.html http://www.cat-snow.com/post/140.html http://www.cat-snow.com/post/145.html http://www.cat-snow.com/post/145.html http://www.mozilla.org/js/scripting/ http://www.mozilla.org/js/scripting/ http://kb.mozillazine.org/Extension_development http://kb.mozillazine.org/Extension_development http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference http://developer.mozilla.org/en/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System http://developer.mozilla.org/en/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System http://developer.mozilla.org/en/docs/Extensions http://developer.mozilla.org/en/docs/Extensions http://developer.mozilla.org/en/docs/XMLHttpRequest http://developer.mozilla.org/en/docs/XMLHttpRequest http://developer.mozilla.org/en/docs/Building_an_Extension http://developer.mozilla.org/en/docs/Building_an_Extension http://developer.mozilla.org/en/docs/Code_snippets http://developer.mozilla.org/en/docs/Code_snippets

最近几天看有关Firefox Extension 的开发,有很多知识链接,使用MindManager 做了这个思维导图,链接可以点击。

更新了链接,增加了浏览指引小图标

Posted by Alex at 2:43 AM | Edit | Taged: Firefox (7)

ASCII Art Pictures

888888888888888DDDDDDD8DNNNNNNNNNNNNDNN8DNNNDNDDNNNNNNNN8888888D8DDDD8DDDDDDDDD8 88888888888DDDDDDDDDDDDDNNNNNNNNNNNNNNNNDDDO8NNNNNNNNNNND8D8DDD8D8DDDDDDDDDDDDD8 88888888888DDDDDDDDDDDDNNMNNMNNNNMNNNNNNNDDDD8NNNNNNNNNNNDDDDDDDDDDDDDDDDDDDDDDD 88888888DDDDDDDDDDDDDDDNNNNNNNNNNNNNNNNNNNNDND8DNDNNNNNNNDDDDDDDDDDDDDDDDDDDDDDD 88888D8DDDDDDDDDDDDDDDDNNNNNNNNNNNDNNNNNNNNND88ODD8NNNNNDDDDDDDDDDDDDDDDDDDDDDDD 8888D =.?,78DIDDDD~ZDD$.MNNNNMNNNNNNNNNNNNNNDDONDZ$8NDNDDDDDDDDDDDDDDDDDDDDDDDDD 8888DD8,DDOD:.DD$8DDDDDN88NNNNNNNNNNNNNNNNDDDN$,,,:~NN78DDDDDDDDDDDDDDDDDDDDDDDD 8DDDDDD.DD8DOZ7D=DDDDDDNN.MNNNNNNNNNNND8$==:,.....,,NNN8DDDDDDDDDDDDDDDDDDDDDDDD D88DDD8.DDD+8D.OIDDDDDDDN.MNNNNNNNNDZ~~,,,:,,.......NNNNDDDDDDDDDDDDDDDDDDDDDDDD DDD88DD DDD?DD$N.DDDDDD8N+NNNNNNNNNDZ?~,,~:,,..,,,,.NNNDDDDDDDDDDDDDDDDDDDDDDDDD DD8DDDD DDONDDD=D.8DDD8N:MNMNNNNNNNNND?::?=?7NNZ:~~,7NNDDDDDDDDDDDDDDDDDDDDDDDDD 8DD8DD$Z$O77DDZIIDDD$ZDDDNNNDNNNNNNNNNND?$8O$?:~,,,.+N.8DDDDDD8D88DDDDDDDDDDDDD8 8DDDDDDDDDDDDO7DD$ZIDDDDDNNNDNNNNNNNNNNN+,,7NNM.Z:,.:7IDD8DDDDDD8DDDDDDDDDDDDDDD 888DDDDDDDD8NDD8=+:ODDDDDDNNDNDDNNZ?DNND:..:7?:.,...?.DDDDDDDDDDDDDDDDDDDDDDDDDD 8DDDDDDDDDD$DDDD,+DDDDDDDDDDDDDDDDZ?NDDD:...,~,,....:8DDDDDDDDDDDDDDDDDDDDDDDDDD...

888888888888888DDDDDDD8DNNNNNNNNNNNNDNN8DNNNDNDDNNNNNNNN8888888D8DDDD8DDDDDDDDD8
88888888888DDDDDDDDDDDDDNNNNNNNNNNNNNNNNDDDO8NNNNNNNNNNND8D8DDD8D8DDDDDDDDDDDDD8
88888888888DDDDDDDDDDDDNNMNNMNNNNMNNNNNNNDDDD8NNNNNNNNNNNDDDDDDDDDDDDDDDDDDDDDDD
88888888DDDDDDDDDDDDDDDNNNNNNNNNNNNNNNNNNNNDND8DNDNNNNNNNDDDDDDDDDDDDDDDDDDDDDDD
88888D8DDDDDDDDDDDDDDDDNNNNNNNNNNNDNNNNNNNNND88ODD8NNNNNDDDDDDDDDDDDDDDDDDDDDDDD
8888D =.?,78DIDDDD~ZDD$.MNNNNMNNNNNNNNNNNNNNDDONDZ$8NDNDDDDDDDDDDDDDDDDDDDDDDDDD
8888DD8,DDOD:.DD$8DDDDDN88NNNNNNNNNNNNNNNNDDDN$,,,:~NN78DDDDDDDDDDDDDDDDDDDDDDDD
8DDDDDD.DD8DOZ7D=DDDDDDNN.MNNNNNNNNNNND8$==:,.....,,NNN8DDDDDDDDDDDDDDDDDDDDDDDD
D88DDD8.DDD+8D.OIDDDDDDDN.MNNNNNNNNDZ~~,,,:,,.......NNNNDDDDDDDDDDDDDDDDDDDDDDDD
DDD88DD DDD?DD$N.DDDDDD8N+NNNNNNNNNDZ?~,,~:,,..,,,,.NNNDDDDDDDDDDDDDDDDDDDDDDDDD
DD8DDDD DDONDDD=D.8DDD8N:MNMNNNNNNNNND?::?=?7NNZ:~~,7NNDDDDDDDDDDDDDDDDDDDDDDDDD
8DD8DD$Z$O77DDZIIDDD$ZDDDNNNDNNNNNNNNNND?$8O$?:~,,,.+N.8DDDDDD8D88DDDDDDDDDDDDD8
8DDDDDDDDDDDDO7DD$ZIDDDDDNNNDNNNNNNNNNNN+,,7NNM.Z:,.:7IDD8DDDDDD8DDDDDDDDDDDDDDD
888DDDDDDDD8NDD8=+:ODDDDDDNNDNDDNNZ?DNND:..:7?:.,...?.DDDDDDDDDDDDDDDDDDDDDDDDDD
8DDDDDDDDDD$DDDD,+DDDDDDDDDDDDDDDDZ?NDDD:...,~,,....:8DDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDD$$D?D~$DDD8DDDDD8DDDDZDNDDDD+....,,,,.,+88DDDDDDDDDDDDDDDDDDDDDDDDDD
8DDDDDDDD8D8DDZDDDDD8DDDDDDDDDDDDNDNDNDD=...:,,,,,,ZDDDDDDDDDDDDDDDDDDDDDDDDDDDN
8D88D8DN.8O+8D.D.DDO$DD.DZDDDDDDNDDNNDD8=...,:,,,,,DDDDDDDDDDDDDDDDDDDDDDDDDDDDN
8D88D88D,DO+8D7D.8=D$DD.DDDDDDDDDDDDDDNNN=7=.,,,,,,DDDDDDDDDDDDDDDDDDDDDDDDDDDDD
888DDDDD,DO+DDDD.D~DDDD.DDDDDDDNNNNDNNNDII,,..,,,,DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
8D888DDD,88?DDDD DDDDDD.DDDNNNDNNNNNNNND,,..,,,,,:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
888D 8D8~88?DDID DDNDDD.DDNNMNNNNNNNNNNZ+,...~,,:8DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
88D8 DD.DDO?DN.D.DD7DDD N8NNNNNNNNNNNNNNNN?:,,,,DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
D8DDDDDDNDDDDDDDDDDDNDNDNM+NNMMMNNNNNDZ~:,,,,,,.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDD8.DN?88.DDD?D?ZDD=DD.NN:NNNNNNMNNNND7?~,,,,,.NNNNNNMNNDDDDDDDDDDDDDDDDDDDDDDD
DDDD OODDD.DDDID$,ND?NM.=MONNNNMMNNNNNNNO??I:,.ZNNNNNMMNMNDDDDDDDDDDDDDDDDDDDDDD
DDDD..DDDD.DDDID7N.DINN.MMNMMMMMMMNMNNNMM:=~,..MNNNNMMMMNMDDDDDDDDDDDDDDDDDDDDDD
DDDD.D.DDD.DDDID7DN.$NM.NNNNNMMMMMNNNNNMNN~::.DNNNNNNNMNNNMDDDDDDDDDDDDDDDDDDDDD
DDDD.DD.DD.DDDIDZMND$NN.NM?NNNNNNNNNMNNNMMMMMMNNNMNNNMNNNNNNDDDDDDDDDDDDDDDDDDDD
D8DD.NDN.NI7NN~N8DNN.NM.MO.NNNNMMNNMNNNNNMMNNMNNNNNNMMMNNNNNNNNDDDDDDDDDDDDDDDDD
DDDDDDDDNNDDDDNNNNNMMMNNNNMNNMMNMMNNNNNNNMNMNNNNDNNNNNMNNNNNNNNDDDDDDDDDDDDDDDDD
DDDDDD:NDDN+=NNN+NNNNM=+NNNNNNNMNNNNNNNNDNNNNNNNNNNNMNNNNNNNNMNDDDDDDDDDDDDDDDDD
DDDDDD:DDDDNM.N.MMMNNNNM.DNNNNNNNNNNMNNNNNNNNNNNNNNNNNNMMMNNNNNNNNNNDDDDDDDDDDDD
DDDDDD:NDDNNNZZDNNNNNNNN+NNNNNNNNNNNNNNNNNNNNDNDN:.=NNNDNNNNNNNNNNNNNNDDDDDDDDDD
DDDDDD:NDDNNN+N+NNNNNNNN.NNNNNNMMNNNNNNNNNNNNN7,..Z+,..MDNNNNNNNNNNNNNNDDDDDDDDD
DDDDDD:DDNNNO8N=ONNNNMN$NNNNNNNMNNNNNNNNNNNN7,..8Z,,,.,,$NNNNNNNNNNNNNNNNDDDDDDD
DDDDDD,=ZO~ONNNNM:=ND+8MNNNNNNNNMMNNNNNNNN8:,.?I:,.,?7,..~NNMMNNNNNNNNNNNNDDDDDD
DDDDDDDNNNNMMNNNNNNNNNNNNNNNNNMNMMNNNNNNNNN~,Z+:..=,...:~,.NNMNNNNNNNNNNNNNDDDDD
DDDDDDDNNNNNM=NNNNMNNNNNMMNNNMMMNNNMNNNNNDNMNI,77:,..,$:,...NMNNNNNNNNNNNNNNNDDD
DDDDDDNNNNNNN:$~~N:NNNNNNNNNMMNMMNMMNMNNNNNDMNND:..+:,.......7NNNNNNNNNNNNNNNNNN
DDDDDNMNNNNNN~MNDONNNNNMNMNNNMMMMMMNNNNNNNNNNNNNOM8:....,:.....,,,+ONNNNNNNNNNMN
DDDDDNNNNNNNNN8MNDNNNNNNNNMNNMMMMMNNNMMMNNNNNNNNNNND~,MMNN~,......,,,,,.ZDNNNNNN
DDDDNNNNNNNNNNN8NNNNNNNNMMNMNMMMMNMNNMNMNNNMNNNNNNNM$MNMNNO:,........,...,ZDDDNN
DDDDDNNNNNNNNNNNNNNNNNNNMNMNZNNNNNNNNNNMNNNNMNNMMMNNNNNNNNN$:,,,,,,..,...,.NNNNN
DDDDNNNNNNNNNNDMNNNNNM,NNMNNNMMMNNNNNNNMMMMMMMMMMNNMNMNNNNNO:$~,,,,,,,,,,,,,NNNN
DDDDNNNDMOMN=NMMNMNN,MMOMMMN$NMMMMNMMNMMMMMMMNNMNNNMNMMMNMNNNNNI::,,,,,,,,,,MNNN
DDDNNNNINN7NNDNMM~M,,,DNNN?MNMNMMMMMNNMI,.:INMNNNMMMMMMNNMNNNNNNNI~:,,,,,,,,MNNN
DDDNM$NN:NN,,I?:MNMNNNMZ+MMMNMNNMNNNN8I~,,.,,,,,.:DMNNNNNNNNNMNNNNN$=~,,,,,,NNNN
DDN,NNN+=NNNNNNNNMNNNNNNNNMNNMNNMMNN8$:,,,,,:~:,,,.,..MNNNNNNNNNNNNNNO?+~:~,NNNN
DDNNNNNNMNNNNZDNNDDMMNNNNNNNMMMMMMMO7~,,,,..+7??=~,,,..:NNNNNNNNNNNNNNNOO+~MNNNN
DNNNNNNNMNNNNDDZD8ODNMMNNNNNMMMMMMDOO~,,,,,,,,.,.~I:,,...NMMNNNNNMNNNNNNNNMMM,..
DNNNNNNMNNNZDDDOOZZDNMMNNNNNNMMNNND$?+:,,:~~~,,,,.,..:,..NNMNNNNMMNNMMMNMN8.....
DMNNNNMMMMMZDD8D8OONNNNNNNNNMNMMNND7:,,,,,=$??~:,,,...:,=NMNNNNMNNNNNNND........
DNNNNNNMMMMNZDDDZZDDNNNNNNMNNNMNDNDD?:,,,,,.=ZOI=~,,..O:.INNMNMNMNNNNI..........
NNMMNNNNMMMMMMMMNMMNMMNNMMMMMMMNNNDDZ:,,:~::,,,.,.,~::N8~MMNMMMNNN8..$7.....=:..
MNMNNNMMNMMMMMMMMMMMMMNMMMMMMNNNNND7:,::~+=?~:,,,.,.INNMMMMMMMMN=...Z.$..,~...,M
NMNNNNMMMMMMMMMMMMMMMMMMMMMMMNNNNNNI:,..8OOOO??::,,.+NMMMMMMNZ..8.D..,,:~,..DMNM
NNMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNN$~~,,,,,.:Z8$I~:.MNNMMMM~.+$7,=..:+,..:NNNNMM
NNNNMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNN$~~~::~,,,,..O,MNNNNI..?.:7:...=...DDNNNNNNM
NNNNMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMMMMN$??=~:~:,,.INNNM..::~.:...?..,:NNNNNNNNNNN
NNNNNNMNMMMMMMMMMMMMMMMNNNNNNMMMMMMNNNMMMNNDZ?~,.NM=..ZI~I,..=~...NNNNNNNNNNNNNN
NNNNNMMMMMMMMMMMMMMMMNMNNNMNNMMMMMMMNMMMMMMMNM8DM.....N+.,,....:MMMMNNNNNNNNNNNN
MMMMNMMMMMMMMMMMMMMNNNMNNMMMMMMMMMMMMMMMMMMMMM:........~.:...MMMMMMMMNNNNNNNNNNN
MMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMNMMMMD.........,:...~MMMMMMMMMMNNNNNNNNNNM
MMMMMMMMMMMMMMMMMNNMMMMNMMMMMMMMMMMMMMMMM.........:+,...MMMMMMMMMMMMMMNNNNNNNNMM
MMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMM8..............~MMMMMMMMMMMMMMMMNNNNNNNMMM

这样的图案很酷吗?glassgiant.com 提供免费的在线服务,让我们把任何图片转换成ASCII 形式的图案。在选择图片时要小心哦,太大的图片会花费很长时间进行生成的,一个2M的照片似乎花费了几分钟,几十k 的图片则很迅速。

Firefox 1.5 无法正常访问这个服务,还好,新装了IE Tab 插件,一键在Firefox 与IE 之间切换很方便。

这里还有一些现成的ASCII  图案 ,给手懒的人看。

Posted by Alex at 9:23 PM | Comments (0) | Edit | Taged: Ascii Art (1)

每天丢掉一点统计数据

不恰当的日志统计设置,可能会导致每天丢掉一部分日志统计数据,请看我犯过的错误。  我使用awstats 统计日志数据,在config 文件中,我设定如下参数: LogFile="/home/username/logs/aiview.com/http/access.log" 我在crontab 中设定每天在整点每间隔4个小时运行一次统计更新。 00 0-23/4 * * * ~/jobs/updawt.sh 我的空间在Dreamhost ,日志生成情况如下,包含当天,一共有最近6天的日志文件,当天的命名为...

不恰当的日志统计设置,可能会导致每天丢掉一部分日志统计数据,请看我犯过的错误。 

我使用awstats 统计日志数据,在config 文件中,我设定如下参数:

LogFile="/home/username/logs/aiview.com/http/access.log"

我在crontab 中设定每天在整点每间隔4个小时运行一次统计更新。

00 0-23/4 * * * ~/jobs/updawt.sh  

我的空间在Dreamhost ,日志生成情况如下,包含当天,一共有最近6天的日志文件,当天的命名为 access.log,前五天加日期后缀,最早的4天压缩存储,第五天不压缩。同时为第五天的日志建立了一个名为access.log.0 的符号连接。

-rw-r--r--  1 root       root      1830112 Apr 16 22:03 access.log
lrwxrwxrwx  1 root       root           21 Apr 16 01:03 access.log.0 -> access.log.2007-04-15
-rw-r--r--  1 xxx        xxx       255078 Apr 11 00:50 access.log.2007-04-10.gz
-rw-r--r--  1 xxx        xxx       222179 Apr 12 00:58 access.log.2007-04-11.gz
-rw-r--r--  1 xxx        xxx       214981 Apr 13 00:07 access.log.2007-04-12.gz
-rw-r--r--  1 xxx        xxx       150369 Apr 14 00:13 access.log.2007-04-13.gz
-rw-r--r--  1 root       root      1096740 Apr 16 01:03 access.log.2007-04-15 

我在配置文件中指定的文件名是access.log ,从前,我一直以为awstats 会自动合并access.log.[0-9],也包括这里的access.log.0 ,但刚刚发现,awstats 并不做这件事情,除非详细指定。

结果就是,我会丢失从日志文件发生轮换那一刻起,至最后一次统计更新之间的那部分日志的统计数据,因为它们没有获得被统计的机会,就被重命名为access.log.0 。而依据我的设置,access.log.0 并不在统计范围。

这里还有一些细节,统计数据是否会丢,以及会丢掉多少,还取决于日志轮换的具体时间(并不总是发生在零点),以及我的job 执行间隔与执行时间。无论如何,更改配置文件,使其不依赖于这些不确定因素是好的方法。

我修改了我的统计配置文件如下:

#LogFile="/home/username/logs/aiview.com/http/access.log"
LogFile="./tools/logresolvemerge.pl /home/username/logs/aiview.com/http/access.log /home/username/logs/aiview.com/http/access.log.0 |" 

logresolvemerge.pl 随awstats 程序包提供,你需要指定适用你的正确路径。 

 

Posted by Alex at 12:11 PM | Comments (0) | Edit | Taged: awstats (5)

awstats 如何统计旧日志

awstats 文档中提供了一个方法 ,需要清空过去所有的统计数据,并依次重新更新所有的历史日志;另外还包含了一个tips,不必清空所有过去的统计数据,就可以把过去遗漏的某天数据加入统计,但依然要求清空一整个月的统计数据。 这些历史统计数据保存在config 文件中DirData 参数所定义的目录中,并且是按月保存的。 awstats.aiview.com.conf : DirData="./xyz" 目录包含文件:  awstats012007.aiview.com.txt awstats022007.aiview.com.txt awstats032007.aiview.com.txt awstats042007.aiview.com.txt 前几日,Dreamhost...

awstats page

awstats 文档中提供了一个方法 ,需要清空过去所有的统计数据,并依次重新更新所有的历史日志;另外还包含了一个tips,不必清空所有过去的统计数据,就可以把过去遗漏的某天数据加入统计,但依然要求清空一整个月的统计数据。

这些历史统计数据保存在config 文件中DirData 参数所定义的目录中,并且是按月保存的。

awstats.aiview.com.conf :

DirData="./xyz"

目录包含文件: 

awstats012007.aiview.com.txt
awstats022007.aiview.com.txt
awstats032007.aiview.com.txt
awstats042007.aiview.com.txt

前几日,Dreamhost 报告文件服务器发生了一些故障,之后就发现我的http 日志停止了更新,在其恢复服务后,12、13日的日志被重新刷新,但14日全天以及15日部分日志丢失。

今天是16日,在日志丢失期间,已经通过crontab 自动更新过多次统计数据,只是这几天统计数据都为零。要想补上12、13、15日的统计数据,只有清除4月份的统计数据文件:awstats042007.aiview.com.txt 文件,并从4月1日开始依次更新所有统计数据。但Dreamhost 只保存最近6天的http 日志,这个办法行不通。

经查看awstats  历史统计数据文件,找到解决方法,算是另外一个tips 。

以下代码片段来自4月份统计数据文件:awstats042007.aiview.com.txt 。LastTime 参数保存了统计的http 日志条目最晚的时间(区别于运行update 的时间),我们可以通过把其他几个时间参数修改为此时间,并且重置一些条目参数来达到目的。

LastLine 20070416000000 4386 898321 47205111575
FirstTime 20070401002121
LastTime 20070412035620
LastUpdate 20070416000004 2542 0 0 0 2542

 下面是修改后的条目:(修改前请先备份旧文件!

LastLine 20070412035620 0 0 0
FirstTime 20070401002121
LastTime 20070412035620
LastUpdate 20070412035620 0 0 0 0 0

接着修改config 文件,注释掉原来的日志路径,指向到旧的日志压缩文件。

#LogFile="/home/username/logs/aiview.com/http/access.log"
LogFile="gzip -d </home/username/logs/aiview.com/http/access.log.2007-04-12.gz |" 

然后运行命令更新统计数据。(注意:如果设置有crontab,操作前最好先disable 任务,免得引起不期望的结果)

$ cd ~/aiview.com/cgi-bin/awstats/
$ ./awstats.pl -config=aiview.com -update 

这时刷新统计页面,已经可以看到13日的统计数据,依次在config 文件中把日志更换为13、15日的文件,并逐次运行更新,即可把所缺日志依次补回。

这种方法虽然不要求具有当天至月初的所有访问日志文件,但要求具有所补日期至当天或者至当月末的所有日志文件。 

看来,写个job 定期备份日志还是有必要的。 

Posted by Alex at 10:00 PM | Comments (0) | Edit | Taged: awstats (5), 日志统计 (2)

Javascript 的噩梦可以结束了

Firebug 是针对Firefox 的一个插件,它与Firefox 很好的集成到了一起,帮助你分析与网页在客户端的一切行为,当然,获益最大的大概就是Javascript 的调试了。 下面是一个例子,红色部分代表遇到了一个脚本错误。 点开后,Firebug 指示出了错误文件与相关代码行。  再继续查看,就直接定位到了相关上下文,这里我们可以看到,是在line 22 多了一个额外的注释标记 "*/",导致此错误。 修复后,显示正常状态。 如果错误不太容易找到,还可以设置断点进行调试,直接在行号部分点击即可设置断点,然后刷新一次网页重新执行脚本,执行到断点处会自动停下,可以像通常调试工具一样选择执行进度,观察并设置变量。 Firebug...

Firebug 是针对Firefox 的一个插件,它与Firefox 很好的集成到了一起,帮助你分析与网页在客户端的一切行为,当然,获益最大的大概就是Javascript 的调试了。

下面是一个例子,红色部分代表遇到了一个脚本错误。

firebug status

点开后,Firebug 指示出了错误文件与相关代码行。

firebug interface

 再继续查看,就直接定位到了相关上下文,这里我们可以看到,是在line 22 多了一个额外的注释标记 "*/",导致此错误。

firebug interface

修复后,显示正常状态。

firebug status

如果错误不太容易找到,还可以设置断点进行调试,直接在行号部分点击即可设置断点,然后刷新一次网页重新执行脚本,执行到断点处会自动停下,可以像通常调试工具一样选择执行进度,观察并设置变量。

Firebug 是完全免费的,要了解更多的功能,请参考考官方网站 。 

Posted by Alex at 1:00 AM | Comments (0) | Edit | Taged: debug (1), Firefox (7), Javascript (5)

CSS 被不期望的下载了多次

前日看网站日志,发现IE 与Firefox 在对待外联CSS 上的一些细微差别。 <link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="screen" /> <link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="projection"...

前日看网站日志,发现IE 与Firefox 在对待外联CSS 上的一些细微差别。

<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="projection" />

对待这样的CSS定义,Firefox 会把screen.css 完整下载两次,而IE 仅仅会有一次访问。

123.112.2.228 - - [12/Apr/2007:09:34:10 -0700] "GET /css/screen.css HTTP/1.1" 200 5327 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:39:11 -0700] "GET /css/screen.css HTTP/1.1" 200 5327 "http://www.aiview.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11"
123.112.2.228 - - [12/Apr/2007:09:39:12 -0700] "GET /css/screen.css HTTP/1.1" 200 5327 "http://www.aiview.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11"

但是对于另外一项,它们却有不同的表现。

<link rel="alternate stylesheet" type="text/css" href="http://www.aiview.com/css/print.css" media="screen" title="PrintPreview"/>
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/print.css" media="print" />

Firefox 针对print.css 访问了一次,而IE 则有两次,第二次是http 304 ,也属于正常。

123.112.2.228 - - [12/Apr/2007:09:34:10 -0700] "GET /css/print.css HTTP/1.1" 200 1486 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:34:11 -0700] "GET /css/print.css HTTP/1.1" 304 256 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:39:12 -0700] "GET /css/print.css HTTP/1.1" 200 1486 "http://www.aiview.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11" 

再来看另外一个例子,screen.css 与screen-clearstyle.css 均引用了base.css 和extend.css 。

<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="screen" title="GetStyleBack" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen-clearstyle.css" media="screen" title="ClearStyle" />
@import "base.css";
@import "extend.css";

对于多个CSS 文件引用的同一个CSS,Firefox 不会再去检查文件修改日期,而IE 照例进行了多次访问,虽然后续仅访问了header,如果引用比较复杂的话,还是有一些可观流量的。

123.112.2.228 - - [12/Apr/2007:09:34:10 -0700] "GET /css/screen.css HTTP/1.1" 200 5327 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:34:10 -0700] "GET /css/base.css HTTP/1.1" 200 1484 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:34:11 -0700] "GET /css/base.css HTTP/1.1" 304 256 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:34:11 -0700] "GET /css/extend.css HTTP/1.1" 200 1964 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:34:11 -0700] "GET /css/extend.css HTTP/1.1" 304 256 "http://www.aiview.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
123.112.2.228 - - [12/Apr/2007:09:39:11 -0700] "GET /css/screen.css HTTP/1.1" 200 5327 "http://www.aiview.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11"
123.112.2.228 - - [12/Apr/2007:09:39:11 -0700] "GET /css/base.css HTTP/1.1" 200 1484 "http://www.aiview.com/css/screen.css" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11"
123.112.2.228 - - [12/Apr/2007:09:39:11 -0700] "GET /css/extend.css HTTP/1.1" 200 1964 "http://www.aiview.com/css/screen.css" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11"

通过这次测试,还学习了一点额外的东西,对于浏览器来说,F5 与CTRL+F5 有一些区别,虽然都是刷新,但F5 仅仅会重新获取相比cache 有所更新的文件,CTRL+F5 则强制性重新获取所有文件。另外提一点,在Firefox 中,F5 与工具栏中的刷新按钮,或者是菜单中的刷新项(CTRL+R),效果都一样,IE 也是如此。

 

顺便把CSS 切换功能 给取消了,还是保持简单点好。因此上面的部分代码,在页面源文件中已经找不到了,下面是个完整的参考:

<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/common.css" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="screen" title="GetStyleBack" />
<link rel="alternate stylesheet" type="text/css" href="http://www.aiview.com/css/screen-linestyle.css" media="screen" title="LineStyle" />
<link rel="alternate stylesheet" type="text/css" href="http://www.aiview.com/css/screen-clearstyle.css" media="screen" title="ClearStyle" />
<link rel="alternate stylesheet" type="text/css" href="http://www.aiview.com/css/print.css" media="screen" title="PrintPreview" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/screen.css" media="projection" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="http://www.aiview.com/css/aural.css" media="aural" />
<script type="text/javascript" language="javascript" src="http://www.aiview.com/switch-css.js"></script>

 

Posted by Alex at 11:55 PM | Edit | Taged: Firefox (7), IE (3)

唠叨下微软的Live.com

微软对自己之前的IM 、Email 、Spaces 等服务进行了整合,称为Live 战略升级,这本无可厚非,不过因我未及时响应其升级行动,把我长时间未登录的hotmail 邮箱中的几百封邮件全部清空,我可就要发发牢骚了。 放弃hotmail ,是因为有了gmail ,好处就不在这讨论了,但msn messenger 还在继续使用,大部分联系人还在这上面,只不过登录的邮件不是hotmail 罢了,而是gmail 的。在hotmail 中没有找到自动邮件回复功能,也没有找到自动邮件转发功能,今天登录进去,告诉我可以免费升级到功能更强大的live 邮箱,满怀希望的开始尝试,以上功能依然没有。...

微软对自己之前的IMEmailSpaces 等服务进行了整合,称为Live 战略升级,这本无可厚非,不过因我未及时响应其升级行动,把我长时间未登录的hotmail 邮箱中的几百封邮件全部清空,我可就要发发牢骚了。

放弃hotmail ,是因为有了gmail ,好处就不在这讨论了,但msn messenger 还在继续使用,大部分联系人还在这上面,只不过登录的邮件不是hotmail 罢了,而是gmail 的。在hotmail 中没有找到自动邮件回复功能,也没有找到自动邮件转发功能,今天登录进去,告诉我可以免费升级到功能更强大的live 邮箱,满怀希望的开始尝试,以上功能依然没有。

我这一抱怨就收不住了,又想起前段时间帮朋友迁移blog,从msn spaces 到mt ,但是发现无法将space 的所有日志导出,rss只包含了最近20条。 

微软的live 战略升级,从某种程度来说是一种受迫性竞争的结果,观察其调整的过程以及域名的混乱,就能看出其进程的痛苦,并且还将延续下去。 

说了这么多微软的坏话,说点好听的吧。新版msn spaces 提供的rss 订阅模块不错,虽然未能与本地发布的日志整合到一起进行显示(同时,你的联系人也无法通过messenger获得你的space 更新通知),但也多了一种额外的选择。我不在msn spaces 写日志,但可以配置一个到aiview.com 的rss 订阅,这样就可以在我的spaces 上显示aiview.com 的文章列表。

msn_spaces.jpg

Posted by Alex at 1:07 PM | Comments (0) | Edit | Taged: live.com (1), msn messenger (3), msn spaces (2), 微软 (3)

我是这样使用flickr 的

下面是flickr 的基本介绍,如果你已经在使用,可以直接跳到这里 阅读。 Flickr 是非常优秀的在线图片管理工具,提供免费的服务,主要优点: 批量剪裁压缩、上传,一步完成,传输速度快 图片保存精度较高 响应快速的管理界面(Ajax) 标签、日期方式索引 免费服务主要的限制: 每个月限100M上传流量 最多管理200张图片,超出可以继续上传,旧的不会被删除,但会被隐藏起来,无法任何方式可以浏览(Flickr Blog除外)。 最多只允许建立3个Sets 如果照片不会超过200张,Flickr...

下面是flickr 的基本介绍,如果你已经在使用,可以直接跳到这里 阅读。

Flickr 是非常优秀的在线图片管理工具,提供免费的服务,主要优点:

  • 批量剪裁压缩、上传,一步完成,传输速度快
  • 图片保存精度较高
  • 响应快速的管理界面(Ajax)
  • 标签、日期方式索引

免费服务主要的限制:

  • 每个月限100M上传流量
  • 最多管理200张图片,超出可以继续上传,旧的不会被删除,但会被隐藏起来,无法任何方式可以浏览(Flickr Blog除外)。
  • 最多只允许建立3个Sets

如果照片不会超过200张,Flickr 是一个非常好的选择;如果会达到数百张,如果选择了Flickr,那么升级到Flickr Pro ($24/Year)几乎是没有选择的,否则转换成本比较高。

我是这样使用Flickr的:

上传图片

除了网页上传,效率更高的方式是下载Flickr Upload 工具 ,集成到鼠标右键菜单,拖放操作,支持批量,十分方便。

浏览图片 

我通常通过Tags 和日期(Archive)来浏览图片,日期分为上传日期(Posted)和拍摄日期(Taken),基本上可以满足需求。

管理图片

管理图片需要先进入Organize,然后通过下面的过滤器筛选出图片列表,拖入当前区域,然后所有的编辑功能都可以通过上面的菜单选择,比如修改标签、权限、日期等等。

权限管理

上传的图片可以指定5 种权限级别:

  1. Public - 任何人都可以看
  2. Private - 只有自己一个人能看
  3. Family - 加入到Family 组的人可以看
  4. Friends - 加入到Friends 组的人可以看
  5. Friends &Family - Family 或者Friends 组的人都可以看

除了私有(private)与家庭(family),只有单一的Friends 组可以用来作为访问控制,对于多个朋友圈,很明显,不够用。

对此,Flickr 提供了Groups。上传时,无法指定Groups,对于希望受限访问的图片,可以全部选择Private,上传后,针对不同的朋友圈,可以建立相应的Private Groups,然后把相应的图片放入这个Group。然后邀请朋友Join 到不同的Groups,这样就实现了额外层次的访问授权。

上述描述起来有些复杂,不过实际操作非常简单顺手。

2007-04-22  更新

付费Pro 版已经没有了最多3 个Sets 的限制,于是为所有图片以Event 为单位建立了Sets, 对于天数较多的活动可以按地点分为多个Sets,然后建立Collection 包含这几个Sets。 

Sets 默认使用创建顺序显示,可以在Organization Sets 编辑区中利用拖拽调整顺序。

对于所有照片的主题进行归纳(实际是针对Sets),然后建立相应的主题Collections ,把已有的Sets 或者Collection 加入这些主题Collections,注意,Collection 不可以即包含Sets,又包含Collection,只能同时包含一种

另外一个小tips,或许是我从前太土了,在Organization 页面的编辑区中,无论是图片,还是Sets,单击均不会有任何操作,双击则可以打开。 

2007-04-23  更新

Blog this 

Extending Flickr 设置了关联Blog,支持很多种Blog 程序,也包括我使用的MT,仅仅需要指定MT 的远程访问API 接口脚本(http://www.aiview.com/cgi-bin/mt/mt-xmlrpc.cgi),用户名和密码即可,这个密码不是登录MT 控制台的密码,是API 调用的密码,在MT用户属性页下方设置。

设置完成,既可以点击图片上方的"Blog this" ,输入Title 和Description,直接发布到Blog。有一点遗憾,就是无法指定Entry 的Category 、Tags 以及Basename。

Upload by email 

Flickr 还支持Email 上传图片 ,它会为每一个用户生成一个唯一并且私有的Email 地址(例如:lto30doing@photos.flickr.com),任何知道这个邮件地址的人都可以发布图片到相关联的Flickr,因此对其要保持私密。

Email 的Subject 与Body 会分别作为图片的Title 与Description。 可以在Subject 或者Body 中使用以下的格式 来添加Tags:

tags: flowers "my garden"

但无法指定Sets、Groups 等。

默认的,通过email 发送的图片都是public 的,如果希望使用其他权限 ,可以加后缀到email 地址。比如:

lto30doing+private@photos.flickr.com
lto30doing+friends@photos.flickr.com
lto30doing+family@photos.flickr.com
lto30doing+ff@photos.flickr.com

Blog this by email

额外的,如果希望email 上传的图片都自动发布到已经设置好的Blog,可以在这里设置 ,会得到另外一个email 地址,譬如:

lto30doing2blog@photos.flickr.com

只有Public 的图片才会被自动发布到Blog,其余的就只存放在Flickr。也可以在一封信中包含多个附件,但每一张图片都会生成单独的entry,并share  相同的Title 与Description,所以并不实用。

同样,无法指定Entry 的Category 、Tags 以及Basename。

 

Posted by Alex at 1:18 AM | Comments (0) | Edit | Taged: Flickr (2)

使用Firxfox 1.5 访问Gmail 时指定https://

故障现象 输入域名 mail.google.com 或者 gmail.com 访问Gmail,Firefox 显示空白页,无任何提示,同一时间使用IE 却可以正常访问。 解决方法 造成大多数人无法访问的根源在于下面的第一条,如果无法解决再尝试后面2条。 在域名之前加上 https://,指定 http:// 或者仅输入域名均无法访问 确认Firefox...

Firefox window

故障现象

输入域名 mail.google.com 或者 gmail.com 访问Gmail,Firefox 显示空白页,无任何提示,同一时间使用IE 却可以正常访问。

解决方法

造成大多数人无法访问的根源在于下面的第一条,如果无法解决再尝试后面2条。

  1. 在域名之前加上 https://,指定 http:// 或者仅输入域名均无法访问
  2. 确认Firefox 选项设置中允许SSL连接
  3. 如果安装有防火墙,检查设置

在IE 中无需特别指定https,以任意方式输入,均会跳入正常页面。

放弃2.0  

从前使用1.5 遇到过这个问题,升级到2.0 后问题自然消失,也就没有深究。最近发现2.0 响应速度很慢,经常把CPU 用到100%,切换一个Tab 要花费几秒钟,开始以为是Flash 插件惹的祸,安装了Flashblock 禁用Flash 之后,问题依旧,也排除了页面script、打开页面太多等问题。今天装回到1.5 版本,响应慢的问题也随之解决。不过gmail 的问题又回来了,google 了一下,发现问题很普遍 ,答案也多种多样,比如:域名解析、SSL、TLS、防火墙、代理设置、Pop Block,证书等等。但我经过测试,其实真正的原因只有一个,就是大家输入域名的习惯问题,省略了"https://" 或者其中的 "s"。把https://gmail.com 或者 https://mail.google.com 加入收藏夹即可。

对于大多数默认安装的Firefox 1.5 来说,上述其它方面导致问题的概率比较低。

google.com 域名一直存在大陆访问不稳定的问题,mail.google.com 也曾经受累一段时间,不过现在,mail.google.com 已经比较稳定了。在你发现IE 可以访问gmail,但Firefox 无法访问时,十有八九本文可以帮到你。

欢迎大家反馈。 

Posted by Alex at 12:09 PM | Comments (0) | Edit | Taged: Firefox (7), Gmail (6), Google (3), https (2)

i'm Initiative 活动现在只限美国地区参与

阿森发送给我关于“i'm”的消息,这看起来是个十分有趣的主意 ,9个 国际慈善组织会通过此活动得到资金,有爱心的人越多,资金的数目就越大,而微软则扩大了msn Messenger的有效用户群,并促使老的用户升级到新版本。 回头看了看朋友的列表,已经有很多人的名字中都多了这个“i'm”,我一直没在意,因为我还在用7.5的版本。但我发现,美国以外地区的messenger注册用户是不包含在这个活动范围内的,请参考活动官方网页的FAQ 中最后一个Q/A。 Q: Can everyone participate in this initiative? A: The...

阿森发送给我关于“i'm”的消息,这看起来是个十分有趣的主意9个 国际慈善组织会通过此活动得到资金,有爱心的人越多,资金的数目就越大,而微软则扩大了msn Messenger的有效用户群,并促使老的用户升级到新版本。

回头看了看朋友的列表,已经有很多人的名字中都多了这个“i'm”,我一直没在意,因为我还在用7.5的版本。但我发现,美国以外地区的messenger注册用户是不包含在这个活动范围内的,请参考活动官方网页FAQ 中最后一个Q/A。

Q: Can everyone participate in this initiative?
A: The i’m Initiative is available to everyone in the 50 United States and the District of
Columbia.

不过,官方成员在自己的Blog发布了一篇文章,The i'm Initiative and new secret emoticon ,文章中说明参与“i'm”的美国地区用户与其他国家地区的用户之间的对话(Conversation),对捐献活动是有效的。这篇文章也是一篇不错的“i'm”参与指南。

我在这里 看到的新增慈善组织也未在官方网页中声明,值得商榷。 

新增加的组织:
*wwf World Wildlife Fund for Nature 世界自然基金會
*oxfam The Oxford Committee for Famine Relief 樂施會(協助解決當時世界各地饑荒及貧窮問題)
*care 國際關懷協會
*hsus The Humane Society of the United States 美國人道協會
*acs American Cancer Society 美國癌症協會
*one ONE Campaign-全球消除貧困與對抗愛滋的組織(GCAP)

无论如何, 这个活动看起来还在发展之中,微软还没有设定中止日期的计划,所以今后会有多少个组织参与,并且是否会扩展到美国以外地区也未可知。不过,看着朋友列表上不断多出的“i'm”,还是很开心。

Posted by Alex at 6:43 PM | Comments (0) | Edit | Taged: msn messenger (3), 微软 (3), 慈善活动 (1), 慈善组织 (1)

再谈国内如何访问维基百科(Wikipedia)

维基百科 (www.wikipedia.com)自2005年10月在国内就无法访问, 但维基百科依然是查找资料最好的选择之一。过去,我一直透过Answer.com 进行访问,我在这里介绍过方法,但近日发现,通过Answers.com 存取的维基百科页面与最新的内容有一定时滞。下面是维基百科一个页面的编辑历史比较 ,左侧的版本是Answers.com 中所显示的 ,右侧是当前维基百科最新的版本 ,以今天的日期来算,Answers.com 对这个页面的cache更新周期至少大于1个月。 Xiongxiong 告诉我另一种访问维基百科的方法——使用网站代理。打开这个网页,选择任一网站代理,进入后输入维基百科的网址,就可以访问了。上例中使用的是 http://www.un-block.net/ 当然,网站代理的作用不仅仅用于访问维基百科,其它受限网站也可以尝试。...

维基百科 (www.wikipedia.com)自2005年10月在国内就无法访问, 但维基百科依然是查找资料最好的选择之一。过去,我一直透过Answer.com 进行访问,我在这里介绍过方法,但近日发现,通过Answers.com 存取的维基百科页面与最新的内容有一定时滞。下面是维基百科一个页面的编辑历史比较 ,左侧的版本是Answers.com 中所显示的 ,右侧是当前维基百科最新的版本 ,以今天的日期来算,Answers.com 对这个页面的cache更新周期至少大于1个月。

wiki_history.gif

Xiongxiong 告诉我另一种访问维基百科的方法——使用网站代理。打开这个网页,选择任一网站代理,进入后输入维基百科的网址,就可以访问了。上例中使用的是 http://www.un-block.net/

当然,网站代理的作用不仅仅用于访问维基百科,其它受限网站也可以尝试。

Posted by Alex at 6:10 PM | Comments (2) | Edit | Taged: wikipedia (3), 代理 (1), 维基百科 (1)

Google 之三人成虎

这两天查找有关彻底清除硬盘数据的信息,Google帮了不少忙,很多资料都引用了美国国防部的DoD 5220.22-M 标准,类似以下的文字在中文互联网上广泛流传 。 美国国防部在《国家工业安全程序操作手册》中对硬盘数据清除作了专门的描述,这个安全标准被称为DOD 5220.22-M(www.dss.mil/isec/nispom_0195.htm)。该手册建议对所要清除的数据区进行三次覆盖,第一次使用一个8位的字符,第二次使用该字符的互补字符(即将二进制位的0、1互换),最后再使用随机字符进行覆盖。 注:NISPOM 是国家工业安全程序(NATIONAL INDUSTRIAL SECURITY PROGRAM)的缩写。 国内外的各种数据清除工具,也有很多按上述类似说法引用了此标准,比如有名的开源软件Darik's Boot and Nuke。出于兴趣,我找到了这个...

这两天查找有关彻底清除硬盘数据的信息,Google帮了不少忙,很多资料都引用了美国国防部的DoD 5220.22-M 标准,类似以下的文字在中文互联网上广泛流传

美国国防部在《国家工业安全程序操作手册》中对硬盘数据清除作了专门的描述,这个安全标准被称为DOD 5220.22-M(www.dss.mil/isec/nispom_0195.htm)。该手册建议对所要清除的数据区进行三次覆盖,第一次使用一个8位的字符,第二次使用该字符的互补字符(即将二进制位的0、1互换),最后再使用随机字符进行覆盖。

注:NISPOM 是国家工业安全程序(NATIONAL INDUSTRIAL SECURITY PROGRAM)的缩写。

国内外的各种数据清除工具,也有很多按上述类似说法引用了此标准,比如有名的开源软件Darik's Boot and Nuke。出于兴趣,我找到了这个 DoD 5220.22-M 文档(前文的链接无法访问),但无论如何有没有找到被大量资料所提及的数据清除方法。我开始怀疑这个引用的权威性,最后,在wikipedia 找到的文字证实了我的猜测。国内一直无法访问wikipedia ,下面的链接使用了网站代理

Misunderstanding as a data sanitization standard

DoD 5220.22-M is sometimes cited as a standard for sanitization to counter data remanence. This is incorrect. The NISPOM covers the entire field of government-industrial security, of which data sanitization is a very small part (about two paragraphs in a 100 page document)[4]. Furthermore, the NISPOM does not actually specify any particular method. Standards for sanitization are left up to the Cognizant Security Authority. The Defense Security Service provides a Clearing and Sanitization Matrix[5] which does specify methods; access to the current C&SM is restricted here.

DoD 5220.22-M 一度被作为数据清除的标准进行引用,这是错误的。这个文档覆盖了全部的政府与工业的安全领域,描述数据清除的内容仅占很小的一部分(100页文档中仅有2段文字)。此外,文档中并没有定义任何具体的数据清除方法。数据清除的标准是由Cognizant Security Authority(不知如何翻译)来决定的,可以在国防安全服务(Defense Security Service)提供的一个名为“Clearing and Sanitization Matrix的文档中找到。

以下是有关硬盘数据的那部分内容,与前述相符,但不同的是,这不属于DoD 5220.22-M 标准。

d. THIS METHOD NOT APPROVED FOR SANITIZING MEDIA THAT CONTAINS TOP SECRET INFORMATION.

1. Before any sanitization product is acquired, careful analysis to the overall costs associated with overwrite/sanitization should be made. Depending on the contractor’s environment, the size of the drive and the differences in the individual products time to perform the sanitization, destruction of the media might be the preferred (i.e., economical) sanitization method.

2. Overwrite all addressable locations with a character, then its complement. Verify “complement” character was written successfully to all addressable locations, then overwrite all addressable locations with random characters; or verify third overwrite of random characters. Overwrite utility must write/read to “growth” defect list/sectors or disk must be mapped before initial classified use and remapped before sanitization. Difference in the comparison lists must be discussed with the DSS Industrial Security Representative (IS Rep) and/or Information System Security Professional (ISSP) before declassification. Note: Overwrite utilities must be authorized by DSS before use.

值得注意的是,文档中注明:这种数据清除方法并不适用于绝密信息。可见对于美国以外,甚至其它非政府控制机构,其安全性仍然有限。

Google就像快餐,速食并且方便,但食得不干净却容易拉肚,很多人不再关心信息的来源,瞧!Google到这么多相同的搜索结果,就是它了!正所谓三人成虎。

Posted by Alex at 11:17 PM | Comments (0) | Edit | Taged: Google (3), 硬盘 (2)

Secure communication on both direction by HTTPS

HTTPS Overview  Let's have an overview on HTTPS. | HTTPS | / \ | HTTP SSL...

HTTPS Overview 

Let's have an overview on HTTPS.

|        HTTPS
|        /  \ 
|    HTTP    SSL    SET
|              \   /
|               PKI

HTTPS is based on HTTP protocal and SSL protocal.

SSL protocal is an implement of PKI standard.

What is PKI?

To discuss HTTTS, we are better to know what PKI is first. It's very important! Here's an article talking about PKI in detail.

PKI, Public Key Infrastructure, is attend to insure the data security transfered over Internet and identify the authentic user.

The public key for ones could be obtained by everyone on Internet, the private key is only kept by the owner. Signing with the public key will insure the data security. Signing with the private key will insure the undeniable.

So it requires both side have theire own keys for insuring secure communication on both direction. However in some situation, it's not easy to get keys on both side, such as B2C, you can't require each visiter getting their keys for using your website.

How does SSL work?

Is there a way to have secure communication both direction without requiring keys on the browser side? The answer is yes, there's SSL. Below's a section from the article Introduction to SSL that describes how SSL works very clearly.

The SSL protocol uses a combination of public-key and symmetric key encryption. Symmetric key encryption is much faster than public-key encryption, but public-key encryption provides better authentication techniques. An SSL session always begins with an exchange of messages called the SSL handshake. The handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows. Optionally, the handshake also allows the client to authenticate itself to the server.

Below is brief steps for SSL Handshake(assume it's between Internet Browser and web server.)

Browser side (no keys)          <----->         Server with SSL (keys based on PKI)
--
B   ->  hello, wanna a secure connection                    ->  S
B   ->  my ssl version                                      ->  S
B   ->  my encrypt type                                     ->  S
B   ->  some random data                                    ->  S
B   ->  hello done                                          ->  S
--
B   <-  hello, yeah, i accept                               <-  S
B   <-  some random data                                    <-  S
B   <-	my certificate including my pub-key                 <-  S
B   <-  hello done                                          <-  S
--
B   verify the certificate                                      S
B   generate "premaster secret"                                 S
B   ->  "premaster secret" encrypted with server's pub-key  ->  S
B   generate "master secret" by "premaster secret"              S
B   generate "session keys" by "master secret"                  S
B   ->  I'll send data encrypted by "session keys" at next  ->  S
B   ->  encrypted "I'm ready"                               ->  S
--
B   decrypt "premaster secret" with server's priv-key           S
B   generate "master secret" by "premaster secret"              S
B   generate "session keys" by "master secret"                  S
B   <-  I'll send data encrypted by "session keys" at next  <-  S
B   <-  encrypted "I'm ready"                               <-  S
--
Handshake is finished.

For the steps above, it's not for the case of server reqests the client authenication. Here only discuss the case of none-keys on client side.

We know the keys on server side is only used for exchanging the session key. The session key is the symmetric key that is acctrually used to encrypt/decrypt data between client and server.

I'm not sure how related between the browser and server's random data at their first hello step. At browser generates "premaster secret", it might base on the random data from server. it's my guess. Anyone could give the steps more clear?


Reference

 

Posted by Alex at 6:37 PM | Comments (0) | Edit | Taged: https (2), ssl (1)

Tag cloud 导致页面滚动迟缓

我一直使用Firefox 浏览器,IE的收藏夹里只有淘宝、北京移动以及网银几个不支持Firefox 的links。近日突然发现自己blog在IE中长页面的滚动非常迟缓(Firefox中正常),一跳一跳的,很不舒服,于是立刻想到了前阵子新加的功能:对于<pre>标签限制宽度和最大高度 ,为了兼容IE,在css中使用了ie hacks以及expression表达式,这可能会加重浏览器绘制工作量,从而导致页面滚动迟缓。经试验,并不是以上代码导致的,根源竟是页面底部的Tag cloud,如下图: 模板: <div id="tagcloud"><div class="inner"> <h3>Tags</h3> <MTTags> <a class="h<$MTTagRank$>" href="<$MTInclude...

我一直使用Firefox 浏览器,IE的收藏夹里只有淘宝、北京移动以及网银几个不支持Firefox 的links。近日突然发现自己blog在IE中长页面的滚动非常迟缓(Firefox中正常),一跳一跳的,很不舒服,于是立刻想到了前阵子新加的功能:对于<pre>标签限制宽度和最大高度 ,为了兼容IE,在css中使用了ie hacks以及expression表达式,这可能会加重浏览器绘制工作量,从而导致页面滚动迟缓。经试验,并不是以上代码导致的,根源竟是页面底部的Tag cloud,如下图:

Tag Could snapshot

模板:

  <div id="tagcloud"><div class="inner">
<h3>Tags</h3>
<MTTags>
<a class="h<$MTTagRank$>" href="<$MTInclude module="Tag URI"$>" title="<$MTTagCount$> entries"><$MTTagName$></a>  
</MTTags>
</div></div><!--tagcloud--> 
Style:
#tagcloud a {
text-decoration: none;
}
#tagcloud a.h1 {
font-size: 200%;
}
#tagcloud a.h2 {
font-size: 180%;
}
#tagcloud a.h3 {
font-size: 160%;
}
#tagcloud a.h4 {
font-size: 140%;
}
#tagcloud a.h5 {
font-size: 100%;
}
#tagcloud a.h6 {
font-size: 90%;
}
Tag 数量比较大,但对于产生此问题的原因还是不解,有人遇到吗?

Posted by Alex at 5:04 PM | Comments (0) | Edit | Taged: IE (3)

google 的热门搜索关键词

google 通过多种方式来提供热门搜索关键词 列表,除了提供当前热门关键词列表以外,还提供从2001年至今的归档 。可以按三种方式浏览,年度、按月、每周。其中年度与每周的列表仅提供英文关键词,而按月归档的列表则提供了不同国家区域的详细列表,其中包括中国。 这是中国2006年12月的热门关键词列表,对于每一个关键词还提供了一个简短的英文说明。 黄金甲 (a very hot movie) 武林外传 (a very hot TV...

google 通过多种方式来提供热门搜索关键词 列表,除了提供当前热门关键词列表以外,还提供从2001年至今的归档 。可以按三种方式浏览,年度、按月、每周。其中年度与每周的列表仅提供英文关键词,而按月归档的列表则提供了不同国家区域的详细列表,其中包括中国。

这是中国2006年12月的热门关键词列表,对于每一个关键词还提供了一个简短的英文说明。

  1. 黄金甲
    (a very hot movie)
  2. 武林外传
    (a very hot TV program)
  3. nba
    (NBA)
  4. 周笔畅
    (a very famous singer)
  5. 谁动了我的琴弦
    (a new song by a famous singer, Zhou Bichang)
  1. 卡巴斯基
    (anti-virus software)
  2. 跑跑卡丁车
    (on-line game)
  3. 狼爱上羊
    (a famous song)
  4. 招商银行
    (China Merchant Bank)
  5. 中国移动
    (China Mobile)
  1. 圣诞节
    (Christmas)
  2. 魔兽世界
    (on-line game)
  3. 基金
    (fund)
  4. 瑞星
    (anti-virus software or company)
  5. 火影忍者
    (cartoon)

关键词基金在11月份还未进入Top 10,可见年末这段时间基金在国内被追捧的程度,橘子就是在这股热潮中后知后觉的投资了基金,还记录了自己跌宕起伏的基金生活,我呢,还在观望中,现在指数太高,等待时机吧。 

 

Posted by Alex at 1:06 PM | Comments (1) | Edit | Taged: 关键词 (2)

google 的网站管理员工具

今天尝试了一下google的网站管理员工具 ,里面有不少有用的信息,包括google对你网站抓取过程中所遇到的错误,我就据此更改了我的robots.txt,并且设置了www.aiview.com 到aiview.com 的关联,今后google会把这两个域名视为同一个网页。我启用了增强型图片搜索,增强型图片搜索背后是google的又一个具有创意的工具Google Image Labeler 。google借助这个类似游戏的小应用让广大互联网用户来帮助他标记(label or tag) 索引的图片,进而提供更准确的图片搜索结果。...
今天尝试了一下google的网站管理员工具 ,里面有不少有用的信息,包括google对你网站抓取过程中所遇到的错误,我就据此更改了我的robots.txt,并且设置了www.aiview.com 到aiview.com 的关联,今后google会把这两个域名视为同一个网页。我启用了增强型图片搜索,增强型图片搜索背后是google的又一个具有创意的工具Google Image Labeler 。google借助这个类似游戏的小应用让广大互联网用户来帮助他标记(label or tag) 索引的图片,进而提供更准确的图片搜索结果。

Posted by Alex at 12:49 PM | Comments (0) | Edit

DreamHost 主机存在的安全隐患

Dreamhost 的空间已经用了个把月了(使用Fenng 的折扣代码购买 ),最欣赏的是它为用户提供登录Shell,在授权内可以运行绝大部分shell 命令,甚至允许添加cron job,让你在最大限度内保留自有主机的使用习惯。不过在带来灵活性的同时,如果使用不慎,风险也随之而来。下面是新建帐号系统默认建立的目录以及权限设置: [hostname]$ pwd /home/yourname [hostname]$ ls -l total 28 drwx--S---...

Dreamhost 的空间已经用了个把月了(使用Fenng折扣代码购买 ),最欣赏的是它为用户提供登录Shell,在授权内可以运行绝大部分shell 命令,甚至允许添加cron job,让你在最大限度内保留自有主机的使用习惯。不过在带来灵活性的同时,如果使用不慎,风险也随之而来。下面是新建帐号系统默认建立的目录以及权限设置:

[hostname]$ pwd
/home/yourname
[hostname]$ ls -l
total 28
drwx--S---   6 yourname groupname 4096 2006-12-27 04:29 Maildir
drwxr-x--x  33 yourname groupname 4096 2007-02-03 06:07 domain.com
drwxr-sr-x   3 root       root      4096 2006-12-26 15:50 logs

目录domain.com 是对应虚拟主机网站所属的根目录,当前的权限位是drwxr-x--x(751),网站如果希望被正常访问,所需的最小权限位是d--x--x--x(111)。而一般网站都有动态内容生成,比如使用cgi,那么作为运行此cgi 进程的用户则需要对相关目录和文件具有写权限,最小权限位是drwx--x--x(711)。

在深入讨论前,先回顾一下Unix 文件权限位的作用,如果你非常熟悉,请跳过。

每一个文件有10个标识位,第一位d代表目录,空(-)代表文件。其后9位分成三组,分别代表当前用户、同组用户、任何登录用户所对应的权限。r: 读权限,w: 写权限,x: 执行权限。这三种权限对于一个文件都很好理解,对于目录,如果拥有r读权限,可以列出目录下的文件,具有目录的w写权限和x执行权限,可以在目录中增加和删除文件。对于目录具有x执行权限,可以使用cd 命令进入此目录。

下面列出一些可能被误解的权限设置。 

例子一: 

drwx----wx /dir
-rwx------ /dir/1.txt

这种权限,虽然其他人无法列出目录dir 中的文件,也无法读取文件1.txt,但是如果已知文件名1.txt,依然可以删除文件,因为Unix 实际把目录也作为一个文件看待,目录实际保存了文件列表,对目录具有写权限就意味可以修改这个列表。

例子二:

drwx-----x /dir
drwx-----x /dir/dir2
-rwx---r-- /dir/dir2/1.txt

对于这种权限,其他人无法通过列目录方式获知文件路径/dir/dir2/1.txt ,但如果已知此路径,就可以读出文件内容。

安全漏洞 

默认的,Dreamhost 为你的home 目录设置如下权限:

[hostname]$ pwd
/home/yourname
[hostname]$ ls -ld .
drwxr-x--x  9 yourname groupname 4096 2007-02-03 06:00 .
 

这保证了任何本组以外的用户无法列出你的home 目录文件,但并不保证无法列出home 目录以下的子目录,这依赖于你的权限设置,而大多数用户都设置了一个非常宽松的权限。有关Dreamhost用户组的设置,下一个小节会讨论。

例子二就是本文讨论的目的,前面说过,对于网站所属的目录,为了保证正常浏览,对于所有目录都要求设置一个最小权限d--x--x--x(111),同时对于网站目录中的cgi 文件,我们通常设置为drwxr-xr-x(755),如果一个不怀好意者拥有一个与你相同主机上的shell 帐户,可以通过猜测或者其它途径获得你的敏感文件路径,然后使用以下命令轻松获得你的敏感信息,比如,人们通常把movable type 系统的数据连接信息保存在文件mt-config.cgi 中。

$ cat /home/yourname/yourdomain.com/mt/mt-config.cgi 

对于上面的安全问题,我有2种解决方法,一种是让人无法获知敏感文件的准确路径,但是这种方法非常具有局限性,即使实现,管理成本也很高。Dreamhost 已存在的一个安全漏洞使大部分未觉察的用户都暴露在此风险下。另一种方法是小心的配置敏感文件的权限,而对于非敏感文件则可以不作考虑。比如对于mt-config.cgi 文件,应该设置权限-rw-------(600),此文件虽然具有cgi 扩展名,不过仅仅是一个配置文件,只要保证以你的帐户身份运行的cgi 程序可以读取此文件即可。对于其它类似的敏感文件可根据情况进行类似权限设置。

更多的讨论

Dreamhost 允许用户建立多个shell 帐户,如果你打算同其他人share 你的host 空间,或者为你的朋友提供hosting,大概就需要为他们创建shell 登录帐户。默认的,这些新建的帐户将与你自己的帐户拥有相同的group,这个默认行为提供了一定的便利性,但也似乎无法改变,需要引起注意。应该根据情况,小心的为你自己的目录和文件设置组权限,并提醒与你share 主机的朋友做好自己的组权限设置(你们在同一个group 内),权限rwxrwx--- 黄底色的部分将影响到你们之间的关系。

如果确定了一个自己认为安全的权限位,并且适合大多数情况,则可以将此权限写入默认设置,使新建的目录和文件自动拥有此设置。这通过umask 命令 实现,并将其写入自己的profile 中。在Dreamhost 此文件位于 /home/yourname/.bash_profile, 并具有如下默认设定:

umask 002
此设置下,默认新建的目录具有权限drwxrwxr-x(775),文件具有权限-rw-rw-r--(664)。

Posted by Alex at 6:04 PM | Edit | Taged: Dreamhost (4), Shell (8), 安全 (1), 权限 (1)

无法覆盖css 中display: none 的问题

在客户端脚本中,我们经常使用对象的CSS 属性style.display 来控制对象在浏览器中的显示与隐藏,一般的习惯是这样写: document.getElementById("div").style.display = "none"; // Hide this div document.getElementById(”div").style.display = ""; // Show...

在客户端脚本中,我们经常使用对象的CSS 属性style.display 来控制对象在浏览器中的显示与隐藏,一般的习惯是这样写:

  document.getElementById("div").style.display = "none"; // Hide this div
document.getElementById(”div").style.display = ""; // Show the div again
不过我最近遇到一个问题,当已经在CSS文件中为这个对象静态设置了display: "none" 属性,那么上面第二行代码将不起作用,不会按我们的预想将对象显示出来。最后找到了一个解决方法,对于以上情况,以下代码可以实现预期的效果。
 document.getElementById(”div").style.display = "inline"; // Show the div again

display 属性 可以有以下取值,上面的inline 可以换成任何你需要的值。

  • block
  • none
  • inline (this is default)
  • inline-block
  • list-item
  • table-header-group
  • table-footer-group

题外参考:CSS属性Display与Visibility的不同, Ten CSS tricks you may not know

Posted by Alex at 2:06 PM | Comments (1) | Edit | Taged: css (3), Javascript (5)

在Dreamhost自动备份mysql数据库

今天准备在Dreamhost 上自动备份blog的DB,MySQL是Dreamhost唯一提供的关系数据库服务,当前版本5.0 我了解很少(这里有个学习笔记 ),已知可以在命令行使用mysqldump 命令备份整个数据库,备份时似乎无需了解数据库的当前状态(比如是否正在运行事务),它会自行处理,从备份出的文件看,mysqldump实现的是冷备份,也就是说,仅采用这种备份方法,数据仅能恢复到最后一次运行mysqldump的时间点。 MySQL也介绍了一个热备份工具mysqlhotcopy,不过文档中有以下声明,我不清楚什么是MyISAM 与ARCHIVE tables,也不大明白MySQL 热备份的恢复机制(如何前滚日志)。还好,我的数据库目前很小,而我的空间很大很大,每次全备份只花费很少的时间,也占用很小的空间。 mysqlhotcopy works only for backing up...

今天准备在Dreamhost 上自动备份blog的DB,MySQL是Dreamhost唯一提供的关系数据库服务,当前版本5.0 我了解很少(这里有个学习笔记 ),已知可以在命令行使用mysqldump 命令备份整个数据库,备份时似乎无需了解数据库的当前状态(比如是否正在运行事务),它会自行处理,从备份出的文件看,mysqldump实现的是冷备份,也就是说,仅采用这种备份方法,数据仅能恢复到最后一次运行mysqldump的时间点。

MySQL也介绍了一个热备份工具mysqlhotcopy,不过文档中有以下声明,我不清楚什么是MyISAM 与ARCHIVE tables,也不大明白MySQL 热备份的恢复机制(如何前滚日志)。还好,我的数据库目前很小,而我的空间很大很大,每次全备份只花费很少的时间,也占用很小的空间。

mysqlhotcopy works only for backing up MyISAM and ARCHIVE tables. It runs on Unix and NetWare.

使用mysqldump备份出来的文件,是一个包含了sql语句的文本文件,含有建表语句以及Insert语句。我采用这种方式恢复:连接到mysql进入mysql提示符,创建一个db(如果不存在),连接到此db,执行备份文件,如:

mysql> source ./mybackup.sql 

执行结束则恢复完毕。这里有篇日志 介绍了另外一种恢复方法(如下),不过我没有尝试过。 

$ mysqldump -u root -p'123456' test2 < samp.db.txt 

言归正传,我准备采用crontab 自动运行mysqldump 来自动备份数据库。写了一个shell脚本如下,备份文件使用当前系统时间(到分钟)作为文件名,备份成功后进行压缩。

backupdb.sh 

bakfile=~/xxx/mt-db_`date '+\%Y\%m\%d\%H\%M'|tr -d '\\\'`.sql
mysqldump -hmysql.mydomain.com -umyname -pmypasswd mt > $bakfile
gzip $bakfile
exit 0

然后在crontab中加入条目,定时自动运行此脚本。这里设置为每4个小时,在整点运行一次,每天产生一份日志。

00 0-23/4 * * * ~/xxx/backupdb.sh >> ~/xxx/logs/backupdb_`date '+\%Y\%m\%d'|tr -d '\\\'`.log 

经试验`date '+\%Y\%m\%d'|tr -d '\\\'`部分似乎不能被cron命令成功替换,但是在shell中是可以成功执行的。

$ echo backupdb_`date '+\%Y\%m\%d'|tr -d '\\\'`.log
backupdb_20070127.log

Posted by Alex at 2:09 AM | Comments (1) | Edit | Taged: backup (2), Database (12), Dreamhost (4), mysql (4), 备份 (1)

IE vertical scrollbar and maxheight problem, Resolved

I use <pre> to wrap the programming code in my pages. What I want is:...

I use <pre> to wrap the programming code in my pages. What I want is:

  • the code within <pre> would not have any unexpected line wrap.
  • display horizontal or/and vertical scrollbar only as need to have.
  • I don't want the fixed width. it should be flexible with the window width change, and would not exceed to the menu part. the horizontal scrollbar would have if needs.
  • I want to have the flexible height that depends content, but maximum 450px. the vertical scrollbar would have if exceeds.

That's all I want, but it won't work out with both Firefox and IE without hacks. I had this style first.

pre {overflow: auto;border: 1px solid #ccc;width: 90%;max-height: 450px;padding: 8px;}

overflow: auto tells to have scrollbar as need. maxheight tells the limitation of the height. I soon found that maxheight is not supported in IE. IE would extend the height as far as the content need. And that's not all, IE push it much. With overflow: auto, you will get the unexpected vertical scrollbar that follows horizontal scrollbar. The reason is that IE will see the horizontal scrollbar as a part of content, then it will give the stupid vertical scrollbar like this. (you'll see an unexpected vertical scrollbar below if you use IE)

Here's a simple for test IE vertical scroll bar problem. When this line is long enough to exceed container that makes IE have a horizontal scrollbar, then the vertical scrollbar comes. If this line is not long enough for your screen yet, please decrease your screen size.The style this object using:<pre style="border: 1px solid #cccccc; padding: 8px; overflow: auto; width: 90%">

There's solution found here and here(none English, none Chinsese, only see the code) , they use IE hacks to resolve the vertical scrollbar problem. It do works, but I still prefer to have the limited height. I got this IE hack for having maxheight in IE. Below's the style.

pre {overflow: auto;border: 1px solid #ccc;width: 90%;max-height: 450px;padding: 8px;}* html pre { /* IE hacks */height: expression(this.scrollHeight > 450 ? "450px" : "auto");}

For the damn vertical scrollbar in IE I got an idea from the code in this post. The idea is to encrease the height after IE calculated the object height. Here's a show, the damn vertical scrollbar in the example above will be removed.About IE scrollHeight logic there's more detail, here's an artible for it.

Here's a simple for test IE vertical scroll bar problem. When this line is long enough to exceed container that makes IE have a horizontal scrollbar, then the vertical scrollbar comes. If this line is not long enough for your screen yet, please decrease your screen size.This style remove the unexpected verticle scrollbar.<pre style="border: 1px solid #cccccc; padding: 8px; overflow: auto; height: expression(this.scrollHeight+15); width: 90%">

It works but new problem came. This style width: 90% is not going to act as expect if I use above code. IE will confuse the base line between window width and container(div) width for the objects having scrollHeight > 450. I have to have below code with it together in IE hack to resolve. IE brings too much issue! 

 

height: expression(this.scrollHeight > 450 ? "450px" : this.scrollHeight+15);width: expression(this.scrollHeight > 450 ? "62%" : "90%");

 

62% is an experience value that works for me. For you it depends your page structure and your favor. Finally, I had my things done. Below is the finally code in my style sheet. The image code.gif is a cool idea to personalize your code area.  CSS Selector ":before" and ":after" could do the similar thing but it's only supported by CSS 3. Currently CSS 2 is widely supported. Another article(Chinese) about CSS Selector.
pre {margin: 16px;overflow: auto;padding: 40px 0 20px 60px;max-height: 450px;background: transparent url(/images/code.gif) left top no-repeat;}* html pre { /* IE hacks */height: expression(this.scrollHeight > 450 ? "450px" : this.scrollHeight-40);width: expression(this.scrollHeight > 450 ? "62%" : "90%");}

Posted by Alex at 2:43 AM | Comments (0) | Edit | Taged: Firefox (7), IE (3)

importing rss feed from msn spaces to movable type

Yueyue is migrating her blog from msn spaces to movable type . It's a real...

Yueyue is migrating her blog from msn spaces to movable type . It's a real difficult thing. Msn spaces have a limited number of post in the rss feed. Yueyue didn't find any option to overcome this limitation. So it's difficult to have the entire rss feed for importing. Here's a discussion(Chinese) on this issue and gave a way: Get the rss feed then remove the posts in this feed, then get the rss feed again and plus to previous feed, then remove... untill get the entire feed. It works, but really takes time if you have a long list. Anyhow, you would have it! We go to Movable Type.

MT builds in import/export feature but it only works on his own format, rss x.0 is not supported yet. We can not import the msn rss feed directly. I had a solution for it. I write a macro file for UltraEdit that read a msn rss feed file and convert it to MT import/export format. After the convert ion, you could save the output as a new file for importing use.

AUTHOR, ALLOW COMMENTS, CONVERT BREAKS and ALLOW PINGS are set default value, you could change them before your importing. DATE might not match your requirement if you have different timezone settings between msn spaces and movable type. Another point, in this case the same charset setting(UTF-8 here) is taken for both side movable type and msn spaces. If you have different setting between them, must do additional charset convertion for the feed file. this could be done within UltraEdit. Unfortunaly some convertion only available in UltraEdit menu but not in Macro. So we have to do it manually.

Output example: 

AUTHOR: #authorname          
TITLE: importing rss feed from msn spaces to movable type
ALLOW COMMENTS: 1            
CONVERT BREAKS: 1            
ALLOW PINGS: 1               
PRIMARY CATEGORY: essay      
DATE: 11/23/2006 03:42:07    
-----                        
BODY:                        
<p>Yueyue is migrating her blog from ...
-----                        
--------                     

UltraEdit tool is necessary for running this macro file. The macro could be used on migrating other rss 2.0 feed  to movable type with little change.

msn_feed2mt.mac

InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Find RegExp "<generator>Microsoft Spaces v[0-9.]+</generator>"
IfNotFound
ExitMacro
EndIf
Top
Find RegExp "^n"
Replace All ""
Find RegExp "<^?xml*</cf:listinfo>"
Replace All ""
Find RegExp "<item><title>Photo Album:*</item>"
Replace All ""
Find RegExp "<item><title>Custom List:*</item>"
Replace All ""
Find RegExp "<item><title>Music List:*</item>"
Replace All ""
Find RegExp "<item><title>Blog List:*</item>"
Replace All ""
Find RegExp "</channel></rss>"
Replace All ""
Find RegExp "<link>*</link>"
Replace All ""
Find RegExp "<guid*</guid>"
Replace All ""
Find RegExp "<comments>*</comments>"
Replace All ""
Find RegExp "<slash:comments>*</slash:comments>"
Replace All ""
Find RegExp "<msn:type>*</msn:type>"
Replace All ""
Find RegExp "<live:type>*</live:type>"
Replace All ""
Find RegExp "<live:typelabel>*</live:typelabel>"
Replace All ""
Find RegExp "<dcterms:modified>*</dcterms:modified>"
Replace All ""
Find "<item>"
Replace All ""
Find "</item>"
Replace All ""
Find "&lt;"
Replace All "<"
Find "&gt;"
Replace All ">"
Find RegExp "<title>^(*^)</title><description>^(*^)</description><category>^(*^)</category><pubDate>^(*^)</pubDate>"
Replace All "^nAUTHOR: #authorname^nTITLE: ^1^nALLOW COMMENTS: 1^nCONVERT BREAKS: 1^nALLOW PINGS: 1^nPRIMARY CATEGORY: ^3^nDATE: ^4^n-----^nBODY: ^n^2^n-----^n--------"
Find RegExp "%DATE: *, ^([0-9]+^) ^([a-zA-Z]+^) ^([0-9]+^) ^(*^) GMT$"
Replace All "DATE: ^2/^1/^3 ^4"
Find RegExp "%DATE: Jan*/"
Replace All "DATE: 01/"
Find RegExp "%DATE: Feb*/"
Replace All "DATE: 02"
Find RegExp "%DATE: Mar*/"
Replace All "DATE: 03/"
Find RegExp "%DATE: Apr*/"
Replace All "DATE: 04/"
Find RegExp "%DATE: May/"
Replace All "DATE: 05/"
Find RegExp "%DATE: Jun*/"
Replace All "DATE: 06/"
Find RegExp "%DATE: Jul*/"
Replace All "DATE: 07/"
Find RegExp "%DATE: Aug*/"
Replace All "DATE: 08/"
Find RegExp "%DATE: Sep*/"
Replace All "DATE: 09/"
Find RegExp "%DATE: Oct*/"
Replace All "DATE: 10/"
Find RegExp "%DATE: Nov*/"
Replace All "DATE: 11/"
Find RegExp "%DATE: Dec*/"
Replace All "DATE: 12/" 

For getting rss feed on msn spaces, it needs to turn the option Syndicate this space On within msn spaces setting.

Yueyue have another place blogcn need to migrate. The rss feed from blogcn is more clear than msn spaces. But it's in GB2312. I made changes on the macro file as below that works for blogcn's rss feed. Following step must be taken after the macro process: File -> Conversions -> ASCII to UTF-8 (Unicode Editing), then save. Or you have other way to do the charset convertion.

InsertMode
ColumnModeOff
HexOff
DosToUnix
UnixReOff
Top
Find RegExp "<rss version="
IfNotFound
ExitMacro
EndIf
Top
Find RegExp "^p"
Replace All ""
Find RegExp "<^?xml*</dc:language>"
Replace All ""
Find RegExp "</channel></rss>"
Replace All ""
Find RegExp "<link>*</link>"
Replace All ""
Find RegExp "<guid*</guid>"
Replace All ""
Find RegExp "<comments>*</comments>"
Replace All ""
Find "<item>"
Replace All ""
Find "</item>"
Replace All ""
Find RegExp "<author>^(*^)</author>*<title><!^[CDATA^[^(*^)]]></title>*<pubDate>^(*^)</pubDate>*<description>*<!^[CDATA^[^(*^)]]>*</description>"
Replace All "^nAUTHOR: ^1^nTITLE: ^2^nALLOW COMMENTS: 1^nCONVERT BREAKS: 1^nALLOW PINGS: 1^nPRIMARY CATEGORY: #blogcn^nDATE: ^3^n-----^nBODY: ^n^4^n-----^n--------"
Find RegExp "%DATE: ^([0-9]+^)-^([0-9]+^)-^([0-9]+^) ^(*^)$"
Replace All "DATE: ^2/^3/^1 ^4"

Posted by Alex at 10:21 AM | Edit | Taged: feed (1), import (2), msn spaces (2), MT (25), rss (2)

schedual awstats update on Dreamhost

My blog is hosted by Dreamhost, that is based on linux and allows crontab command....

My blog is hosted by Dreamhost, that is based on linux and allows crontab command. About cron here's good article for reference. To add a new schedual job, use following command in shell.

$crontab -e
then insert a line like this.
 
00 0-23/4 * * * /home/yourname/jobs/updawt.sh > /home/yourname/jobs/logs/updawt_`date '+\%Y\%m\%d\%H\%M'|tr -d '\\\'`.log 

That means run the script once every 4 hour each day. The code is for updawt.sh:

cd /home/yourname/aiview.com/cgi-bin/awstats/
./awstats.pl -config=aiview.com -update
exit 0

As the time of cron was not available, I used this solution.

 

# updawt.sh
# run this shell as:
#   nohup ./updawt.sh &
# then it will keep running in background whatever you
# logout your shell.
#
# this shell trigers the awstats to update httpd log for
# website aiview.com
#
# by alex, alezhangs@gmail.com, www.aiview.com
# last modified: Jan 18, 2007
cd /home/xxx/aiview.com/cgi-bin/awstats/
./awstats.pl -config=aiview.com -update
sleep 3600
. $0
exit 0
3600 is meaning 3600 second, 10 hours. Run this script as below on Linux, then logout.
$ nohup ./updawt.sh & 

Posted by Alex at 1:05 AM | Comments (0) | Edit | Taged: awstats (5), linux (38)

window.onload problem

I use several javascript for some features on blog, such as highlighting keywords , collapse...

I use several javascript for some features on blog, such as highlighting keywords , collapse and expand the entry area and switch the style sheets . There's a problem that the javascript would not apply untill the whole page is loaded completely. If there's big images in the page or the Internet is very slow, the visitor will have the real bad expereices. Is there's a way to have the javascript work after the document is loaded but before the images are loading? I'm really in luck, the guy  make this work on Firefox, IE and  Safari.

So now I have below code for my each .js file that need this feature. (no Safari supported so for)

// Only for Mozila/Firefox Browser
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", Switchcss.run, false);
}
// Only for IE
/*@cc_on @*/
/*@if (@_win32)
document.write("<script defer src=/ie_onload.js><"+"/script>");
/*@end @*/
// For all other Browsers
if (window.onload) {
Switchcss._old_onload = window.onload;
window.onload = function(e) {
Switchcss._old_onload(e);
Switchcss.run();
}
} else {
window.onload = function(e) {
Switchcss.run();
}
} 

ie_onload.js 

try{Switchcss.run()}catch(e){}
try{Keyword.run()}catch(e){}
try{Hidebody.run()}catch(e){} 

Posted by Alex at 12:45 AM | Comments (0) | Edit | Taged: Javascript (5)

Refine web page structure

I was using below page structure for this blog.  The stucture is very simple and...

I was using below page structure for this blog.  The stucture is very simple and clear. It works well on auto-width mode. The css is easy to design and also easy to deal with different browsers. No much effort on keeping identical for different browsers. However there's hard thing for it, the fixed width with center mode. I could not have the right style sheet making it work well with this structure.

Logo  
Main
Menu
Footer

Now I have below structure. It's my balance on flexible style and clear page structure. I don't like too much level div there, it would cost more client resource and make the page fat. When I play with this structure, I took more effort on having it work out with different browsers.

body class="index-container"
div id="container"
div id="header"
div id="navigation"
div id="crosssitenavigation"
div id="main"
div id="alpha"
beta
delta
gamma 

More about the refine work please see Refine and add new features to my web site.

 

Posted by Alex at 10:44 PM | Comments (0) | Edit | Taged: blog (2), refine (2)

Expect new feature on gmail

I sent this suggestion at Gmail help center. I want to get a none-grouped Contacts view,...

I sent this suggestion at Gmail help center.

I want to get a none-grouped Contacts view, then easier to give groups on each of them.

I got hundreds contacts there, so experienced difficult to indicate who are not in any group that's very important to organize new contacts from the incoming email or imported without group given.

Thank you a million!

Keep an eye to see if google will response this well.

Posted by Alex at 5:48 PM | Comments (0) | Edit | Taged: Gmail (6)

Gmail filters come and tips

There's new feature comes with Gmail, filters for new mails.    We could custmize our own rules...

There's new feature comes with Gmail, filters for new mails.

    gmail filter setting window

We could custmize our own rules with it for various automatic operations such as attaching tags, forwarding, delete, archive.

    gmail filter action window

I mainly use tags for nearly all filters and use archive for some subscribed mails which comes lots of each day and no need to pay special attention.

As default, new created filters won't be applyed to existed mails. there's an option for applying filter on the old mails which matchs the filter during the creating process.

Father moe, I got a tip after several tries.

If you want a rule search logic as "A or B", you can input "A || B" as the rule text. Any way else, I tried "A B", "A or B", they don't works.

In this way you could merge multi filters which have different rule search but same rule actions into one filters, just like this one merged.

    example for gmail filter

Posted by Alex at 11:58 AM | Comments (0) | Edit | Taged: Gmail (6)

Publish Flickr Photos in Blog

Flickr let you publish your photos in Flickr to an external site such as your own...

Flickr let you publish your photos in Flickr to an external site such as your own website.

Exactly, it's that Flickr made your an flash which contains thumbnail of your photos, then you put this flash into your site. the photos in this flash would be updated dynamically.

I put following code generated by Flickr into my MT template. 

<!-- Start of Flickr Badge -->
<style type="text/css">
.zg_div {margin:0px 5px 5px 0px; width:117px;}
.zg_div_inner {border: solid 1px #000000; background-color:#ffffff;  color:#666666; text-align:center; font-family:arial, helvetica; font-size:11px;}
.zg_div a, .zg_div a:hover, .zg_div a:visited {color:#3993ff; background:inherit !important; text-decoration:none !important;}
</style>
<script type="text/javascript">
zg_insert_badge = function() {
var zg_bg_color = 'ffffff';
var zgi_url = 'http://www.flickr.com/apps/badge/badge_iframe.gne?zg_bg_color='+zg_bg_color+'&zg_person_id=83054260%40N00';
document.write('<iframe style="background-color:#'+zg_bg_color+'; border-color:#'+zg_bg_color+'; border:none;" width="113" height="151" frameborder="0" scrolling="no" xsrc="'+zgi_url+'" title="Flickr Badge"></iframe>');
if (document.getElementById) document.write('<div id="zg_whatlink"><a xhref="http://www.flickr.com/badge_new.gne"    style="color:#3993ff;" onclick="zg_toggleWhat(); return false;">what is this?<\/a><\/div>');
}
zg_toggleWhat = function() {
document.getElementById('zg_whatdiv').style.display = (document.getElementById('zg_whatdiv').style.display != 'none') ? 'none' : 'block';
document.getElementById('zg_whatlink').style.display = (document.getElementById('zg_whatdiv').style.display != 'none') ? 'none' : 'block';
return false;
}
</script>
<div class="zg_div"><div class="zg_div_inner"><a xhref="http://www.flickr.com">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><br>
<script type="text/javascript">zg_insert_badge();</script>
<div id="zg_whatdiv">This is a Flickr badge showing public photos from <a xhref="http://www.flickr.com/photos/83054260@N00">I need to follow my heart</a>. Make your own badge <a xhref="http://www.flickr.com/badge_new.gne">here</a>.</div>
<script type="text/javascript">if (document.getElementById) document.getElementById('zg_whatdiv').style.display = 'none';</script>
</div>
</div>
<!-- End of Flickr Badge -->

 

Posted by Alex at 1:13 AM | Comments (0) | Edit | Taged: blog (2), Flickr (2)

get more Firefox Extentions

I'm not sure exactly what the difference of Plugins and Extentions on Firefox is.There're Plugins such...

I'm not sure exactly what the difference of Plugins and Extentions on Firefox is.

There're Plugins such as Flash, WMP, Shockwave. 

There're plenty of Extentions which add various features into Firefox.

I'm seeking an Extention which acts like what screen copy does.

I installed Follwing Extentions.

NOTE: I must install them by running the hdd version of Firefox because I run my Firefox on my RAM disk. otherwise all installed Extentions will be lost after a reboot. 

infoRSS 

infoRSS 1.01.

Displays RSS, Atom, HTML and NNTP feed in the status bar. Compatible with podcasting RSS.

It's also a good Gmail notifier.

Flickr Sidebar 

Flickr Sidebar 0.1.1, by Richard Klein, released on December 23, 2005
This Flickr sidebar is used for viewing and searching photo lists. You can access it by the command key Ctrl+Shift+F, the toolbar button, or clicking on the menu option View|Sidebars|Flickr Sidebar. Once you have authorized the extension to work with your flickr account, you can search through or view a full list of your photos, your favorites, everyones photos, your individual contacts, or your groups. Double clicking a photo opens it's page in the current tab. You can also use all the standard link modifiers to open in tabs and windows.

Finally, I found the Extention what I want at outside of Firefox Addons.

Pearl Crescent Page Saver

Pearl Crescent Page Saver 1.0
a free extension for Mozilla Firefox that lets you save an image of a web page to a file in PNG format.  Options let you control whether images are saved at full size (which is the default) or scaled down to a smaller size.  The Page Saver extension uses the new canvas feature that was introduced in Firefox 1.5. 

Reference

Posted by Alex at 2:02 AM | Comments (0) | Edit | Taged: Firefox (7)

show subtitles in embedded WMP

the value for SAMIFileName must be a .smi file. *.lrc file or others do not work...

the value for SAMIFileName must be a .smi file. *.lrc file or others do not work here.

If .smi files located at the same path with media files,  then no need to specify the parameter of SAMIFileName. WMP will find it automatically.

Sometime, the captions will not display if the .smi file has wrong encoding mode.

Code 

<object id="media" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" standby="Loading" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="0" width="0">
<param name="URL" value="http://210.51.6.45/go/musichigh/bymyside.mp3">
<param name="AutoStart" value="true">
<param name="captioningID" value="CapText">
<param name="SAMIFileName" value="http://210.51.6.45/go/musichigh/bymyside.smi"> <!-- http://210.51.6.45/go/musichigh/bymyside.lrc does Not work here. -->
</object>
<div id="CapText">sss</div>

Reference

  • ClosedCaption.SAMIFileName
    http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/closedcaptionsamifilename.asp

Posted by Alex at 9:49 PM | Comments (0) | Edit | Taged: lrc (1), Media Player (1), subtitle (1)

A new way to access Wikipedia in China

Recently I keeps being not able to visit google at most time. Baidu gets much fewer...

Recently I keeps being not able to visit google at most time. Baidu gets much fewer english resource than google, and the wikipedia has gone for long time(from Oct. last year).

So, I pick up another english search engine from my Bookmark. Fortunately, I got Answer.com there. It's my first time addressing to this search engine. I found something interested in it.

answer.com homepage

Answer.com seems like a meta-search engine. It returns results from different data source such as wikipedia and classify them. it also search web pages itself. but it don't use other search engines.

answer.com

You could use following link:

  • http://www.answers.com/topic/UTF-8#Wikipedia

instead of:

  • http://en.wikipedia.org/wiki/UTF-8

This is very very helpful for visiting wikipedia when it is being blocked.

Posted by Alex at 2:46 PM | Comments (0) | Edit | Taged: wikipedia (3)

running firefox on Ram disk

I had ever moved my IE temporary files folder into a Ram disk for reducing the...

I had ever moved my IE temporary files folder into a Ram disk for reducing the disk IO during surfing.

When I play with Firefox, I don't find any option for moving its temporary files folder like IE does. But finally I found it, not just moving the firefox's profiles, even for firefox.exe itself.

There're 3 level solutions you may choose.

  1. Enable built-in memory cache feature to speed firefox up.
  2. Move profile folder to Ram disk including temporary files folder.
  3. Run both firefox.exe and profile folder on Ram disk.

The 1th solution is most simple, the 3th solution is most complex but has the maximum of reducing disk IO.

The steps for the 1th solution refer to:

Before starting to do the next 2 solutions, you will have to create a Ram disk on your computer. I use this tool called RamDisk, download it at:

  • http://www.greendown.cn/Software.asp?id=530

The steps for the 2th solution refer to:

The steps for the 3th solution: 

  1. Copy the Firefox application folder and your profile folder to the Ram disk. In this example we will use R:\Firefox for the application folder and R:\FFProfile as the profile folder, assuming the drive letter for the Ram disk is R:.
  2. Create a simple batch file called R:\Firefox.bat with the following line:
    start R:\Firefox\firefox.exe -profile R:\FFProfiles
  3. Optionally, you may don't want to lose the bookmarks saved in Ram disk after reboot. Move bookmark file back to harddisk folder by entering about:config in the address field of firefox and set
    browser.bookmarks.file=C:\\Documents and Settings\\Alex\\Application Data\\Mozilla\\Firefox\\Profiles\\ve6luvh6.default\\bookmarks.html
  4. Make system copy firefox application and profile folder from hard disk to Ram disk automatically at each boot time by adding following lines to file C:\AUTOEXEC.BAT.
    rd /S /Q R:\Firefox
    rd /S /Q R:\FFProfiles
    del R:\Firefox.bat

    xcopy /E /H /K "%APPDATA%\Mozilla\Firefox\Profiles\ve6luvh6.default\*" R:\FFProfiles\*
    xcopy /E /H /K "C:\Program Files\Mozilla Firefox\*" R:\Firefox\*

    echo start R:\Firefox\firefox.exe -profile R:\FFProfiles>R:\Firefox.bat
    R:\Firefox.bat
  5. Optionally, disable firefox memory cache to reduce memory usage because the whole program and profiles are running in Ram by setting
    browser.cache.memory.enable=false
  6. Notes: With this solution, all settings made in Ram disk will be lost after system reboots. If you want the settings to be used after rebooting, should make the setting change by running firefox based on harddisk, and then re-copy all folder from hard disk to Ram disk by running AUTOEXEC.BAT.
  7. Refer to:
    Run Firefox from removable media
    http://www.mozilla.org/support/firefox/tips#oth_usb

Refer to

Tested on

  • OS: Windows xp professional
  • Firefox: version 1.5

继续阅读 "running firefox on Ram disk" 的剩余内容

Posted by Alex at 10:16 AM | Comments (0) | Edit | Taged: Firefox (7), ramdisk (2)

going with Gmail contacts

There're 3 view on Contacts page. Frequently MailedAll ContactsGroupsThe first view will show the mail...


There're 3 view on Contacts page.

  1. Frequently Mailed
  2. All Contacts
  3. Groups

The first view will show the mail addresses which you most frequently mailed in past days. It also contains the goups as same as the mail addresses.

You could create your own named groups for getting your contacts order. The conception of Groups is like "tag" which allow you give multi tags on one item. That means you are able to assign one contact to more than one group. This is very helpful.

The most powerful feature with gmail is the search. It also comes with Contacts.  You're able to search all the fields definded on contacts such as full name, email account, email domain name, notes for persons, phone, whatever.  And the search is going with all operations where you feel you need it.;) As the search result, you could pick up one or a group of them for operation, such as sending email or managing goups.

With the powerful contacts search the groups feature is a little bit redundant as my personal opinion, however the group is still a more convenient way for sending a group mail quickly in most cases than searching. But the group will take more efforts for getting order.

More about importing and exporting a batch of contacts please continue to read.

继续阅读 "going with Gmail contacts" 的剩余内容

Posted by Alex at 2:30 PM | Comments (0) | Edit | Taged: Gmail (6)

setup Perl&Apache on windows xp

Download Download the All-in-One package at:http://www.apache.org/dyn/closer.cgi/perl/win32-bin/This package contains Perl and Apache binaries. so you don't need to...

Download 

Download the All-in-One package at:

This package contains Perl and Apache binaries. so you don't need to download Apache additionally.

The downloaded file name is Perl-5.8-win32-bin-0.10.exe

Installation & configuration

Run this installation file, choose a directory where would be installed, if you want the files to be in C:\Perl\, just Enter C:\ . I installed at D:\Green\

All files would be copied into D:\Green\Perl and D:\Green\Apache2

After the installation, the application will ask you if start to configure the Apache and Perl. just need to follow the indication of the text based configuration wizard.

If configure is succeed with no error then go to next step.

Add these 2 paths where are your Perl and Apache installed into your OS environment variable PATH:

D:\Green\Perl\bin
D:\Green\Apache2\bin

Then open a dos window to run following commands:

dos> apache -k install
dos> apache -k start
  • The 1st command will add a service in windows services list called Apache2.
  • The 2nd command will start the Apache web server with default settings.

After this, you can open IE to visit your web server by either of below URLs. you should see the Apache welcome page if you generated them during the configuration above.

Following step is very important and must be taken! For running perl script named as .cgi or .pl on Apache, you should have below code at the first line in your each .pl or .cgi file:

#!d:/green/perl/bin/perl -w

Up to now, the Apache and Perl environment have been ready for use. visit these links for checking if Perl and PHP both work.

Reference

 

Posted by Alex at 6:05 PM | Comments (0) | Edit | Taged: Apache (3), perl (2)

Play with 20Q

来看看这个应用了人工智能的网络服务20Q.net,你自己心里想象一个物品,然后回答20Q问你的问题,幸运的话20Q会在第19次提问后猜出你想的东西,这不是以前你可能在PPS 中玩过的猜扑克牌的小把戏,这是真的! http://y.20q.net/anon 这是我回答了19个问题后它猜出来的答案。没错!答案就是我心里想的。    Q20.  我会猜它是数据库? 是 ,  否 , 接近 19.    它是否在100年前就开始使用了? 否. 18.    它会否令人高兴?...
来看看这个应用了人工智能的网络服务20Q.net,你自己心里想象一个物品,然后回答20Q问你的问题,幸运的话20Q会在第19次提问后猜出你想的东西,这不是以前你可能在PPS 中玩过的猜扑克牌的小把戏,这是真的!

http://y.20q.net/anon

这是我回答了19个问题后它猜出来的答案。没错!答案就是我心里想的。

 

 Q20.  我会猜它是数据库?
 是 ,  否 , 接近


19.

  

它是否在100年前就开始使用了?.

18.

  

它会否令人高兴?.

17.

  

它是否出现在电影里?.

16.

  

它是一个抽象的概念吗? 是.

15.

  

它是一件工具吗? 是.

14.

  

您会在黑暗中使用它吗?? 否.

13.

  

它是否旅行时使用? 否.

12.

  

警察会用它吗? 是.

11.

  

您会否每天使用它? 是.

10.

  

您会在家中使用它吗? 是.

9.

  

它是否比一块面包小? 否.

8.

  

它比一只鸭子重吗? 否.

7.

  

它是否一般肉眼可见? 是.

6.

  

它会否在教堂出现? 否.

5.

  

您可以举起它吗? 否.

4.

  

它是在室外的吗? 否.

3.

  

它是否有多种颜色? 否.

2.

  

它是日常家居用品吗? 否.

1.

  

您会在公众场所使用它? 可能.

 

  

它是分类为不了解。

 

Posted by Alex at 5:30 PM | Comments (0) | Edit | Taged: web 2.0 (2)

Why gmail?

gmail 最近增加了导出联系人的功能——这是我及多数人所期盼的,并允许导出为微软outlook 客户端使用的格式,就是说可以很方便的把gmail 联系人导入到outlook,同时也意味着可以导入到微软hotmail 联系人列表。 hotmail 的功能一再升级,现在与msn messenger 已经结合的相当紧密,但一直不允许导出联系人列表。对比起google ,微软或许真的老了,在思想上,最起码在Internet 上是这样,google 就是在这种开放的策略下逐渐壮大,利他基因也有存在的理由,而且并不违背基因的原始任务,这在google 身上得到了很好的体现。...

gmail 最近增加了导出联系人的功能——这是我及多数人所期盼的,并允许导出为微软outlook 客户端使用的格式,就是说可以很方便的把gmail 联系人导入到outlook,同时也意味着可以导入到微软hotmail 联系人列表。

gmail export window

hotmail 的功能一再升级,现在与msn messenger 已经结合的相当紧密,但一直不允许导出联系人列表。对比起google ,微软或许真的老了,在思想上,最起码在Internet 上是这样,google 就是在这种开放的策略下逐渐壮大,利他基因也有存在的理由,而且并不违背基因的原始任务,这在google 身上得到了很好的体现。

Posted by Alex at 12:54 PM | Comments (0) | Edit | Taged: Gmail (6)

RSS 简介

上一封邮件给大家介绍了blog,这次介绍一个新的工具:在线RSS 订阅器为什么使用rss?网站通过rss 发布内容,订阅者可以通过rss 阅读器同时订阅多个感兴趣网站的rss发布,通过订阅工具,读者可以通过一个入口,集中的阅读当天最新的文章,而不用到处登录去寻找某日以后的更新。哪里找到rss?支持rss 发布的网站一般都会找到类似下面这样的图片或文字链接:                      Syndicate this site (XML)并包含有类似如下的链接:http://www.domain.com/index.xmlhttp://www.domain.com/index.rdfhttp://www.domain.com/atom.xmlhttp://feeds.feedburner.com/aiview通过上面的链接就可以订阅rss。如何使用bloglines订阅?bloglines 是一个在线的rss 订阅工具,不需要安装软件,通过登录www.bloglines.com 进行订阅并在线阅读rss。首先申请一个用户帐号,登录后,点击新增按钮,把需要订阅的rss 链接粘贴到“Blog or feed...
上一封邮件给大家介绍了blog,这次介绍一个新的工具:在线RSS 订阅器

为什么使用rss?网站通过rss 发布内容,订阅者可以通过rss 阅读器同时订阅多个感兴趣网站的rss发布,通过订阅工具,读者可以通过一个入口,集中的阅读当天最新的文章,而不用到处登录去寻找某日以后的更新。

哪里找到rss?支持rss 发布的网站一般都会找到类似下面这样的图片或文字链接:
                      Syndicate this site (XML)

并包含有类似如下的链接:
http://www.domain.com/index.xml
http://www.domain.com/index.rdf
http://www.domain.com/atom.xml
http://feeds.feedburner.com/aiview

通过上面的链接就可以订阅rss。

如何使用bloglines订阅?bloglines 是一个在线的rss 订阅工具,不需要安装软件,通过登录www.bloglines.com 进行订阅并在线阅读rss。
首先申请一个用户帐号,登录后,点击新增按钮,把需要订阅的rss 链接粘贴到“Blog or feed URL”文本框,点击“subscribe”即可。

Posted by Alex at 1:03 PM | Comments (0) | Edit | Taged: rss (2)

麻省理工学院开放式课程计划(MIT OCW) 简介

Reinhard 正在日本出差,对于他已经是午夜,依然在登录gtalk,gtalk 把界面设计的这么简单,似乎目的就是让你talk,don't type。我也改了使用msn messenger 的习惯,calling... 习惯的聊上几句,Reinhard 把MIT OpenCourseWare(麻省理工学院开放式课件) 介绍给了我。这是一个教育资源的开放计划,作为这个计划的目的之一,麻省理工学院通过Internet 向全世界范围的教授者、学生以及自学者免费提供学院中各学科课件资料的存取及检索服务。这里是一个完整的课程列表,课件资料包括课程笔记、阅读列表、思考问题、家庭作业、演示文稿,甚至程序代码等等。下面是一门网络与计算机安全课程图片:这里也有一个中文的网站在运行“开放式课程计划 OOPS”,包含多所大学的课程,MIT OCW 中文项目 也被包含在里面,这里能够找到翻译完成的中文课件资料。同时他们也在招募志工,协助翻译工作以及提供其它服务。...

Reinhard 正在日本出差,对于他已经是午夜,依然在登录gtalk,gtalk 把界面设计的这么简单,似乎目的就是让你talk,don't type。我也改了使用msn messenger 的习惯,calling... 习惯的聊上几句,Reinhard 把MIT OpenCourseWare(麻省理工学院开放式课件) 介绍给了我。

这是一个教育资源的开放计划,作为这个计划的目的之一,麻省理工学院通过Internet 向全世界范围的教授者、学生以及自学者免费提供学院中各学科课件资料的存取及检索服务。

这里是一个完整的课程列表,课件资料包括课程笔记、阅读列表、思考问题、家庭作业、演示文稿,甚至程序代码等等。下面是一门网络与计算机安全课程图片:

Secure sockets layer protocol.

这里也有一个中文的网站在运行“开放式课程计划 OOPS”,包含多所大学的课程,MIT OCW 中文项目 也被包含在里面,这里能够找到翻译完成的中文课件资料。同时他们也在招募志工协助翻译工作以及提供其它服务。

Posted by Alex at 12:49 AM | Comments (0) | Edit | Taged: MIT (1), OCW (1)

wikipedia——在线的多语言大百科全书

今天在google 中查找美国各州及城市列表,链接到了wikipedia,它还有一个中文的版本,叫做wiki 百科。 这里面的信息经过组织整理,非常具有条理性,而且也很具有时效性,支持查询,在wikipedia 中搜索"list of cities in us" 很容易找到了我想要的内容。再搜索一下"list of australia" ,会觉得真的在用一部非常方便的百科全书,某些情况下,搜索wikipedia 或许比搜索google 更高效。还可以试试"list of...

今天在google 中查找美国各州及城市列表,链接到了wikipedia,它还有一个中文的版本,叫做wiki 百科

wiki logo for english version

这里面的信息经过组织整理,非常具有条理性,而且也很具有时效性,支持查询,在wikipedia 中搜索"list of cities in us" 很容易找到了我想要的内容。再搜索一下"list of australia" ,会觉得真的在用一部非常方便的百科全书,某些情况下,搜索wikipedia 或许比搜索google 更高效。

还可以试试"list of films" :

Posted by Alex at 11:44 PM | Comments (0) | Edit | Taged: web 2.0 (2), wikipedia (3), 百科全书 (1)

选择微软?还是Google?

近日收到朋友的Gmail邀请,建立了自己的Gmail 帐号,虽然Gmail 提供了许多令人动心的特色,但对我来说,这不是简单的Email 服务商的迁移,而是从IM(msn messenger)、Email(hotmail)、一直到blog(msn spaces) 的迁移。说得大一点,就是选择微软还是google?这里面最难的一个环节是IM ,已经有大长串的朋友在msn messenger 上了,而且可以很方便的与hotmail 帐户之间共享联系人,msn messenger 和hotmail 一直没有提供联系人导出功能,进来是可以的,但出去不许把东西打包带走:)。google 的确在吸引着我,使用gmail 不用再为剩余空间和邮件查找烦恼,摆脱hotmail...

近日收到朋友的Gmail邀请,建立了自己的Gmail 帐号,虽然Gmail 提供了许多令人动心的特色,但对我来说,这不是简单的Email 服务商的迁移,而是从IM(msn messenger)、Email(hotmail)、一直到blog(msn spaces) 的迁移。说得大一点,就是选择微软还是google?这里面最难的一个环节是IM ,已经有大长串的朋友在msn messenger 上了,而且可以很方便的与hotmail 帐户之间共享联系人,msn messenger 和hotmail 一直没有提供联系人导出功能,进来是可以的,但出去不许把东西打包带走:)。

google 的确在吸引着我,使用gmail 不用再为剩余空间和邮件查找烦恼,摆脱hotmail 讨厌的http 收信的同时,终于可以smtp 迅速的发送邮件了。还有简洁实用的gtalk ,音质很具有临场感。

其实还有一点,我欣赏google 后面创新的精神,相信在她后面会有更多精彩。

无论如何,暂时先把google 作为甜点品尝吧,我还希望继续与messenger 上面的朋友们继续保持联系,也希望可以很方便的从messenger 收到邮件通知并进行回复,还希望把我的idea 通过msn spaces 与朋友们共享,同时也希望有一种比较方便的方式看他们正在“说”什么。毕竟我使用这些服务的目的是为了提高生活质量,而不是用来打乱生活。

Posted by Alex at 12:51 AM | Comments (0) | Edit | Taged: Gmail (6), Google (3), Gtalk (1), Hotmail (1), msn messenger (3), 微软 (3)

Awstats 启用HostInfo 插件

Awstats 6.2 版本提供了一个用于显示主机所属信息的插件:HostInfo 。默认此插件为关闭,编辑文件awstats.domain.com.conf 启用此插件,找到以下行:# Plugin: HostInfo# Perl modules required: Net::XWhois# Add a column into host...

Awstats 6.2 版本提供了一个用于显示主机所属信息的插件:HostInfo 。默认此插件为关闭,编辑文件awstats.domain.com.conf 启用此插件,找到以下行:

# Plugin: HostInfo
# Perl modules required: Net::XWhois
# Add a column into host chart with a link to open a popup window that shows
# info on host (like whois records).
#
#LoadPlugin="hostinfo"

将LoadPlugin="hostinfo" 之前的注释去掉,保存退出。

再次运行Awstats 报错,提示在已有路径中找不到Net::XWhois 模块,依次查找RedHat Linux 9 的三张安装光盘。

$ cd /mnt/cdrom/RedHat/RPM
$ rpm -qlp perl-*.rpm |grep -i xwhois

没有找到包含这个模块的程序包,最后在rpmFine.net 找到了这个模块的下载:

ftp://rpmfind.net/linux/dag/redhat/9/en/i386/dag/RPMS/perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm

不过需要注意你的系统版本,最好从下面的链接进入,逐步选择:

http://rpmfind.net/linux/RPM/dag/

下载程序包:

$ wget ftp://rpmfind.net/linux/dag/redhat/9/en/i386/dag/RPMS/perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm

安装模块,先看看这个包含有哪些文件:

$ rpm -qlp perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm
warning: perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm: V3 DSA signature: NOKEY, key ID 6b8d79e6
/usr/lib/perl5/vendor_perl/5.8.0/Net/XWhois.pm
/usr/share/doc/perl-Net-XWhois-0.90
/usr/share/doc/perl-Net-XWhois-0.90/ARTISTIC
/usr/share/doc/perl-Net-XWhois-0.90/Changes
/usr/share/doc/perl-Net-XWhois-0.90/TODO
/usr/share/man/man3/Net::XWhois.3pm.gz

开始安装(需要在root 权限下进行):

# rpm -ivh perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm
warning: perl-Net-XWhois-0.90-1.0.rh9.dag.noarch.rpm: V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:perl-Net-XWhois ########################################### [100%]

安装完毕,重新进入Awstats 统计页面,在主机项目增加了“WhoIs 资讯”一栏,如下:

主机WhoIs 资讯网页数文件数字节最近参观日期
202.108.130.138?483001.33 M字节2005年 八月 26日 17:34

通过这个插件得到的查询结果,与使用以下命令得到的内容相同:

$ whois 202.108.130.138

有关Awstats 的安装,请参考车东的文章:AWStats: Apache/IIS的日志分析工具——在GNU/Linux和Windows平台上的使用简介

Posted by Alex at 4:31 AM | Comments (0) | Edit | Taged: awstats (5), log (2)

Editlet 调整

让Editlet 编辑器产生<br /> ,而不是<br>在editor.html 中进行替换%3Cbr%3E%3Cbr%20/%3E 去除Editlet 自动添加的:<link xhref="css/sample.css" mce_href="css/sample.css" rel="stylesheet" type="text/css"> 编辑editor.html ,在getXHTML() 中注释://outStr='<link type="text/css" rel="stylesheet"...

让Editlet 编辑器产生<br /> ,而不是<br>

在editor.html 中进行替换
%3Cbr%3E
%3Cbr%20/%3E

去除Editlet 自动添加的:

<link xhref="css/sample.css" mce_href="css/sample.css" rel="stylesheet" type="text/css">

编辑editor.html ,在getXHTML() 中注释:

//outStr='<link type="text/css" rel="stylesheet" xhref="'+css_url+'" mce_href="'+css_url+'" />';

在setMode() 中修改:

//objEditArea.document.body.innerHTML = html.toString()+'<link type="text/css" rel="stylesheet" xhref="'+css_url+'" mce_href="'+css_url+'">';
objEditArea.document.body.innerHTML = html.toString();//+'<link type="text/css" rel="stylesheet" xhref="'+css_url+'" mce_href="'+css_url+'">';
//objEditArea.document.body.innerHTML = document.frmShowEditor.txtSource.value+'<link type="text/css" rel="stylesheet" xhref="'+css_url+'" mce_href="'+css_url+'">' ;
objEditArea.document.body.innerHTML = document.frmShowEditor.txtSource.value;//+'<link type="text/css" rel="stylesheet" xhref="'+css_url+'" mce_href="'+css_url+'">' ;
以上改动没有起到作用,由于源代码结构比较混乱,还有一层encode,要搞清楚需要很大精力,已经决定放弃继续在这套源码之上的refines了。

Posted by Alex at 5:07 PM | Comments (0) | Edit | Taged: Editlet (5), wysiwyg (6)

检验网页是否符合W3C 推荐的标准

正文W3C 提供了一个免费的在线验证服务,访问如下链接:http://validator.w3.org/在Address 中填入你需要验证的网页地址,点击Check 。如果返回:Passed validation则说明你的网页已经达到了标准,否则,会显示失败,并提示错误数目。Failed validation, 4 errors 下面会显示错误列表,可以根据提示信息修改网页。笔者的网站经过检查,错误主要集中在以下一些地方:IMG标签没有加入alt 属性。 下列标签容易忽视在结尾加入标签结束标志 <tag />。 IMG HR INPUT...

正文

W3C 提供了一个免费的在线验证服务,访问如下链接:

http://validator.w3.org/

在Address 中填入你需要验证的网页地址,点击Check 。如果返回:

Passed validation

则说明你的网页已经达到了标准,否则,会显示失败,并提示错误数目。

Failed validation, 4 errors 

下面会显示错误列表,可以根据提示信息修改网页。

笔者的网站经过检查,错误主要集中在以下一些地方:

  1. IMG标签没有加入alt 属性。
  2. 下列标签容易忽视在结尾加入标签结束标志 <tag />。
    • IMG
    • HR
    • INPUT
    • META
    • BR
  3. 属性的值没有使用双引号"" 引起,即使属性值是数字也需要。
  4. 错误的标签包含关系,比如把H1 标签包含在A 标签当中。
  5. HR 标签中不应直接定义样式,应通过CSS 定义。
  6. 使用了大写的标签名称或者属性。

但这个工具也存在一些问题,比如:

  • 对于网页中类似下面的链接,会对连接符& 的部分检出错误,但实际上这只是一个稍微复杂一些的超链接。
http://www-900.ibm.com/cn/support/forum/app/tscforum/list?categoryid=13&areaid=06
  • 网页中如果包含一些特殊字符,尤其是程序源码(即使已经包含在PRE 标签中),则会检出很多错误,甚至无法进行检测。

参考资源

Posted by Alex at 10:07 PM | Comments (0) | Edit | Taged: w3c (1)

使用Javascript 高亮搜索引擎关键词

需求 很大一部分网站,搜索引擎是其最重要的外部访问来源,某些情况,用户宁愿在简洁的搜索页面敲入关键词,也不愿按照一条已知的访问路径来找到资源。如果你的页面很大,定位搜索的关键词会不太容易,并不是每个使用者都知道使用"Ctrl+F",如果能将这些关键词高亮显示,是个很好的主意。 当用户在Google 中使用“db2 学习笔记”作为关键词进行搜索时,如果你的网页列在了结果中,用户点开你的网页,页面中所有出现"db2" 和"学习笔记" 地方,都使用特殊的底色进行了标识。 Hilite 我在Scott Yang 的网站,看到了Search Engine Highlight Javascript ,使用他编写的程序:se_hilite.js 1.1 ,可以很轻松的在网站实现以上功能。 安装很简单,将se_hilite.js 保存在网站目录,并在每一个需要高亮关键词的网页中引用这个js...

需求

很大一部分网站,搜索引擎是其最重要的外部访问来源,某些情况,用户宁愿在简洁的搜索页面敲入关键词,也不愿按照一条已知的访问路径来找到资源。如果你的页面很大,定位搜索的关键词会不太容易,并不是每个使用者都知道使用"Ctrl+F",如果能将这些关键词高亮显示,是个很好的主意。

当用户在Google 中使用“db2 学习笔记”作为关键词进行搜索时,如果你的网页列在了结果中,用户点开你的网页,页面中所有出现"db2" 和"学习笔记" 地方,都使用特殊的底色进行了标识。

Hilite

我在Scott Yang 的网站,看到了Search Engine Highlight Javascript ,使用他编写的程序:se_hilite.js 1.1 ,可以很轻松的在网站实现以上功能。

安装很简单,将se_hilite.js 保存在网站目录,并在每一个需要高亮关键词的网页中引用这个js 文件:

<script type="text/javascript" xsrc="se_hilite.js"></script>

之后在CSS 样式单中加入如下定义:

.hilite { background-color: #ff0; }

如果在se_hilite.js 中设定了:

Hilite.style_name_suffix: true; 

则还需要定义额外的CSS 样式:

.hilite1 { background-color: #ff0; }
.hilite2 { background-color: #f0f; }
.hilite3 { background-color: #0ff; }
.hilite4 ...

原理

如果在A 页面点击链接到达B 页面,则在B 页面可通过document.refferer 读到A 页面的链接。如果A 页面是一个搜索结果页面,则在B 页面读到的refferer 看起来会像下面这个样子:

http://www.google.com/search?q=db2+%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0&hl=en&lr=&newwindow=1

通过解析这个链接,取出每一个关键词,并在B 页面装载完成之后,使用Javascript 对页面进行搜索,对每一个关键词位置加入描述底色的代码。

这个动作实际是在用户的客户端浏览器中完成的,并没有对你的实际网页内容做任何更改。

功能扩展

笔者下载并在网站安装了Hilite,同时做了以下功能扩展:

  1. 增加了对中文关键词的支持。
  2. 增加了对关键词的链接索引,可以通过锚点(anchor)迅速链接到关键词首次出现的地方。
  3. 增加了国内流行的搜索引擎,因为要分析refferer,所以针对每个搜索引擎需提供单独的代码。作者的程序结构非常好,所以很容易扩充。
  4. 增加了搜索站内相关文章的功能,不需要动态程序,只需要利用搜索引擎和Meta 标签,当然这也需要对网站页面进行更多的修改。
  5. 额外增加了一个微不足道的小功能,把用户搜索的关键词再次放到这个页面上,让用户可以快速的发起第二次搜索(可以是在你网站内部)。

中文支持

搜索时浏览器已将URI 进行编码处理,根据页面所采用的字符集不同,编码结果也不同。对于同一个关键词“db2 学习笔记”,Google(UTF-8) 和Baidu(GB2312) 的页面分别会产生不同的编码:

http://www.google.com/search?hl=en&q=db2+%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0
http://www.baidu.com/s?wd=db2+%D1%A7%CF%B0%B1%CA%BC%C7&cl=3

Javascript 中相应提供了用于解码的函数:

decodeURI(encodedURIString)
decodeURIComponent(encodedURIString)

上述decode 函数只能处理UTF-8 编码的URI,如果把GB2312 编码的URI作为参数,会抛出一个错误:

The URI to be decoded is not a valid encoding

我们必须自己实现一个处理GB2312 编码URI 的函数。

Keyword.decodeGBURI = function(strcode) {
    try {
        var result = '';
        for ( var i = 0; i < strcode.length; i ++) {
            var thischr = strcode.substr(i,1);
            if (thischr == '%') { // 则后面为16进制编码
                var ascii = eval('0x' + strcode.substr(i+1,2)); // 取出2位16进制值,转成10进制ascii码
                if ((ascii > 0x20 && ascii < 0x30) ||
                    (ascii > 0x39 && ascii < 0x41) || 
                    (ascii > 0x5a && ascii < 0x61) ||
                    (ascii > 0x7a && ascii < 0x91)) { // !"#$%&'()*+,-./ :;<=>?@ [\]^_;` {|}~
                    try {
                        result = result + String.fromCharCodeAt(ascii); // 还原为单字节字符    
                    } catch (e)    { // ie6不支持,放弃,继续处理
                        i = i + 2;
                        continue;
                    }
                    
                    i = i + 2;
                } else { // 双字节字符
                    ascii = eval('0x' + strcode.substr(i+1,2) + strcode.substr(i+4,2)); // 取出4位16进制值,转成10进制ascii码
                    try    {
                        result = result + chrval(ascii); // 还原为双字节字符,调用vb函数处理gb2312编码
                    } catch (e) { // 不支持vb脚本,放弃这个双字节字符,继续处理下面
                        i = i + 5; 
                        continue;
                    }
                    i = i + 5;
                }
            } else if (thischr == '+')
                    result = result + ' '; // 加号还原为空白
            else // 字母,不需要解码
                    result = result + thischr;
        }
    } catch(e) { return false; };
        
    return result;
};

这个函数由Javascript 编写,但为了完成转换,额外调用了一个自定义的VBscript 函数chrval(vstrin) :

function chrval(vstrin)
   chrval = chr(vstrin)
end function

函数chr() 根据ASCII 码取得对应字符,这里用作将GB2312编码的汉字ascii码还原为汉字。Javascript 语言使用Unicode 编码,未提供此函数。因此,我们须提前声明这个函数,这里将这个函数保存在一个单独的.vbs 文件中,并通过如下语句进行引用,供Javascript 调用。

<script type="text/vbscript" src="/js/chr.vbs"></script>

关键词链接索引

如果希望打开此功能,需要设定:

Keyword.index: true,

对应实现此功能,增加了函数:

Keyword.indexHTML = function(html, query) {
    var re = new Array();
    var q = '您的查询关键词标明如下,点击可以跳到文中首次出现的位置:';
    for (var i = 0; i < query.length; i ++) {
        if (query[i]) {
            var classname = Keyword.style_name;
            if (Keyword.style_name_suffix)
                classname += (re.length==0?'':re.length);
            re.push([new RegExp('('+query[i]+')', "gi"), classname]);
            q += '<span class="' + classname + '">' + (query[i]).link('#kIdx' + i) + ' </span>';
        }
    }
    var last = 0;
    var tag = '<';
    var skip = false;
    var skipre = new RegExp('^(script|style|textarea)', 'gi');
    var part = null;
    var result = '';
    while (last >= 0) {
        var pos = html.indexOf(tag, last);
        if (pos < 0) {
            part = html.substring(last);
            last = -1;
        } else {
            part = html.substring(last, pos);
            last = pos+1;
        }
        if (tag == '<') {
            if (!skip) {
                for (var j = 0; j < re.length; j ++) {
                    part = part.replace(re[j][0], ''.anchor('kIdx' + j) + '$1');
                }
            } else
                skip = false;
        } else if (part.match(skipre)) {
            skip = true;
        }        result += part + (pos < 0 ? '' : tag);
        tag = tag == '<' ? '>' : '<';
    }
    result = q + '<p>' + result;
    return result;
};

支持更多搜索引擎

不同的搜索引擎会产生不同结构的URI ,需要对其进行分析,确定解码函数(UTF-8 或者GB2312),并提取出关键词。因此,要实现某个搜索引擎关键词的高亮显示,在以下函数中增加相关搜索引擎定义即可:

Keyword.decodeReferrer(referrer) 

搜索相关文章

原理:在每个网页中通过Meta 标签定义关键词,如果用户通过搜索引擎找到了页面A,那么将页面A 中定义的关键词(如果定义了多个,只取前两个)提交到搜索引擎继续搜索。

要使用此功能,需要:

  • 修改参数refill2:
Keyword.refill2: true,
  • 修改参数element2:
Keyword.element2: 'w',
  • 在页面中加入如下代码(以Baidu 为例),参数element2 的值应与搜索引擎用于提交关键词的文本框名称一致。
<!-- Search Baidu -->
<form name="baidu2" method="get" action="http://www.baidu.com/baidu">
  <input name="tn" type="hidden" value="bds" />
  <input name="cl" type="hidden" value="3" />
  <input name="si" type="hidden" value="aiview.com" />
  <input name="ct" type="hidden" value="2097152" />
  <input id="w" name="w" type="hidden" size="34" maxlength="100" class="frame" />
  <a xhref='javascript:document.baidu2.submit()'>站内相关文章&nbsp;&gt;</a>
</form>
<!-- Search Baidu -->

便捷搜索

要使用此功能,需要:

  • 修改参数refill1:
Keyword.refill1: true,
  • 修改参数element1:
Keyword.element1: 'word',
  • 在页面中加入如下代码(以Baidu 为例),参数element1 的值应与搜索引擎用于提交关键词的文本框名称一致。
<!-- Search Baidu -->
<form name="baidu" method="get" action="http://www.baidu.com/baidu">
  <input name="tn" type="hidden" value="bds" />
  <input name="cl" type="hidden" value="3" />
  <input name="si" type="hidden" value="aiview.com" />
  <input name="ct" type="hidden" value="2097152" />
  <input id="word" name="word" size="34" maxlength="100" class="frame" value="wwf" tabindex="1" />
  <input type="submit" value="站内搜索" class="buttonface" tabindex="2" />
</form>
<!-- Search Baidu -->

代码下载

Scott Yang 的原程序只有一个文件se_hilite.js 1.1 (24 October 2004) - latest ,笔者修改的版本包含2个文件:keywords.js 1.2.0 chr.vbs

由于程序修改后,已经不仅是Highlight 的功能,因此更改了程序中对象的名称为Keyword 。

参考资源

更新 2007-02-07

优化了针对不同浏览器的onload 事件处理 ,使highlight 加载得更快。这里下载更新的keyword.js v1.30.

Posted by Alex at 8:45 PM | Comments (1) | Edit | Taged: Javascript (5), 关键词 (2), 搜索引擎 (1), 高亮 (1)

Apache 2.0.46 整合Tomcat 5.5.9

Apache 使用RHEL AS3 中的默认安装版本,如果没有安装,到Apache 网站下载。 http://www.apache.org/ Tomcat 下载: http://jakarta.apache.org/tomcat/ JRE 或者JDK下载: http://www.sun.com/j2se/ 安装过程参考: linux下Tomcat 5.0.20 与...

Apache 使用RHEL AS3 中的默认安装版本,如果没有安装,到Apache 网站下载。

http://www.apache.org/

Tomcat 下载:

http://jakarta.apache.org/tomcat/

JRE 或者JDK下载:

http://www.sun.com/j2se/

安装过程参考:

两者分别安装成功,并可正常运行,时间原因,未继续完成整合配置,不过上面的资料可供今后参考。

Posted by Alex at 11:23 AM | Comments (0) | Edit | Taged: Apache (3), tomcat (1)

Editlet 功能扩展:增加标题<Hn>和预定格式<PRE>

需求 Editlet 当前版本未提供标题定义功能<H1>...<H6>,虽然可以通过定义<P class="header1"></p> 来达到相同的显示效果,但真正的标题可以反映良好的页面结构,对于自动抓取网页的程序也更友好(Crawl-Friendly),有关标题的使用可以参见使用真正的标题,这是网站亲和力设计的一部分。 预定格式<PRE>标签,用于在网页上保持文本的原有格式,对于在网页上显示程序源代码十分有用。 本文内容基于已经解除限制的Editlet 版本。 代码 将文本Text加入形如<TAG>Text</TAG> 这样的标签,DHTML 提供了标准的命令:FormatBlock,该命令可通过如下方式调用:execCommand('FormatBlock', false, '<H1>')HRESULT execCommand(          BSTR...

需求

Editlet 当前版本未提供标题定义功能<H1>...<H6>,虽然可以通过定义<P class="header1"></p> 来达到相同的显示效果,但真正的标题可以反映良好的页面结构,对于自动抓取网页的程序也更友好(Crawl-Friendly),有关标题的使用可以参见使用真正的标题,这是网站亲和力设计的一部分。

预定格式<PRE>标签,用于在网页上保持文本的原有格式,对于在网页上显示程序源代码十分有用。

本文内容基于已经解除限制的Editlet 版本

代码

将文本Text加入形如<TAG>Text</TAG> 这样的标签,DHTML 提供了标准的命令:FormatBlock,该命令可通过如下方式调用:

execCommand('FormatBlock', false, '<H1>')

HRESULT execCommand(          BSTR cmdID,
    VARIANT_BOOL showUI,
    VARIANT value,
    VARIANT_BOOL *pfRet
);

参数value 可以是一个HTML 标签,取值依赖于cmdID,当cmdID='FormatBlock' 时,已知的有效标签包括:

<H1>...<H6>,<P>,<DIV>,<PRE>,<UL>,<OL>,<DD>

首先将editlet.html 进行解码。为了需要,进行一下简单重构。

原来程序中用两个函数csslist() 与fontlist() 分别生成CSS与字体的下拉菜单,重构为一个通用的函数fmtList(),并更改原来函数的调用。原字体大小的下拉菜单采用硬编码,也改为使用fmtList() 生成。

原函数:

function fontList(l_str_fontnames)
{
 //alert("inside 1"+l_str_fontnames);
 var fontnames=l_str_fontnames;
 var lastfont=fontnames.substring(fontnames.lastIndexOf(",")+1,fontnames.length);
 //alert("inside 1");
 document.write('<OPTION selected value=Font>Font');
 document.write('<OPTION value="Arial">Arial');
 document.write('<OPTION value="Times New Roman">Times New Roman');
 document.write('<OPTION value="Verdana">Verdana');
 if(fontnames.length>0)
 {
 while(fontnames.indexOf(",")>=0)
 {
  var str=fontnames;
  var commaindex=fontnames.indexOf(",");
  var font=fontnames.substring(0,commaindex);
  fontnames=fontnames.substring(commaindex+1);
  document.write('<OPTION value='+font+'>'+font+'</OPTION>');
 }
 document.write('<OPTION value='+lastfont+'>'+lastfont+'</OPTION>');
 }
 //alert("Fontname="+font_name);
 setFontName(font_name);
}

重构后:

function fmtList(l_str_list, style)
{
 var item;
 var commaindex=l_str_list.indexOf(",");
 var first_item=l_str_list.substring(0,commaindex);
 l_str_list=l_str_list.substring(commaindex+1);
 document.write('<OPTION selected value='+first_item+'>'+first_item+'</OPTION>');
 while(1)
 {
  commaindex=l_str_list.indexOf(",");
  if(commaindex==-1)
  {
   if(l_str_list=="" || l_str_list==null)
    break;
   else
    item=l_str_list;
    l_str_list=null;
  }else
  {
   item=l_str_list.substring(0,commaindex);
   l_str_list=l_str_list.substring(commaindex+1);
  }
  document.write('<OPTION ');
  if(style=1) // show this item with css
   document.write('class='+item+' ');
  document.write('value='+item+'>'+item+'</OPTION>');
 } 

增加一个函数setBlock() ,在下拉菜单的onChange事件中调用。

function setBlock(formatblock)
{
 if(formatblock=="Block")
 {
  return;
 }
 cmdExec('formatblock',formatblock);
}

定义下拉菜单:

<TD>
<SELECT class="formfield" id=Block
onchange="setBlock('&lt;'+this[this.selectedIndex].value+'&gt;'); Block.value='Block';"
name=Block style="LEFT: 0px; TOP: 10px">
<script>fmtList(block_list,0);</script>
</SELECT>
</TD>  

在editor.html 中添加相关变量:

var l_str_block_flag = window.parent.block_flag;
var font_size_list = window.parent.font_size_list;
var block_list = window.parent.block_list;

var l_str_flist="function%20fmtList%28l_str_list%2C%20style%29%0D%0A%7B%0D%0A%09var%20item%3B%0D%0A%09var%20commaindex%3Dl_str_list.indexOf%28%22%2C%22%29%3B%0D%0A%09var%20first_item%3Dl_str_list.substring%280%2Ccommaindex%29%3B%0D%0A%09l_str_list%3Dl_str_list.substring%28commaindex+1%29%3B%0D%0A%09document.write%28%27%3COPTION%20selected%20value%3D%27+first_item+%27%3E%27+first_item+%27%3C/OPTION%3E%27%29%3B%0D%0A%09while%281%29%0D%0A%09%7B%0D%0A%09%09commaindex%3Dl_str_list.indexOf%28%22%2C%22%29%3B%0D%0A%09%09if%28commaindex%3D%3D-1%29%0D%0A%09%09%7B%0D%0A%09%09%09if%28l_str_list%3D%3D%22%22%20%7C%7C%20l_str_list%3D%3Dnull%29%0D%0A%09%09%09%09break%3B%0D%0A%09%09%09else%0D%0A%09%09%09%09item%3Dl_str_list%3B%0D%0A%09%09%09%09l_str_list%3Dnull%3B%0D%0A%09%09%7Delse%0D%0A%09%09%7B%0D%0A%09%09%09item%3Dl_str_list.substring%280%2Ccommaindex%29%3B%0D%0A%09%09%09l_str_list%3Dl_str_list.substring%28commaindex+1%29%3B%0D%0A%09%09%7D%0D%0A%09%09document.write%28%27%3COPTION%20%27%29%3B%0D%0A%09%09if%28style%3D1%29%20//%20show%20this%20item%20with%20css%0D%0A%09%09%09document.write%28%27class%3D%27+item+%27%20%27%29%3B%0D%0A%09%09document.write%28%27value%3D%27+item+%27%3E%27+item+%27%3C/OPTION%3E%27%29%3B%0D%0A%09%7D%09%0D%0A%7D"
//var l_str_script = l_str_script_start+l_str_script_button+l_str_script_table+l_str_script_image+l_str_script_link+l_str_script_clear+l_str_script_symbols+l_str_script_color+l_str_script_init+l_str_font+l_str_script_cleanhtml+l_str_script_open+l_str_fcss+l_str_copy+l_str_script_end;
var l_str_script = l_str_script_start+l_str_script_button+l_str_script_table+l_str_script_image+l_str_script_link+l_str_script_clear+l_str_script_symbols+l_str_script_color+l_str_script_init+l_str_font+l_str_script_cleanhtml+l_str_script_open+l_str_flist+l_str_copy+l_str_script_end;

var l_str_td_block = "%3CTD%3E%3CSELECT%20%20class%3D%22formfield%22%20id%3DBlock%20%0D%0A%09%20%20onchange%3D%22setBlock%28%27&lt;%27+this%5Bthis.selectedIndex%5D.value+%27&gt;%27%29%3B%20Block.value%3D%27Block%27%3B%22%20%0D%0A%09%20%20name%3DBlock%20style%3D%22LEFT%3A%200px%3B%20TOP%3A%2010px%22%3E%20%0D%0A%09%20%20%20%20%3Cscript%3EfmtList%28block_list%2C0%29%3B%3C/script%3E%3C/SELECT%3E%20%3C/TD%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20";

var l_str_td_font_type = "%3CTD%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDIV%20class%3Dbutton%20onclick%3D%22cmdExec%28%27bold%27%29%22%3E%3CIMG%20align%3DabsMiddle%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20title%3D%22Bold%20text%22%20class%3Dicon%20src%3D%22"+icons_path+"/bold.gif%22%3E%20%3C/DIV%3E%3C/TD%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%3CTD%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDIV%20class%3Dbutton%20onclick%3D%22cmdExec%28%27italic%27%29%22%3E%3CIMG%20align%3DabsMiddle%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20title%3D%22Italic%20text%22%20class%3Dicon%20src%3D%22"+icons_path+"/italic.gif%22%3E%20%3C/DIV%3E%3C/TD%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%3CTD%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDIV%20class%3Dbutton%20onclick%3D%22cmdExec%28%27underline%27%29%22%3E%3CIMG%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20align%3DabsMiddle%20title%3D%22Underlined%20text%22%20class%3Dicon%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20src%3D%22"+icons_path+"/under.gif%22%3E%20%3C/DIV%3E%3C/TD%3E";
var l_str_td_font_style = "%3CTD%3E%3CSELECT%20class%3D%22formfield%22%20onchange%3D%22setFont%28this%5Bthis.selectedIndex%5D.value%29%3B%20select1.value%3D%27Font%27%3B%22%20%0D%0A%09%20%20id%3Dselect1%20name%3Dselect1%20style%3D%22LEFT%3A%200px%3B%20TOP%3A%2010px%22%3E%20%0D%0A%09%20%20%20%20%3Cscript%3EfmtList%28font_list%2C0%29%3B%3C/script%3E%0D%0A%09%20%20%20%20%3C/SELECT%3E%20%3C/TD%3E%0D%0A%09%3CTD%3E%3CSELECT%20%20class%3D%22formfield%22%20id%3DFontSize%20%0D%0A%09%20%20onchange%3D%22setSize%28this%5Bthis.selectedIndex%5D.value%29%3B%20FontSize.value%3D%27Size%27%3B%22%20%0D%0A%09%20%20name%3DFontSize%20style%3D%22LEFT%3A%200px%3B%20TOP%3A%2010px%22%3E%20%0D%0A%09%20%20%20%20%3Cscript%3EfmtList%28font_size_list%2C0%29%3BsetFontSize%28font_size%29%3B%3C/script%3E%3C/SELECT%3E%20%3C/TD%3E";
var l_str_css="%3CTD%3E%3CSELECT%20class%3D%22cmbtext%22%20style%3D%22width%3A%20150px%3Bheight%3A%2019px%3B%22%20onchange%3DsetStyle%28editArea%2CHTMLMode%2C%22%22%2Cthis%5Bthis.selectedIndex%5D.text%29%3B%20css1.value%3D%27CSS%27%3B%0D%0A%09%20%20%20%09%20%20id%3Dcss1%20name%3Dcss1%20style1%3D%22LEFT%3A%200px%3B%20TOP%3A%2010px%22%3E%20%0D%0A%09%20%20%20%09%20%20%20%20%3Cscript%3EfmtList%28css_list%2C1%29%3B%3C/script%3E%0D%0A%09%20%20%20%09%20%20%20%20%3C/SELECT%3E%20%3C/TD%3E%0D%0A%09%20%20%20";

if(l_str_block_flag==1)
{
  l_str_piece_tr2_all += l_str_td_block + l_str_td_sep ;
  l_int_tr2_count++;
 } 

在editor.js 中修改并添加新的变量:

var block_flag   = 1 ;
var css_list   = "Choose Style,big-font,middle-font,small-font";
var font_list   = "Font,Arial,Times New Roman,Verdana,ËÎÌå,ºÚÌå";
var font_size_list  = "Size,1,2,3,4,5,6,7"
var block_list   = "Block,H1,H2,H3,H4,H5,PRE"

修改完成,今后只需对以上的变量进行维护即可。

参考资源

Posted by Alex at 7:12 AM | Comments (0) | Edit | Taged: Editlet (5), wysiwyg (6)

awstats 日志统计工具安装

安装过程参考了车东的文章 。 在http://awstats.sourceforge.net/ 下载了项目的二进制文件包,是tgz格式,800多k。目前是6.2版本。 $ wget http://optusnet.dl.sourceforge.net/sourceforge/awstats/awstats-6.2.tgz $ gunzip -d awstats-6.2.tgz $ tar -xvf awstats-6.2.tar...

安装过程参考了车东的文章

http://awstats.sourceforge.net/ 下载了项目的二进制文件包,是tgz格式,800多k。目前是6.2版本。

$ wget http://optusnet.dl.sourceforge.net/sourceforge/awstats/awstats-6.2.tgz
$ gunzip -d awstats-6.2.tgz
$ tar -xvf awstats-6.2.tar

解出了目录 awstats-6.2

进来查看了README,觉得自动配置更让人头痛,决定手动安装,直接把 awstats-6.2/wwwroot/cgi-bin 目录copy到apache目录:/var/www/cgi-bin/

 

# mv awstats-6.2/wwwroot/cgi-bin /var/www/cgi-bin/awstats
#cd /var/www/cgi-bin/awstats


打开awstats.model.conf 进行配置

把LogFile换成自己的log地址,比如/var/logs/httpd/access.log

SiteDomain换成自己的域名:aiview.com

hostAliases中加入自己的主机别名,与原有的用空格分开

其他都不作改变,日志格式等均与现有匹配。

打开浏览器,运行http://www.aiview.com/cgi-bin/awstats/awstats.pl

报错了,403,无权限访问。
回来看一下cgi-bin下面的目录

# ls -ld /var/www/cgi-bin/awstats

目录awstats的权限位不对,更改一下

 

# chmod 755 awstats

回来浏览器再运行一次,统计的表格出来了,但数据都是空的,顶部有信息提示,需要更新一下统计信息。到shell,根据文档提示,运行

$ ./awstats.pl  -config=aiview.com -update


提示更新成功。回到浏览器再次查看,2个月的统计信息出来了,已经自动把历史日志文件(*.1, *.2...)进行合并,但关键字分析部分,中文关键字是乱码,需要更改配置文件中的编码。

安装完毕!

Posted by Alex at 2:23 PM | Comments (0) | Edit | Taged: awstats (5), log (2), 日志统计 (2)

Alex's picture

my email address in picture

搜索|Search

订阅更新|Subscribe to Feed

按月归档|By Month

2009
07
2008
11
10
07
05
04
03
02
01
2007
12
10
07
06
05
04
03
02
01
2006
12
11
10
09
08
07
06
05
04
03
02
01
2005
11
10
09
08
07
04
03
2004
12
11
10
09
08
07
06
05
04
03
02
01
2003
12
10
09
08
06
2002
09
08
04
03
02
2001
12
09
07
06
05

我读|My Books

我的链接|My Links

我的朋友|My Friends

Movable Type 4 Logo
Creative Commons License
This blog is licensed under a Creative Commons License.