Sutra's profile江山易得,知己难求PhotosBlogListsMore Tools Help

Blog


    八月十五敬月光菩萨

    八月十五中秋节,晚上妈妈都会把准备好的月饼和水酵饼一起放在一个小的四方桌子上,放在门口……敬月光菩萨。
    前一天,八月十四,妈妈就会用去年留下的发酵饼在水里泡开,和上面粉(其材料除了发酵饼、面粉、油、糖或糖精外,一般别无他物)做成水酵饼,其关键就是发酵时饼中涨出气泡。其味丝甜,入口爽滑,非常好吃。当然做完后也会留下一小掇做成小面团,白天放在阳光下晒,做成发酵饼(简称酵饼)留作明年再发酵面粉。
    月饼也常是前一天准备好的,小的时候,有卖月饼的小贩送上门,品种也只有2、3种,豆沙,五仁等,包装一般都是一层纸(哪像现在城里那超级豪华、浮华的包装),纸常被月饼的油浸透,纸变得透明,纸的中央印有一个小圆圈,标识月饼的品种和生产厂家,这个圆圈的印色有红色,绿色等纯色,这些月饼大多是手工作坊生产出来的,他们平时会生产脆饼、桃酥等,到了中秋前就开始生产月饼,我有去过那些家里开手工作坊的人家,妈妈曾去定制脆饼时带我一起去玩的。现在买月饼一般都会去村里人家开的小店铺里,有点类似大家在城里见到的好德之类的便利店。
    那时候月饼虽品种很少,但是很好吃。不过和月饼相比,水酵饼的味道要更好一些。
    今天晚上下班时间刚到,Dell的送货人员打电话给我说送货过来,我正愁怎么提前一天,我的工作计划还有一半没有完成,也罢,今天是中秋节就休息一下吧,回来后,Dell送货的还没来,我给妈妈打了个电话,想他们了,问妈妈吃月饼了吗,妈妈说正在敬月光菩萨呢。

    把 Trac Spam Filtering 添加到 ports 里了

    告诉各位 FreeBSD 上的 Trac 用户一个好消息,昨天我提交了 port: trac-spam-filter现在 ports 里已经有了 (和上次的 subcommander 相比,这次的效率好高,5分钟之内就被处理好了),让我们一起来抵制那讨厌的 spams 吧。这里我稍微讲一下它的安装方法和配置使用方法。
    首先安装:
    $ cd /usr/ports/www/trac-spam-filter/ && make install clean
    或者通过添加 package 的方式安装也可以:
    $ pkg_add -r trac-TracSpamFilter

    安装完成后,在你的 trac.ini 里面添加下面的配置(可参考:http://trac.edgewall.org/wiki/SpamFilter ):
    [components]
    tracspamfilter.* = enabled

    这样 trac spam filter 就被启用了,然后你可以选择使用下列过滤策略来进行垃圾信息的过滤,在这个版本(目前 trac spam filter 是 0.2.1 版本)中允许设置“karma”来组织多个不同的策略(这个配置可以在 WebAdmin (port: trac-webadmin ) 的 Spam Filter -> Configuration 中进行):
    1. 正则表达式过滤
    2. IP 黑名单
    3. 针对 IP 节流(IP Throttling,这个词有点难翻译,大概的意思是针对 IP 设置最大允许的 POST)
    4. 使用 Akismet 过滤(这个方式采用 Akismet 提供的一个 web 服务来检查内容是否存在可能的垃圾信息)
    5. Bayes(目前版本尚未支持,还在规划中)
    下面我只着重介绍正则表达式过滤,因为这个比较常用(其它的过滤策略请自行研究):
    新建一个 wiki 页面,名字为 BadContent,在里面增加一个代码块(就是用{{{}}}这个符号括起来的,可以参考 trac 网站上的例子: http://trac.edgewall.org/wiki/BadContent ),在代码块中增加 Python 语法的正则表达式 ,一行一个,如果匿名用户发送的内容中匹配了任意一行,就会被当做垃圾信息被拒绝。被拒绝的信息还可以通过 WebAdmin (port: trac-webadmin )中的 Spam Filter -> Monitoring 进行管理。

    注意:
    1. 配置改好后,如果你是使用的 apache,要重启一下 apache。
    2. BadContent 这个页面最好设置成只读,别让别人乱改。
    3. 另外 spam filter 只会读取第一个代码块,其它的代码块是视而不见的。

    另外,如果你遇到类似如下错误,可以参考: http://trac.edgewall.org/wiki/TracPlugins#SettingupthePluginCache
    Traceback (most recent call last):
    File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
    File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 206, in dispatch
    req.hdf = HDFWrapper(loadpaths=chrome.get_all_templates_dirs())
    File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 263, in get_all_templates_dirs
    dirs += provider.get_templates_dirs()
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/tracspamfilter/admin.py", line 115, in get_templates_dirs
    return [resource_filename(__name__, 'templates')]
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 841, in resource_filename
    self, resource_name
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 1311, in get_resource_filename
    return self._extract_resource(manager, zip_path)
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 1318, in _extract_resource
    manager, os.path.join(zip_path, name)
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 1332, in _extract_resource
    self.egg_name, self._parts(zip_path)
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 921, in get_cache_path
    self.extraction_error()
    File "build/bdist.freebsd-6.2-STABLE-i386/egg/pkg_resources.py", line 887, in extraction_error
    raise err
    ExtractionError: Can't extract file(s) to egg cache

    The following error occurred while trying to extract file(s) to the Python egg
    cache:

    [Errno 13] Permission denied: '/root/.python-eggs'

    The Python egg cache directory is currently set to:

    /root/.python-eggs

    Perhaps your account does not have write access to this directory? You can
    change the cache directory by setting the PYTHON_EGG_CACHE environment
    variable to point to an accessible directory.

    Failed to enable the 'httpready' Accept Filter

    在 FreeBSD 6.2-RELEASE 上从 ports 安装 apache22(/usr/ports/www/apache22),在 /etc/rc.conf 加入 apache22_enable="YES" 后,启动 apache,报下面的警告:
    # apachectl start
    httpd not running, trying to start
    [Wed Sep 12 21:27:30 2007] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter

    要解决这个问题,只需
    # kldload accf_http

    并在 /boot/loader.conf 加入下面两行,以便下次启动自动装载模块:
    accf_data_load="YES"
    accf_http_load="YES"

    这两条设置其实是覆盖了在 /boot/defaults/loader.conf 中的这两个同名选项:
    # cat /boot/defaults/loader.conf | grep accf
    accf_data_load="NO" # Wait for data accept filter
    accf_http_load="NO" # Wait for full HTTP request accept filter

    ---------------- 清晰明朗的分割线 ----------------
    其实这个问题我早解决了,今天写出来省得下次遇到再找。

    新 ports: devel/subcommander 终于提交了

    7月份的时候,我试图要合并一个网友提交的fcitx(http://fcitx.net/http://www.fcitx.org/ )的patch,用patch 命令合并总搞不定,所以我想寻找一个能在FreeBSD 下用的像TortoiseSVN一样的工具,怎么找都没有找到,最后看到subcommander里面的一个submerge ,虽然对我来说没有什么用处,而且我也不喜欢它,好难用的,但是我想既然有人开发出来就会有人需要用的吧,那我看FreeBSD 的ports 里也没有这个软件,不如做个ports提交 好了。
    porter手册 看了好久,终于做了出来,没想第一次提交后,被分析出来缺少一些依赖的设置,于是又打patch(第一次做ports呀,不懂的太多),今天终于看到好了,committed 了。
    Subcommander 是一个基于 Qt 的多平台(Win32, Unix, MacOSX)的 subversion 客户端、对比和合并工具。