echo "hey, it works" > /dev/null

just enough to be dangerous

AtomPub and WordPress


So, WordPress 2.3 beta adds support for AtomPub. All good. I installed it (separately to this blog, I'm just playing around), but all I could get out of the APE was a 401, even though I'd provided the correct authentication credentials. Looking at the code, with liberal use of the logging therein, I worked out that PHPAUTH* weren't being set, so I pulled out some auth code and tried it on it's own. No luck. Weird. I then grabbed a previously working snippet and tried that, but it was broken too. On both the servers to which I have easy access. I sent the snippet to Donal, and the snippet worked for him. WTF?

Turns out, that both the servers I was testing on are running PHP as a CGI, not using modphp, and if PHP is being run as a CGI PHPAUTH_* aren't available. Who knew? Well, someone, but not me. And they knew a workaround too.

Thanks for your help, Donal! And to all the cool people who are working on this (Elias Torres, Pete Lacey, Sam Ruby, Tim Bray get special mention).

The APE now exercises my beta blog. Now I have to work out why it can't delete stuff ...

Feeds in search results


I'm finding more and more feeds are being returned from Google. This seems like stupid behaviour to me. You use a search engine to meet an information need. I want to know something about Ferret, I'm likely to use a search engine to find it. Do I want to subscribe to a feed? No, that's way too much commitment. If I find what I'm after and the site looks interesting I'll poke around a bit and then I might decide it's interesting enough to subscribe to.

The correct behaviour would be for Google to return a link to the site from which the feed originates.

hpricot downcases element names


The title says it all really. I'm using hpricot for the first time, and the page I'm scraping has quaint uppercase HTML elements, shouting its TABLEs at me. It took me quite a while to work out that I didn't have to shout at hpricot.

vcscommand.vim


I've just installed vcscommand.vim, which integrates version control into vim. I was trying it out and was getting the error "No suitable plugin" whenever I ran a command. Turns out this was because I wasn't actually in a working directory, I was in the directory I initially imported. So, remove the directory and then checkout the source, now all good.

Ruby Find and changing directories


When working with Ruby's Find, don't change directories with FileUtils.cd, as Find gets confused. You're better off working with full paths (use File.expand_path).

Joy of version control


I'm a two-bit hacker. Most code I've written to date is small and self contained, rarely more than a couple of files. For that reason, I always thought that version control was a bit overkill--a good idea, but not really worth the effort on small projects. However, at work we do use version control and it's been an interesting experience. The main selling point for version control software is the ability to track changes, but I've found that the changes that using version control software has made to my coding practice have been the most useful. Instead of hacking away at whichever bit of code that's in front of me, I'm having to consider the changes that I'm making as commitable chunks. This has clarified my thinking about what I'm doing and improved my focus. So, from now on, version control on everything more than a five line shell script.

Passing information to Camping


If you want to pass information to a Camping controller, all you have to do is define the class like this:

class Index < R '/(\d+)'
get(id)

Now whatever was matched by the regex \d+ can be retrieved by the variable id. If you want to pass more than one variable, just chain them like this:

class Index < R '/(\d+)/(\w+)'
get(id, action)

Each of your regex groups will be passed as a variable.

If you forget to add the arguments to the get method, you'll get an error like this:

Camping Problem!

MyApp::Controllers::Index.GET

ArgumentError wrong number of arguments (1 for 0):

Screen in a screen


I have GNU screen running on a couple of boxes. Occasionally I accidentally ssh from inside screen to the other box and attach the remote screen, purely out of habit. That means that C-a sends a signal to the outer screen. You can send a real C-a to any application through screen with C-a a, so to detach the inner screen you use C-a a DD.