Erlang

You are currently browsing the archive for the Erlang category.

Etch has ejabberd 1.1 packaged but if you’re like me you’ll want to play with the new features in 2.0, in which case you’ll need to build from source. Etch’s packaged version of Erlang is apparently not up to date enough to support it (it compiles fine, but I couldn’t get TLS to work) so you’ll need to build a newer version of that as well. Luckly it’s all easy. This following is all from your home directory on a fresh install of Debian:

Read the rest of this entry »

Noah Slater has been very busy upgrading the CouchDB build system and the changes have been merged to the trunk version tonight, so it’s time to update my test box build scripts. This lot replaces the earlier stuff found here

sudo apt-get install libicu36 libicu36-dev libreadline5-dev
sudo apt-get install subversion-tools xsltproc automake libtool
svn -r 305 co http://couchdb.googlecode.com/svn/trunk/ couchdb
cd couchdb
./bootstrap
./configure --with-erlang=/usr/local/lib/erlang
make
sudo make install

Starting up CouchDB is now more straightforward:

couchdb

I thought I’d continue the whirlwind guide to Mnesia that I began in Getting started with Mnesia. I have no idea how many of the thousands of readers actually found the last part useful. At least one, judging by the comments, but more to the point it’s rather handy for me to write this stuff down as I’m flitting between various new (to me) things at the moment.

Read the rest of this entry »

I had to post this, mainly for the entertainment value but also as a reminder to myself not to start playing with new stuff after a long hard day of ‘real’ development. I just needed a quick bit of code that starts out with a string of the form “inc=45,56,76,102&exc=10,11,15,98″ and spits out two lists of integers. I somehow ended up with this:

% On entry, A#arg.querydata is a string of the form "inc=n,n,n&exc=n,n,n
QueryArgs=string:tokens(A#arg.querydata,"&"),
QueryArgs2=lists:map(fun(T) -> string:tokens(T,"=") end,QueryArgs),
[[_|IncP]|_]=lists:filter(fun(T) -> [N|_Rest]=T,"inc"==N end,QueryArgs2),
[[_|ExcP]|_]=lists:filter(fun(T) -> [N|_Rest]=T,"exc"==N end,QueryArgs2),
IncS=string:tokens(lists:nth(1,IncP),","),
ExcS=string:tokens(lists:nth(1,ExcP),","),
Includes=lists:map(fun(T)->list_to_integer(T) end,IncS),
Excludes=lists:map(fun(T)->list_to_integer(T) end,ExcS).
% On exit, Includes=[n1,n2,...] and Excludes=[n1,n2,...]

Just as shocking as the code are the facts that a) it took me half an hour to make it work, and b) it actually works at all. Worse still, I don’t even need the code, since ultimately it will all be handled via JSON-RPC and not some nasty ad-hoc HTTP query processing – I just wanted to do a quick test in the meantime. The mission was accomplished, but surely there’s a far more elegant way to do the above. Unfortunately, I’m not going to find it today. I will be compelled to come back to it of course, and when I do I hope I can keep the lovely [[_|IncP]|_] part.

One of the first things that struck me when I was first browsing through the documentation for the Erlang lists module was the lack of support for parallelism. Functions such as lists:map are clearly prime candidates for this, although obviously you might sometimes require a serial implementation.

Read the rest of this entry »

Though Mnesia, Erlang’s “built-in” database, has a lot going for it, one area that definitely doesn’t stand out is the documentation so here is the whirlwind tour I could have used when getting started. I won’t dwell on any particular subject, so consider this a starting point for further research – the documentation is actually ok once you know what it is you’re looking for!

Read the rest of this entry »

I decided to hack together a quick GUI front end for CouchDB to help with my tinkering around. Most people will probably groan and stop reading now, because I implemented it in C#/.NET. Although I’m not going to apologise for that, I do feel the need to justify it:

Read the rest of this entry »

More CouchDB

At the end of the my last post I hadn’t managed to get all my test data uploaded to the CouchDB database. It turns out there was not one problem, but two.

Read the rest of this entry »

There’s been a lot of talk about CouchDB lately, some of it in a rather foolish “this heralds the death of the RDBMS” style. A more sensible view is that it’s an interesting database that could be very useful in some circumstances. I’m particularly interested because it seems to use a number of techniques I’ve implemented and developed in my own database engine. Although I am very fond of mine, it wasn’t designed to scale, and as such it doesn’t. Anyway, that’s a topic for another day, so back to CouchDB:

Read the rest of this entry »

I decided to switch my multi-virtual machine test/dev setup over to a minimal Debian install, not least because I couldn’t keep my mind off the fact that I was carting around a full desktop installation along with various ‘pretty’ desktop backgrounds, system administration for GUI-monkeys applications, and god knows what else. One batch of this stuff is bad enough, but repeated N times it’s too much for me to handle.

Read the rest of this entry »

« Older entries