Get your conky location aware

Add this in your conkyrc ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip/gml:name/text()" -q} ${exec curl -s "http://api.hostip.info" | xpath -e "//gml:featureMember/Hostip//gml:coordinates/text()" -q} Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like <?xml version="1.0" encoding="ISO-8859-1" [...]

Posted in: 装备 by Sunng No Comments , , ,

Using weather

Ubuntu仓库里有个weather-util包,可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息,对美国的城市可以直接用名字查询,其他国家只能使用id查询。id的规则和weather.com不太相同。 中国的天气站点id可以在这个页面上查到。比如南京ZSNJ,上海浦东ZSPD。使用weather工具查询: weather -i ZSNJ Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ) Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC Temperature: 35 F (2 C) Relative Humidity: 59% Wind: from the SSW (210 degrees) at 4 MPH (4 KT) 简化操作,可以在$HOME下创建.weatherrc文件,形如 [default] ID = ZSPD [nj] ID = ZSNJ [...]

Posted in: 装备 by Sunng No Comments , ,

I ♥ Free and Open Source Software

Posted in: 未分类 by Sunng No Comments

老物什 / Old Stuff

大年初一翻旧物,找到一些让人颇有感触的旧物件。2004年买的RH9,2005年夏天买的Fedora 4。前者至今还安装在我家最旧的电脑里,虽然我都忘了它的样子了。 包装 手册 CDs 这个代理商里仁软件似乎已经倒闭了。

Posted in: 留影 by Sunng 2 Comments ,

Virtual Machine Searcher for Gnome Deskbar Applet

Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That’s what I create the the plugin for. I switched to deskbar because gnome-do’s Do.exe reminds me nightmares when I was a M$ Windows user. [...]

Posted in: 广告 by Sunng 3 Comments , , ,

List your installed virtualbox virtual marchines using vbox python xpcom api

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 = [...]

Posted in: 把戏 by Sunng No Comments , ,

Sunng's Canvas based Heatmap API

Glad to announce my works this morning: A simple heatmap API based on HTML5 canvas. The programming interface is rather simple now. To create such a heatmap, you just new a heatmap object by: <canvas width=”300″ height=”215″ id=”canv”></canvas> heatmap = new HeatMap(“canv”); Then read your dataset and push data into the heatmap: heatmap.push(x, y, value); [...]

解决Ubuntu Openbox无法启动的问题

今天在工作用的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 [...]

Posted in: 把戏 by Sunng 10 Comments , ,

无题

我草,这是真的吗,同志们是3:0吗??!! 是不是电视显示错了??! 我有生之年居然看到这一幕了!!! 人生啊,这是人生吗 见证历史了!!! 牛逼!!这是真的吗,这是他妈真的吗 邓卓翔!! 牛逼!!! 娘的,要下载录像 这他妈是真的吗??!! 去你妈的CCTV 去你妈的江和平

Posted in: 自话 by Sunng 5 Comments

Suppressing simple-xml's class attribute

Simple-xml is an object-xml serialization and de-serialization framework. It’s featured by annotation-driven, light-weight and self-contained. In simple-xml, pojos that will be serialized are annotated with @Root, @Element, @Attribute or @Text. The problem is, when handling with inheritance, if the actual type is different from declared type, simple-xml will add a “class” attribute for de-serialization consideration. [...]

Posted in: 手艺 by Sunng 4 Comments ,