手动设置Fedora15网卡

今天上午的Fedora更新,版本为0.8.999.3的NetworkManager会致使NetworkManager和network service的版本不一致,从而导致网络功能无法使用。而这个时候要通过yum downgrade NetworkManager*降级又没有网络连接可用,悲剧。

这时只有手动设置网卡了。service network restartservice NetworkManager restart都报告失败,ifconfig查看网卡,只有本地回环启动。

接下来接上网线,通过 ifconfig -a 查看所有的网卡接口,例如我的接口叫做em2.

启动网卡
ifconfig em2 up

查看网卡情况
ifconfig em2

如果没有获得ip,可以通过dhcpclient获得ip
dhclient -4 em2

再查看网卡情况,如果获得了ip,可以尝试ping www.baidu.com,如果出现network unreachable的报错,需要再配置一下路由信息,其中gw是你的网关:
route add default gw 192.168.1.1

这时你的网络应该暂时可用了,立刻执行yum downgrade NetworkManager*降级吧。

jip 0.5.1 released

I just rolled out jip 0.5.1 as a bugfix version of 0.5. It has been published to pypi and you can install it with pip install jip in your virtualenv.

From 0.5, you have new features available:

  • User-Agent ‘jip/0.5‘ is added to http request.
  • New command `freeze` just like pip.
  • Improved jar downloading. By default, at most 3 jars are downloaded in parall.

In 0.5.1, bugs were fixed:

  • Repositories defined in pom are now included for install command.
  • Placeholder resolving of #{pom.groupId} is corrected. (instance)
  • urllib2.URLError is caught to prevent dump.

For any problem and feature request, please refer to github issue tracker.

用coffeescript重写了首页

下午有时间看了一下coffeescript,发现非常优雅。过去对JavaScript的工作,从dojo到jquery主要是在库的层面,这次coffeescript的出现是在语言层面对javascript做了一次加强。现在对语言的加强不再需要mozilla/microsoft/google/apple几家坐下来慢慢聊了,民间的力量就可以实现。

coffeescript的几个特点也属于博采众长:

  • 类似python的,以缩进取代代码块
  • 类似ruby/perl,方法调用括号可选
  • 类似ruby,无须return
  • 正常的类声明语法

在nodejs的环境里可以通过npm安装coffer-script,利用它的命令行程序,可以把coffeescript编译成javascript。不过最给力的是可以在网页里通过引入coffee-script.js来直接执行(其实也是编译一下)coffeescript。

于是我顺手重写了一下首页的js,改写成coffeescript。因为少打很多() {},手可以控制在键盘中心的,敲字的效率大大提高。用空你也可以尝试一下。

安装Exaile豆瓣电台插件及Gnome-Shell扩展

介绍一下新版本的Exaile豆瓣电台插件和新的GNOME-Shell扩展的安装。

下载

从github上下载相应的版本:

$ wget --no-check-certificate https://github.com/sunng87/exaile-doubanfm-plugin/zipball/0.0.10-dbus
$ wget --no-check-certificate https://github.com/sunng87/exaile-doubanfm-gnome-shell-extension/zipball/0.0.1
$ ls
sunng87-exaile-doubanfm-gnome-shell-extension-0.0.1-0-g5cc29c6.zip
sunng87-exaile-doubanfm-plugin-0.0.10-dbus-0-g90f7175.zip

解压安装

如果你已经安装过exaile豆瓣电台插件,可以先删除旧版本:

$ rm -rf ~/.local/share/exaile/plugins/doubanfm

解压缩下载的文件:

$ unzip sunng87-exaile-doubanfm-plugin-0.0.10-dbus-0-g90f7175.zip
$ unzip sunng87-exaile-doubanfm-gnome-shell-extension-0.0.1-0-g5cc29c6.zip

移动到指定的目录:

$ mv sunng87-exaile-doubanfm-plugin-90f7175/ ~/.local/share/exaile/plugins/doubanfm
$ mv sunng87-exaile-doubanfm-gnome-shell-extension-5cc29c6/ ~/.local/share/gnome-shell/extensions/exaile-doubanfm-gnome-shell-extension

配置

启动Exaile,通过菜单“编辑->首选项->插件”,激活doubanfm,禁用lastfm covers。如图设置插件:

重启GNOME-Shell,按下alt+f2,输入r,回车。

使用

启动exaile,可以通过文件菜单打开豆瓣电台频道。可以通过ctrl+d或者视图菜单切换到豆瓣电台视图:

当然也可以通过gnome-shell扩展的菜单控制豆瓣电台的播放。

GNOME-Shell Extension for Exaile DoubanFM Plugin

从有这个动机到基本可用,花了整整一天的时间。现在可以通过GNOME-Shell的一个小菜单从外部控制Exaile豆瓣电台了。它的意思就是说如果你使用Gnome-Shell,你可以把Exaile界面扔到一个你不想看到的地方去,比如第n+1个workspace。然后通过左上角的菜单来控制豆瓣电台的播放。见多识广的你不会对此感到太惊奇,其实它和Ubuntu上的Sound Menu Indicator类似,不过是专门给豆瓣电台设计的。
Exaile with doubanfm plugin

要实现这个功能,需要播放器通过dbus来expose一些接口供外部程序调用,它和Sound Menu是一样的,通过dbus来解耦。开发起来比较困难的是目前GNOME-Shell的API还不成熟,还没有文档,传统的javascript object inspect方法似乎在这个mozjs的环境里也不能用,所以实在是无从知道一些API。更不要提通过gjs来调用dbus了。网上有一些文档起了很大的作用,如果你也感兴趣,这些文章是:

支持dbus的exaile-doubanfm-plugin会在stable之后合并到主干供大家使用。现在和gjs一样,它的API也不稳定,所以放在分支中:
https://github.com/sunng87/exaile-doubanfm-plugin/tree/dbus

gnome-shell extension的代码现在也放在github上(其实还不成熟的东西放到bitbucket比较好的)。有兴趣可以了解:
https://github.com/sunng87/exaile-doubanfm-gnome-shell-extension

以上都是unstable,仅供吊胃口之用。