我总是对这种城市建设、交通规划一类的游戏欲罢不能,以前在Linux上一直只是玩Lincity,后来发现了纯交通类的simutrans,最近升级到Ubuntu10.04以后,终于可以玩这个六年磨一剑,精雕细琢的OpenTTD了。
可以建造各种客运货运的汽车站、火车站,机场,码头等等,可以建设道路、铁路,可以购买公交车、卡车、火车头、火车车厢等等。可惜我玩了大半天还不知道怎么盈利。。。
Compojure是一个用Clojure写成的类似Sinatra的Web框架。Leiningen是一个新的Clojure构建工具,它用Maven来处理依赖管理,而通过封装Lancet(基于Ant)来实现build-in的task。
以上是背景介绍。以下是HelloWorld。
创建一个目录作为工程目录
像创建build.xml和pom.xml一样创建project.clj
首行定义了项目的groupId, artifactId和version,其后的是maven风格的依赖定义,最后我们还定义了程序的主类。
这个helloworld只有一个文件,被放在src/info/sunng/compojureapp/目录下
中间就是Sinatra风格的URL映射定义,最后在主类中通过一个run-server方法以嵌入式的方式运行一个jetty
回到工程目录,执行构建
通过uberjar可以将依赖通通打入一个jar包中,接着就可以通过
java -jar compojure-app-standalone.jar
启动你的Web程序了,很酷吧
除了这种方式,还可以通过
lein swank
启动一个swank server(project.clj中定义了dev-dependency),再用Emacs的SLIME交互式地运行程序。
参考
If you installed kubuntu parallel to ubuntu, you might find that the default browser is set to konqueror and cursor theme is oxygen which cannot modified by “gnome-default-applications-properties” and “gnome-appearance-properties”.
To fix this, use Debian update-alternatives tool:
update-alternatives –config x-www-browser
update-alternatives –config x-cursor-theme
All configurable options are listed at /var/lib/dkpg/alternatives
升级10.04之后,gwibber2.29开始使用pycurl来处理IO。结果一条更新都拿不下来,为此搜到很多相关、不相关的bug。最后终于自己找到问题,原来是pycurl.setopt方法传入字符串如果是unicode就会报typeerror。而通过gwibber配置界面输入的所有字符都是unicode编码,于是问题也就简单了。做个处理,在 /usr/lib/python2.6/dist-packages/gwibber/microblog/network.py 第18到21行:
另外,使用StatusNet的Twitter兼容API来做Twitter API代理,需要把代理的目录名设置为api,因为/api这个路径是写死在gwibber代码里的。通过界面输入的,只是代理的domain。
说实在的gwibber还是挺烂的。
https://bugs.launchpad.net/bugs/542501
https://bugs.launchpad.net/bugs/543860
I’m sorry for the long title. Due to lack of documentation, it’s not easy to use python xpcom api from virtualbox sdk. The code below is just a sample that lists your installed virtual machines. It works on linux with VirtualBox OSE 2.0.8. Hope useful to you.
Output: