SMPlayer can disable screensaver

刚在 Fedora 14 下用 SMPlayer 看了第一场电影,发现 SMPlayer (当前版本 0.6.9)之前版本恼人的无法阻止进入屏保的 bug 不见了。很开心,电影也好看。

Linux software 一直在进步。

Too early to try Magento 1.5.0.0 alpha2

Magento 1.5.0.0 alpha2 出来了,我下载来尝鲜。可是,安装到第二步就进行不下去了。提示是:

There was a problem proceeding with Magento installation.

Please contact developers with error messages on this page.

Notice: Undefined variable: params in /path/to/magento/app/code/core/Mage/Core/Block/Html/Select.php on line 142

这挺令人失望的。

I am leaving Zend Server

Creating domain error after installing Zend Server
Creating domain error after installing Zend Server

I used to deem Zend Server is overall a good solution for php website development and deployment. However, over a year’s time I realise it brings so many troubles. It is not compatible with Plesk as shown in the screenshot. I can not solve this problem.

It stops yum on Fedora. I can solve this problem but, troublesome.

Do I enjoy any unique feature of Zend Server? None as I can remember. Occasionally I use “debug on server”, but it is a feature of Zend Debug, not of Zend Server.

Also, Zend Server pulls me back to Apache, to which I prefer Nginx.

Actually, I have no reasons to love Zend Server. So I decide to leave it.

Solve Google Desktop 64bit indexing few files

Google Desktop Index Status
Google Desktop Index Status

我的电脑上只有 19 个文件?这怎么可能!

Google Desktop 64bit 在 Fedora 11 上不能正常建立索引,在 Fedora 14 上仍然不能,我很是失望。我用 Fedora 11 时尝试找别人是怎么解决这个问题的,没找到,最后不了了之。现在用 Fedora 14,重新找了一遍,找到一个:

ln -s /opt/google/desktop/lib /usr/lib64/tls/x86_64

原因嘛,据说是 /opt/google/desktop/lib/libgdl.so 没有放在正确的位置。更具体的原因嘛,我也说不上来了。

Fedora 11 freeze at login screen

圣诞啦,收拾房子,发现两张纸的零碎笔记,是关于如何解决 Fedora 11 安装到尾声,因某些显卡驱动程序有 bug, 花屏死在图形界面。

当时没有整理到芳草苑发表,时间一长就忘了。Fedora 发展到了 14,可能这个 bug 已经不复存在。我也忘了具体显卡型号,反正是一台很老旧的机器,intel 的集成显卡,当时想装 Fedora 11 让它重焕青春,我花了很长时间解决这个问题,现在简单说说吧。

1. 要在机器花屏停止响应之前,按 Ctrl + Alt + F2,进入 terminal,输入用户名、密码,然后输入

init 3

2. 然后输入

yum install system-config-display

有时会有 “Could not retrieve mirrorlist” 的错误,多试几次就可以

3. 然后输入

system-config-display --noui

这条命令生成文件 /etc/X11/xorg.conf

4. 在 /etc/X11/xorg.conf 里添加一行
Option “NoAccel” “true”
具体位置我忘了。

5. 然后输入

init 5

即可进入图形界面。不过 NoAccel 关闭了硬件加速,如能安装正确的驱动当然更好,据说以下命令可以,不过我没试过。

rpm -Uvh --oldpackage http://mirrors.kernel.org/fedora/updates/9/i386.newkey/xorg-x11-drv-i810-2.3.2-3.fc9.i386.rpm

芳草苑升级了

芳草苑很久没升级了,今天重新跟上 WordPress 主节奏,更新到 version 3.0.3。

这次更新的主要原因是默认主题 twentyten 很有 html5 的味道;拖了这么久才更新是当初想把当时的 default theme 改为流式布局的任务一直没完成。如今改进 default theme 已无大意义,就彻底放弃此念头。

其实升级也很快,静下心来整一整也就三个小时,含本地测试一次。

老版本最后一个 Google 页面预览照

Magento page speed benchmark

There are some website benchmark tools, looking after various aspects of performance.

The tool I use most is Apache Benchmark, and parameters are 10 concurrencies, e.g.

ab -c 10 -n 200 (page_url)

It reflects the status quo. I have a decent server but the sites are not busy.

Since I dived into Magento, I have been spent quite a lot researching how to improve its speed. I implemented database query cache, enabled block html cache, utilised memcache, tmpfs, apc, etc, etc. Recently I started a project called Full Page Cache Preparer (FPCP) and expected it fundamentally improve Magento speed on Catalog and Cms pages.

FPCP is only 20% completion (it is not producing all blocks with session variables, but shopping cart sidebar), but I am eager to see some result. So I turn it on and compare the Requests Per Second to the time when it is off. I see a marginal 1-2% improvement which is very disappointing.

Why I had the impression that full page cache feature will dramatically drive Magento faster? What if full page cache is working with web server cache, say nginx ncache? I simulate a test by saving a page html source code to a static file and uploading it to web server. (I should have done this test before I started FPCP project.) The result is disappointing, again.

The test is done on a heavy page (with loads of images).

  ADSL connection (8,187/1,291 kbps) to datacentre 100 mbps ADSL connection (4,212/1,078 kbps) to datacentre 100 mbps directly run ab test on webserver
Request via Magento /index.php 9.18 4.56 16.23
Request a static .html file on filesystem (bypass php parser) 8.23 4.65 3368.82
Request a .php file on filesystem (same content as .html, no php tag inside) 8.72 4.62 1584.05

The figures in first two columns (ADSL connection) go up and down when I run tests again and again. Sometimes requesting a static file is even slower than requesting Magento index.php. My conclusion is, even when Magento full page cache is working in conjunction with nginx ncache, I cannot feel the sites are faster (when the server load is not high).

However, I will finish my FPCP module (some day) because I believe it benefits people whose server load is high. To improve my own sites, I will focus on basic (if I call FPCP hi-tech) page speed recommendations, e.g., optimise images, concurrent downloads, cookieless domains for static files, merge js/css files, gzip, etc.

Save comma separated csv files in OpenOffice

I want to establish a protocol for my dataflow in Magento, part of which is “all csv files contains import data should be comma separated”.

OpenOffice is an efficient tool to edit csv files, but how to save them using comma separator? I found OpenOffice behaviour quite unpredictable, sometimes comma separated, sometimes semi-colon separated. Maybe it depends on csv original format upon opening or creating.

How to always save a comma separated csv in OpenOffice?

I did not find a way to make it happen by default, but it can be achieved by 2 steps:

1. Use “Save As…”, and check option “Edit filter settings”

Check Edit filter settings
Check Edit filter settings

2. Set comma as Field delimiter

Filter settings dialogue
Filter settings dialogue

Magento helper class is a singleton desin pattern

Magento did not mention this (or hide somewhere I could not find), so I’d like to mention it:

Magento helper class is a singleton desin pattern. Whether a helper class is called in a format as

Mage::helper('mymodule')->helperMethod();

or as (in a block class or a template),

$this->helper('mymodule')->helperMethod();

the helper class is only initialised once.

Which means Magento puts a singleton desin pattern on helpers.

Solving “Fatal Python error” after installing Zend Server

我想这是个普遍问题:在 Fedora 14 里安装了 Zend Server 以后,yum 不工作了。比如 yum update 错误提示:

Fatal Python error: pycurl: libcurl link-time version is older than compile-time version

幸好有 google 和 Fodera forum,找到一堆建议,先试了一个不管用的(python-pycurl, libcurl 两个 packages 我还是专门找了最新的版本,依然不管用)

rpm -Uvh --force http://mirror.bytemark.co.uk/fedora/linux/releases/14/Everything/x86_64/os/Packages/python-pycurl-7.19.0-7.fc14.x86_64.rpm http://mirror.bytemark.co.uk/fedora/linux/updates/14/x86_64/libcurl-7.21.0-6.fc14.x86_64.rpm

又试了一下这个管用:
1. 先把 Zend 库改个名

mv /usr/local/zend/lib /usr/local/zend/zendlib

2. 用 OS 原有的库替换 Zend 库

ln -s /usr/lib64 /usr/local/zend/lib

这时 yum 正常了,但 apache 起不来了。

3. 软链接 Zend apache2 在原位置

ln -s /usr/local/zend/zendlib/apache2 /usr/local/zend/lib/apache2

apache 正常了,但是 Zend Server web interface 里大量的错误,因为只连了 apache2,还有一大堆跟 Zend Server 相关的文件没连。是继续一个个连呢,还是?

以下是我自己的做法:
推倒前述 1,2, 3 步重来。
1. 把该死的随 Zend Server 来的 libcurl.so.4 删掉或改名

mv /usr/local/zend/lib/libcurl.so.4 /usr/local/zend/lib/libcurl.so.4.bak

这下 yum, httpd, zend server web interface 都正常。既然是 /usr/local/zend/lib/libcurl.so.4 导致 yum 有问题,删了不就行了,就这么简单。