Blogs

My new Spot device

I just went on a dirk biking trip to Moab, and just in time for the trip, my new Spot device arrived. I'm not gonna write a full review here, but so far, I've been incredibly impressed with it. I used it for 3 days straight, in the "tracker" mode where it sends a location message every 10 minutes. I don't think it missed more than one message the whole trip. The cost is not horrible ($150 for basic + unlimited tracking service). Here's an example of what the tracking would look like, this is from our last ride on the Poison Spider trail:

spotme.jpg

Fedora and debuginfo

A while ago, I wrote about installing System Tap on my Fedora box, which requires some debuginfo packages. I mumbled something about what yum commands to use, here. As it turns out, this is a common enough task to do that there's a special Python Yum application for it, debuginfo-install. For example:

# debuginfo-install gcc.i386 glibc.i686

Neat!

Binding application windows to a workspace in Gnome

I keep switching between KDE and Gnome on various boxes, just to get a feel for what each desktop system can do. One thing I dearly miss in Gnome is the capabilities of kwin to "bind" (or "tie") an application's windows to a specific workspace. I use a lot of workspaces, and some of my apps keeps littering these workspaces with windows, in particular Pidgin. This makes it easy to miss someone's important proxy server related questions, and people get cranky.

While poking around for a solution to this, I ran into this little gem of a tool called devilspie. My Fedora distribution has this packaged already, so it was just a matter of doing

# yum install devilspie gdevilspie

(gdevilspie is a GUI rule builder). Now, what does devilspie do, you ask? It can do a lot of things related to managing your X11 windows, as they are created! This seems like the perfect solution, I just need to figure out how to create a Pidgin rule, that detects everytime Pidgin creates a new instant message window, and move those to Workspace #7. I decided to use gdevilspie to create this rule, but you can do it all from command line and your favorite text editor (i.e. emacs).

Step 1: Create a new rule

Start gdevilspie (obviously...) and click on the "+Add" button. Call your new rule "Pidgin".


Step 2: Define the matching property (or properties)

I've decided to match on the name of the application. I wasn't sure if it was "pidgin" or "Pidgin", so I clicked on the "Get" button (not showed below), and then just click on a Pidgin windows. It turns out, like many X11 apps, the application is named "Pidgin". Here's a screenshot:

DS-Matching.png


Step 3: Define the actions to take

In my case, I always want to move any new windows to workspace #7, and this is easily configured in the "Actions" tab:

DS-Actions.png


Step 4: Start Devilspie

You can start devilspie from the GUI application (there's a big fat "Start" button), or you can just run it from command line ("devilspie -a" for example). The final rule also has a text representation ("Raw"), my rule ended up like this:

( if 
( and 
( is ( application_name ) "Pidgin" )
) 
( begin 
( above )
( set_workspace 7 )
( println "match" )
)
)
All in all, this is an awesome tool, it has a ton of features, and a really easy to use Rules GUI creator. I can highly recommended this for managing your new windows.

Drupal and SourceForge

SourceForge recently changed their site to put their Apache servers behind a "pool" of Nginx reverse proxies (accelerators). This is a good idea, but has negative impact on various Drupal features, like, logs, ACLs etc. I've made a small hack on my http://pysearch.sourceforg.net/ Drupal installation, like this:

--- includes/bootstrap.inc.5.10 2008-09-23 08:53:05.000000000 -0600
+++ includes/bootstrap.inc      2008-09-20 10:14:52.000000000 -0600
@@ -5,6 +5,9 @@
  * @file
  * Functions that need to be loaded on every Drupal request.
  */
+if ($_SERVER['HTTP_X_REMOTE_ADDR']) {
+    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REMOTE_ADDR'];
+}
 
 /**
  * Indicates that the item should never be removed unless explicitly told to

Granted, this needs to be configurable, I'm thinking a general Drupal setting where we can tell which Header to use to replace REMOTE_ADDR.

rpm, yum and broken perl installation

My Fedora Core 7 box recently ended up in some state where my perl installation was seriously messed up. I'd get errors about mismatch in platform architecture, problems with sockets etc. etc. So, I really wanted to have yum reinstall all my perl packages. I couldn't find a way to do that, but I managed to achieve something similar using various commands. Here are the steps I followed:

# rpm -qa --qf '%{NAME}\n' | grep '^perl-' > /tmp/perl.pkgs
# rpm -e --justdb --nodeps perl `cat /tmp/perl.pkgs`
# mv /usr/lib/perl5 /usr/lib/perl5-
# yum install perl `cat /tmp/perl.pkgs`

PLEASE! Be careful with these commands, make sure you know what you're doing, check the /tmp/perl.pkgs file to make sure it seems reasonable etc. Once this is all done and finished, I removed the old perl5 library (perl5-).

As an alternative, you could also do something like

# rpm -q --qf '%{NAME}\n' --whatrequires perl > /tmp/perl.pkgs

but that will reinstall more packages than absolutely necessary, I think.

Apache IP ACLs and SourceForge

I was fiddling with some Apache ACLs for one of my projects that I host on SourceForge. They seem to be using Nginx in from of their Apache farms, so ACLs based on the src IP did not want to work at all. Since all I do all day is reverse proxying (at Y!), it was pretty obvious that the src IP was the IP of the Nginx box, and not the client. So, I modified my rules to check the X-Remote-Addr header instead (hopefully their Nginx is smart enough to set this somewhat safely...). I ended up with an Apache rule like

SetEnvIf X-Remote-Addr 1.2.3.4 is_trusted_ip
SetEnvIf X-Remote-Addr 4.3.2.1 is_trusted_ip

<Files somefile.php>
  Order Deny,Allow
  Deny from all
  Allow from env=is_trusted_ip
</Files>

Yes, I know, I could probably use X-Forwarded-For as well, but then I'd risk having multiple IPs in the header.

Drupal Update

To hack around this problem for my SourceForge site (where all src IPs now show up as at 127.0.0.1), I added the following ugly hack to the beginning of my includes/bootstrap.inc file:

if ($_SERVER['HTTP_X_REMOTE_ADDR']) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REMOTE_ADDR'];
}

Emacs for OpenSolaris

I've been fiddling with OpenSolaris lately, and one obviously require package is dearly missed: Emacs. I tried to compile it myself, but couldn't get "configure" to pass, so I decided to look around for alternatives. It turns out SunFreeware has a prebuilt Emacs package, somewhat suitable for OpenSolaris. So, not knowing anything about the IPS system, I fumbled around a bit, until I figured out that the following commands added this repository (or authority I think it's called):

% pfexec pkg image-create -F -a sunfreeware.com=http://pkg.sunfreeware.com:9000 /var/sunfreeware
% pfexec pkg set-authority -O http://pkg.sunfreeware.com:9000 sunfreeware.com
% pfexec pkg refresh --full
# Now I can run
% pfexec pkg search -r emacs
% pfexec pkg install pkg://IPSFWemacs   # Copied from above search results

This version of emacs is a bit old (21.x), and it doesn't seem to work when started with an X11 window. But at least I don't have to suffer with vi any more.

Update: I made an OpenSolaris package with Emacs v22.2 for x86, which has both X11 support (emacs) and a non-X11 version (emacs-nox). The tar ball with the package is available on my FTP site. This might be a usable alternative of Emacs until the official OpenSolaris IPS adds an emacs package.

Yahoo domains ...

To my major disappointment, Yahoo just told me (less than a month before my domain is up for renewal) that they are increasing their prices for domain registration from $9.95/yr (I think) to a whopping $34.95/yr. Fortunately my ISP / hosted server provider (Cari.net) handles domain transfers very nicely, and at a reasonable price ($12/yr). Maybe not the cheapest alternative, but certainly better than $34.95.

KVM/qemu vs VirtualBox

I've been fiddling around with various virtualization systems, including VMWare, Fusion, Xen, Qemu, KVM and now lately, VirtualBox. To my surprise, there's virtually no (pun intended) difference running it natively on FC9, or under either VM (Ubuntu). It's possible Ubuntu is just "faster" than FC9 since some VM tests were actually faster, so maybe I really ought to run this test with an FC9 VM instead. Also, there's very little, if any, difference between VirtualBox and KVM performance (which is good, because I like VirtualBox a heck of a lot more). I ran the VirtualBox benchmarks both with, and without, VT-x support, VT-x seemed marginally faster, although it's probably not statistically "safe".

Here are the numbers:

Native FC9
VirtualBox Ubuntu8
VirtualBox w. VT-x enabled
KVM/qemu Ubuntu8
Integer
54.273
54.730
55.337
54.312
Floating point
43.196
42.843
42.495
43.063

The Bonnie++ I/O benchmarks are equally impressive for VirtualBox, most tests are as fast as the host OS (or faster ...).

On top of being very fast, VirtualBox is also the easiest to use free virtualization software I've tried, so far. It even supports PulseAudio as an audio driver! This feature alone makes it very attractive, since my FC9 host system is completely migrated to PulseAudio, and now my virtual machines now seamlessly supports sound as well.

I'll blog more about PulseAudio as I learn more, but it's a really neat little package. I really hope it'll clear up the Audio mess that is currently in Linux/Gnome/KDE. This could be the sound server to control it all.

HTML to PDF

I like to read various web articles on my laptop while I'm traveling, and often there's no network available (like, in the air..). I found this little service that someone in the UK setup, which lets you convert any HTML page to PDF. The URL is http://www.htm2pdf.co.uk/, and I can highly recommend it, it's an easy to use tool to make sure you have enough reading material available even when you are offline.

And I know, there are other ways of doing this conversion, but the service above is so far the easiest to use that I've found. There are also web service APIs available, which are not free, so I haven't had a chance to try them.