TF101 101

上周末决定不再忍耐,又入了一个大件:华硕的平板,变形金刚。TF101上市已经半年了,而且现在TF102号称四核的版本已经开始接受预订了,所以差不多也到了应该出手的时候了。因为我知道如果去等102的话,我还会像现在这样地去和103做比较。

选择这款的主要原因即他的键盘配置,平板加键盘的组合彻底把上网本推进深渊。对于我这种还算是制造内容比率比较高的人来说,有个强有力的输入设备是必要的。目前市面上有这种搭配的只有transformer和think的,而且think似乎又只有配图和说明,没见真正卖那款键盘的。更严重的是,当然,think太贵了。

接下来开始说问题:
第一关叫做充电。TF101在充电方面有严重的缺陷。当电池电量极低时,会出现无法充电的情况。明明接着电源,可是电量提示一直是0%。如此情况下我整整充了一天拔下电源依然无法开机。最后看了网上的说法,在充电自动开机后关机了半个小时终于起死回生。

第二个小问题,键盘底座的平板本身电源是分离的,二者各自充电。所以在前面〝整整充了一天〞之前还有整整充了一晚上键盘。早晨起来键盘电满了,平板没充进去。

系统出厂是Android 3.0,这个系统的伟大之处在于从他一启动开始,就开始不断有程序报出错退出,不断有应用停止响应。他简直都对不起这个版本号。直到后来充上电升级到3.2之后才可以用。但是,还是有浏览器突然僵死然后突然从眼前消失的场面。再有就是机捆绑的什么人人网,电子书,开心网什么的,让你想不root都不行。

再有andrid 3.x上应用可能本来就不多,随机捆的又是一个流氓市场,除了满眼的流氓软件和山寨以外,就是版已经过时的软件。可怜这挺好一机器都不知道该装点什么。要说TF101硬件已经很可以了,只是配上这么个系统,用范伟的话说,白瞎你这个人了。手放键盘上,真恨不得能打开个终端来挡住这个浅薄的外观。等有时间我一定要尝试在这台机器上装个正经系统。也算是对得起这硬件了。

一句话概括一下的话,硬件还好,软件拉倒。

Extend slacker server with interceptors

An interceptor framework was introduced in slacker 0.3.0. It’s designed to allow user to add custom functionality without hacking into the internal of slacker.

Like many server frameworks, slacker abstracts the request processing as a pipeline. The request object is modified by adding or updating attributes through each node of the pipeline. So it’s easy to add your interceptor into the pipeline, with which you can get the data before and after function executed.

To create such an interceptor, you should use the slacker.interceptor/definterceptor macro and slacker.interceptor/definterceptor+ macro:

(definterceptor name
:before interceptor-function
:after interceptor-function)

(definterceptor+ name [arguments]
:before interceptor-function
:after interceptor-function)

definterceptor+ can accept arguments so you can configure the interceptor when you use it.

See a simple example:

(definterceptor log-function-call
  :before (fn [req] (println (str "calling " (:fname req))) req))

(definterceptor+ log-function-call-prefixed [prefix]
  :before (fn [req] (println (str
                               (if (fn? prefix) (prefix) prefix)
                               " calling "
                               (:fname req)))
                    req))

Then, add it to your slacker server by

(use '[slacker.interceptor])
(import '[java.util Date])
(start-slacker (the-ns 'slapi) 2104
  :interceptors (interceptors log-function-call
                              (log-function-call-prefixed
                                (fn [] (.toString (Date.)))))

Now you can log every function call of your slacker server.

For more detail about the interceptor framework, especially the request data, please check the wiki page.

In slacker 0.3.0, there is a built-in interceptor to stats function calls. You can find it at slacker.interceptors.stats. The stats data is expose via JMX. You can also write monitoring application to retrieve the data.

And there will be more built-in interceptors in 0.4.0, includes function call time stats and logging.

从GNOME网站安装exaile-doubanfm-gnome-shell-extension

最近GNOME发布了期待已久的extension.gnome.org,这个网站允许你直接通过浏览器安装和管理gnome-shell扩展,有点类似app store的感觉,混乱的~/.local/share/gnome-shell/extensions/终于有了一个官方的界面。

网站开通的第一时间,我提交了exaile-doubanfm-gnome-shell-extension,经过review和修改,这个扩展也得到了进一步的完善,适配了gnome-shell 3.2的风格。

你可以从这个地址直接安装启用
https://extensions.gnome.org/extension/24/exaile-doubanfm-control/

它会在exaile douban.fm启动后显示一个菜单在gnome-shell上,你可以通过这个菜单进行基本的操作。

如果喜欢,别忘了在extension.gnome.org上vote一下 :)

Clojalk SCM Visualization

最近有一个小工具非常流行(如果我没有火星的话),gource,可以将你的代码历史可视化出来。这里有reddit的代码历史,fogus也把写the joy of clojure做成了这样的视频。

凑个热闹,来看看我的clojalk项目可视化

And the video link on vimeo.

除了一名contributor,只有一个commiter。又是一幕Forever alone。
forever alone

PS:
gource上的wiki里,ffmpeg如果报错File for preset ‘slow’ not found的话,去掉ffmpeg的-vpre slow就OK了。

Upgraded to GNOME 3.2

ArchLinux最大的魅力就在于Rolling Release,所有的悲喜剧你都比别人早一步见证。

升级到GNOME 3.2后,我的gnome-settings-daemon不能正常工作,导致gtk+的主题都无效。如果没有经验你可能不太容易注意到它的真实原因。最后找到了同病相怜的人,这个问题被报告在这里。恰好是在我发现这个问题几个小时之前。在gnome解决这个问题之前,有一个简单的workaround:
sudo mv /usr/lib/gnome-settings-daemon-3.0/libcolor.so /usr/lib/gnome-settings-daemon-3.0/libcolor.so~

库加载失败后gnome-settings-daemon会自动禁用这个插件,避免出现Segmentation fault。以上的操作,at your own risk。

此外,gnome-shell升级到3.2以后有些api的变化,我更新了exaile豆瓣电台的gnome-shell插件,你可以顺手git pull一下。
Screenshot at 2011-10-02 17:48:51