Month: February 2014

  • PEAR Mail.php

    我想在服务器上用 Gmail SMTP 代替 sendmail 发送邮件,并不想用 Zend_Mail,只想找一个轻量级的解决方案。

    一找就找到 Pear Mail。提示说只要用

    
    pear install Mail
    
    

    然后在程序里

    
    include_once "Mail.php";
    

    我照着做了,可是提示:

    Warning: include_once(Net/SMTP.php): failed to open stream: No such file or directory in mail/Mail/smtp.php on line 348
    PHP Warning: include_once(): Failed opening ‘Net/SMTP.php’ for inclusion (include_path=’.:/usr/lib/php’) in mail/Mail/smtp.php on line 348
    PHP Fatal error: Class ‘Net_SMTP’ not found inmail/Mail/smtp.php on line 349

    原来还需要安装一个依赖包

    
    pear install Net_SMTP
    
    
  • Tips for printing on Avery Quick&Clean™ Business Cards

    Avery C32026 cover
    Avery C32026 cover

    It is my second time using Avery Quick&Clean™ DIY business cards. The first time was very smooth so I did not remember any caveats.

    This time I had printed 5 pages before I got a nice one. So I decide to write some tips for future reference.

    The paper I use is Avery C32026, 270g satin finish, the thickest I can find in store. The printer is Lexmark C544dn, a colour laser printer with auto duplex feature.

    Tip 1. Do not load paper in Tray 1. It is not suitable for thick paper like this. Load it in Manual Feeder.

    Tip2. Do not use auto duplex. If the business card design is double sided, print one side and manually feed paper again for the other side. The auto duplex roller is a small cylinder that may snap the cards away from the frame.

    Tip 3. Use the template provided by Avery and do not convert to any other format. C32026 template is a Word document. After editing, I converted it to a PDF file (I was thinking of portability). The position was changed slightly and some text was printed across the border.

  • Job for mariadb.service failed bug fixed

    Last month I set up a development server using Fedora 20. On that server I wanted to change MySQL socket file from /var/lib/mysql/mysql.sock to /dev/shm/mysql.sock. Basically I wanted to move MySQL socket file to shared memory for performance gain.

    I made the change in /etc/my.cnf, but when I tried to start mysqld, I got the error message:

    Job for mariadb.service failed. See ‘systemctl status mariadb.service’ and ‘journalctl -xn’ for details.

    That was my first time heard about mariadb. I did some background research on mariadb and the relationship between mysqld and mariadb. But that did not help to solve the problem. So I had to revert to the default MySQL socket file /var/lib/mysql/mysql.sock.

    Today I had some free minutes and recalled this unresolved issue. To my surprise, I just changed

    socket=/var/lib/mysql/mysql.sock

    to

    socket=/dev/shm/mysql.sock

    in /etc/my.cnf. And this time mysqld can start without any errors.

    What changes have I made to the system? Nothing but a yum update.

    So I assume there was a bug in mariadb (or mysqld) which is fixed by the recent release.

    Mariadb updated
    Mariadb updated
  • Never use Kwik Fit

    很多年前,我去 Kwik Fit 修车前问过一个朋友:“Kwik Fit 可靠吗?” 他说,“糟透了,千万不要用。”他没讲实例,我也没有亲身体会,所以我并没有形成对 Kwik Fit 的坏感。

    那时,车的排气管坏了,我公司边上有家 Kwik Fit,我早上把车送给他们修,下班去取,觉得很方便。当然 Kwik Fit 的价格不便宜,但体谅它这么大一个公司肯定有很大的管理费用,所以我也觉得合理,毕竟它有地缘优势。

    那次修车还算顺利,所以接着的年检和保养我又想到 Kwik Fit。恰好 Kwik Fit 又在搞年检和保养优惠促销,我就决定去 Kwik Fit 做年检。年检没有通过,Kwik Fit 要我更换一堆零件,包括全部轮胎和电池。我从未被要求一次更换那么多零件(之后也没有过),有点犹豫不决。考虑到去其他地方重检,可能还是得更换,Kwik Fit 又说只要我在它那里换了零件,年检就过了。还是为了方便,我就咬牙让 Kwik Fit 换上了全部轮胎、电池和其他配件。

    之后我想,可能我的车到了那个时间就得大量换零件了,所以并未觉得 Kwik Fit 有什么出格之处,只是之后再也不用它了。

    后来有一次,车胎破了,拉到一个修理厂,技师怎么也卸不下那个轮胎,最后动用锯子锯断螺钉。技师说,是螺帽拧得过头了。哎,最后一次是 Kwik Fit 拧的。但我还没形成对 Kwik Fit 整体的坏感,只想 Kwik Fit 运气不好,雇了一个不称职的员工。

    最近我觉得电池蓄不住电。今天,我在车内听收音机,所有的灯都是关闭的,只有五分钟,竟然连收音机都放不了了。这才几年啊,又要换电池?!当年我不熟悉行情,现在发现 Kwik Fit 的杂牌电池比 Euro Car Parts 的名牌 Bosch 电池要贵一倍多。贵就贵吧,竟然还是这种质量。

    终于,我跟 Kwik Fit 的缘份全面崩溃,愤愤不平地写下以上文字警示后来人。

  • Play Blu-ray ISO images on Fedora 20

    买了新电视 SAMSUNG UE46F6100,总想试一下它的 3D 效果。我没有 Blu-ray player,也没有 Blu-ray disk,于是下载了一个 Blu-ray ISO 镜像格式的文件。怎么放呢?

    我一开始想在 Sony NSZ-GS7 机顶盒上播放,可是没有可用的 App。Windows 下倒有很多解决方案,可惜它不是我的首选。

    我想的是怎么在 Fedora 20 下播放 Blu-ray disk?如果可行,就可以用 Fedora 20 配一台 HTPC 去客厅播放 Blu-ray disk。

    做之前,我以为这有点难,不太会有现成的 yum package。事实上,很简单。

    首先得有 libbluray,用 yum install 一下就可以。但我的机子也装有 libbluray,不知是 Fedora 20 默认安装的库,还是我装别的软件时带进来的。

    然后加载 rpmfusion repo,装一下 vlc 就可以用 VLC 来播放 Blu-ray disk。

    
    yum install vlc
    
    

    HTPC 又多一个新功能。但是 SAMSUNG UE46F6100 电视的 3D 效果实在一般,要令我赏心悦目的 3D 技术还没有到来啊。