Main Page

From Erlang Community

Your Erlang Community Site

Welcome to trapexit.org, the Erlang community site where you can read news and weblogs related to Erlang/OTP, discuss projects, issues and ideas with other Erlang developers, and read and publish articles and HowTos related to Erlang/OTP.

Trapexit News

Timed supervisor for scheduled process execution

Serge has contributed a supervisor module in the User Contrinution section allowing you to schedule the creation and execution of children. You can now run {M,F,A} event Mon & Tue between 9am and 5pm, allowing up to 3 failures within 20 seconds with a restart delay of 4s! To download it (and upload your own contributions), visit Trapexit's User Contributions section.

What is Erlang and OTP?

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance. Originally developed at Ericsson, it was released as open source in 1998.

OTP is set of Erlang libraries and design principles providing middle-ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools. These tools and applications distributed by Ericsson are complemented by numerous other open source projects.

Here is an example of Erlang code:

-module(beersong).
-author('BillClementson').
-export([sing/0]).
-define(TEMPLATE_0, "~s of beer on the wall, ~s of beer.~n"
                    "Go to the store and buy some more," 
                    "99 bottles of beer on the wall.~n").
-define(TEMPLATE_N, "~s of beer on the wall, ~s of beer.~n"
                    "Take one down and pass it around, ~s"
                    " of beer on the wall.~n~n").

create_verse(0)      -> 
    {0, io_lib:format(?TEMPLATE_0, phrase(0))};
create_verse(Bottle) -> 
    {Bottle, io_lib:format(?TEMPLATE_N, phrase(Bottle))}.

phrase(0)      -> ["No more bottles", "no more bottles"];
phrase(1)      -> ["1 bottle", "1 bottle", "no more bottles"];
phrase(2)      -> ["2 bottles", "2 bottles", "1 bottle"];
phrase(Bottle) -> 
     lists:duplicate(2,integer_to_list(Bottle) ++ " bottles") ++ 
                     [integer_to_list(Bottle-1) ++ " bottles"].
bottles() -> lists:reverse(lists:seq(0,99)).
sing() ->
    lists:foreach(fun spawn_singer/1, bottles()),
    sing_verse(99).
spawn_singer(Bottle) ->
    Pid = self(), 
    spawn(fun() -> Pid ! create_verse(Bottle) end).
sing_verse(Bottle) ->
    receive
	{_, Verse} when Bottle == 0 ->
	    io:format(Verse);
	{N, Verse} when Bottle == N ->
	    io:format(Verse),
	    sing_verse(Bottle-1)
    after 
	3000 ->
	    io:format("Verse not received after 3 seconds"
                      " - re-starting singer~n"),
	    spawn_singer(Bottle),
	    sing_verse(Bottle)
    end.


Starter

Good places to start on trapexit.org

HowTo documents - Tutorials and Guides for Erlang developers
Erlang Cookbook - A collection of Erlang solutions to specific problems
Erlang Concepts - Articles dealing with specific Erlang aspects
Erlang Best Practices - Articles dealing with best practices in Erlang
Erlang Articles - Articles of interest to Erlang developers and testers
ErlangJobs - Erlang and Erlang related Jobs
Links to Erlang related sites outside Trapexit
RSS Feeds related to Erlang, including blogs and software development

Latest Forum Posts

Erlang

fastest binary reverse
  (Tue Jan 06, 2009 11:15 am)
RE: programmatic method to build a record
  (Tue Jan 06, 2009 10:51 am)

Open Telecom Platform (OTP)

RE: religous question: pipe or services?
  (Tue Dec 30, 2008 11:28 am)
RE: religous question: pipe or services?
  (Tue Dec 30, 2008 7:39 am)

Advanced Erlang/OTP

RE: qlc join query results
  (Tue Dec 09, 2008 8:14 pm)
qlc join query results
  (Mon Dec 08, 2008 11:45 pm)

User Contributions

RE: Leex - a lexical analyser generator
  (Thu Jan 01, 2009 9:56 pm)

Improvements

Erlanguid.com
  (Mon Nov 24, 2008 8:43 pm)

Latest Planet Entries

Trapexit's Erlang Blog Filter: Sendfile for Yaws
  (Mon Jan 05, 2009 7:22 am)
Programming in the 21st Century: Revisiting "Purely Functional Retrogames"
  (Sun Jan 04, 2009 6:00 am)
Caoyuan's Blog: A Case Study of Scalability Related "Out of memory" Crash in Erlang
  (Sun Jan 04, 2009 2:59 am)
Trapexit's Erlang Blog Filter: More SHA in Erlang
  (Sat Jan 03, 2009 5:11 pm)
Erlang Inside: BeepBeep Is Another New Erlang Framework
  (Sat Jan 03, 2009 12:14 pm)

Latest Wiki Changes

ErlangParis
  (Mon Jan 05, 2009 11:49 am)
Building a Non-blocking TCP server using OTP principles
  (Fri Jan 02, 2009 3:08 am)
SideEffectsInGeneration
  (Tue Dec 30, 2008 11:28 am)

Mailing Lists Posts

Erlang questions mailing list

Flash client communication with Erlang Server problem
  (Sun Jan 04, 2009 11:32 pm)

Yaws mailing list

json decode problem
  (Tue Sep 02, 2008 5:02 pm)

Erlyweb mailing list

RE: Postgres
  (Sun May 25, 2008 2:12 pm)

RabbitMQ mailing list

RE: RabbitMQ perfomance testing & troubles
  (Fri Apr 25, 2008 6:15 am)


Erlang/OTP Projects
Personal tools