From vances@REDACTED Fri Mar 1 07:09:15 2013 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Mar 2013 11:39:15 +0530 Subject: [erlang-questions] Early Out of Memory Message-ID: <20130301060915.GB22587@aluminium.local> In the pathological example below why is eheap_alloc failing to allocate 1.4GB of memory on a system with many more gigabytes of memory available? Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.1 (abort with ^G) 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. #Fun 2> F(F, []). beam.smp(73592,0xb039d000) malloc: *** mmap(size=549453824) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(73592,0xb039d000) malloc: *** mmap(size=1139802112) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type "heap"). Abort trap: 6 -- -Vance From pan@REDACTED Fri Mar 1 10:33:35 2013 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 1 Mar 2013 10:33:35 +0100 Subject: [erlang-questions] Early Out of Memory In-Reply-To: <20130301060915.GB22587@aluminium.local> References: <20130301060915.GB22587@aluminium.local> Message-ID: <513075EF.80902@erlang.org> Hi! On 03/01/2013 07:09 AM, Vance Shipley wrote: > In the pathological example below why is eheap_alloc failing to > allocate 1.4GB of memory on a system with many more gigabytes of > memory available? Looks like you're running a 32 bit VM, in which case you have at a absolute maximum 4GB of memory. A heap allocation of 1.3 GB means an old version of the heap of possibly the same size (copying GC) + old heap generations and so on. A heap also needs to have continuous virtual memory, so the chance of having a single process with this much heap running on a 32bit VM is slim at best. If you have a lot of physical memory in the machine, run a 64bit OS and a 64bit Erlang VM. > > Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V5.10.1 (abort with ^G) > 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. > #Fun > 2> F(F, []). > beam.smp(73592,0xb039d000) malloc: *** mmap(size=549453824) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > beam.smp(73592,0xb039d000) malloc: *** mmap(size=1139802112) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12) > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type "heap"). > Abort trap: 6 > Cheers, /Patrik From vances@REDACTED Fri Mar 1 14:03:31 2013 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Mar 2013 18:33:31 +0530 Subject: [erlang-questions] Early Out of Memory In-Reply-To: <513075EF.80902@erlang.org> References: <20130301060915.GB22587@aluminium.local> <513075EF.80902@erlang.org> Message-ID: <20130301130331.GE14454@aluminium.local> On Fri, Mar 01, 2013 at 10:33:35AM +0100, Patrik Nyblom wrote: } Looks like you're running a 32 bit VM, in which case you have at a } absolute maximum 4GB of memory. A heap allocation of 1.3 GB means } an old version of the heap of possibly the same size (copying GC) + } old heap generations and so on. A heap also needs to have } continuous virtual memory, so the chance of having a single process } with this much heap running on a 32bit VM is slim at best. If you } have a lot of physical memory in the machine, run a 64bit OS and a } 64bit Erlang VM. Patrik, Fair enough, I didn't realize that I had forgotten to build R16B as 64 bit on my MacBook Pro. When I did the test happily used up all 16GB of physical memory and 10GB of swap before I killed it. But can you explain this one?: Erlang R16B (erts-5.10.1) [source] [64-bit halfword] [smp:8:8] [async-threads:10] [kernel-poll:false] Eshell V5.10.1 (abort with ^G) 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. #Fun 2> F(F, []). Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 790960704 bytes of memory (of type "old_heap"). Aborted (core dumped) Above I am running an R16B 64-bit halfword emulator on a server with 6GB of physical memory. What are the system limits with the halfword emulator? I assume that I can't have a binary over 4GB. Can I have an ets table bigger than 4GB? -- -Vance On 03/01/2013 07:09 AM, Vance Shipley wrote: } In the pathological example below why is eheap_alloc failing to } allocate 1.4GB of memory on a system with many more gigabytes of } memory available? } } Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] } } Eshell V5.10.1 (abort with ^G) } 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. } #Fun } 2> F(F, []). } } Crash dump was written to: erl_crash.dump } eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type "heap"). } Abort trap: 6 From z@REDACTED Fri Mar 1 14:16:22 2013 From: z@REDACTED (Danil Zagoskin) Date: Fri, 1 Mar 2013 17:16:22 +0400 Subject: [erlang-questions] Early Out of Memory In-Reply-To: <20130301130331.GE14454@aluminium.local> References: <20130301060915.GB22587@aluminium.local> <513075EF.80902@erlang.org> <20130301130331.GE14454@aluminium.local> Message-ID: Vance, and what do you expect? Function consumes memory, VM allocates more memory. On each iteration function consumes small amount of memory, but this does not mean VM requests memory from OS on each iteration. VM has some pre-allocated memory, and when almost all of it is used, VM allocates next large block. So, when there is already allocated 15.5 GB of available 16 and VM wants to allocate 800MB more, the call fails, saying "cannot allocate 800M". That's what you see in console, but it does not say how much is already used. 2013/3/1 Vance Shipley > On Fri, Mar 01, 2013 at 10:33:35AM +0100, Patrik Nyblom wrote: > } Looks like you're running a 32 bit VM, in which case you have at a > } absolute maximum 4GB of memory. A heap allocation of 1.3 GB means > } an old version of the heap of possibly the same size (copying GC) + > } old heap generations and so on. A heap also needs to have > } continuous virtual memory, so the chance of having a single process > } with this much heap running on a 32bit VM is slim at best. If you > } have a lot of physical memory in the machine, run a 64bit OS and a > } 64bit Erlang VM. > > Patrik, > > Fair enough, I didn't realize that I had forgotten to build R16B as > 64 bit on my MacBook Pro. When I did the test happily used up all > 16GB of physical memory and 10GB of swap before I killed it. > > But can you explain this one?: > > Erlang R16B (erts-5.10.1) [source] [64-bit halfword] [smp:8:8] > [async-threads:10] [kernel-poll:false] > > Eshell V5.10.1 (abort with ^G) > 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. > #Fun > 2> F(F, []). > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 790960704 bytes of memory (of type > "old_heap"). > Aborted (core dumped) > > Above I am running an R16B 64-bit halfword emulator on a server with 6GB > of physical memory. > > What are the system limits with the halfword emulator? I assume that I > can't have a binary over 4GB. Can I have an ets table bigger than 4GB? > > -- > -Vance > > > On 03/01/2013 07:09 AM, Vance Shipley wrote: > } In the pathological example below why is eheap_alloc failing to > } allocate 1.4GB of memory on a system with many more gigabytes of > } memory available? > } > } Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] > [kernel-poll:false] > } > } Eshell V5.10.1 (abort with ^G) > } 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. > } #Fun > } 2> F(F, []). > } > } Crash dump was written to: erl_crash.dump > } eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type > "heap"). > } Abort trap: 6 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- --------------------------------------------- ????? ???????? | +7 906 064 20 47 | z@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Fri Mar 1 14:19:48 2013 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Mar 2013 18:49:48 +0530 Subject: [erlang-questions] Early Out of Memory In-Reply-To: References: <20130301060915.GB22587@aluminium.local> <513075EF.80902@erlang.org> <20130301130331.GE14454@aluminium.local> Message-ID: Yes, sorry, I forgot to say that there is 5GB of free memory during this time as reported by vmstat. On Mar 1, 2013 6:46 PM, "Danil Zagoskin" wrote: > Vance, and what do you expect? > > Function consumes memory, VM allocates more memory. > On each iteration function consumes small amount of memory, but this does > not mean VM requests memory from OS on each iteration. > VM has some pre-allocated memory, and when almost all of it is used, VM > allocates next large block. > > So, when there is already allocated 15.5 GB of available 16 and VM wants > to allocate 800MB more, the call fails, saying "cannot allocate 800M". > That's what you see in console, but it does not say how much is already > used. > > > 2013/3/1 Vance Shipley > >> On Fri, Mar 01, 2013 at 10:33:35AM +0100, Patrik Nyblom wrote: >> } Looks like you're running a 32 bit VM, in which case you have at a >> } absolute maximum 4GB of memory. A heap allocation of 1.3 GB means >> } an old version of the heap of possibly the same size (copying GC) + >> } old heap generations and so on. A heap also needs to have >> } continuous virtual memory, so the chance of having a single process >> } with this much heap running on a 32bit VM is slim at best. If you >> } have a lot of physical memory in the machine, run a 64bit OS and a >> } 64bit Erlang VM. >> >> Patrik, >> >> Fair enough, I didn't realize that I had forgotten to build R16B as >> 64 bit on my MacBook Pro. When I did the test happily used up all >> 16GB of physical memory and 10GB of swap before I killed it. >> >> But can you explain this one?: >> >> Erlang R16B (erts-5.10.1) [source] [64-bit halfword] [smp:8:8] >> [async-threads:10] [kernel-poll:false] >> >> Eshell V5.10.1 (abort with ^G) >> 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. >> #Fun >> 2> F(F, []). >> >> Crash dump was written to: erl_crash.dump >> eheap_alloc: Cannot allocate 790960704 bytes of memory (of type >> "old_heap"). >> Aborted (core dumped) >> >> Above I am running an R16B 64-bit halfword emulator on a server with 6GB >> of physical memory. >> >> What are the system limits with the halfword emulator? I assume that I >> can't have a binary over 4GB. Can I have an ets table bigger than 4GB? >> >> -- >> -Vance >> >> >> On 03/01/2013 07:09 AM, Vance Shipley wrote: >> } In the pathological example below why is eheap_alloc failing to >> } allocate 1.4GB of memory on a system with many more gigabytes of >> } memory available? >> } >> } Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] >> [kernel-poll:false] >> } >> } Eshell V5.10.1 (abort with ^G) >> } 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. >> } #Fun >> } 2> F(F, []). >> } >> } Crash dump was written to: erl_crash.dump >> } eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type >> "heap"). >> } Abort trap: 6 >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > --------------------------------------------- > ????? ???????? | +7 906 064 20 47 | z@REDACTED > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Fri Mar 1 15:41:38 2013 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 1 Mar 2013 15:41:38 +0100 Subject: [erlang-questions] Early Out of Memory In-Reply-To: <20130301130331.GE14454@aluminium.local> References: <20130301060915.GB22587@aluminium.local> <513075EF.80902@erlang.org> <20130301130331.GE14454@aluminium.local> Message-ID: <5130BE22.3010908@erlang.org> Hi! Halfword is limited to 4GB of *total* heap space. In the same way as for 32bit VM, memory runs out for heaps. ETS tables can be as large as the virtual memory, the terms there are stored in mysterious ways :) /Patrik On 03/01/2013 02:03 PM, Vance Shipley wrote: > On Fri, Mar 01, 2013 at 10:33:35AM +0100, Patrik Nyblom wrote: > } Looks like you're running a 32 bit VM, in which case you have at a > } absolute maximum 4GB of memory. A heap allocation of 1.3 GB means > } an old version of the heap of possibly the same size (copying GC) + > } old heap generations and so on. A heap also needs to have > } continuous virtual memory, so the chance of having a single process > } with this much heap running on a 32bit VM is slim at best. If you > } have a lot of physical memory in the machine, run a 64bit OS and a > } 64bit Erlang VM. > > Patrik, > > Fair enough, I didn't realize that I had forgotten to build R16B as > 64 bit on my MacBook Pro. When I did the test happily used up all > 16GB of physical memory and 10GB of swap before I killed it. > > But can you explain this one?: > > Erlang R16B (erts-5.10.1) [source] [64-bit halfword] [smp:8:8] [async-threads:10] [kernel-poll:false] > > Eshell V5.10.1 (abort with ^G) > 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end. > #Fun > 2> F(F, []). > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 790960704 bytes of memory (of type "old_heap"). > Aborted (core dumped) > > Above I am running an R16B 64-bit halfword emulator on a server with 6GB > of physical memory. > > What are the system limits with the halfword emulator? I assume that I > can't have a binary over 4GB. Can I have an ets table bigger than 4GB? > From jose.valim@REDACTED Fri Mar 1 19:00:36 2013 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Fri, 1 Mar 2013 11:00:36 -0700 Subject: [erlang-questions] BEAM Community Announcement Message-ID: Hello everyone, As you may know the Google Summer of Code (GSoC) is an annual program that allows students to work on an Open Source Project of their choice during the summer and it will run once again on the year of 2013: http://www.google-melange.com/gsoc/homepage/google/gsoc2013 For this year, we have decided to create an organization called the BEAM Community that will host different projects that run on the Erlang VM (examples: ejabberd, disco, elixir, zotonic, etc). Over the years, GSoC has given a higher preference to organizations, as mentioned here : > Google's program administrators actually look quite fondly on the umbrella organizations that participate each year. It serves a dual purpose: it allows Google to accept more organizations in the "space" of just one, and also gives an opportunity to accept a marginally-topical org by putting it under the umbrella of a related org. That said, this is the official announcement of the BEAM Community! We have invited and been in touch with some projects in order to organize a good first batch, some of them are already listed on our wiki. We invite those interested to visit the wiki and join the mailing list if you have any questions: https://github.com/beamcommunity/beamcommunity.github.com/wiki https://groups.google.com/forum/#!forum/beam-community If you are... * maintainer of an open source project, have some ideas for students to work, and a mentor to guide them during the summer (for 3 months): make a draft of those proposals and send them to the mailing list, so we can give you access to the wiki; * interested in one of the projects already listed: contact the project maintainers to get more information on how you can help (for example, be a mentor). It is estimated that being a mentor takes 10 hours a week on average; * interested in a project that is not the on the list: contact the project maintainers and help them to follow the route outlines in the first option; Keep in mind that this does not mean we are accepted into the Google Summer of Code as an organization. In fact, there is a long way to go and this is only the first step: to gather a good set of projects and proposals. We will have an answer about acceptance at the beginning of April and then start to get students interested in our projects. :) Let's rock this summer, * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmr@REDACTED Fri Mar 1 19:09:11 2013 From: tmr@REDACTED (Tomas Morstein) Date: Fri, 1 Mar 2013 10:09:11 -0800 (PST) Subject: [erlang-questions] diff/OT library in erlang In-Reply-To: References: Message-ID: <9c115faf-97e3-4432-8b6a-3e73fddcfc33@googlegroups.com> https://github.com/tomas-abrahamsson/tdiff/blob/master/src/tdiff.erl https://github.com/mojombo/yaws/blob/master/applications/wiki/src/wiki_diff.erl ...have you tried them before? We've used tdiff in past, but wiki_diff seems to do the job too. Tom Dne ?tvrtek, 28. ?nora 2013 15:22:33 UTC+1 Benoit Chesneau napsal(a): > > Hi all, > > I would like to add some kind of OT [1] to an application here and I > wonder if someone has already worked on such library in Erlang? Or > even a difflib library like the difflib in Python [2] or an > implementation of the Diff Match and Patch algorithm here [3] ? > > - beno?t > > [1] http://en.wikipedia.org/wiki/Operational_transformation > [2] > http://docs.python.org/3/library/difflib.html?highlight=difflib#difflib > [3 https://code.google.com/p/google-diff-match-patch/ > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Fri Mar 1 19:22:05 2013 From: freeakk@REDACTED (Michael Uvarov) Date: Fri, 1 Mar 2013 21:22:05 +0300 Subject: [erlang-questions] BEAM Community Announcement In-Reply-To: References: Message-ID: It is a great idea. Here is my erlang project from GSOC2012 as an example, what can be done during this program. https://github.com/arcusfelis/xapian-erlang-bindings From gleber.p@REDACTED Fri Mar 1 23:27:47 2013 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 1 Mar 2013 23:27:47 +0100 Subject: [erlang-questions] diff/OT library in erlang In-Reply-To: <9c115faf-97e3-4432-8b6a-3e73fddcfc33@googlegroups.com> References: <9c115faf-97e3-4432-8b6a-3e73fddcfc33@googlegroups.com> Message-ID: I used tdiff in the past too and it worked great for my use case. On 1 Mar 2013 19:09, "Tomas Morstein" wrote: > https://github.com/tomas-abrahamsson/tdiff/blob/master/src/tdiff.erl > > https://github.com/mojombo/yaws/blob/master/applications/wiki/src/wiki_diff.erl > > ...have you tried them before? We've used tdiff in past, but wiki_diff > seems > to do the job too. > > Tom > > > Dne ?tvrtek, 28. ?nora 2013 15:22:33 UTC+1 Benoit Chesneau napsal(a): >> >> Hi all, >> >> I would like to add some kind of OT [1] to an application here and I >> wonder if someone has already worked on such library in Erlang? Or >> even a difflib library like the difflib in Python [2] or an >> implementation of the Diff Match and Patch algorithm here [3] ? >> >> - beno?t >> >> [1] http://en.wikipedia.org/wiki/**Operational_transformation >> [2] http://docs.python.org/3/**library/difflib.html?** >> highlight=difflib#difflib >> [3 https://code.google.com/p/**google-diff-match-patch/ >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-q...@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 max.lapshin@REDACTED Sat Mar 2 12:58:55 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 2 Mar 2013 15:58:55 +0400 Subject: [erlang-questions] R16B os x compile issues Message-ID: ./configure --prefix=/usr/local/Cellar/erlang/R16B --without-javac --enable-smp-support --enable-halfword-emulator --enable-threads --enable-darwin-64bit --enable-m64-build --enable-wx gcc -mdynamic-no-pic -Werror=return-type -m64 -m64 -g -O3 -fomit-frame-pointer -I/Users/max/Sites/otp_src_R16B/erts/x86_64-apple-darwin11.4.2 -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -Ix86_64-apple-darwin11.4.2/opt/smp -Ibeam -Isys/unix -Isys/common -Ix86_64-apple-darwin11.4.2 -Izlib -Ipcre -Ihipe -I../include -I../include/x86_64-apple-darwin11.4.2 -I../include/internal -I../include/internal/x86_64-apple-darwin11.4.2 -c sys/common/erl_mseg.c -o obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o sys/common/erl_mseg.c: In function ?mseg_realloc?: sys/common/erl_mseg.c:1031: warning: passing argument 5 of ?mseg_dealloc? makes integer from pointer without a cast sys/common/erl_mseg.c:1031: error: too few arguments to function ?mseg_dealloc? make[3]: *** [obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o] Error 1 make[2]: *** [opt] Error 2 What should I do to collect more information or fix it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Sat Mar 2 14:21:36 2013 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Sat, 2 Mar 2013 14:21:36 +0100 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: 2013/3/2 Max Lapshin > ./configure --prefix=/usr/local/Cellar/erlang/R16B --without-javac > --enable-smp-support --enable-halfword-emulator --enable-threads > --enable-darwin-64bit --enable-m64-build --enable-wx > > gcc -mdynamic-no-pic -Werror=return-type -m64 -m64 -g -O3 > -fomit-frame-pointer > -I/Users/max/Sites/otp_src_R16B/erts/x86_64-apple-darwin11.4.2 > -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes > -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS > -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS > -Ix86_64-apple-darwin11.4.2/opt/smp -Ibeam -Isys/unix -Isys/common > -Ix86_64-apple-darwin11.4.2 -Izlib -Ipcre -Ihipe -I../include > -I../include/x86_64-apple-darwin11.4.2 -I../include/internal > -I../include/internal/x86_64-apple-darwin11.4.2 -c sys/common/erl_mseg.c -o > obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o > sys/common/erl_mseg.c: In function ?mseg_realloc?: > sys/common/erl_mseg.c:1031: warning: passing argument 5 of ?mseg_dealloc? > makes integer from pointer without a cast > sys/common/erl_mseg.c:1031: error: too few arguments to function > ?mseg_dealloc? > make[3]: *** [obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o] Error 1 > make[2]: *** [opt] Error 2 > > Wow - That's embarrassing. It is missing the 'flags' option as fifth argument, an easy fix. However, In your case, Mac OSX will not run halfword at all since brk/sbrk implementation on darwin is not actually functioning. // Bj?rn-Egil > > What should I do to collect more information or fix it? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Sat Mar 2 14:58:17 2013 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Sat, 2 Mar 2013 14:58:17 +0100 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: 2013/3/2 Bj?rn-Egil Dahlberg > > > 2013/3/2 Max Lapshin > >> ./configure --prefix=/usr/local/Cellar/erlang/R16B --without-javac >> --enable-smp-support --enable-halfword-emulator --enable-threads >> --enable-darwin-64bit --enable-m64-build --enable-wx >> >> gcc -mdynamic-no-pic -Werror=return-type -m64 -m64 -g -O3 >> -fomit-frame-pointer >> -I/Users/max/Sites/otp_src_R16B/erts/x86_64-apple-darwin11.4.2 >> -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes >> -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS >> -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS >> -Ix86_64-apple-darwin11.4.2/opt/smp -Ibeam -Isys/unix -Isys/common >> -Ix86_64-apple-darwin11.4.2 -Izlib -Ipcre -Ihipe -I../include >> -I../include/x86_64-apple-darwin11.4.2 -I../include/internal >> -I../include/internal/x86_64-apple-darwin11.4.2 -c sys/common/erl_mseg.c -o >> obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o >> sys/common/erl_mseg.c: In function ?mseg_realloc?: >> sys/common/erl_mseg.c:1031: warning: passing argument 5 of ?mseg_dealloc? >> makes integer from pointer without a cast >> sys/common/erl_mseg.c:1031: error: too few arguments to function >> ?mseg_dealloc? >> make[3]: *** [obj/x86_64-apple-darwin11.4.2/opt/smp/erl_mseg.o] Error 1 >> make[2]: *** [opt] Error 2 >> >> > Wow - That's embarrassing. It is missing the 'flags' option as fifth > argument, an easy fix. > > However, In your case, Mac OSX will not run halfword at all since brk/sbrk > implementation on darwin is not actually functioning. > I know it says that you can run halfword on OSX in the comments of erl_mseg but that cake is also a complete lie. > > // Bj?rn-Egil > > > > >> >> What should I do to collect more information or fix it? >> >> _______________________________________________ >> 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 Sat Mar 2 15:42:55 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 2 Mar 2013 18:42:55 +0400 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: Indeed, I've removed --enable-halfword-emulator and it works now. Yes, I know that Mac OS X looks like a unix, but smells like something else =) -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Mar 2 15:44:20 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 2 Mar 2013 18:44:20 +0400 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: Ok, next problem: ./configure --prefix=/usr/local/Cellar/erlang/R16B --without-javac --enable-smp-support --enable-threads --enable-darwin-64bit --enable-m64-build --enable-wx otp_src_R16B max$ maketest X"$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && ERL_TOP=/Users/max/Sites/otp_src_R16B make generate) make -f x86_64-apple-darwin11.4.2/Makefile generate if utils/gen_git_version x86_64-apple-darwin11.4.2/gen_git_version.mk; then touch beam/erl_bif_info.c; fi m4 -DTARGET=x86_64-apple-darwin11.4.2 -DOPSYS=darwin -DARCH=amd64 hipe/hipe_x86_asm.m4 > x86_64-apple-darwin11.4.2/opt/plain/hipe_x86_asm.h m4 -DTARGET=x86_64-apple-darwin11.4.2 -DOPSYS=darwin -DARCH=amd64 hipe/hipe_amd64_asm.m4 > x86_64-apple-darwin11.4.2/opt/plain/hipe_amd64_asm.h m4 -DTARGET=x86_64-apple-darwin11.4.2 -DOPSYS=darwin -DARCH=amd64 hipe/hipe_sparc_asm.m4 > x86_64-apple-darwin11.4.2/opt/plain/hipe_sparc_asm.h m4 -DTARGET=x86_64-apple-darwin11.4.2 -DOPSYS=darwin -DARCH=amd64 hipe/hipe_ppc_asm.m4 > x86_64-apple-darwin11.4.2/opt/plain/hipe_ppc_asm.h m4 -DTARGET=x86_64-apple-darwin11.4.2 -DOPSYS=darwin -DARCH=amd64 hipe/hipe_arm_asm.m4 > x86_64-apple-darwin11.4.2/opt/plain/hipe_arm_asm.h gcc -mdynamic-no-pic -Werror=return-type -m64 -m64 -g -O3 -I/Users/max/Sites/otp_src_R16B/erts/x86_64-apple-darwin11.4.2 -D_XOPEN_SOURCE -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -Ix86_64-apple-darwin11.4.2/opt/plain -Ibeam -Isys/unix -Isys/common -Ix86_64-apple-darwin11.4.2 -Izlib -Ipcre -Ihipe -I../include -I../include/x86_64-apple-darwin11.4.2 -I../include/internal -I../include/internal/x86_64-apple-darwin11.4.2 -c hipe/hipe_mkliterals.c -o obj/x86_64-apple-darwin11.4.2/opt/plain/hipe_mkliterals.o In file included from beam/erl_process.h:63, from beam/beam_load.h:24, from beam/export.h:80, from beam/global.h:32, from hipe/hipe_mkliterals.c:31: hipe/hipe_process.h: In function ?hipe_delete_process?: hipe/hipe_process.h:72: error: ?ERTS_ALC_T_HIPE? undeclared (first use in this function) hipe/hipe_process.h:72: error: (Each undeclared identifier is reported only once hipe/hipe_process.h:72: error: for each function it appears in.) make[2]: *** [obj/x86_64-apple-darwin11.4.2/opt/plain/hipe_mkliterals.o] Error 1 make[1]: *** [generate] Error 2 make: *** [depend] Error 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Mar 2 15:48:17 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 2 Mar 2013 18:48:17 +0400 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: I've changed to ./configure --prefix=/usr/local/Cellar/erlang/R16B --without-javac --enable-smp-support --enable-threads --enable-darwin-64bit --enable-m64-build --enable-wx --disable-hipe and it is compiling right now -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Mar 2 15:49:27 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 2 Mar 2013 18:49:27 +0400 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: And we end up with: gcc -m64 -m64 -o /Users/max/Sites/otp_src_R16B/bin/x86_64-apple-darwin11.4.2/epmd /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd.o /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd_cli.o /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd_srv.o -lutil -ldl -lm -L../../lib/internal/x86_64-apple-darwin11.4.2 -lerts_internal -lm make -f x86_64-apple-darwin11.4.2/Makefile TYPE=opt make[3]: Nothing to be done for `all'. cd lib && \ ERL_TOP=/Users/max/Sites/otp_src_R16B PATH=/Users/max/Sites/otp_src_R16B/bootstrap/bin:"${PATH}" \ make opt SECONDARY_BOOTSTRAP=true Makefile:71: warning: overriding commands for target `clean' /Users/max/Sites/otp_src_R16B/make/otp_subdir.mk:28: warning: ignoring old commands for target `clean' === Entering application hipe erlc -W +debug_info +warn_exported_vars +warn_missing_spec +warn_untyped_record -o../ebin hipe_consttab.erl Missing alloc function for sbmbc_low_alloc make[3]: *** [../ebin/hipe_consttab.beam] Abort trap: 6 make[2]: *** [opt] Error 2 make[1]: *** [opt] Error 2 make: *** [secondary_bootstrap_build] Error 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Sat Mar 2 16:07:29 2013 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Sat, 2 Mar 2013 16:07:29 +0100 Subject: [erlang-questions] R16B os x compile issues In-Reply-To: References: Message-ID: I think the make dependencies are a bit troublesome. They don't handle a configure change all that well. Try building in a clean environment without halfword and it should work fine. I just tried git clone ... && cd otp && ./otp_build autoconf && ./configure --without-javac --enable-smp-support --enable-threads --enable-darwin-64bit enable-m64-build --enable-wx && make on my imac just to be sure and that works fine. // Bj?rn-Egil 2013/3/2 Max Lapshin > And we end up with: > > > gcc -m64 -m64 -o > /Users/max/Sites/otp_src_R16B/bin/x86_64-apple-darwin11.4.2/epmd > /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd.o > /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd_cli.o > /Users/max/Sites/otp_src_R16B/erts/obj/x86_64-apple-darwin11.4.2/epmd_srv.o > -lutil -ldl -lm -L../../lib/internal/x86_64-apple-darwin11.4.2 > -lerts_internal -lm > make -f x86_64-apple-darwin11.4.2/Makefile TYPE=opt > make[3]: Nothing to be done for `all'. > cd lib && \ > ERL_TOP=/Users/max/Sites/otp_src_R16B > PATH=/Users/max/Sites/otp_src_R16B/bootstrap/bin:"${PATH}" \ > make opt SECONDARY_BOOTSTRAP=true > Makefile:71: warning: overriding commands for target `clean' > /Users/max/Sites/otp_src_R16B/make/otp_subdir.mk:28: warning: ignoring > old commands for target `clean' > === Entering application hipe > erlc -W +debug_info +warn_exported_vars +warn_missing_spec > +warn_untyped_record -o../ebin hipe_consttab.erl > Missing alloc function for sbmbc_low_alloc > make[3]: *** [../ebin/hipe_consttab.beam] Abort trap: 6 > make[2]: *** [opt] Error 2 > make[1]: *** [opt] Error 2 > make: *** [secondary_bootstrap_build] Error 2 > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Sat Mar 2 21:04:55 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Sat, 2 Mar 2013 15:04:55 -0500 Subject: [erlang-questions] Erlang's Performance Message-ID: <000501ce1781$6c3696e0$44a3c4a0$@frcuba.co.cu> Hi all, I was taking a view of the new stuffs since I had left Erlang, and I found the observer application, I have to say that?s a very nice tool. But unfortunately I had a problem with that, the Load Charts tab has a very high load, it suppose to show the load of other processes and the whole system, but instead of that it take all the load for it self painting the graphics, in my case I have an old pc, 512 GB of RAM and just one CPU Intel Celeron 2.7 GHz, Intel D915GL Board, Socket 775. In some messages from you that I just saw, you speak about running Erlang in very good machines, like 8 GB of RAM and stuffs like that, four CPU cores and so on. I was old programming in Erlang, I mean with a very set of old machines, and I was always happy with Erlang because of the performance it had and has. I had left Erlang for a while, now I?m back and I keep having my old pc, and now I tried some of the new apps that comes with the OTP, for example the ?observer? a very good tool actually, but I noticed that in the Load Charts tab it take the 100 % of my CPU and left none to any other processes. The Erlang console has its problems too with performance, printing things and that kind of stuffs that consoles does, that the oldest consoles had not, I observed that in this new release the console is more slower than for example the v5.7.5. So my point is, I know that the hardware revolution is now more than ever growing up, and every day we have double faster computers and in a few years we will don?t care about doing things so right because computers will support our laziness. So I think if we want to make the best CO programming language ever known for a concurrency world, we need to improve every chain?s link and always look back to the base and optimize there to. Maybe in the Load Charts of the observer application was used the accelerations advantages that the Direct X or OpenGL brings, maybe that?s why my old pc can not enjoy that, or maybe not, and was made just using lineal direct draw as I think because with new computers it was enough. Well my final point is that I can not use that part of the observer application in my pc Intel D915GL, Socket 775 with no graphic card. And so maybe the same can happen with others applications because we program using the new technologies and we forget about the real world that is having an Intel Pentium III 800 MHz, I already test Erlang, with the framework EVO having hundreds of message passing, two years ago and work very fine in real-time with only 256 GB of ram on a Pentium III. That?s why I love Erlang. Best Regards, Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sun Mar 3 14:25:09 2013 From: erlang@REDACTED (Erik Reitsma) Date: Sun, 03 Mar 2013 14:25:09 +0100 Subject: [erlang-questions] Erlang4Android R16B released Message-ID: <51334F35.4050400@ernovation.com> Hi all, A new Erlang4Android is available on http://code.google.com/p/erlang4android/, based on R16B. You need to install the new APK, which can be used to download the actual Erlang binaries. This app installs a small version of Erlang (i.e. erlang_R16.zip) for use with SL4A. First install SL4A, then this app, then run this app to install Erlang/OTP and use SL4A to run your Erlang code. Using the app you can add OTP applications from a repository. It is not yet possible to manage the repositories. To add an application (library), go to "Select libraries". Select "Refresh" from the menu to get a list of available libraries. Then click long on the desired library to select it for installation (or uninstallation). Then select "Go" from the menu to actually perform the (un)installation. From the main screen you can select the menu option "Settings" to specify extra command line arguments that will be used when Erlang is started. For example, to start distribution, specify "-name myandroid@REDACTED -setcookie mysecretcookie" (without the quotes and with relevant values). Enjoy! *Erik. -------------- next part -------------- An HTML attachment was scrubbed... URL: From k.petrauskas@REDACTED Sun Mar 3 15:30:33 2013 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Sun, 3 Mar 2013 16:30:33 +0200 Subject: [erlang-questions] Erlang4Android R16B released In-Reply-To: <51334F35.4050400@ernovation.com> References: <51334F35.4050400@ernovation.com> Message-ID: Hi, I tried to install this package on my samsung galaxy S. I got "There is a problem parsing the package" during installation of the Erlang4Android.apk. I installed SL4A before installing Erlang4Android. Karolis On Sun, Mar 3, 2013 at 3:25 PM, Erik Reitsma wrote: > Hi all, > > A new Erlang4Android is available on > http://code.google.com/p/erlang4android/, based on R16B. > You need to install the new APK, which can be used to download the actual > Erlang binaries. > > This app installs a small version of Erlang (i.e. erlang_R16.zip) for use > with SL4A. > > First install SL4A, then this app, then run this app to install Erlang/OTP > and use SL4A to run your Erlang code. > > Using the app you can add OTP applications from a repository. It is not yet > possible to manage the repositories. To add an application (library), go to > "Select libraries". Select "Refresh" from the menu to get a list of > available libraries. Then click long on the desired library to select it for > installation (or uninstallation). Then select "Go" from the menu to actually > perform the (un)installation. > > From the main screen you can select the menu option "Settings" to specify > extra command line arguments that will be used when Erlang is started. For > example, to start distribution, specify "-name myandroid@REDACTED > -setcookie mysecretcookie" (without the quotes and with relevant values). > > Enjoy! > > *Erik. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From erlang@REDACTED Sun Mar 3 18:52:28 2013 From: erlang@REDACTED (Erik Reitsma) Date: Sun, 03 Mar 2013 18:52:28 +0100 Subject: [erlang-questions] Erlang4Android R16B released In-Reply-To: References: <51334F35.4050400@ernovation.com> Message-ID: <51338DDC.4070700@ernovation.com> Perhaps your device has a too old version of Android for the package I had uploaded. I had only tried the package with Android 4.1. I have replaced the package with a version that should support down to 2.1. I hope you have better luck with this one. Regards, *Erik. On 03/03/2013 03:30 PM, Karolis Petrauskas wrote: > Hi, > > I tried to install this package on my samsung galaxy S. I got > "There is a problem parsing the package" during installation of the > Erlang4Android.apk. I installed SL4A before installing Erlang4Android. > > Karolis > > On Sun, Mar 3, 2013 at 3:25 PM, Erik Reitsma wrote: >> Hi all, >> >> A new Erlang4Android is available on >> http://code.google.com/p/erlang4android/, based on R16B. >> You need to install the new APK, which can be used to download the actual >> Erlang binaries. >> >> This app installs a small version of Erlang (i.e. erlang_R16.zip) for use >> with SL4A. >> >> First install SL4A, then this app, then run this app to install Erlang/OTP >> and use SL4A to run your Erlang code. >> >> Using the app you can add OTP applications from a repository. It is not yet >> possible to manage the repositories. To add an application (library), go to >> "Select libraries". Select "Refresh" from the menu to get a list of >> available libraries. Then click long on the desired library to select it for >> installation (or uninstallation). Then select "Go" from the menu to actually >> perform the (un)installation. >> >> From the main screen you can select the menu option "Settings" to specify >> extra command line arguments that will be used when Erlang is started. For >> example, to start distribution, specify "-name myandroid@REDACTED >> -setcookie mysecretcookie" (without the quotes and with relevant values). >> >> Enjoy! >> >> *Erik. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From bourinov@REDACTED Sun Mar 3 20:08:16 2013 From: bourinov@REDACTED (Max Bourinov) Date: Sun, 3 Mar 2013 20:08:16 +0100 Subject: [erlang-questions] Herceg-Novi Montenegro Erlang meetup tomorrow night Message-ID: If you're in the Herceg-Novi or Boko-Bay area (it is all in Montenegro) tomorrow and don't have plans, feel free to stop by Do-Do Bar for a beer or kafa for Erlang party! Details here: http://lanyrd.com/2013/herceg-novi-erlang-meetup/ Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From zerthurd@REDACTED Sun Mar 3 20:11:41 2013 From: zerthurd@REDACTED (Maxim Treskin) Date: Mon, 4 Mar 2013 02:11:41 +0700 Subject: [erlang-questions] Herceg-Novi Montenegro Erlang meetup tomorrow night In-Reply-To: References: Message-ID: Great! I'll definitely come to party! On Mar 3, 2013 8:09 PM, "Max Bourinov" wrote: > If you're in the Herceg-Novi or Boko-Bay area (it is all in Montenegro) > tomorrow and don't have plans, feel free to stop by Do-Do Bar for a beer > or kafa for Erlang party! > > Details here: > > http://lanyrd.com/2013/herceg-novi-erlang-meetup/ > > 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 k.petrauskas@REDACTED Sun Mar 3 21:46:44 2013 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Sun, 3 Mar 2013 22:46:44 +0200 Subject: [erlang-questions] Erlang4Android R16B released In-Reply-To: <51338DDC.4070700@ernovation.com> References: <51334F35.4050400@ernovation.com> <51338DDC.4070700@ernovation.com> Message-ID: Thanks, it works now. Karolis On Sun, Mar 3, 2013 at 7:52 PM, Erik Reitsma wrote: > Perhaps your device has a too old version of Android for the package I had > uploaded. I had only tried the package with Android 4.1. I have replaced the > package with a version that should support down to 2.1. I hope you have > better luck with this one. > > Regards, > *Erik. > > > On 03/03/2013 03:30 PM, Karolis Petrauskas wrote: >> >> Hi, >> >> I tried to install this package on my samsung galaxy S. I got >> "There is a problem parsing the package" during installation of the >> Erlang4Android.apk. I installed SL4A before installing Erlang4Android. >> >> Karolis >> >> On Sun, Mar 3, 2013 at 3:25 PM, Erik Reitsma >> wrote: >>> >>> Hi all, >>> >>> A new Erlang4Android is available on >>> http://code.google.com/p/erlang4android/, based on R16B. >>> You need to install the new APK, which can be used to download the actual >>> Erlang binaries. >>> >>> This app installs a small version of Erlang (i.e. erlang_R16.zip) for use >>> with SL4A. >>> >>> First install SL4A, then this app, then run this app to install >>> Erlang/OTP >>> and use SL4A to run your Erlang code. >>> >>> Using the app you can add OTP applications from a repository. It is not >>> yet >>> possible to manage the repositories. To add an application (library), go >>> to >>> "Select libraries". Select "Refresh" from the menu to get a list of >>> available libraries. Then click long on the desired library to select it >>> for >>> installation (or uninstallation). Then select "Go" from the menu to >>> actually >>> perform the (un)installation. >>> >>> From the main screen you can select the menu option "Settings" to >>> specify >>> extra command line arguments that will be used when Erlang is started. >>> For >>> example, to start distribution, specify "-name myandroid@REDACTED >>> -setcookie mysecretcookie" (without the quotes and with relevant values). >>> >>> Enjoy! >>> >>> *Erik. >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > From pablo.vb80@REDACTED Mon Mar 4 15:01:25 2013 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Mon, 4 Mar 2013 15:01:25 +0100 Subject: [erlang-questions] shell and escript? Message-ID: Hi everyone, is there any way to use the erlang shell in a escript? I have an escript with a bunch of files in a zip, it works fine but I would like to have a "debug" mode whith a shell. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Mar 4 15:02:38 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 4 Mar 2013 18:02:38 +0400 Subject: [erlang-questions] shell and escript? In-Reply-To: References: Message-ID: Yes, I'm also very interested in it. It looks like shell disabling is compiled inside escript.c, but perhaps it is possible to launch shell explicitly? -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Mon Mar 4 15:03:19 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 4 Mar 2013 14:03:19 +0000 Subject: [erlang-questions] shell and escript? In-Reply-To: References: Message-ID: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> The user_drv:start/0 function is probably worth a look, although you might prefer to use shell:start/1 instead. See https://github.com/nebularis/systest/blob/release-0.8.4/src/systest_shell.erl for example. Cheers, Tim On 4 Mar 2013, at 14:01, Pablo Vieytes wrote: > Hi everyone, > is there any way to use the erlang shell in a escript? > > I have an escript with a bunch of files in a zip, it works fine but I would like to have a "debug" mode whith a shell. > > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From pablo.vb80@REDACTED Mon Mar 4 15:10:16 2013 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Mon, 4 Mar 2013 15:10:16 +0100 Subject: [erlang-questions] shell and escript? In-Reply-To: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> Message-ID: Hi, I added some code to the end of my main function and it works. shell:start(), timer:sleep(infinity). Is there something wrong with that? Thanks 2013/3/4 Tim Watson > The user_drv:start/0 function is probably worth a look, although you might > prefer to use shell:start/1 instead. See > https://github.com/nebularis/systest/blob/release-0.8.4/src/systest_shell.erlfor example. > > Cheers, > Tim > > On 4 Mar 2013, at 14:01, Pablo Vieytes wrote: > > > Hi everyone, > > is there any way to use the erlang shell in a escript? > > > > I have an escript with a bunch of files in a zip, it works fine but I > would like to have a "debug" mode whith a shell. > > > > 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 Mar 4 15:12:37 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 4 Mar 2013 18:12:37 +0400 Subject: [erlang-questions] shell and escript? In-Reply-To: References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> Message-ID: now we have only one question left: how to daemonize escripted bundles? -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Mar 4 15:18:01 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 4 Mar 2013 18:18:01 +0400 Subject: [erlang-questions] shell and escript? In-Reply-To: References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> Message-ID: but you will not see all output. -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Mon Mar 4 15:18:05 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 4 Mar 2013 14:18:05 +0000 Subject: [erlang-questions] shell and escript? In-Reply-To: References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> Message-ID: <87BF3E49-E765-48EB-A3CD-2A7701FF9BBC@gmail.com> Hi On 4 Mar 2013, at 14:10, Pablo Vieytes wrote: > I added some code to the end of my main function and it works. > > shell:start(), > timer:sleep(infinity). > > Is there something wrong with that? > I don't know. It might be fine, but using shell:start/0 didn't work for me. Then again, I am running a bunch of stuff like common-test and that probably complicates matters. If shell:start/0 works for you then great! Cheers, Tim From pablo.vb80@REDACTED Mon Mar 4 15:33:04 2013 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Mon, 4 Mar 2013 15:33:04 +0100 Subject: [erlang-questions] shell and escript? In-Reply-To: <87BF3E49-E765-48EB-A3CD-2A7701FF9BBC@gmail.com> References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> <87BF3E49-E765-48EB-A3CD-2A7701FF9BBC@gmail.com> Message-ID: Hi, at first glance shell:start/0 works but then I have had some problems, it works better with user_drv:start/0. Thanks. 2013/3/4 Tim Watson > Hi > > On 4 Mar 2013, at 14:10, Pablo Vieytes wrote: > > I added some code to the end of my main function and it works. > > > > shell:start(), > > timer:sleep(infinity). > > > > Is there something wrong with that? > > > > I don't know. It might be fine, but using shell:start/0 didn't work for > me. Then again, I am running a bunch of stuff like common-test and that > probably complicates matters. If shell:start/0 works for you then great! > > Cheers, > Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Mon Mar 4 15:46:58 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 4 Mar 2013 09:46:58 -0500 Subject: [erlang-questions] shell and escript? In-Reply-To: References: <9A5E7F51-E9D1-46CB-8C25-8CEA58F15F66@gmail.com> <87BF3E49-E765-48EB-A3CD-2A7701FF9BBC@gmail.com> Message-ID: <20130304144657.GB896@ferdmbp.local> Hi, I recently wrote a blog post about how the Erlang shell works (in the large sense) and this might be useful when it comes to choosing how to start things: http://ferd.ca/repl-a-bit-more-and-less-than-that.html I hope this helps. Regards, Fred. On 03/04, Pablo Vieytes wrote: > Hi, > at first glance shell:start/0 works but then I have had some problems, it > works better with user_drv:start/0. > > Thanks. > > > 2013/3/4 Tim Watson > > > Hi > > > > On 4 Mar 2013, at 14:10, Pablo Vieytes wrote: > > > I added some code to the end of my main function and it works. > > > > > > shell:start(), > > > timer:sleep(infinity). > > > > > > Is there something wrong with that? > > > > > > > I don't know. It might be fine, but using shell:start/0 didn't work for > > me. Then again, I am running a bunch of stuff like common-test and that > > probably complicates matters. If shell:start/0 works for you then great! > > > > Cheers, > > Tim > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ransomr@REDACTED Mon Mar 4 16:50:17 2013 From: ransomr@REDACTED (Ransom Richardson) Date: Mon, 4 Mar 2013 15:50:17 +0000 Subject: [erlang-questions] [ANN] Erlcloud DynamoDB support In-Reply-To: <2AE8B89AC7FEC84997A35F7152B8205A1819C0A1@BLUPRD0810MB390.namprd08.prod.outlook.com> References: <2AE8B89AC7FEC84997A35F7152B8205A1819C0A1@BLUPRD0810MB390.namprd08.prod.outlook.com> Message-ID: <2AE8B89AC7FEC84997A35F7152B8205A1819C598@BLUPRD0810MB390.namprd08.prod.outlook.com> https://github.com/gleber/erlcloud erlcloud now has support for DynamoDB. The full DynamoDB API is implemented. See the erlcloud_ddb module for documentation. Please report any issues and suggestions. thanks, Ransom -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Mar 4 18:36:57 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 4 Mar 2013 21:36:57 +0400 Subject: [erlang-questions] [ANN] Erlcloud DynamoDB support In-Reply-To: <2AE8B89AC7FEC84997A35F7152B8205A1819C598@BLUPRD0810MB390.namprd08.prod.outlook.com> References: <2AE8B89AC7FEC84997A35F7152B8205A1819C0A1@BLUPRD0810MB390.namprd08.prod.outlook.com> <2AE8B89AC7FEC84997A35F7152B8205A1819C598@BLUPRD0810MB390.namprd08.prod.outlook.com> Message-ID: Great! I've found erlcloud very convenient and "just working" library. Thanks for it! Right now I'm looking at adding support for swift: some hosters are using it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Mon Mar 4 20:05:31 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Mon, 4 Mar 2013 14:05:31 -0500 Subject: [erlang-questions] Joe Message-ID: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Hi all, I?m reading the Making Reliable Distributed Systems in the Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found this little algorithm using list of compression and there is no way I can understand how internally it work. perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. I did figure out that the recursion does first I mean the call to the function T <- perms(L--[H]) but step by step I can not follow. First, the function is called using [1,2,3] list so [[1|T] || H <- L, T <- perms([1,2,3]--[1] = [2,3])] [[1|[2|T]] || H <- L, T <- perms([2,3]--[2] = [3])] [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] = [])] [[1|[2|[3|[]]]] || H <- L, T <- [])] And now what! What?s the next step? I changed the code in order to print the steps so I can understand but even with that the debug is so confuse. Because the order changes, maybe because of the recursive thing. But I don?t understand why in the head the value 1 is repeated to yield the next value [[1,2,3), [1,3,2], ] perms([]) -> [[]]; perms(L) -> io:format("L = ~p~n", [L]), [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] || H <- L, T <- perms(L--[H])]. This is the exit 74> test:perms([1,2,3]). L = [1,2,3] L = [2,3] L = [3] H = 3 - T = [] H = 2 - T = [{3,ok}|{[],ok}] L = [2] H = 2 - T = [] H = 3 - T = [{2,ok}|{[],ok}] H = 1 - T = [{2,ok}|{[{3,ok}|{[],ok}],ok}] H = 1 - T = [{3,ok}|{[{2,ok}|{[],ok}],ok}] L = [1,3] L = [3] H = 3 - T = [] H = 1 - T = [{3,ok}|{[],ok}] L = [1] H = 1 - T = [] H = 3 - T = [{1,ok}|{[],ok}] H = 2 - T = [{1,ok}|{[{3,ok}|{[],ok}],ok}] H = 2 - T = [{3,ok}|{[{1,ok}|{[],ok}],ok}] L = [1,2] L = [2] H = 2 - T = [] H = 1 - T = [{2,ok}|{[],ok}] L = [1] H = 1 - T = [] H = 2 - T = [{1,ok}|{[],ok}] H = 3 - T = [{1,ok}|{[{2,ok}|{[],ok}],ok}] H = 3 - T = [{2,ok}|{[{1,ok}|{[],ok}],ok}] [[{1,ok}|{[{2,ok}|{[{3,ok}|{[],ok}],ok}],ok}], [{1,ok}|{[{3,ok}|{[{2,ok}|{[],ok}],ok}],ok}], [{2,ok}|{[{1,ok}|{[{3,ok}|{[],ok}],ok}],ok}], [{2,ok}|{[{3,ok}|{[{1,ok}|{[],ok}],ok}],ok}], [{3,ok}|{[{1,ok}|{[{2,ok}|{[],ok}],ok}],ok}], [{3,ok}|{[{2,ok}|{[{1,ok}|{[],ok}],ok}],ok}]] -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego.llarrull@REDACTED Mon Mar 4 20:58:23 2013 From: diego.llarrull@REDACTED (Diego Llarrull) Date: Mon, 04 Mar 2013 16:58:23 -0300 Subject: [erlang-questions] Nested match specifications? Message-ID: <5134FCDF.30607@tecso.coop> Hello everyone, I would like to insert in an ETS table a tuple with the following type signature: /{string(), [{string(), [string()]}]}/ As an example: / //{"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]}// / My question is the following: is it possible to solve, using match specifications, nested queries like "Retrieve the name of Peter's children" ? That is, a query where I would need to a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" is located in the first position (doable with MS) b) Let '$2' be the value in the second position of the tuple fetched in a). Then, fetch the value corresponding to the key "children" in '$2', if interpreted as a key-value list (i.e. lists:keyfind() should work on '$2'). If I understood correctly, lists:keyfind can't be used inside a match specification because they only allow the BIFs described in http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: is there any low-level mechanism to operate on lists inside match specifications, or am I trying to push the boundaries of match specifications? In case anyone wonders "Why not use Query Lists Comprehensions?" the answer is: "Because of performance issues: in our platform, we need to dynamically build QLCs based on the number of arguments that arrive, which forces us to build them as strings and then use qlc:string_to_handle() which is SLOW". Any help of insight will be greatly appreciated. Thank you very much in advance. Diego Llarrull -------------- next part -------------- An HTML attachment was scrubbed... URL: From z@REDACTED Mon Mar 4 21:16:14 2013 From: z@REDACTED (Danil Zagoskin) Date: Tue, 5 Mar 2013 00:16:14 +0400 Subject: [erlang-questions] Joe In-Reply-To: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> References: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Message-ID: Hello, Ivan. I could not figure out what part don't you understand, so I'll try to explain from ground up. First, you call perms(L). The comprehension does following: 1. Take each element of given list and bind it as H for later steps 2. For each H from step 1 construct list of all other elements L -- [H] 3. Apply self on list from step 2 to get all permutations of other elements. To understand this step you need to remember mathematical induction. We provide simple true result for empty list, so for every list which is longer than [] we can refer to result of running function on shorter list. So, in this step we get list of all possible permutations of elements in L which are not H. 4. For each element of permutation list we got in step 3, we bind it (permutation) as T 5. Prepend H to T and take next permutation from step 4 So, in case of [1,2,3] above steps expand to following: (1) H = 1 - (2) other elements list is [2,3] - - (3) perms([2,3]) is list of possible permutations, e.g. [ [2,3], [3,2] ], so there will be two steps "4" - - - (4) T = [2,3] - - - - (5) emit [1|[2,3]] = [1,2,3] - - - (4) T = [3,2] which is second element in result of applying perms([2,3]) - - - - (5) emit [1,3,2] (1,2) H = 2, L -- [H] = [1,3] - - (3) perms([1,3]) is [ [1,3], [3,1] ] - - - (4,5) emit [2,1,3] - - - (4,5) emit [2,3,1] (1,2) H = 3, L -- [H] = [1,2] - - (3,4,5) emit [3,1,2], [3,2,1] 2013/3/4 Ivan Carmenates Garc?a > Hi all, I?m reading the Making Reliable Distributed Systems in the > Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found > this little algorithm using list of compression and there is no way I can > understand how internally it work.**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].**** > > ** ** > > I did figure out that the recursion does first I mean the call to the > function T <- perms(L--[H]) but step by step I can not follow.**** > > First, the function is called using [1,2,3] list so **** > > [[1|T] || H <- L, T <- perms([1,2,3]--[1] = [2,3])]**** > > [[1|[2|T]] || H <- L, T <- perms([2,3]--[2] = [3])]**** > > [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] = [])]**** > > [[1|[2|[3|[]]]] || H <- L, T <- [])]**** > > ** ** > > And now what! What?s the next step?**** > > ** ** > > I changed the code in order to print the steps so I can understand but > even with that the debug is so confuse. Because the order changes, maybe > because of the recursive thing.**** > > But I don?t understand why in the head the value 1 is repeated to yield > the next value [[1,2,3), [1,3,2], ?]**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) ->**** > > io:format("L = ~p~n", [L]),**** > > [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] > || H <- L, T <- perms(L--[H])].**** > > ** ** > > This is the exit**** > > ** ** > > 74> test:perms([1,2,3]).**** > > L = [1,2,3]**** > > L = [2,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 2 - T = [{3,ok}|{[],ok}]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 3 - T = [{2,ok}|{[],ok}]**** > > H = 1 - T = [{2,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 1 - T = [{3,ok}|{[{2,ok}|{[],ok}],ok}]**** > > L = [1,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 1 - T = [{3,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 3 - T = [{1,ok}|{[],ok}]**** > > H = 2 - T = [{1,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 2 - T = [{3,ok}|{[{1,ok}|{[],ok}],ok}]**** > > L = [1,2]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 1 - T = [{2,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 2 - T = [{1,ok}|{[],ok}]**** > > H = 3 - T = [{1,ok}|{[{2,ok}|{[],ok}],ok}]**** > > H = 3 - T = [{2,ok}|{[{1,ok}|{[],ok}],ok}]**** > > [[{1,ok}|{[{2,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{1,ok}|{[{3,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{1,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{3,ok}|{[{1,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{1,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{2,ok}|{[{1,ok}|{[],ok}],ok}],ok}]]**** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- --------------------------------------------- ????? ???????? | +7 906 064 20 47 | z@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Mon Mar 4 21:41:34 2013 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 4 Mar 2013 21:41:34 +0100 Subject: [erlang-questions] Joe In-Reply-To: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> References: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Message-ID: Hi Ivan, This algorithm is not particular obvious. It works as follows. Suppose I want to compute all permutations of "1234" Suppose I had a program that could compute all perms of three elements I could call it like this: > perms("234"), ["234", "243", "324", "342", "423", "432"]. Now stick a one on the front ["1234", "1243", "1324", "1342", "1423", "1432"]. That's almost right. I've now generated a quarter of what I need Instead of taking out the "1" I could do the same with the "2" > perms("134"). ["134", "143", "314", "341", "413", "431"] and put the 2 at the front ["2134", "2143", "2314", "2341", "2413", "2431"] This what the list comprehension does: H <- L says take H from L in all possible ways T <- perms(L -- [H]) says take T from the set of permutations of L with H removed [ [H|T] || ...] means build the list [H|T] with H and T as above But how did I compute all permutations of three elements? "Suppose I had a function that could compute all permutations of two elements ..." Cheers /Joe On Mon, Mar 4, 2013 at 8:05 PM, Ivan Carmenates Garc?a wrote: > Hi all, I?m reading the Making Reliable Distributed Systems in the > Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found > this little algorithm using list of compression and there is no way I can > understand how internally it work.**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].**** > > ** ** > > I did figure out that the recursion does first I mean the call to the > function T <- perms(L--[H]) but step by step I can not follow.**** > > First, the function is called using [1,2,3] list so **** > > [[1|T] || H <- L, T <- perms([1,2,3]--[1] = [2,3])]**** > > [[1|[2|T]] || H <- L, T <- perms([2,3]--[2] = [3])]**** > > [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] = [])]**** > > [[1|[2|[3|[]]]] || H <- L, T <- [])]**** > > ** ** > > And now what! What?s the next step?**** > > ** ** > > I changed the code in order to print the steps so I can understand but > even with that the debug is so confuse. Because the order changes, maybe > because of the recursive thing.**** > > But I don?t understand why in the head the value 1 is repeated to yield > the next value [[1,2,3), [1,3,2], ?]**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) ->**** > > io:format("L = ~p~n", [L]),**** > > [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] > || H <- L, T <- perms(L--[H])].**** > > ** ** > > This is the exit**** > > ** ** > > 74> test:perms([1,2,3]).**** > > L = [1,2,3]**** > > L = [2,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 2 - T = [{3,ok}|{[],ok}]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 3 - T = [{2,ok}|{[],ok}]**** > > H = 1 - T = [{2,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 1 - T = [{3,ok}|{[{2,ok}|{[],ok}],ok}]**** > > L = [1,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 1 - T = [{3,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 3 - T = [{1,ok}|{[],ok}]**** > > H = 2 - T = [{1,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 2 - T = [{3,ok}|{[{1,ok}|{[],ok}],ok}]**** > > L = [1,2]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 1 - T = [{2,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 2 - T = [{1,ok}|{[],ok}]**** > > H = 3 - T = [{1,ok}|{[{2,ok}|{[],ok}],ok}]**** > > H = 3 - T = [{2,ok}|{[{1,ok}|{[],ok}],ok}]**** > > [[{1,ok}|{[{2,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{1,ok}|{[{3,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{1,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{3,ok}|{[{1,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{1,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{2,ok}|{[{1,ok}|{[],ok}],ok}],ok}]]**** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Mon Mar 4 22:53:09 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Mon, 4 Mar 2013 16:53:09 -0500 Subject: [erlang-questions] Nested match specifications? In-Reply-To: <5134FCDF.30607@tecso.coop> References: <5134FCDF.30607@tecso.coop> Message-ID: <002401ce1922$af750f70$0e5f2e50$@frcuba.co.cu> Hi Diego, I don?t know exactly if this could work for you but you can do complex patterns like this to take what you want 1> ets:new(table, [named_table]), 2> ets:insert("Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]}), 3> ets:match(table, {"Peter", [{"children", '$1'},'_'] }). [[["Bob","Paul"]]] If you always match against the key, you do really faster. Bests, Ivan. De: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] En nombre de Diego Llarrull Enviado el: lunes, 04 de marzo de 2013 14:58 Para: erlang-questions@REDACTED Asunto: [erlang-questions] Nested match specifications? Hello everyone, I would like to insert in an ETS table a tuple with the following type signature: {string(), [{string(), [string()]}]} As an example: {"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]} My question is the following: is it possible to solve, using match specifications, nested queries like "Retrieve the name of Peter's children" ? That is, a query where I would need to a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" is located in the first position (doable with MS) b) Let '$2' be the value in the second position of the tuple fetched in a). Then, fetch the value corresponding to the key "children" in '$2', if interpreted as a key-value list (i.e. lists:keyfind() should work on '$2'). If I understood correctly, lists:keyfind can't be used inside a match specification because they only allow the BIFs described in http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: is there any low-level mechanism to operate on lists inside match specifications, or am I trying to push the boundaries of match specifications? In case anyone wonders "Why not use Query Lists Comprehensions?" the answer is: "Because of performance issues: in our platform, we need to dynamically build QLCs based on the number of arguments that arrive, which forces us to build them as strings and then use qlc:string_to_handle() which is SLOW". Any help of insight will be greatly appreciated. Thank you very much in advance. Diego Llarrull -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Mar 5 02:32:04 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 5 Mar 2013 14:32:04 +1300 Subject: [erlang-questions] Joe In-Reply-To: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> References: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Message-ID: On 5/03/2013, at 8:05 AM, Ivan Carmenates Garc?a wrote: > Hi all, I?m reading the Making Reliable Distributed Systems in the Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found this little algorithm using list of compression and there is no way I can understand how internally it work. That's "list comPREHENSION" and yes there is a way. > perms([]) -> [[]]; > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. to generate the permutations of a list: if the list is empty [] the permutations of [] are [X] where X = [] if the list L is not empty for each element H of L form the list L' by deleting H from L let P be the list of all permutations of L' for each T in P (for each T being a permutation of L without X) add H to the front of T [H|T] is a permutation of L collect all those permutations as the answer or in Smalltalk: Array methods: allPermutations |r| r := OrderedCollection new. self isEmpty ifTrue: [r add: self] ifFalse: [ self do: [:each | (self copyWithout: each) allPermutations do: [:eachPermutation | r add: (eachPermutation copyWith: each)]]]. ^r Test (1 to: 4) asArray allPermutations => an OrderedCollection( #(4 3 2 1) #(3 4 2 1) #(4 2 3 1) #(2 4 3 1) #(3 2 4 1) #(2 3 4 1) #(4 3 1 2) #(3 4 1 2) #(4 1 3 2) #(1 4 3 2) #(3 1 4 2) #(1 3 4 2) #(4 2 1 3) #(2 4 1 3) #(4 1 2 3) #(1 4 2 3) #(2 1 4 3) #(1 2 4 3) #(3 2 1 4) #(2 3 1 4) #(3 1 2 4) #(1 3 2 4) #(2 1 3 4) #(1 2 3 4)) If you look at the Smalltalk code, you will see (1) an "_ isEmpty ifTrue: [_] ifFalse: [_]" which is done in Erlang with two clauses, one of which matches the empty list and the second which will be given anything but the empty list to match (2) an outer "_ do: [:each | _]" loop that iterates over the elements of the array. The equivalent in Erlang is "H <- L". (3) an inner "_ allPermutations do: [:eachPermutation | _] loop that iterates over the permutations of (self copyWithout: each). The equivalent in Erlang is "T <- permutations(L -- [H]) (4) (eachPermutation copyWith: each) is added to the result that is built up. The equivalent in Erlang is [[H|T] || _]. So whenever you have Pattern <- expression in a list comprehension, you have a loop over the elements of the expression, and whenever you have more than one of them, you have nested loops, the leftmost outermost and the rightmost innermost. Another approach is to trace what's going on. You can use the functions in the 'dbg' module to do tracing. It has a lot to offer. But for a simple case like this, adding your own code isn't hard: permutations(L) -> traced_permutations(L, 0). traced_permutations(L, Depth) -> format("~*c~w => ~n", [Depth,32,L]), R = traced_permutations_body(L, Depth+1), format("~*c => ~w~n", [Depth,32,R]), R. traced_permutations_body([], _) -> [[]]; traced_permutations_body(L, Depth) -> [[H|T] || H <- L, T <- traced_permutations(L--[H], Depth)]. 2> perms:permutations([1,2,3]). [1,2,3] => [2,3] => [3] => [] => => [[]] => [[3]] [2] => [] => => [[]] => [[2]] => [[2,3],[3,2]] [1,3] => [3] => [] => => [[]] => [[3]] [1] => [] => => [[]] => [[1]] => [[1,3],[3,1]] [1,2] => [2] => [] => => [[]] => [[2]] [1] => [] => => [[]] => [[1]] => [[1,2],[2,1]] => [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] > > I did figure out that the recursion does first I mean the call to the function T <- perms(L--[H]) but step by step I can not follow. > First, the function is called using [1,2,3] list so > [[1|T] || H <- L, T <- perms([1,2,3]--[1] = [2,3])] > [[1|[2|T]] || H <- L, T <- perms([2,3]--[2] = [3])] > [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] = [])] > [[1|[2|[3|[]]]] || H <- L, T <- [])] > > And now what! What?s the next step? > > I changed the code in order to print the steps so I can understand but even with that the debug is so confuse. Because the order changes, maybe because of the recursive thing. > But I don?t understand why in the head the value 1 is repeated to yield the next value [[1,2,3), [1,3,2], ?] > > perms([]) -> [[]]; > perms(L) -> > io:format("L = ~p~n", [L]), > [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] || H <- L, T <- perms(L--[H])]. This would be better as perms([]) -> [[]]; perms(L) -> [begin io:format("H = ~w, T = ~w, L = ~w;~n", [H,T,L]), [H|T] end || H <- L, T <- perms(L--[H])]. with output 4> perms:perms([1,2,3]). H = 3, T = [], L = [3]; H = 2, T = [3], L = [2,3]; H = 2, T = [], L = [2]; H = 3, T = [2], L = [2,3]; H = 1, T = [2,3], L = [1,2,3]; H = 1, T = [3,2], L = [1,2,3]; H = 3, T = [], L = [3]; H = 1, T = [3], L = [1,3]; H = 1, T = [], L = [1]; H = 3, T = [1], L = [1,3]; H = 2, T = [1,3], L = [1,2,3]; H = 2, T = [3,1], L = [1,2,3]; H = 2, T = [], L = [2]; H = 1, T = [2], L = [1,2]; H = 1, T = [], L = [1]; H = 2, T = [1], L = [1,2]; H = 3, T = [1,2], L = [1,2,3]; H = 3, T = [2,1], L = [1,2,3]; [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] We can see that in every line [H|T] is a permutation of L. That's about all we can see, because it's not indented. In particular, the order in which we see H varying is NOT the order in which permutations starting with that value of H are *begun* but the order in which they are *completed*. [1,2,3] => H<1> = 1, recursive call with [2,3] => H<2> = 2, recursive call with [3] => H<3> = 3, recursive call with [] => [[]] => [3|[]] => [2|[3]] H<2> => 3, recursive call with [2] => H<3> = 2, recursive call with [] => [[]] => [2|[]] => [3|[2]] => [1|[2,3]], [1|[3,2]] ... It's not clear to me what it is that confuses you. Given a list L, a binding to H is used as many times as there are elements in L--[H], because the H loop is the outermost one. From qqshfox@REDACTED Tue Mar 5 05:55:36 2013 From: qqshfox@REDACTED (Hanfei Shen) Date: Mon, 4 Mar 2013 20:55:36 -0800 (PST) Subject: [erlang-questions] R16A binary packages for CentOS, Debian, Mac, Ubuntu and Windows In-Reply-To: <20130131124255.GC28211@dex.krakow> References: <20130130165902.GA22351@dex.krakow> <20130131124255.GC28211@dex.krakow> Message-ID: Hi, I have this problem too with R16B on my OS X 10.8.2. Erlang R16B (erts-5.10.1) [source-05f1189] [64-bit] [smp:4:4] > [async-threads:10] [hipe] [kernel-poll:false] > Eshell V5.10.1 (abort with ^G) 1> observer:start(). =ERROR REPORT==== 5-Mar-2013::12:43:01 === WX Failed loading "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, > 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: > /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat > namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, {wx,new,1,[{file,"wx.erl"},{line,114}]}, {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,239}]}]}} Thanks, Hanfei ? 2013?1?31????UTC+8??8?42?56??Karol Urbanski??? > > Hi, > There was a problem with linked dynamic libraries in yesterday's R16A > 32-bit > release. We've fixed this already, so try to download the package for your > Mac > again. If the problem persists, please let us know. > > Best regards, > Karol Urbanski > > On Thu, Jan 31, 2013 at 11:15:07AM +0000, Adrian Roe wrote: > > I'm really excited about having access to observer etc on my Mac :) ? > > > > ? but not entirely plain sailing getting observer to run (trace > below). Am I being stupid? > > > > Thanks for your help. > > > > Adrian > > > > -- > > Adrian Roe > > Sent with Sparrow > > > > > > > > 4> observer:start(). > > > {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, > 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: > /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat > namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, > > [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, > > {wx,new,1,[{file,"wx.erl"},{line,114}]}, > > {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, > > {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, > > {proc_lib,init_p_do_apply,3, > > [{file,"proc_lib.erl"},{line,239}]}]}} > > 5> > > =ERROR REPORT==== 31-Jan-2013::11:10:42 === > > WX Failed loading > "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" > > > > On Wednesday, 30 January 2013 at 16:59, Karol Urbanski wrote: > > > > Hello, > > You can find our binary packages for the newest Erlang release (R16A) > at > > http://www.erlang-solutions.com/downloads/download-erlang-otp > > The systems we provide the packages for are CentOS 6, Mac OS X Snow > > Leopard and newer, Debian 6, Ubuntu 12.10 and Windows. More systems > to > > come soon! > > Best regards, > > Karol Urbanski > > _______________________________________________ > > erlang-questions mailing list > > erlang-q...@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Tue Mar 5 13:50:34 2013 From: vances@REDACTED (Vance Shipley) Date: Tue, 5 Mar 2013 18:20:34 +0530 Subject: [erlang-questions] Distributed Term Logging Message-ID: <20130305125034.GB389@aluminium.motivity.ca> Is there an existing application which would provide distributed term logging which provides the following characteristics? - low write overhead - durability - eventual consistency Where only these use cases are required: - write once - append only - sequential reads I could just use distributed disk_log's and get everything but consistency. Should I just write my own layer on top of that or has someone else already done this? -- -Vance From pan@REDACTED Tue Mar 5 15:34:50 2013 From: pan@REDACTED (Patrik Nyblom) Date: Tue, 5 Mar 2013 15:34:50 +0100 Subject: [erlang-questions] Nested match specifications? In-Reply-To: <5134FCDF.30607@tecso.coop> References: <5134FCDF.30607@tecso.coop> Message-ID: <5136028A.6010004@erlang.org> Hi! On 03/04/2013 08:58 PM, Diego Llarrull wrote: > Hello everyone, > > I would like to insert in an ETS table a tuple with the following type > signature: > > /{string(), [{string(), [string()]}]}/ > > As an example: > / > //{"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]}// > > / > My question is the following: is it possible to solve, using match > specifications, nested queries like "Retrieve the name of Peter's > children" ? > > That is, a query where I would need to > > a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" > is located in the first position (doable with MS) > b) Let '$2' be the value in the second position of the tuple fetched > in a). Then, fetch the value corresponding to the key "children" in > '$2', if interpreted as a key-value list (i.e. lists:keyfind() should > work on '$2'). > > If I understood correctly, lists:keyfind can't be used inside a match > specification because they only allow the BIFs described in > http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: > is there any low-level mechanism to operate on lists inside match > specifications, or am I trying to push the boundaries of match > specifications? > Yes, you're trying to push the boundaries of match specifications :) You'll have to do a lists:keysearch/keyfind on the results of the ets:select (when you're back in proper Erlang code), only constant time BIF's can be added to the ms language, so it's unfortunately not even an option to add this particular function... Without a huge rewrite that is... So... [lists:keyfind("children",1,P) || P <- ets:select(xxx,ets:fun2ms(fun({"Peter",Data}) -> Data end))]. would be the solution. Except of course if the list has a particular order, or you instead use some record'ish data structure, so that you can match directly: ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> Data end)). But looping over the list inside the ms is not possible. > In case anyone wonders "Why not use Query Lists Comprehensions?" the > answer is: "Because of performance issues: in our platform, we need to > dynamically build QLCs based on the number of arguments that arrive, > which forces us to build them as strings and then use > qlc:string_to_handle() which is SLOW". > > Any help of insight will be greatly appreciated. Thank you very much > in advance. > > Diego Llarrull > > Cheers, /Patrik > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From diego.llarrull@REDACTED Tue Mar 5 17:21:48 2013 From: diego.llarrull@REDACTED (Diego Llarrull) Date: Tue, 05 Mar 2013 13:21:48 -0300 Subject: [erlang-questions] Nested match specifications? In-Reply-To: <5136028A.6010004@erlang.org> References: <5134FCDF.30607@tecso.coop> <5136028A.6010004@erlang.org> Message-ID: <51361B9C.6020402@tecso.coop> Ivan, Patrik: Thank you both for the swift replies! Both provided functions that yield the desired results. The functions are: (I) ets:match(table, {"Peter", [{"children", '$1'},'_'] }). (Ivan's) (II) ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> Data end)). (Patrick's) (II) is effectively rendered to ets:select(xxx,[{{"Peter",{"children",'$1'}},[],['$1']}]) which is pretty similar to Ivan's suggestion. My final question (and I so promise) is: it appears to me that (I) performs better than (II) because of the lack of need of a transformation function such as ets:fun2ms(). However, I don't known for sure whether ets:match() outperforms ets:select() or not. I'm about to run a series of tests on big datasets to check this, but I imagine that there is already an answer to this question. Once again, thank you very much. Diego El 05/03/13 11:34, Patrik Nyblom escribi?: > Hi! > On 03/04/2013 08:58 PM, Diego Llarrull wrote: >> Hello everyone, >> >> I would like to insert in an ETS table a tuple with the following >> type signature: >> >> /{string(), [{string(), [string()]}]}/ >> >> As an example: >> / >> //{"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]}// >> >> / >> My question is the following: is it possible to solve, using match >> specifications, nested queries like "Retrieve the name of Peter's >> children" ? >> >> That is, a query where I would need to >> >> a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" >> is located in the first position (doable with MS) >> b) Let '$2' be the value in the second position of the tuple fetched >> in a). Then, fetch the value corresponding to the key "children" in >> '$2', if interpreted as a key-value list (i.e. lists:keyfind() should >> work on '$2'). >> >> If I understood correctly, lists:keyfind can't be used inside a match >> specification because they only allow the BIFs described in >> http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: >> is there any low-level mechanism to operate on lists inside match >> specifications, or am I trying to push the boundaries of match >> specifications? >> > Yes, you're trying to push the boundaries of match specifications :) > > You'll have to do a lists:keysearch/keyfind on the results of the > ets:select (when you're back in proper Erlang code), only constant > time BIF's can be added to the ms language, so it's unfortunately not > even an option to add this particular function... Without a huge > rewrite that is... > > So... > [lists:keyfind("children",1,P) || P <- > ets:select(xxx,ets:fun2ms(fun({"Peter",Data}) -> Data end))]. > would be the solution. Except of course if the list has a particular > order, or you instead use some record'ish data structure, so that you > can match directly: > ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> > Data end)). > But looping over the list inside the ms is not possible. >> In case anyone wonders "Why not use Query Lists Comprehensions?" the >> answer is: "Because of performance issues: in our platform, we need >> to dynamically build QLCs based on the number of arguments that >> arrive, which forces us to build them as strings and then use >> qlc:string_to_handle() which is SLOW". >> >> Any help of insight will be greatly appreciated. Thank you very much >> in advance. >> >> Diego Llarrull >> >> > Cheers, > /Patrik >> >> >> >> _______________________________________________ >> 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 co7eb@REDACTED Tue Mar 5 18:09:52 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Tue, 5 Mar 2013 12:09:52 -0500 Subject: [erlang-questions] Nested match specifications? In-Reply-To: <51361B9C.6020402@tecso.coop> References: <5134FCDF.30607@tecso.coop> <5136028A.6010004@erlang.org> <51361B9C.6020402@tecso.coop> Message-ID: <001a01ce19c4$457ff060$d07fd120$@frcuba.co.cu> Hi Diego, I think both functions are the same about performance, I think the questions is of how to use it, I bet you will get the same result using the function you like most while you reduce the complexity of the query by reducing calls to other functions and the times you filter the data, and as last point while more specific you come getting the data, using keys, or indexers in the query. It?s my placer to help, that?s why we are here I think. Best, Ivan. De: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] En nombre de Diego Llarrull Enviado el: martes, 05 de marzo de 2013 11:22 Para: erlang-questions@REDACTED Asunto: Re: [erlang-questions] Nested match specifications? Ivan, Patrik: Thank you both for the swift replies! Both provided functions that yield the desired results. The functions are: (I) ets:match(table, {"Peter", [{"children", '$1'},'_'] }). (Ivan's) (II) ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> Data end)). (Patrick's) (II) is effectively rendered to ets:select(xxx,[{{"Peter",{"children",'$1'}},[],['$1']}]) which is pretty similar to Ivan's suggestion. My final question (and I so promise) is: it appears to me that (I) performs better than (II) because of the lack of need of a transformation function such as ets:fun2ms(). However, I don't known for sure whether ets:match() outperforms ets:select() or not. I'm about to run a series of tests on big datasets to check this, but I imagine that there is already an answer to this question. Once again, thank you very much. Diego El 05/03/13 11:34, Patrik Nyblom escribi?: Hi! On 03/04/2013 08:58 PM, Diego Llarrull wrote: Hello everyone, I would like to insert in an ETS table a tuple with the following type signature: {string(), [{string(), [string()]}]} As an example: {"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]} My question is the following: is it possible to solve, using match specifications, nested queries like "Retrieve the name of Peter's children" ? That is, a query where I would need to a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" is located in the first position (doable with MS) b) Let '$2' be the value in the second position of the tuple fetched in a). Then, fetch the value corresponding to the key "children" in '$2', if interpreted as a key-value list (i.e. lists:keyfind() should work on '$2'). If I understood correctly, lists:keyfind can't be used inside a match specification because they only allow the BIFs described in http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: is there any low-level mechanism to operate on lists inside match specifications, or am I trying to push the boundaries of match specifications? Yes, you're trying to push the boundaries of match specifications :) You'll have to do a lists:keysearch/keyfind on the results of the ets:select (when you're back in proper Erlang code), only constant time BIF's can be added to the ms language, so it's unfortunately not even an option to add this particular function... Without a huge rewrite that is... So... [lists:keyfind("children",1,P) || P <- ets:select(xxx,ets:fun2ms(fun({"Peter",Data}) -> Data end))]. would be the solution. Except of course if the list has a particular order, or you instead use some record'ish data structure, so that you can match directly: ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> Data end)). But looping over the list inside the ms is not possible. In case anyone wonders "Why not use Query Lists Comprehensions?" the answer is: "Because of performance issues: in our platform, we need to dynamically build QLCs based on the number of arguments that arrive, which forces us to build them as strings and then use qlc:string_to_handle() which is SLOW". Any help of insight will be greatly appreciated. Thank you very much in advance. Diego Llarrull Cheers, /Patrik _______________________________________________ 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 co7eb@REDACTED Tue Mar 5 18:11:42 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Tue, 5 Mar 2013 12:11:42 -0500 Subject: [erlang-questions] Joe In-Reply-To: References: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Message-ID: <002501ce19c4$875f57a0$961e06e0$@frcuba.co.cu> I'm still digesting the permutation algorithm I will come up with a reply soon... I hope. -----Mensaje original----- De: Richard A. O'Keefe [mailto:ok@REDACTED] Enviado el: lunes, 04 de marzo de 2013 20:32 Para: Ivan Carmenates Garc?a CC: erlang-questions@REDACTED Asunto: Re: [erlang-questions] Joe On 5/03/2013, at 8:05 AM, Ivan Carmenates Garc?a wrote: > Hi all, I?m reading the Making Reliable Distributed Systems in the Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found this little algorithm using list of compression and there is no way I can understand how internally it work. That's "list comPREHENSION" and yes there is a way. > perms([]) -> [[]]; > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. to generate the permutations of a list: if the list is empty [] the permutations of [] are [X] where X = [] if the list L is not empty for each element H of L form the list L' by deleting H from L let P be the list of all permutations of L' for each T in P (for each T being a permutation of L without X) add H to the front of T [H|T] is a permutation of L collect all those permutations as the answer or in Smalltalk: Array methods: allPermutations |r| r := OrderedCollection new. self isEmpty ifTrue: [r add: self] ifFalse: [ self do: [:each | (self copyWithout: each) allPermutations do: [:eachPermutation | r add: (eachPermutation copyWith: each)]]]. ^r Test (1 to: 4) asArray allPermutations => an OrderedCollection( #(4 3 2 1) #(3 4 2 1) #(4 2 3 1) #(2 4 3 1) #(3 2 4 1) #(2 3 4 1) #(4 3 1 2) #(3 4 1 2) #(4 1 3 2) #(1 4 3 2) #(3 1 4 2) #(1 3 4 2) #(4 2 1 3) #(2 4 1 3) #(4 1 2 3) #(1 4 2 3) #(2 1 4 3) #(1 2 4 3) #(3 2 1 4) #(2 3 1 4) #(3 1 2 4) #(1 3 2 4) #(2 1 3 4) #(1 2 3 4)) If you look at the Smalltalk code, you will see (1) an "_ isEmpty ifTrue: [_] ifFalse: [_]" which is done in Erlang with two clauses, one of which matches the empty list and the second which will be given anything but the empty list to match (2) an outer "_ do: [:each | _]" loop that iterates over the elements of the array. The equivalent in Erlang is "H <- L". (3) an inner "_ allPermutations do: [:eachPermutation | _] loop that iterates over the permutations of (self copyWithout: each). The equivalent in Erlang is "T <- permutations(L -- [H]) (4) (eachPermutation copyWith: each) is added to the result that is built up. The equivalent in Erlang is [[H|T] || _]. So whenever you have Pattern <- expression in a list comprehension, you have a loop over the elements of the expression, and whenever you have more than one of them, you have nested loops, the leftmost outermost and the rightmost innermost. Another approach is to trace what's going on. You can use the functions in the 'dbg' module to do tracing. It has a lot to offer. But for a simple case like this, adding your own code isn't hard: permutations(L) -> traced_permutations(L, 0). traced_permutations(L, Depth) -> format("~*c~w => ~n", [Depth,32,L]), R = traced_permutations_body(L, Depth+1), format("~*c => ~w~n", [Depth,32,R]), R. traced_permutations_body([], _) -> [[]]; traced_permutations_body(L, Depth) -> [[H|T] || H <- L, T <- traced_permutations(L--[H], Depth)]. 2> perms:permutations([1,2,3]). [1,2,3] => [2,3] => [3] => [] => => [[]] => [[3]] [2] => [] => => [[]] => [[2]] => [[2,3],[3,2]] [1,3] => [3] => [] => => [[]] => [[3]] [1] => [] => => [[]] => [[1]] => [[1,3],[3,1]] [1,2] => [2] => [] => => [[]] => [[2]] [1] => [] => => [[]] => [[1]] => [[1,2],[2,1]] => [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] > > I did figure out that the recursion does first I mean the call to the function T <- perms(L--[H]) but step by step I can not follow. > First, the function is called using [1,2,3] list so [[1|T] || H <- L, > T <- perms([1,2,3]--[1] = [2,3])] [[1|[2|T]] || H <- L, T <- > perms([2,3]--[2] = [3])] [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] > = [])] [[1|[2|[3|[]]]] || H <- L, T <- [])] > > And now what! What?s the next step? > > I changed the code in order to print the steps so I can understand but even with that the debug is so confuse. Because the order changes, maybe because of the recursive thing. > But I don?t understand why in the head the value 1 is repeated to > yield the next value [[1,2,3), [1,3,2], ] > > perms([]) -> [[]]; > perms(L) -> > io:format("L = ~p~n", [L]), > [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] || H <- L, T <- perms(L--[H])]. This would be better as perms([]) -> [[]]; perms(L) -> [begin io:format("H = ~w, T = ~w, L = ~w;~n", [H,T,L]), [H|T] end || H <- L, T <- perms(L--[H])]. with output 4> perms:perms([1,2,3]). H = 3, T = [], L = [3]; H = 2, T = [3], L = [2,3]; H = 2, T = [], L = [2]; H = 3, T = [2], L = [2,3]; H = 1, T = [2,3], L = [1,2,3]; H = 1, T = [3,2], L = [1,2,3]; H = 3, T = [], L = [3]; H = 1, T = [3], L = [1,3]; H = 1, T = [], L = [1]; H = 3, T = [1], L = [1,3]; H = 2, T = [1,3], L = [1,2,3]; H = 2, T = [3,1], L = [1,2,3]; H = 2, T = [], L = [2]; H = 1, T = [2], L = [1,2]; H = 1, T = [], L = [1]; H = 2, T = [1], L = [1,2]; H = 3, T = [1,2], L = [1,2,3]; H = 3, T = [2,1], L = [1,2,3]; [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] We can see that in every line [H|T] is a permutation of L. That's about all we can see, because it's not indented. In particular, the order in which we see H varying is NOT the order in which permutations starting with that value of H are *begun* but the order in which they are *completed*. [1,2,3] => H<1> = 1, recursive call with [2,3] => H<2> = 2, recursive call with [3] => H<3> = 3, recursive call with [] => [[]] => [3|[]] => [2|[3]] H<2> => 3, recursive call with [2] => H<3> = 2, recursive call with [] => [[]] => [2|[]] => [3|[2]] => [1|[2,3]], [1|[3,2]] ... It's not clear to me what it is that confuses you. Given a list L, a binding to H is used as many times as there are elements in L--[H], because the H loop is the outermost one. From z@REDACTED Tue Mar 5 19:57:57 2013 From: z@REDACTED (Danil Zagoskin) Date: Tue, 5 Mar 2013 22:57:57 +0400 Subject: [erlang-questions] Joe In-Reply-To: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> References: <000001ce190b$42c5ff90$c851feb0$@frcuba.co.cu> Message-ID: maybe this (almost equivalent) code will give output with more clear apply order. I tried to draw how perms() calls itself. Hope it helps to understand: perms(L) -> perms("", L). perms(_Prefix, []) -> [[]]; perms(Prefix, L) -> ListOfPermLists = [perms(Prefix, L, H, L -- [H]) || H <- L], lists:merge(ListOfPermLists). perms(Prefix, L, H, Others) -> io:format("~s-L = ~p, [H] = ~p, Others = ~p~n", [Prefix, L, [H], Others]), OthersPerms = perms(" |" ++ Prefix, Others), Emit = [ [H|T] || T <- OthersPerms], Emitted = [io_lib:format("~p ", [E]) || E <- Emit], io:format("~s L = ~p, [H] = ~p, T <- ~p >>> emit ~s~n", [Prefix, L, [H], OthersPerms, Emitted]), Emit. 2013/3/4 Ivan Carmenates Garc?a > Hi all, I?m reading the Making Reliable Distributed Systems in the > Presence of Software Errors by Joe Armstrong Thesis of 2003 and I found > this little algorithm using list of compression and there is no way I can > understand how internally it work.**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].**** > > ** ** > > I did figure out that the recursion does first I mean the call to the > function T <- perms(L--[H]) but step by step I can not follow.**** > > First, the function is called using [1,2,3] list so **** > > [[1|T] || H <- L, T <- perms([1,2,3]--[1] = [2,3])]**** > > [[1|[2|T]] || H <- L, T <- perms([2,3]--[2] = [3])]**** > > [[1|[2|[3|T]]] || H <- L, T <- perms([3]--[3] = [])]**** > > [[1|[2|[3|[]]]] || H <- L, T <- [])]**** > > ** ** > > And now what! What?s the next step?**** > > ** ** > > I changed the code in order to print the steps so I can understand but > even with that the debug is so confuse. Because the order changes, maybe > because of the recursive thing.**** > > But I don?t understand why in the head the value 1 is repeated to yield > the next value [[1,2,3), [1,3,2], ?]**** > > ** ** > > perms([]) -> [[]];**** > > perms(L) ->**** > > io:format("L = ~p~n", [L]),**** > > [[{H,io:format("H = ~p - ", [H])}| {T, io:format("T = ~p~n", [T])}] > || H <- L, T <- perms(L--[H])].**** > > ** ** > > This is the exit**** > > ** ** > > 74> test:perms([1,2,3]).**** > > L = [1,2,3]**** > > L = [2,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 2 - T = [{3,ok}|{[],ok}]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 3 - T = [{2,ok}|{[],ok}]**** > > H = 1 - T = [{2,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 1 - T = [{3,ok}|{[{2,ok}|{[],ok}],ok}]**** > > L = [1,3]**** > > L = [3]**** > > H = 3 - T = []**** > > H = 1 - T = [{3,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 3 - T = [{1,ok}|{[],ok}]**** > > H = 2 - T = [{1,ok}|{[{3,ok}|{[],ok}],ok}]**** > > H = 2 - T = [{3,ok}|{[{1,ok}|{[],ok}],ok}]**** > > L = [1,2]**** > > L = [2]**** > > H = 2 - T = []**** > > H = 1 - T = [{2,ok}|{[],ok}]**** > > L = [1]**** > > H = 1 - T = []**** > > H = 2 - T = [{1,ok}|{[],ok}]**** > > H = 3 - T = [{1,ok}|{[{2,ok}|{[],ok}],ok}]**** > > H = 3 - T = [{2,ok}|{[{1,ok}|{[],ok}],ok}]**** > > [[{1,ok}|{[{2,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{1,ok}|{[{3,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{1,ok}|{[{3,ok}|{[],ok}],ok}],ok}],**** > > [{2,ok}|{[{3,ok}|{[{1,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{1,ok}|{[{2,ok}|{[],ok}],ok}],ok}],**** > > [{3,ok}|{[{2,ok}|{[{1,ok}|{[],ok}],ok}],ok}]]**** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- --------------------------------------------- ????? ???????? | +7 906 064 20 47 | z@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From yilmazhuseyin@REDACTED Tue Mar 5 20:11:14 2013 From: yilmazhuseyin@REDACTED (Huseyin Yilmaz) Date: Tue, 5 Mar 2013 21:11:14 +0200 Subject: [erlang-questions] pub-sub server implementation detail question. Message-ID: Hi I was checking the source code for kraken (https://github.com/Asana/kraken). I realized that this pub sub server was implemented by using gen_server behavior. But when I think about a pub-sub server, I would definitely choose to use gen_event behavior I think gen_event behavior solves this kind of problems very well. I was wondering if there is a reason for not using gen_event behavior for pub-sub server that I am not aware of? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan@REDACTED Tue Mar 5 20:36:03 2013 From: dan@REDACTED (Daniel Dormont) Date: Tue, 5 Mar 2013 14:36:03 -0500 Subject: [erlang-questions] compile for R14B from R15B Message-ID: Hi all, I have R15B running on my local machine (installed with MacPorts, I can't figure out how to downgrade) but I need to be able to deploy to my development servers which are running R14B. Is there any way with erlc to "cross-compile" (I know that's not the right word, but I haven't had luck with Professor Google so far) in an installation of R15B to deploy my code on R14B? thanks, Dan From hq@REDACTED Tue Mar 5 21:17:13 2013 From: hq@REDACTED (Adam Rutkowski) Date: Tue, 5 Mar 2013 21:17:13 +0100 Subject: [erlang-questions] compile for R14B from R15B In-Reply-To: References: Message-ID: <1E1D2666-87E0-480B-AD39-75202A7FF9A2@mtod.org> On 5 Mar 2013, at 20:36, Daniel Dormont wrote: > Hi all, > > I have R15B running on my local machine (installed with MacPorts, I > can't figure out how to downgrade) but I need to be able to deploy to > my development servers which are running R14B. Is there any way with > erlc to "cross-compile" (I know that's not the right word, but I > haven't had luck with Professor Google so far) in an installation of > R15B to deploy my code on R14B? I use kerl [1] to build various releases and easily switch between them. [1] https://github.com/spawngrid/kerl -- Adam From dmkolesnikov@REDACTED Tue Mar 5 21:26:04 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 5 Mar 2013 22:26:04 +0200 Subject: [erlang-questions] pub-sub server implementation detail question. In-Reply-To: References: Message-ID: <7114CCFF-947D-48B4-82C9-FFA437A4B0D3@gmail.com> Hello, Here is copy-past from documentation. -- CLIP -- A gen_event manager is the process that registers callbacks. It is very important to understand that all events dispatched by the event manager process to event handlers execute in the context of the event manager process. -- CLIP -- If you implement PubSub via gen_event then all you subscriber handlers are executed within dispatcher process. This is not good. you would end-up implementing an gen_event handler as a proxy to your subscriber. Why to bother if ten_server can be used directly. - Dmitry On Mar 5, 2013, at 9:11 PM, Huseyin Yilmaz wrote: > Hi > I was checking the source code for kraken (https://github.com/Asana/kraken). I realized that this pub sub server was implemented by using gen_server behavior. But when I think about a pub-sub server, I would definitely choose to use gen_event behavior I think gen_event behavior solves this kind of problems very well. I was wondering if there is a reason for not using gen_event behavior for pub-sub server that I am not aware of? > _______________________________________________ > 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 Mar 5 21:37:18 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 5 Mar 2013 20:37:18 +0000 Subject: [erlang-questions] pub-sub server implementation detail question. In-Reply-To: <7114CCFF-947D-48B4-82C9-FFA437A4B0D3@gmail.com> References: <7114CCFF-947D-48B4-82C9-FFA437A4B0D3@gmail.com> Message-ID: On 5 Mar 2013, at 20:26, Dmitry Kolesnikov wrote: > If you implement PubSub via gen_event then all you subscriber handlers are executed within dispatcher process. This is not good. you would end-up implementing an gen_event handler as a proxy to your subscriber. Why to bother if ten_server can be used directly. Not to mention the fact that if a gen_event handler crashes, it is silently and unceremoniously removed. See add_sup_handler for a way around that old chestnut. :) Cheers, Tim From dmkolesnikov@REDACTED Tue Mar 5 21:55:49 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 5 Mar 2013 22:55:49 +0200 Subject: [erlang-questions] pub-sub server implementation detail question. In-Reply-To: References: <7114CCFF-947D-48B4-82C9-FFA437A4B0D3@gmail.com> Message-ID: <24A32996-6B92-4FC9-8D37-808A256888D5@gmail.com> Yep, this is another headache? You have to write a gen_server that acts as "supervisor" for that event_handler... - Dmitry On Mar 5, 2013, at 10:37 PM, Tim Watson wrote: > On 5 Mar 2013, at 20:26, Dmitry Kolesnikov wrote: >> If you implement PubSub via gen_event then all you subscriber handlers are executed within dispatcher process. This is not good. you would end-up implementing an gen_event handler as a proxy to your subscriber. Why to bother if ten_server can be used directly. > > Not to mention the fact that if a gen_event handler crashes, it is silently and unceremoniously removed. See add_sup_handler for a way around that old chestnut. :) > > Cheers, > Tim From zabrane3@REDACTED Tue Mar 5 23:45:40 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 5 Mar 2013 23:45:40 +0100 Subject: [erlang-questions] Equivalent C call (in erl_driver) to the NIF enif_inspect_iolist_as_binary? Message-ID: <4786285E-7DE0-4628-B508-6093D35992B0@gmail.com> Hi guys, I'm wondering if there's an equivalent C function (in erl_driver) to the NIF call "enif_inspect_iolist_as_binary": http://www.erlang.org/doc/man/erl_nif.html#enif_inspect_iolist_as_binary I'd like to quickly concatenate some ErlDrvBinary(s) in my linked-in driver. Currently, I'm doing a lot of copying (+freeing) to get the job done. Maybe there's a clever alternative to that. Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Wed Mar 6 00:30:27 2013 From: co7eb@REDACTED (=?UTF-8?Q?Ivan_Carmenates_Garc=C3=ADa?=) Date: Tue, 5 Mar 2013 18:30:27 -0500 Subject: [erlang-questions] RV: Joe (final) Message-ID: <001a01ce19f9$6fe039c0$4fa0ad40$@frcuba.co.cu> De: Ivan Carmenates Garc?a [mailto:co7eb@REDACTED] Enviado el: martes, 05 de marzo de 2013 18:28 Para: 'Danil Zagoskin' Asunto: RE: [erlang-questions] Joe (final) Hi, Danil, Joe, Richard, Well I think I finally did understand. The most tricky part was the swapping of the values. Here?s my understanding? First I came up with an idea I tried this (it was before reading the Richard?s email lol) [[H,T] || H<-[1,2,3], T<-[1,2,3]] and I could see that list of comprehension behave like nested for loops in imperative programming because it generate pair of numbers like this [[1,1],[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]] So the most outer loop (the first generator) iterates only when the most inner loop (lasted generator) does the complete cycle. Now what list of comprehension does is that combines each item of the outer loop (first generator) with all the items of the second generator (inner loop) that?s why the head remains in many steps, like Joe says that I can stick for example the number 1 in each permutation of the rest of the list, and so on with the rest of the items in the list. perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. Example: perms([1,2,3,4])-> [ 1 | [ 2 | [ 3 | [ 4 | [[]] ] ] ] ] here the first recursive journey ends by returning an empty list within a list [[]]. So the value [[4]] is yielded Now the rolling back stands in the call to perms([3,4]) where the [[3,4]] list is emitted, [ H|T || H<-[3,4], T<-perms([4]) (this yield [[4]] ) ] (this yield [[3,4]]) So now the first generator has to advance to the second value in the list [3,4], because no more recursive call are made until now, and the second generator only has one value (4) to yield, so the next value to yield for the first generator in the list [3,4] is 4, so H = 4, T = perms([3]) (which yield [[3]]) leading to the list L? = [[4, 3]] here is where the swap is made, that?s the part that I couldn?t understand before. So because there is no other value to retrieve in H from the list [3,4] the evaluation of the comprehension list the and call to the function perms([3,4]) has ended yielding the list [[3,4], [4,3]] and rolling back to the call of perms([2,3,4]) and so on? I?m alright? At least a fifty percent? Danil?s last debug info really helped me to understand the last part. So Thanks all of you, for your help and time, uff it was really hard but finally I could archive knew knowledge that I hope will never forget. ? well that is if my understanding was at least fifty percent right! Lol. -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Wed Mar 6 01:22:18 2013 From: norton@REDACTED (=?utf-8?B?44OO44O844OI44OzIOOCuOODp+ODvOOCu+ODlSDjgqbjgqfjgqQg?= =?utf-8?B?44Oz?=) Date: Wed, 6 Mar 2013 09:22:18 +0900 Subject: [erlang-questions] Equivalent C call (in erl_driver) to the NIF enif_inspect_iolist_as_binary? In-Reply-To: <4786285E-7DE0-4628-B508-6093D35992B0@gmail.com> References: <4786285E-7DE0-4628-B508-6093D35992B0@gmail.com> Message-ID: <790E64BA-655C-4F09-8C52-824DA6A5A501@lovely.email.ne.jp> Zabrane - You will more than likely have to write your own function. Please see the following link for a related thread of discussion with the OTP team: http://erlang.org/pipermail/erlang-patches/2011-October/002431.html The links contained in the above thread have been moved to the following location: https://github.com/norton/lets/blob/master/c_src/lets_impl_drv_lib.cc#L410 https://github.com/norton/lets/blob/master/c_src/lets_impl_drv.cc#L515 regards, Joe N. On Mar 6, 2013, at 07:45 , Zabrane Mickael wrote: > Hi guys, > > I'm wondering if there's an equivalent C function (in erl_driver) to the NIF call "enif_inspect_iolist_as_binary": > http://www.erlang.org/doc/man/erl_nif.html#enif_inspect_iolist_as_binary > > I'd like to quickly concatenate some ErlDrvBinary(s) in my linked-in driver. > Currently, I'm doing a lot of copying (+freeing) to get the job done. > Maybe there's a clever alternative to that. > > 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 Mar 6 01:30:55 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 6 Mar 2013 01:30:55 +0100 Subject: [erlang-questions] Equivalent C call (in erl_driver) to the NIF enif_inspect_iolist_as_binary? In-Reply-To: <790E64BA-655C-4F09-8C52-824DA6A5A501@lovely.email.ne.jp> References: <4786285E-7DE0-4628-B508-6093D35992B0@gmail.com> <790E64BA-655C-4F09-8C52-824DA6A5A501@lovely.email.ne.jp> Message-ID: Interesting Joe. Thx. Regards, Zabrane On Mar 6, 2013, at 1:22 AM, ???? ????? ??? ? wrote: > > Zabrane - > > You will more than likely have to write your own function. > > Please see the following link for a related thread of discussion with the OTP team: > > http://erlang.org/pipermail/erlang-patches/2011-October/002431.html > > The links contained in the above thread have been moved to the following location: > > https://github.com/norton/lets/blob/master/c_src/lets_impl_drv_lib.cc#L410 > https://github.com/norton/lets/blob/master/c_src/lets_impl_drv.cc#L515 > > regards, > > Joe N. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Wed Mar 6 10:37:16 2013 From: pan@REDACTED (Patrik Nyblom) Date: Wed, 6 Mar 2013 10:37:16 +0100 Subject: [erlang-questions] Nested match specifications? In-Reply-To: <51361B9C.6020402@tecso.coop> References: <5134FCDF.30607@tecso.coop> <5136028A.6010004@erlang.org> <51361B9C.6020402@tecso.coop> Message-ID: <51370E4C.9070202@erlang.org> Hi! On 03/05/2013 05:21 PM, Diego Llarrull wrote: > Ivan, Patrik: > > Thank you both for the swift replies! Both provided functions that > yield the desired results. The functions are: > > (I) ets:match(table, {"Peter", [{"children", '$1'},'_'] }). > (Ivan's) > (II) ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> > Data end)). (Patrick's) > > (II) is effectively rendered to > > ets:select(xxx,[{{"Peter",{"children",'$1'}},[],['$1']}]) > Well, it's rendered to ets:select(xxx,[{{"Peter",[{"children",'$1'}|'_']},[],['$1']}]) i.e. it matches an arbitrary long list as long as the first element is a tuple of two elements having a first element of "children". ets:fun2ms happens at compile time (parse transform), so it's no problem performance-wise. However, designing the table so that you have lists with certain fields in known positions seems error prone, I think using lists:keyfind on the result would be a better idea. If you worry about performance, the first thing you should do is to replace the list strings with binaries (UTF-8 binaries preferably). Matching a list means walking through the cons cells and is slightly heavier than matching a binary. Binaries are also more compact. You should also have tags like "children" as atoms, not lists. If the number of possible fields is known in advance (which it would be if you know the positions, or?) you could use tuples (or records) instead of lists. With records you also are able to avoid the lists:keyfind. It all depends on your application of course. > which is pretty similar to Ivan's suggestion. My final question (and I > so promise) is: it appears to me that (I) performs better than (II) > because of the lack of need of a transformation function such as > ets:fun2ms(). However, I don't known for sure whether ets:match() > outperforms ets:select() or not. I'm about to run a series of tests on > big datasets to check this, but I imagine that there is already an > answer to this question. > > Once again, thank you very much. > > Diego Cheers, /Patrik > > > El 05/03/13 11:34, Patrik Nyblom escribi?: >> Hi! >> On 03/04/2013 08:58 PM, Diego Llarrull wrote: >>> Hello everyone, >>> >>> I would like to insert in an ETS table a tuple with the following >>> type signature: >>> >>> /{string(), [{string(), [string()]}]}/ >>> >>> As an example: >>> / >>> //{"Peter", [{"children", ["Bob", "Paul"]}, {"father", ["Mike"]}]}// >>> >>> / >>> My question is the following: is it possible to solve, using match >>> specifications, nested queries like "Retrieve the name of Peter's >>> children" ? >>> >>> That is, a query where I would need to >>> >>> a) Fetch all ("the", since its a set) tuples of size 3 where "Peter" >>> is located in the first position (doable with MS) >>> b) Let '$2' be the value in the second position of the tuple fetched >>> in a). Then, fetch the value corresponding to the key "children" in >>> '$2', if interpreted as a key-value list (i.e. lists:keyfind() >>> should work on '$2'). >>> >>> If I understood correctly, lists:keyfind can't be used inside a >>> match specification because they only allow the BIFs described in >>> http://www.erlang.org/doc/apps/erts/match_spec.html. My question is: >>> is there any low-level mechanism to operate on lists inside match >>> specifications, or am I trying to push the boundaries of match >>> specifications? >>> >> Yes, you're trying to push the boundaries of match specifications :) >> >> You'll have to do a lists:keysearch/keyfind on the results of the >> ets:select (when you're back in proper Erlang code), only constant >> time BIF's can be added to the ms language, so it's unfortunately not >> even an option to add this particular function... Without a huge >> rewrite that is... >> >> So... >> [lists:keyfind("children",1,P) || P <- >> ets:select(xxx,ets:fun2ms(fun({"Peter",Data}) -> Data end))]. >> would be the solution. Except of course if the list has a particular >> order, or you instead use some record'ish data structure, so that you >> can match directly: >> ets:select(xxx,ets:fun2ms(fun({"Peter",[{"children",Data}|_]}) -> >> Data end)). >> But looping over the list inside the ms is not possible. >>> In case anyone wonders "Why not use Query Lists Comprehensions?" the >>> answer is: "Because of performance issues: in our platform, we need >>> to dynamically build QLCs based on the number of arguments that >>> arrive, which forces us to build them as strings and then use >>> qlc:string_to_handle() which is SLOW". >>> >>> Any help of insight will be greatly appreciated. Thank you very much >>> in advance. >>> >>> Diego Llarrull >>> >>> >> Cheers, >> /Patrik >>> >>> >>> >>> _______________________________________________ >>> 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 yilmazhuseyin@REDACTED Wed Mar 6 10:53:46 2013 From: yilmazhuseyin@REDACTED (Huseyin Yilmaz) Date: Wed, 6 Mar 2013 11:53:46 +0200 Subject: [erlang-questions] pub-sub server implementation detail question. In-Reply-To: <24A32996-6B92-4FC9-8D37-808A256888D5@gmail.com> References: <7114CCFF-947D-48B4-82C9-FFA437A4B0D3@gmail.com> <24A32996-6B92-4FC9-8D37-808A256888D5@gmail.com> Message-ID: It seems to me like gen_event is implemented as message proxy. We send a new event, and gen_event calls all the handlers. Handlers sends multiplies messages to actual receivers. So what gen_event actually does is to multiply messages in another process context so actual event generator process does not spend time with generating messages. According to this perspective. gen_event code should be as little as possible (no calculation, only message sending code.). Does that sound about right? On Tue, Mar 5, 2013 at 10:55 PM, Dmitry Kolesnikov wrote: > Yep, this is another headache? > You have to write a gen_server that acts as "supervisor" for that > event_handler... > > - Dmitry > > On Mar 5, 2013, at 10:37 PM, Tim Watson wrote: > > > On 5 Mar 2013, at 20:26, Dmitry Kolesnikov wrote: > >> If you implement PubSub via gen_event then all you subscriber handlers > are executed within dispatcher process. This is not good. you would end-up > implementing an gen_event handler as a proxy to your subscriber. Why to > bother if ten_server can be used directly. > > > > Not to mention the fact that if a gen_event handler crashes, it is > silently and unceremoniously removed. See add_sup_handler for a way around > that old chestnut. :) > > > > Cheers, > > Tim > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed Mar 6 11:28:35 2013 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 6 Mar 2013 11:28:35 +0100 Subject: [erlang-questions] RV: Joe (final) In-Reply-To: <001a01ce19f9$6fe039c0$4fa0ad40$@frcuba.co.cu> References: <001a01ce19f9$6fe039c0$4fa0ad40$@frcuba.co.cu> Message-ID: There are two ways of thinking about recursion: 1) Try to mentally execute the program 2) Assume the program works, and look for a reduction step that reduces the size of the argument and a base case If you look at perms: perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])]. There is a base case perms([]) the call to perms(L) involves a call to perms(L -- [H]) so there is a reduction step. If you call perms(L) it will call perms(L--[H]) which is a smaller argument than L. So for each call to perms the size of the agument is reduced. Eventually it will reach the base case [] and so it terminates. Understanding recursion through method 1) (mental execution of the program) is terrible - your brain goes into a recursive loop. Often method 2) is much easier. Just check that the argument is reduced and that it will eventually reach the base case and that each reduction step is correct. Cheers /Joe On Wed, Mar 6, 2013 at 12:30 AM, Ivan Carmenates Garc?a wrote: > ** ** > > ** ** > > *De:* Ivan Carmenates Garc?a [mailto:co7eb@REDACTED] > *Enviado el:* martes, 05 de marzo de 2013 18:28 > *Para:* 'Danil Zagoskin' > *Asunto:* RE: [erlang-questions] Joe (final)**** > > ** ** > > Hi, Danil, Joe, Richard,**** > > ** ** > > Well I think I finally did understand. The most tricky part was the > swapping of the values.**** > > ** ** > > Here?s my understanding? **** > > ** ** > > First I came up with an idea I tried this (it was before reading the > Richard?s email lol)**** > > ** ** > > [[H,T] || H<-[1,2,3], T<-[1,2,3]] **** > > ** ** > > and I could see that list of comprehension behave like nested for loops in > imperative programming because it generate pair of numbers like this**** > > ** ** > > [[1,1],[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]]**** > > ** ** > > So the most outer loop (the first generator) iterates only when the most > inner loop (lasted generator) does the complete cycle. Now what list of > comprehension does is that combines each item of the outer loop (first > generator) with all the items of the second generator (inner loop) that?s > why the head remains in many steps, like Joe says that I can stick for > example the number 1 in each permutation of the rest of the list, and so on > with the rest of the items in the list. **** > > ** ** > > perms([]) -> [[]];**** > > perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].**** > > ** ** > > Example:**** > > ** ** > > perms([1,2,3,4])->**** > > [ 1 | [ 2 | [ 3 | [ 4 | [[]] ] ] ] ] here the first recursive > journey ends by returning an empty list within a list [[]]. So the value > [[4]] is yielded **** > > Now the rolling back stands in the call to perms([3,4]) where the [[3,4]] > list is emitted, [ H|T || H<-[3,4], T<-perms([4]) (this yield [[4]] ) ] > (this yield [[3,4]])**** > > So now the first generator has to advance to the second value in the list > [3,4], because no more recursive call are made until now, and the second > generator**** > > only has one value (4) to yield, so the next value to yield for the first > generator in the list [3,4] is 4, so H = 4, T = perms([3]) (which yield > [[3]]) leading to the**** > > list L? = [[4, 3]] here is where the swap is made, that?s the part that I > couldn?t understand before. So because there is no other value to retrieve > in H from the**** > > list [3,4] the evaluation of the comprehension list the and call to the > function perms([3,4]) has ended yielding the list [[3,4], [4,3]] and > rolling back to the call**** > > of perms([2,3,4]) and so on?**** > > ** ** > > I?m alright? At least a fifty percent?**** > > ** ** > > ** ** > > Danil?s last debug info really helped me to understand the last part.**** > > ** ** > > So Thanks all of you, for your help and time, uff it was really hard but > finally I could archive knew knowledge that I hope will never forget.**** > > ? well that is if my understanding was at least fifty percent right! Lol.* > *** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve@REDACTED Wed Mar 6 12:47:10 2013 From: steve@REDACTED (Steve Strong) Date: Wed, 6 Mar 2013 12:47:10 +0100 Subject: [erlang-questions] R16A binary packages for CentOS, Debian, Mac, Ubuntu and Windows In-Reply-To: References: <20130130165902.GA22351@dex.krakow> <20130131124255.GC28211@dex.krakow> Message-ID: <67BA9AB5B90849CA89FB48DAE3502F3A@srstrong.com> Ditto - any news on a fix? Cheers, Steve -- Steve Strong Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, 5 March 2013 at 05:55, Hanfei Shen wrote: > Hi, > > I have this problem too with R16B on my OS X 10.8.2. > > > Erlang R16B (erts-5.10.1) [source-05f1189] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] > > > > Eshell V5.10.1 (abort with ^G) > > 1> observer:start(). > > > > =ERROR REPORT==== 5-Mar-2013::12:43:01 === > > WX Failed loading "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" > > {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, > > [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, > > {wx,new,1,[{file,"wx.erl"},{line,114}]}, > > {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, > > {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, > > {proc_lib,init_p_do_apply,3, > > [{file,"proc_lib.erl"},{line,239}]}]}} > > > Thanks, > Hanfei > > ? 2013?1?31????UTC+8??8?42?56??Karol Urbanski??? > > Hi, > > There was a problem with linked dynamic libraries in yesterday's R16A 32-bit > > release. We've fixed this already, so try to download the package for your Mac > > again. If the problem persists, please let us know. > > > > Best regards, > > Karol Urbanski > > > > On Thu, Jan 31, 2013 at 11:15:07AM +0000, Adrian Roe wrote: > > > I'm really excited about having access to observer etc on my Mac :) ? > > > > > > ? but not entirely plain sailing getting observer to run (trace below). Am I being stupid? > > > > > > Thanks for your help. > > > > > > Adrian > > > > > > -- > > > Adrian Roe > > > Sent with Sparrow > > > > > > > > > > > > 4> observer:start(). > > > {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, > > > [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, > > > {wx,new,1,[{file,"wx.erl"},{line,114}]}, > > > {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, > > > {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, > > > {proc_lib,init_p_do_apply,3, > > > [{file,"proc_lib.erl"},{line,239}]}]}} > > > 5> > > > =ERROR REPORT==== 31-Jan-2013::11:10:42 === > > > WX Failed loading "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" > > > > > > On Wednesday, 30 January 2013 at 16:59, Karol Urbanski wrote: > > > > > > Hello, > > > You can find our binary packages for the newest Erlang release (R16A) at > > > http://www.erlang-solutions.com/downloads/download-erlang-otp > > > The systems we provide the packages for are CentOS 6, Mac OS X Snow > > > Leopard and newer, Debian 6, Ubuntu 12.10 and Windows. More systems to > > > come soon! > > > Best regards, > > > Karol Urbanski > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-q...@REDACTED (javascript:) > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-q...@REDACTED (javascript:) > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > 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 bezirg@REDACTED Wed Mar 6 13:06:13 2013 From: bezirg@REDACTED (Nikolaos Bezirgiannis) Date: Wed, 6 Mar 2013 13:06:13 +0100 Subject: [erlang-questions] EDoc Callback suggestion Message-ID: Hello, this is not really a question, more of a suggestion. According to this post < http://erlang.org/pipermail/erlang-patches/2012-July/002912.html> , EDoc >= 0.7.10 can list the callback functions of an OTP module (custom or non-custom). Why not go further and list also their type specifications? Regards, Nikos -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson@REDACTED Wed Mar 6 15:23:07 2013 From: s.j.thompson@REDACTED (Simon Thompson) Date: Wed, 6 Mar 2013 14:23:07 +0000 Subject: [erlang-questions] Commercial Users of Functional Programming: Call for tutorials Message-ID: <7E9DC07C-4229-4E8F-8C1C-A5B70246F05A@kent.ac.uk> Commercial Users of Functional Programming Call for tutorials Commercial Users of Functional Programming (CUFP) is an annual meeting co-located with the International Conference on Functional Programming which this year will take place in Boston, MA, USA on 22-24 September 2013. CUFP aims to bridge the gap between academia and users applying functional programming in practice. CUFP provides high-quality practical tutorials covering state-of-the-art techniques and tools for functional programming. We are seeking proposals for half-day tutorials to be presented during the first two days of the meeting, 22 and 23 September, with the main CUFP session on 24 September. Among the suggested topics for tutorials are: - Introductions to functional programming languages: in the past we have had introductions to Clojure, Erlang, F#, Haskell, ML, OCaml, Scala, Scheme and others. - Applying functional programming in particular areas, including the web, high-performance computing, finance. - Tools and techniques supporting state of the art functional programming. Tutorial proposals should address the following points - Title - Abstract (about 100 words) - Goals: by the end of this tutorial you will be able to ? - Intended audience: e.g. beginners, those with a working knowledge of X, ? - Infrastructure required: For example, - will participants need access to a particular system? - can they be expected to have this on a laptop, or does it need to be provided by the meeting? and should be sent by email to - Francesco Cesarini: francesco@REDACTED - Simon Thompson: S.J.Thompson@REDACTED by 31 March 2013. 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 tristan.sloughter@REDACTED Wed Mar 6 16:32:59 2013 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Wed, 6 Mar 2013 09:32:59 -0600 Subject: [erlang-questions] Postgres Client Message-ID: Using epgsql I recently had a crash in pgsql_connection that I am not yet sure of a good way to reproduce to test possible solutions, https://github.com/wg/epgsql/issues/25 So I decided to look around forks and issues and pull requests on the original repo for epgsql that I was using and found: https://github.com/wg/epgsql/network https://github.com/wg/epgsql/pulls I thought I'd try sending a call out to everyone with a fork about trying to get all the improvements merged into a single repo. Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mallen@REDACTED Wed Mar 6 17:10:51 2013 From: mallen@REDACTED (Mark Allen) Date: Wed, 6 Mar 2013 10:10:51 -0600 Subject: [erlang-questions] [ANN] erlbrew - bash script to help automate side-by-side Erlang installs on OS X Message-ID: The purpose of erlbrew is intended to help automate side-by-side Erlang installations (on OS X only for the moment) and about 30 minutes after I published it on github, I came across kerl (https://www.github.com/spawngrid/kerl) which is basically the same idea but with far more panache and features. I made erlbrew to scratch an itch I'd been feeling for a while at my $DAYJOB. I tried searching high and low for a tool which did this automation, and although I tried a bunch of different queries on $SEARCH_ENGINE, I never found anything especially helpful for automating Erlang builds from tarball on down especially when you wanted to install a bunch of different Erlang releases and switch between them for various purposes. Oh well, maybe someone else will find erlbrew useful or maybe it will suit their way of thinking about this problem better than kerl. One major difference is the user is in charge of munging a shell $PATH instead of leaving it up to the tool. So if you don't like automation mucking around with your shell environment, maybe erlbrew is for you. https://www.github.com/mrallen1/erlbrew Pull requests are very welcome too. Thank you. Mark From watson.timothy@REDACTED Wed Mar 6 17:25:30 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 6 Mar 2013 16:25:30 +0000 Subject: [erlang-questions] [ANN] erlbrew - bash script to help automate side-by-side Erlang installs on OS X In-Reply-To: References: Message-ID: I did exactly the same thing a while before I knew about kerl - https://github.com/hyperthunk/evm/blob/master/evm. Mine doesn't even download/install, as I have a tendency to install OTP from git/source rather than the source tarballs. Funnily enough, a couple of weeks ago I wrote something similar for Haskell/GHC - https://github.com/hyperthunk/bashtools/blob/master/utilities/ghc-env. Maybe one day someone will build a nice tool that can be configured to do this for any underlying tool chain, rather than having rvm, rbenv, virtualenv, cabal-dev, kerl, etc etc... :) On 6 Mar 2013, at 16:10, Mark Allen wrote: > The purpose of erlbrew is intended to help automate side-by-side Erlang > installations (on OS X only for the moment) and about 30 minutes after I > published it on github, I came across kerl > (https://www.github.com/spawngrid/kerl) which is basically the same idea > but with far more panache and features. > > > I made erlbrew to scratch an itch I'd been feeling for a while at my > $DAYJOB. I tried searching high and low for a tool which did this > automation, and although I tried a bunch of different queries on > $SEARCH_ENGINE, I never found anything especially helpful for automating > Erlang builds from tarball on down especially when you wanted to install a > bunch of different Erlang releases and switch between them for various > purposes. > > Oh well, maybe someone else will find erlbrew useful or maybe it will suit > their way of thinking about this problem better than kerl. One major > difference is the user is in charge of munging a shell $PATH instead of > leaving it up to the tool. So if you don't like automation mucking around > with your shell environment, maybe erlbrew is for you. > > https://www.github.com/mrallen1/erlbrew > > Pull requests are very welcome too. > > Thank you. > > Mark > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mallen@REDACTED Wed Mar 6 17:36:43 2013 From: mallen@REDACTED (Mark Allen) Date: Wed, 6 Mar 2013 10:36:43 -0600 Subject: [erlang-questions] [ANN] erlbrew - bash script to help automate side-by-side Erlang installs on OS X In-Reply-To: Message-ID: I sort of hope that someone with a lot of Google reputation will at least blog about kerl or whatever because it does NOT show up in the results list in the first several suggestions. There probably could be some kind of "grand unified builder tool" though - interesting idea! Mark On 3/6/13 10:25 AM, "Tim Watson" wrote: >I did exactly the same thing a while before I knew about kerl - >https://github.com/hyperthunk/evm/blob/master/evm. Mine doesn't even >download/install, as I have a tendency to install OTP from git/source >rather than the source tarballs. Funnily enough, a couple of weeks ago I >wrote something similar for Haskell/GHC - >https://github.com/hyperthunk/bashtools/blob/master/utilities/ghc-env. > >Maybe one day someone will build a nice tool that can be configured to do >this for any underlying tool chain, rather than having rvm, rbenv, >virtualenv, cabal-dev, kerl, etc etc... :) > >On 6 Mar 2013, at 16:10, Mark Allen wrote: > >> The purpose of erlbrew is intended to help automate side-by-side Erlang >> installations (on OS X only for the moment) and about 30 minutes after I >> published it on github, I came across kerl >> (https://www.github.com/spawngrid/kerl) which is basically the same idea >> but with far more panache and features. >> >> >> I made erlbrew to scratch an itch I'd been feeling for a while at my >> $DAYJOB. I tried searching high and low for a tool which did this >> automation, and although I tried a bunch of different queries on >> $SEARCH_ENGINE, I never found anything especially helpful for automating >> Erlang builds from tarball on down especially when you wanted to >>install a >> bunch of different Erlang releases and switch between them for various >> purposes. >> >> Oh well, maybe someone else will find erlbrew useful or maybe it will >>suit >> their way of thinking about this problem better than kerl. One major >> difference is the user is in charge of munging a shell $PATH instead of >> leaving it up to the tool. So if you don't like automation mucking >>around >> with your shell environment, maybe erlbrew is for you. >> >> https://www.github.com/mrallen1/erlbrew >> >> Pull requests are very welcome too. >> >> Thank you. >> >> Mark >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Wed Mar 6 17:44:34 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 6 Mar 2013 16:44:34 +0000 Subject: [erlang-questions] [ANN] erlbrew - bash script to help automate side-by-side Erlang installs on OS X In-Reply-To: References: Message-ID: <3A80C3F0-4980-4099-8A32-5D1DB82D9D2B@gmail.com> On 6 Mar 2013, at 16:36, Mark Allen wrote: > > There probably could be some kind of "grand unified builder tool" though - > interesting idea! > I had some ideas about building this, and almost made a start. I was planning to write a command line tool that would delegate to whatever tool chain you like, to do package management (with apt/yum, or agner, or cabal, or npm, etc) or build (make, rake, ant, maven, gradle, rebar, cabal, etc) and so on and so forth. The idea was that you instruct it how to manage a tool and then how to recognise (or be told on invocation) that it should be used - e.g., if it sees '.git' in the current directory then commands which are linked to (i.e., configured for) SCM will use git rather than mercurial/darcs/subversion/etc. Anyway, it's a fun idea, but I have no more 'spare time' to spare nowadays. :( Cheers, Tim From alisdairsullivan@REDACTED Thu Mar 7 00:29:43 2013 From: alisdairsullivan@REDACTED (alisdair s) Date: Wed, 6 Mar 2013 15:29:43 -0800 Subject: [erlang-questions] Fwd: [ANN] erlbrew - bash script to help automate side-by-side Erlang installs on OS X References: <57FCA78E-CD5B-4498-A51F-B6BDF529E1D1@yahoo.ca> Message-ID: <92085820-CBE2-42B9-B076-FF033581AD6B@yahoo.ca> > when i wanted something more lightweight i forked https://github.com/sstephenson/rbenv > it can be found at https://github.com/talentdeficit/erlenv > >> The purpose of erlbrew is intended to help automate side-by-side Erlang >> installations (on OS X only for the moment) and about 30 minutes after I >> published it on github, I came across kerl >> (https://www.github.com/spawngrid/kerl) which is basically the same idea >> but with far more panache and features. From co7eb@REDACTED Thu Mar 7 00:35:06 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Wed, 6 Mar 2013 18:35:06 -0500 Subject: [erlang-questions] about iOS and Erlang Message-ID: <000a01ce1ac3$40ab8310$c2028930$@frcuba.co.cu> Hello, I know this is a little bit far from the subject, but I need some help, first I would like to know if having the actual source code of Erlang there will be a difficult task to compile Erlang for iOS, I wish to know if it is because there is no compiler from the programming language in which Erlang source code is implemented to iOS or if that is because of the license imposition that Apple gives. That would be a big one, because there are Android devices, and Windows Phone OS (this don't count) and of course Apple Devices, (and others... (this neither count)). So I can't wait to have an Erlang process running on my iPhone. I think that will not hurt at all, I think. And the other thing, this is the one that get far from the subject, I have an iPhone 4 and it is locked I mean is already jail'breaked but still have no line. But someone told me that to unlock it to support the line of my country I have to unlock it from Canada paying some money and bla bla. I don't have the necessity to complain because it was a gif, so my point is, today I was looking in its internal file system and I found this funny folder /System/Library/Carrier Bundles/iPhone, there are all the company Carriers, the default Carrier in my iPhone is fido, and is there in that folder too, So my local Carrier is CUBACEL and of course it is not in the folder, but I have a friend who has an iPhone 4s already unlocked with support for our local Carrier line, so I guess he has a CUBACEL Carrier in the funny folder. So my question is there is someone of you which know something about that, exist any programming way to unlock my iPhone 4, maybe copying my friend's Carrier from the funny folder to my funny folder and do maybe anther modification to some config xml file? Regards, Ivan. From jesper.louis.andersen@REDACTED Thu Mar 7 09:54:39 2013 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 7 Mar 2013 09:54:39 +0100 Subject: [erlang-questions] Postgres Client In-Reply-To: References: Message-ID: <8097188F-9533-4EB6-9A01-5146CD68EE86@erlang-solutions.com> On Mar 6, 2013, at 4:32 PM, Tristan Sloughter wrote: > Using epgsql I recently had a crash in pgsql_connection that I am not yet sure of a good way to reproduce to test possible solutions, https://github.com/wg/epgsql/issues/25 > > So I decided to look around forks and issues and pull requests on the original repo for epgsql that I was using and found: > > https://github.com/wg/epgsql/network > > https://github.com/wg/epgsql/pulls > > I thought I'd try sending a call out to everyone with a fork about trying to get all the improvements merged into a single repo. > This would be awesome to have IMO. A merger could help a lot on some of the code base I have. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From 249505968@REDACTED Thu Mar 7 08:27:18 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Thu, 7 Mar 2013 15:27:18 +0800 Subject: [erlang-questions] How to use erlang with sublime text? Message-ID: I've install sublime-erlang,sublime-erl,ctags for erlang. It's there any other good package or setting for sublime text? It's there any good cscope-like plugin for erlang ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Thu Mar 7 10:11:47 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Thu, 7 Mar 2013 17:11:47 +0800 Subject: [erlang-questions] Which choice is better? Function or Case Message-ID: I wonder if Function call is better than Case when both of they can implement the target I want? It seems like write a function instead of case could make the code more clear . But which one is fast when it running? I intend to change the case to function to make the code more clear. Is this valuable? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mabrek@REDACTED Thu Mar 7 10:13:10 2013 From: mabrek@REDACTED (Anton Lebedevich) Date: Thu, 07 Mar 2013 13:13:10 +0400 Subject: [erlang-questions] Postgres Client In-Reply-To: References: Message-ID: <51385A26.9060604@gmail.com> On 03/06/2013 07:32 PM, Tristan Sloughter wrote: > Using epgsql I recently had a crash in pgsql_connection that I am not > yet sure of a good way to reproduce to test possible > solutions, https://github.com/wg/epgsql/issues/25 Timeout support is incomplete in wg/epgsql. I'm supporting experimental asynchronous reimplementation of epgsql at: https://github.com/mabrek/epgsql Timeouts are hard, there are a lot of corner cases in state synchronization between server point of view and driver's one. I made 2 attempts to implement them properly and both failed. So my fork doesn't support timeouts too. Regards, Anton Lebedevich. From bengt.kleberg@REDACTED Thu Mar 7 10:26:34 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 7 Mar 2013 10:26:34 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: <1362648394.4772.26.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Another point in favor of functions is that they can be traced with ttb/dbg module. If you worry about code speed you can first make a simple, understandable, solution, then time/profile it. bengt On Thu, 2013-03-07 at 17:11 +0800, ?? wrote: > I wonder if Function call is better than Case when both of they can > implement the target I want? > It seems like write a function instead of case could make the code > more clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. > Is this valuable? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ivan@REDACTED Thu Mar 7 10:31:37 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Thu, 7 Mar 2013 09:31:37 +0000 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: <4CAA2413-82EE-464F-93F7-A745D8952839@llaisdy.com> Clarity is more important imho. Worry about making it faster only if it ever seems too slow (i.e., on testing, and only "optimise" the parts you need to). Ivan -- festina lente On 7 Mar 2013, at 09:11, "??" <249505968@REDACTED> wrote: > I wonder if Function call is better than Case when both of they can implement the target I want? > It seems like write a function instead of case could make the code more clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. Is this valuable? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From tyron.zerafa@REDACTED Thu Mar 7 11:14:51 2013 From: tyron.zerafa@REDACTED (Tyron Zerafa) Date: Thu, 7 Mar 2013 11:14:51 +0100 Subject: [erlang-questions] Let it crash + side effects Message-ID: Erlang is impure, functions do have side effects. So how does exactly the let it crash philosophy fit in Erlang? As far as I know Erlang does not employ any kind of atomic actions or roll back mechanisms. What is the best course of action to take for a failing function which has side effects? -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Thu Mar 7 12:04:12 2013 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 7 Mar 2013 12:04:12 +0100 Subject: [erlang-questions] Let it crash + side effects In-Reply-To: References: Message-ID: 2013/3/7 Tyron Zerafa : > Erlang is impure, functions do have side effects. So how does exactly the > let it crash philosophy fit in Erlang? > As far as I know Erlang does not employ any kind of atomic actions or roll > back mechanisms. Well, Erlang has mnesia transactions. > What is the best course of action to take for a failing > function which has side effects? I don't think you can have a general answer for this question - it depends on very much what the side effect is and what the failing function does. From magnus@REDACTED Thu Mar 7 12:48:45 2013 From: magnus@REDACTED (Magnus Henoch) Date: Thu, 07 Mar 2013 11:48:45 +0000 Subject: [erlang-questions] EDoc Callback suggestion In-Reply-To: (Nikolaos Bezirgiannis's message of "Wed, 6 Mar 2013 13:06:13 +0100") References: Message-ID: Nikolaos Bezirgiannis writes: > Hello, > > this is not really a question, more of a suggestion. > > According to this post < > http://erlang.org/pipermail/erlang-patches/2012-July/002912.html> > , EDoc >= 0.7.10 can list the callback functions of an OTP module (custom > or non-custom). > Why not go further and list also their type specifications? I keep thinking that this shouldn't be hard to do - just do the same parsing for -callback as for -type, and present it in the output. I haven't had time to look into it in detail though; it would definitely be a larger change than the one linked above. If anyone would find the time to work on this and submit a patch, I for one would be happy :) Meanwhile I document my behaviours with
,
and
. Regards, Magnus From diego.llarrull@REDACTED Thu Mar 7 13:23:27 2013 From: diego.llarrull@REDACTED (Diego Llarrull) Date: Thu, 07 Mar 2013 09:23:27 -0300 Subject: [erlang-questions] How to use erlang with sublime text? In-Reply-To: References: Message-ID: <513886BF.8040307@tecso.coop> Have you tried Sublime Text 3 beta releases? El 07/03/13 04:27, ?? escribi?: > I've install sublime-erlang,sublime-erl,ctags for erlang. > It's there any other good package or setting for sublime text? > It's there any good cscope-like plugin for erlang ? > > > _______________________________________________ > 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 Mar 7 14:43:05 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 07 Mar 2013 14:43:05 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments Message-ID: <51389969.4050209@it.uu.se> In revising some HiPE test suites for bit syntax, I noticed some pattern matching with 0-sized segments. They can be illustrated by the following: Eshell V5.10.2 (abort with ^G) 1> <> = <<>>. <<>> 2> X. 0 I think this is interesting and some may consider the above pattern matching a bit weird, possibly preferring an exception instead. The documentation is mute about the presence of these 0-sized segments: http://www.erlang.org/doc/reference_manual/expressions.html#bit_syntax I think that they need to be explicitly mentioned there, possibly together with some rationale for their existence. Kostis From mononcqc@REDACTED Thu Mar 7 15:02:59 2013 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 7 Mar 2013 09:02:59 -0500 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <51389969.4050209@it.uu.se> References: <51389969.4050209@it.uu.se> Message-ID: <20130307140258.GA17984@ferdmbp.local> Agreed. There are also some fun issues related to this: 1. [X || <> <= <<1,2,3>>] 2. [X || <<_:0,X/binary>> <= <<1,2,3>>] Both of these list comprehensions end up being infinite loops. The second one also builds a list infinitely, and can make a node go out of memory. Maybe a compiler warning for explicit 0-length patterns followed by a /binary type (which ends up not moving forward?) would be nice. In fact, there's also a fun behaviour with the length of /binary that Yurii Rashkovskii found. In the shell: 1> [X || <<_:8, X/binary>> <= <<"tis a silly place">>]. [<<"is a silly place">>] Which I would expect. But from a compiled module using the same binary generator: 2> test:bc(). [<<"is a silly place">>,<<"s a silly place">>, <<" a silly place">>,<<"a silly place">>,<<" silly place">>, <<"silly place">>,<<"illy place">>,<<"lly place">>, <<"ly place">>,<<"y place">>,<<" place">>,<<"place">>, <<"lace">>,<<"ace">>,<<"ce">>,<<"e">>,<<>>] Now the X/binary pattern keeps on matching the entire binary, but only the _:8 pattern is consuming the binary, giving us repeated matching of the 'tail'. Yurii and I wondered which of the two behaviours was the 'correct' one. I personally do prefer the shell's way of doing things. Regards, Fred. On 03/07, Kostis Sagonas wrote: > In revising some HiPE test suites for bit syntax, I noticed some > pattern matching with 0-sized segments. They can be illustrated by > the following: > > Eshell V5.10.2 (abort with ^G) > 1> <> = <<>>. > <<>> > 2> X. > 0 > > I think this is interesting and some may consider the above pattern > matching a bit weird, possibly preferring an exception instead. > > The documentation is mute about the presence of these 0-sized segments: > > http://www.erlang.org/doc/reference_manual/expressions.html#bit_syntax > > I think that they need to be explicitly mentioned there, possibly > together with some rationale for their existence. > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From konrad.gadek@REDACTED Thu Mar 7 15:06:05 2013 From: konrad.gadek@REDACTED (Konrad =?utf-8?Q?G=C4=85dek?=) Date: Thu, 7 Mar 2013 14:06:05 +0000 (GMT) Subject: [erlang-questions] R16A binary packages for CentOS, Debian, Mac, Ubuntu and Windows In-Reply-To: <67BA9AB5B90849CA89FB48DAE3502F3A@srstrong.com> Message-ID: <1585353372.65860191.1362665165899.JavaMail.root@erlang-solutions.com> Hi Sorry for late answer (and duplicated mail). Currently we do not support wx on 64bit and there is a simple reason for that. For wx to work on 64bit OS X we'd have to prepare R16A/B packages using unstable development branch of wxWidgets 2.9. Our package-generation process for Mac does not allow to use different environments for 32/64bit, so either 32bit only or both 32/64 but on unreliable lib. I've chosen the former because I believe it's better not to include unstable 'thing' in things like Erlang which must be very stable by default. On the other hand, I'm doing now some experiments on our development stack so to allow different environments for 32/64bit but can't give you any date. If it'll be successful, we'll consider pushing third R16B 64bit with wx working. Cheers, /Konrad G?dek ----- Original Message ----- From: "Steve Strong" To: erlang-programming@REDACTED, erlang-questions@REDACTED Sent: Wednesday, March 6, 2013 12:47:10 PM Subject: Re: [erlang-questions] R16A binary packages for CentOS, Debian, Mac, Ubuntu and Windows Ditto - any news on a fix? Cheers, Steve -- Steve Strong Sent with Sparrow On Tuesday, 5 March 2013 at 05:55, Hanfei Shen wrote: Hi, I have this problem too with R16B on my OS X 10.8.2. Erlang R16B (erts-5.10.1) [source-05f1189] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.1 (abort with ^G) 1> observer:start(). =ERROR REPORT==== 5-Mar-2013::12:43:01 === WX Failed loading "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, {wx,new,1,[{file,"wx.erl"},{line,114}]}, {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,239}]}]}} Thanks, Hanfei ? 2013?1?31????UTC+8??8?42?56??Karol Urbanski??? Hi, There was a problem with linked dynamic libraries in yesterday's R16A 32-bit release. We've fixed this already, so try to download the package for your Mac again. If the problem persists, please let us know. Best regards, Karol Urbanski On Thu, Jan 31, 2013 at 11:15:07AM +0000, Adrian Roe wrote: > I'm really excited about having access to observer etc on my Mac :) ? > > ? but not entirely plain sailing getting observer to run (trace below). Am I being stupid? > > Thanks for your help. > > Adrian > > -- > Adrian Roe > Sent with Sparrow > > > > 4> observer:start(). > {error,{{load_driver,"dlopen(/usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so, 2): Symbol not found: __ZN10wxBoxSizer11RecalcSizesEv\n Referenced from: /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so\n Expected in: flat namespace\n in /usr/local/lib/erlang/lib/wx-1.0/priv/wxe_driver.so"}, > [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]}, > {wx,new,1,[{file,"wx.erl"},{line,114}]}, > {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]}, > {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]}, > {proc_lib,init_p_do_apply,3, > [{file,"proc_lib.erl"},{line,239}]}]}} > 5> > =ERROR REPORT==== 31-Jan-2013::11:10:42 === > WX Failed loading "wxe_driver"@"/usr/local/lib/erlang/lib/wx-1.0/priv" > > On Wednesday, 30 January 2013 at 16:59, Karol Urbanski wrote: > > Hello, > You can find our binary packages for the newest Erlang release (R16A) at > http://www.erlang-solutions.com/downloads/download-erlang-otp > The systems we provide the packages for are CentOS 6, Mac OS X Snow > Leopard and newer, Debian 6, Ubuntu 12.10 and Windows. More systems to > come soon! > Best regards, > Karol Urbanski > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-q...@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 pguyot@REDACTED Thu Mar 7 16:33:46 2013 From: pguyot@REDACTED (Paul Guyot) Date: Thu, 7 Mar 2013 16:33:46 +0100 Subject: [erlang-questions] PosegreSQL driver Message-ID: Hello, As there was yet another discussion on PostgreSQL drivers, we decided to eventually publish our own. It can be found on GitHub: https://github.com/semiocast/pgsql Compared to existing drivers which served as an inspiration (and which we used initially), our driver features: * OTP-supervision; * transparently handling many PostgreSQL types, including arrays and numerics; * cancellation of running queries using out-of-band protocol; * SSL support; * timeout for queries; * iteration on results using protocol-level implicit portals and cursors, with fold, map and foreach; * mapping of types to Erlang using a mapping of known types, handling new types that may arise through the life of the connection (this feature is an improvement of oidmap handling in Christian Sunesson's driver); * handling both floating point and integer datetimes (this feature is an improvement of timestamp handling in Will Glozer's driver). All these features and more (e.g. the driver passes the erlang's node name as the application_name) were developed for our needs and we hope that others would enjoy them. This driver is currently in use with PostgreSQL 9.2 servers. We don't use rebar internally but I made sure ./rebar compile and ./rebar eunit works. Paul -- Semiocast http://semiocast.com/ +33.183627948 - 20 rue Lacaze, 75014 Paris From max.lapshin@REDACTED Thu Mar 7 17:00:51 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 7 Mar 2013 20:00:51 +0400 Subject: [erlang-questions] PosegreSQL driver In-Reply-To: References: Message-ID: What should I do this weekend? Take a beer, write postgresql erlang driver or just write my own nosql database? It is really interesting: why are there so many forks? Is it possible to consolidate all efforts? Maybe it is impossible at all because different drivers implement different approaches of querying async database from async erlang? -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Thu Mar 7 17:25:37 2013 From: g@REDACTED (Garrett Smith) Date: Thu, 7 Mar 2013 10:25:37 -0600 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > I wonder if Function call is better than Case when both of they can > implement the target I want? > It seems like write a function instead of case could make the code more > clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. Is this > valuable? Over the last year or so, I've started to adopt the approach outlined here: http://www.gar1t.com/blog/2012/06/10/solving-embarrassingly-obvious-problems-in-erlang/ There are few things I'd like to modify in a followup post [1] but the general idea of working to make your code "embarrassingly obvious" still is the central idea. Functions are the primary mode of "making things obvious". They let you take otherwise hidden or implicit logic and making it explicit. The smaller and more focused your functions, the better. You should be able to look at the function and, in just a moment, know what it does, without reading comments. If it's not that obvious, ask why, then clarify it by codifying "what's going on" in functions. At the time of writing the piece, I didn't have enough experience with this method to know whether it was Good or Not Good. Today, I believe that it's Very Good! (with amendments listed below) Here's why: - The "obviousness" standard, while subjective, drives a programmer to think carefully about *everything*, to the point of understanding the problem/solution ad nauseam - It shifts the nature of programming from "make the code work" to "say what I want to say" -- which is a shift away from brute force experimentation to deliberate problem elaboration/solving (this is why I advocate trading test time for make-your-code-obvious time) - Your left with code that's *extremely* maintainable -- neither bugs nor potential enhancements have anywhere to hide! Any change will necessarily affect a small surface area that's easy to think about (while you may see ripple effects across many functions depending on the change, you'll know the exact boundary) As to performance, I'll followup with a separate reply, as it involves large code chunks and this reply is already too long :) Garrett [1] There are a few changes I'd like to make to the religious dogma: 1. RoK and others have pointed out -- and I've come to heartily agree with this -- that the use of variables can help further clarify a function by a) placing key functions on their own line, thus highlighting them, b) changing the order things are read from right-to-left (as in the case of reading function calls) to top-down, and c) a single variable name can be clearer than a function call with arguments. 2. While it's possible to replace *all* case expressions with functions, there are instances where case is clearly better. The signal is when code becomes decisively *less obvious* without the case expression. It's a judgement call. 3. In the blog post example, I use a pipeline to convey arguments to a function. This is very odd indeed -- arguments should be spelled out and passed discretely to a function, not as an array of values. (In fact, there's a horrible error in that code, terrible!) Note that each of these points contributed to reduced lines-of-code per function. You can see this was clearly a goal of mine!. Since then, I've relaxed the LoC per function dogma. Though it's still a good proxy for code quality, just without the authoritarian religiosity. From pguyot@REDACTED Thu Mar 7 17:29:51 2013 From: pguyot@REDACTED (Paul Guyot) Date: Thu, 7 Mar 2013 17:29:51 +0100 Subject: [erlang-questions] PostgreSQL driver In-Reply-To: References: Message-ID: Le 7 mars 2013 ? 17:00, Max Lapshin a ?crit : > What should I do this weekend? Take a beer, write postgresql erlang driver > or just write my own nosql database? > > It is really interesting: why are there so many forks? Is it possible to > consolidate all efforts? Maybe it is impossible at all because different > drivers implement different approaches of querying async database from > async erlang? :) Likewise, there are many HTTP servers, several XML and JSON parsers, etc. For example, we mostly use mochiweb here, but we built our own HTTP client and after having used mochiweb for JSON parsing, we transitioned to jiffy. There even are several UUID modules written in Erlang! The reasons are probably diverse, including: - the ease to implement a working network tool, as Erlang is particularly good at protocols. Indeed, you can get a simple working PostgreSQL driver in a weekend; - the existence of a built-in, but unsatisfying implementation (inets for httpd, odbc for PostgreSQL); - the lack of support from first authors and the inactivity of their projects; - the fact that some features may eventually require a rewrite. To illustrate this point, I did some digging before open-sourcing our driver. Initially, we used ODBC, as we try to favor OTP built-in solutions. Then, because ODBC didn't satisfy our needs, in 2009, we went with ejabberd's version of Christian Sunesson's driver. I remember doing a diff with jungerl's version to find out bug fixes from ProcessOne. This driver was the most popular at the time, but it lacked OTP-supervision as we do releases and code_changes. So we implemented that, as well a thin-layer resembling ODBC API and the API that we had with other database drivers we used. At that point, we could still call our implementation a fork, with a couple of modules untouched. I believe we fixed several bugs in this driver and I might have filed a request at ProcessOne (I surely did submit patches to ProcessOne for eunit). It didn't handle latest PostgreSQL protocol if I remember properly. It also didn't handle timestamp well, so we imported some timestamp code from Will Grozer's driver. Entirely switching to Will Grozer's driver was not so much an option as it didn't feature OTP compliancy either. We eventually had to rewrite all the code to support fold/map/foreach, asynchronous cancellation and timeouts. This was quite deep as these features are based on a different sequencing of PostgreSQL backend protocol. At every conversations on postgresql drivers, I wondered if we shall open source our own (which cannot really be considered a fork as of today) and decided so after Anton's comments that timeouts are hard. I don't mean we solved the issue, but we actually use query timeouts in our code using our driver, and it required parting from Will Grozer's and Christian Sunesson's code, which Anton didn't do with his fork. Paul -- Semiocast http://semiocast.com/ +33.183627948 - 20 rue Lacaze, 75014 Paris From g@REDACTED Thu Mar 7 17:34:48 2013 From: g@REDACTED (Garrett Smith) Date: Thu, 7 Mar 2013 10:34:48 -0600 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > I wonder if Function call is better than Case when both of they can > implement the target I want? > It seems like write a function instead of case could make the code more > clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. Is this > valuable? Here's a module: %% == begin =========================== -module(case_vs_function). -export([with_case/1, with_function/1]). with_case(Msg) -> case Msg of "hello" -> {ok, hi}; "goodbye" -> {ok, bye}; _ -> error end. with_function("hello") -> {ok, hi}; with_function("goodbye") -> {ok, bye}; with_function(_) -> error. %% == end ============================= And here's the compiled core Erlang: %% == begin =========================== module 'case_vs_function' ['module_info'/0, 'module_info'/1, 'with_case'/1, 'with_function'/1] attributes [] 'with_case'/1 = %% Line 5 fun (_cor0) -> %% Line 6 case _cor0 of %% Line 7 <[104|[101|[108|[108|[111]]]]]> when 'true' -> {'ok','hi'} %% Line 8 <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> {'ok','bye'} %% Line 9 <_cor3> when 'true' -> 'error' end 'with_function'/1 = %% Line 12 fun (_cor0) -> case _cor0 of <[104|[101|[108|[108|[111]]]]]> when 'true' -> {'ok','hi'} %% Line 13 <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> {'ok','bye'} %% Line 14 <_cor2> when 'true' -> 'error' end 'module_info'/0 = fun () -> call 'erlang':'get_module_info' ('case_vs_function') 'module_info'/1 = fun (_cor0) -> call 'erlang':'get_module_info' ('case_vs_function', _cor0) end %% == end ============================= And the same core Erlang with distractions removed: %% == begin =========================== 'with_case'/1 = fun (_cor0) -> case _cor0 of <[104|[101|[108|[108|[111]]]]]> when 'true' -> {'ok','hi'} <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> {'ok','bye'} <_cor3> when 'true' -> 'error' end 'with_function'/1 = fun (_cor0) -> case _cor0 of <[104|[101|[108|[108|[111]]]]]> when 'true' -> {'ok','hi'} <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> {'ok','bye'} <_cor2> when 'true' -> 'error' end %% == end ============================= This should alleviate any guilt you may have over using functions, instead of case expressions, to make your code more obvious. Garrett From g@REDACTED Thu Mar 7 17:56:52 2013 From: g@REDACTED (Garrett Smith) Date: Thu, 7 Mar 2013 10:56:52 -0600 Subject: [erlang-questions] Let it crash + side effects In-Reply-To: References: Message-ID: On Thu, Mar 7, 2013 at 4:14 AM, Tyron Zerafa wrote: > Erlang is impure, functions do have side effects. So how does exactly the > let it crash philosophy fit in Erlang? > As far as I know Erlang does not employ any kind of atomic actions or roll > back mechanisms. What is the best course of action to take for a failing > function which has side effects? The best course, I suspect, is to avoid cases where inconsistency resulting from a failed function will hurt you. It'll be easier to think about if you have some examples. But in general, I take this approach: - Processes worry only about a narrowly defined set of requirements (external state) and ignore everything else - If the narrow set of requirements aren't met, the processes refuse to continue (crash) - Use other processes to monitor and clean up external state, putting things in order as needed by other processes I like to think of the last point as a "cleanup crew" pattern. With processes focused on routinely cleaning up messes, your primary worker processes can simply and happily forget about making things right on failure. The worker processes just do their thing, when they can. A couple of illustrative operating system patterns: - Log rotation -- loggers write stupidly to a file, not worrying about disks filling up -- someone else solves that - /tmp cleanup -- users of temp file systems just write and leave crap sitting around -- someone else cleans those up Operating systems use this "cleanup crew" pattern so extensively, it's a wonder it's not more established in programming circles! What's nice about Erlang is that you can spin a cleanup crew process up very easily. I use e2 tasks for this: http://e2project.org/tasks.html Garrett From raould@REDACTED Thu Mar 7 18:10:21 2013 From: raould@REDACTED (Raoul Duke) Date: Thu, 7 Mar 2013 09:10:21 -0800 Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? Message-ID: fingers still crossed... :-) From robert.virding@REDACTED Thu Mar 7 18:48:46 2013 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 7 Mar 2013 17:48:46 +0000 (GMT) Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: Message-ID: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> Keep them crossed. :-) It's definitely not impossible, it "just" needs the dialyzer people to implement hooks to which we (LFE, Joxa, ...) can write plugins. It that were to happen I might even add type specifications to LFE. Robert ----- Original Message ----- > From: "Raoul Duke" > To: "erlang-questions" > Sent: Thursday, 7 March, 2013 6:10:21 PM > Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? > > fingers still crossed... :-) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Thu Mar 7 19:02:04 2013 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 7 Mar 2013 18:02:04 +0000 (GMT) Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: Message-ID: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> Just to explain *why* Garret's example produces the same code. Internally the compiler uses the same code to handle the pattern matching in function clauses and in case clauses so the result is naturally the same. So to reinforce what Garret said: choose that which feels the best. Some personal comments: - Sometimes it does feel a bit excessive to create small functions for everything even if it more pure. - If you want to pattern match on multiple values it looks much better in a separate function. Robert ----- Original Message ----- > From: "Garrett Smith" > To: "??" <249505968@REDACTED> > Cc: "erlang-questions" > Sent: Thursday, 7 March, 2013 5:34:48 PM > Subject: Re: [erlang-questions] Which choice is better? Function or Case > > On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > > I wonder if Function call is better than Case when both of they can > > implement the target I want? > > It seems like write a function instead of case could make the code > > more > > clear . > > But which one is fast when it running? > > I intend to change the case to function to make the code more > > clear. Is this > > valuable? > > Here's a module: > > %% == begin =========================== > > -module(case_vs_function). > > -export([with_case/1, with_function/1]). > > with_case(Msg) -> > case Msg of > "hello" -> {ok, hi}; > "goodbye" -> {ok, bye}; > _ -> error > end. > > with_function("hello") -> {ok, hi}; > with_function("goodbye") -> {ok, bye}; > with_function(_) -> error. > > %% == end ============================= > > And here's the compiled core Erlang: > > %% == begin =========================== > > module 'case_vs_function' ['module_info'/0, > 'module_info'/1, > 'with_case'/1, > 'with_function'/1] > attributes [] > 'with_case'/1 = > %% Line 5 > fun (_cor0) -> > %% Line 6 > case _cor0 of > %% Line 7 > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > {'ok','hi'} > %% Line 8 > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > {'ok','bye'} > %% Line 9 > <_cor3> when 'true' -> > 'error' > end > 'with_function'/1 = > %% Line 12 > fun (_cor0) -> > case _cor0 of > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > {'ok','hi'} > %% Line 13 > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > {'ok','bye'} > %% Line 14 > <_cor2> when 'true' -> > 'error' > end > 'module_info'/0 = > fun () -> > call 'erlang':'get_module_info' > ('case_vs_function') > 'module_info'/1 = > fun (_cor0) -> > call 'erlang':'get_module_info' > ('case_vs_function', _cor0) > end > > %% == end ============================= > > And the same core Erlang with distractions removed: > > %% == begin =========================== > > 'with_case'/1 = > fun (_cor0) -> > case _cor0 of > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > {'ok','hi'} > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > {'ok','bye'} > <_cor3> when 'true' -> > 'error' > end > > 'with_function'/1 = > fun (_cor0) -> > case _cor0 of > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > {'ok','hi'} > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > {'ok','bye'} > <_cor2> when 'true' -> > 'error' > end > > %% == end ============================= > > This should alleviate any guilt you may have over using functions, > instead of case expressions, to make your code more obvious. > > Garrett > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From essen@REDACTED Thu Mar 7 19:04:46 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 07 Mar 2013 19:04:46 +0100 Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> References: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> Message-ID: <5138D6BE.9040208@ninenines.eu> You just need to add different debugging information to the beam (typespecs + Core Erlang), and Dialyzer just needs to read that if it can't find Erlang AST. Dialyzer do most of its work on Core Erlang code already, it (correct if I'm wrong) only uses the Erlang AST to extract typespec information. Shouldn't be a patch too difficult to write, just needs time. On 03/07/2013 06:48 PM, Robert Virding wrote: > Keep them crossed. :-) It's definitely not impossible, it "just" needs the dialyzer people to implement hooks to which we (LFE, Joxa, ...) can write plugins. It that were to happen I might even add type specifications to LFE. > > Robert > > ----- Original Message ----- >> From: "Raoul Duke" >> To: "erlang-questions" >> Sent: Thursday, 7 March, 2013 6:10:21 PM >> Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? >> >> fingers still crossed... :-) >> _______________________________________________ >> 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 > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From raould@REDACTED Thu Mar 7 19:18:18 2013 From: raould@REDACTED (Raoul Duke) Date: Thu, 7 Mar 2013 10:18:18 -0800 Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <5138D6BE.9040208@ninenines.eu> References: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> <5138D6BE.9040208@ninenines.eu> Message-ID: > Shouldn't be a patch too difficult to write, just needs time. is there anybody on this list who can do it + will do it? :-) i don't know jack about any of this! (nor do i have any free time :-) From bombadil@REDACTED Thu Mar 7 19:29:45 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 07 Mar 2013 19:29:45 +0100 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol Message-ID: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> Hi, I'd like to share this project, is some odd because it's the server part of the MySQL protocol, but can be used for create servers with MySQL connection for data transport, proxies for MySQL, and whatever :-) https://github.com/bosqueviejo/myproto Comments are welcome! Thanks. Manuel Rubio. From essen@REDACTED Thu Mar 7 19:31:31 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 07 Mar 2013 19:31:31 +0100 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> Message-ID: <5138DD03.7010403@ninenines.eu> On 03/07/2013 07:29 PM, Manuel A. Rubio "Bombadil" wrote: > Hi, > > I'd like to share this project, is some odd because it's the server part > of the MySQL protocol, but can be used for create servers with MySQL > connection for data transport, proxies for MySQL, and whatever :-) > > https://github.com/bosqueviejo/myproto > > Comments are welcome! Sounds nice. How compatible with MySQL itself are you? How did you test it? -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From bombadil@REDACTED Thu Mar 7 19:40:48 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 07 Mar 2013 19:40:48 +0100 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: <5138DD03.7010403@ninenines.eu> References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> <5138DD03.7010403@ninenines.eu> Message-ID: <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> Hi, El 2013-03-07 19:31, Lo?c Hoguin escribi?: > How compatible with MySQL itself are you? How did you test it? I didn't yet tests about compatibility, but I follow the specs in the MySQL and works well with mysql client :-) Regards. Manuel Rubio. From bob@REDACTED Thu Mar 7 19:44:22 2013 From: bob@REDACTED (Bob Ippolito) Date: Thu, 7 Mar 2013 10:44:22 -0800 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> References: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> Message-ID: A performance difference between case and functions can manifest when you extract a case from a function into another function. Function calls aren't free unless they get inlined. On Thu, Mar 7, 2013 at 10:02 AM, Robert Virding < robert.virding@REDACTED> wrote: > Just to explain *why* Garret's example produces the same code. Internally > the compiler uses the same code to handle the pattern matching in function > clauses and in case clauses so the result is naturally the same. So to > reinforce what Garret said: choose that which feels the best. > > Some personal comments: > > - Sometimes it does feel a bit excessive to create small functions for > everything even if it more pure. > - If you want to pattern match on multiple values it looks much better in > a separate function. > > Robert > > ----- Original Message ----- > > From: "Garrett Smith" > > To: "??" <249505968@REDACTED> > > Cc: "erlang-questions" > > Sent: Thursday, 7 March, 2013 5:34:48 PM > > Subject: Re: [erlang-questions] Which choice is better? Function or Case > > > > On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > > > I wonder if Function call is better than Case when both of they can > > > implement the target I want? > > > It seems like write a function instead of case could make the code > > > more > > > clear . > > > But which one is fast when it running? > > > I intend to change the case to function to make the code more > > > clear. Is this > > > valuable? > > > > Here's a module: > > > > %% == begin =========================== > > > > -module(case_vs_function). > > > > -export([with_case/1, with_function/1]). > > > > with_case(Msg) -> > > case Msg of > > "hello" -> {ok, hi}; > > "goodbye" -> {ok, bye}; > > _ -> error > > end. > > > > with_function("hello") -> {ok, hi}; > > with_function("goodbye") -> {ok, bye}; > > with_function(_) -> error. > > > > %% == end ============================= > > > > And here's the compiled core Erlang: > > > > %% == begin =========================== > > > > module 'case_vs_function' ['module_info'/0, > > 'module_info'/1, > > 'with_case'/1, > > 'with_function'/1] > > attributes [] > > 'with_case'/1 = > > %% Line 5 > > fun (_cor0) -> > > %% Line 6 > > case _cor0 of > > %% Line 7 > > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > > {'ok','hi'} > > %% Line 8 > > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > > {'ok','bye'} > > %% Line 9 > > <_cor3> when 'true' -> > > 'error' > > end > > 'with_function'/1 = > > %% Line 12 > > fun (_cor0) -> > > case _cor0 of > > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > > {'ok','hi'} > > %% Line 13 > > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > > {'ok','bye'} > > %% Line 14 > > <_cor2> when 'true' -> > > 'error' > > end > > 'module_info'/0 = > > fun () -> > > call 'erlang':'get_module_info' > > ('case_vs_function') > > 'module_info'/1 = > > fun (_cor0) -> > > call 'erlang':'get_module_info' > > ('case_vs_function', _cor0) > > end > > > > %% == end ============================= > > > > And the same core Erlang with distractions removed: > > > > %% == begin =========================== > > > > 'with_case'/1 = > > fun (_cor0) -> > > case _cor0 of > > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > > {'ok','hi'} > > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > > {'ok','bye'} > > <_cor3> when 'true' -> > > 'error' > > end > > > > 'with_function'/1 = > > fun (_cor0) -> > > case _cor0 of > > <[104|[101|[108|[108|[111]]]]]> when 'true' -> > > {'ok','hi'} > > <[103|[111|[111|[100|[98|[121|[101]]]]]]]> when 'true' -> > > {'ok','bye'} > > <_cor2> when 'true' -> > > 'error' > > end > > > > %% == end ============================= > > > > This should alleviate any guilt you may have over using functions, > > instead of case expressions, to make your code more obvious. > > > > Garrett > > _______________________________________________ > > 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 Mar 7 22:50:05 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 07 Mar 2013 22:50:05 +0100 Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> References: <641847569.66203284.1362678526741.JavaMail.root@erlang-solutions.com> Message-ID: <51390B8D.2070305@cs.ntua.gr> On 03/07/2013 06:48 PM, Robert Virding wrote: > Keep them crossed. :-) It's definitely not impossible, it "just" needs the dialyzer people to implement hooks to which we (LFE, Joxa, ...) can write plugins. It that were to happen I might even add type specifications to LFE. Even disregarding for the moment the question why would "the dialyzer people" care about lfe, joxa, et al., (dialyzer: Discrepancy Analyzer of *Erlang* code) if you are not more specific than the above wish how exactly do you expect them to know about the details of possible hooks that are needed by non-standard uses of dialyzer by other more exotic languages out there? Better yet, dialyzer's code base is on github, and thus one can submit patches (hint, hint!) that have a very good chance of being included in its code base if they do not break dialyzer's current functionality and come with tests that ensure that the extra functionality will not be accidentally broken in the future. Cheers, Kostis From xavier@REDACTED Thu Mar 7 23:29:43 2013 From: xavier@REDACTED (Xavier Maillard) Date: Thu, 07 Mar 2013 23:29:43 +0100 Subject: [erlang-questions] USB, rs232 links Message-ID: Hello, for my next (serious and personal) project with Erlang, I will have to study rs232 and use a USB device connected. Do you know whether something in Erlang already exist so I won't reinvent the wheel ? Thank you /Xavier From ok@REDACTED Fri Mar 8 00:09:13 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Mar 2013 12:09:13 +1300 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <51389969.4050209@it.uu.se> References: <51389969.4050209@it.uu.se> Message-ID: <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> Surely zero-length segments *have* to be allowed? Suppose you have <> = Whatever Is this supposed to crash if N = 0? Why? I cannot understand what is supposed to be 'weird' about zero-length segments. Look at example 4 from the Bit Syntax documentation: -define(IP_VERSION, 4). -define(IP_MIN_HDR_LEN, 5). DgramSize = byte_size(Dgram), case Dgram of <> when HLen>=5, 4*HLen= OptsLen = 4*(HLen - ?IP_MIN_HDR_LEN), <> = RestDgram, ... end. If there are no options, so that HLen == IP_MIN_HDR_LEN and OptsLen == 0, this reduces to <> = RestDgram. Is there anything "weird" about a datagram with no options? If the issue is construction rather than matching, is there anything "weird" about constructing a datagram with no options? Zero is a perfectly good size. It would be a serious defect in Erlang if it _didn't_ allow zero-size segments. And since zero *is* a perfectly sensible size for things, it seems to me that failing to handle zero sensibly is the thing which would have needed special mention in the documentation, while treating zero sensibly is no odder than treating one sensibly. On 8/03/2013, at 2:43 AM, Kostis Sagonas wrote: > In revising some HiPE test suites for bit syntax, I noticed some pattern matching with 0-sized segments. They can be illustrated by the following: > > Eshell V5.10.2 (abort with ^G) > 1> <> = <<>>. From tony@REDACTED Fri Mar 8 00:28:33 2013 From: tony@REDACTED (Tony Rogvall) Date: Fri, 8 Mar 2013 00:28:33 +0100 Subject: [erlang-questions] USB, rs232 links In-Reply-To: References: Message-ID: Have a look at: https://github.com/tonyrog/uart.git (even works on win32, dthread compiled with mingw) /Tony On 7 mar 2013, at 23:29, Xavier Maillard wrote: > Hello, > > for my next (serious and personal) project with Erlang, I will have to > study rs232 and use a USB device connected. > > Do you know whether something in Erlang already exist so I won't > reinvent the wheel ? > > Thank you > > /Xavier > > _______________________________________________ > 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 ok@REDACTED Fri Mar 8 00:39:42 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Mar 2013 12:39:42 +1300 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> References: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> Message-ID: <41051FEE-CD3A-4A18-B131-6F55EFD6570A@cs.otago.ac.nz> I'd just like to say "Happy the programmer whose worst problem is choosing between a 'case' or a function!" Testing is wonderful. Functions are things you can easily _reach_ with tests. Inspection is even more wonderful than testing, even if it is just boring old 'trying to read someone else's code'. Throw in profiling and tracing for good measure. I don't go as far as Garrett Smith. Maybe I should. But I agree with him 100% that you should write whatever is clearest. Who judges what's clearest? Whoever has to maintain the code. If Helmuth von Moltke is in an afterlife that permits him to entertain such thoughts, he probably wishes he had said "no plan survives contact with the enemy", but he said "no operation extends with any certainty beyond the first encounter with the main body of the enemy", which is not so pithy, but offers extra insight. All code has to be considered highly tentative until it has seen some serious testing/use. You _will_ change it. The aim is to get it to that point quickly and change it easily. From kostis@REDACTED Fri Mar 8 01:09:20 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 08 Mar 2013 01:09:20 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> Message-ID: <51392C30.7020006@cs.ntua.gr> On 03/08/2013 12:09 AM, Richard A. O'Keefe wrote: > Surely zero-length segments *have* to be allowed? > > Suppose you have > <> = Whatever > > Is this supposed to crash if N = 0? > Why? > > I cannot understand what is supposed to be 'weird' about > zero-length segments. Perhaps the exact issue that I find slightly "weird" was too subtle in my mail. First of all, note that all your examples involve binary segments. In this case (and in bitstrings, which is its generalization) one could argue that there is a perfectly sensible "solution" to the matching problem, namely the empty bitstring as can be seen below. 9> <> = <<>>. <<>> 10> X. <<>> IMO, the solution to the previous matching makes sense because binaries (bitstrings) get "flattened" out when nested in other ones: for any binary (bitstring) B, the binary (bitstring) <> is the same as B. Also, for all bitstrings B the following matching succeeds and returns X = B. B = <<...SOME BITSTRING...>, N = bit_size(B), <> = B. Note that B = <<>> and <> is just a special case of the above matching. So far so good. When one moves to integer segments the above property does not make much sense anymore (esp. since bit_size is not defined for anything other than bitstrings). In particular, the current implementation of binary pattern matching has chosen to return an "arbitrary" integer, namely 0, as the result. I can may well see that many would consider the following binding for X to 0 a bit weird. 1> <> = <<42:0>>. <<>> 2> X. 0 Moreover, the situation is arguably even more weird for floats: 3> <> = <<42:0>>. <<>> 4> F. 0.0 especially so since one cannot even write something like <<42:0/float>> (or even <<3.1415:0/float>>) as a construction. I am not so convinced that pattern matching with 0-size segments make sense for types other than bitstrings (binaries). Kostis > Look at example 4 from the Bit Syntax documentation: > > -define(IP_VERSION, 4). > -define(IP_MIN_HDR_LEN, 5). > > DgramSize = byte_size(Dgram), > case Dgram of > < ID:16, Flgs:3, FragOff:13, > TTL:8, Proto:8, HdrChkSum:16, > SrcIP:32, > DestIP:32, RestDgram/binary>> when HLen>=5, 4*HLen= > OptsLen = 4*(HLen - ?IP_MIN_HDR_LEN), > <> = RestDgram, > ... > end. > > > If there are no options, so that HLen == IP_MIN_HDR_LEN and OptsLen == 0, > this reduces to > <> = RestDgram. > > Is there anything "weird" about a datagram with no options? > > If the issue is construction rather than matching, > is there anything "weird" about constructing a datagram with no options? > > Zero is a perfectly good size. It would be a serious defect in Erlang > if it _didn't_ allow zero-size segments. .... From ok@REDACTED Fri Mar 8 01:45:40 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 8 Mar 2013 13:45:40 +1300 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <51392C30.7020006@cs.ntua.gr> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> Message-ID: <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> Integers in Erlang do not have silly size restrictions reflecting the underlying hardware. It's not the case that only 8, 16, 32, 64 make sense as integer sizes, for example. Let B and V be integers such that B >= 0 0 <= V < 2**B then <> is a bitstring containing exactly B bits such that <> = <> will exactly recover R == V. The interesting thing here is that B == 0 is NOT a special case. It is not, or _should_ not, be in any way surprising. What _has_ repeatedly caused surprised expressed in this mailing list is the quiet truncation of integer values outside the [0,2**B) range. That would definitely justify an exception. Suppose I am constructing an XML compressor, taking advantage of knowing the DTD. About to emit an element, I want to say "let P be the number of elements allowed here, counting #PCDATA as an element. Let B be the smallest integer such that 2**B >= P. Let V be the zero-origin index of the element type. Now encode V:B." Considering the number of elements where only #PCDATA is allowed, quite often I am going to want to encode 0:0." Zero is a perfectly good size, even for an integer. Floats are very very different. Erlang *does* let a hardware size show through. The *only* size that makes sense is 64. And you _do_ get an exception if you specify the type as 'float' and the size as anything that doesn't resolve to 64. > When one moves to integer segments the above property does not make much sense anymore (esp. since bit_size is not defined for anything other than bitstrings). In particular, the current implementation of binary pattern matching has chosen to return an "arbitrary" integer, namely 0, as the result. But it is not arbitrary at all. It is forced by the rule for non-zero sizes. If the legal range for B bits (where B > 0) is 0..2**B-1, then the legal range for 0 bits *has* to be 0..0. This is the *only* consistent value. > I can may well see that many would consider the following binding for X to 0 a bit weird. > > 1> <> = <<42:0>>. That is a completely different issue. The thing that is weird here is in the *expression*, not the pattern, and it's allowing a value that does not in fact fit into the field and quietly truncating it. <> = <<257:8>> gives you X = 1. *THAT* is weird, but it has nothing whatever to do with zero sizes, and banning the perfectly sensible zero sizes will do nothing to stop the weirdness. > Moreover, the situation is arguably even more weird for floats: > > 3> <> = <<42:0>>. > <<>> > 4> F. > 0.0 *That* I grant you. Since the only legal size in a construction is 64, and you get an exception if you try any other number, then the only legal size for a float in a pattern should also be 64. > > I am not so convinced that pattern matching with 0-size segments make sense for types other than bitstrings (binaries). It doesn't make sense for floats. But it _does_ make sense for integers. More precisely, it makes sense for *unsigned* integers. A *signed* integer has to be at least one bit, because there has to be somewhere to put the sign, otherwise it isn't signed. So: We AGREE that size 0 is sensible for bit strings. We AGREE that size 0 is not sensible for floats. We AGREE that size 0 is not sensible for signed integers. Do we really disagree much about unsigned integers? We AGREE that an explicit size 0 is odd enough to deserve a compiler _warning_. After all, if you _know_ you don't want any bits, why mention them? A warning is not a refusal to compile. Our disagreement seems to be limited to - whether an unsigned integer with a size of zero determined at run time has semantics forced by and consistent with the semantics of nonzero sizes and should certainly be allowed or is so weird that it should raise an exception. From max.lapshin@REDACTED Fri Mar 8 04:57:58 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 8 Mar 2013 07:57:58 +0400 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> <5138DD03.7010403@ninenines.eu> <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> Message-ID: It is good. For example sphinx search engine has switched from handmade protocol to mysql protocol and now you can work with search engine just like with a mysql database. The same approach can be implemented if you have statistics. For example, ejabberd showing online users or message history. -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Fri Mar 8 05:08:38 2013 From: norton@REDACTED (=?utf-8?B?44OO44O844OI44OzIOOCuOODp+ODvOOCu+ODlSDjgqbjgqfjgqQg?= =?utf-8?B?44Oz?=) Date: Fri, 8 Mar 2013 13:08:38 +0900 Subject: [erlang-questions] Add support for erl_nif_phash2/1,2 ? Message-ID: Hello. I have a question about nifs. Is there interest from the OTP Team and/or the community for adding support for erl_nif_phash2/1,2 ? Just curious if any one else has previously had such a need for their nif implementations. thanks, Joe N. From k.petrauskas@REDACTED Fri Mar 8 05:13:25 2013 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Fri, 8 Mar 2013 06:13:25 +0200 Subject: [erlang-questions] Interface to oracle Message-ID: Hi, What is the preferred way for connecting to Oracle from Erlang? >From various posts in the internet, i assume the ODBC approach is not very stable. Another alternative is to use erloci. Maybe there are other options and aspects to consider? I need to access oracle database mostly for querying and I need to use stored procedures and ref cursors. Support for oracle AQ and ADTs would be nice features to have. Main properties of the solution should be reliability and performance. I hope the question is not too abstract. Karolis From dangud@REDACTED Fri Mar 8 08:38:49 2013 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 8 Mar 2013 08:38:49 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> Message-ID: Another nice thing with 0 sized integers is when you add alignment bits in protocols, in both matching and creation. <> = Input Output = <>, /Dan On Fri, Mar 8, 2013 at 1:45 AM, Richard A. O'Keefe wrote: > Integers in Erlang do not have silly size restrictions > reflecting the underlying hardware. It's not the case > that only 8, 16, 32, 64 make sense as integer sizes, > for example. > > Let B and V be integers such that > B >= 0 > 0 <= V < 2**B > then > <> > is a bitstring containing exactly B bits such that > <> = <> > will exactly recover R == V. > > The interesting thing here is that B == 0 is NOT a special case. > > It is not, or _should_ not, be in any way surprising. > > What _has_ repeatedly caused surprised expressed in this mailing > list is the quiet truncation of integer values outside the [0,2**B) > range. That would definitely justify an exception. > > Suppose I am constructing an XML compressor, taking advantage of > knowing the DTD. About to emit an element, I want to say "let P > be the number of elements allowed here, counting #PCDATA as an > element. Let B be the smallest integer such that 2**B >= P. > Let V be the zero-origin index of the element type. Now encode > V:B." Considering the number of elements where only #PCDATA is > allowed, quite often I am going to want to encode 0:0." > > Zero is a perfectly good size, even for an integer. > > Floats are very very different. > Erlang *does* let a hardware size show through. > The *only* size that makes sense is 64. > And you _do_ get an exception if you specify the type as 'float' > and the size as anything that doesn't resolve to 64. > >> When one moves to integer segments the above property does not make much sense anymore (esp. since bit_size is not defined for anything other than bitstrings). In particular, the current implementation of binary pattern matching has chosen to return an "arbitrary" integer, namely 0, as the result. > > But it is not arbitrary at all. It is forced by the rule for non-zero sizes. > If the legal range for B bits (where B > 0) is 0..2**B-1, then the legal > range for 0 bits *has* to be 0..0. This is the *only* consistent value. > >> I can may well see that many would consider the following binding for X to 0 a bit weird. >> >> 1> <> = <<42:0>>. > > That is a completely different issue. The thing that is weird here is > in the *expression*, not the pattern, and it's allowing a value that > does not in fact fit into the field and quietly truncating it. > > <> = <<257:8>> > > gives you X = 1. *THAT* is weird, but it has nothing whatever to do with > zero sizes, and banning the perfectly sensible zero sizes will do nothing > to stop the weirdness. > >> Moreover, the situation is arguably even more weird for floats: >> >> 3> <> = <<42:0>>. >> <<>> >> 4> F. >> 0.0 > > *That* I grant you. Since the only legal size in a construction is 64, > and you get an exception if you try any other number, then the only legal > size for a float in a pattern should also be 64. >> >> I am not so convinced that pattern matching with 0-size segments make sense for types other than bitstrings (binaries). > > It doesn't make sense for floats. > But it _does_ make sense for integers. > > More precisely, it makes sense for *unsigned* integers. > > A *signed* integer has to be at least one bit, because > there has to be somewhere to put the sign, otherwise it > isn't signed. > > So: > > We AGREE that size 0 is sensible for bit strings. > We AGREE that size 0 is not sensible for floats. > We AGREE that size 0 is not sensible for signed integers. > > Do we really disagree much about unsigned integers? > > We AGREE that an explicit size 0 is odd enough to > deserve a compiler _warning_. After all, if you > _know_ you don't want any bits, why mention them? > > A warning is not a refusal to compile. > > Our disagreement seems to be limited to > > - whether an unsigned integer with a size of zero > determined at run time has semantics forced by > and consistent with the semantics of nonzero > sizes and should certainly be allowed or is so > weird that it should raise an exception. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Fri Mar 8 08:46:36 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 8 Mar 2013 08:46:36 +0100 Subject: [erlang-questions] jinterface and FindBugs Message-ID: Hi! I have run FindBugs on jinterface and it found some issues. Most are such that "could never happen", but we might just as well have them right because it doesn't hurt. A few are "scary" as FindBugs categorizes them. Some can be fixed in different ways and I chose what felt most natural to me. My question is: would you prefer a separate branch for each one, or is it ok to have them as separate commits on the same branch? The difference is about how easy it is to reject only some of the fixes. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Fri Mar 8 08:58:42 2013 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 8 Mar 2013 08:58:42 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> Message-ID: <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> On 8 Mar 2013, at 08:38, Dan Gudmundsson wrote: > Another nice thing with 0 sized integers is when you add alignment > bits in protocols, in both > matching and creation. I make use of this in sext as well, in a number of places: encode_bin_elems(<<>>) -> <<8>>; encode_bin_elems(B) -> Pad = 8 - (size(B) rem 8), << (<< <<1:1, B1:8>> || <> <= B >>)/bitstring, 0:Pad, 8 >>. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From kostis@REDACTED Fri Mar 8 09:32:38 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 08 Mar 2013 09:32:38 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> Message-ID: <5139A226.9070809@cs.ntua.gr> On 03/08/2013 08:58 AM, Ulf Wiger wrote: > > On 8 Mar 2013, at 08:38, Dan Gudmundsson wrote: > >> Another nice thing with 0 sized integers is when you add alignment >> bits in protocols, in both >> matching and creation. > > I make use of this in sext as well, in a number of places: > > encode_bin_elems(<<>>) -> > <<8>>; > encode_bin_elems(B) -> > Pad = 8 - (size(B) rem 8), > << (<< <<1:1, B1:8>> ||<> <= B>>)/bitstring, 0:Pad, 8>>. I fail to see where this creates a 0-sized integer... Kostis From max.lapshin@REDACTED Fri Mar 8 09:30:10 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 8 Mar 2013 12:30:10 +0400 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <5139A226.9070809@cs.ntua.gr> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> <5139A226.9070809@cs.ntua.gr> Message-ID: 0:Pad Pad can be zero-length. On Fri, Mar 8, 2013 at 12:32 PM, Kostis Sagonas wrote: > On 03/08/2013 08:58 AM, Ulf Wiger wrote: > >> >> On 8 Mar 2013, at 08:38, Dan Gudmundsson wrote: >> >> Another nice thing with 0 sized integers is when you add alignment >>> bits in protocols, in both >>> matching and creation. >>> >> >> I make use of this in sext as well, in a number of places: >> >> encode_bin_elems(<<>>) -> >> <<8>>; >> encode_bin_elems(B) -> >> Pad = 8 - (size(B) rem 8), >> << (<< <<1:1, B1:8>> ||<> <= B>>)/bitstring, 0:Pad, 8>>. >> > > I fail to see where this creates a 0-sized integer... > > Kostis > > ______________________________**_________________ > 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 Fri Mar 8 09:41:00 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 08 Mar 2013 09:41:00 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> <5139A226.9070809@cs.ntua.gr> Message-ID: <5139A41C.5010809@cs.ntua.gr> On 03/08/2013 09:30 AM, Max Lapshin wrote: > 0:Pad > > Pad can be zero-length. For people like me who are a bit slow, can you please explain how this is possible in the code below? Kostis > On Fri, Mar 8, 2013 at 12:32 PM, Kostis Sagonas > wrote: > > On 03/08/2013 08:58 AM, Ulf Wiger wrote: > > > On 8 Mar 2013, at 08:38, Dan Gudmundsson wrote: > > Another nice thing with 0 sized integers is when you add > alignment > bits in protocols, in both > matching and creation. > > > I make use of this in sext as well, in a number of places: > > encode_bin_elems(<<>>) -> > <<8>>; > encode_bin_elems(B) -> > Pad = 8 - (size(B) rem 8), > << (<< <<1:1, B1:8>> ||<> <= B>>)/bitstring, 0:Pad, 8>>. > > > I fail to see where this creates a 0-sized integer... > > Kostis > > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/__listinfo/erlang-questions > > > From max.lapshin@REDACTED Fri Mar 8 09:51:14 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 8 Mar 2013 12:51:14 +0400 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: <5139A41C.5010809@cs.ntua.gr> References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> <5139A226.9070809@cs.ntua.gr> <5139A41C.5010809@cs.ntua.gr> Message-ID: It is my fault. Pad can never be 0 sized in this code. Perhaps it is bug in Ulf's code? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Fri Mar 8 09:54:56 2013 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 8 Mar 2013 09:54:56 +0100 Subject: [erlang-questions] Add support for erl_nif_phash2/1,2 ? In-Reply-To: References: Message-ID: I believe there is already such a patch proposal by Paul Davis, https://github.com/davisp/otp/compare/master...enif_phash2 See the erlang-patches mailing list archive for details. Lukas On Fri, Mar 8, 2013 at 5:08 AM, ???? ????? ??? ? wrote: > > Hello. > > I have a question about nifs. Is there interest from the OTP Team and/or > the community for adding support for erl_nif_phash2/1,2 ? > > Just curious if any one else has previously had such a need for their nif > implementations. > > thanks, > > Joe N. > _______________________________________________ > 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 Fri Mar 8 10:43:29 2013 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 8 Mar 2013 10:43:29 +0100 Subject: [erlang-questions] bit syntax: 0-sized segments In-Reply-To: References: <51389969.4050209@it.uu.se> <95129E76-83D9-4FF4-9E79-723D17BFC8B1@cs.otago.ac.nz> <51392C30.7020006@cs.ntua.gr> <767FC6BF-2AFC-454D-AEC8-383FA93410EA@cs.otago.ac.nz> <98D18FEE-E1CD-4D04-9C28-0CA31B10C54F@feuerlabs.com> <5139A226.9070809@cs.ntua.gr> <5139A41C.5010809@cs.ntua.gr> Message-ID: <43B11C2A-59C5-41DA-9D97-ABDD2ABD7AE0@feuerlabs.com> On 8 Mar 2013, at 09:51, Max Lapshin wrote: > It is my fault. Pad can never be 0 sized in this code. > > Perhaps it is bug in Ulf's code? Not a bug in the code, but a bug in my recollection (and copy-pasting without thinking). :) It is quite likely that some of the design choices in sext are suboptimal, but anyone is welcome to try their hand at improving the compactness of the encodings. There's a pretty good QuickCheck suite there to ensure that the properties are not violated in the process. BR, Ulf Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Fri Mar 8 10:47:41 2013 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 08 Mar 2013 09:47:41 +0000 Subject: [erlang-questions] Streaming of the Krakow Erlang Factory right now Message-ID: <5139B3BD.8040805@erlang-solutions.com> Hi All, A note to say we are streaming the Krakow Erlang Factory Lite right now. On right now is Omer Killic on Taking Back Embedded. The complete program of the day and approximate times are here: http://www.erlang-factory.com/conference/Krakow2013/programme The streaming itself is here (Don't forget to press play): http://erlanglive.com/ Enjoy, Francesco -- Erlang Solutions Ltd. http://www.erlang-solutions.com From antoine.koener@REDACTED Fri Mar 8 10:49:09 2013 From: antoine.koener@REDACTED (Antoine Koener) Date: Fri, 8 Mar 2013 10:49:09 +0100 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> <5138DD03.7010403@ninenines.eu> <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> Message-ID: Isn't this risky because of Oracle ? If someday they decide to do something about the protocol ? (license fee) On Fri, Mar 8, 2013 at 4:57 AM, Max Lapshin wrote: > It is good. > > For example sphinx search engine has switched from handmade protocol to > mysql protocol and now you can work with search engine just like with a > mysql database. > > The same approach can be implemented if you have statistics. For example, > ejabberd showing online users or message history. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From poprosturadek@REDACTED Fri Mar 8 10:55:53 2013 From: poprosturadek@REDACTED (=?UTF-8?B?UmFkb3PFgmF3IE1pc2l1aw==?=) Date: Fri, 08 Mar 2013 10:55:53 +0100 Subject: [erlang-questions] Streaming of the Krakow Erlang Factory right now In-Reply-To: <5139B3BD.8040805@erlang-solutions.com> References: <5139B3BD.8040805@erlang-solutions.com> Message-ID: <5139B5A9.8050909@gmail.com> Is it just me or sound is not available? W dniu 2013-03-08 10:47, Francesco Cesarini pisze: > Hi All, > > A note to say we are streaming the Krakow Erlang Factory Lite right > now. On right now is Omer Killic on Taking Back Embedded. > > The complete program of the day and approximate times are here: > > http://www.erlang-factory.com/conference/Krakow2013/programme > > The streaming itself is here (Don't forget to press play): > > http://erlanglive.com/ > > Enjoy, > Francesco > From zabrane3@REDACTED Fri Mar 8 10:59:11 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 8 Mar 2013 10:59:11 +0100 Subject: [erlang-questions] Streaming of the Krakow Erlang Factory right now In-Reply-To: <5139B5A9.8050909@gmail.com> References: <5139B3BD.8040805@erlang-solutions.com> <5139B5A9.8050909@gmail.com> Message-ID: I confirm, no sound ... really funny. Regards, Zabrane On Mar 8, 2013, at 10:55 AM, Rados?aw Misiuk wrote: > Is it just me or sound is not available? > > W dniu 2013-03-08 10:47, Francesco Cesarini pisze: >> Hi All, >> >> A note to say we are streaming the Krakow Erlang Factory Lite right now. On right now is Omer Killic on Taking Back Embedded. >> >> The complete program of the day and approximate times are here: >> >> http://www.erlang-factory.com/conference/Krakow2013/programme >> >> The streaming itself is here (Don't forget to press play): >> >> http://erlanglive.com/ >> >> Enjoy, >> Francesco >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From omer.kilic@REDACTED Fri Mar 8 11:47:40 2013 From: omer.kilic@REDACTED (Omer Kilic) Date: Fri, 08 Mar 2013 10:47:40 +0000 Subject: [erlang-questions] Streaming of the Krakow Erlang Factory right now In-Reply-To: References: <5139B3BD.8040805@erlang-solutions.com> <5139B5A9.8050909@gmail.com> Message-ID: <5139C1CC.2090806@erlang-solutions.com> On 08/03/13 09:59, Zabrane Mickael wrote: > I confirm, no sound ... really funny. We had a bit of a problem with our microphone setup but it should be fixed now. Cheers, Omer. > On Mar 8, 2013, at 10:55 AM, Rados?aw Misiuk wrote: > >> Is it just me or sound is not available? >> >> W dniu 2013-03-08 10:47, Francesco Cesarini pisze: >>> Hi All, >>> >>> A note to say we are streaming the Krakow Erlang Factory Lite right >>> now. On right now is Omer Killic on Taking Back Embedded. >>> >>> The complete program of the day and approximate times are here: >>> >>> http://www.erlang-factory.com/conference/Krakow2013/programme >>> >>> The streaming itself is here (Don't forget to press play): >>> >>> http://erlanglive.com/ >>> >>> Enjoy, >>> Francesco >>> >> >> _______________________________________________ >> 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 bombadil@REDACTED Fri Mar 8 11:52:20 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Fri, 08 Mar 2013 11:52:20 +0100 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> <5138DD03.7010403@ninenines.eu> <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> Message-ID: <6c91d6e2e1534a3302301f48a0c33f7e@bosqueviejo.net> Hi, El 2013-03-08 10:49, Antoine Koener escribi?: > Isn't this risky because of Oracle ? > If someday they decide to do something about the protocol ? (license > fee) So, I change the name to MariaDB/Percona Server Protocol :-) Regards. Manuel Rubio. From max.lapshin@REDACTED Fri Mar 8 11:59:26 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 8 Mar 2013 14:59:26 +0400 Subject: [erlang-questions] [ANN] myproto - MySQL Server Protocol In-Reply-To: <6c91d6e2e1534a3302301f48a0c33f7e@bosqueviejo.net> References: <6cde1df5ddb59eb36c2763fa696d7f33@bosqueviejo.net> <5138DD03.7010403@ninenines.eu> <8545776dcb0730d942f91163cfddb33c@bosqueviejo.net> <6c91d6e2e1534a3302301f48a0c33f7e@bosqueviejo.net> Message-ID: There was one lawsuit two years ago when Adobe published specification of "RTMP". At least they tell that they have published spec of protocol, and it was written in specification that anyone who is reading this spec must implement server only according to this spec. Of course, they lied in specification and flash player couldn't work by this spec, so they have suied wowza, telling that they are fooling their customers and sending video by protocol which is not rtmp. Answer of wowza was that adobe is also selling software that is not using their published specification =) Btw, I doubt that all this insane is still actual behind US borders. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik@REDACTED Fri Mar 8 12:33:21 2013 From: fredrik@REDACTED (Fredrik) Date: Fri, 8 Mar 2013 12:33:21 +0100 Subject: [erlang-questions] jinterface and FindBugs In-Reply-To: References: Message-ID: <5139CC81.5030309@erlang.org> On 03/08/2013 08:46 AM, Vlad Dumitrescu wrote: > Hi! > > I have run FindBugs on jinterface and it found some issues. Most are > such that "could never happen", but we might just as well have them > right because it doesn't hurt. A few are "scary" as FindBugs > categorizes them. Some can be fixed in different ways and I chose what > felt most natural to me. > > My question is: would you prefer a separate branch for each one, or is > it ok to have them as separate commits on the same branch? The > difference is about how easy it is to reject only some of the fixes. > > best regards, > Vlad > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Hello, If you are referring to sending a patch, I think you should send it all in one patch and we then we can cherrypick the commits we like if we don't want the whole patch. -- BR Fredrik Gustafsson Erlang OTP Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Fri Mar 8 13:01:25 2013 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 8 Mar 2013 13:01:25 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: I've heard people say "writing code is easy" I disagree 1 - writing code that appears to work is easy 2 - writing code is correct is far more difficult 3 - writing code that is correct subject to the condition that is clear and can be understood by other people is very difficult 4 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future is very very difficult 5 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future and is efficient is very very very difficult Writing efficient code is absolutely the last thing on my list - I get stuck round about point 2. About 25 years ago I wrote some code that was mind-melting complicated the usual stuff - super smart code, super efficient, super undocumented, let the force be with you stuff I distributed the program. Two months later I got a bug to fix. I couldn't understand the code I had written two moths earlier - it was totally incomprehensible - I rewrote it *clearly* - it was faster - I modified it several times in the future - It might still be running today. These days if I have an easy problem I write the code first - but if it's tricky I write some kind of user description first. I also have a rubber duck next to my computer - and the queen - in tricky cases I try to explain how my code works to the rubber duck and the queen. I take my rubber duck to meetings - when I just don't understand things I pull out my rubber duck and say the magic words ... " go on explain to the rubber duck ..." Rubber ducks are pretty stupid so if the rubber duck can understand it I can usually understand it. If you can explain your program to a rubber duck it's probably OK Cheers /Joe On Thu, Mar 7, 2013 at 5:25 PM, Garrett Smith wrote: > On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > > I wonder if Function call is better than Case when both of they can > > implement the target I want? > > It seems like write a function instead of case could make the code more > > clear . > > But which one is fast when it running? > > I intend to change the case to function to make the code more clear. Is > this > > valuable? > > Over the last year or so, I've started to adopt the approach outlined here: > > > http://www.gar1t.com/blog/2012/06/10/solving-embarrassingly-obvious-problems-in-erlang/ > > There are few things I'd like to modify in a followup post [1] but the > general idea of working to make your code "embarrassingly obvious" > still is the central idea. > > Functions are the primary mode of "making things obvious". They let > you take otherwise hidden or implicit logic and making it explicit. > > The smaller and more focused your functions, the better. You should be > able to look at the function and, in just a moment, know what it does, > without reading comments. If it's not that obvious, ask why, then > clarify it by codifying "what's going on" in functions. > > At the time of writing the piece, I didn't have enough experience with > this method to know whether it was Good or Not Good. Today, I believe > that it's Very Good! (with amendments listed below) > > Here's why: > > - The "obviousness" standard, while subjective, drives a programmer to > think carefully about *everything*, to the point of understanding the > problem/solution ad nauseam > > - It shifts the nature of programming from "make the code work" to > "say what I want to say" -- which is a shift away from brute force > experimentation to deliberate problem elaboration/solving (this is why > I advocate trading test time for make-your-code-obvious time) > > - Your left with code that's *extremely* maintainable -- neither bugs > nor potential enhancements have anywhere to hide! Any change will > necessarily affect a small surface area that's easy to think about > (while you may see ripple effects across many functions depending on > the change, you'll know the exact boundary) > > As to performance, I'll followup with a separate reply, as it involves > large code chunks and this reply is already too long :) > > Garrett > > [1] There are a few changes I'd like to make to the religious dogma: > > 1. RoK and others have pointed out -- and I've come to heartily agree > with this -- that the use of variables can help further clarify a > function by a) placing key functions on their own line, thus > highlighting them, b) changing the order things are read from > right-to-left (as in the case of reading function calls) to top-down, > and c) a single variable name can be clearer than a function call with > arguments. > > 2. While it's possible to replace *all* case expressions with > functions, there are instances where case is clearly better. The > signal is when code becomes decisively *less obvious* without the case > expression. It's a judgement call. > > 3. In the blog post example, I use a pipeline to convey arguments to a > function. This is very odd indeed -- arguments should be spelled out > and passed discretely to a function, not as an array of values. (In > fact, there's a horrible error in that code, terrible!) > > Note that each of these points contributed to reduced lines-of-code > per function. You can see this was clearly a goal of mine!. Since > then, I've relaxed the LoC per function dogma. Though it's still a > good proxy for code quality, just without the authoritarian > religiosity. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Joe-the-duck-and-the-Queen1.jpg Type: image/jpeg Size: 52520 bytes Desc: not available URL: From gianfranco.alongi@REDACTED Fri Mar 8 13:54:19 2013 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Fri, 8 Mar 2013 13:54:19 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: Recommended books to anyone aspiring to reach a mental state above the level 'it works' http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073 http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X http://www.amazon.com/Implementation-Patterns-Kent-Beck/dp/0321413091 http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672 None of them are particularly heavy (although, the last two are more for reference). Professional developers try do deliver cheap code. More time is spent reading code than writing it. Therefore, minimize the time needed to read your code, making it cheaper. I would happily receive more good tips on book touching the subject of mastery and professionalism. On Fri, Mar 8, 2013 at 1:01 PM, Joe Armstrong wrote: > I've heard people say "writing code is easy" I disagree > > 1 - writing code that appears to work is easy > 2 - writing code is correct is far more difficult > 3 - writing code that is correct subject to the condition that is clear and > can be understood by other people is very difficult > 4 - writing code that is correct subject to the condition that is clear and > can be understood by other people and maintained in the future and > modified in the future is very very difficult > 5 - writing code that is correct subject to the condition that is clear and > can be understood by other people and maintained in the future and > modified in the future and is efficient is very very very difficult > > Writing efficient code is absolutely the last thing on my list - I get > stuck > round about point 2. > > About 25 years ago I wrote some code that was mind-melting complicated > the usual stuff - super smart code, super efficient, super undocumented, > let the force be with you stuff > > I distributed the program. Two months later I got a bug to fix. I couldn't > understand the code I had written two moths earlier - it was > totally incomprehensible - I rewrote it *clearly* - it was faster - I > modified it several times in the future - It might still be running today. > > These days if I have an easy problem I write the code first - but if it's > tricky I write some kind of user description first. > > I also have a rubber duck next to my computer - and the queen - in > tricky cases I try to explain how my code works to the rubber duck and the > queen. > > I take my rubber duck to meetings - when I just don't understand things > I pull out my rubber duck and say the magic words ... > > " go on explain to the rubber duck ..." > > Rubber ducks are pretty stupid so if the rubber duck can understand it > I can usually understand it. > > If you can explain your program to a rubber duck it's probably OK > > Cheers > > /Joe > > > > > > On Thu, Mar 7, 2013 at 5:25 PM, Garrett Smith wrote: > >> On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: >> > I wonder if Function call is better than Case when both of they can >> > implement the target I want? >> > It seems like write a function instead of case could make the code more >> > clear . >> > But which one is fast when it running? >> > I intend to change the case to function to make the code more clear. Is >> this >> > valuable? >> >> Over the last year or so, I've started to adopt the approach outlined >> here: >> >> >> http://www.gar1t.com/blog/2012/06/10/solving-embarrassingly-obvious-problems-in-erlang/ >> >> There are few things I'd like to modify in a followup post [1] but the >> general idea of working to make your code "embarrassingly obvious" >> still is the central idea. >> >> Functions are the primary mode of "making things obvious". They let >> you take otherwise hidden or implicit logic and making it explicit. >> >> The smaller and more focused your functions, the better. You should be >> able to look at the function and, in just a moment, know what it does, >> without reading comments. If it's not that obvious, ask why, then >> clarify it by codifying "what's going on" in functions. >> >> At the time of writing the piece, I didn't have enough experience with >> this method to know whether it was Good or Not Good. Today, I believe >> that it's Very Good! (with amendments listed below) >> >> Here's why: >> >> - The "obviousness" standard, while subjective, drives a programmer to >> think carefully about *everything*, to the point of understanding the >> problem/solution ad nauseam >> >> - It shifts the nature of programming from "make the code work" to >> "say what I want to say" -- which is a shift away from brute force >> experimentation to deliberate problem elaboration/solving (this is why >> I advocate trading test time for make-your-code-obvious time) >> >> - Your left with code that's *extremely* maintainable -- neither bugs >> nor potential enhancements have anywhere to hide! Any change will >> necessarily affect a small surface area that's easy to think about >> (while you may see ripple effects across many functions depending on >> the change, you'll know the exact boundary) >> >> As to performance, I'll followup with a separate reply, as it involves >> large code chunks and this reply is already too long :) >> >> Garrett >> >> [1] There are a few changes I'd like to make to the religious dogma: >> >> 1. RoK and others have pointed out -- and I've come to heartily agree >> with this -- that the use of variables can help further clarify a >> function by a) placing key functions on their own line, thus >> highlighting them, b) changing the order things are read from >> right-to-left (as in the case of reading function calls) to top-down, >> and c) a single variable name can be clearer than a function call with >> arguments. >> >> 2. While it's possible to replace *all* case expressions with >> functions, there are instances where case is clearly better. The >> signal is when code becomes decisively *less obvious* without the case >> expression. It's a judgement call. >> >> 3. In the blog post example, I use a pipeline to convey arguments to a >> function. This is very odd indeed -- arguments should be spelled out >> and passed discretely to a function, not as an array of values. (In >> fact, there's a horrible error in that code, terrible!) >> >> Note that each of these points contributed to reduced lines-of-code >> per function. You can see this was clearly a goal of mine!. Since >> then, I've relaxed the LoC per function dogma. Though it's still a >> good proxy for code quality, just without the authoritarian >> religiosity. >> _______________________________________________ >> 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 249505968@REDACTED Sat Mar 9 03:10:31 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Sat, 9 Mar 2013 10:10:31 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ICBXaGljaCBjaG9pY2UgaXMg?= =?gb18030?q?better=3F_Function_or_Case?= Message-ID: Thanks Joe ,Thanks for your rubber duck photo?I'm a newbie in coding world. And my team leader tell me the same thing that I should try the best to make the code clear~ The project code which I working in is ,in a sense, mess. After I read the "Refactoring, improve the design of exist code",written by Martin Fowler, I attempt to refact some part of the project. But I have no confidence whether my refactor could work well. It's there any magic meth to verify the code? ------------------ ???? ------------------ ???: "Joe Armstrong"; ????: 2013?3?8?(???) ??8:01 ???: "Garrett Smith"; ??: "??"<249505968@REDACTED>; "erlang-questions"; ??: Re: [erlang-questions] Which choice is better? Function or Case I've heard people say "writing code is easy" I disagree 1 - writing code that appears to work is easy 2 - writing code is correct is far more difficult 3 - writing code that is correct subject to the condition that is clear and can be understood by other people is very difficult 4 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future is very very difficult 5 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future and is efficient is very very very difficult Writing efficient code is absolutely the last thing on my list - I get stuck round about point 2. About 25 years ago I wrote some code that was mind-melting complicated the usual stuff - super smart code, super efficient, super undocumented, let the force be with you stuff I distributed the program. Two months later I got a bug to fix. I couldn't understand the code I had written two moths earlier - it was totally incomprehensible - I rewrote it *clearly* - it was faster - I modified it several times in the future - It might still be running today. These days if I have an easy problem I write the code first - but if it's tricky I write some kind of user description first. I also have a rubber duck next to my computer - and the queen - in tricky cases I try to explain how my code works to the rubber duck and the queen. I take my rubber duck to meetings - when I just don't understand things I pull out my rubber duck and say the magic words ... " go on explain to the rubber duck ..." Rubber ducks are pretty stupid so if the rubber duck can understand it I can usually understand it. If you can explain your program to a rubber duck it's probably OK Cheers /Joe On Thu, Mar 7, 2013 at 5:25 PM, Garrett Smith wrote: On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > I wonder if Function call is better than Case when both of they can > implement the target I want? > It seems like write a function instead of case could make the code more > clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. Is this > valuable? Over the last year or so, I've started to adopt the approach outlined here: http://www.gar1t.com/blog/2012/06/10/solving-embarrassingly-obvious-problems-in-erlang/ There are few things I'd like to modify in a followup post [1] but the general idea of working to make your code "embarrassingly obvious" still is the central idea. Functions are the primary mode of "making things obvious". They let you take otherwise hidden or implicit logic and making it explicit. The smaller and more focused your functions, the better. You should be able to look at the function and, in just a moment, know what it does, without reading comments. If it's not that obvious, ask why, then clarify it by codifying "what's going on" in functions. At the time of writing the piece, I didn't have enough experience with this method to know whether it was Good or Not Good. Today, I believe that it's Very Good! (with amendments listed below) Here's why: - The "obviousness" standard, while subjective, drives a programmer to think carefully about *everything*, to the point of understanding the problem/solution ad nauseam - It shifts the nature of programming from "make the code work" to "say what I want to say" -- which is a shift away from brute force experimentation to deliberate problem elaboration/solving (this is why I advocate trading test time for make-your-code-obvious time) - Your left with code that's *extremely* maintainable -- neither bugs nor potential enhancements have anywhere to hide! Any change will necessarily affect a small surface area that's easy to think about (while you may see ripple effects across many functions depending on the change, you'll know the exact boundary) As to performance, I'll followup with a separate reply, as it involves large code chunks and this reply is already too long :) Garrett [1] There are a few changes I'd like to make to the religious dogma: 1. RoK and others have pointed out -- and I've come to heartily agree with this -- that the use of variables can help further clarify a function by a) placing key functions on their own line, thus highlighting them, b) changing the order things are read from right-to-left (as in the case of reading function calls) to top-down, and c) a single variable name can be clearer than a function call with arguments. 2. While it's possible to replace *all* case expressions with functions, there are instances where case is clearly better. The signal is when code becomes decisively *less obvious* without the case expression. It's a judgement call. 3. In the blog post example, I use a pipeline to convey arguments to a function. This is very odd indeed -- arguments should be spelled out and passed discretely to a function, not as an array of values. (In fact, there's a horrible error in that code, terrible!) Note that each of these points contributed to reduced lines-of-code per function. You can see this was clearly a goal of mine!. Since then, I've relaxed the LoC per function dogma. Though it's still a good proxy for code quality, just without the authoritarian religiosity. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Sat Mar 9 03:21:05 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Sat, 9 Mar 2013 10:21:05 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ICBXaGljaCBjaG9pY2UgaXMg?= =?gb18030?q?better=3F_Function_or_Case?= Message-ID: Thanks Gianfranco, The books seems great! I've read some of it.Clear code would be the most important thing in my work! I'm not sure how to reply the mail via mail list (It's my first time to use mail list system). Thanks all others who help me how to make code more clear! ------------------ ???? ------------------ ???: "Gianfranco Alongi"; ????: 2013?3?8?(???) ??8:54 ???: "Joe Armstrong"; ??: "Garrett Smith"; "??"<249505968@REDACTED>; "erlang-questions"; ??: Re: [erlang-questions] Which choice is better? Function or Case Recommended books to anyone aspiring to reach a mental state above the level 'it works' http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073 http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X http://www.amazon.com/Implementation-Patterns-Kent-Beck/dp/0321413091 http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672 None of them are particularly heavy (although, the last two are more for reference). Professional developers try do deliver cheap code. More time is spent reading code than writing it. Therefore, minimize the time needed to read your code, making it cheaper. I would happily receive more good tips on book touching the subject of mastery and professionalism. On Fri, Mar 8, 2013 at 1:01 PM, Joe Armstrong wrote: I've heard people say "writing code is easy" I disagree 1 - writing code that appears to work is easy 2 - writing code is correct is far more difficult 3 - writing code that is correct subject to the condition that is clear and can be understood by other people is very difficult 4 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future is very very difficult 5 - writing code that is correct subject to the condition that is clear and can be understood by other people and maintained in the future and modified in the future and is efficient is very very very difficult Writing efficient code is absolutely the last thing on my list - I get stuck round about point 2. About 25 years ago I wrote some code that was mind-melting complicated the usual stuff - super smart code, super efficient, super undocumented, let the force be with you stuff I distributed the program. Two months later I got a bug to fix. I couldn't understand the code I had written two moths earlier - it was totally incomprehensible - I rewrote it *clearly* - it was faster - I modified it several times in the future - It might still be running today. These days if I have an easy problem I write the code first - but if it's tricky I write some kind of user description first. I also have a rubber duck next to my computer - and the queen - in tricky cases I try to explain how my code works to the rubber duck and the queen. I take my rubber duck to meetings - when I just don't understand things I pull out my rubber duck and say the magic words ... " go on explain to the rubber duck ..." Rubber ducks are pretty stupid so if the rubber duck can understand it I can usually understand it. If you can explain your program to a rubber duck it's probably OK Cheers /Joe On Thu, Mar 7, 2013 at 5:25 PM, Garrett Smith wrote: On Thu, Mar 7, 2013 at 3:11 AM, ?? <249505968@REDACTED> wrote: > I wonder if Function call is better than Case when both of they can > implement the target I want? > It seems like write a function instead of case could make the code more > clear . > But which one is fast when it running? > I intend to change the case to function to make the code more clear. Is this > valuable? Over the last year or so, I've started to adopt the approach outlined here: http://www.gar1t.com/blog/2012/06/10/solving-embarrassingly-obvious-problems-in-erlang/ There are few things I'd like to modify in a followup post [1] but the general idea of working to make your code "embarrassingly obvious" still is the central idea. Functions are the primary mode of "making things obvious". They let you take otherwise hidden or implicit logic and making it explicit. The smaller and more focused your functions, the better. You should be able to look at the function and, in just a moment, know what it does, without reading comments. If it's not that obvious, ask why, then clarify it by codifying "what's going on" in functions. At the time of writing the piece, I didn't have enough experience with this method to know whether it was Good or Not Good. Today, I believe that it's Very Good! (with amendments listed below) Here's why: - The "obviousness" standard, while subjective, drives a programmer to think carefully about *everything*, to the point of understanding the problem/solution ad nauseam - It shifts the nature of programming from "make the code work" to "say what I want to say" -- which is a shift away from brute force experimentation to deliberate problem elaboration/solving (this is why I advocate trading test time for make-your-code-obvious time) - Your left with code that's *extremely* maintainable -- neither bugs nor potential enhancements have anywhere to hide! Any change will necessarily affect a small surface area that's easy to think about (while you may see ripple effects across many functions depending on the change, you'll know the exact boundary) As to performance, I'll followup with a separate reply, as it involves large code chunks and this reply is already too long :) Garrett [1] There are a few changes I'd like to make to the religious dogma: 1. RoK and others have pointed out -- and I've come to heartily agree with this -- that the use of variables can help further clarify a function by a) placing key functions on their own line, thus highlighting them, b) changing the order things are read from right-to-left (as in the case of reading function calls) to top-down, and c) a single variable name can be clearer than a function call with arguments. 2. While it's possible to replace *all* case expressions with functions, there are instances where case is clearly better. The signal is when code becomes decisively *less obvious* without the case expression. It's a judgement call. 3. In the blog post example, I use a pipeline to convey arguments to a function. This is very odd indeed -- arguments should be spelled out and passed discretely to a function, not as an array of values. (In fact, there's a horrible error in that code, terrible!) Note that each of these points contributed to reduced lines-of-code per function. You can see this was clearly a goal of mine!. Since then, I've relaxed the LoC per function dogma. Though it's still a good proxy for code quality, just without the authoritarian religiosity. _______________________________________________ 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 249505968@REDACTED Sat Mar 9 10:16:15 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Sat, 9 Mar 2013 17:16:15 +0800 Subject: [erlang-questions] Is the function call always pass by value? Message-ID: I have do a test about the function call. There are some strange thing happen when I use function call to pass a tuple. The runtime won't change whatever the tuple scale size change(still smaller than 10k atom in it). So I wonder if the function call always pass value? And in I my project there is a efficiency bottleneck. There is some function loop with passing some large record. simply like this %============================= dot_write_func_dup(N) -> X = #test{}, statistics(runtime), dot_func_dup(N,X), {_,TotalRunTime}=statistics(runtime), io:format("totalruntime:~w~n",[TotalRunTime]). %============================= dot_func_dup(N,X) when N > 0 -> I = X#test{r500 = n}, J = I#test{r501 = m}, dot_func_dup(N -1 ,X); dot_func_dup(0,X) -> I = X#test{r500 = n}, J = I#test{r501 = m}. %=============================It seems very slow with the loop. And we attempt to change the record loop to process dictionary. It's worthy to change it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Sat Mar 9 10:40:37 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Sat, 9 Mar 2013 10:40:37 +0100 Subject: [erlang-questions] Is the function call always pass by value? In-Reply-To: References: Message-ID: On Sat, Mar 9, 2013 at 10:16 AM, ?? <249505968@REDACTED> wrote: > I have do a test about the function call. > There are some strange thing happen when I use function call to pass a > tuple. > The runtime won't change whatever the tuple scale size change(still smaller > than 10k atom in it). > > So I wonder if the function call always pass value? In Erlang it does not matter, because you cannot modify the tuple. AND have no pointers. Hence I am pretty sure it does not make a difference because pointer is passed to the stack. > And in I my project there is a efficiency bottleneck. > There is some function loop with passing some large record. > simply like this > %============================= > dot_write_func_dup(N) -> > X = #test{}, > statistics(runtime), > dot_func_dup(N,X), > {_,TotalRunTime}=statistics(runtime), > io:format("totalruntime:~w~n",[TotalRunTime]). > %============================= > dot_func_dup(N,X) when N > 0 -> > I = X#test{r500 = n}, > J = I#test{r501 = m}, > dot_func_dup(N -1 ,X); > dot_func_dup(0,X) -> > I = X#test{r500 = n}, > J = I#test{r501 = m}. > %============================= You are constructing a record (`J`) and then immediately discarding it. Is this for purpose? You should get "unused variable `J`" warning while compiling the module. Perhaps you meant J instead of X in do_func_dup(N-1, X) ? > It seems very slow with the loop. Numbers would be really good addition to this statement: small record vs large record. > And we attempt to change the record loop to process dictionary. > It's worthy to change it? Anyway, changing a value in the record (tuple) requires to copy the whole record (tuple)*. So yes, it will be slow. And process dictionary will be more efficient. And think about ETS. [*]: there are exceptions. See http://www.erlang.org/doc/efficiency_guide/commoncaveats.html section "3.4 setelement/3". -- Motiejus Jak?tys From hd2010@REDACTED Sat Mar 9 15:13:12 2013 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 9 Mar 2013 15:13:12 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: Message-ID: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Hi list, I realize I keep coming back to the question, even on Saturdays, did Gianfranco mean more comments, or less. On Mar 8, 2013, at 1:54 PM, Gianfranco Alongi wrote: > Therefore, minimize the time needed to read your code, making it cheaper. > In likeliness, I fancy, you meant neither and the balance between cluttering the source into unreadability or under commenting is as delicate as the coding itself. While the language already offers different ways to achieve the same thing, how much more liberty is there in commenting. Robert one time suggested the Church of Short Variable Names to me as a way to reduce Erlang's occasional verbosity. Once you dare writing one-letter variables, it makes a difference like night and day. It is, on the face of it, so much easier to read. But using single letter variables all but makes comments part of the code. One may claim the code to be close to useless without the comments. Since we just saw specs evolving from comment annotations to language part, I wonder if that is a pointer: what part of the comments are to be considered mandatory part of the code, beyond specs, which latter had type verification as focus. What other commenting part that has semantics as focus would emerge, not to create new restrictions but as a guide line to support one's future self, or whoever inherited your code? This, in part, goes back to Joe's proposal to annotate the Internet. While that was not about form but more of a technical discussion, the inspiration is similar. Henning From hd2010@REDACTED Sat Mar 9 16:32:08 2013 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 9 Mar 2013 16:32:08 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <41051FEE-CD3A-4A18-B131-6F55EFD6570A@cs.otago.ac.nz> References: <259514648.66223677.1362679324058.JavaMail.root@erlang-solutions.com> <41051FEE-CD3A-4A18-B131-6F55EFD6570A@cs.otago.ac.nz> Message-ID: Hi Richard, On Mar 8, 2013, at 12:39 AM, Richard A. O'Keefe wrote: > If Helmuth von Moltke is in an afterlife that permits him to > entertain such thoughts, he probably wishes he had said > "no plan survives contact with the enemy", but he said > "no operation extends with any certainty beyond the first > encounter with the main body of the enemy", which is not so > pithy, but offers extra insight. A great example for why to leave extras out. You would never have heard of the quote had he succumbed to this feature creep. Henning From michael.santos@REDACTED Sat Mar 9 16:40:44 2013 From: michael.santos@REDACTED (Michael Santos) Date: Sat, 9 Mar 2013 10:40:44 -0500 Subject: [erlang-questions] USB, rs232 links In-Reply-To: References: Message-ID: <20130309154044.GC6319@ioctl> On Thu, Mar 07, 2013 at 11:29:43PM +0100, Xavier Maillard wrote: > Hello, > > for my next (serious and personal) project with Erlang, I will have to > study rs232 and use a USB device connected. > > Do you know whether something in Erlang already exist so I won't > reinvent the wheel ? > > Thank you > > /Xavier Another option might be srly: https://github.com/msantos/srly If you're comfortable with the Unix serial interface, srly is just a thin layer over it. It tries to just implement the minimum required in C and does the rest in Erlang. I've used it for interacting with an Arduino. For example, to upload code to an Arduino: https://github.com/msantos/stk500 Or to flash the LEDs whenever there's activity on my IPv6 tunnel: https://github.com/msantos/sut/blob/master/examples/tunnel_activity.erl From bengt.kleberg@REDACTED Sat Mar 9 17:39:53 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Sat, 9 Mar 2013 16:39:53 +0000 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> References: , <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: Greetings Yesterday I found myself wishing for a one letter variable name. The code said " unitname ", but what was wanted was unit identity. A single letter would have been less missleading. Bengt Sent from Moxier Mail (http://www.moxier.com) ----- Ursprungligt meddelande ----- Fr?n: Henning Diedrich Till: Gianfranco Alongi Kopia: ?? <249505968@REDACTED>, erlang-questions Skickat: 09-03-2013 3:13 em ?mne: Re: [erlang-questions] Which choice is better? Function or Case Hi list, I realize I keep coming back to the question, even on Saturdays, did Gianfranco mean more comments, or less. On Mar 8, 2013, at 1:54 PM, Gianfranco Alongi wrote: > Therefore, minimize the time needed to read your code, making it cheaper. > In likeliness, I fancy, you meant neither and the balance between cluttering the source into unreadability or under commenting is as delicate as the coding itself. While the language already offers different ways to achieve the same thing, how much more liberty is there in commenting. Robert one time suggested the Church of Short Variable Names to me as a way to reduce Erlang's occasional verbosity. Once you dare writing one-letter variables, it makes a difference like night and day. It is, on the face of it, so much easier to read. But using single letter variables all but makes comments part of the code. One may claim the code to be close to useless without the comments. Since we just saw specs evolving from comment annotations to language part, I wonder if that is a pointer: what part of the comments are to be considered mandatory part of the code, beyond specs, which latter had type verification as focus. What other commenting part that has semantics as focus would emerge, not to create new restrictions but as a guide line to support one's future self, or whoever inherited your code? This, in part, goes back to Joe's proposal to annotate the Internet. While that was not about form but more of a technical discussion, the inspiration is similar. Henning _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Sat Mar 9 18:22:04 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 9 Mar 2013 18:22:04 +0100 Subject: [erlang-questions] build errors Message-ID: Hi, Do these build errors look familiar to anyone? Ubuntu 12.10, the latest 'maint' branch. regards, Vlad obj/i686-pc-linux-gnu/opt/libepcre.a -lethread -lerts_internal_r -lpthread -lrt obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:363: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:368: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:449: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:337: undefined reference to `erts_printf_sword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:388: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:391: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:375: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:378: undefined reference to `erts_printf_uword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:381: undefined reference to `erts_printf_uword' obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_atom_name': /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:156: undefined reference to `erts_printf_sword' obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:478: undefined reference to `erts_printf_sword' /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:481: undefined reference to `erts_printf_sword' obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_atom_name': /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:206: undefined reference to `erts_printf_uword' -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Sat Mar 9 18:22:07 2013 From: g@REDACTED (Garrett Smith) Date: Sat, 9 Mar 2013 11:22:07 -0600 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: On Sat, Mar 9, 2013 at 10:39 AM, Bengt Kleberg wrote: > Greetings > > Yesterday I found myself wishing for a one letter variable name. The code said " unitname ", but what was wanted was unit identity. A single letter would have been less missleading. There should be a Mechanical Turk service where you can paste your function and then get a max-voted-up recommended spelling. It'd be a great outlet for OCD plagued programmers like myself to spend Saturday mornings over coffee :) It does come down to common sense. If a single letter variable is not clear, throw in a few extra. This is why I like the "obvious" standard. It's of course subjective, but it's something a group of programmers can converge on, and then work toward. The result is hopefully one of Joe's "very hard" iterations of correctness and maintainability. Garrett From zabrane3@REDACTED Sat Mar 9 22:12:33 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 9 Mar 2013 22:12:33 +0100 Subject: [erlang-questions] Is is safe? Message-ID: Hi guys, Is is safe to call driver_realloc (http://www.erlang.org/doc/man/erl_driver.html#driver_realloc) with a null pointer: ErlDrvBinary *ptr = NULL; [...] ptr = driver_realloc(ptr, len); assert(ptr); The doc says it's simply a wrapper around "realloc" and my code seems to work well. The first call is simply a call to "malloc" as the pointer is null, right? Can you confirm (OTP) guys? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Mar 9 22:17:41 2013 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 9 Mar 2013 22:17:41 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: On Sat, Mar 9, 2013 at 3:13 PM, Henning Diedrich wrote: > Hi list, > > I realize I keep coming back to the question, even on Saturdays, did > Gianfranco mean more comments, or less. > > On Mar 8, 2013, at 1:54 PM, Gianfranco Alongi > wrote: > > > Therefore, minimize the time needed to read your code, making it cheaper. > > > > > In likeliness, I fancy, you meant neither and the balance between > cluttering the source into unreadability or under commenting is as delicate > as the coding itself. > > While the language already offers different ways to achieve the same > thing, how much more liberty is there in commenting. > > Robert one time suggested the Church of Short Variable Names to me as a > way to reduce Erlang's occasional verbosity. > > Once you dare writing one-letter variables, it makes a difference like > night and day. It is, on the face of it, so much easier to read. > > But using single letter variables all but makes comments part of the code. > One may claim the code to be close to useless without the comments. > I try to use very short variable names. In my mind variable names carry to meaning. I'm very very fussy about extremely accurate function names. If a function says do_this_and_that it should do exactly this_and_that and not something else. Also comments should be extremely accurate . Non-obvious tricks should be explained in detail. Obvious things should not be commented. Comments should be repaired with the same lova and care as code. Without spelling and punctuation errors. If I see a typo in a comment my brain says "this program is not yet ready for publication" - practising the art needs fine attention to detail. I actually think one should publish (for each module) - a .hrl file for each module with comments and function specs and types - documentation for the module - a .beam file and NO .erl file (should be available on demand) Doing this would really test if you code is sufficiently well described for somebody else to actually use. If somebody has to read your code to figure out what it does you have failed. (This is yet another reason why programming is difficult and takes time) Cheers /Joe > > Since we just saw specs evolving from comment annotations to language > part, I wonder if that is a pointer: > > what part of the comments are to be considered mandatory part of the code, > beyond specs, which latter had type verification as focus. > > What other commenting part that has semantics as focus would emerge, not > to create new restrictions but as a guide line to support one's future > self, or whoever inherited your code? > > This, in part, goes back to Joe's proposal to annotate the Internet. While > that was not about form but more of a technical discussion, the inspiration > is similar. > > Henning > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sat Mar 9 22:32:40 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 9 Mar 2013 22:32:40 +0100 Subject: [erlang-questions] code:root_dir() under Windows gives short path names Message-ID: <747C2695-AB35-47D7-90AB-0BD83C464736@gmail.com> This is an old question without an answer: http://www1.erlang.org/pipermail/erlang-questions/2007-April/026337.html Anyone to help? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Sat Mar 9 23:01:08 2013 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 09 Mar 2013 14:01:08 -0800 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: <513BB124.5010306@gmail.com> On 03/09/2013 01:17 PM, Joe Armstrong wrote: > > > On Sat, Mar 9, 2013 at 3:13 PM, Henning Diedrich > wrote: > > Hi list, > > I realize I keep coming back to the question, even on Saturdays, did Gianfranco mean more comments, or less. > > On Mar 8, 2013, at 1:54 PM, Gianfranco Alongi > wrote: > > > Therefore, minimize the time needed to read your code, making it cheaper. > > > > > In likeliness, I fancy, you meant neither and the balance between cluttering the source into unreadability or under commenting is as delicate as the coding itself. > > While the language already offers different ways to achieve the same thing, how much more liberty is there in commenting. > > Robert one time suggested the Church of Short Variable Names to me as a way to reduce Erlang's occasional verbosity. > > Once you dare writing one-letter variables, it makes a difference like night and day. It is, on the face of it, so much easier to read. > > But using single letter variables all but makes comments part of the code. One may claim the code to be close to useless without the comments. > > > I try to use very short variable names. In my mind variable names carry to meaning. I'm very very fussy about extremely accurate function names. If a function says do_this_and_that it should do exactly this_and_that and not something else. > > Also comments should be extremely accurate . Non-obvious tricks should be > explained in detail. Obvious things should not be commented. > > Comments should be repaired with the same lova and care as code. Without > spelling and punctuation errors. If I see a typo in a comment my brain says > "this program is not yet ready for publication" - practising the art needs fine > attention to detail. > > I actually think one should publish (for each module) > > - a .hrl file for each module with comments and function specs and types > - documentation for the module > - a .beam file > > and NO .erl file (should be available on demand) > > Doing this would really test if you code is sufficiently well described for > somebody else to actually use. > > If somebody has to read your code to figure out what it does you have failed. > > (This is yet another reason why programming is difficult and takes time) > > Cheers > > /Joe I think the only major annoyance with what you have suggested with .hrl files is that edoc does not operate on the comments within .hrl files, so the functions are left missing from the documentation that edoc generates. I have not looked at what it would take to get edoc to work with .hrl files, but I assumed it was a lower layer throwing the comments out before edoc gets them. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hd2010@REDACTED Sat Mar 9 23:44:12 2013 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 9 Mar 2013 23:44:12 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: Hi Joe, On Mar 9, 2013, at 10:17 PM, Joe Armstrong wrote: > I try to use very short variable names. In my mind variable names carry [N]o meaning. I'm very very fussy about extremely accurate function names. If a function says do_this_and_that it should do exactly this_and_that and not something else. yes, the obligatory complement to the Short Variable Names Church are speaking function names! But in my experience, sadly, they do not render unnecessary the comment explanations for the variables. I wish. (Not that Joe said anything remotely like that.) > Comments should be repaired with the same lova and care as code. Without > spelling and punctuation errors. If I see a typo in a comment [?] I'll add block justification. I like my comments justified. Really freaks some serious people out though. But the reality is that most code will not get to that point. What I am looking for on the practical side is a standardized, fast-to-read way to explain the one-letter variables, across repeat variants of functions and useful for edocs. Henning -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Sun Mar 10 01:48:31 2013 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 10 Mar 2013 00:48:31 +0000 (GMT) Subject: [erlang-questions] Is the function call always pass by value? In-Reply-To: Message-ID: <1847498020.71348557.1362876511367.JavaMail.root@erlang-solutions.com> Yes, basically, everything, both arguments and return values, is passed "by reference". But, as you say, this is not noticeable as you can't change a value. Robert ----- Original Message ----- > From: "Motiejus Jak?tys" > To: "??" <249505968@REDACTED> > Cc: "erlang-questions" > Sent: Saturday, 9 March, 2013 10:40:37 AM > Subject: Re: [erlang-questions] Is the function call always pass by value? > > On Sat, Mar 9, 2013 at 10:16 AM, ?? <249505968@REDACTED> wrote: > > I have do a test about the function call. > > There are some strange thing happen when I use function call to > > pass a > > tuple. > > The runtime won't change whatever the tuple scale size change(still > > smaller > > than 10k atom in it). > > > > So I wonder if the function call always pass value? > > > In Erlang it does not matter, because you cannot modify the tuple. > AND > have no pointers. Hence I am pretty sure it does not make a > difference > because pointer is passed to the stack. > > > And in I my project there is a efficiency bottleneck. > > There is some function loop with passing some large record. > > simply like this > > %============================= > > dot_write_func_dup(N) -> > > X = #test{}, > > statistics(runtime), > > dot_func_dup(N,X), > > {_,TotalRunTime}=statistics(runtime), > > io:format("totalruntime:~w~n",[TotalRunTime]). > > %============================= > > dot_func_dup(N,X) when N > 0 -> > > I = X#test{r500 = n}, > > J = I#test{r501 = m}, > > dot_func_dup(N -1 ,X); > > dot_func_dup(0,X) -> > > I = X#test{r500 = n}, > > J = I#test{r501 = m}. > > %============================= > > You are constructing a record (`J`) and then immediately discarding > it. Is this for purpose? You should get "unused variable `J`" warning > while compiling the module. Perhaps you meant J instead of X in > do_func_dup(N-1, X) ? > > > It seems very slow with the loop. > Numbers would be really good addition to this statement: small record > vs large record. > > > And we attempt to change the record loop to process dictionary. > > It's worthy to change it? > > Anyway, changing a value in the record (tuple) requires to copy the > whole record (tuple)*. So yes, it will be slow. And process > dictionary > will be more efficient. And think about ETS. > > [*]: there are exceptions. See > http://www.erlang.org/doc/efficiency_guide/commoncaveats.html section > "3.4 setelement/3". > > -- > Motiejus Jak?tys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Sun Mar 10 01:57:45 2013 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 10 Mar 2013 00:57:45 +0000 (GMT) Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <51390B8D.2070305@cs.ntua.gr> Message-ID: <1837816749.71362680.1362877065731.JavaMail.root@erlang-solutions.com> > From: "Kostis Sagonas" > > On 03/07/2013 06:48 PM, Robert Virding wrote: > > Keep them crossed. :-) It's definitely not impossible, it "just" > > needs the dialyzer people to implement hooks to which we (LFE, > > Joxa, ...) can write plugins. It that were to happen I might even > > add type specifications to LFE. > > Even disregarding for the moment the question why would "the dialyzer > people" care about lfe, joxa, et al., (dialyzer: Discrepancy Analyzer > of > *Erlang* code) if you are not more specific than the above wish how > exactly do you expect them to know about the details of possible > hooks > that are needed by non-standard uses of dialyzer by other more exotic > languages out there? Well, if you want to be really strict then dialyzer works on *Core erlang* code. This is what dialyzer means by Erlang. So in this sense anything which generates Core erlang is *erlang* code from dialyzer's point of view. Whether it be LFE, Joxa, Elixir or whatever. > Better yet, dialyzer's code base is on github, and thus one can > submit > patches (hint, hint!) that have a very good chance of being included > in > its code base if they do not break dialyzer's current functionality > and > come with tests that ensure that the extra functionality will not be > accidentally broken in the future. To be practical the people working with dialyzer could restructure it's input phase to use plugins based on file extension much faster than anyone else. Using it on erlang code would then just be another plugin, but one that is provided with dialyzer. Robert From rapsey@REDACTED Sun Mar 10 08:50:31 2013 From: rapsey@REDACTED (Rapsey) Date: Sun, 10 Mar 2013 08:50:31 +0100 Subject: [erlang-questions] code:root_dir() under Windows gives short path names In-Reply-To: <747C2695-AB35-47D7-90AB-0BD83C464736@gmail.com> References: <747C2695-AB35-47D7-90AB-0BD83C464736@gmail.com> Message-ID: Well it would not be too hard to repair that path using filelib:wildcard. Sergej On Sat, Mar 9, 2013 at 10:32 PM, Zabrane Mickael wrote: > This is an old question without an answer: > http://www1.erlang.org/pipermail/erlang-questions/2007-April/026337.html > > Anyone to help? > > 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 ok@REDACTED Sun Mar 10 09:27:36 2013 From: ok@REDACTED (ok@REDACTED) Date: Sun, 10 Mar 2013 21:27:36 +1300 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: I once had to maintain some code written by a highly skilled programmer in a language not entirely unlike Erlang. All the variable names were one letter or one letter and one digit. It had me screaming in frustration. It took me about a day a page to reconstruct meaningful names for the variables. I'm trying to think of anything nastier for a programmer to do to another programmer than to know something the second programmer needs to know and deliberately choose to conceal it by using ultra-short variable names. If I have any luck I'll let you know. Seriously, the job of a programmer is to *COMMUNICATE* with other programmers. I wish I could offer a simple rule for how long to make variable names. My colleague who refuses to use "i" for a loop index in C++, preferring innerLoopIndex, clearly errs on one side. Someone who uses T for timestamp, tree, and table in the same module clearly errs on the other. One rule of thumb I can offer you is this: there's an interplay between *type* and *purpose*, in that a variable with a complicated type is likely to have few plausible purposes in a given scope. If it's obvious to a reader what the type of a variable is, you can get away with shorter variables. For something with a frequently used type, you had better be clear about purpose. From gianfranco.alongi@REDACTED Sun Mar 10 10:35:17 2013 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Sun, 10 Mar 2013 10:35:17 +0100 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: I am (like most others, I imagine) - amused by this email thread that now drifts far off from the original question, and now ventures into and through the land of clean code, good coding practices and principles. Seriously, everyone who has not seen the work of Robert C. Martin (Uncle Bob), is strongly encouraged to do so. He is a very strong character who pours a lot of hours into writing and thinking about communicative code, and readability. Why am I writing? I just want to take the time and support the previous email, which I hope will be the last, so we can avert a full-blown flame war between the short-variable-name and comments people and those who focus on clarity, communication and conveying of intent. No matter what smart solutions you think you have for a problem. If it is unreadable by someone else, and not maintainable - you have failed. You clearly failed to express yourself through code. Another thing that I have noticed is that some "old timers" believe that they do not need to educate themselves in the art of clean coding. They only care about making it work, and stop at that. It is saddening, as there are a lot of upcoming developers from younger generations that look up to them as role models, and so, the unprofessional attitude is passed down from one generation to the next. The professional knows that clean code that clearly communicates your intent - is the king. Cheers G On Sun, Mar 10, 2013 at 9:27 AM, wrote: > I once had to maintain some code written by a highly skilled > programmer in a language not entirely unlike Erlang. All the > variable names were one letter or one letter and one digit. > > It had me screaming in frustration. It took me about a day a > page to reconstruct meaningful names for the variables. > > I'm trying to think of anything nastier for a programmer to > do to another programmer than to know something the second > programmer needs to know and deliberately choose to conceal > it by using ultra-short variable names. If I have any luck > I'll let you know. > > Seriously, the job of a programmer is to *COMMUNICATE* with > other programmers. I wish I could offer a simple rule for > how long to make variable names. My colleague who refuses > to use "i" for a loop index in C++, preferring > innerLoopIndex, clearly errs on one side. Someone who uses > T for timestamp, tree, and table in the same module clearly > errs on the other. > > One rule of thumb I can offer you is this: > there's an interplay between *type* and *purpose*, > in that a variable with a complicated type is likely > to have few plausible purposes in a given scope. > If it's obvious to a reader what the type of a variable > is, you can get away with shorter variables. > For something with a frequently used type, you had > better be clear about purpose. > > > _______________________________________________ > 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 Sun Mar 10 11:17:45 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Sun, 10 Mar 2013 11:17:45 +0100 Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <1837816749.71362680.1362877065731.JavaMail.root@erlang-solutions.com> References: <1837816749.71362680.1362877065731.JavaMail.root@erlang-solutions.com> Message-ID: <513C5DC9.40904@cs.ntua.gr> On 03/10/2013 01:57 AM, Robert Virding wrote: >> From: "Kostis Sagonas" >> >> On 03/07/2013 06:48 PM, Robert Virding wrote: >>> Keep them crossed. :-) It's definitely not impossible, it "just" >>> needs the dialyzer people to implement hooks to which we (LFE, >>> Joxa, ...) can write plugins. It that were to happen I might even >>> add type specifications to LFE. >> >> Even disregarding for the moment the question why would "the dialyzer >> people" care about lfe, joxa, et al., (dialyzer: Discrepancy Analyzer >> of >> *Erlang* code) if you are not more specific than the above wish how >> exactly do you expect them to know about the details of possible >> hooks >> that are needed by non-standard uses of dialyzer by other more exotic >> languages out there? > > Well, if you want to be really strict then dialyzer works on *Core erlang* code. This is what dialyzer means by Erlang. No, it's not. Just because dialyzer does its analysis on Core Erlang, this does not mean that it was ever designed to analyze languages other than Erlang. I grant you that dialyzer's analysis is in principle applicable to other languages that compile to Core Erlang, but I think that my previous mail makes it clear that I also think that the responsibility for doing any changes that are required lies with the developers of languages who are interested in having such a tool for their language. It's probably irrational to expect that non-users of a language care about the tools that are available for it more than the community of that language, isn't it? Kostis From thomas@REDACTED Sun Mar 10 16:33:41 2013 From: thomas@REDACTED (Thomas Allen) Date: Sun, 10 Mar 2013 11:33:41 -0400 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> Message-ID: <513CA7D5.1000309@oinksoft.com> On 3/10/13 4:27 AM, ok@REDACTED wrote:> I'm trying to think of anything nastier for a programmer to > do to another programmer than to know something the second > programmer needs to know and deliberately choose to conceal > it by using ultra-short variable names. If I have any luck > I'll let you know. > > Seriously, the job of a programmer is to *COMMUNICATE* with > other programmers. I wish I could offer a simple rule for > how long to make variable names. My colleague who refuses > to use "i" for a loop index in C++, preferring > innerLoopIndex, clearly errs on one side. Someone who uses > T for timestamp, tree, and table in the same module clearly > errs on the other. I agree with this, to a point. Few things irk me as much as Ret = fish_bowl:boil(Bowl, timer:minutes(3)), %% ... Ret. I've seen many high quality projects that do this, so I cannot criticize the technique as some engineering downfall, but never once have I encountered a variable of this sort that was not better served by a descriptive name. In this case, perhaps `Boiled' is the correct name. However, this has more to do with variable names that mean nothing in context. There's no sense in proscribing short variable names without consideration. Suppose a function that searches a list of `dict()`s which are expected to simply store `term()`s for the user, where we cannot infer the type or other nature of the value. In that function, I believe that variable names such `K' and `V' are entirely suitable, just as `X' and `N' fit comfortably in a mathematical function. What I don't like is variable names like `X', `X1', `X2' in a function that is not mathematical at all. Even if a program is full of nothing but the simplest functions, their clauses must still be maintained by somebody, and there's no sense in deliberately providing vague, short variable names simply for the sake of narrower code or less typing. Of course, there are exceptions to every rule ... "A foolish consistency is the hobgoblin of little minds." Thomas Allen From vkuznet@REDACTED Sun Mar 10 18:36:37 2013 From: vkuznet@REDACTED (Valentin Kuznetsov) Date: Sun, 10 Mar 2013 13:36:37 -0400 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX Message-ID: Hi, I built OTP application using rebar build tool and when I'm running on UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has dos '\r' carriage return symbols in every line. I look-up on a web and did not find any reference about such behavior. I'll appreciate any suggestions why this happens (I don't think it's related to my application per-se and rather feel that it's somehow introduced by rebar, but I'm not sure). The carriage return symbols appears right after logging started message and follow up ever line after that. Here is an example of the head of my log. ===== ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 ===== Exec: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec -boot /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd -mode embedded -config /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config -args_file /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- console^M Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:5] [hipe] [kernel-poll:true]^M ^M ^M Thanks, Valentin. From rtrlists@REDACTED Sun Mar 10 19:55:42 2013 From: rtrlists@REDACTED (Robert Raschke) Date: Sun, 10 Mar 2013 18:55:42 +0000 Subject: [erlang-questions] Which choice is better? Function or Case In-Reply-To: <513CA7D5.1000309@oinksoft.com> References: <99306920-620C-41C1-BC5C-3625657A1435@eonblast.com> <513CA7D5.1000309@oinksoft.com> Message-ID: I would go so far to say that every programmer in the world would like to name things appropriately. But finding the right names can be hard and time consuming. And it is this time that is required for good naming that is often sacrificed by *managers* who are unwilling to understand the impact of poor naming. A good review structure will quite easily rectify naming deficiencies. Getting (or making) time for proper reviews is a big challenge in almost all organisations that write programs (this includes open source efforts). There is one class of program where this is not a problem: use-once programs. But unfortunately, these have a habit of surviving attempts to destroy them. Robby On Mar 10, 2013 3:33 PM, "Thomas Allen" wrote: > On 3/10/13 4:27 AM, ok@REDACTED wrote:> I'm trying to think of > anything nastier for a programmer to > > do to another programmer than to know something the second > > programmer needs to know and deliberately choose to conceal > > it by using ultra-short variable names. If I have any luck > > I'll let you know. > > > > Seriously, the job of a programmer is to *COMMUNICATE* with > > other programmers. I wish I could offer a simple rule for > > how long to make variable names. My colleague who refuses > > to use "i" for a loop index in C++, preferring > > innerLoopIndex, clearly errs on one side. Someone who uses > > T for timestamp, tree, and table in the same module clearly > > errs on the other. > > I agree with this, to a point. Few things irk me as much as > > Ret = fish_bowl:boil(Bowl, timer:minutes(3)), > %% ... > Ret. > > I've seen many high quality projects that do this, so I cannot criticize > the technique as some engineering downfall, but never once have I > encountered a variable of this sort that was not better served by a > descriptive name. In this case, perhaps `Boiled' is the correct name. > > However, this has more to do with variable names that mean nothing in > context. There's no sense in proscribing short variable names without > consideration. > > Suppose a function that searches a list of `dict()`s which are expected to > simply store `term()`s for the user, where we cannot infer the type or > other nature of the value. In that function, I believe that variable names > such `K' and `V' are entirely suitable, just as `X' and `N' fit comfortably > in a mathematical function. > > What I don't like is variable names like `X', `X1', `X2' in a function > that is not mathematical at all. Even if a program is full of nothing but > the simplest functions, their clauses must still be maintained by somebody, > and there's no sense in deliberately providing vague, short variable names > simply for the sake of narrower code or less typing. > > Of course, there are exceptions to every rule ... "A foolish consistency > is the hobgoblin of little minds." > > Thomas Allen > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.koener@REDACTED Sun Mar 10 20:29:54 2013 From: antoine.koener@REDACTED (Antoine Koener) Date: Sun, 10 Mar 2013 20:29:54 +0100 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: References: Message-ID: Erlang doesn't have a clue about your .1 file. See more about your log rotation program. Also your log file doesn't look like a sasl or error logger file... On Sunday, March 10, 2013, Valentin Kuznetsov wrote: > Hi, > I built OTP application using rebar build tool and when I'm running on > UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has > dos '\r' carriage return symbols in every line. I look-up on a web and did > not find any reference about such behavior. I'll appreciate any suggestions > why this happens (I don't think it's related to my application per-se and > rather feel that it's somehow introduced by rebar, but I'm not sure). The > carriage return symbols appears right after logging started message and > follow up ever line after that. Here is an example of the head of my log. > > ===== > ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 > ===== > Exec: > /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec > -boot > /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd > -mode embedded -config > /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config > -args_file > /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- > console^M > Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M > Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:5] > [hipe] [kernel-poll:true]^M > ^M > ^M > > Thanks, > Valentin. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vkuznet@REDACTED Sun Mar 10 20:48:26 2013 From: vkuznet@REDACTED (Valentin Kuznetsov) Date: Sun, 10 Mar 2013 15:48:26 -0400 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: References: Message-ID: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> Hmm, the application does use error_logger and the erlang.log.1 file contains proper lines from the logger, e.g. =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M <0.818.0> Listening on 10190.^M Eshell V5.9.3 (abort with ^G)^M (urlfetchd@REDACTED)1> ^M =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M <0.838.0> Client {127,0,0,1} connected.^M The release log area has the following content: erlang.log.1 run_erl.log sasl sasl-error.log The sasl-error.log contains proper content too, e.g. =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 === Supervisor: {local,ssl_connection_sup} Context: child_terminated Reason: ekeyfile Offender: [{pid,<0.1016.0>}, {name,undefined}, {mfargs,{ssl_connection,start_link,undefined}}, {restart_type,temporary}, {shutdown,4000}, {child_type,worker}] but it does not have '\r' symbols. The erlang.log.1 is not yet rotated since I only perform a few actions with my application. On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote: > Erlang doesn't have a clue about your .1 file. > See more about your log rotation program. > Also your log file doesn't look like a sasl or error logger file... > > > > On Sunday, March 10, 2013, Valentin Kuznetsov wrote: > Hi, > I built OTP application using rebar build tool and when I'm running on UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has dos '\r' carriage return symbols in every line. I look-up on a web and did not find any reference about such behavior. I'll appreciate any suggestions why this happens (I don't think it's related to my application per-se and rather feel that it's somehow introduced by rebar, but I'm not sure). The carriage return symbols appears right after logging started message and follow up ever line after that. Here is an example of the head of my log. > > ===== > ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 > ===== > Exec: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec -boot /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd -mode embedded -config /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config -args_file /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- console^M > Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M > Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:5] [hipe] [kernel-poll:true]^M > ^M > ^M > > Thanks, > Valentin. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From xavier@REDACTED Sun Mar 10 23:52:35 2013 From: xavier@REDACTED (Xavier Maillard) Date: Sun, 10 Mar 2013 23:52:35 +0100 Subject: [erlang-questions] USB, rs232 links References: <20130309154044.GC6319@ioctl> Message-ID: Michael Santos writes: > On Thu, Mar 07, 2013 at 11:29:43PM +0100, Xavier Maillard wrote: >> for my next (serious and personal) project with Erlang, I will have to >> study rs232 and use a USB device connected. >> >> Do you know whether something in Erlang already exist so I won't >> reinvent the wheel ? > Another option might be srly: Thank you. > https://github.com/msantos/srly > > If you're comfortable with the Unix serial interface, srly is just a > thin layer over it. It tries to just implement the minimum required in > C and does the rest in Erlang. I am not terribly comfortable for all this stuff but I will learn :D Thank you for your test cases ! /Xavier From 249505968@REDACTED Mon Mar 11 02:18:17 2013 From: 249505968@REDACTED (=?utf-8?B?6aWV6aSu?=) Date: Mon, 11 Mar 2013 09:18:17 +0800 Subject: [erlang-questions] =?utf-8?b?5Zue5aSN77yaICBJcyB0aGUgZnVuY3Rpb24g?= =?utf-8?q?call_always_pass_by_value=3F?= Message-ID: passed by reference? This does make sense in my project! It's that means It won't change the effect when I use a tail recursion with a record parameter or with no parameter? If it pass by value. It may waste a lot of time to copy values... ------------------ ???? ------------------ ???: "Robert Virding"; ????: 2013?3?10?(???) ??8:48 ???: "Motiejus Jak?tys"; ??: "erlang-questions"; "??"<249505968@REDACTED>; ??: Re: [erlang-questions] Is the function call always pass by value? Yes, basically, everything, both arguments and return values, is passed "by reference". But, as you say, this is not noticeable as you can't change a value. Robert ----- Original Message ----- > From: "Motiejus Jak?tys" > To: "??" <249505968@REDACTED> > Cc: "erlang-questions" > Sent: Saturday, 9 March, 2013 10:40:37 AM > Subject: Re: [erlang-questions] Is the function call always pass by value? > > On Sat, Mar 9, 2013 at 10:16 AM, ?? <249505968@REDACTED> wrote: > > I have do a test about the function call. > > There are some strange thing happen when I use function call to > > pass a > > tuple. > > The runtime won't change whatever the tuple scale size change(still > > smaller > > than 10k atom in it). > > > > So I wonder if the function call always pass value? > > > In Erlang it does not matter, because you cannot modify the tuple. > AND > have no pointers. Hence I am pretty sure it does not make a > difference > because pointer is passed to the stack. > > > And in I my project there is a efficiency bottleneck. > > There is some function loop with passing some large record. > > simply like this > > %============================= > > dot_write_func_dup(N) -> > > X = #test{}, > > statistics(runtime), > > dot_func_dup(N,X), > > {_,TotalRunTime}=statistics(runtime), > > io:format("totalruntime:~w~n",[TotalRunTime]). > > %============================= > > dot_func_dup(N,X) when N > 0 -> > > I = X#test{r500 = n}, > > J = I#test{r501 = m}, > > dot_func_dup(N -1 ,X); > > dot_func_dup(0,X) -> > > I = X#test{r500 = n}, > > J = I#test{r501 = m}. > > %============================= > > You are constructing a record (`J`) and then immediately discarding > it. Is this for purpose? You should get "unused variable `J`" warning > while compiling the module. Perhaps you meant J instead of X in > do_func_dup(N-1, X) ? > > > It seems very slow with the loop. > Numbers would be really good addition to this statement: small record > vs large record. > > > And we attempt to change the record loop to process dictionary. > > It's worthy to change it? > > Anyway, changing a value in the record (tuple) requires to copy the > whole record (tuple)*. So yes, it will be slow. And process > dictionary > will be more efficient. And think about ETS. > > [*]: there are exceptions. See > http://www.erlang.org/doc/efficiency_guide/commoncaveats.html section > "3.4 setelement/3". > > -- > Motiejus Jak?tys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Mar 11 02:41:16 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 11 Mar 2013 14:41:16 +1300 Subject: [erlang-questions] =?utf-8?b?5Zue5aSN77yaICBJcyB0aGUgZnVuY3Rpb24g?= =?utf-8?q?call_always_pass_by_value=3F?= In-Reply-To: References: Message-ID: <138F0840-8C67-4AA4-AFB8-2BDDA2D1EC6A@cs.otago.ac.nz> On 11/03/2013, at 2:18 PM, ?? wrote: > passed by reference? > This does make sense in my project! > It's that means It won't change the effect when I use a tail recursion with a record parameter or with no parameter? > If it pass by value. It may waste a lot of time to copy values? Consider f(X). In imperative languages, we distinguish between - pass by value: X is an expression. It is evaluated in full before the call, and during the call it is bound to the formal parameter as if by an assignment statement. This is sometimes called "pass by copy in." - pass by reference: X is a variable. Its address is determined, and in the body of f the formal parameter stands for X, changes to the formal parameter being reflected in changes to X. - pass by protected reference (Pascal) or const reference (C++): like pass by reference but f is not allowed to change its formal parameter. This was added to ISO Pascal to approximate the semantics of pass by value for records and arrays with the cost of pass by reference. - pass by copy out: X is a variable. Its address is determined. Inside f, the formal parameter is a local variable. Changes to the formal parameter do not affect X *yet*. When f returns, the value of the formal parameter is assigned to X as if by an assignment statement. - pass by copy in copy out. X is a variable. The formal parameter is initialised on entry from its value as if by assignment. The final value of the formal parameter is copied back to X as if by assignment. You will appreciate that since Erlang has no assignment statements, tuples that cannot be changed, records that cannot be changed, lists that cannot be changed, and above all no variables that can be changed after they are bound, most of these parameter passing methods made no sense in Erlang. In functional languages, we expect to distinguish between - pass by value: X is evaluated in full and bound to the formal parameter as if by 'let'-binding. The value is *NOT* copied. - pass by name: the expression X is re-evaluated every time that the formal parameter is mentioned. Algol 60 was the last major language to do this. - pass by need: X is passed to f as an unevaluated expression. The first time f needs its value, the expression will be evaluated, and the value remembered. It will not be evaluated again. Haskell and Clean use this. Erlang uses pass by value. Arguments are expressions, they are evaluated in full, and *values* passed to functions. It simply is not true that anything is ever passed by reference in Erlang. Erlang does not have variables that *could* be passed by reference. Just like Java, Erlang only has pass by reference. Just like Java, this does *NOT* mean copying anything. Ignoring function values, you can think of an Erlang value as *** A POINTER TO THE ROOT OF A TREE ***. The leaves are numbers, atoms, process IDs, and so on. The higher levels of the tree are list pairs and tuples (including records as a special case of tuples). When we do X = , it is this pointer to the root of a tree that X is set to; the tree as a whole is NOT COPIED. When we do f(), it is this pointer to the root of a tree that is passed to f; the tree as a whole is not copied. When we send a message, Pid!, the tree *will* be copied if it is sent to another node, *might* be copied if it is sent to another process on this node, and might *not* be copied if it is sent to another process on this node and might be partly copied and partly not. Pass by value does NOT imply copying and never has; copying is only required for mutable data structures, and Erlang hasn't any. From sean@REDACTED Mon Mar 11 07:00:02 2013 From: sean@REDACTED (Functional Jobs) Date: Mon, 11 Mar 2013 02:00:02 -0400 Subject: [erlang-questions] New Functional Programming Job Opportunities Message-ID: <513d72eea3267@functionaljobs.com> Here are some functional programming job opportunities that were posted recently:Senior Developer - Erlang at Klarnahttp://functionaljobs.com/jobs/133-senior-developer-erlang-at-klarnaCheers,Sean MurphyFunctionalJobs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Mon Mar 11 08:40:15 2013 From: jay@REDACTED (Jay Doane) Date: Mon, 11 Mar 2013 00:40:15 -0700 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> References: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> Message-ID: I believe the erlang.log.N files come from http://www.erlang.org/doc/man/run_erl.html, which is probably being invoked from the script rebar generated in rel/files. There are several environment variables you can use to control the output, but I don't know how to get rid of those annoying carriage returns. Sure wish I did... Jay On Sun, Mar 10, 2013 at 12:48 PM, Valentin Kuznetsov wrote: > Hmm, > the application does use error_logger and the erlang.log.1 file contains > proper lines from the logger, e.g. > > =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M > <0.818.0> Listening on 10190.^M > Eshell V5.9.3 (abort with ^G)^M > (urlfetchd@REDACTED)1> ^M > =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M > <0.838.0> Client {127,0,0,1} connected.^M > > The release log area has the following content: > > erlang.log.1 run_erl.log sasl sasl-error.log > > The sasl-error.log contains proper content too, e.g. > > =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 === > Supervisor: {local,ssl_connection_sup} > Context: child_terminated > Reason: ekeyfile > Offender: [{pid,<0.1016.0>}, > {name,undefined}, > {mfargs,{ssl_connection,start_link,undefined}}, > {restart_type,temporary}, > {shutdown,4000}, {child_type,worker}] > > but it does not have '\r' symbols. > > The erlang.log.1 is not yet rotated since I only perform a few actions > with my application. > > On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote: > > Erlang doesn't have a clue about your .1 file. > See more about your log rotation program. > Also your log file doesn't look like a sasl or error logger file... > > > > On Sunday, March 10, 2013, Valentin Kuznetsov wrote: > >> Hi, >> I built OTP application using rebar build tool and when I'm running on >> UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has >> dos '\r' carriage return symbols in every line. I look-up on a web and did >> not find any reference about such behavior. I'll appreciate any suggestions >> why this happens (I don't think it's related to my application per-se and >> rather feel that it's somehow introduced by rebar, but I'm not sure). The >> carriage return symbols appears right after logging started message and >> follow up ever line after that. Here is an example of the head of my log. >> >> ===== >> ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 >> ===== >> Exec: >> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec >> -boot >> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd >> -mode embedded -config >> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config >> -args_file >> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- >> console^M >> Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M >> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:5] >> [hipe] [kernel-poll:true]^M >> ^M >> ^M >> >> Thanks, >> Valentin. >> _______________________________________________ >> 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 jeremy.heater@REDACTED Mon Mar 11 09:29:16 2013 From: jeremy.heater@REDACTED (Jeremy Heater) Date: Mon, 11 Mar 2013 09:29:16 +0100 Subject: [erlang-questions] build errors In-Reply-To: References: Message-ID: Hey, I had those errors last week when rebuilding erlang. The errors went away after a make clean. Hope that helps, Jeremy. 2013/3/9 Vlad Dumitrescu > Hi, > > Do these build errors look familiar to anyone? Ubuntu 12.10, the latest > 'maint' branch. > > regards, > Vlad > > obj/i686-pc-linux-gnu/opt/libepcre.a -lethread -lerts_internal_r > -lpthread -lrt > obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:363: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:368: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:449: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:337: undefined > reference to `erts_printf_sword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:388: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:391: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:375: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:378: undefined > reference to `erts_printf_uword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:381: undefined > reference to `erts_printf_uword' > obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function > `print_atom_name': > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:156: undefined > reference to `erts_printf_sword' > obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:478: undefined > reference to `erts_printf_sword' > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:481: undefined > reference to `erts_printf_sword' > obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function > `print_atom_name': > /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:206: undefined > reference to `erts_printf_uword' > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Mon Mar 11 10:48:29 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Mon, 11 Mar 2013 17:48:29 +0800 Subject: [erlang-questions] How to reduce the build time when use record? Message-ID: When pass the record to another function in code.It will take tons of time to rebuild the project when the record is big. How to reduce the build time? -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Mon Mar 11 14:20:40 2013 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 11 Mar 2013 13:20:40 +0000 (GMT) Subject: [erlang-questions] dialyzer working with lfe, joxa, et. al? In-Reply-To: <513C5DC9.40904@cs.ntua.gr> Message-ID: <1744797073.74839726.1363008040209.JavaMail.root@erlang-solutions.com> As I see it there are two separate parts to making dialyzer be able to handle other languages: 1. Modify dialyzer to be able to handle language specific plugins. 2. Write the language specific plugins. It is clearly not the dialyzer implementor's job to do 2., that should be left to the various language implementers. But 1. need only be done once if it done properly and generically. It is 1. which I mean would be better if the dialyzer implementers did it as it only needs doing once and they would do it much faster and better than anyone else. That was all. Robert ----- Original Message ----- > From: "Kostis Sagonas" > To: "Robert Virding" > Cc: "erlang-questions" > Sent: Sunday, 10 March, 2013 11:17:45 AM > Subject: Re: [erlang-questions] dialyzer working with lfe, joxa, et. al? > > On 03/10/2013 01:57 AM, Robert Virding wrote: > >> From: "Kostis Sagonas" > >> > >> On 03/07/2013 06:48 PM, Robert Virding wrote: > >>> Keep them crossed. :-) It's definitely not impossible, it "just" > >>> needs the dialyzer people to implement hooks to which we (LFE, > >>> Joxa, ...) can write plugins. It that were to happen I might even > >>> add type specifications to LFE. > >> > >> Even disregarding for the moment the question why would "the > >> dialyzer > >> people" care about lfe, joxa, et al., (dialyzer: Discrepancy > >> Analyzer > >> of > >> *Erlang* code) if you are not more specific than the above wish > >> how > >> exactly do you expect them to know about the details of possible > >> hooks > >> that are needed by non-standard uses of dialyzer by other more > >> exotic > >> languages out there? > > > > Well, if you want to be really strict then dialyzer works on *Core > > erlang* code. This is what dialyzer means by Erlang. > > No, it's not. Just because dialyzer does its analysis on Core Erlang, > this does not mean that it was ever designed to analyze languages > other > than Erlang. > > I grant you that dialyzer's analysis is in principle applicable to > other > languages that compile to Core Erlang, but I think that my previous > mail > makes it clear that I also think that the responsibility for doing > any > changes that are required lies with the developers of languages who > are > interested in having such a tool for their language. > > It's probably irrational to expect that non-users of a language care > about the tools that are available for it more than the community of > that language, isn't it? > > Kostis > From robert.virding@REDACTED Mon Mar 11 14:25:16 2013 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 11 Mar 2013 13:25:16 +0000 (GMT) Subject: [erlang-questions] How to reduce the build time when use record? In-Reply-To: Message-ID: <1663183066.74847638.1363008316966.JavaMail.root@erlang-solutions.com> This question relates to the previous question of whether arguments are passed by value in a function call. They aren't, they are passed by reference but the immutable data property of Erlang makes this safe as the data can never be modified. It is the same with records. Once the record has been created it is passed by reference ad never copied, and like *ALL* erlang data a record is immutable so this causes no problems. Robert ----- Original Message ----- > From: "??" <249505968@REDACTED> > To: "erlang-questions" > Sent: Monday, 11 March, 2013 10:48:29 AM > Subject: [erlang-questions] How to reduce the build time when use > record? > When pass the record to another function in code. > It will take tons of time to rebuild the project when the record is > big. > How to reduce the build time? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From hd2010@REDACTED Mon Mar 11 15:17:55 2013 From: hd2010@REDACTED (Henning Diedrich) Date: Mon, 11 Mar 2013 15:17:55 +0100 Subject: [erlang-questions] How to reduce the build time when use record? In-Reply-To: <1663183066.74847638.1363008316966.JavaMail.root@erlang-solutions.com> References: <1663183066.74847638.1363008316966.JavaMail.root@erlang-solutions.com> Message-ID: Note that sending a message to another process always copies the data though with the exception of >64 byte binaries. Henning On Mar 11, 2013, at 2:25 PM, Robert Virding wrote: > This question relates to the previous question of whether arguments are passed by value in a function call. They aren't, they are passed by reference but the immutable data property of Erlang makes this safe as the data can never be modified. It is the same with records. Once the record has been created it is passed by reference ad never copied, and like *ALL* erlang data a record is immutable so this causes no problems. > > Robert > > From: "??" <249505968@REDACTED> > To: "erlang-questions" > Sent: Monday, 11 March, 2013 10:48:29 AM > Subject: [erlang-questions] How to reduce the build time when use record? > > When pass the record to another function in code. > It will take tons of time to rebuild the project when the record is big. > How to reduce the build time? > > > _______________________________________________ > 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 carlo.bertoldi@REDACTED Mon Mar 11 15:20:16 2013 From: carlo.bertoldi@REDACTED (Carlo Bertoldi) Date: Mon, 11 Mar 2013 15:20:16 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion Message-ID: <513DE820.1060900@ubiquity.it> Hello everybody, this is the error I'm having: gcc -mdynamic-no-pic -Werror=return-type -m32 -g -O3 -fomit-frame-pointer -I/Users/carlo/.kerl/builds/r16b/otp_src_R16B/erts/x86_64-apple-darwin12.2.0 -I/opt/local/include -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -Ix86_64-apple-darwin12.2.0/opt/smp -Ibeam -Isys/unix -Isys/common -Ix86_64-apple-darwin12.2.0 -Izlib -Ipcre -Ihipe -I../include -I../include/x86_64-apple-darwin12.2.0 -I../include/internal -I../include/internal/x86_64-apple-darwin12.2.0 -c beam/erl_bif_re.c -o obj/x86_64-apple-darwin12.2.0/opt/smp/erl_bif_re.o beam/erl_bif_re.c: In function ?erts_init_bif_re?: beam/erl_bif_re.c:68: error: ?erts_pcre_malloc? undeclared (first use in this function) Lib PCRE is installed with Mac Ports, and this is the configuration to include MacPorts libraries. export LDFLAGS='-L/opt/local/lib' export CPPFLAGS='-I/opt/local/include' export LD_LIBRARY_PATH=/opt/local/lib export LD_INCLUDE_PATH=/opt/local/include This is the command I'm using to compile. CC=/opt/local/bin/gcc-mp-4.5 CXX=/opt/local/bin/g++-mp-4.5 ./otp_build autoconf && ./configure --disable-hipe --enable-smp-support --enable-threads --enable-darwin-64bit --enable-kernel-poll Thanks for your time. Carlo From g9414002.pccu.edu.tw@REDACTED Mon Mar 11 15:23:24 2013 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Mon, 11 Mar 2013 22:23:24 +0800 Subject: [erlang-questions] How to reduce the build time when use record? In-Reply-To: References: Message-ID: Hi, Tao-Tei (??), it seems that wasting was caused of both the Erlang immutable mechanism and your big-data-as-argument doing. Maybe you treat a perimeter as an memory area that it must be changed so many times as a dirty data, though in fact you need not make so many copies of data. I think you need a better code written in Erlang style. On Mon, Mar 11, 2013 at 5:48 PM, ?? <249505968@REDACTED> wrote: > When pass the record to another function in code. > It will take tons of time to rebuild the project when the record is big. > How to reduce the build time? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards. --- Y-H. H. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas@REDACTED Mon Mar 11 19:11:14 2013 From: thomas@REDACTED (Thomas Allen) Date: Mon, 11 Mar 2013 14:11:14 -0400 Subject: [erlang-questions] The state of Unicode libraries Message-ID: <513E1E42.5030407@oinksoft.com> Hello, I am working on a project right now for which Unicode string and binary functions are critical. I find myself adrift in my search for a suitable library to handle this. These are the projects I have reviewed this far: i18n : Uses NIFs, linking with libicu. Promising, but this project has a major issue: It depends (in its rebar.config) on some testing library that uses pmods, so I cannot provide an easy install for R16 users if I depend on this library. Author states in the issue queue that he has not used it in production himself, so I'm interested in how this has worked for other users in production. ux : Pure Erlang solution. This is what I am using right now. It does the job, but takes about two seconds to start up (an annoyance) and has some strange history, like when `ux_html' was removed but not mentioned in the commit message: A year later now, and `ux_html' functions are still in the README. starling : Something of a toy, and untouched since early 2008. No to_upper/to_lower or other important functions. I hope that I am missing some viable libraries, because none of these seem satisfactory right now, though `ux' is functional. Thanks, Thomas Allen From noah@REDACTED Mon Mar 11 19:15:53 2013 From: noah@REDACTED (Noah Diewald) Date: Mon, 11 Mar 2013 13:15:53 -0500 Subject: [erlang-questions] The state of Unicode libraries In-Reply-To: <513E1E42.5030407@oinksoft.com> References: <513E1E42.5030407@oinksoft.com> Message-ID: <513E1F59.9090905@diewald.me> I tend to just write my own nifs for what I need from icu and piggyback off of icu4e. On 03/11/2013 01:11 PM, Thomas Allen wrote: > Hello, > > I am working on a project right now for which Unicode string and binary > functions are critical. I find myself adrift in my search for a suitable > library to handle this. > > These are the projects I have reviewed this far: > > i18n : > > Uses NIFs, linking with libicu. Promising, but this project has a > major issue: It depends (in its rebar.config) on some testing > library that uses pmods, so I cannot provide an easy install for R16 > users if I depend on this library. Author states in the issue queue > that he has not used it in production himself, so I'm interested in > how this has worked for other users in production. > > ux : > > Pure Erlang solution. This is what I am using right now. It does the > job, but takes about two seconds to start up (an annoyance) and has > some strange history, like when `ux_html' was removed but not > mentioned in the commit message: > > > > > > A year later now, and `ux_html' functions are still in the README. > > starling : > > Something of a toy, and untouched since early 2008. No > to_upper/to_lower or other important functions. > > I hope that I am missing some viable libraries, because none of these > seem satisfactory right now, though `ux' is functional. > > Thanks, > Thomas Allen > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 555 bytes Desc: OpenPGP digital signature URL: From max.lapshin@REDACTED Mon Mar 11 20:23:40 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 11 Mar 2013 23:23:40 +0400 Subject: [erlang-questions] How to understand busyness of driver job queue? Message-ID: There are async threads, that should be used for disk IO. Is it possible to monitor, how busy these threads are? Should I need more? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Mon Mar 11 20:37:43 2013 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 11 Mar 2013 20:37:43 +0100 Subject: [erlang-questions] build errors In-Reply-To: References: Message-ID: Ah, great! Why didn't I think of that?? :-) Thanks, Jeremy! /Vlad On Mon, Mar 11, 2013 at 9:29 AM, Jeremy Heater < jeremy.heater@REDACTED> wrote: > Hey, > > I had those errors last week when rebuilding erlang. The errors went away > after a make clean. > > Hope that helps, > Jeremy. > > > 2013/3/9 Vlad Dumitrescu > >> Hi, >> >> Do these build errors look familiar to anyone? Ubuntu 12.10, the latest >> 'maint' branch. >> >> regards, >> Vlad >> >> obj/i686-pc-linux-gnu/opt/libepcre.a -lethread -lerts_internal_r >> -lpthread -lrt >> obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:363: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:368: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:449: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:337: undefined >> reference to `erts_printf_sword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:388: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:391: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:375: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:378: undefined >> reference to `erts_printf_uword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:381: undefined >> reference to `erts_printf_uword' >> obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function >> `print_atom_name': >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:156: undefined >> reference to `erts_printf_sword' >> obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function `print_term': >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:478: undefined >> reference to `erts_printf_sword' >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:481: undefined >> reference to `erts_printf_sword' >> obj/i686-pc-linux-gnu/opt/smp/erl_printf_term.o: In function >> `print_atom_name': >> /home/vlad/otp/erts/emulator/beam/erl_printf_term.c:206: undefined >> reference to `erts_printf_uword' >> >> >> _______________________________________________ >> 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 Mar 11 21:02:52 2013 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 11 Mar 2013 15:02:52 -0500 Subject: [erlang-questions] PosegreSQL driver In-Reply-To: References: Message-ID: That is why I sent my original email. There are some patches that forks have done are design/feature decisions that can't necessarily be merged together, but a lot can. I didn't want to simply make tsloughter/epgsql and merge them together without reaching out to those with the forks since then it would just end up being another fork from wg/egpsql like all the rest. Not sure how to move forward with this. Though I'm trying out semiocast's client now as well. I think it also shows an issue that I was talking about in #erlounge yesterday. It would be great to have a page on erlang.org that breaks apps into categories (json parser, http client, postgres/mysql drivers, ...) and links to their source on github. But apps that are known to work and be still in use, not just anything that shows up in a google or github search. Tristan On Thu, Mar 7, 2013 at 10:00 AM, Max Lapshin wrote: > What should I do this weekend? Take a beer, write postgresql erlang driver > or just write my own nosql database? > > > It is really interesting: why are there so many forks? Is it possible to > consolidate all efforts? Maybe it is impossible at all because different > drivers implement different approaches of querying async database from > async erlang? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Mar 11 21:29:57 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 12 Mar 2013 09:29:57 +1300 Subject: [erlang-questions] How to reduce the build time when use record? In-Reply-To: References: Message-ID: On 11/03/2013, at 10:48 PM, ?? wrote: > When pass the record to another function in code. > It will take tons of time to rebuild the project when the record is big. It won't. Passing the largest record you an imagine to another function takes no longer than passing the number 0. Sending a large amount of data to another *process* involves copying, but function calls do *not*. > How to reduce the build time? What made you think there _was_ any significant time taken? What benchmarks did you run? From fritchie@REDACTED Mon Mar 11 22:05:11 2013 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 11 Mar 2013 16:05:11 -0500 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: Message of "Mon, 11 Mar 2013 23:23:40 +0400." Message-ID: <85515.1363035911@snookles.snookles.com> Max Lapshin wrote: ml> There are async threads, that should be used for disk IO. Is it ml> possible to monitor, how busy these threads are? Max, see the aio_pool__add and aio_pool__get probes in the DTrace probe definition file, erts/emulator/beam/erlang_dtrace.d. -Scott From soroker@REDACTED Mon Mar 11 22:52:04 2013 From: soroker@REDACTED (Andrei Soroker) Date: Mon, 11 Mar 2013 14:52:04 -0700 Subject: [erlang-questions] R16B asn1rt_nif error Message-ID: Hello, I just upgraded from R15B03 to R16B and I'm seeing the following: {{keyfile,{badmatch,{error,{asn1,{undef,[{asn1rt_nif,decode_ber_tlv,[<< ... {'OTP-PUB-KEY',decode,2,[{file,"OTP-PUB-KEY.erl"},{line,985}]},{public_key,der_decode,2,[{file,"public_key.erl"},{line,169}]},{ssl_connection,init_private_key,5,[{file,"ssl_connection.erl"},{line,1176}]},{ssl_connection,ssl_init,2,[{file,"ssl_connection.erl"},{line,1115}]},{ssl_connection,init,1,[{file,"ssl_connection.erl"},{line,303}]} Is there some quick fix that I'm missing? Thanks! Andrei From soroker@REDACTED Tue Mar 12 04:09:57 2013 From: soroker@REDACTED (Andrei Soroker) Date: Mon, 11 Mar 2013 20:09:57 -0700 Subject: [erlang-questions] SSL certificate unknown error Message-ID: Hi again, I'm using lhttpc to make some calls over https. Everything worked fine with R15B03-1, but with R16B I'm seeing this: SSL: certify: ssl_handshake.erl:263:Fatal error: certificate unknown Thanks, Andrei From tristan.sloughter@REDACTED Tue Mar 12 04:14:56 2013 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 11 Mar 2013 22:14:56 -0500 Subject: [erlang-questions] SSL certificate unknown error In-Reply-To: References: Message-ID: I ran into the same problem on R16A. I sent this to erlang-bugs http://erlang.org/pipermail/erlang-bugs/2013-February/003369.html I sadly didn't take care of continued investigation.... But if it still exists in R16B I guess I'll have to now, unless you figure it out :) On Mon, Mar 11, 2013 at 10:09 PM, Andrei Soroker wrote: > Hi again, > > I'm using lhttpc to make some calls over https. Everything worked fine > with R15B03-1, but with R16B I'm seeing this: > > SSL: certify: ssl_handshake.erl:263:Fatal error: certificate unknown > > Thanks, > Andrei > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From soroker@REDACTED Tue Mar 12 04:25:36 2013 From: soroker@REDACTED (Andrei Soroker) Date: Mon, 11 Mar 2013 20:25:36 -0700 Subject: [erlang-questions] SSL certificate unknown error In-Reply-To: References: Message-ID: On Mon, Mar 11, 2013 at 8:14 PM, Tristan Sloughter wrote: > I ran into the same problem on R16A. I sent this to erlang-bugs > > http://erlang.org/pipermail/erlang-bugs/2013-February/003369.html > > I sadly didn't take care of continued investigation.... But if it still > exists in R16B I guess I'll have to now, unless you figure it out :) I reverted to R15B03-1 for the time being. I'll poke around some more later in the week. > > > On Mon, Mar 11, 2013 at 10:09 PM, Andrei Soroker wrote: >> >> Hi again, >> >> I'm using lhttpc to make some calls over https. Everything worked fine >> with R15B03-1, but with R16B I'm seeing this: >> >> SSL: certify: ssl_handshake.erl:263:Fatal error: certificate unknown >> >> Thanks, >> Andrei >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From erlangprogram@REDACTED Tue Mar 12 04:58:52 2013 From: erlangprogram@REDACTED (S X) Date: Mon, 11 Mar 2013 23:58:52 -0400 Subject: [erlang-questions] erlang diameter dictionary Message-ID: Hello, I am new to Erlang and Diameter protocol. Wish someone could provide some suggestions on how to utilize the diameter library properly in Erlang. For example, I want to send/receive some Gx messages, like CCR (Credit Control Request), CCA(Credit Control Answer messages. But I notice that there are some predefined messages in erlang diameter library. As my understanding, should use the utility diameterc to generate erlang header/source files based on dia files. There are few dia files under otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, base_rfc3588.dia, relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't have the definitions for Gx. How should I generate or where can I obtain dia files which have support for CCR/CCA message format? Are the dia files proprietary or manufacturer specific? Can I generate with the 3GPP spec? What are the proper steps? Thanks a lot! S -------------- next part -------------- An HTML attachment was scrubbed... URL: From cloudzen@REDACTED Tue Mar 12 07:55:08 2013 From: cloudzen@REDACTED (skyman) Date: Tue, 12 Mar 2013 14:55:08 +0800 (CST) Subject: [erlang-questions] What does "=index_table:atom_tab, size: 9216, limit: 9000, entries: 9216" mean? Message-ID: <240de20.1a683.13d5d61943a.Coremail.cloudzen@163.com> Hi all, I use "erl +t 9000" to se?t? the maximum number of atoms to 9000, then I call erlang:list_to_atom/1 to create atoms, and check the system info: 15> string:tokens(binary_to_list(erlang:system_info(info)),"\n"). ["=memory","total: 49094720","processes: 33358002", "processes_used: 33358002","system: 15736718", "atom: 223537","atom_used: 211133","binary: 1063848", "code: 3739735","ets: 251248","=hash_table:atom_tab", "size: 6421","used: 4906","objs: 9216","depth: 7", "=index_table:atom_tab","size: 9216","limit: 9000", "entries: 9216","=hash_table:module_code","size: 97", "used: 57","objs: 76","depth: 3","=index_table:module_code", "size: 1024","limit: 65536","entries: 76", [...]|...] Please look at the "=index_table:atom_tab" item, what do "size", "limit" and "entries" mean? why can the "size"(9216) larger than the "limit"(9000)? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Tue Mar 12 09:48:06 2013 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 12 Mar 2013 09:48:06 +0100 Subject: [erlang-questions] SSL certificate unknown error In-Reply-To: References: Message-ID: Hi! This error typically happens when there is a problem in the ASN-1 decoding of a certificate. You could try tracing on public_key:pkix_path_validation. If we can get the input values to that function we could create a way to reproduce the error and make it much easier for us to fix the problem. dbg:tracer(). dbg:p(all, [call]). dbg:tpl(public_key, pkix_path_validation, x). Regards Ingela Erlang/OTP- team Ericsson AB 2013/3/12, Andrei Soroker : > On Mon, Mar 11, 2013 at 8:14 PM, Tristan Sloughter > wrote: >> I ran into the same problem on R16A. I sent this to erlang-bugs >> >> http://erlang.org/pipermail/erlang-bugs/2013-February/003369.html >> >> I sadly didn't take care of continued investigation.... But if it still >> exists in R16B I guess I'll have to now, unless you figure it out :) > > I reverted to R15B03-1 for the time being. I'll poke around some more > later in the week. > >> >> >> On Mon, Mar 11, 2013 at 10:09 PM, Andrei Soroker >> wrote: >>> >>> Hi again, >>> >>> I'm using lhttpc to make some calls over https. Everything worked fine >>> with R15B03-1, but with R16B I'm seeing this: >>> >>> SSL: certify: ssl_handshake.erl:263:Fatal error: certificate unknown >>> >>> Thanks, >>> Andrei >>> _______________________________________________ >>> 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 andre.graf@REDACTED Tue Mar 12 10:32:17 2013 From: andre.graf@REDACTED (=?ISO-8859-1?Q?Andr=E9_Graf?=) Date: Tue, 12 Mar 2013 10:32:17 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hello S(?) You have to come up with your own .dia file if the message types are not covered in the .dia files provided by Erlang. Your own .dia file will typically include the '@inherits diameter_gen_base_rfc3588' clause which imports the basic avp's from rfc3588. You then have to provide the missing avp's for your CCR/CCA message types, and also define these messages. Thanks to the format of a .dia file it is pretty much copy-pasting from the rfc4006. Once your .dia file is ready, you use diameterc to generate the .erl and .hrl file. Hope that helped! BR/Andr? On 12 March 2013 04:58, S X wrote: > Hello, > > I am new to Erlang and Diameter protocol. Wish someone could provide some > suggestions on how to utilize the diameter library properly in Erlang. > > For example, I want to send/receive some Gx messages, like CCR (Credit > Control Request), CCA(Credit Control Answer messages. But I notice that > there are some predefined messages in erlang diameter library. As my > understanding, should use the utility diameterc to generate erlang > header/source files based on dia files. There are few dia files under > otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, base_rfc3588.dia, > relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't have > the definitions for Gx. > > How should I generate or where can I obtain dia files which have support for > CCR/CCA message format? Are the dia files proprietary or manufacturer > specific? Can I generate with the 3GPP spec? What are the proper steps? > > Thanks a lot! > > S > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From sverker.eriksson@REDACTED Tue Mar 12 10:50:08 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 12 Mar 2013 10:50:08 +0100 Subject: [erlang-questions] What does "=index_table:atom_tab, size: 9216, limit: 9000, entries: 9216" mean? In-Reply-To: <240de20.1a683.13d5d61943a.Coremail.cloudzen@163.com> References: <240de20.1a683.13d5d61943a.Coremail.cloudzen@163.com> Message-ID: <513EFA50.8070206@erix.ericsson.se> skyman wrote: > Hi all, > I use "erl +t 9000" to se?t? the maximum number of atoms to 9000, then I call erlang:list_to_atom/1 to create atoms, and check the system info: > 15> string:tokens(binary_to_list(erlang:system_info(info)),"\n"). > ["=memory","total: 49094720","processes: 33358002", > "processes_used: 33358002","system: 15736718", > "atom: 223537","atom_used: 211133","binary: 1063848", > "code: 3739735","ets: 251248","=hash_table:atom_tab", > "size: 6421","used: 4906","objs: 9216","depth: 7", > "=index_table:atom_tab","size: 9216","limit: 9000", > "entries: 9216","=hash_table:module_code","size: 97", > "used: 57","objs: 76","depth: 3","=index_table:module_code", > "size: 1024","limit: 65536","entries: 76", > [...]|...] > > > Please look at the "=index_table:atom_tab" item, what do "size", "limit" and "entries" mean? why can the "size"(9216) larger than the "limit"(9000)? > Thanks in advance! 'size' is number of allocated entries in the table 'limit' is the max number of entries 'entries' is number of used entries The table increases 'size' in steps of 1024 entries. And yes, the implementation (index.c) allows you to exceed 'limit' up to the nearest 1024 multiple. Which is what has happened in your case with 9216 atoms. /Sverker, Erlang/OTP From anders.otp@REDACTED Tue Mar 12 12:44:44 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Tue, 12 Mar 2013 12:44:44 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Btw, there's an RFC 4006 dictionary (and a few more) under diameter/examples/dict in the repo. /Anders, Erlang/OTP On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf wrote: > Hello S(?) > > You have to come up with your own .dia file if the message types are > not covered in the .dia files provided by Erlang. Your own .dia file > will typically include the '@inherits diameter_gen_base_rfc3588' > clause which imports the basic avp's from rfc3588. You then have to > provide the missing avp's for your CCR/CCA message types, and also > define these messages. Thanks to the format of a .dia file it is > pretty much copy-pasting from the rfc4006. Once your .dia file is > ready, you use diameterc to generate the .erl and .hrl file. > > Hope that helped! > > BR/Andr? > > > > On 12 March 2013 04:58, S X wrote: >> Hello, >> >> I am new to Erlang and Diameter protocol. Wish someone could provide some >> suggestions on how to utilize the diameter library properly in Erlang. >> >> For example, I want to send/receive some Gx messages, like CCR (Credit >> Control Request), CCA(Credit Control Answer messages. But I notice that >> there are some predefined messages in erlang diameter library. As my >> understanding, should use the utility diameterc to generate erlang >> header/source files based on dia files. There are few dia files under >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, base_rfc3588.dia, >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't have >> the definitions for Gx. >> >> How should I generate or where can I obtain dia files which have support for >> CCR/CCA message format? Are the dia files proprietary or manufacturer >> specific? Can I generate with the 3GPP spec? What are the proper steps? >> >> Thanks a lot! >> >> S >> >> >> _______________________________________________ >> 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 info@REDACTED Tue Mar 12 15:30:25 2013 From: info@REDACTED (info) Date: Tue, 12 Mar 2013 15:30:25 +0100 Subject: [erlang-questions] erlang and postgresql Message-ID: <201303121530233281396@its3.ch> Hello, In order to deploy as soon as possible an erlang application to production, what is according your experience the most mature/stable interface for postgresql ? Thank you to argument John -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.james.barry@REDACTED Tue Mar 12 15:49:03 2013 From: paul.james.barry@REDACTED (Paul Barry) Date: Tue, 12 Mar 2013 14:49:03 +0000 Subject: [erlang-questions] erlang and postgresql In-Reply-To: <201303121530233281396@its3.ch> References: <201303121530233281396@its3.ch> Message-ID: You should take a look at what the Zotonic people have done with PostgreSQL. To date, it's the only RDBMS they support (although this is changing). See: http://zotonic.com for more details. On 12 March 2013 14:30, info wrote: > ** > Hello, > In order to deploy as soon as possible an erlang application to > production, what is according your experience the most mature/stable > interface for postgresql ? > Thank you to argument > > John > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Paul Barry, w: http://paulbarry.itcarlow.ie - e: paul.barry@REDACTED Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mabrek@REDACTED Tue Mar 12 16:00:17 2013 From: mabrek@REDACTED (Anton Lebedevich) Date: Tue, 12 Mar 2013 19:00:17 +0400 Subject: [erlang-questions] erlang and postgresql In-Reply-To: References: <201303121530233281396@its3.ch> Message-ID: <513F4301.9020101@gmail.com> At some point in time Zotonic used modified https://github.com/wg/epgsql fork. Is it still true? On 03/12/2013 06:49 PM, Paul Barry wrote: > You should take a look at what the Zotonic people have done with > PostgreSQL. To date, it's the only RDBMS they support (although this is > changing). > > See: http://zotonic.com for more details. > > > On 12 March 2013 14:30, info > wrote: > > __ > Hello, > In order to deploy as soon as possible an erlang application to > production, what is according your experience the most mature/stable > interface for postgresql ? > Thank you to argument > > John > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Paul Barry, w: http://paulbarry.itcarlow.ie - e: paul.barry@REDACTED > > Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From erlangprogram@REDACTED Tue Mar 12 17:10:48 2013 From: erlangprogram@REDACTED (S X) Date: Tue, 12 Mar 2013 12:10:48 -0400 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hello, Anders & Andre, Thanks a lot for your quick responses and suggestions, which help me start to exploring Erlang world ^_^ I was able to generate based on the file rfc4006_cc.dia under the diameter/examples/dict folders. And understand a bit why and how Erlang diameter protocol dictionaries are organized and maintained. Many thanks and talk to you later! Samuel On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson wrote: > Btw, there's an RFC 4006 dictionary (and a few more) under > diameter/examples/dict in the repo. > > /Anders, Erlang/OTP > > On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf wrote: > > Hello S(?) > > > > You have to come up with your own .dia file if the message types are > > not covered in the .dia files provided by Erlang. Your own .dia file > > will typically include the '@inherits diameter_gen_base_rfc3588' > > clause which imports the basic avp's from rfc3588. You then have to > > provide the missing avp's for your CCR/CCA message types, and also > > define these messages. Thanks to the format of a .dia file it is > > pretty much copy-pasting from the rfc4006. Once your .dia file is > > ready, you use diameterc to generate the .erl and .hrl file. > > > > Hope that helped! > > > > BR/Andr? > > > > > > > > On 12 March 2013 04:58, S X wrote: > >> Hello, > >> > >> I am new to Erlang and Diameter protocol. Wish someone could provide > some > >> suggestions on how to utilize the diameter library properly in Erlang. > >> > >> For example, I want to send/receive some Gx messages, like CCR (Credit > >> Control Request), CCA(Credit Control Answer messages. But I notice that > >> there are some predefined messages in erlang diameter library. As my > >> understanding, should use the utility diameterc to generate erlang > >> header/source files based on dia files. There are few dia files under > >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, > base_rfc3588.dia, > >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't > have > >> the definitions for Gx. > >> > >> How should I generate or where can I obtain dia files which have > support for > >> CCR/CCA message format? Are the dia files proprietary or manufacturer > >> specific? Can I generate with the 3GPP spec? What are the proper steps? > >> > >> Thanks a lot! > >> > >> S > >> > >> > >> _______________________________________________ > >> 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 kenneth.lundin@REDACTED Tue Mar 12 17:45:43 2013 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 12 Mar 2013 17:45:43 +0100 Subject: [erlang-questions] R16B asn1rt_nif error In-Reply-To: References: Message-ID: hi Andrei, from the crash info it seems that you don't have the module asn1rt_nif properly loaded. This module exports 3 so called Nifs (functions implemented in C) a .so file is supposed to be automatically loaded when the asn1rt_nif module is loaded. you can try calling asn1rt_nif:decode_ber_tlv(<<0,0>>) on your system. If this fails you have an unhealty system (the .so file under lib/asn1-x.y/priv is missing or corrupt or can't be loaded for some reason. If this is the case you will have problems with all attempts to decode ASN.1 encoded data using the BER/DER encoding rules, which are the ones used for certificates and other SSL/TLS related stuff. This can be the causebof the other SSL problem you reported on R16B as well. In R15B I think there was a fallback that would run pure Erlang code if the asn1rt_nif module failed to be loaded. This is no longer the case. /Kenneth, Erlang/OTP Ericsson Den 11 mar 2013 22:52 skrev "Andrei Soroker" : > Hello, > > I just upgraded from R15B03 to R16B and I'm seeing the following: > > {{keyfile,{badmatch,{error,{asn1,{undef,[{asn1rt_nif,decode_ber_tlv,[<< > ... > > {'OTP-PUB-KEY',decode,2,[{file,"OTP-PUB-KEY.erl"},{line,985}]},{public_key,der_decode,2,[{file,"public_key.erl"},{line,169}]},{ssl_connection,init_private_key,5,[{file,"ssl_connection.erl"},{line,1176}]},{ssl_connection,ssl_init,2,[{file,"ssl_connection.erl"},{line,1115}]},{ssl_connection,init,1,[{file,"ssl_connection.erl"},{line,303}]} > > Is there some quick fix that I'm missing? > > Thanks! > Andrei > _______________________________________________ > 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 Tue Mar 12 21:10:38 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 13 Mar 2013 00:10:38 +0400 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: <85515.1363035911@snookles.snookles.com> References: <85515.1363035911@snookles.snookles.com> Message-ID: So, I need to run dtrace on live system? I've found that if I increase +A from 16 to 160, system starts working excelently. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.burdick@REDACTED Tue Mar 12 21:51:06 2013 From: thomas.burdick@REDACTED (Tom Burdick) Date: Tue, 12 Mar 2013 15:51:06 -0500 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: References: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> Message-ID: Erlang always seems to stuff carriage returns in its stdio output. Its really really annoying when using it with ports or... well anything. I actually spent the time trying to hunt down where in the OTP those are being put in there so I could send a patch or keep a \r free version of erlang around for myself. I gave up after an hour of trying to hunt it down, maybe someone more knowledgable can point us all in the right place? Tom On Mon, Mar 11, 2013 at 2:40 AM, Jay Doane wrote: > I believe the erlang.log.N files come from > http://www.erlang.org/doc/man/run_erl.html, which is probably being > invoked from the script rebar generated in rel/files. > > There are several environment variables you can use to control the output, > but I don't know how to get rid of those annoying carriage returns. Sure > wish I did... > > Jay > > > On Sun, Mar 10, 2013 at 12:48 PM, Valentin Kuznetsov wrote: > >> Hmm, >> the application does use error_logger and the erlang.log.1 file contains >> proper lines from the logger, e.g. >> >> =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M >> <0.818.0> Listening on 10190.^M >> Eshell V5.9.3 (abort with ^G)^M >> (urlfetchd@REDACTED)1> ^M >> =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M >> <0.838.0> Client {127,0,0,1} connected.^M >> >> The release log area has the following content: >> >> erlang.log.1 run_erl.log sasl sasl-error.log >> >> The sasl-error.log contains proper content too, e.g. >> >> =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 === >> Supervisor: {local,ssl_connection_sup} >> Context: child_terminated >> Reason: ekeyfile >> Offender: [{pid,<0.1016.0>}, >> {name,undefined}, >> {mfargs,{ssl_connection,start_link,undefined}}, >> {restart_type,temporary}, >> {shutdown,4000}, {child_type,worker}] >> >> but it does not have '\r' symbols. >> >> The erlang.log.1 is not yet rotated since I only perform a few actions >> with my application. >> >> On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote: >> >> Erlang doesn't have a clue about your .1 file. >> See more about your log rotation program. >> Also your log file doesn't look like a sasl or error logger file... >> >> >> >> On Sunday, March 10, 2013, Valentin Kuznetsov wrote: >> >>> Hi, >>> I built OTP application using rebar build tool and when I'm running on >>> UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has >>> dos '\r' carriage return symbols in every line. I look-up on a web and did >>> not find any reference about such behavior. I'll appreciate any suggestions >>> why this happens (I don't think it's related to my application per-se and >>> rather feel that it's somehow introduced by rebar, but I'm not sure). The >>> carriage return symbols appears right after logging started message and >>> follow up ever line after that. Here is an example of the head of my log. >>> >>> ===== >>> ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 >>> ===== >>> Exec: >>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec >>> -boot >>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd >>> -mode embedded -config >>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config >>> -args_file >>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- >>> console^M >>> Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M >>> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:5] >>> [hipe] [kernel-poll:true]^M >>> ^M >>> ^M >>> >>> Thanks, >>> Valentin. >>> _______________________________________________ >>> 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 mjtruog@REDACTED Tue Mar 12 21:58:46 2013 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 12 Mar 2013 13:58:46 -0700 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: References: <85515.1363035911@snookles.snookles.com> Message-ID: <513F9706.1070508@gmail.com> You may have thought that the async threads use a shared job queue, but they don't... each thread has its own queue. So, that means it is easy to plug up the async thread pool, if you have long running operations. By increasing the pool size to a much larger value, you are no longer blocking on a randomly overworked async thread. On 03/12/2013 01:10 PM, Max Lapshin wrote: > So, I need to run dtrace on live system? > > I've found that if I increase +A from 16 to 160, system starts working excelently. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Tue Mar 12 23:44:38 2013 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Tue, 12 Mar 2013 23:44:38 +0100 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: References: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> Message-ID: Hey now - why has Gmail begun eating my emails? I didn't even know it had happened before Tom wrote. Anyway, I found the reason - it is the module 'standard_error' which is responsible, and it inserts the \r when a) you write to stderr and b) Erlang thinks it is connected to a terminal. Hoping this helps, or at least illuminates. My original mail contained some demoing of when the conversion is active, but I won't try to write the command lines involved from this phone. /Erik Den 12/03/2013 21.51 skrev "Tom Burdick" : > Erlang always seems to stuff carriage returns in its stdio output. Its > really really annoying when using it with ports or... well anything. > > I actually spent the time trying to hunt down where in the OTP those are > being put in there so I could send a patch or keep a \r free version of > erlang around for myself. > > I gave up after an hour of trying to hunt it down, maybe someone more > knowledgable can point us all in the right place? > > Tom > > > On Mon, Mar 11, 2013 at 2:40 AM, Jay Doane wrote: > >> I believe the erlang.log.N files come from >> http://www.erlang.org/doc/man/run_erl.html, which is probably being >> invoked from the script rebar generated in rel/files. >> >> There are several environment variables you can use to control the >> output, but I don't know how to get rid of those annoying carriage returns. >> Sure wish I did... >> >> Jay >> >> >> On Sun, Mar 10, 2013 at 12:48 PM, Valentin Kuznetsov wrote: >> >>> Hmm, >>> the application does use error_logger and the erlang.log.1 file contains >>> proper lines from the logger, e.g. >>> >>> =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M >>> <0.818.0> Listening on 10190.^M >>> Eshell V5.9.3 (abort with ^G)^M >>> (urlfetchd@REDACTED)1> ^M >>> =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M >>> <0.838.0> Client {127,0,0,1} connected.^M >>> >>> The release log area has the following content: >>> >>> erlang.log.1 run_erl.log sasl sasl-error.log >>> >>> The sasl-error.log contains proper content too, e.g. >>> >>> =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 === >>> Supervisor: {local,ssl_connection_sup} >>> Context: child_terminated >>> Reason: ekeyfile >>> Offender: [{pid,<0.1016.0>}, >>> {name,undefined}, >>> {mfargs,{ssl_connection,start_link,undefined}}, >>> {restart_type,temporary}, >>> {shutdown,4000}, {child_type,worker}] >>> >>> but it does not have '\r' symbols. >>> >>> The erlang.log.1 is not yet rotated since I only perform a few actions >>> with my application. >>> >>> On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote: >>> >>> Erlang doesn't have a clue about your .1 file. >>> See more about your log rotation program. >>> Also your log file doesn't look like a sasl or error logger file... >>> >>> >>> >>> On Sunday, March 10, 2013, Valentin Kuznetsov wrote: >>> >>>> Hi, >>>> I built OTP application using rebar build tool and when I'm running on >>>> UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has >>>> dos '\r' carriage return symbols in every line. I look-up on a web and did >>>> not find any reference about such behavior. I'll appreciate any suggestions >>>> why this happens (I don't think it's related to my application per-se and >>>> rather feel that it's somehow introduced by rebar, but I'm not sure). The >>>> carriage return symbols appears right after logging started message and >>>> follow up ever line after that. Here is an example of the head of my log. >>>> >>>> ===== >>>> ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 >>>> ===== >>>> Exec: >>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec >>>> -boot >>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd >>>> -mode embedded -config >>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config >>>> -args_file >>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- >>>> console^M >>>> Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M >>>> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] >>>> [async-threads:5] [hipe] [kernel-poll:true]^M >>>> ^M >>>> ^M >>>> >>>> Thanks, >>>> Valentin. >>>> _______________________________________________ >>>> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From soroker@REDACTED Wed Mar 13 01:33:12 2013 From: soroker@REDACTED (Andrei Soroker) Date: Tue, 12 Mar 2013 17:33:12 -0700 Subject: [erlang-questions] R16B asn1rt_nif error In-Reply-To: References: Message-ID: Hi Kenneth, I didn't mention the asn1 application to my .app.src file - that was the problem. Thanks for your response! Andrei On Tue, Mar 12, 2013 at 9:45 AM, Kenneth Lundin wrote: > hi Andrei, > > from the crash info it seems that you don't have the module asn1rt_nif > properly loaded. > This module exports 3 so called Nifs (functions implemented in C) > a .so file is supposed to be automatically loaded when the asn1rt_nif module > is loaded. > you can try calling asn1rt_nif:decode_ber_tlv(<<0,0>>) on your system. > > If this fails you have an unhealty system (the .so file under > lib/asn1-x.y/priv is missing or corrupt or can't be loaded for some reason. > > If this is the case you will have problems with all attempts to decode ASN.1 > encoded data using the BER/DER encoding rules, which are the ones used for > certificates and other SSL/TLS related stuff. > > This can be the causebof the other SSL problem you reported on R16B as well. > > In R15B I think there was a fallback that would run pure Erlang code if the > asn1rt_nif module failed to be loaded. This is no longer the case. > > /Kenneth, Erlang/OTP Ericsson > > Den 11 mar 2013 22:52 skrev "Andrei Soroker" : >> >> Hello, >> >> I just upgraded from R15B03 to R16B and I'm seeing the following: >> >> {{keyfile,{badmatch,{error,{asn1,{undef,[{asn1rt_nif,decode_ber_tlv,[<< >> ... >> >> {'OTP-PUB-KEY',decode,2,[{file,"OTP-PUB-KEY.erl"},{line,985}]},{public_key,der_decode,2,[{file,"public_key.erl"},{line,169}]},{ssl_connection,init_private_key,5,[{file,"ssl_connection.erl"},{line,1176}]},{ssl_connection,ssl_init,2,[{file,"ssl_connection.erl"},{line,1115}]},{ssl_connection,init,1,[{file,"ssl_connection.erl"},{line,303}]} >> >> Is there some quick fix that I'm missing? >> >> Thanks! >> Andrei >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From jay@REDACTED Wed Mar 13 02:53:49 2013 From: jay@REDACTED (Jay Doane) Date: Tue, 12 Mar 2013 18:53:49 -0700 Subject: [erlang-questions] Appearance of carriage return in a erlang.log on UNIX In-Reply-To: References: <1A134A15-FEA3-4A29-A6DD-C8675DD33882@gmail.com> Message-ID: While this doesn't really fix the problem, if you are using emacs, it may help you ignore it ;) (defun remove-dos-eol () "Do not show ^M in files containing mixed UNIX and DOS line endings." (interactive) (setq buffer-display-table (make-display-table)) (aset buffer-display-table ?\^M [])) (add-hook 'log-view-mode-hook 'remove-dos-eol) (add-to-list 'auto-mode-alist '("\\.[0-9]+\\'" . log-view-mode)) On Tue, Mar 12, 2013 at 3:44 PM, Erik S?e S?rensen wrote: > Hey now - why has Gmail begun eating my emails? I didn't even know it had > happened before Tom wrote. > > Anyway, I found the reason - it is the module 'standard_error' which is > responsible, and it inserts the \r when a) you write to stderr and b) > Erlang thinks it is connected to a terminal. > > Hoping this helps, or at least illuminates. My original mail contained > some demoing of when the conversion is active, but I won't try to write the > command lines involved from this phone. > > /Erik > Den 12/03/2013 21.51 skrev "Tom Burdick" : > > Erlang always seems to stuff carriage returns in its stdio output. Its >> really really annoying when using it with ports or... well anything. >> >> I actually spent the time trying to hunt down where in the OTP those are >> being put in there so I could send a patch or keep a \r free version of >> erlang around for myself. >> >> I gave up after an hour of trying to hunt it down, maybe someone more >> knowledgable can point us all in the right place? >> >> Tom >> >> >> On Mon, Mar 11, 2013 at 2:40 AM, Jay Doane wrote: >> >>> I believe the erlang.log.N files come from >>> http://www.erlang.org/doc/man/run_erl.html, which is probably being >>> invoked from the script rebar generated in rel/files. >>> >>> There are several environment variables you can use to control the >>> output, but I don't know how to get rid of those annoying carriage returns. >>> Sure wish I did... >>> >>> Jay >>> >>> >>> On Sun, Mar 10, 2013 at 12:48 PM, Valentin Kuznetsov wrote: >>> >>>> Hmm, >>>> the application does use error_logger and the erlang.log.1 file >>>> contains proper lines from the logger, e.g. >>>> >>>> =INFO REPORT==== 9-Mar-2013::20:55:05 ===^M >>>> <0.818.0> Listening on 10190.^M >>>> Eshell V5.9.3 (abort with ^G)^M >>>> (urlfetchd@REDACTED)1> ^M >>>> =INFO REPORT==== 9-Mar-2013::20:55:31 ===^M >>>> <0.838.0> Client {127,0,0,1} connected.^M >>>> >>>> The release log area has the following content: >>>> >>>> erlang.log.1 run_erl.log sasl sasl-error.log >>>> >>>> The sasl-error.log contains proper content too, e.g. >>>> >>>> =SUPERVISOR REPORT==== 10-Mar-2013::18:29:44 === >>>> Supervisor: {local,ssl_connection_sup} >>>> Context: child_terminated >>>> Reason: ekeyfile >>>> Offender: [{pid,<0.1016.0>}, >>>> {name,undefined}, >>>> {mfargs,{ssl_connection,start_link,undefined}}, >>>> {restart_type,temporary}, >>>> {shutdown,4000}, {child_type,worker}] >>>> >>>> but it does not have '\r' symbols. >>>> >>>> The erlang.log.1 is not yet rotated since I only perform a few actions >>>> with my application. >>>> >>>> On Mar 10, 2013, at ,Mar 10, 3:29 PM, Antoine Koener wrote: >>>> >>>> Erlang doesn't have a clue about your .1 file. >>>> See more about your log rotation program. >>>> Also your log file doesn't look like a sasl or error logger file... >>>> >>>> >>>> >>>> On Sunday, March 10, 2013, Valentin Kuznetsov wrote: >>>> >>>>> Hi, >>>>> I built OTP application using rebar build tool and when I'm running on >>>>> UNIX systems (both OSX and Linux) I see that created erlang.log.1 file has >>>>> dos '\r' carriage return symbols in every line. I look-up on a web and did >>>>> not find any reference about such behavior. I'll appreciate any suggestions >>>>> why this happens (I don't think it's related to my application per-se and >>>>> rather feel that it's somehow introduced by rebar, but I'm not sure). The >>>>> carriage return symbols appears right after logging started message and >>>>> follow up ever line after that. Here is an example of the head of my log. >>>>> >>>>> ===== >>>>> ===== LOGGING STARTED Sat Mar 9 20:55:02 EST 2013 >>>>> ===== >>>>> Exec: >>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/erts-5.9.3/bin/erlexec >>>>> -boot >>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/releases/1/urlfetchd >>>>> -mode embedded -config >>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/app.config >>>>> -args_file >>>>> /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd/etc/vm.args -- >>>>> console^M >>>>> Root: /Users/vk/Work/Languages/Erlang/urlfetch/rel/urlfetchd^M >>>>> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] >>>>> [async-threads:5] [hipe] [kernel-poll:true]^M >>>>> ^M >>>>> ^M >>>>> >>>>> Thanks, >>>>> Valentin. >>>>> _______________________________________________ >>>>> 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 >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike@REDACTED Wed Mar 13 03:32:27 2013 From: mike@REDACTED (Mike Cugini) Date: Tue, 12 Mar 2013 19:32:27 -0700 (PDT) Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages Message-ID: <1677913c-78f6-46fe-9771-d1aa9ee85357@googlegroups.com> Hey all, I was recently put on an erlang project, and I've been trying to get etop working to help profile some issues our app has been having (mostly interested in Message Queue sizes). Etop is started with this command: erl -name etop@ -hidden -s etop -s erlang halt \ -output text -sort reductions -lines 50 \ -node -setcookie Whenever I start etop, I see a flood of "Erlang top got garbage" messages: Erlang top got garbage {trace_ts,<5261.332.0>,out, {gconnection,process_sock_loop,2}, {1363,141107,842108}} Erlang top got garbage {trace_ts,<5261.378.0>,out, {gconnection,process_sock_loop,2}, {1363,141107,842471}} Erlang top got garbage {trace_ts,<5261.351.0>,out, {gconnection,process_sock_loop,2}, {1363,141107,842670}} Erlang top got garbage {trace_ts,<5261.424.0>,out, {gconnection,process_sock_loop,2}, {1363,141107,842861}} This sometimes results in the connection dropping after this message: Output server crashed: connection_lost >From what I've gathered, etop can be disrupted in this way by tracing, and as far as I can tell, our codebase does not use tracing anywhere (no references to erlang:trace or dbg). Initially we thought it might be related to using the lager logging library, but even after disabling it, the issue has persisted. Are there any other potential causes of this issue? Or perhaps something I am overlooking? Thanks! Mike Cugini -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Wed Mar 13 08:36:59 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 13 Mar 2013 11:36:59 +0400 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: <513F9706.1070508@gmail.com> References: <85515.1363035911@snookles.snookles.com> <513F9706.1070508@gmail.com> Message-ID: I'm speaking about prim_file, so I don't control job queue. There is one important thing that should be done if haven't already. When you send IO requests to different devices, these requests should go through different IO thread pool. So, each device should use its own thread pool. -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Wed Mar 13 10:49:27 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Wed, 13 Mar 2013 09:49:27 +0000 Subject: [erlang-questions] Tickets to Erlang User Conference 2013 Stockholm Message-ID: Dear all, [1] says: On the 19th of March at 12.00 am Sweden time (GMT+1) , we will be releasing 50 tickets at the Very Early Bird Rate. Be prepared to grab them, they are bound to sell fast! Is it at midnight or in the middle of the day? [2] says 'undefined': > This means that 00:00 A.M. or 00:00 P.M. (or 12:00 A.M. and 12:00 P.M.) have no meaning. Also, are the tickets for students still free? [1]: www.erlang-factory.com/conference/ErlangUserConference2013 [2]: http://wwp.greenwichmeantime.com/info/noon.htm -- Motiejus Jak?tys From pan@REDACTED Wed Mar 13 12:10:59 2013 From: pan@REDACTED (Patrik Nyblom) Date: Wed, 13 Mar 2013 12:10:59 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion In-Reply-To: <513DE820.1060900@ubiquity.it> References: <513DE820.1060900@ubiquity.it> Message-ID: <51405EC3.10502@erlang.org> Hi! You should not need the macports PCRE lib, there's an erlang specific version in the distribution. Remove (unset) LDFLAGS and CPPFLAGS, clean and build again. Also it seems your error does not correspond to your configure flags, the gcc command line includes -m32, but you have specified --enable-darwin-64bit, so it should read gcc -m64. Strange. Try the simplest, use default compiler and no configure flags (and no flags in environment) and then move forward from there. Cheers, /Patrik On 03/11/2013 03:20 PM, Carlo Bertoldi wrote: > Hello everybody, > this is the error I'm having: > > gcc -mdynamic-no-pic -Werror=return-type -m32 -g -O3 > -fomit-frame-pointer > -I/Users/carlo/.kerl/builds/r16b/otp_src_R16B/erts/x86_64-apple-darwin12.2.0 > -I/opt/local/include -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall > -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement > -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS > -Ix86_64-apple-darwin12.2.0/opt/smp -Ibeam -Isys/unix -Isys/common > -Ix86_64-apple-darwin12.2.0 -Izlib -Ipcre -Ihipe -I../include > -I../include/x86_64-apple-darwin12.2.0 -I../include/internal > -I../include/internal/x86_64-apple-darwin12.2.0 -c beam/erl_bif_re.c > -o obj/x86_64-apple-darwin12.2.0/opt/smp/erl_bif_re.o > beam/erl_bif_re.c: In function ?erts_init_bif_re?: > beam/erl_bif_re.c:68: error: ?erts_pcre_malloc? undeclared (first use > in this function) > > Lib PCRE is installed with Mac Ports, and this is the configuration to > include MacPorts libraries. > > export LDFLAGS='-L/opt/local/lib' > export CPPFLAGS='-I/opt/local/include' > export LD_LIBRARY_PATH=/opt/local/lib > export LD_INCLUDE_PATH=/opt/local/include > > This is the command I'm using to compile. > > CC=/opt/local/bin/gcc-mp-4.5 CXX=/opt/local/bin/g++-mp-4.5 ./otp_build > autoconf && ./configure --disable-hipe --enable-smp-support > --enable-threads --enable-darwin-64bit --enable-kernel-poll > > Thanks for your time. > Carlo > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Wed Mar 13 15:07:13 2013 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 13 Mar 2013 15:07:13 +0100 Subject: [erlang-questions] Make sure that there is only one consumer connected to the RabbitMQ queue Message-ID: Hi Erlangers, I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. I think that exclusive = true and auto-delete = false will do the work. Am I right? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Wed Mar 13 15:23:02 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 13 Mar 2013 14:23:02 +0000 Subject: [erlang-questions] Make sure that there is only one consumer connected to the RabbitMQ queue In-Reply-To: References: Message-ID: <6690B2F8-9537-421D-B4C1-D29EE27E4FB7@gmail.com> Hi Max, On 13 Mar 2013, at 14:07, Max Bourinov wrote: > I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. > > I think that exclusive = true and auto-delete = false will do the work. Am I right? > From http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.exclusive: "bit exclusive Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed." An exclusive queue will be deleted when the connection closes, whereas the auto-delete flag is for ensuring the queue is deleted once all consumers have finishing using it. Also, exclusive queues will exist only _for_ the current connection - i.e., no other connection will know about them - so they're not the right abstraction for limiting access to a shared resource. In fact, I'm not sure if AMQP provides a mechanism to do what you want. Is there another way to approach this requirement, or is this specific behaviour a vital part of it? There are probably ways you could layer this on top of AMQP if you're using the erlang-client, but I suspect you'll have more luck trying to select a different routing topology rather than enforcing connectivity rules that the specification doesn't support. Cheers, Tim Watson Staff Engineer RabbitMQ / VMWare From mabrek@REDACTED Wed Mar 13 15:26:36 2013 From: mabrek@REDACTED (Anton Lebedevich) Date: Wed, 13 Mar 2013 18:26:36 +0400 Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: <1677913c-78f6-46fe-9771-d1aa9ee85357@googlegroups.com> References: <1677913c-78f6-46fe-9771-d1aa9ee85357@googlegroups.com> Message-ID: <51408C9C.5010601@gmail.com> On 03/13/2013 06:32 AM, Mike Cugini wrote: > Hey all, > > I was recently put on an erlang project, and I've been trying to get > etop working to help profile some issues our app has been having (mostly > interested in Message Queue sizes). > > Etop is started with this command: > > erl -name etop@ -hidden -s etop -s erlang halt \ > -output text -sort reductions -lines 50 \ > -node -setcookie > > Whenever I start etop, I see a flood of "Erlang top got garbage" messages: -tracing off flag might help etop. Another possible source of that garbage is mnesia. Regards, Anton Lebedevich. From info@REDACTED Wed Mar 13 16:15:31 2013 From: info@REDACTED (info) Date: Wed, 13 Mar 2013 16:15:31 +0100 Subject: [erlang-questions] erlang and postgresql References: <201303121530233281396@its3.ch> , <513F4301.9020101@gmail.com> Message-ID: <201303131615290318396@its3.ch> I note that I am not alone to be disappointed ! Naive question: why don't exist an "official driver" as well as for mySQL or Postgresql ? info From: Anton Lebedevich Date: 2013-03-12 16:00 To: Paul Barry CC: info; erlang-questions Subject: Re: [erlang-questions] erlang and postgresql At some point in time Zotonic used modified https://github.com/wg/epgsql fork. Is it still true? On 03/12/2013 06:49 PM, Paul Barry wrote: > You should take a look at what the Zotonic people have done with > PostgreSQL. To date, it's the only RDBMS they support (although this is > changing). > > See: http://zotonic.com for more details. > > > On 12 March 2013 14:30, info > wrote: > > __ > Hello, > In order to deploy as soon as possible an erlang application to > production, what is according your experience the most mature/stable > interface for postgresql ? > Thank you to argument > > John > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Paul Barry, w: http://paulbarry.itcarlow.ie - e: paul.barry@REDACTED > > Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Mar 13 16:19:30 2013 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 13 Mar 2013 16:19:30 +0100 Subject: [erlang-questions] erlang and postgresql In-Reply-To: <201303131615290318396@its3.ch> References: <201303121530233281396@its3.ch> <513F4301.9020101@gmail.com> <201303131615290318396@its3.ch> Message-ID: These two are your friends: https://github.com/wg/epgsql https://github.com/josephwecker/epgsql_pool Best regards, Max On Wed, Mar 13, 2013 at 4:15 PM, info wrote: > ** > I note that I am not alone to be disappointed ! > Naive question: why don't exist an "official driver" as well as for mySQL > or Postgresql ? > > ------------------------------ > info > > *From:* Anton Lebedevich > *Date:* 2013-03-12 16:00 > *To:* Paul Barry > *CC:* info ; erlang-questions > *Subject:* Re: [erlang-questions] erlang and postgresql > At some point in time Zotonic used modified https://github.com/wg/epgsql > fork. Is it still true? > > On 03/12/2013 06:49 PM, Paul Barry wrote: > > You should take a look at what the Zotonic people have done with > > PostgreSQL. To date, it's the only RDBMS they support (although this is > > changing). > > > > See: http://zotonic.com for more details. > > > > > > On 12 March 2013 14:30, info > wrote: > > > > __ > > Hello, > > In order to deploy as soon as possible an erlang application to > > production, what is according your experience the most mature/stable > > interface for postgresql ? > > Thank you to argument > > > > John > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > -- > > Paul Barry, w: http://paulbarry.itcarlow.ie - e: paul.barry@REDACTED > > > > Lecturer, Computer Networking: Institute of Technology, Carlow, Ireland. > > > > > > _______________________________________________ > > 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 Wed Mar 13 17:06:15 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 13 Mar 2013 16:06:15 +0000 Subject: [erlang-questions] Fwd: Make sure that there is only one consumer connected to the RabbitMQ queue References: <18E62509-4ACF-4D93-B9D1-FB8851D00FD8@gmail.com> Message-ID: Forgot to CC the list... Begin forwarded message: > From: Tim Watson > Subject: Re: [erlang-questions] Make sure that there is only one consumer connected to the RabbitMQ queue > Date: 13 March 2013 15:58:11 GMT > To: Max Bourinov > > Hi Max, > > Thinking about this a bit more... You're actually going to struggle with a queueing based solution to this, because queues are (by their very nature) enforcing a decoupling between clients. Not only this, but even if RabbitMQ did provide a `consumer_count_for(Queue)` API, that would be incredibly prone to race conditions. What if, immediately after returning the count == 1 the network connection breaks, but the caller doesn't bother to connect? And worse, what if the API returns count == 0 but before the new consumer tries to connect, someone else manages to 'beat him to it' and connect first!? That is why rabbit doesn't provide this API - it is error prone. > > For your use case, this maybe doesn't matter if you're making the clients (nodes) cooperate with each other. Given that fact - i.e., if you're already making P2 connect to P1 and 'tell him to stop consuming messages' - then I'd suggest that the easiest way to handle this is thus: > > Start P2. On start-up, P2 is 'informed' about other the other node, which in this case is [P1]. Once P2 has started, it connects to P1 and instructs it to stop working. P1 should nack/reject any messages it has received but not processed - unless it is using prefetch-count=1, in which case it will not have received any more until sending an ACK - and then disconnect from the queue. Whilst P1 is disconnected, messages will build up in the queue. > > At this point, P1 needs to reply to P2 (via rpc:call/4 or something) that it is disconnected and shutting down. Now P2 (once connected to the broker) simply calls basic.consume to begin receiving messages. No message loss will occur. > > Now you still have to deal with the case where P1 dies accidentally before replying to P2, or P2 dies after shutting down P1 but before connecting to the queue. Oh the joys of distribution! :) > >> I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. > > If you don't like the solution above, one way to possibly make this happen is to have each consumer bind to an exchange using an exclusive queue and a temporary auto-delete exchange. I'll describe how to potentially do this, and hopefully you'll be put off by the complexity! :D > > In this scenario, both the queue and the exchange are temporary. The exchange will be deleted once no more queues are using it, and the queue will be deleted once the exclusive consumer (connection) is finished with it. We will rely on these semantics to determine whether or not there are any active consumers. You would now bind the real exchange (which the senders are publishing to) to the temporary exchange - we will name it 'active' - using an exchange-2-exchange binding, which is a RabbitMQ extension to the AMQP protocol. In this topology, all messages sent to the main exchange - the ingress point for published messages - will be routed directly from the first exchange to the second one. > > From the perspective of 'other consumers', in order to determine whether or not there is an active consumer already, you can check for the existence of the 'active' exchange. You can do that by issuing a passive exchange.declare, viz the spec: > > -- https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare.passive > "bit passive > > If set, the server will reply with Declare-Ok if the exchange already exists with the same name, and raise an error if not. The client can use this to check whether an exchange exists without modifying the server state. When set, all other method fields except name and no-wait are ignored. A declare with both passive and no-wait has no effect. Arguments are compared for semantic equivalence. > > * If set, and the exchange does not already exist, the server MUST raise a channel exception with reply code 404 (not found). > * If not set and the exchange exists, the server MUST check that the existing exchange has the same values for type, durable, and arguments fields. > > The server MUST respond with Declare-Ok if the requested exchange matches these fields, and MUST raise a channel exception if not." > > So if you issue exchange.declare with `passive=true`, then you'll get a channel error (killing the channel) and you will know that someone else is consuming from the primary ingress exchange, because there is an exchange called 'active' which exists and therefore another client has a queue bound to it and is dealing with the incoming messages. > > Now how do you 'fail over' between the two consumers, in a cooperative fashion and without loosing messages? It's not all that easy. Because you're doing something 'esoteric' here, when shutting down the active consumer we cannot simply issue connection.close to the broker. His queue is exclusive, so if it disappears all its unprocessed messages will be lost. What you need is a mechanism to ensure no messages are lost, so you will need another queue into which all messages will get routed - yes that's right, yet another queue! This queue is for tracking completed jobs. It is a permanent (durable) queue, into which the messages are delivered and it must not be exclusive nor auto-delete. There must be a second binding directly from the ingress exchange (NOT the 'active' exchange) to this tracking queue, so all inbound messages always arrive in it. > > When the active consumer has taken a message from his personal (exclusive) queue and finished working with it, he must also dequeue it from this 'tracking queue' as well. The simplest method for doing this is probably to use synchronous basic.get, but if you're concerned about throughput you can use basic.consume (in another channel) and set `prefetch=1` using basic.qos, then only send the ACK for a message once it is finished being handled. The tracking task can be a gen_server, which has some code like this (below) to receive a 'tracking note' for the message and to send the ACK (and thereby remove the message from the tracking queue) in response to the worker - which is using a separate (exchange +) queue - indicating completion: > > handle_info({#'basic.deliver'{delivery_tag = DeliveryTag}, > #amqp_msg{props = #'P_basic'{correlation_id = <>}, > payload = Payload}}, > State = #state{continuations = Conts, channel = Channel}) -> > %% store the correlation_id and wait to be told that we can ACK > ... ok; ... etc > > handle_call({finished, TaskKey}, _From, State) -> > DeliveryTag = lookup_correlation_id(TaskKey, State), > amqp_channel:call(State#state.channel, #'basic.ack'{delivery_tag = DeliveryTag}), > {reply, ok, remove_correlation_id(TaskKey, State)}; ... > > > Now when the worker (P1) is ready to stop, it can simply disconnect. Here is what will happen then... > > 1. The exclusive queue will be deleted when the connection dies - all unprocessed messages therein will be lost > 2. The exchange named 'active' is auto-delete, so once its only bound queue is deleted, it will also be removed > 3. All the unprocessed messages still in the shared 'tracking queue' will remain there > 4. Any message delivered from the 'tracking queue' to the (now dead) consumer that has *not* been ack'ed, will be re-queued. > > > Phew. Now for the takeover, it's relatively simple(er). Whilst the 'active' exchange exists, the additional consumers should not connect. If the 'active' exchange does not exist, then they can become the active consumer by creating the exclusive queue, creating the 'active' exchange and binding it to the exclusive queue *first* and then binding the active exchange to the ingress exchange. Once all that is in place, the 'takeover' is almost complete, but of course there will be messages now in the 'tracking queue' which never made it to the 'active' exchange because it didn't exist when they arrived. So now the new consumer must start dequeueing messages from both the exclusive queue (arriving in it via the 'active' exchange) *AND* the tracking queue. Whilst the tracking queue has messages in it that are not in the 'active' queue, we process those first. Once we have caught up, then we swap back and process the messages from the active pipe and ACK them on the tracking queue second. > > Of course it will be very easy to end up with a race between the two in your single consumer. Just describing that design made me feel rather unhappy, so I'd suggest that it's *really* worth trying to find another way to frame the problem if you can. > > Hope that all makes sense, sort of... > > Cheers, > > Tim > >> >> >> On Wed, Mar 13, 2013 at 3:23 PM, Tim Watson wrote: >> Hi Max, >> >> On 13 Mar 2013, at 14:07, Max Bourinov wrote: >>> I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. >>> >>> I think that exclusive = true and auto-delete = false will do the work. Am I right? >>> >> >> From http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.exclusive: >> >> "bit exclusive >> >> Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed." >> >> An exclusive queue will be deleted when the connection closes, whereas the auto-delete flag is for ensuring the queue is deleted once all consumers have finishing using it. Also, exclusive queues will exist only _for_ the current connection - i.e., no other connection will know about them - so they're not the right abstraction for limiting access to a shared resource. In fact, I'm not sure if AMQP provides a mechanism to do what you want. >> >> Is there another way to approach this requirement, or is this specific behaviour a vital part of it? There are probably ways you could layer this on top of AMQP if you're using the erlang-client, but I suspect you'll have more luck trying to select a different routing topology rather than enforcing connectivity rules that the specification doesn't support. >> >> Cheers, >> >> Tim Watson >> Staff Engineer >> RabbitMQ / VMWare >> > From watson.timothy@REDACTED Wed Mar 13 17:10:12 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 13 Mar 2013 16:10:12 +0000 Subject: [erlang-questions] Make sure that there is only one consumer connected to the RabbitMQ queue In-Reply-To: <6690B2F8-9537-421D-B4C1-D29EE27E4FB7@gmail.com> References: <6690B2F8-9537-421D-B4C1-D29EE27E4FB7@gmail.com> Message-ID: Hi Max, Thinking about this a bit more... You're actually going to struggle with a queueing based solution to this, because queues are (by their very nature) enforcing a decoupling between clients. Not only this, but even if RabbitMQ did provide a `consumer_count_for(Queue)` API, that would be incredibly prone to race conditions. What if, immediately after returning the count == 1 the network connection breaks, but the caller doesn't bother to connect? And worse, what if the API returns count == 0 but before the new consumer tries to connect, someone else manages to 'beat him to it' and connect first!? That is why rabbit doesn't provide this API - it is error prone. For your use case, this maybe doesn't matter if you're making the clients (nodes) cooperate with each other. Given that fact - i.e., if you're already making P2 connect to P1 and 'tell him to stop consuming messages' - then I'd suggest that the easiest way to handle this is thus: Start P2. On start-up, P2 is 'informed' about other the other node, which in this case is [P1]. Once P2 has started, it connects to P1 and instructs it to stop working. P1 should nack/reject any messages it has received but not processed - unless it is using prefetch-count=1, in which case it will not have received any more until sending an ACK - and then disconnect from the queue. Whilst P1 is disconnected, messages will build up in the queue. At this point, P1 needs to reply to P2 (via rpc:call/4 or something) that it is disconnected and shutting down. Now P2 (once connected to the broker) simply calls basic.consume to begin receiving messages. No message loss will occur. Now you still have to deal with the case where P1 dies accidentally before replying to P2, or P2 dies after shutting down P1 but before connecting to the queue. Oh the joys of distribution! :) > I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. If you don't like the solution above, one way to possibly make this happen is to have each consumer bind to an exchange using an exclusive queue and a temporary auto-delete exchange. I'll describe how to potentially do this, and hopefully you'll be put off by the complexity! :D In this scenario, both the queue and the exchange are temporary. The exchange will be deleted once no more queues are using it, and the queue will be deleted once the exclusive consumer (connection) is finished with it. We will rely on these semantics to determine whether or not there are any active consumers. You would now bind the real exchange (which the senders are publishing to) to the temporary exchange - we will name it 'active' - using an exchange-2-exchange binding, which is a RabbitMQ extension to the AMQP protocol. In this topology, all messages sent to the main exchange - the ingress point for published messages - will be routed directly from the first exchange to the second one. From the perspective of 'other consumers', in order to determine whether or not there is an active consumer already, you can check for the existence of the 'active' exchange. You can do that by issuing a passive exchange.declare, viz the spec: -- https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare.passive "bit passive If set, the server will reply with Declare-Ok if the exchange already exists with the same name, and raise an error if not. The client can use this to check whether an exchange exists without modifying the server state. When set, all other method fields except name and no-wait are ignored. A declare with both passive and no-wait has no effect. Arguments are compared for semantic equivalence. * If set, and the exchange does not already exist, the server MUST raise a channel exception with reply code 404 (not found). * If not set and the exchange exists, the server MUST check that the existing exchange has the same values for type, durable, and arguments fields. The server MUST respond with Declare-Ok if the requested exchange matches these fields, and MUST raise a channel exception if not." So if you issue exchange.declare with `passive=true`, then you'll get a channel error (killing the channel) and you will know that someone else is consuming from the primary ingress exchange, because there is an exchange called 'active' which exists and therefore another client has a queue bound to it and is dealing with the incoming messages. Now how do you 'fail over' between the two consumers, in a cooperative fashion and without loosing messages? It's not all that easy. Because you're doing something 'esoteric' here, when shutting down the active consumer we cannot simply issue connection.close to the broker. His queue is exclusive, so if it disappears all its unprocessed messages will be lost. What you need is a mechanism to ensure no messages are lost, so you will need another queue into which all messages will get routed - yes that's right, yet another queue! This queue is for tracking completed jobs. It is a permanent (durable) queue, into which the messages are delivered and it must not be exclusive nor auto-delete. There must be a second binding directly from the ingress exchange (NOT the 'active' exchange) to this tracking queue, so all inbound messages always arrive in it. When the active consumer has taken a message from his personal (exclusive) queue and finished working with it, he must also dequeue it from this 'tracking queue' as well. The simplest method for doing this is probably to use synchronous basic.get, but if you're concerned about throughput you can use basic.consume (in another channel) and set `prefetch=1` using basic.qos, then only send the ACK for a message once it is finished being handled. The tracking task can be a gen_server, which has some code like this (below) to receive a 'tracking note' for the message and to send the ACK (and thereby remove the message from the tracking queue) in response to the worker - which is using a separate (exchange +) queue - indicating completion: handle_info({#'basic.deliver'{delivery_tag = DeliveryTag}, #amqp_msg{props = #'P_basic'{correlation_id = <>}, payload = Payload}}, State = #state{continuations = Conts, channel = Channel}) -> %% store the correlation_id and wait to be told that we can ACK ... ok; ... etc handle_call({finished, TaskKey}, _From, State) -> DeliveryTag = lookup_correlation_id(TaskKey, State), amqp_channel:call(State#state.channel, #'basic.ack'{delivery_tag = DeliveryTag}), {reply, ok, remove_correlation_id(TaskKey, State)}; ... Now when the worker (P1) is ready to stop, it can simply disconnect. Here is what will happen then... 1. The exclusive queue will be deleted when the connection dies - all unprocessed messages therein will be lost 2. The exchange named 'active' is auto-delete, so once its only bound queue is deleted, it will also be removed 3. All the unprocessed messages still in the shared 'tracking queue' will remain there 4. Any message delivered from the 'tracking queue' to the (now dead) consumer that has *not* been ack'ed, will be re-queued. Phew. Now for the takeover, it's relatively simple(er). Whilst the 'active' exchange exists, the additional consumers should not connect. If the 'active' exchange does not exist, then they can become the active consumer by creating the exclusive queue, creating the 'active' exchange and binding it to the exclusive queue *first* and then binding the active exchange to the ingress exchange. Once all that is in place, the 'takeover' is almost complete, but of course there will be messages now in the 'tracking queue' which never made it to the 'active' exchange because it didn't exist when they arrived. So now the new consumer must start dequeueing messages from both the exclusive queue (arriving in it via the 'active' exchange) *AND* the tracking queue. Whilst the tracking queue has messages in it that are not in the 'active' queue, we process those first. Once we have caught up, then we swap back and process the messages from the active pipe and ACK them on the tracking queue second. Of course it will be very easy to end up with a race between the two in your single consumer. Just describing that design made me feel rather unhappy, so I'd suggest that it's *really* worth trying to find another way to frame the problem if you can. Hope that all makes sense, sort of... Cheers, Tim On 13 Mar 2013, at 14:23, Tim Watson wrote: > Hi Max, > > On 13 Mar 2013, at 14:07, Max Bourinov wrote: >> I have multiple nodes that might connect to the certain queue at my RabbitMQ server. I need to make sure that only the first of them will connect and all others will fail. Queue should not be deleted when currently connected node goes down. >> >> I think that exclusive = true and auto-delete = false will do the work. Am I right? >> > > From http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.exclusive: > > "bit exclusive > > Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed." > > An exclusive queue will be deleted when the connection closes, whereas the auto-delete flag is for ensuring the queue is deleted once all consumers have finishing using it. Also, exclusive queues will exist only _for_ the current connection - i.e., no other connection will know about them - so they're not the right abstraction for limiting access to a shared resource. In fact, I'm not sure if AMQP provides a mechanism to do what you want. > > Is there another way to approach this requirement, or is this specific behaviour a vital part of it? There are probably ways you could layer this on top of AMQP if you're using the erlang-client, but I suspect you'll have more luck trying to select a different routing topology rather than enforcing connectivity rules that the specification doesn't support. > > Cheers, > > Tim Watson > Staff Engineer > RabbitMQ / VMWare From lee.sylvester@REDACTED Wed Mar 13 17:27:13 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Wed, 13 Mar 2013 16:27:13 +0000 Subject: [erlang-questions] Rebar issues Message-ID: Hi guys, I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: ERROR: Template simplenode not found. If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? Thanks, Lee From fritchie@REDACTED Wed Mar 13 17:54:39 2013 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 13 Mar 2013 11:54:39 -0500 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: Message of "Wed, 13 Mar 2013 00:10:38 +0400." Message-ID: <36194.1363193679@snookles.snookles.com> Max Lapshin wrote: ml> So, I need to run dtrace on live system? I've never had a problem with running DTrace on a live system. Even many tens of thousands of events per second don't make a big impact on performance. If you enable a probe that fires millions of times per second, then you can create a speed/latency problem ... but still not enough to cripple a system or cause it to panic. If you're really paranoid about creating overload, you can use a D script to do something like this in order to stop itself: tick-5sec { exit(0); } ml> I've found that if I increase +A from 16 to 160, system starts ml> working excelently. Sounds like you were indeed having a serialization problem on one or more of those 16 threads. It's worth noting that the mapping of operations to that pool is *not* based on first-available thread. If two files are frequently accessed, and the path of both maps to the same async Pthread, they will (by definition) content for the same async Pthread even when other async Pthreads are idle. -Scott From fritchie@REDACTED Wed Mar 13 18:02:58 2013 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 13 Mar 2013 12:02:58 -0500 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: Message of "Tue, 12 Mar 2013 13:58:46 PDT." <513F9706.1070508@gmail.com> Message-ID: <36747.1363194178@snookles.snookles.com> Michael Truog wrote: mt> You may have thought that the async threads use a shared job queue, mt> but they don't... each thread has its own queue. So, that means it mt> is easy to plug up the async thread pool, if you have long running mt> operations. By increasing the pool size to a much larger value, you mt> are no longer blocking on a randomly overworked async thread. Small correction: you're less likely to block on an overworked async thread. It's still possible to have two independent Erlang file handles/ports operating on different files that will always use the same async thread. -Scott From anotherworldofworld@REDACTED Wed Mar 13 18:24:53 2013 From: anotherworldofworld@REDACTED (Alex toyer) Date: Wed, 13 Mar 2013 23:24:53 +0600 Subject: [erlang-questions] [ANN] Ybot-0.3.2 chat robot released Message-ID: Hello, Let me announce Ybot-0.3.2 released. Ybot - is erlang chat robot which supports different messaging protocols like: HipChat, Campfire, XMPP, IRC, Skype and other. This is bug fix release with some little innovations. Ybot-0.3.2 ChangeLog: - Fixed #42 issue. Unable to connect to IRC bug. - Fixed #44 issue. Fixed internal Ybot commands. - #42. If bot nickname already in use, generate new name and try to reconnect. - #45 fixed. Timeout error from IRC transport. - #43 fixed. Unable to compile using rebar. - Help plugin improved. - #44 Internal commands tested and fixed. - To all plugins added checks arguments. - New internal command 'announce' added. - New api ybot:act/1 added - New api ybot:plugins/0 added - All plugins argumets checking added. - Fixed campfire image/video posting. - Scala plugins support added. - Url decode/encode new plugin added. - math.rb plugin result output fixed. - New core plugin translate.rb added. tranlate text with google translate plugin added. Ybot repository at github - https://github.com/0xAX/Ybot Ybot plugins repository - https://github.com/0xAX/ybot-contrib -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Wed Mar 13 18:39:48 2013 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 13 Mar 2013 12:39:48 -0500 Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: Message of "Wed, 13 Mar 2013 18:26:36 +0400." <51408C9C.5010601@gmail.com> Message-ID: <39010.1363196388@snookles.snookles.com> Anton Lebedevich wrote: >> Whenever I start etop, I see a flood of "Erlang top got garbage" >> messages: al> -tracing off flag might help etop. I agree with Anton: the default (tracing is on) creates a huge amount of extra load on the VM. Turning tracing off is IMHO highly recommended. -Scott From calleja.justin@REDACTED Wed Mar 13 22:52:32 2013 From: calleja.justin@REDACTED (Justin Calleja) Date: Wed, 13 Mar 2013 22:52:32 +0100 Subject: [erlang-questions] erl_syntax issues Message-ID: Hi all, Anyone knows why erl_syntax won't revert a syntaxTree() I created using erl_syntax itself? See: http://pastebin.com/DzFbVUXw cheers, Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Wed Mar 13 22:58:43 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Wed, 13 Mar 2013 22:58:43 +0100 Subject: [erlang-questions] erl_syntax issues In-Reply-To: References: Message-ID: <5140F693.4090900@gmail.com> On 2013-03-13 22:52, Justin Calleja wrote: > Hi all, > > Anyone knows why erl_syntax won't revert a syntaxTree() I created using > erl_syntax itself? > > See: http://pastebin.com/DzFbVUXw I think it's because you pass the result of your ClauseBuilder directly to FunctionBuilder, but the latter expects a list of clauses, and the former just produces a single clause. Try FunctionBuilder([ClauseBuilder(...)]). /Richard From mike@REDACTED Wed Mar 13 23:47:27 2013 From: mike@REDACTED (Mike Cugini) Date: Wed, 13 Mar 2013 15:47:27 -0700 (PDT) Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: <39010.1363196388@snookles.snookles.com> References: <39010.1363196388@snookles.snookles.com> Message-ID: <6cb48923-c37d-4060-8219-c15da78b75c0@googlegroups.com> the -tracing off flag definitely helped, I no longer see the "garbage" messages. Unfortunately, etop will crash within 30 secs on average with: "Output server crashed: connection_lost" This is likely just a result of a busy server? On Wednesday, March 13, 2013 1:39:48 PM UTC-4, Scott Lystig Fritchie wrote: > > Anton Lebedevich > wrote: > > >> Whenever I start etop, I see a flood of "Erlang top got garbage" > >> messages: > > al> -tracing off flag might help etop. > > I agree with Anton: the default (tracing is on) creates a huge amount of > extra load on the VM. Turning tracing off is IMHO highly recommended. > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nem@REDACTED Wed Mar 13 23:58:39 2013 From: nem@REDACTED (Geoff Cant) Date: Wed, 13 Mar 2013 15:58:39 -0700 Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: <6cb48923-c37d-4060-8219-c15da78b75c0@googlegroups.com> References: <39010.1363196388@snookles.snookles.com> <6cb48923-c37d-4060-8219-c15da78b75c0@googlegroups.com> Message-ID: <6EF7C48F-57A1-4766-ADAA-B954CEBDC21B@erlang.geek.nz> I'm not sure if this will help you, but I often get good results in production by establishing a remote shell to the production node from a hidden console node erl -name myconsole -remsh prodnode -hidden And then running etop on the node I'm tracing: 1> etop:start([{node, node()}, {output, text}, {lines, 32}]). I usually don't need to turn off tracing there, but if I do, I think {tracing, off} is the option you add to the list. To stop etop, either quit your shell ^g q ret, or interrupt it ^g i ret. Cheers, -Geoff On 2013-03-13, at 15:47 , Mike Cugini wrote: > the -tracing off flag definitely helped, I no longer see the "garbage" > messages. > > Unfortunately, etop will crash within 30 secs on average with: "Output > server crashed: connection_lost" > > This is likely just a result of a busy server? > > > On Wednesday, March 13, 2013 1:39:48 PM UTC-4, Scott Lystig Fritchie wrote: >> >> Anton Lebedevich > wrote: >> >>>> Whenever I start etop, I see a flood of "Erlang top got garbage" >>>> messages: >> >> al> -tracing off flag might help etop. >> >> I agree with Anton: the default (tracing is on) creates a huge amount of >> extra load on the VM. Turning tracing off is IMHO highly recommended. >> >> -Scott >> _______________________________________________ >> erlang-questions mailing list >> erlang-q...@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Geoff Cant From calleja.justin@REDACTED Thu Mar 14 00:05:36 2013 From: calleja.justin@REDACTED (Justin Calleja) Date: Thu, 14 Mar 2013 00:05:36 +0100 Subject: [erlang-questions] erl_syntax issues In-Reply-To: <5140F693.4090900@gmail.com> References: <5140F693.4090900@gmail.com> Message-ID: u r d best !! thx for always helping with my erl_syntax problems - and for writing it of course :P I also had a similar bug with the use of erl_syntax:clause/3... again was not passing in a [syntaxTree()]. The working version: http://pastebin.com/LdPKTSfG cheers, Justin On 13 March 2013 22:58, Richard Carlsson wrote: > On 2013-03-13 22:52, Justin Calleja wrote: > >> Hi all, >> >> Anyone knows why erl_syntax won't revert a syntaxTree() I created using >> erl_syntax itself? >> >> See: http://pastebin.com/DzFbVUXw >> > > I think it's because you pass the result of your ClauseBuilder directly to > FunctionBuilder, but the latter expects a list of clauses, and the former > just produces a single clause. Try FunctionBuilder([** > ClauseBuilder(...)]). > > /Richard > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arthurbeall@REDACTED Thu Mar 14 02:52:04 2013 From: arthurbeall@REDACTED (Art Beall) Date: Wed, 13 Mar 2013 18:52:04 -0700 (PDT) Subject: [erlang-questions] EPMD and Multiple Erlang nodes of different versions/releases on a single server In-Reply-To: References: Message-ID: <1363225924.88099.YahooMailNeo@web160501.mail.bf1.yahoo.com> Hello, How does the upgrade, install, startup, and shutdown of multiple Erlang nodes (installed separately)?running on the same server work when there is only one version of EPMD running on the server? For instance, what happens when a minor or major upgrade requires shutting only one of the Erlang nodes down and that nodes EPMD is running? Especially when the other nodes on the server are currently using distributed Erlang? To clarify the question, we are running on Windows (please don?t hit page down ;->) , and we will be using the same Erlang cookie. Thanks for any help, examples, or insight! ? Art Beall -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Thu Mar 14 09:45:12 2013 From: rtrlists@REDACTED (Robert Raschke) Date: Thu, 14 Mar 2013 08:45:12 +0000 Subject: [erlang-questions] EPMD and Multiple Erlang nodes of different versions/releases on a single server In-Reply-To: <1363225924.88099.YahooMailNeo@web160501.mail.bf1.yahoo.com> References: <1363225924.88099.YahooMailNeo@web160501.mail.bf1.yahoo.com> Message-ID: Hi Art, EPMD stays running even when you shut down all nodes. If you ever need to ensure that EPMD restarts, you'll have to do that explicitly, either via the EPMD command our by killing it from the task manager. Not sure this answers your question, though. Robby On Mar 14, 2013 1:52 AM, "Art Beall" wrote: > Hello, > How does the upgrade, install, startup, and shutdown of multiple Erlang > nodes (installed separately) running on the same server work when there is > only one version of EPMD running on the server? > For instance, what happens when a minor or major upgrade requires > shutting only one of the Erlang nodes down and that nodes EPMD is running? > Especially when the other nodes on the server are currently using > distributed Erlang? > To clarify the question, we are running on Windows (please don?t hit > page down ;->) , and we will be using the same Erlang cookie. > Thanks for any help, examples, or insight! > > Art Beall > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlo.bertoldi@REDACTED Thu Mar 14 09:52:38 2013 From: carlo.bertoldi@REDACTED (Carlo Bertoldi) Date: Thu, 14 Mar 2013 09:52:38 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion In-Reply-To: <51405EC3.10502@erlang.org> References: <513DE820.1060900@ubiquity.it> <51405EC3.10502@erlang.org> Message-ID: <51418FD6.1070709@ubiquity.it> Thanks Patrik, unsetting the compiler flags solved my problem :) But still, sourcing were compiled with -m32. So I switched to gcc-4.5 included in MacPorts, and finally got the expected -m64. Cheers, Carlo On 13/03/13 12:10, Patrik Nyblom wrote: > Hi! > > You should not need the macports PCRE lib, there's an erlang specific > version in the distribution. Remove (unset) LDFLAGS and CPPFLAGS, clean > and build again. > > Also it seems your error does not correspond to your configure flags, > the gcc command line includes -m32, but you have specified > --enable-darwin-64bit, so it should read gcc -m64. Strange. > > Try the simplest, use default compiler and no configure flags (and no > flags in environment) and then move forward from there. > > Cheers, > /Patrik > > On 03/11/2013 03:20 PM, Carlo Bertoldi wrote: >> Hello everybody, >> this is the error I'm having: >> >> gcc -mdynamic-no-pic -Werror=return-type -m32 -g -O3 >> -fomit-frame-pointer >> -I/Users/carlo/.kerl/builds/r16b/otp_src_R16B/erts/x86_64-apple-darwin12.2.0 >> -I/opt/local/include -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall >> -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement >> -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS >> -Ix86_64-apple-darwin12.2.0/opt/smp -Ibeam -Isys/unix -Isys/common >> -Ix86_64-apple-darwin12.2.0 -Izlib -Ipcre -Ihipe -I../include >> -I../include/x86_64-apple-darwin12.2.0 -I../include/internal >> -I../include/internal/x86_64-apple-darwin12.2.0 -c beam/erl_bif_re.c >> -o obj/x86_64-apple-darwin12.2.0/opt/smp/erl_bif_re.o >> beam/erl_bif_re.c: In function ?erts_init_bif_re?: >> beam/erl_bif_re.c:68: error: ?erts_pcre_malloc? undeclared (first use >> in this function) >> >> Lib PCRE is installed with Mac Ports, and this is the configuration to >> include MacPorts libraries. >> >> export LDFLAGS='-L/opt/local/lib' >> export CPPFLAGS='-I/opt/local/include' >> export LD_LIBRARY_PATH=/opt/local/lib >> export LD_INCLUDE_PATH=/opt/local/include >> >> This is the command I'm using to compile. >> >> CC=/opt/local/bin/gcc-mp-4.5 CXX=/opt/local/bin/g++-mp-4.5 ./otp_build >> autoconf && ./configure --disable-hipe --enable-smp-support >> --enable-threads --enable-darwin-64bit --enable-kernel-poll >> >> Thanks for your time. >> Carlo >> >> _______________________________________________ >> 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 -- Ubiquity - A little bit forward *Carlo Bertoldi* Ubiquity Via Teodosio 65 - 20131, Milano Fisso: +39 02 288584.36 - Fax: +39 02 2829795 Email: carlo.bertoldi@REDACTED Website: www.ubiquity.it From mabrek@REDACTED Thu Mar 14 10:19:45 2013 From: mabrek@REDACTED (Anton Lebedevich) Date: Thu, 14 Mar 2013 13:19:45 +0400 Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: <51408C9C.5010601@gmail.com> References: <1677913c-78f6-46fe-9771-d1aa9ee85357@googlegroups.com> <51408C9C.5010601@gmail.com> Message-ID: <51419631.8010903@gmail.com> On 03/13/2013 06:26 PM, Anton Lebedevich wrote: > On 03/13/2013 06:32 AM, Mike Cugini wrote: >> Hey all, >> >> I was recently put on an erlang project, and I've been trying to get >> etop working to help profile some issues our app has been having (mostly >> interested in Message Queue sizes). >> >> Etop is started with this command: >> >> erl -name etop@ -hidden -s etop -s erlang halt \ >> -output text -sort reductions -lines 50 \ >> -node -setcookie >> >> Whenever I start etop, I see a flood of "Erlang top got garbage" messages: > > > -tracing off flag might help etop. Another possible source of that > garbage is mnesia. There is a correction to the last statement, thanks to H?kan Mattsson: Mnesia doesn't produce that garbage by itself because it doesn't use tracing. But it seems to trigger some bug in the way etop uses tracing. It's reproducible with R14B04. Steps: In one shell: $ erl -boot start_sasl -name mns@REDACTED (mns@REDACTED)1> mnesia:create_schema([node()]). Then in another shell: $ erl -name etop -hidden -s etop -output text -node mns@REDACTED Observe normal etop output. Then go back to the first shell and run: (mns@REDACTED)2> mnesia:start(). Observe lots of these in the second shell: Erlang top got garbage {trace_ts,<5149.95.0>,out, {dets,open_file_loop2,2}, {1363,250243,207280}} Erlang top got garbage {trace_ts,<5149.91.0>,out, {gen_server,loop,6}, {1363,250243,207353}} Regards, Anton Lebedevich. From rapsey@REDACTED Thu Mar 14 11:11:17 2013 From: rapsey@REDACTED (Rapsey) Date: Thu, 14 Mar 2013 11:11:17 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion In-Reply-To: <51418FD6.1070709@ubiquity.it> References: <513DE820.1060900@ubiquity.it> <51405EC3.10502@erlang.org> <51418FD6.1070709@ubiquity.it> Message-ID: Why mac ports? Homebrew works a lot better and is more actively maintained. http://mxcl.github.com/homebrew/ Sergej On Thu, Mar 14, 2013 at 9:52 AM, Carlo Bertoldi wrote: > Thanks Patrik, unsetting the compiler flags solved my problem :) > But still, sourcing were compiled with -m32. > So I switched to gcc-4.5 included in MacPorts, and finally got the > expected -m64. > > Cheers, > Carlo > > > On 13/03/13 12:10, Patrik Nyblom wrote: > >> Hi! >> >> You should not need the macports PCRE lib, there's an erlang specific >> version in the distribution. Remove (unset) LDFLAGS and CPPFLAGS, clean >> and build again. >> >> Also it seems your error does not correspond to your configure flags, >> the gcc command line includes -m32, but you have specified >> --enable-darwin-64bit, so it should read gcc -m64. Strange. >> >> Try the simplest, use default compiler and no configure flags (and no >> flags in environment) and then move forward from there. >> >> Cheers, >> /Patrik >> >> On 03/11/2013 03:20 PM, Carlo Bertoldi wrote: >> >>> Hello everybody, >>> this is the error I'm having: >>> >>> gcc -mdynamic-no-pic -Werror=return-type -m32 -g -O3 >>> -fomit-frame-pointer >>> -I/Users/carlo/.kerl/builds/**r16b/otp_src_R16B/erts/x86_64-** >>> apple-darwin12.2.0 >>> -I/opt/local/include -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall >>> -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement >>> -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS >>> -Ix86_64-apple-darwin12.2.0/**opt/smp -Ibeam -Isys/unix -Isys/common >>> -Ix86_64-apple-darwin12.2.0 -Izlib -Ipcre -Ihipe -I../include >>> -I../include/x86_64-apple-**darwin12.2.0 -I../include/internal >>> -I../include/internal/x86_64-**apple-darwin12.2.0 -c beam/erl_bif_re.c >>> -o obj/x86_64-apple-darwin12.2.0/**opt/smp/erl_bif_re.o >>> beam/erl_bif_re.c: In function ?erts_init_bif_re?: >>> beam/erl_bif_re.c:68: error: ?erts_pcre_malloc? undeclared (first use >>> in this function) >>> >>> Lib PCRE is installed with Mac Ports, and this is the configuration to >>> include MacPorts libraries. >>> >>> export LDFLAGS='-L/opt/local/lib' >>> export CPPFLAGS='-I/opt/local/**include' >>> export LD_LIBRARY_PATH=/opt/local/lib >>> export LD_INCLUDE_PATH=/opt/local/**include >>> >>> This is the command I'm using to compile. >>> >>> CC=/opt/local/bin/gcc-mp-4.5 CXX=/opt/local/bin/g++-mp-4.5 ./otp_build >>> autoconf && ./configure --disable-hipe --enable-smp-support >>> --enable-threads --enable-darwin-64bit --enable-kernel-poll >>> >>> Thanks for your time. >>> Carlo >>> >>> ______________________________**_________________ >>> 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 >> > > > -- > Ubiquity - A little bit forward > *Carlo Bertoldi* > Ubiquity > Via Teodosio 65 - 20131, Milano > Fisso: +39 02 288584.36 - Fax: +39 02 2829795 > Email: carlo.bertoldi@REDACTED > Website: www.ubiquity.it > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlo.bertoldi@REDACTED Thu Mar 14 11:26:35 2013 From: carlo.bertoldi@REDACTED (Carlo Bertoldi) Date: Thu, 14 Mar 2013 11:26:35 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion In-Reply-To: <51418FD6.1070709@ubiquity.it> References: <513DE820.1060900@ubiquity.it> <51405EC3.10502@erlang.org> <51418FD6.1070709@ubiquity.it> Message-ID: <5141A5DB.7070307@ubiquity.it> I've talked too early. I have this error now: make -f x86_64-apple-darwin12.2.0/Makefile TYPE=opt gcc -m64 -m64 -o ../priv/bin/x86_64-apple-darwin12.2.0/memsup ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o ld: warning: ignoring file ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o, file was built for i386 which is not the architecture being linked (x86_64): ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[4]: *** [../priv/bin/x86_64-apple-darwin12.2.0/memsup] Error 1 This is my configure: ./configure --enable-smp-support --enable-threads --enable-kernel-poll --enable-darwin-64bit --enable-m64-build The error happens with both the default compiler and the macports one. If I omit --enable-m64-build, then sources are compiled with -m32, and the compilation works. Carlo On 14/03/13 09:52, Carlo Bertoldi wrote: > Thanks Patrik, unsetting the compiler flags solved my problem :) > But still, sourcing were compiled with -m32. > So I switched to gcc-4.5 included in MacPorts, and finally got the > expected -m64. > > Cheers, > Carlo -- Ubiquity - A little bit forward *Carlo Bertoldi* Ubiquity Via Teodosio 65 - 20131, Milano Fisso: +39 02 288584.36 - Fax: +39 02 2829795 Email: carlo.bertoldi@REDACTED Website: www.ubiquity.it From lee.sylvester@REDACTED Thu Mar 14 13:04:26 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Thu, 14 Mar 2013 12:04:26 +0000 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: <0C176918-2BC0-4300-AAB9-440B8898C7D8@gmail.com> Does anyone have an idea? Thanks, Lee On 13 Mar 2013, at 16:27, Lee Sylvester wrote: > Hi guys, > > I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: > > ERROR: Template simplenode not found. > > If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? > > Thanks, > Lee > From zambal@REDACTED Thu Mar 14 13:48:19 2013 From: zambal@REDACTED (Vincent Siliakus) Date: Thu, 14 Mar 2013 05:48:19 -0700 (PDT) Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Hi Lee, More info is needed to understand what the cause of the problem is. - Where / what version did you download. - How did you compile rebar - With what parameters did you try to run rebar? Anyway, I've never experienced problems with rebar when following the build instructions on github: $ git clone git://github.com/rebar/rebar.git$ cd rebar$ ./bootstrap Recompile: src/getopt ... Recompile: src/rebar_utils==> rebar (compile) Congratulations! You now have a self-contained script called "rebar" in your current working directory. Place this script anywhere in your path and you can use rebar to build OTP-compliant apps. Best, Vincent Op woensdag 13 maart 2013 17:27:13 UTC+1 schreef Lee Sylvester het volgende: > > Hi guys, > > I've downloaded Rebar and compiled it ready for use, but whenever I copy > it to my project directories and run it, I get the error: > > ERROR: Template simplenode not found. > > If I copy the priv directory to the directory I'm calling Rebar from, then > it works fine, but I don't want to keep having to drag that around. What > should I really be doing? > > Thanks, > Lee > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lee.sylvester@REDACTED Thu Mar 14 13:55:18 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Thu, 14 Mar 2013 12:55:18 +0000 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Hi Vincent, Thank you for your reply. 1. I downloaded Rebar from the Basho repository on GitHub 2. rebar --version outputs "rebar 2.1.0-pre R16A 20130313_161755 No VCS info available." 3. I compiled Rebar using the bootstrap script 4. Rebar works when using rebar compile, rebar clean and rebar create-node. However, it only works if I copy the priv directory into the directory I'm making the call from, first. Thanks, Lee On 14 Mar 2013, at 12:48, Vincent Siliakus wrote: > Hi Lee, > > More info is needed to understand what the cause of the problem is. > > - Where / what version did you download. > - How did you compile rebar > - With what parameters did you try to run rebar? > > Anyway, I've never experienced problems with rebar when following the build instructions on github: > > $ git clone git://github.com/rebar/rebar.git > $ cd rebar > $ ./bootstrap > Recompile: src/getopt > ... > Recompile: src/rebar_utils > ==> rebar (compile) > Congratulations! You now have a self-contained script called "rebar" in > your current working directory. Place this script anywhere in your path > and you can use rebar to build OTP-compliant apps. > > Best, Vincent > > > Op woensdag 13 maart 2013 17:27:13 UTC+1 schreef Lee Sylvester het volgende: > Hi guys, > > I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: > > ERROR: Template simplenode not found. > > If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? > > Thanks, > Lee > > _______________________________________________ > erlang-questions mailing list > erlang-q...@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 zabrane3@REDACTED Thu Mar 14 14:01:36 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 14 Mar 2013 14:01:36 +0100 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Lee, What do you want to do: 1. simply compile a pure Erlang project? 2. or your project needs a Linkedin driver? 3. want to learn rebar? In cases 1/2, "rebar" isn't needed at all and a simple Makefile/EMakefile will do the job. For case 3, have a look to (Google is your friend too): http://skeptomai.com/?p=56 http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html Let me now. Regards, Zabrane On Mar 14, 2013, at 1:55 PM, Lee Sylvester wrote: > Hi Vincent, > > Thank you for your reply. > > 1. I downloaded Rebar from the Basho repository on GitHub > 2. rebar --version outputs "rebar 2.1.0-pre R16A 20130313_161755 No VCS info available." > 3. I compiled Rebar using the bootstrap script > 4. Rebar works when using rebar compile, rebar clean and rebar create-node. However, it only works if I copy the priv directory into the directory I'm making the call from, first. > > Thanks, > Lee > > > On 14 Mar 2013, at 12:48, Vincent Siliakus wrote: > >> Hi Lee, >> >> More info is needed to understand what the cause of the problem is. >> >> - Where / what version did you download. >> - How did you compile rebar >> - With what parameters did you try to run rebar? >> >> Anyway, I've never experienced problems with rebar when following the build instructions on github: >> >> $ git clone git://github.com/rebar/rebar.git >> $ cd rebar >> $ ./bootstrap >> Recompile: src/getopt >> ... >> Recompile: src/rebar_utils >> ==> rebar (compile) >> Congratulations! You now have a self-contained script called "rebar" in >> your current working directory. Place this script anywhere in your path >> and you can use rebar to build OTP-compliant apps. >> >> Best, Vincent >> >> >> Op woensdag 13 maart 2013 17:27:13 UTC+1 schreef Lee Sylvester het volgende: >> Hi guys, >> >> I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: >> >> ERROR: Template simplenode not found. >> >> If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? >> >> Thanks, >> Lee >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-q...@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 lee.sylvester@REDACTED Thu Mar 14 14:04:30 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Thu, 14 Mar 2013 13:04:30 +0000 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Hi Zabrane, Yes, I'd like to learn Rebar. I've been using the first link you provided as a guide to getting started. The second link I also know of. Regards, Lee On 14 Mar 2013, at 13:01, Zabrane Mickael wrote: > Lee, > > What do you want to do: > > 1. simply compile a pure Erlang project? > 2. or your project needs a Linkedin driver? > 3. want to learn rebar? > > In cases 1/2, "rebar" isn't needed at all and a simple Makefile/EMakefile will do the job. > > For case 3, have a look to (Google is your friend too): > http://skeptomai.com/?p=56 > http://alancastro.org/2010/05/01/erlang-application-management-with-rebar.html > > Let me now. > > Regards, > Zabrane > > On Mar 14, 2013, at 1:55 PM, Lee Sylvester wrote: > >> Hi Vincent, >> >> Thank you for your reply. >> >> 1. I downloaded Rebar from the Basho repository on GitHub >> 2. rebar --version outputs "rebar 2.1.0-pre R16A 20130313_161755 No VCS info available." >> 3. I compiled Rebar using the bootstrap script >> 4. Rebar works when using rebar compile, rebar clean and rebar create-node. However, it only works if I copy the priv directory into the directory I'm making the call from, first. >> >> Thanks, >> Lee >> >> >> On 14 Mar 2013, at 12:48, Vincent Siliakus wrote: >> >>> Hi Lee, >>> >>> More info is needed to understand what the cause of the problem is. >>> >>> - Where / what version did you download. >>> - How did you compile rebar >>> - With what parameters did you try to run rebar? >>> >>> Anyway, I've never experienced problems with rebar when following the build instructions on github: >>> >>> $ git clone git://github.com/rebar/rebar.git >>> $ cd rebar >>> $ ./bootstrap >>> Recompile: src/getopt >>> ... >>> Recompile: src/rebar_utils >>> ==> rebar (compile) >>> Congratulations! You now have a self-contained script called "rebar" in >>> your current working directory. Place this script anywhere in your path >>> and you can use rebar to build OTP-compliant apps. >>> >>> Best, Vincent >>> >>> >>> Op woensdag 13 maart 2013 17:27:13 UTC+1 schreef Lee Sylvester het volgende: >>> Hi guys, >>> >>> I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: >>> >>> ERROR: Template simplenode not found. >>> >>> If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? >>> >>> Thanks, >>> Lee >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-q...@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 zabrane3@REDACTED Thu Mar 14 14:05:48 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 14 Mar 2013 14:05:48 +0100 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: <327A6F2E-41F8-4F50-8BB6-AED30408E1A0@gmail.com> > Yes, I'd like to learn Rebar. I've been using the first link you provided as a guide to getting started. The second link I also know of. good luck ;-) From cloudzen@REDACTED Thu Mar 14 14:18:08 2013 From: cloudzen@REDACTED (skyman) Date: Thu, 14 Mar 2013 21:18:08 +0800 (CST) Subject: [erlang-questions] erlang:halt() cannot terminate the Erlang VM Message-ID: <4618e4db.21a02.13d690cf003.Coremail.cloudzen@163.com> Hi all, I encounter this problem: erlang:halt() cannot terminate the Erlang VM. Then I user "kill -USR1 erlpid" to kill the Erlang VM process, and get an Erlang crash dump, it indicates that there are some "Scheduled" processes. I want to know under what cases erlang:halt() cannot terminate the Erlang VM, for example, existing "Scheduled" processes? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Thu Mar 14 15:15:50 2013 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 14 Mar 2013 15:15:50 +0100 Subject: [erlang-questions] How would you implement TTL for ETS based cache? Message-ID: Hi Erlangers, How would you implement TTL with callback for ETS based cache? I want when TTL expires callback is triggered and cached value goes to DB. For key I use 32 byte long binary(), value is not bigger than 8 KB. Any suggestions? p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From helge@REDACTED Thu Mar 14 15:23:28 2013 From: helge@REDACTED (Helge Rausch) Date: Thu, 14 Mar 2013 15:23:28 +0100 Subject: [erlang-questions] PosegreSQL driver In-Reply-To: References: Message-ID: <5141DD60.1040104@rausch.io> On 03/11/2013 09:02 PM, Tristan Sloughter wrote: > I think it also shows an issue that I was talking about in #erlounge > yesterday. It would be great to have a page on erlang.org > that breaks apps into categories (json parser, http > client, postgres/mysql drivers, ...) and links to their source on > github. But apps that are known to work and be still in use, not just > anything that shows up in a google or github search. I'd like that, too. Something like https://www.ruby-toolbox.com/ , which categorizes libraries and ranks them according to a metric, considering the number of forks, stars (GitHub), activity, etc.. -- Helge Rausch https://github.com/tsujigiri https://twitter.com/helgerausch -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: OpenPGP digital signature URL: From max.lapshin@REDACTED Thu Mar 14 15:25:44 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 14 Mar 2013 18:25:44 +0400 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: Message-ID: There may be several ideas. For example, write expire time to key when you touch it and then once in a minute foldl through table and clean everything expired. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Thu Mar 14 15:29:33 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 14 Mar 2013 16:29:33 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: Message-ID: <6A078F09-C950-4D59-9187-2EAE6BCC632C@gmail.com> Hello Max, I have been experimenting with similar approach. The main idea was to keep a two ETS based indexes. The first one it key-value map, second is expire-key map. Second index allows you to handle eviction. You have a process that evict a items when they are expired. I did a quick proto but never had opportunity to evolve it further. https://github.com/fogfish/cache It would be excellent to get community comments on it. Best Regards, Dmitry >-|-|-*> On 14.3.2013, at 16.15, Max Bourinov wrote: > Hi Erlangers, > > How would you implement TTL with callback for ETS based cache? > > I want when TTL expires callback is triggered and cached value goes to DB. > > For key I use 32 byte long binary(), value is not bigger than 8 KB. > > Any suggestions? > > p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? > > 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 bourinov@REDACTED Thu Mar 14 15:38:53 2013 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 14 Mar 2013 15:38:53 +0100 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: <6A078F09-C950-4D59-9187-2EAE6BCC632C@gmail.com> References: <6A078F09-C950-4D59-9187-2EAE6BCC632C@gmail.com> Message-ID: Hi Dmitry, Thank you for sharing your code. Do you plan to add some docs to it? Do you use this project? At which state it is now? Best regards, Max On Thu, Mar 14, 2013 at 3:29 PM, Dmitry Kolesnikov wrote: > Hello Max, > > I have been experimenting with similar approach. The main idea was to keep > a two ETS based indexes. The first one it key-value map, second is > expire-key map. Second index allows you to handle eviction. You have a > process that evict a items when they are expired. > > I did a quick proto but never had opportunity to evolve it further. > https://github.com/fogfish/cache > > It would be excellent to get community comments on it. > > > Best Regards, > Dmitry >-|-|-*> > > > On 14.3.2013, at 16.15, Max Bourinov wrote: > > Hi Erlangers, > > How would you implement TTL with callback for ETS based cache? > > I want when TTL expires callback is triggered and cached value goes to DB. > > For key I use 32 byte long binary(), value is not bigger than 8 KB. > > Any suggestions? > > p.s. elang:send_after/3 is a most brutal approach, but how would it be > when cache is under load? > > 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 comptekki@REDACTED Thu Mar 14 15:43:22 2013 From: comptekki@REDACTED (Wes James) Date: Thu, 14 Mar 2013 08:43:22 -0600 Subject: [erlang-questions] PosegreSQL driver In-Reply-To: References: Message-ID: trapexit.org has this, I noticed: Hi there! As you can see our forums are not available anymore. They're in a read only mode which makes you able to access the content, but not to edit or add to it. Sorry for the inconvenience. But don't worry, we're working on a new Erlang community site, which is weeks if not days away from official launching! ------------------- Maybe trapexit would be a good place to do this, but this will take effort from every one to keep it up to date. Anyone have an idea when the new site will be ready? wes On Mon, Mar 11, 2013 at 2:02 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > That is why I sent my original email. There are some patches that forks > have done are design/feature decisions that can't necessarily be merged > together, but a lot can. > > I didn't want to simply make tsloughter/epgsql and merge them together > without reaching out to those with the forks since then it would just end > up being another fork from wg/egpsql like all the rest. > > Not sure how to move forward with this. Though I'm trying out semiocast's > client now as well. > > I think it also shows an issue that I was talking about in #erlounge > yesterday. It would be great to have a page on erlang.org that breaks > apps into categories (json parser, http client, postgres/mysql drivers, > ...) and links to their source on github. But apps that are known to work > and be still in use, not just anything that shows up in a google or github > search. > > Tristan > > On Thu, Mar 7, 2013 at 10:00 AM, Max Lapshin wrote: > >> What should I do this weekend? Take a beer, write postgresql erlang >> driver or just write my own nosql database? >> >> >> It is really interesting: why are there so many forks? Is it possible to >> consolidate all efforts? Maybe it is impossible at all because different >> drivers implement different approaches of querying async database from >> async erlang? >> >> >> _______________________________________________ >> 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 valentin@REDACTED Thu Mar 14 15:50:56 2013 From: valentin@REDACTED (Valentin Micic) Date: Thu, 14 Mar 2013 16:50:56 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: Message-ID: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> Hi Max, We have implemented something similar in the past -- we called it a generational cache (hope no-one accuses me of a plagiarism, for English is but a finite language after all. And so is the problem/solution space...). The gist of it is that instead of using a single ETS table for a cache, you would use two or more "disposable" ETS tables. The generation management is implemented as a process that, upon some criteria are met, destroys the oldest table, and creates a new one in its stead. The youngest cache (the newest ETS table) is always queried first. If the value is not found, the older tables are queried and if entry with a corresponding key is found -- it is moved to the youngest cache. If none of the ETS tables in a cache set contains the key, then the key is loaded from some external source and inserted into the youngest (the newest ETS table) cache. This method worked quite well for us in the past, and we've implemented a several variants of it, e.g. time based, size based, and combination of the two. Bear in mind that when you drop a very large ETS table (and I mean very large, as in Gigabytes of memory), it may take some time to release the allocated memory, but that may be a problem for another day. The downside, this does not really correspond to your requirement to keep a TTL per single cache entry. The upside, it is much faster and cheaper than traversing a single cache periodically. Also, it end up keeping only entries that are most frequently used. Hope this helps. Kind reagards V/ On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: > Hi Erlangers, > > How would you implement TTL with callback for ETS based cache? > > I want when TTL expires callback is triggered and cached value goes to DB. > > For key I use 32 byte long binary(), value is not bigger than 8 KB. > > Any suggestions? > > p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? > > Best regards, > Max > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From francesco@REDACTED Thu Mar 14 15:57:06 2013 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 14 Mar 2013 07:57:06 -0700 Subject: [erlang-questions] PosegreSQL driver In-Reply-To: References: Message-ID: <66669543-ef48-4d62-bc46-707406fab5dc@email.android.com> A very toned down version of Erlang Central (erlangcentral.org) will be launched on Monday. A hackage style repo is on the road map, but probably not until June or July. We are happy over all the help we can get. F Wes James wrote: >trapexit.org has this, I noticed: > >Hi there! > > >As you can see our forums are not available anymore. They're in a read >only >mode which makes you able to access the content, but not to edit or add >to >it. >Sorry for the inconvenience. > >But don't worry, we're working on a new Erlang community site, which is >weeks if not days away from official launching! > >------------------- > >Maybe trapexit would be a good place to do this, but this will take >effort >from every one to keep it up to date. > >Anyone have an idea when the new site will be ready? > >wes > > > >On Mon, Mar 11, 2013 at 2:02 PM, Tristan Sloughter < >tristan.sloughter@REDACTED> wrote: > >> That is why I sent my original email. There are some patches that >forks >> have done are design/feature decisions that can't necessarily be >merged >> together, but a lot can. >> >> I didn't want to simply make tsloughter/epgsql and merge them >together >> without reaching out to those with the forks since then it would just >end >> up being another fork from wg/egpsql like all the rest. >> >> Not sure how to move forward with this. Though I'm trying out >semiocast's >> client now as well. >> >> I think it also shows an issue that I was talking about in #erlounge >> yesterday. It would be great to have a page on erlang.org that breaks >> apps into categories (json parser, http client, postgres/mysql >drivers, >> ...) and links to their source on github. But apps that are known to >work >> and be still in use, not just anything that shows up in a google or >github >> search. >> >> Tristan >> >> On Thu, Mar 7, 2013 at 10:00 AM, Max Lapshin >wrote: >> >>> What should I do this weekend? Take a beer, write postgresql erlang >>> driver or just write my own nosql database? >>> >>> >>> It is really interesting: why are there so many forks? Is it >possible to >>> consolidate all efforts? Maybe it is impossible at all because >different >>> drivers implement different approaches of querying async database >from >>> async erlang? >>> >>> >>> _______________________________________________ >>> 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 Solutions Ltd -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangsiri@REDACTED Thu Mar 14 16:09:27 2013 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 14 Mar 2013 16:09:27 +0100 Subject: [erlang-questions] etop flooded with "Erlang top got garbage" messages In-Reply-To: References: <1677913c-78f6-46fe-9771-d1aa9ee85357@googlegroups.com> <51408C9C.5010601@gmail.com> Message-ID: Just realized that I forgot to copy the list when I sent this yesterday - sorry! /siri 2013/3/13 Siri Hansen > > > 2013/3/13 Anton Lebedevich > >> On 03/13/2013 06:32 AM, Mike Cugini wrote: >> > Hey all, >> > >> > I was recently put on an erlang project, and I've been trying to get >> > etop working to help profile some issues our app has been having (mostly >> > interested in Message Queue sizes). >> > >> > Etop is started with this command: >> > >> > erl -name etop@ -hidden -s etop -s erlang halt \ >> > -output text -sort reductions -lines 50 \ >> > -node -setcookie >> > >> > Whenever I start etop, I see a flood of "Erlang top got garbage" >> messages: >> >> >> -tracing off flag might help etop. Another possible source of that >> garbage is mnesia. >> >> Regards, >> Anton Lebedevich. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > Yes, "-tracing off" will get rid of the flooding. (It will of course also > turn off measurement of runtime per process.) I had a look at the code, and > I am afraid that this is actually a shortcoming in etop as it seems etop > assumes that only one process is running (scheduled in) at a time. We'll > have to look into this! > > I don't think mnesia has anything to do with the garbage messages. > > Regards > /siri > -------------- next part -------------- An HTML attachment was scrubbed... URL: From czinkos@REDACTED Thu Mar 14 16:26:31 2013 From: czinkos@REDACTED (Zsolt Czinkos) Date: Thu, 14 Mar 2013 16:26:31 +0100 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Hi, I've found the source of this issue. In 'rebar_escripter.erl' 'filelib:wildcard/2' fuction is used. This function cannot handle the pattern and current dir given in rebar.config. In the rebar.config (of rebar) change escript_incl_extra parameter like this: {escript_incl_extra, [{"*", "priv/templates"}]}. ( {"priv/templates/*", "."} pattern won't match. It isn't clear for me why.) Run bootsrap, and the result: $ ./rebar version rebar 2.1.0-pre R16A 20130314_145125 git 2.1.0-pre-64-g720d71e-dirty $ ./rebar list-templates ==> tmp (list-templates) * simplesrv: simplesrv.template (escript) (variables: "srvid") * simplenode: simplenode.template (escript) (variables: "nodeid") * simplemod: simplemod.template (escript) (variables: "modid") * simplefsm: simplefsm.template (escript) (variables: "fsmid") * simpleapp: simpleapp.template (escript) (variables: "appid") * ctsuite: ctsuite.template (escript) (variables: "testmod") * basicnif: basicnif.template (escript) (variables: "module") Best, Zsolt On Wed, Mar 13, 2013 at 5:27 PM, Lee Sylvester wrote: > Hi guys, > > I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: > > ERROR: Template simplenode not found. > > If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? > > Thanks, > Lee > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From wenewboy@REDACTED Thu Mar 14 18:42:59 2013 From: wenewboy@REDACTED (wenew zhang) Date: Fri, 15 Mar 2013 01:42:59 +0800 Subject: [erlang-questions] does erlang binary append need to convert to list first? Message-ID: on erl command shell, A=list_to_binary("abc"). B=list_to_binary("def"). i want A+B convert to <<"abcdef">> now i need do it as below: list_to_binary(binary_to_list(A)++binary_to_list(B)). <<"abcdef">> is there a simple method make A+B in binary type? -------------- next part -------------- An HTML attachment was scrubbed... URL: From james@REDACTED Thu Mar 14 18:46:48 2013 From: james@REDACTED (James Aimonetti) Date: Thu, 14 Mar 2013 10:46:48 -0700 Subject: [erlang-questions] does erlang binary append need to convert to list first? In-Reply-To: References: Message-ID: <51420D08.3020407@2600hz.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 <> should suffice. On 03/14/2013 10:42 AM, wenew zhang wrote: > on erl command shell, A=list_to_binary("abc"). > B=list_to_binary("def"). i want A+B convert to <<"abcdef">> now i > need do it as below: > list_to_binary(binary_to_list(A)++binary_to_list(B)). > > <<"abcdef">> > > is there a simple method make A+B in binary type? > > > > _______________________________________________ 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.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJRQg0IAAoJENc77s1OYoGg1uYIAKN/abHWXyGlWzDJ0xWo6pVT XR8hT5Pk9rgR3wPILmiKTfpfzwzA5REkGKMI263zYDeSW4SLYKzawksMI4orrakR V+aq8xfjFVzKs1hVDCVZtb6LPNecMLrw3e4OsvJTDzE/AgAnyf8yPaPuvTeJ8v7n d8oLXsHyjfdS40pEDFpxLRqAnZT5Oi/GoIlaoiD7Ales7+cKODv25JIvV7rmngHY 1YHOFj86hximkoHdzRc7x/XzHMLk8yyWjo0mFefukPQUbrS/P2NQIustvO+gmVMx hkTruTk6N0jmO73vC4FolLRfMd693elvqUHUuiBilv15qKsUiDGI55NAFe11XA8= =Y/Sx -----END PGP SIGNATURE----- From john@REDACTED Thu Mar 14 18:47:01 2013 From: john@REDACTED (John Kemp) Date: Thu, 14 Mar 2013 13:47:01 -0400 Subject: [erlang-questions] does erlang binary append need to convert to list first? In-Reply-To: References: Message-ID: <103C4260-C447-4BD5-82DA-7C531C11D8CE@jkemp.net> list_to_binary(lists:flatten(["abc","def"])). ? JohnK On Mar 14, 2013, at 1:42 PM, wenew zhang wrote: > on erl command shell, > A=list_to_binary("abc"). > B=list_to_binary("def"). > i want A+B convert to <<"abcdef">> > now i need do it as below: > list_to_binary(binary_to_list(A)++binary_to_list(B)). > > <<"abcdef">> > > is there a simple method make A+B in binary type? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Thu Mar 14 18:47:13 2013 From: bob@REDACTED (Bob Ippolito) Date: Thu, 14 Mar 2013 10:47:13 -0700 Subject: [erlang-questions] does erlang binary append need to convert to list first? In-Reply-To: References: Message-ID: A = <<"abc">>, B = <<"def">>, C = <>. Also: C = iolist_to_binary([A, B]). On Thu, Mar 14, 2013 at 10:42 AM, wenew zhang wrote: > on erl command shell, > A=list_to_binary("abc"). > B=list_to_binary("def"). > i want A+B convert to <<"abcdef">> > now i need do it as below: > list_to_binary(binary_to_list(A)++binary_to_list(B)). > > <<"abcdef">> > > is there a simple method make A+B in binary type? > > > _______________________________________________ > 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 Thu Mar 14 18:48:09 2013 From: bob@REDACTED (Bob Ippolito) Date: Thu, 14 Mar 2013 10:48:09 -0700 Subject: [erlang-questions] does erlang binary append need to convert to list first? In-Reply-To: <103C4260-C447-4BD5-82DA-7C531C11D8CE@jkemp.net> References: <103C4260-C447-4BD5-82DA-7C531C11D8CE@jkemp.net> Message-ID: Or more efficiently: iolist_to_binary(["abc", "def"]). On Thu, Mar 14, 2013 at 10:47 AM, John Kemp wrote: > list_to_binary(lists:flatten(["abc","def"])). > > ? > > JohnK > > On Mar 14, 2013, at 1:42 PM, wenew zhang wrote: > > > on erl command shell, > > A=list_to_binary("abc"). > > B=list_to_binary("def"). > > i want A+B convert to <<"abcdef">> > > now i need do it as below: > > list_to_binary(binary_to_list(A)++binary_to_list(B)). > > > > <<"abcdef">> > > > > is there a simple method make A+B in binary type? > > > > _______________________________________________ > > 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 wenewboy@REDACTED Thu Mar 14 18:51:30 2013 From: wenewboy@REDACTED (wenew zhang) Date: Fri, 15 Mar 2013 01:51:30 +0800 Subject: [erlang-questions] does erlang binary append need to convert to list first? In-Reply-To: References: <103C4260-C447-4BD5-82DA-7C531C11D8CE@jkemp.net> Message-ID: <75621D25-47FA-4160-AB57-57B71B463250@gmail.com> thanks all guys, iolist_to_binary([A, B]) is the best method, wenew zhang On 2013-3-15, at ??1:48, Bob Ippolito wrote: > Or more efficiently: > iolist_to_binary(["abc", "def"]). > > > On Thu, Mar 14, 2013 at 10:47 AM, John Kemp wrote: > list_to_binary(lists:flatten(["abc","def"])). > > ? > > JohnK > > On Mar 14, 2013, at 1:42 PM, wenew zhang wrote: > > > on erl command shell, > > A=list_to_binary("abc"). > > B=list_to_binary("def"). > > i want A+B convert to <<"abcdef">> > > now i need do it as below: > > list_to_binary(binary_to_list(A)++binary_to_list(B)). > > > > <<"abcdef">> > > > > is there a simple method make A+B in binary type? > > > > _______________________________________________ > > 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 bombadil@REDACTED Thu Mar 14 18:54:43 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 14 Mar 2013 18:54:43 +0100 Subject: [erlang-questions] Segmentation fault in tests Message-ID: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> Hi, I'm using exmpp for development, and eunit for tests. When I need to launch tests, I write several times: application:start(exmpp), ... application:stop(exmpp). In some cases this throws an "Segmentation fault" and stop erlang VM. I try this code in the shell: [ begin application:start(exmpp), aplication:stop(exmpp), ok end || X <- lists:seq(1,100) ]. And the code fails, not always, but very often... I think could be a problem with unload and load the code when the port isn't unloaded completly... any suggestion? Thanks. Manuel Rubio. From gleber.p@REDACTED Thu Mar 14 19:39:30 2013 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 14 Mar 2013 19:39:30 +0100 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: <36747.1363194178@snookles.snookles.com> References: <513F9706.1070508@gmail.com> <36747.1363194178@snookles.snookles.com> Message-ID: As far as I remember prim_inet does not use async IO threads. Please correct me if I am wrong. Sent from mobile, excuse me for brevity On Wed, Mar 13, 2013 at 6:02 PM, Scott Lystig Fritchie wrote: > Michael Truog wrote: > > mt> You may have thought that the async threads use a shared job queue, > mt> but they don't... each thread has its own queue. So, that means it > mt> is easy to plug up the async thread pool, if you have long running > mt> operations. By increasing the pool size to a much larger value, you > mt> are no longer blocking on a randomly overworked async thread. > > Small correction: you're less likely to block on an overworked async > thread. It's still possible to have two independent Erlang file > handles/ports operating on different files that will always use the same > async thread. > > -Scott > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Thu Mar 14 20:36:39 2013 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 14 Mar 2013 23:36:39 +0400 Subject: [erlang-questions] How to understand busyness of driver job queue? In-Reply-To: References: <513F9706.1070508@gmail.com> <36747.1363194178@snookles.snookles.com> Message-ID: Of course, prim_inet doesn't need async threads, because it uses select/kqueue. I was speaking about prim_file. Everything is very complicated about it, because by default neither linux, neither FreeBSD hasn't async disk IO out of the box without nails and a hammer. Windows has, but it is not a reason to switch =) So to achieve good responsibility prim_file schedules disk requests on thread pool that gets blocked with simple pread/write requests. Problem is that it is possible that all async threads can get blocked with requests to one busy and slow device. "Professional" storage systems like elliptics (I'm speaking of course not about that shit, named "RAID", but about software storage implementations like Swift, LeoFS or elliptics) have separate thread pool per each device so that all requests to buggy device will not affect reads and writes from other devices. -------------- next part -------------- An HTML attachment was scrubbed... URL: From czinkos@REDACTED Thu Mar 14 20:43:31 2013 From: czinkos@REDACTED (Zsolt Czinkos) Date: Thu, 14 Mar 2013 20:43:31 +0100 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: Hi Lee, I've upgraded erlang/otp from R16A to R16B and everything works fine without modifying rebar.config. zsolt On Thu, Mar 14, 2013 at 4:26 PM, Zsolt Czinkos wrote: > Hi, > > I've found the source of this issue. > > In 'rebar_escripter.erl' 'filelib:wildcard/2' fuction is used. This > function cannot handle the pattern and current dir given in > rebar.config. In the rebar.config (of rebar) change escript_incl_extra > parameter like this: > > {escript_incl_extra, [{"*", "priv/templates"}]}. > > ( {"priv/templates/*", "."} pattern won't match. It isn't clear for me why.) > > Run bootsrap, and the result: > > $ ./rebar version > rebar 2.1.0-pre R16A 20130314_145125 git 2.1.0-pre-64-g720d71e-dirty > $ ./rebar list-templates > ==> tmp (list-templates) > * simplesrv: simplesrv.template (escript) (variables: "srvid") > * simplenode: simplenode.template (escript) (variables: "nodeid") > * simplemod: simplemod.template (escript) (variables: "modid") > * simplefsm: simplefsm.template (escript) (variables: "fsmid") > * simpleapp: simpleapp.template (escript) (variables: "appid") > * ctsuite: ctsuite.template (escript) (variables: "testmod") > * basicnif: basicnif.template (escript) (variables: "module") > > > Best, > > Zsolt > > On Wed, Mar 13, 2013 at 5:27 PM, Lee Sylvester wrote: >> Hi guys, >> >> I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: >> >> ERROR: Template simplenode not found. >> >> If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? >> >> Thanks, >> Lee >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From lee.sylvester@REDACTED Thu Mar 14 20:54:15 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Thu, 14 Mar 2013 19:54:15 +0000 Subject: [erlang-questions] Rebar issues In-Reply-To: References: Message-ID: <93EA065F-FFB7-45DF-A17F-C2518D8DEE05@gmail.com> Thank you very much :-) Lee On 14 Mar 2013, at 19:43, Zsolt Czinkos wrote: > Hi Lee, > > I've upgraded erlang/otp from R16A to R16B and everything works fine > without modifying rebar.config. > > zsolt > > On Thu, Mar 14, 2013 at 4:26 PM, Zsolt Czinkos wrote: >> Hi, >> >> I've found the source of this issue. >> >> In 'rebar_escripter.erl' 'filelib:wildcard/2' fuction is used. This >> function cannot handle the pattern and current dir given in >> rebar.config. In the rebar.config (of rebar) change escript_incl_extra >> parameter like this: >> >> {escript_incl_extra, [{"*", "priv/templates"}]}. >> >> ( {"priv/templates/*", "."} pattern won't match. It isn't clear for me why.) >> >> Run bootsrap, and the result: >> >> $ ./rebar version >> rebar 2.1.0-pre R16A 20130314_145125 git 2.1.0-pre-64-g720d71e-dirty >> $ ./rebar list-templates >> ==> tmp (list-templates) >> * simplesrv: simplesrv.template (escript) (variables: "srvid") >> * simplenode: simplenode.template (escript) (variables: "nodeid") >> * simplemod: simplemod.template (escript) (variables: "modid") >> * simplefsm: simplefsm.template (escript) (variables: "fsmid") >> * simpleapp: simpleapp.template (escript) (variables: "appid") >> * ctsuite: ctsuite.template (escript) (variables: "testmod") >> * basicnif: basicnif.template (escript) (variables: "module") >> >> >> Best, >> >> Zsolt >> >> On Wed, Mar 13, 2013 at 5:27 PM, Lee Sylvester wrote: >>> Hi guys, >>> >>> I've downloaded Rebar and compiled it ready for use, but whenever I copy it to my project directories and run it, I get the error: >>> >>> ERROR: Template simplenode not found. >>> >>> If I copy the priv directory to the directory I'm calling Rebar from, then it works fine, but I don't want to keep having to drag that around. What should I really be doing? >>> >>> Thanks, >>> Lee >>> >>> _______________________________________________ >>> 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 Thu Mar 14 21:51:42 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 14 Mar 2013 22:51:42 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: <6A078F09-C950-4D59-9187-2EAE6BCC632C@gmail.com> Message-ID: <427CEBA3-3942-4787-A251-E3B066EE6DDC@gmail.com> Hello Max, Like, I've said that code is proto level. I have not brought it anywhere except my test env. However, it is very simple and straight forward. This is nothing more then gen_server controlling ETS As part of immediate improvements, I'd like to highlite - change of cache i/o (they are masked behind gen_server) - make a notification during eviction process You are right, it is missing the documentation but it would be possible to add it. I am preparing to use it for one of my solution where I need multiple eviction policy including TTL & memory threshold - Dmitry On Mar 14, 2013, at 4:38 PM, Max Bourinov wrote: > Hi Dmitry, > > Thank you for sharing your code. Do you plan to add some docs to it? > > Do you use this project? At which state it is now? > > Best regards, > Max > > > > On Thu, Mar 14, 2013 at 3:29 PM, Dmitry Kolesnikov wrote: > Hello Max, > > I have been experimenting with similar approach. The main idea was to keep a two ETS based indexes. The first one it key-value map, second is expire-key map. Second index allows you to handle eviction. You have a process that evict a items when they are expired. > > I did a quick proto but never had opportunity to evolve it further. > https://github.com/fogfish/cache > > It would be excellent to get community comments on it. > > > Best Regards, > Dmitry >-|-|-*> > > > On 14.3.2013, at 16.15, Max Bourinov wrote: > >> Hi Erlangers, >> >> How would you implement TTL with callback for ETS based cache? >> >> I want when TTL expires callback is triggered and cached value goes to DB. >> >> For key I use 32 byte long binary(), value is not bigger than 8 KB. >> >> Any suggestions? >> >> p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? >> >> 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 tuncer.ayaz@REDACTED Thu Mar 14 22:18:04 2013 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 14 Mar 2013 22:18:04 +0100 Subject: [erlang-questions] rebar and R16A was: Rebar issues Message-ID: On 14 Mar 2013, at 20:54, Lee Sylvester wrote: > Thank you very much :-) > > Lee > > > On 14 Mar 2013, at 19:43, Zsolt Czinkos <> wrote: > >> Hi Lee, >> >> I've upgraded erlang/otp from R16A to R16B and everything works >> fine without modifying rebar.config. >> >> zsolt >> >> On Thu, Mar 14, 2013 at 4:26 PM, Zsolt Czinkos <> wrote: >>> Hi, >>> >>> I've found the source of this issue. >>> >>> In 'rebar_escripter.erl' 'filelib:wildcard/2' fuction is used. >>> This function cannot handle the pattern and current dir given in >>> rebar.config. In the rebar.config (of rebar) change >>> escript_incl_extra parameter like this: >>> >>> {escript_incl_extra, [{"*", "priv/templates"}]}. >>> >>> ( {"priv/templates/*", "."} pattern won't match. It isn't clear for me why.) >>> >>> Run bootsrap, and the result: >>> >>> $ ./rebar version >>> rebar 2.1.0-pre R16A 20130314_145125 git 2.1.0-pre-64-g720d71e-dirty >>> $ ./rebar list-templates >>> ==> tmp (list-templates) >>> * simplesrv: simplesrv.template (escript) (variables: "srvid") >>> * simplenode: simplenode.template (escript) (variables: "nodeid") >>> * simplemod: simplemod.template (escript) (variables: "modid") >>> * simplefsm: simplefsm.template (escript) (variables: "fsmid") >>> * simpleapp: simpleapp.template (escript) (variables: "appid") >>> * ctsuite: ctsuite.template (escript) (variables: "testmod") >>> * basicnif: basicnif.template (escript) (variables: "module") >>> >>> >>> Best, >>> >>> Zsolt Thanks Zsolt and Lee. R16A's filelib:wildcard has a regression[1] which was fixed in 856f165d0[2] (included in R16B). Also, the second element in the escript_incl_extra tuple is not a wildcard, only the first is, and the 2nd is a directory. This is used to construct a proper dir structure in the escript archive and not put everything in the root dir. To be clear, escript_incl_extra is rebar internal and that's why it's not documented in rebar.config.sample or 'rebar help escriptize'. Don't be misled by its use in rebar.git's own rebar.config. $ rebar list-templates ==> foo_project (list-templates) * simplesrv: priv/templates/simplesrv.template (escript) (variables: "srvid") * simplenode: priv/templates/simplenode.template (escript) (variables: "nodeid") * simplemod: priv/templates/simplemod.template (escript) (variables: "modid") * simplefsm: priv/templates/simplefsm.template (escript) (variables: "fsmid") * simpleapp: priv/templates/simpleapp.template (escript) (variables: "appid") * ctsuite: priv/templates/ctsuite.template (escript) (variables: "testmod") * basicnif: priv/templates/basicnif.template (escript) (variables: "module") [1] http://erlang.org/pipermail/erlang-bugs/2013-February/003399.html [2] https://github.com/erlang/otp/commit/856f165d0 From thebullno1@REDACTED Fri Mar 15 08:28:06 2013 From: thebullno1@REDACTED (Bach Le) Date: Fri, 15 Mar 2013 00:28:06 -0700 (PDT) Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> References: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> Message-ID: I like this approach. Thanks for sharing. For TTL per entry, you can do it lazily. Retrieve the entry and look at the TTL, if it's supposed to expire, return nothing and don't promote this entry. The generation will eventually be "garbage collected" anyway. Also, instead of create and delete table, is it faster to clear the table and reuse it? Assuming that ets does some memory pooling, clearing might be more efficient than just dropping. On Thursday, March 14, 2013 10:50:56 PM UTC+8, Valentin Micic wrote: > > Hi Max, > > We have implemented something similar in the past -- we called it a > generational cache (hope no-one accuses me of a plagiarism, for English is > but a finite language after all. And so is the problem/solution space...). > > The gist of it is that instead of using a single ETS table for a cache, > you would use two or more "disposable" ETS tables. > The generation management is implemented as a process that, upon some > criteria are met, destroys the oldest table, and creates a new one in its > stead. > > The youngest cache (the newest ETS table) is always queried first. If the > value is not found, the older tables are queried and if entry with a > corresponding key is found -- it is moved to the youngest cache. > If none of the ETS tables in a cache set contains the key, then the key is > loaded from some external source and inserted into the youngest (the newest > ETS table) cache. > > This method worked quite well for us in the past, and we've implemented a > several variants of it, e.g. time based, size based, and combination of the > two. > Bear in mind that when you drop a very large ETS table (and I mean very > large, as in Gigabytes of memory), it may take some time to release the > allocated memory, but that may be a problem for another day. > > The downside, this does not really correspond to your requirement to keep > a TTL per single cache entry. > The upside, it is much faster and cheaper than traversing a single cache > periodically. Also, it end up keeping only entries that are most frequently > used. > > Hope this helps. > > Kind reagards > > V/ > > > On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: > > > Hi Erlangers, > > > > How would you implement TTL with callback for ETS based cache? > > > > I want when TTL expires callback is triggered and cached value goes to > DB. > > > > For key I use 32 byte long binary(), value is not bigger than 8 KB. > > > > Any suggestions? > > > > p.s. elang:send_after/3 is a most brutal approach, but how would it be > when cache is under load? > > > > Best regards, > > Max > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-q...@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Fri Mar 15 09:06:34 2013 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 15 Mar 2013 09:06:34 +0100 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> Message-ID: This will not work for me. I need pro-active TTL. Best regards, Max On Fri, Mar 15, 2013 at 8:28 AM, Bach Le wrote: > I like this approach. Thanks for sharing. For TTL per entry, you can do it > lazily. Retrieve the entry and look at the TTL, if it's supposed to expire, > return nothing and don't promote this entry. The generation will eventually > be "garbage collected" anyway. > > Also, instead of create and delete table, is it faster to clear the table > and reuse it? Assuming that ets does some memory pooling, clearing might be > more efficient than just dropping. > > > On Thursday, March 14, 2013 10:50:56 PM UTC+8, Valentin Micic wrote: > >> Hi Max, >> >> We have implemented something similar in the past -- we called it a >> generational cache (hope no-one accuses me of a plagiarism, for English is >> but a finite language after all. And so is the problem/solution space...). >> >> The gist of it is that instead of using a single ETS table for a cache, >> you would use two or more "disposable" ETS tables. >> The generation management is implemented as a process that, upon some >> criteria are met, destroys the oldest table, and creates a new one in its >> stead. >> >> The youngest cache (the newest ETS table) is always queried first. If the >> value is not found, the older tables are queried and if entry with a >> corresponding key is found -- it is moved to the youngest cache. >> If none of the ETS tables in a cache set contains the key, then the key >> is loaded from some external source and inserted into the youngest (the >> newest ETS table) cache. >> >> This method worked quite well for us in the past, and we've implemented a >> several variants of it, e.g. time based, size based, and combination of the >> two. >> Bear in mind that when you drop a very large ETS table (and I mean very >> large, as in Gigabytes of memory), it may take some time to release the >> allocated memory, but that may be a problem for another day. >> >> The downside, this does not really correspond to your requirement to keep >> a TTL per single cache entry. >> The upside, it is much faster and cheaper than traversing a single cache >> periodically. Also, it end up keeping only entries that are most frequently >> used. >> >> Hope this helps. >> >> Kind reagards >> >> V/ >> >> >> On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: >> >> > Hi Erlangers, >> > >> > How would you implement TTL with callback for ETS based cache? >> > >> > I want when TTL expires callback is triggered and cached value goes to >> DB. >> > >> > For key I use 32 byte long binary(), value is not bigger than 8 KB. >> > >> > Any suggestions? >> > >> > p.s. elang:send_after/3 is a most brutal approach, but how would it be >> when cache is under load? >> > >> > Best regards, >> > Max >> > >> > ______________________________**_________________ >> > erlang-questions mailing list >> > erlang-q...@REDACTED >> > http://erlang.org/mailman/**listinfo/erlang-questions >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-q...@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 v@REDACTED Fri Mar 15 10:12:29 2013 From: v@REDACTED (Valentin Micic) Date: Fri, 15 Mar 2013 11:12:29 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> Message-ID: <0248AB69-D2B8-4738-8BB2-2726910A0AC8@pharos-avantgard.com> Forgive me for questioning your view, but just consider this: Say that your TTL is set to 30 seconds and that you decide to traverse the cache every second, in which you have 3000 elements, with a maximum incoming rate of 100 entries per second. That results in traversing the entire cache 29 times in order to handle at most 100 elements at the time. This kind of pro-activity is not economical -- you can always put these CPU cycles to a better use (am I old fashion or what?) You may achieve the same thing with generational cache, as you can traverse the table only before you drop it, and then commit entries with expired TTL (e.g. execute a callback), whilst move the ones which TTL did not expire to younger ETS table. Put this to the test: say you create a new generation every 10 seconds. Considering incoming rate of 100 per second, you should have 1000 entries per generation, which you would traverse exactly once, thus, for the same number of entries, say 3000 (with a constant incoming rate of 100), well, you do the math. ;-) V/ On 15 Mar 2013, at 10:06 AM, Max Bourinov wrote: > This will not work for me. I need pro-active TTL. > > Best regards, > Max > > > > On Fri, Mar 15, 2013 at 8:28 AM, Bach Le wrote: > I like this approach. Thanks for sharing. For TTL per entry, you can do it lazily. Retrieve the entry and look at the TTL, if it's supposed to expire, return nothing and don't promote this entry. The generation will eventually be "garbage collected" anyway. > > Also, instead of create and delete table, is it faster to clear the table and reuse it? Assuming that ets does some memory pooling, clearing might be more efficient than just dropping. > > > On Thursday, March 14, 2013 10:50:56 PM UTC+8, Valentin Micic wrote: > Hi Max, > > We have implemented something similar in the past -- we called it a generational cache (hope no-one accuses me of a plagiarism, for English is but a finite language after all. And so is the problem/solution space...). > > The gist of it is that instead of using a single ETS table for a cache, you would use two or more "disposable" ETS tables. > The generation management is implemented as a process that, upon some criteria are met, destroys the oldest table, and creates a new one in its stead. > > The youngest cache (the newest ETS table) is always queried first. If the value is not found, the older tables are queried and if entry with a corresponding key is found -- it is moved to the youngest cache. > If none of the ETS tables in a cache set contains the key, then the key is loaded from some external source and inserted into the youngest (the newest ETS table) cache. > > This method worked quite well for us in the past, and we've implemented a several variants of it, e.g. time based, size based, and combination of the two. > Bear in mind that when you drop a very large ETS table (and I mean very large, as in Gigabytes of memory), it may take some time to release the allocated memory, but that may be a problem for another day. > > The downside, this does not really correspond to your requirement to keep a TTL per single cache entry. > The upside, it is much faster and cheaper than traversing a single cache periodically. Also, it end up keeping only entries that are most frequently used. > > Hope this helps. > > Kind reagards > > V/ > > > On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: > > > Hi Erlangers, > > > > How would you implement TTL with callback for ETS based cache? > > > > I want when TTL expires callback is triggered and cached value goes to DB. > > > > For key I use 32 byte long binary(), value is not bigger than 8 KB. > > > > Any suggestions? > > > > p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? > > > > Best regards, > > Max > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-q...@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-q...@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 dmkolesnikov@REDACTED Fri Mar 15 10:56:25 2013 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 15 Mar 2013 11:56:25 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: <0248AB69-D2B8-4738-8BB2-2726910A0AC8@pharos-avantgard.com> References: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> <0248AB69-D2B8-4738-8BB2-2726910A0AC8@pharos-avantgard.com> Message-ID: Hello Valentin, Let me clarify one issue with you approach. In one of your earliest email you wrote: "if entry with a corresponding key is found -- it is moved to the youngest cache." This implies a data copy from one ETS table to another. The copy rate is sole depends on application but having 30 sec TTL with 10 sec generation you have 2/3 of cache hit request requires ets:lookup, ets:insert, ets:delete. Have you analysed impact of those? On another hands, a cache house keeping process might be executed less frequently then 1 sec but data eviction is happens at access time. - Dmitry On Mar 15, 2013, at 11:12 AM, Valentin Micic wrote: > Forgive me for questioning your view, but just consider this: > > Say that your TTL is set to 30 seconds and that you decide to traverse the cache every second, in which you have 3000 elements, with a maximum incoming rate of 100 entries per second. That results in traversing the entire cache 29 times in order to handle at most 100 elements at the time. This kind of pro-activity is not economical -- you can always put these CPU cycles to a better use (am I old fashion or what?) > > You may achieve the same thing with generational cache, as you can traverse the table only before you drop it, and then commit entries with expired TTL (e.g. execute a callback), whilst move the ones which TTL did not expire to younger ETS table. > > Put this to the test: say you create a new generation every 10 seconds. Considering incoming rate of 100 per second, you should have 1000 entries per generation, which you would traverse exactly once, thus, for the same number of entries, say 3000 (with a constant incoming rate of 100), well, you do the math. ;-) > > V/ > > On 15 Mar 2013, at 10:06 AM, Max Bourinov wrote: > >> This will not work for me. I need pro-active TTL. >> >> Best regards, >> Max >> >> >> >> On Fri, Mar 15, 2013 at 8:28 AM, Bach Le wrote: >> I like this approach. Thanks for sharing. For TTL per entry, you can do it lazily. Retrieve the entry and look at the TTL, if it's supposed to expire, return nothing and don't promote this entry. The generation will eventually be "garbage collected" anyway. >> >> Also, instead of create and delete table, is it faster to clear the table and reuse it? Assuming that ets does some memory pooling, clearing might be more efficient than just dropping. >> >> >> On Thursday, March 14, 2013 10:50:56 PM UTC+8, Valentin Micic wrote: >> Hi Max, >> >> We have implemented something similar in the past -- we called it a generational cache (hope no-one accuses me of a plagiarism, for English is but a finite language after all. And so is the problem/solution space...). >> >> The gist of it is that instead of using a single ETS table for a cache, you would use two or more "disposable" ETS tables. >> The generation management is implemented as a process that, upon some criteria are met, destroys the oldest table, and creates a new one in its stead. >> >> The youngest cache (the newest ETS table) is always queried first. If the value is not found, the older tables are queried and if entry with a corresponding key is found -- it is moved to the youngest cache. >> If none of the ETS tables in a cache set contains the key, then the key is loaded from some external source and inserted into the youngest (the newest ETS table) cache. >> >> This method worked quite well for us in the past, and we've implemented a several variants of it, e.g. time based, size based, and combination of the two. >> Bear in mind that when you drop a very large ETS table (and I mean very large, as in Gigabytes of memory), it may take some time to release the allocated memory, but that may be a problem for another day. >> >> The downside, this does not really correspond to your requirement to keep a TTL per single cache entry. >> The upside, it is much faster and cheaper than traversing a single cache periodically. Also, it end up keeping only entries that are most frequently used. >> >> Hope this helps. >> >> Kind reagards >> >> V/ >> >> >> On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: >> >> > Hi Erlangers, >> > >> > How would you implement TTL with callback for ETS based cache? >> > >> > I want when TTL expires callback is triggered and cached value goes to DB. >> > >> > For key I use 32 byte long binary(), value is not bigger than 8 KB. >> > >> > Any suggestions? >> > >> > p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? >> > >> > Best regards, >> > Max >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-q...@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-q...@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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From v@REDACTED Fri Mar 15 11:46:37 2013 From: v@REDACTED (Valentin Micic) Date: Fri, 15 Mar 2013 12:46:37 +0200 Subject: [erlang-questions] How would you implement TTL for ETS based cache? In-Reply-To: References: <1F6D9BD4-47E1-4001-BBF5-FD810A4AB9C0@pixie.co.za> <0248AB69-D2B8-4738-8BB2-2726910A0AC8@pharos-avantgard.com> Message-ID: <68DE3BDF-5C93-4B67-BCC6-9F9E88CF4CE9@pharos-avantgard.com> Hi Dmitry, We've never performed an analysis on 1000 entries. I am sure we can agree that every approach would work well on 1000 entries. When we did our testing, we did it on 1,000,000+ entries -- unfortunately I do not have results handy. Thus, when used on a small scale, our approach (if I may call it that way, and that for reference purposes only) may work only marginally better, hence the effort may not be worthwhile. However, if you want to have a solution that scales, then you aught to make a few trade-offs, and this a good one, in my view. As for ratio of 2/3 you've mention, well, consider this: A) If you want to prolong a TTL of the entry on every hit, you have no choice but to insert in order to update the entry with a new TTL value -- again, no matter which method you are using; B) If you going to drop the whole table at the end of the traversal, very little point in deleting every entry one by one. Hence, it may cost a bit of memory, but there's no need to call ets:delete for every entry even when element is going to be moved to a "younger cache" -- that is, if you favor speed over memory. (Also, note that a call to ets:delete doesn't actually deallocates the memory immediately anyway); Moving entries around has that purpose -- prolonging a lifecycle of the most recent accessed entries, which should be purpose of the cache. OTOH, if you do not want to prolong the caching of the element, then just keep it in the same table (generation) without any update, and dispose of it with the rest of the generation by dropping the table as a whole. Granted, in such case you may have a higher probability of executing a lookup more than once for the same element as the element grows older, but still result in a fewer lookups than traversing a single ETS periodically. By contrast, when we talk about traversing the whole table periodically, we are talking abut absolute certainty (P=1). V/ On 15 Mar 2013, at 11:56 AM, Dmitry Kolesnikov wrote: > Hello Valentin, > > Let me clarify one issue with you approach. > In one of your earliest email you wrote: "if entry with a corresponding key is found -- it is moved to the youngest cache." > This implies a data copy from one ETS table to another. The copy rate is sole depends on application but having 30 sec TTL with 10 sec generation you have 2/3 of cache hit request requires ets:lookup, ets:insert, ets:delete. Have you analysed impact of those? > > On another hands, a cache house keeping process might be executed less frequently then 1 sec but data eviction is happens at access time. > > - Dmitry > > On Mar 15, 2013, at 11:12 AM, Valentin Micic wrote: > >> Forgive me for questioning your view, but just consider this: >> >> Say that your TTL is set to 30 seconds and that you decide to traverse the cache every second, in which you have 3000 elements, with a maximum incoming rate of 100 entries per second. That results in traversing the entire cache 29 times in order to handle at most 100 elements at the time. This kind of pro-activity is not economical -- you can always put these CPU cycles to a better use (am I old fashion or what?) >> >> You may achieve the same thing with generational cache, as you can traverse the table only before you drop it, and then commit entries with expired TTL (e.g. execute a callback), whilst move the ones which TTL did not expire to younger ETS table. >> >> Put this to the test: say you create a new generation every 10 seconds. Considering incoming rate of 100 per second, you should have 1000 entries per generation, which you would traverse exactly once, thus, for the same number of entries, say 3000 (with a constant incoming rate of 100), well, you do the math. ;-) >> >> V/ >> >> On 15 Mar 2013, at 10:06 AM, Max Bourinov wrote: >> >>> This will not work for me. I need pro-active TTL. >>> >>> Best regards, >>> Max >>> >>> >>> >>> On Fri, Mar 15, 2013 at 8:28 AM, Bach Le wrote: >>> I like this approach. Thanks for sharing. For TTL per entry, you can do it lazily. Retrieve the entry and look at the TTL, if it's supposed to expire, return nothing and don't promote this entry. The generation will eventually be "garbage collected" anyway. >>> >>> Also, instead of create and delete table, is it faster to clear the table and reuse it? Assuming that ets does some memory pooling, clearing might be more efficient than just dropping. >>> >>> >>> On Thursday, March 14, 2013 10:50:56 PM UTC+8, Valentin Micic wrote: >>> Hi Max, >>> >>> We have implemented something similar in the past -- we called it a generational cache (hope no-one accuses me of a plagiarism, for English is but a finite language after all. And so is the problem/solution space...). >>> >>> The gist of it is that instead of using a single ETS table for a cache, you would use two or more "disposable" ETS tables. >>> The generation management is implemented as a process that, upon some criteria are met, destroys the oldest table, and creates a new one in its stead. >>> >>> The youngest cache (the newest ETS table) is always queried first. If the value is not found, the older tables are queried and if entry with a corresponding key is found -- it is moved to the youngest cache. >>> If none of the ETS tables in a cache set contains the key, then the key is loaded from some external source and inserted into the youngest (the newest ETS table) cache. >>> >>> This method worked quite well for us in the past, and we've implemented a several variants of it, e.g. time based, size based, and combination of the two. >>> Bear in mind that when you drop a very large ETS table (and I mean very large, as in Gigabytes of memory), it may take some time to release the allocated memory, but that may be a problem for another day. >>> >>> The downside, this does not really correspond to your requirement to keep a TTL per single cache entry. >>> The upside, it is much faster and cheaper than traversing a single cache periodically. Also, it end up keeping only entries that are most frequently used. >>> >>> Hope this helps. >>> >>> Kind reagards >>> >>> V/ >>> >>> >>> On 14 Mar 2013, at 4:15 PM, Max Bourinov wrote: >>> >>> > Hi Erlangers, >>> > >>> > How would you implement TTL with callback for ETS based cache? >>> > >>> > I want when TTL expires callback is triggered and cached value goes to DB. >>> > >>> > For key I use 32 byte long binary(), value is not bigger than 8 KB. >>> > >>> > Any suggestions? >>> > >>> > p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load? >>> > >>> > Best regards, >>> > Max >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-q...@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-q...@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 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From andra.dinu@REDACTED Fri Mar 15 16:23:03 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Fri, 15 Mar 2013 15:23:03 +0000 (GMT) Subject: [erlang-questions] Erlang User Conference Stockholm 13 June-14 June: Very Early Bird ticket release In-Reply-To: <408367548.3226640.1363360314337.JavaMail.root@erlang-solutions.com> Message-ID: <1826714010.3245930.1363360983547.JavaMail.root@erlang-solutions.com> On the 19th of March at 12.00 noon time (based on Sweden hour GMT+1), we will be releasing a batch of 50 tickets at the Very Early Bird Rate for the Erlang User Conference in Stockholm The 2013 EUC will keep the extended format with two days of talks -13th and 14th of June and three days of training courses ? starting on the 10th of June; those interested can also attend a day of tutorials on the 12th. More details here: http://www.erlang-factory.com/conference/ErlangUserConference2013 Thanks, Andra -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From jdavid.eisenberg@REDACTED Sat Mar 16 07:15:51 2013 From: jdavid.eisenberg@REDACTED (J David Eisenberg) Date: Fri, 15 Mar 2013 23:15:51 -0700 Subject: [erlang-questions] link/1 appears to interfere with message sending Message-ID: I have written a test program that connects Erlang and Java as follows: 1) Erlang module spawns a Java program via open_port/2. 2) Erlang then uses the port to send Java the Erlang node name. 3) The Java program uses that information to open a connection to Erlang. 4) Java sends back the pid of the Java program, then awaits a message from Erlang 5) Erlang sends back an acknowledgment to Java, and... 6) Java sends back a final message to Erlang. Here is the Java code with debugging output in Test.java //========================== import com.ericsson.otp.erlang.*; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStreamReader; public class Test { public static void main(String[] args) { OtpSelf self; OtpConnection connection; OtpPeer erlangPeer; OtpErlangObject [] elements = new OtpErlangObject[2]; OtpMsg message; OtpErlangObject obj; OtpErlangTuple tuple; OtpErlangPid erlangPid; String erlangAtom; try { self = new OtpSelf("java"); BufferedReader input = new BufferedReader(new InputStreamReader( System.in)); String erlNodeName = input.readLine(); System.err.println("Erlang node is |" + erlNodeName + "|\r"); erlangPeer = new OtpPeer(erlNodeName); connection = self.connect(erlangPeer); System.err.println("Connection to " + erlangPeer + " " + connection + "\r"); elements[0] = new OtpErlangAtom("sent_from_java"); elements[1] = connection.self().pid(); connection.send("testing", new OtpErlangTuple(elements)); message = connection.receiveMsg(); System.err.println("Java received message " + message + "\r"); obj = message.getMsg(); tuple = (OtpErlangTuple) obj; erlangAtom = ((OtpErlangAtom) tuple.elementAt(0)).atomValue(); erlangPid = (OtpErlangPid) tuple.elementAt(1); System.err.println("Java received " + erlangAtom + " " + erlangPid + "\r"); connection.send("testing", new OtpErlangAtom("goodbye")); } catch (Exception e) { System.err.println("Java gets exception" + "\r"); e.printStackTrace(System.err); } } } //=========================== And here is the Erlang module, test.erl: %===================== -module(test). -export([go/0,test/0]). go() -> Pid = spawn(?MODULE, test, []), register(testing, Pid), io:format("Erlang spawns test process with pid ~p~n", [Pid]), process_flag(trap_exit, true), Port = open_port({spawn, "java -cp .:/usr/lib/erlang/lib/jinterface-1.5.6/priv/OtpErlang.jar:core.jar Test"}, [{line, 256}]), % send my node name to the Java program. port_command(Port, list_to_binary(atom_to_list(node()) ++ "\n" )), test(). test() -> receive % get the pid of the Java process {Atom, Pid} -> io:format("Erlang receives: ~p ~p~n", [Atom, Pid]), %%% link(Pid), % let me know if Java crashes.. Pid ! {sent_from_erlang, self()}, % and send it a message test(); % then wait for another message Other -> io:format("Erlang receives ~p~n", [Other]) end. %====================== This all works great until I uncomment the ilne with the %%% link(Pid). If I do that, then, when I send the message to Java, it says: java.lang.NullPointerException at com.ericsson.otp.erlang.OtpMsg.getMsg(OtpMsg.java:212) at Test.main(Test.java:39) If I link to the Port instead of the Pid, everything works. I'm clearly overlooking some simple concept; what is it? From heinz@REDACTED Sat Mar 16 16:09:42 2013 From: heinz@REDACTED (Heinz Nikolaus Gies) Date: Sat, 16 Mar 2013 16:09:42 +0100 Subject: [erlang-questions] [ANN] eplugin - simple plugin library for erlang Message-ID: Hi I found this is something that isn't out there, so here a simple library that allows implementing plugin loading and execution for Erlang applications. It's nothing fancy and pretty fresh but it already works pretty well for me, probably there will come some more features over the time. https://github.com/Licenser/eplugin Cheers, Heinz -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From icfp.publicity@REDACTED Sat Mar 16 21:22:00 2013 From: icfp.publicity@REDACTED (David Van Horn) Date: Sat, 16 Mar 2013 16:22:00 -0400 Subject: [erlang-questions] ICFP 2013: Second Call for Papers Message-ID: ===================================================================== 18th ACM SIGPLAN International Conference on Functional Programming ICFP 2013 Boston, MA, USA, 25-27 September 2013 http://www.icfpconference.org/icfp2013 ===================================================================== Important Dates ~~~~~~~~~~~~~~~ Submissions due: Thursday, 28 March 2013 23:59 UTC-11 (Pago Pago, American Samoa, time) Author response: Wednesday, 22 May 0:00 UTC-11 Friday, 24 May 2013 23:59 UTC-11 Notification: Friday, 7 June 2013 Final copy due: Friday, 5 July 2013 Scope ~~~~~ ICFP 2013 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 Thursday, 28 March 2013, 23:59 UTC-11 (American Samoa time), 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.sigplan.org/Resources/Policies/Republication * 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. 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 on the web athttps://www.easychair.org/conferences/?conf=icfp2013 . 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 72-hour period, starting at 0:00 UTC-11 on Wednesday, 22 May 2013, 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 2013. The program committee will invite the authors of select accepted papers to submit a journal version to this issue. General Chair: Greg Morrisett, Harvard University Program Chair: Tarmo Uustalu, Institute of Cybernetics, Tallinn Program Committee: Thorsten Altenkirch, University of Nottingham Olaf Chitil, University of Kent Silvia Ghilezan, University of Novi Sad Michael Hanus, Christian-Albrechts-Universit?t zu Kiel Fritz Henglein, University of Copenhagen Mauro Jaskelioff, Universidad Nacional de Rosario Alan Jeffrey, Alcatel-Lucent Bell Labs Shin-ya Katsumata, Kyoto University Shriram Krishnamurthi, Brown University John Launchbury, Galois Ryan Newton, Indiana University Sungwoo Park, Pohang University of Science and Technology Sam Staton, University of Cambridge Nikhil Swamy, Microsoft Research, Redmond, WA Dimitrios Vytiniotis, Microsoft Research, Cambridge -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sun Mar 17 10:35:33 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 17 Mar 2013 10:35:33 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) Message-ID: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Hi guys, I'm trying to use Valgrind to track memory leaks in C NIF/Linkedin drivers. For this, I've built a "Debug Enabled" ERTS with Valgrind and SMP flavor: http://www.erlang.org/doc/installation_guide/INSTALL.html 1/ First attempt: start an Erlang node and turn it off immediately: $ cerl -valgrind [...] 1> init:stop(). [...] ==61127== at 0xC713: malloc (vg_replace_malloc.c:274) ==61127== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==61127== ==61127== ERROR SUMMARY: 420 errors from 13 contexts (suppressed: 0 from 0) 420 errors reported. Rickard Green explained why Valgrind reported these (false) numbers at: http://erlang.org/pipermail/erlang-questions/2010-February/049591.html 2/ Second attempt: simply load "crypto" module and stop it: $ cerl -valgrind [...] 1> crypto:start(). 2> crypto:stop(). ok 3> =INFO REPORT==== 17-Mar-2013::10:18:26 === application: crypto exited: stopped type: temporar 4> init:stop(). [...] ==59400== at 0xC713: malloc (vg_replace_malloc.c:274) ==59400== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) ==59400== ==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from 0) Valgrind now reorts 460 errors instead of 420 (see above). I know, there's no memory leak in "crypto" ... but this doesn't help at all. Completely useless. So, my question is very simple: How Valgrind can help me to track memory leaks in my own NIF/linked-in drivers then? How can I distinguish between these falsy reported numbers and the real ones? Finally, is there any other way than Valgrind? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From yvan.godin@REDACTED Sun Mar 17 20:22:05 2013 From: yvan.godin@REDACTED (Yvan Godin) Date: Sun, 17 Mar 2013 20:22:05 +0100 Subject: [erlang-questions] Erlang and Cowboy network problem Message-ID: Hello Erlang list, I need some helps, I am trying to make *Cowboy* working in Virtual machine on *ERLANG R16B* but If I configure *Cowboy* without IP binding it work but only on localhost (no external acces) as root, if I bind an IP it work only on PORT 80 and not for other port (tryed 8000 8080 etc..) Cowboy parameters (trying demo web_server with IP ,no IP, and different ports) {ok, _} = cowboy:start_http(http, 100, [{ip,{0,0,0,0}},{port, 8088}], run with : erl -pa ebin deps/*/ebin -s web_server -smp disable (only one core / smp or not doesn't change thing) Is there a known problem with Erlang R16B on Virtual machine ? A binding problem on virtual net ? a cowboy problem ? A mistake from myself ? below some parameters If you have any clues, thank's for your help Best regards, Yvan (the VPS used http://www.lws.fr/serveur_dedie_virtuel.php) The machine has been reintalled on UBUNTU 12.10 and Erlang R16B. But was previously working with DEBIAN 6 and NITROGEN on Erlang R15B over Cowboy *ifconfig* venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:91.234.194.186 P-t-P:91.234.194.186 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 * iptables -S * (no rules) -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT *netstat* *start COWBOY port 80 as root (WORK)* *tcp 0 0 vps11621.lws-hosti:http 94.53.103.84.rev.:33286 TIME_WAIT tcp 0 176 vps11621.lws-hostin:ssh 94.53.103.84.rev.:51806 ESTABLISHED tcp 0 0 vps11621.lws-hosti:http 94.53.103.84.rev.:33285 TIME_WAIT tcp 0 0 vps11621.lws-hostin:ssh 94.53.103.84.rev.:46236 ESTABLISHED* *start COWBOY on port 8080 as root* *tcp 0 0 localhost.lo:submission *:* LISTEN tcp 0 176 vps11621.lws-hostin:ssh 94.53.103.84.rev.:51806 ESTABLISHED tcp 0 0 vps11621.lws-hostin:ssh 94.53.103.84.rev.:46236 ESTABLISHED tcp6 0 0 [::]:ssh [::]:* LISTEN * -- ------------------------------------------------------------ Yvan Godin ------------------------------------------------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Mon Mar 18 11:29:54 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 18 Mar 2013 11:29:54 +0100 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> Message-ID: <5146ECA2.5020806@erix.ericsson.se> Manuel A. Rubio "Bombadil" wrote: > Hi, > > I'm using exmpp for development, and eunit for tests. When I need to > launch tests, I write several times: > > application:start(exmpp), > ... > application:stop(exmpp). > > In some cases this throws an "Segmentation fault" and stop erlang VM. > I try this code in the shell: > > [ begin application:start(exmpp), aplication:stop(exmpp), ok end || X > <- lists:seq(1,100) ]. > > And the code fails, not always, but very often... I think could be a > problem with unload and load the code when the port isn't unloaded > completly... any suggestion? > Looking at exmpp I see that it contains a linked-in driver. I would consider that as prime suspect. Enable core dump generation: [bash]> ulimit -c unlimited Run test to generate core dump file. Look at core dump: > gdb /path/to/otp-release/erts-x.y.z/beam.smp -c core.xxx (gdb) backtrace : : /Sverker, Erlang/OTP Ericsson From bombadil@REDACTED Mon Mar 18 11:58:05 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Mon, 18 Mar 2013 11:58:05 +0100 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <5146ECA2.5020806@erix.ericsson.se> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> <5146ECA2.5020806@erix.ericsson.se> Message-ID: <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> Hi Sverker, El 2013-03-18 11:29, Sverker Eriksson escribi?: > Looking at exmpp I see that it contains a linked-in driver. I would > consider that as prime suspect. > > Enable core dump generation: > > [bash]> ulimit -c unlimited > > Run test to generate core dump file. > Look at core dump: > >> gdb /path/to/otp-release/erts-x.y.z/beam.smp -c core.xxx Done. I've attached the result. The main suspect is confirmed... but I don't know how to fix it :-/ Thanks. Manuel Rubio. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: output.txt URL: From sverker.eriksson@REDACTED Mon Mar 18 15:04:55 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 18 Mar 2013 15:04:55 +0100 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> <5146ECA2.5020806@erix.ericsson.se> <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> Message-ID: <51471F07.1060305@erix.ericsson.se> Manuel A. Rubio "Bombadil" wrote: > Hi Sverker, > > El 2013-03-18 11:29, Sverker Eriksson escribi?: >> Looking at exmpp I see that it contains a linked-in driver. I would >> consider that as prime suspect. >> >> Enable core dump generation: >> >> [bash]> ulimit -c unlimited >> >> Run test to generate core dump file. >> Look at core dump: >> >>> gdb /path/to/otp-release/erts-x.y.z/beam.smp -c core.xxx > > Done. > > I've attached the result. The main suspect is confirmed... but I don't > know how to fix it :-/ > > Thanks. > Manuel Rubio. Try call driver_lock_driver(port); at the end of exmpp_tls_openssl_start() in exmpp_tls_openssl.c This will keep the driver in memory when exmpp is stopped and prevent the driver from re-initialize OpenSSL which seems to be the problem. /Sverker From pan@REDACTED Mon Mar 18 16:43:47 2013 From: pan@REDACTED (Patrik Nyblom) Date: Mon, 18 Mar 2013 16:43:47 +0100 Subject: [erlang-questions] Compiling R16B on Mac OS X Mountain Lion In-Reply-To: <5141A5DB.7070307@ubiquity.it> References: <513DE820.1060900@ubiquity.it> <51405EC3.10502@erlang.org> <51418FD6.1070709@ubiquity.it> <5141A5DB.7070307@ubiquity.it> Message-ID: <51473633.4070507@erlang.org> Hi! On 03/14/2013 11:26 AM, Carlo Bertoldi wrote: > I've talked too early. > I have this error now: > > make -f x86_64-apple-darwin12.2.0/Makefile TYPE=opt > gcc -m64 -m64 -o ../priv/bin/x86_64-apple-darwin12.2.0/memsup > ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o > ld: warning: ignoring file > ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o, file was built for > i386 which is not the architecture being linked (x86_64): > ../priv/obj/x86_64-apple-darwin12.2.0/memsup.o > Undefined symbols for architecture x86_64: > "_main", referenced from: > start in crt1.10.6.o > ld: symbol(s) not found for architecture x86_64 > collect2: ld returned 1 exit status > make[4]: *** [../priv/bin/x86_64-apple-darwin12.2.0/memsup] Error 1 > > This is my configure: > ./configure --enable-smp-support --enable-threads --enable-kernel-poll > --enable-darwin-64bit --enable-m64-build > Are you using macports gcc or apples llvm-wrapper in this case? If macports, did you install the +universal variant? Could you also send the make output from where memsup.o was actually compiled? > The error happens with both the default compiler and the macports one. > If I omit --enable-m64-build, then sources are compiled with -m32, and > the compilation works. > > Carlo Cheers, /Patrik > > > On 14/03/13 09:52, Carlo Bertoldi wrote: >> Thanks Patrik, unsetting the compiler flags solved my problem :) >> But still, sourcing were compiled with -m32. >> So I switched to gcc-4.5 included in MacPorts, and finally got the >> expected -m64. >> >> Cheers, >> Carlo > > From jon@REDACTED Mon Mar 18 16:42:40 2013 From: jon@REDACTED (Jon Schneider) Date: Mon, 18 Mar 2013 15:42:40 -0000 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> <5146ECA2.5020806@erix.ericsson.se> <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> Message-ID: <28e1a31ad095b6a2fbf54d0a2ec3b1f3.squirrel@mail.jschneider.net> It looks like a lot of unrelated projects suffer segfaults involving SSL_library_init and __strcmp_sse42 Can you write a tiny C program that calls SSL_library_init() ? Does your machine have SSE 4.2 (making assumptions...) ? I certainly can on this (random) box that is x86_64 (hint add option -lssl when building). Jon > I've attached the result. The main suspect is confirmed... but I don't > know how to fix it :-/ From garazdawi@REDACTED Mon Mar 18 16:45:33 2013 From: garazdawi@REDACTED (Lukas Larsson) Date: Mon, 18 Mar 2013 16:45:33 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: Hello, use the suppress file in erts/emulator/valgrind/suppress.standard to remove many of the false positive errors. It will not remove all, but many of the extra errors you see. To remove all you have to use erts/emulator/valgrind/suppress.patched.3.6.0, but this requires a patched version of valgrind as the normal suppression syntax was not expressive enough for our needs. Lukas On Sun, Mar 17, 2013 at 10:35 AM, Zabrane Mickael wrote: > Hi guys, > > I'm trying to use Valgrind to track memory leaks in C NIF/Linkedin drivers. > For this, I've built a "Debug Enabled" ERTS with Valgrind and SMP flavor: > http://www.erlang.org/doc/installation_guide/INSTALL.html > > 1/ First attempt: start an Erlang node and turn it off immediately: > > $ cerl -valgrind > [...] > > 1> init:stop(). > > [...] > ==61127== at 0xC713: malloc (vg_replace_malloc.c:274) > ==61127== by 0x1002C25F0: erts_sys_alloc (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000B6B3: erts_alloc (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x1001053E7: init_db (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10002884B: erl_init (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10002D273: erl_start (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000191F: main (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== > ==61127== ERROR SUMMARY: 420 errors from 13 contexts (suppressed: 0 from 0) > > 420 errors reported. > > Rickard Green explained why Valgrind reported these (false) numbers at: > http://erlang.org/pipermail/erlang-questions/2010-February/049591.html > > > 2/ Second attempt: simply load "crypto" module and stop it: > > $ cerl -valgrind > [...] > > 1> crypto:start(). > 2> crypto:stop(). > ok > 3> > =INFO REPORT==== 17-Mar-2013::10:18:26 === > application: crypto > exited: stopped > type: temporar > 4> init:stop(). > > [...] > ==59400== at 0xC713: malloc (vg_replace_malloc.c:274) > ==59400== by 0x1002C25F0: erts_sys_alloc (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000B6B3: erts_alloc (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x1001053E7: init_db (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10002884B: erl_init (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10002D273: erl_start (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000191F: main (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== > ==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from 0) > > Valgrind now reorts 460 errors instead of 420 (see above). > > I know, there's no memory leak in "crypto" ... but this doesn't help at > all. Completely useless. > > So, my question is very simple: > How Valgrind can help me to track memory leaks in my own NIF/linked-in > drivers then? > How can I distinguish between these falsy reported numbers and the real > ones? > > Finally, is there any other way than Valgrind? > > 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 pan@REDACTED Mon Mar 18 16:47:04 2013 From: pan@REDACTED (Patrik Nyblom) Date: Mon, 18 Mar 2013 16:47:04 +0100 Subject: [erlang-questions] erlang:halt() cannot terminate the Erlang VM In-Reply-To: <4618e4db.21a02.13d690cf003.Coremail.cloudzen@163.com> References: <4618e4db.21a02.13d690cf003.Coremail.cloudzen@163.com> Message-ID: <514736F8.4040807@erlang.org> Hi! On 03/14/2013 02:18 PM, skyman wrote: > Hi all, > I encounter this problem: erlang:halt() cannot terminate the Erlang > VM. Then I user "kill -USR1 erlpid" to kill the Erlang VM process, and > get an Erlang crash dump, it indicates that there are some "Scheduled" > processes. > I want to know under what cases erlang:halt() cannot terminate the > Erlang VM, for example, existing "Scheduled" processes? > Thanks in advance! > What version of OTP are you using and on what platform? Erlang:halt only stops for flushing I/O of stdin/stdout. That has changed slightly in later releases. Is pending I/O something that could be the cause in your case? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Cheers, /Patrik -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Mon Mar 18 17:00:03 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 18 Mar 2013 17:00:03 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: Hi Lukas, Thanks for the clarifications. And is the OTP team is willing to share this Valgrind patch with the community? Regards, Zabrane On Mar 18, 2013, at 4:45 PM, Lukas Larsson wrote: > Hello, > > use the suppress file in erts/emulator/valgrind/suppress.standard to remove many of the false positive errors. It will not remove all, but many of the extra errors you see. To remove all you have to use erts/emulator/valgrind/suppress.patched.3.6.0, but this requires a patched version of valgrind as the normal suppression syntax was not expressive enough for our needs. > > Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsvancara@REDACTED Mon Mar 18 17:03:16 2013 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Mon, 18 Mar 2013 17:03:16 +0100 Subject: [erlang-questions] erlang:halt() cannot terminate the Erlang VM In-Reply-To: <514736F8.4040807@erlang.org> References: <4618e4db.21a02.13d690cf003.Coremail.cloudzen@163.com> <514736F8.4040807@erlang.org> Message-ID: >>What version of OTP are you using and on what platform? Erlang:halt only stops for flushing I/O of stdin/stdout. That has changed slightly in later releases. Is >>pending I/O something that could be the cause in your case? Huh. Am I understand well that if I will not send anything to stdout then erlang:halt() will not work? 2013/3/18 Patrik Nyblom > Hi! > > On 03/14/2013 02:18 PM, skyman wrote: > > Hi all, > I encounter this problem: erlang:halt() cannot terminate the Erlang VM. > Then I user "kill -USR1 erlpid" to kill the Erlang VM process, and get an > Erlang crash dump, it indicates that there are some "Scheduled" processes. > I want to know under what cases erlang:halt() cannot terminate the > Erlang VM, for example, existing "Scheduled" processes? > Thanks in advance! > > What version of OTP are you using and on what platform? Erlang:halt only > stops for flushing I/O of stdin/stdout. That has changed slightly in later > releases. Is pending I/O something that could be the cause in your case? > > > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > Cheers, > /Patrik > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bombadil@REDACTED Mon Mar 18 17:22:56 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Mon, 18 Mar 2013 17:22:56 +0100 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <51471F07.1060305@erix.ericsson.se> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> <5146ECA2.5020806@erix.ericsson.se> <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> <51471F07.1060305@erix.ericsson.se> Message-ID: <85f7c4679963f60c5cb8fbd9a897f533@bosqueviejo.net> Hi Sverker, El 2013-03-18 15:04, Sverker Eriksson escribi?: > Try call > > driver_lock_driver(port); > > at the end of exmpp_tls_openssl_start() in exmpp_tls_openssl.c > > This will keep the driver in memory when exmpp is stopped and prevent > the driver from re-initialize OpenSSL which seems to be the problem. I tried, but fails again :-/ Regards. Manuel Rubio. From bombadil@REDACTED Mon Mar 18 17:29:24 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Mon, 18 Mar 2013 17:29:24 +0100 Subject: [erlang-questions] Segmentation fault in tests In-Reply-To: <28e1a31ad095b6a2fbf54d0a2ec3b1f3.squirrel@mail.jschneider.net> References: <5228f5f1f062efb73ac2d293a263dc71@bosqueviejo.net> <5146ECA2.5020806@erix.ericsson.se> <781c91a243e30fa50bdbf4f0f1be23d3@bosqueviejo.net> <28e1a31ad095b6a2fbf54d0a2ec3b1f3.squirrel@mail.jschneider.net> Message-ID: Hi Jon, El 2013-03-18 16:42, Jon Schneider escribi?: > Can you write a tiny C program that calls SSL_library_init() ? Does > your > machine have SSE 4.2 (making assumptions...) ? flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms Yes, my CPU support it. > I certainly can on this (random) box that is x86_64 (hint add option > -lssl > when building). The project has active the SSL: {port_env, [{"LDFLAGS", "$LDFLAGS -module -lei_st -lz -lssl -lcrypto -lexpat"}]}. I've resolved it with a workaround: case lists:keyfind(exmpp, 1, application:loaded_applications()) of false -> application:start(exmpp); _ -> ok end, And never use application:stop(exmpp). So, this workaround avoid the problem of restart exmpp. Thanks. Manuel Rubio. From zabrane3@REDACTED Mon Mar 18 17:35:30 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 18 Mar 2013 17:35:30 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: I'm getting this error when trying with the Valgrind suppresion file shipped with Erlang R16B: [..] --91449-- Scheduler: using generic scheduler lock implementation. --91449-- Reading suppressions file: /opt/otp_src_R16B/erts/emulator/valgrind/suppress.patched.3.6.0 location should be "...", or should start with "fun:" or "obj:" ==91449== FATAL: in suppressions file "/opt/otp_src_R16B/erts/emulator/valgrind/suppress.patched.3.6.0" near line 95: ==91449== location should be "...", or should start with "fun:" or "obj:" ==91449== exiting now. Regards, Zabrane On Mar 18, 2013, at 4:45 PM, Lukas Larsson wrote: > Hello, > > use the suppress file in erts/emulator/valgrind/suppress.standard to remove many of the false positive errors. It will not remove all, but many of the extra errors you see. To remove all you have to use erts/emulator/valgrind/suppress.patched.3.6.0, but this requires a patched version of valgrind as the normal suppression syntax was not expressive enough for our needs. > > Lukas > > > On Sun, Mar 17, 2013 at 10:35 AM, Zabrane Mickael wrote: > Hi guys, > > I'm trying to use Valgrind to track memory leaks in C NIF/Linkedin drivers. > For this, I've built a "Debug Enabled" ERTS with Valgrind and SMP flavor: > http://www.erlang.org/doc/installation_guide/INSTALL.html > > 1/ First attempt: start an Erlang node and turn it off immediately: > > $ cerl -valgrind > [...] > > 1> init:stop(). > > [...] > ==61127== at 0xC713: malloc (vg_replace_malloc.c:274) > ==61127== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==61127== > ==61127== ERROR SUMMARY: 420 errors from 13 contexts (suppressed: 0 from 0) > > 420 errors reported. > > Rickard Green explained why Valgrind reported these (false) numbers at: > http://erlang.org/pipermail/erlang-questions/2010-February/049591.html > > > 2/ Second attempt: simply load "crypto" module and stop it: > > $ cerl -valgrind > [...] > > 1> crypto:start(). > 2> crypto:stop(). > ok > 3> > =INFO REPORT==== 17-Mar-2013::10:18:26 === > application: crypto > exited: stopped > type: temporar > 4> init:stop(). > > [...] > ==59400== at 0xC713: malloc (vg_replace_malloc.c:274) > ==59400== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== > ==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from 0) > > Valgrind now reorts 460 errors instead of 420 (see above). > > I know, there's no memory leak in "crypto" ... but this doesn't help at all. Completely useless. > > So, my question is very simple: > How Valgrind can help me to track memory leaks in my own NIF/linked-in drivers then? > How can I distinguish between these falsy reported numbers and the real ones? > > Finally, is there any other way than Valgrind? > > 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 jon@REDACTED Mon Mar 18 17:53:20 2013 From: jon@REDACTED (Jon Schneider) Date: Mon, 18 Mar 2013 16:53:20 -0000 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== by 0x10000191F: main (in > /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) > ==59400== > ==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from > 0) > How can I distinguish between these falsy reported numbers and the real > ones? Isn't the information you require in the return address/function/executable reported even if this needs a little post-processing ? > Finally, is there any other way than Valgrind? Yes by instrumenting your code. Jon From zabrane3@REDACTED Mon Mar 18 18:11:26 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 18 Mar 2013 18:11:26 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: <79110429-7647-4462-9F3B-E22B5DED38A1@gmail.com> Hi Jon, On Mar 18, 2013, at 5:53 PM, Jon Schneider wrote: >> /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) >> ==59400== by 0x10000191F: main (in >> /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp) >> ==59400== >> ==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from >> 0) >> How can I distinguish between these falsy reported numbers and the real >> ones? > > Isn't the information you require in the return > address/function/executable reported even if this needs a little > post-processing ? Yet it is. But it's mixed with a lot of false positive (see crypto example). And if I can avoid post-processing, that should be great. >> Finally, is there any other way than Valgrind? > > Yes by instrumenting your code. DTrace? SystemTap? How? Can you elaborate with a concret example? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From nmarino@REDACTED Mon Mar 18 19:00:18 2013 From: nmarino@REDACTED (Nick Marino) Date: Mon, 18 Mar 2013 14:00:18 -0400 Subject: [erlang-questions] Mnesia race condition with indexes and dirty read operations Message-ID: <51475632.9020107@shoretel.com> Hi all, I've come across some rather surprising behavior related to Mnesia indexes and dirty reads, and I'm wondering if this is a known issue and if this is something that could/should be fixed. This behavior is limited to Mnesia tables of type 'set' with secondary indexes. I would expect that if I simultaneously update a record and do a dirty index read on it, then I will either read out the old version (pre-update) or the new version (post-update). But in fact it seems there is a short window of time during which I will see neither object and my query will return no results, even if the query matches the record both before and after the update. Here's an illustration of what I'm talking about and how I'm able to reproduce the problem: 1> rd(r, {a, b, c}). r 2> mnesia:start(). ok 3> mnesia:create_table(r, [{attributes, record_info(fields, r)}]). {atomic,ok} 4> mnesia:add_table_index(r, b). {atomic,ok} 5> [mnesia:dirty_write(#r{a=I, b=none, c=0}) || I <- lists:seq(0, 100000)]. [ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok, ok,ok,ok,ok,ok,ok,ok,ok,ok,ok|...] 6> mnesia:dirty_write(#r{a=0, b=none, c=1}). ok 7> mnesia:dirty_match_object(#r{b=none, c=1, _='_'}). [#r{a = 0,b = none,c = 1}] 8> spawn(fun() -> mnesia:transaction(fun() -> mnesia:write(#r{a=0, b=none, c=1}) end) end), 8> mnesia:dirty_match_object(#r{b=none, c=1, _='_'}). [] 9> spawn(fun() -> mnesia:transaction(fun() -> mnesia:write(#r{a=0, b=none, c=1}) end) end), 9> timer:sleep(100), 9> mnesia:dirty_match_object(#r{b=none, c=1, _='_'}). [#r{a = 0,b = none,c = 1}] Step 5 takes quite a while on my machine, but seems to be necessary to reliably reproduce what I'm seeing. I believe this is due to the massive slowdown that all the duplicate index values incur, which in turn allows us to expose the underlying race condition more easily. If I rerun step 8 repeatedly, I only get back an empty list about half the time, seemingly at random. Adding the timer:sleep(100) seems to be enough to get back the record I expect every time though. This behavior is much more reliably reproducible if I use a dirty_write instead of a transactional write, but I generally mistrust dirty writes for most cases anyway, so I thought this would make a more relevant and interesting example :-) I realize dirty operations are warned against, but this seems exceptionally counter-intuitive to me, even for a dirty op. From looking at the mnesia_index.erl code it looks like there's a race condition stemming from the add_index2 function where it first deletes any old indexes for the given object and then regenerates them from scratch. (And notably, this does not appear to be an issue for Mnesia tables of type 'bag', only for 'set' tables.) Would this be considered a bug? It seems like a bug to me, but if it's not, then I feel like maybe there should at least be some kind of extra warning in the documentation for the mnesia:dirty_index_* functions. Thoughts? Thanks, Nick This e-mail and any attachments are confidential. If it is not intended for you, please notify the sender, and please erase and ignore the contents. From sverker.eriksson@REDACTED Mon Mar 18 19:09:15 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 18 Mar 2013 19:09:15 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> Message-ID: <5147584B.60802@erix.ericsson.se> You don't need the patched version if you run with valgrind option --show-possibly-lost=no. This is what we do currently in our daily tests. export VALGRIND_MISC_FLAGS="--suppressions=$ERL_TOP/erts/emulator/valgrind/suppress.standard --show-possibly-lost=no" /Sverker Zabrane Mickael wrote: > Hi Lukas, > > Thanks for the clarifications. > > And is the OTP team is willing to share this Valgrind patch with the community? > > Regards, > Zabrane > > > > On Mar 18, 2013, at 4:45 PM, Lukas Larsson wrote: > > >> Hello, >> >> use the suppress file in erts/emulator/valgrind/suppress.standard to remove many of the false positive errors. It will not remove all, but many of the extra errors you see. To remove all you have to use erts/emulator/valgrind/suppress.patched.3.6.0, but this requires a patched version of valgrind as the normal suppression syntax was not expressive enough for our needs. >> >> Lukas >> > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jon@REDACTED Mon Mar 18 20:15:57 2013 From: jon@REDACTED (Jonathan Schneider) Date: Mon, 18 Mar 2013 19:15:57 +0000 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: <79110429-7647-4462-9F3B-E22B5DED38A1@gmail.com> References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> <79110429-7647-4462-9F3B-E22B5DED38A1@gmail.com> Message-ID: <9B740525-8621-41A5-864A-5BFC4B3D698A@axismilton.ltd.uk> > DTrace? SystemTap? How? > Can you elaborate with a concret example? Sorry but not in any useful way that would take less time than working out how it would actually work with your code. Jon From co7eb@REDACTED Mon Mar 18 21:32:29 2013 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Mon, 18 Mar 2013 15:32:29 -0500 Subject: [erlang-questions] Looking for a job in Erlang Message-ID: <001601ce2417$bbbbae10$33330a30$@frcuba.co.cu> Hi all, I?m looking for some job in Erlang, because I need it so hard, I?m from Cuba but I have finally a way to receive the payment, could be American International Card, maybe Visa o Master Card or other depending of the source country. If someone of you, need an Erlang programmer I can afford that for a noble payment. My best performance is in OTP principles and processes communications. My Best, Ivan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Mon Mar 18 20:54:56 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 18 Mar 2013 20:54:56 +0100 Subject: [erlang-questions] Tracking memory leaks in NIF/Linkedin drivers with Valgrind (or anything else) In-Reply-To: <5147584B.60802@erix.ericsson.se> References: <716745B4-72F2-4CD3-82A2-C2F599B0EA41@gmail.com> <5147584B.60802@erix.ericsson.se> Message-ID: Sverker, Tried your suppression file (with --show-possibly-lost=no) and got this when starting/stopping a node: [...] --4240-- --4240-- used_suppression: 1 Early permanent cache aligned ts_event_pool --4240-- used_suppression: 1 Permanent cache aligned malloc for array of mseg allocators --4240-- used_suppression: 1 Harmless leak of ErtsThrPrgrData from async threads in exiting emulator --4240-- used_suppression: 2 No leak; pointer into block --4240-- used_suppression: 1 Early permanent cache aligned erl_process:aux_work_tmo --4240-- used_suppression: 1 Prebuilt constant terms in os_info_init (PossiblyLost) ==4240== ==4240== ERROR SUMMARY: 416 errors from 9 contexts (suppressed: 4 from 4) Can you please confirm that you get the same "false errors" in your side? Regards, Zabrane On Mar 18, 2013, at 7:09 PM, Sverker Eriksson wrote: > You don't need the patched version if you run with valgrind option --show-possibly-lost=no. > This is what we do currently in our daily tests. > > > export VALGRIND_MISC_FLAGS="--suppressions=$ERL_TOP/erts/emulator/valgrind/suppress.standard --show-possibly-lost=no" > > /Sverker From erlang@REDACTED Tue Mar 19 00:09:52 2013 From: erlang@REDACTED (=?UTF-8?Q?Micha=C5=82_Ptaszek?=) Date: Mon, 18 Mar 2013 16:09:52 -0700 Subject: [erlang-questions] beam.smp signal handling Message-ID: Hey, in order to avoid stupid mistakes on production we have disabled break signal handling for the VM by adding +Bi switch to the options passed to 'beam.smp' command. As a result, if anyone is connect to the shell via pipe and hits CTRL+C - nothing should happen. In order to kill the node someone must intentionally run init:stop()/q() from inside of the node. Unfortunately, as a result, we are not able to handle USR1 signals anymore and thus not being able to generate crash dumps when the VM is stuck. If +Bi option is passed VM is terminated with "User defined signal 1" reason. Temporarily we can run the VM with +Bc switch however I was wondering if there is any other way to completely disable SIGINT, but not SIGUSR1 signal handlers? Thanks, Michal -------------- next part -------------- An HTML attachment was scrubbed... URL: From jon@REDACTED Tue Mar 19 06:23:31 2013 From: jon@REDACTED (Jon Schneider) Date: Tue, 19 Mar 2013 05:23:31 +0000 Subject: [erlang-questions] beam.smp signal handling In-Reply-To: References: Message-ID: Suggestion. Instead change the terminal with stty so that ^C no longer causes a break. Jon "Micha? Ptaszek" wrote: >Hey, > >in order to avoid stupid mistakes on production we have disabled break >signal handling for the VM by adding +Bi switch to the options passed >to >'beam.smp' command. As a result, if anyone is connect to the shell via >pipe >and hits CTRL+C - nothing should happen. In order to kill the node >someone >must intentionally run init:stop()/q() from inside of the node. > >Unfortunately, as a result, we are not able to handle USR1 signals >anymore >and thus not being able to generate crash dumps when the VM is stuck. >If >+Bi option is passed VM is terminated with "User defined signal 1" >reason. > >Temporarily we can run the VM with +Bc switch however I was wondering >if >there is any other way to completely disable SIGINT, but not SIGUSR1 >signal >handlers? > >Thanks, >Michal > > >------------------------------------------------------------------------ > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan@REDACTED Tue Mar 19 14:02:14 2013 From: stefan@REDACTED (Stefan Jahn) Date: Tue, 19 Mar 2013 14:02:14 +0100 Subject: [erlang-questions] scp subsystem Message-ID: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> dear erlang'ers, after reading some documentation on ssh otp system I ended up with: ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, %% create server keys: %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa {system_dir, "/tmp/ssh"}, {user_dir, "/tmp/ssh"}, % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, {auth_methods, "keyboard-interactive,password"}, {subsystems, [ ssh_scpd:subsystem_spec([]) % ssh_sftpd:subsystem_spec([{vsn, 3}]) ]}]). whereas the ssh_scpd module is base on the ssh_sftpd module from otp, i.e. -module(ssh_scpd). %-behaviour(ssh_daemon_channel). -behaviour(ssh_channel). -define(UINT32(X), X:32/unsigned-big-integer). %% External exports -export([subsystem_spec/1]). %% Callbacks -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, code_change/3]). implementing the callbacks similar to what we have in ssh_sftpd... now, when I start $ scp -P 45678 README ssh@REDACTED:README authentification works fine as implemented in auth/2, but somehow the ssh channel behaviour is not used at all. ssh@REDACTED's password: {error,{1,erl_parse,["syntax error before: ",[]]}} $ Received disconnect from 127.0.0.1: 11: Application shutdown It seems like scp commands are send into the standard erlang shell (which I did not specify) and not into the channel. I am using R15B2. Could please someone help out here and give me some hint where to proceed reading? Also an abstract description of the difference between the purposes of ssh_cli and subsystems options would be appriciated. Thank you in advance, Stefan. From ingela.andin@REDACTED Tue Mar 19 15:01:57 2013 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 19 Mar 2013 15:01:57 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> Message-ID: Hi! 2013/3/19, Stefan Jahn : > dear erlang'ers, > > after reading some documentation on ssh otp system I ended up with: > > ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, > %% create server keys: > %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa > %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa > {system_dir, "/tmp/ssh"}, > {user_dir, "/tmp/ssh"}, > % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, > {auth_methods, "keyboard-interactive,password"}, > {subsystems, [ > ssh_scpd:subsystem_spec([]) > % ssh_sftpd:subsystem_spec([{vsn, 3}]) > ]}]). > > whereas the ssh_scpd module is base on the ssh_sftpd module from otp, i.e. > > -module(ssh_scpd). > %-behaviour(ssh_daemon_channel). > -behaviour(ssh_channel). > > -define(UINT32(X), X:32/unsigned-big-integer). > > %% External exports > -export([subsystem_spec/1]). > > %% Callbacks > -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, > code_change/3]). > > implementing the callbacks similar to what we have in ssh_sftpd... > > now, when I start > > $ scp -P 45678 README ssh@REDACTED:README > > authentification works fine as implemented in auth/2, but somehow > the ssh channel behaviour is not used at all. > > ssh@REDACTED's password: > {error,{1,erl_parse,["syntax error before: ",[]]}} > $ Received disconnect from 127.0.0.1: 11: Application shutdown > > It seems like scp commands are send into the standard erlang shell (which > I did not specify) and not into the channel. > > I am using R15B2. > > Could please someone help out here and give me some hint where to > proceed reading? > > Also an abstract description of the difference between the purposes of > ssh_cli and subsystems options would be appriciated. ssh_cli is to customize the shell I do not think you want to use ssh_cli at all. You should write your scp-deamon as subsystem and then use an existing scp client to connect to it or write your own erlang client that opens an ssh connection, requests the ssh-scp subsystem and then sends scp commands on the channel along the lines; ssh:connect ... ssh_connection:session_channel... ssh_connection:subsystem... ssh_connection:send... The client can use the ssh_channel behavior. Regards Ingela Erlang/OTP team Ericsson AB From stefan@REDACTED Tue Mar 19 15:12:40 2013 From: stefan@REDACTED (Stefan Jahn) Date: Tue, 19 Mar 2013 15:12:40 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> Message-ID: <72fd6ef84cdccabc84356453588f8514.squirrel@service.rules.org> Hello! On Tue, March 19, 2013 3:01 pm, Ingela Andin wrote: > Hi! > > 2013/3/19, Stefan Jahn : >> dear erlang'ers, >> >> after reading some documentation on ssh otp system I ended up with: >> >> ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, >> %% create server keys: >> %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa >> %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa >> {system_dir, "/tmp/ssh"}, >> {user_dir, "/tmp/ssh"}, >> % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, >> {auth_methods, "keyboard-interactive,password"}, >> {subsystems, [ >> ssh_scpd:subsystem_spec([]) >> % ssh_sftpd:subsystem_spec([{vsn, 3}]) >> ]}]). >> >> whereas the ssh_scpd module is base on the ssh_sftpd module from otp, >> i.e. >> >> -module(ssh_scpd). >> %-behaviour(ssh_daemon_channel). >> -behaviour(ssh_channel). >> >> -define(UINT32(X), X:32/unsigned-big-integer). >> >> %% External exports >> -export([subsystem_spec/1]). >> >> %% Callbacks >> -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, >> code_change/3]). >> >> implementing the callbacks similar to what we have in ssh_sftpd... >> >> now, when I start >> >> $ scp -P 45678 README ssh@REDACTED:README >> >> authentification works fine as implemented in auth/2, but somehow >> the ssh channel behaviour is not used at all. >> >> ssh@REDACTED's password: >> {error,{1,erl_parse,["syntax error before: ",[]]}} >> $ Received disconnect from 127.0.0.1: 11: Application shutdown >> >> It seems like scp commands are send into the standard erlang shell >> (which >> I did not specify) and not into the channel. >> >> I am using R15B2. >> >> Could please someone help out here and give me some hint where to >> proceed reading? >> >> Also an abstract description of the difference between the purposes of >> ssh_cli and subsystems options would be appriciated. > > ssh_cli is to customize the shell I do not think you want to use > ssh_cli at all. You should write your scp-deamon as subsystem and then > use an existing scp client to connect to it or > write your own erlang client that opens an ssh connection, requests > the ssh-scp subsystem and then sends scp commands on the channel along > the lines; > > ssh:connect ... > ssh_connection:session_channel... > ssh_connection:subsystem... > ssh_connection:send... > > The client can use the ssh_channel behavior. Thank you very much for your email. True, I just want to implement my own scp-daemon. For the client I'll use standard system clients. As shown in my email I was not yet successful to setup my own scp-daemon. I wanted to use the ssh:daemon(..., ..., [{subsystems, []}, ...]) subsystem option. Is this the correct strategy? As stated in my email the authentifaction works, but my ssh_scpd module does not ever be run..., but the erlang shell instead... My ssh_scpd module is based on the ssh_sftp module within otp, but it seems not to be correct... Any more help from is very much appreciated. Thank you in advance, Stefan. From attila.r.nohl@REDACTED Tue Mar 19 15:16:18 2013 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 19 Mar 2013 15:16:18 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> Message-ID: 2013/3/19 Ingela Andin : [...] > ssh_cli is to customize the shell I do not think you want to use > ssh_cli at all. You should write your scp-deamon as subsystem and then > use an existing scp client to connect to it or Unfortunately scp does not use a separate subsystem (unlike SFTP). Scp uses an EXEC request to start the scp executable on the server side, then the client communicates directly with this started process (over the SSH channel), see https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works Even more unfortunately one cannot write a simple shell to handle the this communication, because by default the communication goes through the group I/O handler and that doesn't handle the 0 (\000) character well. A whole new channel has to be implemented, along with the logic in the scp executable. So the short answer is to use SFTP, if you can. From stefan@REDACTED Tue Mar 19 15:36:52 2013 From: stefan@REDACTED (Stefan Jahn) Date: Tue, 19 Mar 2013 15:36:52 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> Message-ID: <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> Hello, this means, one should use ssh:daemon(..., ..., [ {shell, {Module, Function, Args}}, ...]) instead of ssh:daemon(..., ..., [ {subsystems, [subsystem_spec()]}, ...]) correct? Does "the communication goes through the group I/O handler and that doesn't handle the 0 (\000) character well" mean, that it cannot be handled at all? So, it will be impossible to implement it using the shell API? Thank you in advance, Stefan. On Tue, March 19, 2013 3:16 pm, Attila Rajmund Nohl wrote: > 2013/3/19 Ingela Andin : > [...] >> ssh_cli is to customize the shell I do not think you want to use >> ssh_cli at all. You should write your scp-deamon as subsystem and then >> use an existing scp client to connect to it or > > Unfortunately scp does not use a separate subsystem (unlike SFTP). Scp > uses an EXEC request to start the scp executable on the server side, > then the client communicates directly with this started process (over > the SSH channel), see > https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works > > Even more unfortunately one cannot write a simple shell to handle the > this communication, because by default the communication goes through > the group I/O handler and that doesn't handle the 0 (\000) character > well. A whole new channel has to be implemented, along with the logic > in the scp executable. So the short answer is to use SFTP, if you can. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From stefan@REDACTED Tue Mar 19 16:10:43 2013 From: stefan@REDACTED (Stefan Jahn) Date: Tue, 19 Mar 2013 16:10:43 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> Message-ID: <36a480137a631a0cb8b65c60864e6fac.squirrel@service.rules.org> Hello, it sounds like you have some experiences on that area. You were successfully implementing it using the ssh_cli option of ssh:daemon(), yes? I'll give it a try if anything happening in the module code when hooking it into ssh_cli. I can leave out shell option, as well as subsystems? Can I add e.g. {subsystems, [ssh_sftp:subsystem_spec([])]}} having the sftp server in parallel? Thank you, Stefan. On Tue, March 19, 2013 3:49 pm, Attila Rajmund Nohl wrote: > 2013/3/19 Stefan Jahn : >> Hello, >> >> this means, one should use >> >> ssh:daemon(..., ..., [ >> {shell, {Module, Function, Args}}, >> ...]) >> >> instead of >> ssh:daemon(..., ..., [ >> {subsystems, [subsystem_spec()]}, >> ...]) >> >> correct? > > No, unfortunately this is the one that won't work due to the group > swallowing the \000 characters. You should use > > ssh:daemon(..., ..., [ > {ssh_cli,{..., ...}}, > ...]) > > and your callback module has to implement the ssh_channel behaviour. > > [...] >> So, it will be impossible to implement it using the shell API? > > I think yes, we've never managed to get it work using the shell API. > From cloudzen@REDACTED Tue Mar 19 16:36:42 2013 From: cloudzen@REDACTED (skyman) Date: Tue, 19 Mar 2013 23:36:42 +0800 (CST) Subject: [erlang-questions] Port is included in erlang:ports(), but erlang:port_info(Port) returnes 'undefined' Message-ID: <7cefc809.103ee.13d834b9756.Coremail.cloudzen@163.com> Hi everyone, I encounter a problem: While server socket is sending packets, client socket closes, then I find the socket's send_pend( inet:getstat(Socket, [send_pend]) ) is always > 0, that is some data isn't sent out. After closing the port, I find the port is still included in erlang:ports(), but erlang:port_info(Port) returnes 'undefined'. I guess that because the port's send queue is not empty, the erts set the port's status to be ERTS_PORT_SFLG_CLOSING, so the results between erlang:ports() and erlang:port_info() are inconsistent. The code: void erts_do_exit_port(Port *p, Eterm from, Eterm reason) { ... if ((reason != am_kill) && !is_port_ioq_empty(p)) { erts_port_status_bandor_set(p, ~ERTS_PORT_SFLG_EXITING, /* must turn it off */ ERTS_PORT_SFLG_CLOSING); flush_port(p); } ... } The problem can only exist with TCP option: {delay_send, true}. When set {delay_send, false}, the problem disappears. In addition, on this occasion erlang:halt() cannot terminate the node, have to use erlang:halt(Status, [{flush,false}]). Can anyone help me? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Tue Mar 19 18:23:49 2013 From: klacke@REDACTED (Claes Wikstrom) Date: Tue, 19 Mar 2013 18:23:49 +0100 Subject: [erlang-questions] yaws 1.96 Message-ID: <51489F25.7090508@hyber.org> Folks, we have a brand new tested release, Happy to announce yaws 1.96, lots of websocket work as well as HTTP header work went into this release. Code and docs as usual at http://yaws.hyber.org Enjoy - klacke/steve/capflam From garret.smith@REDACTED Tue Mar 19 19:10:09 2013 From: garret.smith@REDACTED (Garret Smith) Date: Tue, 19 Mar 2013 11:10:09 -0700 Subject: [erlang-questions] link/1 appears to interfere with message sending In-Reply-To: References: Message-ID: The Javadoc of OtpMsg.type() is what you're looking for. The Java node is receiving a notification of the process link. This message type has no "payload", so getMsg() fails with NPE. Before calling getMsg(), check the message type with msg.type(). -Garret Smith On Fri, Mar 15, 2013 at 11:15 PM, J David Eisenberg < jdavid.eisenberg@REDACTED> wrote: > I have written a test program that connects Erlang and Java as follows: > 1) Erlang module spawns a Java program via open_port/2. > 2) Erlang then uses the port to send Java the Erlang node name. > 3) The Java program uses that information to open a connection to Erlang. > 4) Java sends back the pid of the Java program, then awaits a message > from Erlang > 5) Erlang sends back an acknowledgment to Java, and... > 6) Java sends back a final message to Erlang. > > Here is the Java code with debugging output in Test.java > //========================== > import com.ericsson.otp.erlang.*; > import java.io.BufferedInputStream; > import java.io.BufferedReader; > import java.io.InputStreamReader; > > public class Test > { > public static void main(String[] args) > { > OtpSelf self; > OtpConnection connection; > OtpPeer erlangPeer; > OtpErlangObject [] elements = new OtpErlangObject[2]; > OtpMsg message; > OtpErlangObject obj; > OtpErlangTuple tuple; > OtpErlangPid erlangPid; > String erlangAtom; > > try > { > self = new OtpSelf("java"); > BufferedReader input = new BufferedReader(new InputStreamReader( > System.in)); > String erlNodeName = input.readLine(); > System.err.println("Erlang node is |" + erlNodeName + "|\r"); > > erlangPeer = new OtpPeer(erlNodeName); > > connection = self.connect(erlangPeer); > System.err.println("Connection to " + erlangPeer + " " + > connection + "\r"); > > elements[0] = new OtpErlangAtom("sent_from_java"); > elements[1] = connection.self().pid(); > connection.send("testing", new OtpErlangTuple(elements)); > > message = connection.receiveMsg(); > System.err.println("Java received message " + message + "\r"); > obj = message.getMsg(); > tuple = (OtpErlangTuple) obj; > erlangAtom = ((OtpErlangAtom) tuple.elementAt(0)).atomValue(); > erlangPid = (OtpErlangPid) tuple.elementAt(1); > System.err.println("Java received " + erlangAtom + " " + > erlangPid + "\r"); > > connection.send("testing", new OtpErlangAtom("goodbye")); > } > catch (Exception e) > { > System.err.println("Java gets exception" + "\r"); > e.printStackTrace(System.err); > } > } > } > //=========================== > > And here is the Erlang module, test.erl: > %===================== > -module(test). > -export([go/0,test/0]). > > go() -> > Pid = spawn(?MODULE, test, []), > register(testing, Pid), > io:format("Erlang spawns test process with pid ~p~n", [Pid]), > process_flag(trap_exit, true), > Port = open_port({spawn, "java -cp > .:/usr/lib/erlang/lib/jinterface-1.5.6/priv/OtpErlang.jar:core.jar > Test"}, > [{line, 256}]), > > % send my node name to the Java program. > port_command(Port, list_to_binary(atom_to_list(node()) ++ "\n" )), > test(). > > test() -> > receive > % get the pid of the Java process > {Atom, Pid} -> > io:format("Erlang receives: ~p ~p~n", [Atom, Pid]), > > %%% link(Pid), % let me know if Java crashes.. > > Pid ! {sent_from_erlang, self()}, % and send it a message > test(); % then wait for another message > Other -> > io:format("Erlang receives ~p~n", [Other]) > end. > %====================== > > This all works great until I uncomment the ilne with the %%% > link(Pid). If I do that, then, when I send the message to Java, it > says: > > java.lang.NullPointerException > at com.ericsson.otp.erlang.OtpMsg.getMsg(OtpMsg.java:212) > at Test.main(Test.java:39) > > If I link to the Port instead of the Pid, everything works. I'm > clearly overlooking some simple concept; what is it? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jdavid.eisenberg@REDACTED Tue Mar 19 19:13:19 2013 From: jdavid.eisenberg@REDACTED (J David Eisenberg) Date: Tue, 19 Mar 2013 11:13:19 -0700 Subject: [erlang-questions] link/1 appears to interfere with message sending In-Reply-To: References: Message-ID: On Tue, Mar 19, 2013 at 11:10 AM, Garret Smith wrote: > The Javadoc of OtpMsg.type() is what you're looking for. > > The Java node is receiving a notification of the process link. This message > type has no "payload", so getMsg() fails with NPE. Before calling getMsg(), > check the message type with msg.type(). > Ah, that explains it! Thank you very much. > -Garret Smith > > > On Fri, Mar 15, 2013 at 11:15 PM, J David Eisenberg > wrote: >> >> I have written a test program that connects Erlang and Java as follows: >> 1) Erlang module spawns a Java program via open_port/2. >> 2) Erlang then uses the port to send Java the Erlang node name. >> 3) The Java program uses that information to open a connection to Erlang. >> 4) Java sends back the pid of the Java program, then awaits a message >> from Erlang >> 5) Erlang sends back an acknowledgment to Java, and... >> 6) Java sends back a final message to Erlang. >> >> Here is the Java code with debugging output in Test.java >> //========================== >> import com.ericsson.otp.erlang.*; >> import java.io.BufferedInputStream; >> import java.io.BufferedReader; >> import java.io.InputStreamReader; >> >> public class Test >> { >> public static void main(String[] args) >> { >> OtpSelf self; >> OtpConnection connection; >> OtpPeer erlangPeer; >> OtpErlangObject [] elements = new OtpErlangObject[2]; >> OtpMsg message; >> OtpErlangObject obj; >> OtpErlangTuple tuple; >> OtpErlangPid erlangPid; >> String erlangAtom; >> >> try >> { >> self = new OtpSelf("java"); >> BufferedReader input = new BufferedReader(new InputStreamReader( >> System.in)); >> String erlNodeName = input.readLine(); >> System.err.println("Erlang node is |" + erlNodeName + "|\r"); >> >> erlangPeer = new OtpPeer(erlNodeName); >> >> connection = self.connect(erlangPeer); >> System.err.println("Connection to " + erlangPeer + " " + >> connection + "\r"); >> >> elements[0] = new OtpErlangAtom("sent_from_java"); >> elements[1] = connection.self().pid(); >> connection.send("testing", new OtpErlangTuple(elements)); >> >> message = connection.receiveMsg(); >> System.err.println("Java received message " + message + "\r"); >> obj = message.getMsg(); >> tuple = (OtpErlangTuple) obj; >> erlangAtom = ((OtpErlangAtom) tuple.elementAt(0)).atomValue(); >> erlangPid = (OtpErlangPid) tuple.elementAt(1); >> System.err.println("Java received " + erlangAtom + " " + >> erlangPid + "\r"); >> >> connection.send("testing", new OtpErlangAtom("goodbye")); >> } >> catch (Exception e) >> { >> System.err.println("Java gets exception" + "\r"); >> e.printStackTrace(System.err); >> } >> } >> } >> //=========================== >> >> And here is the Erlang module, test.erl: >> %===================== >> -module(test). >> -export([go/0,test/0]). >> >> go() -> >> Pid = spawn(?MODULE, test, []), >> register(testing, Pid), >> io:format("Erlang spawns test process with pid ~p~n", [Pid]), >> process_flag(trap_exit, true), >> Port = open_port({spawn, "java -cp >> .:/usr/lib/erlang/lib/jinterface-1.5.6/priv/OtpErlang.jar:core.jar >> Test"}, >> [{line, 256}]), >> >> % send my node name to the Java program. >> port_command(Port, list_to_binary(atom_to_list(node()) ++ "\n" )), >> test(). >> >> test() -> >> receive >> % get the pid of the Java process >> {Atom, Pid} -> >> io:format("Erlang receives: ~p ~p~n", [Atom, Pid]), >> >> %%% link(Pid), % let me know if Java crashes.. >> >> Pid ! {sent_from_erlang, self()}, % and send it a message >> test(); % then wait for another message >> Other -> >> io:format("Erlang receives ~p~n", [Other]) >> end. >> %====================== >> >> This all works great until I uncomment the ilne with the %%% >> link(Pid). If I do that, then, when I send the message to Java, it >> says: >> >> java.lang.NullPointerException >> at com.ericsson.otp.erlang.OtpMsg.getMsg(OtpMsg.java:212) >> at Test.main(Test.java:39) >> >> If I link to the Port instead of the Pid, everything works. I'm >> clearly overlooking some simple concept; what is it? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From bryan@REDACTED Tue Mar 19 22:04:26 2013 From: bryan@REDACTED (Bryan Hughes) Date: Tue, 19 Mar 2013 14:04:26 -0700 Subject: [erlang-questions] Hiding user input in escript Message-ID: <5148D2DA.6080604@go-factory.net> Hi Everyone, I found this old thread from 2009 about trying to hide user input in an escript (e.g. entering a password). http://erlang.org/pipermail/erlang-questions/2009-April/043311.html It concluded with: > The problem seems to be that escript uses the old shell, which > does not support any way to control the terminal. > > We'll have a look at escript for the next release and see whether > it would be possible to have it run with the standard shell. Does anyone know if this has been fixed. I looked through the docs and do not find io:get_password/0, or any options for reading stdin to not echo the characters back. Looking forward to meeting those of you attending Erlang Factory in a couple of days. Cheers, B -- Bryan Hughes *Go Factory* http://www.go-factory.net /"Art is never finished, only abandoned. - Leonardo da Vinci"/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Tue Mar 19 23:17:06 2013 From: bob@REDACTED (Bob Ippolito) Date: Tue, 19 Mar 2013 15:17:06 -0700 Subject: [erlang-questions] Hiding user input in escript In-Reply-To: <5148D2DA.6080604@go-factory.net> References: <5148D2DA.6080604@go-factory.net> Message-ID: I see io:get_password() in my io module in R15B03, but it doesn't appear to work with escript because it uses the old 'user' rather than 'group' which doesn't understand the get_password io request. Haven't looked at R16B yet. On Tue, Mar 19, 2013 at 2:04 PM, Bryan Hughes wrote: > Hi Everyone, > > I found this old thread from 2009 about trying to hide user input in an > escript (e.g. entering a password). > > http://erlang.org/pipermail/erlang-questions/2009-April/043311.html > > It concluded with: > > The problem seems to be that escript uses the old shell, which > does not support any way to control the terminal. > > We'll have a look at escript for the next release and see whether > it would be possible to have it run with the standard shell. > > > Does anyone know if this has been fixed. I looked through the docs and do > not find io:get_password/0, or any options for reading stdin to not echo > the characters back. > > Looking forward to meeting those of you attending Erlang Factory in a > couple of days. > > Cheers, > B > > -- > > Bryan Hughes > *Go Factory* > http://www.go-factory.net > > *"Art is never finished, only abandoned. - Leonardo da Vinci"* > > > > _______________________________________________ > 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 Wed Mar 20 00:01:45 2013 From: bob@REDACTED (Bob Ippolito) Date: Tue, 19 Mar 2013 16:01:45 -0700 Subject: [erlang-questions] Hiding user input in escript In-Reply-To: References: <5148D2DA.6080604@go-factory.net> Message-ID: R16B does not change anything for escript as far as I can tell. On Tue, Mar 19, 2013 at 3:17 PM, Bob Ippolito wrote: > I see io:get_password() in my io module in R15B03, but it doesn't appear > to work with escript because it uses the old 'user' rather than 'group' > which doesn't understand the get_password io request. Haven't looked at > R16B yet. > > > > On Tue, Mar 19, 2013 at 2:04 PM, Bryan Hughes wrote: > >> Hi Everyone, >> >> I found this old thread from 2009 about trying to hide user input in an >> escript (e.g. entering a password). >> >> http://erlang.org/pipermail/erlang-questions/2009-April/043311.html >> >> It concluded with: >> >> The problem seems to be that escript uses the old shell, which >> does not support any way to control the terminal. >> >> We'll have a look at escript for the next release and see whether >> it would be possible to have it run with the standard shell. >> >> >> Does anyone know if this has been fixed. I looked through the docs and >> do not find io:get_password/0, or any options for reading stdin to not echo >> the characters back. >> >> Looking forward to meeting those of you attending Erlang Factory in a >> couple of days. >> >> Cheers, >> B >> >> -- >> >> Bryan Hughes >> *Go Factory* >> http://www.go-factory.net >> >> *"Art is never finished, only abandoned. - Leonardo da Vinci"* >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan@REDACTED Wed Mar 20 00:03:21 2013 From: stefan@REDACTED (Stefan Jahn) Date: Wed, 20 Mar 2013 00:03:21 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> <36a480137a631a0cb8b65c60864e6fac.squirrel@service.rules.org> Message-ID: Hello, after some experiments I ended up with a working file transfer from standard scp command to my erlang scp daemon. Thank you for the hint with ssh_cli option. Now, I have a question about the connection / channel within the ssh_channel messages (handle_ssh_msg). How do I get the user login name from this scope? Thank you in advance, Stefan. On Tue, March 19, 2013 4:38 pm, Attila Rajmund Nohl wrote: > Hello! > > You can add the subsystem options, they are orthogonal to the cli > option. I'm not sure about the shell though, at least in our > implementation the shell option was omitted. > > 2013/3/19 Stefan Jahn : >> Hello, >> >> it sounds like you have some experiences on that area. >> >> You were successfully implementing it using the ssh_cli option >> of ssh:daemon(), yes? >> >> I'll give it a try if anything happening in the module >> code when hooking it into ssh_cli. >> >> I can leave out shell option, as well as subsystems? >> >> Can I add e.g. {subsystems, [ssh_sftp:subsystem_spec([])]}} having >> the sftp server in parallel? >> >> Thank you, >> Stefan. >> >> On Tue, March 19, 2013 3:49 pm, Attila Rajmund Nohl wrote: >>> 2013/3/19 Stefan Jahn : >>>> Hello, >>>> >>>> this means, one should use >>>> >>>> ssh:daemon(..., ..., [ >>>> {shell, {Module, Function, Args}}, >>>> ...]) >>>> >>>> instead of >>>> ssh:daemon(..., ..., [ >>>> {subsystems, [subsystem_spec()]}, >>>> ...]) >>>> >>>> correct? >>> >>> No, unfortunately this is the one that won't work due to the group >>> swallowing the \000 characters. You should use >>> >>> ssh:daemon(..., ..., [ >>> {ssh_cli,{..., ...}}, >>> ...]) >>> >>> and your callback module has to implement the ssh_channel behaviour. >>> >>> [...] >>>> So, it will be impossible to implement it using the shell API? >>> >>> I think yes, we've never managed to get it work using the shell API. From bryan@REDACTED Wed Mar 20 00:08:11 2013 From: bryan@REDACTED (Bryan Hughes) Date: Tue, 19 Mar 2013 16:08:11 -0700 Subject: [erlang-questions] Hiding user input in escript In-Reply-To: References: <5148D2DA.6080604@go-factory.net> Message-ID: <5148EFDB.8040909@go-factory.net> Hi Bob, Thanks for checking it out! Guess not too many people are writing scripts that need to deal with passwords. I will go ahead and submit it as a bug. Cheers, Bryan On 3/19/13 4:01 PM, Bob Ippolito wrote: > R16B does not change anything for escript as far as I can tell. > > On Tue, Mar 19, 2013 at 3:17 PM, Bob Ippolito > wrote: > > I see io:get_password() in my io module in R15B03, but it doesn't > appear to work with escript because it uses the old 'user' rather > than 'group' which doesn't understand the get_password io request. > Haven't looked at R16B yet. > > > > On Tue, Mar 19, 2013 at 2:04 PM, Bryan Hughes > > wrote: > > Hi Everyone, > > I found this old thread from 2009 about trying to hide user > input in an escript (e.g. entering a password). > > http://erlang.org/pipermail/erlang-questions/2009-April/043311.html > > It concluded with: >> The problem seems to be that escript uses the old shell, which >> does not support any way to control the terminal. >> >> We'll have a look at escript for the next release and see whether >> it would be possible to have it run with the standard shell. > > Does anyone know if this has been fixed. I looked through the > docs and do not find io:get_password/0, or any options for > reading stdin to not echo the characters back. > > Looking forward to meeting those of you attending Erlang > Factory in a couple of days. > > Cheers, > B > > -- > > Bryan Hughes > *Go Factory* > http://www.go-factory.net > > /"Art is never finished, only abandoned. - Leonardo da Vinci"/ > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -- Bryan Hughes CTO and Founder / *Go Factory* (415) 515-7916 http://www.go-factory.net /"Art is never finished, only abandoned. - Leonardo da Vinci"/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Mar 20 00:11:07 2013 From: bob@REDACTED (Bob Ippolito) Date: Tue, 19 Mar 2013 16:11:07 -0700 Subject: [erlang-questions] Hiding user input in escript In-Reply-To: <5148EFDB.8040909@go-factory.net> References: <5148D2DA.6080604@go-factory.net> <5148EFDB.8040909@go-factory.net> Message-ID: You can probably get around it by not using escript and just booting up a compiled beam that does what you want... "erl -noinput -noshell -s user_drv" seems to start a shell that can handle io:get_password(), so you could poke inside user_drv and see how to start up user_drv and your script without the shell. On Tue, Mar 19, 2013 at 4:08 PM, Bryan Hughes wrote: > Hi Bob, > > Thanks for checking it out! Guess not too many people are writing scripts > that need to deal with passwords. I will go ahead and submit it as a bug. > > Cheers, > Bryan > > > On 3/19/13 4:01 PM, Bob Ippolito wrote: > > R16B does not change anything for escript as far as I can tell. > > On Tue, Mar 19, 2013 at 3:17 PM, Bob Ippolito wrote: > >> I see io:get_password() in my io module in R15B03, but it doesn't appear >> to work with escript because it uses the old 'user' rather than 'group' >> which doesn't understand the get_password io request. Haven't looked at >> R16B yet. >> >> >> >> On Tue, Mar 19, 2013 at 2:04 PM, Bryan Hughes wrote: >> >>> Hi Everyone, >>> >>> I found this old thread from 2009 about trying to hide user input in an >>> escript (e.g. entering a password). >>> >>> http://erlang.org/pipermail/erlang-questions/2009-April/043311.html >>> >>> It concluded with: >>> >>> The problem seems to be that escript uses the old shell, which >>> does not support any way to control the terminal. >>> >>> We'll have a look at escript for the next release and see whether >>> it would be possible to have it run with the standard shell. >>> >>> >>> Does anyone know if this has been fixed. I looked through the docs and >>> do not find io:get_password/0, or any options for reading stdin to not echo >>> the characters back. >>> >>> Looking forward to meeting those of you attending Erlang Factory in a >>> couple of days. >>> >>> Cheers, >>> B >>> >>> -- >>> >>> Bryan Hughes >>> *Go Factory* >>> http://www.go-factory.net >>> >>> *"Art is never finished, only abandoned. - Leonardo da Vinci"* >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > > -- > > Bryan Hughes > CTO and Founder / *Go Factory* > (415) 515-7916 > > http://www.go-factory.net > > *"Art is never finished, only abandoned. - Leonardo da Vinci"* > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy@REDACTED Wed Mar 20 00:14:14 2013 From: jeremy@REDACTED (Jeremy Ong) Date: Tue, 19 Mar 2013 16:14:14 -0700 Subject: [erlang-questions] Hiding user input in escript In-Reply-To: References: <5148D2DA.6080604@go-factory.net> <5148EFDB.8040909@go-factory.net> Message-ID: As a workaround, is it possible to do this in os:cmd using stty -echo? On Tue, Mar 19, 2013 at 4:11 PM, Bob Ippolito wrote: > You can probably get around it by not using escript and just booting up a > compiled beam that does what you want... "erl -noinput -noshell -s > user_drv" seems to start a shell that can handle io:get_password(), so you > could poke inside user_drv and see how to start up user_drv and your script > without the shell. > > > On Tue, Mar 19, 2013 at 4:08 PM, Bryan Hughes wrote: > >> Hi Bob, >> >> Thanks for checking it out! Guess not too many people are writing >> scripts that need to deal with passwords. I will go ahead and submit it as >> a bug. >> >> Cheers, >> Bryan >> >> >> On 3/19/13 4:01 PM, Bob Ippolito wrote: >> >> R16B does not change anything for escript as far as I can tell. >> >> On Tue, Mar 19, 2013 at 3:17 PM, Bob Ippolito wrote: >> >>> I see io:get_password() in my io module in R15B03, but it doesn't appear >>> to work with escript because it uses the old 'user' rather than 'group' >>> which doesn't understand the get_password io request. Haven't looked at >>> R16B yet. >>> >>> >>> >>> On Tue, Mar 19, 2013 at 2:04 PM, Bryan Hughes wrote: >>> >>>> Hi Everyone, >>>> >>>> I found this old thread from 2009 about trying to hide user input in an >>>> escript (e.g. entering a password). >>>> >>>> http://erlang.org/pipermail/erlang-questions/2009-April/043311.html >>>> >>>> It concluded with: >>>> >>>> The problem seems to be that escript uses the old shell, which >>>> does not support any way to control the terminal. >>>> >>>> We'll have a look at escript for the next release and see whether >>>> it would be possible to have it run with the standard shell. >>>> >>>> >>>> Does anyone know if this has been fixed. I looked through the docs and >>>> do not find io:get_password/0, or any options for reading stdin to not echo >>>> the characters back. >>>> >>>> Looking forward to meeting those of you attending Erlang Factory in a >>>> couple of days. >>>> >>>> Cheers, >>>> B >>>> >>>> -- >>>> >>>> Bryan Hughes >>>> *Go Factory* >>>> http://www.go-factory.net >>>> >>>> *"Art is never finished, only abandoned. - Leonardo da Vinci"* >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >> >> -- >> >> Bryan Hughes >> CTO and Founder / *Go Factory* >> (415) 515-7916 >> >> http://www.go-factory.net >> >> *"Art is never finished, only abandoned. - Leonardo da Vinci"* >> >> >> > > _______________________________________________ > 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 Mar 20 09:20:02 2013 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 20 Mar 2013 09:20:02 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> <36a480137a631a0cb8b65c60864e6fac.squirrel@service.rules.org> Message-ID: Hi! 2013/3/20, Stefan Jahn : > Hello, > > after some experiments I ended up with a working file transfer from > standard scp command to my erlang scp daemon. > > Thank you for the hint with ssh_cli option. > > Now, I have a question about the connection / channel within the > ssh_channel messages (handle_ssh_msg). How do I get the user login > name from this scope? Well the cli option is the least mature part of the ssh application. The standard cli uses ssh_userreg:lookup_user/1 (ssh_cli.erl) which is not a a documented function at the moment. We are interested in your experiences for future improvment work. >>> Can I add e.g. {subsystems, [ssh_sftp:subsystem_spec([])]}} having >>> the sftp server in parallel? Yes you can have subsystems in parallell to a cli-implementation (cli option) or shell adaptation (shell option). Regards Ingela Erlang/OTP team Ericsson AB From pan@REDACTED Wed Mar 20 09:38:27 2013 From: pan@REDACTED (Patrik Nyblom) Date: Wed, 20 Mar 2013 09:38:27 +0100 Subject: [erlang-questions] erlang:halt() cannot terminate the Erlang VM In-Reply-To: References: <4618e4db.21a02.13d690cf003.Coremail.cloudzen@163.com> <514736F8.4040807@erlang.org> Message-ID: <51497583.6070708@erlang.org> On 03/18/2013 05:03 PM, Bohuslav Svancara wrote: > >>What version of OTP are you using and on what platform? Erlang:halt > only stops for flushing I/O of stdin/stdout. That has changed slightly > in later releases. Is >>pending I/O something that could be the cause > in your case? > > Huh. Am I understand well that if I will not send anything to stdout > then erlang:halt() will not work? No, I meant that if there *is* pending I/O (write requests) on e.g. stdout, it will try to flush taht before exiting. If ther is no pending I/O, it will just exit. > > > > 2013/3/18 Patrik Nyblom > > > Hi! > > On 03/14/2013 02:18 PM, skyman wrote: >> Hi all, >> I encounter this problem: erlang:halt() cannot terminate the >> Erlang VM. Then I user "kill -USR1 erlpid" to kill the Erlang VM >> process, and get an Erlang crash dump, it indicates that there >> are some "Scheduled" processes. >> I want to know under what cases erlang:halt() cannot terminate >> the Erlang VM, for example, existing "Scheduled" processes? >> Thanks in advance! >> > What version of OTP are you using and on what platform? > Erlang:halt only stops for flushing I/O of stdin/stdout. That has > changed slightly in later releases. Is pending I/O something that > could be the cause in your case? >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > Cheers, > /Patrik > > _______________________________________________ > 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 Cheers, /Patrik -------------- next part -------------- An HTML attachment was scrubbed... URL: From anotherworldofworld@REDACTED Wed Mar 20 14:00:20 2013 From: anotherworldofworld@REDACTED (Alex toyer) Date: Wed, 20 Mar 2013 19:00:20 +0600 Subject: [erlang-questions] crypto:start/0 eroor Message-ID: Hello, I built and installed Erlang R15B. Now i run erlang shell and try to execute crypto:start(), but get erorr: =ERROR REPORT==== 20-Mar-2013::18:58:35 === Unable to load crypto library. Failed with error: "load_failed, Failed to load NIF library: '/usr/local/lib/erlang/lib/crypto-2.3/priv/lib/crypto.so: undefined symbol: enif_dlsym'" OpenSSL might not be installed on this system. =ERROR REPORT==== 20-Mar-2013::18:58:35 === The on_load function for module crypto returned {error, {load_failed,"Failed to load NIF library: '/usr/local/lib/erlang/lib/crypto-2.3/priv/lib/crypto.so: undefined symbol: enif_dlsym'"}} ** exception error: undefined function crypto:start/0 I built erlang with: ./configure --with-ssl -with-ssl=/usr/include/openssl && make && make install How can i fix it? -- best regards, twitter: @0xAX github: 0xAX -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Wed Mar 20 14:11:53 2013 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Wed, 20 Mar 2013 14:11:53 +0100 Subject: [erlang-questions] crypto:start/0 eroor In-Reply-To: References: Message-ID: <5149B599.6020004@erix.ericsson.se> Alex toyer wrote: > Hello, > > I built and installed Erlang R15B. Now i run erlang shell and try to > execute crypto:start(), but get erorr: > > =ERROR REPORT==== 20-Mar-2013::18:58:35 === > Unable to load crypto library. Failed with error: > "load_failed, Failed to load NIF library: > '/usr/local/lib/erlang/lib/crypto-2.3/priv/lib/crypto.so: undefined symbol: > enif_dlsym'" > OpenSSL might not be installed on this system. > > =ERROR REPORT==== 20-Mar-2013::18:58:35 === > The on_load function for module crypto returned {error, > {load_failed,"Failed to load NIF library: > '/usr/local/lib/erlang/lib/crypto-2.3/priv/lib/crypto.so: undefined symbol: > enif_dlsym'"}} > ** exception error: undefined function crypto:start/0 > > I built erlang with: > > ./configure --with-ssl -with-ssl=/usr/include/openssl && make && make > install > > How can i fix it? > > You are using crypto from R16 on an R15 emulator. /Sverker, Erlang/OTP Ericsson From rvg.mailing@REDACTED Wed Mar 20 18:08:49 2013 From: rvg.mailing@REDACTED (Rudolph van Graan) Date: Wed, 20 Mar 2013 17:08:49 +0000 Subject: [erlang-questions] Diameter client issue Message-ID: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Hi there, I'm trying to start up the Erlang diameter demo application shipped with Erlang/OTP. The issue is that, no matter what format I try, I can't get the client to connect to a remote diameter server. In that example, I started the application as follows: > 3> diameter:start(), client:start(). > ok > > 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > {ok,#Ref<0.0.0.643>} > > 7> client:call(). > {error,no_connection} Here, my local IP address is {10,151,0,166} and the remote one is {10,249,20,174}. TCP to the server is working: > telnet 10.249.20.174 3868 > Trying 10.249.20.174... > Connected to 10.249.20.174. > Escape character is '^]'. I traced diameter_tcp and I can see that it is getting a badarg error somewhere: > (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > [{10,151,0,166}]} > (<0.116.0>) call diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > (<0.116.0>) call diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > (<0.116.0>) returned from diameter_tcp:m/2 -> ok Does anyone have an idea what I am doing wrong? My feeling is that it has to do with the local ip address. I don't understand why I even need to supply a local IP address and the documentation isn't very clear. Thanks, Rudolph Here is the trace: (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) returned from diameter_tcp:i/1 -> {monitor,<0.114.0>,<0.115.0>} (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, {ip,{10,151,0,166}}, {raddr,{10,249,20,174}}, {rport,3868}, {reuseaddr,true}]) (<0.115.0>) call diameter_tcp:ssl_opts([]) (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, [{ssl,false}, {ip,{10,151,0,166}}, {raddr,{10,249,20,174}}, {rport,3868}, {reuseaddr,true}]} (<0.115.0>) call diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, {ip,{10,151,0,166}}, {raddr,{10,249,20,174}}, {rport,3868}, {reuseaddr,true}],[]) (<0.115.0>) call diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, {ip,{10,151,0,166}}, {raddr,{10,249,20,174}}, {rport,3868}, {reuseaddr,true}],[]) (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 (<0.115.0>) call diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, {packet,0}, {active,once}, {ip,{10,151,0,166}}, {ssl,false}, {reuseaddr,true}] (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, [{10,151,0,166}]} (<0.115.0>) call diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, {packet,0}, {active,once}, {ip,{10,151,0,166}}, {ssl,false}, {reuseaddr,true}]) (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, [{10,151,0,166}]} (<0.116.0>) call diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) call diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) returned from diameter_tcp:m/2 -> ok (<0.116.0>) call diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) (<0.116.0>) call diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddosia@REDACTED Wed Mar 20 20:20:21 2013 From: ddosia@REDACTED (Daniil Churikov) Date: Wed, 20 Mar 2013 12:20:21 -0700 (PDT) Subject: [erlang-questions] Multiple common_test test case execution with different configs Message-ID: I use common test framework to check some tricky scenarios. Suppose that I wrote test case which intended to check user registration process: check_user_registration(Config) -> UserSpec = proplists:get_value(user, Config), ok = do_register(UserSpec). UserSpec contains several fields(name, email, login, password etc.). Now I want to check user registration with different UserSpecs, with long login, with utf8 name or weak password. The idea is to generate different Config variables with different combination of such properties and somehow tell CT execute test case with those configs: all() -> [{check_user_registration, Config1}, ... {check_user_registration, ConfigN}]. But I cant figure out how to do this. My first approach was to use groups [1] for this. They could be generated from Module:groups/0 [2] and allow dynamically change number of testcases and/or groups to be executed. Still, their definition contains order of execution and other useful properties, but not actual Config. [1] http://www.erlang.org/doc/apps/common_test/write_test_chapter.html#id71944 [2] http://www.erlang.org/doc/man/common_test.html#Module:groups-0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From gabre@REDACTED Thu Mar 21 01:57:15 2013 From: gabre@REDACTED (=?iso-8859-2?b?SG9zc3r6IA==?= =?iso-8859-2?b?R+Fib3I=?=) Date: Thu, 21 Mar 2013 01:57:15 +0100 Subject: [erlang-questions] wxStyledTextCtrl and numbered lines, custom margin Message-ID: <20130321015715.164133wg5zrif65n@webmail.elte.hu> Hello, I have been writing a GUI application using wxErlang and I would like to do the following: I have a wxStyledTextCtrl and I want the lines to be numbered, but not from 1, but from N (which usually not equals 1). I tried the trivial solution, adding some empty lines with "\n" and hiding those lines, but according to my experiences and wxStyledTextCtrl/Scintilla docs hiding the first line is impossible. On wx forums some programmers suggested me the following function: http://docs.wxwidgets.org/trunk/classwx_styled_text_ctrl.html#ad66c7d820d12a5cc6f82aa72935fbbea (marginsettext) but this function is not implemented in wxErlang. What should I do now? Should I write some C++ code or...? I dont really know the inner structure of the wxErlang modules, I am just a user of them. Thank you in advance, Gabor Hosszu From erlangprogram@REDACTED Thu Mar 21 02:55:37 2013 From: erlangprogram@REDACTED (S X) Date: Wed, 20 Mar 2013 21:55:37 -0400 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hello, Sorry, I still have some problems with sending CCR/CCA messages. I didn't quite get how to configure multiple diameter applications though it seems clear when I read the diameter protocol. Based on the sample diameter code, I made the following changes, diameter_gen_base_rfc4006_cc is the dictionary generated with rfc4006_cc.dia: $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -define(SVC_NAME, ?MODULE). -define(APP_ALIAS, ?MODULE). -define(CALLBACK_MOD, client_cb). -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). -define(L, atom_to_list). -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, {'Origin-Realm', "example.com"}, {'Vendor-Id', 0}, {'Product-Name', "Client"}, {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, {application, [{alias, ?APP_ALIAS}, {dictionary, ?DIAMETER_DICT_CCRA}, {module, ?CALLBACK_MOD}]}]). $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). init(State) -> SvcName = ?MODULE, SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".example.com"}, {'Origin-Realm', "example.com"}, {'Vendor-Id', 193}, {'Product-Name', "Server"}, {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, {application, [{alias, ?MODULE}, {dictionary, ?DIAMETER_DICT_CCRA}, {module, server_cb}]}], TransportOpts = [{transport_module, diameter_tcp}, {transport_config, [{reuseaddr, true}, {ip, {127,0,0,1}}, {port, 3868}]}], diameter:start(), diameter:start_service(SvcName, SvcOpts), diameter:add_transport(SvcName, {listen, TransportOpts}), erlang:display("Set up diameter server completed!"), {ok, State}. I changed the callbacks client_cb and server_cb to handle CCR/CCA messages. However, I got the following errors "app_not_configured". It seems the configuration for applications is incorrect. How should I configure the service properly? My understanding is I want to reuse CER/CEA as default authorization application, but the erlang diameter doesn't explain how to do it. Or my understanding is incorrect at all. =ERROR REPORT==== 20-Mar-2013::21:40:50 === ** Generic server <0.3841.0> terminating ** Last message in was {diameter, {recv, <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, 101,110,116,46,101,120,97,109,112,108,101, 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, 120,97,109,112,108,101,46,99,111,109,0,0,0, 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, 0>>}} ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, diameter_gen_base_rfc3588, {diameter_service,<0.50.0>, {diameter_caps,"server.example.com", "example.com", [{127,0,0,1}], 193,"Server",[],[], [0], [],[],[],[],[]}, [{diameter_app,server, diameter_gen_base_rfc4006_cc, [server_cb], server,4,false, [{answer_errors,report}, {request_errors,answer_3xxx}]}]}, false,exit} ** Reason for termination == ** {{badmatch,{error,{app_not_configured,0}}}, [{diameter_peer_fsm,recv_CER,2, [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, {diameter_peer_fsm,build_answer,3, [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, {diameter_peer_fsm,send_answer,3, [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, {diameter_peer_fsm,handle_info,2, [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} Could you give me some hints on this issue? The erlang debugger is not easy to use and call stack information is hard to read (when I show the trace window, all the buttons for step/next/continue become invisible). The diameter guidance explains the concept but no clear steps about configuration. Many thanks! Samuel On Tue, Mar 12, 2013 at 12:10 PM, S X wrote: > Hello, Anders & Andre, > > Thanks a lot for your quick responses and suggestions, which help me start > to exploring Erlang world ^_^ > > I was able to generate based on the file rfc4006_cc.dia under the > diameter/examples/dict folders. And understand a bit why and how Erlang > diameter protocol dictionaries are organized and maintained. > > Many thanks and talk to you later! > > Samuel > > > On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson wrote: > >> Btw, there's an RFC 4006 dictionary (and a few more) under >> diameter/examples/dict in the repo. >> >> /Anders, Erlang/OTP >> >> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf wrote: >> > Hello S(?) >> > >> > You have to come up with your own .dia file if the message types are >> > not covered in the .dia files provided by Erlang. Your own .dia file >> > will typically include the '@inherits diameter_gen_base_rfc3588' >> > clause which imports the basic avp's from rfc3588. You then have to >> > provide the missing avp's for your CCR/CCA message types, and also >> > define these messages. Thanks to the format of a .dia file it is >> > pretty much copy-pasting from the rfc4006. Once your .dia file is >> > ready, you use diameterc to generate the .erl and .hrl file. >> > >> > Hope that helped! >> > >> > BR/Andr? >> > >> > >> > >> > On 12 March 2013 04:58, S X wrote: >> >> Hello, >> >> >> >> I am new to Erlang and Diameter protocol. Wish someone could provide >> some >> >> suggestions on how to utilize the diameter library properly in Erlang. >> >> >> >> For example, I want to send/receive some Gx messages, like CCR (Credit >> >> Control Request), CCA(Credit Control Answer messages. But I notice that >> >> there are some predefined messages in erlang diameter library. As my >> >> understanding, should use the utility diameterc to generate erlang >> >> header/source files based on dia files. There are few dia files under >> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >> base_rfc3588.dia, >> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't >> have >> >> the definitions for Gx. >> >> >> >> How should I generate or where can I obtain dia files which have >> support for >> >> CCR/CCA message format? Are the dia files proprietary or manufacturer >> >> specific? Can I generate with the 3GPP spec? What are the proper steps? >> >> >> >> Thanks a lot! >> >> >> >> S >> >> >> >> >> >> _______________________________________________ >> >> 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 dangud@REDACTED Thu Mar 21 08:13:26 2013 From: dangud@REDACTED (Dan Gudmundsson) Date: Thu, 21 Mar 2013 08:13:26 +0100 Subject: [erlang-questions] wxStyledTextCtrl and numbered lines, custom margin In-Reply-To: <20130321015715.164133wg5zrif65n@webmail.elte.hu> References: <20130321015715.164133wg5zrif65n@webmail.elte.hu> Message-ID: wxStyledTextCtrl::MarginSetText is not available in wx-2.8.* it is only available in wx-2.9 so it's not something I would like to take in yet. The code generator is still based on 2.8 since that is what is available in most linux distributions. /Dan On Thu, Mar 21, 2013 at 1:57 AM, Hossz? G?bor wrote: > Hello, > > I have been writing a GUI application using wxErlang and I would like to do > the following: > I have a wxStyledTextCtrl and I want the lines to be numbered, but not from > 1, but from N (which usually not equals 1). I tried the trivial solution, > adding some empty lines with "\n" and hiding those lines, but according to > my experiences and wxStyledTextCtrl/Scintilla docs hiding the first line is > impossible. > On wx forums some programmers suggested me the following function: > http://docs.wxwidgets.org/trunk/classwx_styled_text_ctrl.html#ad66c7d820d12a5cc6f82aa72935fbbea > (marginsettext) > but this function is not implemented in wxErlang. What should I do now? > Should I write some C++ code or...? I dont really know the inner structure > of the wxErlang modules, I am just a user of them. > > Thank you in advance, > Gabor Hosszu > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From stefan@REDACTED Thu Mar 21 10:22:17 2013 From: stefan@REDACTED (Stefan Jahn) Date: Thu, 21 Mar 2013 10:22:17 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> <36a480137a631a0cb8b65c60864e6fac.squirrel@service.rules.org> Message-ID: Hello, thank you for your email. The ssh_userreg:lookup_user function returns me {ok, User} which is exactly what I needed. I called it with the connection manager argument passed to the ssh_channel_up message. I guess it will work for any other message as well. I have not yet tested the sftp subsystem in parallel, but the shell interface does not seem to be available any longer. Probably I need to take care of something in the ssh_cli ssh_channel implementation to be the shell still available? So far implementation of sink mode in the server has been done. If I do not want to use the scp command, but implement my own file operations, do I need to parse the exec command in order to e.g. find out about source/sink mode, correct? Thank you in advance, Stefan. On Wed, March 20, 2013 9:20 am, Ingela Andin wrote: > Hi! > > 2013/3/20, Stefan Jahn : >> Hello, >> >> after some experiments I ended up with a working file transfer from >> standard scp command to my erlang scp daemon. >> >> Thank you for the hint with ssh_cli option. >> >> Now, I have a question about the connection / channel within the >> ssh_channel messages (handle_ssh_msg). How do I get the user login >> name from this scope? > > Well the cli option is the least mature part of the ssh application. > The standard cli > uses ssh_userreg:lookup_user/1 (ssh_cli.erl) which is not a a > documented function at the moment. We are interested in your > experiences for future improvment work. > >>>> Can I add e.g. {subsystems, [ssh_sftp:subsystem_spec([])]}} having >>>> the sftp server in parallel? > > Yes you can have subsystems in parallell to a cli-implementation (cli > option) or shell adaptation (shell option). From jbothma@REDACTED Thu Mar 21 10:25:09 2013 From: jbothma@REDACTED (JD Bothma) Date: Thu, 21 Mar 2013 10:25:09 +0100 Subject: [erlang-questions] Multiple common_test test case execution with different configs In-Reply-To: References: Message-ID: You could try something like this: all() -> [ {group, GroupName} || GroupName <- group_names() ]. init_per_group(utf8_this, Config) -> [{user, this_user} | Config]; init_per_group(utf8_that, Config) -> [{user, that_user} | Config]. You can be more concise with something like init_epr_group(GroupName = UTF8Case, Config) -> [{user, utf_cases_user(UTF8Case)} | Config}]. This isn't ideal when you have groups unrelated to your utf8 cases, but can be solved :) On 20 March 2013 20:20, Daniil Churikov wrote: > I use common test framework to check some tricky scenarios. > Suppose that I wrote test case which intended to check user registration > process: > > check_user_registration(Config) -> > UserSpec = proplists:get_value(user, Config), > ok = do_register(UserSpec). > > UserSpec contains several fields(name, email, login, password etc.). > Now I want to check user registration with different UserSpecs, with long > login, > with utf8 name or weak password. > > The idea is to generate different Config variables with different > combination > of such properties and somehow tell CT execute test case with those > configs: > > all() -> [{check_user_registration, Config1}, ... > {check_user_registration, ConfigN}]. > > But I cant figure out how to do this. My first approach was to use groups > [1] for this. > They could be generated from Module:groups/0 [2] and allow dynamically > change number of testcases and/or groups to be executed. Still, their > definition > contains order of execution and other useful properties, but not actual > Config. > > [1] > http://www.erlang.org/doc/apps/common_test/write_test_chapter.html#id71944 > [2] http://www.erlang.org/doc/man/common_test.html#Module:groups-0 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon@REDACTED Thu Mar 21 13:37:57 2013 From: simon@REDACTED (Simon MacMullen) Date: Thu, 21 Mar 2013 12:37:57 +0000 Subject: [erlang-questions] Building from git without wx Message-ID: <514AFF25.6000502@rabbitmq.com> We build Erlang from git with: ./otp_build autoconf ./configure --prefix=... for lib in odbc wx ; do touch lib/${lib}/SKIP ; done make make install However, now that fails, with compilation of debugger exploding: compile: warnings being treated as errors dbg_wx_filedialog_win.erl:21: behaviour wx_object undefined make[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 make[3]: Leaving directory `/tmp/test/otp/lib/debugger/src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/tmp/test/otp/lib/debugger' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/tmp/test/otp/lib' make: *** [libs] Error 2 ...is this expected to work? Should I skip debugger as well? Cheers, Simon -- Simon MacMullen RabbitMQ, VMware From bombadil@REDACTED Thu Mar 21 13:50:26 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 21 Mar 2013 13:50:26 +0100 Subject: [erlang-questions] cover.erl issues Message-ID: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> Hi! I was developing a lot of projects with rebar and, when I put only one app in the apps directory and use eunit and cover, it works well, but when I create several apps in this directory I often see this message: ----------------------------------------------------------------------------------------- ERROR: eunit failed while processing /home/manuel/Proyectos/myproject/apps/app2: {'EXIT', {{badmatch, {error, {badarg, [{ets,new, [cover_internal_data_table, [set,public,named_table,{write_concurrency,true}]], []}, {cover,init_main,1,[{file,"cover.erl"},{line,565}]}]}}}, [{rebar_eunit,cover_init,2,[{file,"src/rebar_eunit.erl"},{line,445}]}, {rebar_eunit,run_eunit,3,[{file,"src/rebar_eunit.erl"},{line,127}]}, {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,405}]}, {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,334}]}, {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,197}]}, {rebar_core,process_each,5,[{file,"src/rebar_core.erl"},{line,268}]}, {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,173}]}, {rebar_core,process_commands,2, [{file,"src/rebar_core.erl"},{line,61}]}]}} ----------------------------------------------------------------------------------------- I think that can be due to a race condition, because the eunit execution between apps is continuous... but I'm not sure :-/ Any idea? Thanks. Manuel Rubio. From bombadil@REDACTED Thu Mar 21 13:58:35 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 21 Mar 2013 13:58:35 +0100 Subject: [erlang-questions] cover.erl issues In-Reply-To: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> References: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> Message-ID: <0330b7f9f73f496faba09bec6ffb755b@bosqueviejo.net> I forgo inform that the error occurs with R15B02 and R16B. El 2013-03-21 13:50, Manuel A. Rubio "Bombadil" escribi?: > Hi! > > I was developing a lot of projects with rebar and, when I put only > one app in the apps directory and use eunit and cover, it works well, > but when I create several apps in this directory I often see this > message: > > > ----------------------------------------------------------------------------------------- > ERROR: eunit failed while processing > /home/manuel/Proyectos/myproject/apps/app2: {'EXIT', > {{badmatch, > {error, > {badarg, > [{ets,new, > [cover_internal_data_table, > > [set,public,named_table,{write_concurrency,true}]], > []}, > > {cover,init_main,1,[{file,"cover.erl"},{line,565}]}]}}}, > > [{rebar_eunit,cover_init,2,[{file,"src/rebar_eunit.erl"},{line,445}]}, > > {rebar_eunit,run_eunit,3,[{file,"src/rebar_eunit.erl"},{line,127}]}, > > {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,405}]}, > > {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,334}]}, > > {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,197}]}, > > {rebar_core,process_each,5,[{file,"src/rebar_core.erl"},{line,268}]}, > > {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,173}]}, > {rebar_core,process_commands,2, > [{file,"src/rebar_core.erl"},{line,61}]}]}} > > ----------------------------------------------------------------------------------------- > > I think that can be due to a race condition, because the eunit > execution between apps is continuous... but I'm not sure :-/ > > Any idea? > > Thanks. > Manuel Rubio. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From anders.otp@REDACTED Thu Mar 21 13:59:07 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Thu, 21 Mar 2013 13:59:07 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: > Hello, > > Sorry, I still have some problems with sending CCR/CCA messages. I didn't > quite get how to configure multiple diameter applications though it seems > clear when I read the diameter protocol. > > Based on the sample diameter code, I made the following changes, > diameter_gen_base_rfc4006_cc is the dictionary generated with > rfc4006_cc.dia: > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > > -define(SVC_NAME, ?MODULE). > -define(APP_ALIAS, ?MODULE). > -define(CALLBACK_MOD, client_cb). > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > > -define(L, atom_to_list). > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > {'Origin-Realm', "example.com"}, > {'Vendor-Id', 0}, > {'Product-Name', "Client"}, > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, > {application, [{alias, ?APP_ALIAS}, > {dictionary, ?DIAMETER_DICT_CCRA}, > {module, ?CALLBACK_MOD}]}]). > > > > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > > init(State) -> > SvcName = ?MODULE, > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".example.com"}, > {'Origin-Realm', "example.com"}, > {'Vendor-Id', 193}, > {'Product-Name', "Server"}, > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, > {application, [{alias, ?MODULE}, > {dictionary, ?DIAMETER_DICT_CCRA}, > {module, server_cb}]}], > TransportOpts = [{transport_module, diameter_tcp}, > {transport_config, [{reuseaddr, true}, > {ip, {127,0,0,1}}, {port, 3868}]}], > diameter:start(), > diameter:start_service(SvcName, SvcOpts), > diameter:add_transport(SvcName, {listen, TransportOpts}), > erlang:display("Set up diameter server completed!"), > {ok, State}. > > > > I changed the callbacks client_cb and server_cb to handle CCR/CCA messages. > > > However, I got the following errors "app_not_configured". It seems the > configuration for applications is incorrect. How should I configure the > service properly? My understanding is I want to reuse CER/CEA as default > authorization application, but the erlang diameter doesn't explain how to do > it. Or my understanding is incorrect at all. The problem is a mismatch between the application and capabilities configuration in your SvcOpts: the 'Auth-Application-Id' tuple specifies the Application Id's that are advertised in the outgoing CER/CEA (that diameter itself sends) while 'applications' specifies corresponding dictionary modules. In your case, advertising the common application (0) during capabilities exchange but backing it up with a dictionary that implement CC (4) is what causes things to go south. What you want is something like this: {'Auth-Application-Id', [0,4]}, {application, [{alias, cc}, {dictionary, diameter_gen_base_rfc4006}, {module, [server_cb, cc]}], {application, [{alias, base}, {dictionary, diameter_gen_base_rfc6733}, {module, [server_cb, base]}]} That is, advertise both application with the Auth-Application-Id config and configure corresponding dictionaries with 'application' config. You might prefer two different callback modules (instead of an extra argument) but the point is to match your advertised capabilities with your configured dictionaries. On a side note, you shouldn't use a diameter prefix on your own dictionaries, so as not to collide with something diameter does in the future. /Anders, Erlang/OTP > > =ERROR REPORT==== 20-Mar-2013::21:40:50 === > ** Generic server <0.3841.0> terminating > ** Last message in was {diameter, > {recv, > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, > 101,110,116,46,101,120,97,109,112,108,101, > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, > 120,97,109,112,108,101,46,99,111,109,0,0,0, > > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, > > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, > 0>>}} > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, > diameter_gen_base_rfc3588, > {diameter_service,<0.50.0>, > {diameter_caps,"server.example.com", > "example.com", > [{127,0,0,1}], > 193,"Server",[],[], > [0], > [],[],[],[],[]}, > [{diameter_app,server, > diameter_gen_base_rfc4006_cc, > [server_cb], > server,4,false, > [{answer_errors,report}, > {request_errors,answer_3xxx}]}]}, > false,exit} > ** Reason for termination == > ** {{badmatch,{error,{app_not_configured,0}}}, > [{diameter_peer_fsm,recv_CER,2, > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, > {diameter_peer_fsm,build_answer,3, > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, > {diameter_peer_fsm,send_answer,3, > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, > {diameter_peer_fsm,handle_info,2, > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} > > > Could you give me some hints on this issue? The erlang debugger is not easy > to use and call stack information is hard to read (when I show the trace > window, all the buttons for step/next/continue become invisible). The > diameter guidance explains the concept but no clear steps about > configuration. > > > Many thanks! > > Samuel > > > > On Tue, Mar 12, 2013 at 12:10 PM, S X wrote: >> >> Hello, Anders & Andre, >> >> Thanks a lot for your quick responses and suggestions, which help me start >> to exploring Erlang world ^_^ >> >> I was able to generate based on the file rfc4006_cc.dia under the >> diameter/examples/dict folders. And understand a bit why and how Erlang >> diameter protocol dictionaries are organized and maintained. >> >> Many thanks and talk to you later! >> >> Samuel >> >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson >> wrote: >>> >>> Btw, there's an RFC 4006 dictionary (and a few more) under >>> diameter/examples/dict in the repo. >>> >>> /Anders, Erlang/OTP >>> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf wrote: >>> > Hello S(?) >>> > >>> > You have to come up with your own .dia file if the message types are >>> > not covered in the .dia files provided by Erlang. Your own .dia file >>> > will typically include the '@inherits diameter_gen_base_rfc3588' >>> > clause which imports the basic avp's from rfc3588. You then have to >>> > provide the missing avp's for your CCR/CCA message types, and also >>> > define these messages. Thanks to the format of a .dia file it is >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is >>> > ready, you use diameterc to generate the .erl and .hrl file. >>> > >>> > Hope that helped! >>> > >>> > BR/Andr? >>> > >>> > >>> > >>> > On 12 March 2013 04:58, S X wrote: >>> >> Hello, >>> >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could provide >>> >> some >>> >> suggestions on how to utilize the diameter library properly in Erlang. >>> >> >>> >> For example, I want to send/receive some Gx messages, like CCR (Credit >>> >> Control Request), CCA(Credit Control Answer messages. But I notice >>> >> that >>> >> there are some predefined messages in erlang diameter library. As my >>> >> understanding, should use the utility diameterc to generate erlang >>> >> header/source files based on dia files. There are few dia files under >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >>> >> base_rfc3588.dia, >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't >>> >> have >>> >> the definitions for Gx. >>> >> >>> >> How should I generate or where can I obtain dia files which have >>> >> support for >>> >> CCR/CCA message format? Are the dia files proprietary or manufacturer >>> >> specific? Can I generate with the 3GPP spec? What are the proper >>> >> steps? >>> >> >>> >> Thanks a lot! >>> >> >>> >> S >>> >> >>> >> >>> >> _______________________________________________ >>> >> 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 anders.otp@REDACTED Thu Mar 21 14:00:06 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Thu, 21 Mar 2013 14:00:06 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: One more time to the list ... On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson wrote: > The problem looks to be that there's an {ssl, false} option being into > diameter_tcp and then down to gen_tcp, which causes it to raise > badarg. What OTP release is this? I can't say I recall the example > code passing this tuple. > > /Anders, Erlang/OTP > > > > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan wrote: >> Hi there, >> >> I'm trying to start up the Erlang diameter demo application shipped with >> Erlang/OTP. The issue is that, no matter what format I try, I can't get the >> client to connect to a remote diameter server. >> >> In that example, I started the application as follows: >> >> 3> diameter:start(), client:start(). >> ok >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> {ok,#Ref<0.0.0.643>} >> >> 7> client:call(). >> {error,no_connection} >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is >> {10,249,20,174}. >> >> TCP to the server is working: >> >> telnet 10.249.20.174 3868 >> Trying 10.249.20.174... >> Connected to 10.249.20.174. >> Escape character is '^]'. >> >> >> I traced diameter_tcp and I can see that it is getting a badarg error >> somewhere: >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> [{10,151,0,166}]} >> (<0.116.0>) call >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) call >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> Does anyone have an idea what I am doing wrong? My feeling is that it has to >> do with the local ip address. I don't understand why I even need to supply a >> local IP address and the documentation isn't very clear. >> >> Thanks, >> >> Rudolph >> >> >> Here is the trace: >> >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) returned from diameter_tcp:i/1 -> {monitor,<0.114.0>,<0.115.0>} >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> {ip,{10,151,0,166}}, >> {raddr,{10,249,20,174}}, >> {rport,3868}, >> {reuseaddr,true}]) >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> [{ssl,false}, >> {ip,{10,151,0,166}}, >> {raddr,{10,249,20,174}}, >> {rport,3868}, >> {reuseaddr,true}]} >> (<0.115.0>) call >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> {ip,{10,151,0,166}}, >> {raddr,{10,249,20,174}}, >> {rport,3868}, >> {reuseaddr,true}],[]) >> (<0.115.0>) call >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> {ip,{10,151,0,166}}, >> {raddr,{10,249,20,174}}, >> {rport,3868}, >> {reuseaddr,true}],[]) >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> (<0.115.0>) call >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> {packet,0}, >> {active,once}, >> {ip,{10,151,0,166}}, >> {ssl,false}, >> {reuseaddr,true}] >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, >> [{10,151,0,166}]} >> (<0.115.0>) call diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> {packet,0}, >> {active,once}, >> {ip,{10,151,0,166}}, >> {ssl,false}, >> {reuseaddr,true}]) >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> [{10,151,0,166}]} >> (<0.116.0>) call >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) call >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> (<0.116.0>) call >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> (<0.116.0>) call >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From hm@REDACTED Thu Mar 21 14:09:18 2013 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 21 Mar 2013 14:09:18 +0100 Subject: [erlang-questions] Building from git without wx In-Reply-To: <514AFF25.6000502@rabbitmq.com> References: <514AFF25.6000502@rabbitmq.com> Message-ID: Try adding the SKIP files before you run configure. /H?kan On Thu, Mar 21, 2013 at 1:37 PM, Simon MacMullen wrote: > We build Erlang from git with: > > ./otp_build autoconf > ./configure --prefix=... > for lib in odbc wx ; do touch lib/${lib}/SKIP ; done > make > make install > > However, now that fails, with compilation of debugger exploding: > > compile: warnings being treated as errors > dbg_wx_filedialog_win.erl:21: behaviour wx_object undefined > make[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 > make[3]: Leaving directory `/tmp/test/otp/lib/debugger/src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/tmp/test/otp/lib/debugger' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/tmp/test/otp/lib' > make: *** [libs] Error 2 > > ...is this expected to work? Should I skip debugger as well? > > Cheers, Simon > > -- > Simon MacMullen > RabbitMQ, VMware > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dangud@REDACTED Thu Mar 21 14:10:18 2013 From: dangud@REDACTED (Dan Gudmundsson) Date: Thu, 21 Mar 2013 14:10:18 +0100 Subject: [erlang-questions] Building from git without wx In-Reply-To: References: <514AFF25.6000502@rabbitmq.com> Message-ID: You will need to skip all applications dependent on wx /Dan On Thu, Mar 21, 2013 at 2:09 PM, H?kan Mattsson wrote: > Try adding the SKIP files before you run configure. > > /H?kan > > On Thu, Mar 21, 2013 at 1:37 PM, Simon MacMullen wrote: >> We build Erlang from git with: >> >> ./otp_build autoconf >> ./configure --prefix=... >> for lib in odbc wx ; do touch lib/${lib}/SKIP ; done >> make >> make install >> >> However, now that fails, with compilation of debugger exploding: >> >> compile: warnings being treated as errors >> dbg_wx_filedialog_win.erl:21: behaviour wx_object undefined >> make[3]: *** [../ebin/dbg_wx_filedialog_win.beam] Error 1 >> make[3]: Leaving directory `/tmp/test/otp/lib/debugger/src' >> make[2]: *** [opt] Error 2 >> make[2]: Leaving directory `/tmp/test/otp/lib/debugger' >> make[1]: *** [opt] Error 2 >> make[1]: Leaving directory `/tmp/test/otp/lib' >> make: *** [libs] Error 2 >> >> ...is this expected to work? Should I skip debugger as well? >> >> Cheers, Simon >> >> -- >> Simon MacMullen >> RabbitMQ, VMware >> _______________________________________________ >> 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 andra.dinu@REDACTED Thu Mar 21 17:18:02 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Thu, 21 Mar 2013 16:18:02 +0000 (GMT) Subject: [erlang-questions] Live stream of Erlang factory SF Bay In-Reply-To: <1697703008.16057597.1363882657394.JavaMail.root@erlang-solutions.com> Message-ID: <163693128.16058302.1363882682635.JavaMail.root@erlang-solutions.com> Hi, The Erlang factory SF Bay is being streamed live from 10.35 PST (17.35 BST). Watch it here: http://erlangcentral.org/ Enjoy, Andra -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From 249505968@REDACTED Fri Mar 22 09:58:31 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Fri, 22 Mar 2013 16:58:31 +0800 Subject: [erlang-questions] =?gb18030?q?How_to_use_the_regex_in_erlang?= =?gb18030?b?o78=?= Message-ID: I have see the re model doc. But still not know how to use regex to take words from a string... How to get the "word" from the string "It's 1 word" with re? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ferenc.holzhauser@REDACTED Fri Mar 22 10:07:58 2013 From: ferenc.holzhauser@REDACTED (Ferenc Holzhauser) Date: Fri, 22 Mar 2013 10:07:58 +0100 Subject: [erlang-questions] =?utf-8?q?How_to_use_the_regex_in_erlang?= =?utf-8?b?77yf?= In-Reply-To: References: Message-ID: I think this should work : re:run("It\'s 1 word", "word", [{capture, all, list}]). On 22 March 2013 09:58, ?? <249505968@REDACTED> wrote: > I have see the re model doc. > But still not know how to use regex to take words from a string... > How to get the "word" from the string "It's 1 word" with re? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson@REDACTED Fri Mar 22 13:31:55 2013 From: s.j.thompson@REDACTED (Simon Thompson) Date: Fri, 22 Mar 2013 12:31:55 +0000 Subject: [erlang-questions] Tutorials at Commercial Users of Functional Programming 2013 Message-ID: There's still time to submit a tutorial proposal for Commercial Users of Functional Programming in Boston ? http://cufp.org/cufp2013-call-tutorials 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 andra.dinu@REDACTED Fri Mar 22 16:42:03 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Fri, 22 Mar 2013 15:42:03 +0000 (GMT) Subject: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes Message-ID: <598233690.17802875.1363966923868.JavaMail.root@erlang-solutions.com> Watch it here: http://erlangcentral.org/ -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From desired.mta@REDACTED Fri Mar 22 16:56:18 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Fri, 22 Mar 2013 15:56:18 +0000 Subject: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes In-Reply-To: References: <598233690.17802875.1363966923868.JavaMail.root@erlang-solutions.com> Message-ID: Forwarding to list. On Fri, Mar 22, 2013 at 3:55 PM, Motiejus Jak?tys wrote: > On Fri, Mar 22, 2013 at 3:42 PM, Andra Dinu > wrote: >> Watch it here: http://erlangcentral.org/ >> > > Which venue is it? I get "service unavailable" with all. > > -- > Motiejus Jak?tys -- Motiejus Jak?tys From simon@REDACTED Fri Mar 22 17:02:47 2013 From: simon@REDACTED (Simon MacMullen) Date: Fri, 22 Mar 2013 16:02:47 +0000 Subject: [erlang-questions] Building from git without wx In-Reply-To: References: <514AFF25.6000502@rabbitmq.com> Message-ID: <514C80A7.20209@rabbitmq.com> On 21/03/13 13:10, Dan Gudmundsson wrote: > You will need to skip all applications dependent on wx Of course. Thanks. Simon -- Simon MacMullen RabbitMQ, VMware From comptekki@REDACTED Fri Mar 22 17:09:09 2013 From: comptekki@REDACTED (Wes James) Date: Fri, 22 Mar 2013 10:09:09 -0600 Subject: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes In-Reply-To: References: <598233690.17802875.1363966923868.JavaMail.root@erlang-solutions.com> Message-ID: It seems to be in the Erlang Factory Live then second option down - I'm getting never ending buffering... On Fri, Mar 22, 2013 at 9:56 AM, Motiejus Jak?tys wrote: > Forwarding to list. > > On Fri, Mar 22, 2013 at 3:55 PM, Motiejus Jak?tys > wrote: > > On Fri, Mar 22, 2013 at 3:42 PM, Andra Dinu > > wrote: > >> Watch it here: http://erlangcentral.org/ > >> > > > > Which venue is it? I get "service unavailable" with all. > > > > -- > > Motiejus Jak?tys > > > > -- > Motiejus Jak?tys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From prof3ta@REDACTED Fri Mar 22 17:09:52 2013 From: prof3ta@REDACTED (Roberto Aloi) Date: Fri, 22 Mar 2013 17:09:52 +0100 Subject: [erlang-questions] -import/1 and R16 Message-ID: Hi all, I have noticed that the behaviour of the `import` module attribute slightly changed in R16. Specifically, it's not possible to use the `-import/1` variant anymore to import all functions from an external module. You need to use the `import/2` variant and to explicitly list all function names and their arity: http://www.erlang.org/doc/reference_manual/modules.html This discourage usage of the `import` attribute, which is a good thing in general. On the other side, there is plenty of legacy code relying on this attribute. Compilation for this code will fail under R16B due to a "bad import declaration". There are also some leftover for `-import/1` in the OTP code. As an example, `erl_syntax_lib` stil believes that an atom could be returned by the `attribute_arguments/1` function: https://github.com/erlang/otp/blob/maint/lib/syntax_tools/src/erl_syntax_lib.erl#L1537 I'm curious about why this change hasn't been explicitly mentioned in the change-log for R16A/B. Am I missing something obvious? Cheers, -- Roberto Aloi --- -------------- next part -------------- An HTML attachment was scrubbed... URL: From andra.dinu@REDACTED Fri Mar 22 17:10:42 2013 From: andra.dinu@REDACTED (Andra Dinu) Date: Fri, 22 Mar 2013 16:10:42 +0000 (GMT) Subject: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes In-Reply-To: Message-ID: <1939191015.17839284.1363968642955.JavaMail.root@erlang-solutions.com> They haven't started yet :) ----- Original Message ----- From: "Wes James" To: "Motiejus Jak?tys" Cc: "Andra Dinu" , erlang-questions@REDACTED Sent: Friday, March 22, 2013 4:09:09 PM Subject: Re: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes It seems to be in the Erlang Factory Live then second option down - I'm getting never ending buffering... On Fri, Mar 22, 2013 at 9:56 AM, Motiejus Jak?tys < desired.mta@REDACTED > wrote: Forwarding to list. On Fri, Mar 22, 2013 at 3:55 PM, Motiejus Jak?tys < desired.mta@REDACTED > wrote: > On Fri, Mar 22, 2013 at 3:42 PM, Andra Dinu > < andra.dinu@REDACTED > wrote: >> Watch it here: http://erlangcentral.org/ >> > > Which venue is it? I get "service unavailable" with all. > > -- > Motiejus Jak?tys -- Motiejus Jak?tys _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From n.oxyde@REDACTED Fri Mar 22 17:22:26 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Fri, 22 Mar 2013 17:22:26 +0100 Subject: [erlang-questions] -import/1 and R16 In-Reply-To: References: Message-ID: <57657539-8650-48CE-85E8-8F0AF8C46619@gmail.com> From what I understood, the attribute -import/1 was never meant to import all functions from an external module, but to import a package-qualified module into the current package namespace. So -import(erlang.lang.list). would have made every function from erlang.lang.list module available through the name list. The removal of packages and thus -import/1 is explicitly mentioned in the R16A changelog [1]: OTP-10348 The experimental support for packages has been removed. You can see both the old and new behaviour in the related compiler commit [2]. Notice there was no machinery in sys_pre_expand.erl to handle -import/1 attributes as you describe (at least from what I gather by reading the code). Regards, [1] http://www.erlang.org/download/otp_src_R16A_RELEASE_CANDIDATE.readme [2] https://github.com/erlang/otp/commit/f143990aea3ed5dd62952c1ed3d0a052f011626f -- Anthony Ramine Le 22 mars 2013 ? 17:09, Roberto Aloi a ?crit : > Hi all, > > I have noticed that the behaviour of the `import` module attribute slightly changed in R16. Specifically, it's not possible to use the `-import/1` variant anymore to import all functions from an external module. You need to use the `import/2` variant and to explicitly list all function names and their arity: > > http://www.erlang.org/doc/reference_manual/modules.html > > This discourage usage of the `import` attribute, which is a good thing in general. On the other side, there is plenty of legacy code relying on this attribute. Compilation for this code will fail under R16B due to a "bad import declaration". > > There are also some leftover for `-import/1` in the OTP code. As an example, `erl_syntax_lib` stil believes that an atom could be returned by the `attribute_arguments/1` function: > > https://github.com/erlang/otp/blob/maint/lib/syntax_tools/src/erl_syntax_lib.erl#L1537 > > I'm curious about why this change hasn't been explicitly mentioned in the change-log for R16A/B. Am I missing something obvious? > > Cheers, > > -- > Roberto Aloi > --- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From desired.mta@REDACTED Fri Mar 22 17:34:35 2013 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Fri, 22 Mar 2013 16:34:35 +0000 Subject: [erlang-questions] Livestream of Joe Armstrong's keynote at Erlang Factory SFBay starts in 20 minutes In-Reply-To: References: <598233690.17802875.1363966923868.JavaMail.root@erlang-solutions.com> Message-ID: On Fri, Mar 22, 2013 at 4:09 PM, Wes James wrote: > It seems to be in the Erlang Factory Live then second option down - I'm > getting never ending buffering... Up. Thanks. Chat is gone, so there is noone to report to. Please fix the sound, it's very hard to hear. :-) -- Motiejus Jak?tys From carlsson.richard@REDACTED Fri Mar 22 17:39:57 2013 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 22 Mar 2013 09:39:57 -0700 Subject: [erlang-questions] -import/1 and R16 In-Reply-To: References: Message-ID: <514C895D.5010407@gmail.com> On 2013-03-22 09:09 , Roberto Aloi wrote: > Hi all, > > I have noticed that the behaviour of the `import` module attribute > slightly changed in R16. Specifically, it's not possible to use the > `-import/1` variant anymore to import all functions from an external > module. You need to use the `import/2` variant and to explicitly list > all function names and their arity: The declaration -import(M) was part of the experimental 'packages' feature which was removed in R16. But -import(foo) did not mean "import all functions from foo" (because due to dynamic code loading, this would be a very vague concept). It just meant "allow the name foo to be used unqualified within this module", so e.g. -import(fee.fie.foo) allowed you to write foo:f(X) instead of fee.fie.foo:f(X). The case where the imported name has no dots in it, as in -import(lists), simply meant that you could say lists:reverse() instead of .lists:reverse() (note the leading dot) in order to call modules in the top level package. With packages removed, this declaration has no meaning. /Richard From erlangprogram@REDACTED Fri Mar 22 17:55:49 2013 From: erlangprogram@REDACTED (S X) Date: Fri, 22 Mar 2013 12:55:49 -0400 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Thanks a lot, Anders, I think I overlooked what the meaning of the configurable ID tag (4) in the dia file is , which is supposed to be the important application ID to be used in the configuration. Your suggestion about the prefix is also right. But now I am just learning erlang diameter library. I just try to follow the sample RAR message style, and am still having issue with sending CCR message. The client configuration now is: -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, {'Origin-Realm', "example.com"}, {'Vendor-Id', 193}, {'Product-Name', "Client"}, {'Auth-Application-Id', [?DIAMETER_APP_ID_CCRA]}, {application, [{alias, ?APP_CCR_ALIAS}, {dictionary, ?DIAMETER_DICT_CCRA}, {module, client_cb_ccra}]}]). Try to send CCR message: call(Name) -> SId = diameter:session_id(?L(Name)), CCR = #diameter_base_rfc4006_cc_CCR{ 'Session-Id' = SId, 'Service-Context-Id' = "Test", 'CC-Request-Type' = ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', 'CC-Request-Number' = 0, 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, 'User-Name' = "Me"}, diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). In the client callback module: prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> #diameter_caps{origin_host = {OH, DH}, origin_realm = {OR, DR}} = Caps, {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, 'Origin-Realm' = OR, 'Destination-Host' = DH, 'Destination-Realm' = DR}}. I got the error about AVP property: =ERROR REPORT==== 22-Mar-2013::00:17:31 === why: {diameter_codec,encode, {{repeated_avp_excessive_arity,'Destination-Host',1, "server.example.com",'CCR'}, [{diameter_gen_base_rfc4006_cc,encode_avps,2, [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, {diameter_codec,encode,2, [{file,"diameter_codec.erl"},{line,63}]}, {diameter_traffic,encode,3, [{file,"diameter_traffic.erl"},{line,1437}]}, {diameter_traffic,send_R,6, [{file,"diameter_traffic.erl"},{line,1276}]}, {diameter_traffic,'-send_request/4-fun-0-',4, [{file,"diameter_traffic.erl"},{line,1050}]}]}} who: <0.180.0> what: {diameter_codec,encode, [diameter_gen_base_rfc4006_cc, {diameter_packet, {diameter_header,1,undefined,undefined,undefined, 1330492780,1330492780,undefined,undefined,undefined, undefined}, undefined, {diameter_base_rfc4006_cc_CCR, ["client",";","1425429748",";","2",";","nonode@REDACTED "], "client.example.com","example.com","example.com",4, "Test",1,0,"server.example.com ","Me",[],[],[],[],[],[], [],[],[],[],[],[],[],[],[],[],[],[]}, undefined,[],undefined}]} My understanding is that the client callback prepare_request sets the "Destination-Host" (retrievd via the CER/A done at earilier stage) in the CCR message. So I should set it right. But seems I still misunderstand something. Does the error information "repeated_avp_excessive_arity" mean " 0-1 Zero or one instance of the AVP MAY be present in the message. It is considered an error if there is more than one instance of the AVP" according to rfc4006 spec? The erlang error message is not that straightforward, really confusing newbies:). Do you have any hints? (I hope I could provide some ramp up steps for other people to learn with erlang diameter library after making it work^_^) Many thanks, Samuel On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson wrote: > On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: > > Hello, > > > > Sorry, I still have some problems with sending CCR/CCA messages. I > didn't > > quite get how to configure multiple diameter applications though it seems > > clear when I read the diameter protocol. > > > > Based on the sample diameter code, I made the following changes, > > diameter_gen_base_rfc4006_cc is the dictionary generated with > > rfc4006_cc.dia: > > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > > > > -define(SVC_NAME, ?MODULE). > > -define(APP_ALIAS, ?MODULE). > > -define(CALLBACK_MOD, client_cb). > > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > > > > -define(L, atom_to_list). > > > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > > {'Origin-Realm', "example.com"}, > > {'Vendor-Id', 0}, > > {'Product-Name', "Client"}, > > {'Auth-Application-Id', > [?DIAMETER_APP_ID_COMMON]}, > > {application, [{alias, ?APP_ALIAS}, > > {dictionary, ?DIAMETER_DICT_CCRA}, > > {module, ?CALLBACK_MOD}]}]). > > > > > > > > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > > > > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > > > > init(State) -> > > SvcName = ?MODULE, > > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".example.com"}, > > {'Origin-Realm', "example.com"}, > > {'Vendor-Id', 193}, > > {'Product-Name', "Server"}, > > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, > > {application, [{alias, ?MODULE}, > > {dictionary, ?DIAMETER_DICT_CCRA}, > > {module, server_cb}]}], > > TransportOpts = [{transport_module, diameter_tcp}, > > {transport_config, [{reuseaddr, true}, > > {ip, {127,0,0,1}}, {port, 3868}]}], > > diameter:start(), > > diameter:start_service(SvcName, SvcOpts), > > diameter:add_transport(SvcName, {listen, TransportOpts}), > > erlang:display("Set up diameter server completed!"), > > {ok, State}. > > > > > > > > I changed the callbacks client_cb and server_cb to handle CCR/CCA > messages. > > > > > > However, I got the following errors "app_not_configured". It seems the > > configuration for applications is incorrect. How should I configure the > > service properly? My understanding is I want to reuse CER/CEA as default > > authorization application, but the erlang diameter doesn't explain how > to do > > it. Or my understanding is incorrect at all. > > The problem is a mismatch between the application and capabilities > configuration in your SvcOpts: the 'Auth-Application-Id' tuple > specifies the Application Id's that are advertised in the outgoing > CER/CEA (that diameter itself sends) while 'applications' specifies > corresponding dictionary modules. In your case, advertising the common > application (0) during capabilities exchange but backing it up with a > dictionary that implement CC (4) is what causes things to go south. > > What you want is something like this: > > {'Auth-Application-Id', [0,4]}, > {application, [{alias, cc}, > {dictionary, diameter_gen_base_rfc4006}, > {module, [server_cb, cc]}], > {application, [{alias, base}, > {dictionary, diameter_gen_base_rfc6733}, > {module, [server_cb, base]}]} > > That is, advertise both application with the Auth-Application-Id > config and configure corresponding dictionaries with 'application' > config. You might prefer two different callback modules (instead of an > extra argument) but the point is to match your advertised capabilities > with your configured dictionaries. > > On a side note, you shouldn't use a diameter prefix on your own > dictionaries, so as not to collide with something diameter does in the > future. > > /Anders, Erlang/OTP > > > > > =ERROR REPORT==== 20-Mar-2013::21:40:50 === > > ** Generic server <0.3841.0> terminating > > ** Last message in was {diameter, > > {recv, > > > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, > > > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, > > > 101,110,116,46,101,120,97,109,112,108,101, > > > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, > > > 120,97,109,112,108,101,46,99,111,109,0,0,0, > > > > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, > > > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, > > > > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, > > 0>>}} > > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, > > diameter_gen_base_rfc3588, > > {diameter_service,<0.50.0>, > > {diameter_caps,"server.example.com", > > "example.com", > > [{127,0,0,1}], > > 193,"Server",[],[], > > [0], > > [],[],[],[],[]}, > > [{diameter_app,server, > > diameter_gen_base_rfc4006_cc, > > [server_cb], > > server,4,false, > > [{answer_errors,report}, > > {request_errors,answer_3xxx}]}]}, > > false,exit} > > ** Reason for termination == > > ** {{badmatch,{error,{app_not_configured,0}}}, > > [{diameter_peer_fsm,recv_CER,2, > > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, > > {diameter_peer_fsm,build_answer,3, > > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, > > {diameter_peer_fsm,send_answer,3, > > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, > > {diameter_peer_fsm,handle_info,2, > > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, > > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, > > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} > > > > > > Could you give me some hints on this issue? The erlang debugger is not > easy > > to use and call stack information is hard to read (when I show the trace > > window, all the buttons for step/next/continue become invisible). The > > diameter guidance explains the concept but no clear steps about > > configuration. > > > > > > Many thanks! > > > > Samuel > > > > > > > > On Tue, Mar 12, 2013 at 12:10 PM, S X wrote: > >> > >> Hello, Anders & Andre, > >> > >> Thanks a lot for your quick responses and suggestions, which help me > start > >> to exploring Erlang world ^_^ > >> > >> I was able to generate based on the file rfc4006_cc.dia under the > >> diameter/examples/dict folders. And understand a bit why and how Erlang > >> diameter protocol dictionaries are organized and maintained. > >> > >> Many thanks and talk to you later! > >> > >> Samuel > >> > >> > >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson > >> wrote: > >>> > >>> Btw, there's an RFC 4006 dictionary (and a few more) under > >>> diameter/examples/dict in the repo. > >>> > >>> /Anders, Erlang/OTP > >>> > >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf > wrote: > >>> > Hello S(?) > >>> > > >>> > You have to come up with your own .dia file if the message types are > >>> > not covered in the .dia files provided by Erlang. Your own .dia file > >>> > will typically include the '@inherits diameter_gen_base_rfc3588' > >>> > clause which imports the basic avp's from rfc3588. You then have to > >>> > provide the missing avp's for your CCR/CCA message types, and also > >>> > define these messages. Thanks to the format of a .dia file it is > >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is > >>> > ready, you use diameterc to generate the .erl and .hrl file. > >>> > > >>> > Hope that helped! > >>> > > >>> > BR/Andr? > >>> > > >>> > > >>> > > >>> > On 12 March 2013 04:58, S X wrote: > >>> >> Hello, > >>> >> > >>> >> I am new to Erlang and Diameter protocol. Wish someone could provide > >>> >> some > >>> >> suggestions on how to utilize the diameter library properly in > Erlang. > >>> >> > >>> >> For example, I want to send/receive some Gx messages, like CCR > (Credit > >>> >> Control Request), CCA(Credit Control Answer messages. But I notice > >>> >> that > >>> >> there are some predefined messages in erlang diameter library. As my > >>> >> understanding, should use the utility diameterc to generate erlang > >>> >> header/source files based on dia files. There are few dia files > under > >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, > >>> >> base_rfc3588.dia, > >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files don't > >>> >> have > >>> >> the definitions for Gx. > >>> >> > >>> >> How should I generate or where can I obtain dia files which have > >>> >> support for > >>> >> CCR/CCA message format? Are the dia files proprietary or > manufacturer > >>> >> specific? Can I generate with the 3GPP spec? What are the proper > >>> >> steps? > >>> >> > >>> >> Thanks a lot! > >>> >> > >>> >> S > >>> >> > >>> >> > >>> >> _______________________________________________ > >>> >> 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 anders.otp@REDACTED Fri Mar 22 18:27:00 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Fri, 22 Mar 2013 18:27:00 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hi Samuel On Fri, Mar 22, 2013 at 5:55 PM, S X wrote: > Thanks a lot, Anders, > > I think I overlooked what the meaning of the configurable ID tag (4) in the > dia file is , which is supposed to be the important application ID to be > used in the configuration. Your suggestion about the prefix is also right. > But now I am just learning erlang diameter library. > > I just try to follow the sample RAR message style, and am still having issue > with sending CCR message. The client configuration now is: > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > {'Origin-Realm', "example.com"}, > {'Vendor-Id', 193}, > {'Product-Name', "Client"}, > {'Auth-Application-Id', [?DIAMETER_APP_ID_CCRA]}, > {application, [{alias, ?APP_CCR_ALIAS}, > {dictionary, ?DIAMETER_DICT_CCRA}, > {module, client_cb_ccra}]}]). > > Try to send CCR message: > > call(Name) -> > SId = diameter:session_id(?L(Name)), > CCR = #diameter_base_rfc4006_cc_CCR{ > 'Session-Id' = SId, > 'Service-Context-Id' = "Test", > 'CC-Request-Type' = > ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', > 'CC-Request-Number' = 0, > 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, > 'User-Name' = "Me"}, > diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). > > > In the client callback module: > > prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> > #diameter_caps{origin_host = {OH, DH}, > origin_realm = {OR, DR}} > = Caps, > > {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, > 'Origin-Realm' = OR, > 'Destination-Host' = DH, > 'Destination-Realm' = DR}}. > > I got the error about AVP property: > > =ERROR REPORT==== 22-Mar-2013::00:17:31 === > why: {diameter_codec,encode, > {{repeated_avp_excessive_arity,'Destination-Host',1, > "server.example.com",'CCR'}, This is because Destination-Host is optional in CCR and AVP's are encoded differently in a message record depending on whether or not there can be exactly one occurrence: if so then the field value should be the AVP value, if not then a list of AVP values. That is, your CCR record should have 'Destination-Host' = [DH], in this case. > [{diameter_gen_base_rfc4006_cc,encode_avps,2, > [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, > > {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, > {diameter_codec,encode,2, > [{file,"diameter_codec.erl"},{line,63}]}, > {diameter_traffic,encode,3, > [{file,"diameter_traffic.erl"},{line,1437}]}, > {diameter_traffic,send_R,6, > [{file,"diameter_traffic.erl"},{line,1276}]}, > {diameter_traffic,'-send_request/4-fun-0-',4, > [{file,"diameter_traffic.erl"},{line,1050}]}]}} > who: <0.180.0> > what: {diameter_codec,encode, > [diameter_gen_base_rfc4006_cc, > {diameter_packet, > {diameter_header,1,undefined,undefined,undefined, > 1330492780,1330492780,undefined,undefined,undefined, > undefined}, > undefined, > {diameter_base_rfc4006_cc_CCR, > > ["client",";","1425429748",";","2",";","nonode@REDACTED"], > "client.example.com","example.com","example.com",4, > > "Test",1,0,"server.example.com","Me",[],[],[],[],[],[], > [],[],[],[],[],[],[],[],[],[],[],[]}, > undefined,[],undefined}]} > > My understanding is that the client callback prepare_request sets the > "Destination-Host" (retrievd via the CER/A done at earilier stage) in the > CCR message. So I should set it right. But seems I still misunderstand > something. Does the error information "repeated_avp_excessive_arity" mean " > 0-1 Zero or one instance of the AVP MAY be present in the message. It is Yes, exactly. In your case your DH is being interpreted as list of Destination-Host values, and "excessive arity" is a result of that list having length greater than 1. /Anders, Erlang/OTP > considered an error if there is more than one instance of the AVP" according > to rfc4006 spec? The erlang error message is not that straightforward, > really confusing newbies:). > > Do you have any hints? (I hope I could provide some ramp up steps for other > people to learn with erlang diameter library after making it work^_^) > > Many thanks, > > Samuel > > > > On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson > wrote: >> >> On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: >> > Hello, >> > >> > Sorry, I still have some problems with sending CCR/CCA messages. I >> > didn't >> > quite get how to configure multiple diameter applications though it >> > seems >> > clear when I read the diameter protocol. >> > >> > Based on the sample diameter code, I made the following changes, >> > diameter_gen_base_rfc4006_cc is the dictionary generated with >> > rfc4006_cc.dia: >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> > >> > -define(SVC_NAME, ?MODULE). >> > -define(APP_ALIAS, ?MODULE). >> > -define(CALLBACK_MOD, client_cb). >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> > >> > -define(L, atom_to_list). >> > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> > {'Origin-Realm', "example.com"}, >> > {'Vendor-Id', 0}, >> > {'Product-Name', "Client"}, >> > {'Auth-Application-Id', >> > [?DIAMETER_APP_ID_COMMON]}, >> > {application, [{alias, ?APP_ALIAS}, >> > {dictionary, >> > ?DIAMETER_DICT_CCRA}, >> > {module, ?CALLBACK_MOD}]}]). >> > >> > >> > >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> > >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> > >> > init(State) -> >> > SvcName = ?MODULE, >> > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".example.com"}, >> > {'Origin-Realm', "example.com"}, >> > {'Vendor-Id', 193}, >> > {'Product-Name', "Server"}, >> > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, >> > {application, [{alias, ?MODULE}, >> > {dictionary, ?DIAMETER_DICT_CCRA}, >> > {module, server_cb}]}], >> > TransportOpts = [{transport_module, diameter_tcp}, >> > {transport_config, [{reuseaddr, true}, >> > {ip, {127,0,0,1}}, {port, 3868}]}], >> > diameter:start(), >> > diameter:start_service(SvcName, SvcOpts), >> > diameter:add_transport(SvcName, {listen, TransportOpts}), >> > erlang:display("Set up diameter server completed!"), >> > {ok, State}. >> > >> > >> > >> > I changed the callbacks client_cb and server_cb to handle CCR/CCA >> > messages. >> > >> > >> > However, I got the following errors "app_not_configured". It seems the >> > configuration for applications is incorrect. How should I configure the >> > service properly? My understanding is I want to reuse CER/CEA as default >> > authorization application, but the erlang diameter doesn't explain how >> > to do >> > it. Or my understanding is incorrect at all. >> >> The problem is a mismatch between the application and capabilities >> configuration in your SvcOpts: the 'Auth-Application-Id' tuple >> specifies the Application Id's that are advertised in the outgoing >> CER/CEA (that diameter itself sends) while 'applications' specifies >> corresponding dictionary modules. In your case, advertising the common >> application (0) during capabilities exchange but backing it up with a >> dictionary that implement CC (4) is what causes things to go south. >> >> What you want is something like this: >> >> {'Auth-Application-Id', [0,4]}, >> {application, [{alias, cc}, >> {dictionary, diameter_gen_base_rfc4006}, >> {module, [server_cb, cc]}], >> {application, [{alias, base}, >> {dictionary, diameter_gen_base_rfc6733}, >> {module, [server_cb, base]}]} >> >> That is, advertise both application with the Auth-Application-Id >> config and configure corresponding dictionaries with 'application' >> config. You might prefer two different callback modules (instead of an >> extra argument) but the point is to match your advertised capabilities >> with your configured dictionaries. >> >> On a side note, you shouldn't use a diameter prefix on your own >> dictionaries, so as not to collide with something diameter does in the >> future. >> >> /Anders, Erlang/OTP >> >> > >> > =ERROR REPORT==== 20-Mar-2013::21:40:50 === >> > ** Generic server <0.3841.0> terminating >> > ** Last message in was {diameter, >> > {recv, >> > >> > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, >> > >> > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, >> > >> > 101,110,116,46,101,120,97,109,112,108,101, >> > >> > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, >> > >> > 120,97,109,112,108,101,46,99,111,109,0,0,0, >> > >> > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, >> > >> > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, >> > >> > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, >> > 0>>}} >> > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, >> > diameter_gen_base_rfc3588, >> > {diameter_service,<0.50.0>, >> > {diameter_caps,"server.example.com", >> > "example.com", >> > [{127,0,0,1}], >> > 193,"Server",[],[], >> > [0], >> > [],[],[],[],[]}, >> > [{diameter_app,server, >> > diameter_gen_base_rfc4006_cc, >> > [server_cb], >> > server,4,false, >> > [{answer_errors,report}, >> > {request_errors,answer_3xxx}]}]}, >> > false,exit} >> > ** Reason for termination == >> > ** {{badmatch,{error,{app_not_configured,0}}}, >> > [{diameter_peer_fsm,recv_CER,2, >> > >> > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, >> > {diameter_peer_fsm,build_answer,3, >> > >> > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, >> > {diameter_peer_fsm,send_answer,3, >> > >> > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, >> > {diameter_peer_fsm,handle_info,2, >> > >> > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, >> > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, >> > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} >> > >> > >> > Could you give me some hints on this issue? The erlang debugger is not >> > easy >> > to use and call stack information is hard to read (when I show the trace >> > window, all the buttons for step/next/continue become invisible). The >> > diameter guidance explains the concept but no clear steps about >> > configuration. >> > >> > >> > Many thanks! >> > >> > Samuel >> > >> > >> > >> > On Tue, Mar 12, 2013 at 12:10 PM, S X wrote: >> >> >> >> Hello, Anders & Andre, >> >> >> >> Thanks a lot for your quick responses and suggestions, which help me >> >> start >> >> to exploring Erlang world ^_^ >> >> >> >> I was able to generate based on the file rfc4006_cc.dia under the >> >> diameter/examples/dict folders. And understand a bit why and how Erlang >> >> diameter protocol dictionaries are organized and maintained. >> >> >> >> Many thanks and talk to you later! >> >> >> >> Samuel >> >> >> >> >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson >> >> wrote: >> >>> >> >>> Btw, there's an RFC 4006 dictionary (and a few more) under >> >>> diameter/examples/dict in the repo. >> >>> >> >>> /Anders, Erlang/OTP >> >>> >> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf >> >>> wrote: >> >>> > Hello S(?) >> >>> > >> >>> > You have to come up with your own .dia file if the message types are >> >>> > not covered in the .dia files provided by Erlang. Your own .dia file >> >>> > will typically include the '@inherits diameter_gen_base_rfc3588' >> >>> > clause which imports the basic avp's from rfc3588. You then have to >> >>> > provide the missing avp's for your CCR/CCA message types, and also >> >>> > define these messages. Thanks to the format of a .dia file it is >> >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is >> >>> > ready, you use diameterc to generate the .erl and .hrl file. >> >>> > >> >>> > Hope that helped! >> >>> > >> >>> > BR/Andr? >> >>> > >> >>> > >> >>> > >> >>> > On 12 March 2013 04:58, S X wrote: >> >>> >> Hello, >> >>> >> >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could >> >>> >> provide >> >>> >> some >> >>> >> suggestions on how to utilize the diameter library properly in >> >>> >> Erlang. >> >>> >> >> >>> >> For example, I want to send/receive some Gx messages, like CCR >> >>> >> (Credit >> >>> >> Control Request), CCA(Credit Control Answer messages. But I notice >> >>> >> that >> >>> >> there are some predefined messages in erlang diameter library. As >> >>> >> my >> >>> >> understanding, should use the utility diameterc to generate erlang >> >>> >> header/source files based on dia files. There are few dia files >> >>> >> under >> >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >> >>> >> base_rfc3588.dia, >> >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files >> >>> >> don't >> >>> >> have >> >>> >> the definitions for Gx. >> >>> >> >> >>> >> How should I generate or where can I obtain dia files which have >> >>> >> support for >> >>> >> CCR/CCA message format? Are the dia files proprietary or >> >>> >> manufacturer >> >>> >> specific? Can I generate with the 3GPP spec? What are the proper >> >>> >> steps? >> >>> >> >> >>> >> Thanks a lot! >> >>> >> >> >>> >> S >> >>> >> >> >>> >> >> >>> >> _______________________________________________ >> >>> >> 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 washington3@REDACTED Fri Mar 22 19:39:42 2013 From: washington3@REDACTED (washington3@REDACTED) Date: Fri, 22 Mar 2013 19:39:42 +0100 Subject: [erlang-questions] introductory book Message-ID: Can you suggest an introductory book on Erlang? From erlangprogram@REDACTED Fri Mar 22 19:46:54 2013 From: erlangprogram@REDACTED (S X) Date: Fri, 22 Mar 2013 14:46:54 -0400 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hi Anders, Thanks for your quick response. But I still don't get why the DH is being interpreted as a list of Destination-Host values ( Is it because the define "avp_arity('CCR', 'Destination-Host') -> {0, 1};"). And if it is treated as a list, how come it has a length greater than 1, I just set it once in prepare_request. What should I do to correct it? Or which document should I read more carefully to understand this properly? Thanks a lot! Samuel On Fri, Mar 22, 2013 at 1:27 PM, Anders Svensson wrote: > Hi Samuel > > On Fri, Mar 22, 2013 at 5:55 PM, S X wrote: > > Thanks a lot, Anders, > > > > I think I overlooked what the meaning of the configurable ID tag (4) in > the > > dia file is , which is supposed to be the important application ID to be > > used in the configuration. Your suggestion about the prefix is also > right. > > But now I am just learning erlang diameter library. > > > > I just try to follow the sample RAR message style, and am still having > issue > > with sending CCR message. The client configuration now is: > > > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > > {'Origin-Realm', "example.com"}, > > {'Vendor-Id', 193}, > > {'Product-Name', "Client"}, > > {'Auth-Application-Id', [?DIAMETER_APP_ID_CCRA]}, > > {application, [{alias, ?APP_CCR_ALIAS}, > > {dictionary, ?DIAMETER_DICT_CCRA}, > > {module, client_cb_ccra}]}]). > > > > Try to send CCR message: > > > > call(Name) -> > > SId = diameter:session_id(?L(Name)), > > CCR = #diameter_base_rfc4006_cc_CCR{ > > 'Session-Id' = SId, > > 'Service-Context-Id' = "Test", > > 'CC-Request-Type' = > > ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', > > 'CC-Request-Number' = 0, > > 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, > > 'User-Name' = "Me"}, > > diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). > > > > > > In the client callback module: > > > > prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> > > #diameter_caps{origin_host = {OH, DH}, > > origin_realm = {OR, DR}} > > = Caps, > > > > {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, > > 'Origin-Realm' = OR, > > 'Destination-Host' = DH, > > 'Destination-Realm' = DR}}. > > > > I got the error about AVP property: > > > > =ERROR REPORT==== 22-Mar-2013::00:17:31 === > > why: {diameter_codec,encode, > > {{repeated_avp_excessive_arity,'Destination-Host',1, > > "server.example.com",'CCR'}, > > This is because Destination-Host is optional in CCR and AVP's are > encoded differently in a message record depending on whether or not > there can be exactly one occurrence: if so then the field value should > be the AVP value, if not then a list of AVP values. That is, your CCR > record should have > > 'Destination-Host' = [DH], > > in this case. > > > [{diameter_gen_base_rfc4006_cc,encode_avps,2, > > > [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, > > > > {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, > > {diameter_codec,encode,2, > > [{file,"diameter_codec.erl"},{line,63}]}, > > {diameter_traffic,encode,3, > > [{file,"diameter_traffic.erl"},{line,1437}]}, > > {diameter_traffic,send_R,6, > > [{file,"diameter_traffic.erl"},{line,1276}]}, > > {diameter_traffic,'-send_request/4-fun-0-',4, > > [{file,"diameter_traffic.erl"},{line,1050}]}]}} > > who: <0.180.0> > > what: {diameter_codec,encode, > > [diameter_gen_base_rfc4006_cc, > > {diameter_packet, > > {diameter_header,1,undefined,undefined,undefined, > > > 1330492780,1330492780,undefined,undefined,undefined, > > undefined}, > > undefined, > > {diameter_base_rfc4006_cc_CCR, > > > > ["client",";","1425429748",";","2",";","nonode@REDACTED"], > > "client.example.com","example.com","example.com > ",4, > > > > "Test",1,0,"server.example.com","Me",[],[],[],[],[],[], > > [],[],[],[],[],[],[],[],[],[],[],[]}, > > undefined,[],undefined}]} > > > > My understanding is that the client callback prepare_request sets the > > "Destination-Host" (retrievd via the CER/A done at earilier stage) in the > > CCR message. So I should set it right. But seems I still misunderstand > > something. Does the error information "repeated_avp_excessive_arity" > mean " > > 0-1 Zero or one instance of the AVP MAY be present in the message. It is > > Yes, exactly. In your case your DH is being interpreted as list of > Destination-Host values, and "excessive arity" is a result of that > list having length greater than 1. > > /Anders, Erlang/OTP > > > > considered an error if there is more than one instance of the AVP" > according > > to rfc4006 spec? The erlang error message is not that straightforward, > > really confusing newbies:). > > > > Do you have any hints? (I hope I could provide some ramp up steps for > other > > people to learn with erlang diameter library after making it work^_^) > > > > Many thanks, > > > > Samuel > > > > > > > > On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson > > wrote: > >> > >> On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: > >> > Hello, > >> > > >> > Sorry, I still have some problems with sending CCR/CCA messages. I > >> > didn't > >> > quite get how to configure multiple diameter applications though it > >> > seems > >> > clear when I read the diameter protocol. > >> > > >> > Based on the sample diameter code, I made the following changes, > >> > diameter_gen_base_rfc4006_cc is the dictionary generated with > >> > rfc4006_cc.dia: > >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > >> > > >> > -define(SVC_NAME, ?MODULE). > >> > -define(APP_ALIAS, ?MODULE). > >> > -define(CALLBACK_MOD, client_cb). > >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > >> > > >> > -define(L, atom_to_list). > >> > > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > >> > {'Origin-Realm', "example.com"}, > >> > {'Vendor-Id', 0}, > >> > {'Product-Name', "Client"}, > >> > {'Auth-Application-Id', > >> > [?DIAMETER_APP_ID_COMMON]}, > >> > {application, [{alias, ?APP_ALIAS}, > >> > {dictionary, > >> > ?DIAMETER_DICT_CCRA}, > >> > {module, ?CALLBACK_MOD}]}]). > >> > > >> > > >> > > >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ > >> > > >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). > >> > > >> > init(State) -> > >> > SvcName = ?MODULE, > >> > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ".example.com > "}, > >> > {'Origin-Realm', "example.com"}, > >> > {'Vendor-Id', 193}, > >> > {'Product-Name', "Server"}, > >> > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, > >> > {application, [{alias, ?MODULE}, > >> > {dictionary, ?DIAMETER_DICT_CCRA}, > >> > {module, server_cb}]}], > >> > TransportOpts = [{transport_module, diameter_tcp}, > >> > {transport_config, [{reuseaddr, true}, > >> > {ip, {127,0,0,1}}, {port, 3868}]}], > >> > diameter:start(), > >> > diameter:start_service(SvcName, SvcOpts), > >> > diameter:add_transport(SvcName, {listen, TransportOpts}), > >> > erlang:display("Set up diameter server completed!"), > >> > {ok, State}. > >> > > >> > > >> > > >> > I changed the callbacks client_cb and server_cb to handle CCR/CCA > >> > messages. > >> > > >> > > >> > However, I got the following errors "app_not_configured". It seems the > >> > configuration for applications is incorrect. How should I configure > the > >> > service properly? My understanding is I want to reuse CER/CEA as > default > >> > authorization application, but the erlang diameter doesn't explain how > >> > to do > >> > it. Or my understanding is incorrect at all. > >> > >> The problem is a mismatch between the application and capabilities > >> configuration in your SvcOpts: the 'Auth-Application-Id' tuple > >> specifies the Application Id's that are advertised in the outgoing > >> CER/CEA (that diameter itself sends) while 'applications' specifies > >> corresponding dictionary modules. In your case, advertising the common > >> application (0) during capabilities exchange but backing it up with a > >> dictionary that implement CC (4) is what causes things to go south. > >> > >> What you want is something like this: > >> > >> {'Auth-Application-Id', [0,4]}, > >> {application, [{alias, cc}, > >> {dictionary, diameter_gen_base_rfc4006}, > >> {module, [server_cb, cc]}], > >> {application, [{alias, base}, > >> {dictionary, diameter_gen_base_rfc6733}, > >> {module, [server_cb, base]}]} > >> > >> That is, advertise both application with the Auth-Application-Id > >> config and configure corresponding dictionaries with 'application' > >> config. You might prefer two different callback modules (instead of an > >> extra argument) but the point is to match your advertised capabilities > >> with your configured dictionaries. > >> > >> On a side note, you shouldn't use a diameter prefix on your own > >> dictionaries, so as not to collide with something diameter does in the > >> future. > >> > >> /Anders, Erlang/OTP > >> > >> > > >> > =ERROR REPORT==== 20-Mar-2013::21:40:50 === > >> > ** Generic server <0.3841.0> terminating > >> > ** Last message in was {diameter, > >> > {recv, > >> > > >> > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, > >> > > >> > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, > >> > > >> > 101,110,116,46,101,120,97,109,112,108,101, > >> > > >> > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, > >> > > >> > 120,97,109,112,108,101,46,99,111,109,0,0,0, > >> > > >> > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, > >> > > >> > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, > >> > > >> > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, > >> > 0>>}} > >> > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, > >> > diameter_gen_base_rfc3588, > >> > {diameter_service,<0.50.0>, > >> > {diameter_caps,"server.example.com", > >> > "example.com", > >> > [{127,0,0,1}], > >> > 193,"Server",[],[], > >> > [0], > >> > [],[],[],[],[]}, > >> > [{diameter_app,server, > >> > diameter_gen_base_rfc4006_cc, > >> > [server_cb], > >> > server,4,false, > >> > [{answer_errors,report}, > >> > > {request_errors,answer_3xxx}]}]}, > >> > false,exit} > >> > ** Reason for termination == > >> > ** {{badmatch,{error,{app_not_configured,0}}}, > >> > [{diameter_peer_fsm,recv_CER,2, > >> > > >> > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, > >> > {diameter_peer_fsm,build_answer,3, > >> > > >> > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, > >> > {diameter_peer_fsm,send_answer,3, > >> > > >> > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, > >> > {diameter_peer_fsm,handle_info,2, > >> > > >> > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, > >> > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, > >> > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} > >> > > >> > > >> > Could you give me some hints on this issue? The erlang debugger is not > >> > easy > >> > to use and call stack information is hard to read (when I show the > trace > >> > window, all the buttons for step/next/continue become invisible). The > >> > diameter guidance explains the concept but no clear steps about > >> > configuration. > >> > > >> > > >> > Many thanks! > >> > > >> > Samuel > >> > > >> > > >> > > >> > On Tue, Mar 12, 2013 at 12:10 PM, S X > wrote: > >> >> > >> >> Hello, Anders & Andre, > >> >> > >> >> Thanks a lot for your quick responses and suggestions, which help me > >> >> start > >> >> to exploring Erlang world ^_^ > >> >> > >> >> I was able to generate based on the file rfc4006_cc.dia under the > >> >> diameter/examples/dict folders. And understand a bit why and how > Erlang > >> >> diameter protocol dictionaries are organized and maintained. > >> >> > >> >> Many thanks and talk to you later! > >> >> > >> >> Samuel > >> >> > >> >> > >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson < > anders.otp@REDACTED> > >> >> wrote: > >> >>> > >> >>> Btw, there's an RFC 4006 dictionary (and a few more) under > >> >>> diameter/examples/dict in the repo. > >> >>> > >> >>> /Anders, Erlang/OTP > >> >>> > >> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf > >> >>> wrote: > >> >>> > Hello S(?) > >> >>> > > >> >>> > You have to come up with your own .dia file if the message types > are > >> >>> > not covered in the .dia files provided by Erlang. Your own .dia > file > >> >>> > will typically include the '@inherits diameter_gen_base_rfc3588' > >> >>> > clause which imports the basic avp's from rfc3588. You then have > to > >> >>> > provide the missing avp's for your CCR/CCA message types, and also > >> >>> > define these messages. Thanks to the format of a .dia file it is > >> >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is > >> >>> > ready, you use diameterc to generate the .erl and .hrl file. > >> >>> > > >> >>> > Hope that helped! > >> >>> > > >> >>> > BR/Andr? > >> >>> > > >> >>> > > >> >>> > > >> >>> > On 12 March 2013 04:58, S X wrote: > >> >>> >> Hello, > >> >>> >> > >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could > >> >>> >> provide > >> >>> >> some > >> >>> >> suggestions on how to utilize the diameter library properly in > >> >>> >> Erlang. > >> >>> >> > >> >>> >> For example, I want to send/receive some Gx messages, like CCR > >> >>> >> (Credit > >> >>> >> Control Request), CCA(Credit Control Answer messages. But I > notice > >> >>> >> that > >> >>> >> there are some predefined messages in erlang diameter library. As > >> >>> >> my > >> >>> >> understanding, should use the utility diameterc to generate > erlang > >> >>> >> header/source files based on dia files. There are few dia files > >> >>> >> under > >> >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, > >> >>> >> base_rfc3588.dia, > >> >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files > >> >>> >> don't > >> >>> >> have > >> >>> >> the definitions for Gx. > >> >>> >> > >> >>> >> How should I generate or where can I obtain dia files which have > >> >>> >> support for > >> >>> >> CCR/CCA message format? Are the dia files proprietary or > >> >>> >> manufacturer > >> >>> >> specific? Can I generate with the 3GPP spec? What are the proper > >> >>> >> steps? > >> >>> >> > >> >>> >> Thanks a lot! > >> >>> >> > >> >>> >> S > >> >>> >> > >> >>> >> > >> >>> >> _______________________________________________ > >> >>> >> 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 rharrison@REDACTED Fri Mar 22 19:49:11 2013 From: rharrison@REDACTED (Ryan Harrison) Date: Fri, 22 Mar 2013 14:49:11 -0400 Subject: [erlang-questions] introductory book In-Reply-To: References: Message-ID: I am a big fan of "Learn You Some Erlang for Great Good!", http://learnyousomeerlang.com/. A lot of things, especially OTP programming, clicked when I read it. -Ryan Harrison On 22 March 2013 14:39, wrote: > > Can you suggest an introductory book on Erlang? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From poprosturadek@REDACTED Fri Mar 22 19:49:06 2013 From: poprosturadek@REDACTED (=?UTF-8?B?UmFkb3PFgmF3IE1pc2l1aw==?=) Date: Fri, 22 Mar 2013 19:49:06 +0100 Subject: [erlang-questions] introductory book In-Reply-To: References: Message-ID: <514CA7A2.9080605@gmail.com> Well, as I suppose, if you're a total novice in Erlang world, Introducing Erlang [1] should do, especially read with [2] on par. [1] http://shop.oreilly.com/product/0636920025818.do [2] http://chimera.labs.oreilly.com/books/1234000000726 Regards, Radek W dniu 2013-03-22 19:39, washington3@REDACTED pisze: > Can you suggest an introductory book on Erlang? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Fri Mar 22 19:50:38 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 22 Mar 2013 19:50:38 +0100 Subject: [erlang-questions] introductory book In-Reply-To: <514CA7A2.9080605@gmail.com> References: <514CA7A2.9080605@gmail.com> Message-ID: +1 http://learnyousomeerlang.com/ It's free... Regards, Zabrane On Mar 22, 2013, at 7:49 PM, Rados?aw Misiuk wrote: > Well, as I suppose, if you're a total novice in Erlang world, Introducing Erlang [1] should do, especially read with [2] on par. > > [1] http://shop.oreilly.com/product/0636920025818.do > [2] http://chimera.labs.oreilly.com/books/1234000000726 > > Regards, > Radek > > W dniu 2013-03-22 19:39, washington3@REDACTED pisze: >> Can you suggest an introductory book on Erlang? >> >> _______________________________________________ >> 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 erlangprogram@REDACTED Fri Mar 22 19:52:05 2013 From: erlangprogram@REDACTED (S X) Date: Fri, 22 Mar 2013 14:52:05 -0400 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hi Anders, Sorry, I think I understand now. You told me the solution. Just use '[ ]'. Anyhow, many thanks! By the way, since 3588 is obsolete, can I use 6733 while compile other dictionaries? Thanks! Samuel On Fri, Mar 22, 2013 at 2:46 PM, S X wrote: > Hi Anders, > > Thanks for your quick response. But I still don't get why the DH is being > interpreted as a list of Destination-Host values ( Is it because the define > "avp_arity('CCR', 'Destination-Host') -> {0, 1};"). > > And if it is treated as a list, how come it has a length greater than 1, I > just set it once in prepare_request. > > What should I do to correct it? Or which document should I read more > carefully to understand this properly? > > Thanks a lot! > > Samuel > > > On Fri, Mar 22, 2013 at 1:27 PM, Anders Svensson wrote: > >> Hi Samuel >> >> On Fri, Mar 22, 2013 at 5:55 PM, S X wrote: >> > Thanks a lot, Anders, >> > >> > I think I overlooked what the meaning of the configurable ID tag (4) in >> the >> > dia file is , which is supposed to be the important application ID to be >> > used in the configuration. Your suggestion about the prefix is also >> right. >> > But now I am just learning erlang diameter library. >> > >> > I just try to follow the sample RAR message style, and am still having >> issue >> > with sending CCR message. The client configuration now is: >> > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> > {'Origin-Realm', "example.com"}, >> > {'Vendor-Id', 193}, >> > {'Product-Name', "Client"}, >> > {'Auth-Application-Id', >> [?DIAMETER_APP_ID_CCRA]}, >> > {application, [{alias, ?APP_CCR_ALIAS}, >> > {dictionary, >> ?DIAMETER_DICT_CCRA}, >> > {module, client_cb_ccra}]}]). >> > >> > Try to send CCR message: >> > >> > call(Name) -> >> > SId = diameter:session_id(?L(Name)), >> > CCR = #diameter_base_rfc4006_cc_CCR{ >> > 'Session-Id' = SId, >> > 'Service-Context-Id' = "Test", >> > 'CC-Request-Type' = >> > ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', >> > 'CC-Request-Number' = 0, >> > 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, >> > 'User-Name' = "Me"}, >> > diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). >> > >> > >> > In the client callback module: >> > >> > prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> >> > #diameter_caps{origin_host = {OH, DH}, >> > origin_realm = {OR, DR}} >> > = Caps, >> > >> > {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, >> > 'Origin-Realm' = OR, >> > 'Destination-Host' = DH, >> > 'Destination-Realm' = DR}}. >> > >> > I got the error about AVP property: >> > >> > =ERROR REPORT==== 22-Mar-2013::00:17:31 === >> > why: {diameter_codec,encode, >> > {{repeated_avp_excessive_arity,'Destination-Host',1, >> > "server.example.com",'CCR'}, >> >> This is because Destination-Host is optional in CCR and AVP's are >> encoded differently in a message record depending on whether or not >> there can be exactly one occurrence: if so then the field value should >> be the AVP value, if not then a list of AVP values. That is, your CCR >> record should have >> >> 'Destination-Host' = [DH], >> >> in this case. >> >> > [{diameter_gen_base_rfc4006_cc,encode_avps,2, >> > >> [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, >> > >> > {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, >> > {diameter_codec,encode,2, >> > [{file,"diameter_codec.erl"},{line,63}]}, >> > {diameter_traffic,encode,3, >> > [{file,"diameter_traffic.erl"},{line,1437}]}, >> > {diameter_traffic,send_R,6, >> > [{file,"diameter_traffic.erl"},{line,1276}]}, >> > {diameter_traffic,'-send_request/4-fun-0-',4, >> > [{file,"diameter_traffic.erl"},{line,1050}]}]}} >> > who: <0.180.0> >> > what: {diameter_codec,encode, >> > [diameter_gen_base_rfc4006_cc, >> > {diameter_packet, >> > {diameter_header,1,undefined,undefined,undefined, >> > >> 1330492780,1330492780,undefined,undefined,undefined, >> > undefined}, >> > undefined, >> > {diameter_base_rfc4006_cc_CCR, >> > >> > ["client",";","1425429748",";","2",";","nonode@REDACTED"], >> > "client.example.com","example.com","example.com >> ",4, >> > >> > "Test",1,0,"server.example.com","Me",[],[],[],[],[],[], >> > [],[],[],[],[],[],[],[],[],[],[],[]}, >> > undefined,[],undefined}]} >> > >> > My understanding is that the client callback prepare_request sets the >> > "Destination-Host" (retrievd via the CER/A done at earilier stage) in >> the >> > CCR message. So I should set it right. But seems I still misunderstand >> > something. Does the error information "repeated_avp_excessive_arity" >> mean " >> > 0-1 Zero or one instance of the AVP MAY be present in the message. It is >> >> Yes, exactly. In your case your DH is being interpreted as list of >> Destination-Host values, and "excessive arity" is a result of that >> list having length greater than 1. >> >> /Anders, Erlang/OTP >> >> >> > considered an error if there is more than one instance of the AVP" >> according >> > to rfc4006 spec? The erlang error message is not that straightforward, >> > really confusing newbies:). >> > >> > Do you have any hints? (I hope I could provide some ramp up steps for >> other >> > people to learn with erlang diameter library after making it work^_^) >> > >> > Many thanks, >> > >> > Samuel >> > >> > >> > >> > On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson >> > wrote: >> >> >> >> On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: >> >> > Hello, >> >> > >> >> > Sorry, I still have some problems with sending CCR/CCA messages. I >> >> > didn't >> >> > quite get how to configure multiple diameter applications though it >> >> > seems >> >> > clear when I read the diameter protocol. >> >> > >> >> > Based on the sample diameter code, I made the following changes, >> >> > diameter_gen_base_rfc4006_cc is the dictionary generated with >> >> > rfc4006_cc.dia: >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client >> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> >> > >> >> > -define(SVC_NAME, ?MODULE). >> >> > -define(APP_ALIAS, ?MODULE). >> >> > -define(CALLBACK_MOD, client_cb). >> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> >> > >> >> > -define(L, atom_to_list). >> >> > >> >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> >> > {'Origin-Realm', "example.com"}, >> >> > {'Vendor-Id', 0}, >> >> > {'Product-Name', "Client"}, >> >> > {'Auth-Application-Id', >> >> > [?DIAMETER_APP_ID_COMMON]}, >> >> > {application, [{alias, ?APP_ALIAS}, >> >> > {dictionary, >> >> > ?DIAMETER_DICT_CCRA}, >> >> > {module, ?CALLBACK_MOD}]}]). >> >> > >> >> > >> >> > >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server >> $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> >> > >> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> >> > >> >> > init(State) -> >> >> > SvcName = ?MODULE, >> >> > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ ". >> example.com"}, >> >> > {'Origin-Realm', "example.com"}, >> >> > {'Vendor-Id', 193}, >> >> > {'Product-Name', "Server"}, >> >> > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, >> >> > {application, [{alias, ?MODULE}, >> >> > {dictionary, ?DIAMETER_DICT_CCRA}, >> >> > {module, server_cb}]}], >> >> > TransportOpts = [{transport_module, diameter_tcp}, >> >> > {transport_config, [{reuseaddr, true}, >> >> > {ip, {127,0,0,1}}, {port, 3868}]}], >> >> > diameter:start(), >> >> > diameter:start_service(SvcName, SvcOpts), >> >> > diameter:add_transport(SvcName, {listen, TransportOpts}), >> >> > erlang:display("Set up diameter server completed!"), >> >> > {ok, State}. >> >> > >> >> > >> >> > >> >> > I changed the callbacks client_cb and server_cb to handle CCR/CCA >> >> > messages. >> >> > >> >> > >> >> > However, I got the following errors "app_not_configured". It seems >> the >> >> > configuration for applications is incorrect. How should I configure >> the >> >> > service properly? My understanding is I want to reuse CER/CEA as >> default >> >> > authorization application, but the erlang diameter doesn't explain >> how >> >> > to do >> >> > it. Or my understanding is incorrect at all. >> >> >> >> The problem is a mismatch between the application and capabilities >> >> configuration in your SvcOpts: the 'Auth-Application-Id' tuple >> >> specifies the Application Id's that are advertised in the outgoing >> >> CER/CEA (that diameter itself sends) while 'applications' specifies >> >> corresponding dictionary modules. In your case, advertising the common >> >> application (0) during capabilities exchange but backing it up with a >> >> dictionary that implement CC (4) is what causes things to go south. >> >> >> >> What you want is something like this: >> >> >> >> {'Auth-Application-Id', [0,4]}, >> >> {application, [{alias, cc}, >> >> {dictionary, diameter_gen_base_rfc4006}, >> >> {module, [server_cb, cc]}], >> >> {application, [{alias, base}, >> >> {dictionary, diameter_gen_base_rfc6733}, >> >> {module, [server_cb, base]}]} >> >> >> >> That is, advertise both application with the Auth-Application-Id >> >> config and configure corresponding dictionaries with 'application' >> >> config. You might prefer two different callback modules (instead of an >> >> extra argument) but the point is to match your advertised capabilities >> >> with your configured dictionaries. >> >> >> >> On a side note, you shouldn't use a diameter prefix on your own >> >> dictionaries, so as not to collide with something diameter does in the >> >> future. >> >> >> >> /Anders, Erlang/OTP >> >> >> >> > >> >> > =ERROR REPORT==== 20-Mar-2013::21:40:50 === >> >> > ** Generic server <0.3841.0> terminating >> >> > ** Last message in was {diameter, >> >> > {recv, >> >> > >> >> > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, >> >> > >> >> > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, >> >> > >> >> > 101,110,116,46,101,120,97,109,112,108,101, >> >> > >> >> > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, >> >> > >> >> > 120,97,109,112,108,101,46,99,111,109,0,0,0, >> >> > >> >> > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, >> >> > >> >> > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, >> >> > >> >> > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, >> >> > 0>>}} >> >> > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, >> >> > diameter_gen_base_rfc3588, >> >> > {diameter_service,<0.50.0>, >> >> > {diameter_caps,"server.example.com", >> >> > "example.com", >> >> > [{127,0,0,1}], >> >> > 193,"Server",[],[], >> >> > [0], >> >> > [],[],[],[],[]}, >> >> > [{diameter_app,server, >> >> > diameter_gen_base_rfc4006_cc, >> >> > [server_cb], >> >> > server,4,false, >> >> > [{answer_errors,report}, >> >> > >> {request_errors,answer_3xxx}]}]}, >> >> > false,exit} >> >> > ** Reason for termination == >> >> > ** {{badmatch,{error,{app_not_configured,0}}}, >> >> > [{diameter_peer_fsm,recv_CER,2, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, >> >> > {diameter_peer_fsm,build_answer,3, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, >> >> > {diameter_peer_fsm,send_answer,3, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, >> >> > {diameter_peer_fsm,handle_info,2, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, >> >> > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, >> >> > >> {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} >> >> > >> >> > >> >> > Could you give me some hints on this issue? The erlang debugger is >> not >> >> > easy >> >> > to use and call stack information is hard to read (when I show the >> trace >> >> > window, all the buttons for step/next/continue become invisible). The >> >> > diameter guidance explains the concept but no clear steps about >> >> > configuration. >> >> > >> >> > >> >> > Many thanks! >> >> > >> >> > Samuel >> >> > >> >> > >> >> > >> >> > On Tue, Mar 12, 2013 at 12:10 PM, S X >> wrote: >> >> >> >> >> >> Hello, Anders & Andre, >> >> >> >> >> >> Thanks a lot for your quick responses and suggestions, which help me >> >> >> start >> >> >> to exploring Erlang world ^_^ >> >> >> >> >> >> I was able to generate based on the file rfc4006_cc.dia under the >> >> >> diameter/examples/dict folders. And understand a bit why and how >> Erlang >> >> >> diameter protocol dictionaries are organized and maintained. >> >> >> >> >> >> Many thanks and talk to you later! >> >> >> >> >> >> Samuel >> >> >> >> >> >> >> >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson < >> anders.otp@REDACTED> >> >> >> wrote: >> >> >>> >> >> >>> Btw, there's an RFC 4006 dictionary (and a few more) under >> >> >>> diameter/examples/dict in the repo. >> >> >>> >> >> >>> /Anders, Erlang/OTP >> >> >>> >> >> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf >> >> >>> wrote: >> >> >>> > Hello S(?) >> >> >>> > >> >> >>> > You have to come up with your own .dia file if the message types >> are >> >> >>> > not covered in the .dia files provided by Erlang. Your own .dia >> file >> >> >>> > will typically include the '@inherits diameter_gen_base_rfc3588' >> >> >>> > clause which imports the basic avp's from rfc3588. You then have >> to >> >> >>> > provide the missing avp's for your CCR/CCA message types, and >> also >> >> >>> > define these messages. Thanks to the format of a .dia file it is >> >> >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is >> >> >>> > ready, you use diameterc to generate the .erl and .hrl file. >> >> >>> > >> >> >>> > Hope that helped! >> >> >>> > >> >> >>> > BR/Andr? >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> > On 12 March 2013 04:58, S X wrote: >> >> >>> >> Hello, >> >> >>> >> >> >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could >> >> >>> >> provide >> >> >>> >> some >> >> >>> >> suggestions on how to utilize the diameter library properly in >> >> >>> >> Erlang. >> >> >>> >> >> >> >>> >> For example, I want to send/receive some Gx messages, like CCR >> >> >>> >> (Credit >> >> >>> >> Control Request), CCA(Credit Control Answer messages. But I >> notice >> >> >>> >> that >> >> >>> >> there are some predefined messages in erlang diameter library. >> As >> >> >>> >> my >> >> >>> >> understanding, should use the utility diameterc to generate >> erlang >> >> >>> >> header/source files based on dia files. There are few dia files >> >> >>> >> under >> >> >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >> >> >>> >> base_rfc3588.dia, >> >> >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files >> >> >>> >> don't >> >> >>> >> have >> >> >>> >> the definitions for Gx. >> >> >>> >> >> >> >>> >> How should I generate or where can I obtain dia files which have >> >> >>> >> support for >> >> >>> >> CCR/CCA message format? Are the dia files proprietary or >> >> >>> >> manufacturer >> >> >>> >> specific? Can I generate with the 3GPP spec? What are the proper >> >> >>> >> steps? >> >> >>> >> >> >> >>> >> Thanks a lot! >> >> >>> >> >> >> >>> >> S >> >> >>> >> >> >> >>> >> >> >> >>> >> _______________________________________________ >> >> >>> >> 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 g@REDACTED Fri Mar 22 20:00:38 2013 From: g@REDACTED (Garrett Smith) Date: Fri, 22 Mar 2013 12:00:38 -0700 Subject: [erlang-questions] introductory book In-Reply-To: References: <514CA7A2.9080605@gmail.com> Message-ID: In addition, buy as many books as you can afford! Amazon "look inside" and reader reviews will give help you prioritize your list (not pimping Amazon, but the information there is useful): http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords=erlang The 2nd edition of Joe Armstrong's book is due in April, so you might wait a few weeks on that one. Garrett On Fri, Mar 22, 2013 at 11:50 AM, Zabrane Mickael wrote: > +1 http://learnyousomeerlang.com/ > > It's free... > > Regards, > Zabrane > > > On Mar 22, 2013, at 7:49 PM, Rados?aw Misiuk wrote: > > Well, as I suppose, if you're a total novice in Erlang world, Introducing > Erlang [1] should do, especially read with [2] on par. > > [1] http://shop.oreilly.com/product/0636920025818.do > [2] http://chimera.labs.oreilly.com/books/1234000000726 > > Regards, > Radek > > W dniu 2013-03-22 19:39, washington3@REDACTED pisze: > > Can you suggest an introductory book on Erlang? > > > _______________________________________________ > > 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 lee.sylvester@REDACTED Fri Mar 22 20:25:21 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Fri, 22 Mar 2013 19:25:21 +0000 Subject: [erlang-questions] Messaging patterns Message-ID: <06E4AE6F-0888-4B41-95CD-5B712690C9AE@gmail.com> Hey guys, I'm writing a messaging service where connected users are placed in a room. Users can then message other users in this same room. This is the easy part :-) I now want to make this service distributed. Users will be added to rooms in a service that is most "available", so it must be at the nearest datacentre with the least load. Therefore, I need to find a pattern that allows users to communicate across services. Essentially, users should be able to message anyone in there room regardless of what service manages their connection. However, if I have 200 services, but only two people in a room, I'd like to avoid those other 198 services having to deal with the messages. Question is, then, does anyone know of a pattern or best practice that supports this paradigm? Thanks loads in advance. Lee From erlangprogram@REDACTED Fri Mar 22 20:56:18 2013 From: erlangprogram@REDACTED (S X) Date: Fri, 22 Mar 2013 15:56:18 -0400 Subject: [erlang-questions] Messaging patterns In-Reply-To: <06E4AE6F-0888-4B41-95CD-5B712690C9AE@gmail.com> References: <06E4AE6F-0888-4B41-95CD-5B712690C9AE@gmail.com> Message-ID: Hi Lee, Not sure I understood your problem correct or not. Just try to throw some ideas. What you want to do is similar to the massive online gaming with virtual play rooms. And player wants to get into one player room dynamically decided by the server. Basically, you want to do the following things: - Service Routing: meaning routing the user to the proper node (having service with least load?) - Node information sharing/communicating - Load balancing algorithm As my understanding, RIAK (the distributed database in erlang) has capabilities to do more than the above. Maybe you can refer to it as a reference to get some ideas. Samuel On Fri, Mar 22, 2013 at 3:25 PM, Lee Sylvester wrote: > Hey guys, > > I'm writing a messaging service where connected users are placed in a > room. Users can then message other users in this same room. This is the > easy part :-) > > I now want to make this service distributed. Users will be added to rooms > in a service that is most "available", so it must be at the nearest > datacentre with the least load. Therefore, I need to find a pattern that > allows users to communicate across services. Essentially, users should be > able to message anyone in there room regardless of what service manages > their connection. However, if I have 200 services, but only two people in > a room, I'd like to avoid those other 198 services having to deal with the > messages. > > Question is, then, does anyone know of a pattern or best practice that > supports this paradigm? > > Thanks loads in advance. > > Lee > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Sat Mar 23 01:34:06 2013 From: mfidelman@REDACTED (Miles Fidelman) Date: Fri, 22 Mar 2013 20:34:06 -0400 Subject: [erlang-questions] introductory book In-Reply-To: References: Message-ID: <514CF87E.7000400@meetinghouse.net> washington3@REDACTED wrote: > Can you suggest an introductory book on Erlang? > _______________________________________________ Learn you some Erlang, and the couple of introductory books are well and good - but if you want to start doing USEFUL things, I highly recommend "Erlang and OTP in Action." It gets past the language and into how to use the OTP platform to build applications and systems. Miles Fidelman From anders.otp@REDACTED Sat Mar 23 11:36:57 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Sat, 23 Mar 2013 11:36:57 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: Hi Samuel. > Thanks for your quick response. But I still don't get why the DH is being > interpreted as a list of Destination-Host values ( Is it because the define > "avp_arity('CCR', 'Destination-Host') -> {0, 1};"). It's because Destination-Host is defined as optional in CCR: CCR ::= < Diameter Header: 272, REQ, PXY > ... [ Destination-Host ] ... This results in the avp_arity/2 clause you noted in the corresponding dictionary module. > And if it is treated as a list, how come it has a length greater than 1, I > just set it once in prepare_request. The CCR definition above causes the encode of a CCR record to expect the 'Destination-Host' field to be a *list* of AVP values. So, for example, 'Destination-Host' = "foo.bar.com", %% = [$f,$o,$o,$.,$b,$a,$r,$.,$c,$o,$m] is a list of 11 integer-valued Destination-Host AVP's (resulting in an encode error), whereas 'Destination-Host' = ["foo.bar.com"], is a list of 1 string-valued Destination-Host AVP. /Anders, Erlang/OTP > What should I do to correct it? Or which document should I read more > carefully to understand this properly? > > Thanks a lot! > > Samuel > > > On Fri, Mar 22, 2013 at 1:27 PM, Anders Svensson > wrote: >> >> Hi Samuel >> >> On Fri, Mar 22, 2013 at 5:55 PM, S X wrote: >> > Thanks a lot, Anders, >> > >> > I think I overlooked what the meaning of the configurable ID tag (4) in >> > the >> > dia file is , which is supposed to be the important application ID to be >> > used in the configuration. Your suggestion about the prefix is also >> > right. >> > But now I am just learning erlang diameter library. >> > >> > I just try to follow the sample RAR message style, and am still having >> > issue >> > with sending CCR message. The client configuration now is: >> > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> > {'Origin-Realm', "example.com"}, >> > {'Vendor-Id', 193}, >> > {'Product-Name', "Client"}, >> > {'Auth-Application-Id', >> > [?DIAMETER_APP_ID_CCRA]}, >> > {application, [{alias, ?APP_CCR_ALIAS}, >> > {dictionary, >> > ?DIAMETER_DICT_CCRA}, >> > {module, client_cb_ccra}]}]). >> > >> > Try to send CCR message: >> > >> > call(Name) -> >> > SId = diameter:session_id(?L(Name)), >> > CCR = #diameter_base_rfc4006_cc_CCR{ >> > 'Session-Id' = SId, >> > 'Service-Context-Id' = "Test", >> > 'CC-Request-Type' = >> > ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', >> > 'CC-Request-Number' = 0, >> > 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, >> > 'User-Name' = "Me"}, >> > diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). >> > >> > >> > In the client callback module: >> > >> > prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> >> > #diameter_caps{origin_host = {OH, DH}, >> > origin_realm = {OR, DR}} >> > = Caps, >> > >> > {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, >> > 'Origin-Realm' = OR, >> > 'Destination-Host' = DH, >> > 'Destination-Realm' = DR}}. >> > >> > I got the error about AVP property: >> > >> > =ERROR REPORT==== 22-Mar-2013::00:17:31 === >> > why: {diameter_codec,encode, >> > {{repeated_avp_excessive_arity,'Destination-Host',1, >> > "server.example.com",'CCR'}, >> >> This is because Destination-Host is optional in CCR and AVP's are >> encoded differently in a message record depending on whether or not >> there can be exactly one occurrence: if so then the field value should >> be the AVP value, if not then a list of AVP values. That is, your CCR >> record should have >> >> 'Destination-Host' = [DH], >> >> in this case. >> >> > [{diameter_gen_base_rfc4006_cc,encode_avps,2, >> > >> > [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, >> > >> > {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, >> > {diameter_codec,encode,2, >> > [{file,"diameter_codec.erl"},{line,63}]}, >> > {diameter_traffic,encode,3, >> > [{file,"diameter_traffic.erl"},{line,1437}]}, >> > {diameter_traffic,send_R,6, >> > [{file,"diameter_traffic.erl"},{line,1276}]}, >> > {diameter_traffic,'-send_request/4-fun-0-',4, >> > [{file,"diameter_traffic.erl"},{line,1050}]}]}} >> > who: <0.180.0> >> > what: {diameter_codec,encode, >> > [diameter_gen_base_rfc4006_cc, >> > {diameter_packet, >> > {diameter_header,1,undefined,undefined,undefined, >> > >> > 1330492780,1330492780,undefined,undefined,undefined, >> > undefined}, >> > undefined, >> > {diameter_base_rfc4006_cc_CCR, >> > >> > ["client",";","1425429748",";","2",";","nonode@REDACTED"], >> > >> > "client.example.com","example.com","example.com",4, >> > >> > "Test",1,0,"server.example.com","Me",[],[],[],[],[],[], >> > [],[],[],[],[],[],[],[],[],[],[],[]}, >> > undefined,[],undefined}]} >> > >> > My understanding is that the client callback prepare_request sets the >> > "Destination-Host" (retrievd via the CER/A done at earilier stage) in >> > the >> > CCR message. So I should set it right. But seems I still misunderstand >> > something. Does the error information "repeated_avp_excessive_arity" >> > mean " >> > 0-1 Zero or one instance of the AVP MAY be present in the message. It is >> >> Yes, exactly. In your case your DH is being interpreted as list of >> Destination-Host values, and "excessive arity" is a result of that >> list having length greater than 1. >> >> /Anders, Erlang/OTP >> >> >> > considered an error if there is more than one instance of the AVP" >> > according >> > to rfc4006 spec? The erlang error message is not that straightforward, >> > really confusing newbies:). >> > >> > Do you have any hints? (I hope I could provide some ramp up steps for >> > other >> > people to learn with erlang diameter library after making it work^_^) >> > >> > Many thanks, >> > >> > Samuel >> > >> > >> > >> > On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson >> > wrote: >> >> >> >> On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: >> >> > Hello, >> >> > >> >> > Sorry, I still have some problems with sending CCR/CCA messages. I >> >> > didn't >> >> > quite get how to configure multiple diameter applications though it >> >> > seems >> >> > clear when I read the diameter protocol. >> >> > >> >> > Based on the sample diameter code, I made the following changes, >> >> > diameter_gen_base_rfc4006_cc is the dictionary generated with >> >> > rfc4006_cc.dia: >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> >> > >> >> > -define(SVC_NAME, ?MODULE). >> >> > -define(APP_ALIAS, ?MODULE). >> >> > -define(CALLBACK_MOD, client_cb). >> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> >> > >> >> > -define(L, atom_to_list). >> >> > >> >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> >> > {'Origin-Realm', "example.com"}, >> >> > {'Vendor-Id', 0}, >> >> > {'Product-Name', "Client"}, >> >> > {'Auth-Application-Id', >> >> > [?DIAMETER_APP_ID_COMMON]}, >> >> > {application, [{alias, ?APP_ALIAS}, >> >> > {dictionary, >> >> > ?DIAMETER_DICT_CCRA}, >> >> > {module, ?CALLBACK_MOD}]}]). >> >> > >> >> > >> >> > >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server >> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> >> > >> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >> >> > >> >> > init(State) -> >> >> > SvcName = ?MODULE, >> >> > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ >> >> > ".example.com"}, >> >> > {'Origin-Realm', "example.com"}, >> >> > {'Vendor-Id', 193}, >> >> > {'Product-Name', "Server"}, >> >> > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, >> >> > {application, [{alias, ?MODULE}, >> >> > {dictionary, ?DIAMETER_DICT_CCRA}, >> >> > {module, server_cb}]}], >> >> > TransportOpts = [{transport_module, diameter_tcp}, >> >> > {transport_config, [{reuseaddr, true}, >> >> > {ip, {127,0,0,1}}, {port, 3868}]}], >> >> > diameter:start(), >> >> > diameter:start_service(SvcName, SvcOpts), >> >> > diameter:add_transport(SvcName, {listen, TransportOpts}), >> >> > erlang:display("Set up diameter server completed!"), >> >> > {ok, State}. >> >> > >> >> > >> >> > >> >> > I changed the callbacks client_cb and server_cb to handle CCR/CCA >> >> > messages. >> >> > >> >> > >> >> > However, I got the following errors "app_not_configured". It seems >> >> > the >> >> > configuration for applications is incorrect. How should I configure >> >> > the >> >> > service properly? My understanding is I want to reuse CER/CEA as >> >> > default >> >> > authorization application, but the erlang diameter doesn't explain >> >> > how >> >> > to do >> >> > it. Or my understanding is incorrect at all. >> >> >> >> The problem is a mismatch between the application and capabilities >> >> configuration in your SvcOpts: the 'Auth-Application-Id' tuple >> >> specifies the Application Id's that are advertised in the outgoing >> >> CER/CEA (that diameter itself sends) while 'applications' specifies >> >> corresponding dictionary modules. In your case, advertising the common >> >> application (0) during capabilities exchange but backing it up with a >> >> dictionary that implement CC (4) is what causes things to go south. >> >> >> >> What you want is something like this: >> >> >> >> {'Auth-Application-Id', [0,4]}, >> >> {application, [{alias, cc}, >> >> {dictionary, diameter_gen_base_rfc4006}, >> >> {module, [server_cb, cc]}], >> >> {application, [{alias, base}, >> >> {dictionary, diameter_gen_base_rfc6733}, >> >> {module, [server_cb, base]}]} >> >> >> >> That is, advertise both application with the Auth-Application-Id >> >> config and configure corresponding dictionaries with 'application' >> >> config. You might prefer two different callback modules (instead of an >> >> extra argument) but the point is to match your advertised capabilities >> >> with your configured dictionaries. >> >> >> >> On a side note, you shouldn't use a diameter prefix on your own >> >> dictionaries, so as not to collide with something diameter does in the >> >> future. >> >> >> >> /Anders, Erlang/OTP >> >> >> >> > >> >> > =ERROR REPORT==== 20-Mar-2013::21:40:50 === >> >> > ** Generic server <0.3841.0> terminating >> >> > ** Last message in was {diameter, >> >> > {recv, >> >> > >> >> > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, >> >> > >> >> > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, >> >> > >> >> > 101,110,116,46,101,120,97,109,112,108,101, >> >> > >> >> > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, >> >> > >> >> > 120,97,109,112,108,101,46,99,111,109,0,0,0, >> >> > >> >> > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, >> >> > >> >> > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, >> >> > >> >> > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, >> >> > 0>>}} >> >> > ** When Server state == {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, >> >> > diameter_gen_base_rfc3588, >> >> > {diameter_service,<0.50.0>, >> >> > {diameter_caps,"server.example.com", >> >> > "example.com", >> >> > [{127,0,0,1}], >> >> > 193,"Server",[],[], >> >> > [0], >> >> > [],[],[],[],[]}, >> >> > [{diameter_app,server, >> >> > diameter_gen_base_rfc4006_cc, >> >> > [server_cb], >> >> > server,4,false, >> >> > [{answer_errors,report}, >> >> > >> >> > {request_errors,answer_3xxx}]}]}, >> >> > false,exit} >> >> > ** Reason for termination == >> >> > ** {{badmatch,{error,{app_not_configured,0}}}, >> >> > [{diameter_peer_fsm,recv_CER,2, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, >> >> > {diameter_peer_fsm,build_answer,3, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, >> >> > {diameter_peer_fsm,send_answer,3, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, >> >> > {diameter_peer_fsm,handle_info,2, >> >> > >> >> > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, >> >> > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, >> >> > >> >> > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} >> >> > >> >> > >> >> > Could you give me some hints on this issue? The erlang debugger is >> >> > not >> >> > easy >> >> > to use and call stack information is hard to read (when I show the >> >> > trace >> >> > window, all the buttons for step/next/continue become invisible). The >> >> > diameter guidance explains the concept but no clear steps about >> >> > configuration. >> >> > >> >> > >> >> > Many thanks! >> >> > >> >> > Samuel >> >> > >> >> > >> >> > >> >> > On Tue, Mar 12, 2013 at 12:10 PM, S X >> >> > wrote: >> >> >> >> >> >> Hello, Anders & Andre, >> >> >> >> >> >> Thanks a lot for your quick responses and suggestions, which help me >> >> >> start >> >> >> to exploring Erlang world ^_^ >> >> >> >> >> >> I was able to generate based on the file rfc4006_cc.dia under the >> >> >> diameter/examples/dict folders. And understand a bit why and how >> >> >> Erlang >> >> >> diameter protocol dictionaries are organized and maintained. >> >> >> >> >> >> Many thanks and talk to you later! >> >> >> >> >> >> Samuel >> >> >> >> >> >> >> >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson >> >> >> >> >> >> wrote: >> >> >>> >> >> >>> Btw, there's an RFC 4006 dictionary (and a few more) under >> >> >>> diameter/examples/dict in the repo. >> >> >>> >> >> >>> /Anders, Erlang/OTP >> >> >>> >> >> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf >> >> >>> wrote: >> >> >>> > Hello S(?) >> >> >>> > >> >> >>> > You have to come up with your own .dia file if the message types >> >> >>> > are >> >> >>> > not covered in the .dia files provided by Erlang. Your own .dia >> >> >>> > file >> >> >>> > will typically include the '@inherits diameter_gen_base_rfc3588' >> >> >>> > clause which imports the basic avp's from rfc3588. You then have >> >> >>> > to >> >> >>> > provide the missing avp's for your CCR/CCA message types, and >> >> >>> > also >> >> >>> > define these messages. Thanks to the format of a .dia file it is >> >> >>> > pretty much copy-pasting from the rfc4006. Once your .dia file is >> >> >>> > ready, you use diameterc to generate the .erl and .hrl file. >> >> >>> > >> >> >>> > Hope that helped! >> >> >>> > >> >> >>> > BR/Andr? >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> > On 12 March 2013 04:58, S X wrote: >> >> >>> >> Hello, >> >> >>> >> >> >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could >> >> >>> >> provide >> >> >>> >> some >> >> >>> >> suggestions on how to utilize the diameter library properly in >> >> >>> >> Erlang. >> >> >>> >> >> >> >>> >> For example, I want to send/receive some Gx messages, like CCR >> >> >>> >> (Credit >> >> >>> >> Control Request), CCA(Credit Control Answer messages. But I >> >> >>> >> notice >> >> >>> >> that >> >> >>> >> there are some predefined messages in erlang diameter library. >> >> >>> >> As >> >> >>> >> my >> >> >>> >> understanding, should use the utility diameterc to generate >> >> >>> >> erlang >> >> >>> >> header/source files based on dia files. There are few dia files >> >> >>> >> under >> >> >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >> >> >>> >> base_rfc3588.dia, >> >> >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files >> >> >>> >> don't >> >> >>> >> have >> >> >>> >> the definitions for Gx. >> >> >>> >> >> >> >>> >> How should I generate or where can I obtain dia files which have >> >> >>> >> support for >> >> >>> >> CCR/CCA message format? Are the dia files proprietary or >> >> >>> >> manufacturer >> >> >>> >> specific? Can I generate with the 3GPP spec? What are the proper >> >> >>> >> steps? >> >> >>> >> >> >> >>> >> Thanks a lot! >> >> >>> >> >> >> >>> >> S >> >> >>> >> >> >> >>> >> >> >> >>> >> _______________________________________________ >> >> >>> >> 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 simonstl@REDACTED Sat Mar 23 11:51:48 2013 From: simonstl@REDACTED (Simon St.Laurent) Date: Sat, 23 Mar 2013 06:51:48 -0400 Subject: [erlang-questions] introductory book In-Reply-To: <514CA7A2.9080605@gmail.com> References: <514CA7A2.9080605@gmail.com> Message-ID: <514D8944.3030904@simonstl.com> On 3/22/13 2:49 PM, Rados?aw Misiuk wrote: > Well, as I suppose, if you're a total novice in Erlang world, > Introducing Erlang [1] should do, especially read with [2] on par. > > [1] http://shop.oreilly.com/product/0636920025818.do > [2] http://chimera.labs.oreilly.com/books/1234000000726 It depends on where you are in programming and learning. I wrote Introducing Erlang for people starting with nothing but a rough sense of programming. In many ways it's meant to be a welcoming companion before (or during) reading Learn You Some Erlang, Erlang Programming, or Programming Erlang. If you want to learn at a faster pace (and go much further), Learn You Some Erlang For Great Good is stunning. I'm very happy that LYSE and Introducing came out at just about the same time, and even happier that Fred Hebert was kind enough to tech review Introducing while he was finishing up LYSE. Etudes for Erlang amazes me - I didn't expect someone to write a companion to my book, and J. David Eisenberg turned up with wonderful exercises. I'll have more on that soon! Thanks, -- Simon St.Laurent http://simonstl.com/ From paul.james.barry@REDACTED Sat Mar 23 12:06:25 2013 From: paul.james.barry@REDACTED (Paul Barry) Date: Sat, 23 Mar 2013 11:06:25 +0000 Subject: [erlang-questions] Erlang4android issue on Nexus Message-ID: Hi all. I've been playing with one of the new Nexus 7" tablets and I have sl4a installed and running fine (with Python). However, when I install the Erlang4android stuff from code.google.com, I get an "exited" console message whenever I try to run anything (e.g., client.erl from the example). I can see from other messages on this list that others have got this working on other devices... But has anybody tried it on a Nexus, and if you did, how did you get on? Thanks, Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.otp@REDACTED Sat Mar 23 12:11:21 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Sat, 23 Mar 2013 12:11:21 +0100 Subject: [erlang-questions] erlang diameter dictionary In-Reply-To: References: Message-ID: On Fri, Mar 22, 2013 at 7:52 PM, S X wrote: > Hi Anders, > > Sorry, I think I understand now. You told me the solution. Just use '[ ]'. > > Anyhow, many thanks! > > By the way, since 3588 is obsolete, can I use 6733 while compile other > dictionaries? Yes. /Anders > > Thanks! > > Samuel > > > On Fri, Mar 22, 2013 at 2:46 PM, S X wrote: >> >> Hi Anders, >> >> Thanks for your quick response. But I still don't get why the DH is being >> interpreted as a list of Destination-Host values ( Is it because the define >> "avp_arity('CCR', 'Destination-Host') -> {0, 1};"). >> >> And if it is treated as a list, how come it has a length greater than 1, I >> just set it once in prepare_request. >> >> What should I do to correct it? Or which document should I read more >> carefully to understand this properly? >> >> Thanks a lot! >> >> Samuel >> >> >> On Fri, Mar 22, 2013 at 1:27 PM, Anders Svensson >> wrote: >>> >>> Hi Samuel >>> >>> On Fri, Mar 22, 2013 at 5:55 PM, S X wrote: >>> > Thanks a lot, Anders, >>> > >>> > I think I overlooked what the meaning of the configurable ID tag (4) in >>> > the >>> > dia file is , which is supposed to be the important application ID to >>> > be >>> > used in the configuration. Your suggestion about the prefix is also >>> > right. >>> > But now I am just learning erlang diameter library. >>> > >>> > I just try to follow the sample RAR message style, and am still having >>> > issue >>> > with sending CCR message. The client configuration now is: >>> > >>> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >>> > {'Origin-Realm', "example.com"}, >>> > {'Vendor-Id', 193}, >>> > {'Product-Name', "Client"}, >>> > {'Auth-Application-Id', >>> > [?DIAMETER_APP_ID_CCRA]}, >>> > {application, [{alias, ?APP_CCR_ALIAS}, >>> > {dictionary, >>> > ?DIAMETER_DICT_CCRA}, >>> > {module, client_cb_ccra}]}]). >>> > >>> > Try to send CCR message: >>> > >>> > call(Name) -> >>> > SId = diameter:session_id(?L(Name)), >>> > CCR = #diameter_base_rfc4006_cc_CCR{ >>> > 'Session-Id' = SId, >>> > 'Service-Context-Id' = "Test", >>> > 'CC-Request-Type' = >>> > ?'DIAMETER_BASE_RFC4006_CC_CC-REQUEST-TYPE_INITIAL_REQUEST', >>> > 'CC-Request-Number' = 0, >>> > 'Auth-Application-Id' = ?DIAMETER_APP_ID_CCRA, >>> > 'User-Name' = "Me"}, >>> > diameter:call(Name, ?APP_CCR_ALIAS, CCR, []). >>> > >>> > >>> > In the client callback module: >>> > >>> > prepare_request(#diameter_packet{msg = Rec}, _, {_, Caps}) -> >>> > #diameter_caps{origin_host = {OH, DH}, >>> > origin_realm = {OR, DR}} >>> > = Caps, >>> > >>> > {send, Rec#diameter_base_rfc4006_cc_CCR{'Origin-Host' = OH, >>> > 'Origin-Realm' = OR, >>> > 'Destination-Host' = DH, >>> > 'Destination-Realm' = DR}}. >>> > >>> > I got the error about AVP property: >>> > >>> > =ERROR REPORT==== 22-Mar-2013::00:17:31 === >>> > why: {diameter_codec,encode, >>> > {{repeated_avp_excessive_arity,'Destination-Host',1, >>> > "server.example.com",'CCR'}, >>> >>> This is because Destination-Host is optional in CCR and AVP's are >>> encoded differently in a message record depending on whether or not >>> there can be exactly one occurrence: if so then the field value should >>> be the AVP value, if not then a list of AVP values. That is, your CCR >>> record should have >>> >>> 'Destination-Host' = [DH], >>> >>> in this case. >>> >>> > [{diameter_gen_base_rfc4006_cc,encode_avps,2, >>> > >>> > [{file,"diameter_gen_base_rfc4006_cc.erl"},{line,47}]}, >>> > >>> > {diameter_codec,e,2,[{file,"diameter_codec.erl"},{line,112}]}, >>> > {diameter_codec,encode,2, >>> > [{file,"diameter_codec.erl"},{line,63}]}, >>> > {diameter_traffic,encode,3, >>> > [{file,"diameter_traffic.erl"},{line,1437}]}, >>> > {diameter_traffic,send_R,6, >>> > [{file,"diameter_traffic.erl"},{line,1276}]}, >>> > {diameter_traffic,'-send_request/4-fun-0-',4, >>> > [{file,"diameter_traffic.erl"},{line,1050}]}]}} >>> > who: <0.180.0> >>> > what: {diameter_codec,encode, >>> > [diameter_gen_base_rfc4006_cc, >>> > {diameter_packet, >>> > {diameter_header,1,undefined,undefined,undefined, >>> > >>> > 1330492780,1330492780,undefined,undefined,undefined, >>> > undefined}, >>> > undefined, >>> > {diameter_base_rfc4006_cc_CCR, >>> > >>> > ["client",";","1425429748",";","2",";","nonode@REDACTED"], >>> > >>> > "client.example.com","example.com","example.com",4, >>> > >>> > "Test",1,0,"server.example.com","Me",[],[],[],[],[],[], >>> > [],[],[],[],[],[],[],[],[],[],[],[]}, >>> > undefined,[],undefined}]} >>> > >>> > My understanding is that the client callback prepare_request sets the >>> > "Destination-Host" (retrievd via the CER/A done at earilier stage) in >>> > the >>> > CCR message. So I should set it right. But seems I still misunderstand >>> > something. Does the error information "repeated_avp_excessive_arity" >>> > mean " >>> > 0-1 Zero or one instance of the AVP MAY be present in the message. It >>> > is >>> >>> Yes, exactly. In your case your DH is being interpreted as list of >>> Destination-Host values, and "excessive arity" is a result of that >>> list having length greater than 1. >>> >>> /Anders, Erlang/OTP >>> >>> >>> > considered an error if there is more than one instance of the AVP" >>> > according >>> > to rfc4006 spec? The erlang error message is not that straightforward, >>> > really confusing newbies:). >>> > >>> > Do you have any hints? (I hope I could provide some ramp up steps for >>> > other >>> > people to learn with erlang diameter library after making it work^_^) >>> > >>> > Many thanks, >>> > >>> > Samuel >>> > >>> > >>> > >>> > On Thu, Mar 21, 2013 at 8:59 AM, Anders Svensson >>> > wrote: >>> >> >>> >> On Thu, Mar 21, 2013 at 2:55 AM, S X wrote: >>> >> > Hello, >>> >> > >>> >> > Sorry, I still have some problems with sending CCR/CCA messages. I >>> >> > didn't >>> >> > quite get how to configure multiple diameter applications though it >>> >> > seems >>> >> > clear when I read the diameter protocol. >>> >> > >>> >> > Based on the sample diameter code, I made the following changes, >>> >> > diameter_gen_base_rfc4006_cc is the dictionary generated with >>> >> > rfc4006_cc.dia: >>> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Client >>> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >>> >> > >>> >> > -define(SVC_NAME, ?MODULE). >>> >> > -define(APP_ALIAS, ?MODULE). >>> >> > -define(CALLBACK_MOD, client_cb). >>> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >>> >> > >>> >> > -define(L, atom_to_list). >>> >> > >>> >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >>> >> > {'Origin-Realm', "example.com"}, >>> >> > {'Vendor-Id', 0}, >>> >> > {'Product-Name', "Client"}, >>> >> > {'Auth-Application-Id', >>> >> > [?DIAMETER_APP_ID_COMMON]}, >>> >> > {application, [{alias, ?APP_ALIAS}, >>> >> > {dictionary, >>> >> > ?DIAMETER_DICT_CCRA}, >>> >> > {module, ?CALLBACK_MOD}]}]). >>> >> > >>> >> > >>> >> > >>> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Server >>> >> > $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >>> >> > >>> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_base_rfc4006_cc). >>> >> > >>> >> > init(State) -> >>> >> > SvcName = ?MODULE, >>> >> > SvcOpts = [{'Origin-Host', atom_to_list(SvcName) ++ >>> >> > ".example.com"}, >>> >> > {'Origin-Realm', "example.com"}, >>> >> > {'Vendor-Id', 193}, >>> >> > {'Product-Name', "Server"}, >>> >> > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON]}, >>> >> > {application, [{alias, ?MODULE}, >>> >> > {dictionary, ?DIAMETER_DICT_CCRA}, >>> >> > {module, server_cb}]}], >>> >> > TransportOpts = [{transport_module, diameter_tcp}, >>> >> > {transport_config, [{reuseaddr, true}, >>> >> > {ip, {127,0,0,1}}, {port, 3868}]}], >>> >> > diameter:start(), >>> >> > diameter:start_service(SvcName, SvcOpts), >>> >> > diameter:add_transport(SvcName, {listen, TransportOpts}), >>> >> > erlang:display("Set up diameter server completed!"), >>> >> > {ok, State}. >>> >> > >>> >> > >>> >> > >>> >> > I changed the callbacks client_cb and server_cb to handle CCR/CCA >>> >> > messages. >>> >> > >>> >> > >>> >> > However, I got the following errors "app_not_configured". It seems >>> >> > the >>> >> > configuration for applications is incorrect. How should I configure >>> >> > the >>> >> > service properly? My understanding is I want to reuse CER/CEA as >>> >> > default >>> >> > authorization application, but the erlang diameter doesn't explain >>> >> > how >>> >> > to do >>> >> > it. Or my understanding is incorrect at all. >>> >> >>> >> The problem is a mismatch between the application and capabilities >>> >> configuration in your SvcOpts: the 'Auth-Application-Id' tuple >>> >> specifies the Application Id's that are advertised in the outgoing >>> >> CER/CEA (that diameter itself sends) while 'applications' specifies >>> >> corresponding dictionary modules. In your case, advertising the common >>> >> application (0) during capabilities exchange but backing it up with a >>> >> dictionary that implement CC (4) is what causes things to go south. >>> >> >>> >> What you want is something like this: >>> >> >>> >> {'Auth-Application-Id', [0,4]}, >>> >> {application, [{alias, cc}, >>> >> {dictionary, diameter_gen_base_rfc4006}, >>> >> {module, [server_cb, cc]}], >>> >> {application, [{alias, base}, >>> >> {dictionary, diameter_gen_base_rfc6733}, >>> >> {module, [server_cb, base]}]} >>> >> >>> >> That is, advertise both application with the Auth-Application-Id >>> >> config and configure corresponding dictionaries with 'application' >>> >> config. You might prefer two different callback modules (instead of an >>> >> extra argument) but the point is to match your advertised capabilities >>> >> with your configured dictionaries. >>> >> >>> >> On a side note, you shouldn't use a diameter prefix on your own >>> >> dictionaries, so as not to collide with something diameter does in the >>> >> future. >>> >> >>> >> /Anders, Erlang/OTP >>> >> >>> >> > >>> >> > =ERROR REPORT==== 20-Mar-2013::21:40:50 === >>> >> > ** Generic server <0.3841.0> terminating >>> >> > ** Last message in was {diameter, >>> >> > {recv, >>> >> > >>> >> > <<1,0,0,124,128,0,1,1,0,0,0,0,101,222,1,72, >>> >> > >>> >> > 101,222,1,72,0,0,1,8,64,0,0,26,99,108,105, >>> >> > >>> >> > 101,110,116,46,101,120,97,109,112,108,101, >>> >> > >>> >> > 46,99,111,109,0,0,0,0,1,40,64,0,0,19,101, >>> >> > >>> >> > 120,97,109,112,108,101,46,99,111,109,0,0,0, >>> >> > >>> >> > 1,1,64,0,0,14,0,1,127,0,0,1,0,0,0,0,1,10,64, >>> >> > >>> >> > 0,0,12,0,0,0,193,0,0,1,13,0,0,0,14,67,108, >>> >> > >>> >> > 105,101,110,116,0,0,0,0,1,2,64,0,0,12,0,0,0, >>> >> > 0>>}} >>> >> > ** When Server state == >>> >> > {state,recv_CER,accept,<0.3840.0>,<0.3842.0>, >>> >> > diameter_gen_base_rfc3588, >>> >> > {diameter_service,<0.50.0>, >>> >> > {diameter_caps,"server.example.com", >>> >> > "example.com", >>> >> > [{127,0,0,1}], >>> >> > 193,"Server",[],[], >>> >> > [0], >>> >> > [],[],[],[],[]}, >>> >> > [{diameter_app,server, >>> >> > diameter_gen_base_rfc4006_cc, >>> >> > [server_cb], >>> >> > server,4,false, >>> >> > [{answer_errors,report}, >>> >> > >>> >> > {request_errors,answer_3xxx}]}]}, >>> >> > false,exit} >>> >> > ** Reason for termination == >>> >> > ** {{badmatch,{error,{app_not_configured,0}}}, >>> >> > [{diameter_peer_fsm,recv_CER,2, >>> >> > >>> >> > [{file,"src/diameter_peer_fsm.erl"},{line,849}]}, >>> >> > {diameter_peer_fsm,build_answer,3, >>> >> > >>> >> > [{file,"src/diameter_peer_fsm.erl"},{line,680}]}, >>> >> > {diameter_peer_fsm,send_answer,3, >>> >> > >>> >> > [{file,"src/diameter_peer_fsm.erl"},{line,647}]}, >>> >> > {diameter_peer_fsm,handle_info,2, >>> >> > >>> >> > [{file,"src/diameter_peer_fsm.erl"},{line,292}]}, >>> >> > {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,607}]}, >>> >> > >>> >> > {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} >>> >> > >>> >> > >>> >> > Could you give me some hints on this issue? The erlang debugger is >>> >> > not >>> >> > easy >>> >> > to use and call stack information is hard to read (when I show the >>> >> > trace >>> >> > window, all the buttons for step/next/continue become invisible). >>> >> > The >>> >> > diameter guidance explains the concept but no clear steps about >>> >> > configuration. >>> >> > >>> >> > >>> >> > Many thanks! >>> >> > >>> >> > Samuel >>> >> > >>> >> > >>> >> > >>> >> > On Tue, Mar 12, 2013 at 12:10 PM, S X >>> >> > wrote: >>> >> >> >>> >> >> Hello, Anders & Andre, >>> >> >> >>> >> >> Thanks a lot for your quick responses and suggestions, which help >>> >> >> me >>> >> >> start >>> >> >> to exploring Erlang world ^_^ >>> >> >> >>> >> >> I was able to generate based on the file rfc4006_cc.dia under the >>> >> >> diameter/examples/dict folders. And understand a bit why and how >>> >> >> Erlang >>> >> >> diameter protocol dictionaries are organized and maintained. >>> >> >> >>> >> >> Many thanks and talk to you later! >>> >> >> >>> >> >> Samuel >>> >> >> >>> >> >> >>> >> >> On Tue, Mar 12, 2013 at 7:44 AM, Anders Svensson >>> >> >> >>> >> >> wrote: >>> >> >>> >>> >> >>> Btw, there's an RFC 4006 dictionary (and a few more) under >>> >> >>> diameter/examples/dict in the repo. >>> >> >>> >>> >> >>> /Anders, Erlang/OTP >>> >> >>> >>> >> >>> On Tue, Mar 12, 2013 at 10:32 AM, Andr? Graf >>> >> >>> wrote: >>> >> >>> > Hello S(?) >>> >> >>> > >>> >> >>> > You have to come up with your own .dia file if the message types >>> >> >>> > are >>> >> >>> > not covered in the .dia files provided by Erlang. Your own .dia >>> >> >>> > file >>> >> >>> > will typically include the '@inherits >>> >> >>> > diameter_gen_base_rfc3588' >>> >> >>> > clause which imports the basic avp's from rfc3588. You then have >>> >> >>> > to >>> >> >>> > provide the missing avp's for your CCR/CCA message types, and >>> >> >>> > also >>> >> >>> > define these messages. Thanks to the format of a .dia file it is >>> >> >>> > pretty much copy-pasting from the rfc4006. Once your .dia file >>> >> >>> > is >>> >> >>> > ready, you use diameterc to generate the .erl and .hrl file. >>> >> >>> > >>> >> >>> > Hope that helped! >>> >> >>> > >>> >> >>> > BR/Andr? >>> >> >>> > >>> >> >>> > >>> >> >>> > >>> >> >>> > On 12 March 2013 04:58, S X wrote: >>> >> >>> >> Hello, >>> >> >>> >> >>> >> >>> >> I am new to Erlang and Diameter protocol. Wish someone could >>> >> >>> >> provide >>> >> >>> >> some >>> >> >>> >> suggestions on how to utilize the diameter library properly in >>> >> >>> >> Erlang. >>> >> >>> >> >>> >> >>> >> For example, I want to send/receive some Gx messages, like CCR >>> >> >>> >> (Credit >>> >> >>> >> Control Request), CCA(Credit Control Answer messages. But I >>> >> >>> >> notice >>> >> >>> >> that >>> >> >>> >> there are some predefined messages in erlang diameter library. >>> >> >>> >> As >>> >> >>> >> my >>> >> >>> >> understanding, should use the utility diameterc to generate >>> >> >>> >> erlang >>> >> >>> >> header/source files based on dia files. There are few dia files >>> >> >>> >> under >>> >> >>> >> otp/lib/diameter/src/dict folder, like acct_rfc6733.dia, >>> >> >>> >> base_rfc3588.dia, >>> >> >>> >> relay.dia, base_accounting.dia, base_rfc6733.dia. Those files >>> >> >>> >> don't >>> >> >>> >> have >>> >> >>> >> the definitions for Gx. >>> >> >>> >> >>> >> >>> >> How should I generate or where can I obtain dia files which >>> >> >>> >> have >>> >> >>> >> support for >>> >> >>> >> CCR/CCA message format? Are the dia files proprietary or >>> >> >>> >> manufacturer >>> >> >>> >> specific? Can I generate with the 3GPP spec? What are the >>> >> >>> >> proper >>> >> >>> >> steps? >>> >> >>> >> >>> >> >>> >> Thanks a lot! >>> >> >>> >> >>> >> >>> >> S >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> _______________________________________________ >>> >> >>> >> 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 ivan@REDACTED Sat Mar 23 13:10:46 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Sat, 23 Mar 2013 12:10:46 +0000 Subject: [erlang-questions] introductory book In-Reply-To: <514CF87E.7000400@meetinghouse.net> References: <514CF87E.7000400@meetinghouse.net> Message-ID: <514D9BC6.9000404@llaisdy.com> Dear All Sorry if I'm late to this party. IMHO the Cesarini & Thompson Programming Erlang is by far and away the best for self- or group- study. Clear path through the material; exercises; can be used as tutorial or reference. The other books currently on the market for this purpose are a long way behind. Lyse and the Armstrong (Erlang Programming) are both very good books. Easy breezy reads. They both cover the material well and are full of hidden gems. Neither is just for beginners. If you are professional about your Erlang you should have all three of these books, as well as Erlang/OTP in Action. This is not an introduction to the language; it's more an introduction to "real world" concerns (eg from memory distribution and deployment). Other Erlang books currently on the market (in English) are more topic-focussed and quality is variable. n.b. Some of the above books have been translated, and other books have been written in German, Spanish and possibly other languages. Best wishes Ivan On 23/03/2013 00:34, Miles Fidelman wrote: > washington3@REDACTED wrote: >> Can you suggest an introductory book on Erlang? >> _______________________________________________ > > Learn you some Erlang, and the couple of introductory books are well and > good - but if you want to start doing USEFUL things, I highly recommend > "Erlang and OTP in Action." It gets past the language and into how to > use the OTP platform to build applications and systems. > > Miles Fidelman > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From john@REDACTED Sat Mar 23 14:09:09 2013 From: john@REDACTED (John Kemp) Date: Sat, 23 Mar 2013 06:09:09 -0700 Subject: [erlang-questions] Erlang4android issue on Nexus In-Reply-To: References: Message-ID: Hi Paul, I am running Erlang4Android on a Nexus 7, and it works fine. I followed exactly the instructions for installing on the device. Are you running E4A from a BusyBox or over ADB shell? Have you 'rooted' the Nexus 7? E4A doesn't require that AFAIK, but it might make a difference (BusyBox install did require it). JohnK On Mar 23, 2013, at 4:06 AM, Paul Barry wrote: > Hi all. > > I've been playing with one of the new Nexus 7" tablets and I have sl4a installed and running fine (with Python). However, when I install the Erlang4android stuff from code.google.com, I get an "exited" console message whenever I try to run anything (e.g., client.erl from the example). > > I can see from other messages on this list that others have got this working on other devices... But has anybody tried it on a Nexus, and if you did, how did you get on? > > Thanks, > > Paul. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From paul.james.barry@REDACTED Sat Mar 23 14:46:29 2013 From: paul.james.barry@REDACTED (Paul Barry) Date: Sat, 23 Mar 2013 13:46:29 +0000 Subject: [erlang-questions] Erlang4android issue on Nexus In-Reply-To: References: Message-ID: Thanks, John. I recall reading somewhere that E4A doesn't require me to root the device.... But, your email has given me hope as well as a few pointers to explore. Paul. On Mar 23, 2013 1:09 PM, "John Kemp" wrote: > Hi Paul, > > I am running Erlang4Android on a Nexus 7, and it works fine. I followed > exactly the instructions for installing on the device. Are you running E4A > from a BusyBox or over ADB shell? Have you 'rooted' the Nexus 7? E4A > doesn't require that AFAIK, but it might make a difference (BusyBox install > did require it). > > JohnK > > On Mar 23, 2013, at 4:06 AM, Paul Barry wrote: > > > Hi all. > > > > I've been playing with one of the new Nexus 7" tablets and I have sl4a > installed and running fine (with Python). However, when I install the > Erlang4android stuff from code.google.com, I get an "exited" console > message whenever I try to run anything (e.g., client.erl from the example). > > > > I can see from other messages on this list that others have got this > working on other devices... But has anybody tried it on a Nexus, and if you > did, how did you get on? > > > > Thanks, > > > > Paul. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lee.sylvester@REDACTED Sat Mar 23 18:24:13 2013 From: lee.sylvester@REDACTED (Lee Sylvester) Date: Sat, 23 Mar 2013 17:24:13 +0000 Subject: [erlang-questions] Messaging patterns In-Reply-To: References: <06E4AE6F-0888-4B41-95CD-5B712690C9AE@gmail.com> Message-ID: <6D63D965-AB93-44DA-9B03-EB821CFD3E48@gmail.com> Hi Samuel, Thank you for the information. The load balancing and routing I have sorted. I guess, I'm going to have to use a single node for registering where rooms exist for all nodes. I was hoping not to go that route. I've been studying Riak, but this isn't a pattern Riak requires. Kindest regards, Lee On 22 Mar 2013, at 19:56, S X wrote: > Hi Lee, > > Not sure I understood your problem correct or not. Just try to throw some ideas. > > What you want to do is similar to the massive online gaming with virtual play rooms. And player wants to get into one player room dynamically decided by the server. > > Basically, you want to do the following things: > - Service Routing: meaning routing the user to the proper node (having service with least load?) > - Node information sharing/communicating > - Load balancing algorithm > > As my understanding, RIAK (the distributed database in erlang) has capabilities to do more than the above. Maybe you can refer to it as a reference to get some ideas. > > > Samuel > > > On Fri, Mar 22, 2013 at 3:25 PM, Lee Sylvester wrote: > Hey guys, > > I'm writing a messaging service where connected users are placed in a room. Users can then message other users in this same room. This is the easy part :-) > > I now want to make this service distributed. Users will be added to rooms in a service that is most "available", so it must be at the nearest datacentre with the least load. Therefore, I need to find a pattern that allows users to communicate across services. Essentially, users should be able to message anyone in there room regardless of what service manages their connection. However, if I have 200 services, but only two people in a room, I'd like to avoid those other 198 services having to deal with the messages. > > Question is, then, does anyone know of a pattern or best practice that supports this paradigm? > > Thanks loads in advance. > > Lee > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bryan@REDACTED Sat Mar 23 19:53:44 2013 From: bryan@REDACTED (Bryan Hughes) Date: Sat, 23 Mar 2013 11:53:44 -0700 Subject: [erlang-questions] introductory book In-Reply-To: References: <514CA7A2.9080605@gmail.com> Message-ID: <514DFA38.9030501@go-factory.net> Highly recommend this one! It's great for beginners - its very complete and actually a great reference for all levels. Cheers, Bryan On 3/22/13 11:50 AM, Zabrane Mickael wrote: > +1 http://learnyousomeerlang.com/ > > It's free... > > Regards, > Zabrane > > > On Mar 22, 2013, at 7:49 PM, Rados?aw Misiuk wrote: > >> Well, as I suppose, if you're a total novice in Erlang world, >> Introducing Erlang [1] should do, especially read with [2] on par. >> >> [1] http://shop.oreilly.com/product/0636920025818.do >> [2] http://chimera.labs.oreilly.com/books/1234000000726 >> >> Regards, >> Radek >> >> W dniu 2013-03-22 19:39, washington3@REDACTED >> pisze: >>> Can you suggest an introductory book on Erlang? >>> >>> _______________________________________________ >>> 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 sperber@REDACTED Sat Mar 23 10:48:21 2013 From: sperber@REDACTED (Michael Sperber) Date: Sat, 23 Mar 2013 10:48:21 +0100 Subject: [erlang-questions] Call for Presentations: Commercial Users of Functional Programming 2013 Message-ID: COMMERCIAL USERS OF FUNCTIONAL PROGRAMMING 2013 CUFP 2013 http://cufp.org/conference CALL FOR PRESENTATIONS Boston, MA, United States Sep 22-24 Talk Proposal Submission Deadline 29 June 2013 Co-located with ICFP 2013 Sponsored by SIGPLAN The annual CUFP workshop is a place where people can see how others are using functional programming to solve real world problems; where practitioners meet and collaborate; where language designers and users can share ideas about the future of their favorite language; and where one can learn practical techniques and approaches for putting functional programming to work. Giving a CUFP Talk ================== If you have experience using functional languages in a practical setting, we invite you to submit a proposal to give a talk at the workshop. We are looking for both experience reports and in-depth technical talks. Experience reports are typically 25 minutes long (but negotiable), and aim to inform participants about how functional programming plays out in real-world applications, focusing especially on lessons learned and insights gained. Experience reports don't need to be highly technical; reflections on the commercial, management, or software engineering aspects are, if anything, more important. Technical talks are also 25 minutes long (also negotiable), and should focus on teaching the audience something about a particular technique or methodology, from the point of view of someone who has seen it play out in practice. These talks could cover anything from techniques for building functional concurrent applications, to managing dynamic reconfigurations, to design recipes for using types effectively in large-scale applications. While these talks will often be based on a particular language, they should be accessible to a broad range of programmers. If you are interested in offering a talk, or nominating someone to do so, fill out the following form: https://www.surveymonkey.com/s/TGXSZSC There will be a short scribes report of the presentations and discussions but not of the details of individual talks, as the meeting is intended to be more a discussion forum than a technical interchange. You do not need to submit a paper, just a proposal for your talk! Note that we will need all presenters to register for the CUFP workshop and travel to Boston at their own expense. Program Committee ================= Marius Eriksen (Twitter, Inc.), co-chair Mike Sperber (Active Group), co-chair Mary Sheeran (Chalmers) Andres L?h (Well-Typed) Thomas Gazagnaire (OCamlPro) Steve Vinoski (Basho) Jorge Ortiz (Foursquare, Inc.) Blake Matheny (Tumblr, Inc.) Simon Marlow (Facebook, Inc.) More information ================ For more information on CUFP, including videos of presentations from previous years, take a look at the CUFP website at http://cufp.org. Note that presenters, like other attendees, will need to register for the event. Presentations will be video taped and presenters will be expected to sign an ACM copyright release form. Acceptance and rejection letters will be sent out by July 16th. Guidance on giving a great CUFP talk ==================================== Focus on the interesting bits: Think about what will distinguish your talk, and what will engage the audience, and focus there. There are a number of places to look for those interesting bits. Setting: FP is pretty well established in some areas, including formal verification, financial processing and server-side web-services. An unusual setting can be a source of interest. If you're deploying FP-based mobile UIs or building servers on oil rigs, then the challenges of that scenario are worth focusing on. Did FP help or hinder in adapting to the setting? Technology: The CUFP audience is hungry to learn about how FP techniques work in practice. What design patterns have you applied, and to what areas? Did you use functional reactive programming for user interfaces, or DSLs for playing chess, or fault-tolerant actors for large scale geological data processing? Teach us something about the techniques you used, and why we should consider using them ourselves. Getting things done: How did you deal with large software development in the absence of a myriad of pre-existing support that are often expected in larger commercial environments (IDEs, coverage tools, debuggers, profilers) and without larger, proven bodies of libraries? Did you hit any brick walls that required support from the community? Don't just be a cheerleader: It's easy to write a rah-rah talk about how well FP worked for you, but CUFP is more interesting when the talks also spend time on what doesn't work. Even when the results were all great, you should spend more time on the challenges along the way than on the parts that went smoothly. From bombadil@REDACTED Sun Mar 24 13:08:55 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Sun, 24 Mar 2013 13:08:55 +0100 Subject: [erlang-questions] introductory book In-Reply-To: References: Message-ID: <269821a6b224cb58a54c0de734cb3ecf@bosqueviejo.net> Hi, El 2013-03-22 19:39, washington3@REDACTED escribi?: > Can you suggest an introductory book on Erlang? You can read this for more information about erlang books :-) http://www.erlang.org/faq/obtaining.html#id50627 Regards. Manuel Rubio. From erlang@REDACTED Sun Mar 24 19:56:20 2013 From: erlang@REDACTED (Erik Reitsma) Date: Sun, 24 Mar 2013 19:56:20 +0100 Subject: [erlang-questions] Erlang4android issue on Nexus In-Reply-To: References: Message-ID: <514F4C54.40005@ernovation.com> Hi Paul, E4A does not require you to root the device. I use it on a non-rooted device myself, but not on a Nexus. Have you tried starting an interactive Erlang shell from SL4A? E4A is not intended to be started from outside SL4A, however, you can start E4A from the shell: /data/data/com.ernovation.erlangforandroid/files/erlang/bin/erl If you start E4A like that, you cannot use the SL4A APIs. *Erik. On 03/23/2013 02:46 PM, Paul Barry wrote: > > Thanks, John. I recall reading somewhere that E4A doesn't require me > to root the device.... But, your email has given me hope as well as a > few pointers to explore. > > Paul. > > On Mar 23, 2013 1:09 PM, "John Kemp" > wrote: > > Hi Paul, > > I am running Erlang4Android on a Nexus 7, and it works fine. I > followed exactly the instructions for installing on the device. > Are you running E4A from a BusyBox or over ADB shell? Have you > 'rooted' the Nexus 7? E4A doesn't require that AFAIK, but it might > make a difference (BusyBox install did require it). > > JohnK > > On Mar 23, 2013, at 4:06 AM, Paul Barry wrote: > > > Hi all. > > > > I've been playing with one of the new Nexus 7" tablets and I > have sl4a installed and running fine (with Python). However, when > I install the Erlang4android stuff from code.google.com > , I get an "exited" console message > whenever I try to run anything (e.g., client.erl from the example). > > > > I can see from other messages on this list that others have got > this working on other devices... But has anybody tried it on a > Nexus, and if you did, how did you get on? > > > > Thanks, > > > > Paul. > > > > _______________________________________________ > > 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 john_re@REDACTED Mon Mar 25 02:26:00 2013 From: john_re@REDACTED (giovanni_re) Date: Sun, 24 Mar 2013 18:26:00 -0700 Subject: [erlang-questions] The language that dare not speak its name: Erlang the Movie - II References: <1364174138.13022.140661208647089.35F94700@webmail.messagingengine.com> Message-ID: <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> First comes Erlang, http://www.erlang.org/ then comes the Movie, http://www.youtube.com/watch?v=xrIjfIjssLE then comes gar1t with an OTP. http://www.gar1t.com/blog/2013/03/21/erlang-the-movie-ii-the-sequel/ -- "No worries Garret. We truly loved it!" - Robert Virding == Erlang The Movie II: The Sequel gar1t ? 12 videos http://www.youtube.com/watch?v=rRbY3TMUcgQ Published on Mar 21, 2013 Erlang's creators discuss the aging language and meet a surprise helper. 3,031. 118 2 From essen@REDACTED Mon Mar 25 02:33:58 2013 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Mon, 25 Mar 2013 02:33:58 +0100 Subject: [erlang-questions] The language that dare not speak its name: Erlang the Movie - II In-Reply-To: <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> References: <1364174138.13022.140661208647089.35F94700@webmail.messagingengine.com> <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> Message-ID: <514FA986.8080007@ninenines.eu> Tried to get her phone number but she killed me for asking. Thank god I was under supervision. On 03/25/2013 02:26 AM, giovanni_re wrote: > First comes Erlang, > http://www.erlang.org/ > > then comes the Movie, > http://www.youtube.com/watch?v=xrIjfIjssLE > > then comes gar1t with an OTP. > http://www.gar1t.com/blog/2013/03/21/erlang-the-movie-ii-the-sequel/ > > > -- > "No worries Garret. We truly loved it!" - Robert Virding > > > == > Erlang The Movie II: The Sequel > gar1t ? 12 videos > http://www.youtube.com/watch?v=rRbY3TMUcgQ > Published on Mar 21, 2013 > Erlang's creators discuss the aging language and meet a surprise helper. > > 3,031. 118 2 > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From g@REDACTED Mon Mar 25 02:42:41 2013 From: g@REDACTED (Garrett Smith) Date: Sun, 24 Mar 2013 18:42:41 -0700 Subject: [erlang-questions] The language that dare not speak its name: Erlang the Movie - II In-Reply-To: <514FA986.8080007@ninenines.eu> References: <1364174138.13022.140661208647089.35F94700@webmail.messagingengine.com> <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> <514FA986.8080007@ninenines.eu> Message-ID: http://www.youtube.com/user/dTokSIcK On Mar 24, 2013 8:34 PM, "Lo?c Hoguin" wrote: > Tried to get her phone number but she killed me for asking. Thank god I > was under supervision. > > On 03/25/2013 02:26 AM, giovanni_re wrote: > >> First comes Erlang, >> http://www.erlang.org/ >> >> then comes the Movie, >> http://www.youtube.com/watch?**v=xrIjfIjssLE >> >> then comes gar1t with an OTP. >> http://www.gar1t.com/blog/**2013/03/21/erlang-the-movie-**ii-the-sequel/ >> >> >> -- >> "No worries Garret. We truly loved it!" - Robert Virding >> >> >> == >> Erlang The Movie II: The Sequel >> gar1t ? 12 videos >> http://www.youtube.com/watch?**v=rRbY3TMUcgQ >> Published on Mar 21, 2013 >> Erlang's creators discuss the aging language and meet a surprise helper. >> >> 3,031. 118 2 >> >> >> >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > ______________________________**_________________ > 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 Mon Mar 25 10:22:27 2013 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 25 Mar 2013 10:22:27 +0100 Subject: [erlang-questions] webdav server in erlang? Message-ID: Has anybody got a webdav server as a stand-alone erlang program or as part of cowboy/yaws? Cheers /Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Mon Mar 25 13:49:50 2013 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 25 Mar 2013 08:49:50 -0400 Subject: [erlang-questions] webdav server in erlang? In-Reply-To: References: Message-ID: On Mon, Mar 25, 2013 at 5:22 AM, Joe Armstrong wrote: > Has anybody got a webdav server as a stand-alone erlang program > or as part of cowboy/yaws? > Yaws supports WebDAV. Just set dav=true in a yaws.conf server config block. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonstl@REDACTED Mon Mar 25 18:48:27 2013 From: simonstl@REDACTED (Simon St.Laurent) Date: Mon, 25 Mar 2013 13:48:27 -0400 Subject: [erlang-questions] Etudes for Erlang Message-ID: <51508DEB.4000506@simonstl.com> I'm delighted to announce something new from O'Reilly Media, something we haven't done before. Etudes for Erlang, by J. David Eisenberg, is a set of exercises for beginners learning the language. It is currently based on Introducing Erlang, though it also has cross-references to other current English-language Erlang books. Because it started from Introducing Erlang, these are definitely etudes for raw beginners, not (yet) intermediate or advanced programmers. It's available for free on the Web, with an option to buy it as an ebook. (We're not currently doing print, but if you want print, let me know and I'll figure something out.) We hope this will grow, and I've been happy to see some activity in the Github repository already. Please take a look, see if it fits your needs, and think about ways it might grow to fit your needs. Thank you, -- Simon St.Laurent http://simonstl.com/ From erlang@REDACTED Mon Mar 25 19:45:12 2013 From: erlang@REDACTED (=?UTF-8?Q?Micha=C5=82_Ptaszek?=) Date: Mon, 25 Mar 2013 19:45:12 +0100 Subject: [erlang-questions] beam.smp signal handling In-Reply-To: <30cd7469-f439-45ac-a35f-a73402416012@googlegroups.com> References: <30cd7469-f439-45ac-a35f-a73402416012@googlegroups.com> Message-ID: Thanks! Will try out both approaches (stty/sighandler) and evaluate which one is closer to what we need. On Sat, Mar 23, 2013 at 1:12 AM, Andrew Tunnell-Jones wrote: > Hi, > > I wrote a signal handler a little while back. With it you can do something > like: > > {ok,Ref} = sighandler:install(int,fun() -> io:fwrite("Interrupt > disabled\n") end). > > And if you later want to restore interrupt: > > sighandler:remove(Ref). > > Be aware: > * It uses a driver > * I've not (yet) updated it to suit the change in the driver API in R16 > from driver_output_term() to erl_drv_output_term() (it still works in R16, > but won't in R17) > * I've not used it in any serious way (and have no immediate plans to) > > The code is available from . > > Regards, > Andrew > > On Tuesday, March 19, 2013 10:09:52 AM UTC+11, Micha? Ptaszek wrote: >> >> Hey, >> >> in order to avoid stupid mistakes on production we have disabled break >> signal handling for the VM by adding +Bi switch to the options passed to >> 'beam.smp' command. As a result, if anyone is connect to the shell via pipe >> and hits CTRL+C - nothing should happen. In order to kill the node someone >> must intentionally run init:stop()/q() from inside of the node. >> >> Unfortunately, as a result, we are not able to handle USR1 signals >> anymore and thus not being able to generate crash dumps when the VM is >> stuck. If +Bi option is passed VM is terminated with "User defined signal >> 1" reason. >> >> Temporarily we can run the VM with +Bc switch however I was wondering if >> there is any other way to completely disable SIGINT, but not SIGUSR1 signal >> handlers? >> >> Thanks, >> Michal >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Tue Mar 26 03:31:52 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Tue, 26 Mar 2013 10:31:52 +0800 Subject: [erlang-questions] How to make a short circuit in erlang ? Message-ID: When in other language.We can use like: example(Something){ if( Something == false) return; //do something here; } But in Erlang.I have to write like: example(Something) -> if Something == false -> false; true -> %do something here end. That's could make the multiple nested like: example(Something) -> if Something == false -> false; true -> if Otherthing == false -> false true -> %do something here end. Some code could make 5 or more nested in it. Is there any idea to make short circuit to reduce of the nested? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Mar 26 03:50:30 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 26 Mar 2013 15:50:30 +1300 Subject: [erlang-questions] How to make a short circuit in erlang ? In-Reply-To: References: Message-ID: <70DB9C2A-3D38-4549-956D-5E71D41B3C19@cs.otago.ac.nz> On 26/03/2013, at 3:31 PM, ?? wrote: > When in other language.We can use like: > example(Something){ > if( Something == false) > return; > //do something here; > } Brian Marick of www.exampler.com has two great stickers. One I have fixed to my door is "To be less wrong than yesterday." The other is "An example would be useful about now" (from memory). Even in C and Java, "if (Something == false)" is bad style. You should write "if (!Something)". The only time that ==false or ==true make sense is when there is a third possibility. > But in Erlang.I have to write like: > example(Something) -> > if > Something == false -> > false; > true -> > %do something here > end. I personally prefer example(Something) -> case Something of false -> false ; true -> . . . end. and then go looking for the third case that probably exists. There is pattern matching in the head. There are guards to be used. In fact, "early-exit" (as it's known in the Smalltalk world) is often an ersatz for guard tests. So the chances are that you should either - be rewriting for clarity, or - using guards. I think a *real* example would be illuminating. > > That's could make the multiple nested like: > example(Something) -> > if > Something == false -> > false; > true -> > if > Otherthing == false -> > false > true -> > %do something here > end. > > Some code could make 5 or more nested in it. No. SHOW US A REAL EXAMPLE. And nothing stops you writing example(Foo, Bar, Ugh) -> case {Foo, Bar, Ugh} of {false, _, _} -> . . . ; {true, false, _} -> . . . ; {true, true, false} -> . . . ; {true, true, true} -> . . . end. We need a real example. (Did I already say that?) > Is there any idea to make short circuit to reduce of the nested? Give us a real example and *then* we can have an illuminating discussion. It's a funny thing. I use early exit a lot in Smalltalk, rather less so in C, and in ML and Haskell it never occurs to me that I don't actually have it. Erlang is definitely close to the ML end of things. I just spent a day turning 63 SLOC of code I wanted to use for a class example of the importance of comments into 21 lines, which annoyingly needs a lot fewer comments. Part of it was to not be scared of introducing auxiliary functions (in Java, yet!). From bob@REDACTED Tue Mar 26 03:54:29 2013 From: bob@REDACTED (Bob Ippolito) Date: Mon, 25 Mar 2013 19:54:29 -0700 Subject: [erlang-questions] How to make a short circuit in erlang ? In-Reply-To: References: Message-ID: There general strategy is to use more functions or have a flat case on a tuple of comparisons (if that can be done sensibly). You could also use exceptions for flow control, but then you have two problems :) On Monday, March 25, 2013, ?? <249505968@REDACTED> wrote: > When in other language.We can use like: > example(Something){ > if( Something == false) > return; > //do something here; > } > But in Erlang.I have to write like: > example(Something) -> > if > Something == false -> > false; > true -> > %do something here > end. > > That's could make the multiple nested like: > example(Something) -> > if > Something == false -> > false; > true -> > if > Otherthing == false -> > false > true -> > %do something here > end. > > Some code could make 5 or more nested in it. > Is there any idea to make short circuit to reduce of the nested? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Tue Mar 26 03:59:26 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Tue, 26 Mar 2013 10:59:26 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ICBIb3cgdG8gbWFrZSBhIHNo?= =?gb18030?q?ort_circuit_in_erlang_=3F?= Message-ID: My teammate also say I should try to write more function. It sounds good! And I also hear Erlang don't have any way to return immediately. I have some idea to refact it now, thanks! ------------------ ???? ------------------ ???: "Bob Ippolito"; ????: 2013?3?26?(???) ??10:54 ???: "??"<249505968@REDACTED>; ??: "erlang-questions"; ??: Re: [erlang-questions] How to make a short circuit in erlang ? There general strategy is to use more functions or have a flat case on a tuple of comparisons (if that can be done sensibly). You could also use exceptions for flow control, but then you have two problems :) On Monday, March 25, 2013, ?? <249505968@REDACTED> wrote: When in other language.We can use like: example(Something){ if( Something == false) return; //do something here; } But in Erlang.I have to write like: example(Something) -> if Something == false -> false; true -> %do something here end. That's could make the multiple nested like: example(Something) -> if Something == false -> false; true -> if Otherthing == false -> false true -> %do something here end. Some code could make 5 or more nested in it. Is there any idea to make short circuit to reduce of the nested? -------------- next part -------------- An HTML attachment was scrubbed... URL: From 249505968@REDACTED Tue Mar 26 04:24:31 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Tue, 26 Mar 2013 11:24:31 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ICBIb3cgdG8gbWFrZSBhIHNo?= =?gb18030?q?ort_circuit_in_erlang_=3F?= Message-ID: hmmmmm Something I just don't agree. I use Something == false. Because I do not name the variable like Is_Something_Right (Apologize for my mike). !Is_Something_Right could be a better code style. !Something , in my opinion, is not better than Something == false. I have see this code style in my project as you write. example(Foo, Bar, Ugh) -> case {Foo, Bar, Ugh} of {false, _, _} -> . . . ; {true, false, _} -> . . . ; {true, true, false} -> . . . ; {true, true, true} -> . . . end. But when look at the {true,true,false}. I still need to check which one is true , and which is false (I'm just stupid as a duck). And There could be 8 different status. That means I should write 8 entry for 3 judgement But if three are nest(Although I don't like it).Only need 3 entry. So I don't think this a good coding style. I just wonder is there any way like return in other language could just return and ignore the step below. And Now I know there are no way to do like that. More function could be a good choice I think ------------------ ???? ------------------ ???: "Richard A. O'Keefe"; ????: 2013?3?26?(???) ??10:50 ???: "??"<249505968@REDACTED>; ??: "erlang-questions"; ??: Re: [erlang-questions] How to make a short circuit in erlang ? On 26/03/2013, at 3:31 PM, ?? wrote: > When in other language.We can use like: > example(Something){ > if( Something == false) > return; > //do something here; > } Brian Marick of www.exampler.com has two great stickers. One I have fixed to my door is "To be less wrong than yesterday." The other is "An example would be useful about now" (from memory). Even in C and Java, "if (Something == false)" is bad style. You should write "if (!Something)". The only time that ==false or ==true make sense is when there is a third possibility. > But in Erlang.I have to write like: > example(Something) -> > if > Something == false -> > false; > true -> > %do something here > end. I personally prefer example(Something) -> case Something of false -> false ; true -> . . . end. and then go looking for the third case that probably exists. There is pattern matching in the head. There are guards to be used. In fact, "early-exit" (as it's known in the Smalltalk world) is often an ersatz for guard tests. So the chances are that you should either - be rewriting for clarity, or - using guards. I think a *real* example would be illuminating. > > That's could make the multiple nested like: > example(Something) -> > if > Something == false -> > false; > true -> > if > Otherthing == false -> > false > true -> > %do something here > end. > > Some code could make 5 or more nested in it. No. SHOW US A REAL EXAMPLE. And nothing stops you writing example(Foo, Bar, Ugh) -> case {Foo, Bar, Ugh} of {false, _, _} -> . . . ; {true, false, _} -> . . . ; {true, true, false} -> . . . ; {true, true, true} -> . . . end. We need a real example. (Did I already say that?) > Is there any idea to make short circuit to reduce of the nested? Give us a real example and *then* we can have an illuminating discussion. It's a funny thing. I use early exit a lot in Smalltalk, rather less so in C, and in ML and Haskell it never occurs to me that I don't actually have it. Erlang is definitely close to the ML end of things. I just spent a day turning 63 SLOC of code I wanted to use for a class example of the importance of comments into 21 lines, which annoyingly needs a lot fewer comments. Part of it was to not be scared of introducing auxiliary functions (in Java, yet!). -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Mar 26 07:14:05 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 26 Mar 2013 19:14:05 +1300 Subject: [erlang-questions] =?utf-8?b?5Zue5aSN77yaICBIb3cgdG8gbWFrZSBhIHNo?= =?utf-8?q?ort_circuit_in_erlang_=3F?= In-Reply-To: References: Message-ID: <15C25A5E-87CD-4BFB-9F9B-6DE5220D5B7E@cs.otago.ac.nz> On 26/03/2013, at 4:24 PM, ?? wrote: > hmmmmm > Something I just don't agree. > I use Something == false. This is, I repeat, Bad Style in ANY Programming Language. It has been bad style ever since Algol got the Boolean type in 1960 and Fortran got the LOGICAL type in 1961. > Because I do not name the variable like Is_Something_Right (Apologize for my mike). Why do you think that a bad choice of names justifies inappropriate comparison? > !Is_Something_Right could be a better code style. > !Something , in my opinion, is not better than Something == false. It is, if Something is well named. The important thing here is that Boolean values are part of a Boolean _algebra_, and by avoiding the natural operations of that algebra, you are making combinations of Booleans __hard to think__ when they need not be. I must point out that having Boolean-valued variables _at all_ in Erlang is definitely odd. It's possible. It's not _wrong_. But it _is_ odd, and there is usually a more idiomatic way to do it. > > I have see this code style in my project as you write. > example(Foo, Bar, Ugh) -> > case {Foo, Bar, Ugh} > of {false, _, _} -> . . . > ; {true, false, _} -> . . . > ; {true, true, false} -> . . . > ; {true, true, true} -> . . . > end. > But when look at the {true,true,false}. > I still need to check which one is true , and which is false (I'm just stupid as a duck). When you look at the {true,true,false} case, you can *see* which one is false (Ugh) and which are not (Foo, Bar). If you can't, you have too much code in one place. Of course, something like this should be encoded using one expression with multiple values rather than several Booleans. > And There could be 8 different status. > That means I should write 8 entry for 3 judgement No, for three judgements you need three entries. Let's switch to Haskell for the moment. Let t1, t2, t3 be three arbitrary expressions of type Bool and e1, e2, e3, e4 be four arbitrary expressions of a common type alpha. Then if t1 then e1 else if t2 then e2 else if t3 then e3 else t4 and case (t1,t2,t3) of (True, _, _) -> e1 (False,True, _) -> e2 (False,False,True) -> e3 (False,False,False) -> e4 are equivalent. In fact, a good Haskell compiler will probably generate the same code for both of them. Both examples make FOUR judgements based on THREE variables. In Erlang, they are only equivalent in the absence of exceptions and side effects. But the scheme as outlined does *NOT* have 2^n branches; it has *exactly* the same number of branches as an 'if' nest would have. So your argument for disliking it is unsound. > I just wonder is there any way like return in other language could just return and ignore the step below. Many other programming languages do _not_ have a 'return e;' statement. In particular, functional languages such as ML, Clean, Haskell, and F# don't. From a web page about F#: One of the limitations of F# is that it doesn't very well support some of the advanced imperative language constructs such as break, continue or imperative style of returning value from a function, meaning that you can't write something like return false in the middle of the function. This has good reasons. > And Now I know there are no way to do like that. A real example of something you need to write would be really really useful. Here's a little example. We are given two tuples Whole and Part and want to find the smallest integer I such that Whole[I..I+tuple_size(Part)-1] = Part. We want to return 0 if there is no such I. We might begin index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part), tuple_size(Whole) >= tuple_size(Part) -> . . . straightforward case . . .; index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part) -> 0. You are probably used to the idea that a function can have only one body, which is not true in Erlang (or Haskell, or ML, or Clean, or F#, . . .). From 249505968@REDACTED Tue Mar 26 07:36:07 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Tue, 26 Mar 2013 14:36:07 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ILvYuLSjuiAgSG93IHRvIG1h?= =?gb18030?q?ke_a_short_circuit_in_erlang_=3F?= Message-ID: Aha!Gotcha! It is a good way to flat a multiple nested.It's truly not need to write 8 branches example(Foo, Bar, Ugh) -> case {Foo, Bar, Ugh} of {false, _, _} -> . . . ; {true, false, _} -> . . . ; {true, true, false} -> . . . ; {true, true, true} -> . . . end. Use if could be better I think,like: example(Foo,Bar,Ugh) -> if Foo =:= false -> ... Bar =:= false -> ... Ugh =:= false -> ... true -> ... (change some logic could remove the "=:= false", to make the code more clean) And this is the better way I thing. (I just going to refactor my code like this) index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part), tuple_size(Whole) >= tuple_size(Part) -> . . . straightforward case . . .; index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part) -> 0. Though I still not agree with that, "!Something" is always better than "Something == false". Because I still consider that "Something == false" could more easy to read for the people like me .... ------------------ ???? ------------------ ???: "Richard A. O'Keefe"; ????: 2013?3?26?(???) ??2:14 ???: "??"<249505968@REDACTED>; ??: "erlang-questions"; ??: Re: ??? [erlang-questions] How to make a short circuit in erlang ? On 26/03/2013, at 4:24 PM, ?? wrote: > hmmmmm > Something I just don't agree. > I use Something == false. This is, I repeat, Bad Style in ANY Programming Language. It has been bad style ever since Algol got the Boolean type in 1960 and Fortran got the LOGICAL type in 1961. > Because I do not name the variable like Is_Something_Right (Apologize for my mike). Why do you think that a bad choice of names justifies inappropriate comparison? > !Is_Something_Right could be a better code style. > !Something , in my opinion, is not better than Something == false. It is, if Something is well named. The important thing here is that Boolean values are part of a Boolean _algebra_, and by avoiding the natural operations of that algebra, you are making combinations of Booleans __hard to think__ when they need not be. I must point out that having Boolean-valued variables _at all_ in Erlang is definitely odd. It's possible. It's not _wrong_. But it _is_ odd, and there is usually a more idiomatic way to do it. > > I have see this code style in my project as you write. > example(Foo, Bar, Ugh) -> > case {Foo, Bar, Ugh} > of {false, _, _} -> . . . > ; {true, false, _} -> . . . > ; {true, true, false} -> . . . > ; {true, true, true} -> . . . > end. > But when look at the {true,true,false}. > I still need to check which one is true , and which is false (I'm just stupid as a duck). When you look at the {true,true,false} case, you can *see* which one is false (Ugh) and which are not (Foo, Bar). If you can't, you have too much code in one place. Of course, something like this should be encoded using one expression with multiple values rather than several Booleans. > And There could be 8 different status. > That means I should write 8 entry for 3 judgement No, for three judgements you need three entries. Let's switch to Haskell for the moment. Let t1, t2, t3 be three arbitrary expressions of type Bool and e1, e2, e3, e4 be four arbitrary expressions of a common type alpha. Then if t1 then e1 else if t2 then e2 else if t3 then e3 else t4 and case (t1,t2,t3) of (True, _, _) -> e1 (False,True, _) -> e2 (False,False,True) -> e3 (False,False,False) -> e4 are equivalent. In fact, a good Haskell compiler will probably generate the same code for both of them. Both examples make FOUR judgements based on THREE variables. In Erlang, they are only equivalent in the absence of exceptions and side effects. But the scheme as outlined does *NOT* have 2^n branches; it has *exactly* the same number of branches as an 'if' nest would have. So your argument for disliking it is unsound. > I just wonder is there any way like return in other language could just return and ignore the step below. Many other programming languages do _not_ have a 'return e;' statement. In particular, functional languages such as ML, Clean, Haskell, and F# don't. From a web page about F#: One of the limitations of F# is that it doesn't very well support some of the advanced imperative language constructs such as break, continue or imperative style of returning value from a function, meaning that you can't write something like return false in the middle of the function. This has good reasons. > And Now I know there are no way to do like that. A real example of something you need to write would be really really useful. Here's a little example. We are given two tuples Whole and Part and want to find the smallest integer I such that Whole[I..I+tuple_size(Part)-1] = Part. We want to return 0 if there is no such I. We might begin index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part), tuple_size(Whole) >= tuple_size(Part) -> . . . straightforward case . . .; index_of_subtuple(Whole, Part) when is_tuple(Whole), is_tuple(Part) -> 0. You are probably used to the idea that a function can have only one body, which is not true in Erlang (or Haskell, or ML, or Clean, or F#, . . .). -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan@REDACTED Tue Mar 26 08:10:15 2013 From: ivan@REDACTED (Ivan Uemlianin) Date: Tue, 26 Mar 2013 07:10:15 +0000 Subject: [erlang-questions] =?utf-8?b?5Zue5aSN77yaIOWbnuWkje+8miAgSG93IHRv?= =?utf-8?q?_make_a_short_circuit_in_erlang_=3F?= In-Reply-To: References: Message-ID: <515149D7.7050507@llaisdy.com> On 26/03/2013 06:36, ?? wrote: > ... > Use if could be better I think,like: > example(Foo,Bar,Ugh) -> > if > Foo =:= false -> ... > Bar =:= false -> ... > Ugh=:= false -> ... > true -> ... > (change some logic could remove the "=:= false", to make the code more > clean) How about example(Foo,Bar,false) -> do_first_thing(); example(Foo,false,Ugh) -> do_second_thing(); example(false,Bar,Ugh) -> do_third_thing(); example(Foo,Bar,Ugh) -> do_default_thing(). Best wishes Ivan -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From raimo+erlang-questions@REDACTED Tue Mar 26 09:22:37 2013 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 26 Mar 2013 09:22:37 +0100 Subject: [erlang-questions] =?utf-8?b?5Zue5aSN77yaIOWbnuWkje+8miBIb3cgdG8g?= =?utf-8?q?make_a_short_circuit_in_erlang_=3F?= In-Reply-To: References: Message-ID: <20130326082237.GA32208@erix.ericsson.se> On Tue, Mar 26, 2013 at 02:36:07PM +0800, ?? wrote: > Aha!Gotcha! > It is a good way to flat a multiple nested.It's truly not need to write 8 branches > example(Foo, Bar, Ugh) -> > case {Foo, Bar, Ugh} > of {false, _, _} -> . . . > ; {true, false, _} -> . . . > ; {true, true, false} -> . . . > ; {true, true, true} -> . . . > end. > > > Use if could be better I think,like: > example(Foo,Bar,Ugh) -> > if > Foo =:= false -> ... > Bar =:= false -> ... > Ugh =:= false -> ... > true -> ... > (change some logic could remove the "=:= false", to make the code more clean) Excuse me for jumping in in the middle without reading up, but that is in fact a very illustrative point of view in this case. I will get back to that shortly. If Foo, Bar and Ugh are booleans, that could be written as: if not Foo -> ...; not Bar -> ...; not Ugh -> ...; true -> ... end But since your code uses "Foo =:= false", I can not immediately know if Foo could have a non-boolean value. Therefore my code suggestion may be incorrect. In fact using "Foo =:= false" instead of just "if Foo ->" _suggests_ that Foo is not just a boolean. At least for someone just jumping in, like me now, which is the situation for anyone reading the code including the writer in the future. And that is one reason why using "Foo =:= false" is bad coding practice in any coding language. > : > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Tue Mar 26 09:28:06 2013 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 26 Mar 2013 09:28:06 +0100 Subject: [erlang-questions] SPAM got through In-Reply-To: <8991dc589b4fdbe75a326cc9a7ccbd4c.cm1@countermail.com> References: <8991dc589b4fdbe75a326cc9a7ccbd4c.cm1@countermail.com> Message-ID: <20130326082806.GA376@erix.ericsson.se> Sorry about one slipping through. We are working on the SPAM filtering strategies. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From 249505968@REDACTED Tue Mar 26 09:55:00 2013 From: 249505968@REDACTED (=?gb18030?B?99L30Q==?=) Date: Tue, 26 Mar 2013 16:55:00 +0800 Subject: [erlang-questions] =?gb18030?b?u9i4tKO6ICBIb3cgdG8gdXNlIHRoZSBy?= =?gb18030?q?egex_in_erlang=A3=BF?= Message-ID: Thanks for your help? ??erlangdoc???????0 0 ------------------ ???? ------------------ ???: "???"; ????: 2013?3?26?(???) ??2:27 ???: "??"<249505968@REDACTED>; ??: Re: [erlang-questions] How to use the regex in erlang? Take a look at re:run/3 more carefully. There are options like "{capture, ValueSpec} | {capture, ValueSpec, Type}" to help you fetch word with "Type" as list. 2013/3/22 ?? <249505968@REDACTED> I have see the re model doc. But still not know how to use regex to take words from a string... How to get the "word" from the string "It's 1 word" with re? _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangprogram@REDACTED Tue Mar 26 15:48:11 2013 From: erlangprogram@REDACTED (S X) Date: Tue, 26 Mar 2013 10:48:11 -0400 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi, Rudolph & Anders, Not sure your problem is resolved or not. I was able to use the diameter sample code with the local/remote mode, i.e. Start a diameter server in an erts on a pc, and start a diameter client in an erts on another pc (I use virtual machines as pcs here). They can communicate different types of diameter messages without problems. However, when I try to use a diameter client (the sample code) from an erts to connect a diameter server which is not running within an erts (other diameter server not implemented in erlang). It doesn't work(can not build up a connection). I am not quite familiar with the detailed implementation of the erlang diameter library now. I am feeling that the erlang diameter relies on the erlang nodes, which means all the peers are built up only on the erts (distributed erlang runtimes). Does the erlang diameter only work within erlang environment? Or in order to talk to other diameter servers, does it need to write another erlang client using some functions from the erlang diameter library, like encode/decode? The sample client code doesn't work in this situation. I am not sure my understanding above is correct or not. Can you provide some guidance? Thanks, Samuel On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson wrote: > One more time to the list ... > > On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson > wrote: > > The problem looks to be that there's an {ssl, false} option being into > > diameter_tcp and then down to gen_tcp, which causes it to raise > > badarg. What OTP release is this? I can't say I recall the example > > code passing this tuple. > > > > /Anders, Erlang/OTP > > > > > > > > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan > wrote: > >> Hi there, > >> > >> I'm trying to start up the Erlang diameter demo application shipped with > >> Erlang/OTP. The issue is that, no matter what format I try, I can't get > the > >> client to connect to a remote diameter server. > >> > >> In that example, I started the application as follows: > >> > >> 3> diameter:start(), client:start(). > >> ok > >> > >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> {ok,#Ref<0.0.0.643>} > >> > >> 7> client:call(). > >> {error,no_connection} > >> > >> > >> Here, my local IP address is {10,151,0,166} and the remote one is > >> {10,249,20,174}. > >> > >> TCP to the server is working: > >> > >> telnet 10.249.20.174 3868 > >> Trying 10.249.20.174... > >> Connected to 10.249.20.174. > >> Escape character is '^]'. > >> > >> > >> I traced diameter_tcp and I can see that it is getting a badarg error > >> somewhere: > >> > >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.116.0>) call > >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> > >> Does anyone have an idea what I am doing wrong? My feeling is that it > has to > >> do with the local ip address. I don't understand why I even need to > supply a > >> local IP address and the documentation isn't very clear. > >> > >> Thanks, > >> > >> Rudolph > >> > >> > >> Here is the trace: > >> > >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:i/1 -> > {monitor,<0.114.0>,<0.115.0>} > >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} > >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}]) > >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> [{ssl,false}, > >> {ip,{10,151,0,166}}, > >> > {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}]} > >> (<0.115.0>) call > >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call > >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} > >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} > >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> (<0.115.0>) call > >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, > >> {packet,0}, > >> {active,once}, > >> > {ip,{10,151,0,166}}, > >> {ssl,false}, > >> {reuseaddr,true}] > >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.115.0>) call > diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> {packet,0}, > >> {active,once}, > >> {ip,{10,151,0,166}}, > >> {ssl,false}, > >> {reuseaddr,true}]) > >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.116.0>) call > >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> (<0.116.0>) call > >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> (<0.116.0>) call > >> > diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> > >> > >> > >> _______________________________________________ > >> 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 bengt.kleberg@REDACTED Tue Mar 26 16:00:58 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 26 Mar 2013 16:00:58 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: <1364310059.4744.11.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, When testing Erlang DIAMETER interfaces I use Seagull. Google for Seagull DIAMETER and you will find it. bengt On Tue, 2013-03-26 at 10:48 -0400, S X wrote: > Hi, Rudolph & Anders, > > > Not sure your problem is resolved or not. > > > I was able to use the diameter sample code with the local/remote mode, > i.e. Start a diameter server in an erts on a pc, and start a diameter > client in an erts on another pc (I use virtual machines as pcs here). > They can communicate different types of diameter messages without > problems. > > > > However, when I try to use a diameter client (the sample code) from an > erts to connect a diameter server which is not running within an erts > (other diameter server not implemented in erlang). It doesn't work(can > not build up a connection). I am not quite familiar with the detailed > implementation of the erlang diameter library now. I am feeling that > the erlang diameter relies on the erlang nodes, which means all the > peers are built up only on the erts (distributed erlang runtimes). > Does the erlang diameter only work within erlang environment? Or in > order to talk to other diameter servers, does it need to write another > erlang client using some functions from the erlang diameter library, > like encode/decode? The sample client code doesn't work in this > situation. > > > I am not sure my understanding above is correct or not. Can you > provide some guidance? > > > Thanks, > > Samuel > > > > > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson > wrote: > One more time to the list ... > > On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson > wrote: > > The problem looks to be that there's an {ssl, false} option > being into > > diameter_tcp and then down to gen_tcp, which causes it to > raise > > badarg. What OTP release is this? I can't say I recall the > example > > code passing this tuple. > > > > /Anders, Erlang/OTP > > > > > > > > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan > wrote: > >> Hi there, > >> > >> I'm trying to start up the Erlang diameter demo application > shipped with > >> Erlang/OTP. The issue is that, no matter what format I try, > I can't get the > >> client to connect to a remote diameter server. > >> > >> In that example, I started the application as follows: > >> > >> 3> diameter:start(), client:start(). > >> ok > >> > >> 4> > client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> {ok,#Ref<0.0.0.643>} > >> > >> 7> client:call(). > >> {error,no_connection} > >> > >> > >> Here, my local IP address is {10,151,0,166} and the remote > one is > >> {10,249,20,174}. > >> > >> TCP to the server is working: > >> > >> telnet 10.249.20.174 3868 > >> Trying 10.249.20.174... > >> Connected to 10.249.20.174. > >> Escape character is '^]'. > >> > >> > >> I traced diameter_tcp and I can see that it is getting a > badarg error > >> somewhere: > >> > >> (<0.114.0>) returned from diameter_tcp:start/3 -> > {ok,<0.115.0>, > >> > [{10,151,0,166}]} > >> (<0.116.0>) call > >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> > >> Does anyone have an idea what I am doing wrong? My feeling > is that it has to > >> do with the local ip address. I don't understand why I even > need to supply a > >> local IP address and the documentation isn't very clear. > >> > >> Thanks, > >> > >> Rudolph > >> > >> > >> Here is the trace: > >> > >> (<0.84.0>) call > diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:i/1 -> > {monitor,<0.114.0>,<0.115.0>} > >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> > {ok,<0.116.0>} > >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}]) > >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> > [{ssl,false}, > >> > {ip,{10,151,0,166}}, > >> > {raddr,{10,249,20,174}}, > >> > {rport,3868}, > >> > {reuseaddr,true}]} > >> (<0.115.0>) call > >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call > >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call > diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) call > diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> > {10,151,0,166} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > {10,151,0,166} > >> (<0.115.0>) call > diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) call > diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> > {10,249,20,174} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > {10,249,20,174} > >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> (<0.115.0>) call > >> > diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> > [binary, > >> > {packet,0}, > >> > {active,once}, > >> > {ip,{10,151,0,166}}, > >> > {ssl,false}, > >> > {reuseaddr,true}] > >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> > {ok,<0.115.0>, > >> > [{10,151,0,166}]} > >> (<0.115.0>) call > diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> {packet,0}, > >> {active,once}, > >> {ip,{10,151,0,166}}, > >> {ssl,false}, > >> {reuseaddr,true}]) > >> (<0.114.0>) returned from diameter_tcp:start/3 -> > {ok,<0.115.0>, > >> > [{10,151,0,166}]} > >> (<0.116.0>) call > >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> (<0.116.0>) call > >> > diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> (<0.116.0>) call > >> > diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> > >> > >> > > >> _______________________________________________ > >> 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 erlangsiri@REDACTED Tue Mar 26 16:53:40 2013 From: erlangsiri@REDACTED (Siri Hansen) Date: Tue, 26 Mar 2013 16:53:40 +0100 Subject: [erlang-questions] cover.erl issues In-Reply-To: <0330b7f9f73f496faba09bec6ffb755b@bosqueviejo.net> References: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> <0330b7f9f73f496faba09bec6ffb755b@bosqueviejo.net> Message-ID: Hi Manuel! I think the problem is that ets tables are not deleted before the cover server is unregistered when cover:stop() is called (and cover:stop() does not wait for the cover server to fully terminate either). This means that if you call cover:start() directly after cover:stop() then a new cover server is started, attempting to create new (named) ets tables while the old ones could still be alive. The probability of this happening increases with the amount of cover data in the ets tables, since it then will take longer to delete the tables. This is a bug in cover. To confirm it you could call ets:delete(Table) for each ets table just before unregister(?SERVER) in cover:main_process_loop/1. Regards /siri 2013/3/21 Manuel A. Rubio "Bombadil" > I forgo inform that the error occurs with R15B02 and R16B. > > El 2013-03-21 13:50, Manuel A. Rubio "Bombadil" escribi?: > > Hi! >> >> I was developing a lot of projects with rebar and, when I put only >> one app in the apps directory and use eunit and cover, it works well, >> but when I create several apps in this directory I often see this >> message: >> >> >> ------------------------------**------------------------------** >> ----------------------------- >> ERROR: eunit failed while processing >> /home/manuel/Proyectos/**myproject/apps/app2: {'EXIT', >> {{badmatch, >> {error, >> {badarg, >> [{ets,new, >> [cover_internal_data_table, >> [set,public,named_table,{** >> write_concurrency,true}]], >> []}, >> {cover,init_main,1,[{file,"** >> cover.erl"},{line,565}]}]}}}, >> [{rebar_eunit,cover_init,2,[{**file,"src/rebar_eunit.erl"},{** >> line,445}]}, >> {rebar_eunit,run_eunit,3,[{**file,"src/rebar_eunit.erl"},{** >> line,127}]}, >> {rebar_core,run_modules,4,[{**file,"src/rebar_core.erl"},{** >> line,405}]}, >> {rebar_core,execute,5,[{file,"**src/rebar_core.erl"},{line,** >> 334}]}, >> {rebar_core,process_dir1,6,[{**file,"src/rebar_core.erl"},{** >> line,197}]}, >> {rebar_core,process_each,5,[{**file,"src/rebar_core.erl"},{** >> line,268}]}, >> {rebar_core,process_dir1,6,[{**file,"src/rebar_core.erl"},{** >> line,173}]}, >> {rebar_core,process_commands,**2, >> [{file,"src/rebar_core.erl"},{**line,61}]}]}} >> >> ------------------------------**------------------------------** >> ----------------------------- >> >> I think that can be due to a race condition, because the eunit >> execution between apps is continuous... but I'm not sure :-/ >> >> Any idea? >> >> Thanks. >> Manuel Rubio. >> ______________________________**_________________ >> 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 jmakarlsson@REDACTED Tue Mar 26 17:18:26 2013 From: jmakarlsson@REDACTED (J K) Date: Tue, 26 Mar 2013 09:18:26 -0700 (PDT) Subject: [erlang-questions] How to make a short circuit in erlang ? In-Reply-To: References: Message-ID: <1364314706.83430.YahooMailNeo@web162803.mail.bf1.yahoo.com> Hi, maybe this would work? http://en.wikipedia.org/wiki/Higher-order_function or_else([], _) -> false; or_else([F | Fs], X) -> or_else(Fs, X, F(X)). or_else(Fs, X, false) -> or_else(Fs, X); or_else(Fs, _, {false, Y}) -> or_else(Fs, Y); or_else(_, _, R) -> R. or_else([fun erlang:is_integer/1, fun erlang:is_atom/1, fun erlang:is_list/1],3.23). Johan >________________________________ > From: ?? <249505968@REDACTED> >To: erlang-questions >Sent: Tuesday, March 26, 2013 3:31 AM >Subject: [erlang-questions] How to make a short circuit in erlang ? > > >When in other language.We can use like: >example(Something){ >? ? if( Something == false) >? ? ? ? return; >? ? //do something here; >} >But in Erlang.I have to write like: >example(Something) -> >? ? if >? ? ? ? Something == false -> >? ? ? ? ? ? false; >? ? ? ? true -> >? ? ? ? ? ? %do something here >? ? end. > > >That's could make the multiple nested like: >example(Something) -> >? ? if >? ? ? ? Something == false -> >? ? ? ? ? ? false; >? ? ? ? true -> >? ? ? ? ? ? if >? ? ? ? ? ? ? ? Otherthing == false -> >? ? ? ? ? ? ? ? ? ? false >? ? ? ? ? ? ? ? true -> >? ? ? ? ? ? ? ? ? ? %do something here >? ? end. > > >Some code could make 5 or more nested in it. >Is there any idea to make short circuit to reduce of the nested? >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.otp@REDACTED Tue Mar 26 17:30:55 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Tue, 26 Mar 2013 17:30:55 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: On Tue, Mar 26, 2013 at 3:48 PM, S X wrote: > Hi, Rudolph & Anders, > > Not sure your problem is resolved or not. > > I was able to use the diameter sample code with the local/remote mode, i.e. > Start a diameter server in an erts on a pc, and start a diameter client in > an erts on another pc (I use virtual machines as pcs here). They can > communicate different types of diameter messages without problems. > > However, when I try to use a diameter client (the sample code) from an erts > to connect a diameter server which is not running within an erts (other > diameter server not implemented in erlang). It doesn't work(can not build up > a connection). I am not quite familiar with the detailed implementation of > the erlang diameter library now. I am feeling that the erlang diameter > relies on the erlang nodes, which means all the peers are built up only on > the erts (distributed erlang runtimes). Does the erlang diameter only work > within erlang environment? Or in order to talk to other diameter servers, No, diameter has no idea how any peers it connects to are implemented. > does it need to write another erlang client using some functions from the > erlang diameter library, like encode/decode? The sample client code doesn't > work in this situation. > > I am not sure my understanding above is correct or not. Can you provide some > guidance? Sure, if you provide me with an example of something that doesn't work as expected. Anders > Thanks, > > Samuel > > > > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson > wrote: >> >> One more time to the list ... >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson >> wrote: >> > The problem looks to be that there's an {ssl, false} option being into >> > diameter_tcp and then down to gen_tcp, which causes it to raise >> > badarg. What OTP release is this? I can't say I recall the example >> > code passing this tuple. >> > >> > /Anders, Erlang/OTP >> > >> > >> > >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan >> > wrote: >> >> Hi there, >> >> >> >> I'm trying to start up the Erlang diameter demo application shipped >> >> with >> >> Erlang/OTP. The issue is that, no matter what format I try, I can't get >> >> the >> >> client to connect to a remote diameter server. >> >> >> >> In that example, I started the application as follows: >> >> >> >> 3> diameter:start(), client:start(). >> >> ok >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> >> {ok,#Ref<0.0.0.643>} >> >> >> >> 7> client:call(). >> >> {error,no_connection} >> >> >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is >> >> {10,249,20,174}. >> >> >> >> TCP to the server is working: >> >> >> >> telnet 10.249.20.174 3868 >> >> Trying 10.249.20.174... >> >> Connected to 10.249.20.174. >> >> Escape character is '^]'. >> >> >> >> >> >> I traced diameter_tcp and I can see that it is getting a badarg error >> >> somewhere: >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> [{10,151,0,166}]} >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is that it >> >> has to >> >> do with the local ip address. I don't understand why I even need to >> >> supply a >> >> local IP address and the documentation isn't very clear. >> >> >> >> Thanks, >> >> >> >> Rudolph >> >> >> >> >> >> Here is the trace: >> >> >> >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> >> >> {monitor,<0.114.0>,<0.115.0>} >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}]) >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> >> [{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}]} >> >> (<0.115.0>) call >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}],[]) >> >> (<0.115.0>) call >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}],[]) >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} >> >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> >> (<0.115.0>) call >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> >> {packet,0}, >> >> {active,once}, >> >> >> >> {ip,{10,151,0,166}}, >> >> {ssl,false}, >> >> {reuseaddr,true}] >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, >> >> >> >> [{10,151,0,166}]} >> >> (<0.115.0>) call >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> >> {packet,0}, >> >> {active,once}, >> >> {ip,{10,151,0,166}}, >> >> {ssl,false}, >> >> {reuseaddr,true}]) >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> [{10,151,0,166}]} >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> (<0.116.0>) call >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> >> >> >> >> _______________________________________________ >> >> 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 bombadil@REDACTED Tue Mar 26 17:42:01 2013 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Tue, 26 Mar 2013 17:42:01 +0100 Subject: [erlang-questions] cover.erl issues In-Reply-To: References: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> <0330b7f9f73f496faba09bec6ffb755b@bosqueviejo.net> Message-ID: <6da53a548a5a67924bac3532b1a4af68@bosqueviejo.net> Hi Sri, El 2013-03-26 16:53, Siri Hansen escribi?: > This is a bug in cover. To confirm it you could call > ets:delete(Table) > for each ets table just before > > unregister(?SERVER)? > > in cover:main_process_loop/1. I use covertool[1] for export tests to jenkins and did a fork and add it cover.erl[2] modified to overload the original code with the workaround: line 561: ---------------------------------------------------------------------------- init_main(Starter) -> %% Having write concurrancy here gives a 40% performance boost %% when collect/1 is called. case ets:info(?COVER_TABLE) of undefined -> register(?SERVER,self()), ets:new(?COVER_TABLE, [set, public, named_table ,{write_concurrency, true} ]), ets:new(?COVER_CLAUSE_TABLE, [set, public, named_table]), ets:new(?BINARY_TABLE, [set, named_table]), ets:new(?COLLECTION_TABLE, [set, public, named_table]), ets:new(?COLLECTION_CLAUSE_TABLE, [set, public, named_table]), process_flag(trap_exit,true), Starter ! {?SERVER,started}, main_process_loop(#main_state{}); _ -> catch ets:delete(?COVER_TABLE), catch ets:delete(?COVER_CLAUSE_TABLE), catch ets:delete(?BINARY_TABLE), catch ets:delete(?COLLECTION_TABLE), catch ets:delete(?COLLECTION_CLAUSE_TABLE), init_main(Starter) end. ---------------------------------------------------------------------------- It works well, but I supose I can move the ets:delete block to main_loop, when call to stop. [1] https://github.com/bosqueviejo/covertool/ [2] https://github.com/bosqueviejo/covertool/blob/master/src/cover.erl Regards. Manuel Rubio. From mfidelman@REDACTED Tue Mar 26 21:16:56 2013 From: mfidelman@REDACTED (Miles Fidelman) Date: Tue, 26 Mar 2013 16:16:56 -0400 Subject: [erlang-questions] The language that dare not speak its name: Erlang the Movie - II In-Reply-To: <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> References: <1364174138.13022.140661208647089.35F94700@webmail.messagingengine.com> <1364174760.15140.140661208651849.7BC5A5FC@webmail.messagingengine.com> Message-ID: <51520238.5020501@meetinghouse.net> giovanni_re wrote: > First comes Erlang, > http://www.erlang.org/ > > then comes the Movie, > http://www.youtube.com/watch?v=xrIjfIjssLE > > then comes gar1t with an OTP. > http://www.gar1t.com/blog/2013/03/21/erlang-the-movie-ii-the-sequel/ > > Just got around to watching it. Hilarious. Are you guys channeling Monty Python? :-) Miles Fidelman -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From ok@REDACTED Tue Mar 26 22:37:36 2013 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 27 Mar 2013 10:37:36 +1300 Subject: [erlang-questions] How to make a short circuit in erlang ? In-Reply-To: <1364314706.83430.YahooMailNeo@web162803.mail.bf1.yahoo.com> References: <1364314706.83430.YahooMailNeo@web162803.mail.bf1.yahoo.com> Message-ID: <0D8C42E9-355F-45AC-A7B5-B1FAF1C59CF5@cs.otago.ac.nz> On 27/03/2013, at 5:18 AM, J K wrote: > Hi, > maybe this would work? > http://en.wikipedia.org/wiki/Higher-order_function > > or_else([], _) -> false; > or_else([F | Fs], X) -> or_else(Fs, X, F(X)). > > or_else(Fs, X, false) -> or_else(Fs, X); > or_else(Fs, _, {false, Y}) -> or_else(Fs, Y); > or_else(_, _, R) -> R. > > > > or_else([fun erlang:is_integer/1, fun erlang:is_atom/1, fun erlang:is_list/1],3.23). But we can already write X = 3.23, ( is_integer(X) orelse is_atom(X) orelse is_list(X) ) so what would be the point? From the OP's point of view, this is surely still nesting. From jmakarlsson@REDACTED Wed Mar 27 00:26:30 2013 From: jmakarlsson@REDACTED (J K) Date: Tue, 26 Mar 2013 16:26:30 -0700 (PDT) Subject: [erlang-questions] How to make a short circuit in erlang ? Message-ID: <1364340390.48961.YahooMailMobile@web162804.mail.bf1.yahoo.com> One point could be that it is more dynamic, that is, it takes a list of functions that doesnt need to be specified at design time. Johan -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan@REDACTED Wed Mar 27 01:13:14 2013 From: stefan@REDACTED (Stefan Jahn) Date: Wed, 27 Mar 2013 01:13:14 +0100 Subject: [erlang-questions] ssh eow In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f9c5ac539ef1c35325a412a2a9c46ec.squirrel@service.rules.org> <36a480137a631a0cb8b65c60864e6fac.squirrel@service.rules.org> Message-ID: hello, while implementing a scp daemon i wonder how to send the eow event to the client in order to tell the scp command to finish expecting data from my scp daemon... see in PROTOCOL (from openssh): 2.1. connection: Channel write close extension "eow@REDACTED" is there a function in ssh api of erlang how i can send this protocol item?? thank you in advance, stefan. From zhuqling@REDACTED Wed Mar 27 01:52:59 2013 From: zhuqling@REDACTED (Jason Chuh) Date: Wed, 27 Mar 2013 08:52:59 +0800 Subject: [erlang-questions] =?gb2312?b?u9i4tKO6IEhvdyB0byB1c2UgdGhlIHJl?= =?gb2312?b?Z2V4IGluIGVybGFuZ6O/?= In-Reply-To: References: Message-ID: ??????????????????? 2013/3/26 ?? <249505968@REDACTED> > Thanks for your help? > ??erlangdoc???????0 0 > > > ------------------ ???? ------------------ > *???:* "???"; > *????:* 2013?3?26?(???) ??2:27 > *???:* "??"<249505968@REDACTED>; ** > *??:* Re: [erlang-questions] How to use the regex in erlang? > > Take a look at re:run/3 more carefully. > > There are options like "{capture, ValueSpec} | {capture, ValueSpec, Type}" > to help you fetch word with "Type" as *list*. > > > 2013/3/22 ?? <249505968@REDACTED> > >> I have see the re model doc. >> But still not know how to use regex to take words from a string... >> How to get the "word" from the string "It's 1 word" with re? >> >> _______________________________________________ >> 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 erlangprogram@REDACTED Wed Mar 27 05:33:07 2013 From: erlangprogram@REDACTED (S X) Date: Wed, 27 Mar 2013 00:33:07 -0400 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi Anders, Thanks for your reply. As my understanding also, the erlang diameter should not care how the other peers are implemented, as long as the peers follow the diameter specifications. But the erlang diameter library provides limited error information and this makes it harder to analyse problems, especially for newbies. My set-up is: - Client (192.168.193.58) runs from an erlang run time in a virtual machine. Just made some little changes based on the sample code: ********************************************************************************************************************** -define(SVC_NAME, ?MODULE). -define(APP_RAR_ALIAS, rara). -define(APP_CCR_ALIAS, ccra). -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). -define(DIAMETER_APP_ID_CCRA, 16777238). -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, {'Origin-Realm', "example.com"}, {'Vendor-Id', 193}, {'Product-Name', "Client"}, {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, {application, [{alias, ?APP_RAR_ALIAS}, {dictionary, ?DIAMETER_DICT_COMMON_NEW}, {module, client_cb}]}, {application, [{alias, ?APP_CCR_ALIAS}, {dictionary, ?DIAMETER_DICT_CCRA}, {module, client_cb_ccra}]}]). connect(Name, T) -> diameter:add_transport(Name, {connect, [{reconnect_timer, 5000000}, {capx_timeout, 50000000} | client(T)]}). client(T) -> client({T, {192,168,193,58}, {10,0,10,71}, 14302}). ********************************************************************************************************************** - Server (10.0.10.71, port 14302) runs a diameter server remotely on a Linux. It is up and running and being tested with other diameter client. Do the followings: 2> debugger:start(). {ok,<0.39.0>} 3> diameter:start(). ok 4> client:start(). ok 5> client:connect(tcp). {ok,#Ref<0.0.0.1210>} 6> client:call(). {error,no_connection} 7> The print information from the runtime doesn't say too much, it shows no connection when call client:call(). In fact, when I check the debugger window, there is no tcp connection being set up properly when calling client:connect(tcp). Meaning the problem happened early without any reminder. It is also wired that the debugger monitor window doesn't allow to copy/paste:(, so I have to type some errors as following: <0.128.0> diameter_peer_fsm:init/1 exit {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, {tcp_closed,#Port<0.2250>}}}} <0.136.0> diameter_tcp:init/1 exit {shutdown,{tcp_closed,#Port<0.2250>}} <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} I increased the capx_timeout, since I thought might be CER timeout. No luck. There was no tcp connection being set up at all. I use the wireshark to watch on the interface with the filter and I didn't see any outgoing packets. Again, It still might be some configurations are incorrect causing the above problem. But with the limited information, it is difficult to figure out what was wrong for newbies. Could you provide some guidances on how to resolve this and any suggestions on diagnosing diameter or erlang issues? Thanks a lot for your comments! Samuel On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson wrote: > On Tue, Mar 26, 2013 at 3:48 PM, S X wrote: > > Hi, Rudolph & Anders, > > > > Not sure your problem is resolved or not. > > > > I was able to use the diameter sample code with the local/remote mode, > i.e. > > Start a diameter server in an erts on a pc, and start a diameter client > in > > an erts on another pc (I use virtual machines as pcs here). They can > > communicate different types of diameter messages without problems. > > > > However, when I try to use a diameter client (the sample code) from an > erts > > to connect a diameter server which is not running within an erts (other > > diameter server not implemented in erlang). It doesn't work(can not > build up > > a connection). I am not quite familiar with the detailed implementation > of > > the erlang diameter library now. I am feeling that the erlang diameter > > relies on the erlang nodes, which means all the peers are built up only > on > > the erts (distributed erlang runtimes). Does the erlang diameter only > work > > within erlang environment? Or in order to talk to other diameter servers, > > No, diameter has no idea how any peers it connects to are implemented. > > > does it need to write another erlang client using some functions from the > > erlang diameter library, like encode/decode? The sample client code > doesn't > > work in this situation. > > > > I am not sure my understanding above is correct or not. Can you provide > some > > guidance? > > Sure, if you provide me with an example of something that doesn't work > as expected. > > Anders > > > > Thanks, > > > > Samuel > > > > > > > > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson > > wrote: > >> > >> One more time to the list ... > >> > >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson > > >> wrote: > >> > The problem looks to be that there's an {ssl, false} option being into > >> > diameter_tcp and then down to gen_tcp, which causes it to raise > >> > badarg. What OTP release is this? I can't say I recall the example > >> > code passing this tuple. > >> > > >> > /Anders, Erlang/OTP > >> > > >> > > >> > > >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan < > rvg.mailing@REDACTED> > >> > wrote: > >> >> Hi there, > >> >> > >> >> I'm trying to start up the Erlang diameter demo application shipped > >> >> with > >> >> Erlang/OTP. The issue is that, no matter what format I try, I can't > get > >> >> the > >> >> client to connect to a remote diameter server. > >> >> > >> >> In that example, I started the application as follows: > >> >> > >> >> 3> diameter:start(), client:start(). > >> >> ok > >> >> > >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> >> {ok,#Ref<0.0.0.643>} > >> >> > >> >> 7> client:call(). > >> >> {error,no_connection} > >> >> > >> >> > >> >> Here, my local IP address is {10,151,0,166} and the remote one is > >> >> {10,249,20,174}. > >> >> > >> >> TCP to the server is working: > >> >> > >> >> telnet 10.249.20.174 3868 > >> >> Trying 10.249.20.174... > >> >> Connected to 10.249.20.174. > >> >> Escape character is '^]'. > >> >> > >> >> > >> >> I traced diameter_tcp and I can see that it is getting a badarg error > >> >> somewhere: > >> >> > >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> >> [{10,151,0,166}]} > >> >> (<0.116.0>) call > >> >> > >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) call > >> >> > >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> > >> >> Does anyone have an idea what I am doing wrong? My feeling is that it > >> >> has to > >> >> do with the local ip address. I don't understand why I even need to > >> >> supply a > >> >> local IP address and the documentation isn't very clear. > >> >> > >> >> Thanks, > >> >> > >> >> Rudolph > >> >> > >> >> > >> >> Here is the trace: > >> >> > >> >> (<0.84.0>) call > diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> > >> >> {monitor,<0.114.0>,<0.115.0>} > >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} > >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> >> {ip,{10,151,0,166}}, > >> >> {raddr,{10,249,20,174}}, > >> >> {rport,3868}, > >> >> {reuseaddr,true}]) > >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> >> [{ssl,false}, > >> >> > {ip,{10,151,0,166}}, > >> >> > >> >> {raddr,{10,249,20,174}}, > >> >> {rport,3868}, > >> >> {reuseaddr,true}]} > >> >> (<0.115.0>) call > >> >> > >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> >> {ip,{10,151,0,166}}, > >> >> {raddr,{10,249,20,174}}, > >> >> {rport,3868}, > >> >> {reuseaddr,true}],[]) > >> >> (<0.115.0>) call > >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> >> {ip,{10,151,0,166}}, > >> >> {raddr,{10,249,20,174}}, > >> >> {rport,3868}, > >> >> {reuseaddr,true}],[]) > >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} > >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} > >> >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} > >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} > >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> >> (<0.115.0>) call > >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, > >> >> {packet,0}, > >> >> {active,once}, > >> >> > >> >> {ip,{10,151,0,166}}, > >> >> {ssl,false}, > >> >> > {reuseaddr,true}] > >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, > >> >> > >> >> [{10,151,0,166}]} > >> >> (<0.115.0>) call > >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> >> {packet,0}, > >> >> {active,once}, > >> >> {ip,{10,151,0,166}}, > >> >> {ssl,false}, > >> >> {reuseaddr,true}]) > >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> >> [{10,151,0,166}]} > >> >> (<0.116.0>) call > >> >> > >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) call > >> >> > >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> (<0.116.0>) call > >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> >> (<0.116.0>) call > >> >> > >> >> > diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> >> > >> >> > >> >> > >> >> _______________________________________________ > >> >> 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 stu.bailey@REDACTED Wed Mar 27 06:19:24 2013 From: stu.bailey@REDACTED (Stu Bailey) Date: Tue, 26 Mar 2013 22:19:24 -0700 Subject: [erlang-questions] Unexpected limitations Message-ID: Hi all, I have an 8 core MacBook Pro Retina Display with 16GB of memory. I am running R16B with no configure options...but I did install libatomic_ops-7.2 . I tried a very simple list allocation test which surprisingly failed with a list size of 100 million. I first made a list with 10 million integers. The beam hung on 100 million. Thinking it was something with lists:seq, I just wrote a dumb test to build big lists of single character atoms. That also failed at 100 million. Is there a known limitation to the size of lists in Erlang? bash-3.2$ uname -a Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 bash-3.2$ erl Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] My Erlang Environment Eshell V5.10.1 (abort with ^G) 1> lists:seq(1,10000000). [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, 23,24,25,26,27,28,29|...] 2> lists:seq(1,100000000). beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Killed: 9 ================ -module(big_lists). -compile([export_all]). make_list(0,Acc)-> Acc; make_list(Size,Acc) -> make_list(Size-1, [a] ++ Acc). =================== 5> c(big_lists). {ok,big_lists} 6> big_lists:make_list(2,[]). [a,a] 7> big_lists:make_list(100000,[]). [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] 8> big_lists:make_list(1000000,[]). [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] 9> big_lists:make_list(10000000,[]). [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] 10> big_lists:make_list(100000000,[]). beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85534,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85534,0xb039d000) malloc: *** mmap(size=949153792) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug beam.smp(85534,0xb039d000) malloc: *** mmap(size=949153792) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap"). Abort trap: 6 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Mar 27 07:21:56 2013 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 27 Mar 2013 07:21:56 +0100 Subject: [erlang-questions] Unexpected limitations In-Reply-To: References: Message-ID: <1364365316.4797.0.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Is your Erlang/OTP 32 or 64 bit? bengt On Tue, 2013-03-26 at 22:19 -0700, Stu Bailey wrote: > Hi all, > > > I have an 8 core MacBook Pro Retina Display with 16GB of memory. I > am running R16B with no configure options...but I did install > libatomic_ops-7.2 . I tried a very simple list allocation test > which surprisingly failed with a list size of 100 million. I first > made a list with 10 million integers. The beam hung on 100 million. > Thinking it was something with lists:seq, I just wrote a dumb test to > build big lists of single character atoms. That also failed at 100 > million. Is there a known limitation to the size of lists in Erlang? > > > bash-3.2$ uname -a > Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 > 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 > > > bash-3.2$ erl > Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] > [kernel-poll:false] > > > My Erlang Environment > Eshell V5.10.1 (abort with ^G) > 1> lists:seq(1,10000000). > [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, > 23,24,25,26,27,28,29|...] > 2> lists:seq(1,100000000). > beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) > failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) > malloc: *** mmap(size=790962176) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > > beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed > (error code=12) > > *** error: can't allocate region > *** set a breakpoint in malloc_error_break to debug > Killed: 9 > > > > > ================ > > > -module(big_lists). > > > -compile([export_all]). > > > > > make_list(0,Acc)-> > Acc; > make_list(Size,Acc) -> > make_list(Size-1, [a] ++ Acc). > > > =================== > > > 5> c(big_lists). > {ok,big_lists} > 6> big_lists:make_list(2,[]). > [a,a] > 7> big_lists:make_list(100000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 8> big_lists:make_list(1000000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 9> big_lists:make_list(10000000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 10> big_lists:make_list(100000000,[]). > beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) > failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) > failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=949153792) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=949153792) failed (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in malloc_error_break to debug > > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 949152844 bytes of memory (of type > "heap"). > Abort trap: 6 > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From z@REDACTED Wed Mar 27 07:31:39 2013 From: z@REDACTED (Danil Zagoskin) Date: Wed, 27 Mar 2013 10:31:39 +0400 Subject: [erlang-questions] Unexpected limitations In-Reply-To: References: Message-ID: Hi, Stu. Does your beam crash when you call lists:duplicate(100000000, a) ? The difference is lists:duplicate is tail-recursive while lists:seq and big_lists:make_list are body-recursive so you can hit some stack size limit, not lists length one. 2013/3/27 Stu Bailey > Hi all, > > I have an 8 core MacBook Pro Retina Display with 16GB of memory. I am > running R16B with no configure options...but I did install > libatomic_ops-7.2 . I tried a very simple list allocation test which > surprisingly failed with a list size of 100 million. I first made a list > with 10 million integers. The beam hung on 100 million. Thinking it was > something with lists:seq, I just wrote a dumb test to build big lists of > single character atoms. That also failed at 100 million. Is there a > known limitation to the size of lists in Erlang? > > bash-3.2$ uname -a > Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 > 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 > > bash-3.2$ erl > Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] > [kernel-poll:false] > > My Erlang Environment > Eshell V5.10.1 (abort with ^G) > 1> lists:seq(1,10000000). > [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, > 23,24,25,26,27,28,29|...] > 2> lists:seq(1,100000000). > beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed (error > code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a > breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a > breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** > set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) malloc: > *** mmap(size=790962176) failed (error code=12) > > *** error: can't allocate > region > > > *** set a breakpoint in malloc_error_break to debug > beam.smp(85491,0xb039d000) > malloc: *** mmap(size=790962176) failed (error code=12) > > *** error: can't > allocate region > *** set a breakpoint in malloc_error_break to debug > Killed: 9 > > > ================ > > -module(big_lists). > > -compile([export_all]). > > > make_list(0,Acc)-> > Acc; > make_list(Size,Acc) -> > make_list(Size-1, [a] ++ Acc). > > =================== > > 5> c(big_lists). > {ok,big_lists} > 6> big_lists:make_list(2,[]). > [a,a] > 7> big_lists:make_list(100000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 8> big_lists:make_list(1000000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 9> big_lists:make_list(10000000,[]). > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > 10> big_lists:make_list(100000000,[]). > beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed (error > code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=791674880) failed (error code=12) > > *** error: can't allocate region > > *** set a > breakpoint in malloc_error_break to debug > > [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] > beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error > code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed > (error code=12) > > *** error: can't allocate region > > *** set a breakpoint in > malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=949153792) failed (error code=12) > > *** error: can't allocate region > > *** set a > breakpoint in malloc_error_break to debug > beam.smp(85534,0xb039d000) malloc: *** > mmap(size=949153792) failed (error code=12) > > *** error: can't allocate region > > *** set a > breakpoint in malloc_error_break to debug > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap"). > Abort trap: 6 > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Wed Mar 27 08:37:25 2013 From: lukas@REDACTED (Lukas Larsson) Date: Wed, 27 Mar 2013 08:37:25 +0100 Subject: [erlang-questions] Unexpected limitations In-Reply-To: References: Message-ID: Hello Stu! As Bengt pointed out you need a 64 bit erlang emulator because the list you created in 2 words * 100 million which would be about 1.6 GB. When the copying GC kicks in that expands to very close to 4GB which is the max in a 32 bit emulator. To compile a 64 but emulator on OS X see http://www.erlang.org/doc/installation_guide/INSTALL.html#id72320 Lukas On Wed, Mar 27, 2013 at 7:31 AM, Danil Zagoskin wrote: > Hi, Stu. > > Does your beam crash when you call lists:duplicate(100000000, a) ? > > The difference is lists:duplicate is tail-recursive while lists:seq and > big_lists:make_list are body-recursive so you can hit some stack size > limit, not lists length one. > > > 2013/3/27 Stu Bailey > >> Hi all, >> >> I have an 8 core MacBook Pro Retina Display with 16GB of memory. I am >> running R16B with no configure options...but I did install >> libatomic_ops-7.2 . I tried a very simple list allocation test which >> surprisingly failed with a list size of 100 million. I first made a list >> with 10 million integers. The beam hung on 100 million. Thinking it was >> something with lists:seq, I just wrote a dumb test to build big lists of >> single character atoms. That also failed at 100 million. Is there a >> known limitation to the size of lists in Erlang? >> >> bash-3.2$ uname -a >> Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 >> 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 >> >> bash-3.2$ erl >> Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] >> [kernel-poll:false] >> >> My Erlang Environment >> Eshell V5.10.1 (abort with ^G) >> 1> lists:seq(1,10000000). >> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, >> 23,24,25,26,27,28,29|...] >> 2> lists:seq(1,100000000). >> beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed (error >> code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) >> failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85491,0xb039d000) malloc: *** >> mmap(size=791674880) failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a >> breakpoint in malloc_error_break to debug >> beam.smp(85491,0xb039d000) malloc: *** >> mmap(size=791674880) failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a >> breakpoint in malloc_error_break to debug >> beam.smp(85491,0xb039d000) malloc: *** >> mmap(size=791674880) failed (error code=12) >> >> *** error: can't allocate region >> >> *** >> set a breakpoint in malloc_error_break to debug >> beam.smp(85491,0xb039d000) >> malloc: *** mmap(size=790962176) failed (error code=12) >> >> *** error: can't allocate >> region >> >> >> *** set a breakpoint in malloc_error_break to debug >> >> beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error >> code=12) >> >> *** error: can't >> allocate region >> *** set a breakpoint in malloc_error_break to debug >> Killed: 9 >> >> >> ================ >> >> -module(big_lists). >> >> -compile([export_all]). >> >> >> make_list(0,Acc)-> >> Acc; >> make_list(Size,Acc) -> >> make_list(Size-1, [a] ++ Acc). >> >> =================== >> >> 5> c(big_lists). >> {ok,big_lists} >> 6> big_lists:make_list(2,[]). >> [a,a] >> 7> big_lists:make_list(100000,[]). >> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >> 8> big_lists:make_list(1000000,[]). >> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >> 9> big_lists:make_list(10000000,[]). >> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >> 10> big_lists:make_list(100000000,[]). >> beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed (error >> code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) >> failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85534,0xb039d000) malloc: *** >> mmap(size=791674880) failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a >> breakpoint in malloc_error_break to debug >> >> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >> beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error >> code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) >> failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a breakpoint in >> malloc_error_break to debug >> beam.smp(85534,0xb039d000) malloc: *** >> mmap(size=949153792) failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a >> breakpoint in malloc_error_break to debug >> beam.smp(85534,0xb039d000) malloc: *** >> mmap(size=949153792) failed (error code=12) >> >> *** error: can't allocate region >> >> *** set a >> breakpoint in malloc_error_break to debug >> >> Crash dump was written to: erl_crash.dump >> eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap"). >> Abort trap: 6 >> >> >> _______________________________________________ >> 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 rvg.mailing@REDACTED Wed Mar 27 09:01:38 2013 From: rvg.mailing@REDACTED (Rudolph van Graan) Date: Wed, 27 Mar 2013 08:01:38 +0000 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: <08356E49-8E72-461D-8FA2-90BAC1A933E7@me.com> Hi Samuel, I managed to get mine to work to an extent. The one issue was as Anders pointed out the ssl tuple and two other issues: 1. The dictionaries and IDs in the dictionaries must be all correct, if they don't match, the peer connections don't come up and 2. The fact that I needed to include a local IP address in the connection configuration. This is really annoying because I am using a VPN to test and this IP address can change at any time, even in the same session. I traced the diameter tcp module and had to figure out the negotiation between the applications to get it right. Regards, Rudolph van Graan On 26 Mar 2013, at 14:48, S X wrote: > Hi, Rudolph & Anders, > > Not sure your problem is resolved or not. > > I was able to use the diameter sample code with the local/remote mode, i.e. Start a diameter server in an erts on a pc, and start a diameter client in an erts on another pc (I use virtual machines as pcs here). They can communicate different types of diameter messages without problems. > > However, when I try to use a diameter client (the sample code) from an erts to connect a diameter server which is not running within an erts (other diameter server not implemented in erlang). It doesn't work(can not build up a connection). I am not quite familiar with the detailed implementation of the erlang diameter library now. I am feeling that the erlang diameter relies on the erlang nodes, which means all the peers are built up only on the erts (distributed erlang runtimes). Does the erlang diameter only work within erlang environment? Or in order to talk to other diameter servers, does it need to write another erlang client using some functions from the erlang diameter library, like encode/decode? The sample client code doesn't work in this situation. > > I am not sure my understanding above is correct or not. Can you provide some guidance? > > Thanks, > > Samuel > > > > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson wrote: > One more time to the list ... > > On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson wrote: > > The problem looks to be that there's an {ssl, false} option being into > > diameter_tcp and then down to gen_tcp, which causes it to raise > > badarg. What OTP release is this? I can't say I recall the example > > code passing this tuple. > > > > /Anders, Erlang/OTP > > > > > > > > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan wrote: > >> Hi there, > >> > >> I'm trying to start up the Erlang diameter demo application shipped with > >> Erlang/OTP. The issue is that, no matter what format I try, I can't get the > >> client to connect to a remote diameter server. > >> > >> In that example, I started the application as follows: > >> > >> 3> diameter:start(), client:start(). > >> ok > >> > >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> {ok,#Ref<0.0.0.643>} > >> > >> 7> client:call(). > >> {error,no_connection} > >> > >> > >> Here, my local IP address is {10,151,0,166} and the remote one is > >> {10,249,20,174}. > >> > >> TCP to the server is working: > >> > >> telnet 10.249.20.174 3868 > >> Trying 10.249.20.174... > >> Connected to 10.249.20.174. > >> Escape character is '^]'. > >> > >> > >> I traced diameter_tcp and I can see that it is getting a badarg error > >> somewhere: > >> > >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.116.0>) call > >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> > >> Does anyone have an idea what I am doing wrong? My feeling is that it has to > >> do with the local ip address. I don't understand why I even need to supply a > >> local IP address and the documentation isn't very clear. > >> > >> Thanks, > >> > >> Rudolph > >> > >> > >> Here is the trace: > >> > >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:i/1 -> {monitor,<0.114.0>,<0.115.0>} > >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} > >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}]) > >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> [{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}]} > >> (<0.115.0>) call > >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call > >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> {ip,{10,151,0,166}}, > >> {raddr,{10,249,20,174}}, > >> {rport,3868}, > >> {reuseaddr,true}],[]) > >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} > >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} > >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} > >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> (<0.115.0>) call > >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, > >> {packet,0}, > >> {active,once}, > >> {ip,{10,151,0,166}}, > >> {ssl,false}, > >> {reuseaddr,true}] > >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.115.0>) call diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> {packet,0}, > >> {active,once}, > >> {ip,{10,151,0,166}}, > >> {ssl,false}, > >> {reuseaddr,true}]) > >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> [{10,151,0,166}]} > >> (<0.116.0>) call > >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) call > >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> (<0.116.0>) call > >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> (<0.116.0>) call > >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> > >> > >> > >> _______________________________________________ > >> 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 anders.otp@REDACTED Wed Mar 27 10:03:05 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Wed, 27 Mar 2013 10:03:05 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: <08356E49-8E72-461D-8FA2-90BAC1A933E7@me.com> References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> <08356E49-8E72-461D-8FA2-90BAC1A933E7@me.com> Message-ID: Hi Rudolph. On Wed, Mar 27, 2013 at 9:01 AM, Rudolph van Graan wrote: > Hi Samuel, > > I managed to get mine to work to an extent. The one issue was as Anders > pointed out the ssl tuple and two other issues: > > 1. The dictionaries and IDs in the dictionaries must be all correct, if they > don't match, the peer connections don't come up and Yes, this is a fairly common source if woe. Right now there's a fairly bloody app_not_configured crash (which I've cleaned up a bit for R16B01) but there's no check that the two match up. I'll fix it. > 2. The fact that I needed to include a local IP address in the connection > configuration. This is really annoying because I am using a VPN to test and > this IP address can change at any time, even in the same session. It's not really the connection configuration that needs the local IP address, it's capabilities exchange that needs one for a Host-IP-Address AVP. Right now diameter_tcp isn't smart enough to do something reasonable without an explicitly configured address but that can change. I should probably make start/3 return the local address returned by inet:sockname/1 if no address is configured, the returned address being what gets used as Host-IP-Address. I'll look into it. /Anders, Erlang/OTP > I traced the diameter tcp module and had to figure out the negotiation > between the applications to get it right. > > Regards, > > Rudolph van Graan > > > > > > On 26 Mar 2013, at 14:48, S X wrote: > > Hi, Rudolph & Anders, > > Not sure your problem is resolved or not. > > I was able to use the diameter sample code with the local/remote mode, i.e. > Start a diameter server in an erts on a pc, and start a diameter client in > an erts on another pc (I use virtual machines as pcs here). They can > communicate different types of diameter messages without problems. > > However, when I try to use a diameter client (the sample code) from an erts > to connect a diameter server which is not running within an erts (other > diameter server not implemented in erlang). It doesn't work(can not build up > a connection). I am not quite familiar with the detailed implementation of > the erlang diameter library now. I am feeling that the erlang diameter > relies on the erlang nodes, which means all the peers are built up only on > the erts (distributed erlang runtimes). Does the erlang diameter only work > within erlang environment? Or in order to talk to other diameter servers, > does it need to write another erlang client using some functions from the > erlang diameter library, like encode/decode? The sample client code doesn't > work in this situation. > > I am not sure my understanding above is correct or not. Can you provide some > guidance? > > Thanks, > > Samuel > > > > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson > wrote: >> >> One more time to the list ... >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson >> wrote: >> > The problem looks to be that there's an {ssl, false} option being into >> > diameter_tcp and then down to gen_tcp, which causes it to raise >> > badarg. What OTP release is this? I can't say I recall the example >> > code passing this tuple. >> > >> > /Anders, Erlang/OTP >> > >> > >> > >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan >> > wrote: >> >> Hi there, >> >> >> >> I'm trying to start up the Erlang diameter demo application shipped >> >> with >> >> Erlang/OTP. The issue is that, no matter what format I try, I can't get >> >> the >> >> client to connect to a remote diameter server. >> >> >> >> In that example, I started the application as follows: >> >> >> >> 3> diameter:start(), client:start(). >> >> ok >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> >> {ok,#Ref<0.0.0.643>} >> >> >> >> 7> client:call(). >> >> {error,no_connection} >> >> >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is >> >> {10,249,20,174}. >> >> >> >> TCP to the server is working: >> >> >> >> telnet 10.249.20.174 3868 >> >> Trying 10.249.20.174... >> >> Connected to 10.249.20.174. >> >> Escape character is '^]'. >> >> >> >> >> >> I traced diameter_tcp and I can see that it is getting a badarg error >> >> somewhere: >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> [{10,151,0,166}]} >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is that it >> >> has to >> >> do with the local ip address. I don't understand why I even need to >> >> supply a >> >> local IP address and the documentation isn't very clear. >> >> >> >> Thanks, >> >> >> >> Rudolph >> >> >> >> >> >> Here is the trace: >> >> >> >> (<0.84.0>) call diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> >> >> {monitor,<0.114.0>,<0.115.0>} >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}]) >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> >> [{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}]} >> >> (<0.115.0>) call >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}],[]) >> >> (<0.115.0>) call >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> >> {ip,{10,151,0,166}}, >> >> {raddr,{10,249,20,174}}, >> >> {rport,3868}, >> >> {reuseaddr,true}],[]) >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} >> >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> >> (<0.115.0>) call >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> >> {packet,0}, >> >> {active,once}, >> >> >> >> {ip,{10,151,0,166}}, >> >> {ssl,false}, >> >> {reuseaddr,true}] >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, >> >> >> >> [{10,151,0,166}]} >> >> (<0.115.0>) call >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> >> {packet,0}, >> >> {active,once}, >> >> {ip,{10,151,0,166}}, >> >> {ssl,false}, >> >> {reuseaddr,true}]) >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> [{10,151,0,166}]} >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> (<0.116.0>) call >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> >> >> >> >> _______________________________________________ >> >> 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 anders.otp@REDACTED Wed Mar 27 10:47:37 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Wed, 27 Mar 2013 10:47:37 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi Samuel. > Thanks for your reply. As my understanding also, the erlang diameter should > not care how the other peers are implemented, as long as the peers follow > the diameter specifications. > > But the erlang diameter library provides limited error information and this > makes it harder to analyse problems, especially for newbies. It's usually (it seems) problems with capabilities exchange that trips people up, and you're right that these can be a bit difficult to to detect: capabilities exchange will fail, the transport connection will be broken, and that's that. I'm a bit hesitant of logging ordinary (albeit failed) Diameter signaling but I'll see what I can do. > My set-up is: > > - Client (192.168.193.58) runs from an erlang run time in a virtual machine. > Just made some little changes based on the sample code: > ********************************************************************************************************************** > -define(SVC_NAME, ?MODULE). > -define(APP_RAR_ALIAS, rara). > -define(APP_CCR_ALIAS, ccra). > -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). > -define(DIAMETER_APP_ID_CCRA, 16777238). > -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > {'Origin-Realm', "example.com"}, > {'Vendor-Id', 193}, > {'Product-Name', "Client"}, > {'Auth-Application-Id', [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, > {application, [{alias, ?APP_RAR_ALIAS}, > {dictionary, ?DIAMETER_DICT_COMMON_NEW}, > {module, client_cb}]}, > {application, [{alias, ?APP_CCR_ALIAS}, > {dictionary, ?DIAMETER_DICT_CCRA}, > {module, client_cb_ccra}]}]). > > connect(Name, T) -> > diameter:add_transport(Name, {connect, [{reconnect_timer, 5000000}, {capx_timeout, 50000000} | client(T)]}). > > client(T) -> > client({T, {192,168,193,58}, {10,0,10,71}, 14302}). > ********************************************************************************************************************** So far, so good. (Although a 5000 sec reconnect_timer is on the long side. :) > - Server (10.0.10.71, port 14302) runs a diameter server remotely on a > Linux. It is up and running and being tested with other diameter client. > > Do the followings: > > 2> debugger:start(). > {ok,<0.39.0>} > 3> diameter:start(). > ok > 4> client:start(). > ok > 5> client:connect(tcp). > {ok,#Ref<0.0.0.1210>} > 6> client:call(). > {error,no_connection} > 7> > > The print information from the runtime doesn't say too much, it shows no > connection when call client:call(). In fact, when I check the debugger > window, there is no tcp connection being set up properly when calling > client:connect(tcp). Meaning the problem happened early without any > reminder. > > It is also wired that the debugger monitor window doesn't allow to > copy/paste:(, so I have to type some errors as following: > > <0.128.0> diameter_peer_fsm:init/1 exit > {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, > {tcp_closed,#Port<0.2250>}}}} > <0.136.0> diameter_tcp:init/1 exit {shutdown,{tcp_closed,#Port<0.2250>}} This looks like the peer is closing the connection. We're not even getting as far as sending CER. Are you able to see what's happening on the peer at all, why it's closing the connection? /Anders, Erlang/OTP > <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} > > I increased the capx_timeout, since I thought might be CER timeout. No luck. > > There was no tcp connection being set up at all. I use the wireshark to > watch on the interface with the filter and I didn't > see any outgoing packets. > > Again, It still might be some configurations are incorrect causing the above > problem. But with the limited information, it is difficult to figure out > what was wrong for newbies. > > Could you provide some guidances on how to resolve this and any suggestions > on diagnosing diameter or erlang issues? > > Thanks a lot for your comments! > > Samuel > > > > On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson > wrote: >> >> On Tue, Mar 26, 2013 at 3:48 PM, S X wrote: >> > Hi, Rudolph & Anders, >> > >> > Not sure your problem is resolved or not. >> > >> > I was able to use the diameter sample code with the local/remote mode, >> > i.e. >> > Start a diameter server in an erts on a pc, and start a diameter client >> > in >> > an erts on another pc (I use virtual machines as pcs here). They can >> > communicate different types of diameter messages without problems. >> > >> > However, when I try to use a diameter client (the sample code) from an >> > erts >> > to connect a diameter server which is not running within an erts (other >> > diameter server not implemented in erlang). It doesn't work(can not >> > build up >> > a connection). I am not quite familiar with the detailed implementation >> > of >> > the erlang diameter library now. I am feeling that the erlang diameter >> > relies on the erlang nodes, which means all the peers are built up only >> > on >> > the erts (distributed erlang runtimes). Does the erlang diameter only >> > work >> > within erlang environment? Or in order to talk to other diameter >> > servers, >> >> No, diameter has no idea how any peers it connects to are implemented. >> >> > does it need to write another erlang client using some functions from >> > the >> > erlang diameter library, like encode/decode? The sample client code >> > doesn't >> > work in this situation. >> > >> > I am not sure my understanding above is correct or not. Can you provide >> > some >> > guidance? >> >> Sure, if you provide me with an example of something that doesn't work >> as expected. >> >> Anders >> >> >> > Thanks, >> > >> > Samuel >> > >> > >> > >> > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson >> > wrote: >> >> >> >> One more time to the list ... >> >> >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson >> >> >> >> wrote: >> >> > The problem looks to be that there's an {ssl, false} option being >> >> > into >> >> > diameter_tcp and then down to gen_tcp, which causes it to raise >> >> > badarg. What OTP release is this? I can't say I recall the example >> >> > code passing this tuple. >> >> > >> >> > /Anders, Erlang/OTP >> >> > >> >> > >> >> > >> >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan >> >> > >> >> > wrote: >> >> >> Hi there, >> >> >> >> >> >> I'm trying to start up the Erlang diameter demo application shipped >> >> >> with >> >> >> Erlang/OTP. The issue is that, no matter what format I try, I can't >> >> >> get >> >> >> the >> >> >> client to connect to a remote diameter server. >> >> >> >> >> >> In that example, I started the application as follows: >> >> >> >> >> >> 3> diameter:start(), client:start(). >> >> >> ok >> >> >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> >> >> {ok,#Ref<0.0.0.643>} >> >> >> >> >> >> 7> client:call(). >> >> >> {error,no_connection} >> >> >> >> >> >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is >> >> >> {10,249,20,174}. >> >> >> >> >> >> TCP to the server is working: >> >> >> >> >> >> telnet 10.249.20.174 3868 >> >> >> Trying 10.249.20.174... >> >> >> Connected to 10.249.20.174. >> >> >> Escape character is '^]'. >> >> >> >> >> >> >> >> >> I traced diameter_tcp and I can see that it is getting a badarg >> >> >> error >> >> >> somewhere: >> >> >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> >> [{10,151,0,166}]} >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is that >> >> >> it >> >> >> has to >> >> >> do with the local ip address. I don't understand why I even need to >> >> >> supply a >> >> >> local IP address and the documentation isn't very clear. >> >> >> >> >> >> Thanks, >> >> >> >> >> >> Rudolph >> >> >> >> >> >> >> >> >> Here is the trace: >> >> >> >> >> >> (<0.84.0>) call >> >> >> diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> >> >> >> {monitor,<0.114.0>,<0.115.0>} >> >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.116.0>} >> >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> >> >> {ip,{10,151,0,166}}, >> >> >> {raddr,{10,249,20,174}}, >> >> >> {rport,3868}, >> >> >> {reuseaddr,true}]) >> >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> >> >> [{ssl,false}, >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> {rport,3868}, >> >> >> {reuseaddr,true}]} >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> >> >> {ip,{10,151,0,166}}, >> >> >> {raddr,{10,249,20,174}}, >> >> >> {rport,3868}, >> >> >> {reuseaddr,true}],[]) >> >> >> (<0.115.0>) call >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> >> >> {ip,{10,151,0,166}}, >> >> >> {raddr,{10,249,20,174}}, >> >> >> {rport,3868}, >> >> >> {reuseaddr,true}],[]) >> >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,151,0,166} >> >> >> (<0.115.0>) call diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> {10,249,20,174} >> >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> >> >> (<0.115.0>) call >> >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> >> >> {packet,0}, >> >> >> {active,once}, >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> {ssl,false}, >> >> >> >> >> >> {reuseaddr,true}] >> >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> {ok,<0.115.0>, >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> (<0.115.0>) call >> >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> >> >> {packet,0}, >> >> >> {active,once}, >> >> >> {ip,{10,151,0,166}}, >> >> >> {ssl,false}, >> >> >> {reuseaddr,true}]) >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> >> [{10,151,0,166}]} >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> (<0.116.0>) call >> >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> 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 stu.bailey@REDACTED Wed Mar 27 15:24:20 2013 From: stu.bailey@REDACTED (Stu Bailey) Date: Wed, 27 Mar 2013 07:24:20 -0700 Subject: [erlang-questions] Unexpected limitations In-Reply-To: References: Message-ID: Everything works with 64bit emulator, sorry for the false alarm. Thanks! On Wed, Mar 27, 2013 at 12:37 AM, Lukas Larsson wrote: > Hello Stu! > > As Bengt pointed out you need a 64 bit erlang emulator because the list > you created in 2 words * 100 million which would be about 1.6 GB. When the > copying GC kicks in that expands to very close to 4GB which is the max in a > 32 bit emulator. To compile a 64 but emulator on OS X see > http://www.erlang.org/doc/installation_guide/INSTALL.html#id72320 > > Lukas > > > On Wed, Mar 27, 2013 at 7:31 AM, Danil Zagoskin wrote: > >> Hi, Stu. >> >> Does your beam crash when you call lists:duplicate(100000000, a) ? >> >> The difference is lists:duplicate is tail-recursive while lists:seq and >> big_lists:make_list are body-recursive so you can hit some stack size >> limit, not lists length one. >> >> >> 2013/3/27 Stu Bailey >> >>> Hi all, >>> >>> I have an 8 core MacBook Pro Retina Display with 16GB of memory. I am >>> running R16B with no configure options...but I did install >>> libatomic_ops-7.2 . I tried a very simple list allocation test which >>> surprisingly failed with a list size of 100 million. I first made a list >>> with 10 million integers. The beam hung on 100 million. Thinking it was >>> something with lists:seq, I just wrote a dumb test to build big lists of >>> single character atoms. That also failed at 100 million. Is there a >>> known limitation to the size of lists in Erlang? >>> >>> bash-3.2$ uname -a >>> Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 >>> 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 >>> >>> bash-3.2$ erl >>> Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] >>> [kernel-poll:false] >>> >>> My Erlang Environment >>> Eshell V5.10.1 (abort with ^G) >>> 1> lists:seq(1,10000000). >>> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, >>> 23,24,25,26,27,28,29|...] >>> 2> lists:seq(1,100000000). >>> beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed >>> (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) >>> failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85491,0xb039d000) malloc: *** >>> mmap(size=791674880) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a >>> breakpoint in malloc_error_break to debug >>> beam.smp(85491,0xb039d000) malloc: *** >>> mmap(size=791674880) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a >>> breakpoint in malloc_error_break to debug >>> beam.smp(85491,0xb039d000) malloc: *** >>> mmap(size=791674880) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> >>> *** set a breakpoint in malloc_error_break to debug >>> beam.smp(85491,0xb039d000) >>> malloc: *** mmap(size=790962176) failed (error code=12) >>> >>> *** error: can't allocate >>> region >>> >>> >>> *** set a breakpoint in malloc_error_break to debug >>> >>> beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error >>> code=12) >>> >>> *** error: can't >>> allocate region >>> *** set a breakpoint in malloc_error_break to debug >>> Killed: 9 >>> >>> >>> ================ >>> >>> -module(big_lists). >>> >>> -compile([export_all]). >>> >>> >>> make_list(0,Acc)-> >>> Acc; >>> make_list(Size,Acc) -> >>> make_list(Size-1, [a] ++ Acc). >>> >>> =================== >>> >>> 5> c(big_lists). >>> {ok,big_lists} >>> 6> big_lists:make_list(2,[]). >>> [a,a] >>> 7> big_lists:make_list(100000,[]). >>> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >>> 8> big_lists:make_list(1000000,[]). >>> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >>> 9> big_lists:make_list(10000000,[]). >>> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >>> 10> big_lists:make_list(100000000,[]). >>> beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed >>> (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) >>> failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85534,0xb039d000) malloc: *** >>> mmap(size=791674880) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a >>> breakpoint in malloc_error_break to debug >>> >>> [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...] >>> beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed >>> (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) >>> failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a breakpoint in >>> malloc_error_break to debug >>> beam.smp(85534,0xb039d000) malloc: *** >>> mmap(size=949153792) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a >>> breakpoint in malloc_error_break to debug >>> beam.smp(85534,0xb039d000) malloc: *** >>> mmap(size=949153792) failed (error code=12) >>> >>> *** error: can't allocate region >>> >>> *** set a >>> breakpoint in malloc_error_break to debug >>> >>> Crash dump was written to: erl_crash.dump >>> eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap"). >>> Abort trap: 6 >>> >>> >>> _______________________________________________ >>> 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 olivier.boudeville@REDACTED Wed Mar 27 17:48:13 2013 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Wed, 27 Mar 2013 17:48:13 +0100 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes Message-ID: Hi, I would have a potentially large number of Erlang terms to send to a set of remote VMs. Currently it is a matter of a few megabytes, but it could be up to a few gigabytes in the future; and the exact same content may have to be sent to typically a dozen of other nodes. I was searching for a solution that would be reliable/simple/efficient to do so (preferably in that order), knowing that these terms could be either be kept in the RAM of the sender or, maybe preferably (the size of the data being probably roughly on par with the local RAM), as a compressed file on disk. Currently I send a binary, compressed archive thanks to a basic Erlang message, but I think it is not a good practice (ex: maybe the kernel ticks are not sent "out of band" and their delaying by larger archives could trigger spurious time-outs). I imagine sendfile with enough async threads could be a good candidate, however I am unsure that the same content (either as a whole or by chunks) could be read once, yet be sent to multiple recipients. Any idea? Thanks in advance for any hint! 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 soroker@REDACTED Wed Mar 27 17:51:12 2013 From: soroker@REDACTED (Andrei Soroker) Date: Wed, 27 Mar 2013 09:51:12 -0700 Subject: [erlang-questions] Querying JSON, team chat Message-ID: Greetings! I've had to deal with a lot of JSON over the last year or so and I wholeheartedly recommend Jiffy [1] for encoding and decoding JSON. One problem I had was querying the decoded JSON (we call the resulting Erlang terms jterms). To address this, I wrote a very simple XPath-inspired query library [2]. Perhaps others would find it useful. In the spirit of attempting to embrace the subject of self-promotion in the Erlang community, I'd like to self-promote my new project - LeChat [3]. It's a team chat service that emphasizes history search, humane copy-pasting of code, and reasonable UI. The backend is handled by Cowboy and Postgres, the fronted is knockout.js, and the two are connected by websockets. We're charging $1/user/month after a 30 day trial, but it's free for use in schools (universities, etc). Andrei [1] https://github.com/davisp/jiffy [2] https://github.com/lechat-im/jsonq [3] http://lechat.im From vances@REDACTED Wed Mar 27 17:54:43 2013 From: vances@REDACTED (Vance Shipley) Date: Wed, 27 Mar 2013 22:24:43 +0530 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes In-Reply-To: References: Message-ID: I have a similar use case for which I am considering using IP multicasting and implementing a reliable layer on top. Basically broadcasting sends but buffering data until there's been time for negative acknowledgements. On Mar 27, 2013 10:18 PM, "Olivier BOUDEVILLE" wrote: > > Hi, > > I would have a potentially large number of Erlang terms to send to a set > of remote VMs. Currently it is a matter of a few megabytes, but it could be > up to a few gigabytes in the future; and the exact same content may have to > be sent to typically a dozen of other nodes. > > I was searching for a solution that would be reliable/simple/efficient to > do so (preferably in that order), knowing that these terms could be either > be kept in the RAM of the sender or, maybe preferably (the size of the data > being probably roughly on par with the local RAM), as a compressed file on > disk. > > Currently I send a binary, compressed archive thanks to a basic Erlang > message, but I think it is not a good practice (ex: maybe the kernel ticks > are not sent "out of band" and their delaying by larger archives could > trigger spurious time-outs). I imagine sendfile with enough async threads > could be a good candidate, however I am unsure that the same content > (either as a whole or by chunks) could be read once, yet be sent to > multiple recipients. > > Any idea? > > Thanks in advance for any hint! > > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangprogram@REDACTED Wed Mar 27 18:50:21 2013 From: erlangprogram@REDACTED (S X) Date: Wed, 27 Mar 2013 13:50:21 -0400 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi Anders & Rudolph, Thanks for your responses. "5000 sec reconnect_timer is on the long side." I guess I treated milli as micro. :) Don't worry about the logging, as long as I can see something from the erlang debugger window (By the way, I feel that the debugger for Window version is better than the one for Ubuntu). And I understand that it is kind of difficult to log everything from the diameter library. As Anders suggested, I checked on the peer side (the diameter server in this case) and it seems timed out waiting for CER and disconnecting the client. Also, I found that my wireshark wasn't set up properly to work with VPN ( I am running it with a VPN environment) and that is properly why I didn't see any packets going outside. At last, I made the communication work after changing Origin-Host and Origin-Realm on the diameter client side. And they can talk diameter now. But don't quite understand why those two options are important for the initial socket set-up? For the initial step, doesn't it just need server IP and port information? Or maybe because the special implementation on this diameter server? Is this common to a diameter application? The other question is about diameter node, in diameter_sync module: call(Name, Req, Max, Timeout) -> call(node(), Name, Req, Max, Timeout). By default, it is "nonode@REDACTED", is the node used just for representing the erlang run time or for other purpose? How does the node information is being used in diameter? Many thanks! Samuel On Wed, Mar 27, 2013 at 5:47 AM, Anders Svensson wrote: > Hi Samuel. > > > Thanks for your reply. As my understanding also, the erlang diameter > should > > not care how the other peers are implemented, as long as the peers follow > > the diameter specifications. > > > > But the erlang diameter library provides limited error information and > this > > makes it harder to analyse problems, especially for newbies. > > It's usually (it seems) problems with capabilities exchange that trips > people up, and you're right that these can be a bit difficult to to > detect: capabilities exchange will fail, the transport connection will > be broken, and that's that. I'm a bit hesitant of logging ordinary > (albeit failed) Diameter signaling but I'll see what I can do. > > > My set-up is: > > > > - Client (192.168.193.58) runs from an erlang run time in a virtual > machine. > > Just made some little changes based on the sample code: > > > ********************************************************************************************************************** > > -define(SVC_NAME, ?MODULE). > > -define(APP_RAR_ALIAS, rara). > > -define(APP_CCR_ALIAS, ccra). > > -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). > > -define(DIAMETER_APP_ID_CCRA, 16777238). > > -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). > > > > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > > {'Origin-Realm', "example.com"}, > > {'Vendor-Id', 193}, > > {'Product-Name', "Client"}, > > {'Auth-Application-Id', > [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, > > {application, [{alias, ?APP_RAR_ALIAS}, > > {dictionary, > ?DIAMETER_DICT_COMMON_NEW}, > > {module, client_cb}]}, > > {application, [{alias, ?APP_CCR_ALIAS}, > > {dictionary, ?DIAMETER_DICT_CCRA}, > > {module, client_cb_ccra}]}]). > > > > connect(Name, T) -> > > diameter:add_transport(Name, {connect, [{reconnect_timer, 5000000}, > {capx_timeout, 50000000} | client(T)]}). > > > > client(T) -> > > client({T, {192,168,193,58}, {10,0,10,71}, 14302}). > > > ********************************************************************************************************************** > > So far, so good. (Although a 5000 sec reconnect_timer is on the long side. > :) > > > - Server (10.0.10.71, port 14302) runs a diameter server remotely on a > > Linux. It is up and running and being tested with other diameter client. > > > > Do the followings: > > > > 2> debugger:start(). > > {ok,<0.39.0>} > > 3> diameter:start(). > > ok > > 4> client:start(). > > ok > > 5> client:connect(tcp). > > {ok,#Ref<0.0.0.1210>} > > 6> client:call(). > > {error,no_connection} > > 7> > > > > The print information from the runtime doesn't say too much, it shows no > > connection when call client:call(). In fact, when I check the debugger > > window, there is no tcp connection being set up properly when calling > > client:connect(tcp). Meaning the problem happened early without any > > reminder. > > > > It is also wired that the debugger monitor window doesn't allow to > > copy/paste:(, so I have to type some errors as following: > > > > <0.128.0> diameter_peer_fsm:init/1 exit > > {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, > > {tcp_closed,#Port<0.2250>}}}} > > <0.136.0> diameter_tcp:init/1 exit {shutdown,{tcp_closed,#Port<0.2250>}} > > This looks like the peer is closing the connection. We're not even > getting as far as sending CER. Are you able to see what's happening on > the peer at all, why it's closing the connection? > > /Anders, Erlang/OTP > > > > <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} > > > > I increased the capx_timeout, since I thought might be CER timeout. No > luck. > > > > There was no tcp connection being set up at all. I use the wireshark to > > watch on the interface with the filter and I > didn't > > see any outgoing packets. > > > > Again, It still might be some configurations are incorrect causing the > above > > problem. But with the limited information, it is difficult to figure out > > what was wrong for newbies. > > > > Could you provide some guidances on how to resolve this and any > suggestions > > on diagnosing diameter or erlang issues? > > > > Thanks a lot for your comments! > > > > Samuel > > > > > > > > On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson > > wrote: > >> > >> On Tue, Mar 26, 2013 at 3:48 PM, S X wrote: > >> > Hi, Rudolph & Anders, > >> > > >> > Not sure your problem is resolved or not. > >> > > >> > I was able to use the diameter sample code with the local/remote mode, > >> > i.e. > >> > Start a diameter server in an erts on a pc, and start a diameter > client > >> > in > >> > an erts on another pc (I use virtual machines as pcs here). They can > >> > communicate different types of diameter messages without problems. > >> > > >> > However, when I try to use a diameter client (the sample code) from an > >> > erts > >> > to connect a diameter server which is not running within an erts > (other > >> > diameter server not implemented in erlang). It doesn't work(can not > >> > build up > >> > a connection). I am not quite familiar with the detailed > implementation > >> > of > >> > the erlang diameter library now. I am feeling that the erlang diameter > >> > relies on the erlang nodes, which means all the peers are built up > only > >> > on > >> > the erts (distributed erlang runtimes). Does the erlang diameter only > >> > work > >> > within erlang environment? Or in order to talk to other diameter > >> > servers, > >> > >> No, diameter has no idea how any peers it connects to are implemented. > >> > >> > does it need to write another erlang client using some functions from > >> > the > >> > erlang diameter library, like encode/decode? The sample client code > >> > doesn't > >> > work in this situation. > >> > > >> > I am not sure my understanding above is correct or not. Can you > provide > >> > some > >> > guidance? > >> > >> Sure, if you provide me with an example of something that doesn't work > >> as expected. > >> > >> Anders > >> > >> > >> > Thanks, > >> > > >> > Samuel > >> > > >> > > >> > > >> > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson < > anders.otp@REDACTED> > >> > wrote: > >> >> > >> >> One more time to the list ... > >> >> > >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson > >> >> > >> >> wrote: > >> >> > The problem looks to be that there's an {ssl, false} option being > >> >> > into > >> >> > diameter_tcp and then down to gen_tcp, which causes it to raise > >> >> > badarg. What OTP release is this? I can't say I recall the example > >> >> > code passing this tuple. > >> >> > > >> >> > /Anders, Erlang/OTP > >> >> > > >> >> > > >> >> > > >> >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan > >> >> > > >> >> > wrote: > >> >> >> Hi there, > >> >> >> > >> >> >> I'm trying to start up the Erlang diameter demo application > shipped > >> >> >> with > >> >> >> Erlang/OTP. The issue is that, no matter what format I try, I > can't > >> >> >> get > >> >> >> the > >> >> >> client to connect to a remote diameter server. > >> >> >> > >> >> >> In that example, I started the application as follows: > >> >> >> > >> >> >> 3> diameter:start(), client:start(). > >> >> >> ok > >> >> >> > >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> >> >> {ok,#Ref<0.0.0.643>} > >> >> >> > >> >> >> 7> client:call(). > >> >> >> {error,no_connection} > >> >> >> > >> >> >> > >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is > >> >> >> {10,249,20,174}. > >> >> >> > >> >> >> TCP to the server is working: > >> >> >> > >> >> >> telnet 10.249.20.174 3868 > >> >> >> Trying 10.249.20.174... > >> >> >> Connected to 10.249.20.174. > >> >> >> Escape character is '^]'. > >> >> >> > >> >> >> > >> >> >> I traced diameter_tcp and I can see that it is getting a badarg > >> >> >> error > >> >> >> somewhere: > >> >> >> > >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> >> >> > [{10,151,0,166}]} > >> >> >> (<0.116.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> >> > >> >> >> Does anyone have an idea what I am doing wrong? My feeling is that > >> >> >> it > >> >> >> has to > >> >> >> do with the local ip address. I don't understand why I even need > to > >> >> >> supply a > >> >> >> local IP address and the documentation isn't very clear. > >> >> >> > >> >> >> Thanks, > >> >> >> > >> >> >> Rudolph > >> >> >> > >> >> >> > >> >> >> Here is the trace: > >> >> >> > >> >> >> (<0.84.0>) call > >> >> >> diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> > >> >> >> {monitor,<0.114.0>,<0.115.0>} > >> >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> > {ok,<0.116.0>} > >> >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> >> >> {ip,{10,151,0,166}}, > >> >> >> {raddr,{10,249,20,174}}, > >> >> >> {rport,3868}, > >> >> >> {reuseaddr,true}]) > >> >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> >> >> [{ssl,false}, > >> >> >> > >> >> >> {ip,{10,151,0,166}}, > >> >> >> > >> >> >> {raddr,{10,249,20,174}}, > >> >> >> {rport,3868}, > >> >> >> > {reuseaddr,true}]} > >> >> >> (<0.115.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> >> >> {ip,{10,151,0,166}}, > >> >> >> {raddr,{10,249,20,174}}, > >> >> >> {rport,3868}, > >> >> >> {reuseaddr,true}],[]) > >> >> >> (<0.115.0>) call > >> >> >> > >> >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> >> >> {ip,{10,151,0,166}}, > >> >> >> {raddr,{10,249,20,174}}, > >> >> >> {rport,3868}, > >> >> >> {reuseaddr,true}],[]) > >> >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} > >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > {10,151,0,166} > >> >> >> (<0.115.0>) call > diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} > >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > {10,249,20,174} > >> >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> >> >> (<0.115.0>) call > >> >> >> > diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, > >> >> >> {packet,0}, > >> >> >> > {active,once}, > >> >> >> > >> >> >> {ip,{10,151,0,166}}, > >> >> >> {ssl,false}, > >> >> >> > >> >> >> {reuseaddr,true}] > >> >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> > {ok,<0.115.0>, > >> >> >> > >> >> >> [{10,151,0,166}]} > >> >> >> (<0.115.0>) call > >> >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> >> >> {packet,0}, > >> >> >> {active,once}, > >> >> >> {ip,{10,151,0,166}}, > >> >> >> {ssl,false}, > >> >> >> {reuseaddr,true}]) > >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, > >> >> >> > [{10,151,0,166}]} > >> >> >> (<0.116.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> >> (<0.116.0>) call > >> >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> >> >> (<0.116.0>) call > >> >> >> > >> >> >> > >> >> >> > diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> >> >> > >> >> >> > >> >> >> > >> >> >> _______________________________________________ > >> >> >> 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 anders.otp@REDACTED Wed Mar 27 21:18:33 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Wed, 27 Mar 2013 21:18:33 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi Samuel. On Wed, Mar 27, 2013 at 6:50 PM, S X wrote: > Hi Anders & Rudolph, > > Thanks for your responses. > > "5000 sec reconnect_timer is on the long side." I guess I treated milli as > micro. :) > > Don't worry about the logging, as long as I can see something from the > erlang debugger window (By the way, I feel that the debugger for Window > version is better than the one for Ubuntu). And I understand that it is kind > of difficult to log everything from the diameter library. > > As Anders suggested, I checked on the peer side (the diameter server in this > case) and it seems timed out waiting for CER and disconnecting the client. > > Also, I found that my wireshark wasn't set up properly to work with VPN ( I > am running it with a VPN environment) and that is properly why I didn't see > any packets going outside. > > At last, I made the communication work after changing Origin-Host and > Origin-Realm on the diameter client side. And they can talk diameter now. > But don't quite understand why those two options are important for the > initial socket set-up? For the initial step, doesn't it just need server IP > and port information? Or maybe because the special implementation on this > diameter server? Is this common to a diameter application? Origin-Host/Realm are only used to construct an outgoing capabilities CER/CEA after the transport connection is established. Are you sure the server wasn't receiving your client's CER and closing the connection for some reason? Changing the values of Origin-Host/Realm shouldn't make a difference unless the server cares. (Which is a bit unusual. If anything it's IP addresses that servers seem to like to reject connections from.) > The other question is about diameter node, in diameter_sync module: > call(Name, Req, Max, Timeout) -> > call(node(), Name, Req, Max, Timeout). > > By default, it is "nonode@REDACTED", is the node used just for representing > the erlang run time or for other purpose? How does the node information is > being used in diameter? nonode@REDACTED is the name of an Erlang node that isn't distributed. That is, that doesn't register with epmd and doesn't talk to other Erlang nodes using the Distribution Protocol. If you start a distributed node (eg. erl -sname foo) then diameter can share information about transport connections with diameter services running on other nodes. This isn't documented (or working :) in R16B but it is on the maint branch on github, on the way to R16B01. (Take a look at the doc for the service_opt() share_peers in diameter(3).) /Anders, Erlang/OTP > Many thanks! > > > Samuel > > > > > On Wed, Mar 27, 2013 at 5:47 AM, Anders Svensson > wrote: >> >> Hi Samuel. >> >> > Thanks for your reply. As my understanding also, the erlang diameter >> > should >> > not care how the other peers are implemented, as long as the peers >> > follow >> > the diameter specifications. >> > >> > But the erlang diameter library provides limited error information and >> > this >> > makes it harder to analyse problems, especially for newbies. >> >> It's usually (it seems) problems with capabilities exchange that trips >> people up, and you're right that these can be a bit difficult to to >> detect: capabilities exchange will fail, the transport connection will >> be broken, and that's that. I'm a bit hesitant of logging ordinary >> (albeit failed) Diameter signaling but I'll see what I can do. >> >> > My set-up is: >> > >> > - Client (192.168.193.58) runs from an erlang run time in a virtual >> > machine. >> > Just made some little changes based on the sample code: >> > >> > ********************************************************************************************************************** >> > -define(SVC_NAME, ?MODULE). >> > -define(APP_RAR_ALIAS, rara). >> > -define(APP_CCR_ALIAS, ccra). >> > -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). >> > -define(DIAMETER_APP_ID_CCRA, 16777238). >> > -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). >> > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> > {'Origin-Realm', "example.com"}, >> > {'Vendor-Id', 193}, >> > {'Product-Name', "Client"}, >> > {'Auth-Application-Id', >> > [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, >> > {application, [{alias, ?APP_RAR_ALIAS}, >> > {dictionary, >> > ?DIAMETER_DICT_COMMON_NEW}, >> > {module, client_cb}]}, >> > {application, [{alias, ?APP_CCR_ALIAS}, >> > {dictionary, >> > ?DIAMETER_DICT_CCRA}, >> > {module, client_cb_ccra}]}]). >> > >> > connect(Name, T) -> >> > diameter:add_transport(Name, {connect, [{reconnect_timer, 5000000}, >> > {capx_timeout, 50000000} | client(T)]}). >> > >> > client(T) -> >> > client({T, {192,168,193,58}, {10,0,10,71}, 14302}). >> > >> > ********************************************************************************************************************** >> >> So far, so good. (Although a 5000 sec reconnect_timer is on the long side. >> :) >> >> > - Server (10.0.10.71, port 14302) runs a diameter server remotely on a >> > Linux. It is up and running and being tested with other diameter client. >> > >> > Do the followings: >> > >> > 2> debugger:start(). >> > {ok,<0.39.0>} >> > 3> diameter:start(). >> > ok >> > 4> client:start(). >> > ok >> > 5> client:connect(tcp). >> > {ok,#Ref<0.0.0.1210>} >> > 6> client:call(). >> > {error,no_connection} >> > 7> >> > >> > The print information from the runtime doesn't say too much, it shows no >> > connection when call client:call(). In fact, when I check the debugger >> > window, there is no tcp connection being set up properly when calling >> > client:connect(tcp). Meaning the problem happened early without any >> > reminder. >> > >> > It is also wired that the debugger monitor window doesn't allow to >> > copy/paste:(, so I have to type some errors as following: >> > >> > <0.128.0> diameter_peer_fsm:init/1 exit >> > {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, >> > {tcp_closed,#Port<0.2250>}}}} >> > <0.136.0> diameter_tcp:init/1 exit {shutdown,{tcp_closed,#Port<0.2250>}} >> >> This looks like the peer is closing the connection. We're not even >> getting as far as sending CER. Are you able to see what's happening on >> the peer at all, why it's closing the connection? >> >> /Anders, Erlang/OTP >> >> >> > <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} >> > >> > I increased the capx_timeout, since I thought might be CER timeout. No >> > luck. >> > >> > There was no tcp connection being set up at all. I use the wireshark to >> > watch on the interface with the filter and I >> > didn't >> > see any outgoing packets. >> > >> > Again, It still might be some configurations are incorrect causing the >> > above >> > problem. But with the limited information, it is difficult to figure out >> > what was wrong for newbies. >> > >> > Could you provide some guidances on how to resolve this and any >> > suggestions >> > on diagnosing diameter or erlang issues? >> > >> > Thanks a lot for your comments! >> > >> > Samuel >> > >> > >> > >> > On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson >> > wrote: >> >> >> >> On Tue, Mar 26, 2013 at 3:48 PM, S X wrote: >> >> > Hi, Rudolph & Anders, >> >> > >> >> > Not sure your problem is resolved or not. >> >> > >> >> > I was able to use the diameter sample code with the local/remote >> >> > mode, >> >> > i.e. >> >> > Start a diameter server in an erts on a pc, and start a diameter >> >> > client >> >> > in >> >> > an erts on another pc (I use virtual machines as pcs here). They can >> >> > communicate different types of diameter messages without problems. >> >> > >> >> > However, when I try to use a diameter client (the sample code) from >> >> > an >> >> > erts >> >> > to connect a diameter server which is not running within an erts >> >> > (other >> >> > diameter server not implemented in erlang). It doesn't work(can not >> >> > build up >> >> > a connection). I am not quite familiar with the detailed >> >> > implementation >> >> > of >> >> > the erlang diameter library now. I am feeling that the erlang >> >> > diameter >> >> > relies on the erlang nodes, which means all the peers are built up >> >> > only >> >> > on >> >> > the erts (distributed erlang runtimes). Does the erlang diameter only >> >> > work >> >> > within erlang environment? Or in order to talk to other diameter >> >> > servers, >> >> >> >> No, diameter has no idea how any peers it connects to are implemented. >> >> >> >> > does it need to write another erlang client using some functions from >> >> > the >> >> > erlang diameter library, like encode/decode? The sample client code >> >> > doesn't >> >> > work in this situation. >> >> > >> >> > I am not sure my understanding above is correct or not. Can you >> >> > provide >> >> > some >> >> > guidance? >> >> >> >> Sure, if you provide me with an example of something that doesn't work >> >> as expected. >> >> >> >> Anders >> >> >> >> >> >> > Thanks, >> >> > >> >> > Samuel >> >> > >> >> > >> >> > >> >> > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson >> >> > >> >> > wrote: >> >> >> >> >> >> One more time to the list ... >> >> >> >> >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson >> >> >> >> >> >> wrote: >> >> >> > The problem looks to be that there's an {ssl, false} option being >> >> >> > into >> >> >> > diameter_tcp and then down to gen_tcp, which causes it to raise >> >> >> > badarg. What OTP release is this? I can't say I recall the example >> >> >> > code passing this tuple. >> >> >> > >> >> >> > /Anders, Erlang/OTP >> >> >> > >> >> >> > >> >> >> > >> >> >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan >> >> >> > >> >> >> > wrote: >> >> >> >> Hi there, >> >> >> >> >> >> >> >> I'm trying to start up the Erlang diameter demo application >> >> >> >> shipped >> >> >> >> with >> >> >> >> Erlang/OTP. The issue is that, no matter what format I try, I >> >> >> >> can't >> >> >> >> get >> >> >> >> the >> >> >> >> client to connect to a remote diameter server. >> >> >> >> >> >> >> >> In that example, I started the application as follows: >> >> >> >> >> >> >> >> 3> diameter:start(), client:start(). >> >> >> >> ok >> >> >> >> >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> >> >> >> {ok,#Ref<0.0.0.643>} >> >> >> >> >> >> >> >> 7> client:call(). >> >> >> >> {error,no_connection} >> >> >> >> >> >> >> >> >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one is >> >> >> >> {10,249,20,174}. >> >> >> >> >> >> >> >> TCP to the server is working: >> >> >> >> >> >> >> >> telnet 10.249.20.174 3868 >> >> >> >> Trying 10.249.20.174... >> >> >> >> Connected to 10.249.20.174. >> >> >> >> Escape character is '^]'. >> >> >> >> >> >> >> >> >> >> >> >> I traced diameter_tcp and I can see that it is getting a badarg >> >> >> >> error >> >> >> >> somewhere: >> >> >> >> >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is >> >> >> >> that >> >> >> >> it >> >> >> >> has to >> >> >> >> do with the local ip address. I don't understand why I even need >> >> >> >> to >> >> >> >> supply a >> >> >> >> local IP address and the documentation isn't very clear. >> >> >> >> >> >> >> >> Thanks, >> >> >> >> >> >> >> >> Rudolph >> >> >> >> >> >> >> >> >> >> >> >> Here is the trace: >> >> >> >> >> >> >> >> (<0.84.0>) call >> >> >> >> diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) call diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> >> >> >> >> {monitor,<0.114.0>,<0.115.0>} >> >> >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> >> >> >> >> {ok,<0.116.0>} >> >> >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> {rport,3868}, >> >> >> >> {reuseaddr,true}]) >> >> >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> >> >> >> [{ssl,false}, >> >> >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> {rport,3868}, >> >> >> >> >> >> >> >> {reuseaddr,true}]} >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> {rport,3868}, >> >> >> >> {reuseaddr,true}],[]) >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> {rport,3868}, >> >> >> >> {reuseaddr,true}],[]) >> >> >> >> (<0.115.0>) call diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> >> >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> >> >> >> >> {10,151,0,166} >> >> >> >> (<0.115.0>) call >> >> >> >> diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> >> >> >> (<0.115.0>) call diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,249,20,174} >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> >> >> >> >> {10,249,20,174} >> >> >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> >> >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> >> >> >> {packet,0}, >> >> >> >> >> >> >> >> {active,once}, >> >> >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> >> >> >> {ssl,false}, >> >> >> >> >> >> >> >> {reuseaddr,true}] >> >> >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> >> >> >> >> {ok,<0.115.0>, >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> (<0.115.0>) call >> >> >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> >> >> >> {packet,0}, >> >> >> >> {active,once}, >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> {ssl,false}, >> >> >> >> {reuseaddr,true}]) >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> {ok,<0.115.0>, >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> (<0.116.0>) call >> >> >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> >> 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 brisa.jimenez.f@REDACTED Wed Mar 27 22:59:01 2013 From: brisa.jimenez.f@REDACTED (=?ISO-8859-1?Q?Brisa_Jim=E9nez?=) Date: Wed, 27 Mar 2013 15:59:01 -0600 Subject: [erlang-questions] How to know if a module:function is called and do something when this happens? Message-ID: Hi everyone! How to know if a module:function is called and do something when this happens? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Mar 27 23:11:15 2013 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 27 Mar 2013 23:11:15 +0100 Subject: [erlang-questions] How to know if a module:function is called and do something when this happens? In-Reply-To: References: Message-ID: http://www.erlang.org/doc/man/dbg.html#id68005 http://www.erlang.org/doc/man/dbg.html#tracer-0 http://www.erlang.org/doc/man/dbg.html#p-1 http://www.erlang.org/doc/man/dbg.html#tp-3 On Wed, Mar 27, 2013 at 10:59 PM, Brisa Jim?nez wrote: > Hi everyone! > How to know if a module:function is called and do something when this > happens? > Thank you. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From john_re@REDACTED Thu Mar 28 00:26:00 2013 From: john_re@REDACTED (giovanni_re) Date: Wed, 27 Mar 2013 16:26:00 -0700 Subject: [erlang-questions] 2 Erlang articles @news.yc: 1) Armstrong - Right Problem. 2) Go vs Erlang Message-ID: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> Do you have something valuable to add to these discussions? --- Joe Armstrong: Solving the wrong problem (github.com) 111 points by geoffhill 4 hours ago | 47 comments https://news.ycombinator.com/item?id=5451202 konstruktor 2 hours ago | link > At this point in time, sequential programs started getting slower, year on year, and parallel programs started getting faster. The first part of this statement is plain wrong. Single thread performance has improved a lot due to better CPU architecture. Look at http://www.cpubenchmark.net/singleThread.html and compare CPUs with the same clock rate, where a 2.5 GHz. An April 2012 Intel Core i7-3770T scores 1971 points while a July 2008 Intel Core2 Duo T9400 scores 1005 points. This is almost double the score in less than four years. Of course, one factor is the larger cache that the quad core has, but this refutes Armstrong's point that the multicore age is bad for single thread performance even more. For exposure to a more balanced point of view, I would highly recommend Martin Thompson's blog mechanical-sympathy.blogspot.com. It is a good a starting point on how far single threaded programs can be pushed and where multi-threading can even be detrimental. Also, I think that fault tolerance is where Erlang really shines. More than a decade after OTP, projects like Akka and Hysterix are finally venturing in the right direction. === Concurrency Models: Go vs Erlang (joneisen.me) 46 points by geoka9 2 hours ago | 13 comments https://news.ycombinator.com/item?id=5451651 jerf 2 hours ago | link Erlang's error checking model is a great deal more like Go's than he thinks. Erlang is in the "exceptions are exceptional" camp too, and idiomatic code should not be throwing exceptions around willy -nilly. Go is noticably more fragile with errors. Unhandled exceptions (which are just a fact of life unless you're a perfect programmer) will result in the entire program terminating if you don't have something that handles it. This behavior is forced on it precisely because of the shared memory model (one of the actual big differences); if one goroutine has f'ed up, you simply don't know what the state of your program is anymore. (Theoretically you could do better than that, but not simply.) Since Erlang memory is isolated, it can kill just that one process, and the other processes can pick up the pieces. (Not necessarily perfectly or without loss, but in practice, really quite well.) Consequently, for any serious Go program, you're still going to have to choose an exception handling policy, it's not as if it has gotten away from exceptions. Failures are a fact of life... for all you know, memory was corrupted. Again, the difference here is not "error handling policy" but the longer term consequences of shared vs. isolated memory spaces. If you just type up idiomatic Erlang OTP code, you have to go out of your way to not have a bulletproof server; if you just type up idiomatic Go code it's on you to make sure you're not excessively sharing state and that you aren't going to see your entire server doing tens of thousands of things come down due to one unhandled exception. Go programmers need to be more worried about error handling in practice than Erlang programmers, since Erlang programmers aren't facing the termination of the entire world if they screw up one thing. There's also a recurring pattern in newer language advocates in which they will in one year claim it's a good thing that they don't have X, and next year tout to the high heavens how wonderful it is that they just implemented X. I went around with the Haskell world on a couple of those issues ("no, strings are not linked lists of numbers", "yes they are you're just not thinking functionally and inductively dude, and by the way, six months later, check out this totally radical ByteString library, and when that still turns out not to be stringy enough hey, check out Data.Text six months later..."). Thinking you can get away without OTP is likely to be one of those for Go. No. You need it, though I have questions about whether it can even be built in Go, because one of the other actual differences between the languages... ... which is Channels vs. Processes. Go has channels, but you can't tell who or what has them, and there's no such thing as a "goroutine reference". By contrast, Erlang has processes, but no way to tell what messages they may send or receive, and there's no such thing as a "channel". Again, this has major impacts on how the system is structured, in particular because it is meaningful to talk about how to restart a "process" in a way that it is not meaningful to talk about how to restart a "channel". Go advocates desperately, desperately need to avoid the temptation to explain to themselves why Erlang isn't as good, because then they'll fail to learn the lessons that Erlang learned the easy way. There's a lot of ways to improve on Erlang, but let me tell you that despite those opportunities, Erlang as a language is one of the wisest languages around, you do not want to try to exceed it by starting from scratch. Learn from it, please , I want a better Erlang than Erlang, but talking yourself into how Go is already better than Erlang isn't going to get you there. From norton@REDACTED Thu Mar 28 02:08:45 2013 From: norton@REDACTED (=?utf-8?B?44OO44O844OI44OzIOOCuOODp+ODvOOCu+ODlSDjgqbjgqfjgqQg?= =?utf-8?B?44Oz?=) Date: Thu, 28 Mar 2013 10:08:45 +0900 Subject: [erlang-questions] [ANN] UBF - Universal Binary Format 2.1 Message-ID: UBF unknown to most people as ABF! (Awesome Binary Format!) is a framework that permits Erlang and the outside world to talk with each other. The documentation and the corresponding open-source code repositories are based on Joe Armstrong's original UBF site and code with an MIT license file added to the distribution. Since then, a large number of enhancements and improvements have been added. What's New in UBF 2.1? - Added support for R16B. Removed support for R13B04. - Fixed issue with UBF listener's shutdown sequence. - Improved layout and presentation of the UBF User's Guide. For further information and instructions to download, please see the https://github.com/ubf/ubf repository on GitHub. For detailed documentation, please see the http://ubf.github.com/ubf/ubf-user-guide.en.html documentation on GitHub. For a new hello world example, please see the https://github.com/ubf/hello-world repository on GitHub. Best regards, Joe N. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Mar 28 08:33:50 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 28 Mar 2013 08:33:50 +0100 Subject: [erlang-questions] TrapExit again and again!!! Message-ID: Guys seriously, can the responsible fix this: http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line We're all claiming Erlang is powerful and blablabla, and TrapExit looks like a shit. Even if its a PHP forum, it must be fixed. Not the first time TrapExit's down. Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From cloudzen@REDACTED Thu Mar 28 08:43:16 2013 From: cloudzen@REDACTED (skyman) Date: Thu, 28 Mar 2013 15:43:16 +0800 (CST) Subject: [erlang-questions] Latency when using the active_once option in gen_tcp communication is reduced in R15B02. What is the details? Message-ID: <197d42b0.1611d.13daff3652a.Coremail.cloudzen@163.com> Hi everybody, I find this in the R15B02 readme(http://www.erlang.org/download/otp_src_R15B02.readme): OTP-10055 Latency when using the active_once option in gen_tcp communication is reduced. I'd know the details about this, can the man in the OTP team or other man explain this? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yueyoum@REDACTED Thu Mar 28 09:16:34 2013 From: yueyoum@REDACTED (=?UTF-8?B?5pyI5b+n6IyX?=) Date: Thu, 28 Mar 2013 16:16:34 +0800 Subject: [erlang-questions] gen_tcp recv web content Message-ID: Hi, I'm learning Erlang, And I have some code, to get web site content. http://pastebin.com/BDeUuymX in erlang shell: c(test). test:start("www.yahoo.com", 80). I MUST waiting for the remote website close the socket, after that, I got {tcp_closed, Socket} msg, then finish the loop. But, Waiting for remote close socket was takes a 'long' time, Is there any way to know, i have already get the whole data, and close the socket by myself? using Content-Length? How? another question: test:start("github.com", 443). when play with such this 'https' sites, the code can not working. It seems like being blocked. can not receive the data, and finally closed by remote sites. Thanks. -- My GitHub https://github.com/yueyoum My Blog http://codeshift.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Mar 28 09:21:37 2013 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 28 Mar 2013 09:21:37 +0100 Subject: [erlang-questions] Latency when using the active_once option in gen_tcp communication is reduced in R15B02. What is the details? In-Reply-To: <197d42b0.1611d.13daff3652a.Coremail.cloudzen@163.com> References: <197d42b0.1611d.13daff3652a.Coremail.cloudzen@163.com> Message-ID: The code change is this: https://github.com/erlang/otp/commit/689ba6e5657867eb3efbcb9a2dbec4aa98ddac5d Essentially it does a read to check if there is any data available right away and if there is none does a driver_select. Before the change it always went directly to driver_select. Lukas On Thu, Mar 28, 2013 at 8:43 AM, skyman wrote: > Hi everybody, > I find this in the R15B02 readme( > http://www.erlang.org/download/otp_src_R15B02.readme): > > OTP-10055 Latency when using the active_once option in gen_tcp > > communication is reduced. > > I'd know the details about this, can the man in the OTP team or other man explain 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 diana.corbacho@REDACTED Thu Mar 28 11:24:54 2013 From: diana.corbacho@REDACTED (Diana Corbacho) Date: Thu, 28 Mar 2013 10:24:54 +0000 (GMT) Subject: [erlang-questions] TrapExit again and again!!! In-Reply-To: Message-ID: <708226852.28437831.1364466294934.JavaMail.root@erlang-solutions.com> Hi Zabrane, The content of TrapExit is being migrated to erlangcentral.org, the new community website. It will be available very soon. Regards, Diana ----- Original Message ----- From: "Zabrane Mickael" To: "Erlang-Questions Questions" Sent: Thursday, March 28, 2013 7:33:50 AM Subject: [erlang-questions] TrapExit again and again!!! Guys seriously, can the responsible fix this: http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line We're all claiming Erlang is powerful and blablabla, and TrapExit looks like a shit. Even if its a PHP forum, it must be fixed. Not the first time TrapExit's down. Regards, Zabrane _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From chandrashekhar.mullaparthi@REDACTED Thu Mar 28 11:35:14 2013 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 28 Mar 2013 10:35:14 +0000 Subject: [erlang-questions] gen_tcp recv web content In-Reply-To: References: Message-ID: Change HTTP/1.1 to HTTP/1.0. The server will then close the connection when it has sent all the data. On 28 March 2013 08:16, ??? wrote: > > Hi, > > I'm learning Erlang, And I have some code, to get web site content. > > http://pastebin.com/BDeUuymX > > > in erlang shell: > > > c(test). > test:start("www.yahoo.com", 80). > > I MUST waiting for the remote website close the socket, > after that, I got {tcp_closed, Socket} msg, > then finish the loop. > > But, Waiting for remote close socket was takes a 'long' time, > > Is there any way to know, i have already get the whole data, and close the > socket by myself? > > > using Content-Length? How? > > > another question: > > test:start("github.com", 443). > > when play with such this 'https' sites, the code can not working. > It seems like being blocked. can not receive the data, and finally closed > by remote sites. > > > Thanks. > > > > > > > > > > > > -- > My GitHub > https://github.com/yueyoum > > My Blog > http://codeshift.org > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Thu Mar 28 12:01:57 2013 From: pan@REDACTED (Patrik Nyblom) Date: Thu, 28 Mar 2013 12:01:57 +0100 Subject: [erlang-questions] Port is included in erlang:ports(), but erlang:port_info(Port) returnes 'undefined' In-Reply-To: <7cefc809.103ee.13d834b9756.Coremail.cloudzen@163.com> References: <7cefc809.103ee.13d834b9756.Coremail.cloudzen@163.com> Message-ID: <51542325.7020105@erlang.org> Hi! Sure looks like a bug to me... Thanks for finding it! Could you repost on erlang-bugs? (You need to register for that list as well...) Cheers, /Patrik On 03/19/2013 04:36 PM, skyman wrote: > Hi everyone, > I encounter a problem: > While server socket is sending packets, client socket closes, then I > find the socket's send_pend( inet:getstat(Socket, [send_pend]) ) is > always > 0, that is some data isn't sent out. After closing the port, > I find the port is still included in erlang:ports(), but > erlang:port_info(Port) returnes 'undefined'. I guess that because the > port's send queue is not empty, the erts set the port's status to > be ERTS_PORT_SFLG_CLOSING, so th e results between erlang:ports() and > erlang:port_info() are inconsistent. The code: > > void erts_do_exit_port(Port *p, Eterm from, Eterm reason) > { > ... > if ((reason != am_kill) && !is_port_ioq_empty(p)) { > erts_port_status_bandor_set(p, > ~ERTS_PORT_SFLG_EXITING, /* must turn it off */ > ERTS_PORT_SFLG_CLOSING); > flush_port(p); > } > ... > } > > The problem can only exist with TCP option: {delay_send, true}. When > set {delay_send, false}, the problem disappears. > > In addition, on this occasion erlang:halt() cannot terminate the node, > have to use erlang:halt(Status, [{flush,false}]). > > Can anyone help me? Thanks in advance! > > > > > > _______________________________________________ > 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 Mar 28 12:26:44 2013 From: erlangsiri@REDACTED (Siri Hansen) Date: Thu, 28 Mar 2013 12:26:44 +0100 Subject: [erlang-questions] cover.erl issues In-Reply-To: <6da53a548a5a67924bac3532b1a4af68@bosqueviejo.net> References: <21219b2d675825f3ea9f86effd23f823@bosqueviejo.net> <0330b7f9f73f496faba09bec6ffb755b@bosqueviejo.net> <6da53a548a5a67924bac3532b1a4af68@bosqueviejo.net> Message-ID: 2013/3/26 Manuel A. Rubio "Bombadil" > Hi Sri, > > El 2013-03-26 16:53, Siri Hansen escribi?: > > This is a bug in cover. To confirm it you could call ets:delete(Table) >> for each ets table just before >> >> unregister(?SERVER) >> >> in cover:main_process_loop/1. >> > > I use covertool[1] for export tests to jenkins and did a fork and add it > cover.erl[2] modified to overload the original code with the workaround: > > line 561: > ------------------------------**------------------------------** > ---------------- > init_main(Starter) -> > %% Having write concurrancy here gives a 40% performance boost > %% when collect/1 is called. > case ets:info(?COVER_TABLE) of > undefined -> > register(?SERVER,self()), > ets:new(?COVER_TABLE, [set, public, named_table > ,{write_concurrency, true} > ]), > ets:new(?COVER_CLAUSE_TABLE, [set, public, named_table]), > ets:new(?BINARY_TABLE, [set, named_table]), > ets:new(?COLLECTION_TABLE, [set, public, named_table]), > ets:new(?COLLECTION_CLAUSE_**TABLE, [set, public, > named_table]), > process_flag(trap_exit,true), > Starter ! {?SERVER,started}, > main_process_loop(#main_state{**}); > _ -> > catch ets:delete(?COVER_TABLE), > catch ets:delete(?COVER_CLAUSE_**TABLE), > catch ets:delete(?BINARY_TABLE), > catch ets:delete(?COLLECTION_TABLE), > catch ets:delete(?COLLECTION_CLAUSE_**TABLE), > init_main(Starter) > end. > ------------------------------**------------------------------** > ---------------- > > It works well, but I supose I can move the ets:delete block to main_loop, > when call to stop. Yes, I think that would be cleaner. It would ensure that cover is completely stopped when cover:stop/0 returns. /siri > [1] https://github.com/**bosqueviejo/covertool/ > [2] https://github.com/**bosqueviejo/covertool/blob/**master/src/cover.erl > > Regards. > Manuel Rubio. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan@REDACTED Thu Mar 28 13:04:48 2013 From: stefan@REDACTED (Stefan Jahn) Date: Thu, 28 Mar 2013 13:04:48 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> Message-ID: <4f6727f775395e32810aeb661470a04d.squirrel@service.rules.org> Hello Ingela, after some experimentation I have an almost completed scpd server implementattion at hand. Some issues still remain: 1) for privileged ports for ssh:daemon() I suggest to have a callback to the ssh options to obtain listen() handle from e.g. fd_server. What do you think? 2) save path handling (resolve symlinks); I leave this out, because I've seen in sftpd implementation similar thing. Probably we should share functions across scpd and sftpd? 3) fine grained file permissions per user base: r/w for list of directories, I leave it out for now, because not necessery so far for my own purposes 4) ssh channel flushing/eof/close on the last transferred file in source mode of the scpd server. needs some more investigations... that why I wrote the "scp eow" topic on the list. 1) until 3) is not that big problem, but 4) need to be solved. After that I would be happy to contribute if you are interested... What do you think? BR, Stefan. On Tue, March 19, 2013 3:04 pm, Ingela Andin wrote: > Hello again, > > If you do a general scp client/server implementation you should > consider contributing it. > We would be interested. > > Regards Ingela Erlang/OTP team - Ericsson AB > > 2013/3/19, Ingela Andin : >> Hi! >> >> 2013/3/19, Stefan Jahn : >>> dear erlang'ers, >>> >>> after reading some documentation on ssh otp system I ended up with: >>> >>> ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, >>> %% create server keys: >>> %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa >>> %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa >>> {system_dir, "/tmp/ssh"}, >>> {user_dir, "/tmp/ssh"}, >>> % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, >>> {auth_methods, "keyboard-interactive,password"}, >>> {subsystems, [ >>> ssh_scpd:subsystem_spec([]) >>> % ssh_sftpd:subsystem_spec([{vsn, 3}]) >>> ]}]). >>> >>> whereas the ssh_scpd module is base on the ssh_sftpd module from otp, >>> i.e. >>> >>> -module(ssh_scpd). >>> %-behaviour(ssh_daemon_channel). >>> -behaviour(ssh_channel). >>> >>> -define(UINT32(X), X:32/unsigned-big-integer). >>> >>> %% External exports >>> -export([subsystem_spec/1]). >>> >>> %% Callbacks >>> -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, >>> code_change/3]). >>> >>> implementing the callbacks similar to what we have in ssh_sftpd... >>> >>> now, when I start >>> >>> $ scp -P 45678 README ssh@REDACTED:README >>> >>> authentification works fine as implemented in auth/2, but somehow >>> the ssh channel behaviour is not used at all. >>> >>> ssh@REDACTED's password: >>> {error,{1,erl_parse,["syntax error before: ",[]]}} >>> $ Received disconnect from 127.0.0.1: 11: Application shutdown >>> >>> It seems like scp commands are send into the standard erlang shell >>> (which >>> I did not specify) and not into the channel. >>> >>> I am using R15B2. >>> >>> Could please someone help out here and give me some hint where to >>> proceed reading? >>> >>> Also an abstract description of the difference between the purposes of >>> ssh_cli and subsystems options would be appriciated. >> >> ssh_cli is to customize the shell I do not think you want to use >> ssh_cli at all. You should write your scp-deamon as subsystem and then >> use an existing scp client to connect to it or >> write your own erlang client that opens an ssh connection, requests >> the ssh-scp subsystem and then sends scp commands on the channel along >> the lines; >> >> ssh:connect ... >> ssh_connection:session_channel... >> ssh_connection:subsystem... >> ssh_connection:send... >> >> The client can use the ssh_channel behavior. >> >> Regards Ingela Erlang/OTP team Ericsson AB >> > From attila.r.nohl@REDACTED Thu Mar 28 13:25:53 2013 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 28 Mar 2013 13:25:53 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: <4f6727f775395e32810aeb661470a04d.squirrel@service.rules.org> References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f6727f775395e32810aeb661470a04d.squirrel@service.rules.org> Message-ID: Hello! There is already an {fd, FD} option in ssh:daemon, so bind first, then pass the file descriptor. 2013/3/28 Stefan Jahn : > Hello Ingela, > > after some experimentation I have an almost completed scpd server > implementattion at hand. > > Some issues still remain: > > 1) for privileged ports for ssh:daemon() I suggest to have a callback > to the ssh options to obtain listen() handle from e.g. fd_server. > What do you think? > > 2) save path handling (resolve symlinks); I leave this out, because > I've seen in sftpd implementation similar thing. Probably we should > share functions across scpd and sftpd? > > 3) fine grained file permissions per user base: r/w for list of > directories, I leave it out for now, because not necessery so far > for my own purposes > > 4) ssh channel flushing/eof/close on the last transferred file in > source mode of the scpd server. needs some more investigations... > that why I wrote the "scp eow" topic on the list. > > 1) until 3) is not that big problem, but 4) need to be solved. After > that I would be happy to contribute if you are interested... > > What do you think? > > BR, Stefan. > > On Tue, March 19, 2013 3:04 pm, Ingela Andin wrote: >> Hello again, >> >> If you do a general scp client/server implementation you should >> consider contributing it. >> We would be interested. >> >> Regards Ingela Erlang/OTP team - Ericsson AB >> >> 2013/3/19, Ingela Andin : >>> Hi! >>> >>> 2013/3/19, Stefan Jahn : >>>> dear erlang'ers, >>>> >>>> after reading some documentation on ssh otp system I ended up with: >>>> >>>> ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, >>>> %% create server keys: >>>> %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa >>>> %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa >>>> {system_dir, "/tmp/ssh"}, >>>> {user_dir, "/tmp/ssh"}, >>>> % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, >>>> {auth_methods, "keyboard-interactive,password"}, >>>> {subsystems, [ >>>> ssh_scpd:subsystem_spec([]) >>>> % ssh_sftpd:subsystem_spec([{vsn, 3}]) >>>> ]}]). >>>> >>>> whereas the ssh_scpd module is base on the ssh_sftpd module from otp, >>>> i.e. >>>> >>>> -module(ssh_scpd). >>>> %-behaviour(ssh_daemon_channel). >>>> -behaviour(ssh_channel). >>>> >>>> -define(UINT32(X), X:32/unsigned-big-integer). >>>> >>>> %% External exports >>>> -export([subsystem_spec/1]). >>>> >>>> %% Callbacks >>>> -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, >>>> code_change/3]). >>>> >>>> implementing the callbacks similar to what we have in ssh_sftpd... >>>> >>>> now, when I start >>>> >>>> $ scp -P 45678 README ssh@REDACTED:README >>>> >>>> authentification works fine as implemented in auth/2, but somehow >>>> the ssh channel behaviour is not used at all. >>>> >>>> ssh@REDACTED's password: >>>> {error,{1,erl_parse,["syntax error before: ",[]]}} >>>> $ Received disconnect from 127.0.0.1: 11: Application shutdown >>>> >>>> It seems like scp commands are send into the standard erlang shell >>>> (which >>>> I did not specify) and not into the channel. >>>> >>>> I am using R15B2. >>>> >>>> Could please someone help out here and give me some hint where to >>>> proceed reading? >>>> >>>> Also an abstract description of the difference between the purposes of >>>> ssh_cli and subsystems options would be appriciated. >>> >>> ssh_cli is to customize the shell I do not think you want to use >>> ssh_cli at all. You should write your scp-deamon as subsystem and then >>> use an existing scp client to connect to it or >>> write your own erlang client that opens an ssh connection, requests >>> the ssh-scp subsystem and then sends scp commands on the channel along >>> the lines; >>> >>> ssh:connect ... >>> ssh_connection:session_channel... >>> ssh_connection:subsystem... >>> ssh_connection:send... >>> >>> The client can use the ssh_channel behavior. >>> >>> Regards Ingela Erlang/OTP team Ericsson AB >>> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From toby@REDACTED Thu Mar 28 13:35:57 2013 From: toby@REDACTED (Toby Thain) Date: Thu, 28 Mar 2013 08:35:57 -0400 Subject: [erlang-questions] Maturity, models matter - Re: Go vs Erlang In-Reply-To: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> References: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> Message-ID: <5154392D.5080805@telegraphics.com.au> On 27/03/13 7:26 PM, giovanni_re wrote: > ... > There's also a recurring pattern in newer language advocates in which > they will in one year claim it's a good thing that they don't have X, > and next year tout to the high heavens how wonderful it is that they > just implemented X. ... The poster children for this cycle would be lambdas (coming soon in Java 8? Maybe?) and garbage collection... But maturity turns out to be not only important but quantifiable; and immature/wonky closures and garbage collection (Python, Ruby, PHP, etc) are not worth dealing with when we have mature choices. Go might shake down in 5 or 10 years into a robust platform (for what, is not clear), but even then the programmer model can still be questioned. It's not like the world needed "another C". --Toby > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Thu Mar 28 14:01:28 2013 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 28 Mar 2013 13:01:28 +0000 Subject: [erlang-questions] Maturity, models matter - Re: Go vs Erlang In-Reply-To: <5154392D.5080805@telegraphics.com.au> References: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> <5154392D.5080805@telegraphics.com.au> Message-ID: <64A0DA82-CBED-4CDB-8B93-226C7BF42365@gmail.com> On 28 Mar 2013, at 12:35, Toby Thain wrote: > > Go might shake down in 5 or 10 years into a robust platform (for what, is not clear), but even then the programmer model can still be questioned. It's not like the world needed "another C". > Indeed. I also found the Damian Katz blog post referenced in an earlier post rather interesting, because writing a bunch of C and a bunch of Erlang that go together is - AFAICT - the canonical way to do things (e.g., AXD, ejabberd, Riak, etc) and I know nobody who loves Erlang to be bashing C. Personally I'd rather reach for a library to facilitate 'difficult things' (memory management/gc, atomic opts, concurrency support) in C rather than trying to pick another language that wants to be C. And there's a reason why we write our emulators/vms/containers/etc in C - i.e., beam, the JVM, the CLR, V8 and so on, are all written in C/C++. So to me, reaching for C when I need to do a fast external call (using a NIF/BIF) or integrate with something long(er) running (or threaded) using a driver seems like the most natural thing to do. And our FFI is very mature and robust - though it'll be a lot more pleasant to work with once 'native processes' appear - so there's no need to worry about competing with systems programming tools like C (or go, I suppose) because you can just reach out and *use* C whenever you like. High level concurrency primitives and declarative programming where you need it and fast, low-latency, highly efficient C when you need that. Cheers, Tim From zabrane3@REDACTED Thu Mar 28 14:18:22 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 28 Mar 2013 14:18:22 +0100 Subject: [erlang-questions] TrapExit again and again!!! In-Reply-To: <708226852.28437831.1364466294934.JavaMail.root@erlang-solutions.com> References: <708226852.28437831.1364466294934.JavaMail.root@erlang-solutions.com> Message-ID: <1B39C7D3-6F0F-4F94-862A-7B0A495B0DFA@gmail.com> Hey Diana, Thanks for handling that. Please ping us when TrapExit will be up. Regards, Zabrane On Mar 28, 2013, at 11:24 AM, Diana Corbacho wrote: > Hi Zabrane, > > The content of TrapExit is being migrated to erlangcentral.org, the new community website. > It will be available very soon. > > Regards, > Diana > > ----- Original Message ----- > From: "Zabrane Mickael" > To: "Erlang-Questions Questions" > Sent: Thursday, March 28, 2013 7:33:50 AM > Subject: [erlang-questions] TrapExit again and again!!! > > > > Guys seriously, can the responsible fix this: > http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line > > > We're all claiming Erlang is powerful and blablabla, and TrapExit looks like a shit. > Even if its a PHP forum, it must be fixed. > > > Not the first time TrapExit's down. > > 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 pierrefenoll@REDACTED Thu Mar 28 14:36:16 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Thu, 28 Mar 2013 14:36:16 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 Message-ID: Hi, As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> [term()]. However, a = lists:append([], a). Shouldn't it return [a]? -- Regards, Pierre Fenoll -------------- next part -------------- An HTML attachment was scrubbed... URL: From hq@REDACTED Thu Mar 28 14:42:35 2013 From: hq@REDACTED (Adam Rutkowski) Date: Thu, 28 Mar 2013 14:42:35 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: Message-ID: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> On 28 Mar 2013, at 14:36, Pierre Fenoll wrote: > As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> [term()]. > > However, a = lists:append([], a). If the spec was ([term()], term()) then maybe ;-) Also, the documentation (and implementation as well) clearly states it's equivalent to A ++ B. A. From k.petrauskas@REDACTED Thu Mar 28 14:50:19 2013 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Thu, 28 Mar 2013 15:50:19 +0200 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: Indeed, what does the 2'nd line mean? 1: 16> [a, b] ++ c. 2: [a,b|c] 3: 17> c ++ [a, b]. 4: ** exception error: bad argument 5: in operator ++/2 6: called as c ++ [a,b] Karolis On Thu, Mar 28, 2013 at 3:42 PM, Adam Rutkowski wrote: > > On 28 Mar 2013, at 14:36, Pierre Fenoll wrote: > >> As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> [term()]. >> >> However, a = lists:append([], a). > > If the spec was ([term()], term()) then maybe ;-) > Also, the documentation (and implementation as well) clearly states it's equivalent to A ++ B. > > A. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From kostis@REDACTED Thu Mar 28 14:55:03 2013 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 28 Mar 2013 15:55:03 +0200 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: Message-ID: <51544BB7.7000303@cs.ntua.gr> On 03/28/2013 03:36 PM, Pierre Fenoll wrote: > Hi, > > As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> > [term()]. > > However, a = lists:append([], a). > > Shouldn't it return [a]? You are reading specs (and the documentation) in the wrong direction. In library code, the spec for a function tells you two things: - you are supposed to call a function with terms of the given types in the arguments, and - if you issue such a call with the "expected" types, you can also expect that the type of the return value of the function is the one mentioned in the spec. The spec says nothing about what happens when you issue a call with the "unexpected" arguments (as in your example). In most cases you will get a bad match exception, but the implementation of the function may be more lenient than its published specification. Kostis From pierrefenoll@REDACTED Thu Mar 28 14:53:00 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Thu, 28 Mar 2013 14:53:00 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: The spec says both arguments and the result are lists. Indeed there is a contradiction with said spec. Isn't that a problem? On 28 March 2013 14:42, Adam Rutkowski wrote: > > On 28 Mar 2013, at 14:36, Pierre Fenoll wrote: > > > As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> > [term()]. > > > > However, a = lists:append([], a). > > If the spec was ([term()], term()) then maybe ;-) > Also, the documentation (and implementation as well) clearly states it's > equivalent to A ++ B. > > A. -------------- next part -------------- An HTML attachment was scrubbed... URL: From diana.corbacho@REDACTED Thu Mar 28 14:54:10 2013 From: diana.corbacho@REDACTED (Diana Corbacho) Date: Thu, 28 Mar 2013 13:54:10 +0000 (GMT) Subject: [erlang-questions] TrapExit again and again!!! In-Reply-To: <1B39C7D3-6F0F-4F94-862A-7B0A495B0DFA@gmail.com> Message-ID: <1237709725.28760180.1364478850677.JavaMail.root@erlang-solutions.com> Hi, TrapExit is up again. It will be available until the content is migrated, but we can expect some issues in between. Regards, Diana ----- Original Message ----- From: "Zabrane Mickael" To: "Diana Corbacho" Cc: "Erlang-Questions Questions" Sent: Thursday, March 28, 2013 1:18:22 PM Subject: Re: [erlang-questions] TrapExit again and again!!! Hey Diana, Thanks for handling that. Please ping us when TrapExit will be up. Regards, Zabrane On Mar 28, 2013, at 11:24 AM, Diana Corbacho wrote: Hi Zabrane, The content of TrapExit is being migrated to erlangcentral.org , the new community website. It will be available very soon. Regards, Diana ----- Original Message ----- From: "Zabrane Mickael" < zabrane3@REDACTED > To: "Erlang-Questions Questions" < erlang-questions@REDACTED > Sent: Thursday, March 28, 2013 7:33:50 AM Subject: [erlang-questions] TrapExit again and again!!! Guys seriously, can the responsible fix this: http://www.trapexit.org/Running_Erlang_Code_From_The_Command_Line We're all claiming Erlang is powerful and blablabla, and TrapExit looks like a shit. Even if its a PHP forum, it must be fixed. Not the first time TrapExit's down. Regards, Zabrane _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Thu Mar 28 14:59:18 2013 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 28 Mar 2013 14:59:18 +0100 Subject: [erlang-questions] TrapExit again and again!!! In-Reply-To: <1237709725.28760180.1364478850677.JavaMail.root@erlang-solutions.com> References: <1237709725.28760180.1364478850677.JavaMail.root@erlang-solutions.com> Message-ID: Great Diana. Regards, Zabrane On Mar 28, 2013, at 2:54 PM, Diana Corbacho wrote: > Hi, > > TrapExit is up again. > It will be available until the content is migrated, but we can expect some issues in between. > > Regards, > Diana > > ----- Original Message ----- > From: "Zabrane Mickael" > To: "Diana Corbacho" > Cc: "Erlang-Questions Questions" > Sent: Thursday, March 28, 2013 1:18:22 PM > Subject: Re: [erlang-questions] TrapExit again and again!!! > > Hey Diana, > > > Thanks for handling that. > Please ping us when TrapExit will be up. > > > > Regards, > Zabrane > > > > > > On Mar 28, 2013, at 11:24 AM, Diana Corbacho wrote: > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From masklinn@REDACTED Thu Mar 28 15:06:46 2013 From: masklinn@REDACTED (Masklinn) Date: Thu, 28 Mar 2013 15:06:46 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: On 2013-03-28, at 14:50 , Karolis Petrauskas wrote: > Indeed, what does the 2'nd line mean? > > 1: 16> [a, b] ++ c. > 2: [a,b|c] > 3: 17> c ++ [a, b]. > 4: ** exception error: bad argument > 5: in operator ++/2 > 6: called as c ++ [a,b] That it's an "improper list" (also known as "dotted pairs" in lisps): lists are sequences of (head, tail) pairs where "tail" is a pointer to the next pair, and in a proper list the final tail is always a "null". Here the "tail" is a pointer to a symbol, which creates an improper list. Many functions will blow up when given this, because they won't handle the terminal case of a non-list. From masklinn@REDACTED Thu Mar 28 15:07:49 2013 From: masklinn@REDACTED (Masklinn) Date: Thu, 28 Mar 2013 15:07:49 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: On 2013-03-28, at 14:53 , Pierre Fenoll wrote: > The spec says both arguments and the result are lists. > Indeed there is a contradiction with said spec. Isn't that a problem? It's not a contradiction, as kostis noted specs are not complete enumerations of all possible argument types. From pierrefenoll@REDACTED Thu Mar 28 15:12:08 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Thu, 28 Mar 2013 15:12:08 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: > It's not a contradiction, as kostis noted specs are not complete > enumerations of all possible argument types. Well, lists:append/2 asks for a list() as a second argument. Shouldn't it badarg when I give it 'a', as in lists:append([], a) ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From masklinn@REDACTED Thu Mar 28 15:33:07 2013 From: masklinn@REDACTED (Masklinn) Date: Thu, 28 Mar 2013 15:33:07 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: <223D01CB-2B85-4466-85AB-DC26D17A4FA1@masklinn.net> On 2013-03-28, at 15:12 , Pierre Fenoll wrote: >> It's not a contradiction, as kostis noted specs are not complete >> enumerations of all possible argument types. > > Well, lists:append/2 asks for a list() as a second argument. No, lists:append defines what happens with a list() as a second argument, specs often aren't prescriptive. > Shouldn't > it badarg when I give it 'a', as in lists:append([], a) ? Should it? Creating improper lists is not forbidden. From norton@REDACTED Thu Mar 28 15:38:44 2013 From: norton@REDACTED (Joseph Wayne Norton) Date: Thu, 28 Mar 2013 23:38:44 +0900 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: Pierre - Just in case ... have you tried running Dialyzer on your program? If so, what does Dialyzer report? regards, Joe N. On Mar 28, 2013, at 11:12 PM, Pierre Fenoll wrote: > > It's not a contradiction, as kostis noted specs are not complete > > enumerations of all possible argument types. > > Well, lists:append/2 asks for a list() as a second argument. Shouldn't > it badarg when I give it 'a', as in lists:append([], a) ? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From pierrefenoll@REDACTED Thu Mar 28 16:04:31 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Thu, 28 Mar 2013 16:04:31 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: Dialyzer says it passed successfully. On 28 March 2013 15:38, Joseph Wayne Norton wrote: > > Pierre - > > Just in case ... have you tried running Dialyzer on your program? If so, > what does Dialyzer report? > > regards, > > Joe N. > > On Mar 28, 2013, at 11:12 PM, Pierre Fenoll > wrote: > > > > It's not a contradiction, as kostis noted specs are not complete > > > enumerations of all possible argument types. > > > > Well, lists:append/2 asks for a list() as a second argument. Shouldn't > > it badarg when I give it 'a', as in lists:append([], a) ? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.james.barry@REDACTED Thu Mar 28 17:50:23 2013 From: paul.james.barry@REDACTED (Paul Barry) Date: Thu, 28 Mar 2013 16:50:23 +0000 Subject: [erlang-questions] Erlang4android issue on Nexus In-Reply-To: <514F4C54.40005@ernovation.com> References: <514F4C54.40005@ernovation.com> Message-ID: Hi Erik. Thanks for your reply. When I try to run the Erlang shell from the sl4a menu, I get the same error: Erlang/OTP exited. I downloaded a file manager to take a look around the filesystem.... The com.ernovation.erlangforandroid folder does not live in /data/data/, but in /storage/emulated/11/, and it contains only a single file: the ZIP of the Erlang download. This is in spite of the installer telling me that the downloaded file was extracted. When I manually unzip it, it makes no difference... I get the same error message. Also I can't manually run "erl" as the exec-bit is not set. :-( Not sure what to try next, but I really don't want to root this thing (my kids would kill me for wiping their data). Any suggestions? Paul. -- Paul Barry Lecturer, IT Carlow, Ireland paul.barry@REDACTED - http://paulbarry.itcarlow.ie On 24 Mar 2013 18:56, "Erik Reitsma" wrote: > Hi Paul, > > E4A does not require you to root the device. I use it on a non-rooted > device myself, but not on a Nexus. > Have you tried starting an interactive Erlang shell from SL4A? E4A is not > intended to be started from outside SL4A, however, you can start E4A from > the shell: > > /data/data/com.ernovation.erlangforandroid/files/erlang/bin/erl > > If you start E4A like that, you cannot use the SL4A APIs. > > *Erik. > > On 03/23/2013 02:46 PM, Paul Barry wrote: > > Thanks, John. I recall reading somewhere that E4A doesn't require me to > root the device.... But, your email has given me hope as well as a few > pointers to explore. > > Paul. > On Mar 23, 2013 1:09 PM, "John Kemp" wrote: > >> Hi Paul, >> >> I am running Erlang4Android on a Nexus 7, and it works fine. I followed >> exactly the instructions for installing on the device. Are you running E4A >> from a BusyBox or over ADB shell? Have you 'rooted' the Nexus 7? E4A >> doesn't require that AFAIK, but it might make a difference (BusyBox install >> did require it). >> >> JohnK >> >> On Mar 23, 2013, at 4:06 AM, Paul Barry wrote: >> >> > Hi all. >> > >> > I've been playing with one of the new Nexus 7" tablets and I have sl4a >> installed and running fine (with Python). However, when I install the >> Erlang4android stuff from code.google.com, I get an "exited" console >> message whenever I try to run anything (e.g., client.erl from the example). >> > >> > I can see from other messages on this list that others have got this >> working on other devices... But has anybody tried it on a Nexus, and if you >> did, how did you get on? >> > >> > Thanks, >> > >> > Paul. >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > 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 olivier.boudeville@REDACTED Thu Mar 28 18:09:42 2013 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 28 Mar 2013 18:09:42 +0100 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes In-Reply-To: Message-ID: Hi, I tried the two most obvious solutions (respectively: file:read_file/1 followed by gen_tcp:send/2, and file:sendfile/2), of course both work but the second is not only faster but able to cope with larger files (whereas the first approach would have needed a more complex sending by chunks, lest it fails with enomem - i.e. not enough memory). So I will stick with as many file:sendfile/2 concurrent calls as needed on the same file, this should be sufficient for my use case. Cheers, 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 vances@REDACTED 27/03/2013 17:54 A olivier.boudeville@REDACTED cc erlang-questions@REDACTED Objet Re: [erlang-questions] Sending a large Erlang content to a set of remote nodes I have a similar use case for which I am considering using IP multicasting and implementing a reliable layer on top. Basically broadcasting sends but buffering data until there's been time for negative acknowledgements. On Mar 27, 2013 10:18 PM, "Olivier BOUDEVILLE" wrote: Hi, I would have a potentially large number of Erlang terms to send to a set of remote VMs. Currently it is a matter of a few megabytes, but it could be up to a few gigabytes in the future; and the exact same content may have to be sent to typically a dozen of other nodes. I was searching for a solution that would be reliable/simple/efficient to do so (preferably in that order), knowing that these terms could be either be kept in the RAM of the sender or, maybe preferably (the size of the data being probably roughly on par with the local RAM), as a compressed file on disk. Currently I send a binary, compressed archive thanks to a basic Erlang message, but I think it is not a good practice (ex: maybe the kernel ticks are not sent "out of band" and their delaying by larger archives could trigger spurious time-outs). I imagine sendfile with enough async threads could be a good candidate, however I am unsure that the same content (either as a whole or by chunks) could be read once, yet be sent to multiple recipients. Any idea? Thanks in advance for any hint! 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 erlang@REDACTED Thu Mar 28 18:44:08 2013 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 28 Mar 2013 18:44:08 +0100 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes In-Reply-To: References: Message-ID: On Wed, Mar 27, 2013 at 5:48 PM, Olivier BOUDEVILLE < olivier.boudeville@REDACTED> wrote: > > Hi, > > I would have a potentially large number of Erlang terms to send to a set > of remote VMs. Currently it is a matter of a few megabytes, but it could be > up to a few gigabytes in the future; and the exact same content may have to > be sent to typically a dozen of other nodes. > How big is the set of remote VMs (how many dozens?) - Is the communication bandwidth between machines symmetric. Once two machines have got a copy they could *both* send the data to a third. Machine one sends the first half, machine two the second. Now three machines have a copy Now three machines can send a copy to a fourth, the first can send the first third, ... and so on. Lookup epidemic gossip protocols. This is a very nice exercise in parallel programming. Cheers /Joe > > I was searching for a solution that would be reliable/simple/efficient to > do so (preferably in that order), knowing that these terms could be either > be kept in the RAM of the sender or, maybe preferably (the size of the data > being probably roughly on par with the local RAM), as a compressed file on > disk. > > Currently I send a binary, compressed archive thanks to a basic Erlang > message, but I think it is not a good practice (ex: maybe the kernel ticks > are not sent "out of band" and their delaying by larger archives could > trigger spurious time-outs). I imagine sendfile with enough async threads > could be a good candidate, however I am unsure that the same content > (either as a whole or by chunks) could be read once, yet be sent to > multiple recipients. > > Any idea? > > Thanks in advance for any hint! > > 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Thu Mar 28 18:58:11 2013 From: bob@REDACTED (Bob Ippolito) Date: Thu, 28 Mar 2013 10:58:11 -0700 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes In-Reply-To: References: Message-ID: On Thu, Mar 28, 2013 at 10:44 AM, Joe Armstrong wrote: > > > On Wed, Mar 27, 2013 at 5:48 PM, Olivier BOUDEVILLE < > olivier.boudeville@REDACTED> wrote: > >> >> Hi, >> >> I would have a potentially large number of Erlang terms to send to a set >> of remote VMs. Currently it is a matter of a few megabytes, but it could be >> up to a few gigabytes in the future; and the exact same content may have to >> be sent to typically a dozen of other nodes. >> > > How big is the set of remote VMs (how many dozens?) - > Is the communication bandwidth between machines symmetric. > > Once two machines have got a copy they could *both* send the data to a > third. > Machine one sends the first half, machine two the second. Now three > machines have a copy > > Now three machines can send a copy to a fourth, the first can send the > first third, ... > and so on. > > Lookup epidemic gossip protocols. > > This is a very nice exercise in parallel programming. > You may even be able to repurpose etorrent for this kind of purpose, I'm sure it'd make it easier to put together a great prototype if nothing else. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangprogram@REDACTED Thu Mar 28 20:39:37 2013 From: erlangprogram@REDACTED (S X) Date: Thu, 28 Mar 2013 15:39:37 -0400 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: Hi, Anders, Just to assure your answer with wireshark, the external server closes the connection after receiving the initial CER with wrong OH and OR from the client. But the server should response with CEA saying wrong information as a common sense. Also, is the node format "nodename@REDACTED" is common to the diameter protocol and not just for the distributed erlang nodes? Thanks, Samuel On Wed, Mar 27, 2013 at 4:18 PM, Anders Svensson wrote: > Hi Samuel. > > On Wed, Mar 27, 2013 at 6:50 PM, S X wrote: > > Hi Anders & Rudolph, > > > > Thanks for your responses. > > > > "5000 sec reconnect_timer is on the long side." I guess I treated milli > as > > micro. :) > > > > Don't worry about the logging, as long as I can see something from the > > erlang debugger window (By the way, I feel that the debugger for Window > > version is better than the one for Ubuntu). And I understand that it is > kind > > of difficult to log everything from the diameter library. > > > > As Anders suggested, I checked on the peer side (the diameter server in > this > > case) and it seems timed out waiting for CER and disconnecting the > client. > > > > Also, I found that my wireshark wasn't set up properly to work with VPN > ( I > > am running it with a VPN environment) and that is properly why I didn't > see > > any packets going outside. > > > > At last, I made the communication work after changing Origin-Host and > > Origin-Realm on the diameter client side. And they can talk diameter now. > > But don't quite understand why those two options are important for the > > initial socket set-up? For the initial step, doesn't it just need server > IP > > and port information? Or maybe because the special implementation on this > > diameter server? Is this common to a diameter application? > > Origin-Host/Realm are only used to construct an outgoing capabilities > CER/CEA after the transport connection is established. Are you sure > the server wasn't receiving your client's CER and closing the > connection for some reason? Changing the values of Origin-Host/Realm > shouldn't make a difference unless the server cares. (Which is a bit > unusual. If anything it's IP addresses that servers seem to like to > reject connections from.) > > > The other question is about diameter node, in diameter_sync module: > > call(Name, Req, Max, Timeout) -> > > call(node(), Name, Req, Max, Timeout). > > > > By default, it is "nonode@REDACTED", is the node used just for > representing > > the erlang run time or for other purpose? How does the node information > is > > being used in diameter? > > nonode@REDACTED is the name of an Erlang node that isn't distributed. > That is, that doesn't register with epmd and doesn't talk to other > Erlang nodes using the Distribution Protocol. If you start a > distributed node (eg. erl -sname foo) then diameter can share > information about transport connections with diameter services running > on other nodes. This isn't documented (or working :) in R16B but it is > on the maint branch on github, on the way to R16B01. (Take a look at > the doc for the service_opt() share_peers in diameter(3).) > > /Anders, Erlang/OTP > > > > Many thanks! > > > > > > Samuel > > > > > > > > > > On Wed, Mar 27, 2013 at 5:47 AM, Anders Svensson > > wrote: > >> > >> Hi Samuel. > >> > >> > Thanks for your reply. As my understanding also, the erlang diameter > >> > should > >> > not care how the other peers are implemented, as long as the peers > >> > follow > >> > the diameter specifications. > >> > > >> > But the erlang diameter library provides limited error information and > >> > this > >> > makes it harder to analyse problems, especially for newbies. > >> > >> It's usually (it seems) problems with capabilities exchange that trips > >> people up, and you're right that these can be a bit difficult to to > >> detect: capabilities exchange will fail, the transport connection will > >> be broken, and that's that. I'm a bit hesitant of logging ordinary > >> (albeit failed) Diameter signaling but I'll see what I can do. > >> > >> > My set-up is: > >> > > >> > - Client (192.168.193.58) runs from an erlang run time in a virtual > >> > machine. > >> > Just made some little changes based on the sample code: > >> > > >> > > ********************************************************************************************************************** > >> > -define(SVC_NAME, ?MODULE). > >> > -define(APP_RAR_ALIAS, rara). > >> > -define(APP_CCR_ALIAS, ccra). > >> > -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). > >> > -define(DIAMETER_APP_ID_CCRA, 16777238). > >> > -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). > >> > > >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, > >> > {'Origin-Realm', "example.com"}, > >> > {'Vendor-Id', 193}, > >> > {'Product-Name', "Client"}, > >> > {'Auth-Application-Id', > >> > [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, > >> > {application, [{alias, ?APP_RAR_ALIAS}, > >> > {dictionary, > >> > ?DIAMETER_DICT_COMMON_NEW}, > >> > {module, client_cb}]}, > >> > {application, [{alias, ?APP_CCR_ALIAS}, > >> > {dictionary, > >> > ?DIAMETER_DICT_CCRA}, > >> > {module, client_cb_ccra}]}]). > >> > > >> > connect(Name, T) -> > >> > diameter:add_transport(Name, {connect, [{reconnect_timer, > 5000000}, > >> > {capx_timeout, 50000000} | client(T)]}). > >> > > >> > client(T) -> > >> > client({T, {192,168,193,58}, {10,0,10,71}, 14302}). > >> > > >> > > ********************************************************************************************************************** > >> > >> So far, so good. (Although a 5000 sec reconnect_timer is on the long > side. > >> :) > >> > >> > - Server (10.0.10.71, port 14302) runs a diameter server remotely on a > >> > Linux. It is up and running and being tested with other diameter > client. > >> > > >> > Do the followings: > >> > > >> > 2> debugger:start(). > >> > {ok,<0.39.0>} > >> > 3> diameter:start(). > >> > ok > >> > 4> client:start(). > >> > ok > >> > 5> client:connect(tcp). > >> > {ok,#Ref<0.0.0.1210>} > >> > 6> client:call(). > >> > {error,no_connection} > >> > 7> > >> > > >> > The print information from the runtime doesn't say too much, it shows > no > >> > connection when call client:call(). In fact, when I check the debugger > >> > window, there is no tcp connection being set up properly when calling > >> > client:connect(tcp). Meaning the problem happened early without any > >> > reminder. > >> > > >> > It is also wired that the debugger monitor window doesn't allow to > >> > copy/paste:(, so I have to type some errors as following: > >> > > >> > <0.128.0> diameter_peer_fsm:init/1 exit > >> > {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, > >> > {tcp_closed,#Port<0.2250>}}}} > >> > <0.136.0> diameter_tcp:init/1 exit > {shutdown,{tcp_closed,#Port<0.2250>}} > >> > >> This looks like the peer is closing the connection. We're not even > >> getting as far as sending CER. Are you able to see what's happening on > >> the peer at all, why it's closing the connection? > >> > >> /Anders, Erlang/OTP > >> > >> > >> > <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} > >> > > >> > I increased the capx_timeout, since I thought might be CER timeout. No > >> > luck. > >> > > >> > There was no tcp connection being set up at all. I use the wireshark > to > >> > watch on the interface with the filter and I > >> > didn't > >> > see any outgoing packets. > >> > > >> > Again, It still might be some configurations are incorrect causing the > >> > above > >> > problem. But with the limited information, it is difficult to figure > out > >> > what was wrong for newbies. > >> > > >> > Could you provide some guidances on how to resolve this and any > >> > suggestions > >> > on diagnosing diameter or erlang issues? > >> > > >> > Thanks a lot for your comments! > >> > > >> > Samuel > >> > > >> > > >> > > >> > On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson < > anders.otp@REDACTED> > >> > wrote: > >> >> > >> >> On Tue, Mar 26, 2013 at 3:48 PM, S X > wrote: > >> >> > Hi, Rudolph & Anders, > >> >> > > >> >> > Not sure your problem is resolved or not. > >> >> > > >> >> > I was able to use the diameter sample code with the local/remote > >> >> > mode, > >> >> > i.e. > >> >> > Start a diameter server in an erts on a pc, and start a diameter > >> >> > client > >> >> > in > >> >> > an erts on another pc (I use virtual machines as pcs here). They > can > >> >> > communicate different types of diameter messages without problems. > >> >> > > >> >> > However, when I try to use a diameter client (the sample code) from > >> >> > an > >> >> > erts > >> >> > to connect a diameter server which is not running within an erts > >> >> > (other > >> >> > diameter server not implemented in erlang). It doesn't work(can not > >> >> > build up > >> >> > a connection). I am not quite familiar with the detailed > >> >> > implementation > >> >> > of > >> >> > the erlang diameter library now. I am feeling that the erlang > >> >> > diameter > >> >> > relies on the erlang nodes, which means all the peers are built up > >> >> > only > >> >> > on > >> >> > the erts (distributed erlang runtimes). Does the erlang diameter > only > >> >> > work > >> >> > within erlang environment? Or in order to talk to other diameter > >> >> > servers, > >> >> > >> >> No, diameter has no idea how any peers it connects to are > implemented. > >> >> > >> >> > does it need to write another erlang client using some functions > from > >> >> > the > >> >> > erlang diameter library, like encode/decode? The sample client code > >> >> > doesn't > >> >> > work in this situation. > >> >> > > >> >> > I am not sure my understanding above is correct or not. Can you > >> >> > provide > >> >> > some > >> >> > guidance? > >> >> > >> >> Sure, if you provide me with an example of something that doesn't > work > >> >> as expected. > >> >> > >> >> Anders > >> >> > >> >> > >> >> > Thanks, > >> >> > > >> >> > Samuel > >> >> > > >> >> > > >> >> > > >> >> > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson > >> >> > > >> >> > wrote: > >> >> >> > >> >> >> One more time to the list ... > >> >> >> > >> >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson > >> >> >> > >> >> >> wrote: > >> >> >> > The problem looks to be that there's an {ssl, false} option > being > >> >> >> > into > >> >> >> > diameter_tcp and then down to gen_tcp, which causes it to raise > >> >> >> > badarg. What OTP release is this? I can't say I recall the > example > >> >> >> > code passing this tuple. > >> >> >> > > >> >> >> > /Anders, Erlang/OTP > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan > >> >> >> > > >> >> >> > wrote: > >> >> >> >> Hi there, > >> >> >> >> > >> >> >> >> I'm trying to start up the Erlang diameter demo application > >> >> >> >> shipped > >> >> >> >> with > >> >> >> >> Erlang/OTP. The issue is that, no matter what format I try, I > >> >> >> >> can't > >> >> >> >> get > >> >> >> >> the > >> >> >> >> client to connect to a remote diameter server. > >> >> >> >> > >> >> >> >> In that example, I started the application as follows: > >> >> >> >> > >> >> >> >> 3> diameter:start(), client:start(). > >> >> >> >> ok > >> >> >> >> > >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). > >> >> >> >> {ok,#Ref<0.0.0.643>} > >> >> >> >> > >> >> >> >> 7> client:call(). > >> >> >> >> {error,no_connection} > >> >> >> >> > >> >> >> >> > >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one > is > >> >> >> >> {10,249,20,174}. > >> >> >> >> > >> >> >> >> TCP to the server is working: > >> >> >> >> > >> >> >> >> telnet 10.249.20.174 3868 > >> >> >> >> Trying 10.249.20.174... > >> >> >> >> Connected to 10.249.20.174. > >> >> >> >> Escape character is '^]'. > >> >> >> >> > >> >> >> >> > >> >> >> >> I traced diameter_tcp and I can see that it is getting a badarg > >> >> >> >> error > >> >> >> >> somewhere: > >> >> >> >> > >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> > {ok,<0.115.0>, > >> >> >> >> > >> >> >> >> [{10,151,0,166}]} > >> >> >> >> (<0.116.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> >> >> > >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is > >> >> >> >> that > >> >> >> >> it > >> >> >> >> has to > >> >> >> >> do with the local ip address. I don't understand why I even > need > >> >> >> >> to > >> >> >> >> supply a > >> >> >> >> local IP address and the documentation isn't very clear. > >> >> >> >> > >> >> >> >> Thanks, > >> >> >> >> > >> >> >> >> Rudolph > >> >> >> >> > >> >> >> >> > >> >> >> >> Here is the trace: > >> >> >> >> > >> >> >> >> (<0.84.0>) call > >> >> >> >> diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) call > diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> > >> >> >> >> {monitor,<0.114.0>,<0.115.0>} > >> >> >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> > >> >> >> >> {ok,<0.116.0>} > >> >> >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> {raddr,{10,249,20,174}}, > >> >> >> >> {rport,3868}, > >> >> >> >> {reuseaddr,true}]) > >> >> >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) > >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false > >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, > >> >> >> >> [{ssl,false}, > >> >> >> >> > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> > >> >> >> >> {raddr,{10,249,20,174}}, > >> >> >> >> {rport,3868}, > >> >> >> >> > >> >> >> >> {reuseaddr,true}]} > >> >> >> >> (<0.115.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> {raddr,{10,249,20,174}}, > >> >> >> >> {rport,3868}, > >> >> >> >> {reuseaddr,true}],[]) > >> >> >> >> (<0.115.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> {raddr,{10,249,20,174}}, > >> >> >> >> {rport,3868}, > >> >> >> >> {reuseaddr,true}],[]) > >> >> >> >> (<0.115.0>) call > diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) > >> >> >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) > >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> {10,151,0,166} > >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > >> >> >> >> {10,151,0,166} > >> >> >> >> (<0.115.0>) call > >> >> >> >> diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) > >> >> >> >> (<0.115.0>) call > diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) > >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> > {10,249,20,174} > >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> > >> >> >> >> {10,249,20,174} > >> >> >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) > >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 > >> >> >> >> (<0.115.0>) call > >> >> >> >> > >> >> >> >> > diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) > >> >> >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, > >> >> >> >> > {packet,0}, > >> >> >> >> > >> >> >> >> {active,once}, > >> >> >> >> > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> > >> >> >> >> {ssl,false}, > >> >> >> >> > >> >> >> >> {reuseaddr,true}] > >> >> >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> > >> >> >> >> {ok,<0.115.0>, > >> >> >> >> > >> >> >> >> [{10,151,0,166}]} > >> >> >> >> (<0.115.0>) call > >> >> >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, > >> >> >> >> {packet,0}, > >> >> >> >> {active,once}, > >> >> >> >> {ip,{10,151,0,166}}, > >> >> >> >> {ssl,false}, > >> >> >> >> {reuseaddr,true}]) > >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> > {ok,<0.115.0>, > >> >> >> >> > >> >> >> >> [{10,151,0,166}]} > >> >> >> >> (<0.116.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok > >> >> >> >> (<0.116.0>) call > >> >> >> >> > diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) > >> >> >> >> (<0.116.0>) call > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) > >> >> >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> _______________________________________________ > >> >> >> >> 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 stefan@REDACTED Thu Mar 28 22:04:21 2013 From: stefan@REDACTED (Stefan Jahn) Date: Thu, 28 Mar 2013 22:04:21 +0100 Subject: [erlang-questions] scp subsystem In-Reply-To: References: <8d026d1d272a84accac74056e8bfbb2d.squirrel@service.rules.org> <4f6727f775395e32810aeb661470a04d.squirrel@service.rules.org> Message-ID: <2feadbbc5cbca5a1450d5c293011a04e.squirrel@service.rules.org> Hello Attila, thank you again =D works like charm also for privileged ports... Thus, only 2) ... 4) still to be done. Best regards, Stefan. On Thu, March 28, 2013 1:25 pm, Attila Rajmund Nohl wrote: > Hello! > > There is already an {fd, FD} option in ssh:daemon, so bind first, then > pass the file descriptor. > > 2013/3/28 Stefan Jahn : >> Hello Ingela, >> >> after some experimentation I have an almost completed scpd server >> implementattion at hand. >> >> Some issues still remain: >> >> 1) for privileged ports for ssh:daemon() I suggest to have a callback >> to the ssh options to obtain listen() handle from e.g. fd_server. >> What do you think? >> >> 2) save path handling (resolve symlinks); I leave this out, because >> I've seen in sftpd implementation similar thing. Probably we should >> share functions across scpd and sftpd? >> >> 3) fine grained file permissions per user base: r/w for list of >> directories, I leave it out for now, because not necessery so far >> for my own purposes >> >> 4) ssh channel flushing/eof/close on the last transferred file in >> source mode of the scpd server. needs some more investigations... >> that why I wrote the "scp eow" topic on the list. >> >> 1) until 3) is not that big problem, but 4) need to be solved. After >> that I would be happy to contribute if you are interested... >> >> What do you think? >> >> BR, Stefan. >> >> On Tue, March 19, 2013 3:04 pm, Ingela Andin wrote: >>> Hello again, >>> >>> If you do a general scp client/server implementation you should >>> consider contributing it. >>> We would be interested. >>> >>> Regards Ingela Erlang/OTP team - Ericsson AB >>> >>> 2013/3/19, Ingela Andin : >>>> Hi! >>>> >>>> 2013/3/19, Stefan Jahn : >>>>> dear erlang'ers, >>>>> >>>>> after reading some documentation on ssh otp system I ended up with: >>>>> >>>>> ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2}, >>>>> %% create server keys: >>>>> %% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa >>>>> %% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa >>>>> {system_dir, "/tmp/ssh"}, >>>>> {user_dir, "/tmp/ssh"}, >>>>> % {ssh_cli,{ssh_cli, {ssh_scpd, []}}}, >>>>> {auth_methods, >>>>> "keyboard-interactive,password"}, >>>>> {subsystems, [ >>>>> ssh_scpd:subsystem_spec([]) >>>>> % >>>>> ssh_sftpd:subsystem_spec([{vsn, 3}]) >>>>> ]}]). >>>>> >>>>> whereas the ssh_scpd module is base on the ssh_sftpd module from otp, >>>>> i.e. >>>>> >>>>> -module(ssh_scpd). >>>>> %-behaviour(ssh_daemon_channel). >>>>> -behaviour(ssh_channel). >>>>> >>>>> -define(UINT32(X), X:32/unsigned-big-integer). >>>>> >>>>> %% External exports >>>>> -export([subsystem_spec/1]). >>>>> >>>>> %% Callbacks >>>>> -export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2, >>>>> code_change/3]). >>>>> >>>>> implementing the callbacks similar to what we have in ssh_sftpd... >>>>> >>>>> now, when I start >>>>> >>>>> $ scp -P 45678 README ssh@REDACTED:README >>>>> >>>>> authentification works fine as implemented in auth/2, but somehow >>>>> the ssh channel behaviour is not used at all. >>>>> >>>>> ssh@REDACTED's password: >>>>> {error,{1,erl_parse,["syntax error before: ",[]]}} >>>>> $ Received disconnect from 127.0.0.1: 11: Application shutdown >>>>> >>>>> It seems like scp commands are send into the standard erlang shell >>>>> (which >>>>> I did not specify) and not into the channel. >>>>> >>>>> I am using R15B2. >>>>> >>>>> Could please someone help out here and give me some hint where to >>>>> proceed reading? >>>>> >>>>> Also an abstract description of the difference between the purposes >>>>> of >>>>> ssh_cli and subsystems options would be appriciated. >>>> >>>> ssh_cli is to customize the shell I do not think you want to use >>>> ssh_cli at all. You should write your scp-deamon as subsystem and then >>>> use an existing scp client to connect to it or >>>> write your own erlang client that opens an ssh connection, requests >>>> the ssh-scp subsystem and then sends scp commands on the channel along >>>> the lines; >>>> >>>> ssh:connect ... >>>> ssh_connection:session_channel... >>>> ssh_connection:subsystem... >>>> ssh_connection:send... >>>> >>>> The client can use the ssh_channel behavior. >>>> >>>> Regards Ingela Erlang/OTP team Ericsson AB >>>> >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From norton@REDACTED Fri Mar 29 02:49:40 2013 From: norton@REDACTED (=?utf-8?B?44OO44O844OI44OzIOOCuOODp+ODvOOCu+ODlSDjgqbjgqfjgqQg?= =?utf-8?B?44Oz?=) Date: Fri, 29 Mar 2013 10:49:40 +0900 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: <0D4BD163-62BD-40AD-AF3B-1EB1FDCEC5C1@lovely.email.ne.jp> Interesting. I would have expected the spec written in the lists module to have triggered a warning message. By adding any one of these specs, dialyzer does produce the desired warning message. -module(foo). -export([bar/2, baz/0]). %%-spec bar(list(), list()) -> list(). %%-spec bar(list(term()), list(term())) -> list(term()). %%-spec bar([term()], [term()]) -> [term()]. bar(A, B) -> lists:append(A, B). baz() -> bar([], a). dialyzer --plt ~/.dialyzer_plt.R16B ebin/foo.beam Checking whether the PLT ~/.dialyzer_plt.R16B is up-to-date... yes Proceeding with analysis... foo.erl:10: Function baz/0 has no local return foo.erl:11: The call foo:bar([],'a') breaks the contract ([term()],[term()]) -> [term()] done in 0m6.70s done (warnings were emitted) On Mar 29, 2013, at 24:04 , Pierre Fenoll wrote: > Dialyzer says it passed successfully. > > On 28 March 2013 15:38, Joseph Wayne Norton wrote: > > Pierre - > > Just in case ... have you tried running Dialyzer on your program? If so, what does Dialyzer report? > > regards, > > Joe N. > > On Mar 28, 2013, at 11:12 PM, Pierre Fenoll wrote: > > > > It's not a contradiction, as kostis noted specs are not complete > > > enumerations of all possible argument types. > > > > Well, lists:append/2 asks for a list() as a second argument. Shouldn't > > it badarg when I give it 'a', as in lists:append([], a) ? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.otp@REDACTED Fri Mar 29 07:19:15 2013 From: anders.otp@REDACTED (Anders Svensson) Date: Fri, 29 Mar 2013 07:19:15 +0100 Subject: [erlang-questions] Diameter client issue In-Reply-To: References: <83CDE6F9-99B1-4133-B4DF-A0A013069038@me.com> Message-ID: On Thu, Mar 28, 2013 at 8:39 PM, S X wrote: > Hi, Anders, > > Just to assure your answer with wireshark, the external server closes the > connection after receiving the initial CER with wrong OH and OR from the > client. But the server should response with CEA saying wrong information as > a common sense. Yes, it should answer with an appropriate Result-Code. If it's rejecting the CER based on the received Origin-Host or Origin-Realm then 3010, DIAMETER_UNKNOWN_PEER, is the best fit. > Also, is the node format "nodename@REDACTED" is common to the diameter > protocol and not just for the distributed erlang nodes? nodename@REDACTED has nothing to do with the Diameter protocol: it's the name of an Erlang node. Both Erlang and Diameter use the term "node". You give an Erlang node a name by passing -sname or -name to erl(1), you give a Diameter node a name by assigning it an Origin-Host that's communicated during capabilities exchange. You choose these names independently. Distributed Erlang is also unrelated to the Diameter protocol. You can read more about it here: http://www.erlang.org/doc/reference_manual/distributed.html The diameter application can make use of distribution (as can your own code) if you spread the implementation of your Diameter node across multiple Erlang nodes, but you can also implement your Diameter node on a single Erlang node. In both cases, your Diameter node communicates with other Diameter nodes using the Diameter protocol over TCP or SCTP. Distributed Erlang isn't involved. /Anders, Erlang/OTP > Thanks, > > Samuel > > > On Wed, Mar 27, 2013 at 4:18 PM, Anders Svensson > wrote: >> >> Hi Samuel. >> >> On Wed, Mar 27, 2013 at 6:50 PM, S X wrote: >> > Hi Anders & Rudolph, >> > >> > Thanks for your responses. >> > >> > "5000 sec reconnect_timer is on the long side." I guess I treated milli >> > as >> > micro. :) >> > >> > Don't worry about the logging, as long as I can see something from the >> > erlang debugger window (By the way, I feel that the debugger for Window >> > version is better than the one for Ubuntu). And I understand that it is >> > kind >> > of difficult to log everything from the diameter library. >> > >> > As Anders suggested, I checked on the peer side (the diameter server in >> > this >> > case) and it seems timed out waiting for CER and disconnecting the >> > client. >> > >> > Also, I found that my wireshark wasn't set up properly to work with VPN >> > ( I >> > am running it with a VPN environment) and that is properly why I didn't >> > see >> > any packets going outside. >> > >> > At last, I made the communication work after changing Origin-Host and >> > Origin-Realm on the diameter client side. And they can talk diameter >> > now. >> > But don't quite understand why those two options are important for the >> > initial socket set-up? For the initial step, doesn't it just need server >> > IP >> > and port information? Or maybe because the special implementation on >> > this >> > diameter server? Is this common to a diameter application? >> >> Origin-Host/Realm are only used to construct an outgoing capabilities >> CER/CEA after the transport connection is established. Are you sure >> the server wasn't receiving your client's CER and closing the >> connection for some reason? Changing the values of Origin-Host/Realm >> shouldn't make a difference unless the server cares. (Which is a bit >> unusual. If anything it's IP addresses that servers seem to like to >> reject connections from.) >> >> > The other question is about diameter node, in diameter_sync module: >> > call(Name, Req, Max, Timeout) -> >> > call(node(), Name, Req, Max, Timeout). >> > >> > By default, it is "nonode@REDACTED", is the node used just for >> > representing >> > the erlang run time or for other purpose? How does the node information >> > is >> > being used in diameter? >> >> nonode@REDACTED is the name of an Erlang node that isn't distributed. >> That is, that doesn't register with epmd and doesn't talk to other >> Erlang nodes using the Distribution Protocol. If you start a >> distributed node (eg. erl -sname foo) then diameter can share >> information about transport connections with diameter services running >> on other nodes. This isn't documented (or working :) in R16B but it is >> on the maint branch on github, on the way to R16B01. (Take a look at >> the doc for the service_opt() share_peers in diameter(3).) >> >> /Anders, Erlang/OTP >> >> >> > Many thanks! >> > >> > >> > Samuel >> > >> > >> > >> > >> > On Wed, Mar 27, 2013 at 5:47 AM, Anders Svensson >> > wrote: >> >> >> >> Hi Samuel. >> >> >> >> > Thanks for your reply. As my understanding also, the erlang diameter >> >> > should >> >> > not care how the other peers are implemented, as long as the peers >> >> > follow >> >> > the diameter specifications. >> >> > >> >> > But the erlang diameter library provides limited error information >> >> > and >> >> > this >> >> > makes it harder to analyse problems, especially for newbies. >> >> >> >> It's usually (it seems) problems with capabilities exchange that trips >> >> people up, and you're right that these can be a bit difficult to to >> >> detect: capabilities exchange will fail, the transport connection will >> >> be broken, and that's that. I'm a bit hesitant of logging ordinary >> >> (albeit failed) Diameter signaling but I'll see what I can do. >> >> >> >> > My set-up is: >> >> > >> >> > - Client (192.168.193.58) runs from an erlang run time in a virtual >> >> > machine. >> >> > Just made some little changes based on the sample code: >> >> > >> >> > >> >> > ********************************************************************************************************************** >> >> > -define(SVC_NAME, ?MODULE). >> >> > -define(APP_RAR_ALIAS, rara). >> >> > -define(APP_CCR_ALIAS, ccra). >> >> > -define(DIAMETER_DICT_CCRA, diameter_gen_rfc4006_cc). >> >> > -define(DIAMETER_APP_ID_CCRA, 16777238). >> >> > -define(DIAMETER_DICT_COMMON_NEW, diameter_gen_base_rfc6733). >> >> > >> >> > -define(SERVICE(Name), [{'Origin-Host', ?L(Name) ++ ".example.com"}, >> >> > {'Origin-Realm', "example.com"}, >> >> > {'Vendor-Id', 193}, >> >> > {'Product-Name', "Client"}, >> >> > {'Auth-Application-Id', >> >> > [?DIAMETER_APP_ID_COMMON, ?DIAMETER_APP_ID_CCRA]}, >> >> > {application, [{alias, ?APP_RAR_ALIAS}, >> >> > {dictionary, >> >> > ?DIAMETER_DICT_COMMON_NEW}, >> >> > {module, client_cb}]}, >> >> > {application, [{alias, ?APP_CCR_ALIAS}, >> >> > {dictionary, >> >> > ?DIAMETER_DICT_CCRA}, >> >> > {module, client_cb_ccra}]}]). >> >> > >> >> > connect(Name, T) -> >> >> > diameter:add_transport(Name, {connect, [{reconnect_timer, >> >> > 5000000}, >> >> > {capx_timeout, 50000000} | client(T)]}). >> >> > >> >> > client(T) -> >> >> > client({T, {192,168,193,58}, {10,0,10,71}, 14302}). >> >> > >> >> > >> >> > ********************************************************************************************************************** >> >> >> >> So far, so good. (Although a 5000 sec reconnect_timer is on the long >> >> side. >> >> :) >> >> >> >> > - Server (10.0.10.71, port 14302) runs a diameter server remotely on >> >> > a >> >> > Linux. It is up and running and being tested with other diameter >> >> > client. >> >> > >> >> > Do the followings: >> >> > >> >> > 2> debugger:start(). >> >> > {ok,<0.39.0>} >> >> > 3> diameter:start(). >> >> > ok >> >> > 4> client:start(). >> >> > ok >> >> > 5> client:connect(tcp). >> >> > {ok,#Ref<0.0.0.1210>} >> >> > 6> client:call(). >> >> > {error,no_connection} >> >> > 7> >> >> > >> >> > The print information from the runtime doesn't say too much, it shows >> >> > no >> >> > connection when call client:call(). In fact, when I check the >> >> > debugger >> >> > window, there is no tcp connection being set up properly when calling >> >> > client:connect(tcp). Meaning the problem happened early without any >> >> > reminder. >> >> > >> >> > It is also wired that the debugger monitor window doesn't allow to >> >> > copy/paste:(, so I have to type some errors as following: >> >> > >> >> > <0.128.0> diameter_peer_fsm:init/1 exit >> >> > {shutdown,{'DOWN',#Ref<0.0.0.1413>process,<0.136.0>, {shutdown, >> >> > {tcp_closed,#Port<0.2250>}}}} >> >> > <0.136.0> diameter_tcp:init/1 exit >> >> > {shutdown,{tcp_closed,#Port<0.2250>}} >> >> >> >> This looks like the peer is closing the connection. We're not even >> >> getting as far as sending CER. Are you able to see what's happening on >> >> the peer at all, why it's closing the connection? >> >> >> >> /Anders, Erlang/OTP >> >> >> >> >> >> > <0.138.0> diameter_tcp:init/1 exit {shutdown, {stop,<0.136.0>}} >> >> > >> >> > I increased the capx_timeout, since I thought might be CER timeout. >> >> > No >> >> > luck. >> >> > >> >> > There was no tcp connection being set up at all. I use the wireshark >> >> > to >> >> > watch on the interface with the filter and I >> >> > didn't >> >> > see any outgoing packets. >> >> > >> >> > Again, It still might be some configurations are incorrect causing >> >> > the >> >> > above >> >> > problem. But with the limited information, it is difficult to figure >> >> > out >> >> > what was wrong for newbies. >> >> > >> >> > Could you provide some guidances on how to resolve this and any >> >> > suggestions >> >> > on diagnosing diameter or erlang issues? >> >> > >> >> > Thanks a lot for your comments! >> >> > >> >> > Samuel >> >> > >> >> > >> >> > >> >> > On Tue, Mar 26, 2013 at 12:30 PM, Anders Svensson >> >> > >> >> > wrote: >> >> >> >> >> >> On Tue, Mar 26, 2013 at 3:48 PM, S X >> >> >> wrote: >> >> >> > Hi, Rudolph & Anders, >> >> >> > >> >> >> > Not sure your problem is resolved or not. >> >> >> > >> >> >> > I was able to use the diameter sample code with the local/remote >> >> >> > mode, >> >> >> > i.e. >> >> >> > Start a diameter server in an erts on a pc, and start a diameter >> >> >> > client >> >> >> > in >> >> >> > an erts on another pc (I use virtual machines as pcs here). They >> >> >> > can >> >> >> > communicate different types of diameter messages without problems. >> >> >> > >> >> >> > However, when I try to use a diameter client (the sample code) >> >> >> > from >> >> >> > an >> >> >> > erts >> >> >> > to connect a diameter server which is not running within an erts >> >> >> > (other >> >> >> > diameter server not implemented in erlang). It doesn't work(can >> >> >> > not >> >> >> > build up >> >> >> > a connection). I am not quite familiar with the detailed >> >> >> > implementation >> >> >> > of >> >> >> > the erlang diameter library now. I am feeling that the erlang >> >> >> > diameter >> >> >> > relies on the erlang nodes, which means all the peers are built up >> >> >> > only >> >> >> > on >> >> >> > the erts (distributed erlang runtimes). Does the erlang diameter >> >> >> > only >> >> >> > work >> >> >> > within erlang environment? Or in order to talk to other diameter >> >> >> > servers, >> >> >> >> >> >> No, diameter has no idea how any peers it connects to are >> >> >> implemented. >> >> >> >> >> >> > does it need to write another erlang client using some functions >> >> >> > from >> >> >> > the >> >> >> > erlang diameter library, like encode/decode? The sample client >> >> >> > code >> >> >> > doesn't >> >> >> > work in this situation. >> >> >> > >> >> >> > I am not sure my understanding above is correct or not. Can you >> >> >> > provide >> >> >> > some >> >> >> > guidance? >> >> >> >> >> >> Sure, if you provide me with an example of something that doesn't >> >> >> work >> >> >> as expected. >> >> >> >> >> >> Anders >> >> >> >> >> >> >> >> >> > Thanks, >> >> >> > >> >> >> > Samuel >> >> >> > >> >> >> > >> >> >> > >> >> >> > On Thu, Mar 21, 2013 at 9:00 AM, Anders Svensson >> >> >> > >> >> >> > wrote: >> >> >> >> >> >> >> >> One more time to the list ... >> >> >> >> >> >> >> >> On Thu, Mar 21, 2013 at 12:58 PM, Anders Svensson >> >> >> >> >> >> >> >> wrote: >> >> >> >> > The problem looks to be that there's an {ssl, false} option >> >> >> >> > being >> >> >> >> > into >> >> >> >> > diameter_tcp and then down to gen_tcp, which causes it to raise >> >> >> >> > badarg. What OTP release is this? I can't say I recall the >> >> >> >> > example >> >> >> >> > code passing this tuple. >> >> >> >> > >> >> >> >> > /Anders, Erlang/OTP >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> > On Wed, Mar 20, 2013 at 6:08 PM, Rudolph van Graan >> >> >> >> > >> >> >> >> > wrote: >> >> >> >> >> Hi there, >> >> >> >> >> >> >> >> >> >> I'm trying to start up the Erlang diameter demo application >> >> >> >> >> shipped >> >> >> >> >> with >> >> >> >> >> Erlang/OTP. The issue is that, no matter what format I try, I >> >> >> >> >> can't >> >> >> >> >> get >> >> >> >> >> the >> >> >> >> >> client to connect to a remote diameter server. >> >> >> >> >> >> >> >> >> >> In that example, I started the application as follows: >> >> >> >> >> >> >> >> >> >> 3> diameter:start(), client:start(). >> >> >> >> >> ok >> >> >> >> >> >> >> >> >> >> 4> client:connect({tcp,{10,151,0,166},{10,249,20,174},3868}). >> >> >> >> >> {ok,#Ref<0.0.0.643>} >> >> >> >> >> >> >> >> >> >> 7> client:call(). >> >> >> >> >> {error,no_connection} >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Here, my local IP address is {10,151,0,166} and the remote one >> >> >> >> >> is >> >> >> >> >> {10,249,20,174}. >> >> >> >> >> >> >> >> >> >> TCP to the server is working: >> >> >> >> >> >> >> >> >> >> telnet 10.249.20.174 3868 >> >> >> >> >> Trying 10.249.20.174... >> >> >> >> >> Connected to 10.249.20.174. >> >> >> >> >> Escape character is '^]'. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> I traced diameter_tcp and I can see that it is getting a >> >> >> >> >> badarg >> >> >> >> >> error >> >> >> >> >> somewhere: >> >> >> >> >> >> >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> >> >> >> >> >> {ok,<0.115.0>, >> >> >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> >> >> >> >> >> >> Does anyone have an idea what I am doing wrong? My feeling is >> >> >> >> >> that >> >> >> >> >> it >> >> >> >> >> has to >> >> >> >> >> do with the local ip address. I don't understand why I even >> >> >> >> >> need >> >> >> >> >> to >> >> >> >> >> supply a >> >> >> >> >> local IP address and the documentation isn't very clear. >> >> >> >> >> >> >> >> >> >> Thanks, >> >> >> >> >> >> >> >> >> >> Rudolph >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Here is the trace: >> >> >> >> >> >> >> >> >> >> (<0.84.0>) call >> >> >> >> >> diameter_tcp:start_link({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> diameter_tcp:init({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) call diameter_tcp:i({monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) returned from diameter_tcp:i/1 -> >> >> >> >> >> {monitor,<0.114.0>,<0.115.0>} >> >> >> >> >> (<0.84.0>) returned from diameter_tcp:start_link/1 -> >> >> >> >> >> {ok,<0.116.0>} >> >> >> >> >> (<0.115.0>) call diameter_tcp:ssl([{ssl,false}, >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> >> {rport,3868}, >> >> >> >> >> {reuseaddr,true}]) >> >> >> >> >> (<0.115.0>) call diameter_tcp:ssl_opts([]) >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl_opts/1 -> false >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:ssl/1 -> {false, >> >> >> >> >> [{ssl,false}, >> >> >> >> >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> >> >> >> >> >> >> {rport,3868}, >> >> >> >> >> >> >> >> >> >> {reuseaddr,true}]} >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,false,[{ssl,false}, >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> >> {rport,3868}, >> >> >> >> >> {reuseaddr,true}],[]) >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:i(connect,#Ref<0.0.0.643>,gen_tcp,<0.114.0>,[{ssl,false}, >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> {raddr,{10,249,20,174}}, >> >> >> >> >> {rport,3868}, >> >> >> >> >> {reuseaddr,true}],[]) >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> diameter_tcp:get_addr([{ip,{10,151,0,166}}],[]) >> >> >> >> >> (<0.115.0>) call diameter_tcp:addr([{ip,{10,151,0,166}}],[]) >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> >> >> >> >> >> {10,151,0,166} >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> >> >> >> >> >> {10,151,0,166} >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> diameter_tcp:get_addr([{raddr,{10,249,20,174}}],[]) >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> diameter_tcp:addr([{raddr,{10,249,20,174}}],[]) >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:addr/2 -> >> >> >> >> >> {10,249,20,174} >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_addr/2 -> >> >> >> >> >> {10,249,20,174} >> >> >> >> >> (<0.115.0>) call diameter_tcp:get_port([{rport,3868}]) >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:get_port/1 -> 3868 >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:gen_opts({10,151,0,166},[{ssl,false},{reuseaddr,true}]) >> >> >> >> >> (<0.115.0>) returned from diameter_tcp:gen_opts/2 -> [binary, >> >> >> >> >> >> >> >> >> >> {packet,0}, >> >> >> >> >> >> >> >> >> >> {active,once}, >> >> >> >> >> >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> >> >> >> >> >> {ssl,false}, >> >> >> >> >> >> >> >> >> >> {reuseaddr,true}] >> >> >> >> >> (<0.82.0>) returned from diameter_tcp:start_link/1 -> >> >> >> >> >> {ok,<0.115.0>, >> >> >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> >> (<0.115.0>) call >> >> >> >> >> diameter_tcp:connect(gen_tcp,{10,249,20,174},3868,[binary, >> >> >> >> >> {packet,0}, >> >> >> >> >> {active,once}, >> >> >> >> >> {ip,{10,151,0,166}}, >> >> >> >> >> {ssl,false}, >> >> >> >> >> {reuseaddr,true}]) >> >> >> >> >> (<0.114.0>) returned from diameter_tcp:start/3 -> >> >> >> >> >> {ok,<0.115.0>, >> >> >> >> >> >> >> >> >> >> [{10,151,0,166}]} >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:handle_info({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:m({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) returned from diameter_tcp:m/2 -> ok >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> diameter_tcp:x({'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}) >> >> >> >> >> (<0.116.0>) call >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> diameter_tcp:terminate({shutdown,{'DOWN',#Ref<0.0.0.924>,process,<0.115.0>,badarg}},{monitor,<0.114.0>,<0.115.0>}) >> >> >> >> >> (<0.116.0>) returned from diameter_tcp:terminate/2 -> ok >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> >> >> 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 yueyoum@REDACTED Fri Mar 29 08:54:36 2013 From: yueyoum@REDACTED (=?UTF-8?B?5pyI5b+n6IyX?=) Date: Fri, 29 Mar 2013 15:54:36 +0800 Subject: [erlang-questions] gen_tcp recv web content In-Reply-To: References: Message-ID: Thanks 2013/3/28 Chandru > Change HTTP/1.1 to HTTP/1.0. The server will then close the connection > when it has sent all the data. > > > On 28 March 2013 08:16, ??? wrote: > >> >> Hi, >> >> I'm learning Erlang, And I have some code, to get web site content. >> >> http://pastebin.com/BDeUuymX >> >> >> in erlang shell: >> >> >> c(test). >> test:start("www.yahoo.com", 80). >> >> I MUST waiting for the remote website close the socket, >> after that, I got {tcp_closed, Socket} msg, >> then finish the loop. >> >> But, Waiting for remote close socket was takes a 'long' time, >> >> Is there any way to know, i have already get the whole data, and close >> the socket by myself? >> >> >> using Content-Length? How? >> >> >> another question: >> >> test:start("github.com", 443). >> >> when play with such this 'https' sites, the code can not working. >> It seems like being blocked. can not receive the data, and finally >> closed by remote sites. >> >> >> Thanks. >> >> >> >> >> >> >> >> >> >> >> >> -- >> My GitHub >> https://github.com/yueyoum >> >> My Blog >> http://codeshift.org >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- My GitHub https://github.com/yueyoum My Blog http://codeshift.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier.boudeville@REDACTED Fri Mar 29 10:46:54 2013 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Fri, 29 Mar 2013 10:46:54 +0100 Subject: [erlang-questions] Sending a large Erlang content to a set of remote nodes In-Reply-To: Message-ID: Hello Joe, erlang@REDACTED a ?crit sur 28/03/2013 18:44:08 : > How big is the set of remote VMs (how many dozens?) - > Is the communication bandwidth between machines symmetric. > > Once two machines have got a copy they could *both* send the data to a third. > Machine one sends the first half, machine two the second. Now three > machines have a copy > > Now three machines can send a copy to a fourth, the first can send > the first third, ... > and so on. > > Lookup epidemic gossip protocols. > > This is a very nice exercise in parallel programming. Yes, I agree; I had thought to a similar "peer-to-peer" mechanism (like also the one Bob hinted) but for my use case currently I think it would be a bit of an overkill. To introduce more context, the setting is a distributed discrete-time simulation engine (Sim-Diasca) running on a HPC cluster (hence indeed with rather homogeneous hosts and symmetric network links, at least a few dozens of them) where sendfile will now be used (in replacement of previous solutions) for at least two purposes: - during the deployment phase: sending a compressed archive, containing the simulator code and data, dedicated to all computing nodes (as no prerequisite is expected to be available on them beforehand); currently the simulation archive is usually rather small, and various delays result in the parallel deployment processes being not really synchronised (hence no "multi-sendfile" - one file reading, multiple TCP sendings - could be really useful there) - during a recovery phase: to address any reliability issue which could happen on future large-scale simulations (despite a good MTBF for each core/host/link, a sufficiently large number of cores would make failures almost certain for longer simulations), the user will be able to specify the maximum number (k) of hosts that may be simultaneously lost in the course of the simulation without having it crashing; for that, each time a simulation milestone is met, each node (one node per host currently) is to send a compressed file containing a serialization of its full state (mostly the state of its model instances) to the k nodes securing it, in order that a simulation rollback can be performed in case of up-to-k simultaneous crashes; the size of each file should be roughly the same as the one of the RAM of the corresponding node (some gigabytes), and sendfile will be very useful there; a "multi-sendfile" (reading the serialization file once, sending it to the k securing nodes simultaneously) could be useful there, however it is low-priority for us, and the current sendfile seems already a very good solution for that (thanks Tuncer!); moreover, as during this phase each node will send its state to its k securing nodes and reciprocally will receive the serialization information from the k nodes it secures, a kind of uniform, already-saturating network load should exist by design But if ever there was in the future an Erlang-based generic, efficient, transparent peer-to-peer file-exchange service between a set of nodes, of course I would gladly integrate it :0) Best regards, Olivier. > > Cheers > > /Joe > > > > I was searching for a solution that would be > reliable/simple/efficient to do so (preferably in that order), > knowing that these terms could be either be kept in the RAM of the > sender or, maybe preferably (the size of the data being probably > roughly on par with the local RAM), as a compressed file on disk. > > Currently I send a binary, compressed archive thanks to a basic > Erlang message, but I think it is not a good practice (ex: maybe the > kernel ticks are not sent "out of band" and their delaying by larger > archives could trigger spurious time-outs). I imagine sendfile with > enough async threads could be a good candidate, however I am unsure > that the same content (either as a whole or by chunks) could be read > once, yet be sent to multiple recipients. > > Any idea? > > Thanks in advance for any hint! > > 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 mail@REDACTED Fri Mar 29 13:51:44 2013 From: mail@REDACTED (Boris Shomodjvarac) Date: Fri, 29 Mar 2013 13:51:44 +0100 Subject: [erlang-questions] diameter and rfc4006 Message-ID: <51558E60.5060806@shomodj.com> Hi Guys, I need to build a diameter server with rfc4006 (Diameter Credit-Control Application) application. I just need a simple service to receive CCA messages send them to RabbitMQ and reply back. CCA unit is only data. Does anyone have any example diameter packets? or maybe test code to share? I will contribute back :) I just need some simple request/reply examples to help me prototype the server. Thx, Boris. -- Understanding recursion is really easy, all you have to do is understand recursion. /Joe From andre@REDACTED Fri Mar 29 14:26:13 2013 From: andre@REDACTED (=?ISO-8859-1?Q?Andr=E9_Graf?=) Date: Fri, 29 Mar 2013 14:26:13 +0100 Subject: [erlang-questions] diameter and rfc4006 In-Reply-To: <51558E60.5060806@shomodj.com> References: <51558E60.5060806@shomodj.com> Message-ID: Hi Boris Search in this mailing list for "erlang diameter dictionary". Another guy has asked an identical question about a week ago. - Andre On 29 March 2013 13:51, Boris Shomodjvarac wrote: > Hi Guys, > > I need to build a diameter server with rfc4006 (Diameter Credit-Control > Application) application. I just need a simple service to receive CCA > messages send them to RabbitMQ and reply back. CCA unit is only data. > > Does anyone have any example diameter packets? or maybe test code to > share? I will contribute back :) > > I just need some simple request/reply examples to help me prototype the > server. > > Thx, > Boris. > > -- > Understanding recursion is really easy, > all you have to do is understand recursion. /Joe > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Fri Mar 29 18:39:46 2013 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 29 Mar 2013 18:39:46 +0100 Subject: [erlang-questions] 2 Erlang articles @news.yc: 1) Armstrong - Right Problem. 2) Go vs Erlang In-Reply-To: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> References: <1364426760.13181.140661210075249.056372B4@webmail.messagingengine.com> Message-ID: On Thu, Mar 28, 2013 at 12:26 AM, giovanni_re wrote: > Do you have something valuable to add to these discussions? > > No - I want to provoke discussion, not take part in it. I'll sit back and watch. I want to start publicizing Erlang - we've had the technical discussions before. You guys - you who read this list - go tweet and blog - join the fun. I came back from the San Francisco Erlang Factory fired with enthusiasm and immediately started a new blog at http://joearms.github.com The idea was to bang the drum a bit and explain what we're doing from my point of view. I'm now trying to explain what we do in simple terms so that more people can understand what we're doing. My second post seemed to attract some attention with 160 comments on: https://news.ycombinator.com/item?id=5451202 I'm saying things that a lot of people disagree with, but also a lot of people agree with - so a lively discussion followed. So if you love Erlang or hate it go join the fun at ycombinator. Saying Erlang is great here is preaching to the converted, time to broaden the discussion and take the argument to the hurly burly of the marketplace. I know I'm an opinionated bastard who makes loads of mistakes, but perhaps we are not totally barking up the wrong tree. I think it's time to throw a few stones into the pond and see where the ripples go. In the next few weeks I'll be blogging my impressions from the Erlang factory. I feel like Marco Polo telling tales from far off exotic places. It's amazing - did you know, they don't have snow in San Francisco what an exotic place. /Joe --- > > Joe Armstrong: Solving the wrong problem (github.com) > 111 points by geoffhill 4 hours ago | 47 comments > https://news.ycombinator.com/item?id=5451202 > > konstruktor 2 hours ago | link > At this point in time, sequential > programs started getting slower, year on year, and parallel programs > started getting faster. > > The first part of this statement is plain wrong. Single thread > performance has improved a lot due to better CPU architecture. Look at > http://www.cpubenchmark.net/singleThread.html and compare CPUs with the > same clock rate, where a 2.5 GHz. An April 2012 Intel Core i7-3770T > scores 1971 points while a July 2008 Intel Core2 Duo T9400 scores 1005 > points. This is almost double the score in less than four years. Of > course, one factor is the larger cache that the quad core has, but this > refutes Armstrong's point that the multicore age is bad for single > thread performance even more. > > For exposure to a more balanced point of view, I would highly recommend > Martin Thompson's blog mechanical-sympathy.blogspot.com. It is a good a > starting point on how far single threaded programs can be pushed and > where multi-threading can even be detrimental. > > Also, I think that fault tolerance is where Erlang really shines. More > than a decade after OTP, projects like Akka and Hysterix are finally > venturing in the right direction. > > > === > > Concurrency Models: Go vs Erlang (joneisen.me) > 46 points by geoka9 2 hours ago | 13 comments > https://news.ycombinator.com/item?id=5451651 > > > jerf 2 hours ago | link Erlang's error checking model is a great deal > more like Go's than he thinks. Erlang is in the "exceptions are > exceptional" camp too, and idiomatic code should not be throwing > exceptions around willy -nilly. > > Go is noticably more fragile with errors. Unhandled exceptions (which > are just a fact of life unless you're a perfect programmer) will result > in the entire program terminating if you don't have something that > handles it. This behavior is forced on it precisely because of the > shared memory model (one of the actual big differences); if one > goroutine has f'ed up, you simply don't know what the state of your > program is anymore. (Theoretically you could do better than that, but > not simply.) Since Erlang memory is isolated, it can kill just that one > process, and the other processes can pick up the pieces. (Not > necessarily perfectly or without loss, but in practice, really quite > well.) Consequently, for any serious Go program, you're still going to > have to choose an exception handling policy, it's not as if it has > gotten away from exceptions. Failures are a fact of life... for all you > know, memory was corrupted. Again, the difference here is not "error > handling policy" but the longer term consequences of shared vs. isolated > memory spaces. If you just type up idiomatic Erlang OTP code, you have > to go out of your way to not have a bulletproof server; if you just type > up idiomatic Go code it's on you to make sure you're not excessively > sharing state and that you aren't going to see your entire server doing > tens of thousands of things come down due to one unhandled exception. Go > programmers need to be more worried about error handling in practice > than Erlang programmers, since Erlang programmers aren't facing the > termination of the entire world if they screw up one thing. > > There's also a recurring pattern in newer language advocates in which > they will in one year claim it's a good thing that they don't have X, > and next year tout to the high heavens how wonderful it is that they > just implemented X. I went around with the Haskell world on a couple of > those issues ("no, strings are not linked lists of numbers", "yes they > are you're just not thinking functionally and inductively dude, and by > the way, six months later, check out this totally radical ByteString > library, and when that still turns out not to be stringy enough hey, > check out Data.Text six months later..."). Thinking you can get away > without OTP is likely to be one of those for Go. No. You need it, though > I have questions about whether it can even be built in Go, because one > of the other actual differences between the languages... > > ... which is Channels vs. Processes. Go has channels, but you can't tell > who or what has them, and there's no such thing as a "goroutine > reference". By contrast, Erlang has processes, but no way to tell what > messages they may send or receive, and there's no such thing as a > "channel". Again, this has major impacts on how the system is > structured, in particular because it is meaningful to talk about how to > restart a "process" in a way that it is not meaningful to talk about how > to restart a "channel". > > Go advocates desperately, desperately need to avoid the temptation to > explain to themselves why Erlang isn't as good, because then they'll > fail to learn the lessons that Erlang learned the easy way. There's a > lot of ways to improve on Erlang, but let me tell you that despite those > opportunities, Erlang as a language is one of the wisest languages > around, you do not want to try to exceed it by starting from scratch. > Learn from it, please , I want a better Erlang than Erlang, but talking > yourself into how Go is already better than Erlang isn't going to get > you there. > > > > > > > > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.james.barry@REDACTED Fri Mar 29 22:03:50 2013 From: paul.james.barry@REDACTED (Paul Barry) Date: Fri, 29 Mar 2013 21:03:50 +0000 Subject: [erlang-questions] Erlang4android issue on Nexus In-Reply-To: References: <514F4C54.40005@ernovation.com> Message-ID: Oh, man. [Lets out a long, low moan]. Turns out all I had to do was think about what I was trying to do... And then it came to me: I was trying to install onto the Nexus 7 while logged in as me, as opposed to the "owner" of the device (who just happens to be my wife). When I install E4A as the owner, everything works a treat. I can even run the shell when logged in as me. Now all I have to do is stop feeling so foolish. :-( Paul. -- Paul Barry Lecturer, IT Carlow, Ireland paul.barry@REDACTED - http://paulbarry.itcarlow.ie On 28 Mar 2013 16:50, "Paul Barry" wrote: > Hi Erik. > > Thanks for your reply. > > When I try to run the Erlang shell from the sl4a menu, I get the same > error: Erlang/OTP exited. > > I downloaded a file manager to take a look around the filesystem.... The > com.ernovation.erlangforandroid folder does not live in /data/data/, but in > /storage/emulated/11/, and it contains only a single file: the ZIP of the > Erlang download. This is in spite of the installer telling me that the > downloaded file was extracted. When I manually unzip it, it makes no > difference... I get the same error message. Also I can't manually run > "erl" as the exec-bit is not set. :-( > > Not sure what to try next, but I really don't want to root this thing (my > kids would kill me for wiping their data). > > Any suggestions? > > Paul. > -- > Paul Barry > Lecturer, IT Carlow, Ireland > paul.barry@REDACTED - http://paulbarry.itcarlow.ie > On 24 Mar 2013 18:56, "Erik Reitsma" wrote: > >> Hi Paul, >> >> E4A does not require you to root the device. I use it on a non-rooted >> device myself, but not on a Nexus. >> Have you tried starting an interactive Erlang shell from SL4A? E4A is not >> intended to be started from outside SL4A, however, you can start E4A from >> the shell: >> >> /data/data/com.ernovation.erlangforandroid/files/erlang/bin/erl >> >> If you start E4A like that, you cannot use the SL4A APIs. >> >> *Erik. >> >> On 03/23/2013 02:46 PM, Paul Barry wrote: >> >> Thanks, John. I recall reading somewhere that E4A doesn't require me to >> root the device.... But, your email has given me hope as well as a few >> pointers to explore. >> >> Paul. >> On Mar 23, 2013 1:09 PM, "John Kemp" wrote: >> >>> Hi Paul, >>> >>> I am running Erlang4Android on a Nexus 7, and it works fine. I followed >>> exactly the instructions for installing on the device. Are you running E4A >>> from a BusyBox or over ADB shell? Have you 'rooted' the Nexus 7? E4A >>> doesn't require that AFAIK, but it might make a difference (BusyBox install >>> did require it). >>> >>> JohnK >>> >>> On Mar 23, 2013, at 4:06 AM, Paul Barry wrote: >>> >>> > Hi all. >>> > >>> > I've been playing with one of the new Nexus 7" tablets and I have sl4a >>> installed and running fine (with Python). However, when I install the >>> Erlang4android stuff from code.google.com, I get an "exited" console >>> message whenever I try to run anything (e.g., client.erl from the example). >>> > >>> > I can see from other messages on this list that others have got this >>> working on other devices... But has anybody tried it on a Nexus, and if you >>> did, how did you get on? >>> > >>> > Thanks, >>> > >>> > Paul. >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> _______________________________________________ >> 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 ok@REDACTED Sat Mar 30 10:55:00 2013 From: ok@REDACTED (ok@REDACTED) Date: Sat, 30 Mar 2013 22:55:00 +1300 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: Message-ID: <15fe61f45a9e83a0bd5d8be299053d21.squirrel@chasm.otago.ac.nz> > Hi, > > As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> > [term()]. > > However, a = lists:append([], a). > > Shouldn't it return [a]? Since you violated the precondition (the second argument is not a list of terms) you have no right to expect the postcondition (that the result is a list) to be true. Besides, why *should* the result be [a] rather than [] or [[[[a]]]] or [97] or anything else? Given that the definition that applies to _all_ cases is (an accelerated version of) append([X|Xs], Ys) -> [X|append(Xs, Ys)]; append([], Ys) -> Ys. how *could* the result be [a]? From ok@REDACTED Sat Mar 30 10:58:51 2013 From: ok@REDACTED (ok@REDACTED) Date: Sat, 30 Mar 2013 22:58:51 +1300 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: <638e9f590e760161ab1c71be439c8c3a.squirrel@chasm.otago.ac.nz> > The spec says both arguments and the result are lists. > Indeed there is a contradiction with said spec. Isn't that a problem? No, there isn't any contradiction with the specification. It says "*IF* the arguments to append are lists, the result will be a list". It doesn't say "I promise to change reality so that no matter what you do the arguments will be lists". From ok@REDACTED Sat Mar 30 11:10:27 2013 From: ok@REDACTED (ok@REDACTED) Date: Sat, 30 Mar 2013 23:10:27 +1300 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> Message-ID: <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> >> It's not a contradiction, as kostis noted specs are not complete >> enumerations of all possible argument types. > > Well, lists:append/2 asks for a list() as a second argument. Shouldn't > it badarg when I give it 'a', as in lists:append([], a) ? Why? Remember that the definition append([X|Xs], Ys) -> [X|append(Xs, Ys)]; append([], Ys) -> Ys. is primary. That has been around since day 1. The spec is a very late addition indeed which is a useful apprimation of the original behaviour, and says *NOTHING* about what will happen if you violate the precondition. This definition of append is a historic one from Lisp: Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8632)! ? (append '(a b) 'c) (A B . C) and Scheme: Gambit v4.4.3 > (append '(a b) 'c) (a b . c) It's essentially the same as what's found in Prolog: ?- append([a,b], c, Zs). Zs = [a, b|c]. Remember, a function specification says what the result will be *IF* the arguments have a certain form, and says *NOTHING* about the behaviour of the function if they do not. From yueyoum@REDACTED Sat Mar 30 12:29:00 2013 From: yueyoum@REDACTED (=?UTF-8?B?5pyI5b+n6IyX?=) Date: Sat, 30 Mar 2013 19:29:00 +0800 Subject: [erlang-questions] Socks5 proxy in my implementaion Message-ID: https://github.com/yueyoum/make-proxy Newbie to erlang, welcome any suggestions. Details see github repo -- My GitHub https://github.com/yueyoum My Blog http://codeshift.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From wmacgyver@REDACTED Sat Mar 30 12:44:41 2013 From: wmacgyver@REDACTED (Wilson MacGyver) Date: Sat, 30 Mar 2013 07:44:41 -0400 Subject: [erlang-questions] Getting erlang represented in framework benchmark Message-ID: <7374C66E-9452-4E94-80FE-ADA1E98EEAFE@gmail.com> I saw this generating quite a bit of buzz. They are accepting pull request. Maybe a good way to promote erlang. http://www.techempower.com/blog/2013/03/28/framework-benchmarks/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sat Mar 30 12:55:36 2013 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 30 Mar 2013 12:55:36 +0100 Subject: [erlang-questions] Getting erlang represented in framework benchmark In-Reply-To: <7374C66E-9452-4E94-80FE-ADA1E98EEAFE@gmail.com> References: <7374C66E-9452-4E94-80FE-ADA1E98EEAFE@gmail.com> Message-ID: <5156D2B8.1090108@ninenines.eu> On 03/30/2013 12:44 PM, Wilson MacGyver wrote: > I saw this generating quite a bit of buzz. They are accepting pull request. > Maybe a good way to promote erlang. > > http://www.techempower.com/blog/2013/03/28/framework-benchmarks/ It would be much more interesting to see benchmarks that evaluate response latency or maximum number of concurrent connections. Or a combination of both. That's where Erlang will really shine. Requests/s is boring (and absolutely doesn't mean one server is faster than another!), especially with keep-alive. As I mentioned in my talk in SF, requests/s benchmarks weren't able to show any performance increase in recent Cowboy versions, despite production nodes being able to handle 2 times more traffic than older versions. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From gleber.p@REDACTED Sat Mar 30 13:23:38 2013 From: gleber.p@REDACTED (Gleb Peregud) Date: Sat, 30 Mar 2013 13:23:38 +0100 Subject: [erlang-questions] Getting erlang represented in framework benchmark In-Reply-To: <5156D2B8.1090108@ninenines.eu> References: <7374C66E-9452-4E94-80FE-ADA1E98EEAFE@gmail.com> <5156D2B8.1090108@ninenines.eu> Message-ID: > It would be much more interesting to see benchmarks that evaluate response > latency or maximum number of concurrent connections. Or a combination of > both. That's where Erlang will really shine. > > Requests/s is boring (and absolutely doesn't mean one server is faster than > another!), especially with keep-alive. As I mentioned in my talk in SF, > requests/s benchmarks weren't able to show any performance increase in > recent Cowboy versions, despite production nodes being able to handle 2 > times more traffic than older versions. https://github.com/TechEmpower/FrameworkBenchmarks/issues/36 Feel free to add more comments there From pierrefenoll@REDACTED Sat Mar 30 13:47:50 2013 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Sat, 30 Mar 2013 13:47:50 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> Message-ID: Well, as Norton said, I was just expecting a badarg to get thrown. Here nothing gets thrown thus a bug gets harder to find? On 30 March 2013 11:10, wrote: > >> It's not a contradiction, as kostis noted specs are not complete > >> enumerations of all possible argument types. > > > > Well, lists:append/2 asks for a list() as a second argument. Shouldn't > > it badarg when I give it 'a', as in lists:append([], a) ? > > Why? > Remember that the definition > append([X|Xs], Ys) -> [X|append(Xs, Ys)]; > append([], Ys) -> Ys. > is primary. That has been around since day 1. The spec > is a very late addition indeed which is a useful apprimation > of the original behaviour, and says *NOTHING* about what > will happen if you violate the precondition. > > This definition of append is a historic one from Lisp: > Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8632)! > ? (append '(a b) 'c) > (A B . C) > and Scheme: > Gambit v4.4.3 > > (append '(a b) 'c) > (a b . c) > It's essentially the same as what's found in Prolog: > ?- append([a,b], c, Zs). > Zs = [a, b|c]. > > Remember, a function specification says what the result will > be *IF* the arguments have a certain form, and says *NOTHING* > about the behaviour of the function if they do not. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Sat Mar 30 14:26:01 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sat, 30 Mar 2013 14:26:01 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> Message-ID: Well, Doesn't Dialyzer complain if it discover you don't give lists:append/2 two lists? That's the whole point of specs, right? Regards, -- Anthony Ramine Le 30 mars 2013 ? 13:47, Pierre Fenoll a ?crit : > Well, as Norton said, I was just expecting a badarg to get thrown. > Here nothing gets thrown thus a bug gets harder to find? > > > On 30 March 2013 11:10, wrote: >>> It's not a contradiction, as kostis noted specs are not complete >>> enumerations of all possible argument types. >> >> Well, lists:append/2 asks for a list() as a second argument. Shouldn't >> it badarg when I give it 'a', as in lists:append([], a) ? > > Why? > Remember that the definition > append([X|Xs], Ys) -> [X|append(Xs, Ys)]; > append([], Ys) -> Ys. > is primary. That has been around since day 1. The spec > is a very late addition indeed which is a useful apprimation > of the original behaviour, and says *NOTHING* about what > will happen if you violate the precondition. > > This definition of append is a historic one from Lisp: > Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8632)! > ? (append '(a b) 'c) > (A B . C) > and Scheme: > Gambit v4.4.3 >> (append '(a b) 'c) > (a b . c) > It's essentially the same as what's found in Prolog: > ?- append([a,b], c, Zs). > Zs = [a, b|c]. > > Remember, a function specification says what the result will > be *IF* the arguments have a certain form, and says *NOTHING* > about the behaviour of the function if they do not. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From n.oxyde@REDACTED Sat Mar 30 14:48:52 2013 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sat, 30 Mar 2013 14:48:52 +0100 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> Message-ID: <7958C6DF-35BB-4FEC-8BE8-DC38FBC297CA@gmail.com> Well, Doesn't Dialyzer complain if it discover you don't give lists:append/2 two lists? That's the whole point of specs, right? Regards, -- Anthony Ramine Le 30 mars 2013 ? 13:47, Pierre Fenoll a ?crit : > Well, as Norton said, I was just expecting a badarg to get thrown. > Here nothing gets thrown thus a bug gets harder to find? > > > On 30 March 2013 11:10, wrote: >>> It's not a contradiction, as kostis noted specs are not complete >>> enumerations of all possible argument types. >> >> Well, lists:append/2 asks for a list() as a second argument. Shouldn't >> it badarg when I give it 'a', as in lists:append([], a) ? > > Why? > Remember that the definition > append([X|Xs], Ys) -> [X|append(Xs, Ys)]; > append([], Ys) -> Ys. > is primary. That has been around since day 1. The spec > is a very late addition indeed which is a useful apprimation > of the original behaviour, and says *NOTHING* about what > will happen if you violate the precondition. > > This definition of append is a historic one from Lisp: > Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8632)! > ? (append '(a b) 'c) > (A B . C) > and Scheme: > Gambit v4.4.3 >> (append '(a b) 'c) > (a b . c) > It's essentially the same as what's found in Prolog: > ?- append([a,b], c, Zs). > Zs = [a, b|c]. > > Remember, a function specification says what the result will > be *IF* the arguments have a certain form, and says *NOTHING* > about the behaviour of the function if they do not. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jon@REDACTED Sat Mar 30 15:58:54 2013 From: jon@REDACTED (Jonathan Schneider) Date: Sat, 30 Mar 2013 14:58:54 +0000 Subject: [erlang-questions] On upgrading Message-ID: I have a few questions about upgrading. soft_purge/1 must know at some level which processes are still running the old version of a module. Does this function have a friend that returns a list of identifiers of processes that are getting in the way (that would die in a subsequent module load) ? The problem case is where a process has called through the module that wants upgrading and can't easily be tickled to let go of it. Obviously one would try not to have code arranged like that. Would it be possible to support not one but arbitrary old versions of modules ? Admittedly I don't understand the VM's workings but it seems to be the cost would be memory taken up by beam code. Was this ever considered during Erlang's design or indeed for the future ? Thanks, Jon From norton@REDACTED Sat Mar 30 16:16:50 2013 From: norton@REDACTED (Joseph Wayne Norton) Date: Sun, 31 Mar 2013 00:16:50 +0900 Subject: [erlang-questions] Wrong advertised spec of lists:append/2 In-Reply-To: References: <49ACDDF7-A281-4BC9-AEFA-98DF62417A3A@mtod.org> <62b9ab113d85f65a5f0c52a30efc134a.squirrel@chasm.otago.ac.nz> Message-ID: <8019FDBC-999C-47D4-AF7B-8AEBD597ABDC@lovely.email.ne.jp> Just for the record (unless there is another Norton). I am only expecting dialyzer to emit a warning. I am not expecting badarg to get thrown. Joe N. On 2013/03/30, at 21:47, Pierre Fenoll wrote: > Well, as Norton said, I was just expecting a badarg to get thrown. > Here nothing gets thrown thus a bug gets harder to find? From erlang@REDACTED Sat Mar 30 20:25:59 2013 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 30 Mar 2013 20:25:59 +0100 Subject: [erlang-questions] On upgrading In-Reply-To: References: Message-ID: When Erlang was designed we had very little memory compared to today. A few MBytes total compared to GBytes today. That's why there are only two versions of a module. Today I'd go for an arbitrary number and use GC to remove unused code. Cheers /Joe On Sat, Mar 30, 2013 at 3:58 PM, Jonathan Schneider wrote: > I have a few questions about upgrading. > > soft_purge/1 must know at some level which processes are still running the > old version of a module. Does this function have a friend that returns a > list of identifiers of processes that are getting in the way (that would > die in a subsequent module load) ? > > The problem case is where a process has called through the module that > wants upgrading and can't easily be tickled to let go of it. Obviously one > would try not to have code arranged like that. > > Would it be possible to support not one but arbitrary old versions of > modules ? Admittedly I don't understand the VM's workings but it seems to > be the cost would be memory taken up by beam code. Was this ever considered > during Erlang's design or indeed for the future ? > > Thanks, > > Jon > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Sat Mar 30 23:17:26 2013 From: matthias@REDACTED (Matthias Lang) Date: Sat, 30 Mar 2013 23:17:26 +0100 Subject: [erlang-questions] On upgrading In-Reply-To: References: Message-ID: <20130330221726.GA30400@corelatus.com> Hi, On Saturday, March 30, Jonathan Schneider wrote: > soft_purge/1 must know at some level which processes are still > running the old version of a module. Does this function have a > friend that returns a list of identifiers of processes that are > getting in the way (that would die in a subsequent module load) ? The closest I know of is erlang:check_process_code(Pid, Module). Here's a one-liner which does what you want, in this case for the 'io' module: lists:filter(fun(P) -> erlang:check_process_code(P, io) end, erlang:processes()). > The problem case is where a process has called through the module > that wants upgrading and can't easily be tickled to let go of > it. Obviously one would try not to have code arranged like that. Exactly. Don't do that. > Would it be possible to support not one but arbitrary old versions > of modules? Probably a bunch of work. For well-behaved code, e.g. a gen_server, having arbitrary old versions (AOV) won't make a difference; you'll only ever run old code for a very short time. One case where AOV would make a difference: code which which is "eventually" well-behaved. Imagine a process blocked in gen_tcp:accept/1. You've loaded debug code into a live system and now want to re-load the regular code and go home, but can't until the next TCP connect happens. A pragmatic way out of this example is to generate a TCP connect. There are other examples where you can't do that, e.g. code blocked in gen_tcp:recv/2. With AOV, such a system will drop from running three versions of the code to two, and then back to one. But that's not clearly better than going home after starting something like: wait_and_hope() -> timer:sleep(5000), case code:soft_purge(my_module) of true -> load_new_code(); false -> wait_and_hope() end. Maybe someone has a more compelling real-world example. Matt From mjtruog@REDACTED Sun Mar 31 07:01:13 2013 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 30 Mar 2013 22:01:13 -0700 Subject: [erlang-questions] [ANN] CloudI 1.2.1 Released! Message-ID: <5157C319.2060904@gmail.com> Download 1.2.1 from http://bit.ly/H8WhYU What is CloudI? A Cloud at the lowest level! CloudI (http://cloudi.org) is a "universal integrator" using an Erlang core, with its actor model, to pursue efficiency, fault-tolerance and scalability. The CloudI API provides a minimal interface to communicate among actors that are called services, so programming language agnostic, database agnostic, and messaging bus agnostic integration can occur. CloudI currently integrates with the programming languages Erlang, C/C++, Java, Python, and Ruby, the databases PostgreSQL, MySQL, couchdb, memcached, and tokyotyrant, the messaging bus ZeroMQ and the internal CloudI messaging. HTTP is also supported for easy integration with cowboy. If anyone is willing to get involved, don't hesitate to contact me or start looking at the code. This release focused on performance issues based on loadtesting and profiling. The latest loadtest results are summarized at http://bit.ly/ZPWojG . The gory details are below: * Performance issues with the version 1.2.0 release were addressed here. It became clear after loadtesting that using a single Erlang process instead of two Erlang processes for each internal service caused much more latency under heavy load for internal services that receive a large amount of throughput. While this may be an obvious conclusion, the latency was judged to be significant after loadtesting, so duo_mode was added as an internal service configuration option to provide a service with two Erlang processes instead of a single Erlang process (which provides performance similar to what was seen previous to version 1.2.0, but with slightly less latency, caveat: python_c suffered due to changes for the request timeout adjustment). The duo_mode option being set to true makes sure to provide an Erlang process for receiving service requests while the main Erlang process handles sending service requests, so that the service messaging flow is able to more fully exploit the Erlang VM scheduling (i.e., duo_mode is a duplex communication mode). * The exception handling overhead has become a source of latency under load when using the request_timeout_adjustment. The request_timeout_adjustment being set to false avoids the extra latency for all CloudI API implementations except python_c (so the python_c performance gains were sacrificed due to usage of python exception handling, with the version 1.2.0 release). So, the python_c latency will be addressed in the next release. * Added more service configuration options: * request_pid_uses, request_pid_options, info_pid_uses, info_pid_options - to provide more control over internal service garbage collection characteristics * duo_mode - to provide better performance for high-throughput internal services * response_timeout_adjustment - to avoid latency typical with the erlang:cancel_timer/1 function call * cowboy was updated to 0.8.2 and misultin was removed * loadtests were done to verify the reduced latency and to test the new service configuration options (results+config are at src/tests/http_req/loadtest/results_v1_2_1/) * ZeroMQ integration received more testing and changes to make it more robust Please mention any problems, issues, or ideas! Thanks, Michael From arrogantparagon@REDACTED Fri Mar 29 16:56:43 2013 From: arrogantparagon@REDACTED (Scott Baldwin) Date: Fri, 29 Mar 2013 11:56:43 -0400 Subject: [erlang-questions] ssl_upgrade_failure with particular SSL certificate Message-ID: I am trying to configure SSL for connections to my RabbitMQ broker. I realize that this is not the RabbitMQ mailing list, but I think that my problem is related specifically to Erlang's SSL implementation. I was able to get it working with a certificate/key pair created directly with OpenSSL; however, when I converted a certificate made with makecert.exe to PEM format and try to use that, the client fails to connect and the server logs an ssl_upgrade_failure. It seems that there is something about my certificate that Erlang doesn't like. I am using Erlang R16B. Here is my certificate: -----BEGIN CERTIFICATE----- MIIDTzCCAjugAwIBAgIQYuux7Ob2BL5PUnDLgT/igTAJBgUrDgMCHQUAMCgxJjAk BgNVBAMTHUVsbGtheSBTdGFnaW5nIFJvb3QgQXV0aG9yaXR5MB4XDTEyMDgxNTE1 MTMzN1oXDTM5MTIzMTIzNTk1OVowMzExMC8GA1UEAx4oACoALgBsAGsAYwBsAG8A dQBkAHMAdABhAGcAaQBuAGcALgBjAG8AbTCCASIwDQYJKoZIhvcNAQEBBQADggEP ADCCAQoCggEBANhryzuSNbDOUVqD7Oby/z+JNjICGemlpP0qmcAZ8JbE7ci/l5eu BYwIyKy/LvjYYV6Z8ZlMKIbzmEgKxGCmSZjTcg08QXxG7CXpJfls/1ycv8Le7Tz0 ep2mzBnFhkOCNDQz2zAOiI/K6gwB0D2tv3O+j3ytnME8w+To5epzZSnfGHRIutQ4 jC7rVz8T1oLixYynQ39tG6L5ALmu5u1DZTRYmzaIbF16c6dy1m8OCqAvQ3LnykZq rukjjaLDlJT6ZbUUXaZeGS2avf8ZM0f+HlrdDR+IFC/CxipxzHa6kStc+1dZVgqj jT7ql9nEQ/8DaXmF4C749ELbtWOlSB/ElwUCAwEAAaNyMHAwEwYDVR0lBAwwCgYI KwYBBQUHAwEwWQYDVR0BBFIwUIAQx8ryGLLGJ2Qr6NrWGYDWT6EqMCgxJjAkBgNV BAMTHUVsbGtheSBTdGFnaW5nIFJvb3QgQXV0aG9yaXR5ghAu7ZXj5fLAu0CXveR3 xHi0MAkGBSsOAwIdBQADggEBACiAPScOR/DViwY4ZDVSxeGFqezh6ubWt4aqrYlt h6ODWF1T0uUjf/VKksPtXlAxAz1F7IHmf80VAGPY18ZmH9JvnVz67PdGcKi6RMHY vpBT79vbv0/+9TXxdIl2+qafuVb5ckmSlq1pIslnlZszt32pwrSYDvLihfRLStvV MzKtUGRsug/eUeuCQBAalAHmuNh77bC6Bnp2ZMg/7HEb0bqXQS1mOupiN3Ylpe/y r3pT7+xLzyzX4NY7GyYVO2VPnz2kvNbrTsTPWO7y1NQc3tDbRIwQeCqpYditByVN cS/zgODqcpH1NipIfL/JTMFvA5O0jlgpSQDbRxiQELjJ9ms= -----END CERTIFICATE----- Here is the relevant part of the log from RabbitMQ: =INFO REPORT==== 28-Mar-2013::20:46:52 === accepting AMQP connection <0.301.0> (192.168.51.234:50804 -> 192.168.51.153:5671) =ERROR REPORT==== 28-Mar-2013::20:46:52 === ** State machine <0.302.0> terminating ** Last message in was {tcp,#Port<0.15153>, <<22,3,0,0,53,1,0,0,49,3,0,81,84,228,150,220,41, 203,120,104,165,175,147,215,108,167,136,54,238, 178,50,70,122,181,212,166,114,251,121,27,202,52, 143,0,0,10,0,5,0,10,0,19,0,4,0,255,1,0>>} ** When State == hello ** Data == {state,server, {#Ref<0.0.0.1972>,<0.301.0>}, gen_tcp,tcp,tcp_closed,tcp_error,"localhost",5671, #Port<0.15153>, {ssl_options,[],verify_none, {#Fun,[]}, false,false,undefined,1, <<"C:/Users/ScottB/AppData/Roaming/RabbitMQ/lkcloudstaging_cer.pem">>, undefined, <<"C:/Users/ScottB/AppData/Roaming/RabbitMQ/server/key.pem">>, undefined,undefined,undefined,<<>>,undefined, undefined, [<<0,107>>, <<0,106>>, <<0,61>>, <<0,103>>, <<0,64>>, <<0,60>>, <<0,57>>, <<0,56>>, <<0,53>>, <<0,22>>, <<0,19>>, <<0,10>>, <<0,51>>, <<0,50>>, <<0,47>>, <<0,5>>, <<0,4>>, <<0,21>>, <<0,9>>], #Fun,true,268435456,false,undefined, undefined,false,undefined,undefined}, {socket_options,binary,0,0,0,false}, {connection_states, {connection_state, {security_parameters, <<0,0>>, 0,0,0,0,0,0,0,0,0,0,0,undefined,undefined, undefined,undefined}, undefined,undefined,undefined,0,undefined, undefined,undefined}, {connection_state, {security_parameters,undefined,0,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined, <<81,84,228,124,31,218,166,3,48,108,125,182, 121,180,129,153,59,55,16,200,98,117,189,183, 170,169,208,189,111,61,67,162>>, undefined}, undefined,undefined,undefined,undefined, undefined,undefined,undefined}, {connection_state, {security_parameters, <<0,0>>, 0,0,0,0,0,0,0,0,0,0,0,undefined,undefined, undefined,undefined}, undefined,undefined,undefined,0,undefined, undefined,undefined}, {connection_state, {security_parameters,undefined,0,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined,undefined, undefined,undefined,undefined, <<81,84,228,124,31,218,166,3,48,108,125,182, 121,180,129,153,59,55,16,200,98,117,189,183, 170,169,208,189,111,61,67,162>>, undefined}, undefined,undefined,undefined,undefined, undefined,undefined,undefined}}, [],<<>>,<<>>, {[],[]}, [],311374, {session,undefined,undefined, <<48,130,3,79,48,130,2,59,160,3,2,1,2,2,16,98,235,177, 236,230,246,4,190,79,82,112,203,129,63,226,129,48,9, 6,5,43,14,3,2,29,5,0,48,40,49,38,48,36,6,3,85,4,3, 19,29,69,108,108,107,97,121,32,83,116,97,103,105, 110,103,32,82,111,111,116,32,65,117,116,104,111,114, 105,116,121,48,30,23,13,49,50,48,56,49,53,49,53,49, 51,51,55,90,23,13,51,57,49,50,51,49,50,51,53,57,53, 57,90,48,51,49,49,48,47,6,3,85,4,3,30,40,0,42,0,46, 0,108,0,107,0,99,0,108,0,111,0,117,0,100,0,115,0, 116,0,97,0,103,0,105,0,110,0,103,0,46,0,99,0,111,0, 109,48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1, 1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,216,107, 203,59,146,53,176,206,81,90,131,236,230,242,255,63, 137,54,50,2,25,233,165,164,253,42,153,192,25,240, 150,196,237,200,191,151,151,174,5,140,8,200,172,191, 46,248,216,97,94,153,241,153,76,40,134,243,152,72, 10,196,96,166,73,152,211,114,13,60,65,124,70,236,37, 233,37,249,108,255,92,156,191,194,222,237,60,244, 122,157,166,204,25,197,134,67,130,52,52,51,219,48, 14,136,143,202,234,12,1,208,61,173,191,115,190,143, 124,173,156,193,60,195,228,232,229,234,115,101,41, 223,24,116,72,186,212,56,140,46,235,87,63,19,214, 130,226,197,140,167,67,127,109,27,162,249,0,185,174, 230,237,67,101,52,88,155,54,136,108,93,122,115,167, 114,214,111,14,10,160,47,67,114,231,202,70,106,174, 233,35,141,162,195,148,148,250,101,181,20,93,166,94, 25,45,154,189,255,25,51,71,254,30,90,221,13,31,136, 20,47,194,198,42,113,204,118,186,145,43,92,251,87, 89,86,10,163,141,62,234,151,217,196,67,255,3,105, 121,133,224,46,248,244,66,219,181,99,165,72,31,196, 151,5,2,3,1,0,1,163,114,48,112,48,19,6,3,85,29,37,4, 12,48,10,6,8,43,6,1,5,5,7,3,1,48,89,6,3,85,29,1,4, 82,48,80,128,16,199,202,242,24,178,198,39,100,43, 232,218,214,25,128,214,79,161,42,48,40,49,38,48,36, 6,3,85,4,3,19,29,69,108,108,107,97,121,32,83,116,97, 103,105,110,103,32,82,111,111,116,32,65,117,116,104, 111,114,105,116,121,130,16,46,237,149,227,229,242, 192,187,64,151,189,228,119,196,120,180,48,9,6,5,43, 14,3,2,29,5,0,3,130,1,1,0,40,128,61,39,14,71,240, 213,139,6,56,100,53,82,197,225,133,169,236,225,234, 230,214,183,134,170,173,137,109,135,163,131,88,93, 83,210,229,35,127,245,74,146,195,237,94,80,49,3,61, 69,236,129,230,127,205,21,0,99,216,215,198,102,31, 210,111,157,92,250,236,247,70,112,168,186,68,193, 216,190,144,83,239,219,219,191,79,254,245,53,241, 116,137,118,250,166,159,185,86,249,114,73,146,150, 173,105,34,201,103,149,155,51,183,125,169,194,180, 152,14,242,226,133,244,75,74,219,213,51,50,173,80, 100,108,186,15,222,81,235,130,64,16,26,148,1,230, 184,216,123,237,176,186,6,122,118,100,200,63,236, 113,27,209,186,151,65,45,102,58,234,98,55,118,37, 165,239,242,175,122,83,239,236,75,207,44,215,224, 214,59,27,38,21,59,101,79,159,61,164,188,214,235,78, 196,207,88,238,242,212,212,28,222,208,219,68,140,16, 120,42,169,97,216,173,7,37,77,113,47,243,128,224, 234,114,145,245,54,42,72,124,191,201,76,193,111,3, 147,180,142,88,41,73,0,219,71,24,144,16,184,201,246, 107>>, undefined,undefined,undefined,new,63531722812}, 323665,ssl_session_cache,undefined,undefined,false, undefined,undefined,undefined, {'RSAPrivateKey','two-prime', 25091000490399564416382733665912293706281236323287507449391018333858706088067104372951637210440828548699801793107621328582247328739957168356535343760898421117596223923057958675108280840952652110424468556362893842108742460936250265912296002218912760264533284800177616747391132407486580757942725318853670784742540298023139943942002078742079335138046822007139070167779479715409389988021492873379536675527198388004784204705449619014967663111341423672277165259908002197645143645833929707716094821495848245665580802072300300901995696081299311434728567907957618159230597695337971845318310069905698028328520007565703331606819, 65537, 12532291835951284642352753464759952731760837234028003552929880741268762456120795803045590924921343389430997938501684187097537025786559622030041471881063352256944852432936802405831735737793065202597533511207149656340503466992496089298764016305810310122514496309703131156584850210212028846765905833153120519214366483351036620512028360903366902227866159233021509892771286294064778569099266243884082209785268720465970929381008430443130075496396131177443808450873061131440124680376808011317874020764946935204300278562787258089499308485762628408971801392792765876969493808892573747399158232707154902628249712310347508330481, 164613524625768478096728511491146234379950805547018160443402940694931123301226530314268605486708880647658162742710176890755691202467149416112553065729831746391569481381229328262217225008710581122456985360175690217141752754366597025760074826970126144030433840076718674219450293036228318089528491377991378917023, 152423687831490839453627602007609954938806264385151113997291723876694061058672531571680491904693205860873313947735180318401018227463103944680073963443527347105243646402511993135691316201430837009543216841366727950952917475175355759283610454988240555587842851002909990207473661609226206434152468235025307200253, 103984547751379971996375538203182369609466154978729646218112491292391375460388439026510307132524542623745369476562226118076733144497574174552444945117251391868174999766567175194585209852993108440859312097378784492720927449807326399887717438420071901928924585277569562140638458907286206884483421800776127924467, 39507777060187907438527428403852332339678380351718296130002815409515266417499584872791499702229633458331247753638059539934359165508273901891762155988452310073344428665326017782260225343145179490686339388197454990354108505894437772295812911773276810317388444847741459078907412450309375905167279214922484907925, 140777917719684893441642072243040594921813463059778562021367548768326948139714681618402000290527139618053328133891840461484222782830228667641262369743730585486629970714763524415800836168519782394433537656246543908266747427470739521793087643652694808980372432733634387874662999415574210646072641560865328049441, asn1_NOVALUE}, {'DHParameter', 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 2,asn1_NOVALUE}, undefined,undefined,315471,#Ref<0.0.0.1974>,undefined, <<>>,true, {false,first}, {<0.301.0>,#Ref<0.0.0.1971>}, #Ref<0.0.0.1980>, {[],[]}, false,true,false,undefined} ** Reason for termination = ** {{badmatch, {error, {asn1, {'Type not compatible with table constraint', {{component,'Type'}, {value,{5,<<>>}}, {unique_name_and_value,id,{1,3,14,3,2,29}}}}}}}, [{public_key,pkix_decode_cert,2,[{file,"public_key.erl"},{line,218}]}, {ssl_cipher,filter,2,[{file,"ssl_cipher.erl"},{line,484}]}, {ssl_handshake,select_session,8,[{file,"ssl_handshake.erl"},{line,654}]}, {ssl_handshake,hello,4,[{file,"ssl_handshake.erl"},{line,178}]}, {ssl_connection,hello,2,[{file,"ssl_connection.erl"},{line,413}]}, {ssl_connection,next_state,4,[{file,"ssl_connection.erl"},{line,2001}]}, {gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,494}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} =ERROR REPORT==== 28-Mar-2013::20:46:52 === error on AMQP connection <0.301.0>: {ssl_upgrade_failure, {{{badmatch, {error, {asn1, {'Type not compatible with table constraint', {{component,'Type'}, {value,{5,<<>>}}, {unique_name_and_value,id, {1,3,14,3,2,29}}}}}}}, [{public_key,pkix_decode_cert,2, [{file,"public_key.erl"},{line,218}]}, {ssl_cipher,filter,2, [{file,"ssl_cipher.erl"},{line,484}]}, {ssl_handshake,select_session,8, [{file,"ssl_handshake.erl"}, {line,654}]}, {ssl_handshake,hello,4, [{file,"ssl_handshake.erl"}, {line,178}]}, {ssl_connection,hello,2, [{file,"ssl_connection.erl"}, {line,413}]}, {ssl_connection,next_state,4, [{file,"ssl_connection.erl"}, {line,2001}]}, {gen_fsm,handle_msg,7, [{file,"gen_fsm.erl"},{line,494}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,239}]}]}, {gen_fsm,sync_send_all_state_event, [<0.302.0>,{start,5000},infinity]}}} Note that this certificate/key pair was created for testing purposes only, but I am concerned that our production certificate/key pair will fail in similar fashion. Thanks, Scott -------------- next part -------------- An HTML attachment was scrubbed... URL: From colanderman@REDACTED Fri Mar 29 18:10:46 2013 From: colanderman@REDACTED (Chris King) Date: Fri, 29 Mar 2013 13:10:46 -0400 Subject: [erlang-questions] oe_obj? Message-ID: Hi, I'm playing around with IC and the c_client backend. All the generated stubs seem to want an "oe_obj" parameter of the type of my interface (which is typedef'd to CORBA_Object). My assumption is that this is analogous to the OE_THIS parameter required by the stubs generated by the erl_genserver backend (i.e. it's the gen_server's PID), but: 1) I see no function (analogous to oe_create/0,1,2) capable of generating such a value, unless I explicitly declare one in another interface (which of course has the same problem), and 2) this value seems to be unused by all the generated code. The c_client example seems to pass in NULL for this argument, instead obtaining the PID manually and storing it manually in the CORBA_Environment structure. This seems... odd. What am I missing? Why does oe_obj not do what I expect? Thanks, Chris From colanderman@REDACTED Sun Mar 31 00:26:06 2013 From: colanderman@REDACTED (Chris King) Date: Sat, 30 Mar 2013 19:26:06 -0400 Subject: [erlang-questions] oe_obj? In-Reply-To: References: Message-ID: (resend, original seems stuck in moderation?) Hi, I'm playing around with IC and the c_client backend. All the generated stubs seem to want an "oe_obj" parameter of the type of my interface (which is typedef'd to CORBA_Object). My assumption is that this is analogous to the OE_THIS parameter required by the stubs generated by the erl_genserver backend (i.e. it's the gen_server's PID), but: 1) I see no function (analogous to oe_create/0,1,2) capable of generating such a value, unless I explicitly declare one in another interface (which of course has the same problem), and 2) this value seems to be unused by all the generated code. The c_client example seems to pass in NULL for this argument, instead obtaining the PID manually and storing it manually in the CORBA_Environment structure. This seems... odd. What am I missing? Why does oe_obj not do what I expect? Thanks, Chris From mangalaman93@REDACTED Fri Mar 29 18:44:16 2013 From: mangalaman93@REDACTED (aman mangal) Date: Fri, 29 Mar 2013 23:14:16 +0530 Subject: [erlang-questions] Mnesia: Whether it is good for my application! help? Message-ID: Hi everyone, This is my first post on this forum! I am new to erlang, just started using it a month ago or so. Since I have come across erlang, I have become such a big fan of it that I have started working on a product in erlang for a company. Coming to the point, here is my question. I want to make a distributive application. There are multiple processes running on a node. The processes are divided in logical groups. Each group serves a specific purpose. Each group has some data(few tables) shared among the processes inside the group but not outside the group. Now my question is that whether to use mnesia or not to store the data? If I don't use mnesia, I'll store the data as state in a gen server processes running in the group. In that case I don't know how will I will keep back up of the data for the case when any node goes down. Also my database can grow as large as thousand tables each having hudred entries on a node. Is mnesia a good idea to use for such a large (I'm not sure whether it is large :P ) database? Is there any free alternative to mnesia? Please note that there is no inter node communication in order to get data except with the back up node! Please help. If anything is not clear, let me know. Thank you in advance Aman Mangal 3rd year Undergraduate Department of Computer Science & Engineering IIT Bombay www.cse.iitb.ac.in/~amanmangal -------------- next part -------------- An HTML attachment was scrubbed... URL: