Feb 10, 2011

Get back desktop icons

I am using Linux Deepin 10.06, a Chinese community distribution based on Ubuntu 10.04 LTS, using xfce4 as its desktop environment. For some reason, my desktop icons have disappeared. I found a lot of solution like going to

Settings > Settings Manager > Desktop
and selecting

Allow xfce to manage the desktop


However I did not find the option at all. This post mentioned xfdesktop. I tried the command, and the icons came back. There seem to be a lot of people who have problems with their desktop "disappearing" on xfce. Maybe the command xfdesktop can help you get back your xfce desktop icons.

Feb 5, 2011

Weather report powered by python

I would like to insert weather report to my diary automatically, so I googled "weather script python" - yes, I prefer python - and found a python script fetching weather report from Yahoo! Weather written by Thomas Upton

In order to use the script, I looked up the location ID for my city. I searched Yahoo Weather home page. The location ID is in the URL for the forecast page for the city. For example, the forecast page for Los Angeles is http://weather.yahoo.com/united-states/california/los-angeles-2442047/. The location ID of Los Angeles is 2442047.

Unfortunately, the script does not work for me. I checked the python source code, and found the feed URL is "http://xml.weather.yahoo.com/forecastrss?p=", which seems only for US zip code. So I modified the URL to "http://weather.yahooapis.com/forecastrss?w=", which works with the code from Yahoo Weather home page.

You can apply a patch if you would like, which I supply here:

--- weather.py 2011-02-05 21:40:02.000000000 +0900
+++ weather.py 2011-02-05 21:51:43.000000000 +0900
@@ -19,7 +19,8 @@

# Yahoo!'s limit on the number of days they will forecast
DAYS_LIMIT = 2
-WEATHER_URL = 'http://xml.weather.yahoo.com/forecastrss?p=%s'
+#WEATHER_URL = 'http://xml.weather.yahoo.com/forecastrss?p=%s'
+WEATHER_URL = 'http://weather.yahooapis.com/forecastrss?w=%s'
METRIC_PARAMETER = '&u=c'
WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0'