From tobbe@REDACTED Tue Apr 19 00:30:55 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Tue, 19 Apr 2005 00:30:55 +0200 Subject: Supervisor hierarchy question In-Reply-To: References: <011820051548.12465.41ED2FB5000F0819000030B122007623029C079D050E03D20A07029D0A@comcast.net> Message-ID: <4264351F.80609@nortelnetworks.com> Would this code work with mysql as well ? Cheers, Tobbe Eric Merritt wrote: >That would actually rock. Its part of a larger codebase that I havn't >decided whether or not to open up. However, I have no problem at all >opening up the postgresql stuff. If you would like I will grant you >access to the subversion repository. If you can't get a subversion >client I will post it on the web somewhere. I don't actually expect to >get the driver to a usable state before the end of the week. > > >On Tue, 18 Jan 2005 15:48:06 +0000, ernie.makris@REDACTED > wrote: > > >>Hi Eric, >> >>I read the message about creating a client for postgresql in erlang. I am interested in helping you out, as I use postgresql from erlang and would be interested in such an interface. Can you post the code? I can help you test it if you'd like. >> >>Thanks >>Ernie >> >> >> > > > > From serge@REDACTED Fri Apr 1 00:09:30 2005 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 31 Mar 2005 17:09:30 -0500 Subject: Configuration update In-Reply-To: <424C696B.2090406@cisco.com> References: <20050331153924.3956@smtp.gmail.com> <424C696B.2090406@cisco.com> Message-ID: <424C751A.7010701@hq.idt.net> Is there a way to refresh the node/application's configuration by rereading the content of the sys.config (or application-specific config) file without restarting the node? Since the content of the config file becomes a part of the application's environment at node startup, I want to ensure that I can dynamically change the configuration (by making changes in the config file), and force the application to refresh its environment with the changes. What's the OTP-way to address this problem? Thanks. Serge P.S. I found an undocumented application_controller:change_application_data/2 function. Am I looking in the right direction? From tobbe@REDACTED Fri Apr 1 00:48:32 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 01 Apr 2005 00:48:32 +0200 Subject: Bit twiddling In-Reply-To: <20050331153924.3956@smtp.gmail.com> References: <20050331153924.3956@smtp.gmail.com> Message-ID: <424C7E40.3010806@nortel.com> Joel Reymont wrote: >Folks, > >What's the most effective way to do bit twiddling in Erlang? > >Should I convert the int into a list of bits? How would I efficiently do this? > >I'm looking to figure out the highest and lowest bit set in an integer as >well as count the number of bits set. > > Thanks, Joel > > > I'm not sure how efficient this is, but its an alternative to the solutions Thomas sent: -------------- Eshell V5.4.5 (abort with ^G) 1> I=2#10100101. 165 2> <> = <>. <<165>> 3> lists:foldl(fun(N,Acc) -> N+Acc end, 0, [A,B,C,D,E,F,G,H]). 4 ------------- Cheers, Tobbe From anders.nygren@REDACTED Fri Apr 1 01:58:04 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 31 Mar 2005 17:58:04 -0600 Subject: inets/http bug in R10B-4 Message-ID: Hi I am getting a crash in http with R10B-4, I never had this problem with R10B-2 SuSE Linux 9.2 Linux godot 2.6.8-24.13-default #1 Fri Mar 18 10:19:42 UTC 2005 i686 i686 i386 GNU/Linux Erlang (BEAM) emulator version 5.4.5 [source] [hipe] (smsgw@REDACTED)9> http:request(get,{"http://google.com",[]},[{timeout,1000}],[]). {ok,{{"HTTP/1.1",200,"OK"}, [{"date","Thu, 31 Mar 2005 23:47:31 GMT"}, ... more data But I also get =ERROR REPORT==== 31-Mar-2005::17:47:31 === ** Generic server <0.263.0> terminating ** Last message in was {tcp,#Port<0.319>, <<50,62,38,99,111,112,121,59,50,48,48,53,32,71,111,111,103,108,101,32,45,32,66,117,115,99,97,110,100,111,32,56,44,48,53,56,44,48,52,52,44,54,53,49,32,112,225,103,105,110,97,115,32,119,101,98,60,47,102,111,110,116,62,60,47,112,62,60,47,99,101,110,116,101,114,62,60,47,98,111,100,121,62,60,47,104,116,109,108,62,13,10,48,13,10,13,10>>} ** When Server state == {state,{request, #Ref<0.0.0.951>, <0.211.0>, 3, http, {"www.google.com.mx",80}, "/", [], get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "www.google.com.mx", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,1000,true,[],false}, "http://google.com"}, {tcp_session, {{"www.google.com.mx",80},<0.263.0>}, false, http, #Port<0.319>, 1}, {"HTTP/1.1",200,"OK"}, {http_response_h, undefined, undefined, "Thu, 31 Mar 2005 23:47:31 GMT", undefined, undefined, "chunked", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "GWS/2.1", undefined, undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, "text/html", undefined, undefined, [{"cache-control","private"}, {"set-cookie", "PREF=ID=66a1247f32127631:LD=es:TM=1112312851:LM=1112312851:S=nL_hpjFTzEzffYxo; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com.mx"}]}, undefined, {http_chunk, decode_data, [2228, <<60,104,116,109,108,62,60,104,101,97,100,62,60,109,101,116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,99,111 cut lots of ints 47,119,119,119,46,103,111,111,103,108,101,46,99,111,109,47,110,99,114,62,71,111,111,103,108,101,46,99,111,109,32,105,110,32,69,110,103,108,105,115,104,60,47,97,62,60,47,102,111,110,116,62,60,112,62,60,102,111,110,116,32,115,105,122,101,61,45>>, {nolimit,<<>>,2228,nolimit}]}, {[],[]}, new, [], nolimit, nolimit, {options,{undefined,[]},0,2,2,disabled}, {timers, [{#Ref<0.0.0.951>,#Ref<0.0.0.974>}], undefined}} ** Reason for termination == ** {{badmatch,#Ref<0.0.0.974>}, [{httpc_handler,answer_request,3}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} =CRASH REPORT==== 31-Mar-2005::17:47:31 === crasher: pid: <0.263.0> registered_name: [] error_info: {{badmatch,#Ref<0.0.0.974>}, [{httpc_handler,answer_request,3}, {httpc_handler,terminate,2}, {gen_server,terminate,6}, {proc_lib,init_p,5}]} initial_call: {gen,init_it, [gen_server, <0.129.0>, <0.129.0>, httpc_handler, [{request,#Ref<0.0.0.951>, <0.211.0>, 3, http, {"www.google.com.mx",80}, "/", [], get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "www.google.com.mx", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,1000,true,[],false}, "http://google.com"}, {options,{undefined,[]},0,2,2,disabled}], []]} ancestors: [httpc_manager,httpc_sup,inets_sup,<0.125.0>] messages: [] links: [<0.129.0>,#Port<0.319>] dictionary: [] trap_exit: true status: running heap_size: 2584 stack_size: 21 reductions: 2346 neighbours: (smsgw@REDACTED)10> /Anders Nygren From ok@REDACTED Fri Apr 1 03:58:02 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 1 Apr 2005 13:58:02 +1200 (NZST) Subject: Bit twiddling Message-ID: <200504010158.j311w2XX221600@atlas.otago.ac.nz> Create table: Table = list_to_tuple([0, 1, 1, ...]) Why not just write Table = {0, 1, 1, ...}? This isn't commented, but it may be of use. low_bit/1 could be extended to negative integers in a fairly uncontroversial way, but hasn't been. Bit indices are >= 0. -module(bits). -export([pop_count/1, high_bit/1, low_bit/1]). pop_count(N) when integer(N), N >= 0 -> pop_count_16(N, 0). pop_count_16(N, B) when N > 65535 -> pop_count_16(N bsr 16, pop_count_4(N, B)); pop_count_16(N, B) -> pop_count_4(N, B). pop_count_4(N, B) -> pop_count_t(N bsr 12) + pop_count_t((N bsr 8) band 15) + pop_count_t((N bsr 4) band 15) + pop_count_t(N band 15) + B. pop_count_t( 0) -> 0; pop_count_t( 1) -> 1; pop_count_t( 2) -> 1; pop_count_t( 3) -> 2; pop_count_t( 4) -> 1; pop_count_t( 5) -> 2; pop_count_t( 6) -> 2; pop_count_t( 7) -> 3; pop_count_t( 8) -> 1; pop_count_t( 9) -> 2; pop_count_t(10) -> 2; pop_count_t(11) -> 3; pop_count_t(12) -> 2; pop_count_t(13) -> 3; pop_count_t(14) -> 3; pop_count_t(15) -> 4. high_bit(N) when integer(N), N > 0 -> high_bit_16(N, 0); high_bit(0) -> -1. high_bit_16(N, B) when N > 65535 -> high_bit_16(N bsr 16, B + 16); high_bit_16(N, B) -> high_bit_4(N, B). high_bit_4(N, B) when N > 15 -> high_bit_4(N bsr 4, B + 4); high_bit_4(N, B) when N > 7 -> B + 3; high_bit_4(N, B) when N > 3 -> B + 2; high_bit_4(N, B) when N > 1 -> B + 1; high_bit_4(1, B) -> B. low_bit(N) when integer(N), N > 0 -> low_bit_16(N, 0); low_bit(0) -> -1. low_bit_16(N, B) when (N band 65535) == 0 -> low_bit_16(N bsr 16, B + 16); low_bit_16(N, B) -> low_bit_4(N, B). low_bit_4(N, B) when (N band 15) == 0 -> low_bit_4(N bsr 4, B + 4); low_bit_4(N, B) when (N band 7) == 0 -> B + 3; low_bit_4(N, B) when (N band 3) == 0 -> B + 2; low_bit_4(N, B) when (N band 1) == 0 -> B + 1; low_bit_4(1, B) -> B. % The end. From erlang@REDACTED Fri Apr 1 08:07:51 2005 From: erlang@REDACTED (Michael McDaniel) Date: Thu, 31 Mar 2005 22:07:51 -0800 Subject: inets/http bug in R10B-4 In-Reply-To: References: Message-ID: <20050401060751.GO10107@fangora.autosys.us> On Thu, Mar 31, 2005 at 05:58:04PM -0600, Anders Nygren wrote: > Hi > I am getting a crash in http with R10B-4, I never had this problem with R10B-2 > SuSE Linux 9.2 > > Linux godot 2.6.8-24.13-default #1 Fri Mar 18 10:19:42 UTC 2005 i686 > i686 i386 GNU/Linux > > Erlang (BEAM) emulator version 5.4.5 [source] [hipe] > > (smsgw@REDACTED)9> http:request(get,{"http://google.com",[]},[{timeout,1000}],[]). > {ok,{{"HTTP/1.1",200,"OK"}, > [{"date","Thu, 31 Mar 2005 23:47:31 GMT"}, > ... more data > > But I also get > > =ERROR REPORT==== 31-Mar-2005::17:47:31 === > ** Generic server <0.263.0> terminating > ** Last message in was {tcp,#Port<0.319>, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I get the same thing with that command, though the following works fine... 9> http:request(get,{"http://google.com",[]},[{trace_driver,on}],[]). I am using R10B-4 on Linux SuSE release 9.1 $ uname -a Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux ~Michael > > /Anders Nygren From joelr1@REDACTED Fri Apr 1 10:56:26 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 09:56:26 +0100 Subject: Bit twiddling In-Reply-To: <424C6AF5.8040804@cisco.com> References: <424C6AF5.8040804@cisco.com> Message-ID: <20050401095626.21652@smtp.gmail.com> >Mark Scandariato wrote: >> So, based on http://www-db.stanford.edu/~manku/bitcount/bitcount.html, >> something like these might do (for 32bit or smaller ints): Folks, A big thanks to all who replied! I now have a lot of solutions to choose from :D. Thanks, Joel -- http://wagerlabs.com/tech From thomasl_erlang@REDACTED Fri Apr 1 11:39:17 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 1 Apr 2005 01:39:17 -0800 (PST) Subject: Bit twiddling In-Reply-To: 6667 Message-ID: <20050401093917.59159.qmail@web41905.mail.yahoo.com> --- "Richard A. O'Keefe" wrote: > Create table: > Table = list_to_tuple([0, 1, 1, ...]) > > Why not just write Table = {0, 1, 1, ...}? > This isn't commented, but it may be of use. Er, good point. I seem to recall an intention to end up with something general, like: Table = list_to_tuple( [ count_bits(N) || N <- lists:seq(1,Max) ] ) but that got unaccountably lost on the way :-) Best, Thomas __________________________________ Yahoo! Messenger Show us what our next emoticon should look like. Join the fun. http://www.advision.webevents.yahoo.com/emoticontest From ingela@REDACTED Fri Apr 1 12:01:22 2005 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 1 Apr 2005 12:01:22 +0200 Subject: inets/http bug in R10B-4 References: Message-ID: <16973.7154.840390.427235@gargle.gargle.HOWL> Well that is a bug and not a very new one I am afraid it seems to have been lingering for quite a while. It has to do with canceling the timeout timer. So the request is successful and the answer is sent to the client. But the request handling process crashes while trying to clean up before terminating or perhaps handling an other request. I suppose it did wind it self through our automated test cases as the client gets the correct response and except for the crash report everything seems normal! In the case that you do not set a timeout you will not bump in to the bug. Of course this will be fixed! Anders Nygren wrote: > Hi > I am getting a crash in http with R10B-4, I never had this problem with R10B-2 > SuSE Linux 9.2 > > Linux godot 2.6.8-24.13-default #1 Fri Mar 18 10:19:42 UTC 2005 i686 > i686 i386 GNU/Linux > > Erlang (BEAM) emulator version 5.4.5 [source] [hipe] > > (smsgw@REDACTED)9> http:request(get,{"http://google.com",[]},[{timeout,1000}],[]). > {ok,{{"HTTP/1.1",200,"OK"}, > [{"date","Thu, 31 Mar 2005 23:47:31 GMT"}, > ... more data > > But I also get > > =ERROR REPORT==== 31-Mar-2005::17:47:31 === > ** Generic server <0.263.0> terminating > ** Last message in was {tcp,#Port<0.319>, > > <<50,62,38,99,111,112,121,59,50,48,48,53,32,71,111,111,103,108,101,32,45,32,66,117,115,99,97,110,100,111,32,56,44,48,53,56,44,48,52,52,44,54,53,49,32,112,225,103,105,110,97,115,32,119,101,98,60,47,102,111,110,116,62,60,47,112,62,60,47,99,101,110,116,101,114,62,60,47,98,111,100,121,62,60,47,104,116,109,108,62,13,10,48,13,10,13,10>>} > ** When Server state == {state,{request, > #Ref<0.0.0.951>, > <0.211.0>, > 3, > http, > {"www.google.com.mx",80}, > "/", > [], > get, > {http_request_h, > undefined, > "keep-alive", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > "www.google.com.mx", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > [], > undefined, > undefined, > undefined, > undefined, > "0", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > []}, > {[],[]}, > {http_options,1000,true,[],false}, > "http://google.com"}, > {tcp_session, > {{"www.google.com.mx",80},<0.263.0>}, > false, > http, > #Port<0.319>, > 1}, > {"HTTP/1.1",200,"OK"}, > {http_response_h, > undefined, > undefined, > "Thu, 31 Mar 2005 23:47:31 GMT", > undefined, > undefined, > "chunked", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > "GWS/2.1", > undefined, > undefined, > undefined, > undefined, > undefined, > "0", > undefined, > undefined, > undefined, > "text/html", > undefined, > undefined, > [{"cache-control","private"}, > {"set-cookie", > > "PREF=ID=66a1247f32127631:LD=es:TM=1112312851:LM=1112312851:S=nL_hpjFTzEzffYxo; > expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; > domain=.google.com.mx"}]}, > undefined, > {http_chunk, > decode_data, > [2228, > > <<60,104,116,109,108,62,60,104,101,97,100,62,60,109,101,116,97,32,104,116,116,112,45,101,113,117,105,118,61,34,99,111 > > cut lots of ints > > 47,119,119,119,46,103,111,111,103,108,101,46,99,111,109,47,110,99,114,62,71,111,111,103,108,101,46,99,111,109,32,105,110,32,69,110,103,108,105,115,104,60,47,97,62,60,47,102,111,110,116,62,60,112,62,60,102,111,110,116,32,115,105,122,101,61,45>>, > {nolimit,<<>>,2228,nolimit}]}, > {[],[]}, > new, > [], > nolimit, > nolimit, > {options,{undefined,[]},0,2,2,disabled}, > {timers, > [{#Ref<0.0.0.951>,#Ref<0.0.0.974>}], > undefined}} > ** Reason for termination == > ** {{badmatch,#Ref<0.0.0.974>}, > [{httpc_handler,answer_request,3}, > {httpc_handler,terminate,2}, > {gen_server,terminate,6}, > {proc_lib,init_p,5}]} > > =CRASH REPORT==== 31-Mar-2005::17:47:31 === > crasher: > pid: <0.263.0> > registered_name: [] > error_info: {{badmatch,#Ref<0.0.0.974>}, > [{httpc_handler,answer_request,3}, > {httpc_handler,terminate,2}, > {gen_server,terminate,6}, > {proc_lib,init_p,5}]} > initial_call: {gen,init_it, > [gen_server, > <0.129.0>, > <0.129.0>, > httpc_handler, > [{request,#Ref<0.0.0.951>, > <0.211.0>, > 3, > http, > {"www.google.com.mx",80}, > "/", > [], > get, > {http_request_h, > undefined, > "keep-alive", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > "www.google.com.mx", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > [], > undefined, > undefined, > undefined, > undefined, > "0", > undefined, > undefined, > undefined, > undefined, > undefined, > undefined, > []}, > {[],[]}, > {http_options,1000,true,[],false}, > "http://google.com"}, > {options,{undefined,[]},0,2,2,disabled}], > []]} > ancestors: [httpc_manager,httpc_sup,inets_sup,<0.125.0>] > messages: [] > links: [<0.129.0>,#Port<0.319>] > dictionary: [] > trap_exit: true > status: running > heap_size: 2584 > stack_size: 21 > reductions: 2346 > neighbours: > > (smsgw@REDACTED)10> > > > /Anders Nygren -- /Ingela - OTP team From laurent.picouleau@REDACTED Fri Apr 1 15:59:13 2005 From: laurent.picouleau@REDACTED (Laurent Picouleau) Date: Fri, 01 Apr 2005 14:59:13 +0100 Subject: Bit twiddling In-Reply-To: <20050331153924.3956@smtp.gmail.com> References: <20050331153924.3956@smtp.gmail.com> Message-ID: <1112363953.1413.76.camel@localhost.localdomain> Hi, On Thu, 2005-03-31 at 15:39, Joel Reymont wrote: > Folks, > > What's the most effective way to do bit twiddling in Erlang? > > Should I convert the int into a list of bits? How would I efficiently do this? Efficiency depends on the size of your numbers. > I'm looking to figure out the highest and lowest bit set in an integer as > well as count the number of bits set. For the lowest bit, if your dealing with small numbers (register size) a nice way is to use: last_bit(0) -> undefined; last_bit(N) -> do_last_bit(N xor (N - 1) ). do_last_bit(2#1) -> 0; do_last_bit(2#11) -> 1; do_last_bit(2#111) -> 2; ... do_last_bit(2#11111111111111111111111111111111) -> 31. or if you have a good solution for first_bit last_bit2(0) -> undefined; last_bit2(N) -> first_bit(N xor (N - 1) ). For numbers bigger than register, you have to reduce their size by removing trailing 0: big_last_bit(N) -> Last = N band 16#ffffffff, case Last of 0 -> 32 + big_last_bit (N bsr 32); _ -> last_bit(Last) end. -- Laurent Picouleau laurent.picouleau@REDACTED From joelr1@REDACTED Fri Apr 1 19:03:02 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 18:03:02 +0100 Subject: Python integration Message-ID: <20050401180302.29415@smtp.gmail.com> Folks, Is there a library that would let me connect to Erlang nodes from Python, hopefully over SSL? I understand that configuring a node to talk to another node over SSL is no big deal but how does this work when Python /C++, etc./ is on the other end? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 1 19:39:24 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 18:39:24 +0100 Subject: Poker appliance Message-ID: <20050401183924.3723@smtp.gmail.com> Dear Erlang experts, After a lot of false starts /see my signature/ I think that Erlang is the best choice for writing my poker backend. I was struggling to figure out how to scale the server to 10k users and I think I should be thinking hundreds of thousands now. Go Erlang! I like the fact that Erlang makes it easy to model and implement games and tournaments and timed state machines. I truly lament not picking Erlang earlier. I sincerely hope to come up with a scalable "poker appliance", a technology that will make me the next Bluetail, to be bought by the poker version of Alteon :D. I harbor plans of world domination! I'm truly enjoying the process and doing this both for technical chops as well as the future money. The poker client is a giveaway and I'll write it in Python and make the source code available. After some poking around I found that I can use Py_Interface but I still have some crucial design questions... I think I'll leave the fault-tolerance, load balancing, etc. for after- beta since it seems reasonably straightforward to implement if I start by using gen_server and other necessary parts of OTP. My most pressing questions are related to state machine and server implementation. Given that my remote nodes will be Python clients, what kind of behavior should I choose for my server? Should I pick gen_server or gen_tcp? I have yet to read through several years of mailing list archives as well as all the documentation so please feel free to point me around and let me know if I should just read the manual. I see the poker game as a state machine that transitions from waiting for at least X players to join, assigning button and blinds, gathering blinds, dealing cards, etc. I have the whole engine implemented and tested in Lisp using continuations (the Arnesi CPS transformer). All requests to clients are timed and if a player does not respond within a given time then they are forced to take action (call a bet or fold). Players themselves have state. They can be logged in or not authenticated. They can be watching a game or playing. I read through the plain fsm thread and I'm not quite sure if I should go with gen_fsm or plain fsm. I'll appreciate your advice here. Also, do I need gen_tcp in this case or should I use gen_server? Does it even matter? Last but not least, my communications should be encrypted. I read how I can establish inter-node SSL connections but I'm somewhat at a loss regarding how to connect the Python side. Thanks in advance, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 1 20:07:13 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 19:07:13 +0100 Subject: Error: cannot handle extended pids and ports Message-ID: <20050401190713.17795@smtp.gmail.com> My archive search is still going (takes a few minutes for some reason) but I have stumbled twice now across this error: =ERROR REPORT==== 1-Apr-2005::19:01:41 === ** enode1@REDACTED: Connection attempt to node py_interface_test@REDACTED aborted since it cannot handle extended pids and ports. ** Same error applies to Distel 3.3. I'm using R10B3 on Mac OSX which comes with erl_interface-3.5.1. Thanks, Joel -- http://wagerlabs.com/tech From luke@REDACTED Fri Apr 1 20:51:36 2005 From: luke@REDACTED (Luke Gorrie) Date: 01 Apr 2005 20:51:36 +0200 Subject: Error: cannot handle extended pids and ports References: <20050401190713.17795@smtp.gmail.com> Message-ID: "Joel Reymont" writes: > My archive search is still going (takes a few minutes for some reason) > but I have stumbled twice now across this error: > > =ERROR REPORT==== 1-Apr-2005::19:01:41 === > ** enode1@REDACTED: Connection attempt to node > py_interface_test@REDACTED aborted since it cannot handle extended pids > and ports. ** > > Same error applies to Distel 3.3. Some feature-negotiation takes place during the distributed Erlang handshake and R10B demands more support than previous versions. The version of Distel in the Jungerl (sourceforge project 'jungerl') should work. Exerpt from Distel changelog: * elisp/derl.el (derl-send-name): Lie to Erlang by saying that we support extended PIDs. This way we can establish distribution with R10B-0, which doesn't seem to actually send extended pids initially. (This is a lame workaround but I'm in a hurry and the extended-pid format is not documented.) You could try this totally untested patch to py_interface to do the same thing: --- erl_opts.py.orig 2005-04-01 20:42:02.000000000 +0200 +++ erl_opts.py 2005-04-01 20:43:02.000000000 +0200 @@ -32,6 +32,7 @@ DISTR_FLAG_DISTMONITORNAME = 32; DISTR_FLAG_HIDDENATOMCACHE = 64; DISTR_FLAG_NEWFUNTAGS = 128; +DISTR_FLAG_EXTENDEDPIDSPORTS = 256; class ErlNodeOpts: def __init__(self, @@ -39,7 +40,7 @@ shortNodeNames=1, cookie="", distrVersion=5, - distrFlags=DISTR_FLAG_EXTENDEDREFERENCES + distrFlags=DISTR_FLAG_EXTENDEDREFERENCES|DISTR_FLAG_EXTENDEDP\ IDSPORTS ): self._netTickTime = netTickTime self._shortNodeNames = shortNodeNames From vances@REDACTED Sat Apr 2 02:02:52 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Apr 2005 19:02:52 -0500 Subject: Poker appliance In-Reply-To: <20050401183924.3723@smtp.gmail.com> References: <20050401183924.3723@smtp.gmail.com> Message-ID: <20050402000251.GD9427@blank.motivity.ca> On Fri, Apr 01, 2005 at 06:39:24PM +0100, Joel Reymont wrote: } } Given that my remote nodes will be Python clients, what kind of behavior First off you won't be able to do more than a couple hundred clients if you intend to use erlang distribution. The distribution method isn't well suited to a lot of nodes. There used to be a limit of something like 255 known nodes and although I think the hard limit was removed the basic problem remains. You'll need to implement your RUDP in both the client and server and use that for all communications. } should I choose for my server? Should I pick gen_server or gen_tcp? I You probably want to implement the RUDP protocol in a gen_fsm behaviour module. You would use gen_udp as the lower layer and provide a service to application processes. } I see the poker game as a state machine that transitions from waiting for Implement this in gen_fsm behaviour as well. } Players themselves have state. They can be logged in or not } authenticated. They can be watching a game or playing. The basic unit of abstraction in Erlang is a process. You should model your system using a process for each truly concurrent activity in the real world. A player would be represented by a process implemented in a gen_fsm module. A game could also be a gen_fsm process. An RUDP association would need a gen_fsm process as well. You store state in a term which is passed from call to call: logged_in(Event, StateData) -> ... {next_state, authenticated, NewStateData}; authenticated(Event, StateData) -> ... {next_state, watching, NewStateData}; ... and so on. Now you could use a gen_server process to handle many clients by having their state stored in the gen_server StateData but what would be the point? Since processes are cheap you instead have one gen_fsm for every actual state machine. } I read through the plain fsm thread and I'm not quite sure if I should go } with gen_fsm or plain fsm. I'll appreciate your advice here. I always suggest sticking with one of the OTP behaviours until you feel you know better than the experts. Way, way later (i.e. never) you may elect to optimize by using your own implementation. Ulf's contribution is interesting but I think that in it's attempt to make things more Erlangish it makes it less OTPish. At this stage of your project I think you'd benefit more from OTP purity. [... /me prepares to be admonished ...] } Last but not least, my communications should be encrypted. I read how I } can establish inter-node SSL connections but I'm somewhat at a loss } regarding how to connect the Python side. See the crypto module. Use it directly to encrypt/decrypt your RUDP payloads. -Vance From vances@REDACTED Sat Apr 2 02:10:46 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Apr 2005 19:10:46 -0500 Subject: Error: cannot handle extended pids and ports In-Reply-To: References: <20050401190713.17795@smtp.gmail.com> Message-ID: <20050402001046.GE9427@blank.motivity.ca> You could also try starting the emulator with a +R option to specify an older release. -Vance On Fri, Apr 01, 2005 at 08:51:36PM +0200, Luke Gorrie wrote: } } Some feature-negotiation takes place during the distributed Erlang } handshake and R10B demands more support than previous versions. From joelr1@REDACTED Fri Apr 1 21:19:02 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 20:19:02 +0100 Subject: Error: cannot handle extended pids and ports In-Reply-To: References: Message-ID: <20050401201902.20504@smtp.gmail.com> > Luke Gorrie wrote: >You could try this totally untested patch to py_interface to do the >same thing: Thank you Luke! Now, you wouldn't have a totally untested Reliable UDP implementation lying around, would you? :) Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 1 21:21:46 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 20:21:46 +0100 Subject: Poker appliance In-Reply-To: <20050402000251.GD9427@blank.motivity.ca> References: <20050402000251.GD9427@blank.motivity.ca> Message-ID: <20050401202146.28553@smtp.gmail.com> > Vance Shipley wrote: >First off you won't be able to do more than a couple hundred clients if >you intend to use erlang distribution. The distribution method isn't >well suited to a lot of nodes. So much for my good intentions :-(. >You'll need to implement your RUDP in both the >client and server and use that for all communications. Does anyone have SDL state diagrams for this protocol? The draft mentions them but I could not find them in google. Thanks, Joel -- http://wagerlabs.com/tech From luke@REDACTED Fri Apr 1 22:06:21 2005 From: luke@REDACTED (Luke Gorrie) Date: 01 Apr 2005 22:06:21 +0200 Subject: Error: cannot handle extended pids and ports References: <20050401201902.20504@smtp.gmail.com> Message-ID: "Joel Reymont" writes: > > Luke Gorrie wrote: > >You could try this totally untested patch to py_interface to do the > >same thing: > > Thank you Luke! > > Now, you wouldn't have a totally untested Reliable UDP implementation > lying around, would you? :) I'd suggest starting simple, either with TCP or UDP with fingers crossed (unlikely to lose packets in laboratory conditions), and then think some more once you see how the protocol turns out. RUDP looks pretty TCP'ishly complex and I can imagine a much simpler protocol if e.g. it turns out that each side only needs to send one packet at a time. My colleagues could probably give you some good tips on how far you can make TCP scale in Erlang, I suspect it's a pretty long way.. I do have a mostly untested/unfinished user-space TCP if you want, but that would take you back to lisp and I don't remember where the latest sources are :-) http://www.cliki.net/Slitch and Tobbe has written a more complete one in Erlang (old and may need slight forwards-porting) http://www.bluetail.com/tobbe/etcp/ Practical path would be to ignore those links though :-) From joelr1@REDACTED Fri Apr 1 22:29:23 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 21:29:23 +0100 Subject: Scaling TCP (was Re: Error: cannot handle extended pids and ports) In-Reply-To: References: Message-ID: <20050401212923.1520@smtp.gmail.com> > Luke Gorrie wrote: >My colleagues could probably give you some good tips on how far you >can make TCP scale in Erlang, I suspect it's a pretty long way.. I must have taken Vance's suggestion the wrong way. He stated that Erlang can only handle about 255 nodes and that I should use RUDP. 255 nodes does not mean 255 TCP clients, I suppose, so I can first try TCP and switch to RUDP later on and if needed. Thanks, Joel -- http://wagerlabs.com/tech From vances@REDACTED Sat Apr 2 03:47:54 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Apr 2005 20:47:54 -0500 Subject: Error: cannot handle extended pids and ports In-Reply-To: References: <20050401201902.20504@smtp.gmail.com> Message-ID: <20050402014754.GF9427@blank.motivity.ca> "Joel Reymont" writes: } } Now, you wouldn't have a totally untested Reliable UDP implementation } lying around, would you? :) Since RUDP has been superceded by SCTP that leads us back to the gen_sctp discussion. :) SCTP isn't really the answer for you as although the server side is easy to provision getting SCTP support into clients is unlikely for many years. I wouldn't try and implement a full blown RUDP in erlang. I'm sure you can build an application specific protocol on top of UDP fairly easily which would satisfy your requirements. Stevens(*) has a section entitled "Adding reliability to UDP applications" which you might want to read. As he points out many existing applications have implemented this; DNS, SNMP, TFTP & RPC are given as examples. -Vance (*) http://www.kohala.com/start/unpv12e.html From joelr1@REDACTED Fri Apr 1 22:52:09 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 1 Apr 2005 21:52:09 +0100 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050402014754.GF9427@blank.motivity.ca> References: <20050402014754.GF9427@blank.motivity.ca> Message-ID: <20050401215209.18381@smtp.gmail.com> > Vance Shipley wrote: >Since RUDP has been superceded by SCTP that leads us back to the gen_sctp >discussion. :) Funny, I was just reading up on SCTP. >SCTP isn't really the answer for you as although the server side is easy >to provision getting SCTP support into clients is unlikely for many years. Why is that? Can't I just build a SCTP client? Joel -- http://wagerlabs.com/tech From sean.hinde@REDACTED Sat Apr 2 00:22:33 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 1 Apr 2005 23:22:33 +0100 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050401215209.18381@smtp.gmail.com> References: <20050402014754.GF9427@blank.motivity.ca> <20050401215209.18381@smtp.gmail.com> Message-ID: On 1 Apr 2005, at 21:52, Joel Reymont wrote: >> Vance Shipley wrote: > >> Since RUDP has been superceded by SCTP that leads us back to the >> gen_sctp >> discussion. :) > > Funny, I was just reading up on SCTP. > >> SCTP isn't really the answer for you as although the server side is >> easy >> to provision getting SCTP support into clients is unlikely for many >> years. > > Why is that? Can't I just build a SCTP client? It is a very heavy duty replacement for TCP running over raw IP. There is an implementation in the Linux 2.6 kernels if you fancy playing with it. Not that I wish to discourage you if you fancy having a go. I did once start to write a version of it in Erlang running over UDP (it was an option in the spec, I don't know if it still is), but as with many such things it was much bigger than available time and skills permitted :-) Sean From anders.nygren@REDACTED Sat Apr 2 00:22:33 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 1 Apr 2005 16:22:33 -0600 Subject: odbc problem Message-ID: Hi I am trying to use odbc and have run into a strange problem. Using R10B-2 on Windows XP, with Microsoft SQL Server2000. The data is inserted in the table on the sql server but for some reason the connection is lost. I have tried to trace the odbc driver with {trace_driver,on} but it does not look very interesting, (but what do I know), I have attatched it anyway. /Anders Nygren Eshell V5.4.3 (smsgw@REDACTED)26> {ok,Ref1}=odbc:connect("DSN=LocalServer;UID=sa;PWD=",[]). {ok,<0.186.0>} (smsgw@REDACTED)27> odbc:param_query(Ref1,"insert into MESSAGE (ID,TELEPHONE) values(?,?)", [{{sql_varchar,13},["123454678"]},{{sql_varchar,10},["2345"]}]). {error,connection_closed} =ERROR REPORT==== 1-Apr-2005::13:10:26 === ** Generic server <0.186.0> terminating ** Last message in was {#Port<0.614>,{exit_status,14}} ** When Server state == {state,#Port<0.614>, {<0.183.0>,#Ref<0.0.0.1758>}, <0.183.0>, undefined, on, true, true, on, connected, undefined, 0, [#Port<0.612>,#Port<0.613>], #Port<0.615>, #Port<0.616>} ** Reason for termination == ** {port_exit,socket_send_message_body_failed} =CRASH REPORT==== 1-Apr-2005::13:10:26 === crasher: pid: <0.186.0> registered_name: [] error_info: {port_exit,socket_send_message_body_failed} initial_call: {gen,init_it, [gen_server, <0.111.0>, <0.111.0>, odbc, [{client,<0.183.0>}], []]} ancestors: [odbc_sup,<0.110.0>] messages: [{'EXIT',#Port<0.614>,normal}] links: [<0.111.0>] dictionary: [] trap_exit: true status: running heap_size: 610 stack_size: 21 reductions: 1581 neighbours: (smsgw@REDACTED)28> =SUPERVISOR REPORT==== 1-Apr-2005::13:10:26 === Supervisor: {local,odbc_sup} Context: child_terminated Reason: {port_exit,socket_send_message_body_failed} Offender: [{pid,<0.186.0>}, {name,[]}, {mfa,{odbc,start_link_sup,[[{client,<0.183.0>}]]}}, {restart_type,temporary}, {shutdown,7000}, {child_type,worker}] -------------- next part -------------- A non-text attachment was scrubbed... Name: SQL.LOG Type: application/octet-stream Size: 13168 bytes Desc: not available URL: From vances@REDACTED Sat Apr 2 06:03:12 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Apr 2005 23:03:12 -0500 Subject: run_erl/to_erl on FreeBSD In-Reply-To: References: <20050329043958.GD836@blank.motivity.ca> <82b7d977b3afa950c10e7b109e194da1@mac.com> Message-ID: <20050402040312.GI9427@blank.motivity.ca> On Wed, Mar 30, 2005 at 09:24:39AM +0200, Bjorn Gustavsson wrote: } } Which version of FreeBSD do you use? Does run_erl run using } R10B-2 or R10B-3? Bjorn, I am using FreeBSD 4.10-STABLE on this particular machine. I found this bug report which goes into the gory details: http://www.freebsd.org/cgi/query-pr.cgi?pr=76525 http://www.freebsd.org/cgi/query-pr.cgi?pr=76144 Basically the problem lies in the semantics of using select() on a named pipe opened for reading for which there has never been a writer. Solaris will return exactly one EOF. On this FreeBSD 4.10 system select() just keeps on returning with the pipe readable and read returning 0 (EOF). OS X, being derived from FreeBSD, is somehow effected as well. I think I'll just live without to_erl until I can schedule an upgrade to FreeBSD 5.3 which presumable works. -Vance From vances@REDACTED Sat Apr 2 06:07:49 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 1 Apr 2005 23:07:49 -0500 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050401215209.18381@smtp.gmail.com> References: <20050402014754.GF9427@blank.motivity.ca> <20050401215209.18381@smtp.gmail.com> Message-ID: <20050402040749.GJ9427@blank.motivity.ca> On Fri, Apr 01, 2005 at 09:52:09PM +0100, Joel Reymont wrote: } } Why is that? Can't I just build a SCTP client? "Just". A software developers favourite word. :) I assume you want to get around to playing poker at some point. SCTP is a very complex beast which provides much more than RUDP does. It belongs in the kernel too. Now if you want something to do you could build us a gen_sctp module which interfaced with the, now standardized, SCTP API available with Solaris 10 and other OSes. That would be nice. -Vance From joelr1@REDACTED Sat Apr 2 01:10:16 2005 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 2 Apr 2005 00:10:16 +0100 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050402040749.GJ9427@blank.motivity.ca> References: <20050402040749.GJ9427@blank.motivity.ca> Message-ID: <20050402001016.8293@smtp.gmail.com> > Vance Shipley wrote: >I assume you want to get around to playing poker at some point. >SCTP is a very complex beast which provides much more than RUDP >does. It belongs in the kernel too. I did not realize it was a kernel-level protocol. >Now if you want something to do you could build us a gen_sctp >module which interfaced with the, now standardized, SCTP API >available with Solaris 10 and other OSes. That would be nice. I think I have my hands full as it is, having blown my last deadline and needing to rewrite the poker engine in Erlang :-). Cheers, Joel -- http://wagerlabs.com/tech From mickael.remond@REDACTED Sat Apr 2 11:04:27 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 02 Apr 2005 11:04:27 +0200 Subject: Scaling TCP (was Re: Error: cannot handle extended pids and ports) In-Reply-To: <20050401212923.1520@smtp.gmail.com> References: <20050401212923.1520@smtp.gmail.com> Message-ID: <424E601B.7000804@erlang-fr.org> Joel Reymont wrote: >>Luke Gorrie wrote: > > >>My colleagues could probably give you some good tips on how far you >>can make TCP scale in Erlang, I suspect it's a pretty long way.. > > > I must have taken Vance's suggestion the wrong way. He stated that Erlang > can only handle about 255 nodes and that I should use RUDP. > > 255 nodes does not mean 255 TCP clients, I suppose, so I can first try > TCP and switch to RUDP later on and if needed. The 255 nodes figures was stated in the case you were planning to use Erlang node distribution protocol. TCP client can scale a lot more. A nice example of the scalability is the Yaws vs Apache benchmark: http://www.sics.se/~joe/apachevsyaws.html Yaws (Erlang Web server) were able to handle 80000 simultaneous users connected. -- Micka?l R?mond From dietmar@REDACTED Tue Apr 5 12:28:37 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Tue, 05 Apr 2005 12:28:37 +0200 Subject: gs Message-ID: <42526855.60605@ast.dfs.de> HI ! gs:start(). What does {error,backend_died} mean ? regards Dietmar From erlq@REDACTED Sat Apr 2 06:03:41 2005 From: erlq@REDACTED (Rob) Date: Fri, 01 Apr 2005 20:03:41 -0800 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050402014754.GF9427@blank.motivity.ca> References: <20050401201902.20504@smtp.gmail.com> <20050402014754.GF9427@blank.motivity.ca> Message-ID: <424E199D.7050508@itsbeen.sent.com> This didn't seem to arrive at the list, retrying = sorry if it gets duped... What about using spread? http://www.spread.org/ there is a python binding and I thought there was/is an erlang binding. You could have various levels of readonly multicast data streams, that a process could subscribe to and you could even create an api that allowed others to build apps that plug in to a given public feed. * public info about server status, active games, player stats, rankings, etc (the lobby server/[service] you talk about on your site) * public info about game X (watch game) * public info about player Y (watch all games for a certain player, I don't know if current poker servers have this function) * player-only info about game X (participate in game) * server-to-server only info about games, internal server states etc. As new servers, processes or clients start up they would either subscribe to the appropriate streams or create new ones and register them with a stream directory service. For poker it seems very little info is transfered upstream so those could probably be tcp connected per request - so placing a bet or getting cards, etc would be an atomic tcp interaction. Even a single erlang node should be able to handle 10's or 100's of 1,000's of player upstream interactions that way. Vance Shipley wrote: > "Joel Reymont" writes: > } > } Now, you wouldn't have a totally untested Reliable UDP implementation > } lying around, would you? :) > > > Since RUDP has been superceded by SCTP that leads us back to the gen_sctp > discussion. :) > > SCTP isn't really the answer for you as although the server side is easy > to provision getting SCTP support into clients is unlikely for many years. > > I wouldn't try and implement a full blown RUDP in erlang. I'm sure you > can build an application specific protocol on top of UDP fairly easily > which would satisfy your requirements. Stevens(*) has a section entitled > "Adding reliability to UDP applications" which you might want to read. > As he points out many existing applications have implemented this; DNS, > SNMP, TFTP & RPC are given as examples. > > -Vance > > (*) http://www.kohala.com/start/unpv12e.html From ingela@REDACTED Tue Apr 5 09:22:41 2005 From: ingela@REDACTED (Ingela Anderton) Date: Tue, 5 Apr 2005 09:22:41 +0200 Subject: odbc problem References: Message-ID: <16978.15553.725919.197888@gargle.gargle.HOWL> Anders Nygren wrote: > Hi > I am trying to use odbc and have run into a strange problem. > Using R10B-2 on Windows XP, with Microsoft SQL Server2000. > The data is inserted in the table on the sql server but for some > reason the connection is lost. Well you must be the first one that tried to use parameterized queries on a windows platform. Our automated test cases for parameterized queries have failed on windows for some time (works fine on solaris), but before I wrote the new configure script I could not reproduce the fault. When I built only the odbc application the old way it always worked. Now I can reproduce it but if I try to debug compile it to get some more information it starts working again. All efforts so far has alas led nowhere. The exit code indicates that the c function send/4 that sends a message on a socket has failed returning -1 which suggest something else has gone wrong and somehow messes up the input to send. I was hoping we would have found the problem by now but as it does not have top priority it might be time to at least document it as an known problem! > I have tried to trace the odbc driver with {trace_driver,on} > but it does not look very interesting, (but what do I know), > I have attatched it anyway. Well thank you I am not sure it will help but I will take a look at it you never know! A problem though is that I have many other things to do the are higher prioritized so it might take a while before I have time to really investigate this further. [...] > ** {port_exit,socket_send_message_body_failed} [...] -- /Ingela - OTP team From erlq@REDACTED Fri Apr 1 23:27:25 2005 From: erlq@REDACTED (Rob) Date: Fri, 01 Apr 2005 13:27:25 -0800 Subject: Error: cannot handle extended pids and ports In-Reply-To: <20050402014754.GF9427@blank.motivity.ca> References: <20050401201902.20504@smtp.gmail.com> <20050402014754.GF9427@blank.motivity.ca> Message-ID: <424DBCBD.9010900@itsbeen.sent.com> What about using spread? http://www.spread.org/ there is a python binding and I thought there was/is an erlang binding. You could have various levels of readonly multicast data streams, that a process could subscribe to and you could even create an api that allowed others to build apps that plug in to a given public feed. * public info about server status, active games, player stats, rankings, etc (the lobby server/[service] you talk about on your site) * public info about game X (watch game) * public info about player Y (watch all games for a certain player, I don't know if current poker servers have this function) * player-only info about game X (participate in game) * server-to-server only info about games, internal server states etc. As new servers, processes or clients start up they would either subscribe to the appropriate streams or create new ones and register them with a stream directory service. For poker it seems very little info is transfered upstream so those could probably be tcp connected per request - so placing a bet or getting cards, etc would be an atomic tcp interaction. Even a single erlang node should be able to handle 10's or 100's of 1,000's of player upstream interactions that way. Vance Shipley wrote: > "Joel Reymont" writes: > } > } Now, you wouldn't have a totally untested Reliable UDP implementation > } lying around, would you? :) > > > Since RUDP has been superceded by SCTP that leads us back to the gen_sctp > discussion. :) > > SCTP isn't really the answer for you as although the server side is easy > to provision getting SCTP support into clients is unlikely for many years. > > I wouldn't try and implement a full blown RUDP in erlang. I'm sure you > can build an application specific protocol on top of UDP fairly easily > which would satisfy your requirements. Stevens(*) has a section entitled > "Adding reliability to UDP applications" which you might want to read. > As he points out many existing applications have implemented this; DNS, > SNMP, TFTP & RPC are given as examples. > > -Vance > > (*) http://www.kohala.com/start/unpv12e.html From Enrico.Santoemma@REDACTED Fri Apr 8 15:31:51 2005 From: Enrico.Santoemma@REDACTED (Santoemma Enrico) Date: Fri, 8 Apr 2005 15:31:51 +0200 Subject: hello Message-ID: <832CEC72F85F3849BB728CBD0618301801656B65@ganimede.beta80group.it> The erlang.org is still down, and I wonder if this list still exists. Are there any old archives? Cheers, Enrico From hakan.stenholm@REDACTED Mon Apr 4 15:46:54 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Mon, 04 Apr 2005 15:46:54 +0200 Subject: YXA with CPL support written in Erlang/OTP now available Message-ID: <4251454E.3080007@mbox304.swipnet.se> ___YXA with CPL support now available___ Erlang/OTP based CPL support, developed by me (H?kan Stenholm), has now for the first time been integrated into the public YXA release (snapshot 2005-04-04). CPL is a script language which allows for the declaration of complex call forwarding behaviors, in IP telephony systems. While the current implementation is done for YXA, it should be easy to adapt it to work with other SIP based servers as well, as CPL is implemented in a very modular fashion. The CPL code may also be of interest to those who work with iCalendar (RFC 2445), as it contains a fully working RRULE implementation. The YXA project is available at http://www.stacken.kth.se/projekt/yxa/ More in depth CPL information and Erlang/OTP related design analysis is available at http://www.stacken.kth.se/projekt/yxa/cpl_implementation.html H?kan Stenholm From bjarne@REDACTED Fri Apr 8 15:29:53 2005 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Fri, 8 Apr 2005 15:29:53 +0200 Subject: hello References: <832CEC72F85F3849BB728CBD0618301801656B65@ganimede.beta80group.it> Message-ID: <003d01c53c3f$0d7b0760$541169d4@segeltorp> The list is now active again. Bjarne ----- Original Message ----- From: "Santoemma Enrico" To: Sent: Friday, April 08, 2005 3:31 PM Subject: hello > The erlang.org is still down, and I wonder if this list still exists. > Are there any old archives? > > Cheers, > Enrico > From Enrico.Santoemma@REDACTED Fri Apr 8 15:46:25 2005 From: Enrico.Santoemma@REDACTED (Santoemma Enrico) Date: Fri, 8 Apr 2005 15:46:25 +0200 Subject: R: hello Message-ID: <832CEC72F85F3849BB728CBD0618301801247D52@ganimede.beta80group.it> Thanks, Bjarne. Do you know the current status of the Erlang language? What I can't discriminate, googling around, is whether it's still an alive thing, at least industrially. There are many old post and almost nothing new, so I'm a bit concerned when thinking to adopt it. Enrico -----Messaggio originale----- Da: Bjarne D?cker [mailto:bjarne@REDACTED] Inviato: venerd? 8 aprile 2005 15.30 A: Santoemma Enrico; erlang-questions@REDACTED Oggetto: Re: hello The list is now active again. Bjarne ----- Original Message ----- From: "Santoemma Enrico" To: Sent: Friday, April 08, 2005 3:31 PM Subject: hello > The erlang.org is still down, and I wonder if this list still exists. > Are there any old archives? > > Cheers, > Enrico > From bengt.kleberg@REDACTED Mon Apr 4 09:51:29 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 04 Apr 2005 09:51:29 +0200 Subject: monitor vs link In-Reply-To: <20050402143624.6360146941@bang.trapexit.org> References: <20050402143624.6360146941@bang.trapexit.org> Message-ID: <4250F201.7050103@ericsson.com> asergey wrote: > Hi Gurus, > > Could you please explain the difference between > erlang:monitor(process, Pid) and link(Pid) + process_flag(trap_exit, > true)? erlang:monitor/2 is one way. it allows your process to find out when Pid exits, without telling Pid if your process exits. erlang:link/1 is two way. your process finds out about when Pid exits, and Pid finds out about your process exit. bengt From csanto@REDACTED Thu Apr 7 08:30:37 2005 From: csanto@REDACTED (Corrado Santoro) Date: Thu, 07 Apr 2005 08:30:37 +0200 Subject: Ping Message-ID: <4254D38D.8030703@diit.unict.it> is the mailing list working? I'm not receiving any message since many days... -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From Enrico.Santoemma@REDACTED Fri Apr 8 16:03:55 2005 From: Enrico.Santoemma@REDACTED (Santoemma Enrico) Date: Fri, 8 Apr 2005 16:03:55 +0200 Subject: R: hello Message-ID: <832CEC72F85F3849BB728CBD0618301801247D53@ganimede.beta80group.it> You're very kind. The graphs have only one interpretation. So, this should be the place where to ask this: I want to port an Haskell app to Erlang, and I started to see whether ODBC is working. So I tried to connect to an Oracle instance, but got an horrible error :) After some days I thought it could be the Oracle driver, infact switching to the Microsoft's was enough. Is this the only driver I may use, to access Oracle? Also, after the first error inside the shell (like a wrong SELECT or so), the db reference is no more usable and I must restart the shell. Is this ok? Enrico From bjarne@REDACTED Fri Apr 8 15:41:16 2005 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Fri, 8 Apr 2005 15:41:16 +0200 Subject: hello References: <832CEC72F85F3849BB728CBD0618301801247D52@ganimede.beta80group.it> Message-ID: <006801c53c40$a55df960$541169d4@segeltorp> Hello I think that there are many who can and will testify to the spreading use of Erlang for industrial purposes. I will just take the opportunity to send the download statistics which, as you can see, show an upward trend. Best wishes Bjarne ----- Original Message ----- From: "Santoemma Enrico" To: "Bjarne D?cker" ; Sent: Friday, April 08, 2005 3:46 PM Subject: R: hello Thanks, Bjarne. Do you know the current status of the Erlang language? What I can't discriminate, googling around, is whether it's still an alive thing, at least industrially. There are many old post and almost nothing new, so I'm a bit concerned when thinking to adopt it. Enrico -------------- next part -------------- A non-text attachment was scrubbed... Name: Slide1.JPG Type: image/jpeg Size: 48254 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Slide2.JPG Type: image/jpeg Size: 58899 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Slide3.JPG Type: image/jpeg Size: 38364 bytes Desc: not available URL: From anders.nygren@REDACTED Fri Apr 8 16:17:22 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 8 Apr 2005 09:17:22 -0500 Subject: YXA with CPL support written in Erlang/OTP now available In-Reply-To: <4251454E.3080007@mbox304.swipnet.se> References: <4251454E.3080007@mbox304.swipnet.se> Message-ID: On Apr 4, 2005 8:46 AM, H?kan Stenholm wrote: > ___YXA with CPL support now available___ > > Erlang/OTP based CPL support, developed by me (H?kan Stenholm), has now for the first time been integrated into the public YXA release (snapshot 2005-04-04). > I could not find any information on which licence yxa is released under. So, what license is used? /Anders From hakan.stenholm@REDACTED Fri Apr 8 17:43:38 2005 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 08 Apr 2005 17:43:38 +0200 Subject: YXA with CPL support written in Erlang/OTP now available Message-ID: <4256A6AA.6000105@mbox304.swipnet.se> Anders Nygren wrote: > On Apr 4, 2005 8:46 AM, H?kan Stenholm > wrote: > > >> ___YXA with CPL support now available___ >> >> Erlang/OTP based CPL support, developed by me (H?kan Stenholm), has >> now for the first time been integrated into the public YXA release >> (snapshot 2005-04-04). >> >> > > > I could not find any information on which licence yxa is released under. > So, what license is used? > > /Anders > > > You'll do best in contacting Fredrik Thulin (ft@REDACTED). I think it was a KTH based open source licence, you might be able to find it if you dig around at www.kth.se From csanto@REDACTED Fri Apr 8 18:31:24 2005 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 08 Apr 2005 18:31:24 +0200 Subject: Erlang use in Italy Message-ID: <4256B1DC.2060609@diit.unict.it> Hi all, For statistical purposes, I would like to know what is the current status of the usage of Erlang in Italy, i.e. what are the companies and universities that use this language for commercial purpose and/or research. You may repond privately, just to not annoy all the members of the list. Thanks in advance. Best regards, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From csanto@REDACTED Tue Apr 5 09:35:40 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 05 Apr 2005 09:35:40 +0200 Subject: Mnesia performances Message-ID: <42523FCC.3010300@diit.unict.it> Dear all, has someone done a measurement of mnesia performances? Something like writes-per-second, reads-per-seconds, etc.? Thanks, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From vlad_dumitrescu@REDACTED Fri Apr 8 20:12:32 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 8 Apr 2005 20:12:32 +0200 Subject: JInterface Message-ID: Hi, Having looked at H?ctor Rivas G?ndaras implementation of C++ nodes (and liking it), I came to think that jinterface could also be extended to provide Java-threads-that-feel-like-an-Erlang-process, i.e. a thread that receives messages in a loop and the messages can be selectively selected from the queue. Is there a reason for not implementing this in jinterface? (other than simplicity or no user requests) Is it something of interest? best regards, Vlad From ulf@REDACTED Sat Apr 2 18:06:49 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 02 Apr 2005 18:06:49 +0200 Subject: monitor vs link In-Reply-To: <20050402143624.6360146941@bang.trapexit.org> References: <20050402143624.6360146941@bang.trapexit.org> Message-ID: (I believe this post didn't make it on the first try.) Den 2005-04-02 16:36:24 skrev asergey : > Could you please explain the difference between erlang:monitor(process, > Pid) and link(Pid) + process_flag(trap_exit, true)? The most important differences are these: - Links are two-way, while monitors are one-way. Thus, links work well for cascading exits, but you can't unobtrusively monitor another process using link (the other process will be affected if your process dies.) - There is never more than one link between two processes, while there can be several nested monitors. Consider e.g. gen_server:call/2. It sets a monitor on the server process, and removes it when it gets a reply. In order to do that with link, the gen:call() function would have to call process_info(self(), links) first, and check the list of links to see whether there is already a link to the server; then perhaps set a link, and - if so - remove it afterwards (if there were a link already, it mustn't remove it). Still, the server must be able to handle EXIT messages from clients, which is normally not what one wants. /Uffe From rpettit@REDACTED Sat Apr 9 03:26:18 2005 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 8 Apr 2005 20:26:18 -0500 Subject: JInterface In-Reply-To: References: Message-ID: <20050409012618.GD8543@vailsys.com> On Fri, Apr 08, 2005 at 08:12:32PM +0200, Vlad Dumitrescu wrote: > Hi, > > Having looked at H?ctor Rivas G?ndaras implementation of C++ nodes (and > liking > it), I came to think that jinterface could also be extended to provide > Java-threads-that-feel-like-an-Erlang-process, i.e. a thread that receives > messages in a loop and the messages can be selectively selected from the > queue. > > Is there a reason for not implementing this in jinterface? (other than > simplicity or no user requests) Here's a user request :-) > Is it something of interest? Yes. -Rick From mickael.remond@REDACTED Sat Apr 9 10:47:35 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 09 Apr 2005 10:47:35 +0200 Subject: New analysis case for Dialyzer ? Message-ID: <425796A7.6030400@erlang-fr.org> Hello, Here is a piece of code that contains a bug: (* are marking the interesting lines): -=-=-=- * TS = To#psock.s, case From#psock.mode of expectheaders -> SSL = nossl, case yaws:http_get_headers(From#psock.s, SSL) of {R, H0} -> ?Debug("R = ~p~n",[R]), RStr = if %% FIXME handle bad_request here record(R, http_response) -> yaws_api:reformat_response(R); record(R, http_request) -> * To ! {cli2srv, R#http_request.method, H0#headers.host}, yaws_api:reformat_request( rewrite_path(R, From#psock.prefix)) end, -=-=-=- The To variable is used as a record, but later on is used as a Pid. I try to analyse the code with Dialyzer, but it did not suspect the problem. Maybe analysis has been extended in the latest version of Dialyzer (I did not try the brand new one), but I thought that actually this piece of code might help the HiPE team. Cheers, -- Micka?l R?mond http://www.erlang-projects.org/ From francesco@REDACTED Sat Apr 9 14:23:03 2005 From: francesco@REDACTED (Francesco Cesarini (Erlang Training & Consulting)) Date: Sat, 09 Apr 2005 13:23:03 +0100 Subject: Erlang use in Italy In-Reply-To: <4256B1DC.2060609@diit.unict.it> References: <4256B1DC.2060609@diit.unict.it> Message-ID: <4257C927.7090801@erlang-consulting.com> Based on the Erlang mailing list statistics from last September (presented at the Erlang workshop in Italy), the numbers were not so high. 1% of the subscribers (397 in total) had an Italian (.it) domain. National domains consisted of about 50% of the addresses (.com, .net, .org etc). http://www.erlang-consulting.com/erlangworkshop04/ (Slide 7). Now, if the University of Catania started teaching Erlang (hint hint :-) ), that would be another story.. Just see the University of Corunna effect, where subscribers members are 3 times higher than Italy :-) :-) But statistics are just part of the truth, as many companies operate in stealth mode not wanting to disclose their best tools... For one of these companies, we are looking for a candidate in Rome. We have managed to fill one of the two positions, but one remains open. For more info, see http://www.erlang-consulting.com/jobs_fs.html Regards, Francesco -- http://www.erlang-consulting.com Corrado Santoro wrote: > Hi all, > > For statistical purposes, I would like to know what is the current > status of the usage of Erlang in Italy, i.e. what are the companies and > universities that use this language for commercial purpose and/or research. > > You may repond privately, just to not annoy all the members of the list. > > Thanks in advance. > > Best regards, > --Corrado > From twanvds@REDACTED Sun Apr 10 01:42:21 2005 From: twanvds@REDACTED (Twan van der Schoot) Date: Sun, 10 Apr 2005 01:42:21 +0200 Subject: What's up with www.erlang.org? Message-ID: To whomever is listening, What has happened to the http://www.erlang.org site? Is it up? Or do I've, in likelyhood, a problem at my side? I can't reach it for a number of days now. thanks in advance, Twan From rpettit@REDACTED Sun Apr 10 02:39:32 2005 From: rpettit@REDACTED (Rick Pettit) Date: Sat, 9 Apr 2005 19:39:32 -0500 Subject: What's up with www.erlang.org? In-Reply-To: References: Message-ID: <20050410003932.GA14135@vailsys.com> On Sun, Apr 10, 2005 at 01:42:21AM +0200, Twan van der Schoot wrote: > To whomever is listening, > > What has happened to the http://www.erlang.org site? > Is it up? Or do I've, in likelyhood, a problem at my side? > > I can't reach it for a number of days now. You are not alone :-( -Rick From ulf@REDACTED Sun Apr 10 09:07:19 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 10 Apr 2005 09:07:19 +0200 Subject: [Spam] [SpamSA] What's up with www.erlang.org? In-Reply-To: References: Message-ID: Den 2005-04-10 01:42:21 skrev Twan van der Schoot : > To whomever is listening, > > What has happened to the http://www.erlang.org site? > Is it up? Or do I've, in likelyhood, a problem at my side? > > I can't reach it for a number of days now. > > thanks in advance, I believe that a router is down due to hardware problems (fried flash circuitry or whatnot). /Uffe From francesco@REDACTED Sun Apr 10 11:22:42 2005 From: francesco@REDACTED (Francesco Cesarini (Erlang Training & Consulting)) Date: Sun, 10 Apr 2005 10:22:42 +0100 Subject: What's up with www.erlang.org? In-Reply-To: References: Message-ID: <4258F062.2060106@erlang-consulting.com> The fried flash circuitry was caused by a power failure last weekend. They hope the site will be up soon. Mirror sites are available at http://www.serc.rmit.edu.au/mirrors/ose_mirror/ http://www.csd.uu.se/ftp/mirror/erlang/ http://erlang.stacken.kth.se/ Regards, Francesco -- http://www.erlang-consulting.com Ulf Wiger wrote: > Den 2005-04-10 01:42:21 skrev Twan van der Schoot : > >> To whomever is listening, >> >> What has happened to the http://www.erlang.org site? >> Is it up? Or do I've, in likelyhood, a problem at my side? >> >> I can't reach it for a number of days now. >> >> thanks in advance, > > > I believe that a router is down due to hardware > problems (fried flash circuitry or whatnot). > > /Uffe > > From csanto@REDACTED Sun Apr 10 12:06:21 2005 From: csanto@REDACTED (Corrado Santoro) Date: Sun, 10 Apr 2005 12:06:21 +0200 Subject: Erlang use in Italy In-Reply-To: <4257C927.7090801@erlang-consulting.com> References: <4256B1DC.2060609@diit.unict.it> <4257C927.7090801@erlang-consulting.com> Message-ID: <4258FA9D.4090606@diit.unict.it> Francesco Cesarini (Erlang Training & Consulting) wrote: > Now, if the University of Catania started teaching Erlang (hint hint :-) > ), that would be another story.. I'm trying to do it... but the main problem is to overcome the "resistance" of some people who say: "Concurrent programming? Ah, pthreads... what other?" :-OO Ciao, --C. -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From erlang@REDACTED Sun Apr 10 20:33:48 2005 From: erlang@REDACTED (Peter-Henry Mander) Date: Sun, 10 Apr 2005 19:33:48 +0100 Subject: Erlang use in Italy In-Reply-To: <4258FA9D.4090606@diit.unict.it> References: <4256B1DC.2060609@diit.unict.it> <4257C927.7090801@erlang-consulting.com> <4258FA9D.4090606@diit.unict.it> Message-ID: <20050410193348.2bf48c17.erlang@manderp.freeserve.co.uk> On Sun, 10 Apr 2005 12:06:21 +0200 Corrado Santoro wrote: > I'm trying to do it... but the main problem is to overcome the > "resistance" of some people who say: "Concurrent programming? Ah, > pthreads... what other?" :-OO Ah yes, I've had to contend with this for quite some time. Unfortunately trying to explain the benefits of Erlang concurrent programming to someone more versed in C or any other low level language, they will often take each individual feature in isolation and reply "so what? I can do that too in C." Of course you can, but there's more effort involved, its more error prone, and it takes much longer to get it to work correctly. If you follow their reasoning to it's absurd conclusion, you may as well write all programs in binary digits without the aid of compilers. That's what programs are compiled into after all! You may try to convince them that the *combination* of features offered by Erlang and the way Erlang programs are written leads to far less programming errors and quicker results (not quicker programs mind you, but read below) and shorter delivery time to customers, and money in your pockets sooner. But I've found that low level programmers are usually too busy hunting down a mysterious intermittent bug, and have no time to spare in fruitful discussion because the deadline died a long time ago and the customer is breathing down their necks. I still hear the guys using C or C++ where I work talk at great length about memory management issues, messaging queue implementations and distribution across nodes, mutexes, semaphores, race conditions, database replication etc... even after more than THREE YEARS of development effort! All the stuff that Erlang gives you with little or no effort. These problems are so *old* and have been analysed and solved many times over before. To have to reinvent the wheel for every new project seems a total waste of time, and yet these guys persist. It's like a macho programmer culture; unless you do it the hard way, you're simply not programming! I think the most convincing way of introducing Erlang into a project is to have it available and ready to replace a failing project, or to fill a need that no one else has been able to satisfy. Otherwise people will simply stick to what they know and are comfortable with, which usually means C. One cause of resistance is the need to learn a different programming paradigm. Only those programmers who encountered Prolog during university seem willing to try it out. The logic/functional programming idiom seems to mystify a lot of imperative programmers. Another argument against Erlang is speed. With simple or moderately complex programs, certainly C will win outright with up to 10x speed advantage. However, when you deal with massively concurrent systems as in telecoms, you have to keep feeding many mouths, avoid getting bubbles in the plumbing, and maintain throughput throughout the whole system to achieve optimum performance. Get it wrong and performance drops like a proverbial lead balloon, and may God help you find the cure! Using Erlang at the outset will help enormously to ease these kinds of problems. Persist as long as you can Corrado, you may end up with them saying "Oh no, not Erlang *again*!" whenever they see you :-) Pete. -- "The Tao of Programming flows far away and returns on the wind of morning." From ulf@REDACTED Sun Apr 10 22:33:30 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 10 Apr 2005 22:33:30 +0200 Subject: Erlang use in Italy In-Reply-To: <20050410193348.2bf48c17.erlang@manderp.freeserve.co.uk> References: <4256B1DC.2060609@diit.unict.it> <4257C927.7090801@erlang-consulting.com> <4258FA9D.4090606@diit.unict.it> <20050410193348.2bf48c17.erlang@manderp.freeserve.co.uk> Message-ID: Den 2005-04-10 20:33:48 skrev Peter-Henry Mander : > Unfortunately trying to explain the benefits of Erlang concurrent > programming to someone more versed in C or any other low level language, > they will often take each individual feature in isolation and reply "so > what? I can do that too in C." Of course you can, but there's more > effort involved, its more error prone, and it takes much longer to get > it to work correctly. If you follow their reasoning to it's absurd > conclusion, you may as well write all programs in binary digits without > the aid of compilers. That's what programs are compiled into after all! Reading http://www.galois.com/methods.php, you come across this justification for using a higher-level programming language: "All programming languages suffer from a semantic gap: once the developer has worked out how to solve a problem, they have to translate that solution into the concrete syntax of the programming language. In traditional languages, such as C, C++, and Java, the semantic gap is large, and the translation is error-prone and time-consuming. In comparison, functional languages, such as Haskell, ML, and Caml, allow developers to express their ideas relatively directly. The rest of the translation is handled by the compiler, and is governed by strict, mathematical principles. By removing the ad-hoc, error-prone, time-consuming translation step, functional languages enable developers to produce correct code in a fraction of the time." Not that it will impress macho programmers, but perhaps it can be used in order to try to explain things to people who have to deal with programmers, and wonder why software development is such a beast to manage. /Uffe From twanvds@REDACTED Mon Apr 11 01:53:42 2005 From: twanvds@REDACTED (Twan van der Schoot) Date: Mon, 11 Apr 2005 01:53:42 +0200 Subject: What's up with www.erlang.org? In-Reply-To: <4258F062.2060106@erlang-consulting.com> Message-ID: Thanks. I hope everything will work out alright. Many more with me, I would geuss ;-) good luck Twan > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Francesco > Cesarini (Erlang Training & Consulting) > Sent: zondag 10 april 2005 11:23 > To: Ulf Wiger > Cc: erlang-questions@REDACTED > Subject: Re: What's up with www.erlang.org? > > > The fried flash circuitry was caused by a power failure last weekend. > They hope the site will be up soon. Mirror sites are available at > > http://www.serc.rmit.edu.au/mirrors/ose_mirror/ > > http://www.csd.uu.se/ftp/mirror/erlang/ > > http://erlang.stacken.kth.se/ > > Regards, > Francesco > -- > http://www.erlang-consulting.com > > Ulf Wiger wrote: > > Den 2005-04-10 01:42:21 skrev Twan van der Schoot : > > > >> To whomever is listening, > >> > >> What has happened to the http://www.erlang.org site? > >> Is it up? Or do I've, in likelyhood, a problem at my side? > >> > >> I can't reach it for a number of days now. > >> > >> thanks in advance, > > > > > > I believe that a router is down due to hardware > > problems (fried flash circuitry or whatnot). > > > > /Uffe > > > > > > > From ft@REDACTED Mon Apr 11 07:58:54 2005 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 11 Apr 2005 07:58:54 +0200 Subject: YXA with CPL support written in Erlang/OTP now available In-Reply-To: References: <4251454E.3080007@mbox304.swipnet.se> Message-ID: On 8 apr 2005, at 16.17, Anders Nygren wrote: > On Apr 4, 2005 8:46 AM, H?kan Stenholm > wrote: >> ___YXA with CPL support now available___ >> >> Erlang/OTP based CPL support, developed by me (H?kan Stenholm), has >> now for the first time been integrated into the public YXA release >> (snapshot 2005-04-04). >> > > I could not find any information on which licence yxa is released > under. > So, what license is used? I see, the cvsweb link is broken. I'll ask someone at Stacken to have a look at that. To answer your question, it is released under KTH's three-clause BSD license. See the file COPYING in cvs or one of the snapshots. /Fredrik From maruthavanan_s@REDACTED Mon Apr 11 09:14:10 2005 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Mon, 11 Apr 2005 07:14:10 +0000 Subject: socket closed in ei_interface Message-ID: An HTML attachment was scrubbed... URL: From tobias.lindahl@REDACTED Mon Apr 11 11:05:05 2005 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Mon, 11 Apr 2005 11:05:05 +0200 (MEST) Subject: New analysis case for Dialyzer ? In-Reply-To: <425796A7.6030400@erlang-fr.org> References: <425796A7.6030400@erlang-fr.org> Message-ID: Hi Mickael, Thanks for the report. We are really interested in getting suggestions on what Dialyzer should find but currently doesn't. I agree that this should be found by Dialyzer, and hopefully this will be solved. The reason it is not found is an old issue that has been discussed before, but it might be worth mentioning again. In > * TS = To#psock.s, the problem is that accessing a field of a record using the .-notation is not a guarantee that the variable is an instance of the record. It compiles in the same way as erlang:element/2, so the only limitation on TO in your example is that it is a tuple and that it is sufficiently big to take the element corresponding to the record field s from it. The type signature of erlang:send/2 (or !) is: send(pid() | port() | atom() | {atom(), atom()}, any()) -> any() The information that the first operand is a tuple will not yield a discrepancy report, since it might succeed. (If something can succeed Dialyzer currently reports nothing to avoid false positives.) However, if the use of To had been protected by an is_record-guard, or if the more safe construct #psock{s=TS} = TO Dialyzer would have reported the discrepancy since it would have had more information about TO. Tobias On Sat, 9 Apr 2005, Mickael Remond wrote: > Hello, > > Here is a piece of code that contains a bug: (* are marking the > interesting lines): > > -=-=-=- > * TS = To#psock.s, > case From#psock.mode of > expectheaders -> > SSL = nossl, > case yaws:http_get_headers(From#psock.s, SSL) of > {R, H0} -> > ?Debug("R = ~p~n",[R]), > RStr = > if > %% FIXME handle bad_request here > record(R, http_response) -> > yaws_api:reformat_response(R); > record(R, http_request) -> > * To ! {cli2srv, R#http_request.method, > H0#headers.host}, > yaws_api:reformat_request( > rewrite_path(R, From#psock.prefix)) > end, > -=-=-=- > > The To variable is used as a record, but later on is used as a Pid. > I try to analyse the code with Dialyzer, but it did not suspect the > problem. Maybe analysis has been extended in the latest version of > Dialyzer (I did not try the brand new one), but I thought that actually > this piece of code might help the HiPE team. > > Cheers, > > -- > Micka?l R?mond > http://www.erlang-projects.org/ > > From bjorn@REDACTED Mon Apr 11 11:44:42 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 11 Apr 2005 11:44:42 +0200 Subject: New analysis case for Dialyzer ? In-Reply-To: References: <425796A7.6030400@erlang-fr.org> Message-ID: Tobias Lindahl writes: [...] > In > > > * TS = To#psock.s, > > the problem is that accessing a field of a record using the .-notation is > not a guarantee that the variable is an instance of the record. It > compiles in the same way as erlang:element/2, so the only limitation on TO > in your example is that it is a tuple and that it is sufficiently big to > take the element corresponding to the record field s from it. We plan to eventually change that, so that there will be a proper record test when "." to access elements. I am not sure we will have time to do that for R11B, though. > > The type signature of erlang:send/2 (or !) is: > > send(pid() | port() | atom() | {atom(), atom()}, any()) -> any() > > The information that the first operand is a tuple will not yield a > discrepancy report, since it might succeed. (If something can succeed > Dialyzer currently reports nothing to avoid false positives.) It could generate a report if the tuple is known to have a size larger than 2 (unless the 's' element happens to be the first in the record, the tuple has more than 2 elements). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From thomasl_erlang@REDACTED Mon Apr 11 11:47:26 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 11 Apr 2005 02:47:26 -0700 (PDT) Subject: Erlang use in Italy In-Reply-To: 6667 Message-ID: <20050411094726.79472.qmail@web41905.mail.yahoo.com> --- Peter-Henry Mander wrote: > I still hear the guys using C or C++ where I work > talk at great length > about memory management issues, messaging queue > implementations and > distribution across nodes, mutexes, semaphores, race > conditions, > database replication etc... even after more than > THREE YEARS of > development effort! As an acquaintance of mine put it (with some relish), "effort is not progress". I think the case can be made that (i) Erlang is lower risk than "roll your own" since much or most of the above development has already been done and tested for you, including the huge swathe of C code invoked by the emulator; furthermore (ii) Erlang thus permits you to work on "adding value", as the business types put it, rather than messing around with home grown solutions to well-known if difficult problems. I wouldn't say Erlang is a silver bullet, but it does at least provide a simple, powerful, flexible, proven way of writing and debugging functioning concurrent and distributed code. > Another argument against Erlang is speed. With > simple or moderately > complex programs, certainly C will win outright with > up to 10x speed advantage. On the other hand, if the Erlang program is fast enough (and in practice it often is), why sit around tinkering with C or C++? Have they no sense of urgency?? :-) Also, do their C solutions scale? How many threads can they run at a time? What is the space overhead per thread? Throughput vs latency and all that. Maybe you should show them Joe's yaws-graph. (And then there's the reliability aspect of performance.) Sure, in some performance critical cases, especially regarding latency, Erlang might still be too slow. In that case, why not use Erlang for the OAM parts? :-) However, if the other party is satisfied with what they have, and they are making their deadlines (and the time to market is good enough), then I think you will have an uphill battle. There has to be a compelling reason to switch -- otherwise there will just be a lot of disgruntled programmers who will produce sub-par Erlang code and blame the problems on the language. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From tobias.lindahl@REDACTED Mon Apr 11 12:04:40 2005 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Mon, 11 Apr 2005 12:04:40 +0200 (MEST) Subject: New analysis case for Dialyzer ? In-Reply-To: References: <425796A7.6030400@erlang-fr.org> Message-ID: On Mon, 11 Apr 2005, Bjorn Gustavsson wrote: [...] > It could generate a report if the tuple is known to have a size larger > than 2 (unless the 's' element happens to be the first in the record, > the tuple has more than 2 elements). Well, this is possible I guess, but it would involve a type that is "A tuple with size >= X" and that would be a bit problematic. I'd rather have you fix the dot-notation for records ;) Tobias From csanto@REDACTED Mon Apr 11 17:08:09 2005 From: csanto@REDACTED (Corrado Santoro) Date: Mon, 11 Apr 2005 17:08:09 +0200 Subject: Some claims about Erlang (was Re: Erlang use in Italy) Message-ID: <425A92D9.1020409@diit.unict.it> I would like to thank everyone posted a comment on Erlang vs. C/C++. Such comments will be very useful in trying to convice my organization on the opportunity to organize some lectures on Erlang. Just for fun (but also for your information), I would like to let you know some claims about Erlang said by many people (researchers, software developers, professors) who don't know Erlang, but pretend to evaluate it with respect to other approaches: "Programming in Erlang requires much effort, since you must deal with process calculi." (a reviewer of a paper of mine) "Programming in Erlang seems easy, but the source code is quite unreadable; maybe we could try to find a syntax that is less complex." "Erlang? 'quick-and-dirty'. I dislike this kind of approaches! I prefer Java." "What are the performances of Erlang? It's bytecoded! It never reach the performances of Java" (forgetting the performance problems Java had in the past, and the *huge* amount of time required *now* by Eclipse to start!) "Who is teaching Erlang? All students take the degree learning C, C++ and Java. This is what companies require" (a professor forgetting that students should learn *how to program*, not *how to program with a specific language*). ... only to cite a few. Ciao, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From ke.han@REDACTED Mon Apr 11 18:44:56 2005 From: ke.han@REDACTED (ke.han) Date: Tue, 12 Apr 2005 00:44:56 +0800 Subject: Python integration In-Reply-To: <20050401180302.29415@smtp.gmail.com> References: <20050401180302.29415@smtp.gmail.com> Message-ID: <425AA988.3020000@redstarling.com> Joel Reymont wrote: > Folks, > > Is there a library that would let me connect to Erlang nodes from Python, > hopefully over SSL? > > I understand that configuring a node to talk to another node over SSL is > no big deal but how does this work when Python /C++, etc./ is on the > other end? > > Thanks, Joel > I believe there is a link on the front page of www.erlang.org for erlang python. ke han From thomasl_erlang@REDACTED Mon Apr 11 19:31:06 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 11 Apr 2005 10:31:06 -0700 (PDT) Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: 6667 Message-ID: <20050411173106.15770.qmail@web41902.mail.yahoo.com> --- Corrado Santoro wrote: > "What are the performances of Erlang? It's > bytecoded! It never reach the > performances of Java" The above is particularly funny if one just remembers that teeny, tiny, piddling Java detail: the stack based, byte coded Java Virtual Machine. Your correspondent shows keen insight indeed :-) > "Who is teaching Erlang? All students take the > degree learning C, C++ > and Java. This is what companies require" The C/C++/Java guy is not in the audience for stealing a march on the competition. He will change his tune only when the big companies tells him to (ask him about C# and you might catch him looking over his shoulder to see if Microsoft heard his comment). His students will likely be the interchangeable commodity building blocks that parts of the industry desire. Bah humbug. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From garry@REDACTED Mon Apr 11 20:19:02 2005 From: garry@REDACTED (Garry Hodgson) Date: Mon, 11 Apr 2005 14:19:02 -0400 Subject: Erlang use in Italy In-Reply-To: <4258FA9D.4090606@diit.unict.it> References: <4258FA9D.4090606@diit.unict.it> Message-ID: <2005041114191113243542@k2.sage.att.com> Corrado Santoro wrote: > Francesco Cesarini (Erlang Training & Consulting) wrote: > > Now, if the University of Catania started teaching Erlang (hint hint :-) > > ), that would be another story.. > > I'm trying to do it... but the main problem is to overcome the > "resistance" of some people who say: "Concurrent programming? Ah, > pthreads... what other?" :-OO or just as bad: "Concurrent programming. Java threads solved it." ---- Garry Hodgson, Technical Consultant, AT&T Labs Your love, your anger, your kindness, your hate. All of it creates the future for you and your children. What kind of future are you creating today? From serge@REDACTED Mon Apr 11 21:05:05 2005 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 11 Apr 2005 15:05:05 -0400 Subject: Configuration update In-Reply-To: <424C751A.7010701@hq.idt.net> References: <20050331153924.3956@smtp.gmail.com> <424C696B.2090406@cisco.com> <424C751A.7010701@hq.idt.net> Message-ID: <425ACA61.9070903@hq.idt.net> I think my prior submission attempt didn't get posted during list unavailability, so here it is again: ----------------- Is there a way to refresh the node/application's configuration by rereading the content of the sys.config (or application-specific config provided on command line, such as: "erl -config "file...") file without restarting the node? Since the content of the config file becomes a part of the application's environment at node startup, I want to ensure that I can change the configuration (by making changes in the config file using text editor), and force the application to refresh its environment with the new changes from file. Merely trying to restart an application on a running node doesn't reread the config file's content. What's the OTP-way to address this problem? Regards, Serge P.S. I found an undocumented application_controller:change_application_data/2 function. Am I looking in the right direction? From erlang-list@REDACTED Mon Apr 11 22:05:21 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 11 Apr 2005 22:05:21 +0200 Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: <425A92D9.1020409@diit.unict.it> References: <425A92D9.1020409@diit.unict.it> Message-ID: <425AD881.4060701@dominicwilliams.net> Corrado Santoro wrote: > some claims about Erlang said by many people [...] Each of those sentences would make an excellent starting point to play Dale Emery's "Resistance as a resource" game, which he recently introduced on the extreme programming mailing list. The key point is, rather than dismiss the resistance, to try and justify and understand it before providing responses that target possibly valid points. Here are the rules (see http://www.dhemery.com/cwd/2005/04/raar.html). Objective. To create, learn, remember, and express ideas about how to respond to resistance. Where to Play. The game can be played anywhere that ideas can be posted, such as mailing lists, electronic forums, and conference rooms with walls, white boards, or flip charts. Players. Any number of players can play. Turns. It is always your turn. Moves. There are four kinds of moves: 1. Change. Post an example of change that you are promoting. (In our case, this would be "Use Erlang"). 2. "Resistance." Choose one of the posted examples of change, and post an example of a statement that expresses "resistance" to that change. The examples posted by Corrado are each an example, there may be more. 3. Reason. Choose one of the posted examples of "resistance," and post an example of a reason that an intelligent, competent, sincere person of good will might say such a thing. Dale's article "Resistance as a Resource" might give you ideas for this move. 4. Response. Choose one of the posted reasons, and post an idea about how to respond effectively to someone who has that reason for making that statement. Cheers, Dominic Williams http://www.dominicwilliams.net ---- From erlang-list@REDACTED Mon Apr 11 22:16:50 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Mon, 11 Apr 2005 22:16:50 +0200 Subject: Resistance to Erlang In-Reply-To: <425A92D9.1020409@diit.unict.it> References: <425A92D9.1020409@diit.unict.it> Message-ID: <425ADB32.2050704@dominicwilliams.net> Suggested change: use Erlang Resistance: > "Programming in Erlang requires much effort, since you > must deal with process calculi." Reason: Erlang combines functional programming and the pi calculus, each based on mathematics and logic. It's a really interesting academic field, I'd love to work on that sort of thing if I were a professor, but it has no practical applications, especially with teams of ordinary programmers who don't have Ph.D's in mathematics. Dominic Williams (playing the "resistance as a resource" game) http://www.dominicwilliams.net ---- From mickael.remond@REDACTED Mon Apr 11 22:33:51 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 11 Apr 2005 22:33:51 +0200 Subject: Resistance to Erlang In-Reply-To: <425ADB32.2050704@dominicwilliams.net> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> Message-ID: <425ADF2F.60409@erlang-fr.org> Dominic Williams a ?crit : > Suggested change: use Erlang > > Resistance: > >> "Programming in Erlang requires much effort, since you >> must deal with process calculi." > > > Reason: > > Erlang combines functional programming and the pi calculus, each based > on mathematics and logic. It's a really interesting academic field, I'd > love to work on that sort of thing if I were a professor, but it has no > practical applications, especially with teams of ordinary programmers > who don't have Ph.D's in mathematics. Answer ? Erlang has a strong background, coming from fields that lead to a very advanced and efficient programming. However, you do not have to understand the theorical background in Erlang to be an efficient and effective programmer, as you do not have to understand the mathematical background behind SQL (such as relational algebra) to write database queries. Moreover, Erlang comes from a practical and industrial approach. It has originally been written by the industry to solve real live problem. Funny game. -- Micka?l R?mond http://www.erlang-projects.org/ From klacke@REDACTED Mon Apr 11 22:30:37 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Mon, 11 Apr 2005 22:30:37 +0200 Subject: bug in inet_drv.c Message-ID: <20050411203037.GA11811@hyber.org> Howdy, I resent an old bug report of mine a couple of months ago but I'm not sure what happened to it. It's a pretty serious bug and I recommend everone running erlang systems that use sockets with {packet, http} (this includes all yaws systems) to apply the patch. Otherwise it's easy to bring down the entire erlang node just by sending broken HTTP requests at it. Anyway, the bug is old and originally reported at: http://www.erlang.org/ml-archive/erlang-questions/200302/msg00493.html and a correct description at http://article.gmane.org/gmane.comp.lang.erlang.patches/3 The patch is: --- inet_drv.c.orig 2005-04-08 17:33:37.003071900 +0200 +++ inet_drv.c 2005-04-08 17:33:43.279602316 +0200 @@ -1980,7 +1980,7 @@ int c; /* start-line = Request-Line | Status-Line */ if (n == 0) - return 0; + return -1; h = 0; meth_ptr = ptr; while (n && !is_tspecial((unsigned char)*ptr)) { /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From rpettit@REDACTED Mon Apr 11 23:11:55 2005 From: rpettit@REDACTED (Rick Pettit) Date: Mon, 11 Apr 2005 16:11:55 -0500 Subject: Resistance to Erlang In-Reply-To: <425ADB32.2050704@dominicwilliams.net> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> Message-ID: <20050411211155.GB20879@vailsys.com> On Mon, Apr 11, 2005 at 10:16:50PM +0200, Dominic Williams wrote: > Suggested change: use Erlang > > Resistance: > > >"Programming in Erlang requires much effort, since you > >must deal with process calculi." > > Reason: > > Erlang combines functional programming and the pi calculus, > each based on mathematics and logic. It's a really > interesting academic field, I'd love to work on that sort of > thing if I were a professor, but it has no practical > applications, especially with teams of ordinary programmers > who don't have Ph.D's in mathematics. Sending a message to a process is a one-liner in Erlang - is that easier than setting up a socket in C/C++? Concurrency in C/C++ to many people implies pthreads - is that simpler than message passing? The list goes on and on. All the arguments mentioned are hogwash. As I see it the biggest problem is that nobody has published a book entitled, "Erlang for Idiots". Fortunately there are plenty other languages (and idiots guides to them) for those who insist on resisting Erlang. -Rick P.S. Someone should write a book entitled, "Concurrent Programming In Non-concurrent Languages For Dummies" - good be a best seller. From todd@REDACTED Mon Apr 11 23:44:51 2005 From: todd@REDACTED (todd) Date: Mon, 11 Apr 2005 14:44:51 -0700 Subject: Resistance to Erlang In-Reply-To: <20050411211155.GB20879@vailsys.com> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> <20050411211155.GB20879@vailsys.com> Message-ID: <425AEFD3.9050908@possibility.com> Rick Pettit wrote: >Sending a message to a process is a one-liner in Erlang - is that easier than >setting up a socket in C/C++? > > Nope. You are always using a class libary so it's usually just a one liner of some sort. You can get streams and async completion for free as well. >Concurrency in C/C++ to many people implies pthreads - is that simpler than >message passing? > > Easy to do in c++ as well. But since it's not enforced in C++ it doesn't count in my book. Lot's of shared state happens easily in c++, even when you don't want it. >The list goes on and on. All the arguments mentioned are hogwash. As I see it >the biggest problem is that nobody has published a book entitled, "Erlang for >Idiots". > > > Sounds good. It would be nice to have a slam dunk example of how erlang can solve problems better. From ulf@REDACTED Tue Apr 12 01:04:45 2005 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 12 Apr 2005 01:04:45 +0200 Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: <425A92D9.1020409@diit.unict.it> References: <425A92D9.1020409@diit.unict.it> Message-ID: Den 2005-04-11 17:08:09 skrev Corrado Santoro : > "Programming in Erlang requires much effort, since you must deal with > process calculi." (a reviewer of a paper of mine) Hehe - a virtual hands-up, all of you on the list who use process calculi in your daily Erlang programming work. (: > "Who is teaching Erlang? All students take the degree learning > C, C++ and Java. This is what companies require" (a professor > forgetting that students should learn *how to program*, not > *how to program with a specific language*). I recall a lecture in "Programming Parallel Systems", when the professor started scribbling a code example on the black board (yes, back in the old days, before the white boards). He was interrupted by a student: "What's that?!" "Why, it's pseudo-code", the professor said. "We don't know pseudo-code. We only know Pascal", the student countered. The professor was stumped - "But I can't express this in Pascal..." but to no avail. The teaching couldn't go on, and the rest of the class was spent discussing the virtues of learning more than one language. /Uffe From mscandar@REDACTED Tue Apr 12 01:44:49 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Mon, 11 Apr 2005 19:44:49 -0400 Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: References: <425A92D9.1020409@diit.unict.it> Message-ID: <425B0BF1.9010303@cisco.com> Ulf Wiger wrote: > Den 2005-04-11 17:08:09 skrev Corrado Santoro : > >> "Programming in Erlang requires much effort, since you must deal with >> process calculi." (a reviewer of a paper of mine) > > > Hehe - a virtual hands-up, all of you on the list who > use process calculi in your daily Erlang programming work. (: Probably the same folks using differential equations to drive their cars. From chas@REDACTED Tue Apr 12 04:47:07 2005 From: chas@REDACTED (Charles Blair) Date: Mon, 11 Apr 2005 21:47:07 -0500 Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: <20050411173106.15770.qmail@web41902.mail.yahoo.com> References: <20050411173106.15770.qmail@web41902.mail.yahoo.com> Message-ID: <20050412024707.GD12546@nirvana.lib.uchicago.edu> > > "Who is teaching Erlang? All students take the > > degree learning C, C++ > > and Java. This is what companies require" > His students will likely be the interchangeable commodity building > blocks that parts of the industry desire. Bah humbug. we have been in the position of having to interview scores of such people during the past six years or so. unless one is in those parts of the industry where the programmer is intended to be a commodity, as opposed to someone who is expected to have some degree of investment in the enterprise, most of these "cookie-cutter degrees" (as my lead programmer/analyst calls them) are worthless: we don't need people with no experience who've learnt how to program yet another shopping cart application in java. (we have hired inexperienced people with CS degrees, but they had other things going for them. one was a graduate of Beijing University: if you get that far in a country of a billion people, we're going to take notice. another was a 19-year old graduate of Trinity College, Dublin: if you get that far that young, we're also going to take notice. a third was a Ph.D. with a programming certificate; again, if you're that motivated to make a mid-life career change, we'll give you a good look.) in my (university) position, some of the people most able to build the applications we need are kids, some of whom haven't even graduated from college yet, with php, mysql, apache and (increasingly) flash skills. these are very smart generalists, not specialists, with a good grasp of the problem domain, which motivates them, because they know, understand, like and respect it, and they'll work for what we can pay them: we can't afford to compete with industry for experienced java programmers. my hope is that the erlang community keeps working on its software "ensemble" (erlang + yaws + (d)ets/mnesia), so that it remains a viable alternative to php + apache + mysql (the "AMP" in "LAMP").[1] either of these right now is a viable alternative for what i need to do, as opposed to the badly bloated java servlet alternative (with, increasingly, an XML component thrown in), which simply adds superfluous overhead (machine and human) to a project. (we are running these as well.) [1] we have used perl and python, and have a major production application programmed in Tcl. we have important utilities written in OCaml, Tcl and Common Lisp, and a server written in erlang + yaws. --- Charles Blair Co-Director, Digital Library Development Center 773-702-8459 University of Chicago Library chas@REDACTED http://www.lib.uchicago.edu/~chas/ From david.nospam.hopwood@REDACTED Tue Apr 12 05:12:34 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 12 Apr 2005 04:12:34 +0100 Subject: Resistance to Erlang In-Reply-To: <425ADB32.2050704@dominicwilliams.net> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> Message-ID: <425B3CA2.5080902@blueyonder.co.uk> Dominic Williams wrote: > Suggested change: use Erlang > > Resistance: > >> "Programming in Erlang requires much effort, since you >> must deal with process calculi." > > Reason: > > Erlang combines functional programming and the pi calculus, each based > on mathematics and logic. It's a really interesting academic field, I'd > love to work on that sort of thing if I were a professor, but it has no > practical applications, especially with teams of ordinary programmers > who don't have Ph.D's in mathematics. In practice, message passing concurrency, especially combined with mostly functional programming as in Erlang, is much easier to deal with for ordinary programmers than is shared state concurrency using mutexes, condition variables etc. In particular it's easier to write programs that avoid both deadlock and race conditions. To correct a minor technical point, Erlang supports asynchronous message passing. The pi calculus uses synchronous message passing, which is a quite different model. It would be possible to model Erlang using (other) process calculi, but that doesn't make Erlang any less practical, and there's no need for anything like that when doing ordinary Erlang programming. Mickael Remond wrote: > Erlang has a strong background, coming from fields that lead to a very > advanced and efficient programming. However, you do not have to > understand the theorical background in Erlang to be an efficient and > effective programmer, as you do not have to understand the mathematical > background behind SQL (such as relational algebra) to write database > queries. Personally I'd say that you *do* have to understand relational algebra to write database queries well -- so this is not a good example. It's not as though relational algebra is difficult (it's quite a bit simpler than the pi calculus). -- David Hopwood From chas@REDACTED Tue Apr 12 05:54:41 2005 From: chas@REDACTED (Charles Blair) Date: Mon, 11 Apr 2005 22:54:41 -0500 Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: <425A92D9.1020409@diit.unict.it> References: <425A92D9.1020409@diit.unict.it> Message-ID: <20050412035440.GE12546@nirvana.lib.uchicago.edu> all right. i cannot let some of these pass me by without comment! :-) On Mon, Apr 11, 2005 at 05:08:09PM +0200, Corrado Santoro wrote: > "Programming in Erlang requires much effort, since you must deal with > process calculi." (a reviewer of a paper of mine) as a manager, my criterion for the practical worth of a new (to me) programming language is, can i learn enough of it in a weekend (because my schedule is otherwise too busy) to do some fun and/or real work in it? two languages have passed this test so far: ruby and erlang. (ruby i don't use, though it stimulated an interesting benchmarking contest with my lead programmer/analyst in which Ocaml won hands down; erlang i do. this is because i don't need yet another object-oriented programming language, though i'm not knocking ruby; it's just that functional languages are more "edgy," and "edgy" is quite frankly cool.) > "Programming in Erlang seems easy, but the source code is quite > unreadable; maybe we could try to find a syntax that is less complex." uh: erlang is the _only_ language in which i've programmed that i can go back to some code i've written some months back _without comments_ and pretty much pick up from where i left off. this is a big win from both a programmer's and a manager's perspective. i could argue that the strictures that erlang imposes make this possible. > "Erlang? 'quick-and-dirty'. I dislike this kind of approaches! I prefer > Java." quick and clean is more like it. to me "dirty" is the kind of side-effectful thing that other languages either promote or connive at. > "What are the performances of Erlang? It's bytecoded! It never reach the > performances of Java" (forgetting the performance problems Java had in > the past, and the *huge* amount of time required *now* by Eclipse to start!) to paraphrase mr. rogers, "can you say 'memory hog,' boys and girls? i thought you could." java is a pig. > "Who is teaching Erlang? All students take the degree learning C, C++ > and Java. This is what companies require" (a professor forgetting that > students should learn *how to program*, not *how to program with a > specific language*). i _do not want to hire_ people simply because they have a specific kind of _training_: i need people who can _think_ (not to mention a good "bedside manner" when it comes to dealing with end-users: in a smallish shop without a dedicated help desk this is essential); effective thinking in this field typically requires a combination of aptitude and experience; how experience is come by is largely immaterial. programming is a talent. yes: a good artist can be enriched by training, but training alone cannot make a good artist. there's got to be some knack there beforehand. a good manager is on the lookout for talent; training one can provide on the job, if one can afford it. From joe.armstrong@REDACTED Tue Apr 12 09:31:49 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 12 Apr 2005 09:31:49 +0200 Subject: Resistance to Erlang Message-ID: How do you overcome resistance to Erlang? To start with you can never "sell" a programming language. You have to "sell" applications. People didn't learn HTML/javascript/CSS/PHP/MySQL out of any intrinsic love of the language - *nobody* in their right mind would want to learn HTML etc. No - they want to make web pages. People didn't learn SQL because it fun - no, they want to make billing systems or whatever turns them on (Prolog's query language is zonks better :-) Programming language have unique advantages if and only if they make the programming of a particular class of problem easy, and if somebody wants that class of program. Thus certain languages are totally dominant in their domains Examples: Postscript for page description HTML for web page pages Partial domination is when one particular language excels for a particular class of problem Examples: C Operating systems SQL Data base queue language Visual basic Windows GUIs Java Applets After this is the "any language will do category" ... perl/lua/C++/... To make Erlang popular I think we must target the "partial domination" category for distributed fault-tolerant applications - this is what is was designed for, this is what it is good at. Amazingly applications like Wings etc are gaining popularity - wings is a graphics application that makes very little use of Erlang's strengths. Erlang is ideal for writing distributed applications - this is where it shines - but very few applications are distributed (most networked apps are simple non-fault tolerant client-server) The real area were we should be writing distributed apps is probably to be found in the cluster peer-2-peer worlds. To make any inroads you must target your arguments to the audiences (ie arguments are not universal, use the correct argument for the correct person). If it's a business person the argument is easy: The have to prove the assertion: "You will make more money by using Erlang than using X" If you cannot argue this for all reasonable X you loose. For a programmer: "It will be quicker to write in Erlang than X" (or more maintainable, etc) << the argument is complicated by folding in the time to learn Erlang - but then again Erlang was designed to be easy to learn - in the early stages we ran courses for hundreds of regular Ericsson programmers - and we were constantly changing things to make it easier to teach and learn >> Without a great "hype" industry telling people what to think that Erlang will never reach the giddy heights of C#, C++ etc. I think we need to aim at a balanced point were we have sufficient users so as to ensure that we do not die from starvation or just lack of interest - and not too many users so that those who do use Erlang retain their commercial advantage. There is one interesting group of people who are not singing the praises of Erlang - these are companies that are silently using Erlang in their products - they gain commercial advantage from this - and are not particularly keen to see their compeditors change from inferior technologies and start competing with them. IMHO people will use language X instead of Y if they can make more money using X than using Y - then eventually all the users of Y die out - Darwinism. Cheers /Joe From erlang@REDACTED Tue Apr 12 09:51:00 2005 From: erlang@REDACTED (Peter Lund) Date: Tue, 12 Apr 2005 09:51:00 +0200 Subject: inets patch on basic authentication Message-ID: <425B7DE4.1040908@lundata.se> Hi, To get basic authentication to work better in inets you (OTP) should apply this patch to the file mod_auth.erl in the latest inets 4.3.1 in (OTP R10B-4). The problem fixed is that the current inets only pops up the basic authentication window on the client browser once, not every time when the user supplies a bad user/password combination. This bug forces the user to kill the browser entirely after a failed login attempt, before the user may try to login again. This is what this fix fixes. With this patch inets sends the "WWW-Authenticate" header every time the user fails to login correctly. It works with my mnesia based authentication. If it also fixes the same problem for the file based authentication version I do not know. I have not tested it. Please do. [peterl@REDACTED OTPpatch]$ diff mod_auth.erl.otp mod_auth.erl 153,160c153 < case httpd_util:key1search(DirectoryData, auth_name) of < undefined -> < {status,{500, none, < ?NICE("AuthName directive" < "not specified")}}; < Realm -> < {authorization_required, Realm} < end; --- > authorization_required(DirectoryData); 170c163 < {authorization_failed, Reason}; --- > authorization_required(DirectoryData); 180a174,181 > authorization_required(DirectoryData) -> > case httpd_util:key1search(DirectoryData, auth_name) of > undefined -> > {status,{500, none,?NICE("AuthName directive not specified")}}; > Realm -> > {authorization_required, Realm} > end. > [peterl@REDACTED OTPpatch]$ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: mod_auth.erl URL: From micke@REDACTED Tue Apr 12 10:25:19 2005 From: micke@REDACTED (Michael Fogeborg) Date: Tue, 12 Apr 2005 10:25:19 +0200 Subject: anyone in norway ( akershus / oslo ) on this list ? Message-ID: <6.2.1.2.0.20050412102354.027a56c8@mail.online.no> want to get in touch with people in norway on this list ! are there any ? From bjorn@REDACTED Tue Apr 12 10:31:11 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 12 Apr 2005 10:31:11 +0200 Subject: bug in inet_drv.c In-Reply-To: <20050411203037.GA11811@hyber.org> References: <20050411203037.GA11811@hyber.org> Message-ID: Thanks! I have now written a ticket, and we'll try to fix the bug in R10B-5. Do you happen to have any simple Erlang code that will provoke the bug? That would save us some time in writing the test case. /Bjorn klacke@REDACTED writes: > Howdy, > > I resent an old bug report of mine a couple > of months ago but I'm not sure what happened to it. > > It's a pretty serious bug and I recommend everone running > erlang systems that use sockets with {packet, http} > (this includes all yaws systems) to apply the patch. > Otherwise it's easy to bring down the entire erlang node > just by sending broken HTTP requests at it. > > Anyway, the bug is old and originally reported at: > > http://www.erlang.org/ml-archive/erlang-questions/200302/msg00493.html > > and a correct description at > > http://article.gmane.org/gmane.comp.lang.erlang.patches/3 > > > The patch is: > > --- inet_drv.c.orig 2005-04-08 17:33:37.003071900 +0200 > +++ inet_drv.c 2005-04-08 17:33:43.279602316 +0200 > @@ -1980,7 +1980,7 @@ > int c; > /* start-line = Request-Line | Status-Line */ > if (n == 0) > - return 0; > + return -1; > h = 0; > meth_ptr = ptr; > while (n && !is_tspecial((unsigned char)*ptr)) { > > > > /klacke > > > -- > Claes Wikstrom -- Caps lock is nowhere and > http://www.hyber.org -- everything is under control > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From micke@REDACTED Tue Apr 12 10:51:34 2005 From: micke@REDACTED (Michael Fogeborg) Date: Tue, 12 Apr 2005 10:51:34 +0200 Subject: Resistance to Erlang && Erlang use in Italy && Erlang at Uni's In-Reply-To: References: Message-ID: <6.2.1.2.0.20050412104129.027a5120@mail.online.no> At 09:31 2005-04-12, you wrote: ...snip... > To make Erlang popular I think we must target the "partial > domination" category for >distributed fault-tolerant applications - this is what is was designed >for, this is what it is >good at. ...snip.... Combining the mention threads made me think... Is it possible to organize an ( open ) ( and possibly intensive ) summer-course, at some university so you can gain credits, covering Erlang - from its basics to OTP and on how you build massively concurrent fault-tolerant systems ? Thinking about Italy made think that it could be offered in a version that allowed you to have a nice vacation at the same time... maybe even bring the family along and have a life while your're learning... ( unless Erlang is your life ;-) ) --- From luke@REDACTED Tue Apr 12 10:56:41 2005 From: luke@REDACTED (Luke Gorrie) Date: 12 Apr 2005 10:56:41 +0200 Subject: bug in inet_drv.c References: <20050411203037.GA11811@hyber.org> Message-ID: klacke@REDACTED writes: > I resent an old bug report of mine a couple > of months ago but I'm not sure what happened to it. Ha ha! I had forgotten all about this but I hit what was probably the same bug just a month or two ago: having a process blocking in gen_tcp:recv on a socket that is in CLOSE_WAIT, which should be impossible. Bjorn, you can find the test case in this link: > http://article.gmane.org/gmane.comp.lang.erlang.patches/3 From pascal.brisset@REDACTED Tue Apr 12 11:12:43 2005 From: pascal.brisset@REDACTED (Pascal Brisset) Date: Tue, 12 Apr 2005 11:12:43 +0200 Subject: Resistance to Erlang In-Reply-To: <425B3CA2.5080902@blueyonder.co.uk> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> <425B3CA2.5080902@blueyonder.co.uk> Message-ID: <20050412091121.525BE1734AF@postfix3-1.free.fr> David Hopwood writes: > To correct a minor technical point, Erlang supports asynchronous message passing. > The pi calculus uses synchronous message passing, which is a quite different > model. Actually there are asynchronous variants of the pi-calculus (Boudol, Honda-Tokoro). Another difference is that the pi-calculus allows dynamic creation of communication channels. Processes can send *and receive* on any channel they know, which is an implementor's nightmare. For most practical purposes, make_ref() and selective receive patterns provide the same functionality in Erlang. Having receive queues as first-class values could be interesting, through. -- Pascal Brisset From gulias@REDACTED Tue Apr 12 11:48:43 2005 From: gulias@REDACTED (Victor M. Gulias) Date: 12 Apr 2005 11:48:43 +0200 Subject: Our experience in Corunna (was Re: Erlang use in Italy) In-Reply-To: <425A92D9.1020409@diit.unict.it> References: <425A92D9.1020409@diit.unict.it> Message-ID: Corrado Santoro writes: >... > "Who is teaching Erlang? All students take the degree learning C, C++ > and Java. This is what companies require" (a professor forgetting that > students should learn *how to program*, not *how to program with a > specific language*). Hi all, Let me talk a little bit about our experience here in University of Corunna. I usually conduct courses to fourth-year students; those students have learnt different programming languages in the past, including some declarative languages such as OCaml or Prolog. These are the courses: * "Information System Design", a mandatory course where I teach software modelling using Design Patterns and UML and its implementation using Java. * "Functional Programming", an optional course that is taken by a subset of the students (about 30% of the total). Here we cover some theoretical stuff such as lambda-calculus and type systems with practical implementation exercises in OCaml. In addition, we save two-three weeks for an introduction to distributed programming in Erlang as a (good) example of the use of a functional language in the real world. To ease the presentation, I use some of the examples/patterns used in the "Information System Design" course and the students really appreciate how different a concurrent system is with both approaches (in favor of Erlang, of course). In fact, they ask me why I am not teaching Erlang instead of Java in the mandatory course... you already know the answer... Of course, you can argue that people that chose the FP course are students that already like functional programming (almost true) but I also found students that did not take the FP course that want to carry out projects with Erlang for his/her master's thesis. Well, the case is that here in Galicia (a poor region, almost no industry, ERDF zone 1) we now have some small IT companies that were created in the last years using Erlang as a tool to develop (some of) its products... Regards, -- Victor M. Gulias From thomasl_erlang@REDACTED Tue Apr 12 11:59:29 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Apr 2005 02:59:29 -0700 (PDT) Subject: Some claims about Erlang (was Re: Erlang use in Italy) In-Reply-To: 6667 Message-ID: <20050412095929.93623.qmail@web41903.mail.yahoo.com> --- Dominic Williams wrote: > The key point is, rather than dismiss the > resistance, to try > and justify and understand it before providing > responses > that target possibly valid points. Nice article. It's somewhat similar to what a salesman goes through, not surprisingly. I like the "CS vibe" of it, though :-) Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From rprice@REDACTED Tue Apr 12 12:12:42 2005 From: rprice@REDACTED (Roger Price) Date: Tue, 12 Apr 2005 12:12:42 +0200 (CEST) Subject: Resistance to Erlang In-Reply-To: <20050412091121.525BE1734AF@postfix3-1.free.fr> Message-ID: On Tue, 12 Apr 2005, Pascal Brisset wrote: > Another difference is that the pi-calculus allows dynamic creation > of communication channels. Processes can send *and receive* on any > channel they know, which is an implementor's nightmare. For most > practical purposes, make_ref() and selective receive patterns > provide the same functionality in Erlang. I implemented a pi-calculus language system much like Pierce and Turner's Pict, and similar to Vasconcelos' TyCO, using Erlang for the run-time. I used the correspondance: Pi calculus | Erlang ---------------+------------- input process | explicit fun output process | argument to function path | Erlang process > Having receive queues as first-class values could be interesting, > through. Not only interesting, but essential. Writing programs in the pi-calculus is complex; somewhat like horizontal microcode. Its hard to debug. The question "Is there a high-level language equivalent?" soon arises, and it seems to me that the answer is "Yes, Erlang", provided one uses the correspondance above. Roger From flaig@REDACTED Tue Apr 12 12:16:13 2005 From: flaig@REDACTED (flaig@REDACTED) Date: Tue, 12 Apr 2005 12:16:13 +0200 Subject: VisualAggression (Re: Some claims about Erlang (was Re: Erlang use in Italy)) Message-ID: <200504121016.j3CAGDQB011941@ger5.wwwserver.net> The problem with students is that they WANT to be commodity building blocks. Nowadays people don't go to university because they are seeking knowledge, but because they want to be taught which buttons to press. (Usually accompanied by calling themselves "pragmatic".) I have been teaching molecular biology and bioinformatics for years and have just given it up, just because of this attitude. Java and VisualBashit are poorly designed but adorned with lots of trashy baubles -- imagine a Citroen 2CV with huge spoilers, holographic rallye stripes and a horn playing Beethoven's 5th symphony --, and that is what attracts people. Logic? Structure? Oh Lord! "We are pragmatic, we want to work with our hands, theory is not for us." People have even told me that they "could not understand" recursion and lambda, so it had to be no good. So the gist of this is: If your audience are dummies, because they *want to be* dummies, you have to provide them with "XXX for dummies". Maybe we should seriously consider producing something like VisualErlang, or at least an EBuilder, as an addition to the existing Erlang "ecosystem"? I do not have any clear ideas how this could work, but it might be worthwhile. -- Ruediger Marcus > > "Who is teaching Erlang? All students take the > > degree learning C, C++ > > and Java. This is what companies require" > > The C/C++/Java guy is not in the audience for stealing > a march on the competition. He will change his tune > only when the big companies tells him to (ask him > about C# and you might catch him looking over his > shoulder to see if Microsoft heard his comment). His > students will likely be the interchangeable commodity > building blocks that parts of the industry desire. Bah > humbug. > > Best, > Thomas -- Chevalier Dr Dr Ruediger Marcus Flaig Institute for Immunology University of Heidelberg INF 305, D-69121 Heidelberg "Drain you of your sanity, Face the Thing That Should Not Be." -- Diese E-Mail wurde mit http://www.mail-inspector.de verschickt Mail Inspector ist ein kostenloser Service von http://www.is-fun.net Der Absender dieser E-Mail hatte die IP: 129.206.124.135 From thomasl_erlang@REDACTED Tue Apr 12 12:26:05 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Apr 2005 03:26:05 -0700 (PDT) Subject: Resistance to Erlang In-Reply-To: 6667 Message-ID: <20050412102605.98124.qmail@web41902.mail.yahoo.com> --- "Joe Armstrong (AL/EAB)" wrote: > To make Erlang popular I think we must target > the "partial domination" category for > distributed fault-tolerant applications - this is > what is was designed for, this is what it is > good at. It's also the area where most of the community works. "Erlang" is not just a language, it's also the surrounding problem-solving knowledge amassed by all of us. I wouldn't recommend artificially restricting our interests, though. You mention Wings, which has a hearteningly large community of users (seemingly uninterested in Erlang, though?). There is also the financial market, which I think sounds like an interesting offshoot. > To make any inroads you must target your > arguments to the audiences > (ie arguments are not universal, use the correct > argument > for the correct person). Yes, AS LONG AS you actually can fulfil the audience needs. On the bright side, if you want to deploy a technology, you are also handed a roadmap: just address the reasonable objections. (And/or show that the loud but unreasonable objections are baseless or can be ignored. Or withdraw from the sub-area in question.) > I think we need to aim at a balanced point were > we have > sufficient users so as to ensure that we do not die > from starvation > or just lack of interest - and not too many users so > that those who > do use Erlang retain their commercial advantage. I think the latter is dangerous. You will as a consequence also be starving any attempts to provide a market for tools, consultants, etc. Also, more practically, I just wouldn't consider a stampede into Erlang a big risk today. The switch, if any, looks like it will be to MDA and executable UML. > There is one interesting group of people who are > not singing the > praises of Erlang - these are companies that are > silently using Erlang > in their products - they gain commercial advantage > from this - and are not > particularly keen to see their compeditors change > from inferior technologies > and start competing with them. "During the years we worked on Viaweb I read a lot of job descriptions. A new competitor seemed to emerge out of the woodwork every month or so. The first thing I would do, after checking to see if they had a live online demo, was look at their job listings. After a couple years of this I could tell which companies to worry about and which not to. The more of an IT flavor the job descriptions had, the less dangerous the company was. The safest kind were the ones that wanted Oracle experience. You never had to worry about those. You were also safe if they said they wanted C++ or Java developers. If they wanted Perl or Python programmers, that would be a bit frightening-- that's starting to sound like a company where the technical side, at least, is run by real hackers. If I had ever seen a job posting looking for Lisp hackers, I would have been really worried." -- Paul Graham, Beating the Averages > IMHO people will use language X instead of Y if > they can make more money > using X than using Y - then eventually all the users > of Y die out - Darwinism. We would then need to make the case that Erlang in total saves money. This is not self-evident to managers, even Ericsson managers who know Erlang. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From thomasl_erlang@REDACTED Tue Apr 12 14:18:16 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Apr 2005 05:18:16 -0700 (PDT) Subject: VisualAggression (Re: Some claims about Erlang (was Re: Erlang use in Italy)) In-Reply-To: 6667 Message-ID: <20050412121816.88992.qmail@web41907.mail.yahoo.com> --- flaig@REDACTED wrote: > The problem with students is that they WANT to be > commodity building blocks. Nowadays people don't go > to university because they are seeking knowledge, > but because they want to be taught which buttons to > press. Undeniably so; computer programming was for a time a simple way of getting a well-paid job. Perhaps it is, on this level, the modern equivalent of working at a car factory? I can certainly see the attraction to someone wanting to make a quick buck. > Maybe we > should seriously consider producing something like > VisualErlang, or at least an EBuilder, as an > addition to the existing Erlang "ecosystem"? I do > not have any clear ideas how this could work, but it > might be worthwhile. Hey, it wouldn't hurt to have that. Given that three guys could write Wings3D, why not a "visual programming environment"? Best, Thomas __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail From simonpeterchappell@REDACTED Tue Apr 12 14:50:38 2005 From: simonpeterchappell@REDACTED (Simon Chappell) Date: Tue, 12 Apr 2005 07:50:38 -0500 Subject: Resistance to Erlang In-Reply-To: References: Message-ID: <8ed7339005041205503b476b7@mail.gmail.com> On Apr 12, 2005 2:31 AM, Joe Armstrong (AL/EAB) wrote: *snip* > There is one interesting group of people who are not singing the > praises of Erlang - these are companies that are silently using Erlang > in their products - they gain commercial advantage from this - and are not > particularly keen to see their compeditors change from inferior technologies > and start competing with them. This fits with the observations of Paul Graham (http://paulgraham.com/avg.html), except he is refering to his use of Lisp. > /Joe Simon From klacke@REDACTED Tue Apr 12 15:47:19 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Tue, 12 Apr 2005 15:47:19 +0200 Subject: bug in inet_drv.c In-Reply-To: References: <20050411203037.GA11811@hyber.org> Message-ID: <20050412134719.GA25307@hyber.org> On Tue, Apr 12, 2005 at 10:31:11AM +0200, Bjorn Gustavsson wrote: > Thanks! > > I have now written a ticket, and we'll try to fix the bug > in R10B-5. > > Do you happen to have any simple Erlang code that will > provoke the bug? That would save us some time in writing > the test case. Sure, follow the links I posted. Nice little erlang program there that provokes the bug. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From klacke@REDACTED Tue Apr 12 15:54:26 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Tue, 12 Apr 2005 15:54:26 +0200 Subject: yaws 1.54 released Message-ID: <20050412135426.GC25307@hyber.org> New bugfix release. Called 1.54. Relnotes + code as usual at http://yaws.hyber.org Cheers /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From bengt.kleberg@REDACTED Tue Apr 12 16:12:08 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 12 Apr 2005 16:12:08 +0200 Subject: question about intended function of filelib:wildcard/2 In-Reply-To: <20050412134719.GA25307@hyber.org> References: <20050411203037.GA11811@hyber.org> <20050412134719.GA25307@hyber.org> Message-ID: <425BD738.7040207@ericsson.com> greetings, this is what the manual says: wildcard(Wildcard, Cwd) -> list() Types Wildcard = filename() | dirname() Cwd = dirname() The wildcard/2 function works like wildcard/1, except that instead of the actual working dirctory, Cwd will be used. i thought this would mean that the following 2 calls would give me the same result: filelib:wildcard("/home/eleberg/*"). filelib:wildcard("*", "/home/eleberg"). on my system they return very different lists. could somebody please explain if they should be different, and how wildcard/2 is supposed to be used. or, what i am doing wrong. bengt From hal@REDACTED Tue Apr 12 17:04:59 2005 From: hal@REDACTED (Hal Snyder) Date: Tue, 12 Apr 2005 10:04:59 -0500 Subject: VisualAggression (Re: Some claims about Erlang In-Reply-To: <200504121016.j3CAGDQB011941@ger5.wwwserver.net> (flaig@sanctacaris.net's message of "Tue, 12 Apr 2005 12:16:13 +0200") References: <200504121016.j3CAGDQB011941@ger5.wwwserver.net> Message-ID: <871x9gc9yc.fsf@ghidra.vail> flaig@REDACTED writes: > The problem with students is that they WANT to be commodity building > blocks. Nowadays people don't go to university because they are > seeking knowledge, but because they want to be taught which buttons > to press. (Usually accompanied by calling themselves "pragmatic".) I > have been teaching molecular biology and bioinformatics for years > and have just given it up, just because of this attitude. Java and > VisualBashit are poorly designed but adorned with lots of trashy > baubles -- imagine a Citroen 2CV with huge spoilers, holographic > rallye stripes and a horn playing Beethoven's 5th symphony --, and > that is what attracts people. Logic? Structure? Oh Lord! "We are > pragmatic, we want to work with our hands, theory is not for us." > People have even told me that they "could not understand" recursion > and lambda, so it had to be no good. > So the gist of this is: If your audience are dummies, because they > *want to be* dummies, you have to provide them with "XXX for > dummies". Maybe we should seriously consider producing something > like VisualErlang, or at least an EBuilder, as an addition to the > existing Erlang "ecosystem"? I do not have any clear ideas how this > could work, but it might be worthwhile. > > -- Ruediger Marcus Interesting points. I taught computer science for over 8 years in university. Every year, there were a few brilliant, dedicated students who loved exploring new ideas, a large number of earnest toilers, and a fair number of pragmatist/philistines who became agitated and even angry when challenged. Erlang is effective for me because the language is so close to how I write requirements. A certain amount of analysis and judgment are required for competent software design, and IMO no builder tool can substitute. From csanto@REDACTED Tue Apr 12 17:21:18 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 12 Apr 2005 17:21:18 +0200 Subject: Resistance to Erlang In-Reply-To: References: Message-ID: <425BE76E.2060902@diit.unict.it> Joe Armstrong (AL/EAB) wrote: *snip* > To make Erlang popular I think we must target the "partial domination" category for > distributed fault-tolerant applications - this is what is was designed for, this is what it is > good at. > *snip* > > Erlang is ideal for writing distributed applications - this is where it shines - but very few > applications are distributed (most networked apps are simple non-fault tolerant client-server) Yes this is true, but not only: Erlang stresses the concept of "concurrent-oriented programming" (COP) in contrast to other programming approaches (O-O ??). And in most cases, writing programs using COP seems quite simple and natural (as Joe claims in his PhD thesis). One example for this: I had to design a software simulator for a Grid environment, something that should simulate 500 network nodes (please note, "simulate" not "emulate") interacting through the exchange of messages. I didn't need concurrency, but only to encapsulate the behaviour of such nodes within "objects". I started writing the simulator in Java, but, after a couple of hard working days, I was flooded by a large number of classes, each one encapsulating a concept of my world. So... I gave up and restarted using Erlang. And you can imagine the result. > The real area were we should be writing distributed apps is probably to be found in the cluster > peer-2-peer worlds. I completely agree! After all, what is mnesia if not a cluster or mini-grid computing? But the world seems to go in a different direction. P2P goes towards the use of JXTA (Java + XML). Grid computing goes towards the use of the Globus toolkit (Java + XML + Web Services). So, while the "Java man" claims that Erlang has worse performances than Java, I see this kind of messages on the Globus mailing list: "I've got a service, running under Globus 3.2.1, which returns an array of approximately 600 objects with the following GWSDL definition: Unfortunately, it appears to take 90 seconds or so to pass this array to a client application running on the same server." 90 SECONDS!!!!!! Once a friend of mine said that Microsoft made Win95 so slow in order to force customers to upgrade their PC or buy more memory... Are we seeing a similar trend with web services and XML? I think that Erlang would be perfect to support Grid computing, but I'm frightened to make such a proposal to Grid people (also belonging to my organization) because they seem to view Globus (and web services) as a silver bullet: "The world uses Globus, so we must adhere". And I don't want to fight, alone, against windmills. > IMHO people will use language X instead of Y if they can make more money > using X than using Y - then eventually all the users of Y die out - Darwinism. But also this Darwinism is true: "People will use language X instead of Y, if X is advertised, supported, taught and used more than Y". ;-))) Ciao, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From joe.armstrong@REDACTED Tue Apr 12 17:22:55 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 12 Apr 2005 17:22:55 +0200 Subject: VisualAggression (Re: Some claims about Erlang (was Re: Erlang use in Italy)) Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Thomas Lindgren > Sent: den 12 april 2005 14:18 > To: erlang-questions@REDACTED > Subject: Re: VisualAggression (Re: Some claims about Erlang (was Re: > Erlang use in Italy)) > > > > --- flaig@REDACTED wrote: > > The problem with students is that they WANT to be > > commodity building blocks. Nowadays people don't go > > to university because they are seeking knowledge, > > but because they want to be taught which buttons to > > press. > > Undeniably so; computer programming was for a time a > simple way of getting a well-paid job. Perhaps it is, > on this level, the modern equivalent of working at a > car factory? I can certainly see the attraction to > someone wanting to make a quick buck. > My advice would be if you want a well paid job learn Erlang :-) The thing you have to tell your students is "nobody got rich learning a me-to technology" - if you learn java then you have no competitive edge over all all the other ten million programmers who learn java. Let me quote from Tim Berners-Lee (Weaving the web page 60). "Our strategy paid off when Robert visited Helsinki University of Technology. Several students there decided to make their combined master's project a Web browser ... they decided to call the browser Erwise ... By the time it was finished in April 1992, Erwise was quite advanced. It was written for use on a Unix machine running X-windows. I went to Finland to encourage the students to continue the project after they finished their degrees, and to extend the browser to an editor, but they had remarkably little ongoing enthusiasm for the Web; they had already decided that when they graduated they were going on to what they saw as more tantalising or lucrative software projects. No one else around the institute wanted to pick up the project, either. Certainly I couldn't continue it; all the code was documented in Finnish!" The rest is history ... Students only see the short term - they are no old enough to see the long term - learning Java etc. is a short-term strategy for becoming a me-too programmer. If you want to become rich do the following: 1) Find an application that people are prepared to pay money for 2) Implement it as soon as possible 3) Sell it Learning Erlang will help 2) *if the problem domain is correct* - but won't help with 1 and 3. /Joe > > Maybe we > > should seriously consider producing something like > > VisualErlang, or at least an EBuilder, as an > > addition to the existing Erlang "ecosystem"? I do > > not have any clear ideas how this could work, but it > > might be worthwhile. > > Hey, it wouldn't hurt to have that. Given that three > guys could write Wings3D, why not a "visual > programming environment"? > > Best, > Thomas > > > > > __________________________________ > Do you Yahoo!? > Read only the mail you want - Yahoo! Mail SpamGuard. > http://promotions.yahoo.com/new_mail > From david.nospam.hopwood@REDACTED Tue Apr 12 18:54:44 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 12 Apr 2005 17:54:44 +0100 Subject: Resistance to Erlang In-Reply-To: <20050412091121.525BE1734AF@postfix3-1.free.fr> References: <425A92D9.1020409@diit.unict.it> <425ADB32.2050704@dominicwilliams.net> <425B3CA2.5080902@blueyonder.co.uk> <20050412091121.525BE1734AF@postfix3-1.free.fr> Message-ID: <425BFD54.7090907@blueyonder.co.uk> Pascal Brisset wrote: > David Hopwood writes: > > To correct a minor technical point, Erlang supports asynchronous message passing. > > The pi calculus uses synchronous message passing, which is a quite different > > model. > > Actually there are asynchronous variants of the pi-calculus > (Boudol, Honda-Tokoro). There are asynchronous process calculi, yes. They're sufficiently different from the original pi calculus that I think they should really be called something else. > Another difference is that the pi-calculus allows dynamic creation > of communication channels. Processes can send *and receive* on any > channel they know, which is an implementor's nightmare. Not really. Erlang allows dynamic creation of processes, and dynamic channels can be implemented in terms of dynamic processes fairly straightforwardly (in an asynchronous setting). I agree with Roger Price's point about the pi calculus being rather low level. The actor model is a closer match to Erlang. Pict changes the pi calculus to be more like the actor model. > Having receive queues as first-class values could be interesting, through. The pet language I'm designing has first-class receive queues. Actually it splits the send and receive facets and makes them both first class; you can attach a receive facet to a fair merge of several send facets. This turns out to be very useful in dealing with fairness issues, and it allows expressing several variants of message passing concurrency in the same language. -- David Hopwood From vlad_dumitrescu@REDACTED Tue Apr 12 20:33:25 2005 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 12 Apr 2005 20:33:25 +0200 Subject: question about intended function of filelib:wildcard/2 References: <20050411203037.GA11811@hyber.org> <20050412134719.GA25307@hyber.org> <425BD738.7040207@ericsson.com> Message-ID: > filelib:wildcard("/home/eleberg/*"). > filelib:wildcard("*", "/home/eleberg"). > on my system they return very different lists. > > could somebody please explain if they should be different, and how > wildcard/2 is supposed to be used. Hi, Looking at the code, wildcard(Pattern) -> {ok, Cwd} = file:get_cwd(), wildcard(Pattern, Cwd). wildcard({compiled_wildcard, [Base|Rest]}, _Cwd) -> wildcard1([Base], Rest); wildcard(Pattern, Cwd) when list(Pattern), list(Cwd) -> wildcard(compile_wildcard(Pattern), Cwd). it's interesting to notice that the Cwd argument is not used at all. I would suppose that the intention was that if Base was a relative path, it should be appended to Cwd. If Base is absolute, then Cwd should be ignored, of course. Using for example wildcard({compiled_wildcard, [Base|Rest]}, Cwd) -> case filename:pathtype(Base) of relative -> wildcard1([join(Base, Cwd)], Rest); _ -> wildcard1([Base], Rest) end; works, with the only drawback that the returned filenames are all absolute (which might or might not be what one needs). regards, Vlad From olivier.sambourg@REDACTED Tue Apr 12 20:48:25 2005 From: olivier.sambourg@REDACTED (Olivier) Date: Tue, 12 Apr 2005 20:48:25 +0200 Subject: OR construction in erlang ? Message-ID: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> Hi everyone Is there an equivalent to the PHP "or" construction ? I'd like to be able to throw errors when a match fails, i.e. : ok = test_function(Args) or throw(error_in_test_function). I know I can achieve the same with a catch and case syntax but nesting several tests gets ugly (or increases the number of functions in a module). Thanks :) -- Olivier From mscandar@REDACTED Tue Apr 12 21:19:35 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 12 Apr 2005 15:19:35 -0400 Subject: OR construction in erlang ? In-Reply-To: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> Message-ID: <425C1F47.9070105@cisco.com> Olivier wrote: > Hi everyone > > Is there an equivalent to the PHP "or" construction ? I'd like to be > able to throw errors when a match fails, i.e. : > > ok = test_function(Args) or throw(error_in_test_function). > > I know I can achieve the same with a catch and case syntax but nesting > several tests gets ugly (or increases the number of functions in a module). > > Thanks :) > > -- > Olivier > I often use something like: some_function(Arg) -> check(Arg), make_use_of(Arg). check(foo) -> ok; check(bar) -> ok; check(E) -> throw({double_plus_ungood, E}). You can even leave off the last clause, if you're happy with a function_clause error. (In which case, it would be nice to use a name like "good_arg" instead of "check"). Mark. From svg@REDACTED Tue Apr 12 21:29:45 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 13 Apr 2005 01:29:45 +0600 (YEKST) Subject: OR construction in erlang ? In-Reply-To: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> Message-ID: <20050413.012945.115907836.svg@surnet.ru> Good day, olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). ok = test_function(Args) orelse throw(error_in_test_function). Best Regards, Vladimir Sekissov olivier.sambourg> Hi everyone olivier.sambourg> olivier.sambourg> Is there an equivalent to the PHP "or" construction ? I'd like to be olivier.sambourg> able to throw errors when a match fails, i.e. : olivier.sambourg> olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). olivier.sambourg> olivier.sambourg> I know I can achieve the same with a catch and case syntax but nesting olivier.sambourg> several tests gets ugly (or increases the number of functions in a olivier.sambourg> module). olivier.sambourg> olivier.sambourg> Thanks :) olivier.sambourg> olivier.sambourg> -- olivier.sambourg> Olivier olivier.sambourg> olivier.sambourg> From mscandar@REDACTED Tue Apr 12 22:07:48 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 12 Apr 2005 16:07:48 -0400 Subject: OR construction in erlang ? In-Reply-To: <20050413.012945.115907836.svg@surnet.ru> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> Message-ID: <425C2A94.90308@cisco.com> Note that: ok = test(Arg). exits with a badmatch if test(Arg) doesn't return ok. (This is often good enough.) The logical operators (or, and, xor, not, orelse, andalso) will exit with badarg if their operands are other than the atoms 'true' or 'false'. Thus, ok = test(Arg) orelse foo(). will either exit with {badarg, ok}, since the value of ok = ok is ok, or it will exit with {badmatch, ...} Mark. Vladimir Sekissov wrote: > Good day, > > olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). > > ok = test_function(Args) orelse throw(error_in_test_function). > > Best Regards, > Vladimir Sekissov > > olivier.sambourg> Hi everyone > olivier.sambourg> > olivier.sambourg> Is there an equivalent to the PHP "or" construction ? I'd like to be > olivier.sambourg> able to throw errors when a match fails, i.e. : > olivier.sambourg> > olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). > olivier.sambourg> > olivier.sambourg> I know I can achieve the same with a catch and case syntax but nesting > olivier.sambourg> several tests gets ugly (or increases the number of functions in a > olivier.sambourg> module). > olivier.sambourg> > olivier.sambourg> Thanks :) > olivier.sambourg> > olivier.sambourg> -- > olivier.sambourg> Olivier > olivier.sambourg> > olivier.sambourg> > From olivier.sambourg@REDACTED Tue Apr 12 22:24:15 2005 From: olivier.sambourg@REDACTED (Olivier) Date: Tue, 12 Apr 2005 22:24:15 +0200 Subject: OR construction in erlang ? In-Reply-To: <20050413.012945.115907836.svg@surnet.ru> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> Message-ID: <64451e8f8bcacef6029f17786e9ec560@gmail.com> Hi again > Good day, > > olivier.sambourg> ok = test_function(Args) or > throw(error_in_test_function). > > ok = test_function(Args) orelse throw(error_in_test_function). > > Best Regards, > Vladimir Sekissov Sadly it doesn't seem to work, as "ok = test_function(Args)" either matches (and is evaluated to "ok") or raises a run-time error (and is not evaluated to "false"). > I often use something like: > > some_function(Arg) -> > check(Arg), > make_use_of(Arg). > > check(foo) -> ok; > check(bar) -> ok; > check(E) -> throw({double_plus_ungood, E}). > > You can even leave off the last clause, if you're happy with a > function_clause error. (In which case, it would be nice to use a name > like "good_arg" instead of "check"). > > Mark. I guess I'll have to do that, but it is basically a case / catch syntax : how would you do it in this case: ... true = lists:member(Key, List), false = lists:member(Key2, List), ... All I can imagine is : case lists:member(Key, List) of false -> throw(error_in_test); _ -> case lists:member(Key2, List) of true -> throw(error2_in_test); _ -> continue with nested code or nested function calls end end, Please tell me I'm wrong :) Thanks for the help ! -- Olivier From svg@REDACTED Tue Apr 12 22:43:15 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 13 Apr 2005 02:43:15 +0600 (YEKST) Subject: OR construction in erlang ? In-Reply-To: <425C2A94.90308@cisco.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> <425C2A94.90308@cisco.com> Message-ID: <20050413.024315.48533138.svg@surnet.ru> mscandar> ok = test(Arg) orelse foo(). mscandar> mscandar> will either exit with {badarg, ok}, since the value of ok = ok is ok, or it will exit with mscandar> {badmatch, ...} Yes, sorry. Must be simply: ... test_function(Args) == ok orelse throw(error_in_test_function), ... > olivier.sambourg> I know I can achieve the same with a catch and case syntax but nesting > olivier.sambourg> several tests gets ugly (or increases the number of functions in a > olivier.sambourg> module). You can use something like: case catch begin {ok, ok} = {ok, test1()}, {ok, Res2} = test2(), test3() orelse exit(Error3), .... end of {ok, Good} -> Good; {'EXIT', Error} -> ... end, mscandar> Note that: mscandar> mscandar> ok = test(Arg). mscandar> mscandar> exits with a badmatch if test(Arg) doesn't return ok. (This is often good enough.) mscandar> mscandar> The logical operators (or, and, xor, not, orelse, andalso) will exit with badarg if their mscandar> operands are other than the atoms 'true' or 'false'. mscandar> mscandar> Thus, mscandar> mscandar> ok = test(Arg) orelse foo(). mscandar> mscandar> will either exit with {badarg, ok}, since the value of ok = ok is ok, or it will exit with mscandar> {badmatch, ...} mscandar> mscandar> Mark. mscandar> mscandar> Vladimir Sekissov wrote: mscandar> > Good day, mscandar> > mscandar> > olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). mscandar> > mscandar> > ok = test_function(Args) orelse throw(error_in_test_function). mscandar> > mscandar> > Best Regards, mscandar> > Vladimir Sekissov mscandar> > mscandar> > olivier.sambourg> Hi everyone mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> Is there an equivalent to the PHP "or" construction ? I'd like to be mscandar> > olivier.sambourg> able to throw errors when a match fails, i.e. : mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function). mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> I know I can achieve the same with a catch and case syntax but nesting mscandar> > olivier.sambourg> several tests gets ugly (or increases the number of functions in a mscandar> > olivier.sambourg> module). mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> Thanks :) mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> -- mscandar> > olivier.sambourg> Olivier mscandar> > olivier.sambourg> mscandar> > olivier.sambourg> mscandar> > mscandar> From mscandar@REDACTED Tue Apr 12 22:51:38 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 12 Apr 2005 16:51:38 -0400 Subject: OR construction in erlang ? In-Reply-To: <64451e8f8bcacef6029f17786e9ec560@gmail.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> <64451e8f8bcacef6029f17786e9ec560@gmail.com> Message-ID: <425C34DA.4060907@cisco.com> Since lists:member/2 returns true or false, you're in luck: lists:member(Key, List) orelse throw(key_error), lists:member(Key2, List) andalso throw(key2_error), Mark. Olivier wrote: > > I guess I'll have to do that, but it is basically a case / catch syntax > : how would you do it in this case: > > ... > true = lists:member(Key, List), > false = lists:member(Key2, List), > ... > From olivier.sambourg@REDACTED Tue Apr 12 23:26:51 2005 From: olivier.sambourg@REDACTED (Olivier) Date: Tue, 12 Apr 2005 23:26:51 +0200 Subject: OR construction in erlang ? In-Reply-To: <425C34DA.4060907@cisco.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> <64451e8f8bcacef6029f17786e9ec560@gmail.com> <425C34DA.4060907@cisco.com> Message-ID: <2498a5a8a915b0a18328c64e0be6b926@gmail.com> Hehe tricked me here, bad example ;) let's pretend it does not return true or false then... -- Olivier Le 12 avr. 05, ? 22:51, Mark Scandariato a ?crit : > Since lists:member/2 returns true or false, you're in luck: > > lists:member(Key, List) orelse throw(key_error), > lists:member(Key2, List) andalso throw(key2_error), > > > Mark. > > Olivier wrote: > >> I guess I'll have to do that, but it is basically a case / catch >> syntax : how would you do it in this case: >> ... >> true = lists:member(Key, List), >> false = lists:member(Key2, List), >> ... > From dgud@REDACTED Wed Apr 13 08:35:13 2005 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 13 Apr 2005 08:35:13 +0200 Subject: OR construction in erlang ? In-Reply-To: <64451e8f8bcacef6029f17786e9ec560@gmail.com> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> <64451e8f8bcacef6029f17786e9ec560@gmail.com> Message-ID: <16988.48545.504374.12208@rian.du.uab.ericsson.se> Olivier writes: > I guess I'll have to do that, but it is basically a case / catch syntax > : how would you do it in this case: > > ... > true = lists:member(Key, List), > false = lists:member(Key2, List), > ... > We use a macro in our tests like: ?match(true, lists:member(Key, List)), ?match(false, lists:member(Key2, List)), -define(match(ExpectedRes,Expr), fun() -> AcTuAlReS = (catch (Expr)), case AcTuAlReS of ExpectedRes -> ?verbose("ok, ~n Result as expected:~p~n",[AcTuAlReS]), {success,AcTuAlReS}; _ -> ?error("Not Matching Actual result was:~n ~p~n", [AcTuAlReS]), {fail,AcTuAlReS} end end()). The nice thing with a macro is that you can also use ?MODULE,?LINE to get the location. /Dan From olivier.sambourg@REDACTED Wed Apr 13 10:15:36 2005 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Wed, 13 Apr 2005 10:15:36 +0200 Subject: OR construction in erlang ? In-Reply-To: <16988.48545.504374.12208@rian.du.uab.ericsson.se> References: <4ebb6223a876b8fa2305c59547ad3821@gmail.com> <20050413.012945.115907836.svg@surnet.ru> <64451e8f8bcacef6029f17786e9ec560@gmail.com> <16988.48545.504374.12208@rian.du.uab.ericsson.se> Message-ID: Great ! Just what I was looking for :) (with an extra parameter to throw a specific error if it does not match) Thanks a lot ! -- Olivier On 4/13/05, Dan Gudmundsson wrote: > We use a macro in our tests like: > > ?match(true, lists:member(Key, List)), > ?match(false, lists:member(Key2, List)), > > -define(match(ExpectedRes,Expr), > fun() -> > AcTuAlReS = (catch (Expr)), > case AcTuAlReS of > ExpectedRes -> > ?verbose("ok, ~n Result as expected:~p~n",[AcTuAlReS]), > {success,AcTuAlReS}; > _ -> > ?error("Not Matching Actual result was:~n ~p~n", > [AcTuAlReS]), > {fail,AcTuAlReS} > end > end()). > > The nice thing with a macro is that you can also use ?MODULE,?LINE > to get the location. > > /Dan > From micke@REDACTED Wed Apr 13 10:27:56 2005 From: micke@REDACTED (Michael Fogeborg) Date: Wed, 13 Apr 2005 10:27:56 +0200 Subject: ant, make and ermake Message-ID: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> Is anyone working on the build/make process of erlang ? I.e. working on OS-independent ways of building erlang ? http://www.erlang.org/ml-archive/erlang-questions/200209/msg00103.html From ingela@REDACTED Wed Apr 13 18:40:13 2005 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 13 Apr 2005 18:40:13 +0200 Subject: inets patch on basic authentication References: <425B7DE4.1040908@lundata.se> Message-ID: <16989.19309.458168.656725@gargle.gargle.HOWL> Peter Lund wrote: > To get basic authentication to work better in inets you (OTP) should > apply this > patch to the file mod_auth.erl in the latest inets 4.3.1 in (OTP R10B-4). > The problem fixed is that the current inets only pops up the basic > authentication > window on the client browser once, not every time when the user supplies > a bad > user/password combination. This bug forces the user to kill the browser > entirely > after a failed login attempt, before the user may try to login again. > This is what this > fix fixes. With this patch inets sends the "WWW-Authenticate" header > every time > the user fails to login correctly. Thank you for the patch suggestion :) I have now verified that it does indeed solve this particular problem but it also introduces new bugs in other scenarios. So I will fix the whole problem for the next inets version. -- /Ingela - OTP team From rpettit@REDACTED Wed Apr 13 18:43:18 2005 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 13 Apr 2005 11:43:18 -0500 Subject: ant, make and ermake In-Reply-To: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> Message-ID: <20050413164318.GB32285@vailsys.com> On Wed, Apr 13, 2005 at 10:27:56AM +0200, Michael Fogeborg wrote: > Is anyone working on the build/make process of erlang ? > > I.e. working on OS-independent ways of building erlang ? > > http://www.erlang.org/ml-archive/erlang-questions/200209/msg00103.html An autotools-based build system works best for us. -Rick From james.hague@REDACTED Wed Apr 13 20:21:09 2005 From: james.hague@REDACTED (James Hague) Date: Wed, 13 Apr 2005 13:21:09 -0500 Subject: Erlang R10B-4 "crashes" under Windows? Message-ID: Twice now, with R10B-4 under Windows XP Professional, I've run werl.exe, gotten an icon on the task bar, but the application window never appeared. Rebooting didn't fix it. The only remedy I found was to uninstall and reinstall Erlang. Has anyone else seen this? I didn't have any trouble with previous versions. From ulf.wiger@REDACTED Wed Apr 13 15:06:50 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 13 Apr 2005 15:06:50 +0200 Subject: VisualAggression (Re: Some claims about Erlang (was Re: Erlang use in Italy)) Message-ID: >imagine a Citroen 2CV with huge spoilers, holographic > rallye stripes and a horn playing Beethoven's 5th symphony > --, and that is what attracts people. Something like this? http://www.geocities.com/Paris/9896/137.jpg /Uffe From bengt.kleberg@REDACTED Thu Apr 14 08:56:59 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 14 Apr 2005 08:56:59 +0200 Subject: ant, make and ermake In-Reply-To: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> Message-ID: <425E143B.60307@ericsson.com> Michael Fogeborg wrote: > Is anyone working on the build/make process of erlang ? since erlang itself has parts that are c code it is not possible to use the make module (afaik). moreover, since erlang itself is worked upon by the otp team, it is unlikely that anything that they do not like will be used. for erlang software i think the make module is sufficient. bengt From enriquecano@REDACTED Thu Apr 14 09:40:21 2005 From: enriquecano@REDACTED (Enrique Cano) Date: Thu, 14 Apr 2005 09:40:21 +0200 Subject: Erlang R10B-4 "crashes" under Windows? In-Reply-To: References: Message-ID: <2aee3e310504140040778221ca@mail.gmail.com> It happened to me a couple of times, with R10B-3 and R10B-4. In my case the problem was a registry key that werl uses to know were to put the main window was corrupted. Apparently, werl started correctly but the window wasn't visible because its coordinates were out of the desktop. I don't know in what situation this key was corrupted but the problem disapeared deleting it: HKEY_CURRENT_USER\Software\Ericsson\Erlang\5.4.5\Pos. The next time I run werl the key was created again with default values and werl was visible. Regards, On 4/13/05, James Hague wrote: > Twice now, with R10B-4 under Windows XP Professional, I've run > werl.exe, gotten an icon on the task bar, but the application window > never appeared. Rebooting didn't fix it. The only remedy I found was > to uninstall and reinstall Erlang. > > Has anyone else seen this? I didn't have any trouble with previous versions. > From peppe@REDACTED Thu Apr 14 09:59:49 2005 From: peppe@REDACTED (UAB L/K Peter Andersson) Date: Thu, 14 Apr 2005 09:59:49 +0200 Subject: Erlang R10B-4 "crashes" under Windows? References: <2aee3e310504140040778221ca@mail.gmail.com> Message-ID: <425E22F5.7BB4571@erix.ericsson.se> Hi James and Enrique, We'll have a look at this. Thanks for the info! Best regards, Peppe ----------------------- Erlang/OTP, Ericsson AB ----------------------- Enrique Cano wrote: > > It happened to me a couple of times, with R10B-3 and R10B-4. > In my case the problem was a registry key that werl uses to know were > to put the main window was corrupted. Apparently, werl started > correctly but the window wasn't visible because its coordinates were > out of the desktop. > > I don't know in what situation this key was corrupted but the problem > disapeared deleting it: > HKEY_CURRENT_USER\Software\Ericsson\Erlang\5.4.5\Pos. > The next time I run werl the key was created again with default values > and werl was visible. > > Regards, > > On 4/13/05, James Hague wrote: > > Twice now, with R10B-4 under Windows XP Professional, I've run > > werl.exe, gotten an icon on the task bar, but the application window > > never appeared. Rebooting didn't fix it. The only remedy I found was > > to uninstall and reinstall Erlang. > > > > Has anyone else seen this? I didn't have any trouble with previous versions. > > From samuel@REDACTED Thu Apr 14 10:49:51 2005 From: samuel@REDACTED (Samuel Rivas) Date: Thu, 14 Apr 2005 10:49:51 +0200 Subject: dialyzer bug? Message-ID: <20050414084951.GA11645@crusher.lfcia.pri> Hi, Next code makes dialyzer to output an error: -module(test). -export([test/1]). test(Foo) -> Foo/bar. When dialyzer (v1.3.0) tries to analyse it the next error rises: Error: [hipe:781]: ERROR: {function_clause, [{hipe_icode_type, find_signature_mfa, ['/']}, {hipe_icode_type, find_plt_return, 2}, {hipe_icode_type, check_for_tuple_as_fun, 2}, {hipe_icode_type, warn_on_call_1, 3}, {hipe_icode_type, warn_on_call, 4}, {hipe_icode_type, warn_on_instr, 3}, {hipe_icode_type,warn_on_bb,3}, {hipe_icode_type, warn_on_type_errors, 5}]} I found this error in a bigger project (a confusion with bit syntax led me to write Something = Stuff/binary), the behaviour was slightly different when dialyzer tried to read the wrong code within the whole project analysis, it showed the error in the warning window, in the test case the error is shown in a separate window. Sadly I wasn't able to write a synthetic test that achieves the same result :( Aside, experimenting with the compiler I found out that expressions like a/b, a+b, ... generate a warning, but expressions like A/b don't. I suppose it would be wise to warn in all these cases. Regards -- Samuel From tobias.lindahl@REDACTED Thu Apr 14 11:51:52 2005 From: tobias.lindahl@REDACTED (Tobias Lindahl) Date: Thu, 14 Apr 2005 11:51:52 +0200 (MEST) Subject: dialyzer bug? In-Reply-To: <20050414084951.GA11645@crusher.lfcia.pri> References: <20050414084951.GA11645@crusher.lfcia.pri> Message-ID: Thanks for the report. We already have a patch that solves the problem. The patch can be found at the Dialyzer homepage http://www.it.uu.se/research/group/hipe/dialyzer/ Tobias On Thu, 14 Apr 2005, Samuel Rivas wrote: > Hi, > > Next code makes dialyzer to output an error: > > -module(test). > -export([test/1]). > > test(Foo) -> > Foo/bar. > > When dialyzer (v1.3.0) tries to analyse it the next error rises: > > Error: [hipe:781]: ERROR: {function_clause, > [{hipe_icode_type, > find_signature_mfa, > ['/']}, > {hipe_icode_type, > find_plt_return, > 2}, > {hipe_icode_type, > check_for_tuple_as_fun, > 2}, > {hipe_icode_type, > warn_on_call_1, > 3}, > {hipe_icode_type, > warn_on_call, > 4}, > {hipe_icode_type, > warn_on_instr, > 3}, > {hipe_icode_type,warn_on_bb,3}, > {hipe_icode_type, > warn_on_type_errors, > 5}]} > > I found this error in a bigger project (a confusion with bit syntax led > me to write Something = Stuff/binary), the behaviour was slightly > different when dialyzer tried to read the wrong code within the whole > project analysis, it showed the error in the warning window, in the test > case the error is shown in a separate window. Sadly I wasn't able to > write a synthetic test that achieves the same result :( > > Aside, experimenting with the compiler I found out that expressions like > a/b, a+b, ... generate a warning, but expressions like A/b don't. I > suppose it would be wise to warn in all these cases. > > Regards > -- > Samuel > From bjorn@REDACTED Thu Apr 14 12:01:57 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 14 Apr 2005 12:01:57 +0200 Subject: dialyzer bug? In-Reply-To: <20050414084951.GA11645@crusher.lfcia.pri> References: <20050414084951.GA11645@crusher.lfcia.pri> Message-ID: Samuel Rivas writes: [...] > > Aside, experimenting with the compiler I found out that expressions like > a/b, a+b, ... generate a warning, but expressions like A/b don't. I > suppose it would be wise to warn in all these cases. The compiler only warns when it finds obvious discrepancies when trying to optimize the code. Arithmetic expressions involving a variable cannot (in general) be optimized, so no warnings are generated. A future version of the compiler will probably do more type analysis and will generate more warnings (and optimize the code better based on the type analysis). /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From paris@REDACTED Thu Apr 14 14:03:27 2005 From: paris@REDACTED (Javier =?iso-8859-1?Q?Par=EDs_Fern=E1ndez?=) Date: Thu, 14 Apr 2005 14:03:27 +0200 Subject: Bug in hipe? Message-ID: <20050414120327.GA8637@dc.fi.udc.es> Hi, When working with very big binaries (something like 256MB) the bit syntax seems to fail when compiling with hipe: -module(foo). -export([start/0]). start() -> {ok, B} = file:read_file("256Mb_File"), <> = B. Compiling this with beam works, but with hipe it fails during execution with the following error: 1> foo:start(). ** exited:{{badmatch,<<97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,...>>}, []} ** =ERROR REPORT==== 14-Apr-2005::13:59:28 === Error in process <0.30.0> with exit value: {{badmatch,<<268435456 bytes>>},[]} Is this a known bug or limitation when working with binaries and hipe? Regards. From erlang-list@REDACTED Thu Apr 14 14:09:29 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Thu, 14 Apr 2005 14:09:29 +0200 Subject: ant, make and ermake In-Reply-To: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> Message-ID: <425E5D79.8020503@dominicwilliams.net> Michael Fogeborg wrote: > Is anyone working on the build/make process of erlang ? > > I.e. working on OS-independent ways of building erlang ? Do you mean building Erlang applications, or building the Erlang/OTP system itself? We are working on an open-source tool called XP Dojo which, although it really has greater ambitions, already automatically and continuously builds an Erlang application. We are probably a few weeks away from the first release, but it's an "outside working hours" project, so don't hold your breath :( In the future it will also do the same for C code. Regards, Dominic Williams http://www.dominicwilliams.net http://www.xpdojo.net ---- From rpettit@REDACTED Thu Apr 14 14:41:29 2005 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Apr 2005 07:41:29 -0500 Subject: ant, make and ermake In-Reply-To: <425E5D79.8020503@dominicwilliams.net> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> <425E5D79.8020503@dominicwilliams.net> Message-ID: <20050414124129.GA22693@vailsys.com> On Thu, Apr 14, 2005 at 02:09:29PM +0200, Dominic Williams wrote: > Michael Fogeborg wrote: > > >Is anyone working on the build/make process of erlang ? OTP ships with Autotools and builds, no? > >I.e. working on OS-independent ways of building erlang ? OTP ships with Autotools and builds _on multiple platforms_, no? > Do you mean building Erlang applications, or building > the Erlang/OTP system itself? Both can be done with Autotools, though there is a learning curve involved. We use Autotools to create source distributions of our application releases and are quite pleased with it. When it comes time to build a binary package out of your Autotools source distfile there are autoconf macros out there: http://autoconf-archive.cryp.to/macros-by-category.html which can build Linux RPMs automatically, for example (I have not personally used them as we prefer NetBSD pkgsrc which itself ports to all sorts of OSes). When working with NetBSD pkgsrc the distfile created by a 'gmake dist' plugs right in. > We are working on an open-source tool called XP Dojo > which, although it really has greater ambitions, > already automatically and continuously builds an Erlang > application. We are probably a few weeks away from the > first release, but it's an "outside working hours" > project, so don't hold your breath :( > > In the future it will also do the same for C code. For C code I would really urge someone to give Autotools a shot. A page long Makefile can be reduced to just a handful of lines in Makefile.am and configure.ac and will produce the most lovely, portable binaries. We do that for building erl_interface/ei-based shared libraries (one of the ways in which we integrate C/C++ applications with OTP). Just my 2 cents. -Rick From per.gustafsson@REDACTED Thu Apr 14 14:43:54 2005 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 14 Apr 2005 14:43:54 +0200 Subject: Bug in hipe? In-Reply-To: <20050414120327.GA8637@dc.fi.udc.es> References: <20050414120327.GA8637@dc.fi.udc.es> Message-ID: <425E658A.7010308@it.uu.se> Hi This is a bug in HiPE. I believe that it is due to a use of a signed comparison that is used instead of an unsigned comparison. If this is the case I will post a patch soon. Javier Par?s Fern?ndez wrote: >Hi, > >When working with very big binaries (something like 256MB) the bit >syntax seems to fail when compiling with hipe: > >-module(foo). > >-export([start/0]). > >start() -> > {ok, B} = file:read_file("256Mb_File"), > <> = B. > >Compiling this with beam works, but with hipe it fails during >execution with the following error: > >1> foo:start(). >** exited:{{badmatch,<<97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,...>>}, > []} ** > >=ERROR REPORT==== 14-Apr-2005::13:59:28 === >Error in process <0.30.0> with exit value: {{badmatch,<<268435456 bytes>>},[]} > >Is this a known bug or limitation when working with binaries and hipe? > >Regards. > > > From per.gustafsson@REDACTED Thu Apr 14 15:26:05 2005 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 14 Apr 2005 15:26:05 +0200 Subject: Bug in hipe? In-Reply-To: <425E658A.7010308@it.uu.se> References: <20050414120327.GA8637@dc.fi.udc.es> <425E658A.7010308@it.uu.se> Message-ID: <425E6F6D.1010303@it.uu.se> There is a limit on how big binaries can be to work with the bit syntax. On a 32 bit machine the bit syntax only works for binaries which are smaller than 512 MB (4GBit). When bigger binaries are used the behaviour is alittle bit weird. For example in this program: -module(bug). -export([start/0]). start() -> {ok, B} = file:read_file("tmp_file4"), io:format("Halfway: Size:~w~n", [size(B)]), <> = B, {Start,size(Rem)}. Gives the following result: bug:start(). Halfway: Size:671088635 {<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,134217708} When tmp_file4 is 671088635 byte file of all zeroes. The result ought to be: bug:start(). Halfway: Size:671088635 {<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,671088620} or possible some error message. Per Gustafsson >> Hi, >> >> When working with very big binaries (something like 256MB) the bit >> syntax seems to fail when compiling with hipe: >> >> -module(foo). >> >> -export([start/0]). >> >> start() -> >> {ok, B} = file:read_file("256Mb_File"), >> <> = B. >> >> Compiling this with beam works, but with hipe it fails during >> execution with the following error: >> >> 1> foo:start(). >> ** >> exited:{{badmatch,<<97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,...>>}, >> >> []} ** >> >> =ERROR REPORT==== 14-Apr-2005::13:59:28 === >> Error in process <0.30.0> with exit value: {{badmatch,<<268435456 >> bytes>>},[]} >> >> Is this a known bug or limitation when working with binaries and hipe? >> >> Regards. >> >> >> > From per.gustafsson@REDACTED Thu Apr 14 15:44:55 2005 From: per.gustafsson@REDACTED (Per Gustafsson) Date: Thu, 14 Apr 2005 15:44:55 +0200 Subject: Patch for bug in hipe Message-ID: <425E73D7.8080101@it.uu.se> This is a patch for the bug that Javier reported. It will be included in R10B-5. Per Gustafsson -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch URL: From hal@REDACTED Thu Apr 14 15:56:12 2005 From: hal@REDACTED (Hal Snyder) Date: Thu, 14 Apr 2005 08:56:12 -0500 Subject: tv shows table size 0 in R9C-0 Message-ID: <87hdi9cvib.fsf@ghidra.vail> I have just started mnesia with disc_copies schema on two nodes and created two set tables (also disc_copies on the two nodes), cfg and state, each with fields named "key" and "value". tv shows the two tables, but although the record count is updated properly in the Table Size column for the first table, it is always displayed as zero for the second. I can write and read records ok with either table, from tv and from an erl shell. Has anyone seen this behavior? It's on i386 Solaris 9, gcc-3.3.3, if that helps. From hal@REDACTED Thu Apr 14 16:15:52 2005 From: hal@REDACTED (Hal Snyder) Date: Thu, 14 Apr 2005 09:15:52 -0500 Subject: tv shows table size 0 in R9C-0 In-Reply-To: <87hdi9cvib.fsf@ghidra.vail> (Hal Snyder's message of "Thu, 14 Apr 2005 08:56:12 -0500") References: <87hdi9cvib.fsf@ghidra.vail> Message-ID: <87br8hculj.fsf@ghidra.vail> Hal Snyder writes: > I have just started mnesia with disc_copies schema on two nodes and > created two set tables (also disc_copies on the two nodes), cfg and > state, each with fields named "key" and "value". Ok, just after posting, I noticed that I had (late at night in altered state) made the first table ram_copies on my shell node; second one was not not resident. Sorry for the noise. From marcink@REDACTED Thu Apr 14 16:55:53 2005 From: marcink@REDACTED (Marcin Kaszynski) Date: Thu, 14 Apr 2005 16:55:53 +0200 Subject: ant, make and ermake In-Reply-To: <20050414124129.GA22693@vailsys.com> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> <425E5D79.8020503@dominicwilliams.net> <20050414124129.GA22693@vailsys.com> Message-ID: <425E8479.9070107@marcink.org> Rick Pettit wrote: > For C code I would really urge someone to give Autotools a shot. A page long > Makefile can be reduced to just a handful of lines in Makefile.am and > configure.ac and will produce the most lovely, portable binaries. > [...] > Just my 2 cents. Slightly off topic, but I'll throw in another 2. I recently converted a medium-sized project (quick check: 1630 .h and .cpp files; lots of executables being built; uses Qt for GUI and portability; includes some custom build rules) from autotools to scons (smarter make replacement) and was _very_ pleased with the results. The configuration files are much more readable and make it much easier to add custom rules for just about everything than autotools. SCons handles dependencies much, much better than anything else I tried so far -- doesn't trust modification dates, but actually checks if the file contents changed since the last build. It also keeps track of environment settings, so adding or removing a compiler option will trigger a rebuild too. And you get to write the configuration files in Python, so it is quite easy to do weird stuff like writing your own little parser to create the build rules based on information from a number of Makefile.am files (the project had to be bulidable both using scons and autotools for some time). I would strongly suggest giving scons a try. Regards, -mk -- [...] it is far from clear whether "good intentions plus stupidity" or "evil intentions plus intelligence" have wrought more harm in the world. -- Dietrich Dorner, The Logic of Failure From rpettit@REDACTED Thu Apr 14 17:52:41 2005 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 14 Apr 2005 10:52:41 -0500 Subject: ant, make and ermake In-Reply-To: <425E8479.9070107@marcink.org> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> <425E5D79.8020503@dominicwilliams.net> <20050414124129.GA22693@vailsys.com> <425E8479.9070107@marcink.org> Message-ID: <20050414155241.GD22693@vailsys.com> On Thu, Apr 14, 2005 at 04:55:53PM +0200, Marcin Kaszynski wrote: > Rick Pettit wrote: > >For C code I would really urge someone to give Autotools a shot. A page > >long > >Makefile can be reduced to just a handful of lines in Makefile.am and > >configure.ac and will produce the most lovely, portable binaries. > >[...] > >Just my 2 cents. > > Slightly off topic, but I'll throw in another 2. > > I recently converted a medium-sized project (quick check: 1630 .h and .cpp > files; lots of executables being built; uses Qt for GUI and portability; > includes some custom build rules) from autotools to scons (smarter make > replacement) and was _very_ pleased with the results. > > The configuration files are much more readable and make it much easier to > add custom rules for just about everything than autotools. SCons handles > dependencies much, much better than anything else I tried so far -- doesn't > trust modification dates, but actually checks if the file contents changed > since the last build. > > It also keeps track of environment settings, so > adding or removing a compiler option will trigger a rebuild too. > > And you get to write the configuration files in Python, so it is quite easy > to do weird stuff like writing your own little parser to create the build > rules based on information from a number of Makefile.am files (the project > had to be bulidable both using scons and autotools for some time). > > I would strongly suggest giving scons a try. Scons does look interesting. I think I will stick with Autotools, though, for the following reasons: 1) So much opensource stuff builds with it (including the OTP distro) that it's worth knowing either way 2) Autotools have been around longer and I suspect they are quite a bit more mature than scons. 3) Autotools don't require Python (they do require Perl but that seems to ship with most of the OSes we deal with anyhow) 4) the output of a 'gmake dist' plugs so nicely into numerous packaging systems (this may be true of scons as well, I don't know) That said I will poke around with scons in free time to see what I am missing. -Rick From mccratch@REDACTED Thu Apr 14 18:29:47 2005 From: mccratch@REDACTED (mccratch@REDACTED) Date: Thu, 14 Apr 2005 18:29:47 +0200 Subject: cerl module; Core Erlang "forms" Message-ID: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> Hello, I was browsing through the compiler application code, because I was looking for a way to automatically generate code and compile it. The current problem I encounter is, that I don't want to pollute the atom table, so I don't want to generate normal Erlang forms, because - as long as I understand the documentation correctly - I have to create an atom for each variable. In my scenario I want to be able to use it, arbitrary users may initiate the generation of code. Because I don't trust these users I don't want to equip them with a tool for bringing the erlang node down (by overpopulating the atom table). As far as I looked at the cerl module, this would be possible to achive with Core Erlang, because at least the data constructors allow (at least the documentation states so) to use integers as variable names. Atoms are no problem, because I don't want to enable the users to specify arbitrary atoms. I have now the following questions: - is the cerl module somehow regarded as "stable"; the documentation is no included in the "official" documentation available in htmlized form from www.erlang.org, so I assume it is not!? - are variables internally always handled as atoms, or get atoms generated in later compilation steps? get the variable identifiers converted to atoms from integers? -- Matthias Kretschmer From erlang@REDACTED Thu Apr 14 20:23:33 2005 From: erlang@REDACTED (Michael McDaniel) Date: Thu, 14 Apr 2005 11:23:33 -0700 Subject: http:request/4 headers Message-ID: <20050414182333.GK9417@fangora.autosys.us> I need to control case for http headers POSTing to an application. http:request/4 makes my headers lowercase. QUESTION: How can I keep my headers the case I want. EXAMPLE: catch http:request(post, {"http://server.providing.services.example.com/specialApplication/", [ {"Date", httpd_util:rfc1123_date()} , {"Host", "server.providing.services.example.com"} , {"REALM", "SPECMA"} , {"APIVER", "SPECMA:2.0"} , {"Authorization ", http_base_64:encode("username:password")} , {"Accept", "text/xml/html"}, {"User-Agent", "erlang client"} ], "application/x-www-form-urlencoded", Body }, [], []). All the headers are converted to lower case and the application needs the uppercase headers as uppercase. Works the same with http or https. I have not yet found the control to keep uppercase headers; thanks for any assistance. ~Michael From vances@REDACTED Fri Apr 15 03:12:39 2005 From: vances@REDACTED (Vance Shipley) Date: Thu, 14 Apr 2005 21:12:39 -0400 Subject: ant, make and ermake In-Reply-To: <20050414155241.GD22693@vailsys.com> References: <6.2.1.2.0.20050413101620.028155d8@mail.online.no> <425E5D79.8020503@dominicwilliams.net> <20050414124129.GA22693@vailsys.com> <425E8479.9070107@marcink.org> <20050414155241.GD22693@vailsys.com> Message-ID: <20050415011239.GD452@blank.motivity.ca> On Thu, Apr 14, 2005 at 10:52:41AM -0500, Rick Pettit wrote: } } 1) So much opensource stuff builds with it (including the OTP distro) that } it's worth knowing either way Indeed. I learned it and can say it was time well spent. I am now building my linked in drivers with it and it is really slick. What I have been doing with these is to have as much as possible done in Erlang so the C driver code just marshalls memory blocks into the emulator where the Erlang side deconstructs them. Sending to the board is the opposite procedure. Since these are C structures this code is dependent on the underlying OS completely. The automake system figures out the sizes of everything from an int to a 'struct foo [MAXF]' and builds the appropriate erlang code. I have ported these drivers to different OSes in 32 bit, 64 bit, little endian, big endian, etc. Just type ./configure; make. As Hannibal says; I like it when a plan comes together. -Vance From richardc@REDACTED Thu Apr 14 23:09:05 2005 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 14 Apr 2005 23:09:05 +0200 Subject: cerl module; Core Erlang "forms" In-Reply-To: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> Message-ID: <425EDBF1.2010905@csd.uu.se> (Note: all of the following is about undocumented internal compiler details; don't mistake any of it as being officially supported by OTP.) mccratch@REDACTED wrote: > ... As far as I looked at the cerl module, this would be possible to > achive with Core Erlang, because at least the data constructors allow > (at least the documentation states so) to use integers as variable > names. Yes, this is true; the internal representation of a variable name can be an integer. If the code is pretty-printed, such a variable with name N will be displayed as _N, which is a legal variable name, and can be parsed back - but will then become an atom. (Names that already have the form '_N' are further mangled upon prettyprinting.) > I have now the following questions: - is the cerl module somehow > regarded as "stable"; the documentation is no included in the > "official" documentation available in htmlized form from > www.erlang.org, so I assume it is not!? I can't speak for Ericsson, but being the author, I can say that the interface has not gone through any significant changes in a long time, and it seems unlikely (to me) that it will do so in the future. (The last big change was the stabilization and documentation of binary-syntax in Core Erlang, see http://www.it.uu.se/research/group/hipe/cerl/ for the latest version of the specification.) > - are variables internally always handled as atoms, or get atoms > generated in later compilation steps? get the variable identifiers > converted to atoms from integers? What I described above is only true from the Core Erlang level down; the later stages treat integer-named variables in the same way, and do not convert them (as far as I know - does Bj?rn have a comment?), until all variables are replaced with Beam abstract machine registers. Stages before Core Erlang probably do not like integers. Most of the older parts of the compiler take the quick-and-dirty approach to unique variable generation and create atoms consisting of an ordinal number prefixed with some abbreviation for the particular compiler stage, such as 'pre42' or 'ker17'. The undocumented compiler module 'rec_env' has support for generating new random variable names (integer or otherwise) that are not in the current environment - this is used in particular in the Core Erlang inliner, and might be of help to you. Happy hacking! /Richard From vances@REDACTED Fri Apr 15 04:54:30 2005 From: vances@REDACTED (Vance Shipley) Date: Thu, 14 Apr 2005 22:54:30 -0400 Subject: cerl module; Core Erlang "forms" In-Reply-To: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> Message-ID: <20050415025430.GH452@blank.motivity.ca> When Joe made the comment that the lack of atom GC would negate the possibility of a compilation server I thought "too bad that sounded like a good idea!". Recently I was thinking about this and realized that it is a simple problem to solve. Using the slave module you can start up new nodes. The pool module manages a pool of slave nodes and predicts the best one to use based on load. So you would have a master node accepting compilation requests and farming the jobs out to slave nodes. If the pool module restarts slave nodes which exit you could just have the job be compile and then exit. -Vance From joelr1@REDACTED Fri Apr 15 10:41:03 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 11:41:03 +0300 Subject: Efficient list rotation Message-ID: <20050415094103.6480@smtp.gmail.com> Folks, Is there a more efficient version of this code? I understand that it's better to append to the head of the list and reverse afterwards but appending to the tail works with the logic of the task. I'm trying to rotate the list so that a particular item is at the tail of the list, that is if I rotate the list once more it will be at the head. As a bit of background info, I need this for my poker logic as when a player makes a bet I rotate the list and place them at the tail. I might delete them right after or I might not. -module(bar). -compile([export_all]). rotate(_Target, []) -> []; rotate(Target, [H|T]) -> rotate(Target, [H|T], none). rotate(Target, [H|T], none) when Target =:= H -> rotate(Target, T, H); rotate(Target, [H|T], none) -> rotate(Target, T ++ [H], none); rotate(_Target, [], X) -> [X]; rotate(_Target, [H|T], X) -> [H|T] ++ [X]. Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 15 10:49:45 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 11:49:45 +0300 Subject: Objects as processes: Do you wrap message passing? Message-ID: <20050415094945.1747@smtp.gmail.com> Howdy! I'm implementing objects as "active processes" /is that the term?/ and all the method calls are handled in a dispatch loop like this: dispatch(This) -> receive { Pid, bet_size, _, _, Stage } -> Pid ! { retval, bet_size(This, Stage) }, dispatch(This); ... dispose -> ok end. Then I invoke the object like this: Limit = fixed_limit:new(10, 20), Limit ! { self(), bet_size, 0, 0, preflop }, { Low, High } = retrieve(). Do you usually add an extra layer on top of this by wrapping dispatch functionality in a function? Is it better to add bet_size(Limit, Foo, Bar, Stage) when pid(Limit) -> Limit ! { self(), bet_size, Foo, Bar, Stage }, retrieve(). and then call fixed_limit:bet_size(Limit, ...) Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 15 10:52:10 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 11:52:10 +0300 Subject: Structuring unit tests Message-ID: <20050415095210.20236@smtp.gmail.com> Folks, I currently have my unit tests at the end of each module. The only way of moving the tests to a different module that I found is by exporting all the tested functions or placing a -compile([export_all]) at the top of the module to be tested. How do you prefer to structure your tests? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 15 10:55:48 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 11:55:48 +0300 Subject: Big state machines Message-ID: <20050415095548.18351@smtp.gmail.com> Dear Erlangers, I'm implementing my poker logic as a gen_fsm behavior. I'm finding that my FSM is getting a bit unwieldy, though, what with all the tests I have to write for different state transitions, etc. I'm wondering if there's an idiomatic way of splitting big FSMs into smaller chunks. Should I move the processing code into different modules and leave just invocations in the FSM callback module? I suppose this will help with reusing states in other state machines but would like to hear how people have been tackling this problem. Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 15 11:01:37 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 12:01:37 +0300 Subject: gen_fsm: forcing state transitions Message-ID: <20050415100137.9725@smtp.gmail.com> I apologize for the batch of messages to the list but I'm online twice a week from the Helsinki public library. They don't have internet at the refugee reception center so please bear with me :-)! I have been trying to spread logic between different states with some states being artificial if you will. Some processing will happen in such a state and I will then force a transition to a different state. I like this approach because it helps me keep state callbacks reasonably small and easy to test. I'm forcing transition thusly: gen_fsm:send_event_after(1, collect), { next_state, small_blind, Data } The intent is for the FSM to transition to the small_blind state and receive a collect event right after. My question is about the timeout parameter. Is 1 ms a good number for forcing an immediate transition? Can I just use 0 or should I pick a number greater than one? Thanks, Joel -- http://wagerlabs.com/tech From luke@REDACTED Fri Apr 15 11:12:48 2005 From: luke@REDACTED (Luke Gorrie) Date: 15 Apr 2005 11:12:48 +0200 Subject: Efficient list rotation References: <20050415094103.6480@smtp.gmail.com> Message-ID: Hi Joel, The problem is to move the first element of the list to the end? Here's a simple way: move_first_to_last([H|T]) -> T++[H]. The list would be representing a queue. There is also a queue data structure in OTP ('queue' module) which is quite a cute, I remember stepping through the algorithm with billiard balls when I was learning Erlang :-). For your purposes a plain ol' list sounds fine. Or do you really need to move the Nth element to the tail instead? From raimo@REDACTED Fri Apr 15 11:17:58 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 15 Apr 2005 11:17:58 +0200 Subject: Efficient list rotation References: <20050415094103.6480@smtp.gmail.com> Message-ID: Have a look at the module 'queue'. It implements a FIFO queue, which can be used as a rotatable list. joelr1@REDACTED (Joel Reymont) writes: > Folks, > > Is there a more efficient version of this code? I understand that it's > better to append to the head of the list and reverse afterwards but > appending to the tail works with the logic of the task. > > I'm trying to rotate the list so that a particular item is at the tail of > the list, that is if I rotate the list once more it will be at the head. > > As a bit of background info, I need this for my poker logic as when a > player makes a bet I rotate the list and place them at the tail. I might > delete them right after or I might not. > > -module(bar). > -compile([export_all]). > > rotate(_Target, []) -> > []; > > rotate(Target, [H|T]) -> > rotate(Target, [H|T], none). > > rotate(Target, [H|T], none) when Target =:= H -> > rotate(Target, T, H); > > rotate(Target, [H|T], none) -> > rotate(Target, T ++ [H], none); > > rotate(_Target, [], X) -> > [X]; > > rotate(_Target, [H|T], X) -> > [H|T] ++ [X]. > > Thanks, Joel > > -- > http://wagerlabs.com/tech > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joelr1@REDACTED Fri Apr 15 11:32:40 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 12:32:40 +0300 Subject: Efficient list rotation In-Reply-To: References: Message-ID: <20050415103240.26705@smtp.gmail.com> Hi Luke! >The problem is to move the first element of the list to the end? >Here's a simple way: > > move_first_to_last([H|T]) -> T++[H]. I don't know in advance the position of the element that will be moving to the end :-(. And I really need to "rotate" the list as opposed to moving it to the end, yes, in a queue-like fashion :). Thanks, Joel -- http://wagerlabs.com/tech From svg@REDACTED Fri Apr 15 11:52:39 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 15 Apr 2005 15:52:39 +0600 (YEKST) Subject: Efficient list rotation In-Reply-To: <20050415094103.6480@smtp.gmail.com> References: <20050415094103.6480@smtp.gmail.com> Message-ID: <20050415.155239.85408897.svg@surnet.ru> Good day, joelr1> -module(bar). joelr1> -compile([export_all]). joelr1> joelr1> rotate(_Target, []) -> joelr1> []; joelr1> joelr1> rotate(Target, [H|T]) -> joelr1> rotate(Target, [H|T], none). joelr1> joelr1> rotate(Target, [H|T], none) when Target =:= H -> joelr1> rotate(Target, T, H); joelr1> joelr1> rotate(Target, [H|T], none) -> joelr1> rotate(Target, T ++ [H], none); joelr1> joelr1> rotate(_Target, [], X) -> joelr1> [X]; joelr1> joelr1> rotate(_Target, [H|T], X) -> joelr1> [H|T] ++ [X]. rotate(Target, L) -> {Before, FromToEnd} = lists:splitwith(fun (E) -> E =/= Target end, L), case FromToEnd of [Target|T] -> T ++ lists:reverse([T|Before]); _ -> lists:reverse(L) end. Best Regards, Vladimir Sekissov From svg@REDACTED Fri Apr 15 12:03:38 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 15 Apr 2005 16:03:38 +0600 (YEKST) Subject: Objects as processes: Do you wrap message passing? In-Reply-To: <20050415094945.1747@smtp.gmail.com> References: <20050415094945.1747@smtp.gmail.com> Message-ID: <20050415.160338.39162433.svg@surnet.ru> Good day, joelr1> Do you usually add an extra layer on top of this by wrapping dispatch joelr1> functionality in a function? Is it better to add joelr1> joelr1> bet_size(Limit, Foo, Bar, Stage) when pid(Limit) -> joelr1> Limit ! { self(), bet_size, Foo, Bar, Stage }, joelr1> retrieve(). joelr1> joelr1> and then call joelr1> joelr1> fixed_limit:bet_size(Limit, ...) It depends from how you prefer to think about your code in paticular case. If you think in terms of processes and protocols use messages and describe protocol. If you think in terms of modules/objects and interfaces wrap all in functions and describe interface. Best Regards, Vladimir Sekissov From joelr1@REDACTED Fri Apr 15 12:05:33 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 13:05:33 +0300 Subject: Objects as processes: Do you wrap message passing? In-Reply-To: <20050415.160338.39162433.svg@surnet.ru> References: <20050415.160338.39162433.svg@surnet.ru> Message-ID: <20050415110533.21998@smtp.gmail.com> > Vladimir Sekissov wrote: > [...] >If you think in terms of processes and protocols use messages and >describe protocol. Yeah, the Erlang way. Plus, avoids a lot of extra wrapper code :D. Joel -- http://wagerlabs.com/tech From svg@REDACTED Fri Apr 15 12:06:00 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 15 Apr 2005 16:06:00 +0600 (YEKST) Subject: Structuring unit tests In-Reply-To: <20050415095210.20236@smtp.gmail.com> References: <20050415095210.20236@smtp.gmail.com> Message-ID: <20050415.160600.59661929.svg@surnet.ru> joelr1> I currently have my unit tests at the end of each module. The only way of joelr1> moving the tests to a different module that I found is by exporting all joelr1> the tested functions or placing a -compile([export_all]) at the top of joelr1> the module to be tested. joelr1> joelr1> How do you prefer to structure your tests? Look at OTP test server http://www.erlang.org/project/test_server/ It is a standard and comfortable way to test your code. Best Regards, Vladimir Sekissov From ulf.wiger@REDACTED Fri Apr 15 12:08:16 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 15 Apr 2005 12:08:16 +0200 Subject: Big state machines Message-ID: Without having seen the code, I'd wager a guess that you're suffering from the standard problem of writing complex FSMs using FIFO, run-to-completion semantics. The problem I'm referring to occurs when the FSM has to coordinate with different actors; the FIFO semantics force an arbitrary merge+serialization of otherwise unsynchronized message streams, and since your coordinating FSM cannot choose which message source to handle next, it has to handle all possible message sequences. In order to handle this, you basically have to write your FSM as a stack machine, where you keep track of what you were doing, and what message you expect to arrive next. In order to survive, you soon realise that you have to draw an event-state matrix. For each cell in your matrix, you have to at least ask yourself whether the history matters (i.e. the sequence of events that got you there). If so, your event-state matrix will contain case statements for certain cells, where you check for various pre-conditions. The same questions will of course also have to be present in your code, so the programming pattern often becomes: handle_event(Msg, State) -> Q = what_was_I_doing(State), case message_is_valid(Msg, Q) of true -> really_handle_message(Msg, State, Q); false -> case is_this_an_error(Msg, Q) of true -> erlang:fault(...); false -> NewState = case defer_or_discard(Msg, Q) of defer -> defer(Msg, Q, State); discard -> State end end end. ... or something to that effect. You get the point. Perhaps this is not at all relevant in your case. Difficult to say without having seen the source. The remedy? Use plain Erlang state machines with selective receive. You will still have to think about whether you can break up your state machines into several smaller ones. The proof is in your code. If it simplifies the code - do it. Otherwise, don't. /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Joel Reymont Sent: den 15 april 2005 10:56 To: Erlang Users' List Subject: Big state machines Dear Erlangers, I'm implementing my poker logic as a gen_fsm behavior. I'm finding that my FSM is getting a bit unwieldy, though, what with all the tests I have to write for different state transitions, etc. I'm wondering if there's an idiomatic way of splitting big FSMs into smaller chunks. Should I move the processing code into different modules and leave just invocations in the FSM callback module? I suppose this will help with reusing states in other state machines but would like to hear how people have been tackling this problem. Thanks, Joel -- http://wagerlabs.com/tech From thomasl_erlang@REDACTED Fri Apr 15 12:10:05 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 15 Apr 2005 03:10:05 -0700 (PDT) Subject: Structuring unit tests In-Reply-To: 6667 Message-ID: <20050415101005.42088.qmail@web41908.mail.yahoo.com> --- Joel Reymont wrote: > exporting all > the tested functions or placing a > -compile([export_all]) at the top of > the module to be tested. You can also do that with a command line option: % erlc +export_all mymod.erl That means you can make it a flag in the makefile, which often is useful. > How do you prefer to structure your tests? The test_server is probably state of the art. http://www.erlang.org/download/test_server/ Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From svg@REDACTED Fri Apr 15 12:11:53 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Fri, 15 Apr 2005 16:11:53 +0600 (YEKST) Subject: gen_fsm: forcing state transitions In-Reply-To: <20050415100137.9725@smtp.gmail.com> References: <20050415100137.9725@smtp.gmail.com> Message-ID: <20050415.161153.115911243.svg@surnet.ru> joelr1> I'm forcing transition thusly: joelr1> joelr1> gen_fsm:send_event_after(1, collect), joelr1> { next_state, small_blind, Data } joelr1> joelr1> The intent is for the FSM to transition to the small_blind state and joelr1> receive a collect event right after. joelr1> joelr1> My question is about the timeout parameter. Is 1 ms a good number for joelr1> forcing an immediate transition? Can I just use 0 or should I pick a joelr1> number greater than one? User 0 instead of 1, but I think would be better to create separate worker process to handle the task and receive the result. Best Regards, Vladimir Sekissov From joelr1@REDACTED Fri Apr 15 12:18:11 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 13:18:11 +0300 Subject: gen_fsm: forcing state transitions In-Reply-To: <20050415.161153.115911243.svg@surnet.ru> References: <20050415.161153.115911243.svg@surnet.ru> Message-ID: <20050415111811.1792@smtp.gmail.com> > Vladimir Sekissov wrote: >User 0 instead of 1, but I think would be better to create separate >worker process to handle the task and receive the result. Any particular reason why? What I'm trying to avoid is adding a bunch of code and logic before making that transition since then I would need to test the different branches under the state that forces the transition as opposed to the state that's being transitioned to. Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 15 12:27:29 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 13:27:29 +0300 Subject: Structuring unit tests In-Reply-To: <20050415.160600.59661929.svg@surnet.ru> References: <20050415.160600.59661929.svg@surnet.ru> Message-ID: <20050415112729.22154@smtp.gmail.com> > Vladimir Sekissov wrote: >Look at OTP test server > >http://www.erlang.org/project/test_server/ > >It is a standard and comfortable way to test your code. Thanks Vladimir. While I think it's a good standard, I'm not sure I agree with the comfortable part :-). Seems like quite a bit of overhead to me, specially for iterative development. Thanks, Joel -- http://wagerlabs.com/tech From mccratch@REDACTED Fri Apr 15 12:41:12 2005 From: mccratch@REDACTED (mccratch@REDACTED) Date: Fri, 15 Apr 2005 12:41:12 +0200 Subject: cerl module; Core Erlang "forms" In-Reply-To: <20050415025430.GH452@blank.motivity.ca> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> <20050415025430.GH452@blank.motivity.ca> Message-ID: <20050415104112.GA2547@marjakh-lan.kilrathi.lcn> thanks for the replies. Richard Carlsson wrote: [...] > What I described above is only true from the Core Erlang level down; > the later stages treat integer-named variables in the same way, and do > not convert them (as far as I know - does Bj?rn have a comment?), until > all variables are replaced with Beam abstract machine registers. Stages > before Core Erlang probably do not like integers. [...] hmm this seems to be good, but something come up my mind that I seem to overlooked. Whats with locally defined (or globally defined) functions? If I interpret the error messages/stack backtraces correctly they are given names. Are those names atoms and are those atoms put into the executable? If this is the case then I can simply restrict the number of possible local functions. If I understand it correctly the local functions aren't given random names, but the names are directly derived from the function name they are declared in with some postfix or so. So if I use only a specific predefined entry function (I am just want to be able to compile some expressions and then run them), then the atom table shouldn't overflow. On 2005-04-14 at 10:54:30 (-0400), Vance Shipley wrote: > When Joe made the comment that the lack of atom GC would negate the > possibility of a compilation server I thought "too bad that sounded > like a good idea!". Recently I was thinking about this and realized > that it is a simple problem to solve. Using the slave module you can > start up new nodes. The pool module manages a pool of slave nodes > and predicts the best one to use based on load. So you would have a > master node accepting compilation requests and farming the jobs out > to slave nodes. If the pool module restarts slave nodes which exit > you could just have the job be compile and then exit. I had this idea, too, but thought it would be much easier if I don't have to copy the modules and uncompiled code/information used for generating the code between two nodes. (well just something that came to my mind now: does the runtime uses an optimized routine for copying terms between two nodes if they are running on the same host?). Of course the safest method would be writing a little interpreter in Erlang itself, but I think the compilation to BEAM (or using Hipe) is a much better approach. Speed shouldn't be a concern -- especially because this is just a toy project of mine -- but I just don't want it to be slow or lets say slower as it could be, even if it is just a constant factor. -- Matthias Kretschmer From joelr1@REDACTED Fri Apr 15 12:41:02 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 15 Apr 2005 13:41:02 +0300 Subject: Big state machines In-Reply-To: References: Message-ID: <20050415114102.11577@smtp.gmail.com> > Ulf Wiger (AL/EAB) wrote: > [...] >The remedy? Use plain Erlang state machines with >selective receive. You will still have to think >about whether you can break up your state machines >into several smaller ones. The proof is in your >code. If it simplifies the code - do it. Otherwise, >don't. Let me elaborate ... I'm writing poker game logic for the Texas Hold'em variant. First I wait for a few seconds to let people join, leave, sit out, come back. I selectively ignore all other actions. When getting a timeout I check if I have enough players and transition to collecting blinds. Here I need to ask players to post a small blind and a big blind. Players who join in these two states need to make up by posting the big blind and I process this in a separate state after SB and BB are collected. So I have small_blind, big_blind and make_up_blinds for states. Have a separate small_blind state because after picking the player whose turn it is to post the SB I need to see if they actually post it. If they do not then I mark them as sitting out and need to ask the following player. If I run out of players then I cancel the game and go to wait for players. If the the small blind is posted then I repeat the procedure for the big blind and so on and so forth. I'm not sure if I'm suffering from the syndrome that you described. I just have a lot of possible things to handle. This was far easier in Lisp with the continuation passing style, at least far more compact :D. I'm including my Lisp implementation, nicely sequential. Note how compact the makeup-blinds code is. With Erlang the state machine gets quite big and I'm just trying to figure out how to modularize it. I'm not trying to start a flame war or discuss the merits of Lisp vs. Erlang. I picked Erlang after implementing a working poker engine in Lisp and I'm simply trying to go back to FSM from continuations now. Thanks for your advice, Joel P.S. ;;; Save game continuation (defun/cc receive (game) (let/cc k ;; save continuation (setf (continuation game) k) ;; TODO: start a timer here )) (defun/cc ask-for-blind (game amount context) (let ((posted nil) (seat nil) (active (car context)) (small-blind-p (= (small-blind$ game) amount))) (while (and (not posted) (car active)) (setf seat (pop active)) ;; skip people who are waiting ;; for the big blind if small blind ;; is being posted. (unless (and (waiting-for-bb-p seat) small-blind-p) (setf (state seat) 'sitting-out) (setf (current game) seat) (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (setf posted t) (broadcast game 'notify 'blind (seat# seat) bet))) ('fold (broadcast game 'notify 'fold (seat# seat) 0)) )))) (setf (car context) active) (if posted seat nil))) (defun/cc assign-blinds (game) ;; the cons bit is a hack since ask-for-blind pops the list ;; and needs pass the updated list back to us. (let ((context (cons (copy-list (blind-active-seats game)) t)) (blind (blinds game)) (sb$ (small-blind$ game)) (bb$ (big-blind$ game)) (b nil) (sb nil) (bb nil)) (with-slots (small big button) blind (if (not (or small big)) ;; first hand of this game (progn (setf b button) (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context))) (progn ;; get active players starting with the seat ;; to the left of the current small blind. (setf (car context) (copy-list (blind-active-seats game :start-seat small))) (setf b small) (if (bust-p big) ;; big blind is bust (progn (setf sb big) (setf bb (ask-for-blind game bb$ context)) ;; special heads-up handling (unless (second (car context)) (setf sb (pop (car context))))) ;; otherwise (progn (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context)))) ))) ;; heads-up play (when (not (car context)) (setf b sb)) ; heads-up, button = sb (list b sb bb) )) ;;; We let people join once the blinds have passed them ;;; but they must make up for it by posting the big blind. (defun/cc make-up-blinds (game active) (let ((new (active-seats game)) (amount (big-blind$ game))) (loop for seat in new unless (member seat active) do (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (broadcast game 'notify 'blind (seat# seat) bet))) ('wait-for-bb (setf (state seat) 'waiting-for-bb) (broadcast game 'notify 'wait-for-bb (seat# seat) 0)) (t ;; time out received (setf (state seat) 'sitting-out) (broadcast game 'notify 'sit-out (seat# seat) 0)) ))))) -- http://wagerlabs.com/tech From ulf.wiger@REDACTED Fri Apr 15 12:51:21 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 15 Apr 2005 12:51:21 +0200 Subject: Big state machines Message-ID: Well, then. You may write your code the same way in Erlang. Your dealer process sends messages (cards) to the players, and receives requests or cards (if a player plays a card, it might as well be sent to the dealer). Again, with selective receive, you should be able to translate your lisp program logic into erlang with fairly little trouble. With gen_fsm, I'd have to think for much more than the two minutes I spent browsing your lisp code. Given the small amount of thinking that went into the writing of this post, I may have missed something. /Uffe -----Original Message----- From: Joel Reymont [mailto:joelr1@REDACTED] Sent: den 15 april 2005 12:41 To: Ulf Wiger (AL/EAB); Erlang Users' List Subject: Re: Big state machines > Ulf Wiger (AL/EAB) wrote: > [...] >The remedy? Use plain Erlang state machines with >selective receive. You will still have to think >about whether you can break up your state machines >into several smaller ones. The proof is in your >code. If it simplifies the code - do it. Otherwise, >don't. Let me elaborate ... I'm writing poker game logic for the Texas Hold'em variant. First I wait for a few seconds to let people join, leave, sit out, come back. I selectively ignore all other actions. When getting a timeout I check if I have enough players and transition to collecting blinds. Here I need to ask players to post a small blind and a big blind. Players who join in these two states need to make up by posting the big blind and I process this in a separate state after SB and BB are collected. So I have small_blind, big_blind and make_up_blinds for states. Have a separate small_blind state because after picking the player whose turn it is to post the SB I need to see if they actually post it. If they do not then I mark them as sitting out and need to ask the following player. If I run out of players then I cancel the game and go to wait for players. If the the small blind is posted then I repeat the procedure for the big blind and so on and so forth. I'm not sure if I'm suffering from the syndrome that you described. I just have a lot of possible things to handle. This was far easier in Lisp with the continuation passing style, at least far more compact :D. I'm including my Lisp implementation, nicely sequential. Note how compact the makeup-blinds code is. With Erlang the state machine gets quite big and I'm just trying to figure out how to modularize it. I'm not trying to start a flame war or discuss the merits of Lisp vs. Erlang. I picked Erlang after implementing a working poker engine in Lisp and I'm simply trying to go back to FSM from continuations now. Thanks for your advice, Joel P.S. ;;; Save game continuation (defun/cc receive (game) (let/cc k ;; save continuation (setf (continuation game) k) ;; TODO: start a timer here )) (defun/cc ask-for-blind (game amount context) (let ((posted nil) (seat nil) (active (car context)) (small-blind-p (= (small-blind$ game) amount))) (while (and (not posted) (car active)) (setf seat (pop active)) ;; skip people who are waiting ;; for the big blind if small blind ;; is being posted. (unless (and (waiting-for-bb-p seat) small-blind-p) (setf (state seat) 'sitting-out) (setf (current game) seat) (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (setf posted t) (broadcast game 'notify 'blind (seat# seat) bet))) ('fold (broadcast game 'notify 'fold (seat# seat) 0)) )))) (setf (car context) active) (if posted seat nil))) (defun/cc assign-blinds (game) ;; the cons bit is a hack since ask-for-blind pops the list ;; and needs pass the updated list back to us. (let ((context (cons (copy-list (blind-active-seats game)) t)) (blind (blinds game)) (sb$ (small-blind$ game)) (bb$ (big-blind$ game)) (b nil) (sb nil) (bb nil)) (with-slots (small big button) blind (if (not (or small big)) ;; first hand of this game (progn (setf b button) (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context))) (progn ;; get active players starting with the seat ;; to the left of the current small blind. (setf (car context) (copy-list (blind-active-seats game :start-seat small))) (setf b small) (if (bust-p big) ;; big blind is bust (progn (setf sb big) (setf bb (ask-for-blind game bb$ context)) ;; special heads-up handling (unless (second (car context)) (setf sb (pop (car context))))) ;; otherwise (progn (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context)))) ))) ;; heads-up play (when (not (car context)) (setf b sb)) ; heads-up, button = sb (list b sb bb) )) ;;; We let people join once the blinds have passed them ;;; but they must make up for it by posting the big blind. (defun/cc make-up-blinds (game active) (let ((new (active-seats game)) (amount (big-blind$ game))) (loop for seat in new unless (member seat active) do (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (broadcast game 'notify 'blind (seat# seat) bet))) ('wait-for-bb (setf (state seat) 'waiting-for-bb) (broadcast game 'notify 'wait-for-bb (seat# seat) 0)) (t ;; time out received (setf (state seat) 'sitting-out) (broadcast game 'notify 'sit-out (seat# seat) 0)) ))))) -- http://wagerlabs.com/tech From kostis@REDACTED Fri Apr 15 14:28:59 2005 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 15 Apr 2005 14:28:59 +0200 (MEST) Subject: Structuring unit tests Message-ID: <200504151228.j3FCSxFu002905@spikklubban.it.uu.se> Thomas Lindgren gave the following advice: > > --- Joel Reymont wrote: > > exporting all the tested functions or placing a > > -compile([export_all]) at the top of the module to be tested. > > You can also do that with a command line option: > > % erlc +export_all mymod.erl > > That means you can make it a flag in the makefile, > which often is useful. Please do not follow these paths, and please do not give such "advice". Do the following instead: If you have a module m that exports functions f1, ..., fn and contains test functions t1, ..., tm, which are internal (i.e., module-local) and return 'ok' when passing the test, export a *single* function test/0 which looks as follows: test() -> ok = t1(...), ok = t2(...), ... ok = tm(...). If you absolutely positively need to test t1, ..., tm individually, then export a function test/1 which looks as: test(t1) -> ok = t1(...); test(t2) -> ok = t2(...); ... test(tm) -> ok = tm(...). There is very little reason to use 'export_all' for this task. Best, Kostis From csanto@REDACTED Fri Apr 15 15:01:39 2005 From: csanto@REDACTED (Corrado Santoro) Date: Fri, 15 Apr 2005 15:01:39 +0200 Subject: Big state machines In-Reply-To: <20050415095548.18351@smtp.gmail.com> References: <20050415095548.18351@smtp.gmail.com> Message-ID: <425FBB33.8070302@diit.unict.it> Joel Reymont wrote: > I'm implementing my poker logic as a gen_fsm behavior. I'm finding that > my FSM is getting a bit unwieldy, though, what with all the tests I have > to write for different state transitions, etc. > > I'm wondering if there's an idiomatic way of splitting big FSMs into > smaller chunks. Should I move the processing code into different modules > and leave just invocations in the FSM callback module? The eXAT agent programming platform that I've written allows agent behaviours to be programmed by means of hierarchical FSMs, also using virtual inheritance. You may take a loot at http://www.diit.unict.it/users/csanto/exat/ The version that can be downloaded is old, but please contact me for the new release, if you are interested. --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From thomasl_erlang@REDACTED Fri Apr 15 15:21:22 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 15 Apr 2005 06:21:22 -0700 (PDT) Subject: Structuring unit tests In-Reply-To: 6667 Message-ID: <20050415132122.57874.qmail@web41907.mail.yahoo.com> --- Kostis Sagonas wrote: > > Thomas Lindgren gave the following advice: > > > > --- Joel Reymont wrote: > > > exporting all the tested functions or placing a > > > -compile([export_all]) at the top of the module > to be tested. > > > > You can also do that with a command line option: > > > > % erlc +export_all mymod.erl > > > > That means you can make it a flag in the > makefile, > > which often is useful. > > Please do not follow these paths, and please do not > give such "advice". --- Kostis Sagonas wrote: > > Thomas Lindgren gave the following advice: > > > > --- Joel Reymont wrote: > > > exporting all the tested functions or placing a > > > -compile([export_all]) at the top of the module > to be tested. > > > > You can also do that with a command line option: > > > > % erlc +export_all mymod.erl > > > > That means you can make it a flag in the > makefile, > > which often is useful. > > Please do not follow these paths, and please do not > give such "advice". On the contrary, I have found doing this very convenient, not only for separating tests from the rest of the code (which I tend to prefer) but also for interactive testing and debugging. You can then get rid of export_all lodged in the modules, and can, if you so desire, subsequently eliminate its use entirely by a makefile option. So I have no qualms with such advice (no scare quotes needed). I've used it for a couple of years, it has worked well enough, I like it. In the end, it's up to the reader to evaluate and decide, of course. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From sean.hinde@REDACTED Fri Apr 15 15:27:52 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 15 Apr 2005 14:27:52 +0100 Subject: cerl module; Core Erlang "forms" In-Reply-To: <20050415104112.GA2547@marjakh-lan.kilrathi.lcn> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> <20050415025430.GH452@blank.motivity.ca> <20050415104112.GA2547@marjakh-lan.kilrathi.lcn> Message-ID: <3e0a45c0967675d14a373b0a9565aa05@mac.com> Hi, > Of course the safest method would be writing a little interpreter in > Erlang itself, but I think the compilation to BEAM (or using Hipe) is a > much better approach. Speed shouldn't be a concern -- especially > because > this is just a toy project of mine -- but I just don't want it to be > slow or lets say slower as it could be, even if it is just a constant > factor. If you want to get started with something slow and measure to see if it is really too slow, then such an interpreter already exists in OTP. Check out erl_scan, erl_eval and friends. Sean From erlang@REDACTED Fri Apr 15 16:33:33 2005 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 15 Apr 2005 07:33:33 -0700 Subject: [ingela@erix.ericsson.se: Re: http:request/4 headers] Message-ID: <20050415143333.GR9417@fangora.autosys.us> ----- Forwarded message from Ingela Anderton ----- From: Ingela Anderton Date: Fri, 15 Apr 2005 08:54:17 +0200 To: erlang@REDACTED Subject: Re: http:request/4 headers Michael McDaniel wrote: > I need to control case for http headers POSTing to an application. > > http:request/4 makes my headers lowercase. > > QUESTION: How can I keep my headers the case I want. > > > EXAMPLE: > catch http:request(post, > {"http://server.providing.services.example.com/specialApplication/", > [ > {"Date", httpd_util:rfc1123_date()} , > {"Host", "server.providing.services.example.com"} , > {"REALM", "SPECMA"} , > {"APIVER", "SPECMA:2.0"} , > {"Authorization ", http_base_64:encode("username:password")} , > {"Accept", "text/xml/html"}, > {"User-Agent", "erlang client"} > ], "application/x-www-form-urlencoded", Body }, [], []). > > All the headers are converted to lower case and the application needs the > uppercase headers as uppercase. Works the same with http or https. > > I have not yet found the control to keep uppercase headers; thanks for any assistance. At the moment there is no such option in inets. If there is a good enough reason I could perhaps add one, but for the moment it does not feel very prioritized! As I see it the real problem is that your application is not abiding to the standard. >From the RFC 2616: HTTP header fields, which include general-header (section 4.5), request-header (section 5.3), response-header (section 6.2), and entity-header (section 7.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 [9]. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- /Ingela - OTP team ----- End forwarded message ----- From erlang@REDACTED Fri Apr 15 17:01:53 2005 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 15 Apr 2005 08:01:53 -0700 Subject: [ingela@erix.ericsson.se: Re: http:request/4 headers] In-Reply-To: <20050415143333.GR9417@fangora.autosys.us> References: <20050415143333.GR9417@fangora.autosys.us> Message-ID: <20050415150153.GS9417@fangora.autosys.us> On Fri, Apr 15, 2005 at 07:33:33AM -0700, Michael McDaniel wrote: > ----- Forwarded message from Ingela Anderton ----- > > From: Ingela Anderton > Date: Fri, 15 Apr 2005 08:54:17 +0200 > To: erlang@REDACTED > Subject: Re: http:request/4 headers > > > Michael McDaniel wrote: > > I need to control case for http headers POSTing to an application. > > > > http:request/4 makes my headers lowercase. > > > > QUESTION: How can I keep my headers the case I want. > > > > > > EXAMPLE: > > catch http:request(post, > > {"http://server.providing.services.example.com/specialApplication/", > > [ > > {"Date", httpd_util:rfc1123_date()} , > > {"Host", "server.providing.services.example.com"} , > > {"REALM", "SPECMA"} , > > {"APIVER", "SPECMA:2.0"} , > > {"Authorization ", http_base_64:encode("username:password")} , > > {"Accept", "text/xml/html"}, > > {"User-Agent", "erlang client"} > > ], "application/x-www-form-urlencoded", Body }, [], []). > > > > All the headers are converted to lower case and the application needs the > > uppercase headers as uppercase. Works the same with http or https. > > > > I have not yet found the control to keep uppercase headers; thanks for any assistance. > > At the moment there is no such option in inets. If there is a good > enough reason I could perhaps add one, but for the moment it does not > feel very prioritized! As I see it the real problem is that your > application is not abiding to the standard. > > From the RFC 2616: HTTP header fields, which include > general-header (section 4.5), request-header (section 5.3), > response-header (section 6.2), and entity-header (section 7.1) fields, > follow the same generic format as that given in Section 3.1 of RFC 822 > [9]. Each header field consists of a name followed by a colon (":") > and the field value. Field names are case-insensitive. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you, Ingela. I thought late last night about whether the other application was standards conformant and apologize for not checking prior to taking up your time. I will request to the company who provides the service over the Internet if they will make their application standards (RFC 2616) conformant. ~~Michael > > -- > /Ingela - OTP team > From sean.hinde@REDACTED Fri Apr 15 19:13:44 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 15 Apr 2005 18:13:44 +0100 Subject: [ingela@erix.ericsson.se: Re: http:request/4 headers] In-Reply-To: <20050415143333.GR9417@fangora.autosys.us> References: <20050415143333.GR9417@fangora.autosys.us> Message-ID: <5b68e8038f0831bb89009da0acfa0a97@mac.com> On 15 Apr 2005, at 15:33, Michael McDaniel wrote: > ----- Forwarded message from Ingela Anderton > ----- > > From: Ingela Anderton > Date: Fri, 15 Apr 2005 08:54:17 +0200 > To: erlang@REDACTED > Subject: Re: http:request/4 headers > > > Michael McDaniel wrote: >> I need to control case for http headers POSTing to an application. >> >> http:request/4 makes my headers lowercase. >> >> QUESTION: How can I keep my headers the case I want. >> >> >> EXAMPLE: >> catch http:request(post, >> {"http://server.providing.services.example.com/specialApplication/", >> [ >> {"Date", httpd_util:rfc1123_date()} , >> {"Host", "server.providing.services.example.com"} , >> {"REALM", "SPECMA"} , >> {"APIVER", "SPECMA:2.0"} , >> {"Authorization ", http_base_64:encode("username:password")} , >> {"Accept", "text/xml/html"}, >> {"User-Agent", "erlang client"} >> ], "application/x-www-form-urlencoded", Body }, [], []). >> >> All the headers are converted to lower case and the application needs >> the >> uppercase headers as uppercase. Works the same with http or https. >> >> I have not yet found the control to keep uppercase headers; thanks >> for any assistance. > > At the moment there is no such option in inets. If there is a good > enough reason I could perhaps add one, but for the moment it does not > feel very prioritized! As I see it the real problem is that your > application is not abiding to the standard. > > From the RFC 2616: HTTP header fields, which include > general-header (section 4.5), request-header (section 5.3), > response-header (section 6.2), and entity-header (section 7.1) fields, > follow the same generic format as that given in Section 3.1 of RFC 822 > [9]. Each header field consists of a name followed by a colon (":") > and the field value. Field names are case-insensitive. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nevertheless many custom web servers are not compliant in this regard. For my part I would expect a useful client to pass through header values in the same format as the user requests. Sean From erlang@REDACTED Sat Apr 16 00:40:37 2005 From: erlang@REDACTED (Michael McDaniel) Date: Fri, 15 Apr 2005 15:40:37 -0700 Subject: [ingela@erix.ericsson.se: Re: http:request/4 headers] In-Reply-To: <20050415150153.GS9417@fangora.autosys.us> References: <20050415143333.GR9417@fangora.autosys.us> <20050415150153.GS9417@fangora.autosys.us> Message-ID: <20050415224037.GD9417@fangora.autosys.us> On Fri, Apr 15, 2005 at 08:01:53AM -0700, Michael McDaniel wrote: > On Fri, Apr 15, 2005 at 07:33:33AM -0700, Michael McDaniel wrote: > > ----- Forwarded message from Ingela Anderton ----- > > > > From: Ingela Anderton > > Date: Fri, 15 Apr 2005 08:54:17 +0200 > > To: erlang@REDACTED > > Subject: Re: http:request/4 headers > > > > > > Michael McDaniel wrote: > > > I need to control case for http headers POSTing to an application. > > > > > > http:request/4 makes my headers lowercase. > > > > > > QUESTION: How can I keep my headers the case I want. > > > > > > > > > EXAMPLE: > > > catch http:request(post, > > > {"http://server.providing.services.example.com/specialApplication/", > > > [ > > > {"Date", httpd_util:rfc1123_date()} , > > > {"Host", "server.providing.services.example.com"} , > > > {"REALM", "SPECMA"} , > > > {"APIVER", "SPECMA:2.0"} , > > > {"Authorization ", http_base_64:encode("username:password")} , > > > {"Accept", "text/xml/html"}, > > > {"User-Agent", "erlang client"} > > > ], "application/x-www-form-urlencoded", Body }, [], []). > > > > > > All the headers are converted to lower case and the application needs the > > > uppercase headers as uppercase. Works the same with http or https. > > > > > > I have not yet found the control to keep uppercase headers; thanks for any assistance. > > > > At the moment there is no such option in inets. If there is a good > > enough reason I could perhaps add one, but for the moment it does not > > feel very prioritized! As I see it the real problem is that your > > application is not abiding to the standard. > > > > From the RFC 2616: HTTP header fields, which include > > general-header (section 4.5), request-header (section 5.3), > > response-header (section 6.2), and entity-header (section 7.1) fields, > > follow the same generic format as that given in Section 3.1 of RFC 822 > > [9]. Each header field consists of a name followed by a colon (":") > > and the field value. Field names are case-insensitive. > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Thank you, Ingela. I thought late last night about whether the other > application was standards conformant and apologize for not checking > prior to taking up your time. > > I will request to the company who provides the service over the Internet > if they will make their application standards (RFC 2616) conformant. > > ~~Michael ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Turns out that header CaSe was not a factor in the problems we were having between our applications. ~~M > > > > > > -- > > /Ingela - OTP team > > From valentin@REDACTED Sat Apr 16 09:32:51 2005 From: valentin@REDACTED (Valentin Micic) Date: Sat, 16 Apr 2005 09:32:51 +0200 Subject: Big state machines References: Message-ID: <002a01c54256$7fd76390$0100a8c0@MONEYMAKER2> If you were to consider a separate FSM for each player, and game as a common context shared amongst group of player, I would opt to implement a "table" as a gen_server that routes messages (context of the game) between players... I see only few states for a player's FSM. Am I missing a plot completely? Valentin. ----- Original Message ----- From: "Ulf Wiger (AL/EAB)" To: "Joel Reymont" ; "Erlang Users' List" Sent: Friday, April 15, 2005 12:51 PM Subject: RE: Big state machines Well, then. You may write your code the same way in Erlang. Your dealer process sends messages (cards) to the players, and receives requests or cards (if a player plays a card, it might as well be sent to the dealer). Again, with selective receive, you should be able to translate your lisp program logic into erlang with fairly little trouble. With gen_fsm, I'd have to think for much more than the two minutes I spent browsing your lisp code. Given the small amount of thinking that went into the writing of this post, I may have missed something. /Uffe -----Original Message----- From: Joel Reymont [mailto:joelr1@REDACTED] Sent: den 15 april 2005 12:41 To: Ulf Wiger (AL/EAB); Erlang Users' List Subject: Re: Big state machines > Ulf Wiger (AL/EAB) wrote: > [...] >The remedy? Use plain Erlang state machines with >selective receive. You will still have to think >about whether you can break up your state machines >into several smaller ones. The proof is in your >code. If it simplifies the code - do it. Otherwise, >don't. Let me elaborate ... I'm writing poker game logic for the Texas Hold'em variant. First I wait for a few seconds to let people join, leave, sit out, come back. I selectively ignore all other actions. When getting a timeout I check if I have enough players and transition to collecting blinds. Here I need to ask players to post a small blind and a big blind. Players who join in these two states need to make up by posting the big blind and I process this in a separate state after SB and BB are collected. So I have small_blind, big_blind and make_up_blinds for states. Have a separate small_blind state because after picking the player whose turn it is to post the SB I need to see if they actually post it. If they do not then I mark them as sitting out and need to ask the following player. If I run out of players then I cancel the game and go to wait for players. If the the small blind is posted then I repeat the procedure for the big blind and so on and so forth. I'm not sure if I'm suffering from the syndrome that you described. I just have a lot of possible things to handle. This was far easier in Lisp with the continuation passing style, at least far more compact :D. I'm including my Lisp implementation, nicely sequential. Note how compact the makeup-blinds code is. With Erlang the state machine gets quite big and I'm just trying to figure out how to modularize it. I'm not trying to start a flame war or discuss the merits of Lisp vs. Erlang. I picked Erlang after implementing a working poker engine in Lisp and I'm simply trying to go back to FSM from continuations now. Thanks for your advice, Joel P.S. ;;; Save game continuation (defun/cc receive (game) (let/cc k ;; save continuation (setf (continuation game) k) ;; TODO: start a timer here )) (defun/cc ask-for-blind (game amount context) (let ((posted nil) (seat nil) (active (car context)) (small-blind-p (= (small-blind$ game) amount))) (while (and (not posted) (car active)) (setf seat (pop active)) ;; skip people who are waiting ;; for the big blind if small blind ;; is being posted. (unless (and (waiting-for-bb-p seat) small-blind-p) (setf (state seat) 'sitting-out) (setf (current game) seat) (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (setf posted t) (broadcast game 'notify 'blind (seat# seat) bet))) ('fold (broadcast game 'notify 'fold (seat# seat) 0)) )))) (setf (car context) active) (if posted seat nil))) (defun/cc assign-blinds (game) ;; the cons bit is a hack since ask-for-blind pops the list ;; and needs pass the updated list back to us. (let ((context (cons (copy-list (blind-active-seats game)) t)) (blind (blinds game)) (sb$ (small-blind$ game)) (bb$ (big-blind$ game)) (b nil) (sb nil) (bb nil)) (with-slots (small big button) blind (if (not (or small big)) ;; first hand of this game (progn (setf b button) (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context))) (progn ;; get active players starting with the seat ;; to the left of the current small blind. (setf (car context) (copy-list (blind-active-seats game :start-seat small))) (setf b small) (if (bust-p big) ;; big blind is bust (progn (setf sb big) (setf bb (ask-for-blind game bb$ context)) ;; special heads-up handling (unless (second (car context)) (setf sb (pop (car context))))) ;; otherwise (progn (setf sb (ask-for-blind game sb$ context)) (setf bb (ask-for-blind game bb$ context)))) ))) ;; heads-up play (when (not (car context)) (setf b sb)) ; heads-up, button = sb (list b sb bb) )) ;;; We let people join once the blinds have passed them ;;; but they must make up for it by posting the big blind. (defun/cc make-up-blinds (game active) (let ((new (active-seats game)) (amount (big-blind$ game))) (loop for seat in new unless (member seat active) do (send (player seat) 'blind amount) (let* ((cmd (receive game)) (action (first cmd)) (bet (second cmd)) (inplay$ (inplay$ (player seat)))) (case action ('blind (when (or (= bet amount) (= bet inplay$)) (setf (state seat) (if (= bet amount) 'playing 'all-in)) (record-bet game seat bet) (broadcast game 'notify 'blind (seat# seat) bet))) ('wait-for-bb (setf (state seat) 'waiting-for-bb) (broadcast game 'notify 'wait-for-bb (seat# seat) 0)) (t ;; time out received (setf (state seat) 'sitting-out) (broadcast game 'notify 'sit-out (seat# seat) 0)) ))))) -- http://wagerlabs.com/tech From mccratch@REDACTED Sat Apr 16 16:44:44 2005 From: mccratch@REDACTED (mccratch@REDACTED) Date: Sat, 16 Apr 2005 16:44:44 +0200 Subject: cerl module; Core Erlang "forms" In-Reply-To: <3e0a45c0967675d14a373b0a9565aa05@mac.com> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> <20050415025430.GH452@blank.motivity.ca> <20050415104112.GA2547@marjakh-lan.kilrathi.lcn> <3e0a45c0967675d14a373b0a9565aa05@mac.com> Message-ID: <20050416144443.GA7945@localhost.localdomain> On 2005-04-15 at 02:27:52 (+0100), Sean Hinde wrote: > If you want to get started with something slow and measure to see if it > is really too slow, then such an interpreter already exists in OTP. > Check out erl_scan, erl_eval and friends. no - erl_scan/erl_eval would pollute the atom table. Though I can of limit the number of variables and such stuff, but I didn't wanted to do that too much. Limiting the number of functions is a bit better, because the number of functions that one needs to do some useful stuff should be much lower than the number of variables ... As I wanted to be able to exchange the backend anyway, I know think I implement both approaches I favorize: targetting Core Erlang and a simple interpreter. -- Matthias Kretschmer From sean.hinde@REDACTED Sat Apr 16 17:58:20 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Sat, 16 Apr 2005 16:58:20 +0100 Subject: cerl module; Core Erlang "forms" In-Reply-To: <20050416144443.GA7945@localhost.localdomain> References: <20050414162947.GB4937@marjakh-lan.kilrathi.lcn> <20050415025430.GH452@blank.motivity.ca> <20050415104112.GA2547@marjakh-lan.kilrathi.lcn> <3e0a45c0967675d14a373b0a9565aa05@mac.com> <20050416144443.GA7945@localhost.localdomain> Message-ID: <2c99733b6fe7d1a6287d6a3ac3c475d0@mac.com> On 16 Apr 2005, at 15:44, mccratch@REDACTED wrote: > On 2005-04-15 at 02:27:52 (+0100), Sean Hinde wrote: >> If you want to get started with something slow and measure to see if >> it >> is really too slow, then such an interpreter already exists in OTP. >> Check out erl_scan, erl_eval and friends. > > no - erl_scan/erl_eval would pollute the atom table. Though I can of > limit the number of variables and such stuff, but I didn't wanted to do > that too much. Possibly it would not be too much work to remove atoms from erl_scan/eval, but the core erlang way is much cooler I agree. Sean From erlang-list@REDACTED Sat Apr 16 23:43:38 2005 From: erlang-list@REDACTED (Dominic Williams) Date: Sat, 16 Apr 2005 23:43:38 +0200 Subject: Structuring unit tests In-Reply-To: <20050415095210.20236@smtp.gmail.com> References: <20050415095210.20236@smtp.gmail.com> Message-ID: <4261870A.4060701@dominicwilliams.net> Joel Reymont wrote: > How do you prefer to structure your tests? I put the unit tests for module foo in module foo_ut, and only test exported functions (the others get tested implicitly). I use pattern matches as assertions. Regards, Dominic Williams http://www.dominicwilliams.net ---- From nm@REDACTED Sun Apr 17 12:57:07 2005 From: nm@REDACTED (Gaspar Chilingarov) Date: Sun, 17 Apr 2005 15:57:07 +0500 (AMST) Subject: Structuring unit tests In-Reply-To: <4261870A.4060701@dominicwilliams.net> References: <20050415095210.20236@smtp.gmail.com> <4261870A.4060701@dominicwilliams.net> Message-ID: <55104.212.73.64.194.1113735427.squirrel@webmail.web.am> Well, and how do you test functions, which are not exported from foo module? I'm getting a lot of utilitary functions,. which are used only inside of module, but i want to test them explictly. another question - how do you following thing in Erlang? in OO world I can define some object, then inherit from it in unit test, and override some functions. Thus i can create necessary environment for tested class. How this can be implemented in Erlang? I also accept answers "this is not an erlangish way at all" :) > Joel Reymont wrote: > >> How do you prefer to structure your tests? > > I put the unit tests for module foo in module foo_ut, and > only test exported functions (the others get tested implicitly). > > I use pattern matches as assertions. > > Regards, > > Dominic Williams > http://www.dominicwilliams.net > > ---- > -- Gaspar Chilingarov System Administrator t +3749 419763 w www.web.am e nm@REDACTED From ok@REDACTED Mon Apr 18 03:56:56 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Apr 2005 13:56:56 +1200 (NZST) Subject: Efficient list rotation Message-ID: <200504180156.j3I1uuoT372884@atlas.otago.ac.nz> From ok@REDACTED Mon Apr 18 04:06:56 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Apr 2005 14:06:56 +1200 (NZST) Subject: Efficient list rotation Message-ID: <200504180206.j3I26uJY377621@atlas.otago.ac.nz> Let's consider the problem abstractly first. We are given X - an element to look for L - a list to look for X in Suppose we can decompose L = A ++ [X] ++ Z where A is as short as possible. Then to rotate L so that X is at the end is to return Z ++ A ++ [X] If we cannot decompose L that way, X does not occur, and following usual Erlang practice, "just let it crash". rotate_to_end(L, X) -> rotate_to_end_aux(L, X, []). rotate_to_end_aux([X|Z], X, ReversedA) -> Z ++ reverse_append(ReversedA, [X]); rotate_to_end_aux([H|T], X, ReversedA) -> rotate_to_end_aux(T, X, [H|ReversedA]). reverse_append([], R) -> R; reverse_append([H|T], R) -> reverse_append(T, [H|R]). This code has been tested. It builds length(L)+length(A) cons cells, of which length(L) are retained. From ok@REDACTED Mon Apr 18 04:59:52 2005 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 18 Apr 2005 14:59:52 +1200 (NZST) Subject: Structuring unit tests Message-ID: <200504180259.j3I2xqN3377240@atlas.otago.ac.nz> "Gaspar Chilingarov" wrote: another question - how do you following thing in Erlang? in OO world I can define some object, then inherit from it in unit test, and override some functions. Thus i can create necessary environment for tested class. How this can be implemented in Erlang? I also accept answers "this is not an erlangish way at all" :) It couldn't be easier if you follow the advice to have a test/1 function that is exported instead of calling the functions individually. -module(foo). -export([test/1]). test(1) -> ...; % The test cases you want to test(77) -> ...; % override or test(102) -> ...; % add go here test(X) -> bar:test(X). % Then you "inherit" from module bar. From ulf@REDACTED Mon Apr 18 06:56:20 2005 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 18 Apr 2005 06:56:20 +0200 Subject: Efficient list rotation In-Reply-To: <200504180206.j3I26uJY377621@atlas.otago.ac.nz> References: <200504180206.j3I26uJY377621@atlas.otago.ac.nz> Message-ID: Nice, although my preference in stead of reverse_append/2 would be lists:reverse([X|ReversedA]). Not that saving 3 lines of code is necessarily that important. Whatever feels the most elegant is of course the solution to pick. /Uffe Den 2005-04-18 04:06:56 skrev Richard A. O'Keefe : > Let's consider the problem abstractly first. > > We are given > X - an element to look for > L - a list to look for X in > > Suppose we can decompose > L = A ++ [X] ++ Z > where A is as short as possible. > Then to rotate L so that X is at the end is > to return Z ++ A ++ [X] > > If we cannot decompose L that way, X does not > occur, and following usual Erlang practice, > "just let it crash". > > rotate_to_end(L, X) -> > rotate_to_end_aux(L, X, []). > > rotate_to_end_aux([X|Z], X, ReversedA) -> > Z ++ reverse_append(ReversedA, [X]); > rotate_to_end_aux([H|T], X, ReversedA) -> > rotate_to_end_aux(T, X, [H|ReversedA]). > > reverse_append([], R) -> R; > reverse_append([H|T], R) -> > reverse_append(T, [H|R]). > > This code has been tested. It builds length(L)+length(A) cons > cells, of which length(L) are retained. > > > From matthias@REDACTED Mon Apr 18 08:57:23 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 18 Apr 2005 08:57:23 +0200 Subject: Structuring unit tests In-Reply-To: <55104.212.73.64.194.1113735427.squirrel@webmail.web.am> References: <20050415095210.20236@smtp.gmail.com> <4261870A.4060701@dominicwilliams.net> <55104.212.73.64.194.1113735427.squirrel@webmail.web.am> Message-ID: <16995.23123.341544.369872@antilipe.corelatus.se> Gaspar Chilingarov writes: > Well, and how do you test functions, which are not exported from foo module? > > I'm getting a lot of utilitary functions,. which are used only inside of > module, but i want to test them explictly. > > another question - how do you following thing in Erlang? > in OO world.... In the OO world, let's say C++, how do you test private member functions? I can think of three straightforward ways and two insane ones 1. You test those functions indirectly, i.e. by calling non-private member functions which you know exercise the private ones. You might use a test coverage tool to verify the "know" part. 2. You incorporate (public) test functions in the class you're testing. Those test functions exercise the private functions. This is a special case of #1. 3. You make a friend class and stick all the test code there. (4. You put '#define private public' in every translation unit, perhaps by means of a compiler directive in a Makefile) (5. You mess around with compiling to shared libraries, fiddle with name mangling and then find a way to use your knowledge of ELF to call the private members, assuming they're emitted.) You can do all except for #3 in Erlang too. I generally stick to #1, occasionally resorting to #2. In Erlang, #4 is accomplished by using the 'export_all' compiler directive. Some frequent contributors to the mailing list consider this a good way to test, others say it is madness. Matt From joelr1@REDACTED Mon Apr 18 11:47:33 2005 From: joelr1@REDACTED (joel reymont) Date: Mon, 18 Apr 2005 12:47:33 +0300 Subject: Big state machines In-Reply-To: References: <002a01c54256$7fd76390$0100a8c0@MONEYMAKER2> Message-ID: Folks, A big thanks to all who replied. I had the insight over the weekend that as Ulf said the code can be rewritten with selective receive. I decided to stick with gen_fsm, though. I?ll post if I have problems. Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Mon Apr 18 11:55:49 2005 From: joelr1@REDACTED (joel reymont) Date: Mon, 18 Apr 2005 12:55:49 +0300 Subject: Prop lists vs. dictionaries Message-ID: Is there any particular reason to use prop lists over dictionaries? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Mon Apr 18 11:58:50 2005 From: joelr1@REDACTED (joel reymont) Date: Mon, 18 Apr 2005 12:58:50 +0300 Subject: Cryptographically strong random Message-ID: Folks, I understand that SSL in Erlang is based on OpenSSL. That library also comes with a cryptographically strong random implementation but that bit is not included in Erlang SSL. Is there a cryptographically strong implementation for Erlang? What is the easiest way to hook up into the Erlang SSL to bring in OpenSSL random? Build it as a linked-in driver? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Mon Apr 18 12:02:05 2005 From: joelr1@REDACTED (joel reymont) Date: Mon, 18 Apr 2005 13:02:05 +0300 Subject: =:= vs == and a shorter version of if Message-ID: Howdy! Should I always use =:= instead of == if I don?t need type conversion? How much more efficient is that? Also, is there a shorter way of saying the following? if SomeCondition -> dostuff; true -> ok end. Thanks, Joel -- http://wagerlabs.com/tech From richardc@REDACTED Mon Apr 18 12:15:56 2005 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 18 Apr 2005 12:15:56 +0200 Subject: Prop lists vs. dictionaries In-Reply-To: References: Message-ID: <426388DC.4000909@csd.uu.se> joel reymont wrote: > Is there any particular reason to use prop lists over dictionaries? Certainly not for efficiency. Proplists are handy for passing options to a function, using defaults, overriding, combining, etc. If you pass a proplist to control the behaviour of some heavy computation, I recommend that you internally pick out the values from the proplist and put them in a record or dictionary for quick access before you enter the main loop. /Richard From casper2000a@REDACTED Mon Apr 18 12:50:21 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 18 Apr 2005 16:50:21 +0600 Subject: Asn1c compile error Message-ID: Hi All, When I try to compile the attached ASN.1 file with below command, /usr/local/lib/erlang/bin/erlc +debug_info -W -b ber_bin +optimize +driver -I ../../tcap-1.0/asn_src ../asn_src/MAP-PDU.asn (I have all the TCAP and ROS asn source files in the tcap-1.0/asn_src directory and MAP asn source files in the current directory) I get the below error, Erlang ASN.1 version "1.4.4.5" compiling "/usr2/erlang/map-1.0/ebin/../asn_src/MAP-PDU.asn" Compiler Options: [ber_bin_v2, report_errors, {cwd,"/usr2/erlang/map-1.0/ebin"}, {outdir,"/usr2/erlang/map-1.0/ebin"}, {i,"/usr2/erlang/map-1.0/ebin/../../tcap-1.0/asn_src"}, driver, optimize, debug_info] asn1error:16:'MAP-PDU':'MAP-PDU' {internal_error,{'cant check',[]}} make[2]: *** [MAP-PDU.erl] Error 1 make[2]: Leaving directory `/usr2/erlang/map-1.0/ebin' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr2/erlang/map-1.0' make: *** [all] Error 2 What could be wrong? Please advice, as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MAP-PDU.asn Type: application/octet-stream Size: 517 bytes Desc: not available URL: From maruthavanan_s@REDACTED Mon Apr 18 13:27:07 2005 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Mon, 18 Apr 2005 11:27:07 +0000 Subject: H/W requirements for OTP RB-2 Message-ID: hi , Can any one suggest me the hardware requirements of erlang OTP R10 B-2 Thanks, Marutha _________________________________________________________________ Don?t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ From ingela@REDACTED Mon Apr 18 14:01:48 2005 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 18 Apr 2005 14:01:48 +0200 Subject: [ingela@erix.ericsson.se: Re: http:request/4 headers] References: <20050415143333.GR9417@fangora.autosys.us> <5b68e8038f0831bb89009da0acfa0a97@mac.com> Message-ID: <16995.41388.296831.736587@gargle.gargle.HOWL> Sean Hinde wrote: [...] > > From the RFC 2616: HTTP header fields, which include > > general-header (section 4.5), request-header (section 5.3), > > response-header (section 6.2), and entity-header (section 7.1) fields, > > follow the same generic format as that given in Section 3.1 of RFC 822 > > [9]. Each header field consists of a name followed by a colon (":") > > and the field value. Field names are case-insensitive. > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Nevertheless many custom web servers are not compliant in this regard. > For my part I would expect a useful client to pass through header > values in the same format as the user requests. I will put it on the wish list, which means I proably will get around to adding such a feature in an foreseeable future. Even though I conceptually think it is wrong, it could be a non default option for practical reasons. Alas client applications are often forced to be forgiving to server errors to survive. -- /Ingela - OTP team From casper2000a@REDACTED Mon Apr 18 14:42:57 2005 From: casper2000a@REDACTED (Casper) Date: Mon, 18 Apr 2005 18:42:57 +0600 Subject: Asn1c compile error In-Reply-To: Message-ID: Hi all, Could anyone please help me to understand how to solve the below error? Even at a fee is alright. Please help. Thanks! - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Casper Sent: Monday, April 18, 2005 4:50 PM To: erlang-questions@REDACTED Subject: Asn1c compile error Hi All, When I try to compile the attached ASN.1 file with below command, /usr/local/lib/erlang/bin/erlc +debug_info -W -b ber_bin +optimize +driver -I ../../tcap-1.0/asn_src ../asn_src/MAP-PDU.asn (I have all the TCAP and ROS asn source files in the tcap-1.0/asn_src directory and MAP asn source files in the current directory) I get the below error, Erlang ASN.1 version "1.4.4.5" compiling "/usr2/erlang/map-1.0/ebin/../asn_src/MAP-PDU.asn" Compiler Options: [ber_bin_v2, report_errors, {cwd,"/usr2/erlang/map-1.0/ebin"}, {outdir,"/usr2/erlang/map-1.0/ebin"}, {i,"/usr2/erlang/map-1.0/ebin/../../tcap-1.0/asn_src"}, driver, optimize, debug_info] asn1error:16:'MAP-PDU':'MAP-PDU' {internal_error,{'cant check',[]}} make[2]: *** [MAP-PDU.erl] Error 1 make[2]: Leaving directory `/usr2/erlang/map-1.0/ebin' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr2/erlang/map-1.0' make: *** [all] Error 2 What could be wrong? Please advice, as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo@REDACTED Mon Apr 18 14:51:26 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 18 Apr 2005 14:51:26 +0200 Subject: =:= vs == and a shorter version of if References: Message-ID: joelr1@REDACTED (joel reymont) writes: > Howdy! > > Should I always use =:= instead of == if I don?t need type conversion? > How much more efficient is that? Hardly noticable. It will cost you one more character to type :-) Ordinary matching uses =:= so it is the one you really often want to use, but == only differs for float vs integer so it is mostly the same. > > Also, is there a shorter way of saying the following? > > if > SomeCondition -> > dostuff; > true -> > ok > end. > > Thanks, Joel > if SomeCondition -> dostuff; true -> ok end. %% Sorry about that, could not resist... this might be better: SomeCondition andalso dostuff. % Warning! not tail recursive. > -- > http://wagerlabs.com/tech -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From vances@REDACTED Mon Apr 18 21:35:07 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 18 Apr 2005 15:35:07 -0400 Subject: Big state machines In-Reply-To: References: <002a01c54256$7fd76390$0100a8c0@MONEYMAKER2> Message-ID: <20050418193507.GO4594@blank.motivity.ca> On Mon, Apr 18, 2005 at 12:47:33PM +0300, joel reymont wrote: } } A big thanks to all who replied. I had the insight over the weekend } that as Ulf said the code can be rewritten with selective receive. I } decided to stick with gen_fsm, though. I?ll post if I have problems. A classical finite state machine has no state data. It only reacts to input events performing an action such as sending a signal and moving to another one of a finite number of states. The only memory it has is it's program for the state it's in. Once it has moved to another state it has no knowledge of what state it was last in or anything which has happened previously. The gen_fsm behaviour is an example of an extended communicating finite state machine. The difference being that it has state data; it remembers things (if we took away the StateData argument to the state handlers it would be a classical FSM). This expands their utility but increases the complexity. A simple use of state data would be to keep counters so that we could execute exceptions such as maximum retries. On the other hand you could take an FSM with ten states and reduce it to one by abusing the state data. If you can identify the natural FSMs in your problem and map them one to one to gen_fsm processes it should be quite mangeable. If it seems unmanageable you've probably overloaded it. An advanced concept is that each of the states may itself be a state machine. If you can map the main problem to a reasonably sozed state machine you may be able to map the details onto sub state machines. SDL is a useful modeling tool which maps well onto Erlang however it does extend things further to use selective receive. SDL has a save which says that it should leave any unmentioned events in the event queue. I still map SDL onto gen_fsms though and use state data to retain the saved signals. I've often wondered about building a new behaviour to handle selective receive but have yet to investigate it. -Vance From vances@REDACTED Mon Apr 18 21:49:58 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 18 Apr 2005 15:49:58 -0400 Subject: Big state machines In-Reply-To: <20050418193507.GO4594@blank.motivity.ca> References: <002a01c54256$7fd76390$0100a8c0@MONEYMAKER2> <20050418193507.GO4594@blank.motivity.ca> Message-ID: <20050418194958.GQ4594@blank.motivity.ca> On Mon, Apr 18, 2005 at 03:35:07PM -0400, Vance Shipley wrote: } ... . I've often wondered about building a new behaviour to handle } selective receive but have yet to investigate it. Of course having just said that I realize that this is what Ulf has given us. The difference is that while his goal was to make things map closer to plain erlang my concept was to make things map closer to plain SDL. -Vance From erlang@REDACTED Mon Apr 18 17:13:13 2005 From: erlang@REDACTED (Michael McDaniel) Date: Mon, 18 Apr 2005 08:13:13 -0700 Subject: H/W requirements for OTP RB-2 In-Reply-To: References: Message-ID: <20050418151313.GP9417@fangora.autosys.us> On Mon, Apr 18, 2005 at 11:27:07AM +0000, maruthavanan s wrote: > hi , > > Can any one suggest me the hardware requirements of erlang OTP R10 B-2 > > Thanks, > Marutha _________________________________________________________________ For what task? My workstation development machine is about 600 Mhz with 512MB memory. I run R10B-4 on a 400 Mhz Celeron (with 512 MB) as an automated web site checker for customers. Not much load doing this task. I am deploying it on a newer machine which will be a 3 GHz Xeon (32-bit core) with 1 GB memory. This new task will have a bit more work to do, keeping up a steady conversation with a couple different external servers and feeding an SQL database for a webserver to query. Even with this task, though, I think the hardware will be loafing. ~Michael From bjarne@REDACTED Mon Apr 18 18:45:55 2005 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Mon, 18 Apr 2005 18:45:55 +0200 Subject: Erlang/OTP User Conference, November 10, 2005 References: Message-ID: <005d01c54436$260aec60$8f1f69d4@segeltorp> Dear Erlang friends All Erlang developers, researchers, users, programmers, and other interested persons are hereby cordially invited to the 11th International Erlang/OTP User Conference, in Stockholm on November 10. Please see the invitation and call for papers at http://www.erlang.se/euc/05/ Dead-line for submissions is October 15. This is the great yearly Erlang event. Check out http://www.erlang.se/euc/04/photos/ to see how fun we had last year ! Welcome Bjarne D?cker (EUC chairman) PS. For those interested in research issues there is the ACM SIGPLAN Erlang workshop http://www.erlang.se/workshop/2005/ already in September. -------------- next part -------------- An HTML attachment was scrubbed... URL: From klacke@REDACTED Mon Apr 18 18:57:18 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Mon, 18 Apr 2005 18:57:18 +0200 Subject: Cryptographically strong random In-Reply-To: References: Message-ID: <20050418165718.GA20751@hyber.org> On Mon, Apr 18, 2005 at 12:58:50PM +0300, joel reymont wrote: > Folks, > > I understand that SSL in Erlang is based on OpenSSL. That library also > comes with a cryptographically strong random implementation but that > bit is not included in Erlang SSL. > > Is there a cryptographically strong implementation for Erlang? We do: random_ascii_str(Length) -> random_ascii_str(Length, os:cmd("dd if=/dev/urandom count=1"), [], 0). random_ascii_str(Length, _,Ret, Length) -> Ret; random_ascii_str(Length, [H|T], Ack, Sofar) -> if $a =< H, H =< $z -> random_ascii_str(Length, T, [H|Ack], Sofar+1); $A =< H, H =< $Z -> random_ascii_str(Length, T, [H|Ack], Sofar+1); true -> random_ascii_str(Length, T, Ack, Sofar) end; random_ascii_str(Length, [], Ack, Sofar) -> random_ascii_str(Length, os:cmd("dd if=/dev/urandom count=1"),Ack, Sofar). > > What is the easiest way to hook up into the Erlang SSL to bring in > OpenSSL random? Build it as a linked-in driver? > Yes, or hack the code in lib/crypto/c_src and lib/crypto/src It should be pretty straightforward to extend with the RAND code from openssl. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From micke@REDACTED Mon Apr 18 21:55:39 2005 From: micke@REDACTED (Michael Fogeborg) Date: Mon, 18 Apr 2005 21:55:39 +0200 Subject: H/W requirements for OTP RB-2 In-Reply-To: <20050418151313.GP9417@fangora.autosys.us> References: <20050418151313.GP9417@fangora.autosys.us> Message-ID: <6.2.1.2.0.20050418215402.027c8538@mail.online.no> After listening to http://www.sics.se/~adam/talks.html talking about small TCP/IP stacks I start to wonder how small a machine erlang can run on.... What is the smallest machine anyone here has run erlang on - and still being useful ? At 17:13 2005-04-18, you wrote: >On Mon, Apr 18, 2005 at 11:27:07AM +0000, maruthavanan s wrote: > > hi , > > > > Can any one suggest me the hardware requirements of erlang OTP R10 B-2 > > > > Thanks, > > Marutha >_________________________________________________________________ >For what task? > >My workstation development machine is about 600 Mhz with 512MB memory. > >I run R10B-4 on a 400 Mhz Celeron (with 512 MB) as an automated web site >checker for customers. Not much load doing this task. > >I am deploying it on a newer machine which will be a 3 GHz Xeon >(32-bit core) with 1 GB memory. This new task will have a bit more >work to do, keeping up a steady conversation with a couple different >external servers and feeding an SQL database for a webserver to >query. Even with this task, though, I think the hardware will >be loafing. > >~Michael From ulf.wiger@REDACTED Mon Apr 18 22:03:59 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 18 Apr 2005 22:03:59 +0200 Subject: Big state machines Message-ID: I have another version, as a matter of fact, which is much closer to gen_fsm. It solves the dreaded complexity explosion problem, but the programmer may still have to resort to e.g. continuations to handle out-of-order messages (since it uses FIFO semantics.) The idea was to find a way to hack a callback- oriented event-handling system in order to keep complexity at bay. The code was written as part of an extended POTS example, the result of which I will try to post somewhere someday. My conclusion was that most programmers have not been trained to consider the awful complexity that results from botching the design of your FSM, and many teachers of CS seem not to have considered it either, even though they don't need to think long to realise the dangers. Among those who have considered it, some search for a solution that maintains the liveliness guarantees required in hard real-time, but which are not needed in the soft real-time programming where Erlang is used. Most FSM frameworks are designed with hard real-time in mind. It's not a behaviour, but I believe that gen_fsm could perhaps be extended to hold a "receive vector" that modifies the normal FIFO semantics. To start with, here's an example of it's use. A snippet from a POTS control program, similar to the one in the Erlang book: offhook(?lim, #s{state = idle} = S) -> Ref = lim_asynch:start_tone(dial), {ok, S#s{state = {{await_tone_start,dial}, getting_first_digit}}, #recv{lim = Ref, _ = false}}; %% The semantics of the callback being: %% - name of callback function is the signal ('offhook') %% - return value is either {ok, NewState} or %% {ok, NewState, ReceiveVector} - in this case, %% receive message tagged as 'lim', where the 2nd element %% in the message is Ref; buffer all other messages. Here's the main event loop module: -module(asynch_main). -export([event_loop/2, event_loop/3]). %% simple event loop with FIFO semantics event_loop(M, S) -> receive {From, Event} -> dispatch(From, Event, M, S); {From, Ref, Event} -> dispatch(From, Event, M, S); Other -> io:format("event_loop received unknown msg: ~p~n", [Other]), exit({unknown_msg, Other}) end. event_loop(M, S, Recv) -> %% Recv is a tuple, where each element represents a filter. %% From is used to locate the right filter, and the value of %% the filter in that position is interpreted as follows: %% false : ignore (buffer) message %% [] : consume message %% Value : consume iff Ref == Value receive {From, Event} when element(From, Recv) == [] -> dispatch(From, Event, M, S); {From, Ref, Event} when element(From, Recv) == Ref -> dispatch(From, Event, M, S); {From, Ref, Event} when element(From, Recv) == [] -> dispatch(From, Event, M, S) end. dispatch(From, Event, M, S) when atom(Event) -> handle(M:Event(From, S), M); dispatch(From, {Event, Arg}, M, S) -> handle(M:Event(From, Arg, S), M). handle({ok, NewState}, M) -> event_loop(M, NewState); handle({ok, NewState, Recv}, M) -> event_loop(M, NewState, Recv). Aside: After several read-throughs, I finally grasped the fact that there is something called "deferrable event" in UML (although the UML tool provided by Rational -- RoseRT -- doesn't support it.) Sadly, with UML and SDL, the default behaviour is to throw away messages that arrive in the wrong state, and have not been marked deferrable in that state. This makes it difficult to maintain large programs, unless the tool in question supports another default (everything deferrable unless otherwise specified.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Vance Shipley Sent: den 18 april 2005 21:50 To: joel reymont Cc: erlang-questions@REDACTED Subject: Re: Big state machines On Mon, Apr 18, 2005 at 03:35:07PM -0400, Vance Shipley wrote: } ... . I've often wondered about building a new behaviour to handle } selective receive but have yet to investigate it. Of course having just said that I realize that this is what Ulf has given us. The difference is that while his goal was to make things map closer to plain erlang my concept was to make things map closer to plain SDL. -Vance From ulf@REDACTED Mon Apr 18 22:45:17 2005 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 18 Apr 2005 22:45:17 +0200 Subject: Big state machines In-Reply-To: References: Message-ID: Den 2005-04-18 22:03:59 skrev Ulf Wiger (AL/EAB) : > > I have another version, as a matter of fact, which is much > closer to gen_fsm. It solves the dreaded complexity explosion > problem, but the programmer may still have to resort to e.g. > continuations to handle out-of-order messages (since it uses > FIFO semantics.) Bah! Forget that nonsense. The continuations are not needed due to FIFO semantics, but due to the non-blocking "go-to-like" semantics. /Uffe From erlang-list@REDACTED Mon Apr 18 22:53:57 2005 From: erlang-list@REDACTED (erlang-list@REDACTED) Date: Mon, 18 Apr 2005 22:53:57 +0200 Subject: Structuring unit tests In-Reply-To: <55104.212.73.64.194.1113735427.squirrel@webmail.web.am> References: <20050415095210.20236@smtp.gmail.com> <4261870A.4060701@dominicwilliams.net> <55104.212.73.64.194.1113735427.squirrel@webmail.web.am> Message-ID: <1113857637.42641e650bfd8@ssl0.ovh.net> Gaspar Chilingarov wrote: > Well, and how do you test functions, which are not > exported from foo module? I'm getting a lot of utilitary > functions,. which are used only inside of module, but i > want to test them explictly. I find that I don't usually need to explicitly. This is probably because I rarely create such functions at first: I start by writing the principal, exported function so that it passes simple cases, then as the test becomes more robust and the exported function more complicated, I extract parts of it into an auxiliary function (which is implicitly tested by the unit test for the principal function). > another question - how do you following thing in Erlang? > in OO world I can define some object, then inherit from > it in unit test, and override some functions. Thus i can > create necessary environment for tested class. How this > can be implemented in Erlang? I also accept answers "this > is not an erlangish way at all" :) I write a separate function that builds up the necessary environment, and call it explicitly at the beginning of any test that needs that environment. Or, more often, as I also need to tear down the environment, I have a higher order function that sets up the environment, executes a fun (passing it the environment), catches any crashes, and then tears down the environment. Regards, Dominic Williams http://www.dominicwilliams.net ---- From matthias@REDACTED Mon Apr 18 23:05:19 2005 From: matthias@REDACTED (Matthias Lang) Date: Mon, 18 Apr 2005 23:05:19 +0200 Subject: H/W requirements for OTP RB-2 In-Reply-To: <6.2.1.2.0.20050418215402.027c8538@mail.online.no> References: <20050418151313.GP9417@fangora.autosys.us> <6.2.1.2.0.20050418215402.027c8538@mail.online.no> Message-ID: <16996.8463.451322.431357@antilipe.corelatus.se> Michael Fogeborg writes: > What is the smallest machine anyone here has run erlang on - and still > being useful ? The smallest machine I've actually seen running R10 and doing something non-trivial is a 50MHz MPC860-based embedded system with 32MB of DRAM. Many of those systems are [still] in live operation today. That's not particularly small, but I thought I'd start the bidding. I know it's possible to go smaller than that, especially if you use a smaller OS (e.g. VxWorks instead of linux), but it's not particularly pleasant. Matt From mickael.remond@REDACTED Tue Apr 19 01:01:56 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 19 Apr 2005 01:01:56 +0200 Subject: ejabberd 0.9 has been released Message-ID: <42643C64.5040300@erlang-fr.org> Hello, a new release of ejabberd 0.9 has been published. ejabberd is a clustered, scalable, robust and full featured XMPP server (developed in Erlang). This release contains several new major features, such as: - Virtual hosting, - Shared roster, - Experimental relational database support and includes many bugfixes, architectural changes for performances improvements. This release is now hosted on Process-one website (http://www.process-one.net/). The community site is at: http://ejabberd.jabber.ru/ ejabberd 0.9 can be downloaded from: http://www.process-one.net/en/projects/ejabberd/download.html For more information, you should have a look at the release note: http://www.process-one.net/en/projects/ejabberd/release.html Have fun, -- The ejabberd team From vances@REDACTED Tue Apr 19 07:44:24 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Apr 2005 01:44:24 -0400 Subject: Big state machines In-Reply-To: References: Message-ID: <20050419054424.GT4594@blank.motivity.ca> On Mon, Apr 18, 2005 at 10:03:59PM +0200, Ulf Wiger (AL/EAB) wrote: } } .... Sadly, with UML and SDL, the default behaviour is to throw } away messages that arrive in the wrong state, and have not been } marked deferrable in that state. This makes it difficult to } maintain large programs, unless the tool in question supports } another default (everything deferrable unless otherwise specified.) I think it has to be this way. You are always going to get late arrivals or other instances of messages you are not interested in. If it weren't for these semantics you'd need to account for every message the FSM handles in every state. You'd also run the constant risk of overflowing the mailbox. Saving is the exceptional condition done when you need to wait for a particular set of messages (e.g. ACK) before proceeding. On the other hand what I would like would require you to explicitly throw away unwanted messages. Ideally what I would like is just a gen_fsm which had the sematics that if an event handler didn't match the first event in the queue it kept trying until it had tried all messages and then kept trying for new messages. This way you would write normal states as: idle(offhook, StateData) -> ... {next_state, dialtone}; idle(Event, StateData) -> {next_state, idle}. When you want a state which saves signals you leave out the catchall clause. This may be no where near the pure erlang which you crave however it would make it easier for me to translate SDL into gen_fsm. Maybe this isn't what I really want and I'm just too used to thinking in gen_fsm. What I am doing is thinking in SDL though so the closer the semantic leap is the better. -Vance From techieyang@REDACTED Tue Apr 19 03:57:11 2005 From: techieyang@REDACTED (Techie Yang) Date: Tue, 19 Apr 2005 09:57:11 +0800 Subject: H/W requirements for OTP RB-2 Message-ID: <200504190157.j3J1vav65521@hades.cslab.ericsson.net> Recenetly, i tried the following configuration: 1) PPC860, 50MHZ, 32MSDRAM(32bits) 2) Vxworks 5.4 3) PPCLINUX with 2.4.19 kernel tree My observation: 1) R10B-4 could run on the PPC860, both vxworks and linux But it is a bit slow, 2) R7B is the fast one, with the small size of virtual machine Eventually, i select to use the R9C-2, which isn't too slow, and looks like it will match my requirement. I am going to start my project with the R9C-2 on PPCLINUX. I guess it might be possible to run the R7B on the 16M SDRM, if compiled with uClibc. Not try it yet. Best Regards Techie ======= 2005-04-19 03:55:39 ????????======= >After listening to http://www.sics.se/~adam/talks.html talking about small >TCP/IP stacks I start to wonder how small a machine erlang can run on.... >What is the smallest machine anyone here has run erlang on - and still >being useful ? > > >At 17:13 2005-04-18, you wrote: >>On Mon, Apr 18, 2005 at 11:27:07AM +0000, maruthavanan s wrote: >> > hi , >> > >> > Can any one suggest me the hardware requirements of erlang OTP R10 B-2 >> > >> > Thanks, >> > Marutha >>_________________________________________________________________ >>For what task? >> >>My workstation development machine is about 600 Mhz with 512MB memory. >> >>I run R10B-4 on a 400 Mhz Celeron (with 512 MB) as an automated web site >>checker for customers. Not much load doing this task. >> >>I am deploying it on a newer machine which will be a 3 GHz Xeon >>(32-bit core) with 1 GB memory. This new task will have a bit more >>work to do, keeping up a steady conversation with a couple different >>external servers and feeding an SQL database for a webserver to >>query. Even with this task, though, I think the hardware will >>be loafing. >> >>~Michael > > = = = = = = = = = = = = = = = = = = = = ????????? ?? ????????Techie Yang ????????techieyang@REDACTED ??????????2005-04-19 From ulf@REDACTED Tue Apr 19 06:54:18 2005 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 19 Apr 2005 06:54:18 +0200 Subject: Big state machines In-Reply-To: <20050419054424.GT4594@blank.motivity.ca> References: <20050419054424.GT4594@blank.motivity.ca> Message-ID: Den 2005-04-19 07:44:24 skrev Vance Shipley : > On Mon, Apr 18, 2005 at 10:03:59PM +0200, Ulf Wiger (AL/EAB) wrote: > } > } .... Sadly, with UML and SDL, the default behaviour is to throw > } away messages that arrive in the wrong state, and have not been > } marked deferrable in that state. This makes it difficult to > } maintain large programs, unless the tool in question supports > } another default (everything deferrable unless otherwise specified.) > > I think it has to be this way. You are always going to get late > arrivals or other instances of messages you are not interested in. > If it weren't for these semantics you'd need to account for every > message the FSM handles in every state. You'd also run the constant > risk of overflowing the mailbox. Saving is the exceptional condition > done when you need to wait for a particular set of messages (e.g. ACK) > before proceeding. I may read your message wrong, but the problem with the UML approach is that you cannot easily say, for a given state: "match these expected messages, but implicitly refer any other message". This is the semantics needed for all transient states, since a transient state may _never_ discard a message it doesn't recognize. In Erlang, you don't have to worry much about transient states, because they can be hidden behind a function call. The classic example is gen_server:call/3. It's not too surprising that UML specifies a special SynchronousCall method, because given the message passing semantics of UML, it's nearly impossible to model a generic SynchronousCall. But for all transient states that do not fit the SynchronousCall pattern, you're in deep trouble (granted -- I think most transient states _do_ fit the SynchronousCall pattern.) > On the other hand what I would like would require you to explicitly > throw away unwanted messages. Ideally what I would like is just a > gen_fsm which had the sematics that if an event handler didn't match > the first event in the queue it kept trying until it had tried all > messages and then kept trying for new messages. This way you would > write normal states as: > > idle(offhook, StateData) -> > ... > {next_state, dialtone}; > idle(Event, StateData) -> > {next_state, idle}. > > When you want a state which saves signals you leave out the catchall > clause. Then the dispatcher would have to trigger on function_clause as meaning "save this message". Would it not be better to have an explicit "defer" callback? This would essentially mimic the semantics of RoseRT - since there is no unsend() function in Erlang, the dispatcher would have to manage a 'defer' queue in memory. Unless you can make it transparent, there would also have to be a recall() function (a la RoseRT), and then you really have a mess on your hands. It would then be better for the dispatcher to keep a FIFO queue in memory, and always run all messages through it. unsend() would then be equivalent to undo() (that is, keep the old Queue variable around, and revert to it if necessary) -- but only as long as one hasn't pulled another message from the Erlang message queue (which is an irreversible action). /Uffe From joe.armstrong@REDACTED Tue Apr 19 10:17:30 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Tue, 19 Apr 2005 10:17:30 +0200 Subject: Socket statistics Message-ID: Good morning Gurus Are there any Erlang functions for obtaining socket statistics? I'd like something like: Stats = gen_tcp:statistics(Socket), Stats should then contain some "amazingly interesting" (sic) information. For example, total time of session number of packets sent/received, packet losses etc. /Joe From flaig@REDACTED Tue Apr 19 11:03:15 2005 From: flaig@REDACTED (flaig@REDACTED) Date: Tue, 19 Apr 2005 11:03:15 +0200 Subject: H/W requirements for OTP RB-2 Message-ID: <200504190903.j3J93F1c024189@ger5.wwwserver.net> For demonstration purposes, I installed it on a Pentium-I/200 MHz laptop, 64 MB RAM, running Linux 2.6. Compilation of the Erlang package was a pain (took about 3 h), but once it was up, it worked properly. No real workhouse stuff, of course. :-) -- R??diger Marcus -- Diese E-Mail wurde mit http://www.mail-inspector.de verschickt Mail Inspector ist ein kostenloser Service von http://www.is-fun.net Der Absender dieser E-Mail hatte die IP: 129.206.124.135 From klacke@REDACTED Tue Apr 19 11:07:28 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Tue, 19 Apr 2005 11:07:28 +0200 Subject: Socket statistics In-Reply-To: References: Message-ID: <20050419090728.GA868@hyber.org> On Tue, Apr 19, 2005 at 10:17:30AM +0200, Joe Armstrong (AL/EAB) wrote: > > Good morning Gurus > > Are there any Erlang functions for obtaining socket statistics? > > I'd like something like: > > Stats = gen_tcp:statistics(Socket), > (a@REDACTED)1> inet:i(). Port Module Recv Sent Owner Local Address Foreign Address State 6 inet_tcp 0 0 <0.19.0> *:32882 *:* LISTENING 8 inet_tcp 4 16 <0.17.0> localhost:32883 localhost:4369 CONNECTED 9 undefined 0 0 <0.20.0> *:* ACCEPTING Port Module Recv Sent Owner Local Address Foreign Address State ok /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From ulf.wiger@REDACTED Tue Apr 19 11:14:10 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 19 Apr 2005 11:14:10 +0200 Subject: Socket statistics Message-ID: On April 19 2005 10:18, Joe wrote: > > Good morning Gurus > > Are there any Erlang functions for obtaining socket statistics? > > I'd like something like: > > Stats = gen_tcp:statistics(Socket), > > Stats should then contain some "amazingly interesting" > (sic) information. > For example, total time of session number of packets > sent/received, packet losses etc. Can't find anything in the docs, but looking at the Source, I found this (below). Apparently, packet loss is not one of the things counted. /Uffe =:=:=:=:=:=:=:=:=:=:= -module(inet). -export([getstat/1, getstat/2]). getstat(Socket) -> prim_inet:getstat(Socket, stats()). getstat(Socket,What) -> prim_inet:getstat(Socket, What). =:=:=:=:=:=:=:=:=:=:= -module(prim_inet). -export([..., getstat/2, ...]). ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% GETSTAT(insock(), StatList) -> {ok,StatReply} | {error, Reason} %% %% get socket statistics (from driver) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% getstat(S, Stats) when port(S),list(Stats) -> case encode_stats(Stats) of {ok, Bytes} -> case ctl_cmd(S, ?INET_REQ_GETSTAT, Bytes) of {ok, Data} -> decode_stats(Data); Error -> Error end; Error -> Error end. ... encode_stats(L) -> case catch enc_stats(L) of List when list(List) -> {ok, List}; Error -> Error end. enc_stats([H|T]) -> case H of recv_cnt -> [?INET_STAT_RECV_CNT | enc_stats(T)]; recv_max -> [?INET_STAT_RECV_MAX | enc_stats(T)]; recv_avg -> [?INET_STAT_RECV_AVG | enc_stats(T)]; recv_dvi -> [?INET_STAT_RECV_DVI | enc_stats(T)]; send_cnt -> [?INET_STAT_SEND_CNT | enc_stats(T)]; send_max -> [?INET_STAT_SEND_MAX | enc_stats(T)]; send_avg -> [?INET_STAT_SEND_AVG | enc_stats(T)]; send_pend -> [?INET_STAT_SEND_PEND | enc_stats(T)]; send_oct -> [?INET_STAT_SEND_OCT | enc_stats(T)]; recv_oct -> [?INET_STAT_RECV_OCT | enc_stats(T)]; _ -> throw({error, einval}) end; enc_stats([]) -> []. decode_stats(Bytes) -> case catch dec_stats(Bytes) of List when list(List) -> {ok, List}; Error -> Error end. dec_stats([?INET_STAT_SEND_OCT,X7,X6,X5,X4,X3,X2,X1,X0 | R]) -> Val = ?u64(X7,X6,X5,X4,X3,X2,X1,X0), [{send_oct, Val} | dec_stats(R)]; dec_stats([?INET_STAT_RECV_OCT,X7,X6,X5,X4,X3,X2,X1,X0 | R]) -> Val = ?u64(X7,X6,X5,X4,X3,X2,X1,X0), [{recv_oct, Val} | dec_stats(R)]; dec_stats([X,X3,X2,X1,X0 | R]) -> Val = ?u32(X3,X2,X1,X0), case X of ?INET_STAT_RECV_CNT -> [{recv_cnt,Val} | dec_stats(R)]; ?INET_STAT_RECV_MAX -> [{recv_max,Val} | dec_stats(R)]; ?INET_STAT_RECV_AVG -> [{recv_avg,Val} | dec_stats(R)]; ?INET_STAT_RECV_DVI -> [{recv_dvi,Val} | dec_stats(R)]; ?INET_STAT_SEND_CNT -> [{send_cnt,Val} | dec_stats(R)]; ?INET_STAT_SEND_MAX -> [{send_max,Val} | dec_stats(R)]; ?INET_STAT_SEND_AVG -> [{send_avg,Val} | dec_stats(R)]; ?INET_STAT_SEND_PEND -> [{send_pend,Val} | dec_stats(R)]; _ -> throw({error, einval}) end; dec_stats([]) -> []. From vances@REDACTED Tue Apr 19 16:17:52 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Apr 2005 10:17:52 -0400 Subject: Big state machines In-Reply-To: References: <20050419054424.GT4594@blank.motivity.ca> Message-ID: <20050419141752.GU4594@blank.motivity.ca> On Tue, Apr 19, 2005 at 06:54:18AM +0200, Ulf Wiger wrote: } } I may read your message wrong, but the problem with the UML approach } is that you cannot easily say, for a given state: "match these } expected messages, but implicitly refer any other message". This } is the semantics needed for all transient states, since a transient } state may _never_ discard a message it doesn't recognize. I don't know UML, and maybe never will as you've told us it isn't very helpful in Erlang. :) In SDL an unspecified signal is implicitly handled by consuming it and transitioning back to the current state. My point was that this default behaviour is important to have. SDL graphical representation: ___ (_s_) | +--+--+ __|_ __|_ >_a_| >_b_| _|_ _|_ (_x_) (_y_) SDL textual representation: state s; input a; nextstate x; input b; nextstate y; endstate s; Plain erlang implementation: s(S) -> receive a -> x(S); b -> y(S); _ -> s(S) end. SDL does provide the 'save' construct which specifies that the referenced signal should be left in the input queue. For your transient state you would probably want to use the asterisk save: ___ (_s_) | +-----+------+ __|_ __|_ __|_ >_a_| >_b_| /_*_/ _|_ _|_ (_x_) (_y_) state s; input a; nextstate x; input b; nextstate y; save *; endstate s; s(S) -> receive a -> x(S); b -> y(S) end. You can also specify the signals you want to save and in the absence of an asterisk input other signals will be consumed: ___ (_s_) | +-----+------+-----+ __|_ __|_ __|_ __|_ >_a_| >_b_| /_c_/ /_d_/ _|_ _|_ (_x_) (_y_) state s; input a; nextstate x; input b; nextstate y; save c; save d; endstate s; s(S) -> receive a -> x(S); b -> y(S); X when X /= c, X /= d -> s(S) end. } In Erlang, you don't have to worry much about transient states, } because they can be hidden behind a function call. The classic I sometimes need to handle a save construct in the context of external signals (protocols) and gen_fsm doesn't provide the syntax, although erlang does. So the short answer I guess is that should I really need to do this I should implement my own system process and abandon gen_fsm. It's probably a better idea than the ugliness which results from further bastardizing Erlang in the pursuit of retaining gen_fsm semantics. -Vance From vances@REDACTED Tue Apr 19 16:23:53 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Apr 2005 10:23:53 -0400 Subject: H/W requirements for OTP RB-2 In-Reply-To: <200504190903.j3J93F1c024189@ger5.wwwserver.net> References: <200504190903.j3J93F1c024189@ger5.wwwserver.net> Message-ID: <20050419142352.GV4594@blank.motivity.ca> I used to run Pentium 90 32MB servers with a full R7B and our application. They worked flawlessly for us. Some are still running. -Vance From thomasl_erlang@REDACTED Tue Apr 19 11:23:59 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 19 Apr 2005 02:23:59 -0700 (PDT) Subject: H/W requirements for OTP RB-2 In-Reply-To: 6667 Message-ID: <20050419092359.36690.qmail@web41901.mail.yahoo.com> --- Michael Fogeborg wrote: > After listening to > http://www.sics.se/~adam/talks.html talking about > small > TCP/IP stacks I start to wonder how small a machine > erlang can run on.... > What is the smallest machine anyone here has run > erlang on - and still > being useful ? I got Erlang R8B2 to run on my PS2 (233 MHz MIPS, 32 MB memory). Not sure if it can be considered useful, though :-) http://www.erlang.org/ml-archive/erlang-questions/200211/msg00012.html Best, Thomas __________________________________ Do you Yahoo!? Plan great trips with Yahoo! Travel: Now over 17,000 guides! http://travel.yahoo.com/p-travelguide From thomasl_erlang@REDACTED Tue Apr 19 11:29:55 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 19 Apr 2005 02:29:55 -0700 (PDT) Subject: Big state machines In-Reply-To: Message-ID: <20050419092956.38181.qmail@web41901.mail.yahoo.com> --- "Ulf Wiger (AL/EAB)" wrote: > > I have another version, as a matter of fact, which > is much > closer to gen_fsm. It solves the dreaded complexity > explosion > problem, /.../ Interesting. Do you have any opinions on Harel's statecharts? (A precursor of UML, I believe, though I haven't studied UML very deeply.) Best, Thomas __________________________________ Do you Yahoo!? Plan great trips with Yahoo! Travel: Now over 17,000 guides! http://travel.yahoo.com/p-travelguide From bjorn@REDACTED Tue Apr 19 11:58:15 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 19 Apr 2005 11:58:15 +0200 Subject: question about intended function of filelib:wildcard/2 In-Reply-To: <425BD738.7040207@ericsson.com> References: <20050411203037.GA11811@hyber.org> <20050412134719.GA25307@hyber.org> <425BD738.7040207@ericsson.com> Message-ID: I have now written the missing test suite and corrected the bug. I have also corrected the minor bug that filelib:wildcard("/not/a/wildcard/pattern") would not check that "/not/a/wildcard/pattern" really existed; not it will check and return an empty list if the file does not exist. I have also changed the exception that is thrown when the pattern is invalid, such as in filelib:wildcard("{a,") It used to be exit(missing_delimiter); but is now erlang:error({badpattern,missing_delimiter}). The correction will be in included in OTP R10-5. /Bjorn Bengt Kleberg writes: > greetings, > > this is what the manual says: > > wildcard(Wildcard, Cwd) -> list() > > Types Wildcard = filename() | dirname() > Cwd = dirname() > > The wildcard/2 function works like wildcard/1, > except that > instead of the actual working dirctory, Cwd will be used. > > > i thought this would mean that the following 2 calls would give me the > same result: > > filelib:wildcard("/home/eleberg/*"). > filelib:wildcard("*", "/home/eleberg"). > > > on my system they return very different lists. > > could somebody please explain if they should be different, and how > wildcard/2 is supposed to be used. > > or, what i am doing wrong. > > > bengt > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From vances@REDACTED Tue Apr 19 17:51:57 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Apr 2005 11:51:57 -0400 Subject: Big state machines In-Reply-To: References: Message-ID: <20050419155157.GA4594@blank.motivity.ca> On Mon, Apr 18, 2005 at 10:03:59PM +0200, Ulf Wiger (AL/EAB) wrote: } } It's not a behaviour, but I believe that gen_fsm could } perhaps be extended to hold a "receive vector" that } modifies the normal FIFO semantics. Maybe it could. To get the functionality I'm looking for it would need to allow you to specify a list of events to receive and a list of events to save. Each of which could include an "any" construct (although obviously not both). I initially rejected this idea because it carries the danger that you will not keep the state handler function clauses in sync with the "receive vector". This may not be that big a problem though. -Vance From ulf.wiger@REDACTED Tue Apr 19 13:39:43 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 19 Apr 2005 13:39:43 +0200 Subject: Big state machines Message-ID: On 19 april 2005 16:18, Vance Shipley wrote: > I don't know UML, and maybe never will as you've told us > it isn't very helpful in Erlang. :) > > In SDL an unspecified signal is implicitly handled by > consuming it and transitioning back to the current state. > My point was that this default behaviour is important to have. SDL has a pretty clean representation of this, and since SDL has been merged into UML 2.0, the same behaviour should be possible to specify in UML 2.0. However, I've been unable to find it in the specification. This is not to say that it isn't there. In my experience, it can well take several months to find and understand some given aspect of UML. > I sometimes need to handle a save construct in the context of > external signals (protocols) and gen_fsm doesn't provide the > syntax, although erlang does. > > So the short answer I guess is that should I really need to do this > I should implement my own system process and abandon gen_fsm. It's > probably a better idea than the ugliness which results from further > bastardizing Erlang in the pursuit of retaining gen_fsm semantics. OK, not exactly what you requested, but here's a quick hack of gen_fsm that supports selective receive in the form of a receive vector (gen_fsm.erl and test.erl attached). Note: the ONLY things I've tested are the things in test.erl. Semantics: - in the init function, instead of returning {ok, NState, Data}, one can return {selective, NState, Vector, Data [, Timeout]} (not tested, but "obviously works" ;-) - As a return value from the callbacks, on can return {next_state_SEL, NStateName, Vector, ...} or {reply_SEL, Reply, NStateName, Vector, ...} as a complement to the old return values, which still work. Vector is a tuple, with the following significance: - For any event {Tag, Event}, where Tag is an integer, the message is consumed if element(Tag, Vector) == [] (by convention, set element(Tag, Vector) to 'false' otherwise) - For any event {Tag, Ref, Event}, where Tag is an integer, the message is consumed if element(Tag, Vector) == Ref. All other messages are left in the queue. The unfortunate stuff with integers instead of atoms is of course that it's difficult to deal with atoms within guards, if the module can't rely on record syntax (which it can't in this case, since the records are user-provided) We need dynamic structs! If a timer is set with gen_fsm:start_timer/2, it can be handled within the selective receive if the vector has the following form: [TimerRef, Vector], where TimerRef is the Ref returned by gen_fsm:start_timer/2, and Vector is a tuple as described above. Timeouts given by the return value from the callback are always handled. I have no plans to support this (as perhaps evident by the fact that I didn't rename it), but if people find it useful, you can put pressure on OTP to consider it. ;-) /Uffe -------------- next part -------------- A non-text attachment was scrubbed... Name: test.erl Type: application/octet-stream Size: 1515 bytes Desc: test.erl URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: gen_fsm.erl Type: application/octet-stream Size: 24282 bytes Desc: gen_fsm.erl URL: From ulf.wiger@REDACTED Tue Apr 19 13:48:44 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 19 Apr 2005 13:48:44 +0200 Subject: Big state machines Message-ID: > -----Original Message----- > From: Vance Shipley [mailto:vances@REDACTED] > Sent: den 19 april 2005 17:52 > To: Ulf Wiger (AL/EAB) > Cc: erlang-questions@REDACTED > Subject: Re: Big state machines > > > On Mon, Apr 18, 2005 at 10:03:59PM +0200, Ulf Wiger (AL/EAB) wrote: > } > } It's not a behaviour, but I believe that gen_fsm could > } perhaps be extended to hold a "receive vector" that > } modifies the normal FIFO semantics. > > Maybe it could. To get the functionality I'm looking for it would > need to allow you to specify a list of events to receive and a list > of events to save. Each of which could include an "any" construct > (although obviously not both). See a hacked gen_fsm that I just posted. The list of events to save, in that case would be all events not specified in the vector. All events are saved if not actively received while in the selective mode, but this is determined by the callback's return value. If no filter vector is given by the return value, the normal gen_fsm semantics apply. The idea behind this was that for "top-level" states, FIFO semantics is perfectly fine. Thus, you provide a filter vector for the few states that will otherwise ruin your entire state machine design. > I initially rejected this idea because it carries the danger that > you will not keep the state handler function clauses in sync with > the "receive vector". This may not be that big a problem though. In the test program I wrote, I explicitly handled tuples and integers to identify messages. One would much prefer to use a record. In my POTS example, I used the following record and macro definitions: -record(recv, {lim = [], % replies, digit, onhook, offhook,... anal = [], % analysis_reply half_call = [] % request_connection, connect }). -define(lim, #recv.lim). -define(anal, #recv.anal). -define(hc, #recv.half_call). Macros to tag messages being sent. The record to use as a receive vector (e.g. #recv{lim = Ref, _ = false}, meaning "handle a message tagged as ?lim where the second element is Ref -- buffer everything else.) It isn't stunningly beautiful, but I've failed sofar to come up with anything better. /Uffe From joelr1@REDACTED Tue Apr 19 14:02:16 2005 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 19 Apr 2005 15:02:16 +0300 Subject: An ode to Erlang Message-ID: <20050419130216.757@smtp.gmail.com> Here it is in all its glory: http://wagerlabs.com/2005/04/how-to-compete-with-big-boys.html Cheers, Joel -- http://wagerlabs.com/tech From vances@REDACTED Tue Apr 19 19:41:49 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 19 Apr 2005 13:41:49 -0400 Subject: Big state machines In-Reply-To: References: Message-ID: <20050419174148.GD4594@blank.motivity.ca> On Tue, Apr 19, 2005 at 01:39:43PM +0200, Ulf Wiger (AL/EAB) wrote: } } OK, not exactly what you requested, but here's a quick hack of } gen_fsm that supports selective receive in the form of a receive } vector (gen_fsm.erl and test.erl attached). Nice. I was also working on hacking gen_fsm to handle a receive vector. I started by building a test module the way I would want to. The module below is what I had in mind. I extended the return from init/1 and the state handler callbacks to include two extra values; Receive & Save. e.g. {next_state, State, StateData, Timeout, Receive, Save} Receive = any | tuple() Save = none | any | tuple() So far I was only supporting atom() events and used the is_element() method of your previous contribution. I changed the main loop in gen_fsm to handle the extra arguments and made the default values any and none. One difference is that you can now have gen_fsm consume messages you are not interested in instead of doing it explicitly in the state handler callback. -module(sdl_fsm). -export([init/1, s/2]). -behaviour(gen_fsm). init(_) -> {ok, s, [], 0, {a,b}, none}; %% ___ %% (_s_) %% | %% +--+--+ %% __|_ __|_ %% >_a_| >_b_| %% _|_ _|_ %% (_x_) (_y_) %% s(a, S) -> {next_state, x, [], 0, {a,b}, any}; s(b, S) -> {next_state, y, [], 0, {a,b}, {c,d}}. %% ___ %% (_x_) %% | %% +-----+------+ %% __|_ __|_ __|_ %% >_a_| >_b_| /_*_/ %% _|_ _|_ %% (_x_) (_y_) %% x(a, S) -> {next_state, x, [], 0, {a,b}, any}; x(b, S) -> {next_state, y, [], 0, {a,b}, {c,d}}. %% ___ %% (_y_) %% | %% +-----+------+-----+ %% __|_ __|_ __|_ __|_ %% >_a_| >_b_| /_c_/ /_d_/ %% _|_ _|_ %% (_x_) (_y_) %% y(a, S) -> {next_state, x, [], 0, {a,b}, any}; y(b, S) -> {next_state, y, [], 0, {a,b}, {c,d}}. I hadn't yet contemplated how to handle real life events. I had been thinking that ultimately what would be required some sort of match spec format for the vectors and whatever (parse transforms?) else in gen_fsm to handle it. Your approach to mandate the events take some certain form may well be a perfectly reasonable way to go. -Vance From olivier.sambourg@REDACTED Tue Apr 19 16:08:29 2005 From: olivier.sambourg@REDACTED (Olivier Sambourg) Date: Tue, 19 Apr 2005 16:08:29 +0200 Subject: Image manipulation in erlang Message-ID: Hi everyone I'm looking for an erlang library which will give me access to the color of a pixel (X/Y given) in a PNG image. The idea is to have a process (gen_server behaviour) keeping the image in memory and answering pixel information requests by other processes. I found a wrapper for the GD library in the erlang driver toolkit projet but I'd like to know if there are better/faster tools for my purpose (I have no idea about the performance of the GD wrapper for instance, benchmarks anyone ?) Thank you :) -- Olivier From thomasl_erlang@REDACTED Tue Apr 19 17:40:47 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 19 Apr 2005 08:40:47 -0700 (PDT) Subject: An ode to Erlang In-Reply-To: 6667 Message-ID: <20050419154047.14812.qmail@web41906.mail.yahoo.com> --- Joel Reymont wrote: > Here it is in all its glory: > > http://wagerlabs.com/2005/04/how-to-compete-with-big-boys.html > Nice. I suspect you will _also_ find that a single server has a quite satisfying capacity all by itself. Best, Thomas __________________________________ Do you Yahoo!? Plan great trips with Yahoo! Travel: Now over 17,000 guides! http://travel.yahoo.com/p-travelguide From martin.ankerl@REDACTED Tue Apr 19 18:46:35 2005 From: martin.ankerl@REDACTED (Martin Ankerl) Date: Tue, 19 Apr 2005 18:46:35 +0200 Subject: how to design large erlang systems Message-ID: Hi! A few days ago I have started to look at Erlang, and so far I really like it. Having mostly OOP background, I am very curious how large software systems are designed in Erlang. I mean, I can design large object oriented systems with class hierarchies, namespaces, packages etc; while in erlang each file is one module (in case I did not miss something). Are there any documents for design patterns or best-practices for how to write large Erlang applications? I would also be very interested in some kind of "Erlang for Java /C#/Ruby/Python developers" document :-) -- Martin Ankerl | http://martinus.geekisp.com/ From csanto@REDACTED Tue Apr 19 19:49:37 2005 From: csanto@REDACTED (Corrado Santoro) Date: Tue, 19 Apr 2005 19:49:37 +0200 Subject: how to design large erlang systems In-Reply-To: References: Message-ID: <426544B1.2040509@diit.unict.it> Martin Ankerl wrote: > Hi! A few days ago I have started to look at Erlang, and so far I > really like it. Having mostly OOP background, I am very curious how > large software systems are designed in Erlang. I mean, I can design > large object oriented systems with class hierarchies, namespaces, > packages etc; while in erlang each file is one module (in case I did > not miss something). > Are there any documents for design patterns or best-practices for how > to write large Erlang applications? My two cents... I think that development techniques, in Erlang, differ substantially from those of other OO languages such as C++ or Java. First of all, in C++ or Java, you must encode everything you need inside a class (and this concept is more stresses in Java). This forces you to have many files, even if they are not really needed. In the same way, when you have to solve a problem using a design pattern, you need many classes. In Erlang instead you focus on functionalities, rather than on the structure of your class/objects/etc. So, in this case, you will encode your pattern inside a single module exporting the proper functions to use those functionalities. This prevents namespace pollution. Indeed, writing "good" programs in Erlang coming from an OO language is not trivial (for my experience), because one tends to use the same idioms of Java or C++. IMHO, this is not a good approach: looking at the way in which library modules are structured and encoded, as well as the possibility offered by OTP and behaviours, is instead fruitfull. > I would also be very interested in some kind of "Erlang for Java > /C#/Ruby/Python developers" document :-) I suggest instead the PhD thesis of Joe Armstrong, which explains the basics of software engineering with Erlang, i.e. the concurrency-based approach. However I forgot the URL of this document, could anyone provide it? Ciao, --Corrado -- ====================================================== Eng. Corrado Santoro, Ph.D. University of Catania - Engineering Faculty Department of Computer Science and Telecommunications Engineering Viale A. Doria, 6 - 95125 CATANIA (ITALY) Tel: +39 095 7382144 Int. (5) 8035 +39 095 7382380 +39 095 7382365 +39 095 7382364 VoIP: sip:8035@REDACTED Fax: +39 095 7382397 EMail: csanto@REDACTED Personal Home Page: http://www.diit.unict.it/users/csanto NUXI Home Page: http://nuxi.iit.unict.it ====================================================== From hp@REDACTED Tue Apr 19 20:08:27 2005 From: hp@REDACTED (HP Wei) Date: Tue, 19 Apr 2005 14:08:27 -0400 (EDT) Subject: how to design large erlang systems Message-ID: <200504191808.j3JI8RWX020936@ram.rentec.com> http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf >> I would also be very interested in some kind of "Erlang for Java >> /C#/Ruby/Python developers" document :-) >I suggest instead the PhD thesis of Joe Armstrong, which explains the >basics of software engineering with Erlang, i.e. the concurrency-based >approach. However I forgot the URL of this document, could anyone >provide it? > >Ciao, >--Corrado > From jabba@REDACTED Tue Apr 19 20:20:53 2005 From: jabba@REDACTED (Jani Launonen) Date: Tue, 19 Apr 2005 21:20:53 +0300 (EEST) Subject: how to design large erlang systems In-Reply-To: <426544B1.2040509@diit.unict.it> References: <426544B1.2040509@diit.unict.it> Message-ID: On Tue, 19 Apr 2005, Corrado Santoro wrote: > Martin Ankerl wrote: [cut a lot] >> I would also be very interested in some kind of "Erlang for Java >> /C#/Ruby/Python developers" document :-) > I suggest instead the PhD thesis of Joe Armstrong, which explains the basics > of software engineering with Erlang, i.e. the concurrency-based approach. > However I forgot the URL of this document, could anyone provide it? Here you are: http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf Take and enjoy! > Ciao, > --Corrado > > -- > ====================================================== > Eng. Corrado Santoro, Ph.D. > > University of Catania - Engineering Faculty > Department of Computer Science and > Telecommunications Engineering > Viale A. Doria, 6 - 95125 CATANIA (ITALY) > > Tel: +39 095 7382144 Int. (5) 8035 > +39 095 7382380 > +39 095 7382365 > +39 095 7382364 > > VoIP: sip:8035@REDACTED > > Fax: +39 095 7382397 > > EMail: csanto@REDACTED > Personal Home Page: > http://www.diit.unict.it/users/csanto > > NUXI Home Page: > http://nuxi.iit.unict.it > ====================================================== > -+-+-+- Jani Launonen From simonpeterchappell@REDACTED Tue Apr 19 21:30:05 2005 From: simonpeterchappell@REDACTED (Simon Chappell) Date: Tue, 19 Apr 2005 14:30:05 -0500 Subject: An ode to Erlang In-Reply-To: <20050419154047.14812.qmail@web41906.mail.yahoo.com> References: <20050419154047.14812.qmail@web41906.mail.yahoo.com> Message-ID: <8ed7339005041912301d539e2f@mail.gmail.com> On 4/19/05, Thomas Lindgren wrote: > > --- Joel Reymont wrote: > > Here it is in all its glory: > > > > > http://wagerlabs.com/2005/04/how-to-compete-with-big-boys.html > > > > Nice. I suspect you will _also_ find that a single > server has a quite satisfying capacity all by itself. True, but as Joe likes to point out, without multiple servers, there is no redundancy. :-) Simon From anders.nygren@REDACTED Tue Apr 19 23:31:44 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 19 Apr 2005 16:31:44 -0500 Subject: erl -config file on windows Message-ID: Hi I am trying to wrap up a project that has to be installed on windows and have a problem with getting erlang to read my *.config file. I try to start it with erl -boot mybootfile -sname name -config myconfigfile But no matter how I specify myconfigfile, - absolute or relative path, - with or without .config extension - "/" or "\" as separator - no quotes, single qutes or double quotes I always get a crash saying "file not found". starting erl without -config and doing file:consult(PATHTOFILE) works so I have the correct path and the file contains a correct erlang term. So, how do I get it to read my configfile????? /Anders From ulf@REDACTED Wed Apr 20 00:35:43 2005 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 20 Apr 2005 00:35:43 +0200 Subject: how to design large erlang systems In-Reply-To: References: Message-ID: Den 2005-04-19 18:46:35 skrev Martin Ankerl : > Hi! A few days ago I have started to look at Erlang, and so far I > really like it. Having mostly OOP background, I am very curious how > large software systems are designed in Erlang. I mean, I can design > large object oriented systems with class hierarchies, namespaces, > packages etc; while in erlang each file is one module (in case I did > not miss something). > Are there any documents for design patterns or best-practices for how > to write large Erlang applications? > I would also be very interested in some kind of "Erlang for Java > /C#/Ruby/Python developers" document :-) Some papers from the AXD 301 experience can be of some use: "Four-fold Increase in Productivity and Quality" Ulf Wiger, FemSYS 2001, Munich http://www.erlang.se/publications/Ulf_Wiger.pdf "World Class Product Certification Using Erlang" U. Wiger, G. Ask, K. Boortz, SIGPLAN Erlang Workshop, Pittsburgh, 2002 http://www.erlang.se/workshop/2002/Wiger.pdf "Trouble Shooting a Large Erlang System" Mats Cronqvist, SIGPLAN Erlang Workshop, Snowbird 2004 http://www.erlang.se/workshop/2004/cronqvist.pdf Here and there in the above documents, suggestions are offered as to why Erlang works well for large system design: - The language is easy to learn - Very expressive syntax gives short readable programs - Very powerful debugging support I think one of the most important factors is that Erlang helps in building systems of loosely coupled components, where the number of unwanted dependencies is kept to a minimum. Several aspects contribute to this, but perhaps the CSP-style concurrency support is the most important contributor. Hoare's book on Communicating Sequential Processes can be downloaded for free here: http://www.usingcsp.com/cspbook.pdf Of great interest is for example his discussion on concurrency on page 209: "In its full generality, multithreading is an incredibly complex and errorprone technique, not to be recommended in any but the smallest programs. In excuse, we may plead that it was invented before the days of structured programming, when even FORTRAN was still considered to be a high-level programming language! A variation of the fork command is still used in the UNIX(tm) operating system. The fork does not mention a label. Its effect is to take a completely fresh copy of the whole of storage allocated to the program, and to allocate the copy to a new process. Both the original and the new process resume execution at the command following the fork. A facility is provided for each process to discover whether it is the parent or the offspring. The allocation of disjoint storage areas to the processes removes the main difficulties and dangers of multithreading, but it can be inefficient both in time and in space. This means that concurrency can be afforded only at the outermost (most global) level of a job, and its use on a small scale is discouraged." One may object that with Erlang, concurrency of the sort Hoare describes is no longer so inefficient that its use on a small scale must be discouraged. /Uffe From roger.larsson@REDACTED Wed Apr 20 01:13:41 2005 From: roger.larsson@REDACTED (Roger Larsson) Date: Wed, 20 Apr 2005 01:13:41 +0200 Subject: Cryptographically strong random - /dev/urandom ? In-Reply-To: <20050418165718.GA20751@hyber.org> References: <20050418165718.GA20751@hyber.org> Message-ID: <200504200113.41612.roger.larsson@norran.net> On Monday 18 April 2005 18.57, klacke@REDACTED wrote: > On Mon, Apr 18, 2005 at 12:58:50PM +0300, joel reymont wrote: > > Folks, > > > > I understand that SSL in Erlang is based on OpenSSL. That library also > > comes with a cryptographically strong random implementation but that > > bit is not included in Erlang SSL. > > > > Is there a cryptographically strong implementation for Erlang? > > We do: > > > random_ascii_str(Length) -> > random_ascii_str(Length, os:cmd("dd if=/dev/urandom count=1"), [], 0). from "man urandom" When read, /dev/urandom device will return as many bytes as are requested. As a result, if there is not sufficient entropy in the entropy pool, the returned values are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver. Knowledge of how to do this is not available in the current non-classified liter? ature, but it is theoretically possible that such an attack may exist. If this is a concern in your application, use /dev/random instead. /RogerL From roger.larsson@REDACTED Wed Apr 20 01:25:36 2005 From: roger.larsson@REDACTED (Roger Larsson) Date: Wed, 20 Apr 2005 01:25:36 +0200 Subject: Image manipulation in erlang In-Reply-To: References: Message-ID: <200504200125.37029.roger.larsson@norran.net> On Tuesday 19 April 2005 16.08, Olivier Sambourg wrote: > Hi everyone > > I'm looking for an erlang library which will give me access to the > color of a pixel (X/Y given) in a PNG image. The idea is to have a > process (gen_server behaviour) keeping the image in memory and > answering pixel information requests by other processes. > I found a wrapper for the GD library in the erlang driver toolkit > projet but I'd like to know if there are better/faster tools for my > purpose (I have no idea about the performance of the GD wrapper for > instance, benchmarks anyone ?) > This might be a nice way if all you want to do is check a single pixel value now and then. Images quickly grows big needing lots of messages. If you on the other hand want to do something with more image data create "map" and "reduce" and send the wanted process function to the image and get the result sent back. Note: image processing has REAL corner cases :-) /RogerL From martin.ankerl@REDACTED Wed Apr 20 09:02:37 2005 From: martin.ankerl@REDACTED (Martin Ankerl) Date: Wed, 20 Apr 2005 09:02:37 +0200 Subject: how to design large erlang systems In-Reply-To: References: Message-ID: Thanks for all the suggestions -- Martin Ankerl | http://martinus.geekisp.com/ From joe.armstrong@REDACTED Wed Apr 20 09:10:05 2005 From: joe.armstrong@REDACTED (Joe Armstrong (AL/EAB)) Date: Wed, 20 Apr 2005 09:10:05 +0200 Subject: how to design large erlang systems Message-ID: Quick answer: OO design is all about identifying the objects CO design is all about identifying the concurrency To write an Erlang program you must identify the concurrency in your problem. If this is a program that interacts or models the real-world then identifying the concurrency is easy - just look - use your eyes. If you're writing a poker game with four players use four processes - If your are writing an IRC program connected to 5 servers and 25 groups use 5 server processes and 25 group processes etc. Make the number of processes in your pgram map 1:1 with the concurrent structure in your problem. Longer answer: This is how I (In theory) go about things: 0) Restudy Identify the most difficult problems that are unsolved - these are the "show stoppers" - write small prototypes to solve *all* such problems - if your have solved all such problems proceed otherwise give up 1) Identify the concurrency structure of the problem Identify the processes you need and name all the processes. (If you don't name things you would be able to talk about them) Identify the message channels between the processes. Sketch the APIs that will create the processes and encapsulate the operation performed between processes. Often the design will break down into well-understood programming patterns Client-server Logger Supervision tree etc. Use these patterns wherever possible 2) Identify the failure paths at a process level You need to think like this: "If process A dies then B will receive a error message and do the error recovery for A" - so identify which processes might die, and who is to do the error recovery if they do die. 3) Write down the APIs Implement the design. Use one module per process class. I use the "flotilla" naming principle. A "main" module called xyz and a load of sub-modules with names like xyz_do_this xyz_do_that Cross process calls should always be made to main modules and not sub modules. ie functions in xyx_abc can call any functions in xyz sub-modules (like xyz_foo) but only functions in pqr and not sub-modules to pqr. Incidentally most problems only need a smallish number of process types so the name-space pollution problem is not that bad. 4) Implement the stuff process at a time testing as you go. If your design involves the use of client-server etc. Use the OTP behaviours. Write a clearly and as cleanly as possible - DO NOT OPTIMISE YOUR CODE Start with the global registered processes they are easiest to debug. Mail this list to see if anybody has already implemented what you want. Keep the parts as isolated as possible so that errors in incorrect code cannot propagate to correct code. 5) Integrate/test/measure Test the system - use invariants as much as possible. In most cases your system will be efficient enough - if not measure and find out where the inefficiency is - look in two particular areas; I/O input especially where you have to parse the inputs and bad concurrency structures (two few or two many processes) In practise I do bits of 0..5 simultaneously :-) The other thing is write clear specifications as you go - as you develop the program you will get sudden flashes of insight "ah ha - That's what it should do" - if you are on the right track carry on. If not throw away ALL your code and start again. Oh and listen to your subconscious - if you get the " this is not right but I don't know why " feeling - stop - conversely if you get the " I know this is right " feeling don't stop, just turn off your brain and type the code in. There is a mis-conception - the best programs "write themselves" so they need no design they have always been and they will always be - you just have to see them and write them down. At first you grope blindly and then you see them. (This is the Platonic view of programming - that programs have a priori existence, we don't invent them, they have always been, we perceive them and write them down :-) /Joe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Martin Ankerl > Sent: den 19 april 2005 18:47 > To: Erlang Users' List > Subject: how to design large erlang systems > > > Hi! A few days ago I have started to look at Erlang, and so far I > really like it. Having mostly OOP background, I am very curious how > large software systems are designed in Erlang. I mean, I can design > large object oriented systems with class hierarchies, namespaces, > packages etc; while in erlang each file is one module (in case I did > not miss something). > Are there any documents for design patterns or best-practices for how > to write large Erlang applications? > I would also be very interested in some kind of "Erlang for Java > /C#/Ruby/Python developers" document :-) > > -- > Martin Ankerl | http://martinus.geekisp.com/ > From raimo@REDACTED Wed Apr 20 09:12:13 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 20 Apr 2005 09:12:13 +0200 Subject: H/W requirements for OTP RB-2 References: <20050418151313.GP9417@fangora.autosys.us>, <6.2.1.2.0.20050418215402.027c8538@mail.online.no>, <16996.8463.451322.431357@antilipe.corelatus.se> Message-ID: I think that was really small; I will not top (bottom) that bid, but: we have a PPC750 board with 128 MByte RAM and no swap. It runs out of memory during some of our heavier regression tests of e.g orber. Otherwise it works like a charm. matthias@REDACTED (Matthias Lang) writes: > Michael Fogeborg writes: > > > What is the smallest machine anyone here has run erlang on - and still > > being useful ? > > The smallest machine I've actually seen running R10 and doing > something non-trivial is a 50MHz MPC860-based embedded system with > 32MB of DRAM. Many of those systems are [still] in live operation > today. That's not particularly small, but I thought I'd start the > bidding. > > I know it's possible to go smaller than that, especially if you use a > smaller OS (e.g. VxWorks instead of linux), but it's not particularly > pleasant. > > Matt -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Wed Apr 20 10:11:25 2005 From: erlang@REDACTED (PeterL) Date: Wed, 20 Apr 2005 10:11:25 +0200 Subject: An ode to Erlang In-Reply-To: <8ed7339005041912301d539e2f@mail.gmail.com> References: <20050419154047.14812.qmail@web41906.mail.yahoo.com> <8ed7339005041912301d539e2f@mail.gmail.com> Message-ID: <42660EAD.3020206@lundata.se> But the OS you run Erlang on, may have some problems with the total number of file descriptors (one per TCP-connection). How many file descriptors is it possble to have on a standard Linux/FreeBSD machine with 512 MB RAM? Simon Chappell wrote: >On 4/19/05, Thomas Lindgren wrote: > > >>http://wagerlabs.com/2005/04/how-to-compete-with-big-boys.html >> >> >>Nice. I suspect you will _also_ find that a single >>server has a quite satisfying capacity all by itself. >> >> > >True, but as Joe likes to point out, without multiple servers, there >is no redundancy. :-) > >Simon > > From thantos@REDACTED Wed Apr 20 10:35:57 2005 From: thantos@REDACTED (Alexander Williams) Date: Wed, 20 Apr 2005 04:35:57 -0400 Subject: MySQL Interface Message-ID: <504504274.20050420043557@speedfactory.net> Evening, folk: I'm trying to put a Yaws front-end on a number of interfaces to the underlying MySQL database within my SAM3 music broadcast system. The Yaws part of the beast is actually no problem at all, truth be told ... its tying to that pesky MySQL back-end that's the bugger right now. I've been using the MySQL interface listed on the Erlang projects page (by Magnus Ahltorp), but it seems to get a bit confused when multiple requests get issued to the database in a short time, and the initialization of the database channel itself is kind of ... awkward. Undoubtedly, folks are doing more MySQL than I've been, so I thought I'd ask here. Sensible, really. Many thanks in advance. -- Alexander Williams (thantos@REDACTED) The Squid's Redoubt: http//chancel.org:8000/Redoubt Currently Playing: Audra and the Antidote - Strange & Beautiful Album: Hello? From bjarne@REDACTED Wed Apr 20 10:51:39 2005 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Wed, 20 Apr 2005 10:51:39 +0200 Subject: Big state machines References: <20050419054424.GT4594@blank.motivity.ca> <20050419141752.GU4594@blank.motivity.ca> Message-ID: <001b01c54586$2c5613a0$512369d4@segeltorp> I believe that SDL was originally defined to describe hardware units similar to a coffee machine. A typical input would be a button pressed. It has either immediate effect or if it comes in a state where it is irrelevant it will be ignored. Bjarne ----- Original Message ----- From: "Vance Shipley" To: "Ulf Wiger" Cc: Sent: Tuesday, April 19, 2005 4:17 PM Subject: Re: Big state machines > On Tue, Apr 19, 2005 at 06:54:18AM +0200, Ulf Wiger wrote: > } > } I may read your message wrong, but the problem with the UML approach > } is that you cannot easily say, for a given state: "match these > } expected messages, but implicitly refer any other message". This > } is the semantics needed for all transient states, since a transient > } state may _never_ discard a message it doesn't recognize. > > I don't know UML, and maybe never will as you've told us it isn't > very helpful in Erlang. :) > > In SDL an unspecified signal is implicitly handled by consuming it > and transitioning back to the current state. My point was that this > default behaviour is important to have. > > - - - - From bry@REDACTED Wed Apr 20 11:46:17 2005 From: bry@REDACTED (bry@REDACTED) Date: Wed, 20 Apr 2005 11:46:17 +0200 Subject: LAM/MPI Erlang? Message-ID: <1113990377.426624e947827@horde.scannet.dk> Hey, I was just wondering if anyone had done anything to make Erlang communicate with applications that have a LAM/MPI messaging interface? From casper2000a@REDACTED Wed Apr 20 11:48:36 2005 From: casper2000a@REDACTED (Casper) Date: Wed, 20 Apr 2005 15:48:36 +0600 Subject: Erlang + SS7 Over IP Message-ID: Hi, If I need to write a packet sniffer to monitor SS7 packets over IP, what're the already available Erlang tools that I can use and from where I can start? Are there any already available TCP/IP packet sniffers written in Erlang? Thanks! - Eranga From thomasl_erlang@REDACTED Wed Apr 20 11:52:20 2005 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 20 Apr 2005 02:52:20 -0700 (PDT) Subject: An ode to Erlang In-Reply-To: 6667 Message-ID: <20050420095221.80681.qmail@web41904.mail.yahoo.com> --- PeterL wrote: > But the OS you run Erlang on, may have some problems > with the total number > of file descriptors (one per TCP-connection). How > many file descriptors > is it > possble to have on a standard Linux/FreeBSD machine > with 512 MB RAM? >From what it sounded like, the performance of the Erlang code per se likely won't be a problem. In essence, I don't think Joel will be making a lot of sacrifices by using Erlang in this case. OS or hardware limitations could be the bottleneck, sure, but is that an Erlang problem? I expect an ordinary C program would face the same capacity problems. (And, as Simon points out elsewhere, resiliency is another issue.) Best, Thomas __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ulf.wiger@REDACTED Wed Apr 20 12:34:06 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 20 Apr 2005 12:34:06 +0200 Subject: how to design large erlang systems Message-ID: On 20 April 2005 09:10, Joe Armstrong wrote: > (This is the Platonic view of programming - that > programs have a priori existence, we don't invent them, > they have always been, we perceive them and write them > down :-) Bad news for the software patent industry -- in essence, you can only hope to get a patent on bad software designs, since all good programs (at least) fall under Prior Art. From tobbe@REDACTED Wed Apr 20 12:44:15 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Wed, 20 Apr 2005 12:44:15 +0200 Subject: Erlang + SS7 Over IP In-Reply-To: References: Message-ID: <4266327F.40608@nortel.com> Casper wrote: > Hi, > > If I need to write a packet sniffer to monitor SS7 packets over IP, what're > the already available Erlang tools that I can use and from where I can > start? Are there any already available TCP/IP packet sniffers written in > Erlang? Well, you could have a look at 'etcp': http://www.bluetail.com/tobbe/etcp/ The code is old and somewhat awkward, but may be a starting point perhaps. Cheers, Tobbe From luke@REDACTED Wed Apr 20 12:33:36 2005 From: luke@REDACTED (Luke Gorrie) Date: 20 Apr 2005 12:33:36 +0200 Subject: Cryptographically strong random - /dev/urandom ? References: <20050418165718.GA20751@hyber.org> <200504200113.41612.roger.larsson@norran.net> Message-ID: Roger Larsson writes: > On Monday 18 April 2005 18.57, klacke@REDACTED wrote: > > On Mon, Apr 18, 2005 at 12:58:50PM +0300, joel reymont wrote: > > > Folks, > > > > > > I understand that SSL in Erlang is based on OpenSSL. That library also > > > comes with a cryptographically strong random implementation but that > > > bit is not included in Erlang SSL. > > > > > > Is there a cryptographically strong implementation for Erlang? > > > > We do: > > > > > > random_ascii_str(Length) -> > > random_ascii_str(Length, os:cmd("dd if=/dev/urandom count=1"), [], 0). > > from "man urandom" > When read, /dev/urandom device will return as many bytes as are > requested. As a result, if there is not sufficient entropy in the > entropy pool, the returned values are theoretically vulnerable to a > cryptographic attack on the algorithms used by the driver. Knowledge > of how to do this is not available in the current non-classified liter? > ature, but it is theoretically possible that such an attack may exist. > If this is a concern in your application, use /dev/random instead. The boring thing with /dev/random is that it can block until you wiggle the mouse :-) -Luke (not somebody to take any cryptography advice from) From bengt.kleberg@REDACTED Wed Apr 20 12:38:45 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 20 Apr 2005 12:38:45 +0200 Subject: how to design large erlang systems In-Reply-To: References: Message-ID: <42663135.9070402@ericsson.com> Ulf Wiger (AL/EAB) wrote: ...deleted > Bad news for the software patent industry -- in essence, > you can only hope to get a patent on bad software designs, > since all good programs (at least) fall under Prior Art. only patented software count as prior art. otherwise it would have been impossible to patent software implementations of existing patented inventions. bengt From casper2000a@REDACTED Wed Apr 20 13:14:30 2005 From: casper2000a@REDACTED (Casper) Date: Wed, 20 Apr 2005 17:14:30 +0600 Subject: Erlang + SS7 Over IP In-Reply-To: <4266327F.40608@nortel.com> Message-ID: Hi, Thanks for the info. Will there be any support from Megaco? - Eranga -----Original Message----- From: Torbjorn Tornkvist [mailto:tobbe@REDACTED] Sent: Wednesday, April 20, 2005 4:44 PM To: Casper Cc: erlang-questions@REDACTED Subject: Re: Erlang + SS7 Over IP Casper wrote: > Hi, > > If I need to write a packet sniffer to monitor SS7 packets over IP, what're > the already available Erlang tools that I can use and from where I can > start? Are there any already available TCP/IP packet sniffers written in > Erlang? Well, you could have a look at 'etcp': http://www.bluetail.com/tobbe/etcp/ The code is old and somewhat awkward, but may be a starting point perhaps. Cheers, Tobbe From klacke@REDACTED Wed Apr 20 14:27:18 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Wed, 20 Apr 2005 14:27:18 +0200 Subject: MySQL Interface In-Reply-To: <504504274.20050420043557@speedfactory.net> References: <504504274.20050420043557@speedfactory.net> Message-ID: <20050420122718.GA15899@hyber.org> On Wed, Apr 20, 2005 at 04:35:57AM -0400, Alexander Williams wrote: > > I've been using the MySQL interface listed on the Erlang projects > page (by Magnus Ahltorp), but it seems to get a bit confused when Tobbe did some mysql work for trapexit.org as well. I think we're lacking a good documented native interface to mysql as it is now. Should be done and checked into jungerl. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From casper2000a@REDACTED Wed Apr 20 14:41:24 2005 From: casper2000a@REDACTED (Casper) Date: Wed, 20 Apr 2005 18:41:24 +0600 Subject: TCAP Component Argument or Result type? In-Reply-To: <200504121000.PAA26408@harvest.india.hp.com> Message-ID: Hi All, When I take an arbitrarily TCAP Component (eg. Invoke), how would I know if that's an ArgumentType or ResultType? Is there any way without actually maintaining a state or tracking the transaction to know what the component is. Please help. Thanks! - Eranga From joelr1@REDACTED Wed Apr 20 15:37:01 2005 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 20 Apr 2005 16:37:01 +0300 Subject: An ode to Erlang In-Reply-To: <42660EAD.3020206@lundata.se> References: <42660EAD.3020206@lundata.se> Message-ID: <20050420143701.23821@smtp.gmail.com> > PeterL wrote: >But the OS you run Erlang on, may have some problems with the total number >of file descriptors (one per TCP-connection). How many file descriptors >is it >possble to have on a standard Linux/FreeBSD machine with 512 MB RAM? I think it's possible to increase the number of open descriptors per user and per process. uname -n 10000 for example. Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Wed Apr 20 17:07:38 2005 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 20 Apr 2005 18:07:38 +0300 Subject: Executing in constance space + memory usage Message-ID: <20050420160738.21609@smtp.gmail.com> Folks, Is there a way to find out the memory used by a process? I found references to the various code profilers but the only thing I know that reports memory usage is erlang:memory() and that is for the emulator overall. I have a code like this: wait_for_players(Game) -> receive ?GA_START -> Game; Event -> Game1 = dispatch(Game, Game#game.state, Event), wait_for_players(Game1) end. where dispatch is a series of function clauses to match game state and event, including a final "catch all" clause. The code is part of the game process and I intend to have as many games as possible. I wonder if it's ok for me to recursively call wait_for_players from one of the dispatch clauses or if I should return some error up to wait_for_players and call it recursively like I'm doing above. It seems to me that the approach of having dispatch return will capture less stack, i.e. the process will execute in less memory. This is just a guess, I don't know how to prove it. Calling wait_for_players from one of the dispatch clauses makes the code cleaner and would be my preferred approach. I would venture to guess that it will increase the memory taken by the process quite a bit. What's the best way to proceed? Thanks, Joel -- http://wagerlabs.com/tech From ulf.wiger@REDACTED Wed Apr 20 17:38:24 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 20 Apr 2005 17:38:24 +0200 Subject: Executing in constance space + memory usage Message-ID: On 20 April 2005 17:08, Joel Reymont wrote: > Is there a way to find out the memory used by a process? > > I found references to the various code profilers but the > only thing I know that reports memory usage is > erlang:memory() and that is for the emulator overall. You should look at Pan: http://cvs.sourceforge.net/viewcvs.py/jungerl/jungerl/lib/pan/#dirlist I believe it is capable of doing pretty much what I'm attempting to describe below. /Uffe You can try tracing on garbage collections. This will give you a good idea of how often GCs occur, how big they are, and were before the GC. If you combine GC trace with function call trace, you can find out which function triggered the GC. This can be a good way to single out functions that could be optimized. Note that it's by no means certain that the function which triggers the GC is doing something it shouldn't. However, if you save the trace output, you can correlate function call trace and GC trace messages, sort them on the difference between the new heap size and the old. This can give pretty good indications. If you use dbg and report trace data to the tty, just be careful not to include the dbg server or the user process in the trace, as this may cause a storm of trace messages. Example: 8> dbg:tracer(). {ok,<0.48.0>} 9> dbg:p(new,[c,arity,garbage_collection]). {ok,[{matched,nonode@REDACTED,0}]} 10> dbg:tpl('_','_','_',[]). ... (<0.53.0>) call erl_parse:yeccpars2/7 (<0.53.0>) call erl_parse:yeccpars1/5 (<0.53.0>) call erl_parse:yeccpars2/7 (<0.53.0>) call erl_parse:yeccpars1/5 (<0.53.0>) call erl_parse:yeccpars2/7 (<0.53.0>) gc_start [{old_heap_block_size,0}, {heap_block_size,233}, {mbuf_size,0}, {recent_size,0}, {stack_size,7}, {old_heap_size,0}, {heap_size,221}] (<0.53.0>) gc_end [{old_heap_block_size,0}, {heap_block_size,233}, {mbuf_size,0}, {recent_size,111}, {stack_size,7}, {old_heap_size,0}, {heap_size,111}] From joelr1@REDACTED Wed Apr 20 17:39:22 2005 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 20 Apr 2005 18:39:22 +0300 Subject: try syntax in Emacs Message-ID: <20050420163922.21173@smtp.gmail.com> Folks, I noticed that the Erlang mode in Emacs does not include handling for try ... catch. This is probably not that important but I wanted to point it out. Thanks, Joel -- http://wagerlabs.com/tech From svg@REDACTED Wed Apr 20 17:55:39 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Wed, 20 Apr 2005 21:55:39 +0600 (YEKST) Subject: Executing in constance space + memory usage In-Reply-To: <20050420160738.21609@smtp.gmail.com> References: <20050420160738.21609@smtp.gmail.com> Message-ID: <20050420.215539.104056221.svg@surnet.ru> Good day, joelr1> Is there a way to find out the memory used by a process? See process_info/2 in man on _erlang_ module. Best Regards, Vladimir Sekissov From ingela@REDACTED Wed Apr 20 17:56:38 2005 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 20 Apr 2005 17:56:38 +0200 Subject: try syntax in Emacs References: <20050420163922.21173@smtp.gmail.com> Message-ID: <16998.31670.509054.23679@gargle.gargle.HOWL> Joel Reymont wrote: > Folks, > > I noticed that the Erlang mode in Emacs does not include handling for try > ... catch. This is probably not that important but I wanted to point it out. The latest version does, however it does not really work as expected for all possible constructs of try and catch. I think it works pretty well for the most basic stuff though! The reason why it does not work in all cases yet, is that quite a few things in the try, catch syntax clashes with other erlang constructs. It is hard for the erlang mode to distinguish between things such as ordinary catch and catch in try.. catch, after in try.. catch and after in receive etc. Alas we have not had time to resolve all these issues. -- /Ingela - OTP team From ingela@REDACTED Wed Apr 20 18:03:59 2005 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 20 Apr 2005 18:03:59 +0200 Subject: Executing in constance space + memory usage References: <20050420160738.21609@smtp.gmail.com> Message-ID: <16998.32111.514414.556406@gargle.gargle.HOWL> Joel Reymont wrote: > Is there a way to find out the memory used by a process? etop in the observer application! -- /Ingela - OTP team From ulf@REDACTED Wed Apr 20 21:25:07 2005 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 20 Apr 2005 21:25:07 +0200 Subject: Big state machines In-Reply-To: <20050419092956.38181.qmail@web41901.mail.yahoo.com> References: <20050419092956.38181.qmail@web41901.mail.yahoo.com> Message-ID: Den 2005-04-19 11:29:55 skrev Thomas Lindgren : > > --- "Ulf Wiger (AL/EAB)" > wrote: > >> >> I have another version, as a matter of fact, which >> is much >> closer to gen_fsm. It solves the dreaded complexity >> explosion >> problem, /.../ > > Interesting. Do you have any opinions on Harel's > statecharts? (A precursor of UML, I believe, though I > haven't studied UML very deeply.) A quick look gave me the impression that Harel's statecharts were the precursor of concurrent sub-states in UML. Interestingly, UML offers both "deferrable events" and concurrent states, but the specification notes that they do not fit very well together. Even though it is possible to reason about what happens when an event that is marked deferrable matches some triggers while failing others in a set of concurrent sub-states, it is by no means obvious. I will not take the time to look up the section in the UML spec that mentions this. It is simply too cumbersome. I believe the recommendation is: use one or the other, but not both at the same time. My guess is: if your state machine has any notion of time, and the ordering of messages in the central message queue can pose a problem - stay away from concurrent sub-states. This also seems to be the general gist of http://www.benmeadowcroft.com/reports/statechart/ It describes Harel statecharts as directed towards what goes on inside a state machine, while CSP is a better model for dealing with real-time systems, since it has a notion of time, and deals with the external interface of a process. Now, with Erlang, if you need Harel statecharts to describe the inner workings of a process, you should rather split it into several processes, and use CSP-like modeling instead. Think 2-port and 4-port equivalents, if you happen to be an EE major. Black boxes - specify what goes in and out of the box. My two cents after five minutes of googling on Harel. Please correct me if I got it all backwards. /Uffe From vances@REDACTED Wed Apr 20 22:14:02 2005 From: vances@REDACTED (Vance Shipley) Date: Wed, 20 Apr 2005 16:14:02 -0400 Subject: variable as function name Message-ID: <20050420201402.GB259@blank.motivity.ca> Why is is that I can do this: 1> T = time. time 2> erlang:T(). {16,8,22} But not this? 3> T(). =ERROR REPORT==== 20-Apr-2005::16:08:12 === Error in process <0.45.0> with exit value: {{badfun,time},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** exited: {{badfun,time}, [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** From erlang@REDACTED Wed Apr 20 22:20:45 2005 From: erlang@REDACTED (Michael McDaniel) Date: Wed, 20 Apr 2005 13:20:45 -0700 Subject: MySQL Interface In-Reply-To: <504504274.20050420043557@speedfactory.net> References: <504504274.20050420043557@speedfactory.net> Message-ID: <20050420202045.GE9417@fangora.autosys.us> On Wed, Apr 20, 2005 at 04:35:57AM -0400, Alexander Williams wrote: > Evening, folk: > > I'm trying to put a Yaws front-end on a number of interfaces to the > underlying MySQL database within my SAM3 music broadcast system. The > Yaws part of the beast is actually no problem at all, truth be told > ... its tying to that pesky MySQL back-end that's the bugger right > now. > > I've been using the MySQL interface listed on the Erlang projects > page (by Magnus Ahltorp), but it seems to get a bit confused when > multiple requests get issued to the database in a short time, and > the initialization of the database channel itself is kind of ... > awkward. > > Undoubtedly, folks are doing more MySQL than I've been, so I thought > I'd ask here. Sensible, really. > > Many thanks in advance. > > -- > Alexander Williams (thantos@REDACTED) > The Squid's Redoubt: http//chancel.org:8000/Redoubt > Currently Playing: Audra and the Antidote - Strange & Beautiful > Album: Hello? > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I am using R10B-4 odbc on Linux. $ uname -a Linux sftp 2.6.4-52-smp #1 SMP Wed Apr 7 02:11:20 UTC 2004 i686 i686 i386 GNU/Linux I have not stress tested it so do not know how it will work with multiple requests using multiple connections. ~~Michael From tobbe@REDACTED Thu Apr 21 08:36:10 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 21 Apr 2005 08:36:10 +0200 Subject: MySQL Interface In-Reply-To: <20050420202045.GE9417@fangora.autosys.us> References: <504504274.20050420043557@speedfactory.net> <20050420202045.GE9417@fangora.autosys.us> Message-ID: <426749DA.2080803@nortel.com> BTW: It would be nice if someone could write a little HowTo on how to setup and use ODBC from Erlang. You'll find the HowTo framework here: http://www.trapexit.org/docs/howto/ Cheers, Tobbe Michael McDaniel wrote: >On Wed, Apr 20, 2005 at 04:35:57AM -0400, Alexander Williams wrote: > > >>Evening, folk: >> >> I'm trying to put a Yaws front-end on a number of interfaces to the >> underlying MySQL database within my SAM3 music broadcast system. The >> Yaws part of the beast is actually no problem at all, truth be told >> ... its tying to that pesky MySQL back-end that's the bugger right >> now. >> >> I've been using the MySQL interface listed on the Erlang projects >> page (by Magnus Ahltorp), but it seems to get a bit confused when >> multiple requests get issued to the database in a short time, and >> the initialization of the database channel itself is kind of ... >> awkward. >> >> Undoubtedly, folks are doing more MySQL than I've been, so I thought >> I'd ask here. Sensible, really. >> >> Many thanks in advance. >> >>-- >> Alexander Williams (thantos@REDACTED) >>The Squid's Redoubt: http//chancel.org:8000/Redoubt >> Currently Playing: Audra and the Antidote - Strange & Beautiful >> Album: Hello? >> >> >> >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >I am using R10B-4 odbc on Linux. >$ uname -a >Linux sftp 2.6.4-52-smp #1 SMP Wed Apr 7 02:11:20 UTC 2004 i686 i686 i386 GNU/Linux > >I have not stress tested it so do not know how it will work with >multiple requests using multiple connections. > >~~Michael > > > > From raimo@REDACTED Thu Apr 21 08:48:22 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 21 Apr 2005 08:48:22 +0200 Subject: variable as function name References: <20050420201402.GB259@blank.motivity.ca> Message-ID: Well, that is just the way it is..., or rather: The only functions you can skip the module name for are local, imported and autoimported (e.g erlang:self/0). The Variable() calling syntax should not behave differently depending on what is imported in the calling context, therefore the Variable should contain both module and function; arity is defined by the parenthesis expression. You can send Variable to another process (on another node) and there other functions may be imported, or even autoimported. The modern way is Variable contains a fun(), the ancient way from when funs did not exist is Variable contains {Module,Function} where Module and Function are atoms. Quite some gurus claim {M,F} funs are a bad, bad thing and should be exterminated ASAP. vances@REDACTED (Vance Shipley) writes: > Why is is that I can do this: > > 1> T = time. > time > 2> erlang:T(). > {16,8,22} > > But not this? > > 3> T(). > > =ERROR REPORT==== 20-Apr-2005::16:08:12 === > Error in process <0.45.0> with exit value: {{badfun,time},[{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} > > ** exited: {{badfun,time}, > [{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]} ** > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From erlang@REDACTED Thu Apr 21 09:09:20 2005 From: erlang@REDACTED (Michael McDaniel) Date: Thu, 21 Apr 2005 00:09:20 -0700 Subject: MySQL Interface In-Reply-To: <426749DA.2080803@nortel.com> References: <504504274.20050420043557@speedfactory.net> <20050420202045.GE9417@fangora.autosys.us> <426749DA.2080803@nortel.com> Message-ID: <20050421070919.GO9417@fangora.autosys.us> On Thu, Apr 21, 2005 at 08:36:10AM +0200, Torbjorn Tornkvist wrote: > > BTW: It would be nice if someone could write a little > HowTo on how to setup and use ODBC from Erlang. > You'll find the HowTo framework here: > > http://www.trapexit.org/docs/howto/ > > Cheers, Tobbe ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I am not particularly pleased with my instructions for getting odbc running. It still feels too much like 'poking and prodding' to get it to work. However, I have got it working on a few of my machines, so I tried to upload some instructions... I could not figure out how to get authenticated to upload a 'howto' so here is (one of) my 'odbc-install.txt' file. I think odbc-2.0.3 is the one included with R10B-4. All of the following is on Linux. Feel free to distill what works for you and maybe upload a 'howto' based on these findings. There are sone 'NEWER INSTRUCTIONS' further below that may be a bit more streamlined. Erlang odbc using odbc-2.0.3 System: SuSE release 9.1 or 9.2 (some package versions different w/9.2) uname -a Linux fangora 2.6.4-52-default #1 Wed Apr 7 02:08:30 UTC 2004 i686 i686 i386 GNU/Linux 1) install the following from Yast MyODBC-unixODBC-3.51.06-150 unixODBC-devel-2.2.8-55 mysql-devel-4.0.18-32 mysql-4.0.18-32 mysql-client-4.0.18-32 mysql-shared-4.0.18-32 openssl-devel ncurses-devel libtool C/C++ 2) using R10-B3 $ cd /opt/src/otp_src_R10B-3/lib $ rm -fr odbc $ tar -zxf odbc-2.0.3.tar.gz $ cd .. $ export ERL_TOP=${PWD}/ $ export LC_ALL=C $ export ERLANG_COMMERCIAL_BUILD="Automated Systems" $ ./configure --with-odbc --with-ssl (the EIROOT directory does not yet exist, it will) $ export EIROOT=/opt/src/otp_src_R10B-3/lib/erl_interface/obj/i686-pc-linux-gnu/ $ emacs lib/odbc_c_src-2.0.3/c_src/i686-pc-linux-gnu/Makefile ODBC_LIB = $(EIROOT) (could put entire string here but I like EIROOT; remove @ODBC_LIB@) (per Heinrich Ventor) #ifeq ($(TYPE),debug) # TYPEMARKER = .debug # else TYPEMARKER = # endif $ $ make $ sudo make install $ cd lib/odbc_c_src-2.0.3/ $ make $ sudo mkdir /usr/local/lib/erlang/lib/odbc-2.0.3 $ cp priv/bin/i686-pc-linux-gnu/odbcserver priv/bin/ $ sudo cp -R * /usr/local/lib/erlang/lib/odbc-2.0.3 $ export ODBCINI=/etc/unixODBC/odbc.ini $ export ODBCSYSINI=/etc/unixODBC/odbcinst.ini # /etc/init.d/mysql start # mysqladmin -u root password "secret" $ mysql -u root -p Password: secret mysql> grant all on test.* to test@REDACTED identified by 'test' ; mysql> quit ; $ export ODBCINI=/etc/unixODBC/odbc.ini $ export ODBCSYSINI=/etc/unixODBC/odbcinst.ini # /etc/init.d/mysql start # mysqladmin -u root password "secret" $ mysql -u root -p Password: secret mysql> grant all on test.* for test identified by 'test' ; mysql> quit ; $ erl Erlang (BEAM) emulator version 5.4.4 [hipe] Eshell V5.4.4 (abort with ^G) 1> application:start(odbc). ok 2> {ok,Ref} = odbc:connect("DSN=myodbc3;UID=test;PWD=test",[{trace_driver,on}]). {ok, <0.38.0>} 3> odbc:sql_query(Ref, "select version();"). {selected, ["version()"],[{"4.0.21"}]} 4> odbc:disconnect(Ref). ok 5> q(). 6> $ $ %% end *** ---------------------------------------------------------- *** *** -------------------- NEWER INSTRUCTIONS ------------------ *** *** ---------------------------------------------------------- *** and here's another series of operations that worked for me... unixODBC-2.2.11.tar.gz ./configure --enable-gui=no --with-gnu-ld=yes "CFLAGS=-I/usr/include/mysql" make sudo make install which results in the following msg (there was more but this seemed most pertinent) " ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- touch /usr/local/etc/odbcinst.ini touch /usr/local/etc/odbc.ini mkdir -p /usr/local/etc/ODBCDataSources " # rpm --nodeps -i /opt/tar/MyODBC-3.51.11-2.i586.rpm w/o --nodeps it complains about libodbcinst.so.1 and libodbc.so.1 but they are already installed erlang from source otp_src_R10B-4.tar.gz $ cd /opt/src/otp_src_R10B-4/ $ export ERL_TOP=${PWD}/ $ export LC_ALL=C $ export ERLANG_COMMERCIAL_BUILD="Automated Systems" $ ./configure --with-odbc --x-includes=/usr/local/include --x-libraries=/usr/lib --with-ssl ********************************************************************* ********************** APPLICATIONS DISABLED ********************** ********************************************************************* jinterface : No Java compiler found odbc : No odbc library found ********************************************************************* $ chmod u+w lib/Makefile $ echo "From: Mikael Karlsson " $ then emacs lib/Makefile w/following changes... otp_src_R10B-4/lib> diff Makefile Makefile~ 68c68 < pman $(SSL_APP) toolbar tv observer odbc \ --- > pman $(SSL_APP) toolbar tv observer \ $ chmod u+w lib/odbc/configure.in $ emacs lib/odbc/configure.in ... On SuSE the odbc root is /usr so this could be added to the configure(.in) files: otp_src_R10B-4/lib/odbc> diff configure.in configure.in~ 67c67 < for dir in /opt/local/pgm/odbc /usr/local/odbc /usr/odbc /usr --- > for dir in /opt/local/pgm/odbc /usr/local/odbc /usr/odbc $ $ make $ export PATH=$PATH:$ERL_TOP/bin (for erlc) $ echo "ODBC_LIB = $(EILIB) in Makefile" $ echo "and, per Heinrich..." #ifeq ($(TYPE),debug) #TYPEMARKER = .debug #TYPEFLAGS = -g #else TYPEMARKER = #TYPEFLAGS = #endif LDFLAGS = $(ODBC_LIB) $(EI_LDFLAGS) -L/usr/local/lib LIBS = -lpthread $(EI_LIB) -lodbc (copy over my odbc.ini and odbcinst.ini files) $ (cd lib/odbc ; rm SKIP && emacs c_src/i686-pc-linux-gnu/Makefile && make) $ $ sudo make install $ export ODBCINI=/etc/unixODBC/odbc.ini $ export ODBCSYSINI=/etc/unixODBC/odbcinst.ini $ erl Erlang (BEAM) emulator version 5.4.5 [hipe] Eshell V5.4.5 (abort with ^G) 1> application:start(odbc). ok 2> FINE, but 2>{ok, Ref} = odbc:connect("DSN=callinfo;UID=me;PWD=secret", [{trace_driver,on}]). wouldn't work. I wound up copying fangora:/usr/lib/libmyodbc3-3.51.11.so over to sftp:/usr/lib and then, on sftp, rm /usr/local/lib/libmyodbc3.so ln -s /usr/lib/libmyodbc3-3.51.11.so /usr/local/lib/libmyodbc3.so and then the erl odbc:connect(...) worked, though with warnings. The warnings were [MYODBCUtilReadDataSource.c][209][WARNING] Failed to get value for attribute (PORT). [MYODBCUtilReadDataSource.c][209][WARNING] Failed to get value for attribute (USER). [MYODBCUtilReadDataSource.c][209][WARNING] Failed to get value for attribute (Password). [MYODBCUtilReadDataSource.c][209][WARNING] Failed to get value for attribute (SOCKET). [MYODBCUtilReadDataSource.c][205][ERROR] Unknown attribute (Trace). [MYODBCUtilReadDataSource.c][205][ERROR] Unknown attribute (TraceFile). **NOTE** I researched the above WARNING and apparently it is benign, though annoying, as it shows up on terminal applications. The Ref worked with sql_query(Ref, "select version();") {selected,["version()"],[{"4.1.7-standard"}]} and other queries worked fine also, so I don't yet know what the [WARNING]s are about (though may be related to having copied over the latest libmyodbc3 and maybe something else is still missing or misconfigured. SO, I did the following (again because, apparently, I removed it ~!#$%?) # rpm -i /opt/tar/MyODBC-3.51.11-2.i586.rpm and now /usr/lib/libmyodbc3* is fully populated; change /etc/unixODBC/odbc.ini and odbcinst.ini for path /usr/lib/libmyodbc3.so (instead of /usr/lib/unixODBC/libmyodbc3.so) and no more errors - hurray! AND remote access to mxml works. %% end ------------------------------------------------------------------------ here's my /etc/unixODBC/odbc.ini (I'm pretty sure only the 'callinfo' section is needed though I haven't cleaned it out to verify). ; ; odbc.ini configuration for MyODBC and MyODBC 3.51 Drivers ; [ODBC Data Sources] myodbc = MySQL ODBC 2.50 Driver DSN myodbc3 = MySQL ODBC 3.51 Driver DSN [myodbc] Driver = /usr/lib/libmyodbc3.so Description = MySQL ODBC 2.50 Driver DSN SERVER = localhost PORT = USER = test Password = test Database = test OPTION = 3 SOCKET = Trace = Yes TraceFile = odbc.log [myodbc3] Driver = /usr/lib/libmyodbc3.so Description = MySQL ODBC 3.51 Driver DSN SERVER = localhost PORT = USER = test Password = test Database = test OPTION = 3 SOCKET = Trace = Yes TraceFile = odbc.log [callinfo] Driver = /usr/lib/libmyodbc3.so Description = MySQL ODBC 3.51 Driver DSN SERVER = localhost PORT = USER = Password = Database = callinfo OPTION = 3 SOCKET = Trace = Yes TraceFile = odbc.log [default] Driver = /usr/lib/libmyodbc3.so Description = MySQL ODBC 3.51 Driver DSN SERVER = cougora.autosys.us PORT = USER = erl Password = erl Database = world OPTION = 3 SOCKET = Trace = Yes TraceFile = odbc.log ------------------------------------------------------------------------ and here's my /etc/unixODBC/odbcinst.ini [callinfo] Description = callinfo Driver = /usr/lib/libmyodbc3.so Setup = /usr/lib/libmyodbc3S.so FileUsage = 1 [MySQL] Description = MySQL Driver = /usr/lib/libmyodbc3.so Setup = /usr/lib/libmyodbc3S.so FileUsage = 1 [MySQL ODBC 3.51 Driver] DRIVER = /usr/lib/libmyodbc3.so SETUP = /usr/lib/libmyodbc3S.so FileUsage = 1 Hope that helps. Oh, yeah, here's some information from one of my machines where odbc is working. $ rpm -qa | egrep -i "mysql|odbc" MySQL-bench-4.1.7-0 MySQL-server-4.1.7-0 unixODBC-devel-2.2.8-55 MyODBC-unixODBC-3.51.06-150 MySQL-client-4.1.7-0 MySQL-devel-4.1.7-0 MySQL-shared-4.1.7-0 unixODBC-2.2.8-55 mysql-shared-4.0.18-32 MyODBC-3.51.11-2 I would like to thank Ingela Anderton of the Ericsson OTP Team who helped my quite a bit to get odbc working on Linux. I hope this helps, and I will try to answer questions people may have. ~Michael > > > Michael McDaniel wrote: > > >On Wed, Apr 20, 2005 at 04:35:57AM -0400, Alexander Williams wrote: > > > > > >>Evening, folk: > >> > >> I'm trying to put a Yaws front-end on a number of interfaces to the > >> underlying MySQL database within my SAM3 music broadcast system. The > >> Yaws part of the beast is actually no problem at all, truth be told > >> ... its tying to that pesky MySQL back-end that's the bugger right > >> now. > >> > >> I've been using the MySQL interface listed on the Erlang projects > >> page (by Magnus Ahltorp), but it seems to get a bit confused when > >> multiple requests get issued to the database in a short time, and > >> the initialization of the database channel itself is kind of ... > >> awkward. > >> > >> Undoubtedly, folks are doing more MySQL than I've been, so I thought > >> I'd ask here. Sensible, really. > >> > >> Many thanks in advance. > >> > >>-- > >>Alexander Williams (thantos@REDACTED) > >>The Squid's Redoubt: http//chancel.org:8000/Redoubt > >> Currently Playing: Audra and the Antidote - Strange & Beautiful > >> Album: Hello? > >> > >> > >> > >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >I am using R10B-4 odbc on Linux. > >$ uname -a > >Linux sftp 2.6.4-52-smp #1 SMP Wed Apr 7 02:11:20 UTC 2004 i686 i686 i386 > >GNU/Linux > > > >I have not stress tested it so do not know how it will work with > >multiple requests using multiple connections. > > > >~~Michael > > > > > > > > > From tobbe@REDACTED Thu Apr 21 09:19:04 2005 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 21 Apr 2005 09:19:04 +0200 Subject: MySQL Interface In-Reply-To: <20050421070919.GO9417@fangora.autosys.us> References: <504504274.20050420043557@speedfactory.net> <20050420202045.GE9417@fangora.autosys.us> <426749DA.2080803@nortel.com> <20050421070919.GO9417@fangora.autosys.us> Message-ID: <426753E8.5000509@nortel.com> Ok, great! The way to authenticate is to use the same user/passwd as you (hopefully) has registered in the forum part of trapexit.org. The actual HowTo's is written in XML so a good idea is to grab one of the existing HowTo's XML files (use the xml link), and replace the content with your own writings. If you have time to do this it would be fantastic, Otherwise I guess I could do it when I get some spare time... ;-) Cheers, Tobbe Michael McDaniel wrote: >On Thu, Apr 21, 2005 at 08:36:10AM +0200, Torbjorn Tornkvist wrote: > > >>BTW: It would be nice if someone could write a little >>HowTo on how to setup and use ODBC from Erlang. >>You'll find the HowTo framework here: >> >>http://www.trapexit.org/docs/howto/ >> >>Cheers, Tobbe >> >> >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > >I am not particularly pleased with my instructions for getting >odbc running. It still feels too much like 'poking and prodding' >to get it to work. However, I have got it working on a few >of my machines, so I tried to upload some instructions... > >I could not figure out how to get authenticated to upload a 'howto' >so here is (one of) my 'odbc-install.txt' file. I think odbc-2.0.3 >is the one included with R10B-4. All of the following is on Linux. > >Feel free to distill what works for you and maybe upload a 'howto' >based on these findings. There are sone 'NEWER INSTRUCTIONS' >further below that may be a bit more streamlined. > > From jabba@REDACTED Thu Apr 21 10:51:52 2005 From: jabba@REDACTED (Jani Launonen) Date: Thu, 21 Apr 2005 11:51:52 +0300 (EEST) Subject: Possible bug & improvement suggestion concerning Erlang shell Message-ID: Hello, when compiling module dummy from Erlang shell that exports functions init/1 and do_something/0 (for example) and asking m(dummy) one gets the following print out: 248> m(dummy). Module dummy compiled: Date: April 21 2005, Time: 08.28 Compiler options: [] Object file: k:/programming/erlang/dummy.beam Exports: do_something/0 init/1 module_info/0 module_info/1 ok Everything as expected. But remove the do_something/0 from exports, compile from the shell and it is still seen in the print out generated by m(dummy). Is this a feature or is this a bug? (One cannot call the do_something/0 outside the module any more, so everythings fine with that respect. It's just puzzling to show students the code-compile-test-change-compile as the old function just shows there in exports with no reason.) Improvement suggestion: Would it be worth adding a menu for graphical directory choosing -component in werl.exe? I noted that asking students to change the current working directory to some other drive and path was little bit puzzling because of the unix-style / -path separator, ls() and pwd() -commands. I wasn't able to make command line scripts for them as I've been in unix enviroment for years and couldn't remember how things were done in windows command line. Also the directory structure was different for the students so I didn't know before hand where their network directories were. So it would have been easier to ask they to click themselves to their own directories than remind them to use "/"-path separator and try to find their way to the right directory forgotting the use of "" around the path... Cheers, -+-+-+- Jani Launonen From casper2000a@REDACTED Thu Apr 21 12:15:02 2005 From: casper2000a@REDACTED (Casper) Date: Thu, 21 Apr 2005 16:15:02 +0600 Subject: Mnesia Order By Message-ID: Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Thu Apr 21 12:35:38 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 21 Apr 2005 12:35:38 +0200 Subject: Possible bug & improvement suggestion concerning Erlang shell In-Reply-To: References: Message-ID: Jani Launonen writes: [...] > > Everything as expected. But remove the do_something/0 from exports, > compile from the shell and it is still seen in the print out generated > by m(dummy). Is this a feature or is this a bug? (One cannot call the > do_something/0 outside the module any more, so everythings fine with > that respect. It's just puzzling to show students the > code-compile-test-change-compile as the old function just shows there > in exports with no reason.) > This bug was corrected in OTP R10B-4. Do you use R10B-4? > > Improvement suggestion: > Would it be worth adding a menu for graphical directory choosing > -component in werl.exe? I noted that asking students to change the > current working directory to some other drive and path was little bit > puzzling because of the unix-style / -path separator, ls() and pwd() > -commands. I wasn't able to make command line scripts for them as I've > been in unix enviroment for years and couldn't remember how things > were done in windows command line. Also the directory structure was > different for the students so I didn't know before hand where their > network directories were. So it would have been easier to ask they to > click themselves to their own directories than remind them to use > "/"-path separator and try to find their way to the right directory > forgotting the use of "" around the path... > Yes, it could be a worthwile addition, but don't hold your breath. When working with Erlang on Windows, I usually make a shortcut to werl.exe. In the shortcut properties, I change the initial working directory. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From svg@REDACTED Thu Apr 21 12:49:36 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 21 Apr 2005 16:49:36 +0600 (YEKST) Subject: Mnesia Order By In-Reply-To: References: Message-ID: <20050421.164936.104060838.svg@surnet.ru> Good day, casper2000a> How do I do a mnesia:select or relevant data retrieval to read data in casper2000a> ordered manner? (like ORDER BY in SQL) QLC queries (see man on _qlc_ module) and Mnemosine have some sorting possibilities. Best Regards, Vladimir Sekissov From ulf.wiger@REDACTED Thu Apr 21 13:15:09 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 21 Apr 2005 13:15:09 +0200 Subject: Mnesia Order By Message-ID: The current solution is: sort the list produced by the select() call. Using qlc, you can produce a handle that, when evaluated, returns a sorted result. See the reference manual on qlc (in stdlib.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper Sent: den 21 april 2005 12:15 To: erlang-questions@REDACTED Subject: Mnesia Order By Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From jabba@REDACTED Thu Apr 21 13:16:17 2005 From: jabba@REDACTED (Jani Launonen) Date: Thu, 21 Apr 2005 14:16:17 +0300 (EEST) Subject: Possible bug & improvement suggestion concerning Erlang shell In-Reply-To: References: Message-ID: > This bug was corrected in OTP R10B-4. Do you use R10B-4? Oh crap! I'm sorry, everyone. I did check quickly the release info, but missed apparently and haven't installed the latest version... classical mistake, I'm afraid. [cut improvement suggestion] > Yes, it could be a worthwile addition, but don't hold your breath. > > When working with Erlang on Windows, I usually make a shortcut to werl.exe. > In the shortcut properties, I change the initial working directory. Thanks for the tip! > /Bjorn > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -+-+-+- Jani Launonen From casper2000a@REDACTED Thu Apr 21 13:55:47 2005 From: casper2000a@REDACTED (Casper) Date: Thu, 21 Apr 2005 17:55:47 +0600 Subject: Mnesia Order By In-Reply-To: Message-ID: Vladmir/Uffe, Thanks for the info. For that, do I have to read all the records before do a sorting? For example, what if I have to navigate through a record set with about couple of hundred thousands of records, 100 records in each page? I.e. I jus want to navigate through a huge database on a Web Page, which gives 100 records in each page. Data is sorted by the Key ID or Entered Date. Viewer can navigate through the records by going to Previous and Next Pages. What I don't want is to do a sorting of 100,000 (let's say) records in each page to get the 100 records to be displayed. What's the best method I can use? Thanks! - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 5:15 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By The current solution is: sort the list produced by the select() call. Using qlc, you can produce a handle that, when evaluated, returns a sorted result. See the reference manual on qlc (in stdlib.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper Sent: den 21 april 2005 12:15 To: erlang-questions@REDACTED Subject: Mnesia Order By Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Thu Apr 21 14:16:07 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 21 Apr 2005 14:16:07 +0200 Subject: Mnesia Order By Message-ID: Wouldn't your select() call return the 100 records to display on the page? If so, sorting the results of the select() call is the way to go. /Uffe -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 21 april 2005 13:56 To: 'Vladimir Sekissov'; Ulf Wiger (AL/EAB); erlang-questions@REDACTED Subject: RE: Mnesia Order By Vladmir/Uffe, Thanks for the info. For that, do I have to read all the records before do a sorting? For example, what if I have to navigate through a record set with about couple of hundred thousands of records, 100 records in each page? I.e. I jus want to navigate through a huge database on a Web Page, which gives 100 records in each page. Data is sorted by the Key ID or Entered Date. Viewer can navigate through the records by going to Previous and Next Pages. What I don't want is to do a sorting of 100,000 (let's say) records in each page to get the 100 records to be displayed. What's the best method I can use? Thanks! - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 5:15 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By The current solution is: sort the list produced by the select() call. Using qlc, you can produce a handle that, when evaluated, returns a sorted result. See the reference manual on qlc (in stdlib.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper Sent: den 21 april 2005 12:15 To: erlang-questions@REDACTED Subject: Mnesia Order By Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From svg@REDACTED Thu Apr 21 14:21:46 2005 From: svg@REDACTED (Vladimir Sekissov) Date: Thu, 21 Apr 2005 18:21:46 +0600 (YEKST) Subject: Mnesia Order By In-Reply-To: References: Message-ID: <20050421.182146.189701395.svg@surnet.ru> casper2000a> What I don't want is to do a sorting of 100,000 (let's say) records in each casper2000a> page to get the 100 records to be displayed. QLC uses temporary files for sorting. If you can keep process initiated the QLC query for reasonable time you can use QLC-cursors(QLC-cursor is an ordinary Erlang process). Best Regards, Vladimir Sekissov From casper2000a@REDACTED Thu Apr 21 14:45:31 2005 From: casper2000a@REDACTED (Casper) Date: Thu, 21 Apr 2005 18:45:31 +0600 Subject: Mnesia Order By In-Reply-To: Message-ID: Uffe, Even though the select call returns only 100 records, I want those records to be globally sorted. What I mean is not those records sorted within those 100, but it's the next block of sorted whole table. I don't know if above is clear. Thanks, - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 6:16 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By Wouldn't your select() call return the 100 records to display on the page? If so, sorting the results of the select() call is the way to go. /Uffe -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 21 april 2005 13:56 To: 'Vladimir Sekissov'; Ulf Wiger (AL/EAB); erlang-questions@REDACTED Subject: RE: Mnesia Order By Vladmir/Uffe, Thanks for the info. For that, do I have to read all the records before do a sorting? For example, what if I have to navigate through a record set with about couple of hundred thousands of records, 100 records in each page? I.e. I jus want to navigate through a huge database on a Web Page, which gives 100 records in each page. Data is sorted by the Key ID or Entered Date. Viewer can navigate through the records by going to Previous and Next Pages. What I don't want is to do a sorting of 100,000 (let's say) records in each page to get the 100 records to be displayed. What's the best method I can use? Thanks! - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 5:15 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By The current solution is: sort the list produced by the select() call. Using qlc, you can produce a handle that, when evaluated, returns a sorted result. See the reference manual on qlc (in stdlib.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper Sent: den 21 april 2005 12:15 To: erlang-questions@REDACTED Subject: Mnesia Order By Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.hinde@REDACTED Thu Apr 21 14:50:53 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 21 Apr 2005 13:50:53 +0100 Subject: Mnesia Order By In-Reply-To: References: Message-ID: <7da547fb6ff349520ee6310086bafdfa@mac.com> Hi, On 21 Apr 2005, at 12:55, Casper wrote: > > Vladmir/Uffe, > ? > Thanks for the info. > ? > For that, do I have to read all the records before do a sorting? For > example, what if I have to navigate through a record set with about > couple of hundred thousands of records, 100 records in each page? > ? > I.e. I jus want to navigate through a huge database on a Web Page, > which gives 100 records in each page. Data is sorted by the Key ID or > Entered Date. Viewer can navigate through the records by going to > Previous and Next Pages. > ? > What I don?t want is to do a sorting of 100,000 (let?s say) records in > each page to get the 100 records to be displayed. I have made a similar system in the past. The approach I used was to keep an additional ordered set table for each of the extra items to sort by. This just pointed into the primary key of the main table. Then to get the first 100 records by, say, date I would select from the date index table and read each record from the main table. Sean From ulf.wiger@REDACTED Thu Apr 21 16:24:42 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 21 Apr 2005 16:24:42 +0200 Subject: Mnesia Order By Message-ID: Sounds to me as if you need compound indexes. ;-) See http://www.erlang.org/ml-archive/erlang-questions/200502/msg00233.html I'm currently re-hacking my code in order to turn the indexes into first-class tables. Not quite done, though. (When I get something working, who wants to take it for a spin?) /Uffe -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 21 april 2005 14:46 To: Ulf Wiger (AL/EAB); erlang-questions@REDACTED Subject: RE: Mnesia Order By Uffe, Even though the select call returns only 100 records, I want those records to be globally sorted. What I mean is not those records sorted within those 100, but it's the next block of sorted whole table. I don't know if above is clear... Thanks, - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 6:16 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By Wouldn't your select() call return the 100 records to display on the page? If so, sorting the results of the select() call is the way to go. /Uffe -----Original Message----- From: Casper [mailto:casper2000a@REDACTED] Sent: den 21 april 2005 13:56 To: 'Vladimir Sekissov'; Ulf Wiger (AL/EAB); erlang-questions@REDACTED Subject: RE: Mnesia Order By Vladmir/Uffe, Thanks for the info. For that, do I have to read all the records before do a sorting? For example, what if I have to navigate through a record set with about couple of hundred thousands of records, 100 records in each page? I.e. I jus want to navigate through a huge database on a Web Page, which gives 100 records in each page. Data is sorted by the Key ID or Entered Date. Viewer can navigate through the records by going to Previous and Next Pages. What I don't want is to do a sorting of 100,000 (let's say) records in each page to get the 100 records to be displayed. What's the best method I can use? Thanks! - Eranga _____ From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] On Behalf Of Ulf Wiger (AL/EAB) Sent: Thursday, April 21, 2005 5:15 PM To: erlang-questions@REDACTED Subject: RE: Mnesia Order By The current solution is: sort the list produced by the select() call. Using qlc, you can produce a handle that, when evaluated, returns a sorted result. See the reference manual on qlc (in stdlib.) /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Casper Sent: den 21 april 2005 12:15 To: erlang-questions@REDACTED Subject: Mnesia Order By Hi All, How do I do a mnesia:select or relevant data retrieval to read data in ordered manner? (like ORDER BY in SQL) Please advice as soon as possible. Thanks! - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders@REDACTED Thu Apr 21 22:29:47 2005 From: anders@REDACTED (Anders Ramsell) Date: Thu, 21 Apr 2005 22:29:47 +0200 Subject: Possible bug & improvement suggestion concerning Erlang shell In-Reply-To: References: Message-ID: <42680D3B.5030704@theheartofgold.org> Bjorn Gustavsson wrote: > Jani Launonen writes: >>Improvement suggestion: >>Would it be worth adding a menu for graphical directory choosing >>-component in werl.exe? >> [snip] >> > Yes, it could be a worthwile addition, but don't hold your breath. > > When working with Erlang on Windows, I usually make a shortcut to werl.exe. > In the shortcut properties, I change the initial working directory. > While we are on the subject of werl and paths I might add another bug report. If you use File/Open Logfile in werl then the current working directory will change to where you store the logfile. Below I call pwd() twice starting the logging between calls. --8<---------------------------------------------------- Erlang (BEAM) emulator version 5.4.5 [threads:0] Eshell V5.4.5 (abort with ^G) 1> pwd(). C:/Program/erl5.4.5 ok 2> pwd(). C:/WINDOWS/Skrivbord ok 3> --8<---------------------------------------------------- /Anders From serge@REDACTED Thu Apr 21 22:56:23 2005 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 21 Apr 2005 16:56:23 -0400 Subject: distributed performance test Message-ID: <42681377.7020803@hq.idt.net> Gentlemen, I'd like to ask for your advice on how to troubleshoot a problem related to a severe performance drop of a gen_server:call() between a client and a server running on different hosts. The server is implementing a gen_server behavior, and a client's code is shown below. I've set up two nodes on different servers. I use a test function drp_client:test_async(ConcurrentClients, TimesToRunPerClient) for stress testing. The function uses spawn/3 to create concurrent processes, where each one calls the drp_client:do_request/2 shown below. When I call the server from the same node, the performance is: - for a single client: 9434 calls/s - for two clients....: 8771 calls/s (~ 4400 call/s per client) (drp@REDACTED)6> drp_client:test_async(1, 1000). Client 1 done. AvgTime=0.000 (9433.962 c/s) (drp@REDACTED)7> drp_client:test_async(2, 1000). Client 2 done. AvgTime=0.000 (4405.286 c/s) Client 1 done. AvgTime=0.000 (4366.812 c/s) ---- When I call the server from a different host/node, the performance is: - for a single client: 2538 calls/s - for two clients....: 30 calls/s (~ 15 call/s per client) <--- !!! (n1@REDACTED)9> drp_client:test_async(1, 1000). Client 1 done. AvgTime=0.000 (2538.071 c/s) (n1@REDACTED)10> drp_client:test_async(2, 100). Client 2 done. AvgTime=0.067 (15.020 c/s) Client 1 done. AvgTime=0.067 (15.017 c/s) For some reason we observe a significant performance drop in case of multiple clients issuing calls from a distributed node. I tried to profile clients running on drp@REDACTED (local) and n1@REDACTED (remote) nodes, but results are very similar. Now - the exciting part. When I try to use the coverage tool on the server, and just compile a few modules using cover:compile_module/1, the invocation of clients on the remote node yields expected performance: (drp@REDACTED)2> cover:start(). {ok,<0.115.0>} (drp@REDACTED)3> lists:foreach(fun(M) -> cover:compile_module(M) end, [drp_proto, drp_router, drp_server]). ok (n1@REDACTED)24> drp_client:test_async(2, 500). Client 2 done. AvgTime=0.001 (1483.680 c/s) Client 1 done. AvgTime=0.001 (1457.726 c/s) So, the two questions are: 1. What can cause such a significant performance drop in case of multiple concurrent clients accessing the server? 2. Why would conver:compile_module/1 eliminate this performance drop. Your advice would be highly appreciated. Regards, Serge drp_client: =========== do_request(Args, Timeout) -> case get_server_pid() of {ok, Pid} -> case catch gen_server:call(Pid, Args, Timeout) of {ok, From, Response} -> {ok, From, Response}; {error, Reason} -> {error, Reason}; {'EXIT', {noproc, _Reason}} -> {error, server_not_running}; {'EXIT', Reason} -> {error, Reason} end; {error, Reason} -> {error, Reason} end. get_server_pid() -> case pg2:get_closest_pid(?MODULE) of Pid when is_pid(Pid) -> {ok, Pid}; {error, {no_process, _}} -> {error, no_process} end. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: fprof_remote.txt URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: fprof_local.txt URL: From vances@REDACTED Fri Apr 22 05:16:46 2005 From: vances@REDACTED (Vance Shipley) Date: Thu, 21 Apr 2005 23:16:46 -0400 Subject: variable as function name In-Reply-To: References: <20050420201402.GB259@blank.motivity.ca> Message-ID: <20050422031646.GE259@blank.motivity.ca> On Thu, Apr 21, 2005 at 08:48:22AM +0200, Raimo Niskanen wrote: } } The only functions you can skip the module name for are } local, imported and autoimported (e.g erlang:self/0). Yeah, I guess that was a bad example. I should have used Foo(). It just bothers me that I have to export all the functions I might bind to Foo when I use mymodule:Foo(). -Vance From raimo@REDACTED Fri Apr 22 09:04:11 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 22 Apr 2005 09:04:11 +0200 Subject: variable as function name References: <20050420201402.GB259@blank.motivity.ca>, , <20050422031646.GE259@blank.motivity.ca> Message-ID: That is correct! The only alternative to exporting is to use fun()s. But they differ in behaviour particulary concerning code change. There have been ideas of how to remedy this, from the Hipe group, but I do not remember how. vances@REDACTED (Vance Shipley) writes: > On Thu, Apr 21, 2005 at 08:48:22AM +0200, Raimo Niskanen wrote: > } > } The only functions you can skip the module name for are > } local, imported and autoimported (e.g erlang:self/0). > > Yeah, I guess that was a bad example. I should have used Foo(). > > It just bothers me that I have to export all the functions I > might bind to Foo when I use mymodule:Foo(). > > -Vance -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From joelr1@REDACTED Fri Apr 22 10:24:58 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Apr 2005 11:24:58 +0300 Subject: Obtaining the current state of the gen_fsm Message-ID: <20050422092458.26477@smtp.gmail.com> Folks, How would you suggest debugging a gen_fsm as a whole? I understand that I can invoke each state fun and see what the return value is but this seems suboptimal at times. Is there a way to obtain the internal state of the FSM? Then I can have a general all-FSM event to return internal state /used for debugging purposes/ and my tests could check the current state of the FSM before the test and after. Thanks, Joel -- http://wagerlabs.com/tech From ulf.wiger@REDACTED Fri Apr 22 10:33:05 2005 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Fri, 22 Apr 2005 10:33:05 +0200 Subject: Obtaining the current state of the gen_fsm Message-ID: sys:get_status(FSM) will reveal the internal gen_fsm state, which will give you information about the current state of your program. You can also run a call trace with call returns on your callback module, e.g. (simple tty trace from the shell): dbg:tracer(). dbg:tp(myCallback, '_', '_', [{'_',[],[{message,{return_trace}}]}]). dbg:p(all, [c]). /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Joel Reymont > Sent: den 22 april 2005 10:25 > To: Erlang Users' List > Subject: Obtaining the current state of the gen_fsm > > > Folks, > > How would you suggest debugging a gen_fsm as a whole? > > I understand that I can invoke each state fun and see what the return > value is but this seems suboptimal at times. > > Is there a way to obtain the internal state of the FSM? Then > I can have a > general all-FSM event to return internal state /used for debugging > purposes/ and my tests could check the current state of the FSM before > the test and after. > > Thanks, Joel > > -- > http://wagerlabs.com/tech > > > From ingela@REDACTED Fri Apr 22 11:00:12 2005 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 22 Apr 2005 11:00:12 +0200 Subject: try syntax in Emacs References: <16998.31670.509054.23679@gargle.gargle.HOWL> <20050422093147.1751@smtp.gmail.com> Message-ID: <17000.48412.5876.363122@gargle.gargle.HOWL> Joel Reymont wrote: > Hi Ingela! > > >The latest version does, however it does not really work as expected > >for all possible constructs of try and catch. > > Apologies for the dumb question but where is the latest version and > what's the version number? It is in the tools application under the emacs directory. There is also a man page for the erlang mode and some information in the users guide for the tools application. The latest version of the emacs-mode is 2.5.2, alas the emacs mode version is hardcoded in the emacs mode file and it has happened the we forget to update it (there is room for improvement here ;)). But if you have tools version 2.4 or later you should be ok! Man page: http://www.erlang.se/doc/doc-5.4.3/lib/tools-2.4/doc/html/index.html Users guide: http://www.erlang.se/doc/doc-5.4.3/lib/tools-2.4/doc/html/part_frame.html -- /Ingela - OTP team From joelr1@REDACTED Fri Apr 22 12:34:35 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Apr 2005 13:34:35 +0300 Subject: New API for exception handling Message-ID: <20050422113435.19634@smtp.gmail.com> Folks, Where's the paper that Vance is referring to? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Fri Apr 22 12:37:01 2005 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 22 Apr 2005 13:37:01 +0300 Subject: New API for exception handling In-Reply-To: <20050422113435.19634@smtp.gmail.com> References: <20050422113435.19634@smtp.gmail.com> Message-ID: <20050422113701.2995@smtp.gmail.com> Found it here after some proper googling: Thanks, Joel -- http://wagerlabs.com/tech From serge@REDACTED Fri Apr 22 16:05:23 2005 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 22 Apr 2005 10:05:23 -0400 Subject: node startup crash Message-ID: <426904A3.6010602@hq.idt.net> Hi, I upgraded Erlang on one of our Linux servers to R10B-4, and started getting this error at startup. This problem wasn't observed before the upgrade. >erl -sname a {error_logger,{{2005,4,21},{21,30,39}},'Protocol: ~p: register error: ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,a,35269},15000]}}]} {error_logger,{{2005,4,21},{21,30,39}},crash_report,[[{pid,<0.18.0>},{registered_name,net_kernel},{error_info,{error,badarg}},{initial_call,{gen,init_it,[gen_server,<0.15.0>,<0.15.0>,{local,net_kernel},net_kernel,{a,longnames,15000},[]]}},{ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[#Port<0.6>,<0.15.0>]},{dictionary,[{longnames,true}]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,21},{reductions,373}],[]]} {error_logger,{{2005,4,21},{21,30,39}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[[a,longnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2005,4,21},{21,30,39}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2005,4,21},{21,30,39}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,old_file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,hipe_unified_loader,hipe_sparc_loader,hipe_ppc_loader,hipe_x86_loader,hipe_amd64_loader,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_ config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,21},{reductions,101}],[]]} {error_logger,{{2005,4,21},{21,30,39}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,shutdown} Kernel pid terminated (application_controller) (shutdown) --- epmd seems to be running ok: ~>ps -aux | grep epmd serge 26268 0.0 0.0 1932 660 ? S 17:16 0:00 /home/serge/erl/erts-5.4.5/bin/epmd -daemon Netstat (netstat -a | grep 35269) doesn't show port 35269 being taken. I ran strace on this machine and on another machine that doesn't exhibit this error, and saved the output to out_bad.txt and out_good.txt respectively (cutting everything before and after the problem spot): strace erl -sname a 2> out_bad.txt Could anyone suggest the cause of this error? Thanks. Serge -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: out_bad.txt URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: out_good.txt URL: From vances@REDACTED Fri Apr 22 16:14:42 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 22 Apr 2005 10:14:42 -0400 Subject: variable as function name In-Reply-To: References: <20050420201402.GB259@blank.motivity.ca> Message-ID: <20050422141442.GG259@blank.motivity.ca> On Thu, Apr 21, 2005 at 08:48:22AM +0200, Raimo Niskanen wrote: } } [...] Quite some gurus claim {M,F} funs are a bad, bad thing } and should be exterminated ASAP. I note that there are lots of them used in the current OTP. -Vance From bengt.kleberg@REDACTED Fri Apr 22 16:17:54 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 22 Apr 2005 16:17:54 +0200 Subject: variable as function name In-Reply-To: <20050422141442.GG259@blank.motivity.ca> References: <20050420201402.GB259@blank.motivity.ca> <20050422141442.GG259@blank.motivity.ca> Message-ID: <42690792.5020701@ericsson.com> Vance Shipley wrote: > On Thu, Apr 21, 2005 at 08:48:22AM +0200, Raimo Niskanen wrote: > } > } [...] Quite some gurus claim {M,F} funs are a bad, bad thing > } and should be exterminated ASAP. > > I note that there are lots of them used in the current OTP. was that not due to ''real'' funs beeing a new addition to the language? in the bad old days {M,F} funs where the only solution. iirc. bengt From vances@REDACTED Fri Apr 22 18:31:12 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 22 Apr 2005 12:31:12 -0400 Subject: Big state machines In-Reply-To: <20050419174148.GD4594@blank.motivity.ca> References: <20050419174148.GD4594@blank.motivity.ca> Message-ID: <20050422163112.GJ259@blank.motivity.ca> Ulf, Having read your paper "Programming Models for Concurrency"(*) I think you have won me over to the pure erlang side. I have some FSMs which require SDL saves and are pretty ugly in gen_fsm. Having selective receives will really simplify things for me. However I'm not convinced that plain_fsm is solving the problem the way I want it solved. In your plain_fsm documentation you say: "... figure out where you really want to handle system messages. Normally, it will suffice to do it in a fairly stable state." In one of your examples you didn't handle system messages while in the transient states waiting for a reply. Is that a good idea? This suggests that the coder should have control over how system messages are processed. Given that I want to do my own receiving, so that I can do so selectively, it seems to me that I want to manage how the system events appear in the receives. So I wrote a behaviour module which uses some of the gen_fsm API but takes out the main loop. I built macros to make the handling of system messages a little less verbose so that the real code is more of a focus. I think I quite like this. The new sdl_fsm looks like this: -module(sdl_fsm). -export([init/1, terminate/4, code_change/4]). -export([s/2, y/2, x/2]). -include("sys_fsm.hrl"). -record(state, {}). init(_Args) -> process_flag(trap_exit, true), {ok, s, #state{}}. %% ___ %% (_s_) %% | %% +--+--+ %% __|_ __|_ %% >_a_| >_b_| %% _|_ _|_ %% (_x_) (_y_) %% s(SysData, StateData) -> receive ?SYSTEM(s, SysData, StateData); ?EXIT(s, SysData, StateData); a -> ?DEBUG(a, s, SysData, StateData), x(SysData, StateData); b -> ?DEBUG(b, s, SysData, StateData), y(SysData, StateData); Msg -> ?DEBUG(Msg, s, SysData, StateData), s(SysData, StateData) end. %% ___ %% (_x_) %% | %% +-----+------+ %% __|_ __|_ __|_ %% >_a_| >_b_| /_*_/ %% _|_ _|_ %% (_x_) (_y_) %% x(SysData, StateData) -> receive ?SYSTEM(x, SysData, StateData); ?EXIT(x, SysData, StateData); a -> ?DEBUG(a, x, SysData, StateData), x(SysData, StateData); b -> ?DEBUG(b, x, SysData, StateData), y(SysData, StateData) end. %% ___ %% (_y_) %% | %% +-----+------+-----+ %% __|_ __|_ __|_ __|_ %% >_a_| >_b_| /_c_/ /_d_/ %% _|_ _|_ %% (_x_) (_y_) %% y(SysData, StateData) -> receive ?SYSTEM(y, SysData, StateData); ?EXIT(y, SysData, StateData); a -> ?DEBUG(a, y, SysData, StateData), x(SysData, StateData); b -> ?DEBUG(b, y, SysData, StateData), y(SysData, StateData); Msg when Msg /= c, Msg /= d -> ?DEBUG(Msg, y, SysData, StateData), y(SysData, StateData) end. %% %% sys_fsm callbacks %% terminate(_Reason, _StateName, _SysData, _StateData) -> ok. code_change(_OldVsn, StateName, StateData, _Extra) -> {ok, StateName, StateData}. -------------- next part -------------- -record(sys, {parent, name, debug}). -define(SYSTEM(StateName, SysData, StateData), {system, From, Msg} -> sys:handle_system_msg(Msg, From, SysData#sys.parent, sys_fsm, SysData#sys.debug, [?MODULE, StateName, SysData, StateData])). -define(EXIT(StateName, SysData, StateData), {'EXIT', Parent, Reason} = Msg when Parent == SysData#sys.parent -> gen_fsm:terminate(Reason, SysData#sys.name, Msg, ?MODULE, StateName, StateData, SysData#sys.debug)). -define(DEBUG(Msg, StateName, SysData, StateData), case SysData#sys.debug of [] -> ok; Debug -> sys:handle_debug(Debug, fun(Device, Event, Extra) -> gen_fsm:print_event(Device, Event, Extra) end, {SysData#sys.name, StateName}, {in, Msg}) end). -------------- next part -------------- %%% sys_fsm.erl %%% %%% Behaviour module for an FSM process which receives messages %%% directly. Much of this module is ruthlessly culled from gen_fsm. %%% -module(sys_fsm). %% API -export([start/3, start_link/3, start/4, start_link/4, format_status/2]). -export([behaviour_info/1]). %% internal -export([init_it/6]). %% sys callbacks -export([system_continue/3, system_terminate/4, system_code_change/4]). -include("sys_fsm.hrl"). behaviour_info(callbacks) -> [{init,1}, {terminate,3},{code_change,4}]; behaviour_info(_Other) -> undefined. %% the start functions have the same syntax as gen_fsm start(Mod, Args, Options) -> gen:start(?MODULE, nolink, Mod, Args, Options). start(Name, Mod, Args, Options) -> gen:start(?MODULE, nolink, Name, Mod, Args, Options). start_link(Mod, Args, Options) -> gen:start(?MODULE, link, Mod, Args, Options). start_link(Name, Mod, Args, Options) -> gen:start(?MODULE, link, Name, Mod, Args, Options). %% the user's init/1 callback has the same results as %% gen_fsm's but without the timeout option. init_it(Starter, self, Name, Mod, Args, Options) -> init_it(Starter, self(), Name, Mod, Args, Options); init_it(Starter, Parent, Name, Mod, Args, Options) -> Debug = gen:debug_options(Options), SysData = #sys{parent = Parent, name = Name, debug = Debug}, case catch Mod:init(Args) of {ok, StateName, StateData} -> proc_lib:init_ack(Starter, {ok, self()}), Mod:StateName(SysData, StateData); {stop, Reason} -> proc_lib:init_ack(Starter, {error, Reason}), exit(Reason); ignore -> proc_lib:init_ack(Starter, ignore), exit(normal); {'EXIT', Reason} -> proc_lib:init_ack(Starter, {error, Reason}), exit(Reason); Else -> Error = {bad_return_value, Else}, proc_lib:init_ack(Starter, {error, Error}), exit(Error) end. %% %% callbacks for system messages %% system_continue(_Parent, Debug, [Module, StateName, SysData, StateData]) -> Module:StateName(SysData#sys{debug = Debug}, StateData). system_terminate(Reason, _Parent, Debug, [Module, StateName, SysData, StateData]) -> gen_fsm:terminate(Reason, SysData#sys.name, [], Module, StateName, StateData, Debug). system_code_change([Module, StateName, SysData, StateData], Module, OldVsn, Extra) -> case catch Module:code_change(OldVsn, StateName, StateData, Extra) of {ok, NewStateName, NewStateData} -> {ok, [Module, NewStateName, SysData, NewStateData]}; Else -> Else end. format_status(Opt, StatusData) -> [PDict, SysState, Parent, Debug, Misc] = StatusData, [Module, StateName, SysData, StateData] = Misc, GenFsmMisc = [SysData#sys.name, StateName, StateData, Module, 0], gen_fsm:format_status(Opt, [PDict, SysState, Parent, Debug, GenFsmMisc]). From serge@REDACTED Fri Apr 22 21:43:14 2005 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 22 Apr 2005 15:43:14 -0400 Subject: distributed performance test In-Reply-To: <42681377.7020803@hq.idt.net> References: <42681377.7020803@hq.idt.net> Message-ID: <426953D2.9060905@hq.idt.net> I managed to reduce this problem to a very plain implementation illustrated in the attached test_server and test_client modules. I configured three nodes, and conducted the following tests. Note: performance is measured in number of calls per second _of each client_. CLIENT SERVER THREADS PERFORMANCE (Calls/sec) ====== ====== ======= ======================= n2@REDACTED n2@REDACTED 1 238095 n2@REDACTED n2@REDACTED 5 43478 n1@REDACTED n2@REDACTED 1 2364 n1@REDACTED n2@REDACTED 5 71 !!! Why? n2@REDACTED n1@REDACTED 1 4201 n2@REDACTED n1@REDACTED 5 55 !!! Why? n1@REDACTED n3@REDACTED 1 164 !!! Why? n1@REDACTED n3@REDACTED 5 3095 n3@REDACTED n1@REDACTED 1 4629 n3@REDACTED n1@REDACTED 5 2808 Ping shows that there's no packet loss between nodes, and the roundtrip times on all servers are around 0.150 ms. I am truly stumbled by this measurements. Can anyone give an advice on how to determine the cause of this performance drop? Thanks. Serge Serge Aleynikov wrote: > Gentlemen, > > I'd like to ask for your advice on how to troubleshoot a problem related > to a severe performance drop of a gen_server:call() between a client and > a server running on different hosts. > > The server is implementing a gen_server behavior, and a client's code is > shown below. > > I've set up two nodes on different servers. I use a test function > drp_client:test_async(ConcurrentClients, TimesToRunPerClient) for stress > testing. The function uses spawn/3 to create concurrent processes, > where each one calls the drp_client:do_request/2 shown below. > > When I call the server from the same node, the performance is: > - for a single client: 9434 calls/s > - for two clients....: 8771 calls/s (~ 4400 call/s per client) > > (drp@REDACTED)6> drp_client:test_async(1, 1000). > Client 1 done. AvgTime=0.000 (9433.962 c/s) > (drp@REDACTED)7> drp_client:test_async(2, 1000). > Client 2 done. AvgTime=0.000 (4405.286 c/s) > Client 1 done. AvgTime=0.000 (4366.812 c/s) > > ---- > > When I call the server from a different host/node, the performance is: > - for a single client: 2538 calls/s > - for two clients....: 30 calls/s (~ 15 call/s per client) <--- !!! > > (n1@REDACTED)9> drp_client:test_async(1, 1000). > Client 1 done. AvgTime=0.000 (2538.071 c/s) > (n1@REDACTED)10> drp_client:test_async(2, 100). > Client 2 done. AvgTime=0.067 (15.020 c/s) > Client 1 done. AvgTime=0.067 (15.017 c/s) > > For some reason we observe a significant performance drop in case of > multiple clients issuing calls from a distributed node. > > I tried to profile clients running on drp@REDACTED (local) and > n1@REDACTED (remote) nodes, but results are very similar. > > Now - the exciting part. When I try to use the coverage tool on the > server, and just compile a few modules using cover:compile_module/1, the > invocation of clients on the remote node yields expected performance: > > (drp@REDACTED)2> cover:start(). > {ok,<0.115.0>} > (drp@REDACTED)3> lists:foreach(fun(M) -> cover:compile_module(M) > end, [drp_proto, drp_router, drp_server]). > ok > > (n1@REDACTED)24> drp_client:test_async(2, 500). > Client 2 done. AvgTime=0.001 (1483.680 c/s) > Client 1 done. AvgTime=0.001 (1457.726 c/s) > > So, the two questions are: > > 1. What can cause such a significant performance drop in case of > multiple concurrent clients accessing the server? > > 2. Why would conver:compile_module/1 eliminate this performance drop. > > Your advice would be highly appreciated. > > Regards, > > Serge > > > > drp_client: > =========== > do_request(Args, Timeout) -> > case get_server_pid() of > {ok, Pid} -> > case catch gen_server:call(Pid, Args, Timeout) of > {ok, From, Response} -> > {ok, From, Response}; > {error, Reason} -> > {error, Reason}; > {'EXIT', {noproc, _Reason}} -> > {error, server_not_running}; > {'EXIT', Reason} -> > {error, Reason} > end; > {error, Reason} -> > {error, Reason} > end. > > get_server_pid() -> > case pg2:get_closest_pid(?MODULE) of > Pid when is_pid(Pid) -> > {ok, Pid}; > {error, {no_process, _}} -> > {error, no_process} > end. > > > > ------------------------------------------------------------------------ > > %% Analysis results: > { analysis_options, > [{callers, false}, > {sort, acc}, > {totals, false}, > {details, true}]}. > > % CNT ACC OWN > [{ totals, 49, 0.403, 0.395}]. %%% > > > % CNT ACC OWN > [{ "<0.52.0>", 11,undefined, 0.176}]. %% > > { {fprof,apply_start_stop,4}, 0, 0.403, 0.035}. > { suspend, 1, 0.227, 0.000}. > { {drp_client,test_async,2}, 1, 0.141, 0.021}. > { {drp_client,test_async,3}, 3, 0.071, 0.025}. > { {erlang,spawn_link,3}, 2, 0.046, 0.046}. > { garbage_collect, 1, 0.025, 0.025}. > { {pg2,start,0}, 1, 0.024, 0.007}. > { {pg2,ensure_started,0}, 1, 0.017, 0.010}. > { {erlang,whereis,1}, 1, 0.007, 0.007}. > { undefined, 0, 0.000, 0.000}. > > % CNT ACC OWN > [{ "<0.55.0>", 19,undefined, 0.118}, %% > { spawned_by, "<0.52.0>"}, > { spawned_as, {drp_client,do_test, > [2, > 500, > {"12345","LNX-US","01170952831122",[],"123"}]}}, > { initial_calls, [{drp_client,do_test,3},{drp_client,test,2}]}]. > > { {drp_client,do_test,3}, 1, 0.284, 0.010}. > { {drp_client,test,2}, 1, 0.213, 0.014}. > { {drp_client,test2,3}, 1, 0.166, 0.006}. > { suspend, 2, 0.166, 0.000}. > { {drp_client,'-test/2-fun-0-',5}, 1, 0.160, 0.005}. > { {drp_client,get_route,5}, 1, 0.155, 0.005}. > { {drp_client,measure_time,2}, 1, 0.150, 0.008}. > { {error_handler,undefined_function,3}, 1, 0.142, 0.006}. > { {error_handler,ensure_loaded,1}, 1, 0.136, 0.010}. > { {code,ensure_loaded,1}, 1, 0.122, 0.005}. > { {code,call,1}, 1, 0.117, 0.005}. > { {code_server,call,3}, 1, 0.112, 0.007}. > { {pg2,start,0}, 1, 0.017, 0.004}. > { {dict,new,0}, 1, 0.016, 0.010}. > { {pg2,ensure_started,0}, 1, 0.013, 0.009}. > { {erlang,whereis,1}, 2, 0.008, 0.008}. > { {dict,mk_seg,1}, 1, 0.006, 0.006}. > { undefined, 0, 0.000, 0.000}. > > % CNT ACC OWN > [{ "<0.56.0>", 19,undefined, 0.101}, %% > { spawned_by, "<0.52.0>"}, > { spawned_as, {drp_client,do_test, > [1, > 500, > {"12345","LNX-US","01170952831122",[],"123"}]}}, > { initial_calls, [{drp_client,do_test,3},{drp_client,test,2}]}]. > > { {drp_client,do_test,3}, 1, 0.251, 0.008}. > { suspend, 2, 0.150, 0.000}. > { {drp_client,test,2}, 1, 0.093, 0.013}. > { {drp_client,test2,3}, 1, 0.050, 0.004}. > { {drp_client,'-test/2-fun-0-',5}, 1, 0.046, 0.005}. > { {drp_client,get_route,5}, 1, 0.041, 0.005}. > { {drp_client,measure_time,2}, 1, 0.036, 0.004}. > { {error_handler,undefined_function,3}, 1, 0.032, 0.005}. > { {error_handler,ensure_loaded,1}, 1, 0.027, 0.008}. > { {pg2,start,0}, 1, 0.017, 0.004}. > { {code,ensure_loaded,1}, 1, 0.014, 0.004}. > { {pg2,ensure_started,0}, 1, 0.013, 0.009}. > { {dict,new,0}, 1, 0.013, 0.009}. > { {code,call,1}, 1, 0.010, 0.004}. > { {erlang,whereis,1}, 2, 0.009, 0.009}. > { {code_server,call,3}, 1, 0.006, 0.006}. > { {dict,mk_seg,1}, 1, 0.004, 0.004}. > { undefined, 0, 0.000, 0.000}. > > > > ------------------------------------------------------------------------ > > %% Analysis results: > { analysis_options, > [{callers, false}, > {sort, acc}, > {totals, false}, > {details, true}]}. > > % CNT ACC OWN > [{ totals, 56, 1.748, 0.417}]. %%% > > > % CNT ACC OWN > [{ "<0.93.0>", 18,undefined, 0.214}]. %% > > { {fprof,apply_start_stop,4}, 0, 1.748, 0.035}. > { suspend, 2, 1.534, 0.000}. > { {error_handler,undefined_function,3}, 1, 1.503, 0.023}. > { {error_handler,ensure_loaded,1}, 1, 1.377, 0.011}. > { {code,ensure_loaded,1}, 1, 1.358, 0.005}. > { {code,call,1}, 1, 1.353, 0.005}. > { {code_server,call,3}, 1, 1.348, 0.024}. > { {drp_client,test_async,2}, 1, 0.097, 0.012}. > { {drp_client,test_async,3}, 3, 0.065, 0.023}. > { {erlang,spawn_link,3}, 2, 0.042, 0.042}. > { {pg2,start,0}, 1, 0.020, 0.005}. > { {pg2,ensure_started,0}, 1, 0.015, 0.009}. > { {erlang,whereis,1}, 2, 0.014, 0.014}. > { {erlang,function_exported,3}, 1, 0.006, 0.006}. > { undefined, 0, 0.000, 0.000}. > > % CNT ACC OWN > [{ "<0.107.0>", 19,undefined, 0.107}, %% > { spawned_by, "<0.93.0>"}, > { spawned_as, {drp_client,do_test, > [2, > 500, > {"12345","LNX-US","01170952831122",[],"123"}]}}, > { initial_calls, [{drp_client,do_test,3},{drp_client,test,2}]}]. > > { {drp_client,do_test,3}, 1, 0.262, 0.009}. > { {drp_client,test,2}, 1, 0.197, 0.014}. > { suspend, 2, 0.155, 0.000}. > { {drp_client,test2,3}, 1, 0.153, 0.006}. > { {drp_client,'-test/2-fun-0-',5}, 1, 0.147, 0.004}. > { {drp_client,get_route,5}, 1, 0.143, 0.005}. > { {drp_client,measure_time,2}, 1, 0.138, 0.005}. > { {error_handler,undefined_function,3}, 1, 0.133, 0.005}. > { {error_handler,ensure_loaded,1}, 1, 0.128, 0.009}. > { {code,ensure_loaded,1}, 1, 0.114, 0.005}. > { {code,call,1}, 1, 0.109, 0.004}. > { {code_server,call,3}, 1, 0.105, 0.006}. > { {pg2,start,0}, 1, 0.016, 0.004}. > { {dict,new,0}, 1, 0.014, 0.009}. > { {pg2,ensure_started,0}, 1, 0.012, 0.007}. > { {erlang,whereis,1}, 2, 0.010, 0.010}. > { {dict,mk_seg,1}, 1, 0.005, 0.005}. > { undefined, 0, 0.000, 0.000}. > > % CNT ACC OWN > [{ "<0.108.0>", 19,undefined, 0.096}, %% > { spawned_by, "<0.93.0>"}, > { spawned_as, {drp_client,do_test, > [1, > 500, > {"12345","LNX-US","01170952831122",[],"123"}]}}, > { initial_calls, [{drp_client,do_test,3},{drp_client,test,2}]}]. > > { {drp_client,do_test,3}, 1, 0.232, 0.009}. > { suspend, 2, 0.136, 0.000}. > { {drp_client,test,2}, 1, 0.087, 0.011}. > { {drp_client,test2,3}, 1, 0.047, 0.005}. > { {drp_client,'-test/2-fun-0-',5}, 1, 0.042, 0.004}. > { {drp_client,get_route,5}, 1, 0.038, 0.004}. > { {drp_client,measure_time,2}, 1, 0.034, 0.005}. > { {error_handler,undefined_function,3}, 1, 0.029, 0.004}. > { {error_handler,ensure_loaded,1}, 1, 0.025, 0.007}. > { {pg2,start,0}, 1, 0.016, 0.004}. > { {dict,new,0}, 1, 0.013, 0.009}. > { {code,ensure_loaded,1}, 1, 0.013, 0.005}. > { {pg2,ensure_started,0}, 1, 0.012, 0.008}. > { {erlang,whereis,1}, 2, 0.009, 0.009}. > { {code,call,1}, 1, 0.008, 0.004}. > { {dict,mk_seg,1}, 1, 0.004, 0.004}. > { {code_server,call,3}, 1, 0.004, 0.004}. > { undefined, 0, 0.000, 0.000}. > -- ================================================================ | Serge Aleynikov Tel: (973) 438-3436 | MIS Telecom Fax: (973) 438-1457 | IDT Corp. serge@REDACTED ================================================================ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_server.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_client.erl URL: From ulf@REDACTED Fri Apr 22 22:09:49 2005 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 22 Apr 2005 22:09:49 +0200 Subject: Big state machines In-Reply-To: <20050422163112.GJ259@blank.motivity.ca> References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> Message-ID: Den 2005-04-22 18:31:12 skrev Vance Shipley : > Having read your paper "Programming Models for Concurrency"(*) > I think you have won me over to the pure erlang side. I have > some FSMs which require SDL saves and are pretty ugly in gen_fsm. > Having selective receives will really simplify things for me. That's great. > However I'm not convinced that plain_fsm is solving the problem > the way I want it solved. That's ok. (: > In your plain_fsm documentation you say: > > "... figure out where you really want to handle system messages. > Normally, it will suffice to do it in a fairly stable state." > > In one of your examples you didn't handle system messages while > in the transient states waiting for a reply. Is that a good idea? I think this is somewhat analogous to having a gen_fsm that performs a gen_server:call() in one of its callbacks. While in the gen:await_reply() function (/sub-state), the process will not respond to system messages. This is ok, as long as it's a timeout-guarded dialogue, and the process will eventually come out of it. [...] > So I wrote a behaviour module which uses some of the gen_fsm API > but takes out the main loop. I built macros to make the handling > of system messages a little less verbose so that the real code is > more of a focus. I think I quite like this. It looks quite nice. The plain_fsm approach was a little bit more extreme in trying minimize the amount of typing needed (and the chances to mess things up...;) I'm not entirely convinced that it was worth it. One of the ways to go wrong is to forget the ?EXIT() part, which could lead to hanging processes during shutdown (normally, they are killed after a while.) It's probably a good idea to always have the ?SYSTEM and ?EXIT macros present, and writing it symmetrically like you've done. Then, of course, one could discuss whether they need to be two separate macros, but OTOH that might serve to clarify what's happening. /Uffe > > The new sdl_fsm looks like this: > > -module(sdl_fsm). > -export([init/1, terminate/4, code_change/4]). > -export([s/2, y/2, x/2]). > > -include("sys_fsm.hrl"). > > -record(state, {}). > > init(_Args) -> > process_flag(trap_exit, true), > {ok, s, #state{}}. > > %% ___ > %% (_s_) > %% | > %% +--+--+ > %% __|_ __|_ > %% >_a_| >_b_| > %% _|_ _|_ > %% (_x_) (_y_) > %% > s(SysData, StateData) -> > receive > ?SYSTEM(s, SysData, StateData); > ?EXIT(s, SysData, StateData); > a -> > ?DEBUG(a, s, SysData, StateData), > x(SysData, StateData); > b -> > ?DEBUG(b, s, SysData, StateData), > y(SysData, StateData); > Msg -> > ?DEBUG(Msg, s, SysData, StateData), > s(SysData, StateData) > end. > > %% ___ > %% (_x_) > %% | > %% +-----+------+ > %% __|_ __|_ __|_ > %% >_a_| >_b_| /_*_/ > %% _|_ _|_ > %% (_x_) (_y_) > %% > x(SysData, StateData) -> > receive > ?SYSTEM(x, SysData, StateData); > ?EXIT(x, SysData, StateData); > a -> > ?DEBUG(a, x, SysData, StateData), > x(SysData, StateData); > b -> > ?DEBUG(b, x, SysData, StateData), > y(SysData, StateData) > end. > > %% ___ > %% (_y_) > %% | > %% +-----+------+-----+ > %% __|_ __|_ __|_ __|_ > %% >_a_| >_b_| /_c_/ /_d_/ > %% _|_ _|_ > %% (_x_) (_y_) > %% > y(SysData, StateData) -> > receive > ?SYSTEM(y, SysData, StateData); > ?EXIT(y, SysData, StateData); > a -> > ?DEBUG(a, y, SysData, StateData), > x(SysData, StateData); > b -> > ?DEBUG(b, y, SysData, StateData), > y(SysData, StateData); > Msg when Msg /= c, Msg /= d -> > ?DEBUG(Msg, y, SysData, StateData), > y(SysData, StateData) > end. > > > %% > %% sys_fsm callbacks > %% > terminate(_Reason, _StateName, _SysData, _StateData) -> ok. > > code_change(_OldVsn, StateName, StateData, _Extra) -> > {ok, StateName, StateData}. > > From vances@REDACTED Sat Apr 23 00:16:52 2005 From: vances@REDACTED (Vance Shipley) Date: Fri, 22 Apr 2005 18:16:52 -0400 Subject: Big state machines In-Reply-To: References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> Message-ID: <20050422221652.GL259@blank.motivity.ca> On Fri, Apr 22, 2005 at 10:09:49PM +0200, Ulf Wiger wrote: } } I think this is somewhat analogous to having a gen_fsm that } performs a gen_server:call() in one of its callbacks. But is that desired functionality? I'm thinking not. On the other hand with my method you can have it that way if you wish. } It's probably a good idea to always have the ?SYSTEM } and ?EXIT macros present, and writing it symmetrically } like you've done. Then, of course, one could discuss } whether they need to be two separate macros, but } OTOH that might serve to clarify what's happening. My thinking was that instead of hiding the system messages I wanted the coder to think about how these messages should be handled. It might be that you wanted to defer EXIT processing briefly for instance but still handle system messages. -Vance From ulf@REDACTED Sat Apr 23 08:50:47 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 23 Apr 2005 08:50:47 +0200 Subject: Big state machines In-Reply-To: <20050422221652.GL259@blank.motivity.ca> References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> <20050422221652.GL259@blank.motivity.ca> Message-ID: Den 2005-04-23 00:16:52 skrev Vance Shipley : > On Fri, Apr 22, 2005 at 10:09:49PM +0200, Ulf Wiger wrote: > } > } I think this is somewhat analogous to having a gen_fsm that > } performs a gen_server:call() in one of its callbacks. > > But is that desired functionality? I'm thinking not. > On the other hand with my method you can have it that > way if you wish. Also with plain_fsm, with the limitation that it required the function to have only one argument: the state. Perhaps this had more to do with my inability to write a sufficiently flexible parse_transform... (: > } It's probably a good idea to always have the ?SYSTEM > } and ?EXIT macros present, and writing it symmetrically > } like you've done. Then, of course, one could discuss > } whether they need to be two separate macros, but > } OTOH that might serve to clarify what's happening. > > My thinking was that instead of hiding the system messages I > wanted the coder to think about how these messages should be > handled. It might be that you wanted to defer EXIT processing > briefly for instance but still handle system messages. Being explicit certainly has its advantages. I think the main benefit of plain_fsm might be that it can also serve as a library for people who want to handle system messages explicitly - much like your sysFsm. Was there anything missing in the plain_fsm utility functions that made you write your own library? Or was it perhaps because I hadn't documented the option of skipping the parse transform and writing more or less the way you did? BTW, I have a version of plain_fsm that also does some really bizarre stuff with erlang:hibernate/3. Basically, it bootstraps itself to new code using a code_change function as soon as the next message comes in. It's been lying around since I ran into problems with the parse transform. But if you want to do without the transform, it should be perfectly useable as it is. I could send it to you if you want to play with it. Regards, Uffe From ulf@REDACTED Sat Apr 23 11:16:21 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 23 Apr 2005 11:16:21 +0200 Subject: Big state machines In-Reply-To: References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> <20050422221652.GL259@blank.motivity.ca> Message-ID: Den 2005-04-23 08:50:47 skrev Ulf Wiger : > Or was it perhaps because I hadn't > documented the option of skipping the parse transform and > writing more or less the way you did? Hmm, re-reading the plain_fsm documentation, I see that this wasn't entirely correct: "In the states where you want to handle system messages, you have two choices: (A) Insert the system messages in the receive clause: idle(S) -> Parent = plain_fsm:info(parent), receive {system, From, Req} -> plain_fsm:handle_system_msg( From, Req, S, fun(S1) -> idle(S1) end); {'EXIT', Parent, Reason} -> plain_fsm:parent_EXIT(Reason, S); ... %% your original code here end. This has the advantage that everyone can understand what's going on. The part that plain_fsm.erl helps you with is the set of functions system_code_change(), system_continue(), system_shutdown(), format_status(), which are required callbacks when you handle system messages directly." (from http://www.wiger.net/uffe/erlang/plain_fsm0.4/doc/index.html) It seems as if the ?SYSTEM and ?EXIT macros should be possible to build on top of this framework as well. /Uffe From ulf@REDACTED Sat Apr 23 13:45:48 2005 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 23 Apr 2005 13:45:48 +0200 Subject: Big state machines In-Reply-To: <20050422163112.GJ259@blank.motivity.ca> References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> Message-ID: Den 2005-04-22 18:31:12 skrev Vance Shipley : > %% ___ > %% (_y_) > %% | > %% +-----+------+-----+ > %% __|_ __|_ __|_ __|_ > %% >_a_| >_b_| /_c_/ /_d_/ > %% _|_ _|_ > %% (_x_) (_y_) > %% > y(SysData, StateData) -> > receive > ?SYSTEM(y, SysData, StateData); > ?EXIT(y, SysData, StateData); > a -> > x(SysData, StateData); > b -> > y(SysData, StateData); > Msg when Msg /= c, Msg /= d -> > y(SysData, StateData) > end. What I meant to say that this is a pretty nice way of illustrating the claim that SDL and Erlang are at roughly the same abstraction level. /Uffe From david.nospam.hopwood@REDACTED Sat Apr 23 19:47:40 2005 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Sat, 23 Apr 2005 18:47:40 +0100 Subject: An ode to Erlang In-Reply-To: <20050420143701.23821@smtp.gmail.com> References: <42660EAD.3020206@lundata.se> <20050420143701.23821@smtp.gmail.com> Message-ID: <426A8A3C.3070406@blueyonder.co.uk> Joel Reymont wrote: > I think it's possible to increase the number of open descriptors per user > and per process. uname -n 10000 for example. ulimit -n 10000 -- David Hopwood From klacke@REDACTED Sat Apr 23 20:48:51 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Sat, 23 Apr 2005 20:48:51 +0200 Subject: node startup crash In-Reply-To: <426904A3.6010602@hq.idt.net> References: <426904A3.6010602@hq.idt.net> Message-ID: <20050423184851.GA2447@hyber.org> On Fri, Apr 22, 2005 at 10:05:23AM -0400, Serge Aleynikov wrote: > Hi, > > I upgraded Erlang on one of our Linux servers to R10B-4, and started > getting this error at startup. This problem wasn't observed before the > upgrade. > > >erl -sname a > {error_logger,{{2005,4,21},{21,30,39}},'Protocol: ~p: register error: > ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,a,35269},15000]}}]} > {error_logger,{{2005,4,21},{21,30,39}},crash_report, ......... One of the early Erlang slogans was: "Symolic information is always available". Somehow, that spung to my mind what I saw your higly _symbolic_ error message :-) It does though look as if there is some trouble while registering the node name with epmd. Maybe incompatible epmd vsns ??, 'killall epmd' and retry. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From serge@REDACTED Sun Apr 24 03:58:47 2005 From: serge@REDACTED (Serge Aleynikov) Date: Sat, 23 Apr 2005 21:58:47 -0400 Subject: node startup crash In-Reply-To: <20050423184851.GA2447@hyber.org> References: <426904A3.6010602@hq.idt.net> <20050423184851.GA2447@hyber.org> Message-ID: <426AFD57.5010002@hq.idt.net> Thanks for the advice, but I tried that a couple of times before submitting this posting. Then I also did: ~/otp_src_R10B-4>killall epmd beam ~/otp_src_R10B-4>rm -fr /usr/local/lib/erlang ~/otp_src_R10B-4>make install ~/otp_src_R10B-4>erl -sname abc {error_logger,{{2005,4,23},{21,41,36}},'Protocol: ~p: register error: ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,abc,35363},15000]}}]} {error_logger,{{2005,4,23},{21,41,36}},crash_report,[[{pid,<0.18.0>},{registered_name,net_kernel},{error_info,{error,badarg} ... The same crash. There's not a lot of stuff running on this host either. Below is the output of "ps -ax". We can also see that epmd was started from the right distribution (erts-5.4.5). This is somewhat annoying, as I am not sure what else can be checked in order to overcome this crash... Thank you. Serge PID TTY STAT TIME COMMAND 1 ? S 0:00 init [3] 2 ? SW 0:00 [migration/0] 3 ? SWN 0:00 [ksoftirqd/0] 4 ? SW 0:00 [migration/1] 5 ? SWN 0:00 [ksoftirqd/1] 6 ? SW 0:03 [migration/2] 7 ? SWN 0:00 [ksoftirqd/2] 8 ? SW 0:00 [migration/3] 9 ? SWN 0:00 [ksoftirqd/3] 10 ? SW< 0:00 [events/0] 11 ? SW< 0:00 [events/1] 12 ? SW< 0:00 [events/2] 13 ? SW< 0:00 [events/3] 14 ? SW< 0:00 [khelper] 15 ? SW< 0:00 [kblockd/0] 16 ? SW< 0:00 [kblockd/1] 17 ? SW< 0:00 [kblockd/2] 18 ? SW< 0:00 [kblockd/3] 53 ? SW 0:00 [kirqd] 54 ? SW 0:00 [pdflush] 55 ? SW 0:11 [pdflush] 56 ? SW 0:00 [kswapd0] 57 ? SW< 0:00 [aio/0] 58 ? SW< 0:00 [aio/1] 59 ? SW< 0:00 [aio/2] 60 ? SW< 0:00 [aio/3] 153 ? SW 0:00 [kseriod] 190 ? SW 0:00 [scsi_eh_0] 191 ? SW 0:00 [aacraid] 204 ? SW 0:18 [kjournald] 520 ? SW 0:00 [khubd] 1043 ? SW 0:00 [kjournald] 1044 ? SW 0:00 [kjournald] 1045 ? SW 0:06 [kjournald] 1463 ? S 0:00 syslogd -m 0 1467 ? S 0:00 klogd -x 1859 ? S 0:02 /usr/sbin/sshd 1884 ? S 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid 1947 ? S 0:00 crond 2010 ? S 0:00 proftpd: (accepting connections) 2017 tty1 S 0:00 /sbin/mingetty tty1 2018 tty2 S 0:00 /sbin/mingetty tty2 2019 tty3 S 0:00 /sbin/mingetty tty3 2020 tty4 S 0:00 /sbin/mingetty tty4 2021 tty5 S 0:00 /sbin/mingetty tty5 2022 tty6 S 0:00 /sbin/mingetty tty6 11707 ? S 0:00 sshd: serge [priv] 11709 ? S 0:01 sshd: serge@REDACTED/1 11710 pts/1 S 0:01 -bash 31265 pts/1 S 0:00 rxvt -sr -fg white -bg black -fn Clean -sl 300 31266 pts/0 S 0:00 bash 27564 ? S 0:00 /usr/local/lib/erlang/erts-5.4.5/bin/epmd -daemon 27557 pts/0 R 0:00 ps -ax klacke@REDACTED wrote: > On Fri, Apr 22, 2005 at 10:05:23AM -0400, Serge Aleynikov wrote: > >>Hi, >> >>I upgraded Erlang on one of our Linux servers to R10B-4, and started >>getting this error at startup. This problem wasn't observed before the >>upgrade. >> >> >>>erl -sname a >> >>{error_logger,{{2005,4,21},{21,30,39}},'Protocol: ~p: register error: >>~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,a,35269},15000]}}]} >>{error_logger,{{2005,4,21},{21,30,39}},crash_report, > > > ......... > > One of the early Erlang slogans > was: "Symolic information is always available". > Somehow, that spung to my mind what I saw your higly _symbolic_ > error message :-) > > > It does though look as if there is some trouble while > registering the node name with epmd. > Maybe incompatible epmd vsns ??, 'killall epmd' and retry. > > > /klacke From matthias@REDACTED Sun Apr 24 21:31:15 2005 From: matthias@REDACTED (Matthias Lang) Date: Sun, 24 Apr 2005 21:31:15 +0200 Subject: distributed performance test In-Reply-To: <42681377.7020803@hq.idt.net> References: <42681377.7020803@hq.idt.net> Message-ID: <17003.62467.297431.642493@antilipe.corelatus.se> Serge Aleynikov writes: > I'd like to ask for your advice on how to troubleshoot a problem Nobody's replied, so it doesn't seem to be a problem anyone's encountered before. If you post some cut-down-but-still-compilable code then maybe some others on the list will at least be able to reproduce your results so that you know that it's not just your machine/network/OS that sucks. Matthias From matthias@REDACTED Sun Apr 24 21:49:13 2005 From: matthias@REDACTED (Matthias Lang) Date: Sun, 24 Apr 2005 21:49:13 +0200 Subject: distributed performance test In-Reply-To: <426953D2.9060905@hq.idt.net> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> Message-ID: <17003.63545.194507.244572@antilipe.corelatus.se> Ignore my previous post... The source was included in another message. I re-ran your tests on two machines and I do _not_ see the unexpected behaviour you're seeing. You reported: > CLIENT SERVER THREADS PERFORMANCE (Calls/sec) > ====== ====== ======= ======================= > n2@REDACTED n2@REDACTED 1 238095 > n2@REDACTED n2@REDACTED 5 43478 > > n1@REDACTED n2@REDACTED 1 2364 > n1@REDACTED n2@REDACTED 5 71 !!! Why? Repeating this on a PC and a laptop: CLIENT SERVER THREADS PERFORMANCE (Calls/sec) ====== ====== ======= ======================= a@REDACTED a@REDACTED 1 257997 a@REDACTED a@REDACTED 5 52714 b@REDACTED a@REDACTED 1 1193 b@REDACTED a@REDACTED 5 319 a@REDACTED b@REDACTED 1 905 a@REDACTED b@REDACTED 5 340 The machines were "mostly idle" when I ran the tests. I used R9C on both. The network between them is slow (10Mbit, hub). Ping roundtrip time is about 400us. Matthias From serge@REDACTED Mon Apr 25 02:17:40 2005 From: serge@REDACTED (Serge Aleynikov) Date: Sun, 24 Apr 2005 20:17:40 -0400 Subject: distributed performance test In-Reply-To: <17003.63545.194507.244572@antilipe.corelatus.se> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> Message-ID: <426C3724.9080406@hq.idt.net> Thanks Matthias, I'd like to also confirm that I am not getting this weird behavior on other computers, yet this particular machine (devlinuxpro2) is quite powerful: 4CPUs, 4G RAM, 100M Eithernet, 100% idle, and I am not certain on how to interpret this result. This time I am showing results of three tests: 1. A client and a server are on different nodes running on the same host (Linux). 2. A client and a server are on different nodes running on different hosts (both have Linux). 3. A client and a server are on different nodes running on different hosts with less powerful hardware (a Windows PC and a Linux server) Test# CLIENT SERVER #ofClients Calls/sec Ping(us) ===== ====== ====== ========== ========= ======== 1a n1@REDACTED n2@REDACTED 1 5714 1b n1@REDACTED n2@REDACTED 5 3067 2a n1@REDACTED n2@REDACTED 1 1727 150us/0% loss 2b n1@REDACTED n2@REDACTED 5 54 <---- !!!! 2c n3@REDACTED n1@REDACTED 1 4115 150us/0% loss 2d n3@REDACTED n1@REDACTED 5 50 <---- !!!! 3a a@REDACTED n1@REDACTED 1 842 400us/0% loss 3b a@REDACTED n1@REDACTED 5 603 and just for the sake of simmetry: 2e n2@REDACTED a@REDACTED 1 582 400us/0% loss 2f n2@REDACTED a@REDACTED 5 16 <---- !!!! So, what are the reasonable questions to ask at this point about devlinuxpro2? Since two nodes running on the same host don't express this problem, it must be due to a mulfinctioning network interface. On the other hand, why in that case, I don't see any problem when running a single client? So, assuming that something _is_ wrong with the network interface, how can such a problem be troubleshot (tcpdump dosn't show anything suspicious either)? Ideally, I'd like to be able to see some stats from the message passing layer in Erlang in order to determine the speed of packets of interest arriving to the node, but before they are dispatched to the process' mailbox. This way, I would know that the delay is in fact external to Erlang. Is there a way to get that? Thanks. Serge Matthias Lang wrote: > Ignore my previous post... The source was included in another message. > > I re-ran your tests on two machines and I do _not_ see the unexpected > behaviour you're seeing. You reported: > > > CLIENT SERVER THREADS PERFORMANCE (Calls/sec) > > ====== ====== ======= ======================= > > n2@REDACTED n2@REDACTED 1 238095 > > n2@REDACTED n2@REDACTED 5 43478 > > > > n1@REDACTED n2@REDACTED 1 2364 > > n1@REDACTED n2@REDACTED 5 71 !!! Why? > > Repeating this on a PC and a laptop: > > CLIENT SERVER THREADS PERFORMANCE (Calls/sec) > ====== ====== ======= ======================= > a@REDACTED a@REDACTED 1 257997 > a@REDACTED a@REDACTED 5 52714 > > b@REDACTED a@REDACTED 1 1193 > b@REDACTED a@REDACTED 5 319 > > a@REDACTED b@REDACTED 1 905 > a@REDACTED b@REDACTED 5 340 > > The machines were "mostly idle" when I ran the tests. I used R9C on > both. The network between them is slow (10Mbit, hub). Ping roundtrip > time is about 400us. > > Matthias > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_client.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_server.erl URL: From vances@REDACTED Mon Apr 25 07:32:55 2005 From: vances@REDACTED (Vance Shipley) Date: Mon, 25 Apr 2005 01:32:55 -0400 Subject: Big state machines In-Reply-To: References: <20050419174148.GD4594@blank.motivity.ca> <20050422163112.GJ259@blank.motivity.ca> <20050422221652.GL259@blank.motivity.ca> Message-ID: <20050425053255.GM259@blank.motivity.ca> On Sat, Apr 23, 2005 at 08:50:47AM +0200, Ulf Wiger wrote: } } Being explicit certainly has its advantages. I think the } main benefit of plain_fsm might be that it can also serve } as a library for people who want to handle system messages } explicitly - much like your sysFsm. Was there anything } missing in the plain_fsm utility functions that made you } write your own library? Or was it perhaps because I hadn't } documented the option of skipping the parse transform and } writing more or less the way you did? By the time I was finished it did occur to me that I could have used plain_fsm without the parse_transform however it wasn't clear when I started. There do remain some differences though and they all come down to the initial objectives. You wrote plain_fsm for folks coming from the Erlang book and migrating to an OTP environment. I wrote sys_fsm for the gen_fsm writer to advance to a purer use of Erlang. As such sys_fsm is more gen_fsm like, good or bad. -Vance From erlang@REDACTED Mon Apr 25 08:09:24 2005 From: erlang@REDACTED (Michael McDaniel) Date: Sun, 24 Apr 2005 23:09:24 -0700 Subject: xmerl_scan {validation, true} Message-ID: <20050425060923.GM9417@fangora.autosys.us> using this DTD... --------------------- --------------------- results in (m1@REDACTED)90> xmerl_scan:file("test.xml", [{validation,true}, {doctype_DTD, "foo.dtd"}]). 2775- fatal: {invalid_nmtoken,"%listi"} ** exited: {fatal,{{invalid_nmtoken,"%listi"},"./foo.dtd",7,20}} ** although using this one works... --------------------- --------------------- QUESTION: 1) is something incorrect with the first DTD or is it a bug in xmerl_scan using validation? thanks, ~Michael From erlang@REDACTED Mon Apr 25 10:56:57 2005 From: erlang@REDACTED (Michael Mcdaniel) Date: Mon, 25 Apr 2005 01:56:57 -0700 Subject: xmerl_lib R10B-4 Message-ID: <20050425085657.GR9417@fangora.autosys.us> I am using R10B-4 xmerl_lib:simplify_content/1 and also xmerl_lib:find_attribute/2 because i could not figure out how to do what I wanted with the externally documented functions. QUESTION: Should I be concerned about xmerl_lib funs disappearing in later releases of Erlang and breaking my application? thanks, ~Michael From sean.hinde@REDACTED Mon Apr 25 11:05:05 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 10:05:05 +0100 Subject: distributed performance test In-Reply-To: <426C3724.9080406@hq.idt.net> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> Message-ID: <7821f2705cd4b7afbc2aad9e89f83153@mac.com> Hi, We have seen such problems when networks/NICs are set up incorrectly (e.g. one end forced to 10/half duplex, the other to 100/full duplex). I suspect you will spend a very long time searching for huge delays in the message passing inside Erlang :) Sean On 25 Apr 2005, at 01:17, Serge Aleynikov wrote: > Thanks Matthias, > > I'd like to also confirm that I am not getting this weird behavior on > other computers, yet this particular machine (devlinuxpro2) is quite > powerful: 4CPUs, 4G RAM, 100M Eithernet, 100% idle, and I am not > certain on how to interpret this result. > > This time I am showing results of three tests: > 1. A client and a server are on different nodes running on the same > host (Linux). > > 2. A client and a server are on different nodes running on different > hosts (both have Linux). > > 3. A client and a server are on different nodes running on different > hosts with less powerful hardware (a Windows PC and a Linux server) > > Test# CLIENT SERVER #ofClients Calls/sec Ping(us) > ===== ====== ====== ========== ========= ======== > 1a n1@REDACTED n2@REDACTED 1 5714 > 1b n1@REDACTED n2@REDACTED 5 3067 > > 2a n1@REDACTED n2@REDACTED 1 1727 150us/0% > loss > 2b n1@REDACTED n2@REDACTED 5 54 <---- !!!! > > 2c n3@REDACTED n1@REDACTED 1 4115 150us/0% > loss > 2d n3@REDACTED n1@REDACTED 5 50 <---- !!!! > > 3a a@REDACTED n1@REDACTED 1 842 400us/0% > loss > 3b a@REDACTED n1@REDACTED 5 603 > > and just for the sake of simmetry: > > 2e n2@REDACTED a@REDACTED 1 582 400us/0% > loss > 2f n2@REDACTED a@REDACTED 5 16 <---- !!!! > > So, what are the reasonable questions to ask at this point about > devlinuxpro2? > > Since two nodes running on the same host don't express this problem, > it must be due to a mulfinctioning network interface. On the other > hand, why in that case, I don't see any problem when running a single > client? So, assuming that something _is_ wrong with the network > interface, how can such a problem be troubleshot (tcpdump dosn't show > anything suspicious either)? > > Ideally, I'd like to be able to see some stats from the message > passing layer in Erlang in order to determine the speed of packets of > interest arriving to the node, but before they are dispatched to the > process' mailbox. This way, I would know that the delay is in fact > external to Erlang. Is there a way to get that? > > Thanks. > > Serge > > > Matthias Lang wrote: > >> Ignore my previous post... The source was included in another message. >> I re-ran your tests on two machines and I do _not_ see the unexpected >> behaviour you're seeing. You reported: >> > CLIENT SERVER THREADS PERFORMANCE (Calls/sec) >> > ====== ====== ======= ======================= >> > n2@REDACTED n2@REDACTED 1 238095 >> > n2@REDACTED n2@REDACTED 5 43478 >> > > n1@REDACTED n2@REDACTED 1 2364 >> > n1@REDACTED n2@REDACTED 5 71 !!! Why? >> Repeating this on a PC and a laptop: >> CLIENT SERVER THREADS PERFORMANCE (Calls/sec) >> ====== ====== ======= ======================= >> a@REDACTED a@REDACTED 1 257997 >> a@REDACTED a@REDACTED 5 52714 >> b@REDACTED a@REDACTED 1 1193 >> b@REDACTED a@REDACTED 5 319 >> a@REDACTED b@REDACTED 1 905 >> a@REDACTED b@REDACTED 5 340 >> The machines were "mostly idle" when I ran the tests. I used R9C on >> both. The network between them is slow (10Mbit, hub). Ping roundtrip >> time is about 400us. >> Matthias > -module(test_client). > > % API > > -export([test/3]). > > % Internal > > -export([do_test/3]). > > test(Node, Parallelizm, Count) when is_integer(Count), Count > 0 -> > lists:foreach( > fun(I) -> > erlang:spawn(?MODULE, do_test, [Node, I, Count]) > end, > lists:seq(1, Parallelizm)). > > do_test(Node, Instance, Count) -> > StartTime = get_tick_count(), > {NSuccess, NFail} = do_test_repeat(Node, Count, {0, 0}), > Time = (get_tick_count() - StartTime)/1000, > Speed = if Time =/= 0.0 -> Count / Time; true -> 0.0 end, > io:format("Client ~2w done. AvgTime=~.3f (~.3f c/s), Failed=~p, > Success=~p~n", > [Instance, Time / Count, Speed, NFail, NSuccess]). > > do_test_repeat(_Node, 0, Stats) -> > Stats; > do_test_repeat(Node, I, {S, F}) -> > Stats = case test_server:ping(Node) of > ok -> {S+1, F}; > _ -> {S, F+1} > end, > do_test_repeat(Node, I-1, Stats). > > get_tick_count() -> > {A,B,C} = now(), > (A-1051) * 1000000000 + B * 1000 + C div 1000. > > -module(test_server). > -behaviour(gen_server). > > %% External exports > -export([start/0, ping/0, ping/1]). > > %% gen_server callbacks > -export([init/1, handle_call/3, handle_cast/2, > handle_info/2, terminate/2, code_change/3]). > > %% API > > start() -> > gen_server:start({local, ?MODULE}, ?MODULE, [], []). > > ping() -> > ping(node()). > > ping(Node) -> > gen_server:call({?MODULE, Node}, ping, 10000). > > %--------------------------------------------------------------------- > % Callback functions > %--------------------------------------------------------------------- > > init([]) -> > {ok, none}. > > handle_call(ping, _From, State) -> > {reply, ok, State}. > > handle_cast(Msg, State) -> > {stop, {unknown_cast, Msg}, State}. > > handle_info(_Info, State) -> > {noreply, State}. > > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > terminate(_Reason, _State) -> > ok. > From jozsef.berces@REDACTED Mon Apr 25 11:58:22 2005 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces_=28LA/ETH=29?=) Date: Mon, 25 Apr 2005 11:58:22 +0200 Subject: ASN.1 PER Unaligned Message-ID: Hi, Is there any plan to support PER unaligned variant? Thanks in advance, Jozsef From bertil@REDACTED Mon Apr 25 12:30:12 2005 From: bertil@REDACTED (Bertil Karlsson) Date: Mon, 25 Apr 2005 12:30:12 +0200 Subject: ASN.1 PER Unaligned In-Reply-To: References: Message-ID: <426CC6B4.20402@erix.ericsson.se> No it isn't. Do you think of any particular protocol, that use of unaligned PER is mandatory/prefered? /Bertil J?zsef B?rces (LA/ETH) wrote: > Hi, > > Is there any plan to support PER unaligned variant? > > Thanks in advance, > Jozsef > > From sean.hinde@REDACTED Mon Apr 25 12:40:50 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 11:40:50 +0100 Subject: distributed performance test In-Reply-To: <17004.47289.167865.238027@beladrome.corelatus.se> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> Message-ID: <2bf7dcbaec73787205df7f37cc248e58@mac.com> On 25 Apr 2005, at 10:30, Matthias Lang wrote: > Sean Hinde writes: > >> We have seen such problems when networks/NICs are set up incorrectly >> (e.g. one end forced to 10/half duplex, the other to 100/full >> duplex). > > Methinks the details have gotten messed up in your memory. That, or perhaps it was an expression of artistic licence designed to increase the impact. Clearly such flights of fancy get the drubbing they deserve on this mailing list :-) (BTW I have copied the list on your answer because this is actually quite useful information) > > There's no way you can have one end at 10Mbit and the other at 100 and > still have communication (10Mbit uses manchester coding, 100Mbit uses > something completely different). > > You're probably remembering one end forced to 100/full duplex with no > autonegotiation and other end on autonegotiate. One end then uses > 100/full and the other 100/half---the standard requires this (broken) > behaviour. Very interesting. This figures more closely with my real memory. We have seen this (I was told, by another well meaning techie) when auto-negotiation didn't "work properly" with Solaris, meaning that both ends need to be pinned to the same settings. I never dug very deeply, and the UNIX guys always needed to fix it, but it sounds like the UNIX guys were fixing a problem caused by the network guys. On reflection that sounds about right. Sean > > The clearest symptom is that the half-duplex side sees late > collisions. _Late_ collisions should never be present on an ethernet. > Up higher, you see TCP connections which have occasional low > throughput and difficulty getting started. > > I've seen this twice in the field, both times it's involved an > expensive switch and a well-meaning techie who insisted on configuring > everything for "maximum performance". From jozsef.berces@REDACTED Mon Apr 25 12:51:35 2005 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces_=28LA/ETH=29?=) Date: Mon, 25 Apr 2005 12:51:35 +0200 Subject: ASN.1 PER Unaligned Message-ID: I would need it for RRC... -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED] Sent: Monday, April 25, 2005 12:30 To: J?zsef B?rces (LA/ETH) Cc: Erlang-Questions (E-mail) Subject: Re: ASN.1 PER Unaligned No it isn't. Do you think of any particular protocol, that use of unaligned PER is mandatory/prefered? /Bertil J?zsef B?rces (LA/ETH) wrote: > Hi, > > Is there any plan to support PER unaligned variant? > > Thanks in advance, > Jozsef > > From joelr1@REDACTED Mon Apr 25 12:57:21 2005 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Apr 2005 13:57:21 +0300 Subject: gen_fsm:send_event_after Message-ID: <20050425115721.25343@smtp.gmail.com> Folks, According to the manual send_event_after does not take a reference to a gen_fsm. How does it know where to send the event when I'm using several gen_fsm for example? Thanks, Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Mon Apr 25 13:08:53 2005 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Apr 2005 14:08:53 +0300 Subject: Poker game logic with a gen_fsm stack Message-ID: <20050425120853.28370@smtp.gmail.com> Folks, I have clearly distinct stages in my poker game logic. First I need to wait for enough players to join the game, then I need to pick two players to post the blind bets, etc. I tried to stick all the stages into one big gen_fsm but that approach proved to be somewhat unwieldy. I considered selective receive suggested by Joe as well as Ulf's plain_fsm. Then I found Vance's LAPD protocol stack design at http://www.erlang.org/ml-archive/erlang-questions/200501/ msg00035.html and used it as a base for a design of my own. I hope someone will find it useful. I implement each stage as a separate gen_fsm callback module. This keeps the modules small, allows me to test them separately and reuse them for different variants of poker. The super-FSM/dispatcher interacts with the players and forwards messages to the callback modules. The dispatcher is a behavior module that simulates a gen_fsm just like in Vance's LADP mux gen_fsm. The callback modules then do -behaviour(cardgame). and use cardgame:send_event(...), etc. in place of gen_fsm:send_event(...). The dispatcher is initialized with a stack of callback modules. For example, I might pass it the wait_for_players module followed by the blinds module, the card dealing module, etc. The dispatcher saves a copy of the module list and then pops the stack to get the first module. It goes like this: init([SeatCount, Limit, Modules]) when number(SeatCount);list(Modules) -> process_flag(trap_exit, true), {Module, Args} = hd(Modules), {ok, Game} = game:start(SeatCount, Limit), case Module:init([Game|Args]) of {ok, State, Data} -> Ctx = #context { game = Game, modules = Modules, stack = Modules, state = State, data = Data }, {ok, state, Ctx}; ... Callback modules should finish with: 1. {stop, {normal, exit}, ...} Will cause the dispatcher to exit. 1. {stop, {normal, restart}, ...} Will cause the dispatcher to restart by resetting the module stack to the original list, popping the head module and initializing it. 2. {stop, {normal, Result}, ...}; This will tell the dispatcher gen_fsm to take Result and use it to kick off the next module in the stack. As per the docs gen_fsm will consider any reason other than "normal" an error. The dispatcher captures the {stop, Reason, ...} of the callback module and processes it like this: state(Event, Ctx) -> {Module, _} = hd(Ctx#context.stack), State = Ctx#context.state, case Module:State(Event, Ctx#context.data) of {next_state, NextState, NewData} -> NewCtx = Ctx#context { state = NextState, data = NewData }, {next_state, state, NewCtx}; {next_state, NextState, NewData, Timeout} -> NewCtx = Ctx#context { state = NextState, data = NewData }, {next_state, state, NewCtx, Timeout}; {stop, Reason, NewData} -> stop(Ctx, Reason, NewData); Other -> Other end. and then like this: %% stop card game stop(Ctx, {normal, exit}, Data) -> stop(Ctx, normal, Data); %% terminate current module %% and restart at the top stop(Ctx, {normal, restart}, Data) -> {Module, _} = hd(Ctx#context.stack), State = Ctx#context.state, Module:terminate({normal, restart}, State, Data), io:format("cardgame:stop/restart: Module=~w, State=~w~n", [Module, State]), start_next_module(Ctx, Ctx#context.modules, nil); %% terminate current module %% and start the next one stop(Ctx, {normal, Result}, Data) -> {Module, _} = hd(Ctx#context.stack), State = Ctx#context.state, Module:terminate({normal, restart}, State, Data), io:format("cardgame:stop/continue: got ~w~n", [Result]), start_next_module(Ctx, Ctx#context.stack, Result); %% stop cardgame stop(Ctx, Reason, Data) -> io:format("cardgame:stop: stopping with reason ~w~n", [Reason]), NewCtx = Ctx#context { data = Data }, {stop, Reason, NewCtx}. The end result of the blinds gen_fsm callback module would be a tuple of small blind, big blind and button. These woudl be used in the next module in the stack. To pass this information to the next module in the stack I use a "kick off" event like this when starting the first module: start(SeatCount, Limit, Modules) when number(SeatCount);list(Modules) -> {X, Pid} = gen_fsm:start(?MODULE, [SeatCount, Limit, Modules], []), kick_off(Pid), {X, Pid}. and I just send the event to self() (the dispatcher) when popping the next module off the stack. The event is then forwarded to the module that I just popped. Apart from implementing the game logic as a gen_fsm I also implemented a game gen_server. This server manages table seats, adds players to a game, etc. etc. The gen_server does the heavy lifting and is passed as the first argument when each module is initialized. init([SeatCount, Limit, Modules]) when number(SeatCount);list(Modules) -> process_flag(trap_exit, true), {Module, Args} = hd(Modules), {ok, Game} = game:start(SeatCount, Limit), case Module:init([Game|Args]) of To summarize, I can now mix and match various small and well-tested poker logic gen_fsms to implement different poker variants. If Game X does not need the blinds then I just don't pass the module to the dispatcher. I think the same approach can be used to implement sub-FSMs by replacing the module at the top of the stack with a different gen_fsm when appropriate. The "current" callback module could change depending on where the player is when implementing an adventure game, for example. Your comments and suggestions are welcome. Thanks, Joel -- http://wagerlabs.com/tech From sean.hinde@REDACTED Mon Apr 25 13:13:23 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 12:13:23 +0100 Subject: gen_fsm:send_event_after In-Reply-To: <20050425115721.25343@smtp.gmail.com> References: <20050425115721.25343@smtp.gmail.com> Message-ID: Hi, On 25 Apr 2005, at 11:57, Joel Reymont wrote: > Folks, > > According to the manual send_event_after does not take a reference to a > gen_fsm. How does it know where to send the event when I'm using > several > gen_fsm for example? It is designed specifically for sending events to its own gen_fsm process. There is an implicit self() in the implementation: send_event_after(Time, Event) -> erlang:start_timer(Time, self(), {'$gen_event', Event}). Sean From joelr1@REDACTED Mon Apr 25 13:19:55 2005 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Apr 2005 14:19:55 +0300 Subject: gen_fsm:send_event_after In-Reply-To: References: Message-ID: <20050425121955.1412@smtp.gmail.com> >send_event_after(Time, Event) -> > erlang:start_timer(Time, self(), {'$gen_event', Event}). Thank you Sean and Vance! Joel -- http://wagerlabs.com/tech From joelr1@REDACTED Mon Apr 25 14:23:47 2005 From: joelr1@REDACTED (Joel Reymont) Date: Mon, 25 Apr 2005 15:23:47 +0300 Subject: Dict vs. gb_trees Message-ID: <20050425132347.3439@smtp.gmail.com> Howdy! Should I use dict or gb_trees? My understanding is that dict is a hash table whereas gb_trees are... trees. Is there a significant performance difference? Thanks, Joel -- http://wagerlabs.com/tech From richardc@REDACTED Mon Apr 25 14:50:30 2005 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 25 Apr 2005 14:50:30 +0200 Subject: Dict vs. gb_trees In-Reply-To: <20050425132347.3439@smtp.gmail.com> References: <20050425132347.3439@smtp.gmail.com> Message-ID: <426CE796.6020507@csd.uu.se> Joel Reymont wrote: > Should I use dict or gb_trees? My understanding is that dict is a > hash table whereas gb_trees are... trees. Is there a significant > performance difference? If you have simple keys (integers, atoms), and the tables are not huge, the gb trees tend to be a bit faster and more lightweight, so they are particularly good when you have lots of smaller tables. If you have complex keys (strings, lists, big tuples, binaries,...), you want to use dict because of the hashing. Apart from that, the choice also depends a bit on the use pattern. However, I swapped out my benchmarks from fresh memory a long time ago. /Richard From serge@REDACTED Mon Apr 25 17:55:01 2005 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 25 Apr 2005 11:55:01 -0400 Subject: distributed performance test In-Reply-To: <2bf7dcbaec73787205df7f37cc248e58@mac.com> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> Message-ID: <426D12D5.8040406@hq.idt.net> Sean/Matthias, Thank you, thank you, thank you!!! The devlinuxpro2 Linux server was indeed running eth0 in 100BaseTX half-duplex mode. After I set the interface to full-duplex, and rebooted, the speed tests ran as expected. Regards, Serge P.S. The only question I have remaining is why would half-duplex setting not have any speed impact on a single client talking to a synchronous server, but only on multiple clients... Sean Hinde wrote: > > On 25 Apr 2005, at 10:30, Matthias Lang wrote: > >> Sean Hinde writes: >> >>> We have seen such problems when networks/NICs are set up incorrectly >>> (e.g. one end forced to 10/half duplex, the other to 100/full >>> duplex). >> >> >> Methinks the details have gotten messed up in your memory. > > > That, or perhaps it was an expression of artistic licence designed to > increase the impact. Clearly such flights of fancy get the drubbing they > deserve on this mailing list :-) > > (BTW I have copied the list on your answer because this is actually > quite useful information) > >> >> There's no way you can have one end at 10Mbit and the other at 100 and >> still have communication (10Mbit uses manchester coding, 100Mbit uses >> something completely different). >> >> You're probably remembering one end forced to 100/full duplex with no >> autonegotiation and other end on autonegotiate. One end then uses >> 100/full and the other 100/half---the standard requires this (broken) >> behaviour. > > > Very interesting. This figures more closely with my real memory. We have > seen this (I was told, by another well meaning techie) when > auto-negotiation didn't "work properly" with Solaris, meaning that both > ends need to be pinned to the same settings. I never dug very deeply, > and the UNIX guys always needed to fix it, but it sounds like the UNIX > guys were fixing a problem caused by the network guys. > > On reflection that sounds about right. > > Sean > >> >> The clearest symptom is that the half-duplex side sees late >> collisions. _Late_ collisions should never be present on an ethernet. >> Up higher, you see TCP connections which have occasional low >> throughput and difficulty getting started. >> >> I've seen this twice in the field, both times it's involved an >> expensive switch and a well-meaning techie who insisted on configuring >> everything for "maximum performance". > > > -- ================================================================ | Serge Aleynikov Tel: (973) 438-3436 | MIS Telecom Fax: (973) 438-1457 | IDT Corp. serge@REDACTED ================================================================ From sean.hinde@REDACTED Mon Apr 25 18:34:35 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 17:34:35 +0100 Subject: distributed performance test In-Reply-To: <426D12D5.8040406@hq.idt.net> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> <426D12D5.8040406@hq.idt.net> Message-ID: <3de9987079ffa6da6b003c9e64000b36@mac.com> > The devlinuxpro2 Linux server was indeed running eth0 in 100BaseTX > half-duplex mode. > > After I set the interface to full-duplex, and rebooted, the speed > tests ran as expected. > > Regards, > > Serge > > P.S. The only question I have remaining is why would half-duplex > setting not have any speed impact on a single client talking to a > synchronous server, but only on multiple clients... Well, I guess that a single client is actually only exercising half of a duplex. There is never any time when traffic wants to flow both ways at the same time. Sean From serge@REDACTED Mon Apr 25 18:49:47 2005 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 25 Apr 2005 12:49:47 -0400 Subject: distributed performance test In-Reply-To: <3de9987079ffa6da6b003c9e64000b36@mac.com> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> <426D12D5.8040406@hq.idt.net> <3de9987079ffa6da6b003c9e64000b36@mac.com> Message-ID: <426D1FAB.3040904@hq.idt.net> Sean Hinde wrote: >> P.S. The only question I have remaining is why would half-duplex >> setting not have any speed impact on a single client talking to a >> synchronous server, but only on multiple clients... > > > Well, I guess that a single client is actually only exercising half of a > duplex. There is never any time when traffic wants to flow both ways at > the same time. You know, I forgot to mention another interesting fact. When I tried to troubleshoot this issue, I extended my test_client/test_server to be able to send/receive messages using three transports: erlang/tcp/udp. Here are the results of my tests when the eth0 was set to half-duplex: (n1@REDACTED)15> test_client:test_erl(n2@REDACTED, 10, 500). -> AvgTime=0.022 (45.360 c/s) (n1@REDACTED)17> test_client:test_udp({10,227,1,200}, 10, 500). -> AvgTime=0.000 (3355.705 c/s) (n1@REDACTED)18> test_client:test_tcp({10,227,1,200}, 10, 500). -> AvgTime=0.000 (3144.654 c/s) So, if your statement were true, then it would've had impact on all tcp/udp/erlang transports, wouldn't it? Yet in this case somehow it only impacted Erlang's message passing speed. After converting eth0 to full-duplex: (n1@REDACTED)19> test_client:test_erl(n2@REDACTED, 10, 500). -> AvgTime=0.000 (2450.980 c/s) (Note: it's still a bit slower than when using TCP/UDP sockets). The modified implementation is attached for reference. Serge -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_client.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test_server.erl URL: From sean.hinde@REDACTED Mon Apr 25 19:17:16 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 18:17:16 +0100 Subject: distributed performance test In-Reply-To: <426D1FAB.3040904@hq.idt.net> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> <426D12D5.8040406@hq.idt.net> <3de9987079ffa6da6b003c9e64000b36@mac.com> <426D1FAB.3040904@hq.idt.net> Message-ID: <9a2677eeb696e4444f09d5fa9a715cf7@mac.com> On 25 Apr 2005, at 17:49, Serge Aleynikov wrote: > Sean Hinde wrote: >>> P.S. The only question I have remaining is why would half-duplex >>> setting not have any speed impact on a single client talking to a >>> synchronous server, but only on multiple clients... >> Well, I guess that a single client is actually only exercising half >> of a duplex. There is never any time when traffic wants to flow both >> ways at the same time. > > You know, I forgot to mention another interesting fact. When I tried > to troubleshoot this issue, I extended my test_client/test_server to > be able to send/receive messages using three transports: > erlang/tcp/udp. Here are the results of my tests when the eth0 was set > to half-duplex: > > (n1@REDACTED)15> test_client:test_erl(n2@REDACTED, 10, 500). > -> AvgTime=0.022 (45.360 c/s) > > (n1@REDACTED)17> test_client:test_udp({10,227,1,200}, 10, 500). > -> AvgTime=0.000 (3355.705 c/s) > > (n1@REDACTED)18> test_client:test_tcp({10,227,1,200}, 10, 500). > -> AvgTime=0.000 (3144.654 c/s) > > So, if your statement were true, then it would've had impact on all > tcp/udp/erlang transports, wouldn't it? Yet in this case somehow it > only impacted Erlang's message passing speed. > > After converting eth0 to full-duplex: > (n1@REDACTED)19> test_client:test_erl(n2@REDACTED, 10, 500). > -> AvgTime=0.000 (2450.980 c/s) > > (Note: it's still a bit slower than when using TCP/UDP sockets). Yes, this also matches with my experience. In fact it prompted us to write our own simpler RPC mechanism as we needed extreme performance for one of our applications. It would be interesting to run profilers and trace to see where the extra time has gone. I have never used it, but erlsnoop might be helpful: http://www.erlang.org/contrib/erlsnoop-1.0.tgz Sean From serge@REDACTED Mon Apr 25 19:26:50 2005 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 25 Apr 2005 13:26:50 -0400 Subject: distributed performance test In-Reply-To: <9a2677eeb696e4444f09d5fa9a715cf7@mac.com> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> <426D12D5.8040406@hq.idt.net> <3de9987079ffa6da6b003c9e64000b36@mac.com> <426D1FAB.3040904@hq.idt.net> <9a2677eeb696e4444f09d5fa9a715cf7@mac.com> Message-ID: <426D285A.8020504@hq.idt.net> Thanks Sean, I'll play with erlsnoop when I have more time. For now the only outstanding issue I have is listed here: http://www.erlang.org/ml-archive/erlang-questions/200504/msg00274.html http://www.erlang.org/ml-archive/erlang-questions/200504/msg00286.html If you happened to have similar experiences, please do let me know. :-( Regards, Serge Sean Hinde wrote: > > On 25 Apr 2005, at 17:49, Serge Aleynikov wrote: > >> Sean Hinde wrote: >> >>>> P.S. The only question I have remaining is why would half-duplex >>>> setting not have any speed impact on a single client talking to a >>>> synchronous server, but only on multiple clients... >>> >>> Well, I guess that a single client is actually only exercising half >>> of a duplex. There is never any time when traffic wants to flow both >>> ways at the same time. >> >> >> You know, I forgot to mention another interesting fact. When I tried >> to troubleshoot this issue, I extended my test_client/test_server to >> be able to send/receive messages using three transports: >> erlang/tcp/udp. Here are the results of my tests when the eth0 was set >> to half-duplex: >> >> (n1@REDACTED)15> test_client:test_erl(n2@REDACTED, 10, 500). >> -> AvgTime=0.022 (45.360 c/s) >> >> (n1@REDACTED)17> test_client:test_udp({10,227,1,200}, 10, 500). >> -> AvgTime=0.000 (3355.705 c/s) >> >> (n1@REDACTED)18> test_client:test_tcp({10,227,1,200}, 10, 500). >> -> AvgTime=0.000 (3144.654 c/s) >> >> So, if your statement were true, then it would've had impact on all >> tcp/udp/erlang transports, wouldn't it? Yet in this case somehow it >> only impacted Erlang's message passing speed. >> >> After converting eth0 to full-duplex: >> (n1@REDACTED)19> test_client:test_erl(n2@REDACTED, 10, 500). >> -> AvgTime=0.000 (2450.980 c/s) >> >> (Note: it's still a bit slower than when using TCP/UDP sockets). > > > Yes, this also matches with my experience. In fact it prompted us to > write our own simpler RPC mechanism as we needed extreme performance for > one of our applications. > > It would be interesting to run profilers and trace to see where the > extra time has gone. I have never used it, but erlsnoop might be helpful: > > http://www.erlang.org/contrib/erlsnoop-1.0.tgz > > Sean From sean.hinde@REDACTED Mon Apr 25 23:37:49 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 25 Apr 2005 22:37:49 +0100 Subject: distributed performance test In-Reply-To: <426D285A.8020504@hq.idt.net> References: <42681377.7020803@hq.idt.net> <426953D2.9060905@hq.idt.net> <17003.63545.194507.244572@antilipe.corelatus.se> <426C3724.9080406@hq.idt.net> <7821f2705cd4b7afbc2aad9e89f83153@mac.com> <17004.47289.167865.238027@beladrome.corelatus.se> <2bf7dcbaec73787205df7f37cc248e58@mac.com> <426D12D5.8040406@hq.idt.net> <3de9987079ffa6da6b003c9e64000b36@mac.com> <426D1FAB.3040904@hq.idt.net> <9a2677eeb696e4444f09d5fa9a715cf7@mac.com> <426D285A.8020504@hq.idt.net> Message-ID: Sorry, I have no idea whatsoever on that one. Sean On 25 Apr 2005, at 18:26, Serge Aleynikov wrote: > Thanks Sean, I'll play with erlsnoop when I have more time. > > For now the only outstanding issue I have is listed here: > > http://www.erlang.org/ml-archive/erlang-questions/200504/msg00274.html > http://www.erlang.org/ml-archive/erlang-questions/200504/msg00286.html > > If you happened to have similar experiences, please do let me know. > :-( > > Regards, > > Serge > > Sean Hinde wrote: >> On 25 Apr 2005, at 17:49, Serge Aleynikov wrote: >>> Sean Hinde wrote: >>> >>>>> P.S. The only question I have remaining is why would half-duplex >>>>> setting not have any speed impact on a single client talking to a >>>>> synchronous server, but only on multiple clients... >>>> >>>> Well, I guess that a single client is actually only exercising half >>>> of a duplex. There is never any time when traffic wants to flow >>>> both ways at the same time. >>> >>> >>> You know, I forgot to mention another interesting fact. When I >>> tried to troubleshoot this issue, I extended my >>> test_client/test_server to be able to send/receive messages using >>> three transports: erlang/tcp/udp. Here are the results of my tests >>> when the eth0 was set to half-duplex: >>> >>> (n1@REDACTED)15> test_client:test_erl(n2@REDACTED, 10, 500). >>> -> AvgTime=0.022 (45.360 c/s) >>> >>> (n1@REDACTED)17> test_client:test_udp({10,227,1,200}, 10, 500). >>> -> AvgTime=0.000 (3355.705 c/s) >>> >>> (n1@REDACTED)18> test_client:test_tcp({10,227,1,200}, 10, 500). >>> -> AvgTime=0.000 (3144.654 c/s) >>> >>> So, if your statement were true, then it would've had impact on all >>> tcp/udp/erlang transports, wouldn't it? Yet in this case somehow it >>> only impacted Erlang's message passing speed. >>> >>> After converting eth0 to full-duplex: >>> (n1@REDACTED)19> test_client:test_erl(n2@REDACTED, 10, 500). >>> -> AvgTime=0.000 (2450.980 c/s) >>> >>> (Note: it's still a bit slower than when using TCP/UDP sockets). >> Yes, this also matches with my experience. In fact it prompted us to >> write our own simpler RPC mechanism as we needed extreme performance >> for one of our applications. >> It would be interesting to run profilers and trace to see where the >> extra time has gone. I have never used it, but erlsnoop might be >> helpful: >> http://www.erlang.org/contrib/erlsnoop-1.0.tgz >> Sean From serge@REDACTED Tue Apr 26 01:01:59 2005 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 25 Apr 2005 19:01:59 -0400 Subject: node startup crash In-Reply-To: <426AFD57.5010002@hq.idt.net> References: <426904A3.6010602@hq.idt.net> <20050423184851.GA2447@hyber.org> <426AFD57.5010002@hq.idt.net> Message-ID: <426D76E7.8050104@hq.idt.net> In my attempt to troubleshoot this issue of a "erl -sname a" startup crash, I determined that the problem is indeed related to epmd. I slightly modified epmd_srv.c to output more tracing: --- /home/serge/tmp/epmd_srv.c 2005-04-25 18:45:31.328089912 -0400 +++ epmd_srv.c 2005-04-25 18:41:23.570754752 -0400 @@ -227,8 +227,12 @@ if (g->delay_accept) /* Test of busy server */ sleep(g->delay_accept); - if(FD_ISSET(listensock,&read_mask)) - do_accept(g,listensock); + dbg_tty_printf(g,2,"select() triggered. read_mask=%d (listensock=%d)", read_mask, listensock); + + if(FD_ISSET(listensock,&read_mask)) { + dbg_tty_printf(g,2,"accepting the socket"); + do_accept(g,listensock); + } /* Go over all connections and look for open ones */ { Then I ran epmd in the debug mode ("epmd -d -d"), fired off an "erl" in a separate terminal, and typed: > net_kernel:start([a]). The call hung, and crashed after a timeout =INFO REPORT==== 25-Apr-2005::18:51:07 === Protocol: "inet_tcp": register error: {timeout, {gen_server, call, [erl_epmd, {register,a,35418}, 15000]}} This is what I saw in the epmd trace: epmd: Mon Apr 25 18:50:48 2005: epmd running - daemon = 0 epmd: Mon Apr 25 18:50:48 2005: try to initiate listening port 4369 epmd: Mon Apr 25 18:50:48 2005: starting epmd: Mon Apr 25 18:50:48 2005: entering the main select() loop epmd: Mon Apr 25 18:50:53 2005: select() triggered. read_mask=0 (listensock=0) epmd: Mon Apr 25 18:50:58 2005: select() triggered. read_mask=0 (listensock=0) epmd: Mon Apr 25 18:51:03 2005: select() triggered. read_mask=0 (listensock=0) epmd: Mon Apr 25 18:51:08 2005: select() triggered. read_mask=0 (listensock=0) What's extreemly odd is that the listensock fd is not set in the read_mask, even though the select() call woke up detecting data... I suppose that there's some incompatibility with libc, but wouldn't configure take care of this during the build process? Is there a problem, perhaps that I am running the 2.6.8.1 kernel on this host? ~/tmp/otp_src_R10B-4/erts/epmd/src>uname -a Linux stardev1.corp.idt.net 2.6.8.1 #2 SMP Tue Sep 28 16:04:54 EDT 2004 i686 i686 i386 GNU/Linux >ldd /home/serge/tmp/otp_src_R10B-4/bin/i686-pc-linux-gnu/epmd libncurses.so.5 => /usr/lib/libncurses.so.5 (0x4002c000) libdl.so.2 => /lib/libdl.so.2 (0x4006c000) libm.so.6 => /lib/tls/libm.so.6 (0x4006f000) libc.so.6 => /lib/tls/libc.so.6 (0x40091000) libgpm.so.1 => /usr/lib/libgpm.so.1 (0x401c8000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) Serge Serge Aleynikov wrote: > Thanks for the advice, but I tried that a couple of times before > submitting this posting. Then I also did: > > ~/otp_src_R10B-4>killall epmd beam > ~/otp_src_R10B-4>rm -fr /usr/local/lib/erlang > ~/otp_src_R10B-4>make install > ~/otp_src_R10B-4>erl -sname abc > {error_logger,{{2005,4,23},{21,41,36}},'Protocol: ~p: register error: > ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,abc,35363},15000]}}]} > > {error_logger,{{2005,4,23},{21,41,36}},crash_report,[[{pid,<0.18.0>},{registered_name,net_kernel},{error_info,{error,badarg} > > ... > > The same crash. There's not a lot of stuff running on this host either. > Below is the output of "ps -ax". We can also see that epmd was started > from the right distribution (erts-5.4.5). This is somewhat annoying, > as I am not sure what else can be checked in order to overcome this > crash... > > Thank you. > > Serge > > PID TTY STAT TIME COMMAND > 1 ? S 0:00 init [3] > 2 ? SW 0:00 [migration/0] > 3 ? SWN 0:00 [ksoftirqd/0] > 4 ? SW 0:00 [migration/1] > 5 ? SWN 0:00 [ksoftirqd/1] > 6 ? SW 0:03 [migration/2] > 7 ? SWN 0:00 [ksoftirqd/2] > 8 ? SW 0:00 [migration/3] > 9 ? SWN 0:00 [ksoftirqd/3] > 10 ? SW< 0:00 [events/0] > 11 ? SW< 0:00 [events/1] > 12 ? SW< 0:00 [events/2] > 13 ? SW< 0:00 [events/3] > 14 ? SW< 0:00 [khelper] > 15 ? SW< 0:00 [kblockd/0] > 16 ? SW< 0:00 [kblockd/1] > 17 ? SW< 0:00 [kblockd/2] > 18 ? SW< 0:00 [kblockd/3] > 53 ? SW 0:00 [kirqd] > 54 ? SW 0:00 [pdflush] > 55 ? SW 0:11 [pdflush] > 56 ? SW 0:00 [kswapd0] > 57 ? SW< 0:00 [aio/0] > 58 ? SW< 0:00 [aio/1] > 59 ? SW< 0:00 [aio/2] > 60 ? SW< 0:00 [aio/3] > 153 ? SW 0:00 [kseriod] > 190 ? SW 0:00 [scsi_eh_0] > 191 ? SW 0:00 [aacraid] > 204 ? SW 0:18 [kjournald] > 520 ? SW 0:00 [khubd] > 1043 ? SW 0:00 [kjournald] > 1044 ? SW 0:00 [kjournald] > 1045 ? SW 0:06 [kjournald] > 1463 ? S 0:00 syslogd -m 0 > 1467 ? S 0:00 klogd -x > 1859 ? S 0:02 /usr/sbin/sshd > 1884 ? S 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid > 1947 ? S 0:00 crond > 2010 ? S 0:00 proftpd: (accepting connections) > 2017 tty1 S 0:00 /sbin/mingetty tty1 > 2018 tty2 S 0:00 /sbin/mingetty tty2 > 2019 tty3 S 0:00 /sbin/mingetty tty3 > 2020 tty4 S 0:00 /sbin/mingetty tty4 > 2021 tty5 S 0:00 /sbin/mingetty tty5 > 2022 tty6 S 0:00 /sbin/mingetty tty6 > 11707 ? S 0:00 sshd: serge [priv] > 11709 ? S 0:01 sshd: serge@REDACTED/1 > 11710 pts/1 S 0:01 -bash > 31265 pts/1 S 0:00 rxvt -sr -fg white -bg black -fn Clean -sl 300 > 31266 pts/0 S 0:00 bash > 27564 ? S 0:00 /usr/local/lib/erlang/erts-5.4.5/bin/epmd > -daemon > 27557 pts/0 R 0:00 ps -ax > > klacke@REDACTED wrote: > >> On Fri, Apr 22, 2005 at 10:05:23AM -0400, Serge Aleynikov wrote: >> >>> Hi, >>> >>> I upgraded Erlang on one of our Linux servers to R10B-4, and started >>> getting this error at startup. This problem wasn't observed before >>> the upgrade. >>> >>> >>>> erl -sname a >>> >>> >>> {error_logger,{{2005,4,21},{21,30,39}},'Protocol: ~p: register error: >>> ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,a,35269},15000]}}]} >>> >>> {error_logger,{{2005,4,21},{21,30,39}},crash_report, >> >> >> >> ......... >> >> One of the early Erlang slogans was: "Symolic information is always >> available". >> Somehow, that spung to my mind what I saw your higly _symbolic_ >> error message :-) >> >> >> It does though look as if there is some trouble while >> registering the node name with epmd. >> Maybe incompatible epmd vsns ??, 'killall epmd' and retry. >> >> >> /klacke > > -- ================================================================ | Serge Aleynikov Tel: (973) 438-3436 | MIS Telecom Fax: (973) 438-1457 | IDT Corp. serge@REDACTED ================================================================ From jahakala@REDACTED Tue Apr 26 02:17:23 2005 From: jahakala@REDACTED (Jani Hakala) Date: Tue, 26 Apr 2005 03:17:23 +0300 Subject: node startup crash In-Reply-To: <426D76E7.8050104@hq.idt.net> (Serge Aleynikov's message of "Mon, 25 Apr 2005 19:01:59 -0400") References: <426904A3.6010602@hq.idt.net> <20050423184851.GA2447@hyber.org> <426AFD57.5010002@hq.idt.net> <426D76E7.8050104@hq.idt.net> Message-ID: <878y36qtm4.fsf@pingviini.kortex.jyu.fi> Serge Aleynikov writes: > epmd: Mon Apr 25 18:50:48 2005: entering the main select() loop > epmd: Mon Apr 25 18:50:53 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:50:58 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:51:03 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:51:08 2005: select() triggered. read_mask=0 > (listensock=0) > A timestamp after each timeout (5 seconds, epmd_int.h: IDLE_TIMEOUT) > What's extreemly odd is that the listensock fd is not set in the > read_mask, even though the select() call woke up detecting data... > select returns 0 if there's a timeout. Some code in epmd_srv.c is executed in this case even tough it might not be necessary(?) Jani Hakala From bengt.kleberg@REDACTED Tue Apr 26 09:39:05 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 26 Apr 2005 09:39:05 +0200 Subject: linking processes on different nodes? Message-ID: <426DF019.5070402@ericsson.com> greetings, is it possible to link process on different nodes? if it is possible, can it be done by calling rpc:call( Node, gen_server, start_link, [{local,server_name}, module_name, [], []] ). ? bengt, who does not get this to work on Erlang (THREADS,HIPE) (BEAM) emulator version 5.4.4 From vlad.xx.dumitrescu@REDACTED Tue Apr 26 10:35:06 2005 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Tue, 26 Apr 2005 10:35:06 +0200 Subject: linking processes on different nodes? Message-ID: <11498CB7D3FCB54897058DE63BE3897C4BE518@esealmw105.eemea.ericsson.se> Hi, > rpc:call( Node, gen_server, start_link, [{local,server_name}, > module_name, > [], > []] ). This call will link the gen_server with the rex process on Node, since it's inside it that the gen_server:start_link is evaluated. You will have to do it manually by sending self() as an argument and handle it in init(). Another way would involve a normally spawn_linked proxy process that would stand for the real gen_server, but I'm not sure if it's a good idea. regards, Vlad From dietmar@REDACTED Tue Apr 26 12:03:35 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Tue, 26 Apr 2005 12:03:35 +0200 Subject: What OS does Erlang run on Message-ID: <426E11F7.1070108@ast.dfs.de> Hi ! I am reading the FAQ which states that Erlang should run ob TRU64 (unconfirmed) I am in the possition to proudly confirm that Erlang otp_src_R10-B4 is running smoothly on Tru64 4.0f Dietmar From serge@REDACTED Tue Apr 26 13:58:47 2005 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 26 Apr 2005 07:58:47 -0400 Subject: distributed performance test In-Reply-To: <200504260829.j3Q8TCCi078784@tordmule.bluetail.com> References: <200504260829.j3Q8TCCi078784@tordmule.bluetail.com> Message-ID: <426E2CF7.4010900@hq.idt.net> Thanks Per! For those who experience similar issues, I'd like to add another variable - it turned out that in our case the port on the Eithernet switch that this host was connected to was indeed set to 100BaseTX full-duplex mode only - I suppose this would be causing collisions that may not necessarily would be seen at one of the hosts. So what you described below applies to all interconnects in the path between two hosts talking to each other. Its at such moments when you think that it would have been much better if the Networking and the Systems Development departments were working more closely, but I believe that's not a reality of any large organization... ;-) Serge Per Hedeland wrote: > Serge Aleynikov wrote: > >>Sean Hinde wrote: >> >>>>P.S. The only question I have remaining is why would half-duplex >>>>setting not have any speed impact on a single client talking to a >>>>synchronous server, but only on multiple clients... >>> >>> >>>Well, I guess that a single client is actually only exercising half of a >>>duplex. There is never any time when traffic wants to flow both ways at >>>the same time. >> >>You know, I forgot to mention another interesting fact. When I tried to >>troubleshoot this issue, I extended my test_client/test_server to be >>able to send/receive messages using three transports: erlang/tcp/udp. >>Here are the results of my tests when the eth0 was set to half-duplex: >> >>(n1@REDACTED)15> test_client:test_erl(n2@REDACTED, 10, 500). >> -> AvgTime=0.022 (45.360 c/s) >> >>(n1@REDACTED)17> test_client:test_udp({10,227,1,200}, 10, 500). >> -> AvgTime=0.000 (3355.705 c/s) >> >>(n1@REDACTED)18> test_client:test_tcp({10,227,1,200}, 10, 500). >> -> AvgTime=0.000 (3144.654 c/s) >> >>So, if your statement were true, then it would've had impact on all >>tcp/udp/erlang transports, wouldn't it? Yet in this case somehow it >>only impacted Erlang's message passing speed. > > > Whether the full-duplex side's making use of the full duplexity is > actually seen as collisions by the half-duplex side can't really be > pre-determined, since it is highly dependant on traffic patterns and > timing. E.g. UDP doesn't have ACKs, which reduces the risk of > "collisions", and while the Erlang distribution uses TCP it does so with > the "Nagle algorithm" disabled, which will make the pattern different > from "normal" TCP. > > We've had quite a few full/half duplex mismatch cases in the field with > our products (not specifically with the Erlang distribution traffic > though), and the only general observation you can make is that it > doesn't really become a problem until you have "a lot" of traffic, at > which point performance goes down the drain. (The cause of these cases > is invariably that a network admin doesn't "trust" Ethernet auto- > negotiation, and insists on locking interfaces at 100Mb/FD - but forgets > that he has to do that at both ends, with the result that the auto- > negotiating end goes into 100Mb/HD - per the specs.) > > --Per From mickael.remond@REDACTED Tue Apr 26 15:19:28 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 26 Apr 2005 15:19:28 +0200 Subject: beam.shared and beam.hybrid Message-ID: <426E3FE0.8040404@erlang-fr.org> Hello, I just noticed that beam.shared is no more build by default. On system that can support it, beam.hybrid is build however (R10B-3) Does this means that beam.hybrid now "officially" replaced the beam.shared emulator and that we should refer beam.hybrid ? Can it be a direct replacement for case where beam.shared were used ? I thought the hybrid model was still experimental however, so if you have any information on its status, this is welcome. Thank you in advance. -- Micka?l R?mond From matthias@REDACTED Tue Apr 26 16:05:28 2005 From: matthias@REDACTED (Matthias Lang) Date: Tue, 26 Apr 2005 16:05:28 +0200 Subject: distributed performance test In-Reply-To: <426E2CF7.4010900@hq.idt.net> References: <200504260829.j3Q8TCCi078784@tordmule.bluetail.com> <426E2CF7.4010900@hq.idt.net> Message-ID: <17006.19112.708660.390928@antilipe.corelatus.se> Per wrote: > Whether the full-duplex side's making use of the full duplexity is > actually seen as collisions by the half-duplex side can't really be > pre-determined, since it is highly dependant on traffic patterns and > timing. Further: it's useful to distinguish between 'normal' collisions and late collisions, even if many popular OSs don't. A normal collision happens within the first 64 octets of an ethernet packet. A normal, healthy half-duplex ethernet has these all the time and the transmitting NIC handles it by waiting a random time (with a special distribution) and retransmitting. Software (TCP) is blissfully unaware, everything works just fine. A late collision happens after the first 64 octets, which may be after the end of the frame. Correctly working networks should _never_ have late collisions. All the NICs I've worked with treat late collisions as a fatal error, i.e. they don't retransmit. Thus software (TCP) sees a late collision as packet loss, and TCP tends to throttle itself when that happens. That's why the performance characteristics get so ugly. Matt From anders.nygren@REDACTED Tue Apr 26 17:06:54 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Tue, 26 Apr 2005 10:06:54 -0500 Subject: snmpm: documentation bug Message-ID: Hi I just noticed some errors in the snmp manager documentation, in R10B-4. snmpm: gb/5,6,7,8 (get bulk) is not documented. (Another thing, is there any special reason that there are no async get bulk functions?) snmpm_user: handle_error/3 is not documented. /Anders From vances@REDACTED Tue Apr 26 17:38:35 2005 From: vances@REDACTED (Vance Shipley) Date: Tue, 26 Apr 2005 11:38:35 -0400 Subject: snmpm: documentation bug In-Reply-To: References: Message-ID: <20050426153835.GI15933@feeble.motivity.ca> It would be nice if snmp:passwd2localized_key/3 were documented too. The User's Guide doesn't tell you what goes into the authentication keys. I eventually learned that you need to take the passphrase from the manager and run it through: snmp:passwd2localized_key(md5, PassPhrase, AgentEngineID) The result is a list of 16 integers to be used as the key in usm.conf. This may be a general SNMP thing but it would be helpful if it was mentioned in the UG and man page. -Vance From serge@REDACTED Tue Apr 26 19:12:28 2005 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 26 Apr 2005 13:12:28 -0400 Subject: node startup crash In-Reply-To: <426D76E7.8050104@hq.idt.net> References: <426904A3.6010602@hq.idt.net> <20050423184851.GA2447@hyber.org> <426AFD57.5010002@hq.idt.net> <426D76E7.8050104@hq.idt.net> Message-ID: <426E767C.6020903@hq.idt.net> After banging my head with this problem for a couple of days now, I finally figured out what was causing this crash. In case of this server netstat ("netstat -a | grep 4369") wasn't seeing anything listening on 127.0.0.1:4369, yet any attempt to bind to it would fail, stating that the address was not available: 4> {ok, S} = gen_tcp:listen(4369, [{ip, {127,0,0,1}},{reuseaddr, true}]). =ERROR REPORT==== 26-Apr-2005::12:44:32 === Error in process <0.32.0> with exit value: {{badmatch,{error,eaddrnotavail}},[{erl_eval,expr,3}]} epmd starts by binding to port 4369 using INADDR_ANY (telling the kernel to choose the IP address for it). So, since the loopback address "127.0.0.1" was taken by some other process, it bound to some other IP address ("172.16.202.77" in case of this host) defined by the eth0 interface. The registration attempts from Erlang were coming on the 127.0.0.1:4369 address, and therefore couldn't find the listener failing with timeout. I ended up recycling the loopback interface on the server ("/sbin/ifdown lo", "/sbin/ifup lo", and this cleared up its state, allowing epmd to bind properly. 7> f(S), {ok, S} = gen_tcp:listen(4369, [{ip, {127,0,0,1}},{reuseaddr, true}]). {ok,#Port<0.89>} 8> q(). And finally the glorious start of the distributed erl: ~/tmp/otp_src_R10B-4>erl -sname a Erlang (BEAM) emulator version 5.4.5 [source] [hipe] [threads:0] Eshell V5.4.5 (abort with ^G) (a@REDACTED)1> I have no clue why the kernel couldn't fulfill the original bind request, other than to blame the state of that interface. I wanted to share with you this finding so that this might be helpful for someone else experincing the same issue. Regards, Serge Serge Aleynikov wrote: > In my attempt to troubleshoot this issue of a "erl -sname a" startup > crash, I determined that the problem is indeed related to epmd. I > slightly modified epmd_srv.c to output more tracing: > > --- /home/serge/tmp/epmd_srv.c 2005-04-25 18:45:31.328089912 -0400 > +++ epmd_srv.c 2005-04-25 18:41:23.570754752 -0400 > @@ -227,8 +227,12 @@ > if (g->delay_accept) /* Test of busy server */ > sleep(g->delay_accept); > > - if(FD_ISSET(listensock,&read_mask)) > - do_accept(g,listensock); > + dbg_tty_printf(g,2,"select() triggered. read_mask=%d > (listensock=%d)", read_mask, listensock); > + > + if(FD_ISSET(listensock,&read_mask)) { > + dbg_tty_printf(g,2,"accepting the socket"); > + do_accept(g,listensock); > + } > > /* Go over all connections and look for open ones */ > { > > Then I ran epmd in the debug mode ("epmd -d -d"), fired off an "erl" in > a separate terminal, and typed: > > > net_kernel:start([a]). > > The call hung, and crashed after a timeout > =INFO REPORT==== 25-Apr-2005::18:51:07 === > Protocol: "inet_tcp": register error: {timeout, > {gen_server, > call, > [erl_epmd, > {register,a,35418}, > 15000]}} > > This is what I saw in the epmd trace: > epmd: Mon Apr 25 18:50:48 2005: epmd running - daemon = 0 > epmd: Mon Apr 25 18:50:48 2005: try to initiate listening port 4369 > epmd: Mon Apr 25 18:50:48 2005: starting > epmd: Mon Apr 25 18:50:48 2005: entering the main select() loop > epmd: Mon Apr 25 18:50:53 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:50:58 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:51:03 2005: select() triggered. read_mask=0 > (listensock=0) > epmd: Mon Apr 25 18:51:08 2005: select() triggered. read_mask=0 > (listensock=0) > > What's extreemly odd is that the listensock fd is not set in the > read_mask, even though the select() call woke up detecting data... > > I suppose that there's some incompatibility with libc, but wouldn't > configure take care of this during the build process? Is there a > problem, perhaps that I am running the 2.6.8.1 kernel on this host? > > ~/tmp/otp_src_R10B-4/erts/epmd/src>uname -a > Linux stardev1.corp.idt.net 2.6.8.1 #2 SMP Tue Sep 28 16:04:54 EDT 2004 > i686 i686 i386 GNU/Linux > > >ldd /home/serge/tmp/otp_src_R10B-4/bin/i686-pc-linux-gnu/epmd > libncurses.so.5 => /usr/lib/libncurses.so.5 (0x4002c000) > libdl.so.2 => /lib/libdl.so.2 (0x4006c000) > libm.so.6 => /lib/tls/libm.so.6 (0x4006f000) > libc.so.6 => /lib/tls/libc.so.6 (0x40091000) > libgpm.so.1 => /usr/lib/libgpm.so.1 (0x401c8000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) > Serge > > > Serge Aleynikov wrote: > >> Thanks for the advice, but I tried that a couple of times before >> submitting this posting. Then I also did: >> >> ~/otp_src_R10B-4>killall epmd beam >> ~/otp_src_R10B-4>rm -fr /usr/local/lib/erlang >> ~/otp_src_R10B-4>make install >> ~/otp_src_R10B-4>erl -sname abc >> {error_logger,{{2005,4,23},{21,41,36}},'Protocol: ~p: register error: >> ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,abc,35363},15000]}}]} >> >> {error_logger,{{2005,4,23},{21,41,36}},crash_report,[[{pid,<0.18.0>},{registered_name,net_kernel},{error_info,{error,badarg} >> >> ... >> >> The same crash. There's not a lot of stuff running on this host >> either. Below is the output of "ps -ax". We can also see that epmd >> was started from the right distribution (erts-5.4.5). This is >> somewhat annoying, as I am not sure what else can be checked in order >> to overcome this crash... >> >> Thank you. >> >> Serge >> >> PID TTY STAT TIME COMMAND >> 1 ? S 0:00 init [3] >> 2 ? SW 0:00 [migration/0] >> 3 ? SWN 0:00 [ksoftirqd/0] >> 4 ? SW 0:00 [migration/1] >> 5 ? SWN 0:00 [ksoftirqd/1] >> 6 ? SW 0:03 [migration/2] >> 7 ? SWN 0:00 [ksoftirqd/2] >> 8 ? SW 0:00 [migration/3] >> 9 ? SWN 0:00 [ksoftirqd/3] >> 10 ? SW< 0:00 [events/0] >> 11 ? SW< 0:00 [events/1] >> 12 ? SW< 0:00 [events/2] >> 13 ? SW< 0:00 [events/3] >> 14 ? SW< 0:00 [khelper] >> 15 ? SW< 0:00 [kblockd/0] >> 16 ? SW< 0:00 [kblockd/1] >> 17 ? SW< 0:00 [kblockd/2] >> 18 ? SW< 0:00 [kblockd/3] >> 53 ? SW 0:00 [kirqd] >> 54 ? SW 0:00 [pdflush] >> 55 ? SW 0:11 [pdflush] >> 56 ? SW 0:00 [kswapd0] >> 57 ? SW< 0:00 [aio/0] >> 58 ? SW< 0:00 [aio/1] >> 59 ? SW< 0:00 [aio/2] >> 60 ? SW< 0:00 [aio/3] >> 153 ? SW 0:00 [kseriod] >> 190 ? SW 0:00 [scsi_eh_0] >> 191 ? SW 0:00 [aacraid] >> 204 ? SW 0:18 [kjournald] >> 520 ? SW 0:00 [khubd] >> 1043 ? SW 0:00 [kjournald] >> 1044 ? SW 0:00 [kjournald] >> 1045 ? SW 0:06 [kjournald] >> 1463 ? S 0:00 syslogd -m 0 >> 1467 ? S 0:00 klogd -x >> 1859 ? S 0:02 /usr/sbin/sshd >> 1884 ? S 0:00 xinetd -stayalive -pidfile /var/run/xinetd.pid >> 1947 ? S 0:00 crond >> 2010 ? S 0:00 proftpd: (accepting connections) >> 2017 tty1 S 0:00 /sbin/mingetty tty1 >> 2018 tty2 S 0:00 /sbin/mingetty tty2 >> 2019 tty3 S 0:00 /sbin/mingetty tty3 >> 2020 tty4 S 0:00 /sbin/mingetty tty4 >> 2021 tty5 S 0:00 /sbin/mingetty tty5 >> 2022 tty6 S 0:00 /sbin/mingetty tty6 >> 11707 ? S 0:00 sshd: serge [priv] >> 11709 ? S 0:01 sshd: serge@REDACTED/1 >> 11710 pts/1 S 0:01 -bash >> 31265 pts/1 S 0:00 rxvt -sr -fg white -bg black -fn Clean -sl 300 >> 31266 pts/0 S 0:00 bash >> 27564 ? S 0:00 /usr/local/lib/erlang/erts-5.4.5/bin/epmd >> -daemon >> 27557 pts/0 R 0:00 ps -ax >> >> klacke@REDACTED wrote: >> >>> On Fri, Apr 22, 2005 at 10:05:23AM -0400, Serge Aleynikov wrote: >>> >>>> Hi, >>>> >>>> I upgraded Erlang on one of our Linux servers to R10B-4, and started >>>> getting this error at startup. This problem wasn't observed before >>>> the upgrade. >>>> >>>> >>>>> erl -sname a >>>> >>>> >>>> >>>> {error_logger,{{2005,4,21},{21,30,39}},'Protocol: ~p: register >>>> error: >>>> ~p~n',[inet_tcp,{timeout,{gen_server,call,[erl_epmd,{register,a,35269},15000]}}]} >>>> >>>> {error_logger,{{2005,4,21},{21,30,39}},crash_report, >>> >>> >>> >>> >>> ......... >>> >>> One of the early Erlang slogans was: "Symolic information is always >>> available". >>> Somehow, that spung to my mind what I saw your higly _symbolic_ >>> error message :-) >>> >>> >>> It does though look as if there is some trouble while >>> registering the node name with epmd. >>> Maybe incompatible epmd vsns ??, 'killall epmd' and retry. >>> >>> >>> /klacke >> >> >> > -- ================================================================ | Serge Aleynikov Tel: (973) 438-3436 | MIS Telecom Fax: (973) 438-1457 | IDT Corp. serge@REDACTED ================================================================ From ke.han@REDACTED Tue Apr 26 20:18:55 2005 From: ke.han@REDACTED (ke.han) Date: Wed, 27 Apr 2005 02:18:55 +0800 Subject: need help with ssh in jungerl Message-ID: <426E860F.5090206@redstarling.com> I have installed ssh from jungerl for use with otp10B-4 on Linux. When I try to connect to another server like: 3> ssh:connect({192,168,1,30}, []). I get the error: =ERROR REPORT==== 27-Apr-2005::02:15:21 === Error in process <0.47.0> with exit value: {{case_clause,{error,enoent}},[{ssh_proto,known_host_key,2},{ssh_proto,client_kex,3},{ssh_proto,kex_negotiate,8}]} {error,{{case_clause,{error,enoent}}, [{ssh_proto,known_host_key,2}, {ssh_proto,client_kex,3}, {ssh_proto,kex_negotiate,8}]}} Any idea what I'm missing? thanks, ke han From serge@REDACTED Tue Apr 26 22:21:07 2005 From: serge@REDACTED (Serge Aleynikov) Date: Tue, 26 Apr 2005 16:21:07 -0400 Subject: node startup crash In-Reply-To: <200504261838.j3QIchhg001185@tordmule.bluetail.com> References: <200504261838.j3QIchhg001185@tordmule.bluetail.com> Message-ID: <426EA2B3.8000507@hq.idt.net> Per Hedeland wrote: >>In case of this server netstat ("netstat -a | grep 4369") wasn't seeing >>anything listening on 127.0.0.1:4369, > > > That's not to be expected - what you should see is a LISTEN on > 0.0.0.0:4369. Yes, but this wasn't happening. >>epmd starts by binding to port 4369 using INADDR_ANY (telling the kernel >>to choose the IP address for it). So, since the loopback address >>"127.0.0.1" was taken by some other process, it bound to some other IP >>address ("172.16.202.77" in case of this host) defined by the eth0 >>interface. > > > Actually no, that would be broken behaviour - binding to the wildcard > INADDR_ANY should fail with EADDRINUSE in that case. And EADDRNOTAVAIL > does not mean that the address is used by some other process, but that > the address simply doesn't exist locally. Presumably no connections to > 127.0.0.1 could be made on your box, regardless of port. You mean that the address is said to be badly specified in case when you are getting EADDRINUSE despite the fact that SO_REUSEADDR is specified? I also expected the epmd to fail with EADDRINUSE, but this wasn't happening. > Just curious, did you check that the loopback interface actually had > 127.0.0.1 configured before doing that? Surely. /sbin/ifconfig showed it listed. > If it did, you probably had some > mess-up in your routing tables - Linux (probably other OSes too) > determines whether an address is local through a routing lookup: > > $ ip route ls table local | grep 127.0.0.1 > ... > local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1 > > The route gets put there "automagically" by the kernel when the address > is configured on the interface, but it's possible to delete it... This I didn't try, but will keep that in mind if I happen to encounter the same issue. Regards, Serge From vlad.xx.dumitrescu@REDACTED Wed Apr 27 08:42:51 2005 From: vlad.xx.dumitrescu@REDACTED (Vlad Dumitrescu XX (LN/EAB)) Date: Wed, 27 Apr 2005 08:42:51 +0200 Subject: Code lifecycle (suggestion) Message-ID: <11498CB7D3FCB54897058DE63BE3897C4BE51B@esealmw105.eemea.ericsson.se> Hi all, I was trying to implement an utility to transparently memoize a module's exported functions (this means that a wrapper is built around them and the wrapper remembers the results of previous calls, who don't need to be recomputed again). I think I have a nice solution, but since it involves a hidden module, I stumbled on a problem: if the original module's code is reloaded (or upgraded) then the whole thing breaks apart. For that reason, I wonder if this backward compatible enhancement could be considered: * for modules declaring -behaviour(lifecycle), let the code loader look for a lifecycle/1 function and call it before and after loading/purging the code. The argument could be before_load, after_load, before_purge, after_purge. This way, initialization and cleanup could be handled nicely. I think even other applications might find this mechanism useful and it is also extensible if needed. I'm not sure if there won't be any clashes when both old and new code is running on a system, but hopefully nothing that can't be avoided with little care. What do you think? If it's interesting, I will gladly implement it myself and submit the code for review. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Wed Apr 27 11:34:31 2005 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 27 Apr 2005 11:34:31 +0200 Subject: beam.shared and beam.hybrid In-Reply-To: <426E3FE0.8040404@erlang-fr.org> References: <426E3FE0.8040404@erlang-fr.org> Message-ID: We (both OTP and the HiPE group) see much more potential in the Hybrid heap than in the Shared heap. Therefore we (OTP) test the Hybrid heap in our daily builds, but not the Shared heap. The Hybrid heap is not as stable as the private heap (default) emulator yet, but it is slowly growing more and more stable. /Bjorn Mickael Remond writes: > Hello, > > I just noticed that beam.shared is no more build by default. On system > that can support it, beam.hybrid is build however (R10B-3) > > Does this means that beam.hybrid now "officially" replaced the > beam.shared emulator and that we should refer beam.hybrid ? Can it be > a direct replacement for case where beam.shared were used ? > > I thought the hybrid model was still experimental however, so if you > have any information on its status, this is welcome. > > Thank you in advance. > > -- > Micka?l R?mond > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From erlang@REDACTED Wed Apr 27 14:50:39 2005 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Wed, 27 Apr 2005 09:50:39 -0300 Subject: String to term References: <426E3FE0.8040404@erlang-fr.org> Message-ID: <036001c54b27$b9de0470$4800a8c0@Inswitch251> Hi, Does someone know if there is an easy way to convert a string to an Erlang term? example: "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} thanks in advance, Eduardo Figoli INSwitch Solutions From bengt.kleberg@REDACTED Wed Apr 27 15:03:49 2005 From: bengt.kleberg@REDACTED (Bengt Kleberg (AL/EAB)) Date: Wed, 27 Apr 2005 08:03:49 -0500 Subject: String to term Message-ID: <200504271305.j3RD5Fbj020887@imr2.ericy.com> Inswitch Solutions - Erlang Evaluation wrote: > Hi, > > Does someone know if there is an easy way to convert a string to an Erlang > term? > example: > "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} do you have a file system? if so, write the string to a file, and the use file:path_consult/2. or have a look in the file module to see what path_consult/2 does. it should be handling strings somewhere along the line. it would be nice if erlang had strings ports. bengt -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo@REDACTED Wed Apr 27 15:12:27 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 27 Apr 2005 15:12:27 +0200 Subject: String to term References: <426E3FE0.8040404@erlang-fr.org>, , <036001c54b27$b9de0470$4800a8c0@Inswitch251> Message-ID: Not that simple, but... {ok,Tokens,_EndLine} = erl_scan:string("{1,2,[hello]}."), {ok,AbsForm} = erl_parse:parse_exprs(Tokens), {value,Value,_Bs} = erl_eval:exprs(AbsForm, erl_eval:new_bindings()), Value. ... to parse expressions. (Note the trailing dot in the input string) erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) writes: > Hi, > > Does someone know if there is an easy way to convert a string to an Erlang > term? > example: > "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} > > > thanks in advance, > Eduardo Figoli > INSwitch Solutions > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From osxroolz@REDACTED Wed Apr 27 15:18:44 2005 From: osxroolz@REDACTED (osxroolz@REDACTED) Date: Wed, 27 Apr 2005 06:18:44 -0700 Subject: String to term In-Reply-To: <036001c54b27$b9de0470$4800a8c0@Inswitch251> References: <426E3FE0.8040404@erlang-fr.org> <036001c54b27$b9de0470$4800a8c0@Inswitch251> Message-ID: <1114607924.9423.232834111@webmail.messagingengine.com> Mr, in mailing list archive it shows that you have been evaluating erlang for many years and must know very much indeed about evaluation now. Please advice results. May be good to evaluation include erl_parse module and his fonction parse_term and then also erl_scan. {ok, T, _} = erl_scan:string("{1,2,[hello]}."), erl_parse:parse_term(T). {ok,{1,2,[hello]}} iMan On Wed, 27 Apr 2005 09:50:39 -0300, "Inswitch Solutions - Erlang Evaluation" said: > Hi, > > Does someone know if there is an easy way to convert a string to an > Erlang > term? > example: > "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} > > > thanks in advance, > Eduardo Figoli > INSwitch Solutions > > > -- osxroolz@REDACTED From erlang@REDACTED Wed Apr 27 15:25:47 2005 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Wed, 27 Apr 2005 10:25:47 -0300 Subject: String to term References: <426E3FE0.8040404@erlang-fr.org> <036001c54b27$b9de0470$4800a8c0@Inswitch251> <1114607924.9423.232834111@webmail.messagingengine.com> Message-ID: <036c01c54b2c$a44ab1d0$4800a8c0@Inswitch251> You're right, but now the answer is the mailing list for our community! thank you very much, Eduardo Prepaid Expertise - Programmable Switches Powered by Ericsson Licensed Technology Ing. Eduardo Figoli - Development Center - IN Switch Solutions Inc. Headquarters - Miami-U.S.A. Tel: 1305-3578076 Fax: 1305-7686260 Development Center - Montevideo - Uruguay Tel/Fax: 5982-7104457 IN SWITCH EMEA Phone: +33 0 6 0335 9427 - Fax: +33 0 4 93655773 / emea@REDACTED IN SWITCH ASIA Phone: +92 51 2800397/8- Fax: +92 51 2800399/ inswasia@REDACTED e-mail: eduardo@REDACTED ----- Original Message ----- From: To: "Inswitch Solutions - Erlang Evaluation" ; Sent: Wednesday, April 27, 2005 10:18 AM Subject: Re: String to term > Mr, > > in mailing list archive it shows that you have been evaluating erlang > for many years > and must know very much indeed about evaluation now. Please advice > results. > > May be good to evaluation include erl_parse module and his fonction > parse_term > and then also erl_scan. > > {ok, T, _} = erl_scan:string("{1,2,[hello]}."), erl_parse:parse_term(T). > {ok,{1,2,[hello]}} > > iMan > > On Wed, 27 Apr 2005 09:50:39 -0300, "Inswitch Solutions - Erlang > Evaluation" said: > > Hi, > > > > Does someone know if there is an easy way to convert a string to an > > Erlang > > term? > > example: > > "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} > > > > > > thanks in advance, > > Eduardo Figoli > > INSwitch Solutions > > > > > > > -- > > osxroolz@REDACTED > > From mscandar@REDACTED Wed Apr 27 15:29:57 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Wed, 27 Apr 2005 09:29:57 -0400 Subject: String to term In-Reply-To: <036001c54b27$b9de0470$4800a8c0@Inswitch251> References: <426E3FE0.8040404@erlang-fr.org> <036001c54b27$b9de0470$4800a8c0@Inswitch251> Message-ID: <426F93D5.8070304@cisco.com> Inswitch Solutions - Erlang Evaluation wrote: > Hi, > > Does someone know if there is an easy way to convert a string to an Erlang > term? > example: > "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]} > > > thanks in advance, > Eduardo Figoli > INSwitch Solutions > > 1> {ok, Tokens, _} = erl_scan:string("{1,2,[hello]}."). {ok,[{'{',1}, {integer,1,1}, {',',1}, {integer,1,2}, {',',1}, {'[',1}, {atom,1,hello}, {']',1}, {'}',1}, {dot,1}], 1} 2> {ok, Term} = erl_parse:parse_term(Tokens). {ok,{1,2,[hello]}} 3> Mark. From richardc@REDACTED Wed Apr 27 19:25:19 2005 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 27 Apr 2005 19:25:19 +0200 Subject: String to term In-Reply-To: <036c01c54b2c$a44ab1d0$4800a8c0@Inswitch251> References: <426E3FE0.8040404@erlang-fr.org> <036001c54b27$b9de0470$4800a8c0@Inswitch251> <1114607924.9423.232834111@webmail.messagingengine.com> <036c01c54b2c$a44ab1d0$4800a8c0@Inswitch251> Message-ID: <426FCAFF.6050707@csd.uu.se> Inswitch Solutions - Erlang Evaluation wrote: > You're right, but now the answer is the mailing list for our community! > > thank you very much, > Eduardo Indeed it is: http://www.erlang.org/ml-archive/erlang-questions/200307/msg00225.html http://www.erlang.org/ml-archive/erlang-questions/200402/msg00204.html /Richard From ke.han@REDACTED Wed Apr 27 20:44:44 2005 From: ke.han@REDACTED (ke.han) Date: Thu, 28 Apr 2005 02:44:44 +0800 Subject: easy module reload? Message-ID: <426FDD9C.7040502@redstarling.com> The way I work with erlang is to use a simple external editor and a erl shell open separately. When I save a file in the editor, I go test it with the shell. I have read many erlang docs but can't seem to find a simple "one line" function to reload my changed code. I can do the initial compile/load with c(ModuleName), but when I change the code and want to recompile/reload, I have to use several commands. Am I missing something? Also, a way to do this on a per .app file basis would be great. i.e. I want to reloadApp(AppName) and have any changed files in the app definition recompile and reload. Is this possible or should I write my own erlang scripts for this? thanks, ke han From mscandar@REDACTED Wed Apr 27 21:10:53 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Wed, 27 Apr 2005 15:10:53 -0400 Subject: easy module reload? In-Reply-To: <426FDD9C.7040502@redstarling.com> References: <426FDD9C.7040502@redstarling.com> Message-ID: <426FE3BD.2050809@cisco.com> ke.han wrote: > The way I work with erlang is to use a simple external editor and a erl > shell open separately. > When I save a file in the editor, I go test it with the shell. I have > read many erlang docs but can't seem to find a simple "one line" > function to reload my changed code. I can do the initial compile/load > with c(ModuleName), but when I change the code and want to > recompile/reload, I have to use several commands. > Am I missing something? Also, a way to do this on a per .app file basis > would be great. i.e. I want to reloadApp(AppName) and have any changed > files in the app definition recompile and reload. Is this possible or > should I write my own erlang scripts for this? > thanks, ke han > Take a look at: http://www.erlang.org/ml-archive/erlang-questions/200411/msg00068.html Mark. From ke.han@REDACTED Wed Apr 27 21:17:29 2005 From: ke.han@REDACTED (ke.han) Date: Thu, 28 Apr 2005 03:17:29 +0800 Subject: function key capture Message-ID: <426FE549.6000708@redstarling.com> I am trying to write an erlang prototype client app which will do simple read and write to a console and capture function keys for special commands (F1, F2...) i.e. I want one keyboard input loop which outputs what I type to the screen and interprets F keys for other commands. Is there an easy way to do this? Should I try to get my arms around slang or can erlang base product handle this? thanks, ke han From ke.han@REDACTED Wed Apr 27 22:14:49 2005 From: ke.han@REDACTED (ke.han) Date: Thu, 28 Apr 2005 04:14:49 +0800 Subject: easy module reload? In-Reply-To: <426FE3BD.2050809@cisco.com> References: <426FDD9C.7040502@redstarling.com> <426FE3BD.2050809@cisco.com> Message-ID: <426FF2B9.3050003@redstarling.com> Cool..great little tool!!! In the post you reference, it says: >> I've added this code to my _user_default.erl_ Is this "user_default.erl" a special file that erlang loads with the shell? i.e. How do I get erl to load up with these nice little tools at the ready? thanks, ke han Mark Scandariato wrote: > ke.han wrote: > >> The way I work with erlang is to use a simple external editor and a >> erl shell open separately. >> When I save a file in the editor, I go test it with the shell. I have >> read many erlang docs but can't seem to find a simple "one line" >> function to reload my changed code. I can do the initial compile/load >> with c(ModuleName), but when I change the code and want to >> recompile/reload, I have to use several commands. >> Am I missing something? Also, a way to do this on a per .app file >> basis would be great. i.e. I want to reloadApp(AppName) and have any >> changed files in the app definition recompile and reload. Is this >> possible or should I write my own erlang scripts for this? >> thanks, ke han >> > Take a look at: > http://www.erlang.org/ml-archive/erlang-questions/200411/msg00068.html > > Mark. > From mikael.karlsson@REDACTED Wed Apr 27 22:30:44 2005 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Wed, 27 Apr 2005 22:30:44 +0200 Subject: Where is IG - Interface generator? Message-ID: <200504272230.44979.mikael.karlsson@creado.com> Hi, I have a C program that sends C structs "straight out" on a TCP connection. Since the receiver normally also is a C-program this works fine. Now I want an Erlang program to receive them (as a binary) and to map them directly into Erlang records . I have the C header files I thought that the good old IG - Interface Generator would be very handy indeed. I hope I can use IG for this? Unfortunately I am not able to get hold of the ig.tar.gz download file from the location pointed out on the otherwise excellent documentation page: http://www.bluetail.com/tobbe/ig/doc.new/ The pointer http://www.bluetail.com/~tobbe/ig.tar.gz gives me Not Found The requested URL /~tobbe/ig.tar.gz was not found on this server. Thanks for any help on this matter. Mikael From mscandar@REDACTED Wed Apr 27 22:53:56 2005 From: mscandar@REDACTED (Mark Scandariato) Date: Wed, 27 Apr 2005 16:53:56 -0400 Subject: easy module reload? In-Reply-To: <426FF2B9.3050003@redstarling.com> References: <426FDD9C.7040502@redstarling.com> <426FE3BD.2050809@cisco.com> <426FF2B9.3050003@redstarling.com> Message-ID: <426FFBE4.80204@cisco.com> The Fine Manual tells all: http://www.erlang.se/doc/doc-5.4.5/lib/stdlib-1.13.5/doc/html/shell_default.html ke.han wrote: > Cool..great little tool!!! > In the post you reference, it says: > > >> I've added this code to my _user_default.erl_ > > Is this "user_default.erl" a special file that erlang loads with the > shell? i.e. How do I get erl to load up with these nice little tools at > the ready? > > thanks, ke han > > Mark Scandariato wrote: > >> ke.han wrote: >> >>> The way I work with erlang is to use a simple external editor and a >>> erl shell open separately. >>> When I save a file in the editor, I go test it with the shell. I >>> have read many erlang docs but can't seem to find a simple "one line" >>> function to reload my changed code. I can do the initial >>> compile/load with c(ModuleName), but when I change the code and want >>> to recompile/reload, I have to use several commands. >>> Am I missing something? Also, a way to do this on a per .app file >>> basis would be great. i.e. I want to reloadApp(AppName) and have any >>> changed files in the app definition recompile and reload. Is this >>> possible or should I write my own erlang scripts for this? >>> thanks, ke han >>> >> Take a look at: >> http://www.erlang.org/ml-archive/erlang-questions/200411/msg00068.html >> >> Mark. >> > From klacke@REDACTED Wed Apr 27 23:00:51 2005 From: klacke@REDACTED (klacke@REDACTED) Date: Wed, 27 Apr 2005 23:00:51 +0200 Subject: easy module reload? In-Reply-To: <426FF2B9.3050003@redstarling.com> References: <426FDD9C.7040502@redstarling.com> <426FE3BD.2050809@cisco.com> <426FF2B9.3050003@redstarling.com> Message-ID: <20050427210051.GA27454@hyber.org> On Thu, Apr 28, 2005 at 04:14:49AM +0800, ke.han wrote: > Cool..great little tool!!! > In the post you reference, it says: > > >> I've added this code to my _user_default.erl_ > > Is this "user_default.erl" a special file that erlang loads with the shell? > i.e. How do I get erl to load up with these nice little tools at the ready? > [klacke@REDACTED]~ > cat .erlang true = code:add_patha(os:getenv("HOME") ++ "/erlang"). c:l(user_default). [klacke@REDACTED]~ > ls ~/erlang/user_default* /home/klacke/erlang/user_default.beam /home/klacke/erlang/user_default.erl [klacke@REDACTED]~ > erl Erlang (BEAM) emulator version 5.4.5 [source] [hipe] Eshell V5.4.5 (abort with ^G) 1> mm(). [] /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From alexey@REDACTED Thu Apr 28 02:17:15 2005 From: alexey@REDACTED (Alexey Shchepin) Date: Thu, 28 Apr 2005 03:17:15 +0300 Subject: inet_drv.c and send blocking Message-ID: <873btbeovo.fsf@alex.sevcom.net> Hi! It seems there is a bug in inet_drv.c which results in blocking of inet:send. How to reproduce it: 1. Compile the following program (based on test case for inet_driver leaking file descriptors by Luke Gorrie): -module(inetblock). -compile(export_all). go(Port) -> spawn_link(fun() -> {ok, L} = gen_tcp:listen(Port, [{active, false}, binary, {reuseaddr, true}, {packet, 0}]), accept_loop(L) end). accept_loop(L) -> case gen_tcp:accept(L) of {ok, S} -> spawn(fun() -> worker(S) end), flood(S); Err -> exit({accept, Err}) end. worker(S) -> io:format("~p trying a read with timeout..~n", [self()]), case gen_tcp:recv(S, 0, infinity) of {ok, Data} -> io:format("~p got ~p~n", [self(), Data]), worker(S); {error, Rsn} -> io:format("~p error: ~p~n", [self(), Rsn]) end. flood(S) -> io:format("~p trying to send...~n", [self()]), case gen_tcp:send(S, "abcdefghijklmnopqrstuvwxyz~n") of ok -> io:format("~p got ok~n", [self()]), flood(S); {error, Rsn} -> io:format("~p error: ~p~n", [self(), Rsn]) end. 2. Run inetblock:go(1234) in erlang shell. 3. Run telnet localhost 1234 in unix shell. Now you should see a lot of following messages in erlang shell (I've recompiled beam with "#define INET_DRV_DEBUG 1" in inet_drv.c and added some more debug messages, so likely you will see only part of them): <0.37.0> trying to send... tcp_sendv(102): s=10, about to send 0,27 bytes <0.37.0> got ok and lines with english alphabet in telnet. 4. Press Control-] in telnet. Now you should see "telnet>" prompt and <0.37.0> trying to send... tcp_sendv(132): s=10, about to send 0,27 bytes tcp_sendv(132): s=10, Send failed, queuing sock_select(132): flags=02, onoff=1, event_mask=03 <0.37.0> got ok <0.37.0> trying to send... <0.37.0> got ok <0.37.0> trying to send... <0.37.0> got ok <0.37.0> trying to send... <0.37.0> got ok ... <0.37.0> trying to send... tcp_sendv(132): s=10, queue exceeded: need 8196 bytes <0.37.0> got ok <0.37.0> trying to send... in erlang shell. 5. Enter "q" in telnet prompt and press enter. Output in erlang shell: tcp_inet_input(132): entering tcp_recv(132): request_len=0 tcp_remain(132): s=10, n=0, nfill=0 nsz=1024 => more=1024 tcp_recv(132): s=10 about to read 1024 bytes... => detected close free_buffer: 1024 release_buffer: 1024 sock_select(132): flags=01, onoff=0, event_mask=02 deq(132): 1 627 32 deq(132): queue empty <0.39.0> error: closed That's all. Now receiving process got its "closed" message, but sending process didn't, and is blocked inside gen_tcp:send call. I've tried to dig into inet_drv.c and now I think that the problem is inside tcp_recv_closed function: /* The socket has closed, cleanup and send event */ static int tcp_recv_closed(tcp_descriptor* desc) { if (!desc->inet.active) { /* We must cancel any timer here ! */ driver_cancel_timer(desc->inet.port); /* passive mode do not terminate port ! */ tcp_clear_input(desc); if (desc->inet.exitf) { /*1*/ desc_close(INETP(desc)); } else { desc_close_read(INETP(desc)); } /*2*/ async_error_am_all(INETP(desc), am_closed); /* next time EXBADSEQ will be delivered */ } else {...} return -1; } After step 4 there was a call of sock_select(INETP(desc),(FD_WRITE|FD_CLOSE), 1); from tcp_sendv. But after step 5 the function desc_close at /*1*/ removes socket from FD_READ, FD_WRITE, and FD_CLOSE sets, thus forgeting that socket is waiting for writing possibility. If desc->inet.exitf = 0, then desc_close_read is executed instead, and all works fine -- after output in step 5 you will see this: tcp_inet_output(132): s=10, About to send 16 items tcp_inet_output(132): sock_sendv(16) errno = 32 driver_failure_eof(132) in drivers/common/inet_drv.c, line 5854 deq(132): queue empty sock_select(132): flags=03, onoff=0, event_mask=00 <0.37.0> error: einval sock_select(131): flags=03, onoff=0, event_mask=00 So, probably there should be some code to clean sending stuf at /*1*/, or exitf should be 0 (but maybe it will break some behaviour in another place), or tcp_send(v) should call enq_async, so async_error_am_all at /*2*/ will send "{error, closed}" message to sending process... Hope that helps :) From dietmar@REDACTED Thu Apr 28 06:42:48 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Thu, 28 Apr 2005 06:42:48 +0200 Subject: eaddrinuse Message-ID: <427069C8.7030901@ast.dfs.de> Hi ! If I understand it right {reuseaddr, Boolean} as parameter for gen_tcp:listen allows local reuse of port numbers. So the error eaddrinuse should not occur ? Every time I try to reconnect to the server I get this error. Here is my code: getMessages(Port) when integer(Port) -> ListenPid = spawn_link(fun() -> listenServer(Port) end). getMessages() -> io:format("getMessages ~n"), getMessages(?LISTENPORT). listenServer(Port) -> Opts = [{packet, raw}, {active, false},{reuseaddr, true}], case gen_tcp:listen(Port,Opts) of {ok,ListenSocket} -> listenLoop(ListenSocket); {error,eaddrinuse} -> io:format("error eaddrinuse in listenServer ~n"), ok end. listenLoop(ListenSocket) -> {ok,Sock} = gen_tcp:accept(ListenSocket), spawn_link(fun() -> listenHandler(Sock) end), listenLoop(ListenSocket). listenHandler(Sock) -> do_recv(Sock), io:format("do_recv terminated~n"), io:format("calling getMessages again ~n"), gen_tcp:close(Sock), getMessages(). Any hints Regards Dietmar From brian@REDACTED Thu Apr 28 07:40:15 2005 From: brian@REDACTED (Brian Buchanan) Date: Wed, 27 Apr 2005 22:40:15 -0700 (PDT) Subject: eaddrinuse In-Reply-To: <427069C8.7030901@ast.dfs.de> References: <427069C8.7030901@ast.dfs.de> Message-ID: <20050427223211.O12742@mail.ncircle.com> On Thu, 28 Apr 2005, Dietmar Schaefer wrote: > If I understand it right > > {reuseaddr, Boolean} as parameter for gen_tcp:listen allows local > reuse of port numbers. > > > So the error eaddrinuse should not occur ? > > > Every time I try to reconnect to the server I get this error. reuseaddr (or SO_REUSEADDR as it is translated to the kernel) only allows reuse of port numbers that were recently used but not currently in use. (They are not normally available for some period of time in order to provide a strict implementation of the TCP specification). If another open socket has that port number, you won't be able to bind it. I know that at least BSD-derived OSes support a SO_REUSEPORT option for setsockopt() that enables multiple sockets to simultaneously listen on the same address and port if all of them enable the option. The Erlang inet module doesn't appear to support this flag, however. - Brian From serge@REDACTED Thu Apr 28 15:37:56 2005 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 28 Apr 2005 09:37:56 -0400 Subject: eaddrinuse In-Reply-To: <20050427223211.O12742@mail.ncircle.com> References: <427069C8.7030901@ast.dfs.de> <20050427223211.O12742@mail.ncircle.com> Message-ID: <4270E734.3070701@hq.idt.net> Brian Buchanan wrote: > On Thu, 28 Apr 2005, Dietmar Schaefer wrote: >>If I understand it right >> >> {reuseaddr, Boolean} as parameter for gen_tcp:listen allows local >>reuse of port numbers. >> >> >>So the error eaddrinuse should not occur ? >> >> >>Every time I try to reconnect to the server I get this error. > > reuseaddr (or SO_REUSEADDR as it is translated to the kernel) only allows > reuse of port numbers that were recently used but not currently in use. > (They are not normally available for some period of time in order to > provide a strict implementation of the TCP specification). If another > open socket has that port number, you won't be able to bind it. It looks like when you restart the server, the listener's Pid doesn't get terminated, and it's still holding the socket open. Most common use of {reuseaddr, true} option is to handle reacquisition of a socket by a server in the following scenario: 1. A listening server is started. 2. It receives a connection request, and spawns a child process to handle it. 3. The listening server terminates without killing the child, who's still processing the request on the established connection. 4. The listening server gets restarted. However, if you are trying to start the second instance of a TCP server and attempt to bind to the same IP:Port, it will fail even though {reuseaddr, true} is specified. > I know that at least BSD-derived OSes support a SO_REUSEPORT option for > setsockopt() that enables multiple sockets to simultaneously listen on the > same address and port if all of them enable the option. The Erlang inet > module doesn't appear to support this flag, however. I believe the duplicate bindings (i.e. to the same IP address and port) are *only* possible for UDP multicast binds. TCP doesn't support this and should always fail with eaddrinuse if another process is active and is bound to that socket. UDP non-multicast binds with {reuseaddr, true} will allow you to "steal" a socket from another process (without that process knowing about it), yet the kernel will only deliver UDP messages to the latest process that bound the UDP socket. It is possible, however, to do a TCP bind to the same port if you use {reuseaddr, true}, and a *different* local IP address. Serge From dietmar@REDACTED Thu Apr 28 15:39:50 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Thu, 28 Apr 2005 15:39:50 +0200 Subject: mnesia - add record to Message-ID: <4270E7A6.9090709@ast.dfs.de> Hi ! I have a mnesia-snmp table: -record(centerDisplayProcessesList, {index,hostname,sector,rowStatus}). I now want to add a record but I can't submit an index. How can I just add a new record for which I do not know the appropriate index ? Regards Dietmar From jwebb@REDACTED Fri Apr 29 03:08:57 2005 From: jwebb@REDACTED (John Webb) Date: Fri, 29 Apr 2005 10:08:57 +0900 Subject: inets: request error on Windows XP Message-ID: Hello, I am using R10B-4 and have run into a problem using http:request/4 on Windows XP (SP2). It seems that specifying a numeric IP address causes a badmatch error somewhere in the depths of inets. The same code runs fine on MAC OS. Has anyone else seen this problem or am I missing something on the windows side? On MAC OS 10.3.9 built from the source distribution I get: Erlang (BEAM) emulator version 5.4.5 [source] Eshell V5.4.5 (abort with ^G) 1> application:start(inets). ok 2> {ok, {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. {"HTTP/1.1",200,"OK"} 3> {ok, {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. {"HTTP/1.1",200,"OK"} 4> But on Windows XP (SP2) from the binary distribution I get: Erlang (BEAM) emulator version 5.4.5 [threads:0] Eshell V5.4.5 (abort with ^G) 1> application:start(inets). ok 2> {ok, {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. {"HTTP/1.1",200,"OK"} 3> {ok, {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. ** exited: {{case_clause,{undefined,{error, {'EXIT', {{badmatch,{error,badarg}}, [{httpc_manager,start_handler,2}, {httpc_manager,handle_request,2}, {httpc_manager,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}}}}}, [{http,handle_request,5}, {erl_eval,do_apply,5}, {erl_eval,expr,5}, {shell,exprs,6}, {shell,eval_loop,3}]} ** 4> =ERROR REPORT==== 29-Apr-2005::09:22:39 === ** Generic server httpc_manager terminating ** Last message in was {request,{request, undefined, <0.29.0>, 0, http, {"66.102.7.147",80}, "/", [], get, {http_request_h, undefined, "keep-alive", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "66.102.7.147", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, [], undefined, undefined, undefined, undefined, "0", undefined, undefined, undefined, undefined, undefined, undefined, []}, {[],[]}, {http_options,infinity,true,[],false}, "http://66.102.7.147"}} ** When Server state == {state,[], 14, {undefined,15}, {options,{undefined,[]},0,2,2,disabled}} ** Reason for termination == ** {'EXIT',{{badmatch,{error,badarg}}, [{httpc_manager,start_handler,2}, {httpc_manager,handle_request,2}, {httpc_manager,handle_call,3}, {gen_server,handle_msg,6}, {proc_lib,init_p,5}]}} =ERROR REPORT==== 29-Apr-2005::09:22:40 === Error in process <0.29.0> with exit value: {{case_clause,{undefined,{error,{'EX T',{{badmatch,{error,badarg}},[{httpc_manager,start_handler,2},{httpc_ma nager,h ndle_request,2},{httpc_manager,handle_call,3},{gen_server,handle_msg,6}, {proc_l b,init_p,5}]}}}}},[{http,... Regards, -jw From dietmar@REDACTED Fri Apr 29 06:13:54 2005 From: dietmar@REDACTED (Dietmar Schaefer) Date: Fri, 29 Apr 2005 06:13:54 +0200 Subject: Re eaddrinuse Message-ID: <4271B482.2030606@ast.dfs.de> Thank you very much you wizards of Oz OOPS Erlang I mean ! It was just my stupid fault. What I meant to get was someting quite simple -> just to accept a new connection whenever one has terminated. I actually did not want to start a new process listening on the socket. Now I got it ! Thanks ! Dietmar From bertil@REDACTED Fri Apr 29 12:00:51 2005 From: bertil@REDACTED (Bertil Karlsson) Date: Fri, 29 Apr 2005 12:00:51 +0200 Subject: xmerl_lib R10B-4 In-Reply-To: <20050425085657.GR9417@fangora.autosys.us> References: <20050425085657.GR9417@fangora.autosys.us> Message-ID: <427205D3.9000006@erix.ericsson.se> We have no plans to remove those functions. But, genarally speaking you shouldn't rely on undocumented functions. /Bertil Karlsson Michael Mcdaniel wrote: > I am using R10B-4 xmerl_lib:simplify_content/1 and also > xmerl_lib:find_attribute/2 because i could not figure out > how to do what I wanted with the externally documented functions. > > QUESTION: > Should I be concerned about xmerl_lib funs disappearing in later releases > of Erlang and breaking my application? > > > thanks, > > ~Michael > > From sean.hinde@REDACTED Fri Apr 29 15:25:24 2005 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 29 Apr 2005 14:25:24 +0100 Subject: eaddrinuse In-Reply-To: <4270E734.3070701@hq.idt.net> References: <427069C8.7030901@ast.dfs.de> <20050427223211.O12742@mail.ncircle.com> <4270E734.3070701@hq.idt.net> Message-ID: <266a3049274630c2245db6e67b1766d9@mac.com> > > I believe the duplicate bindings (i.e. to the same IP address and > port) are *only* possible for UDP multicast binds. TCP doesn't > support this and should always fail with eaddrinuse if another process > is active and is bound to that socket. UDP non-multicast binds with > {reuseaddr, true} will allow you to "steal" a socket from another > process (without that process knowing about it), yet the kernel will > only deliver UDP messages to the latest process that bound the UDP > socket. Not entirely true. For UDP it is possible to dup the UDP file descriptor into several UNIX processes and the OS will send UDP datagrams to any of them. Relevant stuff here: http://forums.trapexit.org:81/phpBB/viewtopic.php? t=3250&postdays=0&postorder=asc&highlight=file+descriptor&start=15 Sean From jd@REDACTED Fri Apr 29 15:41:00 2005 From: jd@REDACTED (John Derrick) Date: Fri, 29 Apr 2005 14:41:00 +0100 (BST) Subject: RA and PhD positions available Message-ID: <200504291341.j3TDf0HO007276@holly.dcs.shef.ac.uk> (Apologies if you get duplicates of this message). We have a 3-year PostDoc position at Sheffield for work on verification of Erlang programs. Please pass on to anyone who may be interested. Further details at: http://www.dcs.shef.ac.uk/research/job_opp/pr3650.html We also have a PhD Studentship for work on developing testing techniques applicable to Erlang code. Please pass on to anyone who may be interested. Further details at: http://www.dcs.shef.ac.uk/research/phd_opp/jd_phd.htm Best, John From anders.nygren@REDACTED Fri Apr 29 15:54:23 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Apr 2005 08:54:23 -0500 Subject: inets: request error on Windows XP In-Reply-To: References: Message-ID: On 4/28/05, John Webb wrote: > Hello, > > I am using R10B-4 and have run into a problem using http:request/4 on > Windows XP (SP2). It seems that specifying a numeric IP address causes > a badmatch error somewhere in the depths of inets. The same code runs > fine on MAC OS. Has anyone else seen this problem or am I missing > something on the windows side? > > On MAC OS 10.3.9 built from the source distribution I get: > > Erlang (BEAM) emulator version 5.4.5 [source] > > Eshell V5.4.5 (abort with ^G) > 1> application:start(inets). > ok > 2> {ok, > {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. > {"HTTP/1.1",200,"OK"} > 3> {ok, > {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. > {"HTTP/1.1",200,"OK"} > 4> > > But on Windows XP (SP2) from the binary distribution I get: > > Erlang (BEAM) emulator version 5.4.5 [threads:0] > > Eshell V5.4.5 (abort with ^G) > 1> application:start(inets). > ok > 2> {ok, > {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. > {"HTTP/1.1",200,"OK"} > 3> {ok, > {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. > ** exited: {{case_clause,{undefined,{error, > {'EXIT', > {{badmatch,{error,badarg}}, > > [{httpc_manager,start_handler,2}, > > {httpc_manager,handle_request,2}, > > {httpc_manager,handle_call,3}, > {gen_server,handle_msg,6}, > {proc_lib,init_p,5}]}}}}}, > [{http,handle_request,5}, > {erl_eval,do_apply,5}, > {erl_eval,expr,5}, > {shell,exprs,6}, > {shell,eval_loop,3}]} ** > This looks like a problem I have had too. See, http://www.erlang.org/ml-archive/erlang-questions/200503/msg00014.html http://www.erlang.org/ml-archive/erlang-questions/200503/msg00045.html I never got any response to those, and I never found the problem. I am happy to see that it works with a name instead of IP address. Another problem with http:request, (at least on Linux), is that if You give a timeout, the request works but there is a crash somewhere in inets, when it tries to remove the timer. So for me it has been impossible to use http on both Linux and Windows, so I have had to make a Java node to handle http requests. This is not just a little embarrasing while trying to convince management to let me use Erlang in some projects. /Anders From anders.nygren@REDACTED Fri Apr 29 16:40:38 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Apr 2005 09:40:38 -0500 Subject: Windows missing registry entries? Message-ID: Hi I am have been trying to get Erlang to run in embedded mode on windows and noticed that start_erl looks for two registry entries software/Ericsson/Erlang/vsn/Bindir software/Ericsson/Erlang/vsn/Rootdir These entries are not added by the default windows installation for R10B-3 and 4. Is that a bug in the installation or the documentation? /Anders From jwebb@REDACTED Fri Apr 29 17:25:51 2005 From: jwebb@REDACTED (John Webb) Date: Sat, 30 Apr 2005 00:25:51 +0900 Subject: inets: request error on Windows XP In-Reply-To: References: Message-ID: <516c8439cdfcb007dd98e7aa7418c8e2@gol.com> On a side note, I thought to use erlang to develop an application to collect image data from network cameras and video sources. Many devices use Netscape's multibyte/x-mixed-replace content-type to stream MJPEG data so I started to started to experiment with an extension to the inets http client to handle this case. Has anyone done anything along these lines or would be interested in such a function? (Warning! Erlang novice at work!) Regards, -jw On Apr 29, 2005, at 10:52 PM, Anders Nygren wrote: > On 4/28/05, John Webb wrote: >> Hello, >> >> I am using R10B-4 and have run into a problem using http:request/4 on >> Windows XP (SP2). It seems that specifying a numeric IP address causes >> a badmatch error somewhere in the depths of inets. The same code runs >> fine on MAC OS. Has anyone else seen this problem or am I missing >> something on the windows side? >> >> On MAC OS 10.3.9 built from the source distribution I get: >> >> Erlang (BEAM) emulator version 5.4.5 [source] >> >> Eshell V5.4.5 (abort with ^G) >> 1> application:start(inets). >> ok >> 2> {ok, >> {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. >> {"HTTP/1.1",200,"OK"} >> 3> {ok, >> {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. >> {"HTTP/1.1",200,"OK"} >> 4> >> >> But on Windows XP (SP2) from the binary distribution I get: >> >> Erlang (BEAM) emulator version 5.4.5 [threads:0] >> >> Eshell V5.4.5 (abort with ^G) >> 1> application:start(inets). >> ok >> 2> {ok, >> {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. >> {"HTTP/1.1",200,"OK"} >> 3> {ok, >> {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. >> ** exited: {{case_clause,{undefined,{error, >> {'EXIT', >> >> {{badmatch,{error,badarg}}, >> >> [{httpc_manager,start_handler,2}, >> >> {httpc_manager,handle_request,2}, >> >> {httpc_manager,handle_call,3}, >> >> {gen_server,handle_msg,6}, >> >> {proc_lib,init_p,5}]}}}}}, >> [{http,handle_request,5}, >> {erl_eval,do_apply,5}, >> {erl_eval,expr,5}, >> {shell,exprs,6}, >> {shell,eval_loop,3}]} ** >> 4> > > This looks like a problem I have had too. > See, > http://www.erlang.org/ml-archive/erlang-questions/200503/msg00014.html > http://www.erlang.org/ml-archive/erlang-questions/200503/msg00045.html > > I never got any response to those, and I never found the problem. > I am happy to see that it works with a name instead of IP address. > > Another problem with http:request, (at least on Linux), is that if You > give a > timeout, the request works but there is a crash somewhere in inets, > when > it tries to remove the timer. > So for me it has been impossible to use http on both Linux and Windows, > so I have had to make a Java node to handle http requests. > > This is not just a little embarrasing while trying to convince > management > to let me use Erlang in some projects. > > /Anders > From ingela@REDACTED Fri Apr 29 17:35:25 2005 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 29 Apr 2005 17:35:25 +0200 Subject: inets: request error on Windows XP References: Message-ID: <17010.21565.706305.793435@gargle.gargle.HOWL> John Webb wrote: > Hello, > > I am using R10B-4 and have run into a problem using http:request/4 on > Windows XP (SP2). It seems that specifying a numeric IP address causes > a badmatch error somewhere in the depths of inets. The same code runs > fine on MAC OS. Has anyone else seen this problem or am I missing > something on the windows side? > > On MAC OS 10.3.9 built from the source distribution I get: > > Erlang (BEAM) emulator version 5.4.5 [source] > > Eshell V5.4.5 (abort with ^G) > 1> application:start(inets). > ok > 2> {ok, > {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. > {"HTTP/1.1",200,"OK"} > 3> {ok, > {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. > {"HTTP/1.1",200,"OK"} > 4> > > But on Windows XP (SP2) from the binary distribution I get: > > Erlang (BEAM) emulator version 5.4.5 [threads:0] > > Eshell V5.4.5 (abort with ^G) > 1> application:start(inets). > ok > 2> {ok, > {R1,_,_}}=http:request(get,{"http://www.google.com",[]},[],[]),R1. > {"HTTP/1.1",200,"OK"} > 3> {ok, > {R2,_,_}}=http:request(get,{"http://66.102.7.147",[]},[],[]),R2. > ** exited: {{case_clause,{undefined,{error, > {'EXIT', > {{badmatch,{error,badarg}}, > > [{httpc_manager,start_handler,2}, > > {httpc_manager,handle_request,2}, > > {httpc_manager,handle_call,3}, [...] Strange I will look in to it when I get some time! I am kind of swamped at the moment so I am not promising any quick answers! -- /Ingela - OTP team From ingela@REDACTED Fri Apr 29 17:37:13 2005 From: ingela@REDACTED (Ingela Anderton) Date: Fri, 29 Apr 2005 17:37:13 +0200 Subject: inets: request error on Windows XP References: Message-ID: <17010.21673.97605.971085@gargle.gargle.HOWL> Anders Nygren wrote: > This looks like a problem I have had too. > See, > http://www.erlang.org/ml-archive/erlang-questions/200503/msg00014.html > http://www.erlang.org/ml-archive/erlang-questions/200503/msg00045.html > > I never got any response to those, and I never found the problem. > I am happy to see that it works with a name instead of IP address. Sometimes things gets drowned in the information sea! > Another problem with http:request, (at least on Linux), is that if You give a > timeout, the request works but there is a crash somewhere in inets, when > it tries to remove the timer. > So for me it has been impossible to use http on both Linux and Windows, > so I have had to make a Java node to handle http requests. > > This is not just a little embarrasing while trying to convince management > to let me use Erlang in some projects. I did fix this right away! Maybe I has not made it in to an open source release yet, but hey there ought to be some privileges with buying a license ;) If you did feel a strong enough need you could have fixed it yourself it was quite an easy fix! And I had actually told you what the problem was! But maybe you felt writing a java program was easier than trying to understand some erlang code that somebody else wrote?! Maybe I could have given you another pointer on how to fix it, if you would have asked nicely even though that is not my job! At least I do not feel embarrassed! -- /Ingela - OTP team From serge@REDACTED Fri Apr 29 18:01:00 2005 From: serge@REDACTED (Serge Aleynikov) Date: Fri, 29 Apr 2005 12:01:00 -0400 Subject: eaddrinuse In-Reply-To: <266a3049274630c2245db6e67b1766d9@mac.com> References: <427069C8.7030901@ast.dfs.de> <20050427223211.O12742@mail.ncircle.com> <4270E734.3070701@hq.idt.net> <266a3049274630c2245db6e67b1766d9@mac.com> Message-ID: <42725A3C.6080300@hq.idt.net> Thanks Sean. Your response forced me to read the relevant chapter in the Stevens' "Advanced Programming in the UNIX Environment" p479 that talks about file-descriptor passing between different processes. In a few projects I was forced to use the IP multicast technique in order to have multiple listeners receiving messages on the same port. The clear advantage of the method you mentioned is that each server is binding to a local IP address rather than an address in a multicast range, and you don't need to worry about multicast filtering by routers. Perhaps there are other beneficial uses of this technique... Serge Sean Hinde wrote: >> I believe the duplicate bindings (i.e. to the same IP address and >> port) are *only* possible for UDP multicast binds. TCP doesn't >> support this and should always fail with eaddrinuse if another >> process is active and is bound to that socket. UDP non-multicast >> binds with {reuseaddr, true} will allow you to "steal" a socket from >> another process (without that process knowing about it), yet the >> kernel will only deliver UDP messages to the latest process that >> bound the UDP socket. > > > Not entirely true. For UDP it is possible to dup the UDP file > descriptor into several UNIX processes and the OS will send UDP > datagrams to any of them. > > Relevant stuff here: > > http://forums.trapexit.org:81/phpBB/viewtopic.php? > t=3250&postdays=0&postorder=asc&highlight=file+descriptor&start=15 > > > Sean > > -- ================================================================ | Serge Aleynikov Tel: (973) 438-3436 | MIS Telecom Fax: (973) 438-1457 | IDT Corp. serge@REDACTED ================================================================ From anders.nygren@REDACTED Fri Apr 29 18:07:48 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Apr 2005 11:07:48 -0500 Subject: inets: request error on Windows XP In-Reply-To: <17010.21673.97605.971085@gargle.gargle.HOWL> References: <17010.21673.97605.971085@gargle.gargle.HOWL> Message-ID: On 4/29/05, Ingela Anderton wrote: > > Anders Nygren wrote: snip > > Another problem with http:request, (at least on Linux), is that if You give a > > timeout, the request works but there is a crash somewhere in inets, when > > it tries to remove the timer. > > So for me it has been impossible to use http on both Linux and Windows, > > so I have had to make a Java node to handle http requests. > > > > This is not just a little embarrasing while trying to convince management > > to let me use Erlang in some projects. > I did fix this right away! Maybe I has not made it in to an open > source release yet, but hey there ought to be some privileges with > buying a license ;) If you did feel a strong enough need you could > have fixed it yourself it was quite an easy fix! And I had actually > told you what the problem was! But maybe you felt writing a java > program was easier than trying to understand some erlang code that > somebody else wrote?! No, I _really_ don't think its easier to write stuff in Java, but in this case the system has to run on Windows, so I never got to the point where the timeout was a problem. Because of the other problem mentioned earlier. > Maybe I could have given you another pointer on > how to fix it, if you would have asked nicely even though that is not > my job! So now that I can use http:request on Windows, I would really appreciate it if You could give me some more info on how to fix the timeout problem. /Anders From anders.nygren@REDACTED Sat Apr 30 01:20:51 2005 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Apr 2005 18:20:51 -0500 Subject: .config file bug on Windows Message-ID: Hi On Windows it is necessary for a .config file to end with an empty line. If not the emulator will crash with {error_logger,{{2005,4,29},{18,17,8}},'"./sys.config": none: not found\n',[]} /Anders