Author: qingbo

  • WordPress Plugin: Trackback Validator Plugin

    Blog在DoNews的时候,收到一些comment spam。如今换到自己的空间,comment spam不见了,全是trackback spam,实在想不出什么好的方法。

    今天在Blogging Pro上看到了Trackback Validator Plugin的介绍,感觉原理很简单,可能也比较有效吧。这是Rice的一些人研究的,目前只是看Trackback的发送者有没有在它页面上链接你的日志,插件有一个选项把trackback spam发送给他们以供研究,可能以后会根据语义判断,或者会像Akismet一样?

    插件主页在这里:Trackback Validator Plugin

    去年就开始发布了,但似乎用的人不多,搜索出来的结果也不多。希望它能起到好的效果。

  • Firefox 1.5.0.4 Released

    楼里的网络从昨晚断到现在才好,习惯了在网上生存的人。看到RSS了,看到邮件了,真是有一种久旱逢甘霖的感觉,不顾要交论文的压力,上Blog来透透气。

    打开Firefox不一会就说下载了1.5.0.4更新,询问是否重启。上mozilla.com一看,才知道已经是“昨日黄花”了。

    以下摘自http://www.mozilla.com/firefox/releases/1.5.0.4.html

    Firefox 1.5.0.4 is a security update that is part of our ongoing program to provide a safe Internet experience for our customers. We recommend that all users upgrade to this latest version.

    Release Date: June 1, 2006

  • PHP mail(), Yahoo search

    今天一回来就看我的Blog,发现mail函数还是不能发出邮件。想到空间商前几日因为有人狂发邮件而被封掉服务器,可能是阻止掉邮件了吧。再一次问空间商客服,告诉我果真如此。

    然后到wordpress.org去搜索mail,竟然发现没有结果返回,搜索什么都是这样。想起以前试过的wp-phpMailer,装上竟然能用,21Windows还不错,没有禁掉太多的函数,就是希望他们的服务器挂的时候少一些。不过,它的邮件头还是有问题,中文乱码,听说数据库备份也不能正常发送,比较遗憾。

    刚才打开GreatNews,发现Matt在Blog上发了一篇日志,Yahoo Search Broken (again?)

  • 紧急时刻,却要去旅游

    昨天导师打电话给我,说实验室要去旅游,问我去不去。我说现在时间紧……“工作要照常做,也要散散心啊。”于是没多想就答应了。

    挂了电话就有点后悔了,答应得太仓促。现在感觉做得越来越没劲了,也许是快毕业的缘故。这个项目最有成就感的时候还是做出那个可以翻译简单语言的compiler。现在快到尽头了,而进度也越来越慢,最后还剩下个JFlex&CUP生成分析器的工作,争取明天完成吧。我没做完又不想开写,到现在连论文的格式都没看。而周一交过周报之后导师就发邮件告诉我月底要交稿了,现在又让我去玩,呵呵,我论文没动笔她是知道的。

    收到了出行计划,去皖南的牯牛降,估计还可以吧。只是名单上的人都是只见过几面,不如和自己朋友去的好,争取混熟一点吧,有个好心情,不然两天时间真的就浪费了。

    27、28两天,回来开始写论文吧。没想到快毕业的时候会这么烦。

  • Paged Threaded Comments 插件

    English page: /blog/post25.html

    这个插件是Brian’s Threaded Comments和Keyvan的WordPress Paged Comments Plugin的结合。Trustin Lee曾经做了一个插件Threaded and Paged Comments Plugin for WordPress 1.5,但结构比较复杂,我把其中的关键SQL语句和函数取出,使得两个插件可以顺利地结合起来。现在两个插件被放在同一个目录下(除了comments-paged.php),结构较为整洁了。

    下载(zip包,2006-06-08)

    更新:

    2006-10-07:

    • 修正了thread-event.js中一个Bug。现在点击“Reply to this comment”之后’+’和’-‘图标如预想的那样显示,以前总是错误。
    • 修正了array_merge在PHP5中的问题。谢谢Andy

    2006-06-08:

    • 修正了在更新Threaded Comments选项时的Bug。

    2006-06-03:

    • 向delete_comment添加一个hook,在删除某留言时,它的回复都得到它的reply ID。之前留言被删除后回复不再显示。
    • 添加了代码在留言区域上方显示thread个数。效果见下面。

    2006-05-24:

    • 将图标文件转换为gif格式,弥补IE6不支持透明PNG的问题。

    安装步骤:

    1. 解压zip包,得到一个PagedThreadedComments目录和一个comments-paged.php文件。
    2. 将PagedThreadedComments目录上传至WordPress插件目录下(wp-content/plugins/)。
    3. 将comments-paged.php文件上传至你使用的主题目录下(wp-content/themes/yourtheme/)。
    4. 在该主题目录中,编辑每个加了留言功能的页面模板(如single.php),把comments_template()调用替换为
      if (function_exists('paged_comments_template')) paged_comments_template();
      else comments_template();
    5. 在WordPress面板中激活Paged Threaded Comments插件。
    6. 现在应该已经可以使用,如果与主题不搭配,请修改插件目录中的thread-style.css

    默认最后一页显示最近的10个thread,最新的排在最上面。在paged-comments-config.php中可以修改这个行为,以及其它一些选项。Thread的嵌套深度请在WP面板选项中修改。

    仅在WordPress 2.02中测试过。如果有什么问题,请留言或发邮件给我。

    许多朋友问怎么用Gravatar。Brian的插件中使用$c作为循环变量,所以与许多插件不兼容。有时间或许我会修改它使之与其它插件相兼容,不过这里有个方案可以凑合:

    • 这个文件解压到你的插件目录,并激活它。这是一个修改过的gravatar.php。
    • 在comments-paged.php的合适位置添加这样的代码: <img src=’<?php gravatar($c->comment_author_email); ?>’ />

    当然需要一些CSS或HTML来美化它:)

  • Paged Threaded Comments plugin

    中文页面: /blog/post26.html

    This plugin is a combination of Brian’s Threaded Comments and Keyvan’s WordPress Paged Comments Plugin. Trustin Lee has written a plugin Threaded and Paged Comments Plugin for WordPress 1.5, but the structure is complicated. I borrowed the SQL statements and functions of it, and made the two plugins work together. Now the structure is tidier, since the plugin files are put into one directory, except the comments-paged.php file.

    Download(zip file, 2006-06-08)

    Update:

    2006-10-07:

    • Fixed a bug in thread-event.js. Now afer clicking "Reply to this comment", the ‘+’ and ‘-’ pictures display as they should be.
    • Fixed the array_merge problem with PHP5. Thanks to Andy.

    2006-06-08:

    • Fixed a bug with the updating of Threaded Comments options.

    2006-06-03:

    • Added a hook to delete_comment so that when the parent comment is deleted, the child gets the reply ID of it. Previously, the replies no longer display when the parent is deleted.
    • Added the code to display the number of threads above comments area. See the effect below.

    2006-05-24:

    • Converted icon files to gif format to solve the problem that IE6 doesn’t support transparent PNG file.

    Installation:

    1. Unzip the archive. There should be a PagedThreadedComments directory and a comments-paged.php file.
    2. Upload PagedThreadedComments directory to WordPress plugin directory (wp-content/plugins/)。
    3. Upload comments-paged.php file to the theme directory you are currently using(wp-content/themes/yourtheme/)。
    4. In this theme directory, edit every template file that is comments-enabled (such as single.php). And the comments_template() function call should be replaced by the following code:
      if (function_exists('paged_comments_template')) paged_comments_template();
       else comments_template();
    5. Activate Paged Threaded Comments plugin in the WordPress admin panel.
    6. Now the plugin should work. If the comments style does not fit your theme, modify the file thread-style.css in the plugin directory.

    By default, the last page shows 10 threads, with the latest on the top. You can change this behaviour and modify other options in paged-comments-config.php. If you want to modify the max nesting level, please go to WP admin panel.

    Only tested in WordPress 2.02-2.04. Any problems, please leave a comment, or directly send a mail to me.

    Many people asked me how to use gravatar. Brian used $c in the comment loop, and that’s why it’s not compatible with gravatar. When time allows, I’ll modify the plugin to let it be compatible with other plugins, but for now here is a "dirty" solution:

    • Extract this file to your plugins directory, and activate the plugin. This is a modified version of gravatar.php.
    • Inside write-comment function of comments-paged.php, add codes like <img src=’<?php gravatar($c->comment_author_email); ?>’ />
      in an appropriate place.

    Of course, you need some CSS or HTML to beautify it:)

  • EditorMonkey修复与完善

    写Blog时有一个好的编辑器会有一份好心情。WP默认编辑器把<pre>中的&nbsp;都吃掉,实在是霸道。Zoundry的编辑器也不成熟,我就暂时放弃了离线编辑。

    近来一直在用EditorMonkey写Blog,感觉比起WP默认的编辑器来要好得多。当然我选择的是FCKEditor,tinyMCE已经删 除了,它占了很大的空间,而且有大量的语言文件,查看源代码时全放在一行中:(。不过EditorMonkey的作者在集成FCKEditor的时候没有能够解决<!–more –>和<!–nextpage–>两个标记的插入问题。在他的论坛里问的时候他说由于FCKEditor太难搞了,以后也不会再 支持它了。

    我在那个thread上订了E-Mail通知,最近发现Cougar解决了这个问题,在他的一篇日志中:EditMonkey 2.5 Patched Version,日志里有patch过的下载链接。

    最初装上的时候觉得还有很多问题,后来证明都是我对XHTML的不了解。唯一发现的错误是如果文章中有图片,就不能显示源代码了,不过这已经被修正。在他的文章里提到<!–more–>和<!–nextpage–>标记的支持至少和原来的WP默认tinyMCE一样好了。如果使用的是Windows下的Firefox,可能换了之后还是不能使用可视化编辑器来插入这两个标记,因为Firefox的缓存机制有些问题吧。直接在浏览器中打开fckeditor\editor\plugins\wordpress\fckplugin.js文件并刷新就可以了。

    当然我是不喜欢用这两个标记,呵呵,只是Bright Young曾经问我怎么点那个按钮什么效果都没有(Firefox中源代码中是插入标签的,而IE中则是完全无效),现在你方便了:)。接下来就说说怎么排版文章好让发表出去的日志符合Web标准吧,针对Cougar修改过的FCKEditor。

    1. 段落:FCKEditor在你回车的时候并不会把刚写的一段用<p></p>标记包起来,这与tinyMCE不同。Cougar的patch把<br/>全去掉了,所以发表的日志就只有一个段落。正确的做法是为每个段落在格式下拉框里选择“普通”,在回车几次后新的段落就自动包含在<p></p>标记中了,自己体会吧。
    2. 代码:粘贴代码时,不要仅仅用<code>标记wrap。<code>实际是<span class="Code">,其中的<br/>会被剔除,因此发表后只有一行了。应该在外面用<pre>标记wrap起来。
    3. 编辑框的样式表:通过修改fckeditor\editor\css\fck_editorarea.css文件可以控制编辑区域元素的样式,例如图片样式等。同样在Windows中的Firefox里,最好手动刷新这个文件。
    4. 插入图片:在XHTML中<img>标记必须有alt属性,所以插入图片时最好加上它(插入图片对话框的“替换文本”),图片不能显示的时候可以显示文字。另外,同样根据XHTML标准,不要使用border/align等属性,而把相关样式放在CSS文件中,在插入图片的对话框中,高级页里的样式类名称中填上它应属的class。我的CSS相关设置(从themes/my theme/style.css中抽取):
      .img-right {
          float: right;
          margin: 5px 0px 5px 5px;
      }
      .img-left {
          float: left;
          margin: 5px 5px 5px 0px;
      }

      这样,插入图片时在样式类名称中填上img-right或img-left就可以使图片靠右或靠左了。而FCK的样式下拉列表中有"image on left"和"image on right",是给<img>加align属性,不建议使用。但这样的话,编辑的时候并不显示图片的停靠,解决办法很简单,照第3点讲的,把这CSS代码复制一份到fck_editorarea.css中去。

    5. 最后:FCKEditor/tinyMCE的对话框都是Javascript弹出窗口。某些Firefox用户(比方我)使用了tab浏览插件的单进程功能,从而对话框在新标签页中打开,把整个窗口缩小,很难受。如果不想这样还是取消单窗口模式,并对javascript弹出窗口设置为允许所有窗口。

    现在我最想要的功能就是像Twilight-Autosave那样的自动保存功能,这个插件在EditorMonkey中不再起作用,我也看不明白,似乎要FCKEditor中的API才能取得textarea内容。

    Happy editing, happy blogging.

  • Windows Media Player 11

    WMP今天9down.com的一篇文章放出了Windows Media Player 11,原文链接:

    http://www.9down.com/story.php?sid=6574

    按照9down.com的说法,这是一个泄露版本。WMP 11已经在Vista中了,不过这是for Windows XP的版本。我已经装在机器上了,试了一下,没什么问题。看起来更cool了,黑色调。播放时间会显示在标题栏上,而屏幕的左下角会显示专辑的图片。在媒体库管理中,也采用显示大的专辑图片,原文中说这方便了媒体的管理,是个极大的进步。我倒一直觉得WMP不适合于媒体管理,呵呵。

    如果选择显示原来的菜单栏,会发现其色彩已经与传统的Windows菜单栏色彩有所不同。 另外,WMP 11采用了与Vista的Explorer路径栏相似的工作方式,在创建、编辑Playlist的时候可以感受到。

    下面是两张截图,查看的同时也体验一下LightBox插件的特效。这是一组图,点击任一个,显示后,把鼠标放到两边,会出来箭头,点击看其它图片。

    播放界面 媒体库界面

    5.15 更新:

    微软官方已经开始提供下载,标明测试版,有多种语言可以选择。之前的泄露版本是5358.4826,现在版本号变为5358.4827。

    下载链接

  • Technorati is back

    Technorati在与Technorati隔绝一阵子之后,今天又看到它了。是Kenwell在他的WP控制板里查看连入的连接时发现的,不过让我过去看时Technorati报告服务量过大,没有给搜出来。这算是提供关键字服务比较早的一个站吧,可惜前段时间被封了,现在看起来挺亲切的。

    改了一下UTW的输出,给每个Tag加上了Technorati和Del.icio.us的链接。如果哪天Technorati又被Ban,也可以方便地把链接去掉,UTW的机制在这点上真够方便的。

    对了,刚才添加Technorati和Del.icio.us的图标链接的时候,怎么也加不上去,还翻开代码看了看。后来发现WP管理后台里把图标都禁用了,呵呵。

  • 终于通过了XHTML 1.0 strict validation

    模板的下面有Valid XTHML & CSS 的链接,我点了一下,XTHML的验证错误一堆。plaintxtBlog模板本身应该是没问题的,就是我给加了好多东西,弄坏了,还有发表的文章中的图片属性也不合法。

    于是就想着把Blog弄规范些,毕竟这是好的。可是对CSS基本不懂,真是费了劲。一边validate,一边到处查资料,同时参考一些规范的网站,最终通过了测试,得到了下面的小奖状

    Valid XHTML 1.0 Strict     Valid CSS!

    至于网页规范的好处,就很多了,不光对访问者好,同样地对建站者也是有很大好处的。

    网页设计师这个网站一直致力于Web标准的推广,可以常去看看。