erlang

Starting two mochiweb servers with a single script file

I have a basic web server that I generated from the mochiweb framework. To start it I use the start.sh script that the framework automatically generates. Everything works fine and the server starts up. Now I have one more mochiweb server that I want to start along with the first one. Again, this starts up perfectly standalone with its st...

Which programming languages support hot code swapping and/or sandboxing?

Hello, I would like to write a web based MMO game that will allow users to write AI and run it as part of the game. I plan to use Html5 for graphics and want this to be web based so it can be accessed from smartphones. I need to find a programming language that will support sandboxing, concurrency, hot code swapping, and a large librar...

erlang - how to limit message queue or emulate it?

Right now I am doing Process ! Message, but as i googled a bit, a message queue size is only limited to memory. I have a tree of processes where leaves generate messages and feed up to the root and i need to limit queue or switch to some another method of doing the same. more of it, sometimes Process gets messages from one leaf and some...

esrcript cron blues

I have an escript file which runs fine from the command line, i.e.: ./escript_file It is meant to be cron friendly and all paths are explicit but when I run it, it fails to compile saying that there are bad attributes. The bad attributes in question are macro definitions: -define(COOKIE, 'somecookie'). The Answer Thanks to Geoff ...

Mapreduce with Riak

Does anyone have example code for mapreduce for Riak that can be run on a single Riak node. ...

Erlang's maximum number of simultaneous open ports?

Does the erlang TCP/IP library have some limitations? I've done some searching but can't find any definitive answers. I have set the ERL_MAX_PORTS environment variable to 12000 and configured Yaws to use unlimited connections. I've written a simple client application that connects to an appmod I've written for Yaws and am testing the n...

Stop Erlang Daemon

Besides running $ killall -9 beam.smp, how can I kill an Erlang node programmatically when I know its -sname? If I don't want the heartbeat monitor to restart the process, how can I ensure that whatever answer is given for the above question will also kill the heartbeat? Is there a decent guide to deploying Erlang as a daemon? ...

Erlang Binary Packet

Hey, I'm very new to Erlang, and I am converting some of my PHP stuff, and I can't figure this one out. Here is the function in PHP: public function raw_send($string1, $string2 = NULL, $type = SERVERDATA_EXECCOMMAND) { $data = pack('VV', $this->get_request_id(), $type) . $string1 . chr(0) . $string2 . chr(0); // build data $packet = ...

Getting two erl shells to talk

I want to be able to have two Erlang shells to talk. I'm running on OS X. I tried the tut17 example here: http://ftp.sunet.se/pub/lang/erlang/doc/getting_started/conc_prog.html I've also tried: $ erl -sname foo and then in a new Terminal: $ erl -sname bar (bar@elife)1> net_adm:ping(foo@elife). pang Any ideas? ...

Could CouchDB benefit significantly from the use of BERT instead of JSON?

I appreciate a lot CouchDB attempt to use universal web formats in everything it does: RESTFUL HTTP methods in every interaction, JSON objects, javascript code to customize database and documents. CouchDB seems to scale pretty well, but the individual cost to make a request usually makes 'relational' people afraid of. Many small busine...

Redirect output from erlang shell into a file

Is there a way to redirect data printed by io:format() from erlang shell into a file ? I know that I can open a file (IoDevice) and write data directly into it, but it requires code change and I don't want to do now. ...

erlang "erl_nif" functionality

I have interfaced Erlang mainly through port drivers but now with the advent of the erl_nif functionality, I am wondering if I should invest in Port Drivers anymore. Will the erl_nif functionality boom or bust like FFI? ...

couchdb hovercraft installation

hello all Im about to start using couchdb directly from erlang, and have been reading the hovercraft APi for some time... today I sat down to actually install it and have realized that there's hardly any documentation out there that deals with how to go about doing it... there is a very brief instruction here: http://github.com/sendtopms...

Python example of Joe's Erlang websocket example

I've just been working through the erlang websockets example from Joe Armstrong's blog I'm still quite new to erlang so I decided to write a simple server in python that would help teach me about websockets (and hopefully some erlang by interpreting joe's code). I'm having two issues: 1) Data I receive from the page includes a 'ÿ' as th...

gen_server with a dict vs mnesia table vs ets

Hi, I'm building an erlang server. Users sends http requests to the server to update their status. The http request process on the server saves the user status message in memory. Every minute the server sends all messages to a remote server and clear the memory. If a user update his status several times in a minute, the last message ove...

How to compile erlang code loaded into a string?

I have a generated string that contains the code for an erlang module. Is there a way to compile the generated module straight from the string? Or is there a way to convert the string into the format needed for compile:forms/1? Or will I have to save it to a temp file first and then compile it with compile:file/1? Alternatively, I ...

How to catch Exception Message in Erlang?

This is the Exception message thrown by Gen_server when its not started. ([email protected])32> R11 = system_warning:self_test("SysWarn"). ** exception exit: {noproc, {gen_server,call, [system_warning_sup, {start_child, {system_warning_SysWarn, ...

Simpler way to format bytesize in a human readable way?

Hi, I came up with the following solution to format an integer (bytesize of a file). Is there any better/shorter solution? I esacially don't like the float_as_string() part. human_filesize(Size) -> KiloByte = 1024, MegaByte = KiloByte * 1024, GigaByte = MegaByte * 1024, TeraByte = GigaByte * 1024, PetaByte = TeraByte * 1024, ...

spawning process on erlang cluster

If I spawn a new process on a busy node in an erlang cluster and other nodes are idle will the process automatically be spawned on one of the free nodes? Update: I found another question similar to this one too: http://stackoverflow.com/questions/662131/using-erlang-how-should-i-distribute-load-amongst-a-cluster ...

Is there a list of all the frameworks and libraries available for Erlang anywhere?

Is there a list of all the frameworks and libraries available for Erlang anywhere? ...