erlang

How does Erlang's support for *transparent* distribution of actors impact application design?

One of the features of the actor model in Erlang is transparent distribution. Unless I'm misinterpreting, when you send messages between actors, you theoretically shouldn't assume that they are in the same process space or even co-located on the same physical machine. I've always been under the impression that distributed, fault tole...

ETS matching probem

I am new to Erlang, and I am learning ETS. I have run into a weird problem. I did: Sometab = ets:new(sometable, [bag]). ets:insert(Sometab, {109, ash, 8}). Then I typed: ets:match(Sometab, {109, ash, '$1'}). However instead of getting 8 - I am getting: ["\b"] as output! What am I doing wrongly? ...

Exception error: undefined function in Mochiweb/Erlang

After seeing this article, I have been tinkering with mochiweb. While trying to replicate what's done in the article - basically setting up a mochiweb server, having two erlang nodes, and then calling a function defined in one node in the other (after setting net_adm:ping() between the two nodes so they know each other). I was able to f...

Differences between set and ordered_set in Mnesia?

What are the differences between a table of type set, and a table of type ordered_set? I'm interested in the differences in read/write performance, what the ordering is based on, the effects across distributed nodes, and such. ...

How to monitor a remote erlang node which was down and is restarting

My application runs in an erlang cluster - with usually two or more nodes. There's active monitoring between the nodes (using erlang:monitor_node) which works fine - I can detect and react to the fact that a node that was up is now down. But how do I then find out that the node has restarted and is back in business? I can of course peri...

how to include yaws file inside the yaws file..

Hi, i have one yaws file(let say a.yaws) inside that I have a lot of function which i m using again and again .so i have decided to put those common function inside the other yaws file (let say common.yaws) and include this yaws to a.yaws. so what is the correct syntax for this. i m using it but seems not including the file -i...

Declaration of ETS in Erlang

The following code gives me an error: "syntax error before: Some_ets" -module(tut). -export([incr/1]). Some_ets = ets:new(?MODULE, [bag]). incr(X) -> X+1. But I am able to delcare the ETS within a function, like: -module(tut). -export([incr/1]). incr(X) -> Some_ets = ets:new(?MODULE, [bag]), X+1. Can't I declare a E...

Erlang Hash Tree

Hello Everyone, I'm working on a p2p app that uses hash trees. I am writing the hash tree construction functions (publ/4 and publ_top/4) but I can't see how to fix publ_top/4. I try to build a tree with publ/1: nivd:publ("file.txt"). prints hashes... ** exception error: no match of right hand side value [67324168] in function ...

How does one use cached data in a functional language such as Erlang?

I've been reading a bit lately about functional languages. Coming from 10+ years of OO development, I'm finding it difficult to get my head around how on earth one can point the pure functional approach (i.e. the same method called with the same parameters does the same thing) at a problem where typically (in an OO program) I would need ...

Erlang: how to set or check TTL in UDP packets?

In Erlang, how can I: Set the TTL for sent UDP packets? Retrieve the value of the TTL for received UDP packets? I need to do this to implement GTSM ...

mochijson2 examples!

I'm a two-week old infant with regards to Erlang and Mochiweb. Earlier I had a system running on PHP and soon I realised that it wasn't going to be able to handle the kind of load I was expecting. So I decided to switch the backend to a Mochiweb based server. Right now I need to know how to implement JSON with Mochiweb. I'm fully aware o...

Handling user sessions with Mochiweb

I have a PHP based application running. The user logins, and does some actions. I have a reverse proxy set up to forward certain requests alone to be handled by the mochiweb server - e.g. any request URL with mysite.com/mochiweb gets routed to the mochiweb server. Now, my question is how do I authenticate this request using the session...

PDF processing library in Erlang

I am looking for a PDF processing library written in Erlang, but I was unable to find any yet. ErlGuten, the only library I found could only generate PDFs not process them. Anyone aware of such library? ...

Should I re-write the webapp front end in Erlang ?

I have a Rails webapp [deployed on Heroku] which makes a series of HTTP calls to other sites on a repeated basis, using Heroku's rake:cron feature. The current situation isn't ideal; the rake:cron process is executed in a single thread, which means HTTP calls are made sequentially; which means in turn that there's a long time between cal...

Nginx Reverse Proxy to custom Mochiweb application

I have Nginx as my front-end web server listening on port 80. And certain requests, I've set up nginx to reverse proxy it to a mochiweb based web server that I've written, listening on Port 8000. My nginx configuration for this looks like this: location /mymochiserver { proxy_pass http://127.0.0.1:8000; ...

What is the best way to learn Erlang?

Other than specific projects (although those are welcome as well)... What tools, books, articles, and other resources should I have at my desk to help me learn Erlang? Also, are there mobile runtimes for Erlang? Please point me in the right direction. Thanks. Note: yes, I have visited Erlang and Wikipedia, but I'd like to hear some ...

Is it easy to write traditional concurrency problems in Erlang?

Hi, I have followed an operative system course where we learned usual concurrency problems as: the dinning philosophers problem, producer-consumer problem, readers & writers problem... Since their main purpose is to protect a shared variable, does it make sense to try to solve these problems in Erlang? Or maybe I just need more Erlang...

Websites & Web Applications Using Erlang

I was wondering if people could post some examples of interesting websites and web apps that were built with Erlang? I can start with a few Erlang based sites: twitterfall.com - Waterfall of Tweets vimagi.com - Cooperative painting. twoorl.com - Twitter clone. dayfindr.com - Collaborative meeting scheduling. beerriot.com - Beer enthus...

Using Erlang to manage multiple instances of an external process

I have a single threaded process, which takes an input file and produces an output file (takes file in and file out paths as inputs). I want to use Erlang to create, manage and close multiple instances of this process. Basically, whenever the client process need to produce the output file, the client connects to the Erlang server with ...

Parsing HTML with Erlang

I am trying to write my first Erlang application, and I need to parse HTML into some sort of internal format. I have had a look at the merl module, but as far as I can see it is only capable of parsing XML. When I supply HTML to merl, it chokes on the non symetric tags. Which library should I be using for this? ...