How do you flush the io buffer in Erlang?
For instace:
io:format("hello") or
io:format(user, "hello")
This post seems to indicate that there is no clean solution.
Is there a better solution than in that post?
...
I am continuing to delve into Erlang. I am thinking of starting my next web project using Erlang, and at this stage the only thing I will really miss from Ruby on Rails is ActiveRecord.
Is there a good alternative technology for Erlang?
Update:
The closest I have come to a solution is to ErlyDB, a component of ErlyWeb.
ErlyDB is a...
I'm looking for some light reading. For those of you have far more Erlang experience than I, what are the best source files to read out on the web? If someone were going to learn correct Erlang/OTP principles only from reading raw source, what code should he start with and where should he go beyond that for a deep and advanced understand...
A took a look at http://erlang.org/doc/apps/inets/http%5Fclient.html and found the following:
An ordinary asynchronous request. The result will be sent to the calling process on the form {http, {ReqestId, Result}}
5 > {ok, RequestId} =
http:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).
In this case th...
I ported most of my app to OTP behaviors, but I'm stuck. I can't figure out how to do selective receives using a gen_server. If none of the callback function clauses match a message, rather than putting the message back in the mailbox, it errors out!
Now, everywhere I go, folks laud selective receives. Everywhere I go, folks laud OTP. C...
I'm thinking of a web app that uses CouchDB extensively, to the point where there would be great gains from serving with the native erlang HTTP API as much as possible.
Can you configure Apache as a reverse proxy to allow outside GETs to be proxied directly to CouchDB, whereas PUT/POST are sent to the application internal logic (for san...
I'm trying to write a simple Thrift server in Erlang that takes a string and returns a string.
Everything seems to be working up to the point of calling my function:
handle_function(Function, Args) when is_atom(Function), is_tuple(Args) ->
case apply(?MODULE, Function, tuple_to_list(Args)) of
ok -> ok;
Reply -> {reply, Reply}
end.
t...
With all the hype around parallel computing lately, I've been thinking a lot about parallelism, number crunching, clusters, etc...
I started reading Learn You Some Erlang. As more people are learning (myself included), Erlang handles concurrency in a very impressive, elegant way.
Then the author asserts that Erlang is not ideal for nu...
Hi I'd like to pick up one FP language (it's always a pain when you work in a position that does not require you learn much), and after doing some research, I felt Erlang and OCaml are the two that I'd really like to get my feet wet for the following reasons:
1) I work mainly on high-availability web server back-end system in C++. I hea...
I want to call xyz with the name of a function to be invoked.
-module(sample).
-export([xyz/1]).
xyz(Name) -> Name().
p() -> "you called p".
g() -> "you called g".
But I get the following error:
1> c(sample.erl).
./sample.erl:6: Warning: function p/0 is unused
./sample.erl:7: Warning: function g/0 is unused
{ok,sample}
2> sample:xy...
I want to define a large record using a composite of smaller records, in an attempt to make the declaration more readable.
I'm trying to do something like this:
-record(molly, {xx=0, yy=1}).
-record(harry, {#molly, zz=2}.
The above of course does not compile :-(
Is there some way to do this ??
...
I've been working non-stop for the last three days on a completely managed interface to Erlang. At this point, I've decided that there simply must be an easier way. I've got a little over 3000 lines and it's not even in a compilable state yet. To be honest, I'm getting lost in my own code.
So, I then remembered that Erlang has a C libra...
I am doing Comet chat with Erlang. I only use one connection (long-polling) for the message transportation. But, as you know, the long-polling connection can not be stay connected all the time. Every time a new message comes or reaches the timeout, it will break and then connect to the server again. If a message is sent before the connec...
Suppose I have something like this :
try code_that_fails()
catch _:_ -> .....
How do I print the stacktrace in the catch block? That block catches all exceptions, but I don't know how to print the stack...
Can you help me?
...
I want to use run_erl to start up a daemon version of my release, but I don't want to have to officially install it, and create an entry in $ROOTDIR/releases and all that. Unfortunately, run_erl seems to depend on a little bootstrapping stuff that happens in release_handler:unpack_release/1. Is there any way to use run_erl on a release t...
I've got a bare-minimum Erlang port driver:
erl_driver_bridge.c -> erl_driver_bridge.dll
#define __WIN32__
#include "erl_driver.h"
typedef struct {
ErlDrvPort port;
} erl_driver_bridge_data;
static ErlDrvData bridge_start(ErlDrvPort port, char *buff) {
erl_driver_bridge_data* d =
(erl_driver_bridge_data*)driver_alloc...
I cannot get wxErlang to work at all. Do i need to include a module. Can't find any basic information relating to it. Please help. I am look for a very basic example of a module.
the error I am getting is
undefined function wx:start/0
...
When my app crashes, I get a crash report that takes 5 minutes to scroll by. What's the best way to handle this?
...
Is it possible for a receive statement to have multiple timeout clauses, and if so, what is the correct syntax?
I want to do something like
foo(Timout1, Timeout2) ->
receive
after
Timeout1 ->
doSomething1();
Timeout2 ->
doSomething2()
end.
where, depending on which of Timeout1 or Ti...
I am working on a project that will require internationalisation support down the track. I want to get started on the right foot with UTF support, and I was wondering what the best practice for handling UTF in Erlang is?
From my current research it seems there are a couple of issues with Erlang's built in string handling for some use ca...