Published at: 01:02 pm - Friday February 12 2010
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. import vboxapi vmsg = vboxapi.VirtualBoxManager(None, None) vbox = [...]
Published at: 01:02 am - Thursday February 11 2010
今天在工作用的ArchLinux上安装了用Openbox取代了GNOME桌面,感觉良好,回来尝试一下在Ubuntu上也做同样的事情。不料遇到问题,在完成基本的配置之后,Openbox Session无法启动,总是自动跳回gdm。查看.xsession-errors,是gnome-setting-daemon报错: (gnome-settings-daemon:2519): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL’ failed 既然是gnome-settings-daemon报错,就在.config/openbox/autostart.sh中注视掉和gnome-settings-daemon相关的部分: # Make GTK apps look and behave how they were set up in the gnome config tools #if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then # /usr/libexec/gnome-settings-daemon & #elif which gnome-settings-daemon >/dev/null; then # gnome-settings-daemon & # Make GTK apps look and behave how they [...]
Published at: 11:01 pm - Sunday January 31 2010
翻译一个po文件。确认安装了gettext工具包。 cd到po目录,创建pot intltool-update –pot 创建相应的语言文件,例如zh_CN msginit -l zh_CN.utf8 程序会提示选择或输入邮箱,之后就会生成zh_CN.po文件,打开文件,逐条编辑msgstr即可。 手动编辑LINGUAS文件,按顺序将zh_CN添加到其中。 可以通过这个命令查看翻译的进度 msgfmt -cv zh_CN.po 对于更新pot更新的情况,可以使用命令更新po文件 intltool-update zh_CN 参考: http://live.gnome.org/TranslationProject/LocalisationGuidezh http://blog.chinaunix.net/u1/37261/showart_476642.html
Published at: 10:12 pm - Wednesday December 30 2009
This is a feature introduced in NetBeans 6.7. Set environment variables for specified life-cycle phases: Open project properties dialog, select action category. Select actions which depend on the variable, click add button to add such an environment variable. However, this method doesn’t work with Glassfish spawned the IDE. If you want use environment variables in [...]
Published at: 10:12 pm - Tuesday December 29 2009
After you test and build your application in NetBeans, you deploy it to Glassfish, but the environment variables are invalid again. In such situation, you should set these variable in glassfish configuration file which is supposed to located at: $GLASSFISH_HOME/glassfish/config/asenv.conf Append your variables to the file, and restart the server. It works.
Published at: 10:12 pm - Monday December 28 2009
If you use NetBeans IDE to build an application which reads environment variable, you will have to do these settings in your IDE. There is no GUI to set such variables in NetBeans while Eclipse provides you a “Run Configuration Dialog”. So just add the declaration in your netbeans.conf. It is highly recommended to copy [...]
Published at: 11:12 pm - Monday December 21 2009
I will show you the usage of Yan captcha service. In this tutorial, it’s based on a simple ruby web application of the Sinatra web framework. Before we start to use the service, it is necesary to get Yan running. Download the code from the project page, then build and run it with maven: mvn [...]
Published at: 01:12 pm - Wednesday December 09 2009
Inspired by a “Call to action” tutorial of Photoshop, I’d like to do the same thing with free and open source software, GIMP. Before we start the journey, it’s better to get well prepared. Take a look at the powerful plugin “Layer Effects“. It provides you complete functionality as “Layer Style” in Photoshop does which [...]
Published at: 04:11 pm - Sunday November 29 2009
在Ubuntu上安装GIS软件,可以添加这个PPA源: deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu karmic main 导入GPG KEY gpg –keyserver subkeys.pgp.net –recv 089EBE08314DF160 gpg –export –armor 089EBE08314DF160 | sudo apt-key add – 这个源中目前包含了最新版本的GIS软件: gdal 1.6 grass qgis
Published at: 02:11 pm - Friday November 20 2009
最近用Groovy的HttpBuilder模块开发RESTful服务的客户端,遇到不少问题,浪费不少时间 网上的例子都是从Grape开始的,但是按照例子上运行,无论是通过grape install还是在代码里@Grab都没有办法把http builder加到classpath里,甚至依赖关系已经下载到~/.groovy/grapes里了,但是还是在import的时候报错。用Grails的时候也是一样,如果通过ivy定义依赖,通过ant下载到lib目录中,在grails shell里还是没有办法引用。不理解了,难道还需要手动再指定path吗。最后用grails的rest插件(grails install-plugin rest)总算是下载到了path中了。 第二是http builder的报错太智能了,它会把服务器端50x的报错输出在客户端。在查看错误的时候一定要分清楚。 第三是net.sf.json-lib这个库在转json的时候有一点问题,比如这样的js对象 {“result”:”success”} 会因为key上有引号而无法解析,必须是这样的格式: {result: “success”} 至于那种是正确的json我也没有兴趣了解了,只是非常遗憾的是couchdb返回的都是前一种形式。 当然了,瑕不掩瑜,http builder还是提供了非常方便的封装,比直接用HttpURLConnection或是HttpClient更加Groovy