From steven.charles.davis@REDACTED Sun Jan 1 05:02:53 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 31 Dec 2011 20:02:53 -0800 (PST) Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <4EFF1E5F.30605@lbox.cc> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> Message-ID: <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> Maybe something like... %%parse_integer(<<$-, Bin/binary>>) -> -1 * parse_integer(Bin, 0);parse_integer(Bin) -> parse_integer(Bin, 0).%parse_integer(<>, Acc) when X >= $0 andalso X =< $9 -> Acc0 = Acc * 10 + (X - $0), parse_integer(Bin, Acc0);parse_integer(<<>>, Acc) -> Acc. On Dec 31, 8:38?am, Muharem Hrnjadovic wrote: > Hello there! > > Is there a way to convert a binary to an integer *directly*? Right now I > am using the following construct: > > ? ? string:to_integer(binary_to_list(B)) > > where B is a binary. > > Best regards/Mit freundlichen Gr??en > > -- > Muharem Hrnjadovic > Public key id : B2BBFCFC > Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC > > ?signature.asc > < 1KViewDownload > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Sun Jan 1 05:07:41 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 31 Dec 2011 20:07:41 -0800 (PST) Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> Message-ID: <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> er... parse_integer(<<$-, Bin/binary>>) -> -1 * parse_integer(Bin, 0);parse_integer(Bin) -> parse_integer(Bin, 0). parse_integer(<>, Acc) when X >= $0 andalso X =< $9 -> Acc0 = Acc * 10 + (X - $0), parse_integer(Bin, Acc0);parse_integer(<<>>, Acc) -> Acc. On Dec 31, 10:02?pm, Steve Davis wrote: > Maybe something like... > > %%parse_integer(<<$-, Bin/binary>>) -> ? -1 * parse_integer(Bin, > 0);parse_integer(Bin) -> ? ? parse_integer(Bin, 0).%parse_integer(< binary>>, Acc) when X >= $0 andalso X =< $9 -> ? Acc0 = Acc * 10 + (X - > $0), ? ?parse_integer(Bin, Acc0);parse_integer(<<>>, Acc) -> ? ? Acc. > On Dec 31, 8:38?am, Muharem Hrnjadovic wrote: > > > > > > > > > Hello there! > > > Is there a way to convert a binary to an integer *directly*? Right now I > > am using the following construct: > > > ? ? string:to_integer(binary_to_list(B)) > > > where B is a binary. > > > Best regards/Mit freundlichen Gr??en > > > -- > > Muharem Hrnjadovic > > Public key id : B2BBFCFC > > Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC > > > ?signature.asc > > < 1KViewDownload > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Sun Jan 1 10:13:59 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 1 Jan 2012 12:13:59 +0300 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> Message-ID: What for such complicated functions? Do you think, that such recursive function is better than creating temporary list? From greim@REDACTED Sun Jan 1 14:39:18 2012 From: greim@REDACTED (greim) Date: Sun, 01 Jan 2012 14:39:18 +0100 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: <-9131750455992961685@unknownmsgid> References: <4EFEEF88.90108@schleibinger.com> <-9131750455992961685@unknownmsgid> Message-ID: <4F006206.2040209@schleibinger.com> > >> Am 30.12.2011 19:29, schrieb Max Bourinov: >>> Hi Dear Erlangers! >>> >>> I want to plot some stats from my Erlang program in munin >>> (http://munin-monitoring.org/). For that I have to call it somehow from >>> bash/sh script. Standart munin setup calls the script every 5 minutes. >>> >> >> >> i think a named pipe (mkfifo) is better >> >> Markus >> > > Hi Markus, can you provide more detail or introduction link? > http://www.linuxjournal.com/article/2156 an good old article, but still true.. Markus > Best regards, > Max > >> >> >>> So, I want to know, what is a best way to establish one way (Erlang -> >>> Bash) communication? >>> >>> One of approaches could be when Erlang program writes file to somewhere >>> like /var/run/erl-prog and bash script reads it. >>> >>> Is there are any other simpler options available? >>> >>> p.s. I know that ejabberd has some interface to bash, but its code too >>> complex to my task. >>> >>> Best regards, >>> Max >>> >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> > From steven.charles.davis@REDACTED Sun Jan 1 16:50:11 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 1 Jan 2012 07:50:11 -0800 (PST) Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> Message-ID: <731e2d10-97b9-4508-b5b7-2accc56f6741@o9g2000yqa.googlegroups.com> Actually this parse_integer ... it's around the same speed as string:to_integer... however: list_to_integer(binary_to_list(<<"-12345">>)) is about 30% faster than both On Jan 1, 3:13?am, Max Lapshin wrote: > What for such complicated functions? > > Do you think, that such recursive function is better than creating > temporary list? > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Sun Jan 1 18:54:13 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sun, 1 Jan 2012 21:54:13 +0400 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: <4F006206.2040209@schleibinger.com> References: <4EFEEF88.90108@schleibinger.com> <-9131750455992961685@unknownmsgid> <4F006206.2040209@schleibinger.com> Message-ID: <1166925059712660714@unknownmsgid> Ah pipes! After new year celebration I didn't get what is pipe. Thank you for the tip. I try it out! Sent from my iPhone On 01.01.2012, at 17:45, greim wrote: >> >>> Am 30.12.2011 19:29, schrieb Max Bourinov: >>>> Hi Dear Erlangers! >>>> >>>> I want to plot some stats from my Erlang program in munin >>>> (http://munin-monitoring.org/). For that I have to call it somehow from >>>> bash/sh script. Standart munin setup calls the script every 5 minutes. >>>> >>> >>> >>> i think a named pipe (mkfifo) is better >>> >>> Markus >>> >> >> Hi Markus, can you provide more detail or introduction link? >> > > http://www.linuxjournal.com/article/2156 > > an good old article, but still true.. > > Markus > > > > >> Best regards, >> Max >> >>> >>> >>>> So, I want to know, what is a best way to establish one way (Erlang -> >>>> Bash) communication? >>>> >>>> One of approaches could be when Erlang program writes file to somewhere >>>> like /var/run/erl-prog and bash script reads it. >>>> >>>> Is there are any other simpler options available? >>>> >>>> p.s. I know that ejabberd has some interface to bash, but its code too >>>> complex to my task. >>>> >>>> Best regards, >>>> Max >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> > From jesper.louis.andersen@REDACTED Sun Jan 1 22:03:58 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sun, 01 Jan 2012 22:03:58 +0100 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <731e2d10-97b9-4508-b5b7-2accc56f6741@o9g2000yqa.googlegroups.com> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> <731e2d10-97b9-4508-b5b7-2accc56f6741@o9g2000yqa.googlegroups.com> Message-ID: <4F00CA3E.1070703@erlang-solutions.com> On 1/1/12 4:50 PM, Steve Davis wrote: > Actually this parse_integer ... it's around the same speed as > string:to_integer... > > however: > > list_to_integer(binary_to_list(<<"-12345">>)) > > is about 30% faster than both > If the goal is speed, you should weigh in the price of constructing the intermediate list with the direct decoding approach. Given that Erlang uses a copying collector in the processes, the price of collecting a dead list is 0. So the only overhead is in the list creation and then afterwards consuming it. What may also come into effect here is that I bet list_to_integer/1 is a BIF - and as such they tend to be much faster by default. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From torben.lehoff@REDACTED Sun Jan 1 22:26:12 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Sun, 1 Jan 2012 22:26:12 +0100 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <4F00CA3E.1070703@erlang-solutions.com> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <294f0864-b416-4dbd-90c6-efc90cb8b495@p4g2000vbt.googlegroups.com> <67d73550-da1d-4425-b35d-1b8c0b392539@f1g2000yqi.googlegroups.com> <731e2d10-97b9-4508-b5b7-2accc56f6741@o9g2000yqa.googlegroups.com> <4F00CA3E.1070703@erlang-solutions.com> Message-ID: <5EADDC3C-BDF8-48F9-8049-4E1B6E3CF06F@gmail.com> In case you want to know if a function is a bif... xref:start(s). xref:add_release(s,"c:/Program\ Files/erl5.7.4/",[{builtins,true}]). {ok,Bifs} = xref:q(s,"B"). Bifs. Change path to fit your release! Cheers, Torben Sent from my iPhone On 01/01/2012, at 22.03, Jesper Louis Andersen wrote: > On 1/1/12 4:50 PM, Steve Davis wrote: >> Actually this parse_integer ... it's around the same speed as >> string:to_integer... >> >> however: >> >> list_to_integer(binary_to_list(<<"-12345">>)) >> >> is about 30% faster than both >> > If the goal is speed, you should weigh in the price of constructing the intermediate list with the direct decoding approach. Given that Erlang uses a copying collector in the processes, the price of collecting a dead list is 0. So the only overhead is in the list creation and then afterwards consuming it. What may also come into effect here is that I bet list_to_integer/1 is a BIF - and as such they tend to be much faster by default. > > -- > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen, DK > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bgustavsson@REDACTED Mon Jan 2 08:25:10 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 2 Jan 2012 08:25:10 +0100 Subject: [erlang-questions] Line Numbers in annotations in core erlang as they relate to stack traces In-Reply-To: <1325266382.1969.35.camel@localhost.localdomain> References: <1325266382.1969.35.camel@localhost.localdomain> Message-ID: On Fri, Dec 30, 2011 at 6:33 PM, Eric B Merritt wrote: > Guys, > > There seems to be a bug in R15B core erlang where line numbers specified > in annotations are not available in stack traces. As always this could > be a misunderstanding on my part. However, given a core erlang form of > cerl:ann_c_apply([10], ...) and an exception occurs at that location the > line numbers seem not to be available to what ever creates the stack > trace. I have to assume that I am missing something here. If erlang is > actually transformed to core erlang before being compiled to beam it > doesn't make sense that this would be over looked. As always any insight > is welcome. > The BEAM compiler does not emit any line number information unless a file name is also available. So it should be cerl:ann_c_apply([10,{file,"some_file"}], ...) -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From desired.mta@REDACTED Mon Jan 2 11:46:56 2012 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Mon, 2 Jan 2012 12:46:56 +0200 Subject: [erlang-questions] testing side effects of asynchronous code Message-ID: <20120102104656.GA13121@jakstys.lt> Hi List, Let's say I am testing side effects of this asynchronous function: gateway_api:send(Message) -> reference() It does some asynchronous processing and produces side effects. After processing completes, gen_gwserver:ack_sent is invoked, like this: gen_gwserver:ack_sent(Ref :: reference()) -> ok. The question is: how can I know that the function ack_sent has been called? Then I know that asynchronous work has been completed, so I can start validating the side effects. An imaginary API in a test case, which blocks until gen_gwserver:ack_sent/1 has been called: ?call_and_sleep( gateway_api:send(Message), gen_gwserver, ack_sent, 1 ) Some options that we ruled out: * timer:sleep(some random value) * making internal gateway_api:ack(Reference) calls (inconvenient, since necessary only for testing) * meck:passthrough looked promising, but the problem is it doesn't return, so it cannot be implemented using meck cleanly. Thanks, Motiejus Jak?tys From gustav.simonsson@REDACTED Mon Jan 2 12:02:47 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Mon, 02 Jan 2012 11:02:47 -0000 (GMT) Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: <20120102104656.GA13121@jakstys.lt> Message-ID: <54a43a83-d0e2-4968-93d6-2342c5453e50@knuth> You could use meck and do a manual passthrough, i.e. something like: meck:expect(gen_gwserver, ack_sent, fun(Ref) -> some_async_test_signalling, gen_gwserver:ack_sent(Ref) end). In the context of testing I don't see why one would rule this possibility out except for reasons of aesthetics. Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Motiejus Jak?tys" To: erlang-questions@REDACTED Sent: Monday, 2 January, 2012 11:46:56 AM Subject: [erlang-questions] testing side effects of asynchronous code Hi List, Let's say I am testing side effects of this asynchronous function: gateway_api:send(Message) -> reference() It does some asynchronous processing and produces side effects. After processing completes, gen_gwserver:ack_sent is invoked, like this: gen_gwserver:ack_sent(Ref :: reference()) -> ok. The question is: how can I know that the function ack_sent has been called? Then I know that asynchronous work has been completed, so I can start validating the side effects. An imaginary API in a test case, which blocks until gen_gwserver:ack_sent/1 has been called: ?call_and_sleep( gateway_api:send(Message), gen_gwserver, ack_sent, 1 ) Some options that we ruled out: * timer:sleep(some random value) * making internal gateway_api:ack(Reference) calls (inconvenient, since necessary only for testing) * meck:passthrough looked promising, but the problem is it doesn't return, so it cannot be implemented using meck cleanly. Thanks, Motiejus Jak?tys _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Mon Jan 2 12:09:20 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 2 Jan 2012 14:09:20 +0300 Subject: [erlang-questions] Have anyone tested to change sock_sendv from writev to vmsplice? Message-ID: These functions look similar to each other by API, but vmsplice claims to be zerocopy. Have anyone tested to change writev to vmsplice? From desired.mta@REDACTED Mon Jan 2 12:20:56 2012 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Mon, 2 Jan 2012 13:20:56 +0200 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: <54a43a83-d0e2-4968-93d6-2342c5453e50@knuth> References: <20120102104656.GA13121@jakstys.lt> <54a43a83-d0e2-4968-93d6-2342c5453e50@knuth> Message-ID: <20120102112056.GA17015@jakstys.lt> On Mon, Jan 02, 2012 at 11:02:47AM -0000, Gustav Simonsson wrote: > > You could use meck and do a manual passthrough, i.e. something like: > meck:expect(gen_gwserver, ack_sent, fun(Ref) -> some_async_test_signalling, gen_gwserver:ack_sent(Ref) end). > > In the context of testing I don't see why one would rule this possibility out except for reasons of aesthetics. Hi, Minor fix: gen_gwserver:ack_sent(Ref) should be changed with meck:passthrough([Ref]), like this: meck:expect(gen_gwserver, ack_sent, fun(Ref) -> some_async_test_signalling, meck:passthrough([Ref]) end). You are right, this would work. However, I would like an abstraction for it, which would include both mecking and test signal catching, because we are using it quite often. Abstraction would need either using something other than meck, or changing expect(Mod::atom(), Func::atom(), Expect::fun()) to accept expect(Mod::atom(), Func::atom(), Arity::pos_int(), Expect::fun()) Expect :: function/1 which takes a list of arguments passed to mocked function. Without abstraction what we could get now: yadda_test() -> MasterPid = self(), % unsure, this might be not necessary meck:expect(gen_gwserver, ack_sent, fun(Ref) -> MasterPid ! done, meck:passthrough([Ref]) end), gateway_api:send(Msg), receive done -> ok end ?assertSomething? If we don't get anything better than that, it's fine. But it's much less elegant than: yadda_test() -> ?call_and_sleep(gateway_api:send(Message), gen_gwserver, ack_sent, 1), ?assertSomething? Ideas? Thanks Motiejus From monika.m.moser@REDACTED Mon Jan 2 16:49:25 2012 From: monika.m.moser@REDACTED (Monika Moser) Date: Mon, 2 Jan 2012 16:49:25 +0100 Subject: [erlang-questions] aes_cfb_128_encrypt text length Message-ID: Hi, I have a question on the behavior of aes_cfb_128_encrypt as its implementation seems to have changed since version R12B-5 Why does Text in *aes_cfb_128_encrypt(Key, IVec, Text) -> Cipher *have to be a multiple of 16 bytes? Though documentation told you, version R12B-5 did not enforce that it had to be a multiple of 16 bytes. While version R14A checks the length of Text and returns badarg. I thought that if you use CFB it was not necessary to use padding and decrypted data had just the same length as the input data. This restriction does not come from openssl or does it? Thanks, Monika -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Mon Jan 2 18:02:56 2012 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 2 Jan 2012 18:02:56 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: Phew! Thank you all for clarifying the issue!! On Fri, Dec 30, 2011 at 6:25 PM, Roberto Ostinelli wrote: > proplists on misultin too. > > > Specifically, I'm worried about >> >> - Yaws >> - Mochiweb >> - Webmachine >> - Misultin >> - Cowboy >> >> :) >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitriid@REDACTED Mon Jan 2 18:06:13 2012 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 2 Jan 2012 18:06:13 +0100 Subject: [erlang-questions] Erlang on Freescale i.MX53 (Cortex A8, ARM): works excelently In-Reply-To: References: Message-ID: There were people at the Erlang Factory who are already probably doing that :) On Sat, Dec 31, 2011 at 12:23 PM, Max Lapshin wrote: > This one is even better: > > http://www.digi.com/products/wireless-wired-embedded-solutions/solutions-on-module/connectcore/connectcore-wi-mx53#overview > > replace dump software in your BMW with erlang =) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericbmerritt@REDACTED Mon Jan 2 18:12:14 2012 From: ericbmerritt@REDACTED (Eric Merritt) Date: Mon, 2 Jan 2012 12:12:14 -0500 Subject: [erlang-questions] Line Numbers in annotations in core erlang as they relate to stack traces In-Reply-To: References: <1325266382.1969.35.camel@localhost.localdomain> Message-ID: Bj?rn, Thanks, I just discovered this for myself yesterday after a bit of playing around with compiling erlang sources to core and asm. Just for future readers, ordering does?'t matter and the file name can be an empty string, though that wont be too useful from a line numbering standpoint. Eric 2012/1/2 Bj?rn Gustavsson : > On Fri, Dec 30, 2011 at 6:33 PM, Eric B Merritt wrote: >> Guys, >> >> There seems to be a bug in R15B core erlang where line numbers specified >> in annotations are not available in stack traces. As always this could >> be a misunderstanding on my part. However, given a core erlang form of >> cerl:ann_c_apply([10], ...) and an exception occurs at that location the >> line numbers seem not to be available to what ever creates the stack >> trace. I have to assume that I am missing something here. If erlang is >> actually transformed to core erlang before being compiled to beam it >> doesn't make sense that this would be over looked. As always any insight >> is welcome. >> > > The BEAM compiler does not emit any line number information unless > a file name is also available. So it should be > > cerl:ann_c_apply([10,{file,"some_file"}], ...) > > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sverker@REDACTED Mon Jan 2 18:18:18 2012 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 2 Jan 2012 18:18:18 +0100 Subject: [erlang-questions] aes_cfb_128_encrypt text length In-Reply-To: References: Message-ID: <4F01E6DA.6090606@erix.ericsson.se> Monika Moser wrote: > Hi, > > I have a question on the behavior of aes_cfb_128_encrypt as its > implementation seems to have changed since version R12B-5 > Why does Text in *aes_cfb_128_encrypt(Key, IVec, Text) -> Cipher *have to > be a multiple of 16 bytes? > Though documentation told you, version R12B-5 did not enforce that it had > to be a multiple of 16 bytes. > While version R14A checks the length of Text and returns badarg. > I thought that if you use CFB it was not necessary to use padding and > decrypted data had just the same length as the input data. > > This restriction does not come from openssl or does it? > No, even though the openssl documentation is somewhat lacking, both the interface as the implementation of AES_cfb128_encrypt seems to be design to handle unaligned input. I think it's a safe bet to supply a patch to remove that restriction. *wink wink* /Sverker, Erlang/OTP From gumm@REDACTED Mon Jan 2 18:21:26 2012 From: gumm@REDACTED (Jesse Gumm) Date: Mon, 2 Jan 2012 11:21:26 -0600 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: Nitrogen uses proplists too, so as long as the server you choose also doesn't use hashes (which sounds like "all of then"), nitrogen is good to go. -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Jan 2, 2012 11:03 AM, "Dmitrii Dimandt" wrote: > Phew! Thank you all for clarifying the issue!! > > On Fri, Dec 30, 2011 at 6:25 PM, Roberto Ostinelli wrote: > >> proplists on misultin too. >> >> >> Specifically, I'm worried about >>> >>> - Yaws >>> - Mochiweb >>> - Webmachine >>> - Misultin >>> - Cowboy >>> >>> :) >>> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Mon Jan 2 18:57:31 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 2 Jan 2012 18:57:31 +0100 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: <20120102104656.GA13121@jakstys.lt> References: <20120102104656.GA13121@jakstys.lt> Message-ID: Hi - just throwing this out there. I started thinking about this too and wanted some kind of lib for side-effect testing and got only as far as whipping up some basic stuff https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/ I didn't have too much time back then and it was mostly a proof of concept /G 2012/1/2 Motiejus Jak?tys : > Hi List, > > Let's say I am testing side effects of this asynchronous function: > gateway_api:send(Message) -> reference() > > It does some asynchronous processing and produces side effects. After > processing completes, gen_gwserver:ack_sent is invoked, like this: > gen_gwserver:ack_sent(Ref :: reference()) -> ok. > > The question is: how can I know that the function ack_sent has been > called? Then I know that asynchronous work has been completed, so I can > start validating the side effects. > > An imaginary API in a test case, which blocks until > gen_gwserver:ack_sent/1 has been called: > ?call_and_sleep( > ? ?gateway_api:send(Message), > ? ?gen_gwserver, ack_sent, 1 > ) > > Some options that we ruled out: > * timer:sleep(some random value) > * making internal gateway_api:ack(Reference) calls (inconvenient, since > ?necessary only for testing) > * meck:passthrough looked promising, but the problem is it doesn't > ?return, so it cannot be implemented using meck cleanly. > > Thanks, > Motiejus Jak?tys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From matthias@REDACTED Mon Jan 2 22:34:23 2012 From: matthias@REDACTED (Matthias Lang) Date: Mon, 2 Jan 2012 22:34:23 +0100 Subject: [erlang-questions] what is the -F switch on to_erl for? Message-ID: <20120102213423.GA28301@corelatus.se> Hi, Short: does anyone know what the -F switch on 'to_erl' is actually for? Long: to_erl has a -F switch (force) which connects to the 'run_erl' FIFO even if another process has already connected. It works, but the effects are so weird that it seems useless. If I use -F to let two to_erl processes connect to the same node, then output (e.g. echoed keystrokes) ends up partly in one process and partly in another, making them both useless. (I first hoped there might be a clever mechanism in there which sends output to whichever process most recently sent input). I tried it on R14B03 on linux 2.6.35 and a couple of other versions. That's not very useful, so maybe -F is actually for solving a completely different problem. Does anyone know? Aside #1: I don't think to_erl has a man page. It's mentioned in the Embedded Systems User's Guide, but no mention of -F there. Aside #2: The whole 'Embedded' section of the manual looks very old, i.e. http://www.erlang.org/doc/embedded/embedded_solaris.html talks about systems with 64 M of RAM and refers to Solaris 2.5.1 (from 1996!!). Same problem for Windows NT and VxWorks. If I submit a documentation patch which deletes the whole section, will anyone be upset? Matt From baliulia@REDACTED Mon Jan 2 22:56:30 2012 From: baliulia@REDACTED (=?UTF-8?B?SWduYXMgVnnFoW5pYXVza2Fz?=) Date: Mon, 02 Jan 2012 23:56:30 +0200 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: References: <20120102104656.GA13121@jakstys.lt> Message-ID: <4F02280E.6040901@gmail.com> On 2012.01.02 19:57, Gianfranco Alongi wrote: > Hi - just throwing this out there. > > I started thinking about this too and wanted some kind of lib for > side-effect testing and got only as far as whipping up some basic > stuff > > https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/ > > I didn't have too much time back then and it was mostly a proof of concept > > /G Hmm, this is interesting, I was thinking of abusing the Erlang tracer as well. For the question Motiejus raised, could something like this possibly work: erlang:trace(all, true, [call, {tracer, self()}]), % I tried all of the flags: global, local and meta, all failed erlang:trace_pattern({gen_gwserver, ack_sent, 1}, true, [local]), gateway_api:send(Msg), receive {trace, _, _, _} -> ok % gen_gwserver:ack_sent/1 was called, we can proceed end, ?assert(Something) I tried this, but it didn't work. Unfortunately, my understanding of Erlang's trace mechanism is very poor, so I couldn't work out whether it's possible to fix it somehow. Thanks, Ignas From bchesneau@REDACTED Mon Jan 2 23:36:25 2012 From: bchesneau@REDACTED (Benoit Chesneau) Date: Mon, 2 Jan 2012 23:36:25 +0100 Subject: [erlang-questions] erl_make_certs Message-ID: Hi, I am looking for a "pure" erlang SSL certificate generation. I've found the script `erl_make_certs.erl` in SSL tests which is apparently abble to do that, but I see such comments in the code: %% @doc Creates a dsa key (OBS: for testing only) Does the script generate secured and valid certificates or should I use another script to use it. Sometimes the code will be on embedded devices so it may not be possible to generate SSL certificates there and I would like to not use the openssl if possible. - benoit From magnus.klaar@REDACTED Tue Jan 3 01:37:12 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Tue, 3 Jan 2012 01:37:12 +0100 Subject: [erlang-questions] Differences between erlang:system_profile and erlang:trace Message-ID: Hi! I'm seeing a strange behavior when using erlang:system_info/2 to trace the running processes on an erlang node. I know it's flagged as experimental so I will assume it's actually a feature even if the documentation does not agree. When a process is used to receive the profile messages from erlang:system_info/2 the receiving process is also profiled. The effect of this is that the process receiving the profile messages will receive an infinite sequence of 'inactive' ... 'active' ... 'inactive' .... messages from the runtime system. The manpage states that the "The receiver is excluded from all profiling.". I've compared this with using the erlang:trace/3 function to trace running processes, when this function is used the tracer processes never receives a message when the tracer process scheduled. Two eunit tests for showing the difference: https://gist.github.com/1552673 Running "erl -noshell -s system_profile test -s init stop" on my system yields the following result: system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For others: 345 system_profile:13: system_profile_test_...*failed* ::{assertion_failed,[{module,system_profile}, {line,32}, {expression,"SelfCount =:= 0"}, {expected,true}, {value,false}]} system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For others: 338 ======================================================= Failed: 1. Skipped: 0. Passed: 1. My questions are: Am I using it wrong? If so, how should it be used? If not, Is it a bug? MVH Magnus -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Tue Jan 3 07:58:17 2012 From: heinz@REDACTED (Heinz N. Gies) Date: Tue, 3 Jan 2012 07:58:17 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: <4D653DB2-6D03-425D-A41E-B0488F984F29@licenser.net> Please correct me if I am wrong, I might have misunderstood something entirely. * All listed Servers use Prop Lists. * Prop Lists are liked lists with the elements having the form {key, value}. * The demonstrated DoS Attack on the Hash tables causes hash tables (usually having a very fast lookup time) to act like linked lists / arrays. Doesn't that lead to the conclusion that all listed servers are vulnerable to a even simpler version of the attack since no collisions need to be crafted? Regards, Heinz -- Heinz N. Gies heinz@REDACTED http://licenser.net From bob@REDACTED Tue Jan 3 08:04:38 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 2 Jan 2012 23:04:38 -0800 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: <4D653DB2-6D03-425D-A41E-B0488F984F29@licenser.net> References: <4D653DB2-6D03-425D-A41E-B0488F984F29@licenser.net> Message-ID: On Mon, Jan 2, 2012 at 10:58 PM, Heinz N. Gies wrote: > Please correct me if I am wrong, I might have misunderstood something > entirely. > > * All listed Servers use Prop Lists. > * Prop Lists are liked lists with the elements having the form {key, > value}. > * The demonstrated DoS Attack on the Hash tables causes hash tables > (usually having a very fast lookup time) to act like linked lists / arrays. > > Doesn't that lead to the conclusion that all listed servers are vulnerable > to a even simpler version of the attack since no collisions need to be > crafted? > The attack is only effective if insert is slow. Insert of N keys is worst case O(N) for proplist, which is optimal. Insert of N keys is worst case O(N^2) for hash tables. Remember that you have to traverse the whole list of keys that hash the same to determine if there is a collision or not. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Tue Jan 3 08:32:12 2012 From: heinz@REDACTED (Heinz N. Gies) Date: Tue, 3 Jan 2012 08:32:12 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: <4D653DB2-6D03-425D-A41E-B0488F984F29@licenser.net> Message-ID: <92C0D334-F8CB-4246-A13F-EA42B191A64C@licenser.net> Thanks for the clarification Bob :), I did a little testing and it confirmed what you said, 2^16 key value pairs make it slower about 2-3s for a request on cowboy but it is a quite linear progression of slowdown :) Regards, Heinz -- Heinz N. Gies heinz@REDACTED http://licenser.net On Jan 3, 2012, at 08:04, Bob Ippolito wrote: > On Mon, Jan 2, 2012 at 10:58 PM, Heinz N. Gies wrote: > Please correct me if I am wrong, I might have misunderstood something entirely. > > * All listed Servers use Prop Lists. > * Prop Lists are liked lists with the elements having the form {key, value}. > * The demonstrated DoS Attack on the Hash tables causes hash tables (usually having a very fast lookup time) to act like linked lists / arrays. > > Doesn't that lead to the conclusion that all listed servers are vulnerable to a even simpler version of the attack since no collisions need to be crafted? > > The attack is only effective if insert is slow. Insert of N keys is worst case O(N) for proplist, which is optimal. Insert of N keys is worst case O(N^2) for hash tables. Remember that you have to traverse the whole list of keys that hash the same to determine if there is a collision or not. > > -bob > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangud@REDACTED Tue Jan 3 09:28:42 2012 From: dangud@REDACTED (Dan Gudmundsson) Date: Tue, 3 Jan 2012 09:28:42 +0100 Subject: [erlang-questions] erl_make_certs In-Reply-To: References: Message-ID: That code is something I made to be able to generate different certs for testing public_key and ssl. I don't have any confidence in the security of the generated keys, so I would use them for testing only. But the certs should be valid, and the code can be extended so it fits your needs, so if you use pre-generated keys or generate keys with something else like ssh or openssl. The code can be used to create usable certs. /Dan On Mon, Jan 2, 2012 at 11:36 PM, Benoit Chesneau wrote: > Hi, > > I am looking for a "pure" erlang SSL certificate generation. I've > found the script `erl_make_certs.erl` in SSL tests which is apparently > abble to do that, but I see such comments in the code: > > ? ?%% @doc Creates a dsa key (OBS: for testing only) > > > Does the script generate secured and valid certificates or should I > use another script to use it. Sometimes the code will be on embedded > devices so it may not be possible to generate SSL certificates there > and I would like to not use the openssl if possible. > > - benoit > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From egil@REDACTED Tue Jan 3 10:06:17 2012 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Tue, 3 Jan 2012 10:06:17 +0100 Subject: [erlang-questions] Differences between erlang:system_profile and erlang:trace In-Reply-To: References: Message-ID: <4F02C509.3030106@erlang.org> From what I remember (trying to recall something written five years ago) system_profile used to respect this policy but from looking at the code it seems like it doesn't now. The tracing and scheduler queues has been rewritten several times since then and it is possible that something has been lost. I will have a look at it. Thank you for reporting this. Regards, Bj?rn-Egil On 2012-01-03 01:37, Magnus Klaar wrote: > Hi! > > I'm seeing a strange behavior when using erlang:system_info/2 to trace > the running processes on an erlang node. I know it's flagged as > experimental so I will assume it's actually a feature even if the > documentation does not agree. When a process is used to receive the > profile messages from erlang:system_info/2 the receiving process is > also profiled. The effect of this is that the process receiving the > profile messages will receive an infinite sequence of 'inactive' ... > 'active' ... 'inactive' .... messages from the runtime system. The > manpage states that the "The receiver is excluded from all > profiling.". I've compared this with using the erlang:trace/3 function > to trace running processes, when this function is used the tracer > processes never receives a message when the tracer process scheduled. > > Two eunit tests for showing the difference: > https://gist.github.com/1552673 > > Running "erl -noshell -s system_profile test -s init stop" on my > system yields the following result: > > > system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For > others: 345 > > system_profile:13: system_profile_test_...*failed* > ::{assertion_failed,[{module,system_profile}, > {line,32}, > {expression,"SelfCount =:= 0"}, > {expected,true}, > {value,false}]} > > > system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For > others: 338 > > ======================================================= > Failed: 1. Skipped: 0. Passed: 1. > > > My questions are: Am I using it wrong? If so, how should it be used? > If not, Is it a bug? > > MVH Magnus > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Jan 3 10:16:16 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 3 Jan 2012 10:16:16 +0100 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: <4F02280E.6040901@gmail.com> References: <20120102104656.GA13121@jakstys.lt> <4F02280E.6040901@gmail.com> Message-ID: Ignas, The problem is not in the flags, it's just that the process can't trace itself. For example you can't do this erlang:trace(self(), true, [call, {tracer,self()}]). If u wanna use tracing for this, you can simply write the desired api as : call_and_sleep({ModC, FunC, ArgC}=_Call, {ModS,FunS,ArgS}=_SleepFor)-> erlang:trace(all ,true, [call]), erlang:trace_pattern({ModS, FunS, ArgS}, true, []), spawn(ModC, FunC, ArgC), receive {trace, _, _, _} -> ok end. 2012/1/2 Ignas Vy?niauskas > On 2012.01.02 19:57, Gianfranco Alongi wrote: > > Hi - just throwing this out there. > > > > I started thinking about this too and wanted some kind of lib for > > side-effect testing and got only as far as whipping up some basic > > stuff > > > > > https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/ > > > > I didn't have too much time back then and it was mostly a proof of > concept > > > > /G > > Hmm, this is interesting, I was thinking of abusing the Erlang tracer as > well. > > For the question Motiejus raised, could something like this possibly work: > > erlang:trace(all, true, [call, {tracer, self()}]), > % I tried all of the flags: global, local and meta, all failed > erlang:trace_pattern({gen_gwserver, ack_sent, 1}, true, [local]), > gateway_api:send(Msg), > receive > {trace, _, _, _} -> > ok % gen_gwserver:ack_sent/1 was called, we can proceed > end, > ?assert(Something) > > I tried this, but it didn't work. Unfortunately, my understanding of > Erlang's trace mechanism is very poor, so I couldn't work out whether > it's possible to fix it somehow. > > Thanks, > Ignas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Jan 3 10:57:02 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 3 Jan 2012 10:57:02 +0100 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: References: <20120102104656.GA13121@jakstys.lt> <4F02280E.6040901@gmail.com> Message-ID: of course you would call it as call_and_sleep({gateway_api,send,[Msg]}, {gen_gwserver, ack_sent, 1}). Also, If you need to check the Args passed to ack_sent, you can add some MatchSpec to the trace_pattern to do that. 2012/1/3 Ahmed Omar > Ignas, > The problem is not in the flags, it's just that the process can't trace > itself. > For example you can't do this > erlang:trace(self(), true, [call, {tracer,self()}]). > > If u wanna use tracing for this, you can simply write the desired api as : > call_and_sleep({ModC, FunC, ArgC}=_Call, {ModS,FunS,ArgS}=_SleepFor)-> > erlang:trace(all ,true, [call]), > erlang:trace_pattern({ModS, FunS, ArgS}, true, []), > spawn(ModC, FunC, ArgC), > receive > {trace, _, _, _} -> > ok > end. > > 2012/1/2 Ignas Vy?niauskas > >> On 2012.01.02 19:57, Gianfranco Alongi wrote: >> > Hi - just throwing this out there. >> > >> > I started thinking about this too and wanted some kind of lib for >> > side-effect testing and got only as far as whipping up some basic >> > stuff >> > >> > >> https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/ >> > >> > I didn't have too much time back then and it was mostly a proof of >> concept >> > >> > /G >> >> Hmm, this is interesting, I was thinking of abusing the Erlang tracer as >> well. >> >> For the question Motiejus raised, could something like this possibly work: >> >> erlang:trace(all, true, [call, {tracer, self()}]), >> % I tried all of the flags: global, local and meta, all failed >> erlang:trace_pattern({gen_gwserver, ack_sent, 1}, true, [local]), >> gateway_api:send(Msg), >> receive >> {trace, _, _, _} -> >> ok % gen_gwserver:ack_sent/1 was called, we can proceed >> end, >> ?assert(Something) >> >> I tried this, but it didn't work. Unfortunately, my understanding of >> Erlang's trace mechanism is very poor, so I couldn't work out whether >> it's possible to fix it somehow. >> >> Thanks, >> Ignas >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker@REDACTED Tue Jan 3 11:51:29 2012 From: sverker@REDACTED (Sverker Eriksson) Date: Tue, 3 Jan 2012 11:51:29 +0100 Subject: [erlang-questions] what is the -F switch on to_erl for? In-Reply-To: <20120102213423.GA28301@corelatus.se> References: <20120102213423.GA28301@corelatus.se> Message-ID: <4F02DDB1.2030405@erix.ericsson.se> Matthias Lang wrote: > Short: > > does anyone know what the -F switch on 'to_erl' is actually for? > > I think -F was added together with the default restriction that only one to_erl could connect at a time. I don't remember if anyone actually asked for it, or if we added -F just in case someone was using the weird "multi-connect" feature. > The whole 'Embedded' section of the manual looks very old, i.e. > > http://www.erlang.org/doc/embedded/embedded_solaris.html > > talks about systems with 64 M of RAM and refers to Solaris 2.5.1 > (from 1996!!). Same problem for Windows NT and VxWorks. > > If I submit a documentation patch which deletes the whole section, > will anyone be upset? > Sounds like a good idea. /Sverker, Erlang/OTP Ericsson From desired.mta@REDACTED Tue Jan 3 19:24:21 2012 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Tue, 3 Jan 2012 20:24:21 +0200 Subject: [erlang-questions] erl_make_certs In-Reply-To: References: Message-ID: <20120103182421.GB2730@jakstys.lt> On Mon, Jan 02, 2012 at 11:36:25PM +0100, Benoit Chesneau wrote: > Hi, > > I am looking for a "pure" erlang SSL certificate generation. I've > found the script `erl_make_certs.erl` in SSL tests which is apparently > abble to do that, but I see such comments in the code: > > %% @doc Creates a dsa key (OBS: for testing only) > > > Does the script generate secured and valid certificates or should I > use another script to use it. Sometimes the code will be on embedded > devices so it may not be possible to generate SSL certificates there > and I would like to not use the openssl if possible. There's a PropEr[1] way to test it and make sure :) Motiejus [1] http://proper.softlab.ntua.gr/ From ericbmerritt@REDACTED Tue Jan 3 23:36:59 2012 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Tue, 03 Jan 2012 17:36:59 -0500 Subject: [erlang-questions] Type specs unavailable in code compiled from core erlang? Message-ID: <1325630219.7537.18.camel@localhost.localdomain> Guys, When a module that includes type specs is compiled to core erlang, those type specs and type definitions become specifically formatted attributes in the module. When further compiled to beam the attributes disappear and, I assume, are encoded in some other way. After much research it seems that the specs and types are only defined in the abstract_code chunk of the beam. In modules compiled from core erlang it seems that the abstract_code chunk is always empty (this may make sense, its something I am still rolling around in my head). I believe the absence of abstract code renders the specs more or less useless? This may argue for something Kenneth suggested back in may, that is keeping spec and types in their own dedicated chunk that does not disappear with the absence of debug information. Thank you, Eric From chandu.gokul138@REDACTED Wed Jan 4 01:45:15 2012 From: chandu.gokul138@REDACTED (Gokul Evuri) Date: Wed, 4 Jan 2012 01:45:15 +0100 Subject: [erlang-questions] How do i get values from this URL? and execute an erlang module with the values to reply the client with result? Message-ID: http://www.myserver.com/exile?Key1=Value1&Key2=Value2 When i get a request in this format to my server, how do i handle this request? What i need to do: Need to get all the values and run a Erlang module, and send the result to the client.Is exile a CGI and if so how come it doesn't have a .cgi extension? Additional Data: I have setup an Yaws on my server(Desktop running linux server). yaws.conf file is configured. -- *Gokul Reddy Evuri,* *IT Universitet **G?teborg**,* *G?teborg,* *Sverige.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Wed Jan 4 02:21:22 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 3 Jan 2012 20:21:22 -0500 Subject: [erlang-questions] How do i get values from this URL? and execute an erlang module with the values to reply the client with result? In-Reply-To: References: Message-ID: On Tue, Jan 3, 2012 at 7:45 PM, Gokul Evuri wrote: > http://www.myserver.com/exile?Key1=Value1&Key2=Value2 > > When i get a request in this format to my server, how do i handle this > request? What i need to do: Need to get all the values and run a Erlang > module, and send the result to the client.Is exile a CGI and if so how come > it doesn't have a .cgi extension? You can't tell how exile is implemented just from this URL alone. > Additional Data: I have setup an Yaws on my server(Desktop running linux > server). yaws.conf file is configured. If you want exile to be processed via CGI, take a look at the Yaws CGI documentation here: http://yaws.hyber.org/cgi.yaws You can also do this with a Yaws appmod: http://yaws.hyber.org/appmods.yaws In an appmod you can obtain the query string portions of the URL via the #arg appmod argument, as described here: http://yaws.hyber.org/query.yaws For Yaws-specific questions, you might want to use the erlyaws-list: https://lists.sourceforge.net/lists/listinfo/erlyaws-list --steve From chandu.gokul138@REDACTED Wed Jan 4 02:56:13 2012 From: chandu.gokul138@REDACTED (Gokul Evuri) Date: Wed, 4 Jan 2012 02:56:13 +0100 Subject: [erlang-questions] How do i get values from this URL? and execute an erlang module with the values to reply the client with result? In-Reply-To: References: Message-ID: How can i implement exile?? that is what i am trying to ask!! any sample scripts for exile(if it is a script), this would be very helpful for my project. On Wed, Jan 4, 2012 at 2:21 AM, Steve Vinoski wrote: > On Tue, Jan 3, 2012 at 7:45 PM, Gokul Evuri > wrote: > > http://www.myserver.com/exile?Key1=Value1&Key2=Value2 > > > > When i get a request in this format to my server, how do i handle this > > request? What i need to do: Need to get all the values and run a Erlang > > module, and send the result to the client.Is exile a CGI and if so how > come > > it doesn't have a .cgi extension? > > You can't tell how exile is implemented just from this URL alone. > > > Additional Data: I have setup an Yaws on my server(Desktop running linux > > server). yaws.conf file is configured. > > If you want exile to be processed via CGI, take a look at the Yaws CGI > documentation here: > > http://yaws.hyber.org/cgi.yaws > > You can also do this with a Yaws appmod: > > http://yaws.hyber.org/appmods.yaws > > In an appmod you can obtain the query string portions of the URL via > the #arg appmod argument, as described here: > > http://yaws.hyber.org/query.yaws > > For Yaws-specific questions, you might want to use the erlyaws-list: > > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > > --steve > -- *Gokul Reddy Evuri,* *IT Universitet **G?teborg**,* *G?teborg,* *Sverige.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Wed Jan 4 03:30:33 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 3 Jan 2012 21:30:33 -0500 Subject: [erlang-questions] How do i get values from this URL? and execute an erlang module with the values to reply the client with result? In-Reply-To: References: Message-ID: On Tue, Jan 3, 2012 at 8:56 PM, Gokul Evuri wrote: > How can i implement exile?? > that is what i am trying to ask!! > any sample scripts for exile(if it is a script), this would be very helpful > for my project. The links I sent you tell you how you can implement exile. Nobody here knows exactly what you need exile to do, so we can't tell you exactly how to implement it. --steve > > On Wed, Jan 4, 2012 at 2:21 AM, Steve Vinoski wrote: >> >> On Tue, Jan 3, 2012 at 7:45 PM, Gokul Evuri >> wrote: >> > http://www.myserver.com/exile?Key1=Value1&Key2=Value2 >> > >> > When i get a request in this format to my server, how do i handle this >> > request? What i need to do: Need to get all the values and run a Erlang >> > module, and send the result to the client.Is exile a CGI and if so how >> > come >> > it doesn't have a .cgi extension? >> >> You can't tell how exile is implemented just from this URL alone. >> >> > Additional Data: I have setup an Yaws on my server(Desktop running linux >> > server). yaws.conf file is configured. >> >> If you want exile to be processed via CGI, take a look at the Yaws CGI >> documentation here: >> >> http://yaws.hyber.org/cgi.yaws >> >> You can also do this with a Yaws appmod: >> >> http://yaws.hyber.org/appmods.yaws >> >> In an appmod you can obtain the query string portions of the URL via >> the #arg appmod argument, as described here: >> >> http://yaws.hyber.org/query.yaws >> >> For Yaws-specific questions, you might want to use the erlyaws-list: >> >> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >> >> --steve > > > > > -- > Gokul Reddy Evuri, > IT?Universitet?G?teborg, > G?teborg, > Sverige. > From per@REDACTED Wed Jan 4 13:59:59 2012 From: per@REDACTED (Per Hedeland) Date: Wed, 4 Jan 2012 13:59:59 +0100 (CET) Subject: [erlang-questions] Fix for bogus {error, enfile} from gen_tcp:accept/1, 2 Message-ID: <201201041259.q04CxxMK004323@pluto.hedeland.org> Hello, CC'ing erlang-questions since this bug has caused some confused discussions in the past, with well-meaning info from people (including me) that know something about what ENFILE means mostly adding to the confusion. The R12B-0 release README says: OTP-6968 If open_port fails because all available ports are already in use, it will now throw a system_limit exception instead of an enfile exception. (enfile might still be thrown if the operating system would return ENFILE.) Which is great (and it shouldn't have been enfile in the first place), but gen_tcp:accept/1,2 which is probably the most common cause of running out of (Erlang) ports has continued to return {error, enfile} when the actual problem is that all ports are in use. The problem is a bit elusive, since at least on Unix, the port table is sized based on the OS process file descriptor limit - i.e. you may well get {error, emfile} (note the 'm'!:-) before you run out of ports - unless you have driver instances that use ports without using file descriptors. So: Fix returned error from gen_tcp:accept/1,2 when running out of ports The {error, enfile} return value is badly misleading and confusing for this case, since the Posix ENFILE errno value has a well-defined meaning that has nothing to do with Erlang ports. The fix changes the return value to {error, system_limit}, which is consistent with e.g. various file(3) functions. inet:format_error/1 has also been updated to support system_limit in the same manner as file:format_error/1. git fetch git://github.com/perhedeland/otp.git fix_enfile (Hoping that I didn't mess up the git stuff.:-) --Per Hedeland per@REDACTED From zabrane3@REDACTED Wed Jan 4 17:38:04 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 4 Jan 2012 17:38:04 +0100 Subject: [erlang-questions] is length(L) fast? Message-ID: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> Hi guys, Is the call to length(L) traverse all the list ? or is it something already pre-computed internally (i.e constant time = fast)? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Jan 4 17:47:04 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 4 Jan 2012 17:47:04 +0100 Subject: [erlang-questions] is length(L) fast? In-Reply-To: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> References: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> Message-ID: On Wed, Jan 4, 2012 at 17:38, Zabrane Mickael wrote: > Is the call to length(L) traverse all the list ? Yes, it does. Lists are single-linked lists > or is it something already pre-computed internally (i.e constant time = > fast)? It's O(n) where n is length of the list. From dmkolesnikov@REDACTED Wed Jan 4 17:48:55 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Wed, 4 Jan 2012 18:48:55 +0200 Subject: [erlang-questions] is length(L) fast? In-Reply-To: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> References: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> Message-ID: <7564725341766861564@unknownmsgid> O(n) See http://erlang.org/pipermail/erlang-questions/1999-January/000087.html Dmitry On 4.1.2012, at 18.42, Zabrane Mickael wrote: Hi guys, Is the call to *length(L)* traverse all the list ? or is it something already pre-computed internally (i.e constant time = fast)? Regards, Zabrane _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Jan 4 17:46:49 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 4 Jan 2012 17:46:49 +0100 Subject: [erlang-questions] is length(L) fast? In-Reply-To: <7564725341766861564@unknownmsgid> References: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> <7564725341766861564@unknownmsgid> Message-ID: Thanks for the prompt responses guys ;-) Regards, Zabrane On Jan 4, 2012, at 5:48 PM, dmitry kolesnikov wrote: > O(n) > > See http://erlang.org/pipermail/erlang-questions/1999-January/000087.html > > Dmitry > > On 4.1.2012, at 18.42, Zabrane Mickael wrote: > >> Hi guys, >> >> Is the call to length(L) traverse all the list ? >> or is it something already pre-computed internally (i.e constant time = fast)? >> >> Regards, >> Zabrane >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Jan 5 01:57:20 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 5 Jan 2012 00:57:20 +0000 Subject: [erlang-questions] Type specs unavailable in code compiled from core erlang? In-Reply-To: <1325630219.7537.18.camel@localhost.localdomain> References: <1325630219.7537.18.camel@localhost.localdomain> Message-ID: On 3 January 2012 22:36, Eric B Merritt wrote: > > This may argue for something Kenneth suggested back in may, that is > keeping spec and types in their own dedicated chunk that does not > disappear with the absence of debug information. > > Well +1 for keeping the types/specs *somewhere* in the beam regardless of debug_info for sure. Personally I favour the idea that types/specs should be present all the time, as they make up part of its public API. IIRC in the previous thread someone had mentioned the abstract_code parse transform, which is nice and all but I think this should be just happen and the information should be available at runtime as proper module attributes. How are record member/element types handled in the abstract code? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeraymond@REDACTED Thu Jan 5 02:57:27 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Wed, 4 Jan 2012 20:57:27 -0500 Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available Message-ID: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> Hi, I'm running dialyzer on an app. I've built the plt for the apps I'm using one of which is cowboy. I've implemented cowboy's cowboy_http_handler behaviour. When I run dialyzer is outputs the warning, "my_http_handler:10: Callback info about the cowboy_http_handler behaviour is not available". How can I teach dialyzer about the cowboy_http_handler behaviour? Thanks, Jeremy From fritchie@REDACTED Thu Jan 5 04:23:38 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 04 Jan 2012 21:23:38 -0600 Subject: [erlang-questions] no next heap size found: 18446744071896091830, offset 0 Message-ID: <76122.1325733818@snookles.snookles.com> Hi. This was a fun one coming from an OpenSolaris 64-bit box running Erlang/OTP R14B03. Searching my archive of erlang-questions and erlang-bugs mailing lists hasn't found a match on 'no next heap size' string ... except for a formatting bug where the heap size is reported as negative. [root@REDACTED /var/log/riak]# head -20 erl_crash.dump.slf.0 =erl_crash_dump:0.1 Thu Jan 5 01:03:52 2012 Slogan: no next heap size found: 18446744071896091830, offset 0 System version: Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async-threads:571] [kernel-poll:true] Compiled: Mon Jul 25 18:05:12 2011 Taints: eleveldb,crypto,bitcask_nifs Atoms: 14581 =memory total: 34190115856 processes: 33980165896 processes_used: 33980126736 system: 209949960 atom: 986689 atom_used: 982563 binary: 154769656 code: 9219672 ets: 712592 =hash_table:atom_tab size: 9643 used: 7479 Riak was running at the time, and a zillion error messages were generated & sent to the error logger by gen_gsm and handled by Andrew Thompson's "lager" application. The 'lager_crash_log' process ended up with 31K messages in its Erlang mailbox, which is quite a lot ... and the app was generating a few thousand error messages per second, which meant that we were probably going to run out of memory anyway due to Erlang mailbox growth. However, having a memory allocation fail for the reason shown above isn't good. Has anyone else seen this error on R14B03? Or later? -Scott P.S. Here's the scoop on the memory hog proc: =proc:<0.43.0> State: Garbing Name: lager_crash_log Spawned as: proc_lib:init_p/5 Last scheduled in for: io_lib_format:iolist_to_chars/1 Spawned by: <0.40.0> Started: Fri Dec 30 00:29:38 2011 Message queue length: 31694 Number of heap fragments: 0 Heap fragment data: 0 Link list: [#Port<0.33849890>, <0.40.0>] Reductions: 8749820516 Stack+heap: 4148490785 OldHeap: 0 Heap unused: 3072286602 OldHeap unused: 0 Program counter: 0x000000000386f1c0 (io_lib_format:iolist_to_chars/1 + 8) CP: 0x0000000000000000 (invalid) From mrtndimitrov@REDACTED Thu Jan 5 10:25:06 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Thu, 05 Jan 2012 11:25:06 +0200 Subject: [erlang-questions] character encoding and xmerl Message-ID: <4F056C72.5070809@gmail.com> Hello, In our app we upload a XML file through simple form. The page is encoded in UTF-8 as well as the file. YAWS gathers the parts of the file, flattens them and sends them to xmerl. The XML is scanned through xmerl_scan:string with {encoding, "utf-8"}. When I dump the string the Cyrillic word ??????? is printed as 208,191,209,128,208,190,208,180,209,131,208,186,209,130. After the scan, the Cyrillic word is printed as 1087,1088,1086,1076,1091,1082,1090 which, according to my believes, is the correct Unicode representation. The problem is when our internal structures are exported to XML. Then trying to scan the XML again, xmerl reports: {fatal,{{unexpected_char,{error,{bad_character,1087}}} Thanks in advance, Martin From olivier.boudeville@REDACTED Thu Jan 5 10:37:17 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 5 Jan 2012 10:37:17 +0100 Subject: [erlang-questions] PLT for R15B Message-ID: Hi, Just to report a few warnings that are output when generating the full PLT for R15B, as it may highlight a few minor defects: """ client_server.erl:34: Call to missing or unexported function ssl:seed/1 client_server.erl:49: Call to missing or unexported function ssl:peercert/2 client_server.erl:66: Call to missing or unexported function ssl:peercert/2 eunit_test.erl:302: Call to missing or unexported function eunit_test:nonexisting_function/0 xrc.erl:124: Call to missing or unexported function wxXmlResource:reload/2 Unknown functions: asn1rt_driver_handler:load_driver/0 wxWindows:'Destroy'/1 wx_core:quit/0 """ On a side note, even before R15B, on some low-end computers (typically a 32-bit laptop with only 1GB of RAM, yet with some swap) we were not able anymore to generate that kind of full PLT, due to memory exhaustion. As for eunit_test:nonexisting_function/0, this does not look at all as a defect, so it might be interesting to be able to hide those expected warnings one way or another (dialyzer suppression files anyone?). Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Jan 5 10:52:46 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 5 Jan 2012 10:52:46 +0100 Subject: [erlang-questions] PLT for R15B In-Reply-To: References: Message-ID: <1325757166.5285.12.camel@seasc0625> Greetings, You mention that you no longer get memory exhaustion when building a PLT for OTP. Is this correct? When I did dialyzer -build_otp -r lib/*-0/ebin I run out of memory on a 4 GB Linux machine. bengt On Thu, 2012-01-05 at 10:37 +0100, Olivier BOUDEVILLE wrote: > > Hi, > > Just to report a few warnings that are output when generating the full > PLT for R15B, as it may highlight a few minor defects: > > """ > client_server.erl:34: Call to missing or unexported function > ssl:seed/1 > client_server.erl:49: Call to missing or unexported function > ssl:peercert/2 > client_server.erl:66: Call to missing or unexported function > ssl:peercert/2 > eunit_test.erl:302: Call to missing or unexported function > eunit_test:nonexisting_function/0 > xrc.erl:124: Call to missing or unexported function > wxXmlResource:reload/2 > Unknown functions: > asn1rt_driver_handler:load_driver/0 > wxWindows:'Destroy'/1 > wx_core:quit/0 > """ > > On a side note, even before R15B, on some low-end computers (typically > a 32-bit laptop with only 1GB of RAM, yet with some swap) we were not > able anymore to generate that kind of full PLT, due to memory > exhaustion. > > As for eunit_test:nonexisting_function/0, this does not look at all as > a defect, so it might be interesting to be able to hide those expected > warnings one way or another (dialyzer suppression files anyone?). > > Best regards, > > Olivier. > --------------------------- > Olivier Boudeville > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 > 47 65 27 13 > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > ?tablis ? l'intention exclusive des destinataires et les informations > qui y figurent sont strictement confidentielles. Toute utilisation de > ce Message non conforme ? sa destination, toute diffusion ou toute > publication totale ou partielle, est interdite sauf autorisation > expresse. > > Si vous n'?tes pas le destinataire de ce Message, il vous est interdit > de le copier, de le faire suivre, de le divulguer ou d'en utiliser > tout ou partie. Si vous avez re?u ce Message par erreur, merci de le > supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en > garder aucune trace sur quelque support que ce soit. Nous vous > remercions ?galement d'en avertir imm?diatement l'exp?diteur par > retour du message. > > Il est impossible de garantir que les communications par messagerie > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de > toute erreur ou virus. > ____________________________________________________ > > This message and any attachments (the 'Message') are intended solely > for the addressees. The information contained in this Message is > confidential. Any use of information contained in this Message not in > accord with its purpose, any dissemination or disclosure, either whole > or partial, is prohibited except formal approval. > > If you are not the addressee, you may not copy, forward, disclose or > use any part of it. If you have received this message in error, please > delete it and all copies from your system and notify the sender > immediately by return message. > > E-mail communication cannot be guaranteed to be timely secure, error > or virus-free. From attila.r.nohl@REDACTED Thu Jan 5 11:01:20 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 5 Jan 2012 11:01:20 +0100 Subject: [erlang-questions] PLT for R15B In-Reply-To: References: Message-ID: 2012/1/5, Olivier BOUDEVILLE : > Hi, > > Just to report a few warnings that are output when generating the full PLT > for R15B, as it may highlight a few minor defects: > > """ > client_server.erl:34: Call to missing or unexported function ssl:seed/1 > client_server.erl:49: Call to missing or unexported function > ssl:peercert/2 > client_server.erl:66: Call to missing or unexported function > ssl:peercert/2 > eunit_test.erl:302: Call to missing or unexported function > eunit_test:nonexisting_function/0 > xrc.erl:124: Call to missing or unexported function wxXmlResource:reload/2 The client_server and the xrc seem to be not updated example code, so I don't think it's a defect in OTP itself. Of course, it would be nice to fix the examples. On the other hand I can't use the R15B dialyzer on our product, it hangs. Actually it's quite hard to decide if it hangs or just slow, but with R14B dialyzer finished in 10 minutes on a particular set of files, but in R15B dialyzer doesn't finish in 3 hours, so I guess it's a hang. Is there a simple way to check if dialyzer is still alive? It would make finding the minimal example easier. From olivier.boudeville@REDACTED Thu Jan 5 11:27:03 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 5 Jan 2012 11:27:03 +0100 Subject: [erlang-questions] PLT for R15B In-Reply-To: <1325757166.5285.12.camel@seasc0625> Message-ID: Hi, Not exactly, the computers we use routinely have at least 8GB of RAM, so we hadn't noticed anything until trying to do the same with older laptops. I was thinking that due to the better compactness of 32-bit VMs and to the potential use of swap (I *suppose* it was used indeed) this could have worked on these computers, but even in a lean and mean context with as much memory freed as possible before launching Dialyzer, this could not do the trick. Actually we integrated some time ago an automatic PLT generation into our custom script to install Erlang (from sources), this is why we ended up generating the PLT on different kinds of computers (not knowing to what extent we could build once for all a PLT for a given Erlang version; architectures and paths may differ, possibly causing issues). It boils down in our case to run: $dialyzer_exec --build_plt -r $erlang_beam_root --output_plt $actual_plt_file and indeed it is quite long (less than two hours here, though) but terminates (provided there is enough RAM of course). Not sure such a PLT could be generated incrementally in a simple manner with the same global level of checking? Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 bengt.kleberg@REDACTED Envoy? par : erlang-questions-bounces@REDACTED 05/01/2012 10:53 Veuillez r?pondre ? bengt.kleberg@REDACTED A undisclosed-recipients:; cc erlang-questions@REDACTED Objet Re: [erlang-questions] PLT for R15B Greetings, You mention that you no longer get memory exhaustion when building a PLT for OTP. Is this correct? When I did dialyzer -build_otp -r lib/*-0/ebin I run out of memory on a 4 GB Linux machine. bengt On Thu, 2012-01-05 at 10:37 +0100, Olivier BOUDEVILLE wrote: > > Hi, > > Just to report a few warnings that are output when generating the full > PLT for R15B, as it may highlight a few minor defects: > > """ > client_server.erl:34: Call to missing or unexported function > ssl:seed/1 > client_server.erl:49: Call to missing or unexported function > ssl:peercert/2 > client_server.erl:66: Call to missing or unexported function > ssl:peercert/2 > eunit_test.erl:302: Call to missing or unexported function > eunit_test:nonexisting_function/0 > xrc.erl:124: Call to missing or unexported function > wxXmlResource:reload/2 > Unknown functions: > asn1rt_driver_handler:load_driver/0 > wxWindows:'Destroy'/1 > wx_core:quit/0 > """ > > On a side note, even before R15B, on some low-end computers (typically > a 32-bit laptop with only 1GB of RAM, yet with some swap) we were not > able anymore to generate that kind of full PLT, due to memory > exhaustion. > > As for eunit_test:nonexisting_function/0, this does not look at all as > a defect, so it might be interesting to be able to hide those expected > warnings one way or another (dialyzer suppression files anyone?). > > Best regards, > > Olivier. > --------------------------- > Olivier Boudeville > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 > 47 65 27 13 > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > ?tablis ? l'intention exclusive des destinataires et les informations > qui y figurent sont strictement confidentielles. Toute utilisation de > ce Message non conforme ? sa destination, toute diffusion ou toute > publication totale ou partielle, est interdite sauf autorisation > expresse. > > Si vous n'?tes pas le destinataire de ce Message, il vous est interdit > de le copier, de le faire suivre, de le divulguer ou d'en utiliser > tout ou partie. Si vous avez re?u ce Message par erreur, merci de le > supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en > garder aucune trace sur quelque support que ce soit. Nous vous > remercions ?galement d'en avertir imm?diatement l'exp?diteur par > retour du message. > > Il est impossible de garantir que les communications par messagerie > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de > toute erreur ou virus. > ____________________________________________________ > > This message and any attachments (the 'Message') are intended solely > for the addressees. The information contained in this Message is > confidential. Any use of information contained in this Message not in > accord with its purpose, any dissemination or disclosure, either whole > or partial, is prohibited except formal approval. > > If you are not the addressee, you may not copy, forward, disclose or > use any part of it. If you have received this message in error, please > delete it and all copies from your system and notify the sender > immediately by return message. > > E-mail communication cannot be guaranteed to be timely secure, error > or virus-free. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Jan 5 11:40:34 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 05 Jan 2012 12:40:34 +0200 Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> Message-ID: <4F057E22.7080509@cs.ntua.gr> On 01/05/12 03:57, Jeremy Raymond wrote: > Hi, > > I'm running dialyzer on an app. I've built the plt for the apps I'm using one of which is cowboy. I've implemented cowboy's cowboy_http_handler behaviour. When I run dialyzer is outputs the warning, "my_http_handler:10: Callback info about the cowboy_http_handler behaviour is not available". How can I teach dialyzer about the cowboy_http_handler behaviour? Dialyzer's message means that this particular behaviour module has not been adapted to specify type information about its callbacks. (This is of course understandable given that this is a new language addition.) I've taken a look at the source code of this particular module: https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl and it appears to be very minimal. (As a matter of fact, I am a bit baffled by its minimality.) To avoid this warning the developers of cowboy need to adapt its code so that it contains -callback attributes instead of a behaviour_info/1 function. (This function will be generated automatically if callback attributes are present.) But of course this will mean that cowboy will require R15B. Until this change is done, you can either create your own version of this module with proper callback information in it, or use the -Wno_behaviours command line option of dialyzer. Kostis From gustav.simonsson@REDACTED Thu Jan 5 11:46:04 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Thu, 05 Jan 2012 10:46:04 -0000 (GMT) Subject: [erlang-questions] no next heap size found: 18446744071896091830, offset 0 In-Reply-To: <76122.1325733818@snookles.snookles.com> Message-ID: <1c21acf1-4c1c-484f-a874-6a5201d86fb0@knuth> Hi, I'm not sure how relevant this is since it was due to a problem which was fixed in the R14B release, and you run R14B03, but I thought it might be useful to post it anyway for reference. It occurred on R13B04 on 32-bit Solaris 9 when an Erlang system ran out of disk space and mnesia could not write to logs. The crash was due to a bug in the virtual heap size calculations when a garbage collection cycle was triggered for binary values. There was a bugfix submitted for this problem in R14B: OTP-8730 "Reduce the risk of integer wrapping in bin vheap size counting." =erl_crash_dump:0.1 Wed Sep 21 15:57:37 2011 Slogan: no next heap size found: -12451840, offset 0 System version: Erlang R13B04 (erts-5.7.5) [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Compiled: Tue Feb 23 02:14:48 2010 Taints: Atoms: 14907 =memory total: 68052336 processes: 6551620 processes_used: 6548052 system: 61500716 atom: 660801 atom_used: 650690 binary: 46042376 code: 3280578 ets: 10677116 Garbing process: =proc:<0.149.0> State: Garbing Spawned as: proc_lib:init_p/5 Last scheduled in for: dets:foldl_bins/2 Spawned by: <0.64.0> Started: Wed Sep 21 15:57:37 2011 Message queue length: 0 Number of heap fragments: 1 Heap fragment data: 398 Link list: [#Port<0.2027>, <0.65.0>, <0.64.0>, {from,<0.146.0>,#Ref<0.0.0.1469>}] Reductions: 16937 Stack+heap: 196418 OldHeap: 196418 Heap unused: 80 OldHeap unused: 196418 Program counter: 0x00722330 (dets:foldl_bins/2 + 4) CP: 0x00000000 (invalid) Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Scott Lystig Fritchie" To: erlang-questions@REDACTED Sent: Thursday, 5 January, 2012 4:23:38 AM Subject: [erlang-questions] no next heap size found: 18446744071896091830, offset 0 Hi. This was a fun one coming from an OpenSolaris 64-bit box running Erlang/OTP R14B03. Searching my archive of erlang-questions and erlang-bugs mailing lists hasn't found a match on 'no next heap size' string ... except for a formatting bug where the heap size is reported as negative. [root@REDACTED /var/log/riak]# head -20 erl_crash.dump.slf.0 =erl_crash_dump:0.1 Thu Jan 5 01:03:52 2012 Slogan: no next heap size found: 18446744071896091830, offset 0 System version: Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async-threads:571] [kernel-poll:true] Compiled: Mon Jul 25 18:05:12 2011 Taints: eleveldb,crypto,bitcask_nifs Atoms: 14581 =memory total: 34190115856 processes: 33980165896 processes_used: 33980126736 system: 209949960 atom: 986689 atom_used: 982563 binary: 154769656 code: 9219672 ets: 712592 =hash_table:atom_tab size: 9643 used: 7479 Riak was running at the time, and a zillion error messages were generated & sent to the error logger by gen_gsm and handled by Andrew Thompson's "lager" application. The 'lager_crash_log' process ended up with 31K messages in its Erlang mailbox, which is quite a lot ... and the app was generating a few thousand error messages per second, which meant that we were probably going to run out of memory anyway due to Erlang mailbox growth. However, having a memory allocation fail for the reason shown above isn't good. Has anyone else seen this error on R14B03? Or later? -Scott P.S. Here's the scoop on the memory hog proc: =proc:<0.43.0> State: Garbing Name: lager_crash_log Spawned as: proc_lib:init_p/5 Last scheduled in for: io_lib_format:iolist_to_chars/1 Spawned by: <0.40.0> Started: Fri Dec 30 00:29:38 2011 Message queue length: 31694 Number of heap fragments: 0 Heap fragment data: 0 Link list: [#Port<0.33849890>, <0.40.0>] Reductions: 8749820516 Stack+heap: 4148490785 OldHeap: 0 Heap unused: 3072286602 OldHeap unused: 0 Program counter: 0x000000000386f1c0 (io_lib_format:iolist_to_chars/1 + 8) CP: 0x0000000000000000 (invalid) _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Thu Jan 5 11:51:12 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 5 Jan 2012 11:51:12 +0100 Subject: [erlang-questions] PLT for R15B In-Reply-To: References: Message-ID: <1325760672.5285.25.camel@seasc0625> To build a OTP PLT on a 4 G machine I do a shell loop like this: for ( i in lib/*0/ebin ) { dialyzer -add_to_plt -r $i } I have not considered the possibility that this will make me miss some warnings. Will it? bengt On Thu, 2012-01-05 at 11:27 +0100, Olivier BOUDEVILLE wrote: > > Hi, > > Not exactly, the computers we use routinely have at least 8GB of RAM, > so we hadn't noticed anything until trying to do the same with older > laptops. > > I was thinking that due to the better compactness of 32-bit VMs and to > the potential use of swap (I *suppose* it was used indeed) this could > have worked on these computers, but even in a lean and mean context > with as much memory freed as possible before launching Dialyzer, this > could not do the trick. > > Actually we integrated some time ago an automatic PLT generation into > our custom script to install Erlang (from sources), this is why we > ended up generating the PLT on different kinds of computers (not > knowing to what extent we could build once for all a PLT for a given > Erlang version; architectures and paths may differ, possibly causing > issues). > > It boils down in our case to run: $dialyzer_exec --build_plt -r > $erlang_beam_root --output_plt $actual_plt_file > > and indeed it is quite long (less than two hours here, though) but > terminates (provided there is enough RAM of course). > > Not sure such a PLT could be generated incrementally in a simple > manner with the same global level of checking? > > Best regards, > > Olivier. > --------------------------- > Olivier Boudeville > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 > 47 65 27 13 > > > bengt.kleberg@REDACTED > Envoy? par : > erlang-questions-bounces@REDACTED > > 05/01/2012 10:53 > Veuillez r?pondre ? > bengt.kleberg@REDACTED > > > > > A > undisclosed-recipients:; > cc > erlang-questions@REDACTED > Objet > Re: > [erlang-questions] PLT for R15B > > > > > > > > > Greetings, > > You mention that you no longer get memory exhaustion when building a > PLT > for OTP. Is this correct? When I did > > dialyzer -build_otp -r lib/*-0/ebin > > I run out of memory on a 4 GB Linux machine. > > > bengt > > On Thu, 2012-01-05 at 10:37 +0100, Olivier BOUDEVILLE wrote: > > > > Hi, > > > > Just to report a few warnings that are output when generating the > full > > PLT for R15B, as it may highlight a few minor defects: > > > > """ > > client_server.erl:34: Call to missing or unexported function > > ssl:seed/1 > > client_server.erl:49: Call to missing or unexported function > > ssl:peercert/2 > > client_server.erl:66: Call to missing or unexported function > > ssl:peercert/2 > > eunit_test.erl:302: Call to missing or unexported function > > eunit_test:nonexisting_function/0 > > xrc.erl:124: Call to missing or unexported function > > wxXmlResource:reload/2 > > Unknown functions: > > asn1rt_driver_handler:load_driver/0 > > wxWindows:'Destroy'/1 > > wx_core:quit/0 > > """ > > > > On a side note, even before R15B, on some low-end computers > (typically > > a 32-bit laptop with only 1GB of RAM, yet with some swap) we were > not > > able anymore to generate that kind of full PLT, due to memory > > exhaustion. > > > > As for eunit_test:nonexisting_function/0, this does not look at all > as > > a defect, so it might be interesting to be able to hide those > expected > > warnings one way or another (dialyzer suppression files anyone?). > > > > Best regards, > > > > Olivier. > > --------------------------- > > Olivier Boudeville > > > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 > 1 > > 47 65 27 13 > > > > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > > ?tablis ? l'intention exclusive des destinataires et les > informations > > qui y figurent sont strictement confidentielles. Toute utilisation > de > > ce Message non conforme ? sa destination, toute diffusion ou toute > > publication totale ou partielle, est interdite sauf autorisation > > expresse. > > > > Si vous n'?tes pas le destinataire de ce Message, il vous est > interdit > > de le copier, de le faire suivre, de le divulguer ou d'en utiliser > > tout ou partie. Si vous avez re?u ce Message par erreur, merci de le > > supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en > > garder aucune trace sur quelque support que ce soit. Nous vous > > remercions ?galement d'en avertir imm?diatement l'exp?diteur par > > retour du message. > > > > Il est impossible de garantir que les communications par messagerie > > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de > > toute erreur ou virus. > > ____________________________________________________ > > > > This message and any attachments (the 'Message') are intended solely > > for the addressees. The information contained in this Message is > > confidential. Any use of information contained in this Message not > in > > accord with its purpose, any dissemination or disclosure, either > whole > > or partial, is prohibited except formal approval. > > > > If you are not the addressee, you may not copy, forward, disclose or > > use any part of it. If you have received this message in error, > please > > delete it and all copies from your system and notify the sender > > immediately by return message. > > > > E-mail communication cannot be guaranteed to be timely secure, error > > or virus-free. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > ?tablis ? l'intention exclusive des destinataires et les informations > qui y figurent sont strictement confidentielles. Toute utilisation de > ce Message non conforme ? sa destination, toute diffusion ou toute > publication totale ou partielle, est interdite sauf autorisation > expresse. > > Si vous n'?tes pas le destinataire de ce Message, il vous est interdit > de le copier, de le faire suivre, de le divulguer ou d'en utiliser > tout ou partie. Si vous avez re?u ce Message par erreur, merci de le > supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en > garder aucune trace sur quelque support que ce soit. Nous vous > remercions ?galement d'en avertir imm?diatement l'exp?diteur par > retour du message. > > Il est impossible de garantir que les communications par messagerie > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de > toute erreur ou virus. > ____________________________________________________ > > This message and any attachments (the 'Message') are intended solely > for the addressees. The information contained in this Message is > confidential. Any use of information contained in this Message not in > accord with its purpose, any dissemination or disclosure, either whole > or partial, is prohibited except formal approval. > > If you are not the addressee, you may not copy, forward, disclose or > use any part of it. If you have received this message in error, please > delete it and all copies from your system and notify the sender > immediately by return message. > > E-mail communication cannot be guaranteed to be timely secure, error > or virus-free. From zabrane3@REDACTED Thu Jan 5 12:27:26 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 5 Jan 2012 12:27:26 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" Message-ID: Hi guys, Is there any preference between running a VM in a "detached mode" (i.e erl -detached ...) or simply running it inside "screen" for example witout detaching from it (i.e erl ...) ? What are the pros/cons? Best practices? Regards, Zabrane From heinz@REDACTED Thu Jan 5 13:45:40 2012 From: heinz@REDACTED (Heinz N. Gies) Date: Thu, 5 Jan 2012 13:45:40 +0100 Subject: [erlang-questions] character encoding and xmerl In-Reply-To: <4F056C72.5070809@gmail.com> References: <4F056C72.5070809@gmail.com> Message-ID: http://ferd.ca/will-the-real-unicode-wrangler-please-stand-up.html is a good article about erlang and Unicode, I am not 100% sure but I think it might help you :) -- Heinz N. Gies heinz@REDACTED http://licenser.net On Jan 5, 2012, at 10:25, Martin Dimitrov wrote: > Hello, > > In our app we upload a XML file through simple form. The page is encoded > in UTF-8 as well as the file. > > YAWS gathers the parts of the file, flattens them and sends them to > xmerl. The XML is scanned through xmerl_scan:string with {encoding, > "utf-8"}. When I dump the string the Cyrillic word ??????? is printed as > 208,191,209,128,208,190,208,180,209,131,208,186,209,130. > > After the scan, the Cyrillic word is printed as > 1087,1088,1086,1076,1091,1082,1090 which, according to my believes, is > the correct Unicode representation. > > The problem is when our internal structures are exported to XML. Then > trying to scan the XML again, xmerl reports: > > {fatal,{{unexpected_char,{error,{bad_character,1087}}} > > > Thanks in advance, > > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From cgsmcmlxxv@REDACTED Thu Jan 5 14:03:37 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Thu, 05 Jan 2012 14:03:37 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: Message-ID: <4F059FA9.8080506@gmail.com> Hi, One major preference to use -detached (implies -noinput which implies further -noshell) option is when you want to create a persistent application which doesn't depend on your connection with the machine where you run the application. It is similar with "nohup" command under Linux. It also implies the use of less resources than "screen", but with no capability to interact directly with it. CGS On 01/05/2012 12:27 PM, Zabrane Mickael wrote: > Hi guys, > > Is there any preference between running a VM in a "detached mode" (i.e erl -detached ...) > or simply running it inside "screen" for example witout detaching from it (i.e erl ...) ? > > What are the pros/cons? > Best practices? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bgustavsson@REDACTED Thu Jan 5 14:26:05 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Thu, 5 Jan 2012 14:26:05 +0100 Subject: [erlang-questions] no next heap size found: 18446744071896091830, offset 0 In-Reply-To: <76122.1325733818@snookles.snookles.com> References: <76122.1325733818@snookles.snookles.com> Message-ID: On 1/5/12, Scott Lystig Fritchie wrote: > Hi. This was a fun one coming from an OpenSolaris 64-bit box running > Erlang/OTP R14B03. Searching my archive of erlang-questions and > erlang-bugs mailing lists hasn't found a match on 'no next heap size' > string ... except for a formatting bug where the heap size is > reported as negative. > There is a correction in the GC after R14B03 to handle huge heaps in a 64-bit emulator: https://github.com/erlang/otp/commit/caad36a5e2fc09d6a416fe31a7053bdfdb35c62d -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From gumm@REDACTED Thu Jan 5 14:26:07 2012 From: gumm@REDACTED (Jesse Gumm) Date: Thu, 5 Jan 2012 07:26:07 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <4F059FA9.8080506@gmail.com> References: <4F059FA9.8080506@gmail.com> Message-ID: I run under screen, since I run screen for everything already, it's nice to always have the erlang shell up and ready if I need it. -Jesse -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Jan 5, 2012 7:03 AM, "CGS" wrote: > Hi, > > One major preference to use -detached (implies -noinput which implies > further -noshell) option is when you want to create a persistent > application which doesn't depend on your connection with the machine where > you run the application. It is similar with "nohup" command under Linux. It > also implies the use of less resources than "screen", but with no > capability to interact directly with it. > > CGS > > > > > > On 01/05/2012 12:27 PM, Zabrane Mickael wrote: > >> Hi guys, >> >> Is there any preference between running a VM in a "detached mode" (i.e >> erl -detached ...) >> or simply running it inside "screen" for example witout detaching from it >> (i.e erl ...) ? >> >> What are the pros/cons? >> Best practices? >> >> Regards, >> Zabrane >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Thu Jan 5 14:43:49 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 5 Jan 2012 05:43:49 -0800 (PST) Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <4F057E22.7080509@cs.ntua.gr> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> Message-ID: <3d6ad073-c69e-4200-969a-092cae1e9ede@u32g2000yqe.googlegroups.com> Hmmmmm.... http://groups.google.com/group/erlang-programming/browse_thread/thread/e832d2b29dd76bd3/4c121493ee324e0e?lnk=gst&q=lundin+type+spec#4c121493ee324e0e On Jan 5, 4:40?am, Kostis Sagonas wrote: > To avoid this warning the developers of > cowboy need to adapt its code so that it contains -callback attributes > instead of a behaviour_info/1 function. (This function will be generated > automatically if callback attributes are present.) But of course this > will mean that cowboy will require R15B. Until this change is done, you > can either create your own version of this module with proper callback > information in it, or use the -Wno_behaviours command line option of > dialyzer. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Thu Jan 5 14:45:19 2012 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 5 Jan 2012 17:45:19 +0400 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <4F059FA9.8080506@gmail.com> Message-ID: <-6949086063001534207@unknownmsgid> We also run everything under screen. And it is nice to have shell = access to all things in the running system, but you must know what you do in there :-) Sent from my iPhone On 05.01.2012, at 17:26, Jesse Gumm wrote: I run under screen, since I run screen for everything already, it's nice to always have the erlang shell up and ready if I need it. -Jesse -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Jan 5, 2012 7:03 AM, "CGS" wrote: > Hi, > > One major preference to use -detached (implies -noinput which implies > further -noshell) option is when you want to create a persistent > application which doesn't depend on your connection with the machine where > you run the application. It is similar with "nohup" command under Linux. It > also implies the use of less resources than "screen", but with no > capability to interact directly with it. > > CGS > > > > > > On 01/05/2012 12:27 PM, Zabrane Mickael wrote: > >> Hi guys, >> >> Is there any preference between running a VM in a "detached mode" (i.e >> erl -detached ...) >> or simply running it inside "screen" for example witout detaching from it >> (i.e erl ...) ? >> >> What are the pros/cons? >> Best practices? >> >> Regards, >> Zabrane >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Jan 5 15:01:47 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 05 Jan 2012 16:01:47 +0200 Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <3d6ad073-c69e-4200-969a-092cae1e9ede@u32g2000yqe.googlegroups.com> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> <3d6ad073-c69e-4200-969a-092cae1e9ede@u32g2000yqe.googlegroups.com> Message-ID: <4F05AD4B.1010605@cs.ntua.gr> On 01/05/12 15:43, Steve Davis wrote: > > Hmmmmm.... > > http://groups.google.com/group/erlang-programming/browse_thread/thread/e832d2b29dd76bd3/4c121493ee324e0e?lnk=gst&q=lundin+type+spec#4c121493ee324e0e Your point being what exactly?? That because specs are optional, dialyzer should not produce warnings when finding behaviour modules without callbacks? Running dialyzer is also optional... Kostis > On Jan 5, 4:40 am, Kostis Sagonas wrote: >> To avoid this warning the developers of >> cowboy need to adapt its code so that it contains -callback attributes >> instead of a behaviour_info/1 function. (This function will be generated >> automatically if callback attributes are present.) But of course this >> will mean that cowboy will require R15B. Until this change is done, you >> can either create your own version of this module with proper callback >> information in it, or use the -Wno_behaviours command line option of >> dialyzer. >> >> Kostis >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ericbmerritt@REDACTED Thu Jan 5 16:29:23 2012 From: ericbmerritt@REDACTED (Eric Merritt) Date: Thu, 5 Jan 2012 10:29:23 -0500 Subject: [erlang-questions] Type specs unavailable in code compiled from core erlang? In-Reply-To: References: <1325630219.7537.18.camel@localhost.localdomain> Message-ID: On Wed, Jan 4, 2012 at 7:57 PM, Tim Watson wrote: > On 3 January 2012 22:36, Eric B Merritt wrote: >> >> >> This may argue for something Kenneth suggested back in may, that is >> keeping spec and types in their own dedicated chunk that does not >> disappear with the absence of debug information. >> > > Well +1 for keeping the types/specs *somewhere* in the beam regardless of > debug_info for sure. Personally I favour the idea that types/specs should be > present all the time, as they make up part of its public API. IIRC in the > previous thread someone had mentioned the abstract_code parse transform, > which is nice and all but I think this should be just happen and the > information should be available at runtime as proper module attributes. Agreed on all most all points, except the module attributes (depending on what you mean by module attributes). It should be in the beam chunk data, and absolutely should be returned by module_info. However, I don't like overloading the attributes chunk with this additional data. It should be in its own place. Time for an EEP I think. > > How are record member/element types handled in the abstract code? From francesco@REDACTED Thu Jan 5 16:41:28 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 05 Jan 2012 15:41:28 +0000 Subject: [erlang-questions] Open Source Convention, talk proposals deadline Jan 12th Message-ID: <4F05C4A8.9040403@erlang-solutions.com> A reminder that the deadline for submitting talks to OSCON 2012 in Portland late July is January 12th. It would be great to see open source Erlang applications and experience reports represented in one of the many tracks. http://www.oscon.com/oscon2012/ There is a wide range of subjects where Erlang talks would be a perfect fit, from startup stacks, code quality, best practices, mobile devices and data. With thousands of delegates, OSCON is a great conference to attend and speak at. I warmly recommend it. Francesco -- Erlang Solutions Ltd. http://www.erlang-solutions.com From james@REDACTED Thu Jan 5 18:19:20 2012 From: james@REDACTED (James Aimonetti) Date: Thu, 5 Jan 2012 09:19:20 -0800 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <-6949086063001534207@unknownmsgid> References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> Message-ID: <4F05DB98.3010000@2600hz.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 We run everything in detached mode, and use a bash script to connect to the VM when we need access to it directly. Our bash script boils down to: exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} with SHELL_NAME usually generated by SHELL_NAME = "con_$(date +%s)@`hostname`". You won't get tab-complete on your modules/functions (I think the standard erlang modules work though), but it works well enough for our purposes. On 01/05/2012 05:45 AM, Max Bourinov wrote: > We also run everything under screen. And it is nice to have shell = access > to all things in the running system, but you must know what you do in there > :-) > > Sent from my iPhone > > On 05.01.2012, at 17:26, Jesse Gumm wrote: > > I run under screen, since I run screen for everything already, it's nice to > always have the erlang shell up and ready if I need it. > > -Jesse > > -- > Jesse Gumm > Owner, Sigma Star Systems > 414.940.4866 > www.sigma-star.com > @jessegumm > On Jan 5, 2012 7:03 AM, "CGS" wrote: > >> Hi, >> >> One major preference to use -detached (implies -noinput which implies >> further -noshell) option is when you want to create a persistent >> application which doesn't depend on your connection with the machine where >> you run the application. It is similar with "nohup" command under Linux. It >> also implies the use of less resources than "screen", but with no >> capability to interact directly with it. >> >> CGS >> >> >> >> >> >> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >> >>> Hi guys, >>> >>> Is there any preference between running a VM in a "detached mode" (i.e >>> erl -detached ...) >>> or simply running it inside "screen" for example witout detaching from it >>> (i.e erl ...) ? >>> >>> What are the pros/cons? >>> Best practices? >>> >>> Regards, >>> Zabrane >>> >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions - -- James Aimonetti Distributed Systems Engineer / DJ MC_ 2600hz | http://2600hz.com sip:james@REDACTED tel: 415.886.7905 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= =ajkn -----END PGP SIGNATURE----- From watson.timothy@REDACTED Thu Jan 5 19:20:40 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 5 Jan 2012 18:20:40 +0000 Subject: [erlang-questions] Type specs unavailable in code compiled from core erlang? In-Reply-To: References: <1325630219.7537.18.camel@localhost.localdomain> Message-ID: On 5 January 2012 15:29, Eric Merritt wrote: > > Agreed on all most all points, except the module attributes (depending > on what you mean by module attributes). It should be in the beam chunk > data, and absolutely should be returned by module_info. However, I > don't like overloading the attributes chunk with this additional data. > It should be in its own place. Time for an EEP I think. > > I didn't make myself very clear there did I. Indeed when I said "attributes" I was referring to what gets returned from module_info/0 rather than the attributes chunk - a separate chunk would be much better. Even better still would be the ability to do module_info(specs). Does the existing module_info return value contain any information about exported types? If not, would you want something like module_info(exported_types) as well? Also, both dialyzer and PropEr seem to have some concept of a type_server that has utility functions for inspecting and interacting with types. Personally I think a utility module/library (after erl_syntax/erl_syntax_lib and the like) would make for a worthwhile (separate) EEP also. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericbmerritt@REDACTED Thu Jan 5 21:11:59 2012 From: ericbmerritt@REDACTED (Eric Merritt) Date: Thu, 5 Jan 2012 15:11:59 -0500 Subject: [erlang-questions] Type specs unavailable in code compiled from core erlang? In-Reply-To: References: <1325630219.7537.18.camel@localhost.localdomain> Message-ID: > I didn't make myself very clear there did I. Indeed when I said "attributes" > I was referring to what gets returned from module_info/0 rather than the > attributes chunk - a separate chunk would be much better.?Even better still > would be the ability to do module_info(specs). Does the existing module_info > return value contain any information about exported types? If not, would you > want something like module_info(exported_types) as well? We are in agreement across the board. Though, non-exported types are not actually useful outside of the module itself I don't believe, assuming of course, that all types used in specs for publicly exported functions are also exported. So your module_info(exported_types) is really a synonym for module_info(types). I hope that description is as clear in what I have written as it is in my head. > > Also, both dialyzer and PropEr seem to have some concept of a type_server > that has utility functions for inspecting and interacting with types. > Personally I think a utility module/library (after erl_syntax/erl_syntax_lib > and the like) would make for a?worthwhile?(separate) EEP also. I agree, though I don't see why they shouldn't be part of the same eep? From magnus.klaar@REDACTED Thu Jan 5 22:08:43 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Thu, 5 Jan 2012 22:08:43 +0100 Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <4F057E22.7080509@cs.ntua.gr> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> Message-ID: Hi! We created a development branch for adding this information to this, and other behaviors and came to the same conclusion, we'd have to drop R14 support, something which we cannot do when we know that there are users who still haven't upgraded their production environments to R15. It was a rather negative surprise to see the build fail after having put great care into making sure the -callback specifications were accurate. ;) Since we're on the subject, is there currently a good way to add specifications for optional callback functions? I noticed that there is no specification for the format_status/2 callback in the gen_* behaviors. We're interested in this for our REST resources. The basho guys have a great description of this type of interface at http://wiki.basho.com/Webmachine-Resource.html . The main point is "There are over 30 resource functions you can define, but any of them can be omitted as they have reasonable defaults.". MVH Magnus On Thu, Jan 5, 2012 at 11:40 AM, Kostis Sagonas wrote: > > and it appears to be very minimal. (As a matter of fact, I am a bit > baffled by its minimality.) To avoid this warning the developers of cowboy > need to adapt its code so that it contains -callback attributes instead of > a behaviour_info/1 function. (This function will be generated automatically > if callback attributes are present.) But of course this will mean that > cowboy will require R15B. Until this change is done, you can either create > your own version of this module with proper callback information in it, or > use the -Wno_behaviours command line option of dialyzer. > > Kostis > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.goertzen@REDACTED Thu Jan 5 23:01:50 2012 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Thu, 5 Jan 2012 16:01:50 -0600 Subject: [erlang-questions] ets access from NIF thread? Message-ID: I was wondering if NIF threads will be able to access ets tables at some point in the future. Is this feasible in the current VM? A work around is of course to make my own shared table that provides both a NIF and C API, but leveraging ets seems convenient. Dan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Thu Jan 5 23:53:59 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Thu, 5 Jan 2012 23:53:59 +0100 Subject: [erlang-questions] Differences between erlang:system_profile and erlang:trace In-Reply-To: <4F02C509.3030106@erlang.org> References: <4F02C509.3030106@erlang.org> Message-ID: Hi! As far as i can tell, this is fixed in https://github.com/erlang/otp/commit/195be9a44f2481b9c575c8ad286f4d2278b831b3, thanks. MVH Magnus 2012/1/3 Bj?rn-Egil Dahlberg > From what I remember (trying to recall something written five years ago) > system_profile used to respect this policy but from looking at the code it > seems like it doesn't now. The tracing and scheduler queues has been > rewritten several times since then and it is possible that something has > been lost. > > I will have a look at it. Thank you for reporting this. > > Regards, > Bj?rn-Egil > > > On 2012-01-03 01:37, Magnus Klaar wrote: > > Hi! > > I'm seeing a strange behavior when using erlang:system_info/2 to trace > the running processes on an erlang node. I know it's flagged as > experimental so I will assume it's actually a feature even if the > documentation does not agree. When a process is used to receive the profile > messages from erlang:system_info/2 the receiving process is also profiled. > The effect of this is that the process receiving the profile messages will > receive an infinite sequence of 'inactive' ... 'active' ... 'inactive' .... > messages from the runtime system. The manpage states that the "The > receiver is excluded from all profiling.". I've compared this with using > the erlang:trace/3 function to trace running processes, when this function > is used the tracer processes never receives a message when the tracer > process scheduled. > > Two eunit tests for showing the difference: > https://gist.github.com/1552673 > > Running "erl -noshell -s system_profile test -s init stop" on my system > yields the following result: > > > system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For > others: 345 > > system_profile:13: system_profile_test_...*failed* > ::{assertion_failed,[{module,system_profile}, > {line,32}, > {expression,"SelfCount =:= 0"}, > {expected,true}, > {value,false}]} > > > system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For others: > 338 > > ======================================================= > Failed: 1. Skipped: 0. Passed: 1. > > > My questions are: Am I using it wrong? If so, how should it be used? If > not, Is it a bug? > > MVH Magnus > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 6 00:29:53 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 6 Jan 2012 00:29:53 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <4F05DB98.3010000@2600hz.com> References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> Message-ID: <7F18AF21-DF8D-4CC4-B36F-1AE3AA5FB2F3@gmail.com> Thanks for all your feedbacks guys ! Regards, Zabrane On Jan 5, 2012, at 6:19 PM, James Aimonetti wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > We run everything in detached mode, and use a bash script to connect to > the VM when we need access to it directly. > > Our bash script boils down to: > > exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} > > with SHELL_NAME usually generated by SHELL_NAME = "con_$(date > +%s)@`hostname`". > > You won't get tab-complete on your modules/functions (I think the > standard erlang modules work though), but it works well enough for our > purposes. > > On 01/05/2012 05:45 AM, Max Bourinov wrote: >> We also run everything under screen. And it is nice to have shell = access >> to all things in the running system, but you must know what you do in there >> :-) >> >> Sent from my iPhone >> >> On 05.01.2012, at 17:26, Jesse Gumm wrote: >> >> I run under screen, since I run screen for everything already, it's nice to >> always have the erlang shell up and ready if I need it. >> >> -Jesse >> >> -- >> Jesse Gumm >> Owner, Sigma Star Systems >> 414.940.4866 >> www.sigma-star.com >> @jessegumm >> On Jan 5, 2012 7:03 AM, "CGS" wrote: >> >>> Hi, >>> >>> One major preference to use -detached (implies -noinput which implies >>> further -noshell) option is when you want to create a persistent >>> application which doesn't depend on your connection with the machine where >>> you run the application. It is similar with "nohup" command under Linux. It >>> also implies the use of less resources than "screen", but with no >>> capability to interact directly with it. >>> >>> CGS >>> >>> >>> >>> >>> >>> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >>> >>>> Hi guys, >>>> >>>> Is there any preference between running a VM in a "detached mode" (i.e >>>> erl -detached ...) >>>> or simply running it inside "screen" for example witout detaching from it >>>> (i.e erl ...) ? >>>> >>>> What are the pros/cons? >>>> Best practices? >>>> >>>> Regards, >>>> Zabrane >>>> >>>> ______________________________**_________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>> >>> >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > - -- > James Aimonetti > Distributed Systems Engineer / DJ MC_ > > 2600hz | http://2600hz.com > sip:james@REDACTED > tel: 415.886.7905 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp > +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR > LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 > +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy > Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl > 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= > =ajkn > -----END PGP SIGNATURE----- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From wallentin.dahlberg@REDACTED Fri Jan 6 00:52:18 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Fri, 6 Jan 2012 00:52:18 +0100 Subject: [erlang-questions] Differences between erlang:system_profile and erlang:trace In-Reply-To: References: <4F02C509.3030106@erlang.org> Message-ID: Hopefully it will now work as intended. I should probably sent a mail but I forgot. Getting a lot of those these days. Give me a shout if something seems amiss. // Bj?rn-Egil Den 5 januari 2012 23:53 skrev Magnus Klaar : > Hi! > > As far as i can tell, this is fixed in > https://github.com/erlang/otp/commit/195be9a44f2481b9c575c8ad286f4d2278b831b3, > thanks. > > MVH Magnus > > > 2012/1/3 Bj?rn-Egil Dahlberg > >> From what I remember (trying to recall something written five years ago) >> system_profile used to respect this policy but from looking at the code it >> seems like it doesn't now. The tracing and scheduler queues has been >> rewritten several times since then and it is possible that something has >> been lost. >> >> I will have a look at it. Thank you for reporting this. >> >> Regards, >> Bj?rn-Egil >> >> >> On 2012-01-03 01:37, Magnus Klaar wrote: >> >> Hi! >> >> I'm seeing a strange behavior when using erlang:system_info/2 to trace >> the running processes on an erlang node. I know it's flagged as >> experimental so I will assume it's actually a feature even if the >> documentation does not agree. When a process is used to receive the profile >> messages from erlang:system_info/2 the receiving process is also profiled. >> The effect of this is that the process receiving the profile messages will >> receive an infinite sequence of 'inactive' ... 'active' ... 'inactive' .... >> messages from the runtime system. The manpage states that the "The >> receiver is excluded from all profiling.". I've compared this with using >> the erlang:trace/3 function to trace running processes, when this function >> is used the tracer processes never receives a message when the tracer >> process scheduled. >> >> Two eunit tests for showing the difference: >> https://gist.github.com/1552673 >> >> Running "erl -noshell -s system_profile test -s init stop" on my system >> yields the following result: >> >> >> system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For >> others: 345 >> >> system_profile:13: system_profile_test_...*failed* >> ::{assertion_failed,[{module,system_profile}, >> {line,32}, >> {expression,"SelfCount =:= 0"}, >> {expected,true}, >> {value,false}]} >> >> >> system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For others: >> 338 >> >> ======================================================= >> Failed: 1. Skipped: 0. Passed: 1. >> >> >> My questions are: Am I using it wrong? If so, how should it be used? If >> not, Is it a bug? >> >> MVH Magnus >> >> >> _______________________________________________ >> erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeraymond@REDACTED Fri Jan 6 02:40:25 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Thu, 5 Jan 2012 20:40:25 -0500 Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <4F057E22.7080509@cs.ntua.gr> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> Message-ID: Actually -Wno_undefined_callbacks is the correct option to disable the warning rather than -Wno_behaviours. Jeremy On 2012-01-05, at 5:40 AM, Kostis Sagonas wrote: > On 01/05/12 03:57, Jeremy Raymond wrote: >> Hi, >> >> I'm running dialyzer on an app. I've built the plt for the apps I'm using one of which is cowboy. I've implemented cowboy's cowboy_http_handler behaviour. When I run dialyzer is outputs the warning, "my_http_handler:10: Callback info about the cowboy_http_handler behaviour is not available". How can I teach dialyzer about the cowboy_http_handler behaviour? > > Dialyzer's message means that this particular behaviour module has not been adapted to specify type information about its callbacks. (This is of course understandable given that this is a new language addition.) > > I've taken a look at the source code of this particular module: > > https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl > > and it appears to be very minimal. (As a matter of fact, I am a bit baffled by its minimality.) To avoid this warning the developers of cowboy need to adapt its code so that it contains -callback attributes instead of a behaviour_info/1 function. (This function will be generated automatically if callback attributes are present.) But of course this will mean that cowboy will require R15B. Until this change is done, you can either create your own version of this module with proper callback information in it, or use the -Wno_behaviours command line option of dialyzer. > > Kostis From mononcqc@REDACTED Fri Jan 6 04:22:35 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 5 Jan 2012 22:22:35 -0500 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <4F05DB98.3010000@2600hz.com> References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> Message-ID: The tab support has been added to R15, if I recall. We run erl in -noshell mode, but always distributed. If the need arises, I use a remote shell (still started from the same node) to do my diagnostics/debugging, just connecting as a hidden node and starting a remote job with ^G. I find it nicer than using screen, especially since software like screen or tmux have sometimes frozen on me. In these cases, I think it's simpler to just start a new remote shell from a new connection and leave the application undisturbed. You just have to be careful not to type 'q()', 'halt()' or 'init:stop()' in the job running on the production node ;) I generally think it's nicer to do it that way than in a screen session -- that way you can daemonize your Erlang processes, and integrate them better in their environment. On Thu, Jan 5, 2012 at 12:19 PM, James Aimonetti wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > We run everything in detached mode, and use a bash script to connect to > the VM when we need access to it directly. > > Our bash script boils down to: > > exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} > > with SHELL_NAME usually generated by SHELL_NAME = "con_$(date > +%s)@`hostname`". > > You won't get tab-complete on your modules/functions (I think the > standard erlang modules work though), but it works well enough for our > purposes. > > On 01/05/2012 05:45 AM, Max Bourinov wrote: >> We also run everything under screen. And it is nice to have shell = access >> to all things in the running system, but you must know what you do in there >> :-) >> >> Sent from my iPhone >> >> On 05.01.2012, at 17:26, Jesse Gumm wrote: >> >> I run under screen, since I run screen for everything already, it's nice to >> always have the erlang shell up and ready if I need it. >> >> -Jesse >> >> -- >> Jesse Gumm >> Owner, Sigma Star Systems >> 414.940.4866 >> www.sigma-star.com >> @jessegumm >> On Jan 5, 2012 7:03 AM, "CGS" wrote: >> >>> Hi, >>> >>> One major preference to use -detached (implies -noinput which implies >>> further -noshell) option is when you want to create a persistent >>> application which doesn't depend on your connection with the machine where >>> you run the application. It is similar with "nohup" command under Linux. It >>> also implies the use of less resources than "screen", but with no >>> capability to interact directly with it. >>> >>> CGS >>> >>> >>> >>> >>> >>> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >>> >>>> Hi guys, >>>> >>>> Is there any preference between running a VM in a "detached mode" ?(i.e >>>> erl -detached ...) >>>> or simply running it inside "screen" for example witout detaching from it >>>> (i.e erl ...) ? >>>> >>>> What are the pros/cons? >>>> Best practices? >>>> >>>> Regards, >>>> Zabrane >>>> >>>> ______________________________**_________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>> >>> >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > - -- > James Aimonetti > Distributed Systems Engineer / DJ MC_ > > 2600hz | http://2600hz.com > sip:james@REDACTED > tel: 415.886.7905 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp > +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR > LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 > +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy > Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl > 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= > =ajkn > -----END PGP SIGNATURE----- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From fritchie@REDACTED Fri Jan 6 06:57:57 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 05 Jan 2012 23:57:57 -0600 Subject: [erlang-questions] no next heap size found: 18446744071896091830, offset 0 In-Reply-To: Message of "Thu\, 05 Jan 2012 14\:26\:05 +0100." Message-ID: <58473.1325829477@snookles.snookles.com> Bj?rn Gustavsson wrote: bg> There is a correction in the GC after R14B03 to handle huge heaps in bg> a 64-bit emulator: bg> https://github.com/erlang/otp/commit/caad36a5e2fc09d6a416fe31a7053bdfdb35c62d Bj?rn, hrm, I hadn't really considered that bug because there wasn't a segmentation fault & crash in my case, something that Richard hints at in his commit message. ... Ah, now I think I understand. Reading is hard. :-) So Richard didn't have segfaults immediately; instead, he had the exact same problem that I saw. Then he fixed something, and after that fix, then he gots SIGSEGV due to similar type errors elsewhere. Ah. -Scott From gianfranco.alongi@REDACTED Fri Jan 6 12:19:18 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Fri, 6 Jan 2012 12:19:18 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> Message-ID: I had concerns that keeping it in screen would use more memory if the node started spewing messages? Am I right? On Fri, Jan 6, 2012 at 4:22 AM, Fred Hebert wrote: > The tab support has been added to R15, if I recall. > > We run erl in -noshell mode, but always distributed. If the need > arises, I use a remote shell (still started from the same node) to do > my diagnostics/debugging, just connecting as a hidden node and > starting a remote job with ^G. I find it nicer than using screen, > especially since software like screen or tmux have sometimes frozen on > me. In these cases, I think it's simpler to just start a new remote > shell from a new connection and leave the application undisturbed. > > You just have to be careful not to type 'q()', 'halt()' or > 'init:stop()' in the job running on the production node ;) > > I generally think it's nicer to do it that way than in a screen > session -- that way you can daemonize your Erlang processes, and > integrate them better in their environment. > > On Thu, Jan 5, 2012 at 12:19 PM, James Aimonetti wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> We run everything in detached mode, and use a bash script to connect to >> the VM when we need access to it directly. >> >> Our bash script boils down to: >> >> exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} >> >> with SHELL_NAME usually generated by SHELL_NAME = "con_$(date >> +%s)@`hostname`". >> >> You won't get tab-complete on your modules/functions (I think the >> standard erlang modules work though), but it works well enough for our >> purposes. >> >> On 01/05/2012 05:45 AM, Max Bourinov wrote: >>> We also run everything under screen. And it is nice to have shell = access >>> to all things in the running system, but you must know what you do in there >>> :-) >>> >>> Sent from my iPhone >>> >>> On 05.01.2012, at 17:26, Jesse Gumm wrote: >>> >>> I run under screen, since I run screen for everything already, it's nice to >>> always have the erlang shell up and ready if I need it. >>> >>> -Jesse >>> >>> -- >>> Jesse Gumm >>> Owner, Sigma Star Systems >>> 414.940.4866 >>> www.sigma-star.com >>> @jessegumm >>> On Jan 5, 2012 7:03 AM, "CGS" wrote: >>> >>>> Hi, >>>> >>>> One major preference to use -detached (implies -noinput which implies >>>> further -noshell) option is when you want to create a persistent >>>> application which doesn't depend on your connection with the machine where >>>> you run the application. It is similar with "nohup" command under Linux. It >>>> also implies the use of less resources than "screen", but with no >>>> capability to interact directly with it. >>>> >>>> CGS >>>> >>>> >>>> >>>> >>>> >>>> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >>>> >>>>> Hi guys, >>>>> >>>>> Is there any preference between running a VM in a "detached mode" ?(i.e >>>>> erl -detached ...) >>>>> or simply running it inside "screen" for example witout detaching from it >>>>> (i.e erl ...) ? >>>>> >>>>> What are the pros/cons? >>>>> Best practices? >>>>> >>>>> Regards, >>>>> Zabrane >>>>> >>>>> ______________________________**_________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>>> >>>> >>>> ______________________________**_________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> - -- >> James Aimonetti >> Distributed Systems Engineer / DJ MC_ >> >> 2600hz | http://2600hz.com >> sip:james@REDACTED >> tel: 415.886.7905 >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.10 (GNU/Linux) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >> >> iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp >> +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR >> LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 >> +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy >> Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl >> 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= >> =ajkn >> -----END PGP SIGNATURE----- >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From preetisp_83@REDACTED Fri Jan 6 12:34:42 2012 From: preetisp_83@REDACTED (preeti sp) Date: Fri, 6 Jan 2012 03:34:42 -0800 (PST) Subject: [erlang-questions] Regd: Erlang Message-ID: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Hi I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) Now, Erlang is a pre-requisite for Installing RabbitMQ When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Thanks, Preeti -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Jan 6 13:24:59 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 6 Jan 2012 12:24:59 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). Also, what version of Ubuntu are you using and do you have the build-essential packages installed? Cheers, Tim On 6 January 2012 11:34, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Jan 6 13:25:36 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 6 Jan 2012 12:25:36 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: And reading http://wiki.basho.com/Installing-Erlang.html might help too. On 6 January 2012 12:24, Tim Watson wrote: > Have you tried installing from sources? It sounds like perhaps the > ./configure script needs to know --with-curses (or whatever the actual > switch is to point to the ncurses you've installed) and/or the architecture > you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information > about *how* you're trying to install and what is going wrong (like error > messages etc). > > Also, what version of Ubuntu are you using and do you have the > build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp wrote: > >> Hi >> >> I am struggling since many days to install RabbitMQ on Ubuntu Machine >> (X86-64) >> >> Now, Erlang is a pre-requisite for Installing RabbitMQ >> >> When I try to Install Erlang, I get an error message saying - Ncurses >> library is not installed. >> >> I tried installing ncurses library in multiple ways using sudo apt-get >> commands. It does not happen and so I am not able to install erlang >> successfully >> >> Can anyone provide me a list of detailed steps to be able to install >> erlang version 14 on an ubuntu machine? >> >> Thanks, >> Preeti >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 6 13:41:33 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 6 Jan 2012 13:41:33 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> Message-ID: <2A22A97C-C6CB-4731-BC32-625A7FD25BF8@gmail.com> Why? I see no reason for that to happen. Regards, Zabrane On Jan 6, 2012, at 12:19 PM, Gianfranco Alongi wrote: > I had concerns that keeping it in screen would use more memory if the > node started spewing messages? > > Am I right? > > On Fri, Jan 6, 2012 at 4:22 AM, Fred Hebert wrote: >> The tab support has been added to R15, if I recall. >> >> We run erl in -noshell mode, but always distributed. If the need >> arises, I use a remote shell (still started from the same node) to do >> my diagnostics/debugging, just connecting as a hidden node and >> starting a remote job with ^G. I find it nicer than using screen, >> especially since software like screen or tmux have sometimes frozen on >> me. In these cases, I think it's simpler to just start a new remote >> shell from a new connection and leave the application undisturbed. >> >> You just have to be careful not to type 'q()', 'halt()' or >> 'init:stop()' in the job running on the production node ;) >> >> I generally think it's nicer to do it that way than in a screen >> session -- that way you can daemonize your Erlang processes, and >> integrate them better in their environment. >> >> On Thu, Jan 5, 2012 at 12:19 PM, James Aimonetti wrote: >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA1 >>> >>> We run everything in detached mode, and use a bash script to connect to >>> the VM when we need access to it directly. >>> >>> Our bash script boils down to: >>> >>> exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} >>> >>> with SHELL_NAME usually generated by SHELL_NAME = "con_$(date >>> +%s)@`hostname`". >>> >>> You won't get tab-complete on your modules/functions (I think the >>> standard erlang modules work though), but it works well enough for our >>> purposes. >>> >>> On 01/05/2012 05:45 AM, Max Bourinov wrote: >>>> We also run everything under screen. And it is nice to have shell = access >>>> to all things in the running system, but you must know what you do in there >>>> :-) >>>> >>>> Sent from my iPhone >>>> >>>> On 05.01.2012, at 17:26, Jesse Gumm wrote: >>>> >>>> I run under screen, since I run screen for everything already, it's nice to >>>> always have the erlang shell up and ready if I need it. >>>> >>>> -Jesse >>>> >>>> -- >>>> Jesse Gumm >>>> Owner, Sigma Star Systems >>>> 414.940.4866 >>>> www.sigma-star.com >>>> @jessegumm >>>> On Jan 5, 2012 7:03 AM, "CGS" wrote: >>>> >>>>> Hi, >>>>> >>>>> One major preference to use -detached (implies -noinput which implies >>>>> further -noshell) option is when you want to create a persistent >>>>> application which doesn't depend on your connection with the machine where >>>>> you run the application. It is similar with "nohup" command under Linux. It >>>>> also implies the use of less resources than "screen", but with no >>>>> capability to interact directly with it. >>>>> >>>>> CGS >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >>>>> >>>>>> Hi guys, >>>>>> >>>>>> Is there any preference between running a VM in a "detached mode" (i.e >>>>>> erl -detached ...) >>>>>> or simply running it inside "screen" for example witout detaching from it >>>>>> (i.e erl ...) ? >>>>>> >>>>>> What are the pros/cons? >>>>>> Best practices? >>>>>> >>>>>> Regards, >>>>>> Zabrane >>>>>> >>>>>> ______________________________**_________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>>>> >>>>> >>>>> ______________________________**_________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> - -- >>> James Aimonetti >>> Distributed Systems Engineer / DJ MC_ >>> >>> 2600hz | http://2600hz.com >>> sip:james@REDACTED >>> tel: 415.886.7905 >>> -----BEGIN PGP SIGNATURE----- >>> Version: GnuPG v1.4.10 (GNU/Linux) >>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >>> >>> iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp >>> +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR >>> LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 >>> +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy >>> Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl >>> 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= >>> =ajkn >>> -----END PGP SIGNATURE----- >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gianfranco.alongi@REDACTED Fri Jan 6 15:06:51 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Fri, 6 Jan 2012 15:06:51 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <2A22A97C-C6CB-4731-BC32-625A7FD25BF8@gmail.com> References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> <2A22A97C-C6CB-4731-BC32-625A7FD25BF8@gmail.com> Message-ID: My reasoning (without any investigation) was that since screen keeps the output (so you can scroll back in the buffer), this would give some kind of performance penalty in relation to a detached mode on a high output scenario. /G On Fri, Jan 6, 2012 at 1:41 PM, Zabrane Mickael wrote: > Why? I see no reason for that to happen. > > Regards, > Zabrane > On Jan 6, 2012, at 12:19 PM, Gianfranco Alongi wrote: > >> I had concerns that keeping it in screen would use more memory if the >> node started spewing messages? >> >> Am I right? >> >> On Fri, Jan 6, 2012 at 4:22 AM, Fred Hebert wrote: >>> The tab support has been added to R15, if I recall. >>> >>> We run erl in -noshell mode, but always distributed. If the need >>> arises, I use a remote shell (still started from the same node) to do >>> my diagnostics/debugging, just connecting as a hidden node and >>> starting a remote job with ^G. I find it nicer than using screen, >>> especially since software like screen or tmux have sometimes frozen on >>> me. In these cases, I think it's simpler to just start a new remote >>> shell from a new connection and leave the application undisturbed. >>> >>> You just have to be careful not to type 'q()', 'halt()' or >>> 'init:stop()' in the job running on the production node ;) >>> >>> I generally think it's nicer to do it that way than in a screen >>> session -- that way you can daemonize your Erlang processes, and >>> integrate them better in their environment. >>> >>> On Thu, Jan 5, 2012 at 12:19 PM, James Aimonetti wrote: >>>> -----BEGIN PGP SIGNED MESSAGE----- >>>> Hash: SHA1 >>>> >>>> We run everything in detached mode, and use a bash script to connect to >>>> the VM when we need access to it directly. >>>> >>>> Our bash script boils down to: >>>> >>>> exec erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} >>>> >>>> with SHELL_NAME usually generated by SHELL_NAME = "con_$(date >>>> +%s)@`hostname`". >>>> >>>> You won't get tab-complete on your modules/functions (I think the >>>> standard erlang modules work though), but it works well enough for our >>>> purposes. >>>> >>>> On 01/05/2012 05:45 AM, Max Bourinov wrote: >>>>> We also run everything under screen. And it is nice to have shell = access >>>>> to all things in the running system, but you must know what you do in there >>>>> :-) >>>>> >>>>> Sent from my iPhone >>>>> >>>>> On 05.01.2012, at 17:26, Jesse Gumm wrote: >>>>> >>>>> I run under screen, since I run screen for everything already, it's nice to >>>>> always have the erlang shell up and ready if I need it. >>>>> >>>>> -Jesse >>>>> >>>>> -- >>>>> Jesse Gumm >>>>> Owner, Sigma Star Systems >>>>> 414.940.4866 >>>>> www.sigma-star.com >>>>> @jessegumm >>>>> On Jan 5, 2012 7:03 AM, "CGS" wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> One major preference to use -detached (implies -noinput which implies >>>>>> further -noshell) option is when you want to create a persistent >>>>>> application which doesn't depend on your connection with the machine where >>>>>> you run the application. It is similar with "nohup" command under Linux. It >>>>>> also implies the use of less resources than "screen", but with no >>>>>> capability to interact directly with it. >>>>>> >>>>>> CGS >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 01/05/2012 12:27 PM, Zabrane Mickael wrote: >>>>>> >>>>>>> Hi guys, >>>>>>> >>>>>>> Is there any preference between running a VM in a "detached mode" ?(i.e >>>>>>> erl -detached ...) >>>>>>> or simply running it inside "screen" for example witout detaching from it >>>>>>> (i.e erl ...) ? >>>>>>> >>>>>>> What are the pros/cons? >>>>>>> Best practices? >>>>>>> >>>>>>> Regards, >>>>>>> Zabrane >>>>>>> >>>>>>> ______________________________**_________________ >>>>>>> erlang-questions mailing list >>>>>>> erlang-questions@REDACTED >>>>>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>>>>> >>>>>> >>>>>> ______________________________**_________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/**listinfo/erlang-questions >>>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> - -- >>>> James Aimonetti >>>> Distributed Systems Engineer / DJ MC_ >>>> >>>> 2600hz | http://2600hz.com >>>> sip:james@REDACTED >>>> tel: 415.886.7905 >>>> -----BEGIN PGP SIGNATURE----- >>>> Version: GnuPG v1.4.10 (GNU/Linux) >>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >>>> >>>> iQEcBAEBAgAGBQJPBduYAAoJENc77s1OYoGgHYAIAJmzxw36KZ9zhEAX5EElevNp >>>> +NCYoN83GTdwv1N8i9Br2x2gW/PFWVitDim0bVXxvoUT/40rDtXRxV3EnM4NqIkR >>>> LTIIRD6r2HGEO4T7uIP+jypVqOnhTYZ+pzSpgGN39hnip6B4NZ3gaol8fhe2KfU8 >>>> +DGDD08urz3n2w2G/+ps3xSBd3iZSxYA9S/88gKnAxVYkh7BuqTgHjVVZWD+4aNy >>>> Y/MlWG1kR1kpr2qOIquTktQBQybkizSD3AsrsuT5oS7t5bMMXz+DhGM1JNiPobsl >>>> 6WCZF9T1SEtkoWjubwXY8l4JPwcsGhEu8AgSZYMT/BRCN5QzeAlEuGSQ6+ogEuU= >>>> =ajkn >>>> -----END PGP SIGNATURE----- >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > From connorsml@REDACTED Fri Jan 6 15:08:51 2012 From: connorsml@REDACTED (Michael Connors) Date: Fri, 6 Jan 2012 15:08:51 +0100 Subject: [erlang-questions] epmd -name and net_adm:names() Message-ID: Hi, I am trying to use epmd on a non-standard port. I can do this: [me@REDACTED ~]$ epmd -names epmd: up and running on port 20321 with data: But if I try to use net_adm, it hangs for 30 seconds or so and then I always get back {error, address}: Eshell V5.8 (abort with ^G) 1> net_adm:names(). {error,address} Is there something I need to do to configure net_adm to use the non-standard port? Thanks, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From mh@REDACTED Fri Jan 6 16:23:07 2012 From: mh@REDACTED (Muharem Hrnjadovic) Date: Fri, 06 Jan 2012 16:23:07 +0100 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: <4F0711DB.9030901@foldr3.com> Just curious: why don't you use the erlang/rabbitmq packages? On 01/06/2012 12:34 PM, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully > > Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Best regards/Mit freundlichen Gr??en -- Muharem Hrnjadovic Public key id : B2BBFCFC Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From dan@REDACTED Fri Jan 6 16:24:52 2012 From: dan@REDACTED (Daniel Dormont) Date: Fri, 6 Jan 2012 10:24:52 -0500 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: What happens if you just say sudo apt-get install erlang dan On Fri, Jan 6, 2012 at 6:34 AM, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From preetisp_83@REDACTED Fri Jan 6 19:02:14 2012 From: preetisp_83@REDACTED (preeti sp) Date: Fri, 6 Jan 2012 10:02:14 -0800 (PST) Subject: [erlang-questions] Regd: Erlang In-Reply-To: Message-ID: <1325872934.20084.YahooMailClassic@web39302.mail.mud.yahoo.com> I actually followed the exact steps illustrated in the link you shared below (GNU/LINUX) on ubuntu. But, when I executed below command, I got a message saying corresponding libraries not found to install. Since those libraries did not install well, erlang installation also showed an error at the end saying - curses library not found. So, rabbitmq installation failed! What i need is proper detailed commands to install below libraries on ubuntu x86-64 machine configuration! Thanks, Preeti sudo apt-get install build-essential libncurses5-dev openssl libssl-dev --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 4:25 AM And reading?http://wiki.basho.com/Installing-Erlang.html might help too. On 6 January 2012 12:24, Tim Watson wrote: Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). Also, what version of Ubuntu are you using and do you have the build-essential packages installed? Cheers, Tim On 6 January 2012 11:34, preeti sp wrote: Hi I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) Now, Erlang is a pre-requisite for Installing RabbitMQ When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Thanks, Preeti _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri Jan 6 19:28:15 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 6 Jan 2012 12:28:15 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: Message-ID: On Thu, Jan 5, 2012 at 5:27 AM, Zabrane Mickael wrote: > Hi guys, > > Is there any preference between running a VM in a "detached mode" ?(i.e erl -detached ...) > or simply running it inside "screen" for example witout detaching from it (i.e erl ...) ? > > What are the pros/cons? > Best practices? It's an interesting idea to use screen for this. Not bad actually. I use run_erl, which is a similar approach. I can see some advantages of run_erl over screen/tmux/etc. - Lighter weight (though I haven't measured by how much) - Automatic log rotation You can use to_erl to connect to the Erlang shell io that's running under run_erl. You can exit that environment without killing Erlang using CTRL-D. It does feel a bit weird to me running a long running process in a shell multiplexer. That seems fine for a dev/test environment, but not for production. That said, I don't really see anything really wrong with it. Definitely not "best practice" IMO. E.g. I'd hate to run into some bug in the much more complex screen util that caused Erlang to foobar. I suggest taking a look... http://linux.die.net/man/1/run_erl Garrett From g@REDACTED Fri Jan 6 19:32:23 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 6 Jan 2012 12:32:23 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: Message-ID: On Fri, Jan 6, 2012 at 12:28 PM, Garrett Smith wrote: > It does feel a bit weird to me running a long running process in a > shell multiplexer. That seems fine for a dev/test environment, but not > for production. That said, I don't really see anything really wrong > with it. I take that last part back! The screen approach complicates the Erlang process startup on server boot and probably doesn't work with heart. run_erl is init script and heart friendly and gives you the same core benefits. Garrett From zabrane3@REDACTED Fri Jan 6 19:43:07 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 6 Jan 2012 19:43:07 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: Message-ID: <05E244C3-D0CB-4B40-A7D1-C776B5CC0F20@gmail.com> Thanks for your feedacks Garrett, On Jan 6, 2012, at 7:32 PM, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 12:28 PM, Garrett Smith wrote: > >> It does feel a bit weird to me running a long running process in a >> shell multiplexer. That seems fine for a dev/test environment, but not >> for production. That said, I don't really see anything really wrong >> with it. > > I take that last part back! > > The screen approach complicates the Erlang process startup on server > boot and probably doesn't work with heart. While speaking about "heart", it seems that's not handling "releases restart" correctly. I've posted a question a couple of days ago, no response: http://erlang.org/pipermail/erlang-questions/2011-December/063525.html Should I avoid using heart with my release? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri Jan 6 19:58:55 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Fri, 6 Jan 2012 20:58:55 +0200 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: Message-ID: <98611362499001901@unknownmsgid> Hello, Recently I meet issue with run_erl and heart. Heart monitors only beam process, if run_erl dies then to_erl cannot access console. I am planning to rollback into remote shell approach. Send by <*)-|-|-< On 6.1.2012, at 20.32, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 12:28 PM, Garrett Smith wrote: > >> It does feel a bit weird to me running a long running process in a >> shell multiplexer. That seems fine for a dev/test environment, but not >> for production. That said, I don't really see anything really wrong >> with it. > > I take that last part back! > > The screen approach complicates the Erlang process startup on server > boot and probably doesn't work with heart. > > run_erl is init script and heart friendly and gives you the same core benefits. > > Garrett > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From klas.johansson@REDACTED Fri Jan 6 20:02:19 2012 From: klas.johansson@REDACTED (Klas Johansson) Date: Fri, 6 Jan 2012 20:02:19 +0100 Subject: [erlang-questions] testing side effects of asynchronous code In-Reply-To: <20120102104656.GA13121@jakstys.lt> References: <20120102104656.GA13121@jakstys.lt> Message-ID: 2012/1/2 Motiejus Jak?tys : > Hi List, > > Let's say I am testing side effects of this asynchronous function: > gateway_api:send(Message) -> reference() > > It does some asynchronous processing and produces side effects. After > processing completes, gen_gwserver:ack_sent is invoked, like this: > gen_gwserver:ack_sent(Ref :: reference()) -> ok. > > The question is: how can I know that the function ack_sent has been > called? Then I know that asynchronous work has been completed, so I can > start validating the side effects. > > An imaginary API in a test case, which blocks until > gen_gwserver:ack_sent/1 has been called: > ?call_and_sleep( > ? ?gateway_api:send(Message), > ? ?gen_gwserver, ack_sent, 1 > ) > > Some options that we ruled out: > * timer:sleep(some random value) > * making internal gateway_api:ack(Reference) calls (inconvenient, since > ?necessary only for testing) > * meck:passthrough looked promising, but the problem is it doesn't > ?return, so it cannot be implemented using meck cleanly. > > Thanks, > Motiejus Jak?tys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Hi, I'm biased here, but it sounds like mockgyver [1] could help you out. mockgyver is a mocking library which also lets you verify side-effects. There are a number of ways to verify side-effects, but the one it sounds you're after is the ?WAIT_CALLED macro and you don't have to (you can, but you don't have to) mock gen_gwserver in order to use it. ?WAIT_CALLED relies on erlang traces for non-mocked modules. Here's how you'd use it from eunit: -include_lib("mockgyver/include/mockgyver.hrl"). api_test_() -> ?WITH_MOCKED_SETUP(fun setup/0, fun cleanup/1). setup() -> ... start server here, if any ... Pid. cleanup(Pid) -> ... stop server here, if any ... calls_gw_server_ack_test(Pid) -> ... Ref = gateway_api:send(Message), ... ?WAIT_CALLED(gen_gwserver:ack_sent(Ref)), % matches only calls with ref from above ... verify side-effects here, perhaps using ?WAS_CALLED ... Cheers, Klas [1] https://github.com/klajo/mockgyver https://github.com/klajo/mockgyver/blob/master/doc/mockgyver.md From g@REDACTED Fri Jan 6 20:49:22 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 6 Jan 2012 13:49:22 -0600 Subject: [erlang-questions] Release handling + Heart = headache In-Reply-To: <9A9E762A-0448-4657-A084-D1332BA21ED8@gmail.com> References: <9A9E762A-0448-4657-A084-D1332BA21ED8@gmail.com> Message-ID: Hi Zabrane, On Sat, Dec 31, 2011 at 1:48 AM, Zabrane Mickael wrote: > Hi guys, > > I've successfully generated a release for a simple project and now, > I'm interested to use "-heart" option for monitoring. > > When running the project in dev mode?with heart, ?the HEART_COMMAND > is taken into account and my program restart as expected (in case of > crash,?unresponsive?VM ...). > > But the same program is never restarted under release mode. What are you specifying for HEART_COMMAND? It should be the same as what you're using under "release mode". > The doc say the?HEART_COMMAND is ignored under release mode, > and advices to set the start_prg envirnoment variable for SASL. What doc is that? I'm not sure what you mean by "release mode". When you run erl, you're always running a release. You can specify an alternative boot file (which specifies how the release is started) using the -boot option. > I tried this somewhere in my code without success: > application:set_env(sasl, start_prg, HEART_COMMAND), HEART_COMMAND should be a system environment variable. I haven't used sasl's start_prg setting -- I have no idea what that does :) You'd typically specify that value in a .config file, which is specified to erl using the -config option (minus the .config extension). So you'd have an Erlang config file that might look like this: [{sasl, [{start_prg, "your_cmd"}]}]. BUT -- I don't know what that will do :) Here's an example you can run to experiment with heart. 1. Create a module that prints the Erlang process to a file: -module(writepid). -export([start/0]). start() -> file:write_file("test.pid", os:getpid()). 2. Compile it: $ erlc writepid.erl 3. Test it: $ erl -run writepid -detached $ cat test.pid PID 4. Kill the Erlang process: $ kill PID 5. Now run with heart $ HEART_COMMAND="erl -run writepid -detached" erl -run writepid -detached -heart $ cat test.pid PID2 6. Kill that Erlang process (it's being monitored by heart): $ kill PID2 $ cat test.pid PID3 If you kill PID3, heart won't restat it because heart isn't running. You need to include -heart in the HEART_COMMAND if you want to keep using heart forever. Note that his has nothing to do with the "release" -- you're free to specify -boot and -config in your erl command. Just remember that HEART_COMMAND will be used to restart the Erlang system -- so make sure you have that correct. Garrett From g@REDACTED Fri Jan 6 21:19:53 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 6 Jan 2012 14:19:53 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <98611362499001901@unknownmsgid> References: <98611362499001901@unknownmsgid> Message-ID: On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov wrote: > Hello, > Recently I meet issue with run_erl and heart. Heart monitors only beam > process, if run_erl dies then to_erl cannot access console. I am > planning to rollback into remote shell approach. This is not true. You may be seeing something environment specific or have a configuration issue. FWIW, I've used run_erl in a large variety of production settings and would strongly recommend it. Here's what I see on Linux R14B04: $ mkdir /tmp/test $ pgrep beam && pgrep run_erl # confirm no running Erlang procs $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" $ pgrep beam && pgrep run_erl 8618 8616 $ echo "1 + 1." | to_erl /tmp/test/ Attaching to /tmp/test/erlang.pipe.3 (^D to exit) [EOF] $ tail -n3 /tmp/test/erlang.log.1 1> 1 + 1. 2 $ pkill run_erl $ pgrep beam && pgrep run_erl 8703 8701 $ echo "2 + 2." | to_erl /tmp/test/ Attaching to /tmp/test/erlang.pipe.4 (^D to exit) [EOF] $ tail -n3 /tmp/test/erlang.log.1 1> 2 + 2. 4 $ pkill beam $ pgrep beam && pgrep run_erl 8753 8751 $ echo "4 + 4." | to_erl /tmp/test/ Attaching to /tmp/test/erlang.pipe.5 (^D to exit) [EOF] $ tail -n3 /tmp/test/erlang.log.1 1> 4 + 4. 8 $ pkill heart $ pgrep beam && pgrep run_erl From dmkolesnikov@REDACTED Fri Jan 6 21:35:46 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 6 Jan 2012 22:35:46 +0200 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> Message-ID: My issue pop up with R15B on EC2 small instance. On R14B04 it was working in similar manner like you shown. - Dmitry On 6.1.2012, at 22.19, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov > wrote: >> Hello, >> Recently I meet issue with run_erl and heart. Heart monitors only beam >> process, if run_erl dies then to_erl cannot access console. I am >> planning to rollback into remote shell approach. > > This is not true. You may be seeing something environment specific or > have a configuration issue. > > FWIW, I've used run_erl in a large variety of production settings and > would strongly recommend it. > > Here's what I see on Linux R14B04: > > $ mkdir /tmp/test > $ pgrep beam && pgrep run_erl # confirm no running Erlang procs > $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" > run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" > $ pgrep beam && pgrep run_erl > 8618 > 8616 > $ echo "1 + 1." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.3 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 1 + 1. > 2 > $ pkill run_erl > $ pgrep beam && pgrep run_erl > 8703 > 8701 > $ echo "2 + 2." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.4 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 2 + 2. > 4 > $ pkill beam > $ pgrep beam && pgrep run_erl > 8753 > 8751 > $ echo "4 + 4." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.5 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 4 + 4. > 8 > $ pkill heart > $ pgrep beam && pgrep run_erl From g@REDACTED Fri Jan 6 21:38:48 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 6 Jan 2012 14:38:48 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> Message-ID: That's something the OTP team should be interested in. If you can provide a way to recreate it and submit a report to erlang bugs, I suspect it'd get some attention. Thanks for the heads up -- I'll look out for this on upgrades! On Fri, Jan 6, 2012 at 2:35 PM, Dmitry Kolesnikov wrote: > My issue pop up with R15B on EC2 small instance. > On R14B04 it was working in similar manner like you shown. > > - Dmitry > > > On 6.1.2012, at 22.19, Garrett Smith wrote: > >> On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov >> wrote: >>> Hello, >>> Recently I meet issue with run_erl and heart. Heart monitors only beam >>> process, if run_erl dies then to_erl cannot access console. I am >>> planning to rollback into remote shell approach. >> >> This is not true. You may be seeing something environment specific or >> have a configuration issue. >> >> FWIW, I've used run_erl in a large variety of production settings and >> would strongly recommend it. >> >> Here's what I see on Linux R14B04: >> >> $ mkdir /tmp/test >> $ pgrep beam && pgrep run_erl # confirm no running Erlang procs >> $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" >> run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" >> $ pgrep beam && pgrep run_erl >> 8618 >> 8616 >> $ echo "1 + 1." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.3 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 1 + 1. >> 2 >> $ pkill run_erl >> $ pgrep beam && pgrep run_erl >> 8703 >> 8701 >> $ echo "2 + 2." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.4 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 2 + 2. >> 4 >> $ pkill beam >> $ pgrep beam && pgrep run_erl >> 8753 >> 8751 >> $ echo "4 + 4." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.5 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 4 + 4. >> 8 >> $ pkill heart >> $ pgrep beam && pgrep run_erl From zabrane3@REDACTED Fri Jan 6 21:35:03 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 6 Jan 2012 21:35:03 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> Message-ID: <027F7E40-377C-4510-989E-F2765C1C7D60@gmail.com> Let me try all these hints on my release. Thanks again Garrett ! Regards, Zabrane On Jan 6, 2012, at 9:35 PM, Dmitry Kolesnikov wrote: > My issue pop up with R15B on EC2 small instance. > On R14B04 it was working in similar manner like you shown. > > - Dmitry > > > On 6.1.2012, at 22.19, Garrett Smith wrote: > >> On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov >> wrote: >>> Hello, >>> Recently I meet issue with run_erl and heart. Heart monitors only beam >>> process, if run_erl dies then to_erl cannot access console. I am >>> planning to rollback into remote shell approach. >> >> This is not true. You may be seeing something environment specific or >> have a configuration issue. >> >> FWIW, I've used run_erl in a large variety of production settings and >> would strongly recommend it. >> >> Here's what I see on Linux R14B04: >> >> $ mkdir /tmp/test >> $ pgrep beam && pgrep run_erl # confirm no running Erlang procs >> $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" >> run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" >> $ pgrep beam && pgrep run_erl >> 8618 >> 8616 >> $ echo "1 + 1." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.3 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 1 + 1. >> 2 >> $ pkill run_erl >> $ pgrep beam && pgrep run_erl >> 8703 >> 8701 >> $ echo "2 + 2." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.4 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 2 + 2. >> 4 >> $ pkill beam >> $ pgrep beam && pgrep run_erl >> 8753 >> 8751 >> $ echo "4 + 4." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.5 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 4 + 4. >> 8 >> $ pkill heart >> $ pgrep beam && pgrep run_erl From rapsey@REDACTED Fri Jan 6 22:27:41 2012 From: rapsey@REDACTED (Rapsey) Date: Fri, 6 Jan 2012 22:27:41 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <027F7E40-377C-4510-989E-F2765C1C7D60@gmail.com> References: <98611362499001901@unknownmsgid> <027F7E40-377C-4510-989E-F2765C1C7D60@gmail.com> Message-ID: I just want to mention dtach. It's what we use and it works fantastic. Unlike screen you can have as many terminals attached to erlang as you want and gets in the way much less with special characters. Sergej On Fri, Jan 6, 2012 at 9:35 PM, Zabrane Mickael wrote: > Let me try all these hints on my release. > Thanks again Garrett ! > > Regards, > Zabrane > > On Jan 6, 2012, at 9:35 PM, Dmitry Kolesnikov wrote: > > > My issue pop up with R15B on EC2 small instance. > > On R14B04 it was working in similar manner like you shown. > > > > - Dmitry > > > > > > On 6.1.2012, at 22.19, Garrett Smith wrote: > > > >> On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov > >> wrote: > >>> Hello, > >>> Recently I meet issue with run_erl and heart. Heart monitors only beam > >>> process, if run_erl dies then to_erl cannot access console. I am > >>> planning to rollback into remote shell approach. > >> > >> This is not true. You may be seeing something environment specific or > >> have a configuration issue. > >> > >> FWIW, I've used run_erl in a large variety of production settings and > >> would strongly recommend it. > >> > >> Here's what I see on Linux R14B04: > >> > >> $ mkdir /tmp/test > >> $ pgrep beam && pgrep run_erl # confirm no running Erlang procs > >> $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" > >> run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" > >> $ pgrep beam && pgrep run_erl > >> 8618 > >> 8616 > >> $ echo "1 + 1." | to_erl /tmp/test/ > >> Attaching to /tmp/test/erlang.pipe.3 (^D to exit) > >> > >> [EOF] > >> $ tail -n3 /tmp/test/erlang.log.1 > >> 1> 1 + 1. > >> 2 > >> $ pkill run_erl > >> $ pgrep beam && pgrep run_erl > >> 8703 > >> 8701 > >> $ echo "2 + 2." | to_erl /tmp/test/ > >> Attaching to /tmp/test/erlang.pipe.4 (^D to exit) > >> > >> [EOF] > >> $ tail -n3 /tmp/test/erlang.log.1 > >> 1> 2 + 2. > >> 4 > >> $ pkill beam > >> $ pgrep beam && pgrep run_erl > >> 8753 > >> 8751 > >> $ echo "4 + 4." | to_erl /tmp/test/ > >> Attaching to /tmp/test/erlang.pipe.5 (^D to exit) > >> > >> [EOF] > >> $ tail -n3 /tmp/test/erlang.log.1 > >> 1> 4 + 4. > >> 8 > >> $ pkill heart > >> $ pgrep beam && pgrep run_erl > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 6 22:32:54 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 6 Jan 2012 22:32:54 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> <027F7E40-377C-4510-989E-F2765C1C7D60@gmail.com> Message-ID: <95AC3C89-EC8C-47A9-AAF6-D6CF2D454FC5@gmail.com> Could you please provide a usage example with Erlang? Regards, Zabrane On Jan 6, 2012, at 10:27 PM, Rapsey wrote: > I just want to mention dtach. It's what we use and it works fantastic. Unlike screen you can have as many terminals attached to erlang as you want and gets in the way much less with special characters. > > > Sergej From watson.timothy@REDACTED Fri Jan 6 22:37:26 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 6 Jan 2012 21:37:26 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325872934.20084.YahooMailClassic@web39302.mail.mud.yahoo.com> References: <1325872934.20084.YahooMailClassic@web39302.mail.mud.yahoo.com> Message-ID: If you need to build curses by hand then do so - just run ./configure --help to see what flags are required to produce a 64 bit binary. Then just point the Erlang configure script at it. Otherwise, you could just do --without-curses or whatever when building Erlang, but personally I'd want (n)curses enabled. Personally I'd suggest you build it by hand from sources, or use kerl and pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. On 6 January 2012 18:02, preeti sp wrote: > I actually followed the exact steps illustrated in the link you shared > below (GNU/LINUX) on ubuntu. > > But, when I executed below command, I got a message saying corresponding > libraries not found to install. Since those libraries did not install well, > erlang installation also showed an error at the end saying - curses library > not found. So, rabbitmq installation failed! > > What i need is proper detailed commands to install below libraries on > ubuntu x86-64 machine configuration! > > Thanks, > Preeti > > sudo apt-get install build-essential libncurses5-dev openssl libssl-dev > > > --- On *Fri, 1/6/12, Tim Watson * wrote: > > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 4:25 AM > > > And reading http://wiki.basho.com/Installing-Erlang.html might help too. > > On 6 January 2012 12:24, Tim Watson > > wrote: > > Have you tried installing from sources? It sounds like perhaps the > ./configure script needs to know --with-curses (or whatever the actual > switch is to point to the ncurses you've installed) and/or the architecture > you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information > about *how* you're trying to install and what is going wrong (like error > messages etc). > > Also, what version of Ubuntu are you using and do you have the > build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp > > wrote: > > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sat Jan 7 00:15:29 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 7 Jan 2012 00:15:29 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> Message-ID: <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> Hi Garrett, I've tried to reproduce you example by copy and past on both Linux/OSX R14B04 and OSX R15B: Each time I kill one of these process: - beam - run_erl - heart the two others die too. I can't explain why. By the way, the test echo "1 + 1." | to_erl /tmp/test/ works perfectly Regards, Zabrane On Jan 6, 2012, at 9:19 PM, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov > wrote: >> Hello, >> Recently I meet issue with run_erl and heart. Heart monitors only beam >> process, if run_erl dies then to_erl cannot access console. I am >> planning to rollback into remote shell approach. > > This is not true. You may be seeing something environment specific or > have a configuration issue. > > FWIW, I've used run_erl in a large variety of production settings and > would strongly recommend it. > > Here's what I see on Linux R14B04: > > $ mkdir /tmp/test > $ pgrep beam && pgrep run_erl # confirm no running Erlang procs > $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" > run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" > $ pgrep beam && pgrep run_erl > 8618 > 8616 > $ echo "1 + 1." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.3 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 1 + 1. > 2 > $ pkill run_erl > $ pgrep beam && pgrep run_erl > 8703 > 8701 > $ echo "2 + 2." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.4 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 2 + 2. > 4 > $ pkill beam > $ pgrep beam && pgrep run_erl > 8753 > 8751 > $ echo "4 + 4." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.5 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 4 + 4. > 8 > $ pkill heart > $ pgrep beam && pgrep run_erl From steven.charles.davis@REDACTED Sat Jan 7 00:41:57 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 6 Jan 2012 15:41:57 -0800 (PST) Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <4F05AD4B.1010605@cs.ntua.gr> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> <3d6ad073-c69e-4200-969a-092cae1e9ede@u32g2000yqe.googlegroups.com> <4F05AD4B.1010605@cs.ntua.gr> Message-ID: <5da58144-e17b-4c66-a540-be9c42416c8a@y12g2000yqc.googlegroups.com> My exact point being your statement: "the developers of cowboy need to adapt its code" No they don't. Nor should they ever have to. I am concerned that this is the thin end of a very large wedge. With respect, /s On Jan 5, 8:01?am, Kostis Sagonas wrote: > On 01/05/12 15:43, Steve Davis wrote: > > > > > Hmmmmm.... > > >http://groups.google.com/group/erlang-programming/browse_thread/threa... > > Your point being what exactly?? ?That because specs are optional, > dialyzer should not produce warnings when finding behaviour modules > without callbacks? ?Running dialyzer is also optional... > > Kostis > > > > > > > > > > > On Jan 5, 4:40 am, Kostis Sagonas ?wrote: > >> To avoid this warning the developers of > >> cowboy need to adapt its code so that it contains -callback attributes > >> instead of a behaviour_info/1 function. (This function will be generated > >> automatically if callback attributes are present.) But of course this > >> will mean that cowboy will require R15B. Until this change is done, you > >> can either create your own version of this module with proper callback > >> information in it, or use the -Wno_behaviours command line option of > >> dialyzer. > > >> Kostis > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Sat Jan 7 01:36:34 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 6 Jan 2012 16:36:34 -0800 (PST) Subject: [erlang-questions] Dialyzer, Callback info about the behaviour is not available In-Reply-To: <5da58144-e17b-4c66-a540-be9c42416c8a@y12g2000yqc.googlegroups.com> References: <7D661B20-3D54-4FBC-95EF-EF846C92F48F@gmail.com> <4F057E22.7080509@cs.ntua.gr> <3d6ad073-c69e-4200-969a-092cae1e9ede@u32g2000yqe.googlegroups.com> <4F05AD4B.1010605@cs.ntua.gr> <5da58144-e17b-4c66-a540-be9c42416c8a@y12g2000yqc.googlegroups.com> Message-ID: <832e088b-f068-46c6-a11c-fe2e461e4dcb@32g2000yqp.googlegroups.com> I'd like to add the following thought: the greatest barrier to understanding code is not input/output types but the *intent* of the function; and that this is the real missing piece that plagues maintainability. 2c /s On Jan 6, 5:41?pm, Steve Davis wrote: > My exact point being your statement: > > "the developers of cowboy need to adapt its code" > No they don't. Nor should they ever have to. > > I am concerned that this is the thin end of a very large wedge. > > With respect, > /s > > On Jan 5, 8:01?am, Kostis Sagonas wrote: > > > > > > > > > On 01/05/12 15:43, Steve Davis wrote: > > > > Hmmmmm.... > > > >http://groups.google.com/group/erlang-programming/browse_thread/threa... > > > Your point being what exactly?? ?That because specs are optional, > > dialyzer should not produce warnings when finding behaviour modules > > without callbacks? ?Running dialyzer is also optional... > > > Kostis > > > > On Jan 5, 4:40 am, Kostis Sagonas ?wrote: > > >> To avoid this warning the developers of > > >> cowboy need to adapt its code so that it contains -callback attributes > > >> instead of a behaviour_info/1 function. (This function will be generated > > >> automatically if callback attributes are present.) But of course this > > >> will mean that cowboy will require R15B. Until this change is done, you > > >> can either create your own version of this module with proper callback > > >> information in it, or use the -Wno_behaviours command line option of > > >> dialyzer. > > > >> Kostis > > >> _______________________________________________ > > >> erlang-questions mailing list > > >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questi...@REDACTED > > >http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From preetisp_83@REDACTED Sat Jan 7 04:43:00 2012 From: preetisp_83@REDACTED (preeti sp) Date: Fri, 6 Jan 2012 19:43:00 -0800 (PST) Subject: [erlang-questions] Regd: Erlang In-Reply-To: Message-ID: <1325907780.16222.YahooMailClassic@web39301.mail.mud.yahoo.com> Hi Tim, I am not an erlang person. I am mainly working with RabbitMQ. I am not clear with below mail details. Could you please let me know exact details on how do I install erlang successfully on ubuntu (Right now, it is not getting installed properly and stating that ncurses not found is the reason for erlang's improper installation) Thanks, Preeti --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 1:37 PM If you need to build curses by hand then do so - just run ./configure --help to see what flags are required to produce a 64 bit binary. Then just point the Erlang configure script at it. Otherwise, you could just do --without-curses or whatever when building Erlang, but personally I'd want (n)curses enabled. Personally I'd suggest you build it by hand from sources, or use kerl and pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. ? On 6 January 2012 18:02, preeti sp wrote: I actually followed the exact steps illustrated in the link you shared below (GNU/LINUX) on ubuntu. But, when I executed below command, I got a message saying corresponding libraries not found to install. Since those libraries did not install well, erlang installation also showed an error at the end saying - curses library not found. So, rabbitmq installation failed! What i need is proper detailed commands to install below libraries on ubuntu x86-64 machine configuration! Thanks, Preeti sudo apt-get install build-essential libncurses5-dev openssl libssl-dev --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 4:25 AM And reading?http://wiki.basho.com/Installing-Erlang.html might help too. On 6 January 2012 12:24, Tim Watson wrote: Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). Also, what version of Ubuntu are you using and do you have the build-essential packages installed? Cheers, Tim On 6 January 2012 11:34, preeti sp wrote: Hi I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) Now, Erlang is a pre-requisite for Installing RabbitMQ When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Thanks, Preeti _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Sat Jan 7 05:04:57 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sat, 7 Jan 2012 05:04:57 +0100 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325907780.16222.YahooMailClassic@web39301.mail.mud.yahoo.com> References: <1325907780.16222.YahooMailClassic@web39301.mail.mud.yahoo.com> Message-ID: Hi! If the installation process is printing an error message, feel free to include the error message in your next email. I also feel that there is a need to re-post a link to the packages ESL provides for the most common operating systems. http://www.erlang-solutions.com/section/132/download-erlang-otp MVH Magnus On Sat, Jan 7, 2012 at 4:43 AM, preeti sp wrote: > Hi Tim, > > I am not an erlang person. I am mainly working with RabbitMQ. I am not > clear with below mail details. Could you please let me know exact details > on how do I install erlang successfully on ubuntu (Right now, it is not > getting installed properly and stating that ncurses not found is the reason > for erlang's improper installation) > > Thanks, > Preeti > > > --- On *Fri, 1/6/12, Tim Watson * wrote: > > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 1:37 PM > > > If you need to build curses by hand then do so - just run ./configure > --help to see what flags are required to produce a 64 bit binary. Then just > point the Erlang configure script at it. Otherwise, you could just do > --without-curses or whatever when building Erlang, but personally I'd want > (n)curses enabled. > > Personally I'd suggest you build it by hand from sources, or use kerl and > pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. > > On 6 January 2012 18:02, preeti sp > > wrote: > > I actually followed the exact steps illustrated in the link you shared > below (GNU/LINUX) on ubuntu. > > But, when I executed below command, I got a message saying corresponding > libraries not found to install. Since those libraries did not install well, > erlang installation also showed an error at the end saying - curses library > not found. So, rabbitmq installation failed! > > What i need is proper detailed commands to install below libraries on > ubuntu x86-64 machine configuration! > > Thanks, > Preeti > > sudo apt-get install build-essential libncurses5-dev openssl libssl-dev > > > --- On *Fri, 1/6/12, Tim Watson > >* wrote: > > > From: Tim Watson > > > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > > > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 4:25 AM > > > And reading http://wiki.basho.com/Installing-Erlang.html might help too. > > On 6 January 2012 12:24, Tim Watson > > wrote: > > Have you tried installing from sources? It sounds like perhaps the > ./configure script needs to know --with-curses (or whatever the actual > switch is to point to the ncurses you've installed) and/or the architecture > you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information > about *how* you're trying to install and what is going wrong (like error > messages etc). > > Also, what version of Ubuntu are you using and do you have the > build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp > > wrote: > > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sat Jan 7 10:54:11 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 7 Jan 2012 09:54:11 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325907780.16222.YahooMailClassic@web39301.mail.mud.yahoo.com> References: <1325907780.16222.YahooMailClassic@web39301.mail.mud.yahoo.com> Message-ID: Hi Preeti, I quite understand. Magnus has replied with a link to some pre-packaged distributions - I'd completely forgotten about those - and they're probably the best way to go. Installing Erlang on Ubuntu should just be a matter of running the apt/aptitude commands. Compiling from source involves grabbing the download from the erlang.org website and running `./configure && make && make install` with some --options passed to configure. If you still want to build/install using apt or from sources, please reply with the following information so we can help: - what ubuntu version are you installing onto - what command(s) you are running to build/install - what output and/or error messages are you getting With these details, I'm sure we'll be able to help! Cheers, Tim On 7 January 2012 03:43, preeti sp wrote: > Hi Tim, > > I am not an erlang person. I am mainly working with RabbitMQ. I am not > clear with below mail details. Could you please let me know exact details > on how do I install erlang successfully on ubuntu (Right now, it is not > getting installed properly and stating that ncurses not found is the reason > for erlang's improper installation) > > Thanks, > Preeti > > > --- On *Fri, 1/6/12, Tim Watson * wrote: > > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 1:37 PM > > > If you need to build curses by hand then do so - just run ./configure > --help to see what flags are required to produce a 64 bit binary. Then just > point the Erlang configure script at it. Otherwise, you could just do > --without-curses or whatever when building Erlang, but personally I'd want > (n)curses enabled. > > Personally I'd suggest you build it by hand from sources, or use kerl and > pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. > > On 6 January 2012 18:02, preeti sp > > wrote: > > I actually followed the exact steps illustrated in the link you shared > below (GNU/LINUX) on ubuntu. > > But, when I executed below command, I got a message saying corresponding > libraries not found to install. Since those libraries did not install well, > erlang installation also showed an error at the end saying - curses library > not found. So, rabbitmq installation failed! > > What i need is proper detailed commands to install below libraries on > ubuntu x86-64 machine configuration! > > Thanks, > Preeti > > sudo apt-get install build-essential libncurses5-dev openssl libssl-dev > > > --- On *Fri, 1/6/12, Tim Watson > >* wrote: > > > From: Tim Watson > > > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > > > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 4:25 AM > > > And reading http://wiki.basho.com/Installing-Erlang.html might help too. > > On 6 January 2012 12:24, Tim Watson > > wrote: > > Have you tried installing from sources? It sounds like perhaps the > ./configure script needs to know --with-curses (or whatever the actual > switch is to point to the ncurses you've installed) and/or the architecture > you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information > about *how* you're trying to install and what is going wrong (like error > messages etc). > > Also, what version of Ubuntu are you using and do you have the > build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp > > wrote: > > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Sat Jan 7 16:04:24 2012 From: g@REDACTED (Garrett Smith) Date: Sat, 7 Jan 2012 09:04:24 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> References: <98611362499001901@unknownmsgid> <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> Message-ID: On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael wrote: > Hi Garrett, > > I've tried to reproduce you example by copy and past > on both Linux/OSX R14B04 and OSX R15B: > > Each time I kill one of these process: > - beam > - run_erl > - heart > > the two others die too. Killing beam or run_erl should result in the corresponding process dying as well. But if run with -heart and with a correct HEART_COMMAND, run_erl/beam be restarted. Killing heart has the effect of killing its child processes. > I can't explain why. > > By the way, the test > echo "1 + 1." | to_erl /tmp/test/ > works perfectly In your tests, did the "2 + 2" and "4 + 4" examples work? Btw, piping into to_erl can be used to control the VM (e.g. calling init:stop()), getting status info, etc. without using distributed Erlang. Garrett From zabrane3@REDACTED Sat Jan 7 16:34:58 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 7 Jan 2012 16:34:58 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> Message-ID: <8C9E0464-6CF0-4025-8429-AB4C3FA19BC7@gmail.com> On Jan 7, 2012, at 4:04 PM, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael wrote: >> Hi Garrett, >> >> I've tried to reproduce you example by copy and past >> on both Linux/OSX R14B04 and OSX R15B: >> >> Each time I kill one of these process: >> - beam >> - run_erl >> - heart >> >> the two others die too. > > Killing beam or run_erl should result in the corresponding process > dying as well. But if run with -heart and with a correct > HEART_COMMAND, run_erl/beam be restarted. > > Killing heart has the effect of killing its child processes. I tried several time (copy/past your example). Same result. I'll try again on virtual machine with a fresh Erlang installed. Which Linux are you using Garrett? Can someone else please confirm Garret's example on his machine? > >> I can't explain why. >> >> By the way, the test >> echo "1 + 1." | to_erl /tmp/test/ >> works perfectly > > In your tests, did the "2 + 2" and "4 + 4" examples work? Yep, they both work correctly. > Btw, piping into to_erl can be used to control the VM (e.g. calling > init:stop()), getting status info, etc. without using distributed > Erlang. Didn't know that trick before. Thank Garrett ;-) Regards, Zabrane From g@REDACTED Sat Jan 7 16:42:52 2012 From: g@REDACTED (Garrett Smith) Date: Sat, 7 Jan 2012 09:42:52 -0600 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <8C9E0464-6CF0-4025-8429-AB4C3FA19BC7@gmail.com> References: <98611362499001901@unknownmsgid> <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> <8C9E0464-6CF0-4025-8429-AB4C3FA19BC7@gmail.com> Message-ID: On Sat, Jan 7, 2012 at 9:34 AM, Zabrane Mickael wrote: > > On Jan 7, 2012, at 4:04 PM, Garrett Smith wrote: > >> On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael wrote: >>> Hi Garrett, >>> >>> I've tried to reproduce you example by copy and past >>> on both Linux/OSX R14B04 and OSX R15B: >>> >>> Each time I kill one of these process: >>> - beam >>> - run_erl >>> - heart >>> >>> the two others die too. >> >> Killing beam or run_erl should result in the corresponding process >> dying as well. But if run with -heart and with a correct >> HEART_COMMAND, run_erl/beam be restarted. >> >> Killing heart has the effect of killing its child processes. > > I tried several time (copy/past your example). Same result. > I'll try again on virtual machine with a fresh Erlang installed. > Which Linux are you using Garrett? I'm not clear on what the problem is. See next point. > Can someone else please confirm Garret's example on his machine? > >> >>> I can't explain why. >>> >>> By the way, the test >>> echo "1 + 1." | to_erl /tmp/test/ >>> works perfectly >> >> In your tests, did the "2 + 2" and "4 + 4" examples work? > > Yep, they both work correctly. I suspect you're seeing the correct behavior then. The point of the example is to show that, by using -heart, your Erlang process, running under run_erl, will be restarted whether it's the beam process or the run_erl process that's killed. The fact that the "2 + 2" and "4 + 4" scenarios are working mean that your Erlang process is indeed getting restarted. Garrett From rapsey@REDACTED Sat Jan 7 17:18:09 2012 From: rapsey@REDACTED (Rapsey) Date: Sat, 7 Jan 2012 17:18:09 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <95AC3C89-EC8C-47A9-AAF6-D6CF2D454FC5@gmail.com> References: <98611362499001901@unknownmsgid> <027F7E40-377C-4510-989E-F2765C1C7D60@gmail.com> <95AC3C89-EC8C-47A9-AAF6-D6CF2D454FC5@gmail.com> Message-ID: This is our upstart script. It runs dtach with one listener which is used to log output of the app: start on filesystem and net-device-up stop on runlevel [06] env HOME=/home/ubuntu respawn console output script exec start-stop-daemon --name ourappname --start --chuid nobody --exec /usr/bin/dtach -- -c /tmp/erl /usr/local/bin/ourapp > /var/log/ourapp.log end script /usr/local/bin/ourapp is just a normal script that runs erlang with -eval "application:start(ourapp,permanent)" To attach to erlang just write: dtach -a /tmp/erl Sergej On Fri, Jan 6, 2012 at 10:32 PM, Zabrane Mickael wrote: > Could you please provide a usage example with Erlang? > > Regards, > Zabrane > > > On Jan 6, 2012, at 10:27 PM, Rapsey wrote: > > > I just want to mention dtach. It's what we use and it works fantastic. > Unlike screen you can have as many terminals attached to erlang as you want > and gets in the way much less with special characters. > > > > > > Sergej > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sat Jan 7 19:32:33 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 7 Jan 2012 18:32:33 +0000 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> <8C9E0464-6CF0-4025-8429-AB4C3FA19BC7@gmail.com> Message-ID: Doesn't seem to play nicely on OSX: t4@REDACTED:custom-assembly $ ps -ef | grep run_erl 501 1349 2378 0 0:00.00 ttys001 0:00.00 grep run_erl t4@REDACTED:custom-assembly $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" t4@REDACTED:custom-assembly $ ps -ef | grep run_erl 501 1352 1 0 0:00.00 ?? 0:00.00 run_erl -daemon /tmp/test/ /tmp/test/ erl -heart 501 1359 2378 0 0:00.00 ttys001 0:00.00 grep run_erl t4@REDACTED:custom-assembly $ ps -ef | grep beam 501 1353 1352 0 0:00.07 ttys000 0:00.19 /Users/t4/Library/Erlang/Versions/R15B64-LHSE/erts-5.9/bin/beam.smp -- -root /Users/t4/Library/Erlang/Versions/R15B64-LHSE -progname erl -- -home /Users/t4 -- -heart 501 1361 2378 0 0:00.00 ttys001 0:00.00 grep beam t4@REDACTED:custom-assembly $ echo "1 + 1." | to_erl /tmp/test/ Attaching to /tmp/test/erlang.pipe.1 (^D to exit) [EOF] t4@REDACTED:custom-assembly $ tail -n3 /tmp/test/erlang.log.1 1> 1 + 1. 2 2> t4@REDACTED:custom-assembly $ t4@REDACTED:custom-assembly $ t4@REDACTED:custom-assembly $ t4@REDACTED:custom-assembly $ ps -ef | grep run_erl 501 1352 1 0 0:00.00 ?? 0:00.00 run_erl -daemon /tmp/test/ /tmp/test/ erl -heart 501 1366 2378 0 0:00.00 ttys001 0:00.00 grep run_erl t4@REDACTED:custom-assembly $ kill -9 1352 t4@REDACTED:custom-assembly $ ps -ef | grep run_erl 501 1368 2378 0 0:00.00 ttys001 0:00.00 grep run_erl t4@REDACTED:custom-assembly $ ps -ef | grep beam 501 1353 1 0 0:03.73 ttys000 0:09.12 /Users/t4/Library/Erlang/Versions/R15B64-LHSE/erts-5.9/bin/beam.smp -- -root /Users/t4/Library/Erlang/Versions/R15B64-LHSE -progname erl -- -home /Users/t4 -- -heart 501 1370 2378 0 0:00.00 ttys001 0:00.00 grep beam t4@REDACTED:custom-assembly $ evm info R15B compiled for i386-apple-darwin10.8.0, 64bit t4@REDACTED:custom-assembly $ echo "2 + 2." | to_erl /tmp/test/ No running Erlang on pipe /tmp/test/erlang.pipe.1: Device not configured t4@REDACTED:custom-assembly $ On 7 January 2012 15:42, Garrett Smith wrote: > On Sat, Jan 7, 2012 at 9:34 AM, Zabrane Mickael > wrote: > > > > On Jan 7, 2012, at 4:04 PM, Garrett Smith wrote: > > > >> On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael > wrote: > >>> Hi Garrett, > >>> > >>> I've tried to reproduce you example by copy and past > >>> on both Linux/OSX R14B04 and OSX R15B: > >>> > >>> Each time I kill one of these process: > >>> - beam > >>> - run_erl > >>> - heart > >>> > >>> the two others die too. > >> > >> Killing beam or run_erl should result in the corresponding process > >> dying as well. But if run with -heart and with a correct > >> HEART_COMMAND, run_erl/beam be restarted. > >> > >> Killing heart has the effect of killing its child processes. > > > > I tried several time (copy/past your example). Same result. > > I'll try again on virtual machine with a fresh Erlang installed. > > Which Linux are you using Garrett? > > I'm not clear on what the problem is. See next point. > > > Can someone else please confirm Garret's example on his machine? > > > >> > >>> I can't explain why. > >>> > >>> By the way, the test > >>> echo "1 + 1." | to_erl /tmp/test/ > >>> works perfectly > >> > >> In your tests, did the "2 + 2" and "4 + 4" examples work? > > > > Yep, they both work correctly. > > I suspect you're seeing the correct behavior then. The point of the > example is to show that, by using -heart, your Erlang process, running > under run_erl, will be restarted whether it's the beam process or the > run_erl process that's killed. > > The fact that the "2 + 2" and "4 + 4" scenarios are working mean that > your Erlang process is indeed getting restarted. > > Garrett > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sat Jan 7 20:40:49 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 7 Jan 2012 20:40:49 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> <63BFE3F6-453F-4D00-8A23-8DD82978A8FE@gmail.com> <8C9E0464-6CF0-4025-8429-AB4C3FA19BC7@gmail.com> Message-ID: <503E80E2-3FA3-45FA-88D6-9F61A42E7D04@gmail.com> Everything worked as Garrett explained after a simple reboot of my machines. Thanks again guys for all these tricks. By the way, dtach is simply fantastic. Regards, Zabrane On Jan 7, 2012, at 4:42 PM, Garrett Smith wrote: > On Sat, Jan 7, 2012 at 9:34 AM, Zabrane Mickael wrote: >> >> On Jan 7, 2012, at 4:04 PM, Garrett Smith wrote: >> >>> On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael wrote: >>>> Hi Garrett, >>>> >>>> I've tried to reproduce you example by copy and past >>>> on both Linux/OSX R14B04 and OSX R15B: >>>> >>>> Each time I kill one of these process: >>>> - beam >>>> - run_erl >>>> - heart >>>> >>>> the two others die too. >>> >>> Killing beam or run_erl should result in the corresponding process >>> dying as well. But if run with -heart and with a correct >>> HEART_COMMAND, run_erl/beam be restarted. >>> >>> Killing heart has the effect of killing its child processes. >> >> I tried several time (copy/past your example). Same result. >> I'll try again on virtual machine with a fresh Erlang installed. >> Which Linux are you using Garrett? > > I'm not clear on what the problem is. See next point. > >> Can someone else please confirm Garret's example on his machine? >> >>> >>>> I can't explain why. >>>> >>>> By the way, the test >>>> echo "1 + 1." | to_erl /tmp/test/ >>>> works perfectly >>> >>> In your tests, did the "2 + 2" and "4 + 4" examples work? >> >> Yep, they both work correctly. > > I suspect you're seeing the correct behavior then. The point of the > example is to show that, by using -heart, your Erlang process, running > under run_erl, will be restarted whether it's the beam process or the > run_erl process that's killed. > > The fact that the "2 + 2" and "4 + 4" scenarios are working mean that > your Erlang process is indeed getting restarted. > > Garrett From overminddl1@REDACTED Sun Jan 8 04:26:00 2012 From: overminddl1@REDACTED (OvermindDL1) Date: Sat, 7 Jan 2012 20:26:00 -0700 Subject: [erlang-questions] Websites: TrapExit and TryErlang Message-ID: So, I am noticing that TrapExit is getting inundated with spam bots posting all over the place, what is the deal, is the site dead? Also, notice that tryerlang.org is still down for a very long time now, and I keep trying to use it to show off some Erlang syntax to others, and notes on it? From max.lapshin@REDACTED Sun Jan 8 21:30:24 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 8 Jan 2012 23:30:24 +0300 Subject: [erlang-questions] Is it possible to generate http requests with proper? Message-ID: Can proper generate http requests so that I can feed parser with them? I want to describe rules for generation of request, than I want to write two functions: 1) one for translating request to raw TCP data 2) one for translating request to awaited output From hnakamur@REDACTED Mon Jan 9 08:38:26 2012 From: hnakamur@REDACTED (Hiroaki Nakamura) Date: Mon, 9 Jan 2012 16:38:26 +0900 Subject: [erlang-questions] install ncurses libraries and headers in Ubuntu Message-ID: Hi. You can install ncurses libraries and headers in Ubuntu with the command below: $ sudo apt-get install libncurses5-dev Please see pages below for details: https://help.ubuntu.com/community/CompilingSoftware http://packages.ubuntu.com/search?suite=oneiric§ion=all&arch=any&searchon=names&keywords=ncurses+dev Hope this helps. -- )Hiroaki Nakamura) hnakamur@REDACTED From essen@REDACTED Mon Jan 9 13:03:08 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 09 Jan 2012 13:03:08 +0100 Subject: [erlang-questions] [ANN] Cowboy 0.4.0 Released! Message-ID: <4F0AD77C.1040003@ninenines.eu> Hello! We have finally completed the work on the new beta version for Cowboy, tagged as 0.4.0. Cowboy can be found on Github: https://github.com/extend/cowboy I first want to thank all the people and companies who've done an awesome job submitting patches and bug reports but also testing Cowboy and even using it in production! Thank you. I also want to welcome Magnus Klaar in the Nine Nines team (previously Dev:Extend), who will help me with Cowboy and will run various related open source projects. He's already worked a lot on this release and submitted one of the two long-awaited experimental features described below. Highlights from this release include: * An HTTP handler loop mechanism allowing you to easily write long-polling handlers with timeouts and hibernation all handled directly by Cowboy. * Built-in header parsing functions. * Removal of the quoted dependency by default, replaced by an Erlang equivalent. It can of course be enabled again easily. * Improved Websocket support for all versions including RFC 6455. * An experimental REST protocol handler based on Webmachine and following most of its public interface; although it uses binaries like the rest of Cowboy. * An experimental static file handler that uses the REST protocol handler to serve files as efficiently as possible, written by Magnus Klaar. The full CHANGELOG is available at the following URL: https://github.com/extend/cowboy/blob/master/CHANGELOG.md In addition to these changes, the Bullet project has been created and might be of interest to anyone looking for a socket.io replacement: https://github.com/extend/bullet User guides for all these projects are being worked on and will be added to our upcoming website in a few weeks. I am currently working on setting up commercial support for Cowboy and our other projects. If you or your company are interested, please send me an email. If you need a quick answer or any help using Cowboy, drop your questions in #erlounge on freenode (we also answer questions in #erlang, although less regularly). -- Lo?c Hoguin Erlang Cowboy Nine Nines From freeakk@REDACTED Mon Jan 9 14:19:04 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Mon, 9 Jan 2012 16:19:04 +0300 Subject: [erlang-questions] [ANN] Cowboy 0.4.0 Released! In-Reply-To: <4F0AD77C.1040003@ninenines.eu> References: <4F0AD77C.1040003@ninenines.eu> Message-ID: Congratulations, it is really nice project. -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Mon Jan 9 14:26:49 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 9 Jan 2012 05:26:49 -0800 (PST) Subject: [erlang-questions] starting a window process from erlang Message-ID: Hi everybody, i have an application that looks basically like this: init([]) -> ...., erlang:open_port({spawn,"cmd /c start www.google.com"},[exit_status]), {ok,#state{}}. Here is the thing: A) I start the erlang shell and i start my application: $ erl 1> application:start(my_app). ==> it can start the external process (it opens up the webbrowser) ==> behaves as expected B) I start the application from the command line: $ erl -my_app ==> works normally but does not start the external process (it does not open the webbrowser) ==> does not behave as expected Am i missing something? From daniel.goertzen@REDACTED Mon Jan 9 15:52:08 2012 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Mon, 9 Jan 2012 08:52:08 -0600 Subject: [erlang-questions] starting a window process from erlang In-Reply-To: References: Message-ID: $ erl -my_app This does not launch an application; this form would be used for passing parameters to an application, for example: $ erl -my_app param1 123 To start you app, try... $ erl -s application start my_app Also, escript might be more suitable for what it appears you are trying to do. Cheers, Dan. On Mon, Jan 9, 2012 at 7:26 AM, eigenfunction wrote: > Hi everybody, > i have an application that looks basically like this: > > init([]) -> ...., > erlang:open_port({spawn,"cmd /c start www.google.com > "},[exit_status]), > {ok,#state{}}. > > > Here is the thing: > > A) I start the erlang shell and i start my application: > $ erl > 1> application:start(my_app). > ==> it can start the external process (it opens up the > webbrowser) > ==> behaves as expected > > B) I start the application from the command line: > $ erl -my_app > ==> works normally but does not start the external process (it > does not open the webbrowser) > ==> does not behave as expected > > Am i missing something? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Mon Jan 9 16:34:43 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 9 Jan 2012 07:34:43 -0800 (PST) Subject: [erlang-questions] starting a window process from erlang In-Reply-To: References: Message-ID: <582dac19-1ea0-4432-a7d9-758aef60e6db@s18g2000vby.googlegroups.com> On 9 Jan., 15:52, Daniel Goertzen wrote: > ?$ erl -my_app > Sorry for not expressing my though correctly. Indeed i used the command to pass argument parameter to my application. I just did not want to write down everything. My application is packaged as a release and the command is the start command for it. Concerning my problem, you can ignore it. It is working on the production machine, which is an embedded device. It works on my dev machine, but only sometimes. Why it is so is still unclear. Thank you again for replying. > This does not launch an application; this form would be used for passing > parameters to an application, for example: > > $ erl -my_app param1 123 > > To start you app, try... > > $ erl -s application start my_app > > Also, escript might be more suitable for what it appears you are trying to > do. > > Cheers, > Dan. > > > > > > > > On Mon, Jan 9, 2012 at 7:26 AM, eigenfunction wrote: > > Hi everybody, > > i have an application that looks basically like this: > > > init([]) -> ...., > > ? ? ? ? ? ? erlang:open_port({spawn,"cmd /c startwww.google.com > > "},[exit_status]), > > ? ? ? ? ? ?{ok,#state{}}. > > > Here is the thing: > > > A) I start the erlang shell and i start my application: > > ? ?$ erl > > ? ? ? ? 1> application:start(my_app). > > ? ? ? ? ?==> it can start the external process (it opens up the > > webbrowser) > > ? ? ? ? ?==> behaves as expected > > > B) I start the application from the command line: > > ? ?$ erl -my_app > > ? ? ? ==> works normally but does not start the external process (it > > does not open the webbrowser) > > ? ? ? ==> does not behave as expected > > > Am i missing something? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Mon Jan 9 16:37:08 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Mon, 9 Jan 2012 17:37:08 +0200 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <98611362499001901@unknownmsgid> Message-ID: <2811325661336580484@unknownmsgid> Now I have discovered the issue. When you start erl with -smp enable then heart do not restart killed run_erl. Send by <*)-|-|-< On 6.1.2012, at 22.20, Garrett Smith wrote: > On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov > wrote: >> Hello, >> Recently I meet issue with run_erl and heart. Heart monitors only beam >> process, if run_erl dies then to_erl cannot access console. I am >> planning to rollback into remote shell approach. > > This is not true. You may be seeing something environment specific or > have a configuration issue. > > FWIW, I've used run_erl in a large variety of production settings and > would strongly recommend it. > > Here's what I see on Linux R14B04: > > $ mkdir /tmp/test > $ pgrep beam && pgrep run_erl # confirm no running Erlang procs > $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" > run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" > $ pgrep beam && pgrep run_erl > 8618 > 8616 > $ echo "1 + 1." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.3 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 1 + 1. > 2 > $ pkill run_erl > $ pgrep beam && pgrep run_erl > 8703 > 8701 > $ echo "2 + 2." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.4 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 2 + 2. > 4 > $ pkill beam > $ pgrep beam && pgrep run_erl > 8753 > 8751 > $ echo "4 + 4." | to_erl /tmp/test/ > Attaching to /tmp/test/erlang.pipe.5 (^D to exit) > > [EOF] > $ tail -n3 /tmp/test/erlang.log.1 > 1> 4 + 4. > 8 > $ pkill heart > $ pgrep beam && pgrep run_erl From zabrane3@REDACTED Mon Jan 9 16:43:17 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 9 Jan 2012 16:43:17 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <2811325661336580484@unknownmsgid> References: <98611362499001901@unknownmsgid> <2811325661336580484@unknownmsgid> Message-ID: <63549A7B-3CC1-40E7-BDE5-F1AEC9AE536E@gmail.com> Interesting. Which OS are you using (Linux, OSX...) ? 32 or 64 bits arch ? Regards, Zabrane On Jan 9, 2012, at 4:37 PM, dmitry kolesnikov wrote: > Now I have discovered the issue. When you start erl with -smp enable > then heart do not restart killed run_erl. > > Send by <*)-|-|-< > > On 6.1.2012, at 22.20, Garrett Smith wrote: > >> On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov >> wrote: >>> Hello, >>> Recently I meet issue with run_erl and heart. Heart monitors only beam >>> process, if run_erl dies then to_erl cannot access console. I am >>> planning to rollback into remote shell approach. >> >> This is not true. You may be seeing something environment specific or >> have a configuration issue. >> >> FWIW, I've used run_erl in a large variety of production settings and >> would strongly recommend it. >> >> Here's what I see on Linux R14B04: >> >> $ mkdir /tmp/test >> $ pgrep beam && pgrep run_erl # confirm no running Erlang procs >> $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" >> run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" >> $ pgrep beam && pgrep run_erl >> 8618 >> 8616 >> $ echo "1 + 1." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.3 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 1 + 1. >> 2 >> $ pkill run_erl >> $ pgrep beam && pgrep run_erl >> 8703 >> 8701 >> $ echo "2 + 2." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.4 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 2 + 2. >> 4 >> $ pkill beam >> $ pgrep beam && pgrep run_erl >> 8753 >> 8751 >> $ echo "4 + 4." | to_erl /tmp/test/ >> Attaching to /tmp/test/erlang.pipe.5 (^D to exit) >> >> [EOF] >> $ tail -n3 /tmp/test/erlang.log.1 >> 1> 4 + 4. >> 8 >> $ pkill heart >> $ pgrep beam && pgrep run_erl From dmkolesnikov@REDACTED Mon Jan 9 17:12:08 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Mon, 9 Jan 2012 18:12:08 +0200 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: <63549A7B-3CC1-40E7-BDE5-F1AEC9AE536E@gmail.com> References: <98611362499001901@unknownmsgid> <2811325661336580484@unknownmsgid> <63549A7B-3CC1-40E7-BDE5-F1AEC9AE536E@gmail.com> Message-ID: <121056958465999287@unknownmsgid> Reproduced on FC14 32bit. Erlang R15B (built manually) but same was on EC2 Send by <*)-|-|-< On 9.1.2012, at 17.47, Zabrane Mickael wrote: > Interesting. Which OS are you using (Linux, OSX...) ? 32 or 64 bits arch ? > > Regards, > Zabrane > > > On Jan 9, 2012, at 4:37 PM, dmitry kolesnikov wrote: > >> Now I have discovered the issue. When you start erl with -smp enable >> then heart do not restart killed run_erl. >> >> Send by <*)-|-|-< >> >> On 6.1.2012, at 22.20, Garrett Smith wrote: >> >>> On Fri, Jan 6, 2012 at 12:58 PM, dmitry kolesnikov >>> wrote: >>>> Hello, >>>> Recently I meet issue with run_erl and heart. Heart monitors only beam >>>> process, if run_erl dies then to_erl cannot access console. I am >>>> planning to rollback into remote shell approach. >>> >>> This is not true. You may be seeing something environment specific or >>> have a configuration issue. >>> >>> FWIW, I've used run_erl in a large variety of production settings and >>> would strongly recommend it. >>> >>> Here's what I see on Linux R14B04: >>> >>> $ mkdir /tmp/test >>> $ pgrep beam && pgrep run_erl # confirm no running Erlang procs >>> $ HEART_COMMAND="run_erl -daemon /tmp/test/ /tmp/test/ 'erl -heart'" >>> run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart" >>> $ pgrep beam && pgrep run_erl >>> 8618 >>> 8616 >>> $ echo "1 + 1." | to_erl /tmp/test/ >>> Attaching to /tmp/test/erlang.pipe.3 (^D to exit) >>> >>> [EOF] >>> $ tail -n3 /tmp/test/erlang.log.1 >>> 1> 1 + 1. >>> 2 >>> $ pkill run_erl >>> $ pgrep beam && pgrep run_erl >>> 8703 >>> 8701 >>> $ echo "2 + 2." | to_erl /tmp/test/ >>> Attaching to /tmp/test/erlang.pipe.4 (^D to exit) >>> >>> [EOF] >>> $ tail -n3 /tmp/test/erlang.log.1 >>> 1> 2 + 2. >>> 4 >>> $ pkill beam >>> $ pgrep beam && pgrep run_erl >>> 8753 >>> 8751 >>> $ echo "4 + 4." | to_erl /tmp/test/ >>> Attaching to /tmp/test/erlang.pipe.5 (^D to exit) >>> >>> [EOF] >>> $ tail -n3 /tmp/test/erlang.log.1 >>> 1> 4 + 4. >>> 8 >>> $ pkill heart >>> $ pgrep beam && pgrep run_erl > From goberman@REDACTED Mon Jan 9 18:44:35 2012 From: goberman@REDACTED (ilya goberman) Date: Mon, 9 Jan 2012 11:44:35 -0600 Subject: [erlang-questions] Calling Java from Erlang Message-ID: Hello,We are a market data API vendor. We have APIs to consume market data in Java, .Net, and C++. One of the clients indicated interest in using our API from Erlang.So I would like to find out if it is possible to interface with any of these language APIs from Erlang. I looked briefly at jinterface, but it appears to be designed to make calls from Java to Erlang, but not in the other directions.I have found a post http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for the Erlang-java calls, but it does not seem to be a finished product. What is the best bet to accomplish the integration? Any advice is appreciated.Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Mon Jan 9 18:53:43 2012 From: anthonym@REDACTED (Anthony Molinaro) Date: Mon, 9 Jan 2012 09:53:43 -0800 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: References: Message-ID: <20120109175343.GA21187@alumni.caltech.edu> There are many, many options. Most likely you'd want to roll your own based around thrift, protobuf, messagepack or some other interchange format that allows you to easily pass values between erlang and java. Some of these provide RPC mechanisms (thrift and messagepack), some do not (protobuf). I would guess that thrift might be a good choice as it has bindings for all the languages you list as well as a dozen or so more. It's also an Apache project so the license is compatible with most business needs. http://thrift.apache.org/ Good luck, -Anthony On Mon, Jan 09, 2012 at 11:44:35AM -0600, ilya goberman wrote: > > Hello,We are a market data API vendor. We have APIs to consume market data in Java, .Net, and C++. One of the clients indicated interest in using our API from Erlang.So I would like to find out if it is possible to interface with any of these language APIs from Erlang. > > I looked briefly at jinterface, but it appears to be designed to make calls from Java to Erlang, but not in the other directions.I have found a post http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for the Erlang-java calls, but it does not seem to be a finished product. > What is the best bet to accomplish the integration? > Any advice is appreciated.Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- ------------------------------------------------------------------------ Anthony Molinaro From anthonym@REDACTED Mon Jan 9 20:30:21 2012 From: anthonym@REDACTED (Anthony Molinaro) Date: Mon, 9 Jan 2012 11:30:21 -0800 Subject: [erlang-questions] Los Angeles Erlang Meetup, January 11th, 7PM Message-ID: <20120109193021.GC21491@alumni.caltech.edu> Meeting to be held at OpenX in Pasadena Erlang Solutions, Tony Rogvall, Ulf Wiger and a few other people just launched Feuerlabs here in LA to explore embedded Erlang. Magnus Feuer agreed to give a presentation about what they are doing. RSVP here, http://www.erlang.la/events/44325672/ -- ------------------------------------------------------------------------ Anthony Molinaro From mjtruog@REDACTED Mon Jan 9 21:26:41 2012 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 09 Jan 2012 12:26:41 -0800 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: References: Message-ID: <4F0B4D81.1090708@gmail.com> You can use jinterface to use the JVM as an Erlang cnode. CloudI uses jinterface to use the JVM as an Erlang port (http://cloudi.org). erjang is for using Erlang code within Java, but it doesn't seem to be for production usage... just a research project. - Michael On 01/09/2012 09:44 AM, ilya goberman wrote: > Hello, > We are a market data API vendor. We have APIs to consume market data in Java, .Net, and C++. One of the clients indicated interest in using our API from Erlang. > So I would like to find out if it is possible to interface with any of these language APIs from Erlang. > > I looked briefly at jinterface, but it appears to be designed to make calls from Java to Erlang, but not in the other directions. > I have found a post http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for the Erlang-java calls, but it does not seem to be a finished product. > > What is the best bet to accomplish the integration? > Any advice is appreciated. > Thanks > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Jan 9 21:54:28 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 9 Jan 2012 23:54:28 +0300 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: <4F0B4D81.1090708@gmail.com> References: <4F0B4D81.1090708@gmail.com> Message-ID: Why can't you just make network driver for Erlang? Write interface library, put it on github, your customers will send you pull-requests. Your business is in data, not in code. If you will make some half-magic java-erlang adapters, you will never satisfy customers. From jesper.louis.andersen@REDACTED Mon Jan 9 23:34:42 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 09 Jan 2012 23:34:42 +0100 Subject: [erlang-questions] "detached VM" vs "VM under screen" In-Reply-To: References: <4F059FA9.8080506@gmail.com> <-6949086063001534207@unknownmsgid> <4F05DB98.3010000@2600hz.com> <2A22A97C-C6CB-4731-BC32-625A7FD25BF8@gmail.com> Message-ID: <4F0B6B82.8080505@erlang-solutions.com> On 1/6/12 3:06 PM, Gianfranco Alongi wrote: > My reasoning (without any investigation) was that since screen keeps > the output (so you can scroll back in the buffer), > this would give some kind of performance penalty in relation to a > detached mode on a high output scenario. > It only keeps a partial buffer, and by default it is limited to 100 lines per terminal you open in screen. So this is not that much of a problem. I tend to use the same method as Fred though: attach another node to the system and spawn a shell remotely. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From rtrlists@REDACTED Tue Jan 10 12:15:14 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 10 Jan 2012 11:15:14 +0000 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: References: Message-ID: On Mon, Jan 9, 2012 at 5:44 PM, ilya goberman wrote: > Hello, > We are a market data API vendor. We have APIs to consume market data in > Java, .Net, and C++. One of the clients indicated interest in using our API > from Erlang. > So I would like to find out if it is possible to interface with any of > these language APIs from Erlang. > > I looked briefly at jinterface, but it appears to be designed to make > calls from Java to Erlang, but not in the other directions. > I have found a post > http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for the > Erlang-java calls, but it does not seem to be a finished product. > > What is the best bet to accomplish the integration? > Any advice is appreciated. > Thanks > > Erlang uses message passing as it's primary communication mechanism. Thus you could write a small Java program utilising the Jinterface library to enable it to receive messages from Erlang, marshalling to your API and sending results back using the messaging again. This is pretty straightforward. Untested Java-like "pseudo"-code without any error checking: public static void main(String[] args) { String node_name = args[0]; String mbox_name = args[1]; String cookie = args[2]; OtpNode node = new OtpNode(node_name, cookie); OtpMbox mbox = = node.createMbox(mbox_name); while (true) { OtpErlangTuple msg = (OtpErlangTuple) mbox.receive(); OtpErlangPid from = (OtpErlangPid) msg.elementAt(0); OtpErlangAtom request = (OtpErlangAtom) msg.elementAt(1); OtpErlangObject args = msg.elementAt(2); if (request.atomValue().equals("stop")) { break; } else { handle_request_and_send_result_back_to_requestor(from, request, args); } } node.closeMbox(mbox); node.close(); } In Erlang, you'd have a gen_server that launches this Java server (for example, as a port program) and uses the defined node and mbox names to communicate with it. Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Tue Jan 10 12:39:23 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Tue, 10 Jan 2012 12:39:23 +0100 Subject: [erlang-questions] Injecting Line and File in Erlang Abstract Format Message-ID: With the addition of line and file in stacktraces, it became important to support both line and file in the Erlang Abstract Format. http://www.erlang.org/doc/apps/erts/absform.html Line numbers are supported since day one but I could not find a way to inject the file in the Erlang Abstract Format. For instance, the representation for doing a call to an Atom with Args on line 10 would be: { call, 10, Atom, Args } In case there is an exception using the representation above, both line and file appear correctly in stacktrace. The following format also works: { call, [{line,10}], Atom, Args } However, I could not find a way to inject the file. I have tried both formats below but both makes the stacktrace not appear at all: { call, [{file,"sample.erl"},{line,10}], Atom, Args } { call, [{line,{"sample.erl",10}}], Atom, Args } Does anyone know if it is possible to pass the file to the Erlang Abstract Format? This feature would be useful for transforms and languages like LFE. When you use macros, it is better if the stacktrace points to the place where the quote was generated instead of the place the quoted syntax was inserted. * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * -------------- next part -------------- An HTML attachment was scrubbed... URL: From lfredlund@REDACTED Tue Jan 10 13:52:46 2012 From: lfredlund@REDACTED (=?UTF-8?B?TGFycy3DhWtlIEZyZWRsdW5k?=) Date: Tue, 10 Jan 2012 13:52:46 +0100 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: References: Message-ID: <4F0C349E.2060308@fi.upm.es> On 01/10/2012 12:15 PM, Robert Raschke wrote: > > On Mon, Jan 9, 2012 at 5:44 PM, ilya goberman > wrote: > > Hello, > We are a market data API vendor. We have APIs to consume market > data in Java, .Net, and C++. One of the clients indicated interest > in using our API from Erlang. > So I would like to find out if it is possible to interface with > any of these language APIs from Erlang. > > I looked briefly at jinterface, but it appears to be designed to > make calls from Java to Erlang, but not in the other directions. > I have found a post > http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for > the Erlang-java calls, but it does not seem to be a finished product. > > What is the best bet to accomplish the integration? > Any advice is appreciated. > Thanks > > > Erlang uses message passing as it's primary communication mechanism. > Thus you could write a small Java program utilising the Jinterface > library to enable it to receive messages from Erlang, marshalling to > your API and sending results back using the messaging again. > You could also take a look at the JavaErlang library which tries to reduce the amount of boilerplate code you have to write to call Java from Erlang. See https://github.com/fredlund/JavaErlang. We use it internally here to test student libraries written in Java. Greetings, Lars-?ke -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.hughes@REDACTED Tue Jan 10 14:33:24 2012 From: john.hughes@REDACTED (John Hughes) Date: Tue, 10 Jan 2012 14:33:24 +0100 Subject: [erlang-questions] Calling Java from Erlang In-Reply-To: References: Message-ID: <8264B87CEF0E4D459F1B6B5A5DD07ACC@JohnsTablet2009> QuickCheck includes a library for calling C APIs from Erlang, which can call virtually any C function. It just represents the C values directly on the Erlang side, so for example {ptr,char,123456} represents a character pointer to the given address. That lets us construct whatever C data structures we want as arguments to the API, and recover whatever data we want from the results, with very simple programming on the Erlang side. Of course that's C, not C++, and also it's not open source. If you're interested, there's a demo video here: http://quviq.com/demos/eqc_c%20demo/eqc_c%20demo.html John ----- Original Message ----- From: ilya goberman To: erlang-questions@REDACTED Sent: Monday, January 09, 2012 6:44 PM Subject: [erlang-questions] Calling Java from Erlang Hello, We are a market data API vendor. We have APIs to consume market data in Java, .Net, and C++. One of the clients indicated interest in using our API from Erlang. So I would like to find out if it is possible to interface with any of these language APIs from Erlang. I looked briefly at jinterface, but it appears to be designed to make calls from Java to Erlang, but not in the other directions. I have found a post http://www.javalimit.com/2010/06/a-java-api-for-erjang.html for the Erlang-java calls, but it does not seem to be a finished product. What is the best bet to accomplish the integration? Any advice is appreciated. Thanks ------------------------------------------------------------------------------ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From kuleshovmail@REDACTED Tue Jan 10 15:28:19 2012 From: kuleshovmail@REDACTED (Alexander Kuleshov) Date: Tue, 10 Jan 2012 20:28:19 +0600 Subject: [erlang-questions] Exmpp gen_fsm, sync_send_event, timeout exception Message-ID: Hello, I run ejabberd and try to run 1000 bot written with exmpp. All bots login and nothing do. When I run around 900 +-50 bots i got error: ** exception exit: {timeout,{gen_fsm,sync_send_event, [<0.2899.0>, {connect_socket,"my-host",5222,[]}, 5000]}} How can i avoid this? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsvancara@REDACTED Tue Jan 10 16:47:31 2012 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Tue, 10 Jan 2012 16:47:31 +0100 Subject: [erlang-questions] How to meck? Message-ID: Hello! I am trying to use meck, but have no luck. Can you help me, please? Erlang version: Erlang 5.9/OTP R15B ---------- tested module: -module(meck_module_for_test). -compile(export_all). a() -> a. call_a() -> a(). ------------------------- testing module: -module(meck_test). -compile(export_all). test()-> ok = meck:new(meck_module_for_test,[passthrough]), % Docs says: Retains the original functions, if not mocked by meck. % Mock "a()" which is called from call_a(). ok = meck:expect(meck_module_for_test, a, 0, fun() -> "result_from_mocked_a" end ), Result = meck_module_for_test:call_a(), io:format("Result of call_a: ~p~n",[Result]), Result_A = meck_module_for_test:a(), io:format("Result of a: ~p~n",[Result_A]), Valid = meck:validate(meck_module_for_test), io:format("Valid: ~p~n",[Valid]), meck:unload(meck_module_for_test), ok. --------------------- result of meck_test:test(): Result of call_a: a Result of a: #Fun Valid: true ok ----------------------------- I believe that call_a() should call a mocked version of a() which should return "result_from_mocked_a". So the result from call_a() shoud be:"result_from_mocked_a" But my results are different. Can you help me, please? Thanks, Bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From yrashk@REDACTED Tue Jan 10 17:19:09 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Tue, 10 Jan 2012 08:19:09 -0800 Subject: [erlang-questions] OTP-9649 and further changes Message-ID: Hi, I was wondering if anybody (especially from the OTP team) can shed some light on the following subject. In R15 we've got this: OTP-9649 Tuple funs (a two-element tuple with a module name and a function) are now officially deprecated and will be removed in R16. Use 'fun M:F/A' instead. To make you aware that your system uses tuple funs, the very first time a tuple fun is applied, a warning will be sent to the error logger. Which is fine. But I was wondering if there's any word out about the fate of tuple modules? The ones like {erlang}:element(1). Are they expected to be kept around? (I certainly hope they are :) Thanks, Yurii. From gleber.p@REDACTED Tue Jan 10 17:24:19 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 10 Jan 2012 17:24:19 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On Tue, Jan 10, 2012 at 17:19, Yurii Rashkovskii wrote: > Hi, > > I was wondering if anybody (especially from the OTP team) can shed > some light on the following subject. > > In R15 we've got this: > > OTP-9649 ?Tuple funs (a two-element tuple with a module name and a > ? ? ? ? ? ? ?function) are now officially deprecated and will be removed > ? ? ? ? ? ? ?in R16. Use 'fun M:F/A' instead. To make you aware that your > ? ? ? ? ? ? ?system uses tuple funs, the very first time a tuple fun is > ? ? ? ? ? ? ?applied, a warning will be sent to the error logger. > > Which is fine. > > But I was wondering if there's any word out about the fate of tuple > modules? The ones like {erlang}:element(1). Are they expected to be > kept around? (I certainly hope they are :) I believe you mean parametrized modules, since they are basically a tuples in runtime, where first element is module name. Those are two different concepts. In general I think that parametrized modules are here to stay, since so many projects are using it, including OTP code itself (mnesia). Although it would be nice if they are actually moved into "official" part of language. Best, Gleb From yrashk@REDACTED Tue Jan 10 17:28:46 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Tue, 10 Jan 2012 08:28:46 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Gleb, > I believe you mean parametrized modules, since they are basically a > tuples in runtime, where first element is module name. Those are two > different concepts. Well, this is a "hack" used to enable parametrized modules. I, however, use it outside of parametrized modules (just make functions accept the value tagged with the module name as the last argument). This is why I prefer calling them tuple modules so that I don't run into anti-parametrized modules crowd when it is uncalled for (the general consensus on IRC is that as long as your module is not parametrized but explicit, you're fine). > > In general I think that parametrized modules are here to stay, since > so many projects are using it, including OTP code itself (mnesia). > Although it would be nice if they are actually moved into "official" > part of language. Exactly. That's why I would love to hear from the OTP team. Yurii. From gleber.p@REDACTED Tue Jan 10 17:32:02 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 10 Jan 2012 17:32:02 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On Tue, Jan 10, 2012 at 17:28, Yurii Rashkovskii wrote: > Well, this is a "hack" used to enable parametrized modules. I, > however, use it outside of parametrized modules (just make functions > accept the value tagged with the module name as the last argument). > This is why I prefer calling them tuple modules so that ... Why do you need wrapping module name in a tuple? It works without it: Eshell V5.9 (abort with ^G) 1> erlang:length([1,2,3]). 3 2> M = erlang. erlang 3> M:length([1,2,3]). 3 Is there any case when wrapping is necessary, which I'm missing? Best, Gleb From yrashk@REDACTED Tue Jan 10 17:36:37 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Tue, 10 Jan 2012 08:36:37 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: > Why do you need wrapping module name in a tuple? It works without it: > > Eshell V5.9 ?(abort with ^G) > 1> erlang:length([1,2,3]). > 3 > 2> M = erlang. > erlang > 3> M:length([1,2,3]). > 3 > > Is there any case when wrapping is necessary, which I'm missing? That was just a minimal (and useless) case of how tuple modules behave. This is a far bigger deal when you have records (or just tagged tuples) and modules named according to them. One of the real use cases is misultin_req: https://github.com/ostinelli/misultin/blob/master/src/misultin_req.erl Yurii. From magnus.klaar@REDACTED Tue Jan 10 17:50:06 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Tue, 10 Jan 2012 17:50:06 +0100 Subject: [erlang-questions] How to meck? In-Reply-To: References: Message-ID: Hi! You can only mock external calls using meck, this means that you must prefix the call to a() in meck_module_for_test:call_a/0 with meck_module_for_test: or ?MODULE: to ensure that the call is handled by the mocked version of the module. When you make a local call to a function in the same module it will always call the function defined in the current module version. MVH Magnus On Tue, Jan 10, 2012 at 4:47 PM, Bohuslav Svancara wrote: > Hello! > I am trying to use meck, but have no luck. > Can you help me, please? > > Erlang version: Erlang 5.9/OTP R15B > > ---------- tested module: > -module(meck_module_for_test). > -compile(export_all). > a() -> a. > call_a() -> a(). > > ------------------------- testing module: > -module(meck_test). > -compile(export_all). > test()-> > ok = meck:new(meck_module_for_test,[passthrough]), % Docs says: > Retains the original functions, if not mocked by meck. > > % Mock "a()" which is called from call_a(). > ok = meck:expect(meck_module_for_test, a, 0, fun() -> > "result_from_mocked_a" end ), > > Result = meck_module_for_test:call_a(), > io:format("Result of call_a: ~p~n",[Result]), > > Result_A = meck_module_for_test:a(), > io:format("Result of a: ~p~n",[Result_A]), > > Valid = meck:validate(meck_module_for_test), > io:format("Valid: ~p~n",[Valid]), > > meck:unload(meck_module_for_test), > ok. > > --------------------- result of meck_test:test(): > Result of call_a: a > Result of a: #Fun > Valid: true > ok > ----------------------------- > > I believe that call_a() should call a mocked version of a() which should > return "result_from_mocked_a". > So the result from call_a() shoud be:"result_from_mocked_a" > But my results are different. > > Can you help me, please? > > Thanks, > Bob > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From phil.toland@REDACTED Tue Jan 10 22:25:45 2012 From: phil.toland@REDACTED (Phillip Toland) Date: Tue, 10 Jan 2012 15:25:45 -0600 Subject: [erlang-questions] Performance issue with snmp Message-ID: I am working on an application that uses SNMP heavily. This application needs to make hundreds of SNMP queries during normal operation and, this being Erlang, I tried to speed things up by issuing queries in parallel. Unfortunately, the performance of snmpm decreases considerably as you add more concurrent requests with requests timing out above a certain threshold. To illustrate the problem I have created a minimal code sample to reproduce the problem. Since snmpm requires a little configuration I have uploaded the code and config files to Github: https://github.com/toland/snmp_perf If I run snmp_perf:sync() with any number performance is very stable with every request returning in about 0.002 seconds. I am testing with a device on the network so this is reasonable performance. However, running snmp_perf:async(10) results in requests taking on average 0.01 seconds and the performance continues to get worse until about 80 concurrent requests when I start getting timeouts and the average request time is about 0.08 seconds. Increasing the number of requests results in longer request times and more timeouts. My question is this: is this performance degradation the expected behavior or does it represent a bug in snmpm? It looks like a bug to me but I wanted to get a second opinion. If this is the expected behavior does anyone have a suggestion for ameliorating the problem in a highly concurrent application? I have considered implementing a queue and worker pool as a way to limit the concurrent requests to snmpm, but was hoping there was a better solution. Thanks ~p From dmkolesnikov@REDACTED Tue Jan 10 23:28:03 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 11 Jan 2012 00:28:03 +0200 Subject: [erlang-questions] Performance issue with snmp In-Reply-To: References: Message-ID: <61B59BD3-E6C0-455E-9B4B-D29F1F1CA0C4@gmail.com> Hi, I am sorry not been able to comment Erlang side of snmp but I had exactly the same issue with snmp in other runtime. There was two performance bottleneckes 1. within the interface to snmp protocol 2. the way how application issues GET request (two much of rtts) The best option for me was bulk get requests for desired sub tree(s) and then I run client side filtering and post processing. If you think that in your case root cause is issue #1 then I would advise to sniff snmp traffic to validate it. Dmitry On 10.1.2012, at 23.25, Phillip Toland wrote: > I am working on an application that uses SNMP heavily. This > application needs to make hundreds of SNMP queries during normal > operation and, this being Erlang, I tried to speed things up by > issuing queries in parallel. Unfortunately, the performance of snmpm > decreases considerably as you add more concurrent requests with > requests timing out above a certain threshold. To illustrate the > problem I have created a minimal code sample to reproduce the problem. > Since snmpm requires a little configuration I have uploaded the code > and config files to Github: https://github.com/toland/snmp_perf > > If I run snmp_perf:sync() with any number performance is very stable > with every request returning in about 0.002 seconds. I am testing with > a device on the network so this is reasonable performance. However, > running snmp_perf:async(10) results in requests taking on average 0.01 > seconds and the performance continues to get worse until about 80 > concurrent requests when I start getting timeouts and the average > request time is about 0.08 seconds. Increasing the number of requests > results in longer request times and more timeouts. > > My question is this: is this performance degradation the expected > behavior or does it represent a bug in snmpm? It looks like a bug to > me but I wanted to get a second opinion. If this is the expected > behavior does anyone have a suggestion for ameliorating the problem in > a highly concurrent application? I have considered implementing a > queue and worker pool as a way to limit the concurrent requests to > snmpm, but was hoping there was a better solution. > > Thanks > ~p > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bsvancara@REDACTED Wed Jan 11 00:27:35 2012 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Wed, 11 Jan 2012 00:27:35 +0100 Subject: [erlang-questions] How to meck? In-Reply-To: References: Message-ID: Thank you, but it does not help. ---------- modified tested module: -module(meck_module_for_test). -compile(export_all). a() -> a. call_a() -> *meck_module_for_test:a().* % changed line ------- testing module "meck_test" is the same (se below) Result: 1> meck_test:test(). Result of call_a: #Fun Result of a: #Fun Valid: true ok Bob 2012/1/10 Magnus Klaar > Hi! > > You can only mock external calls using meck, this means that you must > prefix the call to a() in meck_module_for_test:call_a/0 with > meck_module_for_test: or ?MODULE: to ensure that the call is handled by > the mocked version of the module. When you make a local call to a function > in the same module it will always call the function defined in the current > module version. > > MVH Magnus > > On Tue, Jan 10, 2012 at 4:47 PM, Bohuslav Svancara wrote: > >> Hello! >> I am trying to use meck, but have no luck. >> Can you help me, please? >> >> Erlang version: Erlang 5.9/OTP R15B >> >> ---------- tested module: >> -module(meck_module_for_test). >> -compile(export_all). >> a() -> a. >> call_a() -> a(). >> >> ------------------------- testing module: >> -module(meck_test). >> -compile(export_all). >> test()-> >> ok = meck:new(meck_module_for_test,[passthrough]), % Docs says: >> Retains the original functions, if not mocked by meck. >> >> % Mock "a()" which is called from call_a(). >> ok = meck:expect(meck_module_for_test, a, 0, fun() -> >> "result_from_mocked_a" end ), >> >> Result = meck_module_for_test:call_a(), >> io:format("Result of call_a: ~p~n",[Result]), >> >> Result_A = meck_module_for_test:a(), >> io:format("Result of a: ~p~n",[Result_A]), >> >> Valid = meck:validate(meck_module_for_test), >> io:format("Valid: ~p~n",[Valid]), >> >> meck:unload(meck_module_for_test), >> ok. >> >> --------------------- result of meck_test:test(): >> Result of call_a: a >> Result of a: #Fun >> Valid: true >> ok >> ----------------------------- >> >> I believe that call_a() should call a mocked version of a() which should >> return "result_from_mocked_a". >> So the result from call_a() shoud be:"result_from_mocked_a" >> But my results are different. >> >> Can you help me, please? >> >> Thanks, >> Bob >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave@REDACTED Wed Jan 11 00:54:10 2012 From: dave@REDACTED (David Goehrig) Date: Tue, 10 Jan 2012 18:54:10 -0500 Subject: [erlang-questions] X86_64 binding optimizations Message-ID: <86BD29A8-64D7-4829-B0A2-204C62B0AEDB@nexttolast.com> Has anyone characterized what potential x86_64 register bindings (similar to the SPARC ones) could do to BEAM emulator performance? -=-=- dave@REDACTED -=-=- From christophe.romain@REDACTED Wed Jan 11 01:04:46 2012 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 11 Jan 2012 01:04:46 +0100 Subject: [erlang-questions] [ANN] CEAN 2.0 released Message-ID: <20120111000433.GC2549@localhost> After three years of no visible activity, i'm happy to announce a new release of CEAN. More than providing binary packages, now we provide a complete Erlang development/build/package framework. This way you can even build any other Erlang version you need and build your own repositories. The aim is to reach a production quality level repository of auto-generated Erlang packages, using a cross-platform framework. The most valuable CEAN 2.0 features are: - Provide both Erlang and Unix shell commands. - Build and packaging framework is now Open Source (GPL). - Ability to generate packages and standalone installers. - Work in cluster environment. It's possible to sync Erlang/CEAN installation on several hosts using just one command. - Ability to have as many Erlang version installed as needed. - Reliable package dependencies generator. site: http://cean.process-one.net/ framework: https://github.com/cromain/cean project: https://support.process-one.net/browse/CEAN Currently supported platforms: R12B-5: linux(x86,x86_64) darwin-x86 windows R13B04: linux(x86,x86_64) darwin-x86 windows R14B04: linux(armel,armhf,mips,mipsel,powerpc,sh4,sparc,sparc64,x86,x86_64) darwin(x86,x86_64) windows netbsd-x86 R15B: linux(x86,x86_64) darwin(x86,x86_64) windows netbsd-x86 From magnus.klaar@REDACTED Wed Jan 11 01:06:23 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Wed, 11 Jan 2012 01:06:23 +0100 Subject: [erlang-questions] How to meck? In-Reply-To: References: Message-ID: Hi! Comparing the output in the two posts, the first one returns 'a' from call_a() and the return value you specified using meck:expect/4 from the a() function, the second one shows that both call_a() and a() returns the value you specified. If you want to return "result_from_mocked_a" from these functions you must invoke meck:expect/3 or /4 as: meck:expect(meck_module_for_test, a, 0, "result_from_mocked_a") or meck:expect(meck_module_for_test, a, fun() -> "result_from_mocked_a" end ) MVH Magnus On Wed, Jan 11, 2012 at 12:27 AM, Bohuslav Svancara wrote: > Thank you, but it does not help. > > ---------- modified tested module: > > -module(meck_module_for_test). > -compile(export_all). > a() -> a. > call_a() -> *meck_module_for_test:a().* % changed line > > ------- testing module "meck_test" is the same (se below) > > Result: > > 1> meck_test:test(). > Result of call_a: #Fun > Result of a: #Fun > Valid: true > ok > > > Bob > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Jan 11 01:18:08 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 11 Jan 2012 01:18:08 +0100 Subject: [erlang-questions] [ANN] CEAN 2.0 released In-Reply-To: <20120111000433.GC2549@localhost> References: <20120111000433.GC2549@localhost> Message-ID: <1C31BB66-24C3-4EAD-A434-58C1FA58623C@gmail.com> Congratulations for CEAN Team ;-) Regards, Zabrane On Jan 11, 2012, at 1:04 AM, Christophe Romain wrote: > After three years of no visible activity, i'm happy to announce a new release of CEAN. > > More than providing binary packages, now we provide a complete Erlang development/build/package framework. > This way you can even build any other Erlang version you need and build your own repositories. > The aim is to reach a production quality level repository of auto-generated Erlang packages, using a cross-platform framework. > > The most valuable CEAN 2.0 features are: > - Provide both Erlang and Unix shell commands. > - Build and packaging framework is now Open Source (GPL). > - Ability to generate packages and standalone installers. > - Work in cluster environment. It's possible to sync Erlang/CEAN installation on several hosts using just one command. > - Ability to have as many Erlang version installed as needed. > - Reliable package dependencies generator. > > site: http://cean.process-one.net/ > framework: https://github.com/cromain/cean > project: https://support.process-one.net/browse/CEAN > > Currently supported platforms: > R12B-5: linux(x86,x86_64) darwin-x86 windows > R13B04: linux(x86,x86_64) darwin-x86 windows > R14B04: linux(armel,armhf,mips,mipsel,powerpc,sh4,sparc,sparc64,x86,x86_64) darwin(x86,x86_64) windows netbsd-x86 > R15B: linux(x86,x86_64) darwin(x86,x86_64) windows netbsd-x86 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From preetisp_83@REDACTED Wed Jan 11 03:56:55 2012 From: preetisp_83@REDACTED (preeti sp) Date: Tue, 10 Jan 2012 18:56:55 -0800 (PST) Subject: [erlang-questions] Regd: Erlang In-Reply-To: Message-ID: <1326250615.4361.YahooMailClassic@web39303.mail.mud.yahoo.com> Tim, Refer my answers below: - what ubuntu version are you installing onto :- 11.10 - what command(s) you are running to build/install : I am using below commands you stated: make, configure, make install. I am not passing any options. - what output and/or error messages are you getting: I am getting a bunch of errors stating - all erlang dependencies are missing - like odbc etc... I tried installing as Magnus said using below command as well: dpkg -i esl-erlang_15.b-1_amd64.deb But, I am getting below error now with that approach: (Reading database ... 59952 files and directories currently installed.) Preparing to replace esl-erlang 1:15.b (using esl-erlang_15.b-1_amd64.deb) ... Unpacking replacement esl-erlang ... dpkg: dependency problems prevent configuration of esl-erlang: esl-erlang depends on default-jre-headless | java2-runtime-headless | java1-runtime-headless | java2-runtime | java1-runtime; however: Package default-jre-headless is not installed. Package java2-runtime-headless is not installed. Package java1-runtime-headless is not installed. Package java2-runtime is not installed. Package java1-runtime is not installed. esl-erlang depends on libwxbase2.8-0; however: Package libwxbase2.8-0 is not installed. esl-erlang depends on libwxgtk2.8-0; however: Package libwxgtk2.8-0 is not installed. dpkg: error processing esl-erlang (--install): dependency problems - leaving unconfigured Errors were encountered while processing: --- On Sat, 1/7/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Saturday, January 7, 2012, 1:54 AM Hi Preeti, I quite understand. Magnus has replied with a link to some pre-packaged distributions - I'd completely forgotten about those - and they're probably the best way to go. Installing Erlang on Ubuntu should just be a matter of running the apt/aptitude commands. Compiling from source involves grabbing the download from the erlang.org website and running `./configure && make && make install` with some --options passed to configure. If you still want to build/install using apt or from sources, please reply with the following information so we can help: - what ubuntu version are you installing onto?- what command(s) you are running to build/install- what output and/or error messages are you getting With these details,?I'm sure?we'll be able to help! Cheers, Tim On 7 January 2012 03:43, preeti sp wrote: Hi Tim, I am not an erlang person. I am mainly working with RabbitMQ. I am not clear with below mail details. Could you please let me know exact details on how do I install erlang successfully on ubuntu (Right now, it is not getting installed properly and stating that ncurses not found is the reason for erlang's improper installation) Thanks, Preeti --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 1:37 PM If you need to build curses by hand then do so - just run ./configure --help to see what flags are required to produce a 64 bit binary. Then just point the Erlang configure script at it. Otherwise, you could just do --without-curses or whatever when building Erlang, but personally I'd want (n)curses enabled. Personally I'd suggest you build it by hand from sources, or use kerl and pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. ? On 6 January 2012 18:02, preeti sp wrote: I actually followed the exact steps illustrated in the link you shared below (GNU/LINUX) on ubuntu. But, when I executed below command, I got a message saying corresponding libraries not found to install. Since those libraries did not install well, erlang installation also showed an error at the end saying - curses library not found. So, rabbitmq installation failed! What i need is proper detailed commands to install below libraries on ubuntu x86-64 machine configuration! Thanks, Preeti sudo apt-get install build-essential libncurses5-dev openssl libssl-dev --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 4:25 AM And reading?http://wiki.basho.com/Installing-Erlang.html might help too. On 6 January 2012 12:24, Tim Watson wrote: Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). Also, what version of Ubuntu are you using and do you have the build-essential packages installed? Cheers, Tim On 6 January 2012 11:34, preeti sp wrote: Hi I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) Now, Erlang is a pre-requisite for Installing RabbitMQ When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Thanks, Preeti _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Wed Jan 11 05:27:23 2012 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 11 Jan 2012 11:27:23 +0700 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: Hello You definitely should use Kerl: https://github.com/spawngrid/kerl It is best and easiest way to install Erlang/OTP on your machine. On 6 January 2012 18:34, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsvancara@REDACTED Wed Jan 11 11:24:53 2012 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Wed, 11 Jan 2012 11:24:53 +0100 Subject: [erlang-questions] How to meck? In-Reply-To: References: Message-ID: Thanks for your help, Magnus. It works fine now. Bob 2012/1/11 Magnus Klaar > Hi! > > Comparing the output in the two posts, the first one returns 'a' from > call_a() and the return value you specified using meck:expect/4 from the > a() function, the second one shows that both call_a() and a() returns the > value you specified. > > If you want to return "result_from_mocked_a" from these functions you > must invoke meck:expect/3 or /4 as: > > meck:expect(meck_module_for_test, a, 0, "result_from_mocked_a") or > meck:expect(meck_module_for_test, a, fun() -> "result_from_mocked_a" end ) > > MVH Magnus > > On Wed, Jan 11, 2012 at 12:27 AM, Bohuslav Svancara wrote: > >> Thank you, but it does not help. >> >> ---------- modified tested module: >> >> -module(meck_module_for_test). >> -compile(export_all). >> a() -> a. >> call_a() -> *meck_module_for_test:a().* % changed line >> >> ------- testing module "meck_test" is the same (se below) >> >> Result: >> >> 1> meck_test:test(). >> Result of call_a: #Fun >> Result of a: #Fun >> Valid: true >> ok >> >> >> Bob >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Wed Jan 11 12:15:30 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Wed, 11 Jan 2012 13:15:30 +0200 Subject: [erlang-questions] How fast is to retrieve date from ETS table Message-ID: <4F0D6F52.5020609@gmail.com> I thought this is a lame question so I posted it on StackOverflow (http://stackoverflow.com/questions/8811430/retrieval-of-data-from-ets-table) so not to bother the list but there aren't many replies. Here it is my observation: I know that lookup time is constant for ETS tables. But I also heard that the table is kept outside of the process and when retrieving data, the data needs to be moved to the process heap. So, this is expensive. But then, how to explain this: 1> {ok, B} = file:read_file("IMG_2171.JPG"). {ok,<<255,216,255,225,63,254,69,120,105,102,0,0,73,73,42, 0,8,0,0,0,10,0,14,1,2,0,32,...>>} 2> size(B). 1986392 3> L = binary_to_list(B). [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, 0,10,0,14,1,2,0,32,0,0|...] 4> length(L). 1986392 5> ets:insert(utilo, {a, L}). true 6> timer:tc(ets, match, [utilo, {a, '$1'}]). {106000, [[[255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0, 0,0,10,0,14,1,2|...]]]} It takes 106000 microseconds to retrieve 1986392 long list which is pretty fast, isn't it? I also tried it from a module and the result is the same. Best regards, Martin From adam.rutkowski@REDACTED Wed Jan 11 12:22:12 2012 From: adam.rutkowski@REDACTED (Adam Rutkowski) Date: Wed, 11 Jan 2012 12:22:12 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <4F0D6F52.5020609@gmail.com> References: <4F0D6F52.5020609@gmail.com> Message-ID: <1D0034E2-D349-478C-A94A-C0D758F6CCF0@jtendo.com> Hi, On Jan 11, 2012, at 12:15 PM, Martin Dimitrov wrote: > 3> L = binary_to_list(B). > [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, > 0,10,0,14,1,2,0,32,0,0|...] What's the reason behind this? You can store binaries in ETS, you should also get significantly better results retrieving them. -- AR From adam.rutkowski@REDACTED Wed Jan 11 12:26:04 2012 From: adam.rutkowski@REDACTED (Adam Rutkowski) Date: Wed, 11 Jan 2012 12:26:04 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <1D0034E2-D349-478C-A94A-C0D758F6CCF0@jtendo.com> References: <4F0D6F52.5020609@gmail.com> <1D0034E2-D349-478C-A94A-C0D758F6CCF0@jtendo.com> Message-ID: <9A0DF189-BBE4-4CF0-AB70-BEFBF920E933@jtendo.com> Ah, sorry, ignore my previous answer, I didn't read your stackoverflow post. On Jan 11, 2012, at 12:22 PM, Adam Rutkowski wrote: > Hi, > > On Jan 11, 2012, at 12:15 PM, Martin Dimitrov wrote: > >> 3> L = binary_to_list(B). >> [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, >> 0,10,0,14,1,2,0,32,0,0|...] > > What's the reason behind this? > You can store binaries in ETS, you should also get significantly better results retrieving them. -- AR From gleber.p@REDACTED Wed Jan 11 12:27:09 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 11 Jan 2012 12:27:09 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <1D0034E2-D349-478C-A94A-C0D758F6CCF0@jtendo.com> References: <4F0D6F52.5020609@gmail.com> <1D0034E2-D349-478C-A94A-C0D758F6CCF0@jtendo.com> Message-ID: On Wed, Jan 11, 2012 at 12:22, Adam Rutkowski wrote: >> 3> L = binary_to_list(B). >> [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, >> 0,10,0,14,1,2,0,32,0,0|...] > > What's the reason behind this? > You can store binaries in ETS, you should also get significantly better results retrieving them. The question is actually about how to retrieve whole structures from ETS. Binaries would be only referenced (as said in stackoverflow thread). 100ms does not seem to be that much for copying 2MB of data from one place in memory to another. Although for building such a list cell-by-cell it seems pretty fast. You can do the following: - measure time to memcpy 2MB memory chunk in pure C or - analyze how data is copied from ETS to process heap in the source code or - wait for an answer from someone who knows it (OTP team) Best, Gleb From ulf@REDACTED Wed Jan 11 12:45:05 2012 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 11 Jan 2012 12:45:05 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <4F0D6F52.5020609@gmail.com> References: <4F0D6F52.5020609@gmail.com> Message-ID: <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> Well, reading from ETS does impose a copy operation, but this is just as efficient (as far as it goes) as message passing, which also copies. Exactly the same copy operation is used, in fact. And just as with message passing, if you are using binaries, they may be passed by reference instead, as has already been pointed out. Given that term copying is central in message passing and GC, as well as in ETS, a lot of time has been invested in optimizing it*. The Erlang VM does it well, but of course, copying is always copying - the cost will be relative to the size of the data, and the emulator must traverse the term in order to know what's in it. The actual code is in $ERL_TOP/erts/emulator/beam/copy.c (copy_struct()), or: https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L191 Another potential performance issue with ETS tables is locking, if you have many cores. Again, this is an area that the ERTS team is working hard on, so it gets better and better. However, shared data structures are notoriously hard to manage as the core count grows. Bottom line: it's good to be aware of cost factors, but you won't know how fast or slow it is in reality, until you measure (which you did!). ETS tables are fast enough for most purposes. :) BR, Ulf W * The garbage collector uses its own copying techniques, since it doesn't have to be limited to copying one term at a time, and also _must_ preserve subterm sharing. On 11 Jan 2012, at 12:15, Martin Dimitrov wrote: > I thought this is a lame question so I posted it on StackOverflow > (http://stackoverflow.com/questions/8811430/retrieval-of-data-from-ets-table) > so not to bother the list but there aren't many replies. > > Here it is my observation: > > I know that lookup time is constant for ETS tables. But I also heard > that the table is kept outside of the process and when retrieving data, > the data needs to be moved to the process heap. So, this is expensive. > But then, how to explain this: > > 1> {ok, B} = file:read_file("IMG_2171.JPG"). > {ok,<<255,216,255,225,63,254,69,120,105,102,0,0,73,73,42, > 0,8,0,0,0,10,0,14,1,2,0,32,...>>} > 2> size(B). > 1986392 > 3> L = binary_to_list(B). > [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, > 0,10,0,14,1,2,0,32,0,0|...] > 4> length(L). > 1986392 > 5> ets:insert(utilo, {a, L}). > true > 6> timer:tc(ets, match, [utilo, {a, '$1'}]). > {106000, > [[[255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0, > 0,0,10,0,14,1,2|...]]]} > > It takes 106000 microseconds to retrieve 1986392 long list which is > pretty fast, isn't it? > I also tried it from a module and the result is the same. > > Best regards, > > Martin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ttmrichter@REDACTED Wed Jan 11 13:21:11 2012 From: ttmrichter@REDACTED (Michael Richter) Date: Wed, 11 Jan 2012 20:21:11 +0800 Subject: [erlang-questions] [ANN] CEAN 2.0 released In-Reply-To: <20120111000433.GC2549@localhost> References: <20120111000433.GC2549@localhost> Message-ID: Congratulations on the massive change and update! Minor, but embarrassing, typo on the site: "14 achritectures" On 11 January 2012 08:04, Christophe Romain < christophe.romain@REDACTED> wrote: > After three years of no visible activity, i'm happy to announce a new > release of CEAN. > > More than providing binary packages, now we provide a complete Erlang > development/build/package framework. > This way you can even build any other Erlang version you need and build > your own repositories. > The aim is to reach a production quality level repository of > auto-generated Erlang packages, using a cross-platform framework. > > The most valuable CEAN 2.0 features are: > - Provide both Erlang and Unix shell commands. > - Build and packaging framework is now Open Source (GPL). > - Ability to generate packages and standalone installers. > - Work in cluster environment. It's possible to sync Erlang/CEAN > installation on several hosts using just one command. > - Ability to have as many Erlang version installed as needed. > - Reliable package dependencies generator. > > site: http://cean.process-one.net/ > framework: https://github.com/cromain/**cean > project: https://support.process-one.**net/browse/CEAN > > Currently supported platforms: > R12B-5: linux(x86,x86_64) darwin-x86 windows > R13B04: linux(x86,x86_64) darwin-x86 windows > R14B04: linux(armel,armhf,mips,mipsel,**powerpc,sh4,sparc,sparc64,x86,**x86_64) > darwin(x86,x86_64) windows netbsd-x86 > R15B: linux(x86,x86_64) darwin(x86,x86_64) windows netbsd-x86 > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -- "Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot." --Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Wed Jan 11 14:54:17 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Wed, 11 Jan 2012 15:54:17 +0200 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> References: <4F0D6F52.5020609@gmail.com> <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> Message-ID: <4F0D9489.5080507@gmail.com> Thanks for the informative answer. I did some tests with memcpy in C and it turns out that 0.1 second for ~2MB data is not "quite fast" but, I guess, normal. Best regards, Martin On 1/11/2012 1:45 PM, Ulf Wiger wrote: > Well, reading from ETS does impose a copy operation, but this is just as efficient (as far as it goes) as message passing, which also copies. Exactly the same copy operation is used, in fact. > > And just as with message passing, if you are using binaries, they may be passed by reference instead, as has already been pointed out. > > Given that term copying is central in message passing and GC, as well as in ETS, a lot of time has been invested in optimizing it*. The Erlang VM does it well, but of course, copying is always copying - the cost will be relative to the size of the data, and the emulator must traverse the term in order to know what's in it. > > The actual code is in $ERL_TOP/erts/emulator/beam/copy.c (copy_struct()), or: > > https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L191 > > Another potential performance issue with ETS tables is locking, if you have many cores. Again, this is an area that the ERTS team is working hard on, so it gets better and better. However, shared data structures are notoriously hard to manage as the core count grows. > > Bottom line: it's good to be aware of cost factors, but you won't know how fast or slow it is in reality, until you measure (which you did!). ETS tables are fast enough for most purposes. :) > > BR, > Ulf W > > * The garbage collector uses its own copying techniques, since it doesn't have to be limited to copying one term at a time, and also _must_ preserve subterm sharing. > > On 11 Jan 2012, at 12:15, Martin Dimitrov wrote: > >> I thought this is a lame question so I posted it on StackOverflow >> (http://stackoverflow.com/questions/8811430/retrieval-of-data-from-ets-table) >> so not to bother the list but there aren't many replies. >> >> Here it is my observation: >> >> I know that lookup time is constant for ETS tables. But I also heard >> that the table is kept outside of the process and when retrieving data, >> the data needs to be moved to the process heap. So, this is expensive. >> But then, how to explain this: >> >> 1> {ok, B} = file:read_file("IMG_2171.JPG"). >> {ok,<<255,216,255,225,63,254,69,120,105,102,0,0,73,73,42, >> 0,8,0,0,0,10,0,14,1,2,0,32,...>>} >> 2> size(B). >> 1986392 >> 3> L = binary_to_list(B). >> [255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0,0, >> 0,10,0,14,1,2,0,32,0,0|...] >> 4> length(L). >> 1986392 >> 5> ets:insert(utilo, {a, L}). >> true >> 6> timer:tc(ets, match, [utilo, {a, '$1'}]). >> {106000, >> [[[255,216,255,225,63,254,69,120,105,102,0,0,73,73,42,0,8,0, >> 0,0,10,0,14,1,2|...]]]} >> >> It takes 106000 microseconds to retrieve 1986392 long list which is >> pretty fast, isn't it? >> I also tried it from a module and the result is the same. >> >> Best regards, >> >> Martin >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From ponton@REDACTED Wed Jan 11 15:08:31 2012 From: ponton@REDACTED (Tomasz Maciejewski) Date: Wed, 11 Jan 2012 15:08:31 +0100 Subject: [erlang-questions] ODBC parametrized query and out parameter Message-ID: Hello everyone! I've got a PL/SQL function in an Oracle database which returns values through out parameter. How can I call it and receive with odbc:param_query/3? I've tried something like this: ? ?odbc:param_query(Ref, "CALL FOOBAR(?, ?)", [{{sql_varchar, 20}, in, ["foo"]}, {{sql_varchar, 20}, out, Result}]) but I got: exception exit: {badarg,odbc,param_query,'Params'} in function odbc:decode/1 I can't see anything about procedures and function (or out parameters) in the documentation. -- Tomasz Maciejewski From emeka_1978@REDACTED Wed Jan 11 15:23:59 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Wed, 11 Jan 2012 06:23:59 -0800 (PST) Subject: [erlang-questions] error_logger Message-ID: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> This is my sasl config file: [{sasl, [ {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, %%{errlog_type, error}, {error_logger_mf_dir,"d:/error_logs" }, {error_logger_mf_maxbytes,10485760}, {error_logger_mf_maxfiles, 2} ]}]. Can someone plz explain to me why i am only getting progress reports in my file ? In my code i used error_logger:msg_error ... for error messages. thx. From erlangsiri@REDACTED Wed Jan 11 15:56:44 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Wed, 11 Jan 2012 15:56:44 +0100 Subject: [erlang-questions] error_logger In-Reply-To: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> References: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> Message-ID: 2012/1/11 eigenfunction > This is my sasl config file: > > [{sasl, [ > {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, > %%{errlog_type, error}, > {error_logger_mf_dir,"d:/error_logs" }, > {error_logger_mf_maxbytes,10485760}, > {error_logger_mf_maxfiles, 2} > ]}]. > > Can someone plz explain to me why i am only getting progress reports > in my file ? > In my code i used error_logger:msg_error ... for error messages. > thx. > > This configuration installs two error handlers. First, the sasl_error_logger variable installs sasl_report_file_h which according to the documentation "Formats and writes supervisor reports, crash report and progress report to a single file." Next, the three error_logger_mf_* variables install log_mf_h, which writes *all* error logger events to a circular set of binary files in the directory specified by the error_logger_mf_dir variable (files will be named 1, 2 and index). These files can best be read with the report browser (rb) in the sasl application. So, in your errors.log file you will only get supervisor, crash and progress reports, while the circular set of binary files will contain *all* reports, including errors... Regards /siri -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Wed Jan 11 16:21:17 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Wed, 11 Jan 2012 07:21:17 -0800 (PST) Subject: [erlang-questions] error_logger In-Reply-To: References: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> Message-ID: Thank you very much for the quick answer, to which the next question follows: how do i read the binary-reports offline? I have copied the folder errors.log to another directory, let's say /tmp and am starting the erlang shell with erl -boot start_sasl -sasl error_logger_mf_dir "\"tmp/error_logs\"" error_logger_mf_maxfiles 5 error_logger_mf_maxbytes 10&. It just overrides the previous files that were there and shows me the newly created ones. Any idea? On 11 Jan., 15:56, Siri Hansen wrote: > 2012/1/11 eigenfunction > > > > > > > > > > > This is my sasl config file: > > > [{sasl, [ > > {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, > > %%{errlog_type, error}, > > {error_logger_mf_dir,"d:/error_logs" }, > > {error_logger_mf_maxbytes,10485760}, > > {error_logger_mf_maxfiles, 2} > > ]}]. > > > Can someone plz explain to me why i am only getting progress reports > > in my file ? > > In my code i used error_logger:msg_error ... for error messages. > > thx. > > > This configuration installs two error handlers. First, the > > sasl_error_logger variable installs sasl_report_file_h which according to > the documentation "Formats and writes supervisor reports, crash report and > progress report to a single file." > > Next, the three error_logger_mf_* variables install log_mf_h, which writes > *all* error logger events to a circular set of binary files in the > directory specified by the error_logger_mf_dir variable (files will be > named 1, 2 and index). These files can best be read with the report browser > (rb) in the sasl application. > > So, in your errors.log file you will only get supervisor, crash and > progress reports, while the circular set of binary files will contain *all* > reports, including errors... > > Regards > /siri > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Wed Jan 11 16:26:36 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 11 Jan 2012 08:26:36 -0700 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: On Fri, Jan 6, 2012 at 4:34 AM, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > Here are some old notes for ubuntu 10.10 and Erlang 14B02. https://sites.google.com/site/comptekkia/erlang/how-to-install-erlang-on-ubuntu-10-10 I have 11.10 now so I'll install Erlang and post my notes here when done. -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From christophe.romain@REDACTED Wed Jan 11 16:30:34 2012 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 11 Jan 2012 16:30:34 +0100 Subject: [erlang-questions] [ANN] CEAN 2.0 released In-Reply-To: References: <20120111000433.GC2549@localhost> Message-ID: <20120111153033.GG2549@localhost> >Minor, but embarrassing, typo on the site: "14 achritectures" typo fixed thanks! From demeshchuk@REDACTED Wed Jan 11 16:52:54 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Wed, 11 Jan 2012 19:52:54 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Hi, Siri! Sorry for the long delay, I missed your e-mail and knew that you replied only today. :( As far as I understood your proposal, you suggest to use a directory that contains Erlang our projects as a lib directory. It's a good option, and perhaps we'll really use it instead of making some custom stuff or asking you to patch reltool. The only possible problem I can see is that any projects that cause conflicts in reltool will make us unable to build release packages for *the rest* of the projects that reside in the same directory. Say, I had erlson in my projects directory, and it was causing the conflicts during release package generation (well, placing erl_parse.erl into application listing is wrong, it definitely needs to be fixed). Probably, the same goes to projects that may contain same modules in the applications listing (rabbitmq and riak_core both use gen_server2.erl, and those modules are actually different; this doesn't affect any of them but definitely but won't let us build release package). Maybe, there are some more rare errors that might occur as well. On the other hand, it's a good idea to make every project capable of being built using reltool, and this problem may serve as a good indicator of the projects that need to be improved. I'm not even sure that I want to continue making the initial request. :) It's definitely not bad (at least because of the fact that the proposed solution wasn't that obvious), but on the other hand stubborn people will eventually come up with a decent solution, by thinking or searching. Thank you. On Thu, Dec 29, 2011 at 5:55 PM, Siri Hansen wrote: > Hi Dmitry! > > At the first glance I find Garret's proposal very good. I find it reasonable > to have the dependency applications outside of the core application, since > different core applications might share the same dependencies. > > However, if your directory structure is the most common way, I assume it > would be a good idea if reltool could support it. > > Now I have the feeling that I missed something important, but why can't you > have your structure > > lib/coreapp/ > ?? deps/ > ?? ebin/ > ?? include/ > ?? priv/ > ?? src/ > > and give the following to reltool: > > [{lib_dirs, ["lib", "lib/coreapp/deps"]}...] > > ?? > > That would create a target with both your coreapp and the apps in the deps > directory.... > > Regards > /siri > > > 2011/12/22 Dmitry Demeshchuk >> >> Hi, Garret. >> >> Thanks, didn't think about the problem this way. This is much easier >> than making a rebar plugin :) >> >> Still, it clearly seems like a workaround too. >> Generally, you have one core application and multiple dependencies in >> a project, or at least so tells me my experience. These dependencies >> may be either independent applications (gproc, gen_bunny or whatever) >> or module libraries. (Of course, there are some exceptions of such a >> scheme, modern Riak for example, but there aren't many of them) >> And this is exactly why most of the open-source projects have the same >> directory structure as I described in my first email. Putting source >> code into another directory is not a big deal, of course, but it's >> slightly less convenient and more confusing. >> >> We can force these projects to do "git mkdir && git mv && git commit" >> (not a big deal, would take less than a minute), or even to do nothing >> (how many people like and use OTP upgrades?). Or we can add to reltool >> an ability to understand their projects structure, and structure of >> future 1000 projects. >> >> On Tue, Dec 20, 2011 at 11:25 PM, Garret Smith >> wrote: >> > My rebar/reltool setup is doing close to what you describe as the >> > "ideal" >> > way. >> > >> > Relevant project structure is: >> > >> > apps/ >> > ??? app1 >> > ??? app2 >> > >> > deps/ >> > ? ? >> > >> > rel/ >> > ??? reltool.config >> > >> > My rebar.config looks like: >> > {lib_dirs, ["apps"]}. >> > >> > {sub_dirs, [ >> > ??????? "apps/app1", >> > ??????? "apps/app2", >> > ??????? "rel"]}. >> > >> > {deps, [...]}. >> > >> > My reltool.config looks like (cut-n-pasted pieces here): >> > >> > {sys, [ >> > ?????? {lib_dirs, ["../apps", "../deps"]}, >> > ?????? {rel, "start", "1", >> > ??????? [ >> > ???????? app1, >> > ???????? app2, >> > ???????? dependent_app1, >> > ???????? dependent_app1 >> > ??????? ]}, >> > ?????? {rel, "start_clean", "", >> > ??????? [ >> > ???????? kernel, >> > ???????? stdlib >> > ??????? ]}, >> > ?????? {app, app1, [{incl_cond, include}]}, >> > ?????? {app, app1, [{incl_cond, include}]}, >> > ?????? {app, dependent_app1, [{incl_cond, include}]}, >> > ?????? {app, dependent_app2, [{incl_cond, include}]} >> > }. >> > >> > >> > With this setup, rebar & reltool take the apps under apps/ and deps/ and >> > creates a target release for me. >> > >> > Is this what you are looking for? >> > >> > -Garret >> > >> > On Tue, Dec 20, 2011 at 11:12 AM, Dmitry Demeshchuk >> > >> > wrote: >> >> >> >> Hello, Siri and everyone. >> >> >> >> Recently I've been trying to start using OTP releases in our projects >> >> with help of rebar. However, I faced the following problem. >> >> >> >> Rebar expects that *all* Erlang code resides in some directory >> >> (generally, "deps" folder) or several directories. This is a reltool >> >> strict requirement, as far as I understand. Unlike, Riak, all our >> >> applications have the following directory structure: >> >> >> >> . >> >> .. >> >> deps/ >> >> ebin/ >> >> include/ >> >> priv/ >> >> src/ >> >> >> >> So, we pull some libraries (and sometimes smaller applications) as >> >> deps, but the main application's code resides in the root application >> >> folder. And there's no way to make reltool include this code into the >> >> generated release, or at least I don't see it. >> >> >> >> For now, there are 2 ways for me to solve this without affecting >> >> reltool >> >> itself: >> >> >> >> 1. For all apps, make another repository that just pulls our >> >> application and all its deps, so the actual application code resides >> >> in the deps/ dir as well, and generate the release package from it. >> >> However, this seems like an overhead to me. Moreover, this isn't >> >> convenient for development. >> >> >> >> 2. I made a hack that creates symlinks in the deps/ dir, so that it >> >> seems to reltool that the core application actually resides in the >> >> deps/ folder, so it's included into the release. Obviously, this is >> >> kinda ugly and potentially buggy, forget total Windows >> >> incompatibility. Initially, this was a pull request to rebar but after >> >> some thinking me and one of rebar's maintainers agreed that it's >> >> better to make this code a rebar plugin. >> >> >> >> So, as you can see, both of the solutions aren't perfect. The ideal >> >> way I can see is an ability to set explicit app directories in >> >> reltool.config, like: >> >> >> >> {explicit_app_dirs, ["/apps/myapp1"]}. >> >> >> >> Probably, it won't make any other use besides the problem I'm >> >> describing here, but at least it's quite general and doesn't seem like >> >> a hack. Maybe there's a better way that I didn't come up with. Or >> >> maybe reltool can do what I want, and I just don't know about such an >> >> ability. >> >> >> >> This seems like a very useful feature. I know that many people use >> >> just the same directory structure in their projects. Also, rebar >> >> maintainers already gave me their +1 to this. I'll be glad to work on >> >> the patch if we come up with a good solution. >> >> >> >> Thank you. >> >> >> >> >> >> -- >> >> Best regards, >> >> Dmitry Demeshchuk >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > >> > >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk > > -- Best regards, Dmitry Demeshchuk From sverker@REDACTED Wed Jan 11 16:59:43 2012 From: sverker@REDACTED (Sverker Eriksson) Date: Wed, 11 Jan 2012 16:59:43 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> References: <4F0D6F52.5020609@gmail.com> <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> Message-ID: <4F0DB1EF.2070501@erix.ericsson.se> Ulf Wiger wrote: > : > The actual code is in $ERL_TOP/erts/emulator/beam/copy.c (copy_struct()), or: > > https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L191 > Copy from ETS actually uses copy_shallow() which is simpler and even more effective as the term is known to be contained within one continuous block. https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L919 /Sverker, Erlang/OTP Ericsson From ulf@REDACTED Wed Jan 11 17:04:52 2012 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 11 Jan 2012 17:04:52 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <4F0DB1EF.2070501@erix.ericsson.se> References: <4F0D6F52.5020609@gmail.com> <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> <4F0DB1EF.2070501@erix.ericsson.se> Message-ID: <6A0C5034-16EA-4C0C-A199-E35B24C53367@feuerlabs.com> Thanks for correcting me. I thought as much*, but then did some sloppy grep:ing and was misled. :) I assume it's copy_struct() in one direction (storing) and copy_shallow() in the other? BR, Ulf W * As in, Bj?rn G told me some 5-6 years ago, but I forgot the particulars. On 11 Jan 2012, at 16:59, Sverker Eriksson wrote: > Ulf Wiger wrote: >> : >> The actual code is in $ERL_TOP/erts/emulator/beam/copy.c (copy_struct()), or: >> >> https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L191 >> > Copy from ETS actually uses copy_shallow() which is simpler and even more effective as the term is known to be contained within one continuous block. > > https://github.com/erlang/otp/blob/master/erts/emulator/beam/copy.c#L919 > > > /Sverker, Erlang/OTP Ericsson > > > > > > > From phil.toland@REDACTED Wed Jan 11 19:14:47 2012 From: phil.toland@REDACTED (Phillip Toland) Date: Wed, 11 Jan 2012 12:14:47 -0600 Subject: [erlang-questions] Performance issue with snmp In-Reply-To: <4F0D6F12.7000704@erix.ericsson.se> References: <4F0D6F12.7000704@erix.ericsson.se> Message-ID: On Wed, Jan 11, 2012 at 5:14 AM, Micael Karlberg wrote: > On 01/10/2012 10:25 PM, Phillip Toland wrote: >> I am working on an application that uses SNMP heavily. This >> application needs to make hundreds of SNMP queries during normal >> operation and, this being Erlang, I tried to speed things up by >> issuing queries in parallel. Unfortunately, the performance of snmpm >> decreases considerably as you add more concurrent requests with >> requests timing out above a certain threshold. ?To illustrate the >> problem I have created a minimal code sample to reproduce the problem. >> Since snmpm requires a little configuration I have uploaded the code >> and config files to Github: https://github.com/toland/snmp_perf >> >> If I run snmp_perf:sync() with any number performance is very stable >> with every request returning in about 0.002 seconds. I am testing with >> a device on the network so this is reasonable performance. However, >> running snmp_perf:async(10) results in requests taking on average 0.01 >> seconds and the performance continues to get worse until about 80 >> concurrent requests when I start getting timeouts and the average >> request time is about 0.08 seconds. Increasing the number of requests >> results in longer request times and more timeouts. >> >> My question is this: is this performance degradation the expected >> behavior or does it represent a bug in snmpm? It looks like a bug to >> me but I wanted to get a second opinion. If this is the expected >> behavior does anyone have a suggestion for ameliorating the problem in >> a highly concurrent application? I have considered implementing a >> queue and worker pool as a way to limit the concurrent requests to >> snmpm, but was hoping there was a better solution. > > > I would not go as far as calling it a bug. Possibly there is a > design flaw. OK. I am fine with either term. The bottom line is that I did not expect that kind of slowdown. > But, looking at your code, I see that you are using > snmpm:sync_get/3 (there is also snmpm:sync_get2/3,4) for both the > synchronous and asynchronous calls. >From reading the code it looks like sync_get2 is exactly the same code as sync_get. I just ran a quick benchmark and they don't appear to perform any differently. > I am wondering why you are not > using snmpm:async_get/3 (or snmpm:async_get2/3,4) for the > asynchronous calls. Did you find a problem with that? My application exposes an API. Each call to the API results in several SNMP queries which are done in sequence since later queries rely on the results of earlier queries. For example, I am talking to Cisco switches and I want to know which VLAN is assigned to each port. I first issue a query for the list of ports then issue a query for the VLAN information on each port. Within the context of a single API call, sync_get appears to be the appropriate way to go. I spent quite a bit of time with the snmpm code and all SNMP operations are asynchronous under the covers. snmpm_server simply sticks a record into ETS for each SNMP request then returns noreply to the caller. When the request completes it looks up the request in ETS and sends the reply to the caller. At least, that is my understanding of the code. Since I really do need synchronous requests within the context of a single API call I would have to do something very similar to this in my implementation of the snmpm_user behavior. I didn't want to reinvent the wheel and the code in snmpm_server looks sound to me. I think that the terms "sync" and "async" have perhaps muddied the waters a bit. To be clear, what I need to do is make multiple concurrent synchronous SNMP requests. All that having been said, I will try to benchmark async_get this afternoon to see if I can make that work. It is going to be hard to get an apples-to-apples comparison, but if I can get the performance I need that is all I really care about. > Also, you could ask for more than one oid for every request. There > is after all quite a bit of overhead for every request, so asking > for more then one oid at a time saves a lot of processing. > As Dimitry wrote, you could also use get-bulk. get-bulk and requesting multiple OIDs doesn't really help in my situation since the problem I am having is with multiple concurrent requests to different devices. Talking to one device is fine and shows acceptable performance, it is only when I need to talk to a lot of devices at once that I start to see problems. Since the simple code sample I wrote showed significant problems with 80 concurrent requests, and that is a reasonable level of concurrency to expect in my application, I do not believe that making fewer calls to individual devices will solve my problem. ~p From comptekki@REDACTED Wed Jan 11 19:30:23 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 11 Jan 2012 11:30:23 -0700 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: On Fri, Jan 6, 2012 at 4:34 AM, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > Here is how I got erlang R15B installed on ubuntu 11.10: sudo apt-get install autoconf sudo apt-get install g++ sudo apt-get install libncurses5-dev sudo apt-get install fop sudo apt-get install xsltproc sudo apt-get install openjdk-6-jdk sudo apt-get install libssl-dev sudo apt-get install unixodbc-dev sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg sudo apt-get install libwxbase2.8 libqt4-opengl-dev libgtk2.0-dev cd /usr/local/src sudo git clone https://github.com/erlang/otp.git cd otp sudo git checkout OTP_R15B sudo ./otp_build autoconf sudo ./configure sudo make sudo make install ----------------- Good luck! -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Wed Jan 11 21:46:13 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 11 Jan 2012 20:46:13 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: Nicely done Wes - was that on a 64bit install? On 11 January 2012 18:30, Wes James wrote: > > > On Fri, Jan 6, 2012 at 4:34 AM, preeti sp wrote: > >> Hi >> >> I am struggling since many days to install RabbitMQ on Ubuntu Machine >> (X86-64) >> >> Now, Erlang is a pre-requisite for Installing RabbitMQ >> >> > Here is how I got erlang R15B installed on ubuntu 11.10: > > sudo apt-get install autoconf > sudo apt-get install g++ > sudo apt-get install libncurses5-dev > sudo apt-get install fop > sudo apt-get install xsltproc > sudo apt-get install openjdk-6-jdk > sudo apt-get install libssl-dev > sudo apt-get install unixodbc-dev > sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg > sudo apt-get install libwxbase2.8 libqt4-opengl-dev libgtk2.0-dev > > cd /usr/local/src > sudo git clone https://github.com/erlang/otp.git > cd otp > sudo git checkout OTP_R15B > sudo ./otp_build autoconf > sudo ./configure > sudo make > sudo make install > > ----------------- > > Good luck! > > -wes > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Wed Jan 11 21:50:52 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 11 Jan 2012 20:50:52 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: On 11 January 2012 04:27, Maxim Treskin wrote: > Hello > > You definitely should use Kerl: https://github.com/spawngrid/kerl > It is best and easiest way to install Erlang/OTP on your machine. > > Kerl is very nice, but if you can't install from the erlang.org tarballs using "./configure && make && make install" then you'll need to set up the KERL_CONFIGURE_OPTIONS environment variable with the right arguments to give to the configure script, which IIRC is the basic problem that the OP has been struggling with. If Wes' steps on Ubuntu 11 were on a 64 bit machine then hopefully using apt/aptitude to install the required packages before running kerl will sort things out, but I suspect kerl doesn't use otp_build and I'm not sure what the differences are between that and doing a straight build of the download (if any). -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Wed Jan 11 21:54:35 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 11 Jan 2012 20:54:35 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1326250615.4361.YahooMailClassic@web39303.mail.mud.yahoo.com> References: <1326250615.4361.YahooMailClassic@web39303.mail.mud.yahoo.com> Message-ID: Hi Preeti, Try the same steps as Wes did - the missing dependencies need to be installed first. He explicitly installs, for example, libwxbase2.8 and other things that the configure script requires to be installed. If you already have those dependencies installed (i.e., if you've already installed unix-odbc somewhere), then you should pass the relevant option(s) to configure so it knows where to find them. ./configure --help to see what choices you have. Do let us know how you get on - I'm going to upgrade a spare machine to Ubuntu 11 some time soon and will check myself. On 11 January 2012 02:56, preeti sp wrote: > Tim, > > Refer my answers below: > > - what ubuntu version are you installing onto :- 11.10 > > - what command(s) you are running to build/install : I am using below > commands you stated: make, configure, make install. I am not passing any > options. > > - what output and/or error messages are you getting: > I am getting a bunch of errors stating - all erlang dependencies are > missing - like odbc etc... > > > I tried installing as Magnus said using below command as well: > dpkg -i esl-erlang_15.b-1_amd64.deb > But, I am getting below error now with that approach: > > (Reading database ... 59952 files and directories currently installed.) > Preparing to replace esl-erlang 1:15.b (using esl-erlang_15.b-1_amd64.deb) > ... > Unpacking replacement esl-erlang ... > dpkg: dependency problems prevent configuration of esl-erlang: > esl-erlang depends on default-jre-headless | java2-runtime-headless | > java1-runtime-headless | java2-runtime | java1-runtime; however: > Package default-jre-headless is not installed. > Package java2-runtime-headless is not installed. > Package java1-runtime-headless is not installed. > Package java2-runtime is not installed. > Package java1-runtime is not installed. > esl-erlang depends on libwxbase2.8-0; however: > Package libwxbase2.8-0 is not installed. > esl-erlang depends on libwxgtk2.8-0; however: > Package libwxgtk2.8-0 is not installed. > dpkg: error processing esl-erlang (--install): > dependency problems - leaving unconfigured > Errors were encountered while processing: > > > > > > --- On *Sat, 1/7/12, Tim Watson * wrote: > > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Saturday, January 7, 2012, 1:54 AM > > Hi Preeti, > > I quite understand. Magnus has replied with a link to some pre-packaged > distributions - I'd completely forgotten about those - and they're probably > the best way to go. > > Installing Erlang on Ubuntu should just be a matter of running the > apt/aptitude commands. Compiling from source involves grabbing the download > from the erlang.org website and running `./configure && make && make > install` with some --options passed to configure. If you still want to > build/install using apt or from sources, please reply with the following > information so we can help: > > - what ubuntu version are you installing onto > - what command(s) you are running to build/install > - what output and/or error messages are you getting > > With these details, I'm sure we'll be able to help! > > Cheers, > > Tim > > On 7 January 2012 03:43, preeti sp > > wrote: > > Hi Tim, > > I am not an erlang person. I am mainly working with RabbitMQ. I am not > clear with below mail details. Could you please let me know exact details > on how do I install erlang successfully on ubuntu (Right now, it is not > getting installed properly and stating that ncurses not found is the reason > for erlang's improper installation) > > Thanks, > Preeti > > > --- On *Fri, 1/6/12, Tim Watson > >* wrote: > > > From: Tim Watson > > > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > > > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 1:37 PM > > > If you need to build curses by hand then do so - just run ./configure > --help to see what flags are required to produce a 64 bit binary. Then just > point the Erlang configure script at it. Otherwise, you could just do > --without-curses or whatever when building Erlang, but personally I'd want > (n)curses enabled. > > Personally I'd suggest you build it by hand from sources, or use kerl and > pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. > > On 6 January 2012 18:02, preeti sp > > wrote: > > I actually followed the exact steps illustrated in the link you shared > below (GNU/LINUX) on ubuntu. > > But, when I executed below command, I got a message saying corresponding > libraries not found to install. Since those libraries did not install well, > erlang installation also showed an error at the end saying - curses library > not found. So, rabbitmq installation failed! > > What i need is proper detailed commands to install below libraries on > ubuntu x86-64 machine configuration! > > Thanks, > Preeti > > sudo apt-get install build-essential libncurses5-dev openssl libssl-dev > > > --- On *Fri, 1/6/12, Tim Watson > >* wrote: > > > From: Tim Watson > > > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > > > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 4:25 AM > > > And reading http://wiki.basho.com/Installing-Erlang.html might help too. > > On 6 January 2012 12:24, Tim Watson > > wrote: > > Have you tried installing from sources? It sounds like perhaps the > ./configure script needs to know --with-curses (or whatever the actual > switch is to point to the ncurses you've installed) and/or the architecture > you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information > about *how* you're trying to install and what is going wrong (like error > messages etc). > > Also, what version of Ubuntu are you using and do you have the > build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp > > wrote: > > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine > (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses > library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get > commands. It does not happen and so I am not able to install erlang > successfully > > Can anyone provide me a list of detailed steps to be able to install > erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Jan 11 21:59:08 2012 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 11 Jan 2012 15:59:08 -0500 Subject: [erlang-questions] ct_framework:error_notification badarg error Message-ID: Why??? === Ended at 2012-01-11 15:31:16 === location {ct_framework,error_notification} === reason = {error, ? ? ? ? ? ? ? ? ? ? ?{ct_framework,error_notification, ? ? ? ? ? ? ? ? ? ? ? ? ?{badarg, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[{io,format, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [user, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"~n- - - - - - - - - - - - - - - - - - - - - - - - - -~n", ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[]], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? []}, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {ct_framework,error_notification,4, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [{file,"ct_framework.erl"},{line,809}]}, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {test_server_sup,framework_call,4, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [{file,"test_server_sup.erl"},{line,511}]}, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {test_server,run_test_case_eval1,6, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [{file,"test_server.erl"},{line,1187}]}, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {test_server,run_test_case_eval,9, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [{file,"test_server.erl"},{line,1123}]}]}}} -- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Device drivers, firmware and debugging From comptekki@REDACTED Wed Jan 11 22:13:56 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 11 Jan 2012 14:13:56 -0700 Subject: [erlang-questions] Regd: Erlang In-Reply-To: References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: yes here is uname -a 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux -wes On Wed, Jan 11, 2012 at 1:46 PM, Tim Watson wrote: > Nicely done Wes - was that on a 64bit install? > > On 11 January 2012 18:30, Wes James wrote: > >> >> >> On Fri, Jan 6, 2012 at 4:34 AM, preeti sp wrote: >> >>> Hi >>> >>> I am struggling since many days to install RabbitMQ on Ubuntu Machine >>> (X86-64) >>> >>> Now, Erlang is a pre-requisite for Installing RabbitMQ >>> >>> >> Here is how I got erlang R15B installed on ubuntu 11.10: >> >> sudo apt-get install autoconf >> sudo apt-get install g++ >> sudo apt-get install libncurses5-dev >> sudo apt-get install fop >> sudo apt-get install xsltproc >> sudo apt-get install openjdk-6-jdk >> sudo apt-get install libssl-dev >> sudo apt-get install unixodbc-dev >> sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg >> sudo apt-get install libwxbase2.8 libqt4-opengl-dev libgtk2.0-dev >> >> cd /usr/local/src >> sudo git clone https://github.com/erlang/otp.git >> cd otp >> sudo git checkout OTP_R15B >> sudo ./otp_build autoconf >> sudo ./configure >> sudo make >> sudo make install >> >> ----------------- >> >> Good luck! >> >> -wes >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Wed Jan 11 22:14:53 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 11 Jan 2012 21:14:53 +0000 Subject: [erlang-questions] Regd: Erlang In-Reply-To: References: <1325849682.15670.YahooMailClassic@web39306.mail.mud.yahoo.com> Message-ID: Cool nice one, hopefully the OP will be able to replicate your steps and get on with installing rabbit afterwards. On 11 January 2012 21:13, Wes James wrote: > yes > > here is uname -a > > 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 > x86_64 GNU/Linux > > -wes > > On Wed, Jan 11, 2012 at 1:46 PM, Tim Watson wrote: > >> Nicely done Wes - was that on a 64bit install? >> >> On 11 January 2012 18:30, Wes James wrote: >> >>> >>> >>> On Fri, Jan 6, 2012 at 4:34 AM, preeti sp wrote: >>> >>>> Hi >>>> >>>> I am struggling since many days to install RabbitMQ on Ubuntu Machine >>>> (X86-64) >>>> >>>> Now, Erlang is a pre-requisite for Installing RabbitMQ >>>> >>>> >>> Here is how I got erlang R15B installed on ubuntu 11.10: >>> >>> sudo apt-get install autoconf >>> sudo apt-get install g++ >>> sudo apt-get install libncurses5-dev >>> sudo apt-get install fop >>> sudo apt-get install xsltproc >>> sudo apt-get install openjdk-6-jdk >>> sudo apt-get install libssl-dev >>> sudo apt-get install unixodbc-dev >>> sudo apt-get install libwxgtk2.8-dev libwxgtk2.8-dbg >>> sudo apt-get install libwxbase2.8 libqt4-opengl-dev libgtk2.0-dev >>> >>> cd /usr/local/src >>> sudo git clone https://github.com/erlang/otp.git >>> cd otp >>> sudo git checkout OTP_R15B >>> sudo ./otp_build autoconf >>> sudo ./configure >>> sudo make >>> sudo make install >>> >>> ----------------- >>> >>> Good luck! >>> >>> -wes >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Jan 11 22:19:11 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 11 Jan 2012 22:19:11 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang Message-ID: Hi guys, Any Erlang library to simply DbC (? la Eiffel)? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From navinparray@REDACTED Wed Jan 11 23:17:23 2012 From: navinparray@REDACTED (Navin Parray) Date: Wed, 11 Jan 2012 18:17:23 -0400 Subject: [erlang-questions] When to use gen_server? Message-ID: Hello everyone, I'm developing a backend with Erlang/OTP and I need advice on the type of behaviours I should use for the various applications. The code is broken into four areas. One is a webmachine REST interface called myapp_webapi. This calls an application called myapp_core. myapp_core provides an abstraction of the data access layer. The data access layer consists of two applications, myapp_store and myapp_indexer. myapp_store connects to a Riak database while myapp_indexer connects to an ElasticSearch engine. My confusion lies in not knowing what type of behaviour the various layers should implement. Should the myapp_core be a gen_server or a basic application? Similarly, what about the myapp_store and myapp_indexer applications? I'd like to understand the reason I would chose one over the other in this situation. I could do this by simply calling modules in the webmachine application but I want to keep the areas separated because I will need to provide a second REST interface for another application. This would use the same data but only required read access to a couple data points and would be used by the public whereas myapp_webapi is used by my frontend applications only. I would need to call myapp_core from that application also. Regards Navin -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Wed Jan 11 23:32:44 2012 From: g@REDACTED (Garrett Smith) Date: Wed, 11 Jan 2012 16:32:44 -0600 Subject: [erlang-questions] When to use gen_server? In-Reply-To: References: Message-ID: On Wed, Jan 11, 2012 at 4:17 PM, Navin Parray wrote: > > Hello everyone, > > I'm developing a backend with Erlang/OTP and I need advice on the type of > behaviours I should use for the various applications. The code is broken > into four areas. One is a webmachine REST interface called myapp_webapi. > This calls an application called myapp_core. myapp_core provides an > abstraction of the data access layer. The data access layer consists of two > applications, myapp_store and myapp_indexer. myapp_store connects to a Riak > database while myapp_indexer connects to an ElasticSearch engine. > > My confusion lies in not knowing what type of behaviour the various layers > should implement. Should the myapp_core be a gen_server or a basic > application? Similarly, what about the myapp_store and myapp_indexer > applications? I'd like to understand the reason I would chose one over the > other in this situation. > > I could do this by simply calling modules in the webmachine application but > I want to keep the areas separated because I will need to provide a second > REST interface for another application. This would use the same data but > only required read access to a couple data points and would be used by the > public whereas myapp_webapi is used by my frontend applications only. I > would need to call myapp_core from that application also. Your overall project is probably one OTP application. If you're using rebar to build your project, you already have that setup (thanks rebar!) The components you're talking about are either registered gen_server processes or they're just modules, depending on how your data access is implemented. If you data access layer (some Riak client interface?) supports concurrent access (e.g. multiplexing, connection pools, etc.) there's no need to use gen_servers as intermediaries. The gen_server will serialize your requests and become a bottleneck in your application. If your database libraries can be used directly by your web tier, I think you're just talking about a module abstraction layer to give you a clean API. gen_servers are just fancy interfaces to Erlang processes. Each process has a mailbox and communicates with the outside by sending and receiving messages. If you don't need to serialize your data processing requests, don't bother with all that. While you could implement some pretty fancy things using multiple coordinated processes, I'm betting that's already in your database client. Garrett From mononcqc@REDACTED Wed Jan 11 23:55:49 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 11 Jan 2012 17:55:49 -0500 Subject: [erlang-questions] ct_framework:error_notification badarg error In-Reply-To: References: Message-ID: Because!!! (my best guess is that 'user' isn't alive, which is weird because it's usually the default process for these things.) On Wed, Jan 11, 2012 at 3:59 PM, Joel Reymont wrote: > Why??? > > === Ended at 2012-01-11 15:31:16 > === location {ct_framework,error_notification} > === reason = {error, > {ct_framework,error_notification, > {badarg, > [{io,format, > [user, > "~n- - - - - - - - - - - - - - - - > - - - - - - - - - -~n", > []], > []}, > {ct_framework,error_notification,4, > [{file,"ct_framework.erl"},{line,809}]}, > {test_server_sup,framework_call,4, > > [{file,"test_server_sup.erl"},{line,511}]}, > {test_server,run_test_case_eval1,6, > [{file,"test_server.erl"},{line,1187}]}, > {test_server,run_test_case_eval,9, > > [{file,"test_server.erl"},{line,1123}]}]}}} > > -- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Thu Jan 12 01:39:31 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 11 Jan 2012 16:39:31 -0800 (PST) Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: Message-ID: If you've not seen it already, Joe Armstrong's UBF is worth studying: http://www.sics.se/~joe/ubf/site/home.html On Jan 11, 3:19?pm, Zabrane Mickael wrote: > Hi guys, > > Any Erlang library to simply DbC (? la Eiffel)? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Thu Jan 12 03:12:23 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 12 Jan 2012 03:12:23 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: Message-ID: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Thanks Steve. But UBF is for protocol validation between Erlang and foreign languages. But to simply check pre-conditions, post-conditions aroudn functions ... may be something simple exists!!! Regards, Zabrane On Jan 12, 2012, at 1:39 AM, Steve Davis wrote: > If you've not seen it already, Joe Armstrong's UBF is worth studying: > > http://www.sics.se/~joe/ubf/site/home.html > > > On Jan 11, 3:19 pm, Zabrane Mickael wrote: >> Hi guys, >> >> Any Erlang library to simply DbC (? la Eiffel)? >> >> Regards, >> Zabrane >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From erlangsiri@REDACTED Thu Jan 12 10:16:15 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 12 Jan 2012 10:16:15 +0100 Subject: [erlang-questions] error_logger In-Reply-To: References: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> Message-ID: >From sasl user guide: "If the report browser is used off-line, the reports can be copied to another directory which is specified when starting the browser. If no such directory is specified, the browser reads reports from the SASL error_logger_mf_dir." I.e. start rb like this: > rb:start([{report_dir,"/tmp/error_logs"}]). /siri 2012/1/11 eigenfunction > Thank you very much for the quick answer, to which the next question > follows: > how do i read the binary-reports offline? I have copied the folder > errors.log to another directory, let's say /tmp > and am starting the erlang shell with erl -boot start_sasl -sasl > error_logger_mf_dir "\"tmp/error_logs\"" error_logger_mf_maxfiles 5 > error_logger_mf_maxbytes 10&. > It just overrides the previous files that were there and shows me the > newly created ones. > Any idea? > > On 11 Jan., 15:56, Siri Hansen wrote: > > 2012/1/11 eigenfunction > > > > > > > > > > > > > > > > > > > > > This is my sasl config file: > > > > > [{sasl, [ > > > {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, > > > %%{errlog_type, error}, > > > {error_logger_mf_dir,"d:/error_logs" }, > > > {error_logger_mf_maxbytes,10485760}, > > > {error_logger_mf_maxfiles, 2} > > > ]}]. > > > > > Can someone plz explain to me why i am only getting progress reports > > > in my file ? > > > In my code i used error_logger:msg_error ... for error messages. > > > thx. > > > > > This configuration installs two error handlers. First, the > > > > sasl_error_logger variable installs sasl_report_file_h which according to > > the documentation "Formats and writes supervisor reports, crash report > and > > progress report to a single file." > > > > Next, the three error_logger_mf_* variables install log_mf_h, which > writes > > *all* error logger events to a circular set of binary files in the > > directory specified by the error_logger_mf_dir variable (files will be > > named 1, 2 and index). These files can best be read with the report > browser > > (rb) in the sasl application. > > > > So, in your errors.log file you will only get supervisor, crash and > > progress reports, while the circular set of binary files will contain > *all* > > reports, including errors... > > > > Regards > > /siri > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED:// > erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker@REDACTED Thu Jan 12 11:09:55 2012 From: sverker@REDACTED (Sverker Eriksson) Date: Thu, 12 Jan 2012 11:09:55 +0100 Subject: [erlang-questions] How fast is to retrieve date from ETS table In-Reply-To: <6A0C5034-16EA-4C0C-A199-E35B24C53367@feuerlabs.com> References: <4F0D6F52.5020609@gmail.com> <800DD30B-066E-4F00-889A-E681149D821C@feuerlabs.com> <4F0DB1EF.2070501@erix.ericsson.se> <6A0C5034-16EA-4C0C-A199-E35B24C53367@feuerlabs.com> Message-ID: <4F0EB173.3010500@erix.ericsson.se> Ulf Wiger wrote: > Thanks for correcting me. I thought as much*, but then did some sloppy grep:ing and was misled. :) > > I assume it's copy_struct() in one direction (storing) and copy_shallow() in the other? > > Yes, that's right. /Sverker From emeka_1978@REDACTED Thu Jan 12 11:15:23 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Thu, 12 Jan 2012 02:15:23 -0800 (PST) Subject: [erlang-questions] error_logger In-Reply-To: References: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> Message-ID: Thank you very much. Could someone may be update the documentation and be more specific on that matter? I had already started looking for some other logging framework, but now that everything is working so flawlessly, i am sticking to error_logger. On 12 Jan., 10:16, Siri Hansen wrote: > From sasl user guide: > > "If the report browser is used off-line, the reports can be copied to > another directory which is specified when starting the browser. If no such > directory is specified, the browser reads reports from the SASL > error_logger_mf_dir." > > I.e. start rb like this: > > > rb:start([{report_dir,"/tmp/error_logs"}]). > > /siri > > 2012/1/11 eigenfunction > > > > > > > > > Thank you very much for the quick answer, to which the next question > > follows: > > how do i read the binary-reports offline? I have copied the folder > > errors.log to another directory, let's say /tmp > > and am starting the erlang shell with erl -boot ?start_sasl -sasl > > error_logger_mf_dir "\"tmp/error_logs\"" error_logger_mf_maxfiles 5 > > error_logger_mf_maxbytes 10&. > > It just overrides the previous files that were there and shows me the > > newly created ones. > > Any idea? > > > On 11 Jan., 15:56, Siri Hansen wrote: > > > 2012/1/11 eigenfunction > > > > > This is my sasl config file: > > > > > [{sasl, [ > > > > {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, > > > > %%{errlog_type, error}, > > > > {error_logger_mf_dir,"d:/error_logs" }, > > > > {error_logger_mf_maxbytes,10485760}, > > > > {error_logger_mf_maxfiles, 2} > > > > ]}]. > > > > > Can someone plz explain to me why i am only getting progress reports > > > > in my file ? > > > > In my code i used error_logger:msg_error ... for error messages. > > > > thx. > > > > > This configuration installs two error handlers. First, the > > > > sasl_error_logger variable installs sasl_report_file_h which according to > > > the documentation "Formats and writes supervisor reports, crash report > > and > > > progress report to a single file." > > > > Next, the three error_logger_mf_* variables install log_mf_h, which > > writes > > > *all* error logger events to a circular set of binary files in the > > > directory specified by the error_logger_mf_dir variable (files will be > > > named 1, 2 and index). These files can best be read with the report > > browser > > > (rb) in the sasl application. > > > > So, in your errors.log file you will only get supervisor, crash and > > > progress reports, while the circular set of binary files will contain > > *all* > > > reports, including errors... > > > > Regards > > > /siri > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questi...@REDACTED:// > > erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From erlangsiri@REDACTED Thu Jan 12 11:18:32 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 12 Jan 2012 11:18:32 +0100 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Hi! The only possible problem I can see is that any projects that cause > conflicts in reltool will make us unable to build release packages for > *the rest* of the projects that reside in the same directory. > > Say, I had erlson in my projects directory, and it was causing the > conflicts during release package generation (well, placing > erl_parse.erl into application listing is wrong, it definitely needs > to be fixed). > Probably, the same goes to projects that may contain same modules in > the applications listing (rabbitmq and riak_core both use > gen_server2.erl, and those modules are actually different; this > doesn't affect any of them but definitely but won't let us build > release package). > Maybe, there are some more rare errors that might occur as well. > I'm not sure that I understand everything here... Do you mean that with my proposal reltool will *see* some applications which it shall not include in the release package? And that the fact that some of these applications have modules with equal names causes problems when building the release package? If so, is it not possible to write a reltool config which specifies which apps/modules to use - and by this avoid conflicts? Sorry for the stupid questions - I just feel like it would be good to understand the problems completely... /siri -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Thu Jan 12 11:35:46 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Thu, 12 Jan 2012 02:35:46 -0800 (PST) Subject: [erlang-questions] When to use gen_server? In-Reply-To: References: Message-ID: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> >?If you don't need to serialize your data > processing requests, don't bother with all that. Could you pls elaborate more on that? I, Like the OP , sometimes have a hard time making a difference between a gen_server and a normal process, and i end up using normal processes and think that i am doing something wrong. Can anyone give an example of a case where a gen_server is more useful than a normal process? From lukas@REDACTED Thu Jan 12 11:41:38 2012 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 12 Jan 2012 11:41:38 +0100 Subject: [erlang-questions] error_logger In-Reply-To: References: <5b5ea0fb-316c-413e-b693-367bd5afe73c@i6g2000vbk.googlegroups.com> Message-ID: Hello! One of the great advantages of looking at something for the first time is that you get a very unique perspective which we will never get. If you find that parts of the documentation could be better expressed or should be expanded, please take the time to submit a patch[1]. You can find the documentation for the relevant sections here[2] and here[3]. Lukas [1] https://github.com/erlang/otp/wiki/Submitting-patches [2] https://github.com/erlang/otp/tree/master/lib/sasl/doc/src [3] https://github.com/erlang/otp/blob/master/lib/kernel/doc/src/error_logger.xml On Thu, Jan 12, 2012 at 11:15 AM, eigenfunction wrote: > Thank you very much. > Could someone may be update the documentation and be more specific on > that matter? > I had already started looking for some other logging framework, but > now that everything is working so > flawlessly, i am sticking to error_logger. > > > On 12 Jan., 10:16, Siri Hansen wrote: >> From sasl user guide: >> >> "If the report browser is used off-line, the reports can be copied to >> another directory which is specified when starting the browser. If no such >> directory is specified, the browser reads reports from the SASL >> error_logger_mf_dir." >> >> I.e. start rb like this: >> >> > rb:start([{report_dir,"/tmp/error_logs"}]). >> >> /siri >> >> 2012/1/11 eigenfunction >> >> >> >> >> >> >> >> > Thank you very much for the quick answer, to which the next question >> > follows: >> > how do i read the binary-reports offline? I have copied the folder >> > errors.log to another directory, let's say /tmp >> > and am starting the erlang shell with erl -boot ?start_sasl -sasl >> > error_logger_mf_dir "\"tmp/error_logs\"" error_logger_mf_maxfiles 5 >> > error_logger_mf_maxbytes 10&. >> > It just overrides the previous files that were there and shows me the >> > newly created ones. >> > Any idea? >> >> > On 11 Jan., 15:56, Siri Hansen wrote: >> > > 2012/1/11 eigenfunction >> >> > > > This is my sasl config file: >> >> > > > [{sasl, [ >> > > > {sasl_error_logger, {file,"d:/error_logs/errors.log"}}, >> > > > %%{errlog_type, error}, >> > > > {error_logger_mf_dir,"d:/error_logs" }, >> > > > {error_logger_mf_maxbytes,10485760}, >> > > > {error_logger_mf_maxfiles, 2} >> > > > ]}]. >> >> > > > Can someone plz explain to me why i am only getting progress reports >> > > > in my file ? >> > > > In my code i used error_logger:msg_error ... for error messages. >> > > > thx. >> >> > > > This configuration installs two error handlers. First, the >> >> > > sasl_error_logger variable installs sasl_report_file_h which according to >> > > the documentation "Formats and writes supervisor reports, crash report >> > and >> > > progress report to a single file." >> >> > > Next, the three error_logger_mf_* variables install log_mf_h, which >> > writes >> > > *all* error logger events to a circular set of binary files in the >> > > directory specified by the error_logger_mf_dir variable (files will be >> > > named 1, 2 and index). These files can best be read with the report >> > browser >> > > (rb) in the sasl application. >> >> > > So, in your errors.log file you will only get supervisor, crash and >> > > progress reports, while the circular set of binary files will contain >> > *all* >> > > reports, including errors... >> >> > > Regards >> > > /siri >> >> > > _______________________________________________ >> > > erlang-questions mailing list >> > > erlang-questi...@REDACTED:// >> > erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questi...@REDACTED >> >http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From demeshchuk@REDACTED Thu Jan 12 11:42:27 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Thu, 12 Jan 2012 14:42:27 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: I'm sorry, my explanation was really messy. It seems like in that case reltool will *see* and somehow *validate* all Erlang applications it finds in the "lib" directory, no matter if they are included into reltool.config or not. Maybe this should be considered as wrong behavior. So, in my example erlson wasn't included anywhere in reltool.config. It just had 'erl_parse' module included into the application. Btw, apparently Anton has recently removed erl_parse.erl from his repository, just because it had been causing problems with release package generation. Of course, this error is quite specific, but maybe there are more possible errors that I just don't know. On Thu, Jan 12, 2012 at 2:18 PM, Siri Hansen wrote: > Hi! > >> The only possible problem I can see is that any projects that cause >> conflicts in reltool will make us unable to build release packages for >> *the rest* of the projects that reside in the same directory. >> >> Say, I had erlson in my projects directory, and it was causing the >> conflicts during release package generation (well, placing >> erl_parse.erl into application listing is wrong, it definitely needs >> to be fixed). >> Probably, the same goes to projects that may contain same modules in >> the applications listing (rabbitmq and riak_core both use >> gen_server2.erl, and those modules are actually different; this >> doesn't affect any of them but definitely but won't let us build >> release package). >> Maybe, there are some more rare errors that might occur as well. > > > I'm not sure that I understand everything here... Do you mean that with my > proposal reltool will *see* some applications which it shall not include in > the release package? And that the fact that some of these applications have > modules with equal names causes problems when building the release package? > > If so, is it not possible to write a reltool config which specifies which > apps/modules to use - and by this avoid conflicts? Sorry for the stupid > questions - I just feel like it would be good to understand the problems > completely... > > /siri -- Best regards, Dmitry Demeshchuk From erlangsiri@REDACTED Thu Jan 12 12:01:17 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 12 Jan 2012 12:01:17 +0100 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Sorry, forgot to copy the list... 2012/1/12 Siri Hansen > Ok, I see! But what does your reltool config look like when you start > reltool? > > By default, when starting reltool it will traverse all applications seen > in the lib dirs. The idea is that if there are multiple modules with the > same name, then reltool will fail if it can not decide which one to > include, but if the configuration indicates what to include, then it will > only warn. > > There might of course be bugs in this functionality, so an example would > be nice to see... > > /siri > > 2012/1/12 Dmitry Demeshchuk > >> I'm sorry, my explanation was really messy. >> >> It seems like in that case reltool will *see* and somehow *validate* >> all Erlang applications it finds in the "lib" directory, no matter if >> they are included into reltool.config or not. Maybe this should be >> considered as wrong behavior. >> >> So, in my example erlson wasn't included anywhere in reltool.config. >> It just had 'erl_parse' module included into the application. Btw, >> apparently Anton has recently removed erl_parse.erl from his >> repository, just because it had been causing problems with release >> package generation. >> Of course, this error is quite specific, but maybe there are more >> possible errors that I just don't know. >> >> >> On Thu, Jan 12, 2012 at 2:18 PM, Siri Hansen >> wrote: >> > Hi! >> > >> >> The only possible problem I can see is that any projects that cause >> >> conflicts in reltool will make us unable to build release packages for >> >> *the rest* of the projects that reside in the same directory. >> >> >> >> Say, I had erlson in my projects directory, and it was causing the >> >> conflicts during release package generation (well, placing >> >> erl_parse.erl into application listing is wrong, it definitely needs >> >> to be fixed). >> >> Probably, the same goes to projects that may contain same modules in >> >> the applications listing (rabbitmq and riak_core both use >> >> gen_server2.erl, and those modules are actually different; this >> >> doesn't affect any of them but definitely but won't let us build >> >> release package). >> >> Maybe, there are some more rare errors that might occur as well. >> > >> > >> > I'm not sure that I understand everything here... Do you mean that with >> my >> > proposal reltool will *see* some applications which it shall not >> include in >> > the release package? And that the fact that some of these applications >> have >> > modules with equal names causes problems when building the release >> package? >> > >> > If so, is it not possible to write a reltool config which specifies >> which >> > apps/modules to use - and by this avoid conflicts? Sorry for the stupid >> > questions - I just feel like it would be good to understand the problems >> > completely... >> > >> > /siri >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Thu Jan 12 12:22:04 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 12 Jan 2012 11:22:04 +0000 Subject: [erlang-questions] When to use gen_server? In-Reply-To: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> References: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> Message-ID: On Thu, Jan 12, 2012 at 10:35 AM, eigenfunction wrote: > > > If you don't need to serialize your data > > processing requests, don't bother with all that. > > Could you pls elaborate more on that? I, Like the OP , sometimes > have a hard time making a difference between a gen_server and a normal > process, > and i end up using normal processes and think that i am doing > something wrong. > Can anyone give an example of a case where a gen_server is more useful > than a normal > process? > > A gen_server wraps up a resource through client-server interaction. From the documentation ( http://www.erlang.org/doc/design_principles/gen_server_concepts.html#id55988 ): "The client-server model is characterized by a central server and an arbitrary number of clients. The client-server model is generally used for resource management operations, where several different clients want to share a common resource. The server is responsible for managing this resource." The key here is that you want multiple clients to share one common resource. Thus you have to provide a way to handle multiple requests from your clients in a defined way. The gen_server does that for you. Sometimes your model does not need a shared common resource, instead you bring lots of processes to life that do work. For example, I use a gen_server to handle comms with a C Node that runs Lua code. This means I don't have to worry about asynchronous requests in my C or Lua code. I have another component that handles messages from RabbitMQ and here I simply care about handling the message, so I kick of a process to deal with the message. (This is low-volume messaging, in case you start wondering about the sanity of this approach :-) Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From demeshchuk@REDACTED Thu Jan 12 12:40:39 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Thu, 12 Jan 2012 15:40:39 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Try running this gist: https://gist.github.com/1600020 reltool.config will reside in lib/gproc/rel/ Thank you. On Thu, Jan 12, 2012 at 3:01 PM, Siri Hansen wrote: > Sorry, forgot to copy the list... > > > 2012/1/12 Siri Hansen >> >> Ok, I see! But what does your reltool config look like when you start >> reltool? >> >> By default, when starting reltool it will traverse all applications seen >> in the lib dirs.?The idea is that if there are multiple modules with the >> same name, then reltool will fail if it can not decide which one to include, >> but if the configuration indicates what to include, then it will only warn. >> >> There might of course be bugs in this functionality, so an example would >> be nice to see... >> >> /siri >> >> 2012/1/12 Dmitry Demeshchuk >>> >>> I'm sorry, my explanation was really messy. >>> >>> It seems like in that case reltool will *see* and somehow *validate* >>> all Erlang applications it finds in the "lib" directory, no matter if >>> they are included into reltool.config or not. Maybe this should be >>> considered as wrong behavior. >>> >>> So, in my example erlson wasn't included anywhere in reltool.config. >>> It just had 'erl_parse' module included into the application. Btw, >>> apparently Anton has recently removed erl_parse.erl from his >>> repository, just because it had been causing problems with release >>> package generation. >>> Of course, this error is quite specific, but maybe there are more >>> possible errors that I just don't know. >>> >>> >>> On Thu, Jan 12, 2012 at 2:18 PM, Siri Hansen >>> wrote: >>> > Hi! >>> > >>> >> The only possible problem I can see is that any projects that cause >>> >> conflicts in reltool will make us unable to build release packages for >>> >> *the rest* of the projects that reside in the same directory. >>> >> >>> >> Say, I had erlson in my projects directory, and it was causing the >>> >> conflicts during release package generation (well, placing >>> >> erl_parse.erl into application listing is wrong, it definitely needs >>> >> to be fixed). >>> >> Probably, the same goes to projects that may contain same modules in >>> >> the applications listing (rabbitmq and riak_core both use >>> >> gen_server2.erl, and those modules are actually different; this >>> >> doesn't affect any of them but definitely but won't let us build >>> >> release package). >>> >> Maybe, there are some more rare errors that might occur as well. >>> > >>> > >>> > I'm not sure that I understand everything here... Do you mean that with >>> > my >>> > proposal reltool will *see* some applications which it shall not >>> > include in >>> > the release package? And that the fact that some of these applications >>> > have >>> > modules with equal names causes problems when building the release >>> > package? >>> > >>> > If so, is it not possible to write a reltool config which specifies >>> > which >>> > apps/modules to use - and by this avoid conflicts? Sorry for the stupid >>> > questions - I just feel like it would be good to understand the >>> > problems >>> > completely... >>> > >>> > /siri >>> >>> >>> >>> -- >>> Best regards, >>> Dmitry Demeshchuk >> >> > -- Best regards, Dmitry Demeshchuk From emeka_1978@REDACTED Thu Jan 12 13:17:32 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Thu, 12 Jan 2012 04:17:32 -0800 (PST) Subject: [erlang-questions] When to use gen_server? In-Reply-To: References: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> Message-ID: <913af776-3c36-4c31-97d3-a312f15e8847@n30g2000yqd.googlegroups.com> Now i see. That makes sense. Thank you for the explanation. On 12 Jan., 12:22, Robert Raschke wrote: > On Thu, Jan 12, 2012 at 10:35 AM, eigenfunction wrote: > > > > > > If you don't need to serialize your data > > > processing requests, don't bother with all that. > > > Could you pls elaborate more on that? I, Like the OP , sometimes > > have a hard time making a difference between a gen_server and a normal > > process, > > and i end up using normal processes and think that i am doing > > something wrong. > > Can anyone give an example of a case where a gen_server is more useful > > than a normal > > process? > > A gen_server wraps up a resource through client-server interaction. From > the documentation (http://www.erlang.org/doc/design_principles/gen_server_concepts.html#... > ): > > "The client-server model is characterized by a central server and an > arbitrary number of clients. The client-server model is generally used for > resource management operations, where several different clients want to > share a common resource. The server is responsible for managing this > resource." > > The key here is that you want multiple clients to share one common > resource. Thus you have to provide a way to handle multiple requests from > your clients in a defined way. The gen_server does that for you. > > Sometimes your model does not need a shared common resource, instead you > bring lots of processes to life that do work. > > For example, I use a gen_server to handle comms with a C Node that runs Lua > code. This means I don't have to worry about asynchronous requests in my C > or Lua code. > > I have another component that handles messages from RabbitMQ and here I > simply care about handling the message, so I kick of a process to deal with > the message. (This is low-volume messaging, in case you start wondering > about the sanity of this approach :-) > > Robby > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From michal.niec@REDACTED Thu Jan 12 13:51:04 2012 From: michal.niec@REDACTED (Michal Niec) Date: Thu, 12 Jan 2012 13:51:04 +0100 Subject: [erlang-questions] Regd: Erlang In-Reply-To: <1326250615.4361.YahooMailClassic@web39303.mail.mud.yahoo.com> References: <1326250615.4361.YahooMailClassic@web39303.mail.mud.yahoo.com> Message-ID: Hi Preeti, When you tried to install the esl-erlang_15.b-1_amd64.deb package, the error message stated you have missing dependencies. In the message you have all the package names. You can install them by calling (sudo) apt-get install -f, this will repair all required dependencies and finish installation. Some notes: If you are executing the dpkg command as a simple user, use sudo dpkg -i esl-erlang_15.b-1_amd64.deb The package you downloaded was generated and tested on Ubuntu 11.04. If we don't have the correct OS version you would like to use, you can always ask us to generate it. We are already planning to add Ubuntu 11.10 to our OS list. Even if the dpkg command has --force-depends flag but it is not recommended to use it. Best Regards, Micha? Nie? On 11 Jan 2012, at 03:56, preeti sp wrote: > Tim, > > Refer my answers below: > > - what ubuntu version are you installing onto :- 11.10 > > - what command(s) you are running to build/install : I am using below commands you stated: make, configure, make install. I am not passing any options. > > - what output and/or error messages are you getting: > I am getting a bunch of errors stating - all erlang dependencies are missing - like odbc etc... > > > I tried installing as Magnus said using below command as well: > dpkg -i esl-erlang_15.b-1_amd64.deb > But, I am getting below error now with that approach: > > (Reading database ... 59952 files and directories currently installed.) > Preparing to replace esl-erlang 1:15.b (using esl-erlang_15.b-1_amd64.deb) ... > Unpacking replacement esl-erlang ... > dpkg: dependency problems prevent configuration of esl-erlang: > esl-erlang depends on default-jre-headless | java2-runtime-headless | java1-runtime-headless | java2-runtime | java1-runtime; however: > Package default-jre-headless is not installed. > Package java2-runtime-headless is not installed. > Package java1-runtime-headless is not installed. > Package java2-runtime is not installed. > Package java1-runtime is not installed. > esl-erlang depends on libwxbase2.8-0; however: > Package libwxbase2.8-0 is not installed. > esl-erlang depends on libwxgtk2.8-0; however: > Package libwxgtk2.8-0 is not installed. > dpkg: error processing esl-erlang (--install): > dependency problems - leaving unconfigured > Errors were encountered while processing: > > > > > > --- On Sat, 1/7/12, Tim Watson wrote: > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Saturday, January 7, 2012, 1:54 AM > > Hi Preeti, > > I quite understand. Magnus has replied with a link to some pre-packaged distributions - I'd completely forgotten about those - and they're probably the best way to go. > > Installing Erlang on Ubuntu should just be a matter of running the apt/aptitude commands. Compiling from source involves grabbing the download from the erlang.org website and running `./configure && make && make install` with some --options passed to configure. If you still want to build/install using apt or from sources, please reply with the following information so we can help: > > - what ubuntu version are you installing onto > - what command(s) you are running to build/install > - what output and/or error messages are you getting > > With these details, I'm sure we'll be able to help! > > Cheers, > > Tim > > On 7 January 2012 03:43, preeti sp wrote: > Hi Tim, > > I am not an erlang person. I am mainly working with RabbitMQ. I am not clear with below mail details. Could you please let me know exact details on how do I install erlang successfully on ubuntu (Right now, it is not getting installed properly and stating that ncurses not found is the reason for erlang's improper installation) > > Thanks, > Preeti > > > --- On Fri, 1/6/12, Tim Watson wrote: > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 1:37 PM > > > If you need to build curses by hand then do so - just run ./configure --help to see what flags are required to produce a 64 bit binary. Then just point the Erlang configure script at it. Otherwise, you could just do --without-curses or whatever when building Erlang, but personally I'd want (n)curses enabled. > > Personally I'd suggest you build it by hand from sources, or use kerl and pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. > > On 6 January 2012 18:02, preeti sp wrote: > I actually followed the exact steps illustrated in the link you shared below (GNU/LINUX) on ubuntu. > > But, when I executed below command, I got a message saying corresponding libraries not found to install. Since those libraries did not install well, erlang installation also showed an error at the end saying - curses library not found. So, rabbitmq installation failed! > > What i need is proper detailed commands to install below libraries on ubuntu x86-64 machine configuration! > > Thanks, > Preeti > sudo apt-get install build-essential libncurses5-dev openssl libssl-dev > > --- On Fri, 1/6/12, Tim Watson wrote: > > From: Tim Watson > Subject: Re: [erlang-questions] Regd: Erlang > To: "preeti sp" > Cc: erlang-questions@REDACTED > Date: Friday, January 6, 2012, 4:25 AM > > > And reading http://wiki.basho.com/Installing-Erlang.html might help too. > > On 6 January 2012 12:24, Tim Watson wrote: > Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. > > If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). > > Also, what version of Ubuntu are you using and do you have the build-essential packages installed? > > Cheers, > > Tim > > On 6 January 2012 11:34, preeti sp wrote: > Hi > > I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) > > Now, Erlang is a pre-requisite for Installing RabbitMQ > > When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. > > I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully > > Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? > > Thanks, > Preeti > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Jan 12 15:11:52 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 12 Jan 2012 14:11:52 +0000 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: You could easily write your own using https://github.com/hyperthunk/annotations For some usage examples: https://github.com/hyperthunk/rebar_annotations/blob/master/src/base_dir.erl https://github.com/nebularis/memoize/blob/master/src/memoize.erl It would be easy to write the pre/post conditions as annotations and glue them in to the build using this. On 12 January 2012 02:12, Zabrane Mickael wrote: > Thanks Steve. But UBF is for protocol validation between Erlang and > foreign languages. > > But to simply check pre-conditions, post-conditions aroudn functions ... > may be something simple exists!!! > > Regards, > Zabrane > > On Jan 12, 2012, at 1:39 AM, Steve Davis wrote: > > > If you've not seen it already, Joe Armstrong's UBF is worth studying: > > > > http://www.sics.se/~joe/ubf/site/home.html > > > > > > On Jan 11, 3:19 pm, Zabrane Mickael wrote: > >> Hi guys, > >> > >> Any Erlang library to simply DbC (? la Eiffel)? > >> > >> Regards, > >> Zabrane > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questi...@REDACTED:// > erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Jan 12 15:13:35 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 12 Jan 2012 14:13:35 +0000 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: And if you need to differentiate between pre/post more clearly in your annotation, you can do it like this too: https://github.com/hyperthunk/annotations/blob/master/examples/simple/src/logging.erl On 12 January 2012 14:11, Tim Watson wrote: > You could easily write your own using > https://github.com/hyperthunk/annotations > > For some usage examples: > > > https://github.com/hyperthunk/rebar_annotations/blob/master/src/base_dir.erl > https://github.com/nebularis/memoize/blob/master/src/memoize.erl > > It would be easy to write the pre/post conditions as annotations and glue > them in to the build using this. > > On 12 January 2012 02:12, Zabrane Mickael wrote: > >> Thanks Steve. But UBF is for protocol validation between Erlang and >> foreign languages. >> >> But to simply check pre-conditions, post-conditions aroudn functions ... >> may be something simple exists!!! >> >> Regards, >> Zabrane >> >> On Jan 12, 2012, at 1:39 AM, Steve Davis wrote: >> >> > If you've not seen it already, Joe Armstrong's UBF is worth studying: >> > >> > http://www.sics.se/~joe/ubf/site/home.html >> > >> > >> > On Jan 11, 3:19 pm, Zabrane Mickael wrote: >> >> Hi guys, >> >> >> >> Any Erlang library to simply DbC (? la Eiffel)? >> >> >> >> Regards, >> >> Zabrane >> >> >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questi...@REDACTED:// >> erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangsiri@REDACTED Thu Jan 12 15:47:52 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 12 Jan 2012 15:47:52 +0100 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Ah... this is interesting... a missing test case maybe - but I'm not sure if it is a bug. What happens is that the duplicated module erl_parse causes erlson to become derived since a module with the same name is used by stdlib and several other applications. If it was only stdlib, then I guess reltool could make the assumption that the module to use is the one in the same application and thus never make erlson derived (because to this module, that is). However, since the module in this case is also used by other applications, this assumption is not that obvious. The easiest way to get around this right now is to be more specific in the config file to make sure that erlson (or only the erl_parse module) is excluded... e.g. by adding {app, erlson, [{incl_cond,exclude}]} or {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} (The latter would allow erlson to be derived if any of it's other modules were used by other applications) Regards /siri 2012/1/12 Dmitry Demeshchuk > Try running this gist: https://gist.github.com/1600020 > > reltool.config will reside in lib/gproc/rel/ > > Thank you. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Jan 12 16:12:46 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 12 Jan 2012 16:12:46 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: Thanks Tim. I'll give "annotations" a try. Regards, Zabrane On Jan 12, 2012, at 3:13 PM, Tim Watson wrote: > And if you need to differentiate between pre/post more clearly in your annotation, you can do it like this too: > > https://github.com/hyperthunk/annotations/blob/master/examples/simple/src/logging.erl > > On 12 January 2012 14:11, Tim Watson wrote: > You could easily write your own using https://github.com/hyperthunk/annotations > > For some usage examples: > > https://github.com/hyperthunk/rebar_annotations/blob/master/src/base_dir.erl > https://github.com/nebularis/memoize/blob/master/src/memoize.erl > > It would be easy to write the pre/post conditions as annotations and glue them in to the build using this. > > On 12 January 2012 02:12, Zabrane Mickael wrote: > Thanks Steve. But UBF is for protocol validation between Erlang and foreign languages. > > But to simply check pre-conditions, post-conditions aroudn functions ... may be something simple exists!!! > > Regards, > Zabrane > > On Jan 12, 2012, at 1:39 AM, Steve Davis wrote: > > > If you've not seen it already, Joe Armstrong's UBF is worth studying: > > > > http://www.sics.se/~joe/ubf/site/home.html > > > > > > On Jan 11, 3:19 pm, Zabrane Mickael wrote: > >> Hi guys, > >> > >> Any Erlang library to simply DbC (? la Eiffel)? > >> > >> Regards, > >> Zabrane > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From preetisp_83@REDACTED Thu Jan 12 16:21:33 2012 From: preetisp_83@REDACTED (preeti sp) Date: Thu, 12 Jan 2012 07:21:33 -0800 (PST) Subject: [erlang-questions] Regd: Erlang In-Reply-To: Message-ID: <1326381693.29741.YahooMailClassic@web39302.mail.mud.yahoo.com> Thanks Michal. I am reading this after doing successful Installation :) Never Mind, your solution works! --- On Thu, 1/12/12, Michal Niec wrote: From: Michal Niec Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: "Tim Watson" , erlang-questions@REDACTED Date: Thursday, January 12, 2012, 4:51 AM Hi Preeti, When you tried to install the esl-erlang_15.b-1_amd64.deb package, the error message stated you have missing dependencies. In the message you have all the package names. You can install them by calling (sudo) apt-get install -f, this will repair all required dependencies and finish installation. Some notes: If you are executing the dpkg command as a simple user, use sudo dpkg -i esl-erlang_15.b-1_amd64.deb The package you downloaded was generated and tested on Ubuntu 11.04. If we don't have the correct OS version you would like to use, you can always ask us to generate it. We are already planning to add Ubuntu 11.10 to our OS list. Even if the dpkg command has --force-depends flag but it is not recommended to use it.? Best Regards, Micha? Nie? On 11 Jan 2012, at 03:56, preeti sp wrote: Tim, Refer my answers below: - what ubuntu version are you installing onto :- 11.10 - what command(s) you are running to build/install : I am using below commands you stated: make, configure, make install. I am not passing any options. - what output and/or error messages are you getting: I am getting a bunch of errors stating - all erlang dependencies are missing - like odbc etc... I tried installing as Magnus said using below command as well: dpkg -i esl-erlang_15.b-1_amd64.deb But, I am getting below error now with that approach: (Reading database ... 59952 files and directories currently installed.) Preparing to replace esl-erlang 1:15.b (using esl-erlang_15.b-1_amd64.deb) ... Unpacking replacement esl-erlang ... dpkg: dependency problems prevent configuration of esl-erlang: esl-erlang depends on default-jre-headless | java2-runtime-headless | java1-runtime-headless | java2-runtime | java1-runtime; however: Package default-jre-headless is not installed. Package java2-runtime-headless is not installed. Package java1-runtime-headless is not installed. Package java2-runtime is not installed. Package java1-runtime is not installed. esl-erlang depends on libwxbase2.8-0; however: Package libwxbase2.8-0 is not installed. esl-erlang depends on libwxgtk2.8-0; however: Package libwxgtk2.8-0 is not installed. dpkg: error processing esl-erlang (--install): dependency problems - leaving unconfigured Errors were encountered while processing: --- On Sat, 1/7/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Saturday, January 7, 2012, 1:54 AM Hi Preeti, I quite understand. Magnus has replied with a link to some pre-packaged distributions - I'd completely forgotten about those - and they're probably the best way to go. Installing Erlang on Ubuntu should just be a matter of running the apt/aptitude commands. Compiling from source involves grabbing the download from the erlang.org website and running `./configure && make && make install` with some --options passed to configure. If you still want to build/install using apt or from sources, please reply with the following information so we can help: - what ubuntu version are you installing onto?- what command(s) you are running to build/install- what output and/or error messages are you getting With these details,?I'm sure?we'll be able to help! Cheers, Tim On 7 January 2012 03:43, preeti sp wrote: Hi Tim, I am not an erlang person. I am mainly working with RabbitMQ. I am not clear with below mail details. Could you please let me know exact details on how do I install erlang successfully on ubuntu (Right now, it is not getting installed properly and stating that ncurses not found is the reason for erlang's improper installation) Thanks, Preeti --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 1:37 PM If you need to build curses by hand then do so - just run ./configure --help to see what flags are required to produce a 64 bit binary. Then just point the Erlang configure script at it. Otherwise, you could just do --without-curses or whatever when building Erlang, but personally I'd want (n)curses enabled. Personally I'd suggest you build it by hand from sources, or use kerl and pass KERL_CONFIGURE_OPTS based on the install documentation if you prefer. ? On 6 January 2012 18:02, preeti sp wrote: I actually followed the exact steps illustrated in the link you shared below (GNU/LINUX) on ubuntu. But, when I executed below command, I got a message saying corresponding libraries not found to install. Since those libraries did not install well, erlang installation also showed an error at the end saying - curses library not found. So, rabbitmq installation failed! What i need is proper detailed commands to install below libraries on ubuntu x86-64 machine configuration! Thanks, Preeti sudo apt-get install build-essential libncurses5-dev openssl libssl-dev --- On Fri, 1/6/12, Tim Watson wrote: From: Tim Watson Subject: Re: [erlang-questions] Regd: Erlang To: "preeti sp" Cc: erlang-questions@REDACTED Date: Friday, January 6, 2012, 4:25 AM And reading?http://wiki.basho.com/Installing-Erlang.html might help too. On 6 January 2012 12:24, Tim Watson wrote: Have you tried installing from sources? It sounds like perhaps the ./configure script needs to know --with-curses (or whatever the actual switch is to point to the ncurses you've installed) and/or the architecture you're installing for one isn't compatible with the other. If you want detailed assistance, please provide a bit more information about *how* you're trying to install and what is going wrong (like error messages etc). Also, what version of Ubuntu are you using and do you have the build-essential packages installed? Cheers, Tim On 6 January 2012 11:34, preeti sp wrote: Hi I am struggling since many days to install RabbitMQ on Ubuntu Machine (X86-64) Now, Erlang is a pre-requisite for Installing RabbitMQ When I try to Install Erlang, I get an error message saying - Ncurses library is not installed. I tried installing ncurses library in multiple ways using sudo apt-get commands. It does not happen and so I am not able to install erlang successfully Can anyone provide me a list of detailed steps to be able to install erlang version 14 on an ubuntu machine? Thanks, Preeti _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Thu Jan 12 17:03:48 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Thu, 12 Jan 2012 17:03:48 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: Also, you can typespec everything rigorously and dialyze, not dbc per se, but gives you great confidence that it fits together nicely. On Jan 12, 2012 4:17 PM, "Zabrane Mickael" wrote: > Thanks Tim. > > I'll give *"annotations"* a try. > > Regards, > Zabrane > > > On Jan 12, 2012, at 3:13 PM, Tim Watson wrote: > > And if you need to differentiate between pre/post more clearly in your > annotation, you can do it like this too: > > > https://github.com/hyperthunk/annotations/blob/master/examples/simple/src/logging.erl > > On 12 January 2012 14:11, Tim Watson wrote: > >> You could easily write your own using >> https://github.com/hyperthunk/annotations >> >> For some usage examples: >> >> >> https://github.com/hyperthunk/rebar_annotations/blob/master/src/base_dir.erl >> https://github.com/nebularis/memoize/blob/master/src/memoize.erl >> >> It would be easy to write the pre/post conditions as annotations and glue >> them in to the build using this. >> >> On 12 January 2012 02:12, Zabrane Mickael wrote: >> >>> Thanks Steve. But UBF is for protocol validation between Erlang and >>> foreign languages. >>> >>> But to simply check pre-conditions, post-conditions aroudn functions ... >>> may be something simple exists!!! >>> >>> Regards, >>> Zabrane >>> >>> On Jan 12, 2012, at 1:39 AM, Steve Davis wrote: >>> >>> > If you've not seen it already, Joe Armstrong's UBF is worth studying: >>> > >>> > http://www.sics.se/~joe/ubf/site/home.html >>> > >>> > >>> > On Jan 11, 3:19 pm, Zabrane Mickael wrote: >>> >> Hi guys, >>> >> >>> >> Any Erlang library to simply DbC (? la Eiffel)? >>> >> >>> >> Regards, >>> >> Zabrane >>> >> >>> >> _______________________________________________ >>> >> erlang-questions mailing list >>> >> erlang-questi...@REDACTED:// >>> erlang.org/mailman/listinfo/erlang-questions >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingo.jaeckel@REDACTED Thu Jan 12 17:08:00 2012 From: ingo.jaeckel@REDACTED (Ingo Jaeckel) Date: Thu, 12 Jan 2012 16:08:00 +0000 Subject: [erlang-questions] Exchanging messages during functions called by Erlang Server Interface mod_esi? In-Reply-To: References: Message-ID: Hello, I am currently developing a module that creates an instance of inets http server. After starting the server, I call two different messages of my module (create/3, read/3) from a browser. Both methods are shown below: create(SessionID, Env, _Input) -> ? ? ? ?{Key, Value} = lists:last(Env), ? ? ? ?case Key of ? ? ? ? ? ? ? ?query_string -> ? ? ? ? ? ? ? ? ? ? ? ?reply(SessionID, "{created: true}"), ? ? ? ? ? ? ? ? ? ? ? ?storage ! {create, string_to_tuple(Value)}; ? ? ? ? ? ? ? ?_ -> ? ? ? ? ? ? ? ? ? ? ? ?reply(SessionID, "{error: \"Missing query string.\"}") ? ? ? ?end. read(SessionID, _Env, _Input) -> ? ? ? ?storage ! {read, self()}, ? ? ? ?receive ? ? ? ? ? ? ? [] -> ? reply(SessionID, lists:concat(["{\"results\": []}"])); ? ? ? ? ? ? ? Data -> ? ? ? ? ? ? ? ? ? ? ? reply(SessionID, lists:concat(["{\"count\": ", length(Data), ", \"results\": ", json:encode(Data), "}"])) ? ? ? end. reply(SessionID, Reply) -> ? ? ? ?mod_esi:deliver(SessionID, [ ? ? ? ? ? ? ? ?"Content-Type: application/json\r\n\r\n", ? ? ? ? ? ? ? ?Reply ? ? ? ?]). I can open the URL for the create/3 function without any problems. The browser immediately receives the proper reply. But when I try to call the URL for read/3, the server never receives a response. I have exactly the same behavior for create/3 when I send a message BEFORE replying back to the client. Now, one difference between read/3 and create/3 is that read/3 sends and receives a message to a registered process (running on the same node) before it replies back to the client. Is this maybe something you cannot do within functions called by mod_esi? Or could there be another reason preventing me from sending a proper reply back to the client? Thank you very much in advance! Regards, Ingo From zabrane3@REDACTED Thu Jan 12 17:09:28 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 12 Jan 2012 17:09:28 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: Already did that. But it's static checking and want also dynamic checking. Anyway thanks. Regards, Zabrane On Jan 12, 2012, at 5:03 PM, Gianfranco Alongi wrote: > Also, you can typespec everything rigorously and dialyze, not dbc per se, but gives you great confidence that it fits together nicely. > > On Jan 12, 2012 4:17 PM, "Zabrane Mickael" wrote: > Thanks Tim. > > I'll give "annotations" a try. > > Regards, > Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Thu Jan 12 17:54:01 2012 From: g@REDACTED (Garrett Smith) Date: Thu, 12 Jan 2012 10:54:01 -0600 Subject: [erlang-questions] When to use gen_server? In-Reply-To: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> References: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> Message-ID: On Thu, Jan 12, 2012 at 4:35 AM, eigenfunction wrote: > >>?If you don't need to serialize your data >> processing requests, don't bother with all that. > > Could you pls elaborate more on that? I, Like the OP , sometimes > have a hard time making a difference between a gen_server and a normal > process, > and i end up using normal processes and think that i am doing > something wrong. > Can anyone give an example of a case where a gen_server is more useful > than a normal > process? As Robert succinctly put, a gen_server wraps a process. Use gen_server whenever you want to formalize your process behavior. Here's a simple low level use of an Erlang process: spawn(fun() -> do_work() end) We do some work in an Erlang process and when we're done the process exits. Super simple. We can "formalize" the process by creating a module: -module(workers). start_work -> spawn(fun() -> do_work() end). This hides the details of doing the work. You can document it, you can include it in an OTP app that can be used in different system configurations. Fantastic! Adding more features to our process-based work system is now a matter of adding new functions: change_work_priority/2 get_work_status/1 stop_work/1 To implement these, we'd go through the basic routine: use a loop function that receives messages, handle message sent from our exported functions, send replies to callers, etc. You'll see this in every Erlang textbook. But at that point, for the cost of a few extra lines of code, we're better off implementing a gen_server behavior. We can then use OTP supervisors to start and monitor the process. Even if we don't care about process restarts (e.g. temporary restart strategy), using OTP conventions will formalize the process life cycle. Garrett From watson.timothy@REDACTED Thu Jan 12 18:22:47 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 12 Jan 2012 17:22:47 +0000 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: On 12 January 2012 15:12, Zabrane Mickael wrote: > Thanks Tim. > > I'll give *"annotations"* a try. > > Cool. Any problems then submit an issue on github and I'll jump to it - I'm using this in a few places myself so very keen to make sure it's good quality. -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Thu Jan 12 18:31:00 2012 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 12 Jan 2012 17:31:00 -0000 (GMT) Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4EFD91E5.3010203@gmail.com> Message-ID: <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> I think that in many cases you DO want to know about the implementation as different algorithms have different properties and choosing the right one can have a significant effect on an application. This was the reason we have different versions with the same API, so you could test and choose between them and find the best one. Unfortunately it took a long time before there came a new one after the original two. I think it is good to have at least one tree based version as well. Though I would much prefer to have it in a separate module (gbdict?) instead of baking it into the dict version. I prefer to be explicit rather then "hiding" behind one module. In most case you do really want to know what is going on. I have two tree versions that I have long been meaning to include in the distribution, rbdict based on Red-Black trees and aadict based on the same algorithms as gb_trees but implemented in a different way. The more the merrier. But as I said I strongly feel it is much better to have separate modules. It also makes it easier to add versions, which as you can probably understand I think there should be. I have not yet looked through the suggestion for extending the API, but I will shortly. Robert ----- Original Message ----- > On 2011-12-30 01:25, Steve Davis wrote: > > On Dec 29, 11:35 am, Richard Carlsson > > wrote: > >> ...but you shouldn't have to know anything about the > >> implementation. > > > > Once, I would have strongly agreed with you. Now, I am not so sure > > that this tenet is true for many cases. Specifically what guides > > this > > change of heart for me is the painful progress in RPC/CORBA/JRMI > > abstractions over the years. I suspect that it also applies to > > data/ > > state sources. > > > > My 2c. > > /s > > And I basically agree, which is why I'm not aiming for an object > oriented approach. But I think that letting the dict module have an > ordered version, just like ets tables, is a good idea. You still get > to > choose between O(n) time for an unordered table and O(log n) time for > an > ordered table when you initialize the dict, and from a usability > perspective it means that for most cases where you want a functional > dictionary data type, the dict module is all you need to know. > > I couldn't get a good unified dict API until I decided to remove the > gb_trees module from the equation by making it accessible via dict > instead, because its current API is too different from the existing > dict/orddict API and the name clashes got too difficult to resolve. I > could of course also invent a new name for gb_trees, but that seems > unnecessary. > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From emeka_1978@REDACTED Thu Jan 12 19:34:29 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Thu, 12 Jan 2012 10:34:29 -0800 (PST) Subject: [erlang-questions] When to use gen_server? In-Reply-To: References: <5388a92f-10b6-42da-82fc-12aa60dcf803@n39g2000yqh.googlegroups.com> Message-ID: <246ecb31-5375-4241-976a-cbc94fab0c8d@f1g2000yqi.googlegroups.com> I understand that, from a design pattern standpoint, it is cleaner to use a gen_server to abstract away boilerplate and not write the same "receive"/"send" primitives everytime. But Garret said something that i was not aware of, even after reading all the erlang books out there: "serialization of data processing". Now i understand the definition of "gen_server" that is written in the documentation. nice. On Jan 12, 5:54?pm, Garrett Smith wrote: > On Thu, Jan 12, 2012 at 4:35 AM, eigenfunction wrote: > > >>?If you don't need to serialize your data > >> processing requests, don't bother with all that. > > > Could you pls elaborate more on that? I, Like the OP , sometimes > > have a hard time making a difference between a gen_server and a normal > > process, > > and i end up using normal processes and think that i am doing > > something wrong. > > Can anyone give an example of a case where a gen_server is more useful > > than a normal > > process? > > As Robert succinctly put, a gen_server wraps a process. Use gen_server > whenever you want to formalize your process behavior. > > Here's a simple low level use of an Erlang process: > > ? spawn(fun() -> do_work() end) > > We do some work in an Erlang process and when we're done the process > exits. Super simple. > > We can "formalize" the process by creating a module: > > ? -module(workers). > > ? start_work -> > ? ? ? spawn(fun() -> do_work() end). > > This hides the details of doing the work. You can document it, you can > include it in an OTP app that can be used in different system > configurations. Fantastic! > > Adding more features to our process-based work system is now a matter > of adding new functions: > > ? change_work_priority/2 > ? get_work_status/1 > ? stop_work/1 > > To implement these, we'd go through the basic routine: use a loop > function that receives messages, handle message sent from our exported > functions, send replies to callers, etc. You'll see this in every > Erlang textbook. > > But at that point, for the cost of a few extra lines of code, we're > better off implementing a gen_server behavior. We can then use OTP > supervisors to start and monitor the process. Even if we don't care > about process restarts (e.g. temporary restart strategy), using OTP > conventions will formalize the process life cycle. > > Garrett > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Thu Jan 12 21:05:51 2012 From: bob@REDACTED (Bob Cowdery) Date: Thu, 12 Jan 2012 20:05:51 +0000 Subject: [erlang-questions] Undefined references linking linked-in driver on Win64 Message-ID: <4F0F3D1F.2040401@bobcowdery.plus.com> Hi I've been compiling a linked-in driver on my Win32 (erl 5.8.2) system with no trouble. I've just put everything on my Win64 laptop using the 64 bit version of erl 5.9 and it can't resolve any of the references. /snip obj\Release\erl\dttsp_port.o:dttsp_port.c:(.text+0x56): undefined reference to `ei_x_free' obj\Release\erl\dttsp_port.o:dttsp_port.c:(.text+0x62): undefined reference to `ei_x_new_with_version' obj\Release\main\decoder.o:decoder.c:(.text+0x2f): undefined reference to `ei_decode_version' snip/ I've seen a few posts about similar things but no replies as far as I can tell. Did something change in 5.9 that means I need to link a different library rather than ei-md.lib? Thanks Bob From rexxe98@REDACTED Thu Jan 12 22:41:23 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Thu, 12 Jan 2012 13:41:23 -0800 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: <5C082A54-2BBF-4A66-BF9B-252D827FDD6F@gmail.com> Message-ID: Tim, I've been looking for something like your Annotations (I come from a Java background, so this is fantastic for me). Great stuff! Perfect for security checking! --Andrew On Thu, Jan 12, 2012 at 9:22 AM, Tim Watson wrote: > On 12 January 2012 15:12, Zabrane Mickael wrote: > >> Thanks Tim. >> >> I'll give *"annotations"* a try. >> >> > Cool. Any problems then submit an issue on github and I'll jump to it - > I'm using this in a few places myself so very keen to make sure it's good > quality. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shane.evans@REDACTED Fri Jan 13 00:28:02 2012 From: shane.evans@REDACTED (Shane Evans) Date: Thu, 12 Jan 2012 23:28:02 +0000 Subject: [erlang-questions] httpc streaming bodies of 404 responses Message-ID: <4F0F6C82.1030205@gmail.com> Hi, This has been raised before: http://erlang.org/pipermail/erlang-questions/2010-February/049267.html But I didn't see any replies. I am using the http options {sync, false} and {stream, self} with httpc:request/4. The documentation of stream says: > Streams the body of a 200 or 206 response to the calling process or to > a file. When streaming to the calling process using the option self > the following stream messages will be sent to that process: {http, > {RequestId, stream_start, Headers}, {http, {RequestId, stream, > BinBodyPart}, {http, {RequestId, stream_end, Headers}. However, when a server replies with a 404 status, I get a message of the form: {request_id() , {status_line(), headers(), Body}} as expected, but Body is empty (<<>>) and then the actual body of the response is sent as a stream message: {http, {request_id(), stream, Body}} note that there was no stream_start or stream_end messages. This seems like a bug to me... but if you look at http_handler:stream, there is clearly a function clause doing exactly this when status is 404. I guess my question is why? and would it be a good idea to either document this, or remove that function clause (in which case 404s would be handled as you'd expect)? Thanks, Shane From gleber.p@REDACTED Fri Jan 13 12:07:50 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 13 Jan 2012 12:07:50 +0100 Subject: [erlang-questions] [ANN] PROJ.4 bindings for Erlang Message-ID: Hello I would like to announce release of a basic PROJ.4 bindings for Erlang using NIFs. It's located here: https://github.com/greenelephantlabs/proj4erl It is a very basic binding, so feel free to improve. All pull requests are greatly welcomed :) This is a first release in a series of Erlang GIS libraries/servers releases. Best regards, Gleb Peregud Green Elephant Labs From jose.valim@REDACTED Fri Jan 13 12:44:15 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Fri, 13 Jan 2012 12:44:15 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> References: <4EFD91E5.3010203@gmail.com> <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> Message-ID: I agree with the general direction of creating another module called gen_dict that adds a level of indirection instead of changing dict implementation. So developers can choose between transparency (gen_dict) and performance (dict). But the truth is that Erlang lacks the proper abstractions to (elegantly) solve this problem. Even if we create a module that properly wraps gb_trees, orddict and dict, if the developer decides to create a new dictionary (for example, a red black tree based implementation) there is no way the developer will be able to hook his own dictionary into the gen_dict API. An abstraction like Clojure's protocols would be able to solve this more elegantly. Tuple modules could be a possible solution to this problem, so one would be able to call Dict:find(Key) and not worry about what a Dict really is, but they wouldn't work for orddicts or gbtrees unless they are rewritten to be in the tuple module format and I doubt this is a direction people would like OTP libraries to move towards to (I certainly don't). -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 13 14:20:47 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 13 Jan 2012 14:20:47 +0100 Subject: [erlang-questions] [ANN] PROJ.4 bindings for Erlang In-Reply-To: References: Message-ID: <4F886F08-7880-4B04-9C0E-8883C3FB1FEC@gmail.com> Wow. Congrats for the NIF. Regards, Zabrane On Jan 13, 2012, at 12:07 PM, Gleb Peregud wrote: > Hello > > I would like to announce release of a basic PROJ.4 bindings for Erlang > using NIFs. > > It's located here: > > https://github.com/greenelephantlabs/proj4erl > > It is a very basic binding, so feel free to improve. All pull requests > are greatly welcomed :) > > This is a first release in a series of Erlang GIS libraries/servers releases. > > Best regards, > Gleb Peregud > Green Elephant Labs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From carlsson.richard@REDACTED Fri Jan 13 14:57:08 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 13 Jan 2012 14:57:08 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: References: <4EFD91E5.3010203@gmail.com> <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> Message-ID: <4F103834.603@gmail.com> On 01/13/2012 12:44 PM, Jos? Valim wrote: > I agree with the general direction of creating another module called > gen_dict that adds a level of indirection instead of changing dict > implementation. So developers can choose between transparency (gen_dict) > and performance (dict). > > But the truth is that Erlang lacks the proper abstractions to > (elegantly) solve this problem. Even if we create a module that properly > wraps gb_trees, orddict and dict, if the developer decides to create a > new dictionary (for example, a red black tree based implementation) > there is no way the developer will be able to hook his own dictionary > into the gen_dict API. An abstraction like Clojure's protocols would be > able to solve this more elegantly. > > Tuple modules could be a possible solution to this problem, so one would > be able to call Dict:find(Key) and not worry about what a Dict really > is, but they wouldn't work for orddicts or gbtrees unless they are > rewritten to be in the tuple module format and I doubt this is a > direction people would like OTP libraries to move towards to (I > certainly don't). There seems to be a lot of confusion going on here between *interface* (API) and *dispatch* (redirecting the API calls to the actual implementation depending on the data structure). I have only suggested a unified API; not a generic dispatch mechanism. "Tuple modules" (please call them Parameterized modules or Abstract modules - the implementation-as-tuples is a temporary hack, and you should treat them as opaque objects just like funs) are not needed, because there is nothing here to parameterize. If all dict-like modules implement the same API, it's enough to use the module's name. For example: MyDict = orddict, ... D = MyDict:new(), ... What you *could* do is to parameterize the module that uses the dictionary: -module(my_module, [SomeDict]). ... foo() -> D = SomeDict:new(), ... and then you could easily change implementation as you like: M1 = my_module:new(orddict), M1:foo(), M2 = my_module:new(ets), M2:foo(), ... That said, I think Clojure's protocols (which are a way of dynamically getting the same effect that you get with Haskell's type classes) are a neat idea that would probably work well with Erlang. But that's a different story. /Richard From jose.valim@REDACTED Fri Jan 13 15:10:16 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Fri, 13 Jan 2012 15:10:16 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4F103834.603@gmail.com> References: <4EFD91E5.3010203@gmail.com> <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> <4F103834.603@gmail.com> Message-ID: > > There seems to be a lot of confusion going on here between *interface* > (API) and *dispatch* (redirecting the API calls to the actual > implementation depending on the data structure). I have only suggested a > unified API; not a generic dispatch mechanism. > If the main purpose is an unified API, agreed. Thanks for clearing it up. "Tuple modules" (please call them Parameterized modules or Abstract modules > - the implementation-as-tuples is a temporary hack, and you should treat > them as opaque objects just like funs). > I thought it was the opposite. Parameterized modules were the temporary hack and the implementation-as-tuples/"tuple modules" were here to stay. > That said, I think Clojure's protocols (which are a way of dynamically > getting the same effect that you get with Haskell's type classes) are a > neat idea that would probably work well with Erlang. But that's a different > story. Agreed as well. Regardless, protocols should be possible to implement in Erlang via parse transforms. I have implemented it for a language of top of the Erlang VM I am working on, but it is not officially released yet. Hoping to talk more about it on Erlang Factory Lite in Krak?w this march. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Fri Jan 13 15:21:15 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 13 Jan 2012 15:21:15 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> References: <26cbf451-7688-4d9b-912f-4353a5470afa@knuth> Message-ID: <4F103DDB.1010302@gmail.com> On 01/12/2012 06:31 PM, Robert Virding wrote: > I think that in many cases you DO want to know about the > implementation as different algorithms have different properties and > choosing the right one can have a significant effect on an > application. This was the reason we have different versions with the > same API, so you could test and choose between them and find the best > one. Unfortunately it took a long time before there came a new one > after the original two. > > I think it is good to have at least one tree based version as well. > Though I would much prefer to have it in a separate module (gbdict?) > instead of baking it into the dict version. I prefer to be explicit > rather then "hiding" behind one module. In most case you do really > want to know what is going on. I have two tree versions that I have > long been meaning to include in the distribution, rbdict based on > Red-Black trees and aadict based on the same algorithms as gb_trees > but implemented in a different way. The more the merrier. > > But as I said I strongly feel it is much better to have separate > modules. It also makes it easier to add versions, which as you can > probably understand I think there should be. It is of course possible to *also* give gb_trees a new interface (which requires a new module name) although I didn't want to do that as part of this exercise. Still, I think that it's a good thing to just make the dict module itself offer both a hashed form and an ordered (tree based) form, because it makes Erlang more approachable. These things are not mutually exclusive. The actual implementation used for the hash and tree forms could change between Erlang releases depending on what is deemed to be the most efficient; after all, the current hash table implementation is explicitly said to be opaque and might be replaced with some more efficient variant one day. But for the basic Erlang user, I think it ought to be enough to know that the dict module covers most of his needs, both for ordered and unordered dictionaries. If he later wants to optimize his code, he can then familiarize himself with the other N dict-like modules in the distribution and pick one that might be better for his use case. If they all speak the same API, swapping them should then be simple. /Richard From demeshchuk@REDACTED Fri Jan 13 16:26:27 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Fri, 13 Jan 2012 19:26:27 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Hi, Siri. I guess, we are moving away from the main conversation. Don't you think that it would be good to make reltool do the required job in a simpler way? The way we are discussing works in most cases, but it's quite unclear for the people who aren't very familiar with reltool. Using the existing functionalities to solve problems is often good, but if the solution becomes complicated, maybe a new functionality should be created instead. On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: > Ah... this is interesting... a missing test case maybe - but I'm not sure if > it is a bug. > > What happens is that the duplicated module erl_parse causes erlson to become > derived since a module with the same name is used by stdlib and several > other applications. If it was only stdlib, then I guess reltool could make > the assumption that the module to use is the one in the same application and > thus never make erlson derived (because to this module, that is). However, > since the module in this case is also used by other applications, this > assumption is not that obvious. > > The easiest way to get around this right now is to be more specific in the > config file to make sure that erlson (or only the erl_parse module) is > excluded... e.g. by adding > > {app, erlson, [{incl_cond,exclude}]} or > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} > > (The latter would allow erlson to be derived if any of it's other modules > were used by other applications) > > Regards > /siri > > 2012/1/12 Dmitry Demeshchuk >> >> Try running this gist: https://gist.github.com/1600020 >> >> reltool.config will reside in lib/gproc/rel/ >> >> Thank you. >> > -- Best regards, Dmitry Demeshchuk From erlangsiri@REDACTED Fri Jan 13 16:56:47 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Fri, 13 Jan 2012 16:56:47 +0100 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Yes, we are definitely drifting away from the original problem. But I found it quite interesting also... :) Anyway - I'm not against introducing new functionality if it is needed - but I do believe in doing a good investigation in order to ensure (or at least attempt) the best possible solution. The problem for me was that I did not really understand the problem. I'm not sure if I still do (sorry!) - but I'll try to explain what I think you mean. Please correct me if (when) I'm wrong... ;) I think that what you suggest is to be able to point out one specific application directory instead of specifying one or more lib dirs. And the reason for this is that you have several applications stored under the same lib dir, which are not necessarily at all related to each other. And typically - for each core application (which forms the main functionality of a release), you have it's dependency applications stored in the deps directory under the core application itself. Is this correct? How do you handle different version of the core app and of the dep apps? Could you give an example of this? e.g. lib/ coreapp-1.0/ src/ ebin/ include/ priv/ deps/ app1-1.0/ src ebin ... coreapp-2.0/ src/ ebin/ include/ priv/ deps/ app1-1.1/ src ebin ... And, when specifying the explicit app dir, would you expect reltool to automatically include the deps directory in the selected coreapp-Vsn as a lib dir?? Or should there be a way to specify that also? I hope I'm not totally on the wrong track here... /siri 2012/1/13 Dmitry Demeshchuk > Hi, Siri. > > I guess, we are moving away from the main conversation. > > Don't you think that it would be good to make reltool do the required > job in a simpler way? The way we are discussing works in most cases, > but it's quite unclear for the people who aren't very familiar with > reltool. > > Using the existing functionalities to solve problems is often good, > but if the solution becomes complicated, maybe a new functionality > should be created instead. > > On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: > > Ah... this is interesting... a missing test case maybe - but I'm not > sure if > > it is a bug. > > > > What happens is that the duplicated module erl_parse causes erlson to > become > > derived since a module with the same name is used by stdlib and several > > other applications. If it was only stdlib, then I guess reltool could > make > > the assumption that the module to use is the one in the same application > and > > thus never make erlson derived (because to this module, that is). > However, > > since the module in this case is also used by other applications, this > > assumption is not that obvious. > > > > The easiest way to get around this right now is to be more specific in > the > > config file to make sure that erlson (or only the erl_parse module) is > > excluded... e.g. by adding > > > > {app, erlson, [{incl_cond,exclude}]} or > > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} > > > > (The latter would allow erlson to be derived if any of it's other modules > > were used by other applications) > > > > Regards > > /siri > > > > 2012/1/12 Dmitry Demeshchuk > >> > >> Try running this gist: https://gist.github.com/1600020 > >> > >> reltool.config will reside in lib/gproc/rel/ > >> > >> Thank you. > >> > > > > > > -- > Best regards, > Dmitry Demeshchuk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From demeshchuk@REDACTED Fri Jan 13 17:18:18 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Fri, 13 Jan 2012 20:18:18 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Here's a more certain example. ========================================================================================= Say, I clone some repository from GitHub (say, gproc, like in my example gist). Now I add some stuff to it and want to build a release. Here's how it should look: some_dir/ gproc/ src/ include/ ebin/ priv/ deps/ rel/ reltool.config files/ (this contains starting bash scripts, default config file and so on) gproc/ (this directory will be actually generated by rebar when running "rebar generate"; in fact, most of its content is generated by reltool) erts-5.8.5/ lib/ priv/ releases/ So, my release will run from "rel/gproc". Now, if I generate a release upgrade to release 2.0, I make some changes, do "rebar generate-appups && rebar generate-upgrade" and a new release package is created: rel/gproc/releases/gproc-2.0.tar.gz Then I just remsh to my running node and install the new release using release_handler. ================================================================================ What I want here is to be independent from the top-level folder (some_dir). Maybe I have more Erlang projects there, maybe just some pictures, books and MongoDB logs, it can be anything. For now, the only thing I can do without doing anything with directory structure is adding to reltool.config this: {lib_dirs, ["../.."]}. or in an absolute way: {lib_dirs, ["/home/me/some/path/some_dir"]}. Does this make sense? On Fri, Jan 13, 2012 at 7:56 PM, Siri Hansen wrote: > Yes, we are definitely drifting away from the original problem. But I found > it quite interesting also... :) > > Anyway - I'm not against introducing new functionality if it is needed - but > I do believe in doing a good investigation in order to ensure (or at least > attempt) the best possible solution. The problem for me was that I did not > really understand the problem. I'm not sure if I still do (sorry!) - but > I'll try to explain what I think you mean. Please correct me if (when) I'm > wrong... ;) > > I think that what you suggest is to be able to point out one specific > application directory instead of specifying one or more lib dirs. And the > reason for this is that you have several applications stored under the same > lib dir, which are not necessarily at all related to each other. And > typically - for each core application (which forms the main functionality of > a release), you have it's dependency applications stored in the deps > directory under the core application itself.?Is this correct? > > How do you handle different version of the core app and of the dep apps? > Could you give an example of this? e.g. > > lib/ > ?? coreapp-1.0/ > ?? ? ?src/ > ?? ? ?ebin/ > ?? ? ?include/ > ?? ? ?priv/ > ?? ? ?deps/ > ?? ? ? ? app1-1.0/ > ?? ? ? ? ? ? src > ?? ? ? ? ? ? ebin > ?? ? ? ... > ?? coreapp-2.0/ > ?? ? ?src/ > ?? ? ?ebin/ > ?? ? ?include/ > ?? ? ?priv/ > ?? ? ?deps/ > ?? ? ? ? app1-1.1/ > ?? ? ? ? ? ? src > ?? ? ? ? ? ? ebin > ?? ? ?... > > And, when specifying the explicit app dir, would you expect reltool to > automatically include the deps directory in the selected coreapp-Vsn as a > lib dir?? Or should there be a way to specify that also? > > I hope I'm not totally on the wrong track here... > > /siri > > > 2012/1/13 Dmitry Demeshchuk >> >> Hi, Siri. >> >> I guess, we are moving away from the main conversation. >> >> Don't you think that it would be good to make reltool do the required >> job in a simpler way? The way we are discussing works in most cases, >> but it's quite unclear for the people who aren't very familiar with >> reltool. >> >> Using the existing functionalities to solve problems is often good, >> but if the solution becomes complicated, maybe a new functionality >> should be created instead. >> >> On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: >> > Ah... this is interesting... a missing test case maybe - but I'm not >> > sure if >> > it is a bug. >> > >> > What happens is that the duplicated module erl_parse causes erlson to >> > become >> > derived since a module with the same name is used by stdlib and several >> > other applications. If it was only stdlib, then I guess reltool could >> > make >> > the assumption that the module to use is the one in the same application >> > and >> > thus never make erlson derived (because to this module, that is). >> > However, >> > since the module in this case is also used by other applications, this >> > assumption is not that obvious. >> > >> > The easiest way to get around this right now is to be more specific in >> > the >> > config file to make sure that erlson (or only the erl_parse module) is >> > excluded... e.g. by adding >> > >> > {app, erlson, [{incl_cond,exclude}]} or >> > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} >> > >> > (The latter would allow erlson to be derived if any of it's other >> > modules >> > were used by other applications) >> > >> > Regards >> > /siri >> > >> > 2012/1/12 Dmitry Demeshchuk >> >> >> >> Try running this gist: https://gist.github.com/1600020 >> >> >> >> reltool.config will reside in lib/gproc/rel/ >> >> >> >> Thank you. >> >> >> > >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk > > -- Best regards, Dmitry Demeshchuk From demeshchuk@REDACTED Fri Jan 13 17:20:58 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Fri, 13 Jan 2012 20:20:58 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Also, answering your last question: no, I'm not expecting reltool to automatically include deps (but this is a thing to consider, maybe it's not bad). I expect to be able to add a certain app dir, so reltool.config from my previous example will be something like this: {lib_dirs, ["../deps"]}. {explicit_lib_dirs, [".."]}. Thank you. On Fri, Jan 13, 2012 at 8:18 PM, Dmitry Demeshchuk wrote: > Here's a more certain example. > > ========================================================================================= > > Say, I clone some repository from GitHub (say, gproc, like in my > example gist). Now I add some stuff to it and want to build a release. > Here's how it should look: > > some_dir/ > ? ?gproc/ > ? ? ? ?src/ > ? ? ? ?include/ > ? ? ? ?ebin/ > ? ? ? ?priv/ > ? ? ? ?deps/ > ? ? ? ?rel/ > ? ? ? ? ? reltool.config > ? ? ? ? ? files/ ? ? ?(this contains starting bash scripts, default > config file and so on) > ? ? ? ? ? gproc/ ? ? (this directory will be actually generated by > rebar when running "rebar generate"; in fact, most of its content is > generated by reltool) > ? ? ? ? ? ? ? ?erts-5.8.5/ > ? ? ? ? ? ? ? ?lib/ > ? ? ? ? ? ? ? ?priv/ > ? ? ? ? ? ? ? ?releases/ > > > So, my release will run from "rel/gproc". > > Now, if I generate a release upgrade to release 2.0, I make some > changes, do "rebar generate-appups && rebar generate-upgrade" and a > new release package is created: > > rel/gproc/releases/gproc-2.0.tar.gz > > Then I just remsh to my running node and install the new release using > release_handler. > > ================================================================================ > > What I want here is to be independent from the top-level folder > (some_dir). Maybe I have more Erlang projects there, maybe just some > pictures, books and MongoDB logs, it can be anything. > > For now, the only thing I can do without doing anything with directory > structure is adding to reltool.config this: > > {lib_dirs, ["../.."]}. > > or in an absolute way: > > {lib_dirs, ["/home/me/some/path/some_dir"]}. > > > Does this make sense? > > On Fri, Jan 13, 2012 at 7:56 PM, Siri Hansen wrote: >> Yes, we are definitely drifting away from the original problem. But I found >> it quite interesting also... :) >> >> Anyway - I'm not against introducing new functionality if it is needed - but >> I do believe in doing a good investigation in order to ensure (or at least >> attempt) the best possible solution. The problem for me was that I did not >> really understand the problem. I'm not sure if I still do (sorry!) - but >> I'll try to explain what I think you mean. Please correct me if (when) I'm >> wrong... ;) >> >> I think that what you suggest is to be able to point out one specific >> application directory instead of specifying one or more lib dirs. And the >> reason for this is that you have several applications stored under the same >> lib dir, which are not necessarily at all related to each other. And >> typically - for each core application (which forms the main functionality of >> a release), you have it's dependency applications stored in the deps >> directory under the core application itself.?Is this correct? >> >> How do you handle different version of the core app and of the dep apps? >> Could you give an example of this? e.g. >> >> lib/ >> ?? coreapp-1.0/ >> ?? ? ?src/ >> ?? ? ?ebin/ >> ?? ? ?include/ >> ?? ? ?priv/ >> ?? ? ?deps/ >> ?? ? ? ? app1-1.0/ >> ?? ? ? ? ? ? src >> ?? ? ? ? ? ? ebin >> ?? ? ? ... >> ?? coreapp-2.0/ >> ?? ? ?src/ >> ?? ? ?ebin/ >> ?? ? ?include/ >> ?? ? ?priv/ >> ?? ? ?deps/ >> ?? ? ? ? app1-1.1/ >> ?? ? ? ? ? ? src >> ?? ? ? ? ? ? ebin >> ?? ? ?... >> >> And, when specifying the explicit app dir, would you expect reltool to >> automatically include the deps directory in the selected coreapp-Vsn as a >> lib dir?? Or should there be a way to specify that also? >> >> I hope I'm not totally on the wrong track here... >> >> /siri >> >> >> 2012/1/13 Dmitry Demeshchuk >>> >>> Hi, Siri. >>> >>> I guess, we are moving away from the main conversation. >>> >>> Don't you think that it would be good to make reltool do the required >>> job in a simpler way? The way we are discussing works in most cases, >>> but it's quite unclear for the people who aren't very familiar with >>> reltool. >>> >>> Using the existing functionalities to solve problems is often good, >>> but if the solution becomes complicated, maybe a new functionality >>> should be created instead. >>> >>> On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: >>> > Ah... this is interesting... a missing test case maybe - but I'm not >>> > sure if >>> > it is a bug. >>> > >>> > What happens is that the duplicated module erl_parse causes erlson to >>> > become >>> > derived since a module with the same name is used by stdlib and several >>> > other applications. If it was only stdlib, then I guess reltool could >>> > make >>> > the assumption that the module to use is the one in the same application >>> > and >>> > thus never make erlson derived (because to this module, that is). >>> > However, >>> > since the module in this case is also used by other applications, this >>> > assumption is not that obvious. >>> > >>> > The easiest way to get around this right now is to be more specific in >>> > the >>> > config file to make sure that erlson (or only the erl_parse module) is >>> > excluded... e.g. by adding >>> > >>> > {app, erlson, [{incl_cond,exclude}]} or >>> > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} >>> > >>> > (The latter would allow erlson to be derived if any of it's other >>> > modules >>> > were used by other applications) >>> > >>> > Regards >>> > /siri >>> > >>> > 2012/1/12 Dmitry Demeshchuk >>> >> >>> >> Try running this gist: https://gist.github.com/1600020 >>> >> >>> >> reltool.config will reside in lib/gproc/rel/ >>> >> >>> >> Thank you. >>> >> >>> > >>> >>> >>> >>> -- >>> Best regards, >>> Dmitry Demeshchuk >> >> > > > > -- > Best regards, > Dmitry Demeshchuk -- Best regards, Dmitry Demeshchuk From vladimir.kirichenko@REDACTED Fri Jan 13 18:33:02 2012 From: vladimir.kirichenko@REDACTED (Volodymyr Kyrychenko) Date: Fri, 13 Jan 2012 19:33:02 +0200 Subject: [erlang-questions] gen_server state is not released for gc Message-ID: Hi. Here is simple gen_server that holds binary in its state and never releases it. http://ideone.com/U4f9X 1> X = myserver:start_link("/tmp/1.cache"). {ok,<0.33.0>} 2> myserver:info(). {binary,[{140408119021616,401681797,2}]} 3> myserver:release(). ok 4> myserver:info(). {binary,[{140408119021616,401681797,2}]} 7> memory(binary). 402043632 How come there are 2 references on it and what to do to free this binary? -- Best Regards, Volodymyr Kyrychenko From egil@REDACTED Fri Jan 13 18:50:00 2012 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 13 Jan 2012 18:50:00 +0100 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: Message-ID: <4F106EC8.5060500@erlang.org> On 2012-01-13 18:33, Volodymyr Kyrychenko wrote: > Hi. Here is simple gen_server that holds binary in its state and never > releases it. > > http://ideone.com/U4f9X > > 1> X = myserver:start_link("/tmp/1.cache"). > {ok,<0.33.0>} > 2> myserver:info(). > {binary,[{140408119021616,401681797,2}]} > 3> myserver:release(). > ok > 4> myserver:info(). > {binary,[{140408119021616,401681797,2}]} > 7> memory(binary). > 402043632 > > How come there are 2 references on it and what to do to free this binary? it is not gc:ed yet. Try erlang:garbage_collect/0 info: handle_call(info, _From, State) -> erlang:garbage_collect(), {reply, process_info(self(), binary), State}; // Bj?rn-Egil From max.lapshin@REDACTED Fri Jan 13 18:51:52 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 13 Jan 2012 20:51:52 +0300 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: Message-ID: Try to return hibernate flag after your release call and check what will happen On Friday, January 13, 2012, Volodymyr Kyrychenko < vladimir.kirichenko@REDACTED> wrote: > Hi. Here is simple gen_server that holds binary in its state and never > releases it. > > http://ideone.com/U4f9X > > 1> X = myserver:start_link("/tmp/1.cache"). > {ok,<0.33.0>} > 2> myserver:info(). > {binary,[{140408119021616,401681797,2}]} > 3> myserver:release(). > ok > 4> myserver:info(). > {binary,[{140408119021616,401681797,2}]} > 7> memory(binary). > 402043632 > > How come there are 2 references on it and what to do to free this binary? > > -- > Best Regards, > Volodymyr Kyrychenko > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From egil@REDACTED Fri Jan 13 19:00:20 2012 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 13 Jan 2012 19:00:20 +0100 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: <4F106EC8.5060500@erlang.org> References: <4F106EC8.5060500@erlang.org> Message-ID: <4F107134.1080404@erlang.org> On 2012-01-13 18:50, Bj?rn-Egil Dahlberg wrote: > On 2012-01-13 18:33, Volodymyr Kyrychenko wrote: >> Hi. Here is simple gen_server that holds binary in its state and never >> releases it. >> >> http://ideone.com/U4f9X >> >> 1> X = myserver:start_link("/tmp/1.cache"). >> {ok,<0.33.0>} >> 2> myserver:info(). >> {binary,[{140408119021616,401681797,2}]} >> 3> myserver:release(). >> ok >> 4> myserver:info(). >> {binary,[{140408119021616,401681797,2}]} >> 7> memory(binary). >> 402043632 >> >> How come there are 2 references on it and what to do to free this >> binary? > it is not gc:ed yet. To be a little more specific. The references (Procbins) to your offheap binary are still on the process heap even though nothing in the rootset is referencing the procbins. A gc will be triggered when the current heap is full, binary vheap is "full" or an explicit garbage_collect is called for, which ever comes first. At that moment the procbins will be removed and the offheap binary will be deallocated (if nothing else is referencing it). // Bj?rn-Egil > Try erlang:garbage_collect/0 info: > > handle_call(info, _From, State) -> > > erlang:garbage_collect(), > > {reply, process_info(self(), binary), State}; > > > // Bj?rn-Egil > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From zabrane3@REDACTED Fri Jan 13 19:34:28 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 13 Jan 2012 19:34:28 +0100 Subject: [erlang-questions] Erlang API for GoogleMap? Message-ID: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> Hi guys, Any Erlang API to access GoogleMap? Regards, Zabrane From gleber.p@REDACTED Fri Jan 13 19:44:03 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 13 Jan 2012 19:44:03 +0100 Subject: [erlang-questions] Erlang API for GoogleMap? In-Reply-To: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> References: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> Message-ID: Google Maps is more of an UI thing. Which particular map-related Google service are you interested in? On Jan 13, 2012 7:39 PM, "Zabrane Mickael" wrote: > Hi guys, > > Any Erlang API to access GoogleMap? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 13 19:51:39 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 13 Jan 2012 19:51:39 +0100 Subject: [erlang-questions] Erlang API for GoogleMap? In-Reply-To: References: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> Message-ID: <295FF3B5-8B85-42F4-8014-D624535D9370@gmail.com> Let's suppose I've a complete address and want to map it on GoogleMap? Example: Apple Inc. Headquarters, Cupertino, CA, United States http://maps.google.com/maps/place?q=Apple+Inc.+Headquarters,+Cupertino,+CA,+United+States&hl=en&cid=9787757543467320456 Of course, the result should any valid HTML snippet that I'll embed in a Web page. Regards, Zabrane On Jan 13, 2012, at 7:44 PM, Gleb Peregud wrote: > Google Maps is more of an UI thing. Which particular map-related Google service are you interested in? > > On Jan 13, 2012 7:39 PM, "Zabrane Mickael" wrote: > Hi guys, > > Any Erlang API to access GoogleMap? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Fri Jan 13 20:37:58 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 13 Jan 2012 20:37:58 +0100 Subject: [erlang-questions] [ANN] PROJ.4 bindings for Erlang In-Reply-To: <4F886F08-7880-4B04-9C0E-8883C3FB1FEC@gmail.com> References: <4F886F08-7880-4B04-9C0E-8883C3FB1FEC@gmail.com> Message-ID: On Fri, Jan 13, 2012 at 14:20, Zabrane Mickael wrote: > Wow. Congrats for the NIF. Not sure what you mean, but little credit should go to me. It is ripped^Wheavily inspired by: https://github.com/iamaleksey/iconverl/blob/master/c_src/iconverl.c for general structure. And by crypto NIF code like this one: https://github.com/erlang/otp/blob/master/lib/crypto/c_src/crypto.c#L903 So the credit for nice code should go to authors of those libraries :) From gleber.p@REDACTED Fri Jan 13 20:43:21 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 13 Jan 2012 20:43:21 +0100 Subject: [erlang-questions] Erlang API for GoogleMap? In-Reply-To: <295FF3B5-8B85-42F4-8014-D624535D9370@gmail.com> References: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> <295FF3B5-8B85-42F4-8014-D624535D9370@gmail.com> Message-ID: Google provides geocoding REST API: http://code.google.com/intl/pl/apis/maps/documentation/geocoding/ which can be used ONLY for doing geocoding of data which will be shown on public web sites, which are using Google Maps Javascript API for visualizing results of geocoding. Hence you can't use it for geocoding something for internal use. It has to be related to public web site with Google maps displayed on them. Requests are pretty simple: http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false and returns simple JSON Best, Gleb Peregud Green Elephant Labs P.S. We are close to finishing a geocoding server which is capable of handling very flexible unstructured queries at the moment. It may be open-sourced in future :) On Fri, Jan 13, 2012 at 19:51, Zabrane Mickael wrote: > Let's suppose I've a complete address and want to map it on GoogleMap? > > Example: > Apple Inc. Headquarters, Cupertino, CA, United States > http://maps.google.com/maps/place?q=Apple+Inc.+Headquarters,+Cupertino,+CA,+United+States&hl=en&cid=9787757543467320456 > > Of course, the result should any valid HTML snippet ?that I'll embed in a > Web page. > > Regards, > Zabrane > > On Jan 13, 2012, at 7:44 PM, Gleb Peregud wrote: > > Google Maps is more of an UI thing. Which particular map-related Google > service are you interested in? > > On Jan 13, 2012 7:39 PM, "Zabrane Mickael" wrote: >> >> Hi guys, >> >> Any Erlang API to access GoogleMap? >> >> Regards, >> Zabrane >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > From leonard.boyce@REDACTED Fri Jan 13 20:52:06 2012 From: leonard.boyce@REDACTED (Leonard Boyce) Date: Fri, 13 Jan 2012 14:52:06 -0500 Subject: [erlang-questions] rabbit, epmd and bonded interfaces woes Message-ID: <4161289.ErBAafFudA@captmarvel.usethesource.net> Hopefully someone has hit this issue and can shed some light. Network interfaces are configured bonded in pairs Rabbit crashes/dumps when trying to start with error; "Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch, {error,epmd_close}}.... In my research to date the only similar issue I've been able to find is a reference to running ejabberd in FreeBSD jails and the solution was to patch epmd to allow all callers (not limit to 127.x.x.x), which is not really safe. We've tried running epmd -d -d -d, calling from another term unsing "erl - sname somestrangename" ading using tcpdump to inspect the connection and tcp dump shows that "erl -sname somestrangename" seems to be calling from the public interface I have a sneaking suspicion that this has something to do with incorrect handling of bonded interfaces as another server with exactly the same OS/hardware and software versions (minus bonded interfaces) works perfectly. We've tried R15B and results are exactly the same. Any advice/help would be appreciated. Thanks, Leonard --- Environment; ############################################# Ubuntu 10.04 LTS Linux web1 2.6.32-37-server #81-Ubuntu SMP Fri Dec 2 20:49:12 UTC 2011 x86_64 GNU/Linux Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async- threads:0] [kernel-poll:false] File: /etc/hostname ############################################# web1 File: /etc/hosts ############################################# 127.0.0.1 web1 localhost 192.168.100.1 web1 web1.XXXXXX.XXX 192.168.100.83 web2 web2.XXXXXX.XXX # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters File: /etc/network/interfaces ############################################# # The loopback network interface auto lo iface lo inet loopback auto bond0 iface bond0 inet static address XX.XX.XX.XX netmask 255.255.255.240 gateway xx.xx.xx.xx bond-slaves eth0 eth1 bond_mode 802.3ad bond_miimon 100 bond_lacp_rate 1 auto bond1 iface bond1 inet static address 192.168.100.1 netmask 255.255.255.0 bond-slaves eth2 eth3 bond_mode 802.3ad bond_miimon 100 bond_lacp_rate 1 auto bond1:0 iface bond1:0 inet static address 192.168.100.2 netmask 255.255.255.0 auto bond1:1 iface bond1:1 inet static address 192.168.100.3 netmask 255.255.255.0 TCP Dump (sanitized XX.XX.XX.XX for public IP); ############################################# leonard@REDACTED:~$ sudo tcpdump -i lo -vv port 4369 tcpdump: listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes 14:41:27.873868 IP (tos 0x0, ttl 64, id 61955, offset 0, flags [DF], proto TCP (6), length 60) XX.XX.XX.XX.42982 > web1.4369: Flags [S], cksum 0xba6b (correct), seq 2754024620, win 32792, options [mss 16396,sackOK,TS val 24962735 ecr 0,nop,wscale 7], length 0 14:41:27.873884 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60) web1.4369 > web1.42982: Flags [S.], cksum 0xeb9d (correct), seq 4276970213, ack 2754024621, win 32768, options [mss 16396,sackOK,TS val 24962735 ecr 24962735,nop,wscale 7], length 0 14:41:27.873895 IP (tos 0x0, ttl 64, id 61956, offset 0, flags [DF], proto TCP (6), length 52) XX.XX.XX.XX.42982 > web1.4369: Flags [.], cksum 0x5897 (correct), seq 2754024621, ack 4276970214, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 0 14:41:27.873938 IP (tos 0x0, ttl 64, id 61957, offset 0, flags [DF], proto TCP (6), length 82) XX.XX.XX.XX.42982 > web1.4369: Flags [P.], seq 0:30, ack 1, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 30 14:41:27.873945 IP (tos 0x0, ttl 64, id 33865, offset 0, flags [DF], proto TCP (6), length 52) web1.4369 > web1.42982: Flags [.], cksum 0xd3a4 (correct), seq 1, ack 31, win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 14:41:27.874143 IP (tos 0x0, ttl 64, id 33866, offset 0, flags [DF], proto TCP (6), length 52) web1.4369 > web1.42982: Flags [F.], cksum 0xd3a3 (correct), seq 1, ack 31, win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 14:41:27.874188 IP (tos 0x0, ttl 64, id 61958, offset 0, flags [DF], proto TCP (6), length 52) XX.XX.XX.XX.42982 > web1.4369: Flags [F.], cksum 0x5877 (correct), seq 30, ack 2, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 0 14:41:27.874202 IP (tos 0x0, ttl 64, id 33867, offset 0, flags [DF], proto TCP (6), length 52) web1.4369 > web1.42982: Flags [.], cksum 0xd3a2 (correct), seq 2, ack 32, win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 epmd output; ############################################# root@REDACTED:/usr/local/src# epmd -d -d -d epmd: Fri Jan 13 14:41:25 2012: epmd running - daemon = 0 epmd: Fri Jan 13 14:41:25 2012: try to initiate listening port 4369 epmd: Fri Jan 13 14:41:25 2012: entering the main select() loop epmd: Fri Jan 13 14:41:27 2012: Non-local peer connected epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 epmd: Fri Jan 13 14:41:27 2012: opening connection on file descriptor 4 epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 epmd: Fri Jan 13 14:41:27 2012: got 30 bytes ***** 00000000 00 1c 78 b8 4a 4d 00 00 05 00 05 00 0f 73 6f 6d |..x.JM.......som| ***** 00000010 65 73 74 72 61 6e 67 65 6e 61 6d 65 00 00 | estrangename..| epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 epmd: Fri Jan 13 14:41:27 2012: ** got ALIVE2_REQ epmd: Fri Jan 13 14:41:27 2012: ALIVE2_REQ from non local address epmd: Fri Jan 13 14:41:27 2012: closing connection on file descriptor 4 From michael.santos@REDACTED Fri Jan 13 21:15:16 2012 From: michael.santos@REDACTED (Michael Santos) Date: Fri, 13 Jan 2012 15:15:16 -0500 Subject: [erlang-questions] rabbit, epmd and bonded interfaces woes In-Reply-To: <4161289.ErBAafFudA@captmarvel.usethesource.net> References: <4161289.ErBAafFudA@captmarvel.usethesource.net> Message-ID: <20120113201516.GA32117@ecn.lan> On Fri, Jan 13, 2012 at 02:52:06PM -0500, Leonard Boyce wrote: > Hopefully someone has hit this issue and can shed some light. > > Network interfaces are configured bonded in pairs > > Rabbit crashes/dumps when trying to start with error; > "Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch, > {error,epmd_close}}.... > > In my research to date the only similar issue I've been able to find is a > reference to running ejabberd in FreeBSD jails and the solution was to patch > epmd to allow all callers (not limit to 127.x.x.x), which is not really safe. That patch reverts to the old behaviour of epmd (allow all query types from remote clients). > We've tried running epmd -d -d -d, calling from another term unsing "erl - > sname somestrangename" ading using tcpdump to inspect the connection and tcp > dump shows that "erl -sname somestrangename" seems to be calling from the > public interface > > I have a sneaking suspicion that this has something to do with incorrect > handling of bonded interfaces as another server with exactly the same > OS/hardware and software versions (minus bonded interfaces) works perfectly. > > We've tried R15B and results are exactly the same. Newer versions of epmd consider connections with the same source and destination address as local. What are the source and destination addresses for the TCP connection to epmd? > Any advice/help would be appreciated. > > Thanks, > Leonard > --- > > > Environment; > ############################################# > Ubuntu 10.04 LTS > Linux web1 2.6.32-37-server #81-Ubuntu SMP Fri Dec 2 20:49:12 UTC 2011 x86_64 > GNU/Linux > Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:16:16] [rq:16] [async- > threads:0] [kernel-poll:false] > > > File: /etc/hostname > ############################################# > web1 > > File: /etc/hosts > ############################################# > 127.0.0.1 web1 localhost > > 192.168.100.1 web1 web1.XXXXXX.XXX > 192.168.100.83 web2 web2.XXXXXX.XXX > > # The following lines are desirable for IPv6 capable hosts > ::1 localhost ip6-localhost ip6-loopback > fe00::0 ip6-localnet > ff00::0 ip6-mcastprefix > ff02::1 ip6-allnodes > ff02::2 ip6-allrouters > > > File: /etc/network/interfaces > ############################################# > # The loopback network interface > auto lo > iface lo inet loopback > > auto bond0 > iface bond0 inet static > address XX.XX.XX.XX > netmask 255.255.255.240 > gateway xx.xx.xx.xx > bond-slaves eth0 eth1 > bond_mode 802.3ad > bond_miimon 100 > bond_lacp_rate 1 > auto bond1 > iface bond1 inet static > address 192.168.100.1 > netmask 255.255.255.0 > bond-slaves eth2 eth3 > bond_mode 802.3ad > bond_miimon 100 > bond_lacp_rate 1 > auto bond1:0 > iface bond1:0 inet static > address 192.168.100.2 > netmask 255.255.255.0 > > auto bond1:1 > iface bond1:1 inet static > address 192.168.100.3 > netmask 255.255.255.0 > > TCP Dump (sanitized XX.XX.XX.XX for public IP); > ############################################# > leonard@REDACTED:~$ sudo tcpdump -i lo -vv port 4369 > tcpdump: listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes > 14:41:27.873868 IP (tos 0x0, ttl 64, id 61955, offset 0, flags [DF], proto TCP > (6), length 60) > XX.XX.XX.XX.42982 > web1.4369: Flags [S], cksum 0xba6b (correct), seq > 2754024620, win 32792, options [mss 16396,sackOK,TS val 24962735 ecr > 0,nop,wscale 7], length 0 > 14:41:27.873884 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), > length 60) > web1.4369 > web1.42982: Flags [S.], cksum 0xeb9d (correct), seq > 4276970213, ack 2754024621, win 32768, options [mss 16396,sackOK,TS val > 24962735 ecr 24962735,nop,wscale 7], length 0 > 14:41:27.873895 IP (tos 0x0, ttl 64, id 61956, offset 0, flags [DF], proto TCP > (6), length 52) > XX.XX.XX.XX.42982 > web1.4369: Flags [.], cksum 0x5897 (correct), seq > 2754024621, ack 4276970214, win 257, options [nop,nop,TS val 24962735 ecr > 24962735], length 0 > 14:41:27.873938 IP (tos 0x0, ttl 64, id 61957, offset 0, flags [DF], proto TCP > (6), length 82) > XX.XX.XX.XX.42982 > web1.4369: Flags [P.], seq 0:30, ack 1, win 257, > options [nop,nop,TS val 24962735 ecr 24962735], length 30 > 14:41:27.873945 IP (tos 0x0, ttl 64, id 33865, offset 0, flags [DF], proto TCP > (6), length 52) > web1.4369 > web1.42982: Flags [.], cksum 0xd3a4 (correct), seq 1, ack 31, > win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 > 14:41:27.874143 IP (tos 0x0, ttl 64, id 33866, offset 0, flags [DF], proto TCP > (6), length 52) > web1.4369 > web1.42982: Flags [F.], cksum 0xd3a3 (correct), seq 1, ack 31, > win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 > 14:41:27.874188 IP (tos 0x0, ttl 64, id 61958, offset 0, flags [DF], proto TCP > (6), length 52) > XX.XX.XX.XX.42982 > web1.4369: Flags [F.], cksum 0x5877 (correct), seq 30, > ack 2, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 0 > 14:41:27.874202 IP (tos 0x0, ttl 64, id 33867, offset 0, flags [DF], proto TCP > (6), length 52) > web1.4369 > web1.42982: Flags [.], cksum 0xd3a2 (correct), seq 2, ack 32, > win 256, options [nop,nop,TS val 24962735 ecr 24962735], length 0 > > > > epmd output; > ############################################# > root@REDACTED:/usr/local/src# epmd -d -d -d > epmd: Fri Jan 13 14:41:25 2012: epmd running - daemon = 0 > epmd: Fri Jan 13 14:41:25 2012: try to initiate listening port 4369 > epmd: Fri Jan 13 14:41:25 2012: entering the main select() loop > epmd: Fri Jan 13 14:41:27 2012: Non-local peer connected > epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 > epmd: Fri Jan 13 14:41:27 2012: opening connection on file descriptor 4 > epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 > epmd: Fri Jan 13 14:41:27 2012: got 30 bytes > ***** 00000000 00 1c 78 b8 4a 4d 00 00 05 00 05 00 0f 73 6f 6d > |..x.JM.......som| > ***** 00000010 65 73 74 72 61 6e 67 65 6e 61 6d 65 00 00 | > estrangename..| > epmd: Fri Jan 13 14:41:27 2012: time in seconds: 1326483687 > epmd: Fri Jan 13 14:41:27 2012: ** got ALIVE2_REQ > epmd: Fri Jan 13 14:41:27 2012: ALIVE2_REQ from non local address > epmd: Fri Jan 13 14:41:27 2012: closing connection on file descriptor 4 > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From leonard.boyce@REDACTED Fri Jan 13 21:25:21 2012 From: leonard.boyce@REDACTED (Leonard Boyce) Date: Fri, 13 Jan 2012 15:25:21 -0500 Subject: [erlang-questions] rabbit, epmd and bonded interfaces woes In-Reply-To: <20120113201516.GA32117@ecn.lan> References: <4161289.ErBAafFudA@captmarvel.usethesource.net> <20120113201516.GA32117@ecn.lan> Message-ID: <4072007.ipCyBbqyXL@captmarvel.usethesource.net> On Friday, January 13, 2012 03:15:16 PM Michael Santos wrote: > On Fri, Jan 13, 2012 at 02:52:06PM -0500, Leonard Boyce wrote: > > > That patch reverts to the old behaviour of epmd (allow all query types > from remote clients). > > > Newer versions of epmd consider connections with the same source and > destination address as local. What are the source and destination > addresses for the TCP connection to epmd? looking at tcpdump the command "erl -sname somestrangename" calls epmd from the public IP of the machine. "web1" is the aliased to 127.0.0.1 in /etc/hosts. With the alias removed the tcpdump shows 'localhost' in place of 'web1'. 14:41:27.874188 IP (tos 0x0, ttl 64, id 61958, offset 0, flags [DF], proto TCP (6), length 52) XX.XX.XX.XX.42982 > web1.4369: Flags [F.], cksum 0x5877 (correct), seq 30, ack 2, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 0 As far as I understand the above command 'should' be binding and calling epmd from 'localhost', not an arbitrary mounted IP. Leonard -- > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions From ingo.jaeckel@REDACTED Fri Jan 13 21:44:09 2012 From: ingo.jaeckel@REDACTED (Ingo Jaeckel) Date: Fri, 13 Jan 2012 15:44:09 -0500 Subject: [erlang-questions] Exchanging messages during functions called by Erlang Server Interface mod_esi? In-Reply-To: References: Message-ID: Hello, the problem was not related to the Erlang Service Interface. The working version of the module is listed below. Regards, Ingo -module(main). -include_lib("eunit/include/eunit.hrl"). -export([start/0, create/3, read/3, loop/0]). %% API Functions start() -> register(storage, spawn(?MODULE, loop, [])), inets:start(), inets:start(httpd, [ {port, 8080}, {server_name, "wuza"}, {server_root, "log"}, {document_root, "www"}, {modules,[mod_esi,mod_get]}, {erl_script_alias, {"/erl", [main]}} ]). create(SessionID, _Env, _Input) -> {Key, Value} = lists:last(_Env), case Key of query_string -> reply(SessionID, "{created: true}"), storage ! {create, string_to_tuple(Value)}; _ -> reply(SessionID, "{error: \"Missing query string.\"}") end. read(SessionID, _Env, _Input) -> storage ! {read, self()}, receive [] -> reply(SessionID, lists:concat(["{\"count\": 0, \"results\": []}"])); Data -> reply(SessionID, lists:concat(["{\"count\": ", length(Data), ", \"results\": ", json:encode(Data), "}"])) end. loop() -> loop([]). loop(Data) -> receive {create, What} -> loop(Data ++ [What]); {read, ClientPid} -> ClientPid ! Data end, loop(Data). %% Local Functions reply(SessionID, Reply) -> mod_esi:deliver(SessionID, [ "Content-Type: application/json\r\n\r\n", Reply ]). string_to_tuple(String) -> lists:map(fun(Pair) -> [Key, Value|_] = string:tokens(Pair, "="), {Key, Value} end, string:tokens(String, "&")). On Thu, Jan 12, 2012 at 11:08 AM, Ingo Jaeckel wrote: > Hello, > > I am currently developing a module that creates an instance of inets > http server. After starting the server, I call two different messages > of my module (create/3, read/3) from a browser. Both methods are shown > below: > > create(SessionID, Env, _Input) -> > ? ? ? ?{Key, Value} = lists:last(Env), > > ? ? ? ?case Key of > ? ? ? ? ? ? ? ?query_string -> > ? ? ? ? ? ? ? ? ? ? ? ?reply(SessionID, "{created: true}"), > ? ? ? ? ? ? ? ? ? ? ? ?storage ! {create, string_to_tuple(Value)}; > ? ? ? ? ? ? ? ?_ -> > ? ? ? ? ? ? ? ? ? ? ? ?reply(SessionID, "{error: \"Missing query string.\"}") > ? ? ? ?end. > > read(SessionID, _Env, _Input) -> > ? ? ? ?storage ! {read, self()}, > ? ? ? ?receive > ? ? ? ? ? ? ? [] -> ? reply(SessionID, lists:concat(["{\"results\": []}"])); > ? ? ? ? ? ? ? Data -> > ? ? ? ? ? ? ? ? ? ? ? reply(SessionID, lists:concat(["{\"count\": ", > length(Data), ", \"results\": ", json:encode(Data), "}"])) > ? ? ? end. > > reply(SessionID, Reply) -> > ? ? ? ?mod_esi:deliver(SessionID, [ > ? ? ? ? ? ? ? ?"Content-Type: application/json\r\n\r\n", > ? ? ? ? ? ? ? ?Reply > ? ? ? ?]). > > I can open the URL for the create/3 function without any problems. The > browser immediately receives the proper reply. But when I try to call > the URL for read/3, the server never receives a response. I have > exactly the same behavior for create/3 when I send a message BEFORE > replying back to the client. > > Now, one difference between read/3 and create/3 is that read/3 sends > and receives a message to a registered process (running on the same > node) before it replies back to the client. Is this maybe something > you cannot do within functions called by mod_esi? Or could there be > another reason preventing me from sending a proper reply back to the > client? > > Thank you very much in advance! > > Regards, > Ingo From max.lapshin@REDACTED Fri Jan 13 21:51:18 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 13 Jan 2012 23:51:18 +0300 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: <4F107134.1080404@erlang.org> References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: I really thought that hibernating should make full cleanup of process state. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Jan 13 22:07:43 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 13 Jan 2012 22:07:43 +0100 Subject: [erlang-questions] Erlang API for GoogleMap? In-Reply-To: References: <243C1928-0664-4146-8FE3-A7A87E7CA51C@gmail.com> <295FF3B5-8B85-42F4-8014-D624535D9370@gmail.com> Message-ID: <6C9C0E97-B559-4B3A-B32D-679E84185E6A@gmail.com> > Requests are pretty simple: > > http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false > and returns simple JSON Exactly the kind of request I was looking after. Thanks Gleb. > P.S. We are close to finishing a geocoding server which is capable of > handling very flexible unstructured queries at the moment. It may be > open-sourced in future :) Awesome if it'll be open-sourced. Regards, Zabrane From ingela@REDACTED Fri Jan 13 22:47:45 2012 From: ingela@REDACTED (Ingela Andin) Date: Fri, 13 Jan 2012 22:47:45 +0100 Subject: [erlang-questions] httpc streaming bodies of 404 responses In-Reply-To: References: <4F0F6C82.1030205@gmail.com> Message-ID: Hoops now for the list too.... ---------- Forwarded message ---------- From: Ingela Andin Date: 2012/1/13 Subject: Re: [erlang-questions] httpc streaming bodies of 404 responses To: Shane Evans Hi! Thank you for reporting this again, it must alas have been missed by us. We will fix it removing the clause so it works as expected. Regards Ingela Erlang/OTP team - Ericsson AB 2012/1/13, Shane Evans : > Hi, > > This has been raised before: > http://erlang.org/pipermail/erlang-questions/2010-February/049267.html > But I didn't see any replies. > > I am using the http options {sync, false} and {stream, self} with > httpc:request/4. The documentation of stream says: > >> Streams the body of a 200 or 206 response to the calling process or to >> a file. When streaming to the calling process using the option self >> the following stream messages will be sent to that process: {http, >> {RequestId, stream_start, Headers}, {http, {RequestId, stream, >> BinBodyPart}, {http, {RequestId, stream_end, Headers}. > However, when a server replies with a 404 status, I get a message of the > form: > {request_id() , ?{status_line(), headers(), Body}} > as expected, but Body is empty (<<>>) and then the actual body of the > response is sent as a stream message: > {http, {request_id(), stream, Body}} > note that there was no stream_start or stream_end messages. > > This seems like a bug to me... but if you look at http_handler:stream, there > is clearly a function clause doing exactly this when status is 404. ?I guess > my question is why? and would it be a good idea to either document this, or > remove that function clause (in which case 404s would be handled as you'd > expect)? > > Thanks, > > Shane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From wallentin.dahlberg@REDACTED Fri Jan 13 22:48:40 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Fri, 13 Jan 2012 22:48:40 +0100 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: Den 13 januari 2012 21:51 skrev Max Lapshin : > I really thought that hibernating should make full cleanup of process > state. > I am certain that hibernate will achieve the same intended result, i.e. no lingering procbins: handle_call(release, _From, _State) -> {reply, ok, nothing, hibernate}. Hibernate is a lot more aggressive, see doc for details, then a gc but is also useful in scenarios when you want to shrink idle workers to a minimum. Of course, you normally don't need to trigger gc:s or a hibernate unless your application scenario really requires it. Large lingering binaries are a bit of a problem if the space is tight. In those cases an well placed explicit gc is well worth the trade off. // Bj?rn-Egil -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.santos@REDACTED Fri Jan 13 23:05:20 2012 From: michael.santos@REDACTED (Michael Santos) Date: Fri, 13 Jan 2012 17:05:20 -0500 Subject: [erlang-questions] rabbit, epmd and bonded interfaces woes In-Reply-To: <4072007.ipCyBbqyXL@captmarvel.usethesource.net> References: <4161289.ErBAafFudA@captmarvel.usethesource.net> <20120113201516.GA32117@ecn.lan> <4072007.ipCyBbqyXL@captmarvel.usethesource.net> Message-ID: <20120113220520.GA2191@ecn.lan> On Fri, Jan 13, 2012 at 03:25:21PM -0500, Leonard Boyce wrote: > On Friday, January 13, 2012 03:15:16 PM Michael Santos wrote: > > On Fri, Jan 13, 2012 at 02:52:06PM -0500, Leonard Boyce wrote: > > > > > That patch reverts to the old behaviour of epmd (allow all query types > > from remote clients). > > > > > Newer versions of epmd consider connections with the same source and > > destination address as local. What are the source and destination > > addresses for the TCP connection to epmd? > > looking at tcpdump the command "erl -sname somestrangename" calls epmd from > the public IP of the machine. "web1" is the aliased to 127.0.0.1 in > /etc/hosts. With the alias removed the tcpdump shows 'localhost' in place of > 'web1'. Try tcpdump -n, the name lookups are suppressed. > 14:41:27.874188 IP (tos 0x0, ttl 64, id 61958, offset 0, flags [DF], proto TCP > (6), length 52) > XX.XX.XX.XX.42982 > web1.4369: Flags [F.], cksum 0x5877 (correct), seq 30, > ack 2, win 257, options [nop,nop,TS val 24962735 ecr 24962735], length 0 > > As far as I understand the above command 'should' be binding and calling epmd > from 'localhost', not an arbitrary mounted IP. Yup, Erlang nodes are hard coded to go to 127.0.0.1. You should see the source as 127.0.0.1. The server is in a weird state. Anything wrong with the loopback or the routes? I remember someone had a similar issue that cleared up after a reboot. Might want to try that, if you haven't already. From max.lapshin@REDACTED Fri Jan 13 23:11:14 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 14 Jan 2012 01:11:14 +0300 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: I thought, that calling gc will be a problem: A = crypto:rand_bytes(1024*1024*1024), erlang:garbagecollect(), {reply, ok, State} Will gc free A? I think that no, because A is still used in the place, where gc is called. Am I right? From bob@REDACTED Fri Jan 13 23:15:43 2012 From: bob@REDACTED (Bob Cowdery) Date: Fri, 13 Jan 2012 22:15:43 +0000 Subject: [erlang-questions] Change in behaviour in 5.9 Message-ID: <4F10AD0F.2020606@bobcowdery.plus.com> Hi In erl 5.8.2 I had this: S = io_lib:format("~10.6.0f", [Freq]), where Freq was a float, say 7.0 and this gave me [["00","7.000000"]] so I concat the strings to get what I want which is "007.000000" In 5.9 the code breaks because I get [["00",55,46,48,48,48,48,48,48]]. Neither look right to me but I really don't understand the 5.9 result. If I do io:format("~10.6.0f", [7.0]). it gives me what I would expect "007.000000". Can someone explain these behaviours please. Thanks Bob From vladdu55@REDACTED Fri Jan 13 23:21:46 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 13 Jan 2012 23:21:46 +0100 Subject: [erlang-questions] Fwd: Change in behaviour in 5.9 In-Reply-To: References: <4F10AD0F.2020606@bobcowdery.plus.com> Message-ID: ... and to the list .... Hi! On Fri, Jan 13, 2012 at 23:15, Bob Cowdery wrote: > In erl 5.8.2 I had this: > S = io_lib:format("~10.6.0f", [Freq]), > where Freq was a float, say 7.0 and this gave me > [["00","7.000000"]] so I concat the strings to get what I want which is > "007.000000" > > In 5.9 the code breaks because I get [["00",55,46,48,48,48,48,48,48]]. > > Neither look right to me but I really don't understand the 5.9 result. > > If I do io:format("~10.6.0f", [7.0]). it gives me what I would expect > "007.000000". > > Can someone explain these behaviours please. io:format returns an iolist. The exact contents may vary, but they represent the same thing: 3> erlang:iolist_to_binary([["00",55,46,48,48,48,48,48,48]]). <<"007.000000">> regards, Vlad From tony@REDACTED Fri Jan 13 23:23:17 2012 From: tony@REDACTED (Tony Rogvall) Date: Fri, 13 Jan 2012 23:23:17 +0100 Subject: [erlang-questions] Change in behaviour in 5.9 In-Reply-To: <4F10AD0F.2020606@bobcowdery.plus.com> References: <4F10AD0F.2020606@bobcowdery.plus.com> Message-ID: <34FB8E59-2C75-4D1A-9999-4984E07D6F36@rogvall.se> I think the documentation is wrong here! The return value should probably (to be safe) be documented as iolist() ? /Tony On 13 jan 2012, at 23:15, Bob Cowdery wrote: > Hi > > In erl 5.8.2 I had this: > S = io_lib:format("~10.6.0f", [Freq]), > where Freq was a float, say 7.0 and this gave me > [["00","7.000000"]] so I concat the strings to get what I want which is > "007.000000" > > In 5.9 the code breaks because I get [["00",55,46,48,48,48,48,48,48]]. > > Neither look right to me but I really don't understand the 5.9 result. > > If I do io:format("~10.6.0f", [7.0]). it gives me what I would expect > "007.000000". > > Can someone explain these behaviours please. > > Thanks > Bob > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From grimlog@REDACTED Fri Jan 13 23:34:23 2012 From: grimlog@REDACTED (Michael Schreckenbauer) Date: Fri, 13 Jan 2012 23:34:23 +0100 Subject: [erlang-questions] Fwd: Change in behaviour in 5.9 In-Reply-To: References: <4F10AD0F.2020606@bobcowdery.plus.com> Message-ID: <2865146.8vsZrD2Voa@pc> Hi, Am Freitag, 13. Januar 2012, 23:21:46 schrieb Vlad Dumitrescu: > ... and to the list .... > > Hi! > > On Fri, Jan 13, 2012 at 23:15, Bob Cowdery wrote: > > In erl 5.8.2 I had this: > > S = io_lib:format("~10.6.0f", [Freq]), > > where Freq was a float, say 7.0 and this gave me > > [["00","7.000000"]] so I concat the strings to get what I want which is > > "007.000000" > > > > In 5.9 the code breaks because I get [["00",55,46,48,48,48,48,48,48]]. > > > > Neither look right to me but I really don't understand the 5.9 result. > > > > If I do io:format("~10.6.0f", [7.0]). it gives me what I would expect > > "007.000000". > > > > Can someone explain these behaviours please. > > io:format returns an iolist. The exact contents may vary, but they > represent the same thing: > 3> erlang:iolist_to_binary([["00",55,46,48,48,48,48,48,48]]). > <<"007.000000">> My (5.8.5) io:format returns ok. Eshell V5.8.5 (abort with ^G) 1> A=io:format("lalala", []). lalalaok 2> A. ok 3> > regards, > Vlad Best, Michael From grimlog@REDACTED Fri Jan 13 23:42:24 2012 From: grimlog@REDACTED (Michael Schreckenbauer) Date: Fri, 13 Jan 2012 23:42:24 +0100 Subject: [erlang-questions] Fwd: Change in behaviour in 5.9 In-Reply-To: <2865146.8vsZrD2Voa@pc> References: <4F10AD0F.2020606@bobcowdery.plus.com> <2865146.8vsZrD2Voa@pc> Message-ID: <3312208.RetMXmtJWA@pc> Am Freitag, 13. Januar 2012, 23:34:23 schrieb Michael Schreckenbauer: > Hi, > > Am Freitag, 13. Januar 2012, 23:21:46 schrieb Vlad Dumitrescu: > > ... and to the list .... > > > > Hi! > > > > On Fri, Jan 13, 2012 at 23:15, Bob Cowdery wrote: > > > In erl 5.8.2 I had this: > > > S = io_lib:format("~10.6.0f", [Freq]), > > > where Freq was a float, say 7.0 and this gave me > > > [["00","7.000000"]] so I concat the strings to get what I want which > > > is > > > "007.000000" > > > > > > In 5.9 the code breaks because I get > > > [["00",55,46,48,48,48,48,48,48]]. > > > > > > Neither look right to me but I really don't understand the 5.9 > > > result. > > > > > > If I do io:format("~10.6.0f", [7.0]). it gives me what I would > > > expect > > > "007.000000". > > > > > > Can someone explain these behaviours please. > > > > io:format returns an iolist. The exact contents may vary, but they > > represent the same thing: > > 3> erlang:iolist_to_binary([["00",55,46,48,48,48,48,48,48]]). > > <<"007.000000">> > > My (5.8.5) io:format returns ok. > > Eshell V5.8.5 (abort with ^G) > 1> A=io:format("lalala", []). > lalalaok > 2> A. > ok > 3> ... but the OP was talking about io_lib:format, which indeed returns an iolist. > > regards, > > Vlad Best, Michael From wallentin.dahlberg@REDACTED Fri Jan 13 23:42:27 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Fri, 13 Jan 2012 23:42:27 +0100 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: Den 13 januari 2012 23:11 skrev Max Lapshin : > I thought, that calling gc will be a problem: > > > A = crypto:rand_bytes(1024*1024*1024), > erlang:garbagecollect(), > {reply, ok, State} > > > Will gc free A? I think that no, because A is still used in the place, > where gc is called. Am I right? > Correct. To be a little technical (and don't take this as an absolute truth in the details), What we see here is "A is referencing a large binary", which is true. What happens internally is that Eterm A is a boxed pointer from the stack or a register which points to a ProcBin on the heap. The ProcBin in turn holds an increment of a Reference counted binary off heap. Both the stack and the registers will become part of the root set during the garbage collection hence letting the binary be reachable and therefore "live". I believe that you need leave the function (release the stack) in order to free your binary. A gc without the A in the stack will not let the ProcBin survive during the copy phase of the gc. When the ProcBin is removed the RefcBinary will decrement and if it reaches zero, i.e. the last ProcBin has died, that too will be removed. // Bj?rn-Egil -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Sat Jan 14 10:07:08 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sat, 14 Jan 2012 13:07:08 +0400 Subject: [erlang-questions] Problem with Rescheduling Interrupts Message-ID: Hi Erlangers, I have Erlang OTP application that heavily utilizes exmpp. When I run it under the load I see very strage system behavior in munin (this is system monitoring tool). The graph I see is the following: http://img829.imageshack.us/img829/259/irqstats.png At the same time CPU and memory consumption grows too, but this is expected behavior. Does anybody had similar issue? What coud be the reason? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Sat Jan 14 10:22:19 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Sat, 14 Jan 2012 12:22:19 +0300 Subject: [erlang-questions] Fwd: Change in behaviour in 5.9 In-Reply-To: <3312208.RetMXmtJWA@pc> References: <4F10AD0F.2020606@bobcowdery.plus.com> <2865146.8vsZrD2Voa@pc> <3312208.RetMXmtJWA@pc> Message-ID: Don't use internal structure of iolist. It can be changed anytime. It is useful for collecting data together, not for splitting it again. You only can transform the iolist to a list or to a binary. > Eshell V5.9 (abort with ^G) > 1> io_lib:format("~10.6.0f", [7.0]). > [["00",55,46,48,48,48,48,48,48]] > 2> lists:flatten(io_lib:format("~10.6.0f", [7.0])). > "007.000000" > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pguyot@REDACTED Sat Jan 14 11:04:04 2012 From: pguyot@REDACTED (Paul Guyot) Date: Sat, 14 Jan 2012 11:04:04 +0100 Subject: [erlang-questions] SSL distribution issues Message-ID: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> Hello, Is anyone successfully using SSL distribution on production servers? http://www.erlang.org/documentation/doc-5.9/lib/ssl-5.0/doc/html/ssl_distribution.html While running a couple of nodes works properly on a development machine, we have serious issues on a real production cluster. Our nodes ping other nodes very early, before our applications are started. We observed two serious issues: - pinging another node randomly blocks indefinitely, whether the other node is pingable or not (e.g. not over SSL or with a different cookie) ; - after a while (after pings timeout), ssl_tls_dist_proxy just crashes. =ERROR REPORT==== 2012-01-13 16:48:58 === ** Generic server ssl_tls_dist_proxy terminating ** Last message in was {connect,IP,25669} <-- this is another SSL node with the same cookie ** When Server state == {state,{#Port<0.284>,#Port<0.285>}, {<0.24.0>,<0.25.0>}} ** Reason for termination == ** {{badmatch,{error,badarg}}, [{ssl_tls_dist_proxy,handle_call,3, [{file,"ssl_tls_dist_proxy.erl"},{line,90}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]} The relevant code is the following: handle_call({connect, Ip, Port}, {From, _}, State) -> Me = self(), Pid = spawn_link(fun() -> setup_proxy(Ip, Port, Me) end), receive {Pid, go_ahead, LPort} -> Res = {ok, Socket} = try_connect(LPort), ok = gen_tcp:controlling_process(Socket, From), <---- line 90 flush_old_controller(From, Socket), {reply, Res, State}; {Pid, Error} -> {reply, Error, State} end; The crash happens because From is no longer alive. For the record, this is master branch and the SSL parameters are the following : -proto_dist inet_tls -ssl_dist_opt server_certfile /otp_root/ssl/${NODE_NAME}.pem client_certfile /otp_root/ssl/${NODE_NAME}.pem server_secure_renegotiate true client_secure_renegotiate true server_verify verify_peer client_verify verify_peer server_fail_if_no_peer_cert true server_cacertfile /otp_root/ssl/ca.pem client_cacertfile /otp_root/ssl/ca.pem server_depth 2 client_depth 2 Did we miss something obvious? Paul -- Semiocast http://semiocast.com/ +33.183627948 - 20 rue Lacaze, 75014 Paris From demeshchuk@REDACTED Sat Jan 14 11:10:04 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Sat, 14 Jan 2012 14:10:04 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Found another interesting problem with the approach we are discussing. Say, I have a folder where all my projects reside: projects/ my_work_project/ my_home_project/ my_work_lib/ my_home_lib/ opensource_lib/ So, work project requires work lib and opensource lib, and home project requires home lib and opensource lib: projects/ my_work_project/ deps/ my_work_lib/ opensource_lib/ my_home_project/ deps/ my_home_lib/ opensource_lib/ my_work_lib/ my_home_lib/ opensource_lib/ Now if I setup reltool.config, say, for the work project, like this: {lib_dirs, ["projects/my_work_project/deps", "projects"]}. during release package generation reltool will tell me: {"init terminating in do_boot","my_work_lib: Application version clash. Multiple directories contains version \"1.0\"."} Because my_work_lib resides both in deps/ folder (cloned there by rebar) and projects/ folder where I work on it. And I will get the same error for opensource_lib. The only workaround I see is to compile my_work_lib and opensource_lib that reside in projects/ and manually remove them from deps/. This way, they will reside in only one place and won't cause conflicts. On Fri, Jan 13, 2012 at 8:20 PM, Dmitry Demeshchuk wrote: > Also, answering your last question: no, I'm not expecting reltool to > automatically include deps (but this is a thing to consider, maybe > it's not bad). I expect to be able to add a certain app dir, so > reltool.config from my previous example will be something like this: > > {lib_dirs, ["../deps"]}. > {explicit_lib_dirs, [".."]}. > > Thank you. > > On Fri, Jan 13, 2012 at 8:18 PM, Dmitry Demeshchuk wrote: >> Here's a more certain example. >> >> ========================================================================================= >> >> Say, I clone some repository from GitHub (say, gproc, like in my >> example gist). Now I add some stuff to it and want to build a release. >> Here's how it should look: >> >> some_dir/ >> ? ?gproc/ >> ? ? ? ?src/ >> ? ? ? ?include/ >> ? ? ? ?ebin/ >> ? ? ? ?priv/ >> ? ? ? ?deps/ >> ? ? ? ?rel/ >> ? ? ? ? ? reltool.config >> ? ? ? ? ? files/ ? ? ?(this contains starting bash scripts, default >> config file and so on) >> ? ? ? ? ? gproc/ ? ? (this directory will be actually generated by >> rebar when running "rebar generate"; in fact, most of its content is >> generated by reltool) >> ? ? ? ? ? ? ? ?erts-5.8.5/ >> ? ? ? ? ? ? ? ?lib/ >> ? ? ? ? ? ? ? ?priv/ >> ? ? ? ? ? ? ? ?releases/ >> >> >> So, my release will run from "rel/gproc". >> >> Now, if I generate a release upgrade to release 2.0, I make some >> changes, do "rebar generate-appups && rebar generate-upgrade" and a >> new release package is created: >> >> rel/gproc/releases/gproc-2.0.tar.gz >> >> Then I just remsh to my running node and install the new release using >> release_handler. >> >> ================================================================================ >> >> What I want here is to be independent from the top-level folder >> (some_dir). Maybe I have more Erlang projects there, maybe just some >> pictures, books and MongoDB logs, it can be anything. >> >> For now, the only thing I can do without doing anything with directory >> structure is adding to reltool.config this: >> >> {lib_dirs, ["../.."]}. >> >> or in an absolute way: >> >> {lib_dirs, ["/home/me/some/path/some_dir"]}. >> >> >> Does this make sense? >> >> On Fri, Jan 13, 2012 at 7:56 PM, Siri Hansen wrote: >>> Yes, we are definitely drifting away from the original problem. But I found >>> it quite interesting also... :) >>> >>> Anyway - I'm not against introducing new functionality if it is needed - but >>> I do believe in doing a good investigation in order to ensure (or at least >>> attempt) the best possible solution. The problem for me was that I did not >>> really understand the problem. I'm not sure if I still do (sorry!) - but >>> I'll try to explain what I think you mean. Please correct me if (when) I'm >>> wrong... ;) >>> >>> I think that what you suggest is to be able to point out one specific >>> application directory instead of specifying one or more lib dirs. And the >>> reason for this is that you have several applications stored under the same >>> lib dir, which are not necessarily at all related to each other. And >>> typically - for each core application (which forms the main functionality of >>> a release), you have it's dependency applications stored in the deps >>> directory under the core application itself.?Is this correct? >>> >>> How do you handle different version of the core app and of the dep apps? >>> Could you give an example of this? e.g. >>> >>> lib/ >>> ?? coreapp-1.0/ >>> ?? ? ?src/ >>> ?? ? ?ebin/ >>> ?? ? ?include/ >>> ?? ? ?priv/ >>> ?? ? ?deps/ >>> ?? ? ? ? app1-1.0/ >>> ?? ? ? ? ? ? src >>> ?? ? ? ? ? ? ebin >>> ?? ? ? ... >>> ?? coreapp-2.0/ >>> ?? ? ?src/ >>> ?? ? ?ebin/ >>> ?? ? ?include/ >>> ?? ? ?priv/ >>> ?? ? ?deps/ >>> ?? ? ? ? app1-1.1/ >>> ?? ? ? ? ? ? src >>> ?? ? ? ? ? ? ebin >>> ?? ? ?... >>> >>> And, when specifying the explicit app dir, would you expect reltool to >>> automatically include the deps directory in the selected coreapp-Vsn as a >>> lib dir?? Or should there be a way to specify that also? >>> >>> I hope I'm not totally on the wrong track here... >>> >>> /siri >>> >>> >>> 2012/1/13 Dmitry Demeshchuk >>>> >>>> Hi, Siri. >>>> >>>> I guess, we are moving away from the main conversation. >>>> >>>> Don't you think that it would be good to make reltool do the required >>>> job in a simpler way? The way we are discussing works in most cases, >>>> but it's quite unclear for the people who aren't very familiar with >>>> reltool. >>>> >>>> Using the existing functionalities to solve problems is often good, >>>> but if the solution becomes complicated, maybe a new functionality >>>> should be created instead. >>>> >>>> On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: >>>> > Ah... this is interesting... a missing test case maybe - but I'm not >>>> > sure if >>>> > it is a bug. >>>> > >>>> > What happens is that the duplicated module erl_parse causes erlson to >>>> > become >>>> > derived since a module with the same name is used by stdlib and several >>>> > other applications. If it was only stdlib, then I guess reltool could >>>> > make >>>> > the assumption that the module to use is the one in the same application >>>> > and >>>> > thus never make erlson derived (because to this module, that is). >>>> > However, >>>> > since the module in this case is also used by other applications, this >>>> > assumption is not that obvious. >>>> > >>>> > The easiest way to get around this right now is to be more specific in >>>> > the >>>> > config file to make sure that erlson (or only the erl_parse module) is >>>> > excluded... e.g. by adding >>>> > >>>> > {app, erlson, [{incl_cond,exclude}]} or >>>> > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} >>>> > >>>> > (The latter would allow erlson to be derived if any of it's other >>>> > modules >>>> > were used by other applications) >>>> > >>>> > Regards >>>> > /siri >>>> > >>>> > 2012/1/12 Dmitry Demeshchuk >>>> >> >>>> >> Try running this gist: https://gist.github.com/1600020 >>>> >> >>>> >> reltool.config will reside in lib/gproc/rel/ >>>> >> >>>> >> Thank you. >>>> >> >>>> > >>>> >>>> >>>> >>>> -- >>>> Best regards, >>>> Dmitry Demeshchuk >>> >>> >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk > > > > -- > Best regards, > Dmitry Demeshchuk -- Best regards, Dmitry Demeshchuk From demeshchuk@REDACTED Sat Jan 14 11:21:17 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Sat, 14 Jan 2012 14:21:17 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Here's another story. Again, I have a projects/ directory and tons of projects and libraries in it (most of them totally independent on the current project I'm trying to build). projects/ proj1/ proj2/ .... proj118/ my_project/ What I want is to exclude them from my_project/ release package (for obvious reasons). For now, the only way I see is to write in reltool.config: {incl_cond, exclude} Which means, I'll have to explicitly set the applications to include into the release. Okay, not a big deal, I can teach rebar to do that: gather all the deps that are listed in rebar.config, for each of them gather its dependencies too, and so on. Then, write explicit {incl_cond, include} conditions for them But wait, it's not working. Shoot, I have to set include conditions for internal Erlang applications as well. Apparently, syntax_tools and compiler are being used somewhere. And mochiweb is using crypto, inets, ssl, and public_key. But all I actually wanted to do here is just including my core application, my_project/, into release, along with dependencies. On Sat, Jan 14, 2012 at 2:10 PM, Dmitry Demeshchuk wrote: > Found another interesting problem with the approach we are discussing. > > Say, I have a folder where all my projects reside: > > projects/ > ? ?my_work_project/ > ? ?my_home_project/ > ? ?my_work_lib/ > ? ?my_home_lib/ > ? ?opensource_lib/ > > So, work project requires work lib and opensource lib, and home > project requires home lib and opensource lib: > > projects/ > ? ?my_work_project/ > ? ? ? ?deps/ > ? ? ? ? ? ?my_work_lib/ > ? ? ? ? ? ?opensource_lib/ > ? ?my_home_project/ > ? ? ? ? deps/ > ? ? ? ? ? ?my_home_lib/ > ? ? ? ? ? ?opensource_lib/ > ? ?my_work_lib/ > ? ?my_home_lib/ > ? ?opensource_lib/ > > > Now if I setup reltool.config, say, for the work project, like this: > > {lib_dirs, ["projects/my_work_project/deps", "projects"]}. > > during release package generation reltool will tell me: > > {"init terminating in do_boot","my_work_lib: Application version > clash. Multiple directories contains version \"1.0\"."} > > Because my_work_lib resides both in deps/ folder (cloned there by > rebar) and projects/ folder where I work on it. > And I will get the same error for opensource_lib. > > The only workaround I see is to compile my_work_lib and opensource_lib > that reside in projects/ and manually remove them from deps/. This > way, they will reside in only one place and won't cause conflicts. > > On Fri, Jan 13, 2012 at 8:20 PM, Dmitry Demeshchuk wrote: >> Also, answering your last question: no, I'm not expecting reltool to >> automatically include deps (but this is a thing to consider, maybe >> it's not bad). I expect to be able to add a certain app dir, so >> reltool.config from my previous example will be something like this: >> >> {lib_dirs, ["../deps"]}. >> {explicit_lib_dirs, [".."]}. >> >> Thank you. >> >> On Fri, Jan 13, 2012 at 8:18 PM, Dmitry Demeshchuk wrote: >>> Here's a more certain example. >>> >>> ========================================================================================= >>> >>> Say, I clone some repository from GitHub (say, gproc, like in my >>> example gist). Now I add some stuff to it and want to build a release. >>> Here's how it should look: >>> >>> some_dir/ >>> ? ?gproc/ >>> ? ? ? ?src/ >>> ? ? ? ?include/ >>> ? ? ? ?ebin/ >>> ? ? ? ?priv/ >>> ? ? ? ?deps/ >>> ? ? ? ?rel/ >>> ? ? ? ? ? reltool.config >>> ? ? ? ? ? files/ ? ? ?(this contains starting bash scripts, default >>> config file and so on) >>> ? ? ? ? ? gproc/ ? ? (this directory will be actually generated by >>> rebar when running "rebar generate"; in fact, most of its content is >>> generated by reltool) >>> ? ? ? ? ? ? ? ?erts-5.8.5/ >>> ? ? ? ? ? ? ? ?lib/ >>> ? ? ? ? ? ? ? ?priv/ >>> ? ? ? ? ? ? ? ?releases/ >>> >>> >>> So, my release will run from "rel/gproc". >>> >>> Now, if I generate a release upgrade to release 2.0, I make some >>> changes, do "rebar generate-appups && rebar generate-upgrade" and a >>> new release package is created: >>> >>> rel/gproc/releases/gproc-2.0.tar.gz >>> >>> Then I just remsh to my running node and install the new release using >>> release_handler. >>> >>> ================================================================================ >>> >>> What I want here is to be independent from the top-level folder >>> (some_dir). Maybe I have more Erlang projects there, maybe just some >>> pictures, books and MongoDB logs, it can be anything. >>> >>> For now, the only thing I can do without doing anything with directory >>> structure is adding to reltool.config this: >>> >>> {lib_dirs, ["../.."]}. >>> >>> or in an absolute way: >>> >>> {lib_dirs, ["/home/me/some/path/some_dir"]}. >>> >>> >>> Does this make sense? >>> >>> On Fri, Jan 13, 2012 at 7:56 PM, Siri Hansen wrote: >>>> Yes, we are definitely drifting away from the original problem. But I found >>>> it quite interesting also... :) >>>> >>>> Anyway - I'm not against introducing new functionality if it is needed - but >>>> I do believe in doing a good investigation in order to ensure (or at least >>>> attempt) the best possible solution. The problem for me was that I did not >>>> really understand the problem. I'm not sure if I still do (sorry!) - but >>>> I'll try to explain what I think you mean. Please correct me if (when) I'm >>>> wrong... ;) >>>> >>>> I think that what you suggest is to be able to point out one specific >>>> application directory instead of specifying one or more lib dirs. And the >>>> reason for this is that you have several applications stored under the same >>>> lib dir, which are not necessarily at all related to each other. And >>>> typically - for each core application (which forms the main functionality of >>>> a release), you have it's dependency applications stored in the deps >>>> directory under the core application itself.?Is this correct? >>>> >>>> How do you handle different version of the core app and of the dep apps? >>>> Could you give an example of this? e.g. >>>> >>>> lib/ >>>> ?? coreapp-1.0/ >>>> ?? ? ?src/ >>>> ?? ? ?ebin/ >>>> ?? ? ?include/ >>>> ?? ? ?priv/ >>>> ?? ? ?deps/ >>>> ?? ? ? ? app1-1.0/ >>>> ?? ? ? ? ? ? src >>>> ?? ? ? ? ? ? ebin >>>> ?? ? ? ... >>>> ?? coreapp-2.0/ >>>> ?? ? ?src/ >>>> ?? ? ?ebin/ >>>> ?? ? ?include/ >>>> ?? ? ?priv/ >>>> ?? ? ?deps/ >>>> ?? ? ? ? app1-1.1/ >>>> ?? ? ? ? ? ? src >>>> ?? ? ? ? ? ? ebin >>>> ?? ? ?... >>>> >>>> And, when specifying the explicit app dir, would you expect reltool to >>>> automatically include the deps directory in the selected coreapp-Vsn as a >>>> lib dir?? Or should there be a way to specify that also? >>>> >>>> I hope I'm not totally on the wrong track here... >>>> >>>> /siri >>>> >>>> >>>> 2012/1/13 Dmitry Demeshchuk >>>>> >>>>> Hi, Siri. >>>>> >>>>> I guess, we are moving away from the main conversation. >>>>> >>>>> Don't you think that it would be good to make reltool do the required >>>>> job in a simpler way? The way we are discussing works in most cases, >>>>> but it's quite unclear for the people who aren't very familiar with >>>>> reltool. >>>>> >>>>> Using the existing functionalities to solve problems is often good, >>>>> but if the solution becomes complicated, maybe a new functionality >>>>> should be created instead. >>>>> >>>>> On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen wrote: >>>>> > Ah... this is interesting... a missing test case maybe - but I'm not >>>>> > sure if >>>>> > it is a bug. >>>>> > >>>>> > What happens is that the duplicated module erl_parse causes erlson to >>>>> > become >>>>> > derived since a module with the same name is used by stdlib and several >>>>> > other applications. If it was only stdlib, then I guess reltool could >>>>> > make >>>>> > the assumption that the module to use is the one in the same application >>>>> > and >>>>> > thus never make erlson derived (because to this module, that is). >>>>> > However, >>>>> > since the module in this case is also used by other applications, this >>>>> > assumption is not that obvious. >>>>> > >>>>> > The easiest way to get around this right now is to be more specific in >>>>> > the >>>>> > config file to make sure that erlson (or only the erl_parse module) is >>>>> > excluded... e.g. by adding >>>>> > >>>>> > {app, erlson, [{incl_cond,exclude}]} or >>>>> > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} >>>>> > >>>>> > (The latter would allow erlson to be derived if any of it's other >>>>> > modules >>>>> > were used by other applications) >>>>> > >>>>> > Regards >>>>> > /siri >>>>> > >>>>> > 2012/1/12 Dmitry Demeshchuk >>>>> >> >>>>> >> Try running this gist: https://gist.github.com/1600020 >>>>> >> >>>>> >> reltool.config will reside in lib/gproc/rel/ >>>>> >> >>>>> >> Thank you. >>>>> >> >>>>> > >>>>> >>>>> >>>>> >>>>> -- >>>>> Best regards, >>>>> Dmitry Demeshchuk >>>> >>>> >>> >>> >>> >>> -- >>> Best regards, >>> Dmitry Demeshchuk >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk > > > > -- > Best regards, > Dmitry Demeshchuk -- Best regards, Dmitry Demeshchuk From dmkolesnikov@REDACTED Sat Jan 14 15:22:30 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 14 Jan 2012 16:22:30 +0200 Subject: [erlang-questions] Problem with Rescheduling Interrupts In-Reply-To: References: Message-ID: <25034F24-5A5A-4C65-9C23-80AFB549AADE@gmail.com> Hi, Look like a side effect caused by NIC drivers. Just curious, have you done any kernel level optimisation? BTW, what os, NIC, kernel and erlang config we are talking about? - Dmitry On 14.1.2012, at 11.07, Max Bourinov wrote: > Hi Erlangers, > > I have Erlang OTP application that heavily utilizes exmpp. When I run it under the load I see very strage system behavior in munin (this is system monitoring tool). > > The graph I see is the following: http://img829.imageshack.us/img829/259/irqstats.png > > At the same time CPU and memory consumption grows too, but this is expected behavior. Does anybody had similar issue? What coud be the reason? > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Sat Jan 14 15:54:24 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Sat, 14 Jan 2012 09:54:24 -0500 Subject: [erlang-questions] Fwd: Change in behaviour in 5.9 In-Reply-To: References: <4F10AD0F.2020606@bobcowdery.plus.com> <2865146.8vsZrD2Voa@pc> <3312208.RetMXmtJWA@pc> Message-ID: I wouldn't use lists:flatten/1 for iolists because by definition, iolists can also contain binaries. The only safe way, I figure, would be to use iolist_to_binary/1 as the list is a sequence of bytes and binaries. If you want to convert it back to a list, you can use binary_to_list/1 for the example used rightn ow, but you have to be careful in general cases: if you have encoded Unicode (utf-8/16/32) in there, the format will be lost on the final string. This is because Unicode strings as lists directly use codepoint numbers and not a specific encoding to represent various codepoints. In these cases what you want to do is in fact convert the iolist using unicode:characters_to_list/1, which will take care of changing the bytes from a given encoding into the right representation. There is also unicode:characters_to_binary/1 if you need it going that way. I've got a few more details and examples at http://ferd.ca/will-the-real-unicode-wrangler-please-stand-up.html. When you want to handle unicode or one of its encodings, you have to be careful in how you handle things; I'd recommend against using lists:flatten to handle io lists (especially when the unicode module itself accepts iolists). On Sat, Jan 14, 2012 at 4:22 AM, Michael Uvarov wrote: > Don't use internal structure of iolist. It can be changed anytime. It is > useful for collecting data together, not for splitting it again. You only > can transform the iolist to a list or to a binary. > > >> Eshell V5.9 (abort with ^G) >> 1> io_lib:format("~10.6.0f", [7.0]). >> [["00",55,46,48,48,48,48,48,48]] >> 2> lists:flatten(io_lib:format("~10.6.0f", [7.0])). >> "007.000000" >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kuleshovmail@REDACTED Sat Jan 14 18:46:29 2012 From: kuleshovmail@REDACTED (Alexander Kuleshov) Date: Sat, 14 Jan 2012 23:46:29 +0600 Subject: [erlang-questions] Problem with Rescheduling Interrupts In-Reply-To: <25034F24-5A5A-4C65-9C23-80AFB549AADE@gmail.com> References: <25034F24-5A5A-4C65-9C23-80AFB549AADE@gmail.com> Message-ID: 2012/1/14 Dmitry Kolesnikov > Hi, > > Look like a side effect caused by NIC drivers. > Just curious, have you done any kernel level optimisation? > BTW, what os, NIC, kernel and erlang config we are talking about? > > > - Dmitry > > > On 14.1.2012, at 11.07, Max Bourinov wrote: > > Hi Erlangers, > > I have Erlang OTP application that heavily utilizes exmpp. When I run it > under the load I see very strage system behavior in munin (this is system > monitoring tool). > > The graph I see is the following: > http://img829.imageshack.us/img829/259/irqstats.png > > At the same time CPU and memory consumption grows too, but this is > expected behavior. Does anybody had similar issue? What coud be the reason? > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > Hello Dmitry, I work with Max and try to answer on your questions. We use Linux ubuntu 3.0.0-12-server x86_64 operation system and erlang R14B02 (erts-5.8.3). Now we made only kernel tuning ( http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1) . Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sat Jan 14 19:05:10 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 14 Jan 2012 20:05:10 +0200 Subject: [erlang-questions] Problem with Rescheduling Interrupts In-Reply-To: References: <25034F24-5A5A-4C65-9C23-80AFB549AADE@gmail.com> Message-ID: <9BD35FEC-AD1B-4916-9D53-61C809B35AC4@gmail.com> Hello, I see. I would recommend you to check NIC drivers, to enable irq throttling and additionally play around with nbr of async processes within VM. - Dmitry On Jan 14, 2012, at 7:46 PM, Alexander Kuleshov wrote: > > > 2012/1/14 Dmitry Kolesnikov > Hi, > > Look like a side effect caused by NIC drivers. > Just curious, have you done any kernel level optimisation? > BTW, what os, NIC, kernel and erlang config we are talking about? > > > - Dmitry > > > On 14.1.2012, at 11.07, Max Bourinov wrote: > >> Hi Erlangers, >> >> I have Erlang OTP application that heavily utilizes exmpp. When I run it under the load I see very strage system behavior in munin (this is system monitoring tool). >> >> The graph I see is the following: http://img829.imageshack.us/img829/259/irqstats.png >> >> At the same time CPU and memory consumption grows too, but this is expected behavior. Does anybody had similar issue? What coud be the reason? >> >> Best regards, >> Max >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > Hello Dmitry, > > I work with Max and try to answer on your questions. We use Linux ubuntu 3.0.0-12-server x86_64 operation system and erlang R14B02 (erts-5.8.3). Now we made only kernel tuning (http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1) . > > Thank you. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Sat Jan 14 20:20:41 2012 From: bob@REDACTED (Bob Cowdery) Date: Sat, 14 Jan 2012 19:20:41 +0000 Subject: [erlang-questions] Version management. Message-ID: <4F11D589.90205@bobcowdery.plus.com> Hi I'm trying to get a driver that worked in 5.8 to load in 5.9. As far as I can tell there are two changes to make. The return value from the callbacks and version info. I've made both changes but still it does not load. I'm using the 32 bit version as I failed to figure out how to link the 64 bit version (using Windows 7). What else do I need to do? I did have a certain amount of trouble finding the info. The code samples in the 5.9 docs don't include the required version management. I've extended my driver structure like so. ErlDrvEntry dttsp_port_driver_entry = { NULL, /* F_PTR init, N/A */ dttsp_port_drv_start, /* L_PTR start, called when port is opened */ dttsp_port_drv_stop, /* F_PTR stop, called when port is closed */ dttsp_port_drv_output, /* F_PTR output, called when erlang has sent */ NULL, /* F_PTR ready_input, called when input descriptor ready */ NULL, /* F_PTR ready_output, called when output descriptor ready */ "zeno-dttsp-win", /* char *driver_name, the argument to open_port */ NULL, /* F_PTR finish, called when unloaded */ NULL, /* F_PTR control, port_command callback */ NULL, /* F_PTR timeout, reserved */ NULL, /* F_PTR outputv, reserved */ // Extended fields as version management is mandatory from 5.9 onwards NULL, /* called when we have output from erlang to the port */ NULL, /* Ready sync */ NULL, /* called when the port is about to be closed, and there is data in the driver queue that needs to be flushed before 'stop' can be called */ NULL, /* Works mostly like 'control', a synchronous call into the driver. */ NULL, /* Called when an event selected by driver_event() has occurred */ ERL_DRV_EXTENDED_MARKER, /* ERL_DRV_EXTENDED_MARKER */ ERL_DRV_EXTENDED_MAJOR_VERSION, /* ERL_DRV_EXTENDED_MAJOR_VERSION */ ERL_DRV_EXTENDED_MINOR_VERSION, /* ERL_DRV_EXTENDED_MINOR_VERSION */ 0, /* ERL_DRV_FLAGs */ NULL, /* Reserved -- Used by emulator internally */ NULL, /* Called when a process monitor fires */ NULL, /* Called on behalf of driver_select when it is safe to release 'event'. A typical unix driver would call close(event) */ /* When adding entries here, dont forget to pad in obsolete/driver.h */ }; Regards Bob From yrashk@REDACTED Sat Jan 14 20:54:23 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Sat, 14 Jan 2012 11:54:23 -0800 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) Message-ID: Hi, Problem ------- Does it bother you that some of your code looks like this? ```erlang L1 = lists:map(fun (X) -> ... end, L), L2 = lists:filter(fun (X) -> ... end, L1) %% or {Q,Req1} = cowboy_http_req:qs_val(<<"q">>,Req), {Id,Req2} = cowboy_http_req:qs_val(<<"id">>,Req1) ``` Solution ------------ You can find out about it at https://github.com/spawngrid/seqbind Thanks, Yurii. From andrzej.sliwa@REDACTED Sun Jan 15 12:55:36 2012 From: andrzej.sliwa@REDACTED (Andrzej Sliwa) Date: Sun, 15 Jan 2012 12:55:36 +0100 Subject: [erlang-questions] tidier is down Message-ID: <35F49CCD-F958-4677-B53F-F9AAA0A8BEA7@i-tool.eu> Hi Guys, it looks like tidier service is down: http://tidier.softlab.ntua.gr/mediawiki/ Database error A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was: (SQL query hidden) from within function "MediaWikiBagOStuff::_doinsert". MySQL returned error "1114: The table 'objectcache' is full (localhost)". http://tidier.softlab.ntua.gr:20000/tidier/getstarted ERROR erlang code crashed: File: appmod:0 Reason: {undef, [{erlyweb,out, [{arg,#Port<0.486>, {{89,228,137,251},64315}, {headers,"keep-alive", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "tidier.softlab.ntua.gr:20000",undefined,undefined, undefined,undefined,undefined,undefined,undefined, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7", undefined,[],undefined,undefined,undefined, undefined,undefined,undefined,undefined, [{http_header,10,'Accept-Encoding',undefined, "gzip, deflate"}, {http_header,11,'Accept-Language',undefined, "en-us"}]}, {http_request,'GET', {abs_path,"/tidier/getstarted"}, {1,1}}, undefined,"/tidier/getstarted",undefined,"getstarted", "/home/ethan/apps/tidier/www","/", "/home/ethan/apps/tidier/www/tidier/getstarted", undefined,undefined,<0.240.0>, [{"appname","tidier"}], "/","/","/getstarted"}]}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p,5}]} Req: {http_request,'GET',{abs_path,"/tidier/getstarted"},{1,1}} Stack: [{erlyweb,out, [{arg,#Port<0.486>, {{89,228,137,251},64315}, {headers,"keep-alive", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "tidier.softlab.ntua.gr:20000",undefined,undefined, undefined,undefined,undefined,undefined,undefined, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7", undefined,[],undefined,undefined,undefined,undefined, undefined,undefined,undefined, [{http_header,10,'Accept-Encoding',undefined, "gzip, deflate"}, {http_header,11,'Accept-Language',undefined,"en-us"}]}, {http_request,'GET',{abs_path,"/tidier/getstarted"},{1,1}}, undefined,"/tidier/getstarted",undefined,"getstarted", "/home/ethan/apps/tidier/www","/", "/home/ethan/apps/tidier/www/tidier/getstarted",undefined, undefined,<0.240.0>, [{"appname","tidier"}], "/","/","/getstarted"}]}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p,5}] Maybe it is good time to make this tool open, or free standalone version for open source projects? best regards, Andrzej -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sun Jan 15 15:28:38 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 15 Jan 2012 15:28:38 +0100 Subject: [erlang-questions] CVS reader module In-Reply-To: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> Message-ID: <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> Hi guys, Is there any stable/efficient "CSV reader" module in Erlang? Regards, Zabrane From siraaj@REDACTED Sun Jan 15 16:09:33 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Sun, 15 Jan 2012 10:09:33 -0500 Subject: [erlang-questions] CVS reader module In-Reply-To: <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> Message-ID: <47CCE477-6526-4E60-B49C-C6F7946BF6D3@khandkar.net> On Jan 15, 2012, at 9:28 AM, Zabrane Mickael wrote: > Hi guys, > > Is there any stable/efficient "CSV reader" module in Erlang? I had the same question a few weeks ago and ended-up just using [string:join(Tokens, ",")++"\n" || Tokens <- Lines]. :-) Certainly not suitable for all cases... However, it looks like there's been a recent attempt to fill this need: https://github.com/refuge/ecsv -- Siraaj Khandkar From s.j.thompson@REDACTED Sun Jan 15 17:17:17 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Sun, 15 Jan 2012 16:17:17 +0000 Subject: [erlang-questions] SBLP - call for papers Message-ID: <444EF7B5-1C87-489D-985A-A8620455C59D@kent.ac.uk> ============================================================ CALL FOR PAPERS 16th BRAZILIAN SYMPOSIUM ON PROGRAMMING LANGUAGES Natal, Rio Grande do Norte, Brazil September 24-28, 2012 http://www.cbsoft.dimap.ufrn.br ============================================================ IMPORTANT DATES Paper abstract submission (15 lines): April 20nd, 2012 Full paper submission: April 27th, 2012 Notification of acceptance: May 28th, 2012 Final papers due: June 29th, 2012 INTRODUCTION The 16th Brazilian Symposium on Programming Languages, SBLP 2012, will be held in Natal, Brazil, on September 24-28, 2012. SBLP provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. The symposium will be part of the 3nd Brazilian Conference on Software: Theory and Practice, CBSoft 2012, http://www.cbsoft.dimap.ufrn.br, which will host four traditional, well-established symposia: * XXVI Brazilian Symposium on Software Engineering (SBES) * XVI Brazilian Symposium on Programming Languages (SBLP) * XV Brazilian Symposium on Formal Methods (SBMF) * VI Brazilian Symposium on Components, Software Architecture and Software Reuse (SBCARS) SBLP 2012 invites authors to contribute with technical papers related (but not limited) to: * Program generation and transformation, including domain- specific languages and model-driven development in the context of programming languages. * Programming paradigms and styles, including functional, object-oriented, aspect-oriented, scripting languages, real-time, service-oriented, multithreaded, parallel, and distributed programming. * Formal semantics and theoretical foundations, including denotational, operational, algebraic and categorical. * Program analysis and verification, including type systems, static analysis and abstract interpretation. * Programming language design and implementation, including new programming models, programming language environments, compilation and interpretation techniques. SUBMISSIONS Contributions should be written in Portuguese or English. We solicit papers that should fall into one of two different categories: full papers, with at most 15 pages, or short papers, with at most 5 pages. All papers should be prepared using the SBC template. In particular, we encourage the submission of short papers reporting on partial results of on-going master dissertations or doctoral theses. All accepted papers will be published in the conference proceedings. Submissions should be done using SBLP 2012 installation of the EasyChair conference mangement system at http://www.easychair.org/conferences/?conf=sblp2012. As in previous editions, a journal special issue, with selected papers from accepted contributions, is anticipated. GENERAL CO-CHAIRS N?lio Cacho, UFRN Gibeon Aquino, UFRN Martin Musicante, UFRN PROGRAMME CHAIRS Francisco Heron de Carvalho Junior, UFC Luis Soares Barbosa, Univ. do Minho PROGRAMME COMMITTEE * Alberto Pardo, Univ. de La Republica * Alex Garcia, IME * Alvaro Freitas Moreira, UFRGS * Andr? Rauber Du Bois, UFPel * Andre Santos, UFPE * Carlos Camarao, UFMG * Christiano Braga, UFF * Fernando Castor Filho, UFPE * Fernando Quint?o Pereira, UFMG * Francisco Heron de Carvalho Junior, UFC (co-chair) * Joao Saraiva, Universidade do Minho * Jo?o F. Ferreira, Teeside University * Jonathan Aldrich, Carnegie Mellon Univ. * Jose Luiz Fiadeiro, Univ. of Leicester * Lucilia Figueiredo, UFOP * Luis Soares Barbosa, Univ. do Minho * Manuel Ant?nio Martins, Univ. de Aveiro * Marcelo A. Maia, UFU * Marcello Bonsangue, Leiden Univ/CWI * Marcelo d'Amorim, UFPE * Marco Tulio Valente, UFMG * Mariza A. S. Bigonha, UFMG * Martin A. Musicante, UFRN * Noemi Rodriguez, PUC-Rio * Paulo Borba, UFPE * Peter Mosses, Swansea University * Qiu Zongyang, Beijing University * Rafael Dueire Lins, UFPE * Renato Cerqueira, PUC-Rio * Ricardo Massa, UFPE * Roberto S. Bigonha, UFMG * Roberto Ierusalimschy, PUC-Rio * Sandro Rigo, UNICAMP * Sergio Soares, UFPE * Simon Thompson, Univ. of Kent * Varmo Vene, Univ. de Tartu Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From zabrane3@REDACTED Sun Jan 15 17:57:55 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 15 Jan 2012 17:57:55 +0100 Subject: [erlang-questions] CVS reader module In-Reply-To: <47CCE477-6526-4E60-B49C-C6F7946BF6D3@khandkar.net> References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> <47CCE477-6526-4E60-B49C-C6F7946BF6D3@khandkar.net> Message-ID: <5AA09383-172D-4F4D-8C38-C20F39840C6F@gmail.com> The problem with "ecsv", it uses lists and I want something which handle the data as binaries instead: https://github.com/refuge/ecsv/blob/master/src/ecsv_parser.erl Too lazy to write one ... if someone else already did it. Regards, Zabrane On Jan 15, 2012, at 4:09 PM, Siraaj Khandkar wrote: > On Jan 15, 2012, at 9:28 AM, Zabrane Mickael wrote: > >> Hi guys, >> >> Is there any stable/efficient "CSV reader" module in Erlang? > > I had the same question a few weeks ago and ended-up just using > [string:join(Tokens, ",")++"\n" || Tokens <- Lines]. :-) Certainly not > suitable for all cases... > > However, it looks like there's been a recent attempt to fill this need: > https://github.com/refuge/ecsv > > -- > Siraaj Khandkar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sun Jan 15 17:51:26 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 15 Jan 2012 17:51:26 +0100 Subject: [erlang-questions] CVS reader module In-Reply-To: <47CCE477-6526-4E60-B49C-C6F7946BF6D3@khandkar.net> References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> <47CCE477-6526-4E60-B49C-C6F7946BF6D3@khandkar.net> Message-ID: <5252D2D1-47B5-45BF-A91C-ED6FAF1C59A7@gmail.com> The problem with "ecsv", it uses lists and I want something which handle binaries instead: https://github.com/refuge/ecsv/blob/master/src/ecsv_parser.erl Too lazy to write one ... if someone else already did it. Regards, Zabrane On Jan 15, 2012, at 4:09 PM, Siraaj Khandkar wrote: > On Jan 15, 2012, at 9:28 AM, Zabrane Mickael wrote: > >> Hi guys, >> >> Is there any stable/efficient "CSV reader" module in Erlang? > > I had the same question a few weeks ago and ended-up just using > [string:join(Tokens, ",")++"\n" || Tokens <- Lines]. :-) Certainly not > suitable for all cases... > > However, it looks like there's been a recent attempt to fill this need: > https://github.com/refuge/ecsv > > -- > Siraaj Khandkar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sun Jan 15 18:21:10 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 15 Jan 2012 18:21:10 +0100 Subject: [erlang-questions] CVS reader module In-Reply-To: References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> Message-ID: <1F45D5DB-2505-4F83-8762-0ABFC94EA85C@gmail.com> Great pointer. Thanks Gordon. Regards, Zabrane On Jan 15, 2012, at 6:16 PM, Gordon Guthrie wrote: > Mickael > > There is an RFC 4180 csv parser. I had it up on my github account > origionally but Eric Merritt has added it to his collection of RFC > parsers at: > https://github.com/afiniate/erfc_parsers > > Gordon > > On 15 January 2012 14:28, Zabrane Mickael wrote: >> Hi guys, >> >> Is there any stable/efficient "CSV reader" module in Erlang? >> >> Regards, >> Zabrane >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Gordon Guthrie > CEO hypernumbers > > http://hypernumbers.com > t: hypernumbers > +44 7776 251669 From steven.charles.davis@REDACTED Mon Jan 16 00:04:47 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 15 Jan 2012 15:04:47 -0800 (PST) Subject: [erlang-questions] CVS reader module In-Reply-To: <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> References: <8818E18E-9D6C-470A-98A3-9338A520E37E@gmail.com> <92F4A5B8-5200-49B5-BC55-2C13E72F3EF7@gmail.com> Message-ID: <2f375510-a686-4ba5-85c5-d8a97471716f@n39g2000yqh.googlegroups.com> My immediate solution was: re:split()... BTW the RFC seems rather inadequate to me; esp. with respect to leniency over header lines and quotes - where is the absolute determination? If there is none, you are coding heuristically (hacking). Regards, /s On Jan 15, 8:28?am, Zabrane Mickael wrote: > Hi guys, > > Is there any stable/efficient "CSV reader" module in Erlang? > > Regards, > Zabrane > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From ingela.andin@REDACTED Mon Jan 16 10:15:02 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Mon, 16 Jan 2012 10:15:02 +0100 Subject: [erlang-questions] SSL distribution issues In-Reply-To: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> References: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> Message-ID: Hi Paul! 2012/1/14, Paul Guyot : > Hello, > > Is anyone successfully using SSL distribution on production servers? > http://www.erlang.org/documentation/doc-5.9/lib/ssl-5.0/doc/html/ssl_distribution.html I do not know, but to my knowledge I have only heard of experimental use of the distribution over the old ssl-implementation and the new one is just out, you are early adopters I think. > While running a couple of nodes works properly on a development machine, we > have serious issues on a real production cluster. > Our nodes ping other nodes very early, before our applications are started. While erlang distribution over new ssl is better tested then erlang distribution over the old ssl implementation ever was the test are still fairly basic and we plan on implementing more test in the near future. The main goal for R15 was to be good enough to be able to get rid of old ssl. > We observed two serious issues: > - pinging another node randomly blocks indefinitely, whether the other node > is pingable or not (e.g. not over SSL or with a different cookie) ; There is one blocking problem that I know of that can happen when a none ssl node tries to contact an ssl node. If the nodename is fairly short the first message can be seen as the begining of a correct "ssl/tls"-packet and then it will wait for more data that never comes and the other end is waiting for the response for its first message. This can be fairly easily fixed by adding a check for the value of the first byte for handshake messages. We will be adding this for the next release. This has however not interfered with the legitimate nodes in our tests. > - after a while (after pings timeout), ssl_tls_dist_proxy just crashes. > > =ERROR REPORT==== 2012-01-13 16:48:58 === > ** Generic server ssl_tls_dist_proxy terminating > ** Last message in was {connect,IP,25669} <-- this is another SSL node > with the same cookie > ** When Server state == {state,{#Port<0.284>,#Port<0.285>}, > {<0.24.0>,<0.25.0>}} > ** Reason for termination == > ** {{badmatch,{error,badarg}}, > [{ssl_tls_dist_proxy,handle_call,3, > [{file,"ssl_tls_dist_proxy.erl"},{line,90}]}, > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]} > > The relevant code is the following: > > handle_call({connect, Ip, Port}, {From, _}, State) -> > Me = self(), > Pid = spawn_link(fun() -> setup_proxy(Ip, Port, Me) end), > receive > {Pid, go_ahead, LPort} -> > Res = {ok, Socket} = try_connect(LPort), > ok = gen_tcp:controlling_process(Socket, From), <---- line 90 > flush_old_controller(From, Socket), > {reply, Res, State}; > {Pid, Error} -> > {reply, Error, State} > end; > > The crash happens because From is no longer alive. > > For the record, this is master branch and the SSL parameters are the > following : > > -proto_dist inet_tls > -ssl_dist_opt > server_certfile /otp_root/ssl/${NODE_NAME}.pem > client_certfile /otp_root/ssl/${NODE_NAME}.pem > server_secure_renegotiate true > client_secure_renegotiate true > server_verify verify_peer > client_verify verify_peer > server_fail_if_no_peer_cert true > server_cacertfile /otp_root/ssl/ca.pem > client_cacertfile /otp_root/ssl/ca.pem > server_depth 2 > client_depth 2 > > Did we miss something obvious? I am not sure I (we) will look in to this, it is not suppose to just crash. I have not seen this before. Regards Ingela Erlang/OTP team - Ericsson AB From alttagil@REDACTED Mon Jan 16 12:10:49 2012 From: alttagil@REDACTED (Alexander Hudich) Date: Mon, 16 Jan 2012 15:10:49 +0400 Subject: [erlang-questions] dh_anon SSL connection failed Message-ID: <002e01ccd43f$816f1270$844d3750$@gmail.com> Spent all night trying to establish SSL connection from my Erlang program to Nagios NRPE service. This is kind of excerpt from check_nrpe code which connects just fine: SSL_library_init(); SSLeay_add_ssl_algorithms(); meth=SSLv23_client_method(); SSL_load_error_strings(); ctx=SSL_CTX_new(meth)); SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); result=my_tcp_connect(server_name,server_port,&sd); /* do SSL handshake */ if(result==STATE_OK && use_ssl==TRUE){ if((ssl=SSL_new(ctx))!=NULL){ SSL_CTX_set_cipher_list(ctx,"ADH"); SSL_set_fd(ssl,sd); rc=SSL_connect(ssl)); } } But I couldn't establish connection in any way. I always got an error: Erlang R16B (erts-5.10) [source] [64-bit] [smp:1:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.10 5> SockOpts. [{active,false}, {ssl_imp,old}, {verify,verify_none}, {ciphers,[{dh_anon,rc4_128,md5}, {dh_anon,des_cbc,sha}, {dh_anon,'3des_ede_cbc',sha}, {dh_anon,aes_128_cbc,sha}, {dh_anon,aes_256_cbc,sha}]}] 6> ssl:connect( Ip, 5666, SockOpts, infinity). =ERROR REPORT==== 16-Jan-2012::12:49:23 === SSL: hello: ssl_handshake.erl:885:Fatal error: handshake failure {error,esslconnect} Code in ssl_handshake.erl at line 885 is dec_hs( _, _ ) -> throw( ?ALERT_REC( ... ) ) What do you think is it possible to make this type of connection in Erlang? What else can I try or is it a bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: From demeshchuk@REDACTED Mon Jan 16 12:14:37 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Mon, 16 Jan 2012 15:14:37 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: On Mon, Jan 16, 2012 at 2:16 PM, Siri Hansen wrote: > Ok, I get it :) We need a way to specify one explicit directory for an > application!! Possible syntax: > > 1) On sys level: {explicit_app_dirs, [App1Dir]} > or > 2) On app level: {app,App1Name,[{incl_cond,include},{lib_dir,App1Dir}]} > > Any preference?? (I think I like the latter - but is there any reason not to > have this on app level?) Yes, the second one seems more solid. After all, what we really care about is applications list, not directories list. > > Maybe also let reltool search for multiple App1Dirs that are suffixed with > -Vsn (if basename(App1Dir)=:=App1Name) - and pick the latest?? Nice idea. In that case I'd go further and parse app versions out of the .app files and don't bind to the directory names. Also, maybe it's good to silently ignore applications with same versions and just add a single instance. > > /siri > > > > 2012/1/14 Dmitry Demeshchuk >> >> Here's another story. >> >> Again, I have a projects/ directory and tons of projects and libraries >> in it (most of them totally independent on the current project I'm >> trying to build). >> >> projects/ >> ? ? proj1/ >> ? ? proj2/ >> ? ? .... >> ? ? proj118/ >> ? ? my_project/ >> >> What I want is to exclude them from my_project/ release package (for >> obvious reasons). For now, the only way I see is to write in >> reltool.config: >> >> {incl_cond, exclude} >> >> Which means, I'll have to explicitly set the applications to include >> into the release. Okay, not a big deal, I can teach rebar to do that: >> gather all the deps that are listed in rebar.config, for each of them >> gather its dependencies too, and so on. Then, write explicit >> {incl_cond, include} conditions for them >> >> But wait, it's not working. Shoot, I have to set include conditions >> for internal Erlang applications as well. Apparently, syntax_tools and >> compiler are being used somewhere. And mochiweb is using crypto, >> inets, ssl, and public_key. >> >> But all I actually wanted to do here is just including my core >> application, my_project/, into release, along with dependencies. >> >> On Sat, Jan 14, 2012 at 2:10 PM, Dmitry Demeshchuk >> wrote: >> > Found another interesting problem with the approach we are discussing. >> > >> > Say, I have a folder where all my projects reside: >> > >> > projects/ >> > ? ?my_work_project/ >> > ? ?my_home_project/ >> > ? ?my_work_lib/ >> > ? ?my_home_lib/ >> > ? ?opensource_lib/ >> > >> > So, work project requires work lib and opensource lib, and home >> > project requires home lib and opensource lib: >> > >> > projects/ >> > ? ?my_work_project/ >> > ? ? ? ?deps/ >> > ? ? ? ? ? ?my_work_lib/ >> > ? ? ? ? ? ?opensource_lib/ >> > ? ?my_home_project/ >> > ? ? ? ? deps/ >> > ? ? ? ? ? ?my_home_lib/ >> > ? ? ? ? ? ?opensource_lib/ >> > ? ?my_work_lib/ >> > ? ?my_home_lib/ >> > ? ?opensource_lib/ >> > >> > >> > Now if I setup reltool.config, say, for the work project, like this: >> > >> > {lib_dirs, ["projects/my_work_project/deps", "projects"]}. >> > >> > during release package generation reltool will tell me: >> > >> > {"init terminating in do_boot","my_work_lib: Application version >> > clash. Multiple directories contains version \"1.0\"."} >> > >> > Because my_work_lib resides both in deps/ folder (cloned there by >> > rebar) and projects/ folder where I work on it. >> > And I will get the same error for opensource_lib. >> > >> > The only workaround I see is to compile my_work_lib and opensource_lib >> > that reside in projects/ and manually remove them from deps/. This >> > way, they will reside in only one place and won't cause conflicts. >> > >> > On Fri, Jan 13, 2012 at 8:20 PM, Dmitry Demeshchuk >> > wrote: >> >> Also, answering your last question: no, I'm not expecting reltool to >> >> automatically include deps (but this is a thing to consider, maybe >> >> it's not bad). I expect to be able to add a certain app dir, so >> >> reltool.config from my previous example will be something like this: >> >> >> >> {lib_dirs, ["../deps"]}. >> >> {explicit_lib_dirs, [".."]}. >> >> >> >> Thank you. >> >> >> >> On Fri, Jan 13, 2012 at 8:18 PM, Dmitry Demeshchuk >> >> wrote: >> >>> Here's a more certain example. >> >>> >> >>> >> >>> ========================================================================================= >> >>> >> >>> Say, I clone some repository from GitHub (say, gproc, like in my >> >>> example gist). Now I add some stuff to it and want to build a release. >> >>> Here's how it should look: >> >>> >> >>> some_dir/ >> >>> ? ?gproc/ >> >>> ? ? ? ?src/ >> >>> ? ? ? ?include/ >> >>> ? ? ? ?ebin/ >> >>> ? ? ? ?priv/ >> >>> ? ? ? ?deps/ >> >>> ? ? ? ?rel/ >> >>> ? ? ? ? ? reltool.config >> >>> ? ? ? ? ? files/ ? ? ?(this contains starting bash scripts, default >> >>> config file and so on) >> >>> ? ? ? ? ? gproc/ ? ? (this directory will be actually generated by >> >>> rebar when running "rebar generate"; in fact, most of its content is >> >>> generated by reltool) >> >>> ? ? ? ? ? ? ? ?erts-5.8.5/ >> >>> ? ? ? ? ? ? ? ?lib/ >> >>> ? ? ? ? ? ? ? ?priv/ >> >>> ? ? ? ? ? ? ? ?releases/ >> >>> >> >>> >> >>> So, my release will run from "rel/gproc". >> >>> >> >>> Now, if I generate a release upgrade to release 2.0, I make some >> >>> changes, do "rebar generate-appups && rebar generate-upgrade" and a >> >>> new release package is created: >> >>> >> >>> rel/gproc/releases/gproc-2.0.tar.gz >> >>> >> >>> Then I just remsh to my running node and install the new release using >> >>> release_handler. >> >>> >> >>> >> >>> ================================================================================ >> >>> >> >>> What I want here is to be independent from the top-level folder >> >>> (some_dir). Maybe I have more Erlang projects there, maybe just some >> >>> pictures, books and MongoDB logs, it can be anything. >> >>> >> >>> For now, the only thing I can do without doing anything with directory >> >>> structure is adding to reltool.config this: >> >>> >> >>> {lib_dirs, ["../.."]}. >> >>> >> >>> or in an absolute way: >> >>> >> >>> {lib_dirs, ["/home/me/some/path/some_dir"]}. >> >>> >> >>> >> >>> Does this make sense? >> >>> >> >>> On Fri, Jan 13, 2012 at 7:56 PM, Siri Hansen >> >>> wrote: >> >>>> Yes, we are definitely drifting away from the original problem. But I >> >>>> found >> >>>> it quite interesting also... :) >> >>>> >> >>>> Anyway - I'm not against introducing new functionality if it is >> >>>> needed - but >> >>>> I do believe in doing a good investigation in order to ensure (or at >> >>>> least >> >>>> attempt) the best possible solution. The problem for me was that I >> >>>> did not >> >>>> really understand the problem. I'm not sure if I still do (sorry!) - >> >>>> but >> >>>> I'll try to explain what I think you mean. Please correct me if >> >>>> (when) I'm >> >>>> wrong... ;) >> >>>> >> >>>> I think that what you suggest is to be able to point out one specific >> >>>> application directory instead of specifying one or more lib dirs. And >> >>>> the >> >>>> reason for this is that you have several applications stored under >> >>>> the same >> >>>> lib dir, which are not necessarily at all related to each other. And >> >>>> typically - for each core application (which forms the main >> >>>> functionality of >> >>>> a release), you have it's dependency applications stored in the deps >> >>>> directory under the core application itself.?Is this correct? >> >>>> >> >>>> How do you handle different version of the core app and of the dep >> >>>> apps? >> >>>> Could you give an example of this? e.g. >> >>>> >> >>>> lib/ >> >>>> ?? coreapp-1.0/ >> >>>> ?? ? ?src/ >> >>>> ?? ? ?ebin/ >> >>>> ?? ? ?include/ >> >>>> ?? ? ?priv/ >> >>>> ?? ? ?deps/ >> >>>> ?? ? ? ? app1-1.0/ >> >>>> ?? ? ? ? ? ? src >> >>>> ?? ? ? ? ? ? ebin >> >>>> ?? ? ? ... >> >>>> ?? coreapp-2.0/ >> >>>> ?? ? ?src/ >> >>>> ?? ? ?ebin/ >> >>>> ?? ? ?include/ >> >>>> ?? ? ?priv/ >> >>>> ?? ? ?deps/ >> >>>> ?? ? ? ? app1-1.1/ >> >>>> ?? ? ? ? ? ? src >> >>>> ?? ? ? ? ? ? ebin >> >>>> ?? ? ?... >> >>>> >> >>>> And, when specifying the explicit app dir, would you expect reltool >> >>>> to >> >>>> automatically include the deps directory in the selected coreapp-Vsn >> >>>> as a >> >>>> lib dir?? Or should there be a way to specify that also? >> >>>> >> >>>> I hope I'm not totally on the wrong track here... >> >>>> >> >>>> /siri >> >>>> >> >>>> >> >>>> 2012/1/13 Dmitry Demeshchuk >> >>>>> >> >>>>> Hi, Siri. >> >>>>> >> >>>>> I guess, we are moving away from the main conversation. >> >>>>> >> >>>>> Don't you think that it would be good to make reltool do the >> >>>>> required >> >>>>> job in a simpler way? The way we are discussing works in most cases, >> >>>>> but it's quite unclear for the people who aren't very familiar with >> >>>>> reltool. >> >>>>> >> >>>>> Using the existing functionalities to solve problems is often good, >> >>>>> but if the solution becomes complicated, maybe a new functionality >> >>>>> should be created instead. >> >>>>> >> >>>>> On Thu, Jan 12, 2012 at 6:47 PM, Siri Hansen >> >>>>> wrote: >> >>>>> > Ah... this is interesting... a missing test case maybe - but I'm >> >>>>> > not >> >>>>> > sure if >> >>>>> > it is a bug. >> >>>>> > >> >>>>> > What happens is that the duplicated module erl_parse causes erlson >> >>>>> > to >> >>>>> > become >> >>>>> > derived since a module with the same name is used by stdlib and >> >>>>> > several >> >>>>> > other applications. If it was only stdlib, then I guess reltool >> >>>>> > could >> >>>>> > make >> >>>>> > the assumption that the module to use is the one in the same >> >>>>> > application >> >>>>> > and >> >>>>> > thus never make erlson derived (because to this module, that is). >> >>>>> > However, >> >>>>> > since the module in this case is also used by other applications, >> >>>>> > this >> >>>>> > assumption is not that obvious. >> >>>>> > >> >>>>> > The easiest way to get around this right now is to be more >> >>>>> > specific in >> >>>>> > the >> >>>>> > config file to make sure that erlson (or only the erl_parse >> >>>>> > module) is >> >>>>> > excluded... e.g. by adding >> >>>>> > >> >>>>> > {app, erlson, [{incl_cond,exclude}]} or >> >>>>> > {app, erlson, [{mod,erl_parse,[{incl_cond,exclude}]}]} >> >>>>> > >> >>>>> > (The latter would allow erlson to be derived if any of it's other >> >>>>> > modules >> >>>>> > were used by other applications) >> >>>>> > >> >>>>> > Regards >> >>>>> > /siri >> >>>>> > >> >>>>> > 2012/1/12 Dmitry Demeshchuk >> >>>>> >> >> >>>>> >> Try running this gist: https://gist.github.com/1600020 >> >>>>> >> >> >>>>> >> reltool.config will reside in lib/gproc/rel/ >> >>>>> >> >> >>>>> >> Thank you. >> >>>>> >> >> >>>>> > >> >>>>> >> >>>>> >> >>>>> >> >>>>> -- >> >>>>> Best regards, >> >>>>> Dmitry Demeshchuk >> >>>> >> >>>> >> >>> >> >>> >> >>> >> >>> -- >> >>> Best regards, >> >>> Dmitry Demeshchuk >> >> >> >> >> >> >> >> -- >> >> Best regards, >> >> Dmitry Demeshchuk >> > >> > >> > >> > -- >> > Best regards, >> > Dmitry Demeshchuk >> >> >> >> -- >> Best regards, >> Dmitry Demeshchuk > > -- Best regards, Dmitry Demeshchuk From pguyot@REDACTED Mon Jan 16 14:06:43 2012 From: pguyot@REDACTED (Paul Guyot) Date: Mon, 16 Jan 2012 14:06:43 +0100 Subject: [erlang-questions] SSL distribution fixes (was: Re: SSL distribution issues) In-Reply-To: References: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> Message-ID: Le 16 janv. 2012 ? 10:15, Ingela Andin a ?crit : > There is one blocking problem that I know of that can happen when > a none ssl node tries to contact an ssl node. If the nodename is > fairly short the first message can be seen as the begining of a > correct "ssl/tls"-packet and then it will wait for more data that > never comes and the other end is waiting for the response for its > first message. This can be fairly easily fixed by adding a check > for the value of the first byte for handshake messages. We will > be adding this for the next release. This has however not > interfered with the legitimate nodes in our tests. This probably is what happens. The other bug I saw is that the client can timeout (using dist_utils:timer) while the proxy doesn't handle this. What is the rationale behind the use of the proxy? Isn't it related to the old implementation of SSL? Eventually, we are running a cluster with currently a dozen nodes using the new implementation and the following fixes: - the proxy is made more robust to a death of the caller (the crash I reported, typically after a timeout); - inet_tls_dist:setup/5 now links the process just like what inet_tcp_dist:setup/5 does (I also set the priority to maximum like inet_tcp_dist does); - #hs_data.f_address function was updated to handle the case where the node disappeared, just like inet_tcp_dist does as well. This was done by exporting get_tcp_address from ssl_tls_dist_proxy and changing its return type. Besides, the proxy is now running on the loopback interface only (the sockets listen on {127,0,0,1}) as it is not meant to be connected from another node, from what I understand... The patch can be found here: https://github.com/pguyot/otp/compare/ssl_dist-fixes git fetch git://github.com/pguyot/otp.git ssl_dist-fixes Paul -- Semiocast http://semiocast.com/ +33.183627948 - 20 rue Lacaze, 75014 Paris From jamie@REDACTED Mon Jan 16 14:13:15 2012 From: jamie@REDACTED (Jamie Brandon) Date: Mon, 16 Jan 2012 13:13:15 +0000 Subject: [erlang-questions] mnesia:dirty_update_counter returns 'ok' in R14B04 Message-ID: The docs state that mnesia:dirty_update_counter should return NewVal (http://www.erlang.org/documentation/doc-5.8.5/lib/mnesia-4.5/doc/html/mnesia.html#dirty_update_counter-2). In fact, I get: (smarkets@REDACTED)7> mnesia:dirty_read(external_eid, all). [{external_eid,all,3235}] (smarkets@REDACTED)8> mnesia:dirty_update_counter(external_eid, all, 1). ok (smarkets@REDACTED)9> mnesia:dirty_read(external_eid, all). [{external_eid,all,3236}] This is not particularly helpful :-| Can anyone shed any light on this? The table is created with default options. From toby@REDACTED Mon Jan 16 14:54:40 2012 From: toby@REDACTED (Toby Thain) Date: Mon, 16 Jan 2012 08:54:40 -0500 Subject: [erlang-questions] error in hipe_ppc_bifs.S - building R15B on OS X 10.4.11 Message-ID: <4F142C20.9030108@telegraphics.com.au> Is this known to be broken? After a plain ./configure; make of otp_src_R15B: powerpc-apple-darwin8.11.0/opt/smp/hipe_ppc_bifs.S:457:Parameter syntax error (parameter 3) ...and hundreds more occurrences. --Toby From ingela@REDACTED Mon Jan 16 14:56:19 2012 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 16 Jan 2012 14:56:19 +0100 Subject: [erlang-questions] [erlang-patches] SSL distribution fixes In-Reply-To: References: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> Message-ID: <4F142C83.7020406@erix.ericsson.se> Hi Paul! Paul Guyot wrote: > Le 16 janv. 2012 ? 10:15, Ingela Andin a ?crit : > > >> There is one blocking problem that I know of that can happen when >> > > >> a none ssl node tries to contact an ssl node. If the nodename is >> fairly short the first message can be seen as the begining of a >> correct "ssl/tls"-packet and then it will wait for more data that >> never comes and the other end is waiting for the response for its >> first message. This can be fairly easily fixed by adding a check >> for the value of the first byte for handshake messages. We will >> be adding this for the next release. This has however not >> interfered with the legitimate nodes in our tests. >> > > This probably is what happens. The other bug I saw is that the client can timeout (using dist_utils:timer) while the proxy doesn't handle this. > > What is the rationale behind the use of the proxy? Isn't it related to the old implementation of SSL? > > We want to avoid having a driver. > Eventually, we are running a cluster with currently a dozen nodes using the new implementation and the following fixes: > - the proxy is made more robust to a death of the caller (the crash I reported, typically after a timeout); > - inet_tls_dist:setup/5 now links the process just like what inet_tcp_dist:setup/5 does (I also set the priority to maximum like inet_tcp_dist does); > - #hs_data.f_address function was updated to handle the case where the node disappeared, just like inet_tcp_dist does as well. This was done by exporting get_tcp_address from ssl_tls_dist_proxy and changing its return type. > > Besides, the proxy is now running on the loopback interface only (the sockets listen on {127,0,0,1}) as it is not meant to be connected from another node, from what I understand... > > I think the changes are sound. > The patch can be found here: > https://github.com/pguyot/otp/compare/ssl_dist-fixes > git fetch git://github.com/pguyot/otp.git ssl_dist-fixes > > Paul > Henrik has/will include it in pu. Regards Ingela Erlang/OTP team - Ericsson AB From emeka_1978@REDACTED Mon Jan 16 15:18:07 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 16 Jan 2012 06:18:07 -0800 (PST) Subject: [erlang-questions] firewall traversal Message-ID: <05d9065c-9da3-47f0-9dff-8115aa898d34@f11g2000yql.googlegroups.com> How do i send packets through a firewall in erlang? I can't seem to find a way to specify the proxyhost/proxyport on the socket options. Is there such thing? From ingela.andin@REDACTED Mon Jan 16 15:19:47 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Mon, 16 Jan 2012 15:19:47 +0100 Subject: [erlang-questions] dh_anon SSL connection failed In-Reply-To: <002e01ccd43f$816f1270$844d3750$@gmail.com> References: <002e01ccd43f$816f1270$844d3750$@gmail.com> Message-ID: Hi Alexander! 2012/1/16, Alexander Hudich : > Spent all night trying to establish SSL connection from my Erlang program to > Nagios NRPE service. > > This is kind of excerpt from check_nrpe code which connects just fine: > > SSL_library_init(); > > SSLeay_add_ssl_algorithms(); > > meth=SSLv23_client_method(); > > SSL_load_error_strings(); > > ctx=SSL_CTX_new(meth)); > > SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); > > result=my_tcp_connect(server_name,server_port,&sd); > > /* do SSL handshake */ > > if(result==STATE_OK && use_ssl==TRUE){ > > if((ssl=SSL_new(ctx))!=NULL){ > > SSL_CTX_set_cipher_list(ctx,"ADH"); > > SSL_set_fd(ssl,sd); > > rc=SSL_connect(ssl)); > > } > > } > What cipher suite and SSL/TLS-protocol version will this code end up using? > > But I couldn't establish connection in any way. I always got an error: > > Erlang R16B (erts-5.10) [source] [64-bit] [smp:1:1] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.10 > > > > 5> SockOpts. > > [{active,false}, > > {ssl_imp,old}, This is not a relevant option after R15B ( it will always be new even if you write old). > > {verify,verify_none}, > > {ciphers,[{dh_anon,rc4_128,md5}, > > {dh_anon,des_cbc,sha}, > > {dh_anon,'3des_ede_cbc',sha}, > > {dh_anon,aes_128_cbc,sha}, > > {dh_anon,aes_256_cbc,sha}]}] > > 6> ssl:connect( Ip, 5666, SockOpts, infinity). > > > > =ERROR REPORT==== 16-Jan-2012::12:49:23 === > > SSL: hello: ssl_handshake.erl:885:Fatal error: handshake failure > > {error,esslconnect} > > Code in ssl_handshake.erl at line 885 is > > dec_hs( _, _ ) -> > > throw( ?ALERT_REC( ... ) ) > > > > What do you think is it possible to make this type of connection in Erlang? > What else can I try or is it a bug? Our test cases for anonymous suites works just fine. Have you tried running the test case anonymous_cipher_suites in ssl_basic_SUITE? Servers will normally not support anonymous cipher suites and we include them only for test purposes and they may only be used if explicitly supplied. Regards Ingela Erlang/OTP team - Ericsson AB From pguyot@REDACTED Mon Jan 16 15:21:38 2012 From: pguyot@REDACTED (Paul Guyot) Date: Mon, 16 Jan 2012 15:21:38 +0100 Subject: [erlang-questions] [erlang-patches] SSL distribution fixes In-Reply-To: <4F142C83.7020406@erix.ericsson.se> References: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> <4F142C83.7020406@erix.ericsson.se> Message-ID: Le 16 janv. 2012 ? 14:56, Ingela Anderton Andin a ?crit : >> This probably is what happens. The other bug I saw is that the client can timeout (using dist_utils:timer) while the proxy doesn't handle this. >> >> What is the rationale behind the use of the proxy? Isn't it related to the old implementation of SSL? >> >> > We want to avoid having a driver. Ingela, Thank you for your replies. I still do not fully understand the way distribution over TLS works. I've just read in the (old) documentation that proto_dist requires a driver. Is this such a driver that you try to avoid? Is inet_ssl_dist using the same driver as inet_tcp_dist and hence requires a proxy? Is this why inet_tls_dist cannot use ssl:send/2 and ssl:recv/3 as f_recv and f_send handlers (lines 244 and 248)? > Henrik has/will include it in pu. Great! Paul -- Semiocast http://semiocast.com/ +33.183627948 - 20 rue Lacaze, 75014 Paris From chandu.gokul138@REDACTED Mon Jan 16 15:41:11 2012 From: chandu.gokul138@REDACTED (Gokul Evuri) Date: Mon, 16 Jan 2012 15:41:11 +0100 Subject: [erlang-questions] Code/Hot/Loading Message-ID: so for instance f() -> 3. x() -> F = fun() -> f() end, A = f(), B = ?MODULE:f(), C = F(). right after F hash been defined, a new version of code for f() is defined as follows f()-> threeand loaded. What would be the value of C. -- *Gokul Reddy Evuri,* *IT Universitet **G?teborg**,* *G?teborg,* *Sverige.* -------------- next part -------------- An HTML attachment was scrubbed... URL: From icfp.publicity@REDACTED Mon Jan 16 16:30:15 2012 From: icfp.publicity@REDACTED (Wouter Swierstra) Date: Mon, 16 Jan 2012 16:30:15 +0100 Subject: [erlang-questions] ICFP 2012 Call for papers Message-ID: ===================================================================== ICFP 2012: International Conference on Functional Programming Copenhagen, Denmark, September 9 - 15, 2012 http://www.icfpconference.org/icfp2012 ===================================================================== Important Dates ~~~~~~~~~~~~~~~ Submissions due: Monday Mar 12, 2012 14:00 UTC Author response: Monday May 07, 2012 14:00 UTC - May 9 14:00 UTC Notification: Monday May 28, 2012 Final copy due: Monday Jul 02, 2012 Scope ~~~~~ ICFP 2012 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, and from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects, concurrency, or parallelism. Topics of interest include (but are not limited to): * Language Design: concurrency and distribution; modules; components and composition; metaprogramming; interoperability; type systems; relations to imperative, object-oriented, or logic programming * Implementation: abstract machines; virtual machines; interpretation; compilation; compile-time and run-time optimization; memory management; multi-threading; exploiting parallel hardware; interfaces to foreign functions, services, components, or low-level machine resources * Software-Development Techniques: algorithms and data structures; design patterns; specification; verification; validation; proof assistants; debugging; testing; tracing; profiling * Foundations: formal semantics; lambda calculus; rewriting; type theory; monads; continuations; control; state; effects; program verification; dependent types * Analysis and Transformation: control-flow; data-flow; abstract interpretation; partial evaluation; program calculation * Applications and Domain-Specific Languages: symbolic computing; formal-methods tools; artificial intelligence; systems programming; distributed-systems and web programming; hardware design; databases; XML processing; scientific and numerical computing; graphical user interfaces; multimedia programming; scripting; system administration; security * Education: teaching introductory programming; parallel programming; mathematical proof; algebra * Functional Pearls: elegant, instructive, and fun essays on functional programming * Experience Reports: short papers that provide evidence that functional programming really works or describe obstacles that have kept it from working If you are concerned about the appropriateness of some topic, do not hesitate to contact the program chair. Abbreviated instructions for authors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * By March 12 2012, 14:00 UTC, submit a full paper of at most 12 pages (6 pages for an Experience Report), including bibliography and figures. The deadlines will be strictly enforced and papers exceeding the page limits will be summarily rejected. * Authors have the option to attach supplementary material to a submission, on the understanding that reviewers may choose not to look at it. * Each submission must adhere to SIGPLAN's republication policy, as explained on the web at http://www.acm.org/sigplan/republicationpolicy.htm * Authors of resubmitted (but previously rejected) papers have the option to attach an annotated copy of the reviews of their previous submission(s), explaining how they have addressed these previous reviews in the present submission. If a reviewer identifies him/herself as a reviewer of this previous submission and wishes to see how his/her comments have been addressed, the program chair will communicate to this reviewer the annotated copy of his/her previous review. Otherwise, no reviewer will read the annotated copies of the previous reviews. Overall, a submission will be evaluated according to its relevance, correctness, significance, originality, and clarity. It should explain its contributions in both general and technical terms, clearly identifying what has been accomplished, explaining why it is significant, and comparing it with previous work. The technical content should be accessible to a broad audience. Functional Pearls and Experience Reports are separate categories of papers that need not report original research results and must be marked as such at the time of submission. Detailed guidelines on both categories are on the conference web site. Proceedings will be published by ACM Press. Authors of accepted submissions are expected to transfer the copyright to the ACM. Presentations will be videotaped and released online if the presenter consents. Formatting: Submissions must be in PDF format printable in black and white on US Letter sized paper and interpretable by Ghostscript. If this requirement is a hardship, make contact with the program chair at least one week before the deadline. Papers must adhere to the standard ACM conference format: two columns, nine-point font on a ten-point baseline, with columns 20pc (3.33in) wide and 54pc (9in) tall, with a column gutter of 2pc (0.33in). A suitable document template for LaTeX is available: http://www.acm.org/sigs/sigplan/authorInformation.htm Submission: Submissions will be accepted only online via the ICFP website. Improved versions of a paper may be submitted at any point before the submission deadline using the same web interface. Author response: Authors will have a 48-hour period, starting at 14:00 UTC on Monday May 7th 2012, to read reviews and respond to them. Special Journal Issue: There will be a special issue of the Journal of Functional Programming with papers from ICFP 2012. The program committee will invite the authors of select accepted papers to submit a journal version to this issue. Conference Chair: Peter Thiemann, University of Freiburg Program Chair: Robby Findler, Northwestern University Program Committee: Andreas Rossberg, Google Andrew Tolmach, Portland State University Brigitte Pientka, McGill University Colin Runciman, University of York Eijiro Sumii, Tohoku University Jan Midtgaard, Aarhus University John Hughes, Chalmers University of Technology and Quviq AB Lars Birkedal, IT University of Copenhagen Manuel F?hndrich, Microsoft Research Mariangiola Dezani-Ciancaglini, University of Turin Matthias Blume, Google R. Kent Dybvig, Cisco and Indiana University Sam Tobin-Hochstadt, Northeastern University Satnam Singh, Google Research Simon Marlow, Microsoft Research Zena M. Ariola, University of Oregon From mail@REDACTED Mon Jan 16 17:28:53 2012 From: mail@REDACTED (Tim Fletcher) Date: Mon, 16 Jan 2012 08:28:53 -0800 (PST) Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: > Does it bother you that some of your code looks like this? No, because it doesn't :) Same issue mentioned here: http://damienkatz.net/2008/03/what_sucks_abou.html The problem disappears if you use a functional programming style instead of an imperative programming style. The first example could be rewritten as this: F = fun (List) -> lists:map(fun (X) -> ... end, List) end G = fun (List) -> lists:filter(fun (X) -> ... end, List) end G(F(L)) Admittedly that's not much more readable, but the problem no longer exists. Realistically you'd probably extract those functions fully, leaving something like this: foo(bar(L)) Much easier to read and understand. Ignoring the obtuse function name in the second example, I can't see why an "accessor" function should need to return state. So hypothetically, if the cowboy_http_req module had an API similar to the proplists module, you'd be able to write something like this instead: Q = cowboy_http_req:get_value(<<"q">>, Request) Id = cowboy_http_req:get_value(<<"id">>, Request) Again, the problem no longer exists! Cheers, Tim From leonard.boyce@REDACTED Mon Jan 16 17:32:08 2012 From: leonard.boyce@REDACTED (Leonard Boyce) Date: Mon, 16 Jan 2012 11:32:08 -0500 Subject: [erlang-questions] rabbit, epmd and bonded interfaces woes In-Reply-To: <20120113220520.GA2191@ecn.lan> References: <4161289.ErBAafFudA@captmarvel.usethesource.net> <4072007.ipCyBbqyXL@captmarvel.usethesource.net> <20120113220520.GA2191@ecn.lan> Message-ID: <2251682.cBdnFFXYBq@captmarvel.usethesource.net> On Friday, January 13, 2012 05:05:20 PM Michael Santos wrote: > I remember someone had a similar issue that cleared up after a reboot. > Might want to try that, if you haven't already. Hi Michael, Embarrassed to say this was a total PEBKAC issue. Had some iptables rules for forwarding private network traffic out over the public interface which were catching the erlang connections. Thanks for the advise though, Leonard --- From jwatte@REDACTED Mon Jan 16 18:24:23 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 16 Jan 2012 09:24:23 -0800 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: Is this an artifact of the current implementation? Semantically, I don't see why a sufficiently smart VM wouldn't be able to collect the binary at that point. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. 2012/1/13 Bj?rn-Egil Dahlberg > Den 13 januari 2012 23:11 skrev Max Lapshin : > > I thought, that calling gc will be a problem: >> >> >> A = crypto:rand_bytes(1024*1024*1024), >> erlang:garbagecollect(), >> {reply, ok, State} >> >> >> Will gc free A? I think that no, because A is still used in the place, >> where gc is called. Am I right? >> > > Correct. > > To be a little technical (and don't take this as an absolute truth in the > details), > What we see here is "A is referencing a large binary", which is true. What > happens internally is that Eterm A is a boxed pointer from the stack or a > register which points to a ProcBin on the heap. The ProcBin in turn holds > an increment of a Reference counted binary off heap. Both the stack and the > registers will become part of the root set during the garbage collection > hence letting the binary be reachable and therefore "live". I believe that > you need leave the function (release the stack) in order to free your > binary. > > A gc without the A in the stack will not let the ProcBin survive during > the copy phase of the gc. When the ProcBin is removed the RefcBinary will > decrement and if it reaches zero, i.e. the last ProcBin has died, that too > will be removed. > > // Bj?rn-Egil > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Mon Jan 16 18:31:38 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 16 Jan 2012 09:31:38 -0800 Subject: [erlang-questions] Code/Hot/Loading In-Reply-To: References: Message-ID: Funs are always bound to the code they are initially loaded from. Only name look-ups are affected by code loading AFAICT. This has been a source of exceptions in our previous development, because the first time you load new code, F is still valid, but the second time you load new code, the old code is purged and F is now invalid. Any call to it will generate an exception. We ended up wrapping our needs for lambdas in a module with state instead. Not the most elegant, but allows us to get "dynamic lambdas." If all you need in the fun is module:function, you can use a tuple for that instead of a fun. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Mon, Jan 16, 2012 at 6:41 AM, Gokul Evuri wrote: > so for instance > > f() -> 3. > x() -> F = fun() -> f() end, > A = f(), > B = ?MODULE:f(), > C = F(). > > right after F hash been defined, > > a new version of code for f() is defined as follows > > f()-> threeand loaded. > > What would be the value of C. > > -- > *Gokul Reddy Evuri,* > *IT Universitet **G?teborg**,* > *G?teborg,* > *Sverige.* > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Mon Jan 16 18:33:36 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 16 Jan 2012 09:33:36 -0800 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: When I write code like that (instead of just inlining all the arguments like a good functional programmer), I do that because I want to be able to inspect L1 and L2 in the debugger. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Sat, Jan 14, 2012 at 11:54 AM, Yurii Rashkovskii wrote: > Hi, > > Problem > ------- > > Does it bother you that some of your code looks like this? > > ```erlang > L1 = lists:map(fun (X) -> ... end, L), > L2 = lists:filter(fun (X) -> ... end, L1) > %% or > {Q,Req1} = cowboy_http_req:qs_val(<<"q">>,Req), > {Id,Req2} = cowboy_http_req:qs_val(<<"id">>,Req1) > ``` > > Solution > ------------ > > You can find out about it at https://github.com/spawngrid/seqbind > > Thanks, > Yurii. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Mon Jan 16 18:47:38 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 16 Jan 2012 11:47:38 -0600 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: > > When I write code like that (instead of just inlining all the arguments > like a good functional programmer), I do that because I want to be able to > inspect L1 and L2 in the debugger. Agreed. But its also a problem of Erlang verbosity as compared to say: map (1+) $ filter (== 2) [1,2,3,4,2] Sometimes its clearer in Erlang to use the sequence method of L1, L2, etc simply so what is happening is more clear then defining a number of anonymous functions or doing: lists:map(fun(X) -> X +1 end, lists:filter(fun(X) -> X == 2 end, List) or [X + 1 || X <- lists:filter(fun(X) -> X == 2 end, List)] Though, my real favorite solution may be for Erlang to be able to do: modify_list(List) -> G(H(List) where G(List) -> lists:map(fun(X) -> X +1 end, List); H(List) -> lists:filter(fun(X) -> X == 2 end, List) end end Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Jan 16 18:57:25 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 16 Jan 2012 18:57:25 +0100 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: <4F146505.3020602@ninenines.eu> On 01/16/2012 05:28 PM, Tim Fletcher wrote: > Ignoring the obtuse function name in the second example, I can't see > why an "accessor" function should need to return state. So > hypothetically, if the cowboy_http_req module had an API similar to > the proplists module, you'd be able to write something like this > instead: > > Q = cowboy_http_req:get_value(<<"q">>, Request) > Id = cowboy_http_req:get_value(<<"id">>, Request) > > Again, the problem no longer exists! The example is a bit wrong as it's not just accessors that return the Req (get_value doesn't actually exist) and so you do end up having more than one Req in the end when you read the request body or send a reply anyway. Also, accessors return the state because Cowboy doesn't try to parse or read anything from the socket if it doesn't have to. That means body, query string, cookies and so on aren't parsed until you need them, saving resources in the process at the expense of a few more characters to write. -- Lo?c Hoguin Erlang Cowboy Nine Nines From yrashk@REDACTED Mon Jan 16 19:03:45 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Mon, 16 Jan 2012 10:03:45 -0800 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: Jon, This is a good & valid concern. WIth this use case in mind, I just added seqbind:i/3 (M,F,A) helper that can be used to print out function-in-question's source code interactively with all sequential bindings renamed so that they can be easily matched to those you can use in the debugger. On Mon, Jan 16, 2012 at 9:33 AM, Jon Watte wrote: > When I write code like that (instead of just inlining all the arguments like > a good functional programmer), I do that because I want to be able to > inspect L1 and L2 in the debugger. > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > On Sat, Jan 14, 2012 at 11:54 AM, Yurii Rashkovskii > wrote: >> >> Hi, >> >> Problem >> ------- >> >> Does it bother you that some of your code looks like this? >> >> ```erlang >> ?L1 = lists:map(fun (X) -> ... end, L), >> ?L2 = lists:filter(fun (X) -> ... end, L1) >> ?%% or >> ?{Q,Req1} = cowboy_http_req:qs_val(<<"q">>,Req), >> ?{Id,Req2} = cowboy_http_req:qs_val(<<"id">>,Req1) >> ``` >> >> Solution >> ------------ >> >> You can find out about it at https://github.com/spawngrid/seqbind >> >> Thanks, >> Yurii. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From tristan.sloughter@REDACTED Mon Jan 16 19:05:08 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 16 Jan 2012 12:05:08 -0600 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: <4F146505.3020602@ninenines.eu> References: <4F146505.3020602@ninenines.eu> Message-ID: > > Q = cowboy_http_req:get_value(<<"**q">>, Request) >> Id = cowboy_http_req:get_value(<<"**id">>, Request) >> > I was confused by the pass back of Request myself. I started using Cowboy yesterday and wasn't sure if I needed to continue to pass the new Req variable on down like: {Q, R1} = cowboy_http_req:get_value(<<"**q">>, R), {Id, R2} = cowboy_http_req:get_value(<<"id">>, R1) And then return that R2 at the end of the function with the return tuple. 1) Do you? 2) "Again, the problem no longer exists!" -- What did that mean? Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Jan 16 19:09:51 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 16 Jan 2012 19:09:51 +0100 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: <4F146505.3020602@ninenines.eu> Message-ID: <4F1467EF.1010301@ninenines.eu> On 01/16/2012 07:05 PM, Tristan Sloughter wrote: > Q = cowboy_http_req:get_value(<<"__q">>, Request) > Id = cowboy_http_req:get_value(<<"__id">>, Request) > > > I was confused by the pass back of Request myself. I started using > Cowboy yesterday and wasn't sure if I needed to continue to pass the new > Req variable on down like: > > {Q, R1} = cowboy_http_req:get_value(<<"__q">>, R), > {Id, R2} = cowboy_http_req:get_value(<<"id">>, R1) > > And then return that R2 at the end of the function with the return tuple. > > 1) Do you? You do. > 2) "Again, the problem no longer exists!" -- What did that mean? That was a quote from the previous email from Tim. :) -- Lo?c Hoguin Erlang Cowboy Nine Nines From jack@REDACTED Mon Jan 16 19:11:07 2012 From: jack@REDACTED (Jack Moffitt) Date: Mon, 16 Jan 2012 11:11:07 -0700 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: <4F146505.3020602@ninenines.eu> Message-ID: This reminds me a lot of the threading macros in Clojure. I like them a lot. (-> ....) and (->> ....) The first will take the result of the evaluation of a form and pass it as the first argument of hte next form, and so on. The ->> version passes the result as the last argument of the form. It's very convenient. Unfortunately, I don't think this Erlang version is syntactically better enough to tempt me. jack. From alttagil@REDACTED Mon Jan 16 19:13:15 2012 From: alttagil@REDACTED (Alexander Hudich) Date: Mon, 16 Jan 2012 22:13:15 +0400 Subject: [erlang-questions] dh_anon SSL connection failed In-Reply-To: References: <002e01ccd43f$816f1270$844d3750$@gmail.com> Message-ID: <005b01ccd47a$84fd4070$8ef7c150$@gmail.com> Hi, Ingela! >> This is kind of excerpt from check_nrpe code which connects just fine: >> >>SSL_library_init(); >>SSLeay_add_ssl_algorithms(); >>meth=SSLv23_client_method(); >>SSL_load_error_strings(); >>ctx=SSL_CTX_new(meth)); >>SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); >>result=my_tcp_connect(server_name,server_port,&sd); >> >> /* do SSL handshake */ >> >> if(result==STATE_OK && use_ssl==TRUE){ >> if((ssl=SSL_new(ctx))!=NULL){ >> SSL_CTX_set_cipher_list(ctx,"ADH"); >> SSL_set_fd(ssl,sd); >> rc=SSL_connect(ssl)); >> } >>} > What cipher suite and SSL/TLS-protocol version will this code end up using? I have not very much experience in development with using SSL connections. So I don't know if I've done it's right I added this line after SSL_connect to get current information about established SSL connection in check_nrpe: printf( "CIPHER %s %s\n", SSL_CIPHER_get_name( SSL_get_current_cipher(ssl) ), SSL_CIPHER_get_version( SSL_get_current_cipher(ssl) ) ); And it gives: CIPHER ADH-AES256-SHA TLSv1/SSLv3 Also I tried to change SSLv23_client_method() call to SSLv3_client_method(). And that gave very interesting result: CHECK_NRPE: Error - Could not complete SSL handshake. SSL_connect=0 36071:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1102:SSL alert number 40 That looks pretty similar to what I get with a result that erlang ssl:connect call returns. >> Erlang R16B (erts-5.10) [source] [64-bit] [smp:1:1] [async-threads:0] >> [hipe] [kernel-poll:false] >> 5> SockOpts. >> [{active,false}, >> {ssl_imp,old}, >This is not a relevant option after R15B ( it will always be new even if you write old). Yes I know that, it was just an act of despair :) >> {verify,verify_none}, >> {ciphers,[{dh_anon,rc4_128,md5}, >> {dh_anon,des_cbc,sha}, >> {dh_anon,'3des_ede_cbc',sha}, >> {dh_anon,aes_128_cbc,sha}, >> {dh_anon,aes_256_cbc,sha}]}] >> >> 6> ssl:connect( Ip, 5666, SockOpts, infinity). >> >> =ERROR REPORT==== 16-Jan-2012::12:49:23 === >> SSL: hello: ssl_handshake.erl:885:Fatal error: handshake failure >> {error,esslconnect} >> What do you think is it possible to make this type of connection in Erlang? >> What else can I try or is it a bug? > Our test cases for anonymous suites works just fine. Have you tried running the test case anonymous_cipher_suites in ssl_basic_SUITE? How can I do that? > Servers will normally not support anonymous cipher suites and we include them only for test purposes and they may only be used if explicitly supplied. I thought that I explicitly pointed to use that anonymous ciphers by supplying them in connection options. Or there is something else I should do? >Regards Ingela Erlang/OTP team - Ericsson AB From mail@REDACTED Mon Jan 16 19:29:18 2012 From: mail@REDACTED (Tim Fletcher) Date: Mon, 16 Jan 2012 10:29:18 -0800 (PST) Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: References: Message-ID: > Sometimes its clearer in Erlang to use the sequence method of L1, L2, etc > simply so what is happening is more clear then defining a number of > anonymous functions or doing: > > lists:map(fun(X) -> X +1 end, lists:filter(fun(X) -> X == 2 end, List) I agree that's not particularly clear. I also find the sequencing unclear because you manually have to trace the variables through the functions. Here are two relatively compact expressions: map(fun plus_one/1, filter(fun equals_two/1, List)) [plus_one(X) || X <- List, equals_two(X)] I can understand adding variables for debugging, but I don't see how adding variables makes either of those clearer. Tim From mail@REDACTED Mon Jan 16 19:37:52 2012 From: mail@REDACTED (Tim Fletcher) Date: Mon, 16 Jan 2012 10:37:52 -0800 (PST) Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: <4F146505.3020602@ninenines.eu> References: <4F146505.3020602@ninenines.eu> Message-ID: <255933ea-e243-4cbb-a332-868b64186ea4@v14g2000vbc.googlegroups.com> > Also, accessors return the state because Cowboy doesn't try to parse or > read anything from the socket if it doesn't have to. That means body, > query string, cookies and so on aren't parsed until you need them, > saving resources in the process at the expense of a few more characters > to write. I see, but it's not *just* the extra characters, there's the mental overhead of having to remember to thread the state through, and there's the added complexity of the lazy parsing/reading which could be harder to debug. Whether that's a good trade-off for performance I don't know, but IMO it's not an API that would be easy to use. Cheers, Tim From watson.timothy@REDACTED Mon Jan 16 19:55:58 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 16 Jan 2012 18:55:58 +0000 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: <255933ea-e243-4cbb-a332-868b64186ea4@v14g2000vbc.googlegroups.com> References: <4F146505.3020602@ninenines.eu> <255933ea-e243-4cbb-a332-868b64186ea4@v14g2000vbc.googlegroups.com> Message-ID: On 16 January 2012 18:37, Tim Fletcher wrote: > > Also, accessors return the state because Cowboy doesn't try to parse or > > read anything from the socket if it doesn't have to. That means body, > > query string, cookies and so on aren't parsed until you need them, > > saving resources in the process at the expense of a few more characters > > to write. > > I see, but it's not *just* the extra characters, there's the mental > overhead of having to remember to thread the state through, and > there's the added complexity of the lazy parsing/reading which could > be harder to debug. Whether that's a good trade-off for performance I > don't know, but IMO it's not an API that would be easy to use. > > This conversation reminds me of the erlando parse_transform and its do-notation: http://www.erlang-factory.com/upload/presentations/435/MatthewSackman.pdf. That, in turn, reminds me of several enormous threads about how the syntax could/should change or be improved upon. There are also one or two outstanding EEPs regarding this issue. Personally I find pulling things out into an Explaining Function removes a lot of the tedium, at least for the reader, if not the author of the code. Like Joel, I'm a bit of a fanatical in-liner, but I also know people who *swear* by having an Explaining Variable for ever last bit of intermediate state. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Mon Jan 16 20:17:18 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 16 Jan 2012 13:17:18 -0600 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: <4F1467EF.1010301@ninenines.eu> References: <4F146505.3020602@ninenines.eu> <4F1467EF.1010301@ninenines.eu> Message-ID: > 1) Do you? >> > > You do. > > > 2) "Again, the problem no longer exists!" -- What did that mean? >> > > That was a quote from the previous email from Tim. :) Ah... I was hoping the quote meant in newer Cowboy you no longer needed to do this. Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Jan 16 20:25:27 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 16 Jan 2012 20:25:27 +0100 Subject: [erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental) In-Reply-To: <255933ea-e243-4cbb-a332-868b64186ea4@v14g2000vbc.googlegroups.com> References: <4F146505.3020602@ninenines.eu> <255933ea-e243-4cbb-a332-868b64186ea4@v14g2000vbc.googlegroups.com> Message-ID: <4F1479A7.3030100@ninenines.eu> On 01/16/2012 07:37 PM, Tim Fletcher wrote: >> Also, accessors return the state because Cowboy doesn't try to parse or >> read anything from the socket if it doesn't have to. That means body, >> query string, cookies and so on aren't parsed until you need them, >> saving resources in the process at the expense of a few more characters >> to write. > > I see, but it's not *just* the extra characters, there's the mental > overhead of having to remember to thread the state through, and > there's the added complexity of the lazy parsing/reading which could > be harder to debug. Whether that's a good trade-off for performance I > don't know, but IMO it's not an API that would be easy to use. Well the most interesting case is when receiving a POST body of a few megabytes that you may not even want to read, Cowboy doesn't read it from the socket until you tell it to, saving both time and memory in cases where you don't actually need that body. Same goes for query string/headers/cookies parsing and so on. Whether the trade-off is good is debatable of course, and thankfully for the people annoyed by Req1 Req2 Req3 all over the place there's now this parse transform available. But I haven't had much negative feedback about that. You might also note that it's actually not that different than having a State#state{} variable in a gen_server and modifying then returning it, which is something people are quite used to do anyway. -- Lo?c Hoguin Erlang Cowboy Nine Nines From wallentin.dahlberg@REDACTED Mon Jan 16 20:34:45 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Mon, 16 Jan 2012 20:34:45 +0100 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: Den 16 januari 2012 18:24 skrev Jon Watte : > Is this an artifact of the current implementation? > Semantically, I don't see why a sufficiently smart VM wouldn't be able to > collect the binary at that point. > Hmm, yes, I did not answer correctly to the example. (Bad teacher) "A" isn't used in the above example so it will be garbed. Let me show you by example what I mean. -module(test). -compile([export_all]). go1() -> {ok, A} = file:read_file("test.erl"), go1(A). go1(A) -> ok = nothing(A), erlang:garbage_collect(), io:format("~p~n", [erlang:process_info(self(), binary)]), ok. go2() -> {ok, A} = file:read_file("test.erl"), go2(A). go2(A) -> erlang:garbage_collect(), ok = nothing(A), io:format("~p~n", [erlang:process_info(self(), binary)]), ok. nothing(_) -> ok. What will the two functions go1 and go2 produce? Eshell V5.9.1 (abort with ^G) 1> test:go1(). {binary,[]} ok 2> test:go2(). {binary,[{11960880,575,2}]} ok // Bj?rn-Egil > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > 2012/1/13 Bj?rn-Egil Dahlberg > >> Den 13 januari 2012 23:11 skrev Max Lapshin : >> >> I thought, that calling gc will be a problem: >>> >>> >>> A = crypto:rand_bytes(1024*1024*1024), >>> erlang:garbagecollect(), >>> {reply, ok, State} >>> >>> >>> Will gc free A? I think that no, because A is still used in the place, >>> where gc is called. Am I right? >>> >> >> Correct. >> >> To be a little technical (and don't take this as an absolute truth in the >> details), >> What we see here is "A is referencing a large binary", which is true. >> What happens internally is that Eterm A is a boxed pointer from the stack >> or a register which points to a ProcBin on the heap. The ProcBin in turn >> holds an increment of a Reference counted binary off heap. Both the stack >> and the registers will become part of the root set during the garbage >> collection hence letting the binary be reachable and therefore "live". I >> believe that you need leave the function (release the stack) in order to >> free your binary. >> >> A gc without the A in the stack will not let the ProcBin survive during >> the copy phase of the gc. When the ProcBin is removed the RefcBinary will >> decrement and if it reaches zero, i.e. the last ProcBin has died, that too >> will be removed. >> >> // Bj?rn-Egil >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alttagil@REDACTED Mon Jan 16 22:12:59 2012 From: alttagil@REDACTED (Alexander Hudich) Date: Tue, 17 Jan 2012 01:12:59 +0400 Subject: [erlang-questions] dh_anon SSL connection failed In-Reply-To: <005b01ccd47a$84fd4070$8ef7c150$@gmail.com> References: <002e01ccd43f$816f1270$844d3750$@gmail.com> <005b01ccd47a$84fd4070$8ef7c150$@gmail.com> Message-ID: <000a01ccd493$a160f9f0$e422edd0$@gmail.com> Hi, Ingela! Also there is an output of #openssl s_client -connect ipaddress:5666 -state -debug -no_ssl2 -cipher ADH May be it'll help to figure out what happens: CONNECTED(00000003) write to 0x128e930 [0x128ea40] (71 bytes => 71 (0x47)) 0000 - 16 03 01 00 42 01 00 00-3e 03 01 4f 14 92 1b 26 ....B...>..O...& 0010 - 0e 5c 4e 7f 22 8f 66 b8-37 61 ee d1 58 07 a5 dd .\N.".f.7a..X... 0020 - 03 09 67 79 c7 7f 78 1c-7a 19 9d 00 00 10 00 3a ..gy..x.z......: 0030 - 00 34 00 1b 00 1a 00 19-00 18 00 17 00 ff 02 01 .4.............. 0040 - 00 00 04 00 23 SSL_connect:SSLv3 read finished A read from 0x128e930 [0x1293fa0] (7 bytes => 7 (0x7)) 0000 - 16 03 01 00 35 02 ....5. 0007 - read from 0x128e930 [0x1293fa7] (51 bytes => 51 (0x33)) 0000 - 00 31 03 01 4f 14 92 1b-59 1b 0b 30 69 e0 31 db .1..O...Y..0i.1. 0010 - 21 62 e5 0d 1b 64 29 19-a5 ef 63 ed df 66 4c 20 !b...d)...c..fL 0020 - 79 4c eb 1f 00 00 3a 01-00 09 ff 01 00 01 00 00 yL....:......... 0030 - 23 # 0033 - read from 0x128e930 [0x1293fa0] (5 bytes => 5 (0x5)) 0000 - 16 03 01 00 8b ..... read from 0x128e930 [0x1293fa5] (139 bytes => 139 (0x8B)) 0000 - 0c 00 00 87 00 40 f7 84-f4 7b a9 a1 fb 0d 4f e8 .....@REDACTED{....O. 0010 - 70 bf 60 0e 3a 1e b1 cd-09 f0 0b 26 1a 85 c5 c2 p.`.:......&.... 0020 - 23 f5 61 71 00 7e 7a f9-d3 fa 13 a5 bc 8d e1 b9 #.aq.~z......... 0030 - 89 e4 e9 f7 e3 46 db d2-f7 de 8e 68 71 a3 0f d7 .....F.....hq... 0040 - ce e1 b6 aa 5d 43 00 01-02 00 40 77 09 30 29 a7 ....]C....@REDACTED). 0050 - 80 88 1a 41 8a 1e 3d 59-08 90 e6 0c d1 d2 dc fd ...A..=Y........ 0060 - 7b 52 3f 91 8a d3 92 66-4e 63 d1 b4 5b 7a 24 12 {R?....fNc..[z$. 0070 - d0 74 27 29 0d 73 4d 3a-a5 59 19 90 7d 2f 26 12 .t').sM:.Y..}/&. 0080 - 85 f6 4f ef db 92 11 19-a3 4a da ..O......J. read from 0x128e930 [0x1293fa0] (5 bytes => 5 (0x5)) 0000 - 16 03 01 00 04 ..... read from 0x128e930 [0x1293fa5] (4 bytes => 4 (0x4)) 0000 - 0e . 0004 - write to 0x128e930 [0x129e270] (75 bytes => 75 (0x4B)) 0000 - 16 03 01 00 46 10 00 00-42 00 40 c3 ab 9b b1 35 ....F...B.@REDACTED 0010 - 1b a6 41 de d3 a8 e1 1e-90 15 3c d5 a6 30 c2 1f ..A.......<..0.. 0020 - b1 1d b9 39 6f a4 ab aa-bf 4b 65 c7 c4 0d bd 96 ...9o....Ke..... 0030 - 58 8e cb c2 fd cd cd c9-c2 0d 42 14 1f db 70 88 X.........B...p. 0040 - 83 a2 2b 30 56 6e b0 76-65 5c de ..+0Vn.ve\. write to 0x128e930 [0x129e270] (6 bytes => 6 (0x6)) 0000 - 14 03 01 00 01 01 ...... write to 0x128e930 [0x129e270] (53 bytes => 53 (0x35)) 0000 - 16 03 01 00 30 95 cc d9-da 4b 46 01 41 78 dd c3 ....0....KF.Ax.. 0010 - 72 dd c8 b3 c1 56 35 3f-30 5f cb 22 8b 27 0f fb r....V5?0_.".'.. 0020 - 6b 9b 32 63 74 69 88 2c-7b 06 2d 0e 25 dc 75 8f k.2cti.,{.-.%.u. 0030 - fd 1e e3 96 73 ....s read from 0x128e930 [0x1293fa0] (5 bytes => 5 (0x5)) 0000 - 16 03 01 00 aa ..... read from 0x128e930 [0x1293fa5] (170 bytes => 170 (0xAA)) 0000 - 04 00 00 a6 00 00 00 00-00 a0 a5 a7 5e ef 42 76 ............^.Bv 0010 - 46 0b c5 e9 26 a4 d9 18-4f 98 e5 85 f4 20 c3 f0 F...&...O.... .. 0020 - 65 21 2d ee 04 34 e4 4e-77 1e 3f 71 c4 89 83 a9 e!-..4.Nw.?q.... 0030 - aa ee fb 99 f0 32 d2 65-92 d6 ad 5d 9f a2 5b 62 .....2.e...]..[b 0040 - 15 43 c5 93 16 c6 85 c4-22 34 41 82 ea 17 17 48 .C......"4A....H 0050 - 91 e7 8d 03 ea bf 2c 89-b6 5c da f8 81 a6 32 e2 ......,..\....2. 0060 - 29 ec b3 5b d1 9b af 3d-29 b8 0f 62 c0 08 84 86 )..[...=)..b.... 0070 - d3 84 0c 79 b9 04 e1 67-5e 18 3a fb 12 df 50 a1 ...y...g^.:...P. 0080 - 54 db 1b 1b 9c f2 e4 b6-81 77 ca a0 02 de 45 38 T........w....E8 0090 - 40 c3 f1 77 1a 47 8b 50-d8 69 85 56 06 a7 d7 80 @..w.G.P.i.V.... 00a0 - 4a 8c a3 49 cd de dd 12-31 5a J..I....1Z read from 0x128e930 [0x1293fa0] (5 bytes => 5 (0x5)) 0000 - 14 03 01 00 01 ..... read from 0x128e930 [0x1293fa5] (1 bytes => 1 (0x1)) 0000 - 01 . read from 0x128e930 [0x1293fa0] (5 bytes => 5 (0x5)) 0000 - 16 03 01 00 30 ....0 read from 0x128e930 [0x1293fa5] (48 bytes => 48 (0x30)) 0000 - dc a3 d1 b9 13 be f5 ff-c5 92 44 e8 a5 23 44 1c ..........D..#D. 0010 - 2b 29 87 eb 6a 7a 5b 8a-5c e6 5b 23 7e 03 61 5b +)..jz[.\.[#~.a[ 0020 - 47 e5 17 b3 66 45 89 7f-36 1f d9 8c 11 a3 d5 87 G...fE..6....... --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 445 bytes and written 205 bytes --- New, TLSv1/SSLv3, Cipher is ADH-AES256-SHA Secure Renegotiation IS supported Compression: zlib compression Expansion: zlib compression SSL-Session: Protocol : TLSv1 Cipher : ADH-AES256-SHA Session-ID: 4BAD14D397EC13B0F89F2B5ED3F075F2578BDBD9CBA19D8C030DA7637ED2064E Session-ID-ctx: Master-Key: 4223A49C4792971D7C27819D47373B1871F0CF9E0BBC34FAAEBA97A4EBC7F2C365AE82213BD8 4516C0446CE0ECF4B5AA Key-Arg : None TLS session ticket: 0000 - a5 a7 5e ef 42 76 46 0b-c5 e9 26 a4 d9 18 4f 98 ..^.BvF...&...O. 0010 - e5 85 f4 20 c3 f0 65 21-2d ee 04 34 e4 4e 77 1e ... ..e!-..4.Nw. 0020 - 3f 71 c4 89 83 a9 aa ee-fb 99 f0 32 d2 65 92 d6 ?q.........2.e.. 0030 - ad 5d 9f a2 5b 62 15 43-c5 93 16 c6 85 c4 22 34 .]..[b.C......"4 0040 - 41 82 ea 17 17 48 91 e7-8d 03 ea bf 2c 89 b6 5c A....H......,..\ 0050 - da f8 81 a6 32 e2 29 ec-b3 5b d1 9b af 3d 29 b8 ....2.)..[...=). 0060 - 0f 62 c0 08 84 86 d3 84-0c 79 b9 04 e1 67 5e 18 .b.......y...g^. 0070 - 3a fb 12 df 50 a1 54 db-1b 1b 9c f2 e4 b6 81 77 :...P.T........w 0080 - ca a0 02 de 45 38 40 c3-f1 77 1a 47 8b 50 d8 69 ....E8@REDACTED 0090 - 85 56 06 a7 d7 80 4a 8c-a3 49 cd de dd 12 31 5a .V....J..I....1Z Compression: 1 (zlib compression) Start Time: 1326748187 Timeout : 300 (sec) Verify return code: 0 (ok) -----Original Message----- Hi, Ingela! >> This is kind of excerpt from check_nrpe code which connects just fine: >> >>SSL_library_init(); >>SSLeay_add_ssl_algorithms(); >>meth=SSLv23_client_method(); >>SSL_load_error_strings(); >>ctx=SSL_CTX_new(meth)); >>SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); >>result=my_tcp_connect(server_name,server_port,&sd); >> >> /* do SSL handshake */ >> >> if(result==STATE_OK && use_ssl==TRUE){ >> if((ssl=SSL_new(ctx))!=NULL){ >> SSL_CTX_set_cipher_list(ctx,"ADH"); >> SSL_set_fd(ssl,sd); >> rc=SSL_connect(ssl)); >> } >>} > What cipher suite and SSL/TLS-protocol version will this code end up using? I have not very much experience in development with using SSL connections. So I don't know if I've done it's right I added this line after SSL_connect to get current information about established SSL connection in check_nrpe: printf( "CIPHER %s %s\n", SSL_CIPHER_get_name( SSL_get_current_cipher(ssl) ), SSL_CIPHER_get_version( SSL_get_current_cipher(ssl) ) ); And it gives: CIPHER ADH-AES256-SHA TLSv1/SSLv3 Also I tried to change SSLv23_client_method() call to SSLv3_client_method(). And that gave very interesting result: CHECK_NRPE: Error - Could not complete SSL handshake. SSL_connect=0 36071:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1102:SSL alert number 40 That looks pretty similar to what I get with a result that erlang ssl:connect call returns. >> Erlang R16B (erts-5.10) [source] [64-bit] [smp:1:1] [async-threads:0] >> [hipe] [kernel-poll:false] >> 5> SockOpts. >> [{active,false}, >> {ssl_imp,old}, >This is not a relevant option after R15B ( it will always be new even if you write old). Yes I know that, it was just an act of despair :) >> {verify,verify_none}, >> {ciphers,[{dh_anon,rc4_128,md5}, >> {dh_anon,des_cbc,sha}, >> {dh_anon,'3des_ede_cbc',sha}, >> {dh_anon,aes_128_cbc,sha}, >> {dh_anon,aes_256_cbc,sha}]}] >> >> 6> ssl:connect( Ip, 5666, SockOpts, infinity). >> >> =ERROR REPORT==== 16-Jan-2012::12:49:23 === >> SSL: hello: ssl_handshake.erl:885:Fatal error: handshake failure >> {error,esslconnect} >> What do you think is it possible to make this type of connection in Erlang? >> What else can I try or is it a bug? > Our test cases for anonymous suites works just fine. Have you tried running the test case anonymous_cipher_suites in ssl_basic_SUITE? How can I do that? > Servers will normally not support anonymous cipher suites and we include them only for test purposes and they may only be used if explicitly supplied. I thought that I explicitly pointed to use that anonymous ciphers by supplying them in connection options. Or there is something else I should do? >Regards Ingela Erlang/OTP team - Ericsson AB From romanshestakov@REDACTED Mon Jan 16 22:52:09 2012 From: romanshestakov@REDACTED (Roman Shestakov) Date: Mon, 16 Jan 2012 21:52:09 +0000 (GMT) Subject: [erlang-questions] question how to recover a 'stateful' app when Erlang node crashes? In-Reply-To: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> References: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> Message-ID: <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> hello, I have a problem with Erlang VM running out of memory and dying. With this I have a question about correct recovery mechanisms which involve multiple VMs. what is the correct way to recover "stateful" Erlang application? In my case, the app. which is crashing is a complex hierarchy of fsm_processes each containing certain state. I understand how to recover stateless processes with supervisors but what is the correct way to recovery stateful apps? Clearly in my case I probably need some kind of supervisor 'node' but what would be the steps to correctly recover killed processes with their states? do I need to use a db and replay the processes from disk on another node or can I have a node with identical processes hierarchy? Regards, Roman -------------- next part -------------- An HTML attachment was scrubbed... URL: From baliulia@REDACTED Mon Jan 16 23:31:39 2012 From: baliulia@REDACTED (=?UTF-8?B?SWduYXMgVnnFoW5pYXVza2Fz?=) Date: Mon, 16 Jan 2012 22:31:39 +0000 Subject: [erlang-questions] xmerl_regexp "\w" character class Message-ID: <4F14A54B.7000409@gmail.com> Hi Erlangers, why does xmerl_regexp not support the character class \w? 1> {ok, MatchW} = xmerl_regexp:setup("\\w"). {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, <..>}}} 2> xmerl_regexp:match("a", MatchW). nomatch 3> {ok, MatchW2} = xmerl_regexp:setup("[a-z]"). {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, <..>}}} 4> xmerl_regexp:match("a", MatchW2). {match,1,1} It supports \d for example: 5> {ok, MatchD} = xmerl_regexp:setup("\\d"). {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, <..>}}} 6> xmerl_regexp:match("1", MatchD). {match,1,1} This causes XML validation to fail when I have the restriction in the schema I get: {error, [{pattern_mismatch,"WORD","\\w{1,4}"}]}. Of course I can change the restriction to but I wanted to make people aware of this issue. -- Ignas From chandrashekhar.mullaparthi@REDACTED Tue Jan 17 05:53:46 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 17 Jan 2012 04:53:46 +0000 Subject: [erlang-questions] MAP ASN.1 Message-ID: Hi, Does anyone have a version of the GSM MAP ASN.1 specifications which compile with the erlang ASN.1 compiler? I've downloaded a version of the spec from http://www.3gpp.org/ftp/Specs/archive/29_series/29.002/ASN.1/ but I get errors when compiling these files. Compiling MAP-SupplementaryServiceOperations.asn1...syntax error at line 445 in module MAP-SupplementaryServiceOperations.asn1: got 'SEQUENCE' expected ':' ta Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From harry.weppner@REDACTED Tue Jan 17 06:58:59 2012 From: harry.weppner@REDACTED (Harald Weppner) Date: Mon, 16 Jan 2012 21:58:59 -0800 Subject: [erlang-questions] erlang-questions Digest, Vol 44, Issue 2 In-Reply-To: References: Message-ID: <039AF1AB-FC78-4867-9DEF-D051C69CF083@gmx.net> Hi Toby, a known issue - essentially an invalid ppc asm comment delimiter. The problem is described and a patch is available at https://trac.macports.org/ticket/32649 Cheerio, Harry. On Jan 16, 2012, at 10:11 AM, erlang-questions-request@REDACTED wrote: > Date: Mon, 16 Jan 2012 08:54:40 -0500 > From: Toby Thain > Subject: [erlang-questions] error in hipe_ppc_bifs.S - building R15B > on OS X 10.4.11 > > Is this known to be broken? > > After a plain ./configure; make of otp_src_R15B: > > powerpc-apple-darwin8.11.0/opt/smp/hipe_ppc_bifs.S:457:Parameter > syntax > error (parameter 3) > > ...and hundreds more occurrences. > > --Toby -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Tue Jan 17 07:24:11 2012 From: vances@REDACTED (Vance Shipley) Date: Tue, 17 Jan 2012 11:54:11 +0530 Subject: [erlang-questions] MAP ASN.1 In-Reply-To: References: Message-ID: <20120117062409.GG303@aluminum.motivity.ca> Have you tried signerl?: http://cgit.osmocom.org/cgit/erlang/signerl/tree/MAP On Tue, Jan 17, 2012 at 04:53:46AM +0000, Chandru wrote: } Does anyone have a version of the GSM MAP ASN.1 specifications which } compile with the erlang ASN.1 compiler? -- -Vance From chandrashekhar.mullaparthi@REDACTED Tue Jan 17 08:11:25 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 17 Jan 2012 07:11:25 +0000 Subject: [erlang-questions] MAP ASN.1 In-Reply-To: <20120117062409.GG303@aluminum.motivity.ca> References: <20120117062409.GG303@aluminum.motivity.ca> Message-ID: Thanks Vance, just took a look and yes it looks pretty useful. I've downloaded the specs, and now the only errors I get are in Remote-Operations-Information-Objects.asn MAP-OperationPackages.asn I'll investigate and post an update. Out of curiousity, how complete is the signerl application? Are the SCCP/TCAP/MAP layers usable. What about M3UA? cheers Chandru On 17 January 2012 06:24, Vance Shipley wrote: > Have you tried signerl?: > > http://cgit.osmocom.org/cgit/erlang/signerl/tree/MAP > > On Tue, Jan 17, 2012 at 04:53:46AM +0000, Chandru wrote: > } Does anyone have a version of the GSM MAP ASN.1 specifications which > } compile with the erlang ASN.1 compiler? > > -- > -Vance > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Tue Jan 17 08:32:17 2012 From: barcojie@REDACTED (Barco You) Date: Tue, 17 Jan 2012 15:32:17 +0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: So, if OTP will not support this kind of trick since R16, that meant the Misultin has to upgrade codes? Barco On Wed, Jan 11, 2012 at 12:36 AM, Yurii Rashkovskii wrote: > > Why do you need wrapping module name in a tuple? It works without it: > > > > Eshell V5.9 (abort with ^G) > > 1> erlang:length([1,2,3]). > > 3 > > 2> M = erlang. > > erlang > > 3> M:length([1,2,3]). > > 3 > > > > Is there any case when wrapping is necessary, which I'm missing? > > That was just a minimal (and useless) case of how tuple modules > behave. This is a far bigger deal when you have records (or just > tagged tuples) and modules named according to them. One of the real > use cases is misultin_req: > https://github.com/ostinelli/misultin/blob/master/src/misultin_req.erl > > Yurii. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Tue Jan 17 08:41:25 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 17 Jan 2012 07:41:25 +0000 Subject: [erlang-questions] xmerl_regexp "\w" character class In-Reply-To: <4F14A54B.7000409@gmail.com> References: <4F14A54B.7000409@gmail.com> Message-ID: It does appear to have a completely custom regex engine, so it could be an oversight. According to the code (as of R14B) you *can* use posix character classes like [:alnum:] and [:alpha:] though. 2012/1/16 Ignas Vy?niauskas > Hi Erlangers, > > why does xmerl_regexp not support the character class \w? > > 1> {ok, MatchW} = xmerl_regexp:setup("\\w"). > {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, > <..>}}} > 2> xmerl_regexp:match("a", MatchW). > nomatch > 3> {ok, MatchW2} = xmerl_regexp:setup("[a-z]"). > {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, > <..>}}} > 4> xmerl_regexp:match("a", MatchW2). > {match,1,1} > > It supports \d for example: > > 5> {ok, MatchD} = xmerl_regexp:setup("\\d"). > {ok,{comp_regexp,{{{c_state,1,none,none,none,none,none, > <..>}}} > 6> xmerl_regexp:match("1", MatchD). > {match,1,1} > > This causes XML validation to fail when I have the restriction in the > schema > I get: {error, [{pattern_mismatch,"WORD","\\w{1,4}"}]}. > > Of course I can change the restriction to > > but I wanted to make people aware of this issue. > > -- > Ignas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue Jan 17 09:01:52 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 17 Jan 2012 10:01:52 +0200 Subject: [erlang-questions] error in hipe_ppc_bifs.S - building R15B on OS X 10.4.11 In-Reply-To: <4F142C20.9030108@telegraphics.com.au> References: <4F142C20.9030108@telegraphics.com.au> Message-ID: <4F152AF0.1090709@cs.ntua.gr> On 01/16/12 15:54, Toby Thain wrote: > Is this known to be broken? > > After a plain ./configure; make of otp_src_R15B: > > powerpc-apple-darwin8.11.0/opt/smp/hipe_ppc_bifs.S:457:Parameter syntax > error (parameter 3) > > ...and hundreds more occurrences. Unfortunately, since August 2011, we do not have access to a machine running (an ancient version of) darwin so we cannot routinely test the PPC back-end of HiPE. The change that breaks the make process was introduced in October 2011 https://github.com/erlang/otp/commits/master/erts/emulator/hipe/hipe_ppc_bifs.m4 but I am absolutely sure that the developer that did this tested his change on his system before committing it. So, I think this is probably due to differences in tools used to make the system (either in m4 or in the assembler) on different versions of OS X. In any case, as mentioned in another mail, a patch that fixes the issue is available at: https://trac.macports.org/ticket/32649 Perhaps somebody with access to a machine with OS X can verify that this works. We should make sure that this gets included in R15B01. I am cc:ing Sverker @ OTP. Kostis From wallentin.dahlberg@REDACTED Tue Jan 17 10:16:01 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Tue, 17 Jan 2012 10:16:01 +0100 Subject: [erlang-questions] Differences between erlang:system_profile and erlang:trace In-Reply-To: References: <4F02C509.3030106@erlang.org> Message-ID: This seemed to work but the correction had an uncaught lock order violation (!). A correction of the correction is in opu and will be merged to maint (r15b01-dev) later this week. // Bj?rn-Egil Den 6 januari 2012 00:52 skrev Bj?rn-Egil Dahlberg < wallentin.dahlberg@REDACTED>: > Hopefully it will now work as intended. > > I should probably sent a mail but I forgot. Getting a lot of those these > days. > > Give me a shout if something seems amiss. > > // Bj?rn-Egil > > Den 5 januari 2012 23:53 skrev Magnus Klaar : > > Hi! >> >> As far as i can tell, this is fixed in >> https://github.com/erlang/otp/commit/195be9a44f2481b9c575c8ad286f4d2278b831b3, >> thanks. >> >> MVH Magnus >> >> >> 2012/1/3 Bj?rn-Egil Dahlberg >> >>> From what I remember (trying to recall something written five years >>> ago) system_profile used to respect this policy but from looking at the >>> code it seems like it doesn't now. The tracing and scheduler queues has >>> been rewritten several times since then and it is possible that something >>> has been lost. >>> >>> I will have a look at it. Thank you for reporting this. >>> >>> Regards, >>> Bj?rn-Egil >>> >>> >>> On 2012-01-03 01:37, Magnus Klaar wrote: >>> >>> Hi! >>> >>> I'm seeing a strange behavior when using erlang:system_info/2 to trace >>> the running processes on an erlang node. I know it's flagged as >>> experimental so I will assume it's actually a feature even if the >>> documentation does not agree. When a process is used to receive the profile >>> messages from erlang:system_info/2 the receiving process is also profiled. >>> The effect of this is that the process receiving the profile messages will >>> receive an infinite sequence of 'inactive' ... 'active' ... 'inactive' .... >>> messages from the runtime system. The manpage states that the "The >>> receiver is excluded from all profiling.". I've compared this with using >>> the erlang:trace/3 function to trace running processes, when this function >>> is used the tracer processes never receives a message when the tracer >>> process scheduled. >>> >>> Two eunit tests for showing the difference: >>> https://gist.github.com/1552673 >>> >>> Running "erl -noshell -s system_profile test -s init stop" on my >>> system yields the following result: >>> >>> >>> system_profile.erl:30:<0.35.0>: Total: 525169, For tracer: 524824, For >>> others: 345 >>> >>> system_profile:13: system_profile_test_...*failed* >>> ::{assertion_failed,[{module,system_profile}, >>> {line,32}, >>> {expression,"SelfCount =:= 0"}, >>> {expected,true}, >>> {value,false}]} >>> >>> >>> system_profile.erl:58:<0.123.0>: Total: 338, For tracer: 0, For >>> others: 338 >>> >>> ======================================================= >>> Failed: 1. Skipped: 0. Passed: 1. >>> >>> >>> My questions are: Am I using it wrong? If so, how should it be used? >>> If not, Is it a bug? >>> >>> MVH Magnus >>> >>> >>> _______________________________________________ >>> erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Jan 17 12:18:49 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 17 Jan 2012 12:18:49 +0100 Subject: [erlang-questions] mnesia:dirty_update_counter returns 'ok' in R14B04 In-Reply-To: References: Message-ID: I can't reproduce your issue, can you give more details about which system you use, how you create the table, mnesia:info() if possible 3> mnesia:create_table(test). {aborted,{badarg,test}} 4> mnesia:create_table(test,[]). {atomic,ok} 5> mnesia:dirty_update_counter(test, all, 0). 0 6> mnesia:dirty_update_counter(test, all, 1). 1 7> mnesia:dirty_read(test, all). [{test,all,1}] On Mon, Jan 16, 2012 at 2:13 PM, Jamie Brandon wrote: > The docs state that mnesia:dirty_update_counter should return NewVal > ( > http://www.erlang.org/documentation/doc-5.8.5/lib/mnesia-4.5/doc/html/mnesia.html#dirty_update_counter-2 > ). > > In fact, I get: > > (smarkets@REDACTED)7> > mnesia:dirty_read(external_eid, all). > [{external_eid,all,3235}] > (smarkets@REDACTED)8> > mnesia:dirty_update_counter(external_eid, all, 1). > ok > (smarkets@REDACTED)9> > mnesia:dirty_read(external_eid, all). > [{external_eid,all,3236}] > > This is not particularly helpful :-| > > Can anyone shed any light on this? The table is created with default > options. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From juanjo@REDACTED Tue Jan 17 13:54:54 2012 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 17 Jan 2012 09:54:54 -0300 Subject: [erlang-questions] Getting the number of columns of a terminal Message-ID: Does anybody know if there's any way of getting the number of columns in a terminal in a portable way in Erlang (i.e. not using curses or anything else that's not available on other platforms)? I need to wrap some lines that I'm showing on a terminal and I'd rather use the real terminal's width instead hardcoding it to 80 characters or so. Thanks, Juanjo From gustav.simonsson@REDACTED Tue Jan 17 15:17:35 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Tue, 17 Jan 2012 14:17:35 -0000 (GMT) Subject: [erlang-questions] Getting the number of columns of a terminal In-Reply-To: Message-ID: <3969f025-0a65-4a67-b491-c60af5856fae@knuth> Good question. If you can find out which terminal device you're in you can do something like this: 15:14:12 belegost ~> tty /dev/pts/1 15:14:16 belegost ~> erl Erlang R14B04 (erts-5.8.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.5 (abort with ^G) 1> 1> open_port({spawn_executable, "/bin/sh"}, [{args,["-c", "stty -aF /dev/pts/1"]}]). #Port<0.581> 2> flush(). Shell got {#Port<0.581>, {data,"speed 38400 baud; rows 70; columns 119; line = 0;\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;\nswtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;\nlnext = ^V; flush = ^O; min = 1; time = 0;\n-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts\n-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff\n-iuclc ixany imaxbel iutf8\n-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\nisig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\nechoctl echoke\n"}} ok 3> The problem is if you call tty or stty directly from within Erlang then they will fail because they cannot know which terminal device they are executed from. The good thing about stty though if you can find a way to use it is that it works on linux, mac os x and BSD. Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Juan Jose Comellas" To: "erlang-questions" Sent: Tuesday, January 17, 2012 1:54:54 PM Subject: [erlang-questions] Getting the number of columns of a terminal Does anybody know if there's any way of getting the number of columns in a terminal in a portable way in Erlang (i.e. not using curses or anything else that's not available on other platforms)? I need to wrap some lines that I'm showing on a terminal and I'd rather use the real terminal's width instead hardcoding it to 80 characters or so. Thanks, Juanjo _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From freza@REDACTED Tue Jan 17 15:27:43 2012 From: freza@REDACTED (Jachym Holecek) Date: Tue, 17 Jan 2012 09:27:43 -0500 Subject: [erlang-questions] Getting the number of columns of a terminal In-Reply-To: References: Message-ID: <20120117142743.GA15315@circlewave.net> # Juan Jose Comellas 2012-01-17: > Does anybody know if there's any way of getting the number of columns > in a terminal in a portable way in Erlang (i.e. not using curses or > anything else that's not available on other platforms)? I need to wrap > some lines that I'm showing on a terminal and I'd rather use the real > terminal's width instead hardcoding it to 80 characters or so. io:columns/N should do it? BR, -- Jachym From juanjo@REDACTED Tue Jan 17 15:36:40 2012 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 17 Jan 2012 11:36:40 -0300 Subject: [erlang-questions] Getting the number of columns of a terminal In-Reply-To: <3969f025-0a65-4a67-b491-c60af5856fae@knuth> References: <3969f025-0a65-4a67-b491-c60af5856fae@knuth> Message-ID: The problem with this approach is that I need to do it portably (i.e. also on Windows). Thanks, Juanjo On Tue, Jan 17, 2012 at 11:17 AM, Gustav Simonsson wrote: > > Good question. > If you can find out which terminal device you're in you can do something like this: > > 15:14:12 belegost ~> tty > /dev/pts/1 > 15:14:16 belegost ~> erl > Erlang R14B04 (erts-5.8.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.8.5 ?(abort with ^G) > 1> > 1> open_port({spawn_executable, "/bin/sh"}, [{args,["-c", "stty -aF /dev/pts/1"]}]). > #Port<0.581> > 2> flush(). > Shell got {#Port<0.581>, > ? ? ? ? ? {data,"speed 38400 baud; rows 70; columns 119; line = 0;\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;\nswtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;\nlnext = ^V; flush = ^O; min = 1; time = 0;\n-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts\n-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff\n-iuclc ixany imaxbel iutf8\n-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\nisig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\nechoctl echoke\n"}} > ok > 3> > > The problem is if you call tty or stty directly from within Erlang then they will > fail because they cannot know which terminal device they are executed from. > The good thing about stty though if you can find a way to use it is that it works on linux, mac os x and BSD. > > Regards, > Gustav Simonsson > > > > Sent from my PC > > ----- Original Message ----- > From: "Juan Jose Comellas" > To: "erlang-questions" > Sent: Tuesday, January 17, 2012 1:54:54 PM > Subject: [erlang-questions] Getting the number of columns of a terminal > > Does anybody know if there's any way of getting the number of columns > in a terminal in a portable way in Erlang (i.e. not using curses or > anything else that's not available on other platforms)? I need to wrap > some lines that I'm showing on a terminal and I'd rather use the real > terminal's width instead hardcoding it to 80 characters or so. > > Thanks, > > Juanjo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From juanjo@REDACTED Tue Jan 17 15:37:58 2012 From: juanjo@REDACTED (Juan Jose Comellas) Date: Tue, 17 Jan 2012 11:37:58 -0300 Subject: [erlang-questions] Getting the number of columns of a terminal In-Reply-To: <20120117142743.GA15315@circlewave.net> References: <20120117142743.GA15315@circlewave.net> Message-ID: Thanks! This is exactly what I had been looking for. I don't know how I had overlooked it. Juanjo On Tue, Jan 17, 2012 at 11:27 AM, Jachym Holecek wrote: > # Juan Jose Comellas 2012-01-17: >> Does anybody know if there's any way of getting the number of columns >> in a terminal in a portable way in Erlang (i.e. not using curses or >> anything else that's not available on other platforms)? I need to wrap >> some lines that I'm showing on a terminal and I'd rather use the real >> terminal's width instead hardcoding it to 80 characters or so. > > io:columns/N should do it? > > BR, > ? ? ? ?-- Jachym From g@REDACTED Tue Jan 17 16:10:18 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 17 Jan 2012 09:10:18 -0600 Subject: [erlang-questions] Getting the number of columns of a terminal In-Reply-To: <20120117142743.GA15315@circlewave.net> References: <20120117142743.GA15315@circlewave.net> Message-ID: On Tue, Jan 17, 2012 at 8:27 AM, Jachym Holecek wrote: > # Juan Jose Comellas 2012-01-17: >> Does anybody know if there's any way of getting the number of columns >> in a terminal in a portable way in Erlang (i.e. not using curses or >> anything else that's not available on other platforms)? I need to wrap >> some lines that I'm showing on a terminal and I'd rather use the real >> terminal's width instead hardcoding it to 80 characters or so. > > io:columns/N should do it? It never ceases to amaze me what's lurking the core libraries. From anders.nygren@REDACTED Tue Jan 17 16:22:16 2012 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 17 Jan 2012 09:22:16 -0600 Subject: [erlang-questions] MAP ASN.1 In-Reply-To: References: <20120117062409.GG303@aluminum.motivity.ca> Message-ID: We have been using this one. /Anders On Tue, Jan 17, 2012 at 1:11 AM, Chandru wrote: > Thanks Vance, just took a look and yes it looks pretty useful. I've > downloaded the specs, and now the only errors I get are in > > Remote-Operations-Information-Objects.asn > MAP-OperationPackages.asn > > I'll investigate and post an update. > > Out of curiousity, how complete is the signerl application? Are the > SCCP/TCAP/MAP layers usable. What about M3UA? > > cheers > Chandru > > > On 17 January 2012 06:24, Vance Shipley wrote: >> >> Have you tried signerl?: >> >> ? http://cgit.osmocom.org/cgit/erlang/signerl/tree/MAP >> >> On Tue, Jan 17, 2012 at 04:53:46AM +0000, Chandru wrote: >> } ?Does anyone have a version of the GSM MAP ASN.1 specifications which >> } ?compile with the erlang ASN.1 compiler? >> >> -- >> ? ? ? ?-Vance > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- A non-text attachment was scrubbed... Name: Remote-Operations-Information-Objects.asn Type: application/octet-stream Size: 3443 bytes Desc: not available URL: From jamie@REDACTED Tue Jan 17 16:34:32 2012 From: jamie@REDACTED (Jamie Brandon) Date: Tue, 17 Jan 2012 15:34:32 +0000 Subject: [erlang-questions] mnesia:dirty_update_counter returns 'ok' in R14B04 In-Reply-To: References: Message-ID: The machine is a Debian Squeeze image running on VirtualBox. The table is defined as: -record(external_eid, {id, eid}). setup() -> mnesia:create(external_eid, [{attributes, record_info(fields, external_eid)}]). More info: (smarkets-env)vagrant@REDACTED:/vagrant$ uname -aLinux vagrant-dev.corp.smarkets.com 2.6.32-5-686 #1 SMP Wed Jan 12 04:01:41 UTC 2011 i686 GNU/Linux (smarkets-env)vagrant@REDACTED:/vagrant$ sudo dpkg --status erlang-dev Package: erlang-dev Status: install ok installed Priority: optional Section: interpreters Installed-Size: 3176 Maintainer: Debian Erlang Packagers Architecture: i386 Source: erlang Version: 1:14.b.4-dfsg-1 Replaces: erlang (<< 1:14.b.4-dfsg-1), erlang-base (<< 1:14.b.4-dfsg-1), erlang-base-hipe (<< 1:14.b.4-dfsg-1), erlang-examples (<< 1:14.b.4-dfsg-1), erlang-mode (<< 1:12.b.1-dfsg-2), erlang-nox (<< 1:14.b.4-dfsg-1), erlang-src (<< 1:14.b.4-dfsg-1), erlang-x11 (<< 1:14.b.4-dfsg-1) Depends: erlang-base (= 1:14.b.4-dfsg-1) | erlang-base-hipe (= 1:14.b.4-dfsg-1) Suggests: erlang, erlang-manpages, erlang-doc Description: Erlang/OTP development libraries and headers The files for application development in Erlang. They include headers for all applications included into Erlang/OTP distribution and C interface libraries. Homepage: http://www.erlang.org/ (smarkets-env)vagrant@REDACTED:/vagrant$ erl Erlang R14B04 (erts-5.8.5) [source] [rq:1] [async-threads:0] [kernel-poll:false] %%% I didn't commit the code that used mnesia:dirty_update_counter but this is in the tip I was working from %%% (smarkets@REDACTED)1> mnesia:info(). ---> Processes holding locks <--- ---> Processes waiting for locks <--- ---> Participant transactions <--- ---> Coordinator transactions <--- ---> Uncertain transactions <--- ---> Active tables <--- mkt_ord : with 306 records occupying 31174 bytes on disc mkt_acct : with 245 records occupying 21180 bytes on disc acct_order_arch: with 1285 records occupying 728653 bytes on disc quote : with 85 records occupying 4836 words of mem acct_profit : with 117 records occupying 4268 words of mem cache_pair : with 0 records occupying 286 words of mem mealy_queue : with 152 records occupying 100008 bytes on disc acct_gexp : with 96 records occupying 4146 words of mem acct_deposit : with 0 records occupying 286 words of mem mealy_subscr : with 0 records occupying 286 words of mem mealy : with 939 records occupying 1799739 bytes on disc last_match : with 2 records occupying 6039 bytes on disc schema : with 20 records occupying 2626 words of mem acct_wdraw : with 0 records occupying 286 words of mem acct_outs : with 0 records occupying 286 words of mem mealy_migration: with 1 records occupying 298 words of mem acct_order_full: with 114 records occupying 13750 words of mem acct_pos : with 96 records occupying 9600 words of mem acct_couts : with 0 records occupying 286 words of mem uuid_seq : with 11 records occupying 374 words of mem ===> System info in version "4.5", debug level = none <=== opt_disc. Directory "/vagrant/tmp/mnesia" is used. use fallback at restart = false running db nodes = ['smarkets@REDACTED'] stopped db nodes = [] master node tables = [] remote = [] ram_copies = [cache_pair,mealy_subscr] disc_copies = [acct_couts,acct_deposit,acct_gexp,acct_order_full, acct_outs,acct_pos,acct_profit,acct_wdraw, mealy_migration,quote,schema,uuid_seq] disc_only_copies = [acct_order_arch,last_match,mealy,mealy_queue,mkt_acct, mkt_ord] [{'smarkets@REDACTED',disc_copies}] = [uuid_seq, acct_couts, acct_pos, acct_order_full, mealy_migration, acct_outs, acct_wdraw,schema, acct_deposit, acct_gexp, acct_profit,quote] [{'smarkets@REDACTED',disc_only_copies}] = [last_match, mealy, mealy_queue, acct_order_arch, mkt_acct, mkt_ord] [{'smarkets@REDACTED',ram_copies}] = [mealy_subscr, cache_pair] 2 transactions committed, 22 aborted, 0 restarted, 6889 logged to disc 0 held locks, 0 in queue; 0 local transactions, 0 remote 0 transactions waits for other nodes: [] ok From g@REDACTED Tue Jan 17 16:34:35 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 17 Jan 2012 09:34:35 -0600 Subject: [erlang-questions] question how to recover a 'stateful' app when Erlang node crashes? In-Reply-To: <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> References: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> Message-ID: On Mon, Jan 16, 2012 at 3:52 PM, Roman Shestakov wrote: > hello, > > I have a problem with Erlang VM running out of memory and dying. With this I > have a question about correct recovery mechanisms which involve multiple > VMs. > > what is the correct way to recover "stateful" Erlang application? In my > case, the app. which is crashing is a complex hierarchy of fsm_processes > each containing certain state. I understand how to recover stateless > processes with supervisors but what is the correct way to recovery stateful > apps? Clearly in my case I probably need some kind of supervisor 'node' but > what would be the steps to correctly recover killed processes with their > states? do I need to use a db and replay the processes from disk on another > node or can I have a node with identical processes hierarchy? This is a very good question. I'd love to hear from the seasoned vets on this one. My take is, first, this problem highlights the cost of state in the first place. The best solution is to avoid recovering state altogether. This usually means pushing more responsibility responsibility to your users. An academic but illustrative example is the web session state problem: rather than spend incredible energy on the back end managing client sessions, use client cookies. Of course, if that's not something you can wriggle out of, you have this problem. I generally use dets tables to store process state, which then can be used for recovery on process startup. I'll typically use on dets file per process. This is pretty easy -- you just save off your state every time it's updated. As for the recovery, I think you have two options: the recovered process can restore its own state, or another process can restore it. This depends on how long it takes to restore the state and whether your app can tolerate the recovered process being unavailable for that period. If it's too complex or time consuming, use a separate process to do that work, feeding the recovered process state appropriately. In the interest of separating concerns, it's probably always better to pair the process with a separate "state serializer" process, though I often just bake that into the process itself if its simple/fast enough. Garrett From chandrashekhar.mullaparthi@REDACTED Tue Jan 17 17:46:39 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 17 Jan 2012 16:46:39 +0000 Subject: [erlang-questions] MAP ASN.1 In-Reply-To: References: <20120117062409.GG303@aluminum.motivity.ca> Message-ID: Thank you Anders. Ill give it a try. Chandru On Jan 17, 2012 3:22 PM, "Anders Nygren" wrote: > We have been using this one. > > /Anders > > On Tue, Jan 17, 2012 at 1:11 AM, Chandru > wrote: > > Thanks Vance, just took a look and yes it looks pretty useful. I've > > downloaded the specs, and now the only errors I get are in > > > > Remote-Operations-Information-Objects.asn > > MAP-OperationPackages.asn > > > > I'll investigate and post an update. > > > > Out of curiousity, how complete is the signerl application? Are the > > SCCP/TCAP/MAP layers usable. What about M3UA? > > > > cheers > > Chandru > > > > > > On 17 January 2012 06:24, Vance Shipley wrote: > >> > >> Have you tried signerl?: > >> > >> http://cgit.osmocom.org/cgit/erlang/signerl/tree/MAP > >> > >> On Tue, Jan 17, 2012 at 04:53:46AM +0000, Chandru wrote: > >> } Does anyone have a version of the GSM MAP ASN.1 specifications which > >> } compile with the erlang ASN.1 compiler? > >> > >> -- > >> -Vance > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue Jan 17 22:19:38 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 17 Jan 2012 22:19:38 +0100 Subject: [erlang-questions] question how to recover a 'stateful' app when Erlang node crashes? In-Reply-To: <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> References: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> Message-ID: <4F15E5EA.7070304@erlang-solutions.com> On 1/16/12 10:52 PM, Roman Shestakov wrote: > > what is the correct way to recover "stateful" Erlang application? In > my case, the app. which is crashing is a complex hierarchy of > fsm_processes each containing certain state. I understand how to > recover stateless processes with supervisors but what is the correct > way to recovery stateful apps? Clearly in my case I probably need some > kind of supervisor 'node' but what would be the steps to correctly > recover killed processes with their states? do I need to use a db and > replay the processes from disk on another node or can I have a node > with identical processes hierarchy? > The problem with a crashing process is that its internal state is not sound anymore. There was a reason as to why it went wrong. The problem with a crashing node is largely the same. There is a reason you ended up with resource exhaustion in the first place. The trick is that there is no trick. You need another node to have your state or you need your state on stable storage once in a while so you can restart from it. The point is that you can then make sure that from this stable state there will be no trouble. Essentially you want to only store to disk when you are sure about some part of the system is consistent with your invariants. Or move your state to another node. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Wed Jan 18 03:03:44 2012 From: toby@REDACTED (Toby Thain) Date: Tue, 17 Jan 2012 21:03:44 -0500 Subject: [erlang-questions] SOLVED - Re: error in hipe_ppc_bifs.S - building R15B on OS X 10.4.11 In-Reply-To: <4F152AF0.1090709@cs.ntua.gr> References: <4F142C20.9030108@telegraphics.com.au> <4F152AF0.1090709@cs.ntua.gr> Message-ID: <4F162880.1000909@telegraphics.com.au> On 17/01/12 3:01 AM, Kostis Sagonas wrote: > ...a patch that fixes the issue > is available at: > > https://trac.macports.org/ticket/32649 > > Perhaps somebody with access to a machine with OS X can verify that this > works. We should make sure that this gets included in R15B01. I am > cc:ing Sverker @ OTP. This patch does resolve the issue on OS X 10.4.11 (darwin 8.11.0) and OS X 10.5.8 (darwin 9.8.0). Thankyou for directing me to the solution. Don't hesitate to contact me if you need further OS X/PowerPC testing. --Toby > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From cgsmcmlxxv@REDACTED Wed Jan 18 04:03:33 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Wed, 18 Jan 2012 04:03:33 +0100 Subject: [erlang-questions] question how to recover a 'stateful' app when Erlang node crashes? In-Reply-To: <4F15E5EA.7070304@erlang-solutions.com> References: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> <4F15E5EA.7070304@erlang-solutions.com> Message-ID: To recover the state, I am also using one of the options given in this thread. But, to prevent memory starvation (preventing is more efficient than recovering, in my opinion), one can use erlang:memory() to build a monitor for the main application. So, a solution would be to have few "flags" for different levels of memory consumption and to instruct your application to return a "busy" flag (data not accepted) to the user in case the memory usage is over a certain level. For more complex monitors, one can use os:cmd() to get the system resources consumption. Another solution is to save the state only when the memory consumption is above a threshold, so, in case of crash, to be able to start from the last known state. This is less time consuming (to save the state every time it got changed is introducing a lag in your application), but you need to take into consideration many factors to decrease the risk of losing the state. I hope this will help you to have at least a starting point in (re)designing your application. CGS On Tue, Jan 17, 2012 at 10:19 PM, Jesper Louis Andersen < jesper.louis.andersen@REDACTED> wrote: > On 1/16/12 10:52 PM, Roman Shestakov wrote: > > > what is the correct way to recover "stateful" Erlang application? In my > case, the app. which is crashing is a complex hierarchy of fsm_processes > each containing certain state. I understand how to recover stateless > processes with supervisors but what is the correct way to recovery stateful > apps? Clearly in my case I probably need some kind of supervisor 'node' but > what would be the steps to correctly recover killed processes with their > states? do I need to use a db and replay the processes from disk on another > node or can I have a node with identical processes hierarchy? > > The problem with a crashing process is that its internal state is not > sound anymore. There was a reason as to why it went wrong. The problem with > a crashing node is largely the same. There is a reason you ended up with > resource exhaustion in the first place. > > The trick is that there is no trick. You need another node to have your > state or you need your state on stable storage once in a while so you can > restart from it. The point is that you can then make sure that from this > stable state there will be no trouble. Essentially you want to only store > to disk when you are sure about some part of the system is consistent with > your invariants. Or move your state to another node. > > -- > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen, DK > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Jan 18 09:31:12 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 18 Jan 2012 09:31:12 +0100 Subject: [erlang-questions] question how to recover a 'stateful' app when Erlang node crashes? In-Reply-To: References: <1326749579.89379.YahooMailNeo@web25405.mail.ukl.yahoo.com> <1326750729.18019.YahooMailNeo@web25404.mail.ukl.yahoo.com> <4F15E5EA.7070304@erlang-solutions.com> Message-ID: <767D13B6-2E35-489F-A73D-FEC80C26369B@gmail.com> Simply brilliant idea to save the state when above a certain threshold. Thanks CGS! Regards, Zabrane On Jan 18, 2012, at 4:03 AM, CGS wrote: > To recover the state, I am also using one of the options given in this thread. But, to prevent memory starvation (preventing is more efficient than recovering, in my opinion), one can use erlang:memory() to build a monitor for the main application. So, a solution would be to have few "flags" for different levels of memory consumption and to instruct your application to return a "busy" flag (data not accepted) to the user in case the memory usage is over a certain level. For more complex monitors, one can use os:cmd() to get the system resources consumption. Another solution is to save the state only when the memory consumption is above a threshold, so, in case of crash, to be able to start from the last known state. This is less time consuming (to save the state every time it got changed is introducing a lag in your application), but you need to take into consideration many factors to decrease the risk of losing the state. > > I hope this will help you to have at least a starting point in (re)designing your application. > > > CGS > > > On Tue, Jan 17, 2012 at 10:19 PM, Jesper Louis Andersen wrote: > On 1/16/12 10:52 PM, Roman Shestakov wrote: >> >> >> what is the correct way to recover "stateful" Erlang application? In my case, the app. which is crashing is a complex hierarchy of fsm_processes each containing certain state. I understand how to recover stateless processes with supervisors but what is the correct way to recovery stateful apps? Clearly in my case I probably need some kind of supervisor 'node' but what would be the steps to correctly recover killed processes with their states? do I need to use a db and replay the processes from disk on another node or can I have a node with identical processes hierarchy? >> > The problem with a crashing process is that its internal state is not sound anymore. There was a reason as to why it went wrong. The problem with a crashing node is largely the same. There is a reason you ended up with resource exhaustion in the first place. > > The trick is that there is no trick. You need another node to have your state or you need your state on stable storage once in a while so you can restart from it. The point is that you can then make sure that from this stable state there will be no trouble. Essentially you want to only store to disk when you are sure about some part of the system is consistent with your invariants. Or move your state to another node. > -- > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen, DK > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Wed Jan 18 09:39:20 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 18 Jan 2012 09:39:20 +0100 Subject: [erlang-questions] dh_anon SSL connection failed In-Reply-To: References: <002e01ccd43f$816f1270$844d3750$@gmail.com> <005b01ccd47a$84fd4070$8ef7c150$@gmail.com> Message-ID: Hi! 2012/1/16 Alexander Hudich : > Hi, Ingela! > >>> This is kind of excerpt from check_nrpe code which connects just fine: >>> >>>SSL_library_init(); >>>SSLeay_add_ssl_algorithms(); >>>meth=SSLv23_client_method(); >>>SSL_load_error_strings(); >>>ctx=SSL_CTX_new(meth)); >>>SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); >>>result=my_tcp_connect(server_name,server_port,&sd); >>> >>> /* do SSL handshake */ >>> >>> if(result==STATE_OK && use_ssl==TRUE){ >>> if((ssl=SSL_new(ctx))!=NULL){ >>> SSL_CTX_set_cipher_list(ctx,"ADH"); >>> SSL_set_fd(ssl,sd); >>> rc=SSL_connect(ssl)); >>> } >>>} > >> What cipher suite and SSL/TLS-protocol version will this code end up > using? > > > I have not very much experience in development with using SSL connections. > So I don't know if I've done it's right I added this line after SSL_connect > to get current > information about established SSL connection in check_nrpe: > > printf( "CIPHER %s %s\n", SSL_CIPHER_get_name( SSL_get_current_cipher(ssl) > ), SSL_CIPHER_get_version( SSL_get_current_cipher(ssl) ) ); > > And it gives: > > CIPHER ADH-AES256-SHA TLSv1/SSLv3 > > Also I tried to change SSLv23_client_method() call to SSLv3_client_method(). > And that gave very interesting result: > > CHECK_NRPE: Error - Could not complete SSL handshake. > SSL_connect=0 > 36071:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake > failure:s3_pkt.c:1102:SSL alert number 40 > > That looks pretty similar to what I get with a result that erlang > ssl:connect call returns. > Hum ... interesting it could be so that SSLv23_client_method() is more forgiving in some way and that your server has a bug... I will try to look into this more when I get time. If you come up with something in the meantime pleas let me know. >>> Erlang R16B (erts-5.10) [source] [64-bit] [smp:1:1] [async-threads:0] >>> [hipe] [kernel-poll:false] >>> 5> SockOpts. >>> [{active,false}, >>> {ssl_imp,old}, > > >>This is not a relevant option after R15B ( it will always be new even if > you write old). > > Yes I know that, it was just an act of despair :) > > > >>> {verify,verify_none}, >>> {ciphers,[{dh_anon,rc4_128,md5}, >>> {dh_anon,des_cbc,sha}, >>> {dh_anon,'3des_ede_cbc',sha}, >>> {dh_anon,aes_128_cbc,sha}, >>> {dh_anon,aes_256_cbc,sha}]}] >>> >>> 6> ssl:connect( Ip, 5666, SockOpts, infinity). >>> >>> =ERROR REPORT==== 16-Jan-2012::12:49:23 === >>> SSL: hello: ssl_handshake.erl:885:Fatal error: handshake failure >>> {error,esslconnect} >>> What do you think is it possible to make this type of connection in > Erlang? >>> What else can I try or is it a bug? > >> Our test cases for anonymous suites works just fine. Have you tried > running the test case anonymous_cipher_suites in ssl_basic_SUITE? > > How can I do that? See description under testing in erlang patch instructions: https://github.com/erlang/otp/wiki/submitting-patches > >> Servers will normally not support anonymous cipher suites and we include > them only for test purposes and they may only be used if explicitly > supplied. > > I thought that I explicitly pointed to use that anonymous ciphers by > supplying them in connection options. Or there is something else I should > do? By supplying them in the connection options you will make the client try to connect to the server with those suites but it does not necessarily mean that the server supports them and will let you set up the connection. However your server seeems to support {dh_anon,aes_256_cbc,sha} ( ADH-AES256-SHA ). Regards Ingela Erlang/OTP team - Ericsson AB From robert.virding@REDACTED Wed Jan 18 09:54:09 2012 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 18 Jan 2012 08:54:09 -0000 (GMT) Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4F103DDB.1010302@gmail.com> Message-ID: <9658ee0d-9391-4489-a469-cb2abe6a7da0@knuth> ----- Original Message ----- > On 01/12/2012 06:31 PM, Robert Virding wrote: > > I think that in many cases you DO want to know about the > > implementation as different algorithms have different properties > > and > > choosing the right one can have a significant effect on an > > application. This was the reason we have different versions with > > the > > same API, so you could test and choose between them and find the > > best > > one. Unfortunately it took a long time before there came a new one > > after the original two. > > > > I think it is good to have at least one tree based version as well. > > Though I would much prefer to have it in a separate module > > (gbdict?) > > instead of baking it into the dict version. I prefer to be explicit > > rather then "hiding" behind one module. In most case you do really > > want to know what is going on. I have two tree versions that I have > > long been meaning to include in the distribution, rbdict based on > > Red-Black trees and aadict based on the same algorithms as gb_trees > > but implemented in a different way. The more the merrier. > > > > But as I said I strongly feel it is much better to have separate > > modules. It also makes it easier to add versions, which as you can > > probably understand I think there should be. > > It is of course possible to *also* give gb_trees a new interface > (which > requires a new module name) although I didn't want to do that as part > of > this exercise. Still, I think that it's a good thing to just make the > dict module itself offer both a hashed form and an ordered (tree > based) > form, because it makes Erlang more approachable. These things are not > mutually exclusive. > > The actual implementation used for the hash and tree forms could > change > between Erlang releases depending on what is deemed to be the most > efficient; after all, the current hash table implementation is > explicitly said to be opaque and might be replaced with some more > efficient variant one day. > > But for the basic Erlang user, I think it ought to be enough to know > that the dict module covers most of his needs, both for ordered and > unordered dictionaries. If he later wants to optimize his code, he > can > then familiarize himself with the other N dict-like modules in the > distribution and pick one that might be better for his use case. If > they > all speak the same API, swapping them should then be simple. Yes, the most important thing is definitely that the various dict modules all have the same API. My thought with having separate modules for each implementation would be that it would be easier to add new and different implementations. You could have versions tuned to different types of usage profiles. Even if you add the ordered tree option to 'dict' I think there should still be a version of it in a separate module, like gbdict. For backwards compatibility. Robert From ingela@REDACTED Wed Jan 18 17:31:15 2012 From: ingela@REDACTED (Ingela Anderton Andin) Date: Wed, 18 Jan 2012 17:31:15 +0100 Subject: [erlang-questions] [erlang-patches] SSL distribution fixes In-Reply-To: References: <291DBF2D-AB8F-40A5-A137-51736D95AC9D@kallisys.net> <4F142C83.7020406@erix.ericsson.se> Message-ID: <4F16F3D3.8030404@erix.ericsson.se> Hi! Paul Guyot wrote: > Le 16 janv. 2012 ? 14:56, Ingela Anderton Andin a ?crit : > > >>> This probably is what happens. The other bug I saw is that the client can timeout (using dist_utils:timer) while the proxy doesn't handle this. >>> >>> What is the rationale behind the use of the proxy? Isn't it related to the old implementation of SSL? >>> >>> >>> >> We want to avoid having a driver. >> > > Ingela, > > Thank you for your replies. > > I still do not fully understand the way distribution over TLS works. I've just read in the (old) documentation that proto_dist requires a driver. Is this such a driver that you try to avoid? Is inet_ssl_dist using the same driver as inet_tcp_dist and hence requires a proxy? Is this why inet_tls_dist cannot use ssl:send/2 and ssl:recv/3 as f_recv and f_send handlers (lines 244 and 248)? > > ssl:send/recv operates on ssl-sockes. ssl-sockets are not the same thing as inet-sockets that will be used in the inet callback-functions in inet_tls_dist. New ssl is a pure erlang application, this is sort of a problem as when starting the erlang distribution you are not able to start erlang applications yet, this is solved by "cloning" the ssl-application hanging it under the kernel application supervisor. Then all distribution messages are sent from erts to erlang and handled by erlang ssl and sent back to erts that knows nothing about the SSL/TLS-handshaking and TLS/SSL-decryption/encryption. This is a short and simplified description, but hope it helps. Regards Ingela Erlang/OTP team -Ericsson AB From jwatte@REDACTED Wed Jan 18 18:40:47 2012 From: jwatte@REDACTED (Jon Watte) Date: Wed, 18 Jan 2012 09:40:47 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: I have a separate question about this. {M, F} references survive code reload and old code purge. That is, you can hold on to these references "forever." fun() -> M:F() end does not -- once the code that defined the fun is purged, any reference will now generate an exception when called. Will "fun M:F/A" survive reloads and old code purge, and behave like the tuple function? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Jan 10, 2012 at 8:19 AM, Yurii Rashkovskii wrote: > Hi, > > I was wondering if anybody (especially from the OTP team) can shed > some light on the following subject. > > In R15 we've got this: > > OTP-9649 Tuple funs (a two-element tuple with a module name and a > function) are now officially deprecated and will be removed > in R16. Use 'fun M:F/A' instead. To make you aware that your > system uses tuple funs, the very first time a tuple fun is > applied, a warning will be sent to the error logger. > > Which is fine. > > But I was wondering if there's any word out about the fate of tuple > modules? The ones like {erlang}:element(1). Are they expected to be > kept around? (I certainly hope they are :) > > Thanks, > Yurii. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Jan 18 18:42:04 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 18 Jan 2012 18:42:04 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On Wed, Jan 18, 2012 at 18:40, Jon Watte wrote: > Will "fun M:F/A" survive reloads and old code purge, and behave like the > tuple function? AFAIK, yes From jwatte@REDACTED Wed Jan 18 18:49:47 2012 From: jwatte@REDACTED (Jon Watte) Date: Wed, 18 Jan 2012 09:49:47 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On Wed, Jan 18, 2012 at 9:42 AM, Gleb Peregud wrote: > On Wed, Jan 18, 2012 at 18:40, Jon Watte wrote: > > Will "fun M:F/A" survive reloads and old code purge, and behave like the > > tuple function? > > AFAIK, yes > That is fantastic news! Now, if we could get "bound args" in there somehow too... :-) Actually, I guess you can do that, with parameterized modules. Sincerely, jw -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Wed Jan 18 18:53:44 2012 From: jwatte@REDACTED (Jon Watte) Date: Wed, 18 Jan 2012 09:53:44 -0800 Subject: [erlang-questions] gen_server state is not released for gc In-Reply-To: References: <4F106EC8.5060500@erlang.org> <4F107134.1080404@erlang.org> Message-ID: Again, the question is whether a smart enough compiler or VM couldn't just get rid of this reference? Specifically, because nothing is called without the module specifier, the VM could inline it, and in turn drop the reference to the binary, right? Whereas if the call to nothing was made with module name qualification, then that inline replacement could not take place, and the reference would have to be retained? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. 2012/1/16 Bj?rn-Egil Dahlberg > > > Den 16 januari 2012 18:24 skrev Jon Watte : > > Is this an artifact of the current implementation? >> Semantically, I don't see why a sufficiently smart VM wouldn't be able to >> collect the binary at that point. >> > > Hmm, yes, I did not answer correctly to the example. (Bad teacher) "A" > isn't used in the above example so it will be garbed. Let me show you by > example what I mean. > > -module(test). > > -compile([export_all]). > > go1() -> > {ok, A} = file:read_file("test.erl"), > go1(A). > > go1(A) -> > ok = nothing(A), > erlang:garbage_collect(), > io:format("~p~n", [erlang:process_info(self(), binary)]), > ok. > > go2() -> > {ok, A} = file:read_file("test.erl"), > go2(A). > > go2(A) -> > erlang:garbage_collect(), > ok = nothing(A), > io:format("~p~n", [erlang:process_info(self(), binary)]), > ok. > > nothing(_) -> ok. > > > What will the two functions go1 and go2 produce? > > Eshell V5.9.1 (abort with ^G) > 1> test:go1(). > {binary,[]} > ok > 2> test:go2(). > {binary,[{11960880,575,2}]} > ok > > > // Bj?rn-Egil > > >> Sincerely, >> >> jw >> >> >> -- >> Americans might object: there is no way we would sacrifice our living >> standards for the benefit of people in the rest of the world. Nevertheless, >> whether we get there willingly or not, we shall soon have lower consumption >> rates, because our present rates are unsustainable. >> >> >> >> 2012/1/13 Bj?rn-Egil Dahlberg >> >>> Den 13 januari 2012 23:11 skrev Max Lapshin : >>> >>> I thought, that calling gc will be a problem: >>>> >>>> >>>> A = crypto:rand_bytes(1024*1024*1024), >>>> erlang:garbagecollect(), >>>> {reply, ok, State} >>>> >>>> >>>> Will gc free A? I think that no, because A is still used in the place, >>>> where gc is called. Am I right? >>>> >>> >>> Correct. >>> >>> To be a little technical (and don't take this as an absolute truth in >>> the details), >>> What we see here is "A is referencing a large binary", which is true. >>> What happens internally is that Eterm A is a boxed pointer from the stack >>> or a register which points to a ProcBin on the heap. The ProcBin in turn >>> holds an increment of a Reference counted binary off heap. Both the stack >>> and the registers will become part of the root set during the garbage >>> collection hence letting the binary be reachable and therefore "live". I >>> believe that you need leave the function (release the stack) in order to >>> free your binary. >>> >>> A gc without the A in the stack will not let the ProcBin survive during >>> the copy phase of the gc. When the ProcBin is removed the RefcBinary will >>> decrement and if it reaches zero, i.e. the last ProcBin has died, that too >>> will be removed. >>> >>> // Bj?rn-Egil >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Thu Jan 19 07:47:09 2012 From: v@REDACTED (Valentin Micic) Date: Thu, 19 Jan 2012 08:47:09 +0200 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Really sorry for rewinding this conversation back a bit, but I am getting a bit confused... So, let me ask explicitly: is the following syntax going to be valid going forward (e.g. R16 onwards): > > Eshell V5.9 (abort with ^G) > 1> erlang:length([1,2,3]). > 3 > 2> M = erlang. > erlang > 3> M:length([1,2,3]). > 3 ...or would we be required to replace the above with: 67> F=fun erlang:length/1. #Fun 68> F([1,2,3]). 3 Kind regards, V/ From gleber.p@REDACTED Thu Jan 19 07:50:13 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 19 Jan 2012 07:50:13 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Afaik this syntax is here to stay. The syntax which lifetime is undefined yet is syntax mentioned by Yuri at the beginning of the conversation On Jan 19, 2012 7:47 AM, "Valentin Micic" wrote: > Really sorry for rewinding this conversation back a bit, but I am getting > a bit confused... > So, let me ask explicitly: is the following syntax going to be valid going > forward (e.g. R16 onwards): > > > > > Eshell V5.9 (abort with ^G) > > 1> erlang:length([1,2,3]). > > 3 > > 2> M = erlang. > > erlang > > 3> M:length([1,2,3]). > > 3 > > ...or would we be required to replace the above with: > > 67> F=fun erlang:length/1. > #Fun > > 68> F([1,2,3]). > 3 > > > Kind regards, > > V/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Thu Jan 19 08:16:26 2012 From: vances@REDACTED (Vance Shipley) Date: Thu, 19 Jan 2012 12:46:26 +0530 Subject: [erlang-questions] dialyzer: 'breaks the contract' Message-ID: <20120119071625.GK303@aluminum.motivity.ca> In the gen_sctp module reference manual there are examples: /Users/otpuser/lib/erlang/lib/kernel-2.15/doc/html/gen_sctp.html#id123111 In R15B when dialyzer is run on this example it produces the warning: sctp_client.erl:23: The call gen_sctp:send(S::port(),Assoc::#sctp_assoc_change{},0,<<_:48>>) breaks the contract (Socket,Assoc,Stream,Data) -> 'ok' | {'error',Reason} when is_subtype(Socket,sctp_socket()), is_subtype(Assoc,#sctp_assoc_change{} | assoc_id()), is_subtype(Stream,integer()), is_subtype(Data,'binary' | iolist()), is_subtype(Reason,term()) What is the problem here? -- -Vance From kostis@REDACTED Thu Jan 19 08:27:54 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 19 Jan 2012 09:27:54 +0200 Subject: [erlang-questions] dialyzer: 'breaks the contract' In-Reply-To: <20120119071625.GK303@aluminum.motivity.ca> References: <20120119071625.GK303@aluminum.motivity.ca> Message-ID: <4F17C5FA.8020200@cs.ntua.gr> On 01/19/12 09:16, Vance Shipley wrote: > In the gen_sctp module reference manual there are examples: > > /Users/otpuser/lib/erlang/lib/kernel-2.15/doc/html/gen_sctp.html#id123111 > > In R15B when dialyzer is run on this example it produces the warning: > > sctp_client.erl:23: The call gen_sctp:send(S::port(),Assoc::#sctp_assoc_change{},0,<<_:48>>) breaks the contract (Socket,Assoc,Stream,Data) -> 'ok' | {'error',Reason} when is_subtype(Socket,sctp_socket()), is_subtype(Assoc,#sctp_assoc_change{} | assoc_id()), is_subtype(Stream,integer()), is_subtype(Data,'binary' | iolist()), is_subtype(Reason,term()) > > What is the problem here? The problem is that the specs of gen_sctp:send/{3,4} have a typo. Lines 317 and 334 in file lib/kernel/src/gen_sctp.erl should read: Data :: binary() | iolist(), instead of Data :: binary | iolist(), Somebody at OTP should fix this. Kostis From spawn.think@REDACTED Thu Jan 19 13:13:41 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Thu, 19 Jan 2012 13:13:41 +0100 Subject: [erlang-questions] Back to Hangouts! Message-ID: What could be a better start for 2012 than an Erlang Hangout with a special guest? Join us next Thursday (26th January) and let's talk Erlang with one of its inventors! Send your questions, messages or points to discuss now! More details : https://plus.google.com/u/0/108730584872406072872/posts/MGDPdhf8qqP -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From abdoo.mahran@REDACTED Thu Jan 19 15:42:27 2012 From: abdoo.mahran@REDACTED (Abdul Fattah Mahran) Date: Thu, 19 Jan 2012 16:42:27 +0200 Subject: [erlang-questions] Does Erlang pure functional programming language? Message-ID: Hi All, I want to know if Erlang pure functional programming language or not? I can't find a clear document that states this. If someone can tell where I can find this information in Erlang documentation it will help a lot. Thanks Best Regards, Abd El-Fattah Mahran -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Thu Jan 19 15:43:58 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 19 Jan 2012 15:43:58 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: 2012/1/19, Abdul Fattah Mahran : > Hi All, > I want to know if Erlang pure functional programming language or not? I > can't find a clear document that states this. If someone can tell where I > can find this information in Erlang documentation it will help a lot. Erlang functions can have side effects, so it's not a pure functional language. From abdoo.mahran@REDACTED Thu Jan 19 15:50:50 2012 From: abdoo.mahran@REDACTED (Abdul Fattah Mahran) Date: Thu, 19 Jan 2012 16:50:50 +0200 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: Hi Attila, I can find this link http://www.trapexit.org/Erlang_and_Neural_Networks#State_of_the_Purely_Functional section 1.4 and it states that Erlang is pure, please advice? On Thu, Jan 19, 2012 at 4:43 PM, Attila Rajmund Nohl < attila.r.nohl@REDACTED> wrote: > 2012/1/19, Abdul Fattah Mahran : > > Hi All, > > I want to know if Erlang pure functional programming language or not? I > > can't find a clear document that states this. If someone can tell where I > > can find this information in Erlang documentation it will help a lot. > > Erlang functions can have side effects, so it's not a pure functional > language. > -- Thanks Best Regards, Abd El-Fattah Mahran -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Jan 19 15:52:04 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 19 Jan 2012 15:52:04 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: On Thu, Jan 19, 2012 at 15:50, Abdul Fattah Mahran wrote: > Hi Attila, > I can find this link > http://www.trapexit.org/Erlang_and_Neural_Networks#State_of_the_Purely_Functional > section 1.4 and it states that Erlang is pure, please advice? It's incorrect. It is possible to write a pure functions in Erlang, but it is possible to have side effects like: - sending messages to other processes (changes state of other process) - mutating own process dictionary - manipulating ETS tables - changing things like operating system environmental variables, etc. > > > On Thu, Jan 19, 2012 at 4:43 PM, Attila Rajmund Nohl > wrote: >> >> 2012/1/19, Abdul Fattah Mahran : >> > Hi All, >> > I want to know if Erlang pure functional programming language or not? I >> > can't find a clear document that states this. If someone can tell where >> > I >> > can find this information in Erlang documentation it will help a lot. >> >> Erlang functions can have side effects, so it's not a pure functional >> language. > > > > > -- > Thanks > Best Regards, > Abd El-Fattah Mahran > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From masklinn@REDACTED Thu Jan 19 16:04:24 2012 From: masklinn@REDACTED (Masklinn) Date: Thu, 19 Jan 2012 16:04:24 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: On 2012-01-19, at 15:52 , Gleb Peregud wrote: > On Thu, Jan 19, 2012 at 15:50, Abdul Fattah Mahran > wrote: >> Hi Attila, >> I can find this link >> http://www.trapexit.org/Erlang_and_Neural_Networks#State_of_the_Purely_Functional >> section 1.4 and it states that Erlang is pure, please advice? > > It's incorrect. It is possible to write a pure functions in Erlang, > but it is possible to have side effects like: > - sending messages to other processes (changes state of other process) > - mutating own process dictionary > - manipulating ETS tables > - changing things like operating system environmental variables, etc. Although sequential erlang is very, very close to a pure language: * No messages to other processes * No ETS tables? I don't think ets tables can be stored in-process * I'm guessing many changes (such as ENVVARs) delegate to port drivers, which would not be available to sequential erlang (an Erlang unable to send or receive messages) which leaves process dictionary mutation. Of course, in reality Erlang is not just sequential erlang, and any function call can hide sends and receives. From kostis@REDACTED Thu Jan 19 16:16:09 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 19 Jan 2012 16:16:09 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <4F1833B9.8020902@cs.ntua.gr> On 01/19/2012 03:50 PM, Abdul Fattah Mahran wrote: > Hi Attila, > I can find this link > http://www.trapexit.org/Erlang_and_Neural_Networks#State_of_the_Purely_Functional > section 1.4 and it states that Erlang is pure, please advice? You believe everything that you read on the internet, don't you? :P Here is another document on the internet that treats the subject of Purity in Erlang more thoroughly... http://user.it.uu.se/~kostis/Papers/purity.pdf Kostis From robert.virding@REDACTED Thu Jan 19 17:36:52 2012 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 19 Jan 2012 16:36:52 -0000 (GMT) Subject: [erlang-questions] Exmpp gen_fsm, sync_send_event, timeout exception In-Reply-To: Message-ID: <86401739-b880-4077-aaef-8d6ef997299c@knuth> Hi, gen_fsm:sync_send_event/2 has a default timeout of 5000ms which means that if it doesn't get a reply from the FSM within that time the function generates an error and the process crashes. This seems like what has happened to you. One solution is to use gen_fsm:sync_send_event/3 where you can set the timeout value. Another is to find out why the FSM is taking so long time and if there is anything you can do about it. Robert ----- Original Message ----- > Hello, > I run ejabberd and try to run 1000 bot written with exmpp. All bots > login and nothing do. When I run around 900 +-50 bots i got error: > ** exception exit: {timeout,{gen_fsm,sync_send_event, [<0.2899.0>, > {connect_socket,"my-host",5222,[]}, 5000]}} > How can i avoid this? > Thank you. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Jan 20 00:54:08 2012 From: comptekki@REDACTED (Wes James) Date: Thu, 19 Jan 2012 16:54:08 -0700 Subject: [erlang-questions] erlang R15B and windows xp Message-ID: I've been trying to get R15B to work on windows xp. It was missing a dll so I installed vistual studio c++ 2010 redestributable and now when I run erl, I just get a crash dump. I see now that in the release info it just says "windows 7". Does that mean that 1R5B won't work on windows xp? thanks, -wes From steven.charles.davis@REDACTED Fri Jan 20 02:31:47 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 19 Jan 2012 17:31:47 -0800 (PST) Subject: [erlang-questions] erlang R15B and windows xp In-Reply-To: References: Message-ID: Hi Wes, On my winxpsp3 laptop I had 15B running with no incident or issue... Erlang R15B (erts-5.9) [smp:1:1] [async-threads:0] Eshell V5.9 ?(abort with ^G) 1> os:version(). {5,1,2600} 2> Maybe try a reinstall and accept the vcc update first time around? /s On Jan 19, 5:54?pm, Wes James wrote: > I've been trying to get R15B to work on windows xp. ?It was missing a > dll so I installed vistual studio c++ 2010 redestributable and now > when I run erl, I just get a crash dump. ?I see now that in the > release info it just says "windows 7". ?Does that mean that 1R5B won't > work on windows xp? > > thanks, > > -wes > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Fri Jan 20 02:44:10 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 19 Jan 2012 17:44:10 -0800 (PST) Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <9c564bee-0928-4343-9bfe-cedebaa8a0ed@f33g2000yqh.googlegroups.com> Pure, no. Practical, yes. On Jan 19, 8:42?am, Abdul Fattah Mahran wrote: > Hi All, > I want to know if Erlang pure functional programming language or not? I > can't find a clear document that states this. If someone can tell where I > can find this information in Erlang documentation it will help a lot. > > Thanks > Best Regards, > Abd El-Fattah Mahran > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From thaterlangguy@REDACTED Fri Jan 20 07:38:45 2012 From: thaterlangguy@REDACTED (Ahmed Al-Saadi) Date: Fri, 20 Jan 2012 01:38:45 -0500 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: Abdul Fattah: If you want a pure functional language, look at Haskell. A good indication that a programming language is purely functional is its use of monads. Erlang may not be purely functional, but it is certainly pure pleasure ;) -- Ahmed Al-Saadi Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, January 19, 2012 at 9:42 AM, Abdul Fattah Mahran wrote: > Hi All, > I want to know if Erlang pure functional programming language or not? I can't find a clear document that states this. If someone can tell where I can find this information in Erlang documentation it will help a lot. > > Thanks > Best Regards, > Abd El-Fattah Mahran > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri Jan 20 08:07:25 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Fri, 20 Jan 2012 09:07:25 +0200 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <-6595435993676650961@unknownmsgid> Hello, Recently, I found an reference about Haskell extension. One thing what they are doing is asynchronous message-passing. Surprise but they concepts and high-level architecture is derived from Erlang =) At least it gave me a clear hit that Erlang programming semantic is right ;-) You are not limited and language supports you - write pure (side effect less) libraries - asynchronous or synchronous MP communication Send by <*)-|-|-< On 20.1.2012, at 8.39, Ahmed Al-Saadi wrote: Abdul Fattah: If you want a pure functional language, look at Haskell. A good indication that a programming language is purely functional is its use of monads. Erlang may not be purely functional, but it is certainly pure pleasure ;) -- Ahmed Al-Saadi Sent with Sparrow On Thursday, January 19, 2012 at 9:42 AM, Abdul Fattah Mahran wrote: Hi All, I want to know if Erlang pure functional programming language or not? I can't find a clear document that states this. If someone can tell where I can find this information in Erlang documentation it will help a lot. Thanks Best Regards, Abd El-Fattah Mahran _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From abdoo.mahran@REDACTED Fri Jan 20 08:29:53 2012 From: abdoo.mahran@REDACTED (Abdul Fattah Mahran) Date: Fri, 20 Jan 2012 09:29:53 +0200 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: Hi Ahmed, I use Erlang from a long time :). I won't replace it. I was asking for a concept. and for sure If Erlang was pure language, Erlang designers will state this somewhere clearly :). and Of course it pure pleasure :) On Fri, Jan 20, 2012 at 8:38 AM, Ahmed Al-Saadi wrote: > Abdul Fattah: > > If you want a pure functional language, look at Haskell. A good indication > that a programming language is purely functional is its use of monads. > > Erlang may not be purely functional, but it is certainly pure pleasure ;) > > -- > Ahmed Al-Saadi > Sent with Sparrow > > On Thursday, January 19, 2012 at 9:42 AM, Abdul Fattah Mahran wrote: > > Hi All, > I want to know if Erlang pure functional programming language or not? I > can't find a clear document that states this. If someone can tell where I > can find this information in Erlang documentation it will help a lot. > > Thanks > Best Regards, > Abd El-Fattah Mahran > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -- Thanks Best Regards, Abd El-Fattah Mahran -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Jan 20 16:19:29 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 20 Jan 2012 08:19:29 -0700 Subject: [erlang-questions] erlang R15B and windows xp In-Reply-To: References: Message-ID: I just got back in to work and reinstalled erlang for windows. I got it from erlang.org. I also installed .net framework 4 - but I don't think that was the issue. Probably reinstalling after installing the visual studio c++ 2010 redestributable did it. Just as a test, I removed .net framework 4, visual studio c++ 2010 redestributable and erlang and installed your version. During the install it indicates the ms dll's are present. I'm not sure which those are, but after installing I ran erl and it ran fine. Does your version install the needed ms files? -wes On Fri, Jan 20, 2012 at 2:56 AM, Tino Breddin wrote: > Hi Wes, > > Were you using our package [1]? > > If you were using the one from us we'd appreciate the logs showing your problems to be able > to help and fix that. > > Cheers, > Tino > > [1] http://binaries.erlang-solutions.com/R15B/Windows%20X86%20X86/esl-erlang_R15B-1_X86.exe > > On Jan 19, 2012, at 11:54 PM, Wes James wrote: > >> I've been trying to get R15B to work on windows xp. ?It was missing a >> dll so I installed vistual studio c++ 2010 redestributable and now >> when I run erl, I just get a crash dump. ?I see now that in the >> release info it just says "windows 7". ?Does that mean that 1R5B won't >> work on windows xp? >> >> thanks, >> >> -wes >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From ttmrichter@REDACTED Fri Jan 20 16:45:47 2012 From: ttmrichter@REDACTED (Michael Richter) Date: Fri, 20 Jan 2012 23:45:47 +0800 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: On 20 January 2012 14:38, Ahmed Al-Saadi wrote: > A good indication that a programming language is purely functional is its > use of monads. > This is nonsense. Mercury is a pure functional/logical language. It does not use monads. Clean is a pure functional language. It does not use monads. I *think* Pure is a pure functional language too. It doesn't use monads to my knowledge. In the meantime monads are easily available in Scheme/Racket, ML, Perl (!) and Clojure. These are not pure functional languages (and one of them isn't a functional language at all!). (They're less easily available in C++, Ruby and Python, incidentally.) -- "Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot." --Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Jan 20 16:58:07 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 20 Jan 2012 18:58:07 +0300 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: I can't imagine language, which is built only from pure functions. From michal.niec@REDACTED Fri Jan 20 17:36:30 2012 From: michal.niec@REDACTED (Michal Niec) Date: Fri, 20 Jan 2012 16:36:30 -0000 (GMT) Subject: [erlang-questions] erlang R15B and windows xp In-Reply-To: Message-ID: <449c99db-a6e6-4c32-b83d-c9979885c074@knuth> Hi Wes! Our version was built using Visual Studio C++ 2008. As a result it requires VSC++ 2008 Redistributable which was probably already installed on your machine. If you are interested you can see the test results for Windows XP here. http://www.erlang-solutions.com/section/132/download-erlang-otp Best Regards, Micha? Nie? -- Michal Niec http://www.erlang-solutions.com ----- Oryginalna wiadomo?? ----- > Od: "Wes James" > Do: "Tino Breddin" > DW: erlang-questions@REDACTED > Wys?ane: pi?tek, 20 stycze? 2012 16:19:29 > Temat: Re: [erlang-questions] erlang R15B and windows xp > > I just got back in to work and reinstalled erlang for windows. I got > it from erlang.org. I also installed .net framework 4 - but I don't > think that was the issue. Probably reinstalling after installing the > visual studio c++ 2010 redestributable did it. > > Just as a test, I removed .net framework 4, visual studio c++ 2010 > redestributable and erlang and installed your version. During the > install it indicates the ms dll's are present. I'm not sure which > those are, but after installing I ran erl and it ran fine. > > Does your version install the needed ms files? > > -wes > > On Fri, Jan 20, 2012 at 2:56 AM, Tino Breddin > wrote: > > Hi Wes, > > > > Were you using our package [1]? > > > > If you were using the one from us we'd appreciate the logs showing > > your problems to be able > > to help and fix that. > > > > Cheers, > > Tino > > > > [1] > > http://binaries.erlang-solutions.com/R15B/Windows%20X86%20X86/esl-erlang_R15B-1_X86.exe > > > > On Jan 19, 2012, at 11:54 PM, Wes James wrote: > > > >> I've been trying to get R15B to work on windows xp. ?It was > >> missing a > >> dll so I installed vistual studio c++ 2010 redestributable and now > >> when I run erl, I just get a crash dump. ?I see now that in the > >> release info it just says "windows 7". ?Does that mean that 1R5B > >> won't > >> work on windows xp? > >> > >> thanks, > >> > >> -wes > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From comptekki@REDACTED Fri Jan 20 17:41:16 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 20 Jan 2012 09:41:16 -0700 Subject: [erlang-questions] erlang R15B and windows xp In-Reply-To: <449c99db-a6e6-4c32-b83d-c9979885c074@knuth> References: <449c99db-a6e6-4c32-b83d-c9979885c074@knuth> Message-ID: Yes, I noticed that 2008 redist. was already installed when removing 2010 redist. Thanks, -wes On Fri, Jan 20, 2012 at 9:36 AM, Michal Niec wrote: > Hi Wes! > > Our version was built using Visual Studio C++ 2008. ?As a result it requires VSC++ 2008 Redistributable which was probably already installed on your machine. > > If you are interested you can see the test results for Windows XP here. > http://www.erlang-solutions.com/section/132/download-erlang-otp > > Best Regards, > Micha? Nie? > > -- > Michal Niec > http://www.erlang-solutions.com > > > ----- Oryginalna wiadomo?? ----- >> Od: "Wes James" >> Do: "Tino Breddin" >> DW: erlang-questions@REDACTED >> Wys?ane: pi?tek, 20 stycze? 2012 16:19:29 >> Temat: Re: [erlang-questions] erlang R15B and windows xp >> >> I just got back in to work and reinstalled erlang for windows. ?I got >> it from erlang.org. I also installed .net framework 4 - but I don't >> think that was the issue. ?Probably reinstalling after installing the >> visual studio c++ 2010 redestributable did it. >> >> Just as a test, I removed .net framework 4, visual studio c++ 2010 >> redestributable and erlang and installed your version. ?During the >> install it indicates the ms dll's are present. I'm not sure which >> those are, but after installing I ran erl and it ran fine. >> >> Does your version install the needed ms files? >> >> -wes >> >> On Fri, Jan 20, 2012 at 2:56 AM, Tino Breddin >> wrote: >> > Hi Wes, >> > >> > Were you using our package [1]? >> > >> > If you were using the one from us we'd appreciate the logs showing >> > your problems to be able >> > to help and fix that. >> > >> > Cheers, >> > Tino >> > >> > [1] >> > http://binaries.erlang-solutions.com/R15B/Windows%20X86%20X86/esl-erlang_R15B-1_X86.exe >> > >> > On Jan 19, 2012, at 11:54 PM, Wes James wrote: >> > >> >> I've been trying to get R15B to work on windows xp. ?It was >> >> missing a >> >> dll so I installed vistual studio c++ 2010 redestributable and now >> >> when I run erl, I just get a crash dump. ?I see now that in the >> >> release info it just says "windows 7". ?Does that mean that 1R5B >> >> won't >> >> work on windows xp? >> >> >> >> thanks, >> >> >> >> -wes >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From amindfv@REDACTED Fri Jan 20 19:46:22 2012 From: amindfv@REDACTED (Tom Murphy) Date: Fri, 20 Jan 2012 13:46:22 -0500 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: On Jan 20, 2012 1:39 AM, "Ahmed Al-Saadi" wrote: > > Abdul Fattah: > > If you want a pure functional language, look at Haskell. A good indication that a programming language is purely functional is its use of monads. > Monads are a way of "interfacing" between pure and impure code, so in a sense this is true, but many languages (like OCaml?) bridge the divide differently. In its essence, having pure functons simply means being able to define functions which are unable to perform side-effects. So Erlang could add support for pure functions, without really needing to change anything else within the language. > Erlang may not be purely functional, but it is certainly pure pleasure ;) > Agreed! As is Haskell - don't let monads scare you. Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From raould@REDACTED Fri Jan 20 19:50:49 2012 From: raould@REDACTED (Raoul Duke) Date: Fri, 20 Jan 2012 10:50:49 -0800 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: yeah, and there are other approaches to doing things like "state" in purely functional languages. but admittedly they aren't as main-stream as haskell. which is a funny thing to say, if you think about it... From mjtruog@REDACTED Fri Jan 20 20:31:01 2012 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 20 Jan 2012 11:31:01 -0800 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <4F19C0F5.2090304@gmail.com> On 01/20/2012 10:46 AM, Tom Murphy wrote: > > On Jan 20, 2012 1:39 AM, "Ahmed Al-Saadi" > wrote: > > If you want a pure functional language, look at Haskell. A good indication that a programming language is purely functional is its use of monads. > > > > Monads are a way of "interfacing" between pure and impure code, so in a sense this is true, but many languages (like OCaml?) bridge the divide differently. In its essence, having pure functons simply means being able to define functions which are unable to perform side-effects. So Erlang could add support for pure functions, without really needing to change anything else within the language. > Erlang already has pure functions that are called "guards" (these functions do not create side-effects). -------------- next part -------------- An HTML attachment was scrubbed... URL: From masklinn@REDACTED Fri Jan 20 21:02:11 2012 From: masklinn@REDACTED (Masklinn) Date: Fri, 20 Jan 2012 21:02:11 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: <4F19C0F5.2090304@gmail.com> References: <4F19C0F5.2090304@gmail.com> Message-ID: <65DDE40A-E1FB-4D7B-B35B-D7F24744D798@masklinn.net> On 2012-01-20, at 20:31 , Michael Truog wrote: > Erlang already has pure functions that are called "guards" (these functions do not create side-effects). Guards functions are extremely limited (in part because they need to run fast) and can't ? as far as I know ? be created in "userland" code. They're a special existence which is part of Erlang's kernel. While guards are indeed pure function, they're not guards because they're pure functions but are pure functions due to then being guards. From gumm@REDACTED Fri Jan 20 21:08:28 2012 From: gumm@REDACTED (Jesse Gumm) Date: Fri, 20 Jan 2012 14:08:28 -0600 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: <4F19C0F5.2090304@gmail.com> References: <4F19C0F5.2090304@gmail.com> Message-ID: Yes, but there is no way to define your own guards that will be treated by the erlang compiler as such (correct me if I'm wrong), while in haskell you can define a side effect free function, and the compiler will recognize a function prevent you from introducing side effects into said function. In erlang, you can't use user defined functions in guards (because erlang doesn't check side effects in compilation afaik), but if erlang did support done kind of "guaranteed side effect free function definition", then that would perhaps be a road to allowing user defined functions in guards. -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Jan 20, 2012 1:31 PM, "Michael Truog" wrote: > ** > On 01/20/2012 10:46 AM, Tom Murphy wrote: > > On Jan 20, 2012 1:39 AM, "Ahmed Al-Saadi" wrote: > > If you want a pure functional language, look at Haskell. A good > indication that a programming language is purely functional is its use of > monads. > > > > Monads are a way of "interfacing" between pure and impure code, so in a > sense this is true, but many languages (like OCaml?) bridge the divide > differently. In its essence, having pure functons simply means being able > to define functions which are unable to perform side-effects. So Erlang > could add support for pure functions, without really needing to change > anything else within the language. > > Erlang already has pure functions that are called "guards" (these > functions do not create side-effects). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Jan 20 21:11:15 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 20 Jan 2012 13:11:15 -0700 Subject: [erlang-questions] R14B03 compiled code vs R15B compiled code Message-ID: I've been pushing some R15B compiled code to some workstations that have R14B03 on them, but they crash when run. If I take my code and compile it on the R14B03 system and run it, it does not crash. What is the compatibility between versions? I don't remember having any issue in the past between versions (like R14 and R13). Thanks, -wes From ulf@REDACTED Fri Jan 20 21:14:42 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 20 Jan 2012 21:14:42 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: There are domain-specific languages that are entirely pure. One nice example is Cryptol (http://www.cryptol.net, a DSL written in Haskell): An example from (http://hcss-cps.org/events/erkok.pdf): encrypt128 : ([4][32],[4][4][8]) -> [4][4][8]; encrypt128 (initialKey, plainText) = cipherText where { roundKeys = [ initialKey ] # [| nextKey (round, prev) || round <- [1..10] || prev <- roundKeys |]; initialState = first(roundKeys) ^ plainText; rounds = [ initialState ] # [| nextState (prev, roundKey, round) || round <- [1..10] || prev <- rounds || roundKey <- drop (1, roundKeys) |]; cipherText = last(rounds); } BR, Ulf W On 20 Jan 2012, at 16:58, Max Lapshin wrote: > I can't imagine language, which is built only from pure functions. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Jan 20 23:52:33 2012 From: freza@REDACTED (Jachym Holecek) Date: Fri, 20 Jan 2012 17:52:33 -0500 Subject: [erlang-questions] R14B03 compiled code vs R15B compiled code In-Reply-To: References: Message-ID: <20120120225233.GA26500@circlewave.net> # Wes James 2012-01-20: > I've been pushing some R15B compiled code to some workstations that > have R14B03 on them, but they crash when run. If I take my code and > compile it on the R14B03 system and run it, it does not crash. What > is the compatibility between versions? IIRC the contract is that code compiled with R${n} shall work fine with R${N+1} and R${N+2} -- nothing more, especially not in the opposite direction. > I don't remember having any issue in the past between versions > (like R14 and R13). You got lucky I think. BR, -- Jachym From nem@REDACTED Sat Jan 21 00:22:09 2012 From: nem@REDACTED (Geoff Cant) Date: Fri, 20 Jan 2012 15:22:09 -0800 Subject: [erlang-questions] Simultaneous erlang distribution connections Message-ID: <4C60551B-ACA9-4847-A7DE-16045CD57579@erlang.geek.nz> Hi all, I was wondering what happens when two nodes simultaneously attempt to connect erlang distribution connections to each other? Is there a race where one loses and prints a 'connection from disallowed node' message? This is just a theory and I haven't done a complete investigation. I'm just fishing to find out if someone already knows what causes this one. We had a couple of spurious messages along those lines from a node this morning (booting a new node into a 21 node cluster - auto connect is on and there is a user-code node discovery and connection mechanism too, so it's possible we were involved in a few auto connects as well as trying manual connections at the same time). The nodes eventually connected fine, so I don't think cookies or anything were an issue. Cheers, -- Geoff Cant (irc.freenode.net/archaelus, geoff@REDACTED) From comptekki@REDACTED Sat Jan 21 00:29:22 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 20 Jan 2012 16:29:22 -0700 Subject: [erlang-questions] R14B03 compiled code vs R15B compiled code In-Reply-To: <20120120225233.GA26500@circlewave.net> References: <20120120225233.GA26500@circlewave.net> Message-ID: ok thanks. -wes On Fri, Jan 20, 2012 at 3:52 PM, Jachym Holecek wrote: > # Wes James 2012-01-20: >> I've been pushing some R15B compiled code to some workstations that >> have R14B03 on them, but they crash when run. ?If I take my code and >> compile it on the R14B03 system and run it, it does not crash. ?What >> is the compatibility between versions? > > IIRC the contract is that code compiled with R${n} shall work fine > with R${N+1} and R${N+2} -- nothing more, especially not in the > opposite direction. > >> I don't remember having any issue in the past between versions >> (like R14 and R13). > > You got lucky I think. > > BR, > ? ? ? ?-- Jachym From steven.charles.davis@REDACTED Sat Jan 21 23:02:12 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 21 Jan 2012 14:02:12 -0800 (PST) Subject: [erlang-questions] get_env returns a surprise... Message-ID: <4888fb66-4d0a-4bac-b1e6-f497bad8326d@q8g2000yqa.googlegroups.com> Bug or feature? Why does the key included_applications appear twice, i.e. also under env which it is specifically not a part of? 6> application:get_all_key(myapp). {ok,[{description,"My App"}, {id,[]}, {vsn,"1.0.0"}, {modules,[]}, {maxP,infinity}, {maxT,infinity}, {registered,[]}, {included_applications,[public_key,ssl]}, {applications,[kernel,stdlib]}, {env,[{included_applications,[public_key, ssl]}]}, {mod,{ice_app,[]}}, {start_phases,undefined}]} best, /s From phil.toland@REDACTED Sat Jan 21 23:16:31 2012 From: phil.toland@REDACTED (Phillip Toland) Date: Sat, 21 Jan 2012 16:16:31 -0600 Subject: [erlang-questions] Performance issue with snmp In-Reply-To: <4F0EFA28.20902@erix.ericsson.se> References: <4F0D6F12.7000704@erix.ericsson.se> <4F0EFA28.20902@erix.ericsson.se> Message-ID: Sorry it took me so long to get back on this one. I got pulled onto something else for a while. On Thu, Jan 12, 2012 at 9:20 AM, Micael Karlberg wrote: > On 01/11/2012 07:14 PM, Phillip Toland wrote: >> From reading the code it looks like sync_get2 is exactly the same code >> as sync_get. I just ran a quick benchmark and they don't appear to >> perform any differently. > > I did not mention it because it is different, but because its the > "new" version, which provides an easier way to provide arguments (the > timeout time among other things). Now that I look more closely at the signatures I see that. Interesting. > The obvious way *around* this problem is to increase the timeout time as > you increase the load (proportional to N). I tried that and the results were unsatisfactory. I ended up with the timeout set as high as 60 seconds and I was still getting timeouts with a relatively small number of concurrent requests. > Spawning processes in Erlang is cheap, but not free. Having one > process that issues X number of async requests and then await > X replies is cheaper than spawning X processes that each issues > one request and await the reply (even if the waiting is hidden > within snmpm). Right, which is why it didn't make sense to me that I would see any difference between using sync_get and async_get. > But your test will show if there this actually makes a difference. And indeed there was not any difference. > The way the manager is designed, spawning a process for each > request does very little to distribute load, since all that > process does is (basically) to wait for a reply. The actual processing > is done in the snmpm_server and snmpm_net_if processes. Yes, and profiling my simple demo application showed that about 60% of the time for each call was spent in snmp_server and about 40% in snmpm_net_if. I was able to identify some hotspots with the profiling (a lot of time is spent in ETS), but nothing that I feel is a smoking gun for the problem I am seeing. I am coming to the conclusion that the root problem is a mismatch in requirements. It seems that snmpm was built on a few assumptions that are counter to what I am trying to do. For example, that there are a relatively small number of agents with extended interactions with each agent. I, on the other hand, have a huge number of agents and my interactions will be few and brief. Also, snmpm doesn't seem to be designed with concurrency in mind and concurrency is crucial for what I am doing. You cannot, for example, start multiple snmpm applications on different ports to increase concurrency. So that leads me to the conclusion that what I need to do is build an snmp manager that is geared towards my goals and stop trying to fit a square peg into a round hole. I don't relish the idea of building my own manager, but it is hard to escape the conclusion that I cannot make snmpm meet my performance requirements without fundamentally changing the architecture. -- ~p From ulf@REDACTED Sun Jan 22 10:49:04 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 22 Jan 2012 10:49:04 +0100 Subject: [erlang-questions] get_env returns a surprise... In-Reply-To: <4888fb66-4d0a-4bac-b1e6-f497bad8326d@q8g2000yqa.googlegroups.com> References: <4888fb66-4d0a-4bac-b1e6-f497bad8326d@q8g2000yqa.googlegroups.com> Message-ID: <2F7CDE18-D1F6-4734-97F6-852DF0FB6343@feuerlabs.com> It's a feature. :) See the following in application_controller:load/2: NewEnv2 = merge_app_env(NewEnv, CmdLineEnv), NewEnv3 = keyreplaceadd(included_applications, 1, NewEnv2, {included_applications, IncApps}), If I rack my brain, I seem to recall that included applications were added on request from the AXD 301 project. We had so much code, and so many development teams, that we needed a way to automatically integrate the work from several teams into one "top application" (i.e. an instance that could move as one unit during failver and takeover). The prototype was something I wrote, using some Ericsson vernacular and integrating "load module files", .appLm files, into a bigger .app file. During discussions with OTP, we agreed that it could be done in runtime with an 'included_applications' attribute, as long as we could inspect the attribute dynamically. We already had a number of standardized env variables ('$go' and '$takeover' function hooks etc) that were picked up and used by some central coordination functions. However, at the time, application:get_key/2 didn't yet exist, so the quick way to make the 'included_applications' attribute available for inspection was to get to it via application:get_env/2. Of course, there is no reason to keep it around anymore, and I don't think it's even documented anywhere. BR, Ulf W On 21 Jan 2012, at 23:02, Steve Davis wrote: > Bug or feature? Why does the key included_applications appear twice, > i.e. also under env which it is specifically not a part of? > > 6> application:get_all_key(myapp). > {ok,[{description,"My App"}, > {id,[]}, > {vsn,"1.0.0"}, > {modules,[]}, > {maxP,infinity}, > {maxT,infinity}, > {registered,[]}, > {included_applications,[public_key,ssl]}, > {applications,[kernel,stdlib]}, > {env,[{included_applications,[public_key, > ssl]}]}, > {mod,{ice_app,[]}}, > {start_phases,undefined}]} > > best, > /s > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jesper.louis.andersen@REDACTED Sun Jan 22 13:33:19 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sun, 22 Jan 2012 13:33:19 +0100 Subject: [erlang-questions] "Design By Contract" in Erlang In-Reply-To: References: Message-ID: <4F1C020F.4000606@erlang-solutions.com> On 1/11/12 10:19 PM, Zabrane Mickael wrote: > Hi guys, > > Any Erlang library to simply *DbC* (? la Eiffel)? > I tend to just do: foo(Args) when GuardArgs -> true = assert_precondition(Args), Result = ... true = assert_postcondition(Result), Result. Where GuardArgs protects the inbound arguments as much as possible. The basic idea is that if your assumptions are not satisfied, you crash before you begin doing bad stuff. As long as your functions are pure, this works well. Also note that in many cases, providing such pre/post-conditions actually strengthens the dialyzer quite a bit since it uses the information to narrow down the valid control-flow/data-flow paths in the code. That said, I am not consistent in writing code like this. I tend to assert certain situations now and then, especially if the code has proven to be tricky. In fact, if you look at typical erlang code, {ok, R} = ... is such an assertion. It protects the caller by asserting that a certain operation succeeded. I'll recommend code be built around this and then handling the crashes properly. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sun Jan 22 15:02:23 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sun, 22 Jan 2012 14:02:23 +0000 Subject: [erlang-questions] R14B03 compiled code vs R15B compiled code In-Reply-To: <20120120225233.GA26500@circlewave.net> References: <20120120225233.GA26500@circlewave.net> Message-ID: On 20 January 2012 22:52, Jachym Holecek wrote: > # Wes James 2012-01-20: > > I've been pushing some R15B compiled code to some workstations that > > have R14B03 on them, but they crash when run. If I take my code and > > compile it on the R14B03 system and run it, it does not crash. What > > is the compatibility between versions? > > IIRC the contract is that code compiled with R${n} shall work fine > with R${N+1} and R${N+2} -- nothing more, especially not in the > opposite direction. > > Is the *official line* wrt compatibility between OTP releases documented somewhere? We produce binary artefacts that get stashed in a repository and used as dependencies for build/deployment and I'd like to understand what we should be doing about different erts versions on the target environment. -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Sun Jan 22 15:15:46 2012 From: freza@REDACTED (Jachym Holecek) Date: Sun, 22 Jan 2012 09:15:46 -0500 Subject: [erlang-questions] R14B03 compiled code vs R15B compiled code In-Reply-To: References: <20120120225233.GA26500@circlewave.net> Message-ID: <20120122141546.GA8610@circlewave.net> # Tim Watson 2012-01-22: > On 20 January 2012 22:52, Jachym Holecek wrote: > > > # Wes James 2012-01-20: > > > I've been pushing some R15B compiled code to some workstations that > > > have R14B03 on them, but they crash when run. If I take my code and > > > compile it on the R14B03 system and run it, it does not crash. What > > > is the compatibility between versions? > > > > IIRC the contract is that code compiled with R${n} shall work fine > > with R${N+1} and R${N+2} -- nothing more, especially not in the > > opposite direction. > > Is the *official line* wrt compatibility between OTP releases documented > somewhere? We produce binary artefacts that get stashed in a repository and > used as dependencies for build/deployment and I'd like to understand what > we should be doing about different erts versions on the target environment. See http://erlang.org/pipermail/erlang-questions/2011-June/059464.html BR, -- Jachym From avinash@REDACTED Sun Jan 22 15:21:01 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Sun, 22 Jan 2012 19:51:01 +0530 (IST) Subject: [erlang-questions] Push/Pull messaging using CosEvent Message-ID: <1327242061.61094.YahooMailNeo@web5603.biz.mail.in.yahoo.com> I have a system state partitioned into roles as suppliers and consumers, communicating over untyped push/pull messaging model. I have little familiarity in OrbixEvents on how to do this, but I am completely new to Erlang, hence taking a short cut to query on you (the community). Supposing that both supplier and consumer are passive and thus required to be acted upon explicitly from the channel (performing the role of an agent), OrbixEvents Service does not automatically pull the supplier and push the consumer (or, let me say - I do not know how to do this in Orbix). Will this be the case too in Erlang's CosEvent implementation?? Or, is my expectation wrong that no channel code (proxies for suppliers and consumers) needs to be written to get passive supplier and consumer to communicate, and that it's the responsibility of the channel service provider to arrange for their communication once suppliers and consumers are hooked onto the channel? Please advise. Thanks Avinash PS: I have tried to use Erlang's built-in (raw) messaging model, but found that it was too hard (for me) to do it. But, then, noticed the CosEvent implementation in Erlang's library. The abstractions provided in CosEvent for decoupled communication using push/pull messaging seem indispensable (to me). Please advise also if there are similar high level abstractions available elsewhere within Erlang's domain for realising push/pull system architectures. Thanks, again. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Sun Jan 22 20:16:13 2012 From: mjtruog@REDACTED (Michael Truog) Date: Sun, 22 Jan 2012 11:16:13 -0800 Subject: [erlang-questions] Push/Pull messaging using CosEvent In-Reply-To: <1327242061.61094.YahooMailNeo@web5603.biz.mail.in.yahoo.com> References: <1327242061.61094.YahooMailNeo@web5603.biz.mail.in.yahoo.com> Message-ID: <4F1C607D.40109@gmail.com> On 01/22/2012 06:21 AM, Avinash Dhumane wrote: > I have tried to use Erlang's built-in (raw) messaging model, but found that it was too hard (for me) to do it. But, then, noticed the CosEvent implementation in Erlang's library. The abstractions provided in CosEvent for decoupled communication using push/pull messaging seem indispensable (to me). Please advise also if there are similar high level abstractions available elsewhere within Erlang's domain for realising push/pull system architectures. Thanks, again. You might like CloudI (http://cloudi.org). Within CloudI, a channel is a service name that services subscribe or unsubscribe. The messaging is for any data (no formatting or schema imposed), while binary data is used when messaging external (written in C/C++, Java, Python, or Ruby) services. The messages are not meant to be persistent (that is what a database is for) so they include a timeout, a priority, and a uuid for tracking (transId). With service replication and context-dependent error handling, there should be no need for persistent messaging. The main messaging functions within the CloudI API are: send_async, send_sync, mcast_async, recv_async, return, and forward. From steven.charles.davis@REDACTED Sun Jan 22 22:52:50 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 22 Jan 2012 13:52:50 -0800 (PST) Subject: [erlang-questions] get_env returns a surprise... In-Reply-To: <2F7CDE18-D1F6-4734-97F6-852DF0FB6343@feuerlabs.com> References: <4888fb66-4d0a-4bac-b1e6-f497bad8326d@q8g2000yqa.googlegroups.com> <2F7CDE18-D1F6-4734-97F6-852DF0FB6343@feuerlabs.com> Message-ID: <30629cd5-3f7c-4223-9e92-ac4e49cb8815@l19g2000yqj.googlegroups.com> A more interesting answer than I expected... it's always nice to hear snippets from the history of Erlang. Thank you for the insight, Ulf! I guess it probably should be removed some time for consistency's sake. It's not terribly harmful, just weird. /s On Jan 22, 3:49 am, Ulf Wiger wrote: > It's a feature. :) From ok@REDACTED Mon Jan 23 04:47:10 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 23 Jan 2012 16:47:10 +1300 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <2A992A2D-90B7-4B96-A3E5-D95CA3403360@cs.otago.ac.nz> On 20/01/2012, at 3:52 AM, Gleb Peregud wrote: > It's incorrect. It is possible to write a pure functions in Erlang, > but it is possible to have side effects like: > - sending messages to other processes (changes state of other process) > - mutating own process dictionary > - manipulating ETS tables > - changing things like operating system environmental variables, etc. It's worth noting that the process dictionary can be regarded in a pure functional way. That is, you can understand each Erlang function definition as a short-hand for an "underlying" function which would be pure if it didn't use any of the other features. To keep this message short, I'll use a tiny example. State threading is pretty well understood, and was used as part of the demonstration that the programming language Euclid could be regarded as pure functional; before that it was used to convert Fortran to Lisp for the Boyer-Moore prover. f(X) -> g(h(X), m(X)). f(X, State0) -> {T1,State1} = h(X, State0), {T2,State2} = m(X, State1), g(T1, T2, State2). Then get(K) => {get(K, State), State} put/1 is one of the few things that makes a new state. The big deal that makes Erlang impure, of course, is one of its reasons for existence: you can dynamically load and unload modules. From sam@REDACTED Mon Jan 23 06:57:16 2012 From: sam@REDACTED (Sam Bobroff) Date: Mon, 23 Jan 2012 16:57:16 +1100 Subject: [erlang-questions] Code/Hot/Loading In-Reply-To: References: Message-ID: Sorry I'm a little late with my reply, but the situation is not as simple as that (at least as of R14B02, I have not re-tested R15): funs can migrate between versions of a module in some situations. Here's the thread where I asked a similar question: http://erlang.org/pipermail/erlang-questions/2011-May/058301.html Another older thread is referenced in that one and it's also interesting. Sam. On 17 January 2012 04:31, Jon Watte wrote: > Funs are always bound to the code they are initially loaded from. Only > name look-ups are affected by code loading AFAICT. > > This has been a source of exceptions in our previous development, because > the first time you load new code, F is still valid, but the second time you > load new code, the old code is purged and F is now invalid. Any call to it > will generate an exception. > > We ended up wrapping our needs for lambdas in a module with state instead. > Not the most elegant, but allows us to get "dynamic lambdas." If all you > need in the fun is module:function, you can use a tuple for that instead of > a fun. > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > On Mon, Jan 16, 2012 at 6:41 AM, Gokul Evuri wrote: > >> so for instance >> >> f() -> 3. >> x() -> F = fun() -> f() end, >> A = f(), >> B = ?MODULE:f(), >> C = F(). >> >> right after F hash been defined, >> >> a new version of code for f() is defined as follows >> >> f()-> threeand loaded. >> >> What would be the value of C. >> >> -- >> *Gokul Reddy Evuri,* >> *IT Universitet **G?teborg**,* >> *G?teborg,* >> *Sverige.* >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgustavsson@REDACTED Mon Jan 23 10:39:04 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 23 Jan 2012 10:39:04 +0100 Subject: [erlang-questions] Code/Hot/Loading In-Reply-To: References: Message-ID: On 1/23/12, Sam Bobroff wrote: > Sorry I'm a little late with my reply, but the situation is not as simple > as that (at least as of R14B02, I have not re-tested R15): funs can migrate > between versions of a module in some situations. > > Here's the thread where I asked a similar question: > > http://erlang.org/pipermail/erlang-questions/2011-May/058301.html > > Another older thread is referenced in that one and it's also interesting. > This problem has been fixed in R15B. Here is the release note from the README: OTP-9667 The calculation of the 'uniq' value for a fun (see erlang:fun_info/1) was too weak and has been strengthened. It used to be based on the only the code for the fun body, but it is now based on the MD5 of the BEAM code for the module. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Jan 23 11:10:00 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 23 Jan 2012 11:10:00 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On 1/18/12, Jon Watte wrote: > I have a separate question about this. > > {M, F} references survive code reload and old code purge. That is, you can > hold on to these references "forever." > fun() -> M:F() end does not -- once the code that defined the fun is > purged, any reference will now generate an exception when called. > > Will "fun M:F/A" survive reloads and old code purge, and behave like the > tuple function? > Yes. This behavior is documented at the end of section 7.17 in the reference manual: http://www.erlang.org/doc/reference_manual/expressions.html#id77989 /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Jan 23 11:13:22 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 23 Jan 2012 11:13:22 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On 1/19/12, Valentin Micic wrote: > Really sorry for rewinding this conversation back a bit, but I am getting a > bit confused... > So, let me ask explicitly: is the following syntax going to be valid going > forward (e.g. R16 onwards): > >> >> Eshell V5.9 (abort with ^G) >> 1> erlang:length([1,2,3]). >> 3 >> 2> M = erlang. >> erlang >> 3> M:length([1,2,3]). >> 3 Yes. This will continue to work regardless of what happens to parameterized modules. (This syntax is much older than parameterized modules.) /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Mon Jan 23 11:25:32 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 23 Jan 2012 11:25:32 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: On 1/10/12, Yurii Rashkovskii wrote: > Hi, > > I was wondering if anybody (especially from the OTP team) can shed > some light on the following subject. > > In R15 we've got this: > > OTP-9649 Tuple funs (a two-element tuple with a module name and a > function) are now officially deprecated and will be removed > in R16. Use 'fun M:F/A' instead. To make you aware that your > system uses tuple funs, the very first time a tuple fun is > applied, a warning will be sent to the error logger. > > Which is fine. > > But I was wondering if there's any word out about the fate of tuple > modules? The ones like {erlang}:element(1). Are they expected to be > kept around? (I certainly hope they are :) > No, we don't expect to keep them. As pointed out by others, "tuple modules" is just an implementation detail of parameterized modules (which is an experimental feature). We have not reached a decision yet, but in the future we expect we will do one of two things: * Remove parameterized modules completely from the compiler and run-time system. OR * Implement parameterized modules properly by creating a new data type, both to allow better type checking by Dialyzer, and to possibly improve performance. /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From jwatte@REDACTED Mon Jan 23 18:28:25 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 23 Jan 2012 09:28:25 -0800 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: What does "pure" mean anyway? The reason we run computer programs is to enjoy their side effects. If a program does not change some observable state (display, disk, network, etc) then that program is useless to any user. This is why every functional language actually used to build applications has some way of dealing with (and generating) side effects. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Thu, Jan 19, 2012 at 6:42 AM, Abdul Fattah Mahran wrote: > Hi All, > I want to know if Erlang pure functional programming language or not? I > can't find a clear document that states this. If someone can tell where I > can find this information in Erlang documentation it will help a lot. > > Thanks > Best Regards, > Abd El-Fattah Mahran > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Mon Jan 23 19:17:44 2012 From: tony@REDACTED (Tony Rogvall) Date: Mon, 23 Jan 2012 19:17:44 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: <106B95EB-E79A-4FE1-BEF6-72144CA67541@rogvall.se> On 23 jan 2012, at 18:28, Jon Watte wrote: > What does "pure" mean anyway? > The reason we run computer programs is to enjoy their side effects. > If a program does not change some observable state (display, disk, network, etc) then that program is useless to any user. > This is why every functional language actually used to build applications has some way of dealing with (and generating) side effects. > Think of your self as part of a grand scale state threading, it just make sense. /Tony > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. > > > > On Thu, Jan 19, 2012 at 6:42 AM, Abdul Fattah Mahran wrote: > Hi All, > I want to know if Erlang pure functional programming language or not? I can't find a clear document that states this. If someone can tell where I can find this information in Erlang documentation it will help a lot. > > Thanks > Best Regards, > Abd El-Fattah Mahran > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From masklinn@REDACTED Mon Jan 23 19:30:26 2012 From: masklinn@REDACTED (Masklinn) Date: Mon, 23 Jan 2012 19:30:26 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: On 2012-01-23, at 18:28 , Jon Watte wrote: > What does "pure" mean anyway? > The reason we run computer programs is to enjoy their side effects. Not entirely true, there are numerous applications to pure computations (although they are frequently forced into impurity due to limitations of the implementation's support). `grep` in a unix pipe is essentially a pure function, are you going to call it useless? What possible side-effects of it would you enjoy? > If a program does not change some observable state (display, disk, network, > etc) then that program is useless to any user. See above. > This is why every functional language actually used to build applications > has some way of dealing with (and generating) side effects. Of course. On the other hand, the better you can segregate these side-effects the easier it is to reason about the program and its parts, the easier it is to test it, the easier it is to validate it, ?. Hence the search for a practical language trying for extensive purity. From gianfranco.alongi@REDACTED Mon Jan 23 19:46:09 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 23 Jan 2012 19:46:09 +0100 Subject: [erlang-questions] Does Erlang pure functional programming language? In-Reply-To: References: Message-ID: I thought it was implicit that Jon wrote that with a twinkle in the eye (this is a Swedish phrase - sure this is not correct in English), but just in case he did not - I second some of this. Purity: - Deterministic - Easier to test - Easier to reason about Should be the goal. -G On Mon, Jan 23, 2012 at 7:30 PM, Masklinn wrote: > On 2012-01-23, at 18:28 , Jon Watte wrote: >> What does "pure" mean anyway? >> The reason we run computer programs is to enjoy their side effects. > Not entirely true, there are numerous applications to pure computations (although they are frequently forced into impurity due to limitations of the implementation's support). `grep` in a unix pipe is essentially a pure function, are you going to call it useless? What possible side-effects of it would you enjoy? > >> If a program does not change some observable state (display, disk, network, >> etc) then that program is useless to any user. > See above. > >> This is why every functional language actually used to build applications >> has some way of dealing with (and generating) side effects. > Of course. On the other hand, the better you can segregate these side-effects the easier it is to reason about the program and its parts, the easier it is to test it, the easier it is to validate it, ?. Hence the search for a practical language trying for extensive purity. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From sam@REDACTED Mon Jan 23 22:21:40 2012 From: sam@REDACTED (Sam Bobroff) Date: Tue, 24 Jan 2012 08:21:40 +1100 Subject: [erlang-questions] Code/Hot/Loading In-Reply-To: References: Message-ID: 2012/1/23 Bj?rn Gustavsson > On 1/23/12, Sam Bobroff wrote: > > Sorry I'm a little late with my reply, but the situation is not as simple > > as that (at least as of R14B02, I have not re-tested R15): funs can > migrate > > between versions of a module in some situations. > > > > Here's the thread where I asked a similar question: > > > > http://erlang.org/pipermail/erlang-questions/2011-May/058301.html > > > > Another older thread is referenced in that one and it's also interesting. > > > > This problem has been fixed in R15B. Here is the release note > from the README: > > OTP-9667 The calculation of the 'uniq' value for a fun (see > erlang:fun_info/1) was too weak and has been strengthened. It > used to be based on the only the code for the fun body, but > it is now based on the MD5 of the BEAM code for the module. > > /Bj?rn > Thank you! It's great to have that cleared up :-) Sam. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yrashk@REDACTED Mon Jan 23 23:20:32 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Mon, 23 Jan 2012 14:20:32 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Hi Bj?rn, Understandable. The only problem that I see with this decision is that a considerable number of projects use this feature, even without using parametrized modules directly (off the top of my head I can remember a few but I am pretty sure there's much more). And yes, I do understand that this feature was experimental. But there's also reality of its use. Yurii. 2012/1/23 Bj?rn Gustavsson : > On 1/10/12, Yurii Rashkovskii wrote: >> Hi, >> >> I was wondering if anybody (especially from the OTP team) can shed >> some light on the following subject. >> >> In R15 we've got this: >> >> OTP-9649 ?Tuple funs (a two-element tuple with a module name and a >> ? ? ? ? ? ? function) are now officially deprecated and will be removed >> ? ? ? ? ? ? in R16. Use 'fun M:F/A' instead. To make you aware that your >> ? ? ? ? ? ? system uses tuple funs, the very first time a tuple fun is >> ? ? ? ? ? ? applied, a warning will be sent to the error logger. >> >> Which is fine. >> >> But I was wondering if there's any word out about the fate of tuple >> modules? The ones like {erlang}:element(1). Are they expected to be >> kept around? (I certainly hope they are :) >> > > No, we don't expect to keep them. > > As pointed out by others, "tuple modules" is just an implementation > detail of parameterized modules (which is an experimental feature). > > We have not reached a decision yet, but in the future we expect > we will do one of two things: > > * Remove parameterized modules completely from the compiler > and run-time system. > > OR > > * Implement parameterized modules properly by creating a new > data type, both to allow better type checking by Dialyzer, and > to possibly improve performance. > > /Bj?rn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From yrashk@REDACTED Tue Jan 24 00:22:48 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Mon, 23 Jan 2012 15:22:48 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Bj?rn, Is there any way tuple module calls can be separated from parametrized modules and subsequently documented and become part of standard Erlang? Yurii >> But I was wondering if there's any word out about the fate of tuple >> modules? The ones like {erlang}:element(1). Are they expected to be >> kept around? (I certainly hope they are :) >> > > No, we don't expect to keep them. > > As pointed out by others, "tuple modules" is just an implementation > detail of parameterized modules (which is an experimental feature). > > We have not reached a decision yet, but in the future we expect > we will do one of two things: > > * Remove parameterized modules completely from the compiler > and run-time system. > > OR > > * Implement parameterized modules properly by creating a new > data type, both to allow better type checking by Dialyzer, and > to possibly improve performance. > > /Bj?rn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bgustavsson@REDACTED Tue Jan 24 07:29:50 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 24 Jan 2012 07:29:50 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: 2012/1/23 Yurii Rashkovskii : > Hi Bj?rn, > > Understandable. The only problem that I see with this decision is that > a considerable number of projects use this feature, even without using > parametrized modules directly (off the top of my head I can remember a > few but I am pretty sure there's much more). > To inform our decision, it would be very interesting to know: 1) Why are projects using "tuple modules"? Is is because the syntax is easy to use or is because of performance or some other reason? 2) Could the projects use parameterized modules instead? 3) Which are the projects? /Bj?rn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From yrashk@REDACTED Tue Jan 24 07:49:16 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Mon, 23 Jan 2012 22:49:16 -0800 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: > To inform our decision, it would be very interesting to know: > > 1) Why are projects using "tuple modules"? Is is because > the syntax is easy to use or is because of performance or > some other reason? I can't speak for everybody, but I can speak of our own use. In different cases it is obviously a slightly different reason. In our latest case, it is not an "ease of use" of the syntax, but a whole way to establish a certain type of operations. This project (not yet released as open source, but eventually will be) is a relational database mapper akin to ActiveRecord. It allows us to map records describing the structute of tables to be mapped to modules that implement their functionality. So, suppose we have db_User record: -record(db_User, { id, email, password }). and a respective db_User module: -module(db_User). -extends(db_model). -include("models.hrl") As you can see, this module exports nothing. However, because of -extends attribute, it will redirect all those missed calls to db_model module. With tuple calls, the magic happens around there. When, for example, someone executes User:save(), it gets ultimately converted to db_model:save(#db_User{}) which can take care of saving the record. Moreover, db_model:save/1 attempts to call before_save / after_save callbacks if they are defined in db_User. The way it does it is fairly simple: it just calls User:callback_name() and if it is not defined, that call again goes to the default implementation in db_model. Of course it is technically possible to implement all of this without tuple calls (at an expense of worse syntax), but obviously I'd rather keep it as is as it works fantastically. > > 2) Could the projects use parameterized modules instead? Some could, I suppose. But a lot of developers (including myself) are avoiding them because of their many problems, like obscuring functions arities. Tuple calls don't do that, your module source has functions the way they eventually will be available in a compiled form. I suppose you're talking about refined parametrized modules that don't use tuples and use their own type. In this case the above project will suffer a damage as it is an important feature of the project to keep database records as records so that they can be easily matched. Unless this new type provides a clear alternative to the above, it'll force us into rewriting the whole thing once tuple calls are removed. > > 3) Which are the projects? I just started collecting the list at https://github.com/yrashk/9649-consequences ? obviously this list is far from completion and doesn't account for non-opensource projects. Yurii. From bgustavsson@REDACTED Tue Jan 24 08:22:20 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 24 Jan 2012 08:22:20 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: 2012/1/24 Yurii Rashkovskii : > Bj?rn, > > Is there any way tuple module calls can be separated from parametrized > modules and subsequently documented and become part of standard > Erlang? > Perhaps. The problem with the current implementation of "tuple modules" is that the M in apply(M, F, A) and M:F(...) has a strange type, i.e. M can be either an atom or a tuple. Unless we implement parameterized modules, we want M to be only an atom. (There is a run-time cost in the implementation of apply/3 to allow parameterized modules/"tuple modules", and parameterized modules prevented an optimization I wanted to do in the compiler for R15B.) We might consider an alternative implementation of "tuple modules" that does not use apply(M, F, A) or M:F(...), using either new BIFs or new syntax. (Example: tuple_module_apply(M, F, A) could behave as apply/3 currently behaves, or alternatively only allow M to be a tuple. This is not a serious suggestion, just an example to make it clear what I mean.) I suggest that you write an EEP. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From majek04@REDACTED Tue Jan 24 15:59:46 2012 From: majek04@REDACTED (Marek Majkowski) Date: Tue, 24 Jan 2012 14:59:46 +0000 Subject: [erlang-questions] is length(L) fast? In-Reply-To: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> References: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> Message-ID: On Wed, Jan 4, 2012 at 16:38, Zabrane Mickael wrote: > Is the call to length(L) traverse all the list ? > or is it something already pre-computed internally (i.e constant time = > fast)? May be out of interest: http://www.lshift.net/blog/2010/02/28/memory-matters-even-in-erlang Cheers, Marek From reynaldomic@REDACTED Tue Jan 24 20:31:19 2012 From: reynaldomic@REDACTED (Reynaldo Baquerizo) Date: Tue, 24 Jan 2012 14:31:19 -0500 Subject: [erlang-questions] chained functions Message-ID: <20120124143119.3f06e43c@bertello> A friend of mine asked: ## If you have functions that return {ok, Result} | {error, Reason} how do you chained them? So that you have: w(x(y(z(...)))) without building a staircasing. Something that would be done in Haskell with monads. ## I would probably go for: x({ok, Value}) -> NewValue = , {ok, NewValue}; x({error, Reason}) -> {error, Reason}. in each function which brings me other question, when do you tag return values? I tend to only use tagged return values with impure functions, were an error is more likely due to side effects. -- Reynaldo From watson.timothy@REDACTED Tue Jan 24 21:22:32 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 24 Jan 2012 20:22:32 +0000 Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> References: <20120124143119.3f06e43c@bertello> Message-ID: https://github.com/rabbitmq/erlando provides an implementation of monads that'll do what I think you want: write_file(Path, Data, Modes) -> Modes1 = [binary, write | (Modes -- [binary, write])], do([error_m || Bin <- make_binary(Data), {ok, Hdl} <- file:open(Path, Modes1), {ok, Result} <- return(do([error_m || ok <- file:write(Hdl, Bin), file:sync(Hdl)])), file:close(Hdl), Result]). On 24 January 2012 19:31, Reynaldo Baquerizo wrote: > > A friend of mine asked: > > ## > If you have functions that return {ok, Result} | {error, Reason} > how do you chained them? So that you have: > > w(x(y(z(...)))) > > without building a staircasing. Something that would be done in Haskell > with monads. > ## > > I would probably go for: > > x({ok, Value}) -> > NewValue = , > {ok, NewValue}; > x({error, Reason}) -> > {error, Reason}. > > in each function > > which brings me other question, when do you tag return values? > > I tend to only use tagged return values with impure functions, were an > error is more likely due to side effects. > > -- > Reynaldo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Tue Jan 24 22:17:47 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Tue, 24 Jan 2012 22:17:47 +0100 Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> References: <20120124143119.3f06e43c@bertello> Message-ID: If all your functions F_1 ... F_K have the type F({ok,Result} | {error,Reason} ) -> {ok,Result} | {error,Reason} then I would probably write a small sequencer as seq({ok,Result},[ F | T ]) -> seq(F(Res),T); seq(Error,T) -> Error. And call it like seq({ok,Initial},[ fun F_1, ..., fun F_K ]) I always try to tag values, so you can use it to determine flow control. Cheers G On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo wrote: > > A friend of mine asked: > > ## > If you have functions that return {ok, Result} | {error, Reason} > how do you chained them? So that you have: > > w(x(y(z(...)))) > > without building a staircasing. Something that would be done in Haskell > with monads. > ## > > I would probably go for: > > x({ok, Value}) -> > ?NewValue = , > ?{ok, NewValue}; > x({error, Reason}) -> > ?{error, Reason}. > > in each function > > which brings me other question, when do you tag return values? > > I tend to only use tagged return values with impure functions, were an > error is more likely due to side effects. > > -- > Reynaldo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gianfranco.alongi@REDACTED Tue Jan 24 22:24:31 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Tue, 24 Jan 2012 22:24:31 +0100 Subject: [erlang-questions] chained functions In-Reply-To: References: <20120124143119.3f06e43c@bertello> Message-ID: What an error! Should be: If all your functions F_1 ... F_K have the type F(Input) -> ?{ok,Result} | {error,Reason} then I would probably write a small sequencer as seq(X,[]) -> X; seq({ok,Result},[ F | T ]) -> ?seq(F(Res),T); seq({error,Reason},_) -> ?{error,Reason}. And call it like seq({ok,Initial},[ fun F_1, ..., fun F_K ]) /G (And that's why you don't write your emails in a haste before bed!!!) On Tue, Jan 24, 2012 at 10:17 PM, Gianfranco Alongi wrote: > If all your functions F_1 ... F_K have the type > > F({ok,Result} | {error,Reason} ) -> ?{ok,Result} | {error,Reason} > > then I would probably write a small sequencer as > > seq({ok,Result},[ F | T ]) -> > ?seq(F(Res),T); > seq(Error,T) -> > ?Error. > > And call it like > > seq({ok,Initial},[ fun F_1, ..., fun F_K ]) > > I always try to tag values, so you can use it to determine flow control. > > Cheers > G > > On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo > wrote: >> >> A friend of mine asked: >> >> ## >> If you have functions that return {ok, Result} | {error, Reason} >> how do you chained them? So that you have: >> >> w(x(y(z(...)))) >> >> without building a staircasing. Something that would be done in Haskell >> with monads. >> ## >> >> I would probably go for: >> >> x({ok, Value}) -> >> ?NewValue = , >> ?{ok, NewValue}; >> x({error, Reason}) -> >> ?{error, Reason}. >> >> in each function >> >> which brings me other question, when do you tag return values? >> >> I tend to only use tagged return values with impure functions, were an >> error is more likely due to side effects. >> >> -- >> Reynaldo >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Tue Jan 24 22:21:57 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 24 Jan 2012 22:21:57 +0100 Subject: [erlang-questions] is length(L) fast? In-Reply-To: References: <261F43F6-C7F8-4CB6-B1F6-5862E069DB93@gmail.com> Message-ID: Very interesting analysis. Thanks Marek. Regards, Zabrane On Jan 24, 2012, at 3:59 PM, Marek Majkowski wrote: > On Wed, Jan 4, 2012 at 16:38, Zabrane Mickael wrote: >> Is the call to length(L) traverse all the list ? >> or is it something already pre-computed internally (i.e constant time = >> fast)? > > May be out of interest: > http://www.lshift.net/blog/2010/02/28/memory-matters-even-in-erlang > > Cheers, > Marek From alexey.v.romanov@REDACTED Wed Jan 25 07:17:50 2012 From: alexey.v.romanov@REDACTED (Alexey Romanov) Date: Wed, 25 Jan 2012 09:17:50 +0300 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: <4EEB4BC3.9070909@erix.ericsson.se> References: <4EEB4BC3.9070909@erix.ericsson.se> Message-ID: Thank you! I'll try to fix it this or next month, when I have time. Yours, Alexey Romanov On Fri, Dec 16, 2011 at 5:46 PM, Sverker Eriksson wrote: > >> You must rebuild it with Erlang R15B to work. >> > > Not just rebuild: > > http://www.erlang.org/doc/man/erl_driver.html#rewrites_for_64_bits > > > /Sverker, Erlang/OTP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bengt.kleberg@REDACTED Wed Jan 25 08:53:27 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 25 Jan 2012 08:53:27 +0100 Subject: [erlang-questions] chained functions In-Reply-To: References: <20120124143119.3f06e43c@bertello> Message-ID: <1327478007.5010.1.camel@seasc1137> Greetings, For things like this (seq/2 below) there is also lists:foldl/3 and lists:foldr/3 bengt On Tue, 2012-01-24 at 22:24 +0100, Gianfranco Alongi wrote: > What an error! > Should be: > > If all your functions F_1 ... F_K have the type > > F(Input) -> {ok,Result} | {error,Reason} > > then I would probably write a small sequencer as > > seq(X,[]) -> > X; > seq({ok,Result},[ F | T ]) -> > seq(F(Res),T); > seq({error,Reason},_) -> > {error,Reason}. > > And call it like > > seq({ok,Initial},[ fun F_1, ..., fun F_K ]) > > /G > > (And that's why you don't write your emails in a haste before bed!!!) > > On Tue, Jan 24, 2012 at 10:17 PM, Gianfranco Alongi > wrote: > > If all your functions F_1 ... F_K have the type > > > > F({ok,Result} | {error,Reason} ) -> {ok,Result} | {error,Reason} > > > > then I would probably write a small sequencer as > > > > seq({ok,Result},[ F | T ]) -> > > seq(F(Res),T); > > seq(Error,T) -> > > Error. > > > > And call it like > > > > seq({ok,Initial},[ fun F_1, ..., fun F_K ]) > > > > I always try to tag values, so you can use it to determine flow control. > > > > Cheers > > G > > > > On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo > > wrote: > >> > >> A friend of mine asked: > >> > >> ## > >> If you have functions that return {ok, Result} | {error, Reason} > >> how do you chained them? So that you have: > >> > >> w(x(y(z(...)))) > >> > >> without building a staircasing. Something that would be done in Haskell > >> with monads. > >> ## > >> > >> I would probably go for: > >> > >> x({ok, Value}) -> > >> NewValue = , > >> {ok, NewValue}; > >> x({error, Reason}) -> > >> {error, Reason}. > >> > >> in each function > >> > >> which brings me other question, when do you tag return values? > >> > >> I tend to only use tagged return values with impure functions, were an > >> error is more likely due to side effects. > >> > >> -- > >> Reynaldo > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From robert.virding@REDACTED Wed Jan 25 10:06:03 2012 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 25 Jan 2012 09:06:03 -0000 (GMT) Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> Message-ID: <5aaa1614-b662-462d-9ca1-70558e6ba41f@knuth> I personally am ok with "staircasing" so I don't see the problem. :-) This probably comes from working with it for a long time. Also I find that very often the handling of returns values is more complex than just chaining things through. I also feel there is a benefit in being very explicit with values being returned so you see what is happening. You tag the return value of a function when you need to clearly show whether the function has "succeeded" or "failed". Often the value in itself is not enough. For example a value could both be a valid return and an error reason which case you need to tag it to differentiate between them. Robert ----- Original Message ----- > > A friend of mine asked: > > ## > If you have functions that return {ok, Result} | {error, Reason} > how do you chained them? So that you have: > > w(x(y(z(...)))) > > without building a staircasing. Something that would be done in > Haskell > with monads. > ## > > I would probably go for: > > x({ok, Value}) -> > NewValue = , > {ok, NewValue}; > x({error, Reason}) -> > {error, Reason}. > > in each function > > which brings me other question, when do you tag return values? > > I tend to only use tagged return values with impure functions, were > an > error is more likely due to side effects. > > -- > Reynaldo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From rtrlists@REDACTED Wed Jan 25 10:35:02 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 25 Jan 2012 09:35:02 +0000 Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> References: <20120124143119.3f06e43c@bertello> Message-ID: On Tue, Jan 24, 2012 at 7:31 PM, Reynaldo Baquerizo wrote: > > A friend of mine asked: > > ## > If you have functions that return {ok, Result} | {error, Reason} > how do you chained them? So that you have: > > w(x(y(z(...)))) > > without building a staircasing. Something that would be done in Haskell > with monads. > ## > > I would probably go for: > > x({ok, Value}) -> > NewValue = , > {ok, NewValue}; > x({error, Reason}) -> > {error, Reason}. > > in each function > > which brings me other question, when do you tag return values? > > I tend to only use tagged return values with impure functions, were an > error is more likely due to side effects. > > -- > Reynaldo > > You'll find that pure functions (those without side effects) will rarely return {ok, Value} tuples. You get those usually because the function you are calling is interacting with something stateful. In languages like Java you end up getting gross misuse of exceptions instead of tagged tuple results. I know what I prefer. ;-) Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Wed Jan 25 11:59:50 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 25 Jan 2012 11:59:50 +0100 Subject: [erlang-questions] chained functions In-Reply-To: <1327478007.5010.1.camel@seasc1137> References: <20120124143119.3f06e43c@bertello> <1327478007.5010.1.camel@seasc1137> Message-ID: <4F1FE0A6.1080202@volny.cz> Hello. On 25.1.2012 08:53, Bengt Kleberg wrote: > For things like this (seq/2 below) there is also lists:foldl/3 and > lists:foldr/3 But they're not the same. seq/2 supports early termination (see its last clause) whereas lists:foldl/3 traverses all elements in the list. Thus, you would still have to wrap a call to lists:foldl/3 in an exception trapping code and use throw(Result) in the fold fun to terminate prematuraly (i.e. implement your seq2/2 using lists:foldl/3). I found the original seq/2 (much) easier to understand. Or have I miss anything? Just my 2c, Ladislav Lenart > On Tue, 2012-01-24 at 22:24 +0100, Gianfranco Alongi wrote: >> What an error! >> Should be: >> >> If all your functions F_1 ... F_K have the type >> >> F(Input) -> {ok,Result} | {error,Reason} >> >> then I would probably write a small sequencer as >> >> seq(X,[]) -> >> X; >> seq({ok,Result},[ F | T ]) -> >> seq(F(Res),T); >> seq({error,Reason},_) -> >> {error,Reason}. >> >> And call it like >> >> seq({ok,Initial},[ fun F_1, ..., fun F_K ]) >> >> /G >> >> (And that's why you don't write your emails in a haste before bed!!!) >> >> On Tue, Jan 24, 2012 at 10:17 PM, Gianfranco Alongi >> wrote: >>> If all your functions F_1 ... F_K have the type >>> >>> F({ok,Result} | {error,Reason} ) -> {ok,Result} | {error,Reason} >>> >>> then I would probably write a small sequencer as >>> >>> seq({ok,Result},[ F | T ]) -> >>> seq(F(Res),T); >>> seq(Error,T) -> >>> Error. >>> >>> And call it like >>> >>> seq({ok,Initial},[ fun F_1, ..., fun F_K ]) >>> >>> I always try to tag values, so you can use it to determine flow control. >>> >>> Cheers >>> G >>> >>> On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo >>> wrote: >>>> >>>> A friend of mine asked: >>>> >>>> ## >>>> If you have functions that return {ok, Result} | {error, Reason} >>>> how do you chained them? So that you have: >>>> >>>> w(x(y(z(...)))) >>>> >>>> without building a staircasing. Something that would be done in Haskell >>>> with monads. >>>> ## >>>> >>>> I would probably go for: >>>> >>>> x({ok, Value}) -> >>>> NewValue =, >>>> {ok, NewValue}; >>>> x({error, Reason}) -> >>>> {error, Reason}. >>>> >>>> in each function >>>> >>>> which brings me other question, when do you tag return values? >>>> >>>> I tend to only use tagged return values with impure functions, were an >>>> error is more likely due to side effects. >>>> >>>> -- >>>> Reynaldo >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From jesper.louis.andersen@REDACTED Wed Jan 25 12:04:12 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 25 Jan 2012 12:04:12 +0100 Subject: [erlang-questions] chained functions In-Reply-To: <5aaa1614-b662-462d-9ca1-70558e6ba41f@knuth> References: <5aaa1614-b662-462d-9ca1-70558e6ba41f@knuth> Message-ID: <4F1FE1AC.4060403@erlang-solutions.com> On 1/25/12 10:06 AM, Robert Virding wrote: > I personally am ok with "staircasing" so I don't see the problem. :-) This probably comes from working with it for a long time. Also I find that very often the handling of returns values is more complex than just chaining things through. I also feel there is a benefit in being very explicit with values being returned so you see what is happening. But in Erlang, it isn't often the case of "staircasing" at all as well! In Haskell, you often program defensively, so your code will look like case f x of Nothing -> Just x -> case g x of Nothing -> Just x -> ... And this is a problem because it is irritating to write. So you monad it: do x <- f x x <- g x ... And then you run it and get either a valid result or that some error happened along the way. Where the error happened is now lost on you for the Maybe-Monad but a proper Error Monad can tell you what is wrong as well. But this is Erlang, and Erlang runs everything inside such an Error monad by default: {ok, X1} = f(X), {ok, X2} = g(X1), ... So there is no staircasing going on and an error results in a crash by default. Now you may think that the crash is a bad idea, but often it is the only sensible thing to do first. Don't handle a lot of nasty corner cases before you know that they occur in production code and occur with a frequency that hurts you. You can always do some explicit handling of the error case if necessary later. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From erlang@REDACTED Wed Jan 25 13:16:08 2012 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 25 Jan 2012 13:16:08 +0100 Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> References: <20120124143119.3f06e43c@bertello> Message-ID: I think you are asking the wrong question. If a function returns {ok,Val} | {error,Reason} then I think to myself "the caller of this function expects things to go wrong and is committed to handling *both* return values. So they would *never* write w(x(y(z(....))) because this does not cater for both return values. With the "let it crash" philosophy one would make w,x,y, .. return a value OR call exit(...). With this convention things do nest in the "happy" case without using a staircase. At the top level try or catch is used to catch the error. Alternatively you could say ok({ok,X}) -> X; ok{error,E}) -> exit(E). and then w(ok(x(ok(y(ok(z(X)))))) Not pretty but it does the job /Joe On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo wrote: > > A friend of mine asked: > > ## > If you have functions that return {ok, Result} | {error, Reason} > how do you chained them? So that you have: > > w(x(y(z(...)))) > > without building a staircasing. Something that would be done in Haskell > with monads. > ## > > I would probably go for: > > x({ok, Value}) -> > ?NewValue = , > ?{ok, NewValue}; > x({error, Reason}) -> > ?{error, Reason}. > > in each function > > which brings me other question, when do you tag return values? > > I tend to only use tagged return values with impure functions, were an > error is more likely due to side effects. > > -- > Reynaldo > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From tony@REDACTED Wed Jan 25 14:23:46 2012 From: tony@REDACTED (Tony Rogvall) Date: Wed, 25 Jan 2012 14:23:46 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: <4EEB4BC3.9070909@erix.ericsson.se> Message-ID: <59A7DC68-248D-4FE5-90B1-45237DD6314C@rogvall.se> Hi I am doing some upgrades of drivers right now. I realized that I sometimes need to be able to compile on pre R15 so I came up with the following scheme in drv_x.c: #include "erl_driver.h" // Hack to handle R15 driver used with pre R15 driver #if ERL_DRV_EXTENDED_MAJOR_VERSION == 1 typedef int ErlDrvSizeT; typedef int ErlDrvSSizeT; #endif Then I re-type x_ctl ... I think this will work, at least for me ? Or will there be a 1.x that breaks this ? /Tony On 25 jan 2012, at 07:17, Alexey Romanov wrote: > Thank you! I'll try to fix it this or next month, when I have time. > > Yours, Alexey Romanov > > > > On Fri, Dec 16, 2011 at 5:46 PM, Sverker Eriksson > wrote: >> >>> You must rebuild it with Erlang R15B to work. >>> >> >> Not just rebuild: >> >> http://www.erlang.org/doc/man/erl_driver.html#rewrites_for_64_bits >> >> >> /Sverker, Erlang/OTP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From jakob@REDACTED Wed Jan 25 14:29:20 2012 From: jakob@REDACTED (Jakob Praher) Date: Wed, 25 Jan 2012 14:29:20 +0100 Subject: [erlang-questions] chained functions In-Reply-To: Message-ID: One could also compose a sequence of functions much like in combinator parsing, and fail at the first event returning the error status, otherwise continue to call apply the functions to the result. apply_each([F|FS],X) -> {S, V} = F(X), if S = error -> {S, V} S = ok -> apply_each(FS, V); end . {R, V} = apply_each([z,y,x], Arg). if R = ok -> ... I have not much practice in Erlang (though I have some practice in Prolog), so this might not be 100 % correct. Cheers, Jakob Am Mittwoch, 25. Januar 2012 13:16 CET, Joe Armstrong schrieb: > I think you are asking the wrong question. If a function returns > {ok,Val} | {error,Reason} > then I think to myself "the caller of this function expects things to > go wrong and is > committed to handling *both* return values. > > So they would *never* write w(x(y(z(....))) because this does not cater for both > return values. > > With the "let it crash" philosophy one would make w,x,y, .. return a > value OR call exit(...). > With this convention things do nest in the "happy" case without using > a staircase. > > At the top level try or catch is used to catch the error. > > Alternatively you could say > > ok({ok,X}) -> X; > ok{error,E}) -> exit(E). > > and then > > w(ok(x(ok(y(ok(z(X)))))) > > Not pretty but it does the job > > /Joe > > > On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo > wrote: > > > > A friend of mine asked: > > > > ## > > If you have functions that return {ok, Result} | {error, Reason} > > how do you chained them? So that you have: > > > > w(x(y(z(...)))) > > > > without building a staircasing. Something that would be done in Haskell > > with monads. > > ## > > > > I would probably go for: > > > > x({ok, Value}) -> > > ?NewValue = , > > ?{ok, NewValue}; > > x({error, Reason}) -> > > ?{error, Reason}. > > > > in each function > > > > which brings me other question, when do you tag return values? > > > > I tend to only use tagged return values with impure functions, were an > > error is more likely due to side effects. > > > > -- > > Reynaldo > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From raimo+erlang-questions@REDACTED Wed Jan 25 14:57:57 2012 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 25 Jan 2012 14:57:57 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: <59A7DC68-248D-4FE5-90B1-45237DD6314C@rogvall.se> References: <4EEB4BC3.9070909@erix.ericsson.se> <59A7DC68-248D-4FE5-90B1-45237DD6314C@rogvall.se> Message-ID: <20120125135757.GA19140@erix.ericsson.se> On Wed, Jan 25, 2012 at 02:23:46PM +0100, Tony Rogvall wrote: > > Hi I am doing some upgrades of drivers right now. I realized that I sometimes need to be able to > compile on pre R15 so I came up with the following scheme in drv_x.c: > > #include "erl_driver.h" > > // Hack to handle R15 driver used with pre R15 driver > #if ERL_DRV_EXTENDED_MAJOR_VERSION == 1 > typedef int ErlDrvSizeT; > typedef int ErlDrvSSizeT; > #endif > > Then I re-type x_ctl ... > > I think this will work, at least for me ? Or will there be a 1.x that breaks this ? No. Between major versions (going forward) it is supposed to suffice with recompiling. > > /Tony > > > > On 25 jan 2012, at 07:17, Alexey Romanov wrote: > > > Thank you! I'll try to fix it this or next month, when I have time. > > > > Yours, Alexey Romanov > > > > > > > > On Fri, Dec 16, 2011 at 5:46 PM, Sverker Eriksson > > wrote: > >> > >>> You must rebuild it with Erlang R15B to work. > >>> > >> > >> Not just rebuild: > >> > >> http://www.erlang.org/doc/man/erl_driver.html#rewrites_for_64_bits > >> > >> > >> /Sverker, Erlang/OTP > >> > >> > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From avinash@REDACTED Wed Jan 25 15:30:09 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Wed, 25 Jan 2012 20:00:09 +0530 (IST) Subject: [erlang-questions] Stringified integer with leading zeroes Message-ID: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> How to get an integer 123 as 10-char long string "0000000123" with leading zeroes, i.e. erlang term [48, 48, 48, 48, 48, 48, 48, 49, 50, 51]? Following is not what I expect! I tried with both ~B and ~s. $ erl Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Eshell V5.8.3 ?(abort with ^G) 1> io_lib:fwrite("~B", [123]). ["123"] 2> io_lib:fwrite("~s", ["123"]). ["123"] 3> io_lib:fwrite("~5B", [123]). [[" ?",49,50,51]] 4> io_lib:fwrite("~5..0B", [123]). [["00",49,50,51]] 5> io_lib:fwrite("~5..0s", ["123"]). [["00",49,50,51]] 6> io_lib:fwrite("~5.5.0s", ["123"]). [["00",49,50,51]] 7> io_lib:fwrite("~8..0B", [123]). [[[48,"00",48,48],49,50,51]] 8> io_lib:fwrite("~8..0s", ["123"]). [[[48,"00",48,48],49,50,51]] 9> io_lib:fwrite("~8.8.0s", ["123"]). [[[48,"00",48,48],49,50,51]] 10> io_lib:fwrite("~10..0B", [123]). [[[48,"000",48,48,48],49,50,51]] 11> io_lib:fwrite("~10.10.0s", ["123"]). [[[48,"000",48,48,48],49,50,51]] 12> -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Jan 25 15:37:57 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 25 Jan 2012 15:37:57 +0100 Subject: [erlang-questions] Stringified integer with leading zeroes In-Reply-To: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> References: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> Message-ID: <1327502277.8580.39.camel@seasc1137> Greetings, Please try lists:flatten/1 on the final example (io_lib:fwrite("~10.10.0s", ["123"]).). bengt On Wed, 2012-01-25 at 15:30 +0100, Avinash Dhumane wrote: > How to get an integer 123 as 10-char long string "0000000123" with > leading zeroes, i.e. erlang term [48, 48, 48, 48, 48, 48, 48, 49, 50, > 51]? > > > Following is not what I expect! I tried with both ~B and ~s. > > > $ erl > > Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] > [kernel-poll:false] > > > Eshell V5.8.3 (abort with ^G) > 1> io_lib:fwrite("~B", [123]). > ["123"] > 2> io_lib:fwrite("~s", ["123"]). > ["123"] > 3> io_lib:fwrite("~5B", [123]). > [[" ",49,50,51]] > 4> io_lib:fwrite("~5..0B", [123]). > [["00",49,50,51]] > 5> io_lib:fwrite("~5..0s", ["123"]). > [["00",49,50,51]] > 6> io_lib:fwrite("~5.5.0s", ["123"]). > [["00",49,50,51]] > 7> io_lib:fwrite("~8..0B", [123]). > [[[48,"00",48,48],49,50,51]] > 8> io_lib:fwrite("~8..0s", ["123"]). > [[[48,"00",48,48],49,50,51]] > 9> io_lib:fwrite("~8.8.0s", ["123"]). > [[[48,"00",48,48],49,50,51]] > 10> io_lib:fwrite("~10..0B", [123]). > [[[48,"000",48,48,48],49,50,51]] > 11> io_lib:fwrite("~10.10.0s", ["123"]). > [[[48,"000",48,48,48],49,50,51]] > 12> > > From gustav.simonsson@REDACTED Wed Jan 25 15:39:06 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Wed, 25 Jan 2012 14:39:06 -0000 (GMT) Subject: [erlang-questions] Stringified integer with leading zeroes In-Reply-To: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> Message-ID: <4a24ecf4-eea5-49fe-ac41-10ab59f1ffd1@knuth> Erlang R16B (erts-5.10) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.10 (abort with ^G) 1> lists:flatten(io_lib:format("~5..0B", [123])). "00123" 2> lists:flatten(io_lib:format("~8..0B", [123])). "00000123" 3> Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Avinash Dhumane" To: "Erlang Questions" Sent: Wednesday, January 25, 2012 3:30:09 PM Subject: [erlang-questions] Stringified integer with leading zeroes How to get an integer 123 as 10-char long string "0000000123" with leading zeroes, i.e. erlang term [48, 48, 48, 48, 48, 48, 48, 49, 50, 51]? Following is not what I expect! I tried with both ~B and ~s. $ erl Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Eshell V5.8.3 (abort with ^G) 1> io_lib:fwrite("~B", [123]). ["123"] 2> io_lib:fwrite("~s", ["123"]). ["123"] 3> io_lib:fwrite("~5B", [123]). [[" ",49,50,51]] 4> io_lib:fwrite("~5..0B", [123]). [["00",49,50,51]] 5> io_lib:fwrite("~5..0s", ["123"]). [["00",49,50,51]] 6> io_lib:fwrite("~5.5.0s", ["123"]). [["00",49,50,51]] 7> io_lib:fwrite("~8..0B", [123]). [[[48,"00",48,48],49,50,51]] 8> io_lib:fwrite("~8..0s", ["123"]). [[[48,"00",48,48],49,50,51]] 9> io_lib:fwrite("~8.8.0s", ["123"]). [[[48,"00",48,48],49,50,51]] 10> io_lib:fwrite("~10..0B", [123]). [[[48,"000",48,48,48],49,50,51]] 11> io_lib:fwrite("~10.10.0s", ["123"]). [[[48,"000",48,48,48],49,50,51]] 12> _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From jose.valim@REDACTED Wed Jan 25 15:39:13 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Wed, 25 Jan 2012 15:39:13 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: Since the discussion steered towards "tuple modules", I am going to use the opportunity to ask. The fact that part of the standard library, like the dict module, receives the dict as last argument and the dict itself is a "tuple module" is an accident or a design decision? Does anyone actually write "Dict:find(Key)" instead of "dict:find(key, Dict)"? * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * 2012/1/24 Bj?rn Gustavsson > 2012/1/24 Yurii Rashkovskii : > > Bj?rn, > > > > Is there any way tuple module calls can be separated from parametrized > > modules and subsequently documented and become part of standard > > Erlang? > > > > Perhaps. > > The problem with the current implementation of "tuple modules" > is that the M in apply(M, F, A) and M:F(...) has a strange type, i.e. M can > be either an atom or a tuple. Unless we implement parameterized modules, > we want M to be only an atom. (There is a run-time cost in the > implementation of apply/3 to allow parameterized modules/"tuple modules", > and parameterized modules prevented an optimization I wanted to do in the > compiler for R15B.) > > We might consider an alternative implementation of "tuple modules" > that does not use apply(M, F, A) or M:F(...), using either new BIFs or new > syntax. (Example: tuple_module_apply(M, F, A) could behave as apply/3 > currently behaves, or alternatively only allow M to be a tuple. This is not > a serious suggestion, just an example to make it clear what I mean.) > > I suggest that you write an EEP. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From masklinn@REDACTED Wed Jan 25 15:39:38 2012 From: masklinn@REDACTED (Masklinn) Date: Wed, 25 Jan 2012 15:39:38 +0100 Subject: [erlang-questions] Stringified integer with leading zeroes In-Reply-To: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> References: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> Message-ID: <16A171EB-12D7-4298-8E53-4E89D231DC84@masklinn.net> On 2012-01-25, at 15:30 , Avinash Dhumane wrote: > How to get an integer 123 as 10-char long string "0000000123" with leading zeroes, i.e. erlang term [48, 48, 48, 48, 48, 48, 48, 49, 50, 51]? > > Following is not what I expect! I tried with both ~B and ~s. 5> io_lib:fwrite("~10..0B", [123]). [[[48,"000",48,48,48],49,50,51]] 6> lists:flatten(io_lib:fwrite("~10..0B", [123])). "0000000123" io_lib:fwrite returns an iolist. In fact you can pass it straight to io:format it's going to print the right thing: 10> io:format(io_lib:fwrite("~10..0B", [123])). 0000000123ok From dangud@REDACTED Wed Jan 25 15:56:40 2012 From: dangud@REDACTED (Dan Gudmundsson) Date: Wed, 25 Jan 2012 15:56:40 +0100 Subject: [erlang-questions] Stringified integer with leading zeroes In-Reply-To: <16A171EB-12D7-4298-8E53-4E89D231DC84@masklinn.net> References: <1327501809.49232.YahooMailNeo@web5604.biz.mail.in.yahoo.com> <16A171EB-12D7-4298-8E53-4E89D231DC84@masklinn.net> Message-ID: And the same with ~w io:format("~10..0w~n", [123]). /Dan On Wed, Jan 25, 2012 at 3:39 PM, Masklinn wrote: > > On 2012-01-25, at 15:30 , Avinash Dhumane wrote: > >> How to get an integer 123 as 10-char long string "0000000123" with leading zeroes, i.e. erlang term [48, 48, 48, 48, 48, 48, 48, 49, 50, 51]? >> >> Following is not what I expect! I tried with both ~B and ~s. > > 5> io_lib:fwrite("~10..0B", [123]). > [[[48,"000",48,48,48],49,50,51]] > 6> lists:flatten(io_lib:fwrite("~10..0B", [123])). > "0000000123" > > io_lib:fwrite returns an iolist. In fact you can pass it straight to io:format it's going to print the right thing: > > 10> io:format(io_lib:fwrite("~10..0B", [123])). > 0000000123ok > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From YurinVV@REDACTED Wed Jan 25 16:00:28 2012 From: YurinVV@REDACTED (Nevar) Date: Wed, 25 Jan 2012 07:00:28 -0800 (PST) Subject: [erlang-questions] erl -name test and net_kernel:start([test, longnames]) Message-ID: <1327503628866-4327469.post@n4.nabble.com> yurin@~()$erl -name test Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.4 (abort with ^G) (test@REDACTED)1> yurin@~()$erl Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.4 (abort with ^G) 1> net_kernel:start([test, longnames]). {ok,<0.34.0>} (test@REDACTED)2> It is right that node names are different? I expected: yurin@~()$erl Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.4 (abort with ^G) 1> inet_config:init(), OsType = os:type(), inet_config:do_load_resolv(OsType, longnames). ok 2> net_kernel:start([test, longnames]). {ok,<0.35.0>} (test@REDACTED)3> It seems the inet_config is configured incorrectly when using net_kernel:start. -- View this message in context: http://erlang.2086793.n4.nabble.com/erl-name-test-and-net-kernel-start-test-longnames-tp4327469p4327469.html Sent from the Erlang Questions mailing list archive at Nabble.com. From carlsson.richard@REDACTED Wed Jan 25 16:14:46 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Wed, 25 Jan 2012 16:14:46 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: References: Message-ID: <4F201C66.8040202@gmail.com> On 01/25/2012 03:39 PM, Jos? Valim wrote: > Since the discussion steered towards "tuple modules", I am going to use > the opportunity to ask. > > The fact that part of the standard library, like the dict module, > receives the dict as last argument and the dict itself is a "tuple > module" is an accident or a design decision? Does anyone actually write > "Dict:find(Key)" instead of "dict:find(key, Dict)"? This is just a coincidence. First, the dict module is much older than the experimental implementation of parameterized modules. Second, the data representation used by dict is explicitly documented to be considered opaque and subject to possible changes. Nowhere is it said that a dict is or will remain a callable object. The reason it happens to work is that 1) the dict module uses a record also called 'dict' for its hash table representation, and 2) when performing a call to a parameterized module, the module object itself is passed as an additional parameter, whose position (last) happens to coincide with the expected position of the input dict in the API calls. If the calling convention for parameterized modules would pass the module object as the first argument (which it could do in a future version of the compiler), or the dict module changed the record name used for its tables, this would cease to work. /Richard From jose.valim@REDACTED Wed Jan 25 17:28:24 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Wed, 25 Jan 2012 17:28:24 +0100 Subject: [erlang-questions] OTP-9649 and further changes In-Reply-To: <4F201C66.8040202@gmail.com> References: <4F201C66.8040202@gmail.com> Message-ID: > > This is just a coincidence. First, the dict module is much older than the > experimental implementation of parameterized modules. Second, the data > representation used by dict is explicitly documented to be considered > opaque and subject to possible changes. Nowhere is it said that a dict is > or will remain a callable object. > Thanks, this answer is exactly what I was looking for. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddd45cu@REDACTED Thu Jan 26 09:49:26 2012 From: ddd45cu@REDACTED (David Drew) Date: Thu, 26 Jan 2012 03:49:26 -0500 Subject: [erlang-questions] Question on Erlang Port Drivers Message-ID: Hey everyone, Quick beginner question in relation to the example given on the Erlang Port Drivers Interoperability Tutorial located at http://www.erlang.org/doc/tutorial/c_portdriver.html. How would this example (the complex5 module and the port_driver.c file) be expanded if you wanted to send/receive doubles instead of integers less than 256, while still sticking with the port_drivers interoperability and not switching to one of the other types? Such as if the c function you were creating ap ort to, complex.c, was: /* complex.c */ double foo(double x) { return x/1.0; } double bar(double y) { return y/2.0; } Thanks in advance for your help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddd45cu@REDACTED Thu Jan 26 10:00:38 2012 From: ddd45cu@REDACTED (Dave) Date: Thu, 26 Jan 2012 04:00:38 -0500 Subject: [erlang-questions] Question on Erlang Port Driver Message-ID: Hey everyone, Quick beginner question in relation to the example given on the Erlang Port Drivers Interoperability Tutorial located at http://www.erlang.org/doc/tutorial/c_portdriver.html. How would this example (the complex5 module and the port_driver.c file) be expanded if you wanted to send/receive doubles instead of integers less than 256, while still sticking with the port_drivers interoperability and not switching to one of the other types? Such as if the c function you were creating ap ort to, complex.c, was: /* complex.c */ double foo(double x) { return x/1.0; } double bar(double y) { return y/2.0; } Thanks in advance for your help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Thu Jan 26 18:10:12 2012 From: vances@REDACTED (Vance Shipley) Date: Thu, 26 Jan 2012 22:40:12 +0530 Subject: [erlang-questions] Question on Erlang Port Drivers In-Reply-To: References: Message-ID: <20120126171010.GJ286@aluminum.wavenet.lk> On Thu, Jan 26, 2012 at 03:49:26AM -0500, David Drew wrote: } How would this example (the complex5 module and the port_driver.c file) } be expanded if you wanted to send/receive doubles instead of integers David, The example sends data to the port, as a message, and receives a message back from the port. It opens the port in normal mode so the data sent in is a list of integers. In this simple example a list of two integers is sent as [Command, Argument]. On the driver side it matches Command with the function you want to call. It gets the result of the function and calls driver_output() to send it as message from the port. Changing Argument to a double could be done by lengthening the list to handle the size of a double. Something like [Command, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7], and you'd need to handle mapping the eight bytes from a double. But that would all be messy and not portable. Using port_command/2, or 'Port ! {PortOwner, {command, Data}}', is the best solution for a driver which is handling a stream of data or transactions where you can have a flying window. For synchonous calls there are other alternatives. I have attached a version which uses erlang:port_call/3 to make a synchronous call to the driver. This method uses the Erlang external term format for the messages it sends and receives. In this way you can easily marshall any type between the driver and your Erlang processes. -- -Vance -------------- next part -------------- /* complex.c */ int foo(int x) { return x+1; } int bar(int y) { return y*2; } double foz(double x) { return x/1.0; } double baz(double y) { return y/2.0; } -------------- next part -------------- /* ~/lib/erlang/doc/tutorial/c_portdriver.html */ /* port_driver.c */ #include #include "erl_driver.h" double foz(double); double baz(double); typedef struct { ErlDrvPort port; } example_data; static ErlDrvData example_drv_start(ErlDrvPort port, char *buff) { example_data* d = (example_data*)driver_alloc(sizeof(example_data)); d->port = port; return (ErlDrvData)d; } static void example_drv_stop(ErlDrvData handle) { driver_free((char*)handle); } static void example_drv_output(ErlDrvData handle, char *buff, ErlDrvSizeT bufflen) { example_data* d = (example_data*)handle; char fn = buff[0], arg = buff[1], res; if (fn == 1) { res = foo(arg); } else if (fn == 2) { res = bar(arg); } driver_output(d->port, &res, 1); } static ErlDrvSSizeT example_drv_call(ErlDrvData handle, unsigned int command, char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen, unsigned int *flags) { example_data* d = (example_data*)handle; double arg, res; int version, index = 0; if (ei_decode_version(buf, &index, &version)) return((ErlDrvSSizeT) ERL_DRV_ERROR_GENERAL); if (ei_decode_double(buf, &index, &arg)) return((ErlDrvSSizeT) ERL_DRV_ERROR_BADARG); switch (command) { case 3: res = foz(arg); break; case 4: res = baz(arg); break; default: return((ErlDrvSSizeT) ERL_DRV_ERROR_BADARG); } index = 0; if (ei_encode_version(*rbuf, &index) || ei_encode_double(*rbuf, &index, res)) return((ErlDrvSSizeT) ERL_DRV_ERROR_ERRNO); else return((ErlDrvSSizeT) index); } ErlDrvEntry example_driver_entry = { NULL, /* F_PTR init, N/A */ example_drv_start, /* L_PTR start, called when port is opened */ example_drv_stop, /* F_PTR stop, called when port is closed */ example_drv_output, /* F_PTR output, called when erlang has sent */ NULL, /* F_PTR ready_input, called when input descriptor ready */ NULL, /* F_PTR ready_output, called when output descriptor ready */ "example_drv", /* char *driver_name, the argument to open_port */ NULL, /* F_PTR finish, called when unloaded */ NULL, /* F_PTR control, port_command callback */ NULL, /* F_PTR timeout, reserved */ NULL, /* F_PTR outputv, reserved */ NULL, NULL, NULL, example_drv_call, NULL, ERL_DRV_EXTENDED_MARKER, ERL_DRV_EXTENDED_MAJOR_VERSION, ERL_DRV_EXTENDED_MINOR_VERSION, 0, NULL, NULL, NULL }; DRIVER_INIT(example_drv) /* must match name in driver_entry */ { return &example_driver_entry; } From baliulia@REDACTED Thu Jan 26 18:16:46 2012 From: baliulia@REDACTED (=?UTF-8?B?SWduYXMgVnnFoW5pYXVza2Fz?=) Date: Thu, 26 Jan 2012 17:16:46 +0000 Subject: [erlang-questions] erlang:now() incremental guaranty scope Message-ID: <4F218A7E.40603@gmail.com> Hi Erlangers, the docs on erlang:now/0 say that > It is also guaranteed that subsequent calls to this BIF returns > continuously increasing values. What is the scope of this guaranty? Is this guaranteed for calls from the same process/calls within the same node/calls within the same runtime-system? Thanks, Ignas From igarai@REDACTED Thu Jan 26 21:26:52 2012 From: igarai@REDACTED (=?UTF-8?B?ScOxYWtpIEdhcmF5?=) Date: Thu, 26 Jan 2012 18:26:52 -0200 Subject: [erlang-questions] Question on Erlang Port Driver In-Reply-To: References: Message-ID: On Thu, Jan 26, 2012 at 07:00, Dave wrote: > Quick beginner question in relation to the example given on the Erlang Port > Drivers Interoperability Tutorial located at > http://www.erlang.org/doc/tutorial/c_portdriver.html. How would this example > (the complex5 module and the port_driver.c file) be expanded if you wanted > to send/receive doubles instead of integers less than 256, while still > sticking with the port_drivers interoperability and not switching to one of > the other types? Such as if the c function you were creating ap ort to, > complex.c, was: > > > > /* complex.c */ > double foo(double x) { > ? return x/1.0; > } > double bar(double y) { > ? return y/2.0; > } The ei library is your friend: http://www.erlang.org/doc/man/ei.html#ei_decode_double I don't think using ei on the C side will hurt interoperability, others may correct me. Also read: http://www.erlang.org/doc/apps/erl_interface/users_guide.html http://www.erlang.org/doc/tutorial/erl_interface.html Common pitfalls when working with ei are forgetting to send the version info, and errors handling memory for the buffer. The _x_ versions of the ei functions which use dynamic buffers are recommended. good luck! I?aki Garay From spawn.think@REDACTED Thu Jan 26 22:23:20 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Thu, 26 Jan 2012 22:23:20 +0100 Subject: [erlang-questions] [ANN] Erlang Hangout with Robert Virding, recording available Message-ID: If you missed today's hangout with +Robert Virding , you can still watch the recording https://plus.google.com/108730584872406072872/posts/9vBcxhFGL7G -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From igarai@REDACTED Thu Jan 26 22:25:56 2012 From: igarai@REDACTED (=?UTF-8?B?ScOxYWtpIEdhcmF5?=) Date: Thu, 26 Jan 2012 19:25:56 -0200 Subject: [erlang-questions] [ANN] Erlang Hangout with Robert Virding, recording available In-Reply-To: References: Message-ID: On Thu, Jan 26, 2012 at 19:23, Ahmed Omar wrote: > If you missed today's hangout with +Robert Virding , you can still watch the > recording > https://plus.google.com/108730584872406072872/posts/9vBcxhFGL7G > > -- > Best Regards, > - Ahmed Omar thank you for taking the time to upload the recording! sincerely, I?aki Garay From ok@REDACTED Fri Jan 27 04:54:56 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 27 Jan 2012 16:54:56 +1300 Subject: [erlang-questions] chained functions In-Reply-To: <20120124143119.3f06e43c@bertello> References: <20120124143119.3f06e43c@bertello> Message-ID: <68C321F7-D9E9-46CC-91AC-C29DF6E311CA@cs.otago.ac.nz> There's always the possibility of eapp(F, E={error,_}) -> E; eapp(F, {ok,X}) -> F(X). Then w(x(y(z(...)))) -> eapp(fun w/1, eapp(fun x/1, eapp(fun y/1, eapp(fun z/1, ...)))) and of course this can be turned into a macro: -define(eapp(F,X), case ?X of EC1 = {error,_} -> EC1 ; OC2 = {ok,OV2} -> ?X(OV2) end). Sometimes throwing exceptions is a better choice. From codevally@REDACTED Fri Jan 27 06:24:27 2012 From: codevally@REDACTED (Roshan Pradeep) Date: Fri, 27 Jan 2012 16:24:27 +1100 Subject: [erlang-questions] crashdump_viewer execution issue on Windows Message-ID: Hi I have installed erlang on my windows box, but getting the below error when running the webtool bat file. C:\project\erl5.9\lib\webtool-0.8.9.1\priv\bin>start_webtool.bat crashdump_viewer Starting webtool... Eshell V5.9 (abort with ^G) (webtool@REDACTED)1> WebTool is available at http://localhost:8888/ (webtool@REDACTED)1> Or http://127.0.0.1:8888/ (webtool@REDACTED)1> Starting crashdump_viewer... (webtool@REDACTED)1> Starting internet explorer... {"init terminating in do_boot",{{badmatch,{error,enoent}},[{webtool,script_start,1,[{file,"webtool.erl"},{line,169}]},{init,start_it,1,[{file,"init.erl"},{line,1043}]},{init,start_em,1,[{file," init.er 1022}]}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () Could someone please help me on this? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangsiri@REDACTED Fri Jan 27 10:45:30 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Fri, 27 Jan 2012 10:45:30 +0100 Subject: [erlang-questions] crashdump_viewer execution issue on Windows In-Reply-To: References: Message-ID: Not a nice error message, of course... but I think that webtool has problems finding your executable for internet explorer. To get around it you can specify a browser start command on the command line - as the second argument to start_webtool.bat. /siri 2012/1/27 Roshan Pradeep > Hi > > I have installed erlang on my windows box, but getting the below error > when running the webtool bat file. > > C:\project\erl5.9\lib\webtool-0.8.9.1\priv\bin>start_webtool.bat > crashdump_viewer > Starting webtool... > Eshell V5.9 (abort with ^G) > (webtool@REDACTED)1> WebTool is available at http://localhost:8888/ > (webtool@REDACTED)1> Or http://127.0.0.1:8888/ > (webtool@REDACTED)1> Starting crashdump_viewer... > (webtool@REDACTED)1> Starting internet explorer... > {"init terminating in > do_boot",{{badmatch,{error,enoent}},[{webtool,script_start,1,[{file,"webtool.erl"},{line,169}]},{init,start_it,1,[{file,"init.erl"},{line,1043}]},{init,start_em,1,[{file," > init.er > 1022}]}]}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > > Could someone please help me on this? > > Thanks. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Fri Jan 27 11:01:30 2012 From: vances@REDACTED (Vance Shipley) Date: Fri, 27 Jan 2012 15:31:30 +0530 Subject: [erlang-questions] Question on Erlang Port Drivers In-Reply-To: <20120126171010.GJ286@aluminum.wavenet.lk> References: <20120126171010.GJ286@aluminum.wavenet.lk> Message-ID: <20120127100115.GK286@aluminum.wavenet.lk> On Thu, Jan 26, 2012 at 10:40:12PM +0530, Vance Shipley wrote: } Using port_command/2, or 'Port ! {PortOwner, {command, Data}}', is } the best solution for a driver which is handling a stream of data } or transactions where you can have a flying window. Of course that's both only my opinion and only a rule of thumb. Some would argue that pure messaging is the truly functional way. } Changing Argument to a double could be done by lengthening the list } to handle the size of a double. Something like [Command, Arg0, Arg1, } Arg2, Arg3, Arg4, Arg5, Arg6, Arg7], and you'd need to handle mapping } the eight bytes from a double. But that would all be messy and not } portable. You can stick with this method of message passing by opening the port in binary mode and encoding with the external term format. To open the port in binary mode just add the option to open_port/2: Port = open_port({spawn, SharedLib}, [binary]), Change to encode your terms in the external term format and send as a binary: encode(Arg) -> term_to_binary(Arg). decode(Result) -> binary_to_term(Result). In the example_drv_output() function of port_driver.c decode the received buffer as an external term format: if (ei_decode_version(buf, &index, &version) || ei_decode_tuple_header(buf, &index, &arity) || arity != 3 || ei_decode_atom(buf, &index, &cmd) || ei_decode_double(buf, &index, &arg)) return; Return the result the same way: rbuf = driver_alloc_binary(size); if (ei_encode_version(rbuf, &index) || ei_encode_double(*rbuf, &index, res)) return; else driver_output_binary(d->port, rbuf, index); -- -Vance From gumm@REDACTED Fri Jan 27 15:40:49 2012 From: gumm@REDACTED (Jesse Gumm) Date: Fri, 27 Jan 2012 08:40:49 -0600 Subject: [erlang-questions] erlang:now() incremental guaranty scope In-Reply-To: <4F218A7E.40603@gmail.com> References: <4F218A7E.40603@gmail.com> Message-ID: Based on the docs, it looks like it's guaranteed for any calls on a single running node. -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Jan 26, 2012 11:16 AM, "Ignas Vy?niauskas" wrote: > Hi Erlangers, > > the docs on erlang:now/0 say that > > It is also guaranteed that subsequent calls to this BIF returns > > continuously increasing values. > > What is the scope of this guaranty? > Is this guaranteed for calls from the same process/calls within the same > node/calls within the same runtime-system? > > Thanks, > Ignas > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Fri Jan 27 16:42:55 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 27 Jan 2012 16:42:55 +0100 Subject: [erlang-questions] erlang:now() incremental guaranty scope In-Reply-To: References: <4F218A7E.40603@gmail.com> Message-ID: 2012/1/27 Jesse Gumm : > Based on the docs, it looks like it's guaranteed for any calls on a single > running? node. I can confirm this. That's why in a single cluster {node(), now()} generates a "globally unique" identifier. From daniel@REDACTED Fri Jan 27 16:43:39 2012 From: daniel@REDACTED (Daniel Luna) Date: Fri, 27 Jan 2012 10:43:39 -0500 Subject: [erlang-questions] erlang:now() incremental guaranty scope In-Reply-To: <4F218A7E.40603@gmail.com> References: <4F218A7E.40603@gmail.com> Message-ID: 2012/1/26 Ignas Vy?niauskas : > the docs on erlang:now/0 say that >> It is also guaranteed that subsequent calls to this BIF returns >> continuously increasing values. > > What is the scope of this guaranty? > Is this guaranteed for calls from the same process/calls within the same > node/calls within the same runtime-system? It is guaranteed that calls on a single node are continuously increasing (which also implies unique). If you want a globally unique value you can use {node(), now()}, which is guaranteed to be unique barring restarts with clock drift (or between nodes with the same name, I guess). /Daniel From gleber.p@REDACTED Fri Jan 27 18:59:05 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 27 Jan 2012 18:59:05 +0100 Subject: [erlang-questions] erlang-mode on Emacs marmalade Message-ID: Hello list I want to contact Anders Lindgren, who is the maintainer of erlang-mode on Emacs marmalade repo. Anders, are you reading this mailing list? If not, does anyone know how can I contact him? Erlang mode in there is 2.4.1 which seems to be ancient :) Best regards, Gleb Peregud From carlsson.richard@REDACTED Fri Jan 27 19:06:30 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 27 Jan 2012 19:06:30 +0100 Subject: [erlang-questions] erlang-mode on Emacs marmalade In-Reply-To: References: Message-ID: <4F22E7A6.3040701@gmail.com> On 01/27/2012 06:59 PM, Gleb Peregud wrote: > Hello list > > I want to contact Anders Lindgren, who is the maintainer of > erlang-mode on Emacs marmalade repo. > > Anders, are you reading this mailing list? If not, does anyone know > how can I contact him? Erlang mode in there is 2.4.1 which seems to be > ancient :) As far as I know, Anders hasn't been involved with the Erlang emacs mode for many years, but I have CC:d him here just in case he knows something about the marmalade stuff. /Richard From goddang@REDACTED Sat Jan 28 01:06:04 2012 From: goddang@REDACTED (God Dang) Date: Sat, 28 Jan 2012 00:06:04 +0000 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? Message-ID: I'm creating a system where I've ended up with alot of gen_servers that provides a clean interface. When I run this under load I see that the gen_server:call's is becoming a bottleneck.For instance, In a handle_request I might ask an other gen_server to get me a cached object, then ask the database something, then etc...and in some cases I have my-gen_server->cache-gen_server->memcache-client-gen_server as you see it stacks up to alot of steps. I've tried to optimize with deferring gen_server responses and that has given a slight performance improvement but not as drastical as if I for instance bypass one gen_server instance. Is there a better way to go about this or some smart optimization to do? And FYI, I use gen_server when I need to keep a state of a connection or something so if the answer is to scrap or reduce the number of gen_servers I will need to keep those connections somewhere else. Thanks, Dang -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Sat Jan 28 09:09:20 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Sat, 28 Jan 2012 09:09:20 +0100 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: References: Message-ID: Could you put common memory-related operations into one single gen_server? Does this need to be gen_server at all? You could use the synchronized serialization to generate push-back behaviour from your system, so that you do not handle a new request before it's possible - maybe you are already doing this, or not. If you really want to find the bottlenecks, you could try with fprof http://www.erlang.org/doc/man/fprof.html /G > / Sat, Jan 28, 2012 at 1:06 AM, God Dang wrote: > I'm creating a system where I've ended up with alot of gen_servers that > provides a clean interface. When I run this under load I see that the > gen_server:call's is becoming a bottleneck. > For instance, In a handle_request I might ask an other gen_server to get me > a cached object, then ask the database something, then etc... > and in some cases I have > my-gen_server->cache-gen_server->memcache-client-gen_server as you see it > stacks up to alot of steps. I've tried to optimize with deferring gen_server > responses and that has given a slight performance improvement but not as > drastical as if I for instance bypass one gen_server instance. > > Is there a better way to go about this or some smart optimization to do? And > FYI, I use gen_server when I need to keep a state of a connection or > something so if the answer is to scrap ?or reduce the number of gen_servers > I will need to keep those connections somewhere else. > > Thanks, Dang > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From bourinov@REDACTED Sat Jan 28 10:20:27 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sat, 28 Jan 2012 14:50:27 +0530 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: References: Message-ID: <-6101768077835229602@unknownmsgid> Instead of memcache you can use ETS which is "built in" and way faster. Sent from my iPhone On 28.01.2012, at 13:39, Gianfranco Alongi wrote: > Could you put common memory-related operations into one single gen_server? > Does this need to be gen_server at all? > > You could use the synchronized serialization to generate push-back > behaviour from your system, > so that you do not handle a new request before it's possible - maybe > you are already doing this, > or not. > > If you really want to find the bottlenecks, you could try with fprof > http://www.erlang.org/doc/man/fprof.html > > /G > >> / Sat, Jan 28, 2012 at 1:06 AM, God Dang wrote: >> I'm creating a system where I've ended up with alot of gen_servers that >> provides a clean interface. When I run this under load I see that the >> gen_server:call's is becoming a bottleneck. >> For instance, In a handle_request I might ask an other gen_server to get me >> a cached object, then ask the database something, then etc... >> and in some cases I have >> my-gen_server->cache-gen_server->memcache-client-gen_server as you see it >> stacks up to alot of steps. I've tried to optimize with deferring gen_server >> responses and that has given a slight performance improvement but not as >> drastical as if I for instance bypass one gen_server instance. >> >> Is there a better way to go about this or some smart optimization to do? And >> FYI, I use gen_server when I need to keep a state of a connection or >> something so if the answer is to scrap or reduce the number of gen_servers >> I will need to keep those connections somewhere else. >> >> Thanks, Dang >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mattevans123@REDACTED Sat Jan 28 16:18:23 2012 From: mattevans123@REDACTED (Matthew Evans) Date: Sat, 28 Jan 2012 10:18:23 -0500 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: References: Message-ID: Of course you need to run a profiler such as fprof to see what's going on. Sounds like a classic head of line blocking problem. Many requests, possibly from processes on different schedulers/cores, all getting serialized on a single gen_server. The obvious, and maybe non-OTP, answer is to hold some of this state information in a public or protected named ETS table that your clients read from directly. A single gen_server can still own and write to that ETS table. Another obvious answer is to provide back-pressure of some kind to prevent clients from requesting data when it is under load. You might find that a particular infrequent gen_server:call operation is taking a long time to complete causing a message queue to suddenly grow. You might want to change such an operation from: handle_call({long_operation,Data},From,State) -> Rsp = do_lengthy_operation(Data), {reply, Rsp, State}; to: handle_call({long_operation,Data},From,State) -> spawn(fun() -> Rsp = do_lengthy_operation(Data), gen_server:reply(Rsp,From) end), {noreply, State}; From: goddang@REDACTED To: erlang-questions@REDACTED Date: Sat, 28 Jan 2012 00:06:04 +0000 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? I'm creating a system where I've ended up with alot of gen_servers that provides a clean interface. When I run this under load I see that the gen_server:call's is becoming a bottleneck.For instance, In a handle_request I might ask an other gen_server to get me a cached object, then ask the database something, then etc...and in some cases I have my-gen_server->cache-gen_server->memcache-client-gen_server as you see it stacks up to alot of steps. I've tried to optimize with deferring gen_server responses and that has given a slight performance improvement but not as drastical as if I for instance bypass one gen_server instance. Is there a better way to go about this or some smart optimization to do? And FYI, I use gen_server when I need to keep a state of a connection or something so if the answer is to scrap or reduce the number of gen_servers I will need to keep those connections somewhere else. Thanks, Dang _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Jan 28 17:09:39 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 28 Jan 2012 17:09:39 +0100 Subject: [erlang-questions] better ct_expand and some intricate problems Message-ID: <59294C34-299B-42AF-8163-6E61E514A9C1@feuerlabs.com> I have made some improvements to ct_expand https://github.com/uwiger/parse_trans/blob/master/doc/ct_expand.md It used to be that it could only expand simple expressions. Now, it can handle calls to local functions, which are then interpreted. It also handles things like fun foo/1, by fetching the function definition and inlining it as a "regular" fun. Unfortunately, I failed to bring it up to the level that I aspired to, namely to improve some of Tony Rogvall's code (not yet released). The problem there was that his code called functions that stored funs in a dict. Doing this at compile-time, the funs would - at best - end up being interpreted. As it was, I didn't even get that far, since funs created by one interpreted function couldn't be passed as arguments to another interpreted function. The culprits are erl_eval, which unconditionally converts the return values into regular terms, and erl_parse:abstract/1, which fails to create abstract expressions from funs. Thus, the conversion to regular terms is not reversible in this case. In https://github.com/uwiger/parse_trans/blob/master/examples/ct_expand_test.erl#L15, an example is given of what kind of things can now be done with ct_expand. I added a trace option, so that it would be easier to debug complex expansions: Eshell V5.8.4 (abort with ^G) 1> c(ct_expand_test,[{ct_expand_trace,[r]}]). ct_expand (27): call zip([1,2],[a,b]) ct_expand (27): call zip([2],[b]) ct_expand (27): call zip([],[]) ct_expand (27): returned from zip/2: [] ct_expand (27): returned from zip/2: [{{2},{b}}] ct_expand (27): returned from zip/2: [{{1},{a}},{{2},{b}}] Pretty-printed in "./ct_expand_test.xfm" (Not perfect: the functions that were inlined don't show up in the trace.) I welcome ideas on how to get around the above limitation with reasonable effort (I know I could make my own evaluator, but that seems like too high a price). Oh, the error reporting from parse_trans has been greatly improved. It now detects parse_errors immediately, and aborts the transform, and also reports transform errors in a less noisy way. Let me know if you have issues with it. BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Sat Jan 28 17:18:47 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sat, 28 Jan 2012 17:18:47 +0100 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: References: Message-ID: <4F241FE7.7080106@erlang-solutions.com> On 1/28/12 4:18 PM, Matthew Evans wrote: > > The obvious, and maybe non-OTP, answer is to hold some of this state > information in a public or protected named ETS table that your clients > read from directly. A single gen_server can still own and write to > that ETS table. > This would be my first idea. Create an ETS table being protected. Writes to the table goes through the gen_server, -export([write/1, read/1]). write(Obj) -> call({write, Obj}). call(M) -> gen_server:call(?SERVER, M, infinity). but reads happen in the calling process of the API and does not go through the gen_server at all, read(Key) -> case ets:lookup(?TAB, Key) of [] -> not_found; [_|_] = Objects -> {ok, Objects} end. Creating the table with {read_concurrency, true} as the option will probably speed up reads by quite a bit as well. It is probably going to be a lot faster than having all caching reads going through that single point of contention. Chances are that just breaking parts of the chain is enough to improve the performance of the system. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Jan 28 18:39:52 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 28 Jan 2012 18:39:52 +0100 Subject: [erlang-questions] better ct_expand and some intricate problems In-Reply-To: <59294C34-299B-42AF-8163-6E61E514A9C1@feuerlabs.com> References: <59294C34-299B-42AF-8163-6E61E514A9C1@feuerlabs.com> Message-ID: <2680AED8-CE38-478F-B91E-B8CD2E75F2BC@feuerlabs.com> Never mind - problem solved. Funs from erl_eval _can_ actually be abstracted using erl_eval:fun_data/1. Too bad erl_parse:abstract/1 isn't aware of that? As it happens, since the resulting data structure is in abstract form, funs in a dict will be compiled eventually anyway. :) I leave it to you all to find remaining limitations or exciting uses. BR, Ulf W On 28 Jan 2012, at 17:09, Ulf Wiger wrote: > > I have made some improvements to ct_expand > > https://github.com/uwiger/parse_trans/blob/master/doc/ct_expand.md > > It used to be that it could only expand simple expressions. Now, it can handle calls to local functions, which are then interpreted. It also handles things like fun foo/1, by fetching the function definition and inlining it as a "regular" fun. > > Unfortunately, I failed to bring it up to the level that I aspired to, namely to improve some of Tony Rogvall's code (not yet released). The problem there was that his code called functions that stored funs in a dict. Doing this at compile-time, the funs would - at best - end up being interpreted. As it was, I didn't even get that far, since funs created by one interpreted function couldn't be passed as arguments to another interpreted function. > > The culprits are erl_eval, which unconditionally converts the return values into regular terms, and erl_parse:abstract/1, which fails to create abstract expressions from funs. Thus, the conversion to regular terms is not reversible in this case. > > In https://github.com/uwiger/parse_trans/blob/master/examples/ct_expand_test.erl#L15, an example is given of what kind of things can now be done with ct_expand. > > I added a trace option, so that it would be easier to debug complex expansions: > > Eshell V5.8.4 (abort with ^G) > 1> c(ct_expand_test,[{ct_expand_trace,[r]}]). > ct_expand (27): call zip([1,2],[a,b]) > ct_expand (27): call zip([2],[b]) > ct_expand (27): call zip([],[]) > ct_expand (27): returned from zip/2: [] > ct_expand (27): returned from zip/2: [{{2},{b}}] > ct_expand (27): returned from zip/2: [{{1},{a}},{{2},{b}}] > Pretty-printed in "./ct_expand_test.xfm" > > (Not perfect: the functions that were inlined don't show up in the trace.) > > I welcome ideas on how to get around the above limitation with reasonable effort (I know I could make my own evaluator, but that seems like too high a price). > > Oh, the error reporting from parse_trans has been greatly improved. It now detects parse_errors immediately, and aborts the transform, and also reports transform errors in a less noisy way. Let me know if you have issues with it. > > BR, > Ulf W > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Sun Jan 29 00:13:25 2012 From: freza@REDACTED (Jachym Holecek) Date: Sat, 28 Jan 2012 18:13:25 -0500 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: <4F241FE7.7080106@erlang-solutions.com> References: <4F241FE7.7080106@erlang-solutions.com> Message-ID: <20120128231325.GA6021@circlewave.net> Hi, [Replying to multiple replies at once, all quoted text reformatted for readability (seems people these days can't be bothered!?).] [Warning: excessively nitpicky content ahead, here and there.] # God Dang 2012-01-28: > I'm creating a system where I've ended up with alot of gen_servers that > provides a clean interface. When I run this under load I see that the > gen_server:call's is becoming a bottleneck. You're probably treating asynchronous things as synchronous somewhere along the path, inflicting collateral damage to concurrent users? Synchronous high-level API is fine, but if you know some operation is expensive or depends on response from the outside world you should record request context in ETS (row looking something like {Req_id, Timeout, From[, ...]} and process requests out-of-order OR offload the actual processing to short lived worker processes like Matthew Evans says OR a combination of both OR somesuch. My point being that gen_server:call/N, by itself, is *very* fast in practice, so chances are you're doing something wrong elsewhere. Other (unlikely) thing: you're not sending very large data structures in messages, are you? That could hurt, but there are ways to address that too if needed. # Matthew Evans 2012-01-28: > Another obvious answer is to provide back-pressure of some kind to prevent > clients from requesting data when it is under load. On external interfaces (or for global resource usage of some sort): yes, a fine idea (a clear "must have", actually!); but doing this internally would seem excessively defensive to me, unless further justification was given. > You might want to change such an operation from: > > handle_call({long_operation,Data},From,State) -> > Rsp = do_lengthy_operation(Data), > {reply, Rsp, State}; > > to: > > handle_call({long_operation,Data},From,State) -> > spawn(fun() -> Rsp = do_lengthy_operation(Data), gen_server:reply(Rsp,From) end), > {noreply, State}; 1. Why do people bother introducing "one-shot" variables for trivial expressions they could have inlined? Means less context to maintain when reading the code... 2. Surely you meant proc_lib:spawn_link/X there, didn't you? SASL logs and fault propagation are the reason. While there are exceptions to this, they're extremely rare. 3. The order of arguments to gen_server:reply/2 is wrong. Regarding the general approach: yes, a fine idea too. Depending on what do_lengthy_operation/1 does putting these workers under supervisor might be called for. # Jesper Louis Andersen 2012-01-28: > This would be my first idea. Create an ETS table being protected. > Writes to the table goes through the gen_server, Yes, a fine idea too -- ETS is one of the less obvious cornerstones of Erlang programming (but don't tell "purity" fascists )... One detail: almost all of my ETS tables are public even when many of them are really treated as private or protected, reason is to keep high degree of runtime tweakability just in case (this might be a bit superstitious I admit). > -export([write/1, read/1]). > > write(Obj) -> > call({write, Obj}). > > call(M) -> > gen_server:call(?SERVER, M, infinity). 1. Abstracting trivial functionality such as call/1 above only obfuscates code for precisely zero gain. 2. Same goes for typing "?SERVER" instead of the actual server name. Using "?MODULE" is however alright, as long as it's only referred to from current module (as it should). 3. No infinite timeouts without very good justification! You're sacrificing a good default protective measure for no good reason... > but reads happen in the calling process of the API and does not go > through the gen_server at all, > > read(Key) -> > case ets:lookup(?TAB, Key) of > [] -> not_found; > [_|_] = Objects -> {ok, Objects} > end. (2) from above also applies to "?TAB" here. More to the point, it's sometimes perfectly OK to do table writes directly from caller's context too, like: write(Item) -> true = ets:insert_new(actual_table_name, Item). It can of course be very tricky business and needs good thinking first. I bet you're aware of this, mentioning it just because it's a handy trick that doesn't seem to be widely known. > Creating the table with {read_concurrency, true} as the option will > probably speed up reads by quite a bit as well. It is probably going > to be a lot faster than having all caching reads going through that > single point of contention. Chances are that just breaking parts of > the chain is enough to improve the performance of the system. Well, yes, avoiding central points of contention (such as blessed processes or, you guessed it, ETS tables) is certainly good engineering practice, but see first part of this email for other considerations. BR, -- Jachym From roberto@REDACTED Sun Jan 29 07:56:35 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Sat, 28 Jan 2012 22:56:35 -0800 Subject: [erlang-questions] smtp server Message-ID: dear list, are you aware of any existent production-ready SMTP server in Erlang? I've only found, maintained: https://github.com/Vagabond/gen_smtp thank you, r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From goddang@REDACTED Sun Jan 29 09:38:47 2012 From: goddang@REDACTED (God Dang) Date: Sun, 29 Jan 2012 08:38:47 +0000 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: <20120128231325.GA6021@circlewave.net> References: , , <4F241FE7.7080106@erlang-solutions.com>, <20120128231325.GA6021@circlewave.net> Message-ID: Thank you all for taking time to help me out. Some clarification, I've come to the conclusion that gen_server(or more precisely my design) is to blame after running multiple sessions with fprof, eprof and alot of timer:now_diff and timer:tc. For example, if I put load on the system and time my handle_call({long_operation,Data},From,State) I see that the execution time begins rise from <10ms to around ~2000ms and stabilizing there under my load. If I remove the last gen_server and instead implement it as a simple function it stabilizes around ~1000ms and removing yet another one gives me yet lower execution times. A word on my design, a lot of the time the only reason we use a gen_server is for keeping a state and more precisely a connection. For instance a generic db backend which keeps the pid of the db connection, a cache backend which keeps the memcache connection pid, my own server that keep state. and within my handle_call({long_operation,Data},From,State) I could be doing a couple of gen_server:call's and within the database gen_server I could be doing additional gen_server call's to the cache backend. Why we've constructed it as separate gen_server's is also to be able to call it from different parts of the system like db:do_something() or cache:get(). On paper this looked like a clean and nice design but under load it starts to behave poorly. To answer all in order:# Gianfranco Alongi 2012-01-28:> You could use the synchronized serialization to generate push-back > behaviour from your system, > so that you do not handle a new request before it's possible - maybe > you are already doing this, or not. I don' understand what this mean. Can you please clarify. # Matthew Evans 2012-01-28> The obvious, and maybe non-OTP, answer is to hold some of this state information in a public or protected named ETS table> that your clients read from directly. A single gen_server can still own and write to that ETS table.Sounds like a smart approach. > Another obvious answer is to provide back-pressure of some kind to prevent clients from requesting data when it is under load.I don't understand this fully. > You might find that a particular infrequent gen_server:call operation is taking a long time to complete causing a message queue> to suddenly grow. You might want to change such an operation from:I've done that on the first most handle_call. That's what I meant with deferring gen_server responses. I saw some speedups on the first handle_call but doing this on short lived handle_call's did see slowdowns. # Jesper Louis Andersen 2012-01-28> This would be my first idea. Create an ETS table being protected. Writes to the table goes through the gen_server, I like this approach, not as "beautiful" as a pure OTP-approach, but if does the trick. Hey. # Jachym Holecek 2012-01-29> You're probably treating asynchronous things as synchronous somewhere along the path, inflicting collateral damage to concurrent users?it's basically a get_data() function where we need to do roundtrips to db, other stuff to be able to return the value. Can I do this in a asynchronous fashion? I tend to think of get's as handle_calls and sets as hanlde_cast. Big thank you all. /dang > Date: Sat, 28 Jan 2012 18:13:25 -0500 > From: freza@REDACTED > To: jesper.louis.andersen@REDACTED > CC: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? > > Hi, > > [Replying to multiple replies at once, all quoted text reformatted for > readability (seems people these days can't be bothered!?).] > > [Warning: excessively nitpicky content ahead, here and there.] > > # God Dang 2012-01-28: > > I'm creating a system where I've ended up with alot of gen_servers that > > provides a clean interface. When I run this under load I see that the > > gen_server:call's is becoming a bottleneck. > > You're probably treating asynchronous things as synchronous somewhere along > the path, inflicting collateral damage to concurrent users? Synchronous > high-level API is fine, but if you know some operation is expensive or > depends on response from the outside world you should record request > context in ETS (row looking something like {Req_id, Timeout, From[, ...]} > and process requests out-of-order OR offload the actual processing to > short lived worker processes like Matthew Evans says OR a combination > of both OR somesuch. > > My point being that gen_server:call/N, by itself, is *very* fast in > practice, so chances are you're doing something wrong elsewhere. > > Other (unlikely) thing: you're not sending very large data structures in > messages, are you? That could hurt, but there are ways to address that > too if needed. > > # Matthew Evans 2012-01-28: > > Another obvious answer is to provide back-pressure of some kind to prevent > > clients from requesting data when it is under load. > > On external interfaces (or for global resource usage of some sort): yes, a > fine idea (a clear "must have", actually!); but doing this internally would > seem excessively defensive to me, unless further justification was given. > > > You might want to change such an operation from: > > > > handle_call({long_operation,Data},From,State) -> > > Rsp = do_lengthy_operation(Data), > > {reply, Rsp, State}; > > > > to: > > > > handle_call({long_operation,Data},From,State) -> > > spawn(fun() -> Rsp = do_lengthy_operation(Data), gen_server:reply(Rsp,From) end), > > {noreply, State}; > > 1. Why do people bother introducing "one-shot" variables for trivial > expressions they could have inlined? Means less context to maintain > when reading the code... > > 2. Surely you meant proc_lib:spawn_link/X there, didn't you? SASL logs > and fault propagation are the reason. While there are exceptions to > this, they're extremely rare. > > 3. The order of arguments to gen_server:reply/2 is wrong. > > Regarding the general approach: yes, a fine idea too. Depending on what > do_lengthy_operation/1 does putting these workers under supervisor might > be called for. > > # Jesper Louis Andersen 2012-01-28: > > This would be my first idea. Create an ETS table being protected. > > Writes to the table goes through the gen_server, > > Yes, a fine idea too -- ETS is one of the less obvious cornerstones > of Erlang programming (but don't tell "purity" fascists )... One > detail: almost all of my ETS tables are public even when many of > them are really treated as private or protected, reason is to keep > high degree of runtime tweakability just in case (this might be a > bit superstitious I admit). > > > -export([write/1, read/1]). > > > > write(Obj) -> > > call({write, Obj}). > > > > call(M) -> > > gen_server:call(?SERVER, M, infinity). > > 1. Abstracting trivial functionality such as call/1 above only > obfuscates code for precisely zero gain. > > 2. Same goes for typing "?SERVER" instead of the actual server > name. Using "?MODULE" is however alright, as long as it's > only referred to from current module (as it should). > > 3. No infinite timeouts without very good justification! You're > sacrificing a good default protective measure for no good > reason... > > > but reads happen in the calling process of the API and does not go > > through the gen_server at all, > > > > read(Key) -> > > case ets:lookup(?TAB, Key) of > > [] -> not_found; > > [_|_] = Objects -> {ok, Objects} > > end. > > (2) from above also applies to "?TAB" here. More to the point, it's > sometimes perfectly OK to do table writes directly from caller's > context too, like: > > write(Item) -> > true = ets:insert_new(actual_table_name, Item). > > It can of course be very tricky business and needs good thinking first. > I bet you're aware of this, mentioning it just because it's a handy > trick that doesn't seem to be widely known. > > > Creating the table with {read_concurrency, true} as the option will > > probably speed up reads by quite a bit as well. It is probably going > > to be a lot faster than having all caching reads going through that > > single point of contention. Chances are that just breaking parts of > > the chain is enough to improve the performance of the system. > > Well, yes, avoiding central points of contention (such as blessed > processes or, you guessed it, ETS tables) is certainly good engineering > practice, but see first part of this email for other considerations. > > BR, > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Sun Jan 29 11:08:20 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Sun, 29 Jan 2012 11:08:20 +0100 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: References: <4F241FE7.7080106@erlang-solutions.com> <20120128231325.GA6021@circlewave.net> Message-ID: Hi, What i meant was that you could maybe change your current design (if it is not like this already) so that you do not start to process another request from an external interface until your system has the actual resources to do so. On Sun, Jan 29, 2012 at 9:38 AM, God Dang wrote: > Thank you all for taking time to help me out. Some clarification, I've come > to the conclusion that gen_server(or more precisely my design) is to blame > after running multiple sessions with fprof, eprof and alot of timer:now_diff > and timer:tc. For example, if I put load on the system and time > my?handle_call({long_operation,Data},From,State) I see that the execution > time begins rise from <10ms to around ~2000ms and stabilizing there under my > load. If I remove the last gen_server and instead implement it as a simple > function it stabilizes around ~1000ms and removing yet another one gives me > yet lower execution times. > > A word on my design, a lot of the time the only reason we use a gen_server > is for keeping a state and more precisely a connection. For instance a > generic db backend which keeps the pid of the db connection, a cache backend > which keeps the memcache connection pid, my own server that keep state. and > within my handle_call({long_operation,Data},From,State) I could be doing a > couple of gen_server:call's and within the database gen_server I could be > doing additional gen_server call's to the cache backend. Why we've > constructed it as separate gen_server's is also to be able to call it from > different parts of the system like db:do_something() or cache:get(). > > On paper this looked like a clean and nice design but under load it starts > to behave poorly. > > To answer all in order: > #?Gianfranco Alongi 2012-01-28: >> You could use the synchronized serialization to generate push-back >> behaviour from your system, >> so that you do not handle a new request before it's possible - maybe >> you are already doing this,?or not. > I don' understand what this mean. Can you please clarify. > > # Matthew Evans 2012-01-28 >> The obvious, and maybe non-OTP, answer is to hold some of this state >> information in a public or protected named ETS table >> that your clients read from directly. A single gen_server can still own >> and write to that ETS table. > Sounds like a smart approach. > >> Another obvious answer is to provide back-pressure of some kind to prevent >> clients from requesting data when it is under load. > I don't understand this fully. > > >> You might find that a particular infrequent ?gen_server:call operation is >> taking a long time to complete causing a message queue >> to suddenly grow. You might want to change such an operation from: > I've done that on the?first most?handle_call. That's what I meant > with?deferring?gen_server responses. I saw some speedups on the first > handle_call but doing this on?short lived?handle_call's did see slowdowns. > > #?Jesper Louis Andersen 2012-01-28 >> This would be my first idea. Create an ETS table being protected. Writes >> to the table goes through the gen_server, > I like this approach, not as "beautiful" as a pure OTP-approach, but if does > the trick. Hey. > > #?Jachym Holecek 2012-01-29 >>?You're probably treating asynchronous things as synchronous somewhere >> along the path, inflicting collateral damage to concurrent users? > it's basically a get_data() function where we need to do roundtrips to db, > other stuff to be able to return the value. Can I do this in a asynchronous > fashion? I tend to think of get's as handle_calls and sets as hanlde_cast. > > Big thank you all. > > /dang > >> Date: Sat, 28 Jan 2012 18:13:25 -0500 >> From: freza@REDACTED >> To: jesper.louis.andersen@REDACTED >> CC: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Slow when using chained gen_server:call's, >> redesign or optimize? > >> >> Hi, >> >> [Replying to multiple replies at once, all quoted text reformatted for >> readability (seems people these days can't be bothered!?).] >> >> [Warning: excessively nitpicky content ahead, here and there.] >> >> # God Dang 2012-01-28: >> > I'm creating a system where I've ended up with alot of gen_servers that >> > provides a clean interface. When I run this under load I see that the >> > gen_server:call's is becoming a bottleneck. >> >> You're probably treating asynchronous things as synchronous somewhere >> along >> the path, inflicting collateral damage to concurrent users? Synchronous >> high-level API is fine, but if you know some operation is expensive or >> depends on response from the outside world you should record request >> context in ETS (row looking something like {Req_id, Timeout, From[, ...]} >> and process requests out-of-order OR offload the actual processing to >> short lived worker processes like Matthew Evans says OR a combination >> of both OR somesuch. >> >> My point being that gen_server:call/N, by itself, is *very* fast in >> practice, so chances are you're doing something wrong elsewhere. >> >> Other (unlikely) thing: you're not sending very large data structures in >> messages, are you? That could hurt, but there are ways to address that >> too if needed. >> >> # Matthew Evans 2012-01-28: >> > Another obvious answer is to provide back-pressure of some kind to >> > prevent >> > clients from requesting data when it is under load. >> >> On external interfaces (or for global resource usage of some sort): yes, a >> fine idea (a clear "must have", actually!); but doing this internally >> would >> seem excessively defensive to me, unless further justification was given. >> >> > You might want to change such an operation from: >> > >> > handle_call({long_operation,Data},From,State) -> >> > Rsp = do_lengthy_operation(Data), >> > {reply, Rsp, State}; >> > >> > to: >> > >> > handle_call({long_operation,Data},From,State) -> >> > spawn(fun() -> Rsp = do_lengthy_operation(Data), >> > gen_server:reply(Rsp,From) end), >> > {noreply, State}; >> >> 1. Why do people bother introducing "one-shot" variables for trivial >> expressions they could have inlined? Means less context to maintain >> when reading the code... >> >> 2. Surely you meant proc_lib:spawn_link/X there, didn't you? SASL logs >> and fault propagation are the reason. While there are exceptions to >> this, they're extremely rare. >> >> 3. The order of arguments to gen_server:reply/2 is wrong. >> >> Regarding the general approach: yes, a fine idea too. Depending on what >> do_lengthy_operation/1 does putting these workers under supervisor might >> be called for. >> >> # Jesper Louis Andersen 2012-01-28: >> > This would be my first idea. Create an ETS table being protected. >> > Writes to the table goes through the gen_server, >> >> Yes, a fine idea too -- ETS is one of the less obvious cornerstones >> of Erlang programming (but don't tell "purity" fascists )... One >> detail: almost all of my ETS tables are public even when many of >> them are really treated as private or protected, reason is to keep >> high degree of runtime tweakability just in case (this might be a >> bit superstitious I admit). >> >> > -export([write/1, read/1]). >> > >> > write(Obj) -> >> > call({write, Obj}). >> > >> > call(M) -> >> > gen_server:call(?SERVER, M, infinity). >> >> 1. Abstracting trivial functionality such as call/1 above only >> obfuscates code for precisely zero gain. >> >> 2. Same goes for typing "?SERVER" instead of the actual server >> name. Using "?MODULE" is however alright, as long as it's >> only referred to from current module (as it should). >> >> 3. No infinite timeouts without very good justification! You're >> sacrificing a good default protective measure for no good >> reason... >> >> > but reads happen in the calling process of the API and does not go >> > through the gen_server at all, >> > >> > read(Key) -> >> > case ets:lookup(?TAB, Key) of >> > [] -> not_found; >> > [_|_] = Objects -> {ok, Objects} >> > end. >> >> (2) from above also applies to "?TAB" here. More to the point, it's >> sometimes perfectly OK to do table writes directly from caller's >> context too, like: >> >> write(Item) -> >> true = ets:insert_new(actual_table_name, Item). >> >> It can of course be very tricky business and needs good thinking first. >> I bet you're aware of this, mentioning it just because it's a handy >> trick that doesn't seem to be widely known. >> >> > Creating the table with {read_concurrency, true} as the option will >> > probably speed up reads by quite a bit as well. It is probably going >> > to be a lot faster than having all caching reads going through that >> > single point of contention. Chances are that just breaking parts of >> > the chain is enough to improve the performance of the system. >> >> Well, yes, avoiding central points of contention (such as blessed >> processes or, you guessed it, ETS tables) is certainly good engineering >> practice, but see first part of this email for other considerations. >> >> BR, >> -- Jachym >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jesper.louis.andersen@REDACTED Sun Jan 29 12:15:30 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sun, 29 Jan 2012 12:15:30 +0100 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: <20120128231325.GA6021@circlewave.net> References: <4F241FE7.7080106@erlang-solutions.com> <20120128231325.GA6021@circlewave.net> Message-ID: <4F252A52.6080504@erlang-solutions.com> On 1/29/12 12:13 AM, Jachym Holecek wrote: >> -export([write/1, read/1]). >> >> write(Obj) -> >> call({write, Obj}). >> >> call(M) -> >> gen_server:call(?SERVER, M, infinity). > > 3. No infinite timeouts without very good justification! You're > sacrificing a good default protective measure for no good > reason... > The question here is really one of what you want to do if a write takes more than the default timeout of 5 seconds. You can either decide to tell the writer that the cache is clogged up at the moment and the abstain from caching the result, you can crash, or you can wait around like the above code does. What the right thing to do in a situation depends a bit on what semantics you want. Perhaps my reaction for a cache was to knee-jerky. You might want a call to fail if it takes too long to process because it will uncover another problem in the code: namely overload of the cache. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From bourinov@REDACTED Sun Jan 29 14:11:50 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sun, 29 Jan 2012 17:11:50 +0400 Subject: [erlang-questions] Looking for high performance transport Message-ID: Hello Erlangers, Could anybody suggest a good transport for my needs? My requirements: - Should support up to 1 Gbit traffic per node (message size from 128 bites to 4 KB) - Should support a lot (> 65000) connection per node - Should support authentification - Should be possible to develop additional client libs. Ideal will be kind of a server + client lib. So far I have tried ejabberd and exmpp. ejabberd is great but it has big overhead ~150 KB for connected user. exmpp is buggy and has very poor performance on our data (I send JSON data and exmpp tries to wrap each " into separate CDATA tag). Any ideas and links are welcome! Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Sun Jan 29 15:11:20 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Sun, 29 Jan 2012 15:11:20 +0100 Subject: [erlang-questions] Looking for high performance transport In-Reply-To: References: Message-ID: On Sunday, January 29, 2012, Max Bourinov wrote: > Hello Erlangers, > Could anybody suggest a good transport for my needs? > My requirements: > - Should support up to 1 Gbit traffic per node (message size from 128 bites to 4 KB) > - Should support a lot (> 65000) connection per node > - Should support authentification > - Should be possible to develop additional client libs. > Ideal will be kind of a server + client lib. > So far I have tried ejabberd and exmpp. ejabberd is great but it has big overhead ~150 KB for connected user. exmpp is buggy and has very poor performance on our data (I send JSON data and exmpp tries to wrap each " into separate CDATA tag). > Any ideas and links are welcome! > Best regards, > Max I'd say that those requirements are not very specific, since there are many other aspects which may be important. Two projects which I find "sexy" lately are ZeroMQ, which is very performant and may support topology you want out of the box. For transport encoding you could try using MsgPack which is allegedly very fast. But generally more details are needed to give good recommendations. Best, Gleb -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sun Jan 29 15:15:17 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sun, 29 Jan 2012 16:15:17 +0200 Subject: [erlang-questions] Looking for high performance transport In-Reply-To: References: Message-ID: <397FC3F0-D809-4734-A893-7592F8A21A3E@gmail.com> 1. udp 2. sctp both available at erlang. you might need to tweak auth by you self. - D On Jan 29, 2012, at 3:11 PM, Max Bourinov wrote: > Hello Erlangers, > > Could anybody suggest a good transport for my needs? > > My requirements: > - Should support up to 1 Gbit traffic per node (message size from 128 bites to 4 KB) > - Should support a lot (> 65000) connection per node > - Should support authentification > - Should be possible to develop additional client libs. > > Ideal will be kind of a server + client lib. > > So far I have tried ejabberd and exmpp. ejabberd is great but it has big overhead ~150 KB for connected user. exmpp is buggy and has very poor performance on our data (I send JSON data and exmpp tries to wrap each " into separate CDATA tag). > > Any ideas and links are welcome! > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mattevans123@REDACTED Sun Jan 29 18:01:02 2012 From: mattevans123@REDACTED (Matthew Evans) Date: Sun, 29 Jan 2012 12:01:02 -0500 Subject: [erlang-questions] HiPE compiler Message-ID: Hi group, My understanding is that HiPE takes Erlang byte code beam files as the input to produce modified combined HiPE + byte code beam files. I'm thinking of using HiPE on a project. Unfortunately the build system is mixed, and I'd rather not go down the cross-compiler route. My question is - is there a way to create "HiPE targets" just from beam files on the target platform? The source will, obviously, not be available on the target platform. Thanks Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Sun Jan 29 19:40:18 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Sun, 29 Jan 2012 19:40:18 +0100 Subject: [erlang-questions] Retrieve all auto-imported functions Message-ID: Is there a way to retrieve all auto-imported functions in parse time and/or runtime? erlang:module_info(exports) also returns non auto-imported functions. Thanks in advance, * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Sun Jan 29 21:35:23 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 29 Jan 2012 22:35:23 +0200 Subject: [erlang-questions] HiPE compiler In-Reply-To: References: Message-ID: <4F25AD8B.6070209@cs.ntua.gr> On 01/29/12 19:01, Matthew Evans wrote: > Hi group, > > My understanding is that HiPE takes Erlang byte code beam files as the > input to produce modified combined HiPE + byte code beam files. > > I'm thinking of using HiPE on a project. Unfortunately the build system > is mixed, and I'd rather not go down the cross-compiler route. My > question is - is there a way to create "HiPE targets" just from beam > files on the target platform? The source will, obviously, not be > available on the target platform. I am not sure I understand your question well, but I'll give it a shot in answering it anyway. Unlike BEAM byte code, the native code that the HiPE compiler generates has a very strong dependence on the specifics of the Erlang runtime system which is running the code. This means that you cannot native compile the code using Erlang/OTP R-X and expect it to run on R-Y where X and Y are different. This holds even for minor revisions of the same major release (i.e. code compiled for R14B03 cannot run on R14B03.) Also obviously there is a strong dependency on the target architecture: i.e. you cannot compile code for an x86 and expect it to run on an ARM. But you can compile your code natively and run it on another target if the machine that you compile in and the target machine are running exactly the same Erlang/OTP release and have the same underlying architecture. In this case you can use: erlc +native FILE.erl -o FILE.beam and transfer these FILE.beam(s) on the target machine. I am pretty sure this works. But what you can also do the following: compile the files to BEAM byte code and transfer these files to the target machine and then native compile these files on the fly (as part of the start of your application) by using something like the following: lists:foreach(fun (F) -> hipe:c(F) end, BEAM_FILES) This will compile the BEAM files in memory, generate native code for them and load them in the running system. (Obviously, you can choose to compile only a subset of your files, perhaps only those that are time critical.) There is obviously a small start up cost in doing this, but in most applications this should not be an issue. Let me know how it goes. We can continue this perhaps offline. Kostis From freza@REDACTED Sun Jan 29 21:59:03 2012 From: freza@REDACTED (Jachym Holecek) Date: Sun, 29 Jan 2012 15:59:03 -0500 Subject: [erlang-questions] Slow when using chained gen_server:call's, redesign or optimize? In-Reply-To: <4F252A52.6080504@erlang-solutions.com> References: <4F241FE7.7080106@erlang-solutions.com> <20120128231325.GA6021@circlewave.net> <4F252A52.6080504@erlang-solutions.com> Message-ID: <20120129205903.GA25835@circlewave.net> # Jesper Louis Andersen 2012-01-29: > On 1/29/12 12:13 AM, Jachym Holecek wrote: > >>-export([write/1, read/1]). > >> > >>write(Obj) -> > >> call({write, Obj}). > >> > >>call(M) -> > >> gen_server:call(?SERVER, M, infinity). > > > > 3. No infinite timeouts without very good justification! You're > > sacrificing a good default protective measure for no good > > reason... > > > The question here is really one of what you want to do if a write > takes more than the default timeout of 5 seconds. You can either > decide to tell the writer that the cache is clogged up at the moment > and the abstain from caching the result, you can crash, or you can > wait around like the above code does. What the right thing to do in > a situation depends a bit on what semantics you want. True. > Perhaps my reaction for a cache was to knee-jerky. You might want a > call to fail if it takes too long to process because it will uncover > another problem in the code: namely overload of the cache. And it will also release the resources held by waiting process, that's my main concern. What came to mind immediately when I saw the infinite timeout was a typical (IMO) scenario when one might be tempted to use those: %% This could be a load-balancer or failover manager process that %% acts as entry point to a protocol stack, or somesuch thing. send_req(Pid, Req, Timeout) -> gen_server:call(Pid, {send_req, Req, Timeout}, infinity). handle_call({send_req, Req, Timeout}, From, #state{parties = Ps} = State) -> party:send_req(choose_party(Ps), {send_req, Req, From, Timeout}), {noreply, State}; Where party module would perhaps do some more delegation of its own and eventually request ends up sent out to an external system, timeout gets planned and its reference recorded along with From in and ETS table. When either timeout triggers or response arrives it gets correlated against ETS and gen_server:reply/2 is called. Now if something goes wrong and that ETS table evaporates or a low-level process explodes and the error, by mistake, isn't propagated correctly (which would involve faulting all pending requests immediately), one is left with the client process sitting there forever. Sure, gen_server:call/X isn't stupid and monitors the server process -- but given the amount of delegation we have going on, that one may very well still be alive and doing well. Now over time these zombie processes could add u, and whole node crashes. This is a somewhat elaborate scenario and depends on a suitable bug being already present somewhere in the system, or perhaps just some unfortunate timing in otherwise reasonably designed system. But let's consider trivial change, everything else being the same: send_req(Pid, Req, Timeout) -> gen_server:call(Pid, {send_req, Req, scale_down(Timeout)}, Timeout). scale_down(N) -> %% This could involve both low and high internal processing overhead %% allowance cutoff if one wanted to be super-correct about this. round(N * 0.90). Bugs or not and timing or not we now have a hard deadline on resource release and can sleep a bit more peacefully at night without nightmares of zombie apocalypse. :-) Furthermore, this valuable behavioral contract is immediately apparent during code inspection, making things easier to reason about. Hopefully this sort of context clarifies my (possibly overly terse) response. BR, -- Jachym From roberto@REDACTED Sun Jan 29 22:06:50 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Sun, 29 Jan 2012 13:06:50 -0800 Subject: [erlang-questions] [ANN] Misultin 0.9 Message-ID: Dear all, Misultin 0.9 is out. Changelog is: - added SESSIONS state, persistent across requests - added access log callback function, so that main application can log HTTP access - added streaming input for big files or endless input, using a manual body_recv function in conjunction with the {auto_recv_body, false} option - added static directory support, so that GET requests to /static/* can automatically send files from a specified directory (thanks to egobrain suggestion) - added request redirection helper method - consistently improved memory usage by not copying by default to handler processes the full request or websocket record - added configuration option to set which websocket versions must be supported by the server - added support for websocket draft-hybi-10 - added support for websocket draft-hybi-17 (thanks to RJ) - added support for websockets on FireFox (thanks to Egobrain) - added support for 'If-Modified-Since' headers in file sending (thanks to davidgaleano) - added support for websockets when behind stunnel with {external_ssl, boolean()} option (thanks to RJ) - added support to see the correct client IP when behind stunnel, according to http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt(thanks to RJ) - added support for OPTIONS method (thanks to majek) - rebar-ized makefile - corrected minor bugs (thank you all - you know who you are!) Link to repo: https://bit.ly/misultin09 Thank you, r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Sun Jan 29 22:08:42 2012 From: vances@REDACTED (Vance Shipley) Date: Mon, 30 Jan 2012 02:38:42 +0530 Subject: [erlang-questions] better ct_expand and some intricate problems In-Reply-To: <2680AED8-CE38-478F-B91E-B8CD2E75F2BC@feuerlabs.com> References: <59294C34-299B-42AF-8163-6E61E514A9C1@feuerlabs.com> <2680AED8-CE38-478F-B91E-B8CD2E75F2BC@feuerlabs.com> Message-ID: <20120129210841.GB42931@aluminum.motivity.ca> On Sat, Jan 28, 2012 at 06:39:52PM +0100, Ulf Wiger wrote: } Funs from erl_eval _can_ actually be abstracted using erl_eval:fun_data/1. } } Too bad erl_parse:abstract/1 isn't aware of that? Indeed. Neither is the Erlang Pretty Printer. Not without converting the fun_data to the proper abstract expression form for a fun(): 1> {ok, Tokens, _} = erl_scan:string("fun () -> ok end."), 1> {ok, ExprList} = erl_parse:parse_exprs(Tokens), 1> {value, Fun, _} = erl_eval:exprs(ExprList, []), 1> {fun_data, _, Clauses} = erl_eval:fun_data(Fun), 1> AbsExpr = {'fun', 0, {clauses, Clauses}}, 1> io:put_chars(erl_pp:expr(AbsExpr)). fun() -> ok endok -- -Vance From mattevans123@REDACTED Mon Jan 30 02:39:06 2012 From: mattevans123@REDACTED (Matthew Evans) Date: Sun, 29 Jan 2012 20:39:06 -0500 Subject: [erlang-questions] HiPE compiler In-Reply-To: <4F25AD8B.6070209@cs.ntua.gr> References: , <4F25AD8B.6070209@cs.ntua.gr> Message-ID: Thanks Kostis, Calling hipe:c/1 on the beam file was exactly what I wanted. I thought you could only run it on source files. Matt > Date: Sun, 29 Jan 2012 22:35:23 +0200 > From: kostis@REDACTED > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] HiPE compiler > > On 01/29/12 19:01, Matthew Evans wrote: > > Hi group, > > > > My understanding is that HiPE takes Erlang byte code beam files as the > > input to produce modified combined HiPE + byte code beam files. > > > > I'm thinking of using HiPE on a project. Unfortunately the build system > > is mixed, and I'd rather not go down the cross-compiler route. My > > question is - is there a way to create "HiPE targets" just from beam > > files on the target platform? The source will, obviously, not be > > available on the target platform. > > I am not sure I understand your question well, but I'll give it a shot > in answering it anyway. > > Unlike BEAM byte code, the native code that the HiPE compiler generates > has a very strong dependence on the specifics of the Erlang runtime > system which is running the code. This means that you cannot native > compile the code using Erlang/OTP R-X and expect it to run on R-Y where > X and Y are different. This holds even for minor revisions of the same > major release (i.e. code compiled for R14B03 cannot run on R14B03.) > Also obviously there is a strong dependency on the target architecture: > i.e. you cannot compile code for an x86 and expect it to run on an ARM. > > But you can compile your code natively and run it on another target if > the machine that you compile in and the target machine are running > exactly the same Erlang/OTP release and have the same underlying > architecture. In this case you can use: > > erlc +native FILE.erl -o FILE.beam > > and transfer these FILE.beam(s) on the target machine. I am pretty sure > this works. > > But what you can also do the following: compile the files to BEAM byte > code and transfer these files to the target machine and then native > compile these files on the fly (as part of the start of your > application) by using something like the following: > > lists:foreach(fun (F) -> hipe:c(F) end, BEAM_FILES) > > This will compile the BEAM files in memory, generate native code for > them and load them in the running system. (Obviously, you can choose to > compile only a subset of your files, perhaps only those that are time > critical.) There is obviously a small start up cost in doing this, but > in most applications this should not be an issue. > > Let me know how it goes. We can continue this perhaps offline. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel@REDACTED Mon Jan 30 03:11:19 2012 From: daniel@REDACTED (Daniel Luna) Date: Sun, 29 Jan 2012 21:11:19 -0500 Subject: [erlang-questions] HiPE compiler In-Reply-To: References: <4F25AD8B.6070209@cs.ntua.gr> Message-ID: Just remember to compile your files with debug_info for this to work. HiPE needs the information in there to do its magic. /Daniel On 29 January 2012 20:39, Matthew Evans wrote: > Thanks Kostis, > > Calling hipe:c/1 on the beam file was exactly what I wanted. I thought you > could only run it on source files. > > Matt > >> Date: Sun, 29 Jan 2012 22:35:23 +0200 >> From: kostis@REDACTED >> To: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] HiPE compiler > >> >> On 01/29/12 19:01, Matthew Evans wrote: >> > Hi group, >> > >> > My understanding is that HiPE takes Erlang byte code beam files as the >> > input to produce modified combined HiPE + byte code beam files. >> > >> > I'm thinking of using HiPE on a project. Unfortunately the build system >> > is mixed, and I'd rather not go down the cross-compiler route. My >> > question is - is there a way to create "HiPE targets" just from beam >> > files on the target platform? The source will, obviously, not be >> > available on the target platform. >> >> I am not sure I understand your question well, but I'll give it a shot >> in answering it anyway. >> >> Unlike BEAM byte code, the native code that the HiPE compiler generates >> has a very strong dependence on the specifics of the Erlang runtime >> system which is running the code. This means that you cannot native >> compile the code using Erlang/OTP R-X and expect it to run on R-Y where >> X and Y are different. This holds even for minor revisions of the same >> major release (i.e. code compiled for R14B03 cannot run on R14B03.) >> Also obviously there is a strong dependency on the target architecture: >> i.e. you cannot compile code for an x86 and expect it to run on an ARM. >> >> But you can compile your code natively and run it on another target if >> the machine that you compile in and the target machine are running >> exactly the same Erlang/OTP release and have the same underlying >> architecture. In this case you can use: >> >> erlc +native FILE.erl -o FILE.beam >> >> and transfer these FILE.beam(s) on the target machine. I am pretty sure >> this works. >> >> But what you can also do the following: compile the files to BEAM byte >> code and transfer these files to the target machine and then native >> compile these files on the fly (as part of the start of your >> application) by using something like the following: >> >> lists:foreach(fun (F) -> hipe:c(F) end, BEAM_FILES) >> >> This will compile the BEAM files in memory, generate native code for >> them and load them in the running system. (Obviously, you can choose to >> compile only a subset of your files, perhaps only those that are time >> critical.) There is obviously a small start up cost in doing this, but >> in most applications this should not be an issue. >> >> Let me know how it goes. We can continue this perhaps offline. >> >> Kostis >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From bengt.kleberg@REDACTED Mon Jan 30 07:32:40 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 30 Jan 2012 07:32:40 +0100 Subject: [erlang-questions] Retrieve all auto-imported functions In-Reply-To: References: Message-ID: <1327905160.5414.4.camel@seasc1137> No answer, just removing a dead-end. Given a simple module(*) I get the following: 5> t:module_info(imports). [] Perhaps this is Erlang/OTPs way to remind us to avoid -import()? bengt (*) -module(t). -export([t/0]). -import(lists, [reverse/1]). t() -> reverse([1,2,3]). On Sun, 2012-01-29 at 19:40 +0100, Jos? Valim wrote: > Is there a way to retrieve all auto-imported functions in parse time > and/or runtime? > > > erlang:module_info(exports) also returns non auto-imported functions. > > > Thanks in advance, > > > Jos? Valim > www.plataformatec.com.br > Founder and Lead Developer > > From bgustavsson@REDACTED Mon Jan 30 08:20:03 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 30 Jan 2012 08:20:03 +0100 Subject: [erlang-questions] HiPE compiler In-Reply-To: References: <4F25AD8B.6070209@cs.ntua.gr> Message-ID: On Mon, Jan 30, 2012 at 3:11 AM, Daniel Luna wrote: > Just remember to compile your files with debug_info for this to work. > HiPE needs the information in there to do its magic. No, that is not correct. HiPE does not the abstract code in the BEAM file. It uses the BEAM byte code itself to generate native code. By the way, there is an easy way add native code to existing BEAM files, with no need for the source code: erlc +native FILE.beam -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kostis@REDACTED Mon Jan 30 09:11:22 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 30 Jan 2012 10:11:22 +0200 Subject: [erlang-questions] HiPE compiler In-Reply-To: References: <4F25AD8B.6070209@cs.ntua.gr> Message-ID: <4F2650AA.2050406@cs.ntua.gr> On 01/30/12 04:11, Daniel Luna wrote: > Just remember to compile your files with debug_info for this to work. > HiPE needs the information in there to do its magic. That's NOT the case! (Daniel may be confusing HiPE with dialyzer.) No special options are needed for this to work. Kostis From bourinov@REDACTED Mon Jan 30 14:49:05 2012 From: bourinov@REDACTED (Max Bourinov) Date: Mon, 30 Jan 2012 16:49:05 +0300 Subject: [erlang-questions] Strange server behavior when high load on erlang node Message-ID: Hi Erlangers, I see strange server behavior when I apply high load on my erlang node. My OS is Ubuntu 11.04 64 bit. I use Erlang/OTP exmpp with xpath. I have ~3000 processes running. All processes are OTP. My hardware is: http://h10010.www1.hp.com/wwpc/us/en/en/WF05a/3709945-3709945-3328410-241641-3328419-1842750.html?dnr=1 CPU: 2 x Intel Xeon 5420 Quad Core 2.50 GHz RAM 16 GB My sysclt is the following: * # General gigabit tuning: * * **net.core.rmem_max = 16777216* * **net.core.wmem_max = 16777216* * **net.ipv4.tcp_rmem = 10240 87380 16777216* * **net.ipv4.tcp_wmem = 10240 65536 16777216* * **net.ipv4.tcp_syncookies = 1* * * * **net.ipv4.ip_local_port_range = 10000 65000* * **kernel.max_pid = 4000000* * * * **net.ipv4.tcp_window_scaling = 1* * **net.ipv4.tcp_timestamps = 1* * **net.ipv4.tcp_sack = 1* * **net.ipv4.tcp_no_metrics_save = 1* * * * **kernel.sem = 250 32000 100 128* * * * **kernel.shmmni = 4096* * **fs.file-max = 100000* * **vm.swappiness = 0* * **vm.vfs_cache_pressure = 50* * * * **kernel.msgmax = 665536* * **kernel.shmmax = 68719476736* * **kernel.shmall = 4294967296* Please see the end part of each graph. This is CPU: http://img848.imageshack.us/img848/8999/cpuw.png This is IRQ: http://img7.imageshack.us/img7/259/irqstats.png This is Interrupts: http://img851.imageshack.us/img851/1985/interrupts.png This is eth0: http://img259.imageshack.us/img259/5730/ifeth0.png So, my questions about graphs are: 1. Why my IRQ are so high? Especially "Rescheduling interrupts"? I read somewhere that it could be because of power management and it is expectable that server consumes more energy under the load, but I have to idea how to fix it in this case. 2. Why "Interrupts" are so high? Please, Erlangers, *those of you who has experience with highly loaded erlang nodes* tell me about your experience: 1. Which values of IRQ and Interrupts are ok/normal? 2. Which values you see on your servers under high load? 3. Which OS is the best for high computation/traffic to host Erlang/OTP application? 4. Which settings you apply to you OS (general description or configs are welcome) to manage high load on Erlang? I hope that this information will be useful for all of us, because I believe everybody will face problems like I do one day when high load is applied. Thank you all in advance! Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From als@REDACTED Mon Jan 30 15:04:29 2012 From: als@REDACTED (Anthony Shipman) Date: Tue, 31 Jan 2012 01:04:29 +1100 Subject: [erlang-questions] gen_sctp:peeloff() in R15B Message-ID: <201201310104.29329.als@iinet.net.au> It appears that this function delivers a new socket with active=false, no matter what the active flag was for the original socket. Is this correct? The documentation could provide more detail on the settings of the new socket. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From andrew@REDACTED Mon Jan 30 15:21:50 2012 From: andrew@REDACTED (Andrew Thompson) Date: Mon, 30 Jan 2012 09:21:50 -0500 Subject: [erlang-questions] smtp server In-Reply-To: References: Message-ID: <20120130142150.GF5026@hijacked.us> On Sat, Jan 28, 2012 at 10:56:35PM -0800, Roberto Ostinelli wrote: > dear list, > > are you aware of any existent production-ready SMTP server in Erlang? I've > only found, maintained: https://github.com/Vagabond/gen_smtp I wrote that because I *couldn't* find an alternative that worked. I don't think anything complete has emerged in the years since either. Andrew From yoursurrogategod@REDACTED Mon Jan 30 16:40:04 2012 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Mon, 30 Jan 2012 10:40:04 -0500 Subject: [erlang-questions] Erlang and cloud computing Message-ID: Hello, I have a curiosity question. Is Erlang being used somehow in the field of cloud computing? The idea of splitting up a task and then processing it in pieces in parallel seems right up Erlang's alley. I have looked at Windows Azure, but they mostly use .NET languages, are there services where you can have a cloud computing environment and use Erlang to do the application development? What has been your experience if you have used Erlang in cloud computing? --Yves -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Mon Jan 30 18:48:16 2012 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 30 Jan 2012 17:48:16 -0000 (GMT) Subject: [erlang-questions] Retrieve all auto-imported functions In-Reply-To: <1327905160.5414.4.camel@seasc1137> Message-ID: <44b78870-0bc1-4426-88f2-14e53248948b@knuth> I don't know why it does this, it doesn't make sense. Of course import in Erlang doesn't do what many expect, ALL it does is a little name munging so you don't need to write the module name when calling the imported functions. The functions aren't "imported" into the module in any way or become special in any way. It only provides some syntactic sugar and has no semantic meaning at all. Robert ----- Original Message ----- > No answer, just removing a dead-end. Given a simple module(*) I get > the > following: > 5> t:module_info(imports). > [] > > > Perhaps this is Erlang/OTPs way to remind us to avoid -import()? > > > bengt > > (*) > -module(t). > -export([t/0]). > -import(lists, [reverse/1]). > t() -> reverse([1,2,3]). > > > On Sun, 2012-01-29 at 19:40 +0100, Jos? Valim wrote: > > Is there a way to retrieve all auto-imported functions in parse > > time > > and/or runtime? > > > > > > erlang:module_info(exports) also returns non auto-imported > > functions. > > > > > > Thanks in advance, > > > > > > Jos? Valim > > www.plataformatec.com.br > > Founder and Lead Developer > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From roberto.majadas@REDACTED Mon Jan 30 19:11:04 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Mon, 30 Jan 2012 19:11:04 +0100 Subject: [erlang-questions] Writers Readers problem Message-ID: Hello everyone: I'm writting a erlang app and i've the next scenario: The app has n process that writes tokens in "somewhere" and there are m process that reads one of those tokens and remove it. Which is the best way to store this tokens ? * global ets * a gen_server + ets * mnesia * ... thanks in advance Roberto -------------- next part -------------- An HTML attachment was scrubbed... URL: From austin@REDACTED Mon Jan 30 19:32:42 2012 From: austin@REDACTED (Austin Haas) Date: Mon, 30 Jan 2012 10:32:42 -0800 Subject: [erlang-questions] How can process_info return a status of exiting? Message-ID: <20120130183241.GA27774@mars.chicago> I've been studying the beam source code to learn about how processes are implemented and I've run into a dead end on this minor detail. How can process_info return a status of exiting for a target process? It appears that process_info_2 ignores exiting processes entirely. If I am following the source code correctly, process_info_2 gets a reference (rp) to the target process by calling pi_pid2proc, which in turn calls erts_pid2proc. erts_pid2proc is defined as erts_pid2proc_opt with a 0 for the optional flags, which means that it does not supply the ERTS_P2P_FLG_ALLOW_OTHER_X flag, which means that a process that is currently exiting will never be returned via these calls. If pi_pid2proc does not return a reference, then process_info_2 returns undefined and the code that looks up the status of the process will never execute. I probably either took a wrong turn tracing the code (perhaps due to various #ifdefS) or I'm overlooking some nuance of how processes are implemented. I'd really appreciate any pointers, tips, or wisdom. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com From dmkolesnikov@REDACTED Mon Jan 30 21:46:23 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Mon, 30 Jan 2012 22:46:23 +0200 Subject: [erlang-questions] Strange server behavior when high load on erlang node In-Reply-To: References: Message-ID: <517315FA-AD6D-42B4-BF4B-BD359E40FE25@gmail.com> Max, What is high load means? BTW, According to your CPU utilization you run a new test. What was a change to compare with previous test? I would advice you to check this thread http://old.nabble.com/-BUG--linux-2.6.28-rc3-regression:-IRQ-smp_affinities-not-respected-td20336758.html It is old but about your NIC > 2. Why "Interrupts" are so high? I've been experience high interrupts only because of NIC driver... > 1. Which values of IRQ and Interrupts are ok/normal? 50 - 60K if I remember properly > > 2. Which values you see on your servers under high load? 120K irq/sec ~12000 RPS and 1Gbpp bandwidth =) > 3. Which OS is the best for high computation/traffic to host Erlang/OTP application? I am sorry to say but not Ubuntu =) I swap test env from Ubuntu to CentOS right after 10.04 due to issue with NIC drivers but that was a different story and has nothing to do with your symptoms. Production is either CentOS or AWS default images - Dmitry On Jan 30, 2012, at 3:49 PM, Max Bourinov wrote: > Hi Erlangers, > > I see strange server behavior when I apply high load on my erlang node. > > My OS is Ubuntu 11.04 64 bit. > I use Erlang/OTP exmpp with xpath. > I have ~3000 processes running. All processes are OTP. > > My hardware is: > > http://h10010.www1.hp.com/wwpc/us/en/en/WF05a/3709945-3709945-3328410-241641-3328419-1842750.html?dnr=1 > > CPU: 2 x Intel Xeon 5420 Quad Core 2.50 GHz > RAM 16 GB > > My sysclt is the following: > > # General gigabit tuning: > net.core.rmem_max = 16777216 > net.core.wmem_max = 16777216 > net.ipv4.tcp_rmem = 10240 87380 16777216 > net.ipv4.tcp_wmem = 10240 65536 16777216 > net.ipv4.tcp_syncookies = 1 > > net.ipv4.ip_local_port_range = 10000 65000 > kernel.max_pid = 4000000 > > net.ipv4.tcp_window_scaling = 1 > net.ipv4.tcp_timestamps = 1 > net.ipv4.tcp_sack = 1 > net.ipv4.tcp_no_metrics_save = 1 > > kernel.sem = 250 32000 100 128 > > kernel.shmmni = 4096 > fs.file-max = 100000 > vm.swappiness = 0 > vm.vfs_cache_pressure = 50 > > kernel.msgmax = 665536 > kernel.shmmax = 68719476736 > kernel.shmall = 4294967296 > > > Please see the end part of each graph. > > This is CPU: > http://img848.imageshack.us/img848/8999/cpuw.png > > This is IRQ: > http://img7.imageshack.us/img7/259/irqstats.png > > This is Interrupts: > http://img851.imageshack.us/img851/1985/interrupts.png > > This is eth0: > http://img259.imageshack.us/img259/5730/ifeth0.png > > > So, my questions about graphs are: > > 1. Why my IRQ are so high? Especially "Rescheduling interrupts"? I read somewhere that it could be because of power management and it is expectable that server consumes more energy under the load, but I have to idea how to fix it in this case. > > 2. Why "Interrupts" are so high? > > Please, Erlangers, those of you who has experience with highly loaded erlang nodes tell me about your experience: > > 1. Which values of IRQ and Interrupts are ok/normal? > > 2. Which values you see on your servers under high load? > > 3. Which OS is the best for high computation/traffic to host Erlang/OTP application? > > 4. Which settings you apply to you OS (general description or configs are welcome) to manage high load on Erlang? > > > I hope that this information will be useful for all of us, because I believe everybody will face problems like I do one day when high load is applied. > > Thank you all in advance! > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From gianfranco.alongi@REDACTED Mon Jan 30 21:57:55 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 30 Jan 2012 21:57:55 +0100 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: Some questions that can help us give you an accurate answer 1) How frequent does this happen? Once a second? Once a minute? Once an hour? 2) How large is the token? 1 byte? 1 Kbyte? 1 Mbyte? 3) Do you need the storage to scale dynamically with more added nodes? 4) What more do you expect of the storage? - Automatic signaling on add/delete? - Triggers? etc Cheers G On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez wrote: > Hello everyone: > > I'm writting a erlang app and i've the next scenario: > > The app has n process that writes tokens in "somewhere" and there are m > process that reads one of those tokens and remove it. > > Which is the best way to store this tokens ? > ?* global ets > ?* a gen_server + ets > ?* mnesia > ?* ... > > thanks in advance > > Roberto > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From roberto.majadas@REDACTED Mon Jan 30 22:07:18 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Mon, 30 Jan 2012 22:07:18 +0100 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: 2012/1/30 Gianfranco Alongi > Some questions that can help us give you an accurate answer > > 1) How frequent does this happen? > Once a second? > Once a minute? > Once an hour? less than a second > > 2) How large is the token? > 1 byte? > 1 Kbyte? > 1 Mbyte? > probably 10-20 chars > > 3) Do you need the storage to scale dynamically with more added nodes? > could be ok, but i think is not required > > 4) What more do you expect of the storage? > - Automatic signaling on add/delete? > - Triggers? > not required Thanks :) > etc > > Cheers > G > > On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez > wrote: > > Hello everyone: > > > > I'm writting a erlang app and i've the next scenario: > > > > The app has n process that writes tokens in "somewhere" and there are m > > process that reads one of those tokens and remove it. > > > > Which is the best way to store this tokens ? > > * global ets > > * a gen_server + ets > > * mnesia > > * ... > > > > thanks in advance > > > > Roberto > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik.svahn@REDACTED Mon Jan 30 22:14:03 2012 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Mon, 30 Jan 2012 22:14:03 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: There is also http://svahne.github.com/browserl, a small script which I wrote just for fun. Short version: it is an Erlang emulator in javascript, which can load and run an Erlang/OTP system from a tar file with ordinary beam files. It can also load and execute individual beam files. It will run common test and successfully complete some OTP test suites (the test suites are not loaded in the example page, though). Files, binaries, ets and floats are work in progress, at the moment they are only supported to the extent needed to boot the system and run common test. BR /Fredrik On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: > wow. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gianfranco.alongi@REDACTED Mon Jan 30 22:21:22 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 30 Jan 2012 22:21:22 +0100 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: Okay, so here goes some of my immediate thoughts, First - I would write some wrapper that abstracts away from the implementation of the storage, this way you should be able to try out some of your ideas quickly without being punished too much. If you need access across multiple nodes, I would go for a simple mnesia implementation. If you get too much lock contention - distribute the tokens over a deterministic key space using hashes or whatever you need. Mnesia is also nice since you get redundancy and persistency - once your system comes up again, it's all there and you can start chugging along. If this is too slow for you and you don't need redundancy or persistency - try it out with ets tables. /G On Mon, Jan 30, 2012 at 10:07 PM, Roberto Majadas Lopez wrote: > 2012/1/30 Gianfranco Alongi >> >> Some questions that can help us give you an accurate answer >> >> 1) How frequent does this happen? >> ? ?Once a second? >> ? ?Once a minute? >> ? ?Once an hour? > > > less than a second > >> >> >> 2) How large is the token? >> ? ?1 byte? >> ? ?1 Kbyte? >> ? ?1 Mbyte? > > > > probably 10-20 chars > >> >> >> 3) Do you need the storage to scale dynamically with more added nodes? > > > could be ok, but i think is not required > >> >> >> 4) What more do you expect of the storage? >> ? ?- Automatic signaling on add/delete? >> ? ?- Triggers? > > > not required > > Thanks :) > >> >> ? etc >> >> Cheers >> G >> >> On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez >> wrote: >> > Hello everyone: >> > >> > I'm writting a erlang app and i've the next scenario: >> > >> > The app has n process that writes tokens in "somewhere" and there are m >> > process that reads one of those tokens and remove it. >> > >> > Which is the best way to store this tokens ? >> > ?* global ets >> > ?* a gen_server + ets >> > ?* mnesia >> > ?* ... >> > >> > thanks in advance >> > >> > Roberto >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > > > From dmkolesnikov@REDACTED Mon Jan 30 22:28:39 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Mon, 30 Jan 2012 23:28:39 +0200 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: why not pass tokens from (n)-process directly to (m)-process? - D. On Jan 30, 2012, at 11:21 PM, Gianfranco Alongi wrote: > Okay, so here goes some of my immediate thoughts, > > First - I would write some wrapper that abstracts away from the > implementation of the storage, > this way you should be able to try out some of your ideas quickly > without being punished too much. > > If you need access across multiple nodes, I would go for a simple > mnesia implementation. > If you get too much lock contention - distribute the tokens over a > deterministic key space using hashes or whatever you need. > Mnesia is also nice since you get redundancy and persistency - once > your system comes up again, it's all there > and you can start chugging along. > > If this is too slow for you and you don't need redundancy or > persistency - try it out with ets tables. > > /G > > On Mon, Jan 30, 2012 at 10:07 PM, Roberto Majadas Lopez > wrote: >> 2012/1/30 Gianfranco Alongi >>> >>> Some questions that can help us give you an accurate answer >>> >>> 1) How frequent does this happen? >>> Once a second? >>> Once a minute? >>> Once an hour? >> >> >> less than a second >> >>> >>> >>> 2) How large is the token? >>> 1 byte? >>> 1 Kbyte? >>> 1 Mbyte? >> >> >> >> probably 10-20 chars >> >>> >>> >>> 3) Do you need the storage to scale dynamically with more added nodes? >> >> >> could be ok, but i think is not required >> >>> >>> >>> 4) What more do you expect of the storage? >>> - Automatic signaling on add/delete? >>> - Triggers? >> >> >> not required >> >> Thanks :) >> >>> >>> etc >>> >>> Cheers >>> G >>> >>> On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez >>> wrote: >>>> Hello everyone: >>>> >>>> I'm writting a erlang app and i've the next scenario: >>>> >>>> The app has n process that writes tokens in "somewhere" and there are m >>>> process that reads one of those tokens and remove it. >>>> >>>> Which is the best way to store this tokens ? >>>> * global ets >>>> * a gen_server + ets >>>> * mnesia >>>> * ... >>>> >>>> thanks in advance >>>> >>>> Roberto >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From tony@REDACTED Mon Jan 30 22:40:35 2012 From: tony@REDACTED (Tony Rogvall) Date: Mon, 30 Jan 2012 22:40:35 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: <00E79442-3F19-4CD2-AD3E-C8107EC8F68B@rogvall.se> This is not a "small script", this is an ultra cool "small script" :-) I like! /Tony On 30 jan 2012, at 22:14, Fredrik Svahn wrote: > There is also http://svahne.github.com/browserl, a small script which > I wrote just for fun. > > Short version: it is an Erlang emulator in javascript, which can load > and run an Erlang/OTP system from a tar file with ordinary beam files. > It can also load and execute individual beam files. It will run common > test and successfully complete some OTP test suites (the test suites > are not loaded in the example page, though). Files, binaries, ets and > floats are work in progress, at the moment they are only supported to > the extent needed to boot the system and run common test. > > BR /Fredrik > > > On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: >> wow. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From wgwi@REDACTED Tue Jan 31 03:13:31 2012 From: wgwi@REDACTED (Wang Wei) Date: Tue, 31 Jan 2012 10:13:31 +0800 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: <4F274E4B.4060001@sxu.edu.cn> I think using a message queue such as zeromq or rabbitmq maybe better. Wang Wei ? 2012/1/31 2:11, Roberto Majadas Lopez ??: > Hello everyone: > > I'm writting a erlang app and i've the next scenario: > > The app has n process that writes tokens in "somewhere" and there are > m process that reads one of those tokens and remove it. > > Which is the best way to store this tokens ? > * global ets > * a gen_server + ets > * mnesia > * ... > > thanks in advance > > Roberto > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue Jan 31 10:24:04 2012 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 31 Jan 2012 10:24:04 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: Wow - ultra interesting. Just out of curiosity - how do you represent lists and tuples in JS? Are they represented as native JS objects or as objects on the beam stack and heap? And if they are native JS objects what is the storage overhead of a list-cell? /Joe On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn wrote: > There is also http://svahne.github.com/browserl, a small script which > I wrote just for fun. > > Short version: it is an Erlang emulator in javascript, which can load > and run an Erlang/OTP system from a tar file with ordinary beam files. > It can also load and execute individual beam files. It will run common > test and successfully complete some OTP test suites (the test suites > are not loaded in the example page, though). Files, binaries, ets and > floats are work in progress, at the moment they are only supported to > the extent needed to boot the system and run common test. > > BR /Fredrik > > > On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: >> wow. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Tue Jan 31 10:28:04 2012 From: bourinov@REDACTED (Max Bourinov) Date: Tue, 31 Jan 2012 12:28:04 +0300 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: That is very cool indeed. Do you have any use-cases where we can benefit from it in our projects? Would be great to load ur users with some Erlang in their browsers :-) Best regards, Max On Tue, Jan 31, 2012 at 12:24 PM, Joe Armstrong wrote: > Wow - ultra interesting. > > Just out of curiosity - how do you represent lists and tuples in JS? > Are they represented > as native JS objects or as objects on the beam stack and heap? And if > they are native JS objects what is the storage overhead of a > list-cell? > > /Joe > > > On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn > wrote: > > There is also http://svahne.github.com/browserl, a small script which > > I wrote just for fun. > > > > Short version: it is an Erlang emulator in javascript, which can load > > and run an Erlang/OTP system from a tar file with ordinary beam files. > > It can also load and execute individual beam files. It will run common > > test and successfully complete some OTP test suites (the test suites > > are not loaded in the example page, though). Files, binaries, ets and > > floats are work in progress, at the moment they are only supported to > > the extent needed to boot the system and run common test. > > > > BR /Fredrik > > > > > > On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: > >> wow. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Tue Jan 31 10:35:23 2012 From: tony@REDACTED (Tony Rogvall) Date: Tue, 31 Jan 2012 10:35:23 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: On my wish list is distributed Erlang over web sockets. Toss in a built in module for creating and manage HTML DOM elements. But a web socket "driver" could get us far enough :-) /Tony On 31 jan 2012, at 10:28, Max Bourinov wrote: > That is very cool indeed. > > Do you have any use-cases where we can benefit from it in our projects? Would be great to load ur users with some Erlang in their browsers :-) > > Best regards, > Max > > > > > On Tue, Jan 31, 2012 at 12:24 PM, Joe Armstrong wrote: > Wow - ultra interesting. > > Just out of curiosity - how do you represent lists and tuples in JS? > Are they represented > as native JS objects or as objects on the beam stack and heap? And if > they are native JS objects what is the storage overhead of a > list-cell? > > /Joe > > > On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn wrote: > > There is also http://svahne.github.com/browserl, a small script which > > I wrote just for fun. > > > > Short version: it is an Erlang emulator in javascript, which can load > > and run an Erlang/OTP system from a tar file with ordinary beam files. > > It can also load and execute individual beam files. It will run common > > test and successfully complete some OTP test suites (the test suites > > are not loaded in the example page, though). Files, binaries, ets and > > floats are work in progress, at the moment they are only supported to > > the extent needed to boot the system and run common test. > > > > BR /Fredrik > > > > > > On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: > >> wow. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Tue Jan 31 10:40:47 2012 From: bourinov@REDACTED (Max Bourinov) Date: Tue, 31 Jan 2012 12:40:47 +0300 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: So, the idea is to run distributed Erlang in browsers over the Internet? Erlang web-based distributed computation network. That is very intresting indeed. Don't know how to use it at the moment because I never think about using Erlang this way, but I think cool ideas will come :-) Best regards, Max On Tue, Jan 31, 2012 at 12:35 PM, Tony Rogvall wrote: > On my wish list is distributed Erlang over web sockets. > Toss in a built in module for creating and manage HTML DOM elements. > > But a web socket "driver" could get us far enough :-) > > /Tony > > > On 31 jan 2012, at 10:28, Max Bourinov wrote: > > That is very cool indeed. > > Do you have any use-cases where we can benefit from it in our projects? > Would be great to load ur users with some Erlang in their browsers :-) > > Best regards, > Max > > > > > On Tue, Jan 31, 2012 at 12:24 PM, Joe Armstrong wrote: > >> Wow - ultra interesting. >> >> Just out of curiosity - how do you represent lists and tuples in JS? >> Are they represented >> as native JS objects or as objects on the beam stack and heap? And if >> they are native JS objects what is the storage overhead of a >> list-cell? >> >> /Joe >> >> >> On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn >> wrote: >> > There is also http://svahne.github.com/browserl, a small script which >> > I wrote just for fun. >> > >> > Short version: it is an Erlang emulator in javascript, which can load >> > and run an Erlang/OTP system from a tar file with ordinary beam files. >> > It can also load and execute individual beam files. It will run common >> > test and successfully complete some OTP test suites (the test suites >> > are not loaded in the example page, though). Files, binaries, ets and >> > floats are work in progress, at the moment they are only supported to >> > the extent needed to boot the system and run common test. >> > >> > BR /Fredrik >> > >> > >> > On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: >> >> wow. >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > "Installing applications can lead to corruption over time. Applications > gradually write over each other's libraries, partial upgrades occur, user > and system errors happen, and minute changes may be unnoticeable and > difficult to fix" > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue Jan 31 11:25:27 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 31 Jan 2012 11:25:27 +0100 Subject: [erlang-questions] [erlide] poll: eclipse versions used Message-ID: Hi, Sorry for duplicate messages. Is there anyone that uses erlide still required to use Eclipse 3.6? (No answer = "not me") If not, we will soon base our code on 3.7. best regards, Vlad From fredrik.svahn@REDACTED Tue Jan 31 11:56:50 2012 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Tue, 31 Jan 2012 11:56:50 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: Hi Joe, The Erlang list [1, 2, 3] is represented as js native objects {value: 1, next: {value: 2, next: {value: 3, next:nil}}}. The size of a string represented as a list is 40 bytes per character in Chromium on my x86_64 machine (I do not know if the size would be smaller on a 32 bit machine). The corresponding number for beam is 16 bytes/char for x86_64, I believe, so it is more wasteful as expected. I have considered mapping it to js arrays but haven't done any measurements. This is just a small script so I did not want to write my own GC, also mapping to native objects is better if I later would like to make it possible to compile performance critical beams to native javascript code. The Erlang tuple {1,2,3} is represented as the js array [1, 2, 3]. Binaries are mapped to js strings, and atoms to numbers. BR /Fredrik On Tue, Jan 31, 2012 at 10:24 AM, Joe Armstrong wrote: > Wow - ultra interesting. > > Just out of curiosity - how do you represent lists and tuples in JS? > Are they represented > as ?native JS objects or as objects on the beam stack and heap? And if > they are native JS objects what is the storage overhead of a > list-cell? > > /Joe > > > On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn wrote: >> There is also http://svahne.github.com/browserl, a small script which >> I wrote just for fun. >> >> Short version: it is an Erlang emulator in javascript, which can load >> and run an Erlang/OTP system from a tar file with ordinary beam files. >> It can also load and execute individual beam files. It will run common >> test and successfully complete some OTP test suites (the test suites >> are not loaded in the example page, though). Files, binaries, ets and >> floats are work in progress, at the moment they are only supported to >> the extent needed to boot the system and run common test. >> >> BR /Fredrik >> >> >> On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: >>> wow. >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From roberto.majadas@REDACTED Tue Jan 31 12:18:12 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Tue, 31 Jan 2012 12:18:12 +0100 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: 2012/1/30 Dmitry Kolesnikov > why not pass tokens from (n)-process directly to (m)-process? > The problem is that i've n process representing an user session, and the token is like a "ticket" to authorize to take some information from the server. The real user gets the token and goes to an http server (inside the erlang app) a create one of the (m)-process. This process needs to check if the token is valid or not. If is valid, the user can get the data and the token is removed. thanks for the hell and regards > > - D. > > On Jan 30, 2012, at 11:21 PM, Gianfranco Alongi wrote: > > > Okay, so here goes some of my immediate thoughts, > > > > First - I would write some wrapper that abstracts away from the > > implementation of the storage, > > this way you should be able to try out some of your ideas quickly > > without being punished too much. > > > > If you need access across multiple nodes, I would go for a simple > > mnesia implementation. > > If you get too much lock contention - distribute the tokens over a > > deterministic key space using hashes or whatever you need. > > Mnesia is also nice since you get redundancy and persistency - once > > your system comes up again, it's all there > > and you can start chugging along. > > > > If this is too slow for you and you don't need redundancy or > > persistency - try it out with ets tables. > > > > /G > > > > On Mon, Jan 30, 2012 at 10:07 PM, Roberto Majadas Lopez > > wrote: > >> 2012/1/30 Gianfranco Alongi > >>> > >>> Some questions that can help us give you an accurate answer > >>> > >>> 1) How frequent does this happen? > >>> Once a second? > >>> Once a minute? > >>> Once an hour? > >> > >> > >> less than a second > >> > >>> > >>> > >>> 2) How large is the token? > >>> 1 byte? > >>> 1 Kbyte? > >>> 1 Mbyte? > >> > >> > >> > >> probably 10-20 chars > >> > >>> > >>> > >>> 3) Do you need the storage to scale dynamically with more added nodes? > >> > >> > >> could be ok, but i think is not required > >> > >>> > >>> > >>> 4) What more do you expect of the storage? > >>> - Automatic signaling on add/delete? > >>> - Triggers? > >> > >> > >> not required > >> > >> Thanks :) > >> > >>> > >>> etc > >>> > >>> Cheers > >>> G > >>> > >>> On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez > >>> wrote: > >>>> Hello everyone: > >>>> > >>>> I'm writting a erlang app and i've the next scenario: > >>>> > >>>> The app has n process that writes tokens in "somewhere" and there are > m > >>>> process that reads one of those tokens and remove it. > >>>> > >>>> Which is the best way to store this tokens ? > >>>> * global ets > >>>> * a gen_server + ets > >>>> * mnesia > >>>> * ... > >>>> > >>>> thanks in advance > >>>> > >>>> Roberto > >>>> > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>> > >> > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jakob@REDACTED Tue Jan 31 12:44:41 2012 From: jakob@REDACTED (Jakob Praher) Date: Tue, 31 Jan 2012 12:44:41 +0100 Subject: [erlang-questions] Erlang in the browser Message-ID: <7732-4f27d400-5-748af280@35816948> Hi Fredirk, nice work! Regarding representing data types. It might be worth to look at emscripten (https://github.com/kripken/emscripten). Alon Zakai (the author) uses native memory layout for data structures. Native memory is represented as a arrays (optionally separated between primitive types) in Javascript. According to his evaluations this is a very efficient representation technique. One could also investigate in taking the existing implementation of erl and compile it on LLVM to be used by emscripten. For interfacing with Javascript (the downside of the data structures as native blobs) ints and floats can be used as is, but other data structures are just slieces in arrays. So it also depends on how much interaction is happening between erlang and javascript for this to be more efficient or not. See: https://github.com/kripken/emscripten/wiki/Interacting-with-code In preamble.js there are functions for setting and getting values on/from the heap. For instance the function intArrayFromString that shows how the conversion between a Javascript string and the heap C-like null-terminated char array is done. Cheers, Jakob PS: For my resarch I have prototyped a Prolog interpreter in Javascript (for educational reasons only). In this implementation I used Javascript arrays for functors. I also thought about marking arrays as being either native arrays or functors. Am Dienstag, 31. Januar 2012 11:56 CET, Fredrik Svahn schrieb: > Hi Joe, > > The Erlang list [1, 2, 3] is represented as js native objects {value: > 1, next: {value: 2, next: {value: 3, next:nil}}}. The size of a string > represented as a list is 40 bytes per character in Chromium on my > x86_64 machine (I do not know if the size would be smaller on a 32 bit > machine). The corresponding number for beam is 16 bytes/char for > x86_64, I believe, so it is more wasteful as expected. I have > considered mapping it to js arrays but haven't done any measurements. > This is just a small script so I did not want to write my own GC, also > mapping to native objects is better if I later would like to make it > possible to compile performance critical beams to native javascript > code. > > The Erlang tuple {1,2,3} is represented as the js array [1, 2, 3]. > Binaries are mapped to js strings, and atoms to numbers. > > BR /Fredrik > > > On Tue, Jan 31, 2012 at 10:24 AM, Joe Armstrong wrote: > > Wow - ultra interesting. > > > > Just out of curiosity - how do you represent lists and tuples in JS? > > Are they represented > > as ?native JS objects or as objects on the beam stack and heap? And if > > they are native JS objects what is the storage overhead of a > > list-cell? > > > > /Joe > > > > > > On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn wrote: > >> There is also http://svahne.github.com/browserl, a small script which > >> I wrote just for fun. > >> > >> Short version: it is an Erlang emulator in javascript, which can load > >> and run an Erlang/OTP system from a tar file with ordinary beam files. > >> It can also load and execute individual beam files. It will run common > >> test and successfully complete some OTP test suites (the test suites > >> are not loaded in the example page, though). Files, binaries, ets and > >> floats are work in progress, at the moment they are only supported to > >> the extent needed to boot the system and run common test. > >> > >> BR /Fredrik > >> > >> > >> On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: > >>> wow. > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Tue Jan 31 13:31:19 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Tue, 31 Jan 2012 14:31:19 +0200 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: <3523050567733832999@unknownmsgid> I see but this is what I mean... User session is an erlang n-process. When user asks for token it gets a noncenc + serialized node and pid of n-process + signature. When it connects to erlang app m-process, user supplies a token. M-process validates signature, deserialize address (pid+node) and asks n-process to validate noncenc. If n-process is not exists then session is expired. No needs for shared memory like ets, mnesia, etc. Best Regards, Dmitry >-|-|-*> On 31.1.2012, at 13.18, Roberto Majadas Lopez wrote: 2012/1/30 Dmitry Kolesnikov > why not pass tokens from (n)-process directly to (m)-process? > The problem is that i've n process representing an user session, and the token is like a "ticket" to authorize to take some information from the server. The real user gets the token and goes to an http server (inside the erlang app) a create one of the (m)-process. This process needs to check if the token is valid or not. If is valid, the user can get the data and the token is removed. thanks for the hell and regards > > - D. > > On Jan 30, 2012, at 11:21 PM, Gianfranco Alongi wrote: > > > Okay, so here goes some of my immediate thoughts, > > > > First - I would write some wrapper that abstracts away from the > > implementation of the storage, > > this way you should be able to try out some of your ideas quickly > > without being punished too much. > > > > If you need access across multiple nodes, I would go for a simple > > mnesia implementation. > > If you get too much lock contention - distribute the tokens over a > > deterministic key space using hashes or whatever you need. > > Mnesia is also nice since you get redundancy and persistency - once > > your system comes up again, it's all there > > and you can start chugging along. > > > > If this is too slow for you and you don't need redundancy or > > persistency - try it out with ets tables. > > > > /G > > > > On Mon, Jan 30, 2012 at 10:07 PM, Roberto Majadas Lopez > > wrote: > >> 2012/1/30 Gianfranco Alongi > >>> > >>> Some questions that can help us give you an accurate answer > >>> > >>> 1) How frequent does this happen? > >>> Once a second? > >>> Once a minute? > >>> Once an hour? > >> > >> > >> less than a second > >> > >>> > >>> > >>> 2) How large is the token? > >>> 1 byte? > >>> 1 Kbyte? > >>> 1 Mbyte? > >> > >> > >> > >> probably 10-20 chars > >> > >>> > >>> > >>> 3) Do you need the storage to scale dynamically with more added nodes? > >> > >> > >> could be ok, but i think is not required > >> > >>> > >>> > >>> 4) What more do you expect of the storage? > >>> - Automatic signaling on add/delete? > >>> - Triggers? > >> > >> > >> not required > >> > >> Thanks :) > >> > >>> > >>> etc > >>> > >>> Cheers > >>> G > >>> > >>> On Mon, Jan 30, 2012 at 7:11 PM, Roberto Majadas Lopez > >>> wrote: > >>>> Hello everyone: > >>>> > >>>> I'm writting a erlang app and i've the next scenario: > >>>> > >>>> The app has n process that writes tokens in "somewhere" and there are > m > >>>> process that reads one of those tokens and remove it. > >>>> > >>>> Which is the best way to store this tokens ? > >>>> * global ets > >>>> * a gen_server + ets > >>>> * mnesia > >>>> * ... > >>>> > >>>> thanks in advance > >>>> > >>>> Roberto > >>>> > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>> > >> > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jakob@REDACTED Tue Jan 31 14:07:48 2012 From: jakob@REDACTED (Jakob Praher) Date: Tue, 31 Jan 2012 14:07:48 +0100 Subject: [erlang-questions] chained functions In-Reply-To: Message-ID: <7732-4f27e780-9-748af280@35816950> As I tried out the code below I learned that tuples of module and function atoms evalute to functions, not atoms by themselves. If one can apply arguments to a tuple, why not to an atom if this would be denote a function in the current environment? {R, V} = apply_each([{m1,z},{m2,y},{m3,x}], Arg). if R = ok -> ... Thanks, Jakob Am Mittwoch, 25. Januar 2012 14:29 CET, "Jakob Praher" schrieb: > > One could also compose a sequence of functions much like in combinator parsing, and fail at the first event returning the error status, otherwise continue to call apply the functions to the result. > > apply_each([F|FS],X) -> > {S, V} = F(X), > if S = error -> > {S, V} > S = ok -> > apply_each(FS, V); > end > . > > {R, V} = apply_each([z,y,x], Arg). > if R = ok -> ... > > I have not much practice in Erlang (though I have some practice in Prolog), so this might not be 100 % correct. > > Cheers, > Jakob > > Am Mittwoch, 25. Januar 2012 13:16 CET, Joe Armstrong schrieb: > > > I think you are asking the wrong question. If a function returns > > {ok,Val} | {error,Reason} > > then I think to myself "the caller of this function expects things to > > go wrong and is > > committed to handling *both* return values. > > > > So they would *never* write w(x(y(z(....))) because this does not cater for both > > return values. > > > > With the "let it crash" philosophy one would make w,x,y, .. return a > > value OR call exit(...). > > With this convention things do nest in the "happy" case without using > > a staircase. > > > > At the top level try or catch is used to catch the error. > > > > Alternatively you could say > > > > ok({ok,X}) -> X; > > ok{error,E}) -> exit(E). > > > > and then > > > > w(ok(x(ok(y(ok(z(X)))))) > > > > Not pretty but it does the job > > > > /Joe > > > > > > On Tue, Jan 24, 2012 at 8:31 PM, Reynaldo Baquerizo > > wrote: > > > > > > A friend of mine asked: > > > > > > ## > > > If you have functions that return {ok, Result} | {error, Reason} > > > how do you chained them? So that you have: > > > > > > w(x(y(z(...)))) > > > > > > without building a staircasing. Something that would be done in Haskell > > > with monads. > > > ## > > > > > > I would probably go for: > > > > > > x({ok, Value}) -> > > > ?NewValue = , > > > ?{ok, NewValue}; > > > x({error, Reason}) -> > > > ?{error, Reason}. > > > > > > in each function > > > > > > which brings me other question, when do you tag return values? > > > > > > I tend to only use tagged return values with impure functions, were an > > > error is more likely due to side effects. > > > > > > -- > > > Reynaldo > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Tue Jan 31 14:31:41 2012 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 31 Jan 2012 14:31:41 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: On Tue, Jan 31, 2012 at 11:56 AM, Fredrik Svahn wrote: > Hi Joe, > > The Erlang list [1, 2, 3] is represented as js native objects {value: > 1, next: {value: 2, next: {value: 3, next:nil}}}. The size of a string > represented as a list is 40 bytes per character in Chromium on my > x86_64 machine (I do not know if the size would be smaller on a 32 bit > machine). How do you know that it is 40 bytes/character? - in fact how do you know the internal size of any JS object. if I say x = {abc:123, def:"xyz", ...} etc. how big is this object in memory - there must be some hidden pointers associated with x, but without reading the code for the JS emulator it would be difficult to say how large it is. > The corresponding number for beam is 16 bytes/char for > x86_64, I believe, so it is more wasteful as expected. I have > considered mapping it to js arrays but haven't done any measurements. > This is just a small script so I did not want to write my own GC, also > mapping to native objects is better if I later would like to make it > possible to compile performance critical beams to native javascript > code. If memory were a problem you'd need to write the GC and use the beam memory model .. /Joe > > The Erlang tuple {1,2,3} is represented as the js array [1, 2, 3]. > Binaries are mapped to js strings, and atoms to numbers. > > BR /Fredrik > > > On Tue, Jan 31, 2012 at 10:24 AM, Joe Armstrong wrote: >> Wow - ultra interesting. >> >> Just out of curiosity - how do you represent lists and tuples in JS? >> Are they represented >> as ?native JS objects or as objects on the beam stack and heap? And if >> they are native JS objects what is the storage overhead of a >> list-cell? >> >> /Joe >> >> >> On Mon, Jan 30, 2012 at 10:14 PM, Fredrik Svahn wrote: >>> There is also http://svahne.github.com/browserl, a small script which >>> I wrote just for fun. >>> >>> Short version: it is an Erlang emulator in javascript, which can load >>> and run an Erlang/OTP system from a tar file with ordinary beam files. >>> It can also load and execute individual beam files. It will run common >>> test and successfully complete some OTP test suites (the test suites >>> are not loaded in the example page, though). Files, binaries, ets and >>> floats are work in progress, at the moment they are only supported to >>> the extent needed to boot the system and run common test. >>> >>> BR /Fredrik >>> >>> >>> On Tue, Nov 29, 2011 at 12:47 AM, Raoul Duke wrote: >>>> wow. >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions From egil@REDACTED Tue Jan 31 14:46:36 2012 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Tue, 31 Jan 2012 14:46:36 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: <4F27F0BC.7070202@erlang.org> On 2012-01-31 11:56, Fredrik Svahn wrote: > The Erlang list [1, 2, 3] is represented as js native objects {value: > 1, next: {value: 2, next: {value: 3, next:nil}}}. The size of a string > represented as a list is 40 bytes per character in Chromium on my > x86_64 machine (I do not know if the size would be smaller on a 32 bit > machine). The corresponding number for beam is 16 bytes/char for > x86_64, I believe, so it is more wasteful as expected. I have > considered mapping it to js arrays but haven't done any measurements. > This is just a small script so I did not want to write my own GC, also > mapping to native objects is better if I later would like to make it > possible to compile performance critical beams to native javascript > code. Very cool project Fredrik. You obviously have too much time on your hands right now =) Btw, If memory is a problem, wouldn't it be better to represent lists as some sort of (Phil Bagwell) VLists? I guess you have already thought about it since you did measurements on it before for erlang. // Bj?rn-Egil From g@REDACTED Tue Jan 31 16:12:29 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 31 Jan 2012 09:12:29 -0600 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: On Tue, Jan 31, 2012 at 5:18 AM, Roberto Majadas Lopez wrote: > 2012/1/30 Dmitry Kolesnikov > > The problem is that i've n process representing an user session, and the > token is like a "ticket" to authorize to take some information from the > server. The real user gets the token and goes to an http server (inside the > erlang app) a create one of the (m)-process. This process needs to check if > the token is valid or not. If is valid, the user can get the data and the > token is removed. This sounds like a registered process (e.g. gen_server) that manages the token. It's user facing API might look like this: acquire_token() -> {ok, Token} | timeout acquire_token(Timeout) -> {ok, Token} | timeout release_token(Token) is_token_valid(Token) -> boolean() The user processes would acquire a token and pass it to an agent, which would then validate it before proceeding. The agent could release the token when it was done with it. This scheme could be used for rate limiting, simple authorization, etc. This problem seems independent of persistence, independent of crash recovery. If you needed to recover token state from a crash, the process would need to save off its state somewhere (I typically use a single dets table per process) and look for that state on init. Garrett From g@REDACTED Tue Jan 31 16:15:44 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 31 Jan 2012 09:15:44 -0600 Subject: [erlang-questions] smtp server In-Reply-To: References: Message-ID: On Sun, Jan 29, 2012 at 12:56 AM, Roberto Ostinelli wrote: > dear list, > > are you aware of any existent production-ready SMTP server in Erlang? I've > only found, maintained: https://github.com/Vagabond/gen_smtp I've used gen_smtp in the past and it worked okay (though it was very lightly used). Have you run into problems with it? Garrett From dmkolesnikov@REDACTED Tue Jan 31 16:31:35 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Tue, 31 Jan 2012 17:31:35 +0200 Subject: [erlang-questions] Writers Readers problem In-Reply-To: References: Message-ID: <3436873690158444368@unknownmsgid> Hello, With a registered process you have a single-server bottleneck, do not keep all eggs in one basket. What I mean is a process per token... In this respect, the process idles in memory unti it is consumed or ttl expired. You have to protect data against OOM or node failure. In this particular case for one-time token I would not see a strict requirements for durability and recovery due to cost and system complexity. But if you are strict about durability then DHT/Chord type of in-memory systems are required: mnesia, riak, etc. Best Regards, Dmitry >-|-|-*> On 31.1.2012, at 17.12, Garrett Smith wrote: > On Tue, Jan 31, 2012 at 5:18 AM, Roberto Majadas Lopez > wrote: >> 2012/1/30 Dmitry Kolesnikov >> >> The problem is that i've n process representing an user session, and the >> token is like a "ticket" to authorize to take some information from the >> server. The real user gets the token and goes to an http server (inside the >> erlang app) a create one of the (m)-process. This process needs to check if >> the token is valid or not. If is valid, the user can get the data and the >> token is removed. > > This sounds like a registered process (e.g. gen_server) that manages > the token. It's user facing API might look like this: > > acquire_token() -> {ok, Token} | timeout > acquire_token(Timeout) -> {ok, Token} | timeout > release_token(Token) > is_token_valid(Token) -> boolean() > > The user processes would acquire a token and pass it to an agent, > which would then validate it before proceeding. The agent could > release the token when it was done with it. > > This scheme could be used for rate limiting, simple authorization, etc. > > This problem seems independent of persistence, independent of crash > recovery. If you needed to recover token state from a crash, the > process would need to save off its state somewhere (I typically use a > single dets table per process) and look for that state on init. > > Garrett From g@REDACTED Tue Jan 31 16:44:34 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 31 Jan 2012 09:44:34 -0600 Subject: [erlang-questions] Looking for high performance transport In-Reply-To: References: Message-ID: On Sun, Jan 29, 2012 at 7:11 AM, Max Bourinov wrote: > Hello Erlangers, > > Could anybody suggest a good transport for my needs? > > My requirements: > ?- Should support up to 1 Gbit traffic per node (message size from 128 bites > to 4 KB) > ?- Should support a lot (> 65000) connection per node > ?- Should support authentification > ?- Should be possible to develop additional client libs. > > Ideal will be kind of a server + client lib. > > So far I have tried ejabberd and exmpp. ejabberd is great but it has big > overhead ~150 KB for connected user. exmpp is buggy and has very poor > performance on our data (I send JSON data and exmpp tries to wrap each " > into separate CDATA tag). > > Any ideas and links are welcome! 0MQ was designed for high performance and throughput. http://www.zeromq.org/ It doesn't support authentication, but I think in your case that's a good sign -- anything low enough level will leave that to the app tier. The Erlang bindings are very good and are maintained by people active on this list: https://github.com/zeromq/erlzmq2 From g@REDACTED Tue Jan 31 16:54:09 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 31 Jan 2012 09:54:09 -0600 Subject: [erlang-questions] Writers Readers problem In-Reply-To: <3436873690158444368@unknownmsgid> References: <3436873690158444368@unknownmsgid> Message-ID: The process I have in mind is a very simple dispatch service. I'd be surprised if that's a bottleneck. Maybe one token manager per core? ;) If the tokens were more than just, well, tokens -- i.e. implemented some behavior independent of one another -- I think one process per token would make sense. On Tue, Jan 31, 2012 at 9:31 AM, dmitry kolesnikov wrote: > Hello, > > With a registered process you have a single-server bottleneck, do not > keep all eggs in one basket. What I mean is a process per token... > > In this respect, the process idles in memory unti it is consumed or > ttl expired. You have to protect data against OOM or node failure. In > this particular case for one-time token I would not see a strict > requirements for durability and recovery due to cost and system > complexity. > > But if you are strict about durability then DHT/Chord type of > in-memory systems are required: mnesia, riak, etc. > > Best Regards, > Dmitry >-|-|-*> > > > On 31.1.2012, at 17.12, Garrett Smith wrote: > >> On Tue, Jan 31, 2012 at 5:18 AM, Roberto Majadas Lopez >> wrote: >>> 2012/1/30 Dmitry Kolesnikov >>> >>> The problem is that i've n process representing an user session, and the >>> token is like a "ticket" to authorize to take some information from the >>> server. The real user gets the token and goes to an http server (inside the >>> erlang app) a create one of the (m)-process. This process needs to check if >>> the token is valid or not. If is valid, the user can get the data and the >>> token is removed. >> >> This sounds like a registered process (e.g. gen_server) that manages >> the token. It's user facing API might look like this: >> >> acquire_token() -> {ok, Token} | timeout >> acquire_token(Timeout) -> {ok, Token} | timeout >> release_token(Token) >> is_token_valid(Token) -> boolean() >> >> The user processes would acquire a token and pass it to an agent, >> which would then validate it before proceeding. The agent could >> release the token when it was done with it. >> >> This scheme could be used for rate limiting, simple authorization, etc. >> >> This problem seems independent of persistence, independent of crash >> recovery. If you needed to recover token state from a crash, the >> process would need to save off its state somewhere (I typically use a >> single dets table per process) and look for that state on init. >> >> Garrett From roe.adrian@REDACTED Tue Jan 31 19:28:57 2012 From: roe.adrian@REDACTED (Adrian Roe) Date: Tue, 31 Jan 2012 18:28:57 +0000 Subject: [erlang-questions] Erlang and cloud computing In-Reply-To: References: Message-ID: We (id3as) have worked in cloud for a while and have used Erlang for all of our cloud management tasks for the last couple of years with great success - it's very well suited to the job. During that time we've worked with many of the major cloud providers on both Windows and Linux platforms and would be happy to share experiences. I suspect that's best done off list unless there is wide interest, but in a one sentence summary would steer you at Amazon if you have highly dynamic load requirements and Linux if you have the choice (the costs per hour are much lower for equivalent servers). Amazon (in our experience at least) have been streets ahead of the other vendors when the number of servers varies widely and rapidly - for example some of our solutions range from running on 3~4 servers at some points of the day rising up to ~1000 at times of peak load. If you don't need such a dynamic solution (i.e. your server load is far more constant) then there is less to choose between vendors. Kind regards Adrian *Dr Adrian Roe* *Director* *id3as* On 30 January 2012 15:40, Yves S. Garret wrote: > Hello, > > I have a curiosity question. Is Erlang being used somehow in the field > of cloud computing? The idea of splitting up a task and then processing it > in pieces in parallel seems right up Erlang's alley. > > I have looked at Windows Azure, but they mostly use .NET languages, are > there services where you can have a cloud computing environment and use > Erlang to do the application development? What has been your experience if > you have used Erlang in cloud computing? > > --Yves > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ciprian.craciun@REDACTED Tue Jan 31 19:54:45 2012 From: ciprian.craciun@REDACTED (Ciprian Dorin Craciun) Date: Tue, 31 Jan 2012 20:54:45 +0200 Subject: [erlang-questions] Erlang and cloud computing In-Reply-To: References: Message-ID: On Tue, Jan 31, 2012 at 20:28, Adrian Roe wrote: > [...] > and??would??be happy to share experiences. ?I suspect that's best done off > list unless there is wide interest, but?in a one sentence summary would > [...] > > Adrian I would also be interested about this topic, as such please keep it on this list. (Unless someone has something against.) Ciprian. From emeka_1978@REDACTED Tue Jan 31 20:15:36 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Tue, 31 Jan 2012 11:15:36 -0800 (PST) Subject: [erlang-questions] Erlang and cloud computing In-Reply-To: References: Message-ID: Please keep it in this list. That last time i did hear anything related to clould computing and erlang, it was in the context of couchdb. There were not really great news. On Jan 31, 7:28?pm, Adrian Roe wrote: > We (id3as) have worked in cloud for a while and have used Erlang for all of > our cloud management tasks for the last couple of years with great success > - it's very well suited to the job. ?During that time we've worked with > many of the major cloud providers on both Windows and Linux platforms > and ?would ?be happy to share experiences. ?I suspect that's best done off > list unless there is wide interest, but in a one sentence summary would > steer you at Amazon if you have highly dynamic load requirements and Linux > if you have the choice (the costs per hour are much lower for equivalent > servers). > > Amazon (in our experience at least) have been streets ahead of the other > vendors when the number of servers varies widely and rapidly - for example > some of our solutions range from running on 3~4 servers at some points of > the day rising up to ~1000 at times of peak load. ?If you don't need such a > dynamic solution (i.e. your server load is far more constant) then there is > less to choose between vendors. > > Kind regards > > Adrian > *Dr Adrian Roe* > *Director* > *id3as* > > On 30 January 2012 15:40, Yves S. Garret wrote: > > > > > > > > > Hello, > > > ? ?I have a curiosity question. ?Is Erlang being used somehow in the field > > of cloud computing? ?The idea of splitting up a task and then processing it > > in pieces in parallel seems right up Erlang's alley. > > > ? ?I have looked at Windows Azure, but they mostly use .NET languages, are > > there services where you can have a cloud computing environment and use > > Erlang to do the application development? ?What has been your experience if > > you have used Erlang in cloud computing? > > > --Yves > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From emeka_1978@REDACTED Tue Jan 31 20:17:04 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Tue, 31 Jan 2012 11:17:04 -0800 (PST) Subject: [erlang-questions] [erlide] poll: eclipse versions used In-Reply-To: References: Message-ID: We still use 3.6 on windows. But if 3.7 is stable, we will switch. On Jan 31, 11:25?am, Vlad Dumitrescu wrote: > Hi, > > Sorry for duplicate messages. > > Is there anyone that uses erlide still required to use Eclipse 3.6? > (No answer = "not me") > > If not, we will soon base our code on 3.7. > > best regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From mjtruog@REDACTED Tue Jan 31 21:36:38 2012 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 31 Jan 2012 12:36:38 -0800 Subject: [erlang-questions] Erlang and cloud computing In-Reply-To: References: Message-ID: <4F2850D6.9080602@gmail.com> On 01/30/2012 07:40 AM, Yves S. Garret wrote: > > I have a curiosity question. Is Erlang being used somehow in the field of cloud computing? The idea of splitting up a task and then processing it in pieces in parallel seems right up Erlang's alley. > > I have looked at Windows Azure, but they mostly use .NET languages, are there services where you can have a cloud computing environment and use Erlang to do the application development? What has been your experience if you have used Erlang in cloud computing? > There is a public/private cloud computing framework that I have been working on for a few years called CloudI (http://cloudi.org). CloudI helps take advantage of Erlang's actor model, extending it into C/C++, Java, Python, and Ruby, to provide fault tolerance and scalability. Erlang is very applicable to cloud computing, since it provides real fault-tolerance... while there are attempts to provide fault-tolerance within JVM languages, it is limited by their single heap garbage collection strategy (which also helps to limit scalability). So, it is very beneficial to have solid supervision tree functionality to manage fault-tolerance within the Erlang language. Other cloud computing source code and services are unable to provide granular fault-tolerance... they focus on large system redundancy, like with the AWS zones or avoid an AWS zone outage. With CloudI, it is much simpler to test without a public deployment, so you can make architectural decisions without getting locked into a particular cloud computing service and that allows you to focus on lower-level fault-tolerance/scalability concerns. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Tue Jan 31 22:40:19 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 31 Jan 2012 13:40:19 -0800 Subject: [erlang-questions] smtp server In-Reply-To: References: Message-ID: Hi Garrett, no I haven't, I was just surprised to see so little in this direction. Well, thank you Andrew for your work ^^_ r. On Tue, Jan 31, 2012 at 7:15 AM, Garrett Smith wrote: > > I've used gen_smtp in the past and it worked okay (though it was very > lightly used). Have you run into problems with it? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Tue Jan 31 22:45:02 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 31 Jan 2012 13:45:02 -0800 Subject: [erlang-questions] XML diff Message-ID: Dear list, I was wandering if there is some available work done in generating XML files diff, obviously in Erlang but this is a broader question. so, for instance, given these two files: 1 2 and 1 3 I'd like to be able to generate some kind of diff file stating that entry with value 2 got removed and entry with value 3 added. I do realize this is a generic questions but I'd like to hear any thoughts that you might have. Thank you, r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik.svahn@REDACTED Tue Jan 31 22:53:46 2012 From: fredrik.svahn@REDACTED (Fredrik Svahn) Date: Tue, 31 Jan 2012 22:53:46 +0100 Subject: [erlang-questions] Erlang in the browser In-Reply-To: References: <20111127214135.GA9190@smp.if.uj.edu.pl> <2995082.337.1322439152252.JavaMail.geo-discussion-forums@prnu24> <20111128153213.GG9190@smp.if.uj.edu.pl> Message-ID: > How do you know that it is 40 bytes/character? - in fact how do you know the > internal size of any JS object. if I say x = {abc:123, def:"xyz", ...} > etc. how big is this > object in memory - there must be some hidden pointers associated with > x, but without reading > the code for the JS emulator it would be difficult to say how large it is. 40 bytes is what the Chromium heap profiler claims that the shallow size of the list is. The retained size for my example string represented as a 144 character list is 5.63 KB which is more or less exactly 144 chars * 40 bytes. A little bit of testing shows that in Chromium the size of an object seems to be 24 bytes + 8 bytes/property which matches the 40 bytes I saw. However I missed to take into account that the value of the property needs to be stored as well. If the value of the property is e.g. a javascript string the property value and its' memory consumption is also shown in the profiler*, but in case it is a number the size of the property is not shown. The size of a number seems to be 16 bytes according to separate measurements. The retained size of 144 chars represented as a JS array is 1.17 KB. IIRC from a blog post I read about Firefox memory optimizations, the figures above should be in the same ball park for FF. > If memory were a problem you'd need to write the GC and use the beam > memory model .. An empty window in Chromium has a heap size of 5.8 Mb. With the emu loaded it consumes 11.5 Mb which isn't bad considering 66 modules are loaded and started in the example. If optimizing for memory is interesting (might be for running on mobiles) I would go with optimizing the code storage array into a typed array first. Unfortunately this isn't supported yet on a number of browsers (including the Android one), which is why I only use them in the loader. Optimizing the loading time on mobile browsers would also come higher on my list of possible optimizations. First make it work at all, then optimize, right? ;-) BR /Fredrik * Strings are probably a very bad example since they might be stored outside the heap in Chromium... From emeka_1978@REDACTED Tue Jan 31 23:16:40 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Tue, 31 Jan 2012 14:16:40 -0800 (PST) Subject: [erlang-questions] Erlang and cloud computing In-Reply-To: <4F2850D6.9080602@gmail.com> References: <4F2850D6.9080602@gmail.com> Message-ID: <26e8f451-450b-4820-ac08-f306ea649662@j15g2000yqb.googlegroups.com> I have always been intrigued by cloudi but never had the time to take it for a ride. Lets say that i am building a website in erlang and decide to use java for (jdbc)database access or to use some NLP librairies. In what way can cloudi be beneficial over, say, plain old jinterface? On Jan 31, 9:36?pm, Michael Truog wrote: > On 01/30/2012 07:40 AM, Yves S. Garret wrote: > > > > > ? ?I have a curiosity question. ?Is Erlang being used somehow in the field of cloud computing? ?The idea of splitting up a task and then processing it in pieces in parallel seems right up Erlang's alley. > > > ? ?I have looked at Windows Azure, but they mostly use .NET languages, are there services where you can have a cloud computing environment and use Erlang to do the application development? ?What has been your experience if you have used Erlang in cloud computing? > > There is a public/private cloud computing framework that I have been working on for a few years called CloudI (http://cloudi.org). ?CloudI helps take advantage of Erlang's actor model, extending it into C/C++, Java, Python, and Ruby, to provide fault tolerance and scalability. ?Erlang is very applicable to cloud computing, since it provides real fault-tolerance... while there are attempts to provide fault-tolerance within JVM languages, it is limited by their single heap garbage collection strategy (which also helps to limit scalability). ?So, it is very beneficial to have solid supervision tree functionality to manage fault-tolerance within the Erlang language. ?Other cloud computing source code and services are unable to provide granular fault-tolerance... they focus on large system redundancy, like with the AWS zones or avoid an AWS zone outage. ?With CloudI, it is much simpler to test without a public deployment, so you can make architectural decisions without getting > locked into a particular cloud computing service and that allows you to focus on lower-level fault-tolerance/scalability concerns. > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions