Archive for January, 2010

[ANN] CL-Twitter

Friday, January 29th, 2010

CL-Twitter is here, for (some of) your lispish twittery needs. Or it will be, once the code is in a usable state.

Right now you can load twitter.lisp into a REPL and make, delete, list posts, and so on, but it’s broken as an asdf package. I’ll fix that later – right now this is more proof-of-concept stuff while I learn how CL works.

It’s tested in Clozure, but the heavy lifting is all done in drakma and cl-json.

CLBuild rocks.

Wednesday, January 27th, 2010

It does. I’m not entirely it’s an active project these days, but I’ve been using it to get up and running with clozure. Getting clbuild to work with clozure involved a bit of jiggery-pokery, however. Basically what I needed to do was:

  • Switch the svn url in implementations to point to an architecture-specific release
  • ./clbuild update ccl
  • Manually (re)build ccl
  • Put the following into clbuild.conf:
    DEFAULT_LISP_IMPLEMENTATION=ccl
    CCL=/home/alex/clbuild/source/ccl/lx86cl64

...and that's it. ./clbuild slime does what I want, and I haven't found anything that breaks ./clbuild install yet.

I'm cutting my teeth on a twitter client library (because yes, the world does need another one, damnit) which I will either a) post to github, or b) bury under the blissful outpourings of /dev/rand.

[ANN] main.py

Wednesday, January 27th, 2010

Well, all I can say is that I hope I’m not treading on anyone else’s namespace with my little effort.

I finally got bored with rolling and re-rolling my own command line processors in Python, so I’ve knocked together a little something to make things simpler for myself.

It’s loosely based on the marvellously prolific Ara T. Howard’s main gem, but it doesn’t have nearly the feature set. Yet. I guess I’ve given myself something to aim for there.

Anyhow, here’s how to use it, nicked straight from the README:


import main
import sys

def callback(params):
  print "Called with " + params['foo'].value

m = main.mode("run", callback)
m.option("foo")
m.description="How not to be seen"
main.process(sys.argv)

Called as:

$ python b.py

Outputs:

Usage:
  # How not to be seen
        b.py run --foo=<foo>

Called as:

$ python b.py run --foo=bar

Outputs:

Called with bar

There’s lots left to do (decent error handling, for instance – it makes a modicum of effort, but largely you can expect mistakes to blow up in your face), but it’s a start.

JRuby and NekoHTML

Wednesday, January 27th, 2010

My last post (from ages ago) dealt with creating a parser wrapped around celerity. That approach has since stopped working because of API changes, so I figured I might as well see about doing it properly by directly talking to NekoHTML, which is the parser underlying HtmlUnit. If you install celerity, you get the nekohtml jar anyway, so I figured I might as well try to make some sort of use of it.

Because I’m not so familiar with the Java XML APIs, this took me more hunting than I expected, but I’ve wrapped it up in a gem for posterity.

In other words: ew. This code is icky but (possibly) useful.


require 'nekohtml'
html = "<html><head><title>Title of Majesty</title></head></html>"
Nekohtml.parse(html).at("//TITLE").text
 # => "Title of Majesty"
Entries (RSS)