erlang

Error while using lhttpc from erlang shell

怎甘沉沦 提交于 2019-12-11 15:02:02
问题 When I run following in erlang shell lhttpc:request("http://www.google.co.uk", get, [], infinity). I get this error ** exception exit: {noproc,{gen_server,call, [lhttpc_manager, {socket,<0.44.0>,"www.google.co.uk",80,false}, infinity]}} I'm a completely new to erlang and only thing I understand from the above is that some gen_server module has exited with some error. How do I fix this error? 回答1: I found the answer on the erlang channel of freenode. I need to run following commands before

Rebar fails compiling / bulding from source on R16B02

霸气de小男生 提交于 2019-12-11 14:51:28
问题 Running Erlang R16B02 (its installed through source and compiled, erl is on path). Recompile: src/rebar_utils Recompile: src/rebar_xref Uncaught error in rebar_core: {'EXIT', {undef, [{crypto,start,[],[]}, {rebar,run_aux,2, [{file,"src/rebar.erl"},{line,163}]}, {rebar,main,1, [{file,"src/rebar.erl"},{line,58}]}, {erl_eval,do_apply,6, [{file,"erl_eval.erl"},{line,569}]}, {escript,eval_exprs,5, [{file,"escript.erl"},{line,856}]}, {erl_eval,local_func,5, [{file,"erl_eval.erl"},{line,467}]},

Erlang Eclipse not responding when try to run

若如初见. 提交于 2019-12-11 14:45:57
问题 I am trying to run Erlang compiler from Eclipse but it continuously shows nothing or Eclipse becomes not responding. According to one of these tutorials, http://www.youtube.com/watch?v=lrkhIGzCr3Q when I press the run button, tt must show me Erlang console window for me to interact with but my Ecllipse with Erlide does not show me anything and sometimes it become not responding. I have tried few possible solutions for the issues including // including this in eclipse.ini -Derlide.runtime=

Error `make` erlang after downloading latest binary

一个人想着一个人 提交于 2019-12-11 14:16:28
问题 I ran ./configure I had a couple errors that documentation couldn't be built because there was no java compiler. I didn't think that was related so I went ahead with make : What is Error 4 ? oot@marble-pyramid-1:~/download/otp_src_20.0# make MAKE depend make[1]: Entering directory `/root/download/otp_src_20.0/erts/emulator' MAKE generate make[2]: Entering directory `/root/download/otp_src_20.0/erts/emulator' GEN x86_64-unknown-linux-gnu/gen_git_version.mk GEN x86_64-unknown-linux-gnu/opt/smp

“** exception error: undefined function add:addfunc/0 in Erlang ”

强颜欢笑 提交于 2019-12-11 13:36:43
问题 I'm trying to execute a simple erlang program of adding two numbers. I'm trying to do this in Eclipse on Ubuntu 10.04 LTS. When i execute this program, I'm getting the error as shown below: ** exception error: undefined function add:addfunc/0 How do i go about solving this error? Thanks in advance. This program when executed in the erlang shell is working fine. But when it comes to eclipse it's giving me this error. Not this, any program for that matter is giving me the similar error. Guess I

Reverse concat in Elixir

◇◆丶佛笑我妖孽 提交于 2019-12-11 12:56:49
问题 Is there a standard library function in Elixir (or Erlang) to concatenate the reverse of a list in front of some other list? Basically I'm looking for an equivalent of reverse_::: in Scala. The rationale is that it's handy when implementing a tail-recursive algorithm on a list. During recursion, you hold on to some of the elements for later by adding them onto the front of an accumulator list. In the end you can reverse-concat them onto the remainder of the assembled list in one go (which

How to efficiently read thousand of lines from STDIN in Erlang?

混江龙づ霸主 提交于 2019-12-11 12:46:10
问题 I've stumbled upon an issue when reading thousands of lines from STDIN. This would have been an imaginary edge case until I found out that some tests for this problem require reading thousand of lines from STDIN. At first I thought that my algorithms were not optimal, and only by accident I've found out that only reading lines without any computations could make half of the test time out. Here is part code that times out: process_queries(0, _) -> ok; process_queries(N, A) -> case io:fread("",

Erlang - Nodes don't recognize

江枫思渺然 提交于 2019-12-11 12:37:11
问题 I'm trying to use distributing programming in Erlang. But I had a problem, I can't communicate two Erlang's nodes to communicate. I tried to put the same atom in the "Magical cookies", but it didn't work. I tried to use command net:ping(node), but reponse was pang (didn't reconigze another node), or used nodes(), to see if my first node see the second node, but it didn't work again. The first and second node is CentOS in VMWare, using bridge connection in network adaptor. I entered command

map pattern matching in Erlang, unexpected error (unbound)

回眸只為那壹抹淺笑 提交于 2019-12-11 12:03:41
问题 The code below is basically copied from J.A.'s book: -module(mapz). -export([count_chars/1]). count_chars(Str) -> count_chars(Str, #{}). count_chars([H|T], #{H := N}=X) -> % line that throws count_chars(T, X#{H := N+1}); count_chars([H|T], X) -> count_chars(T, X#{H => 1}); count_chars([], X) -> X. however, compiling it in the shell gives me 151> c(mapz). mapz.erl:7: variable 'H' is unbound error 152> I understand the importance of having H bound before it can be used for matching a key in a

Erlang: check duplicate inserted elements

烈酒焚心 提交于 2019-12-11 11:21:38
问题 I want to know if inserted elements are duplicated. Here is simple example for what I'm looking for : In first run should return false. check_duplicate("user", "hi"). But in second run should return true. check_duplicate("user", "hi"). 回答1: One of best features of functional programming is pure functions. There are even functional languages like Haskell where you can't write an impure function. A pure function always returns the same value for the same argument. An impure function has side