[ Content | Sidebar ]

Archives for erlang

Intro to gen_fsm and gen_server

Emacs

erl process handling commands

Note to self: some handy erlang shell commands for dealing with processes.
process_info(Pid)
i()
erlang:processes(), or better yet, rp(erlang:processes()). Sometimes long lists show “…” to represent the tail elements. Wrapping in rp() shows the whole list.
Finally, exit(Pid, kill) to kill the process represented by Pid. For a while I thought that exit(Pid) sufficed, but some experimentation [...]

man page support in erlang-mode

I want to record what I had to do to get man page support working correctly in emacs erlang-mode under Ubuntu Hardy Heron.
First, set the erlang root directory for erlang-mode:

(setq erlang-root-dir “/usr/lib/erlang”)

Next put a symbolic link to the man pages in the erlang root directory.

cd /usr/lib/erlang
sudo rmdir man #the man dir installed by [...]

upcoming Pragmatic book on Erlang

Kevin Smith of Hypothetical Labs has let the cat out of the bag.

I’m currently writing a Erlang book for the Pragmatic Bookshelf. The book’s focus will be practical development using Erlang. It will cover OTP, mnesia, web programming (Yaws, Mochiweb, Erlyweb), and a few miscellaneous topics such as XML parsing and unit testing.

I [...]

OOP in erlang

I read this quote on the blog of Isaiah Perumalla, in the post called My Journey to Smalltalk:

“OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which [...]

ejabberd

I’m interested in learning a bit about the Jabber/XMPP protocol. There’s only one way I know to do so, and that is to mess with it. So I decided to install a Jabber server, ejabberd.
Installing ejabberd on Ubuntu is easy, but I hit an immediate roadblock: ejabberd has a web-based administrative interface, but following installation, [...]

recursion in erlang

Some months ago Kevin (check him out at Hypothetical Labs) started the RDU erlounge, a monthly meeting of area erlang enthusiasts. The meetings were organized via a mailing list. Recently one of the guys on the list, Jared (Alloy Code), asked for a bit of help. He was working an exercise (a function to compute [...]

sum of file sizes

This was recently posted to the erlang-questions mailing list
I am trying to grok how to write a simple ‘du’ like program that walks a directory structure ( not just one but all nested directories ) and calculates a sum of all the file sizes. I found some sum() code that I understand how that works.
I [...]

tools

I’ve spent a lot of time since the last posting on tool-chain issues. I decided to go with emacs as my editor/IDE, and darcs as my version control system. Since I mostly use a Mac, I went with Aquamacs as my emacs. It is hands down the best looking emacs I have ever seen.
Hacking emacs [...]

generating random permutations

I want to consider the simulation of dealing a deck of cards. The deck is simply the list of integers D = [1,2,...,52]. Dealing the cards amounts to generating a random permutation of D.
Here’s how I would do it in java.
public class Shuffle {
private static java.util.Random rand = new java.util.Random();
[...]