WEBrick proxy authentication example

Posted in Coding, Ruby on July 29th, 2008 by alex / No Comments »

I’ve never been able to find an example of using WEBrick’s HTTP proxy with authentication online before, so here’s one I figured out today, after the fold.

Read the rest of this entry »

Tags: .

Clojure’s REPL and Readline

Posted in Clojure, Coding on July 4th, 2008 by alex / No Comments »

The standard advice for getting a practical REPL for Clojure is to use jLine, but that’s not really necessary if you’re not on Windows. rlwrap does the job admirably, and was only an

apt-get install rlwrap

away for me.

Government data! Free APIs!

Posted in Cool stuff, Internet, mapping on July 2nd, 2008 by alex / No Comments »

Wow.

Now I just need to generate some spare time to think through what’s possible with all this.

Also, intriguingly, the Ordnance Survey has released an API that mitigates my old post somewhat.

Updating Metadata for 722 gems! AARGH!

Posted in Coding, Ruby on June 26th, 2008 by alex / No Comments »

Seriously. Is this really necessary?

alex@21:~/Documents/Projects/VPNGen$ gem search scp --remote

*** REMOTE GEMS ***

Updating metadata for 722 gems from http://gems.rubyforge.org/
..............................................................................................
..............................................................................................
..............................................................................................
...............................ERROR:  Interrupted
Tags: ,.

Clojure, Slime, Documentation?

Posted in Clojure, Coding on June 26th, 2008 by alex / 6 Comments »

Update: It turns out that the Gutsy-included version of slime is rather out-of-date, and the clojure scripts are based on the CVS version. If you’re having the problem below, get thee hence and cvs thyself.

There seems to be a general theme in the emacs world. If I could give it a voice, it might say “I’m great. No, I’m not going to tell you how to use me. You mean you don’t already know?”

Let me put this in context. You might be able to tell from my previous posts that I’ve got a long-standing, from-a-distance interest in all things lispy. Naturally, my attention fell on Clojure (fairly recently, admittedly). My next thought was that I should get slime set up to use it so that I could use a natural environment to try it out, and this is where things started to get dicey.

Almost everything works; here’s the relevant section from my .emacs:

(defun set-clojure-inferior-lisp ()
  (setq inferior-lisp-program
        (let* ((java-path "java")
               (java-options "")
               (clojure-path "~/Documents/Projects/clojure/bin/")
               (class-path-delimiter ";")
               (class-path (mapconcat (lambda (s) s)
                                      (list (concat
																						 clojure-path "clojure.jar"))
                                      class-path-delimiter)))
          (concat java-path
                  " " java-options
                  " -cp " class-path
                  " clojure.lang.Repl"))))

(defun clojure-boot ()
  (interactive)
  (require 'slime)
  (setq slime-net-coding-system 'utf-8-unix)
  (slime-setup)
  (add-to-list 'load-path "~/emacs/clojure-mode")
  (require 'clojure-auto)
  (set-clojure-inferior-lisp)
  (setq slime-lisp-implementations
        '((clojure ("~/emacs/clojure-extra/sh-script/clojure")
                   :init clojure-init)))
  (add-to-list 'load-path "~/emacs/swank-clojure")
  (require 'swank-clojure)
  (cua-mode t)
  (slime))

The annoying thing is what doesn’t work: exceptions are getting lost, and the error message that comes back for each and every one is distinctly unhelpful:

error in process filter: Wrong number of arguments: nil, 3

Where do I go from here? Google knows nothing of this error. I’ve emailed the author of the swank-clojure code for assistance; I’ll update here if I get anywhere with this. It’s really frustrating to be this close to what looks like a brilliant development environment, just to hit a brick wall like this.

Tags: ,,,.

VirtualBox, KVM, Windows and Linux

Posted in Ruby on June 12th, 2008 by alex / No Comments »

Today I’ve been mostly bringing a new subcontractor up to speed on a project I’ve been working on for a while. It’s quite a fun project that I’ll probably post about at some later date (think _why’s mousehole on steroids), but what I’ve spent most of my time on is wrangling virtual machine images.

For me, kvm is the first (free) virtual machine host system that makes everything Just Work. I always had problems with UML and Xen, qemu was too slow, and I always shied away from VMware. Not entirely sure why, but there you go.

Now, back to this contractor: he’s on Windows, I’m on Ubuntu Gutsy. I know that my code won’t work on Windows, because I’m daemonising and fork()ing all over the place. VMs to the rescue! It looks to me like the best combination is kvm on my side, and VirtualBox on his. There’s a very simple conversion that lets me convert my qcow image to a vmdk that VirtualBox can read:

qemu-img convert etch-rodents-i386.img -O vmdk etch-rodents-i386.vmdk

I’ve not seen this documented anywhere; most google hits mention the obsolete vditool, which I couldn’t get to run on my 64-bit host anyway.

Added bonus: the vmdk image is slightly smaller than the qcow. Win.

Tags: ,,.

Ordnance Survey – Dead Man Standing?

Posted in Internet, mapping, technology on August 17th, 2007 by alex / Comments Off

IWR Blog – information industry insight from www.iwr.co.uk – Individual Archives
and
The Graun

The Ordnance Survey, those charged with measuring the British Isles, seem to have a particularly backward view of the internet and the democratisation of content. For now, it’s really annoying. Genuinely white-hat projects are getting canned because the OS is stuck in the (relative) dark ages. Five years from now, it won’t make a blind bit of difference. Either they will have opened up, or they will have been supplanted as the primary open mapping service in the UK – if not over the whole UK then at least in London. In that time I expect Google to have photographed everything, and someone’s bound to come along and do something very clever with Photosynth to get high-accuracy metrics out of those images.

Even if it’s not Google that does it, the market pressure is high enough that someone is going to offer the service that the OS doesn’t want to, and it’s only going to get cheaper for them to do it as time goes on.

IWR Blog – information industry insight from www.iwr.co.uk – Individual Archives

Posted in Uncategorized on August 17th, 2007 by alex / No Comments »

IWR Blog – information industry insight from www.iwr.co.uk – Individual Archives
There’s a gloriously enticing quote in this article about harnessing creativity.

The trick is to ensure that an environment is established where it’s okay to dream and definitely okay to share and where curiosity and creativity are a continuous backdrop to real life.

Yes, please.

Also, I really want to know what the top-secret approach mentioned in the first paragraph is. If it can put an end to those “just can’t think of anything worth thinking about” mornings… well, yes please to that too. Being a one-man-band, I can’t help but think that my creativity suffers somewhat from the lack of day-to-day interaction with people directly on my wavelength.

Why FireFox is Blocked

Posted in Internet, firefox on August 17th, 2007 by alex / No Comments »

This is good for a giggle, from Metafilter:

Why FireFox is Blocked
How to block FireFox
FireFox is now blocked from this and many of my other sites

The short story: disgruntled webmaster blocks FireFox because he notices that AdBlock can’t be detected, because “Accessing the content while blocking the ads … would be no less than stealing.” Then he procedes to mount a mini-crusade against internet thieves

Bollocks to that.

Get it into your skulls, content providers: this is my computer, and I will decide what it does. If you decide that by exercising that right I shouldn’t be allowed access to your content, so be it, but please, drop the righteous indignation. Calling me a criminal is hardly likely to endear me to your cause.

ERB quine fun

Posted in Coding, Ruby on April 8th, 2007 by alex / No Comments »

Quoth Ken Bloom on the ruby-lang mailing list:

If you really want to be evil and twisted, what’s the smallest self-
reproducing erb program you can write that doesn’t read its own file.

And who could ignore a challenge like that on an Easter Sunday? This is the best I could do:

<%=s=">%"}esrever.s{#}tcepsni.s{#=s=%<";";"<%=s=#{s.inspect}#{s.reverse}"%>

77 characters of fun.

Entries (RSS)