Switch users from XScreenSaver

  • Post author:
  • Post category:Uncategorized

Joao: you can configure XScreenSaver to show a “Switch User” button in it’s password dialog (which calls gdmflexiserver when run). This lets you start a new X session after the screen has locked. This feature is turned on in Ubuntu if you want to try it out.

Of course, this is not a full solution, since it doesn’t help you switch to an existing session (you’d need to guess the correct Ctrl+Alt+Fn combo). There is code in gnome-screensaver to support this though, giving you a list of sessions you can switch to.

DSB-R100 USB Radio Tuner

  • Post author:
  • Post category:Uncategorized

Picked up a DSB-R100 USB Radio tuner off EBay recently. I did this partly because I have better speakers on my computer than on the radio in that room, and partly because I wanted to play around with timed recordings.

Setting it up was trivial — the dsbr100 driver got loaded automatically, and a program to tune the radio (gnomeradio) was available in the Ubuntu universe repository. I did need to change the radio device from /dev/radio to /dev/radio0 though.

One of the issues with the gnomeradio is the UI for tuning the radio. The following controls in the main window are used for this purpose:

  1. The slider on the left hand side of the window.
  2. The rewind and fast forward buttons (which are actually scan forward and backward).
  3. The track backward and forward buttons (which actually move back or forward by 0.05MHz).
  4. The presets option menu (which is initially empty).

What you can’t do from the main window is type in a frequency with the keyboard. You can type in frequencies directly when entering presets though, which is nice. These controls could probably be reduced to just an entry field for the frequency (possibly a spin button), and the presets option menu. The scanning feature seems most useful in setting up the presets: create a preset for each radio station that can be tuned and be done with it.

There are a few other small complaints:

  • The button for turning the radio on or off (the button with a speaker on it) doesn’t change appearance like most other mute controls.
  • The recording feature doesn’t use GStreamer. It’d be nice if it offered the same audio profiles for recording as Sound Juicer and other apps.
  • The input selection and volume control should probably also use GStreamer, so that they can work with the ALSA mixer.

I haven’t yet looked into software for doing timed recordings. Other people have though, so I could probably use those scripts as a base.

Playing with Google Maps API

  • Post author:
  • Post category:Uncategorized

I finally got round to playing with the Google Maps API, and the results can be seen here. I took data from the GnomeWorldWide wiki page and merged in some information from the Planet Gnome FOAF file (which now includes the nicknames and hackergotchis).

The code is available here (a BZR branch, but you can easily download the latest versions of the files directly). The code works roughly as follows:

  • Convert the locations info GnomeWorldWide page into an XML file, adding information from the Planet Gnome FOAF file using the makexml.py script.
  • When the main page loads, it requests the XML file previously generated. For each person element in the XML file, a marker is created on the map.
  • When a marker is clicked, an info window is displayed, which is the result of applying an XSLT transformation to the XML node.

HTTP resource watcher

  • Post author:
  • Post category:Uncategorized

I’ve got most of the features of my HTTP resource watching code I was working on for GWeather done. The main benefits over the existing gnome-vfs based code are:

  • Simpler API. Just connect to the updated signal on the resource object, and you get notified when the resource changes.
  • Supports gzip and deflate content encodings, to reduce bandwidth usage.
  • Keeps track of Last-Modified date and Etag value for the resource so that it can do conditional GETs of the resource for simple client side caching.
  • Supports the Expires header. If the update interval is set at 30 minutes but the web server says that the it won’t be updated for an hour, then use the longer timeout til the next check.
  • If a permanent redirect is received, then the new URI is used for future checks.
  • If a 410 Gone response is received, then future checks are not queued (they can be restarted with a refresh() call).

I’ve also got some code to watch the HTTP proxy settings in GConf, but that seems to trigger a hang in libsoup (bug 309867).

While I wrote the code for use in GWeather, it could be quite useful for other tasks that require watching an HTTP resource such as:

  • HTTP calendar backend of evolution-data-server.
  • A stock ticker applet like gtik.
  • Possibly an RSS reader.

The code is available in my Bazaar archive:

baz get http://www.gnome.org/~jamesh/arch/james@jamesh.id.au/http-resource--devel--0

Bryan’s Bazaar Tutorial

Bryan: there are a number of steps you can skip in your little tutorial:

  1. You don’t need to set my-default-archive. If you often work with multiple archives, you can treat working copies for all archives pretty much the same. If you are currently inside a working copy, any branch names you use will be relative to your current one, so you can still use short branch names in almost all cases (this is similar to the reason I don’t set $CVSROOT when working with CVS).
  2. If you have a directory which contains only the files you want to import into your Bazaar archive, the following command will add them all, and convert the directory into a Bazaar working copy:
    cd background-channels
    baz import -a bclark@redhat.com--gnomearchive/background-channels--dev--0.1

    No need for init-tree, add or commit.

  3. Running archive-mirror in your working copy will mirror that archive, so doesn’t need my-default-archive set.
  4. Other people probably don’t want to set your archive as their default. Also, they can ommit the register-archive call entirely:
    baz get http://gnome.org/~clarkbw/arch/background-channels--dev--0.1

    This checks out the branch, and registers the archive as a side effect.

  5. If you want to find out what is inside an archive, the following command is quite convenient:
    baz abrowse http://gnome.org/~clarkbw/arch

Some things you might want to do:

  1. If you have a PGP key, create a signed archive. This will cryptographically sign all revisions. When people checkout your branches, the signatures get checked automatically (this is useful if the server hosting your mirror gets broken into and you need to verify that nothing has been tampered with). If you have already created the archive, you can turn on signing with baz change-archive (remember to update the mirror archive too).
  2. If you turn on signing, consider using a PGP agent like gnome-gpg. You can configure it in ~/.arch-params/archives/defaults.
  3. It is customary to name the archive directory the same as the archive name. This has the benefit that the branch name matches the last portion of the URL.
  4. If you haven’t set up a revision library, you should do so:
    mkdir ~/.arch-revlib
    baz my-revision-library ~/.arch-revlib
    baz library-config --greedy --sparse ~/.arch-revlib