erlang

Erlang: What does question mark syntax mean?

What does the question mark in Erlang syntax mean? For example: Json = ?record_to_json(artist, Artist). The full context of the source can be found here. ...

Erlang: Removing Fields in Records

Say you have an Erlang record of the following kind for songs: rd(song, {artist, title, album}). Song = #song{artist = <<"oasis">>, title = <<"wonderwall">>, album = <<"morning glory">>}. But you want to reformat the song records to include only the artist and title. How would you go about removing a field in Erlang records (in this ...

Erlang source code guide

I am interested in delving into Erlang's C source code and try to understand (at least at a moderate level) what is going on under the hood. Where can I find info on the design and structure of the code? ...

Can you critique my solution for the "ring benchmark" problem from J. Armstrong's book?

I am making my way through Joe Armstrong's book on programing Erlang. I came up with the following answer for the ring benchmark question. The code works but I am not sure if it is "Erlangic" (for lack of a better word). In particular I am not sure if I am using too many Guards. Can more experienced programmers critique the code? I had...

Converting records to proplists (and back)

I have a Erlang webapp, based on Mochiweb and Mnesia, which consumes and emits JSON. It makes sense to store records in Mnesia; however Mochiweb/Mochijson require data in proplist format. So I end up with a large amount of boilerplate code: -record(foobar, {name, value}). record_to_proplist(Record)-> [{name, Record#foobar.name}, ...

How is erlang fault tolerant, or help in that regard?

How is erlang fault tolerant, or help in that regard? ...

Erlang - case construction

I'm new to Erlang and I've tried some Erlang constructions. My program should behave something like that: if x == 42: print "Hi" else: print "Hello" Here is my code in Erlang -module(tested). -export([main/0]). main() -> {ok, X} = io:fread("","~d"), case X == 42 of true -> io:fwrite("Hi\n"); false -> io:fwrite("H...

Emacs/TextMate code completion for Erlang?

ESense looks dead; what are your recommendations for Erlang code completion in Emacs? It doesn't have to be fancy (ESense built an index from the Erlang source); even something that just uses Erlang's module_info/0 and module_info/1 functions for introspection of function names would help. If one isn't available in Emacs, can you recomm...

What is the faster ( and slower ) language to do this ?

Possible Duplicate: What is the faster ( and slower ) language to do this ? I want to know what is the faster ( execution time ) language for this simple script ( executed through ajax ): Pseudocode: // start code var str = GET['string'] INSERT SQL SELECT SQL // end code This is a very simple script with 2 simple query. ...

Ensuring an event is handled while switching gen_event handlers in Erlang/OTP

Let's say I have several versions of a gen_event handler and want to change them around while the program is running: -module(logger_all). -behaviour(gen_event). -export([init/1, handle_event/2, terminate/2]). init(_Args) -> {ok, []}. handle_event({Severity, ErrorMsg}, State) -> io:format("***~p*** ~p~n", [Severity, ErrorMsg]), ...

PHP Erlang Bridge # ei_connect error

I installed the mypeb php apache erlang and more. mypeb is here : http://code.google.com/p/mypeb/ I need to connect Erlang node and call it. then my php code is : $link = peb_connect('[email protected]', 'abc'); if (!$link) { die('Could not connect: ' . peb_error()); } [email protected] is my Erlang node but also notice Could ...

Erlang io:formatting a binary to hex

Can I format an Erlang binary so that each byte is written in hex? I.e., > io:format(???, [<<255, 16>>]). <<FF, 10>> I don't see an obvious way to do it in io:format documentation, but perhaps I am simply missing one? Converting a binary to list and formatting its elements separately is too inefficient. ...

returning the max of a list

I am trying to return the max of a list. I have the following code list_max([]) -> []; list_max([H|T]) -> list_max(H, T). list_max(Temp, []) -> Temp; list_max(Temp, [H|T]) when H > Temp -> Temp = H; list_max(Temp, T). But am struggling to relate to Erlang. How do I assign something to temp and replace it to the hig...

How do you support per-page sidebar content in Zotonic?

I would like to have per-page sidebar content in Zotonic: Links White papers Webinars What is a good way to do this and what kind of template snippets would I need to make it work? ...

Best .NET language for Concurrent programming

This may be a question that others have seen, but I am trying to find the best language for concurrent programming that can run on the .net platform. I have been doing side development in erlang to get a feel for the language and have loved how easy it is to get a stable concurrent or even distributed system up. It led me to scala wh...

Actor-model library, framework, or language written in C?

The Actor-model was defined in a 1973 paper by Carl Hewitt, but has been popularized by the Erlang language. I believe the parts of Erlang that aren't self-hosted (written in Erlang) are written in C; BEAM and HiPE are written mostly in C. What are some alternative Actor-model implementations (languages, frameworks, or libraries) that ar...

Erlang gen_tcp:recv(Socket, Length) semantics

After reading this answer, I want to understand if the same applies to the calls to gen_tcp:recv(Socket, Length). My understanding of the documentation is that this if more than Length bytes are available in the buffer, they remain there; if there is less than Length bytes, the call blocks until enough is available or connection closes. ...

Why does erlang use random ports for distribution

When nodes connect to each other on Erlang, why not just use the original port the connection is made on? Why cause the firewall issues that using random ports causes. I know how to get around this, but I don't understand why. Edit: I realize that this is frequently done, and this isn't necessarily an Erlang question, but it was a desig...

Are most Erlang applications such as MochiWeb, Riak, RabbitMQ, Zotonic, ejabberd and CouchDB OTP applications?

Just started reading the OTP chapter on the great Erlang book by Francesco Cesarini. Are most Erlang applications such as MochiWeb, Riak, RabbitMQ, Zotonic, ejabberd and CouchDB OTP applications? ...

Does IV need to change while encrypting multiple packets in CFB mode?

In the Erlang crypto library, there is no aes_cfb_ivec function. Does it mean that the same IVec should be used for multiple rounds? Or should the encrypted data from the last step be used, as in the example of "DES in CBC mode" at the end of the linked page? ...