You cannot post messages because only members can post, and you are not currently a member.
|
If Condition vs. Multiple Function Clauses
|
| |
Hi List,
I'm currently working myself through the "Études for Erlang" book [1] and in exercise it wks's to write a recursive function, calculating the greatest common divisor for two numbers N and M. The suggested solution is a single gcd/2 function with an If condition and recursion:
gcd(M, N) ->... more »
|
|
Records / Proplists / JSON / BSON
|
| |
Hi, We have built a number of projects recently that have a mongodb backend, an HTML / javascript frontend and Erlang in the middle - pretty standard stuff. One of the things the we end up repeating over and over is mapping data from BSON (the mongo format) to Records (our preferred in-memory format for Erlang) and JSON (to send / receive from the browser). To add to the mix, we also like using proplists in configuration files, so have mappings from those to records as well.... more »
|
|
Compiler list comprehension optimizations
|
| |
I have some questions about compiler optimizations on list comprehensions.
The efficiency guide says that list comprehensions that are "neither assigned to a variable, nor passed to another function, nor returned" will be optimized by the compiler to avoid the list construction.
However, Dialyzer sometimes complains about such list comprehensions... more »
|
|
Couple Riaks question
|
| |
- Should I create a connection pool or it's OK to create {ok, Pid} =
riakc_pb_socket:start_link("12 7.0.0.1", 8087) on each web request
It's very strange and pity that erlang native client doesn't support all
features Java one has:
[link]... more »
|
|
child_setup high CPU usage
|
| |
I'm seeing an issue where under what should be light load I see two child_setup processes spawned by Erlang using 100% CPU (combined) and making my machine unresponsive for a number of seconds.
I recently updated to R16B and never saw this issue on previous releases.
This happens when processing files sent over ssl from a client. My code uploads the files to S3 (using erlcloud, which uses httpc). If the client uploads only a few files it works fine. But if the client uploads about 6 files in a row then I see the behavior where the two child_setup processes consume 100% CPU. I would expect the only CPU intensive parts of this operation to be the calls to digest and MAC the S3 request. I'm not aware of any calls made to the shell in this scenario.... more »
|
|
driver_create_port overhead and driver_caller
|
| |
I have linked in driver which deals with embedded library, can make calls some in outputv, some using driver_async, but now have to support some other long running operations requiring thread affinity and (more importantly) need to receive multiple commands/actions from Erlang client code associated with long running transaction in library API. Currently considering to spawn (or pool) some new thread for these (long running tasks) and using ErlDrvMutex and simple queue/array data structure to communicate with it from outputv, but there is also affinity between Erlang callers process id and long running task thread (since caller originates with erlang:send/2 direct to port, which is accessed via ets table), because replies are sent via driver_send_term so need to also store client's process id in ErlDrvTermData and use driver_monitor_process to ensure that if client dies, work is rolled back. IIRC driver_caller not thread safe, so need to only use this in outputv is that still... more »
|
|
Unloading all modules from ERL session
|
| |
Hi, If an Erlang session on command prompt is running and I call a function from a module, the module gets loaded. If I realize that there is a bug, and while leaving the erl session running, change the code and recompile the module and amny other modules, the older version of the module remains loaded in teh erl session.... more »
|
|
exception when no match found
|
| |
I think that erlang would just bypass the entire case..of instead of throw an exception when no match found. It's can economize more lines of code.
______________________________ _________________
erlang-questions mailing list
erlang-questi...@erlang.org
[link]... more »
|
|
erlang-questions Digest, Vol 117, Issue 3
|
| |
I'm not looking too closely at the errors, so this may not be all you
need, but, all of the REST callbacks can return a tuple of {halt,
Response, State}, which is the correct idiom to use when you want to stop
the REST handler from continuing (so in your code you'd return {halt,
Resp3, State}).... more »
|
|
|