From ovidiudeac@REDACTED Sat Aug 1 04:55:45 2009 From: ovidiudeac@REDACTED (Ovidiu Deac) Date: Sat, 1 Aug 2009 05:55:45 +0300 Subject: [erlang-questions] how to break the problem. the erlang way? In-Reply-To: References: <804cd4020907310747w21f4567djb3797798064d8520@mail.gmail.com> <804cd4020907311309g1bd41732v1bc3fc9f59ec5445@mail.gmail.com> <1249072071.29722.4.camel@sredniczarny> Message-ID: <804cd4020907311955l5f1c77d1sec84cd7b83ffba16@mail.gmail.com> Nice. So basically allocating the memory for a new process should be very fast (like stack allocation?) and then growing/cleaning it's heap will be performed only when the process runs out of heap space. Since every process has it's own non-shared data then it will have a per-process gc which is guaranteed that it won't run as long as the process' heap needs fit in the min_heap_size provided by spawn_opt. So if I determined a min_heap_size (after proper measurement of course) can I rely on the fact gc won't run on any platform? Or maybe this size depends on the erlang vm implementation? I'm thinking about 32 vs 64 bit platforms. If this is the case I should use the maximum detected for the intended deployment platforms. For this tuning phase how can I detect that gc was called for a process? On Fri, Jul 31, 2009 at 11:39 PM, Mihai Balea wrote: > > On Jul 31, 2009, at 4:27 PM, Witold Baryluk wrote: > >> Dnia 2009-07-31, pi? o godzinie 23:09 +0300, Ovidiu Deac pisze: >>> >>> On Fri, Jul 31, 2009 at 6:41 PM, Mihai Balea wrote: >> >> h >>>> >>>> One advantage of having transient processes is that you can tune them to >>>> never need garbage collection, which is not the case for long lived >>>> processes. >>> >>> Can you detail this part? I don't think I understand what you mean by >>> "tune them to never need garbage collection" but it sounds good :) >> >> I think He mean that if spawned process will do its job quickly >> (and it will not trigger garbage collection due to small usage of own >> heap and stack), all memory will be freed after its terminate. >> So it will still reclaim its memory, but it will be trivial and >> ultra fast. > > Yes, that is gist of it. > > GC in Erlang is done on a per-process basis - each process has its own heap > that is managed ?and collected independently. > If the process is sufficiently short lived, it will terminate before GC is > triggered and the entire process memory is reclaimed in one very fast ?step. > By "fine-tuning" I was referring to the ability to set the initial process > heap, when you spawn the process. > > Mihai From dave.pawson@REDACTED Sat Aug 1 06:26:28 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Sat, 1 Aug 2009 05:26:28 +0100 Subject: [erlang-questions] how to break the problem. the erlang way? In-Reply-To: References: <804cd4020907310747w21f4567djb3797798064d8520@mail.gmail.com> Message-ID: <711a73df0907312126q7f38b503yc4d2a4d9b949d916@mail.gmail.com> 2009/7/31 Mihai Balea : > Depending on how heavy is your message unpacking and deserializing, you > might want to do something like: > > Receiver -> spawn a process for each packet that unpacks/deserializes it -> > Orderer/Writer > > That, of course, assumes packets can be processed independently. > > One advantage of having transient processes is that you can tune them to > never need garbage collection, which is not the case for long lived > processes. Just to confirm, by 'transient process', do you mean the process is spawned, processes one packet, and then dies? TIA -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From mihai@REDACTED Sun Aug 2 16:13:55 2009 From: mihai@REDACTED (Mihai Balea) Date: Sun, 2 Aug 2009 10:13:55 -0400 Subject: [erlang-questions] how to break the problem. the erlang way? In-Reply-To: <711a73df0907312126q7f38b503yc4d2a4d9b949d916@mail.gmail.com> References: <804cd4020907310747w21f4567djb3797798064d8520@mail.gmail.com> <711a73df0907312126q7f38b503yc4d2a4d9b949d916@mail.gmail.com> Message-ID: On Aug 1, 2009, at 12:26 AM, Dave Pawson wrote: >> >> One advantage of having transient processes is that you can tune >> them to >> never need garbage collection, which is not the case for long lived >> processes. > > > Just to confirm, by 'transient process', do you mean the process > is spawned, processes one packet, and then dies? Yes, that's correct. From mihai@REDACTED Sun Aug 2 16:24:38 2009 From: mihai@REDACTED (Mihai Balea) Date: Sun, 2 Aug 2009 10:24:38 -0400 Subject: [erlang-questions] how to break the problem. the erlang way? In-Reply-To: <804cd4020907311955l5f1c77d1sec84cd7b83ffba16@mail.gmail.com> References: <804cd4020907310747w21f4567djb3797798064d8520@mail.gmail.com> <804cd4020907311309g1bd41732v1bc3fc9f59ec5445@mail.gmail.com> <1249072071.29722.4.camel@sredniczarny> <804cd4020907311955l5f1c77d1sec84cd7b83ffba16@mail.gmail.com> Message-ID: <6D1A328E-CE49-4E10-8E09-B83A48728472@hates.ms> On Jul 31, 2009, at 10:55 PM, Ovidiu Deac wrote: > Nice. > > So basically allocating the memory for a new process should be very > fast (like stack allocation?) and then growing/cleaning it's heap > will be performed only when the process runs out of heap space. Since > every process has it's own non-shared data then it will have a > per-process gc which is guaranteed that it won't run as long as the > process' heap needs fit in the min_heap_size provided by spawn_opt. That's the basic idea, although I'm sure people more familiar with the inner workings of the VM can provide more details. > > So if I determined a min_heap_size (after proper measurement of > course) can I rely on the fact gc won't run on any platform? Or maybe > this size depends on the erlang vm implementation? I'm thinking about > 32 vs 64 bit platforms. If this is the case I should use the maximum > detected for the intended deployment platforms. Yes, 32 vs. 64 bit platforms will have different size requirements, It would probably be a good idea profile on any platform you plan on using. > For this tuning phase how can I detect that gc was called for a > process? Not sure, I would look at erlang:process_info() or some similar function Mihai From yoursurrogategod@REDACTED Mon Aug 3 03:19:15 2009 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Sun, 2 Aug 2009 18:19:15 -0700 (PDT) Subject: Nested for-loops, there has to be a better way to do this In-Reply-To: <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> References: <187b6a3f-498c-4281-bc30-0ad40a13c4c9@p36g2000prn.googlegroups.com> <9b08084c0907282335s7fc42eb5r8e925e9597dae34c@mail.gmail.com> <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> Message-ID: <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> Not quite. For your input, this should be your output: [4, 2, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1] On Jul 31, 9:34?am, Joe Armstrong wrote: > I still don't understand. Erlang (or any functional programming languages) > is made from lots of small functions. Each function has inputs and outputs > and there is some relationship between the inputs and the output. > > To specify a function we must state what the inputs are, state what > the outputs are and state what the relationship between the inputs and > outputs are. > > The fact that you print something is irrelevant. You could just as > well say that the > output of a function is a list and that you then print the items in the list one > at a time. > > I have tried to write a program that *exactly* follows your spec. > Following the rules in your spec I conclude that if the input to your program > is the list [4,2,1,1] then the output should be [4,2,1,5,4,3,2,1,1,3,2,1] > > Is this correct? > > Here's the program - read the comments to see how the code relates to the spec. > > -module(process). > > -compile(export_all). > > test() -> > ? ? process([4,2,1,5]). > > process(In) -> > ? ? Out = f(In), > ? ? [io:format("~p~n", [I]) || I <- Out]. > > %% Now we have to write f > %% The spec says this: > > %% Takes first int, processes it (in this case, prints it out), > %% decrements it, takes the second int, processes it (prints it out), > %% decrements it and on. ?When it gets to the very last item, it > %% processes it until there are none left. ?Then goes to the one above > %% it, processes it, decrements it... wash, rinse, repeat :) . > > %% What this mean ... lets' take it bit by bit. > > %% The first two lines say > %% Takes first int, processes it (in this case, prints it out), > %% decrements it, takes the second int, processes it (prints it out), > > %% What happens after the first int has been decremented? > %% Now we have to "take the second int" wheres the first Int gone? > %% It seems like it is pushed onto a stack, so we can deal with it later. > %% The idea of a stack is reinforced by saying later "goes to the one above" > > %% So here's what I think the first two lines of the spec mean: > > f(L) -> process(L, [], []). > > process([Int|T], Stack, Print) -> > ? ? %% Takes first int, processes it (in this case, prints it out), > ? ? %% decrements it, takes the second int, processes it (prints it out), > ? ? process(T, [Int-1|Stack], [Int|Print]); > > %% Now we get to the next major bit of the spec > %% ?.. When it gets to the very last item, it > %% ?.. processes it until there are none left. ?Then goes to the one above > %% .. it, processes it, decrements it... wash, rinse, repeat :) . > > %% This is very confusing. The word "it" is referred to many times > %% What is "it". > %% "when it gets to the very last item, it process it until there are non left" > > %% But if it has got to the very last item there there is nothing to process > %% because it is the last item. > > %% To resolve this we look at the next lines of the spec > %% " When it gets to the very last item, it > %% ? processes it until there are none left. ?Then goes to the one above > %% ? it, processes it, decrements it... wash, rinse, repeat :) . > > %% I think this means this: > process([], [H|Rest], Print) when H > 0-> > ? ? process([], [H-1|Rest], [H|Print]); > > %% All this talk of decrementing things makes me wonder > %% how the iteration will stop I assume it's when > %% "it" reaches zero which is why I added the guard above. > %% Let's add a base case > > process([], [0|Rest], Print) -> > ? ? process([], Rest, Print); > > %% Finally when "it" is zero and "there is nothing above" > > process([], [], Print) -> > ? ? lists:reverse(Print). > > %% end > > Incidentally if you had given a test case > i.e that for the input ?[4,2,1,1] then the output should be > [4,2,1,5,4,3,2,1,1,3,2,1] > > Then I would have immediately translated this into a unit test: > > ? ?test() -> > ? ? ? ? [4,2,1,5,4,3,2,1,1,3,2,1] = f([4,2,1,1]). > > *before* writing the code > > Cheers > > /Joe > > On Fri, Jul 31, 2009 at 3:59 AM, Yves S. > > > > > > Garret wrote: > > Takes first int, processes it (in this case, prints it out), > > decrements it, takes the second int, processes it (prints it out), > > decrements it and on. ?When it gets to the very last item, it > > processes it until there are none left. ?Then goes to the one above > > it, processes it, decrements it... wash, rinse, repeat :) . > > > In retrospect, I could have made this clearer. > > > On Jul 29, 2:35?am, Joe Armstrong wrote: > >> I don't understand what you want. > > >> If the input to your program is: [5,5,10] > >> the output should be: X > > >> What is X? > > >> /Joe > > >> On Wed, Jul 29, 2009 at 4:55 AM, Yves S. > > >> Garret wrote: > >> > I was playing around with the idea of implementing a nested for-loop > >> > like construct (I will concede, they are evil, but at rare times, > >> > necessary.) ?In non-functional programming languages, they are trivial > >> > to do. ?However, this has proved to be one of those simple things that > >> > are a pain in the neck for me. ?The idea was to be able to pass in a > >> > list [5, 5, 10] (for example) and go through it all like 3 dimensional > >> > array. ?The below illustration is far from elegant (it's almost 23:00 > >> > where I live and need to go to work tomorrow early, so no time to come > >> > up with something more sane :) ), but is there as an inquisitive > >> > exercise. ?Now, in my opinion, this implementation sucks (first time > >> > I've ever gave such a problem a shot in Erlang.) > > >> > Is there a better way to do this? ?Anyone would like to demonstrate > >> > it? > > >> > Note: I've tested this code with the lists [2, 4] and [2, 4, 5]. > > >> > Compiled with: > >> > Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.6.5 > > >> > My code: > >> > ====================================== > >> > -module(loopWrapper). > > >> > -export([runLoop/1]). > > >> > runLoop(List) -> > >> > ?[FirstVal | RestList] = List, > >> > ?NextVal = FirstVal - 1, > >> > ?if (length(RestList) > 0) and (FirstVal > 0) -> > >> > ? ?io:format("~B~n~n", [FirstVal]), > >> > ? ?runLoop(RestList), > >> > ? ?io:format("~n~n"), > >> > ? ?runLoop([NextVal | RestList]); > >> > ?FirstVal > 0 -> > >> > ? ?io:format("~B", [FirstVal]), > >> > ? ?runLoop([NextVal]); > >> > ?true -> > >> > ? ?null > >> > ?end. > > >> > ________________________________________________________________ > >> > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > >> > erlang-questions (at) erlang.org > > >> ________________________________________________________________ > >> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > > > ________________________________________________________________ > > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From nick@REDACTED Mon Aug 3 09:03:42 2009 From: nick@REDACTED (Niclas Eklund) Date: Mon, 3 Aug 2009 09:03:42 +0200 (CEST) Subject: EUC 2009 - Call for Papers Message-ID: EUC 2009 - Call for Papers All Erlang developers, researchers, users, programmers, and interested persons are hereby cordially invited to the 15th International Erlang User Conference, EUC, which will take place in Stockholm on Thursday November 12, 2009. Please see the conference web site at http://www.erlang-factory.com/conference/ErlangUserConference2009 Since the EUC has outgrown its previous venue, this year's EUC will take place in a location in the centre of Stockholm. This means that there will be a nominal conference fee which also covers lunch. Presentations for the EUC are invited. They could be academic papers, project reports, over-head slides etc. Demos to be shown during intermissions are also welcome. Please see previous EUC for examples. http://www.erlang.se/euc/ Dead-line for submissions is September 20 and author notification will be September 30. The paper submission page is found at http://www.erlang-factory.com/conference/ErlangUserConference2009/submit_talk Welcome Bjarne D?cker (EUC chairman) From vinayakapawar@REDACTED Mon Aug 3 11:30:43 2009 From: vinayakapawar@REDACTED (Vinayak Pawar) Date: Mon, 3 Aug 2009 15:00:43 +0530 Subject: Mnesia Table Fragmentation Error Message-ID: <23237d040908030230w7dde476ep91b754762fab13a1@mail.gmail.com> Hello all, I'm trying to add a fragment to an already fragmented table. I'm getting below error message: {aborted,{"add_frag: Fragment not locked",315}} Can anyone let me know what this error means and how it can be overcome? Many thanks Best regards, Vinayak From mryufeng@REDACTED Mon Aug 3 12:05:02 2009 From: mryufeng@REDACTED (Feng Yu) Date: Mon, 3 Aug 2009 18:05:02 +0800 Subject: bug in R13B01 inet:setopt(high_watermark) Message-ID: <549b206a0908030305yff24e0id0cf471504fbe03d@mail.gmail.com> Hi, Maybe a bug in R13B01 erts/emulator/drivers/common/inet_drv.c:L 4674 found: case INET_LOPT_TCP_HIWTRMRK: if (desc->stype == SOCK_STREAM) { tcp_descriptor* tdesc = (tcp_descriptor*) desc; fprintf(stderr, "hiwtrmrk:%d\n", ival); if (ival < 0) ival = 0; else if (ival > INET_MAX_BUFFER*2) ival = INET_MAX_BUFFER*2; if (tdesc->low > ival) tdesc->low = ival; tdesc->high = ival; } continue; case INET_LOPT_TCP_LOWTRMRK: if (desc->stype == SOCK_STREAM) { tcp_descriptor* tdesc = (tcp_descriptor*) desc; if (ival < 0) ival = 0; else if (ival > INET_MAX_BUFFER) ival = INET_MAX_BUFFER; if (tdesc->high < ival) tdesc->high = ival; /*L4674*/ tdesc->high = ival; /*it should be tdesc->low = ival; ????*/ } continue; right? From kamiseq@REDACTED Mon Aug 3 12:40:54 2009 From: kamiseq@REDACTED (=?UTF-8?B?cGF3ZcWCIGthbWnFhHNraQ==?=) Date: Mon, 3 Aug 2009 12:40:54 +0200 Subject: mnesia starting and then droping schema Message-ID: hi, im totally new to mnesia, I went through chapter about mnesia db and tried to run code from the Joe's book. I managed to create schema of few tables, then I started and waited for tables with wait_for_tables/2 but all I got was timeout then I tried dropping the schema I just created but I got error that db is running on other nodes (nonode@REDACTED - the default from emacs shell) and I cant drop it....... should I run my script from sasl or start something before??? pozdrawiam Pawe? Kami?ski kamiseq@REDACTED pkaminski.prv@REDACTED ______________________ From rtrlists@REDACTED Mon Aug 3 12:42:06 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 3 Aug 2009 11:42:06 +0100 Subject: xmerl namespace handling Message-ID: <6a3ae47e0908030342v3b32dda3ife4b3159fb0edfa@mail.gmail.com> Hi, in xmerl_xsd.erl there's code that checks namespaces while validating where it looks like the comments and the code disagree (in R13B01, lines 4809-4843): %% mk_EII_QName/2 %% makes a name with qualified info out of an Element Information Item %% A) If name is qualified get namespace matching prefix. %% B) If not qualified search parents for a namespace: %% 1) use default namespace if defined, else. %% 2) if a parent is qualified use that namespace or %% 3) no namespace is applied mk_EII_QName(Name,#xmlElement{name=Me,namespace=NS,parents=P},S) when is_list(Name) -> mk_EII_QName(list_to_atom(Name), #xmlElement{name=Me,namespace=NS,parents=P},S); mk_EII_QName(Name,#xmlElement{name=Me,namespace=NS,parents=P},S) -> Scope = S#xsd_state.scope, NameStr = atom_to_list(Name), case string:tokens(NameStr,":") of ["xmlns",PrefixDef] -> %% special case {'xmlns',Scope,namespace(PrefixDef,NS,[])}; [Prefix,LocalName] -> %% A {list_to_atom(LocalName),Scope,namespace(Prefix,NS,[])}; [_LocalName] -> %% B {Name,Scope,mk_EII_namespace([{Me,0}|P],NS,S)} end. mk_EII_namespace([],#xmlNamespace{default=DefaultNS},_S) -> DefaultNS; %%mk_EII_namespace([{PName,_}|GrandPs],NS=#xmlNamespace{default=[]},S) -> mk_EII_namespace([{PName,_}|GrandPs],NS,S) -> NameStr = atom_to_list(PName), case string:tokens(NameStr,":") of [Prefix,_LocalName] -> namespace(Prefix,NS,[]); [_LocalName] -> mk_EII_namespace(GrandPs,NS,S) end; mk_EII_namespace(_,NS,_S) -> NS#xmlNamespace.default. In the case B (unqualified name), it looks like the code will apply a parent's qualified namespace, even if the node with the unqualified name has a default namespace defined (contradicting B.1). The upshot of this is that it is not possible to use xmerl_xsd:validate/2 to validate unqualified internal elements that are part of a larger (qualified) tree. The commented out line suggests to me that there was an attempt to rectify this, but I'm not sure. I don't really know if this is a bug or not. It looks intentional. Myself, I would think that mk_Ell_namespace/3 should have a first clause along the lines of mk_EII_namespace(_,#xmlNamespace{default=DefaultNS},_S) when is_list(DefaultNS), length(DefaultNS)>0 -> DefaultNS; to agree with the comment. But is the comment correct in terms of XML/XSD/namespace handling? Robby From rtrlists@REDACTED Mon Aug 3 13:04:14 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 3 Aug 2009 12:04:14 +0100 Subject: xmerl namespace handling In-Reply-To: <6a3ae47e0908030342v3b32dda3ife4b3159fb0edfa@mail.gmail.com> References: <6a3ae47e0908030342v3b32dda3ife4b3159fb0edfa@mail.gmail.com> Message-ID: <6a3ae47e0908030404n22655365x94d20d4368cb5466@mail.gmail.com> Hmm replying to myself, sorry 'bout that. On Mon, Aug 3, 2009 at 11:42 AM, Robert Raschke wrote: > Hi, > > in xmerl_xsd.erl there's code that checks namespaces while validating where > it looks like the comments and the code disagree (in R13B01, lines > 4809-4843): > > %% mk_EII_QName/2 > %% makes a name with qualified info out of an Element Information Item > %% A) If name is qualified get namespace matching prefix. > %% B) If not qualified search parents for a namespace: > %% 1) use default namespace if defined, else. > %% 2) if a parent is qualified use that namespace or > %% 3) no namespace is applied > mk_EII_QName(Name,#xmlElement{name=Me,namespace=NS,parents=P},S) > when is_list(Name) -> > mk_EII_QName(list_to_atom(Name), > #xmlElement{name=Me,namespace=NS,parents=P},S); > mk_EII_QName(Name,#xmlElement{name=Me,namespace=NS,parents=P},S) -> > Scope = S#xsd_state.scope, > NameStr = atom_to_list(Name), > case string:tokens(NameStr,":") of > ["xmlns",PrefixDef] -> %% special case > {'xmlns',Scope,namespace(PrefixDef,NS,[])}; > [Prefix,LocalName] -> %% A > {list_to_atom(LocalName),Scope,namespace(Prefix,NS,[])}; > [_LocalName] -> %% B > {Name,Scope,mk_EII_namespace([{Me,0}|P],NS,S)} > end. > mk_EII_namespace([],#xmlNamespace{default=DefaultNS},_S) -> > DefaultNS; > %%mk_EII_namespace([{PName,_}|GrandPs],NS=#xmlNamespace{default=[]},S) -> > mk_EII_namespace([{PName,_}|GrandPs],NS,S) -> > NameStr = atom_to_list(PName), > case string:tokens(NameStr,":") of > [Prefix,_LocalName] -> > namespace(Prefix,NS,[]); > [_LocalName] -> > mk_EII_namespace(GrandPs,NS,S) > end; > mk_EII_namespace(_,NS,_S) -> > NS#xmlNamespace.default. > > In the case B (unqualified name), it looks like the code will apply a > parent's qualified namespace, even if the node with the unqualified name has > a default namespace defined (contradicting B.1). > > The upshot of this is that it is not possible to use xmerl_xsd:validate/2 > to validate unqualified internal elements that are part of a larger > (qualified) tree. The commented out line suggests to me that there was an > attempt to rectify this, but I'm not sure. > > I don't really know if this is a bug or not. It looks intentional. > > Myself, I would think that mk_Ell_namespace/3 should have a first clause > along the lines of > > mk_EII_namespace(_,#xmlNamespace{default=DefaultNS},_S) when > is_list(DefaultNS), length(DefaultNS)>0 -> > DefaultNS; > > to agree with the comment. > > But is the comment correct in terms of XML/XSD/namespace handling? > > Robby > > I figured out that namespaces are kept as atoms in the xmlNamespace record and the 'default' field of that record has a default value of []. So if I change the first clause of mk_Ell_namespace/3 to read like follows, I can get my XML validated: mk_EII_namespace(_,#xmlNamespace{default=DefaultNS},_S) when is_atom(DefaultNS) -> DefaultNS; Does anyone have a deeper understanding of the xmerl_xsd module to verify that this would be the correct thing to do? Thanks, Robby From dave.pawson@REDACTED Mon Aug 3 13:11:57 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 3 Aug 2009 12:11:57 +0100 Subject: [erlang-questions] Re: xmerl namespace handling In-Reply-To: <6a3ae47e0908030404n22655365x94d20d4368cb5466@mail.gmail.com> References: <6a3ae47e0908030342v3b32dda3ife4b3159fb0edfa@mail.gmail.com> <6a3ae47e0908030404n22655365x94d20d4368cb5466@mail.gmail.com> Message-ID: <711a73df0908030411o3c318f23nbd84357e06953b41@mail.gmail.com> 2009/8/3 Robert Raschke : > Hmm replying to myself, sorry 'bout that. > I figured out that namespaces are kept as atoms in the xmlNamespace record > and the 'default' field of that record has a default value of []. So if I > change the first clause of mk_Ell_namespace/3 to read like follows, I can > get my XML validated: Differentiate between default namespace and null namespace? http://www.w3.org/TR/xml-names/#defaulting An element without a namespace inherits from it's nearest ancestor specifying a namespace http://www.w3.org/TR/REC-xml-names/#scoping HTH -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From bflatmaj7th@REDACTED Mon Aug 3 13:23:51 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Mon, 3 Aug 2009 21:23:51 +1000 Subject: [erlang-questions] mnesia starting and then droping schema In-Reply-To: References: Message-ID: <7702c0610908030423x4086c5e9m39db35690151c8f7@mail.gmail.com> 2009/8/3 pawe? kami?ski : > hi, > im totally new to mnesia, I went through chapter about mnesia db and tried > to run code from the Joe's book. > I managed to create schema of few tables, then I started and waited for > tables with wait_for_tables/2 but all I got was timeout > > then I tried dropping the schema I just created but I got error that db is > running on other nodes (nonode@REDACTED - the default from emacs shell) and I > cant drop it....... > > should I run my script from sasl or start something before??? Yeah. I had trouble with disk nodes when I started using mnesia too. Here's the basics: * You can only call create_schema before starting the mnesia application (more precisely when the app is not running). So either have a separate program to do it or detect the missing schema and create it; but you have to do this *before* you start the mnesia application. I usually make a script or command line flag to do it. * Mnesia startup expects the schema to be present if you specify a disc node. You can then create tables and call wait_for_tables to wait while mnesia synchronises. * You can only safely remove the schema when mnesia is stopped; same principle as for creating. You can however stop mnesia, delete and create the schema and restart. >From man mnesia (R12B4): mnesia:create_schema/1 fails if any of the Erlang nodes given as DiscNodes are not alive, if Mnesia is running on anyone of the nodes, or if anyone of the nodes already has a schema. Use mnesia:delete_schema/1 to get rid of old faulty schemas. This has implications for adding mnesia to your own .app file. HTH -- Rich From rtrlists@REDACTED Mon Aug 3 13:41:31 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 3 Aug 2009 12:41:31 +0100 Subject: [erlang-questions] Re: xmerl namespace handling In-Reply-To: <711a73df0908030411o3c318f23nbd84357e06953b41@mail.gmail.com> References: <6a3ae47e0908030342v3b32dda3ife4b3159fb0edfa@mail.gmail.com> <6a3ae47e0908030404n22655365x94d20d4368cb5466@mail.gmail.com> <711a73df0908030411o3c318f23nbd84357e06953b41@mail.gmail.com> Message-ID: <6a3ae47e0908030441t77da16d6n9ed81513a9375e5@mail.gmail.com> On Mon, Aug 3, 2009 at 12:11 PM, Dave Pawson wrote: > 2009/8/3 Robert Raschke : > > Hmm replying to myself, sorry 'bout that. > > > I figured out that namespaces are kept as atoms in the xmlNamespace > record > > and the 'default' field of that record has a default value of []. So if I > > change the first clause of mk_Ell_namespace/3 to read like follows, I can > > get my XML validated: > > Differentiate between default namespace and null namespace? > http://www.w3.org/TR/xml-names/#defaulting > > An element without a namespace inherits from it's nearest ancestor > specifying a namespace > > http://www.w3.org/TR/REC-xml-names/#scoping > > > HTH > > > Yeah, my case is the following: I have XML: ... And I have an XSD with a targetNamespace of "bar" for the tree rooted in I want to check the tree starting with element against my XSD. In the current xmerl I can't do that, since it appears to check the parents namespaces before the default on the node. So, after selecting the element, I get an error like {element_not_in_schema, [c, {c,[],foo}, ... Thus has received the namespace of its parent by the processing in xmerl_xsd, instead of its own default namespace! Robby From kamiseq@REDACTED Mon Aug 3 14:03:05 2009 From: kamiseq@REDACTED (=?UTF-8?B?cGF3ZcWCIGthbWnFhHNraQ==?=) Date: Mon, 3 Aug 2009 14:03:05 +0200 Subject: [erlang-questions] mnesia starting and then droping schema In-Reply-To: <7702c0610908030423x4086c5e9m39db35690151c8f7@mail.gmail.com> References: <7702c0610908030423x4086c5e9m39db35690151c8f7@mail.gmail.com> Message-ID: yes but I was running all scripts in my shell by hand and for shure (or maybe not :) it was stopped, or I didnt noticed any error while creating schema. can I run any admin to see if all tables are there? or any command? or any file on disc? anyway I have to assume that if wait_for_tables/2 does not succeed I need to check my schema. I will try with that, thanks pozdrawiam Pawe? Kami?ski kamiseq@REDACTED pkaminski.prv@REDACTED ______________________ From erlang@REDACTED Mon Aug 3 15:04:48 2009 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 3 Aug 2009 15:04:48 +0200 Subject: Stuff that breaks when you move it Message-ID: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> There's two kinds of stuff: A) Stuff which doesn't break when you move it B) Stuff which breaks when you move it Type A includes: zip files, PDF files, jpg files, mp3 files, ... Type B includes: Erlang, HTML files, DRM protected files, erlang beam files, ... A good general principle is: P-1 - "Stuff should not break if you move it to a new directory" A is good B is bad. Experiment: # cd /usr/local/lib # mv erlang globble # globble/bin/erl exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found Thus Erlang is in B. But it doesn't have to be so - this is a bug not a feature Note: 1) This problem (stuff breaking when you move it) is a particular pain when you have to make something work that depends upon several different components and each one individually breaks when you move it. 2) Sometimes stuff cannot be moved to where the author wanted you to move it to. So if you have not got admin rights you *cannot* move your program to /bin (or whatever) So lets add: P-2: It should be possible to move stuff to *any* directory in the file system to which you have write access without breaking it. And while we're on the subject: P-3: We should be able to *remove* stuff without breaking other stuff that is not dependent upon the stuff we have removed. And P-4: If we add stuff to the system and then remove it we should put the system back to the state it was in before we added the stuff that we removed. (Possibly we might change the state of the system log to say that we have added and removed something, but nothing else should happen) Very little software obeys principles P-1 to P-4. This is bad. Fix it. Cheers /Joe From bengt.kleberg@REDACTED Mon Aug 3 15:12:15 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 03 Aug 2009 15:12:15 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <1249305135.4710.19.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, One solution is Plan9 (http://plan9.bell-labs.com/plan9/). bengt On Mon, 2009-08-03 at 15:04 +0200, Joe Armstrong wrote: > There's two kinds of stuff: > > A) Stuff which doesn't break when you move it > B) Stuff which breaks when you move it > > Type A includes: > zip files, PDF files, jpg files, mp3 files, ... > > > Type B includes: > Erlang, HTML files, DRM protected files, erlang beam files, ... > > > A good general principle is: > > P-1 - "Stuff should not break if you move it to a new directory" > > A is good B is bad. > > Experiment: > > # cd /usr/local/lib > # mv erlang globble > # globble/bin/erl > exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found > > Thus Erlang is in B. > > But it doesn't have to be so - this is a bug not a feature > > Note: 1) This problem (stuff breaking when you move it) is > a particular pain when you have to make something work > that depends upon several different components and each one > individually breaks when you move it. > > 2) Sometimes stuff cannot be moved to where the author wanted > you to move it to. So if you have not got admin rights > you *cannot* move your program to /bin (or whatever) > > So lets add: > > P-2: It should be possible to move stuff to *any* > directory in the file system to which you have write access > without breaking it. > > And while we're on the subject: > > P-3: We should be able to *remove* stuff without breaking > other stuff that is not dependent upon the stuff we have removed. > > And > > P-4: If we add stuff to the system and then remove it we should put > the system back to the state it was in before we added the > stuff that we removed. (Possibly we might change the state of the > system log to say that we have added and removed something, > but nothing else should happen) > > Very little software obeys principles P-1 to P-4. > > This is bad. > > Fix it. > > Cheers > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From baryluk@REDACTED Mon Aug 3 15:15:52 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 03 Aug 2009 15:15:52 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <1249305352.6181.7.camel@sredniczarny> Dnia 2009-08-03, pon o godzinie 15:04 +0200, Joe Armstrong pisze: > There's two kinds of stuff: > > A) Stuff which doesn't break when you move it > B) Stuff which breaks when you move it > Thus Erlang is in B. > > But it doesn't have to be so - this is a bug not a feature > > Note: 1) This problem (stuff breaking when you move it) is > a particular pain when you have to make something work > that depends upon several different components and each one > individually breaks when you move it. > > 2) Sometimes stuff cannot be moved to where the author wanted > you to move it to. So if you have not got admin rights > you *cannot* move your program to /bin (or whatever) > > So lets add: > > P-2: It should be possible to move stuff to *any* > directory in the file system to which you have write access > without breaking it. > > And while we're on the subject: > > P-3: We should be able to *remove* stuff without breaking > other stuff that is not dependent upon the stuff we have removed. > > And > > P-4: If we add stuff to the system and then remove it we should put > the system back to the state it was in before we added the > stuff that we removed. (Possibly we might change the state of the > system log to say that we have added and removed something, > but nothing else should happen) > > Very little software obeys principles P-1 to P-4. > > This is bad. > > Fix it. I think that Debian packaging system and policy enforces to obey P3 and P4. About P1 and P2, it is about parametrization of paths mainly in dependent stuff, sometimes it is good (many versions can coexist), sometimes bad (lots of additional configuration needed by user, or special detection procedures, with some convention for default paths, and when many versions exists which to remove on upgrades). Anyway most tools, should be beware about self location, this is for example, why many tools/scripts uses $0 aka argv[0] to refer to itself, not necessary default name/path given by author. Similarly with paths. LHS can be helpful here also, but this standard is mostly about system locations. I don't know if it is easy to maintain similar structure in users' home directory. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From dizzyd@REDACTED Mon Aug 3 15:36:00 2009 From: dizzyd@REDACTED (Dave Smith) Date: Mon, 3 Aug 2009 07:36:00 -0600 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: On Mon, Aug 3, 2009 at 7:04 AM, Joe Armstrong wrote: > Experiment: > > ? ?# cd /usr/local/lib > ? ?# mv erlang globble > ? ?# globble/bin/erl > ? ?exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found > > Thus Erlang is in B. > > But it doesn't have to be so - this is a bug not a feature +1. I've never understood why the Erlang distribution embeds absolute paths into all the executables generated. It seems to me that requiring something akin to the JAVA_HOME environment variable would be a better solution which ensures portability across directory structures and machines. My $0.02 :) D. From kiszl@REDACTED Mon Aug 3 15:40:49 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 3 Aug 2009 15:40:49 +0200 (CEST) Subject: [erlang-questions] Re: Nested for-loops, there has to be a better way to do this In-Reply-To: <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> References: <187b6a3f-498c-4281-bc30-0ad40a13c4c9@p36g2000prn.googlegroups.com> <9b08084c0907282335s7fc42eb5r8e925e9597dae34c@mail.gmail.com> <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> Message-ID: <11152.194.88.55.211.1249306849.squirrel@localhost> for(List) -> for(List, [], []). for([], [], Result) -> lists:reverse(Result); for([], [Hd|Stack], Result) -> for(Hd, Stack, Result); for([Hd|List], Stack, Result) -> NewStack = case Hd > 1 of true -> [[Hd-1|List]|Stack]; false -> Stack end, for(List, NewStack, [Hd|Result]). > for:for([4,2,1,1]). [4,2,1,1,1,1,1,3,2,1,1,1,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1] Passed all TCs :) Regards, Zoltan. > Not quite. > > For your input, this should be your output: > [4, 2, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, > 1, 1, 1, 1, 1] > From rtrlists@REDACTED Mon Aug 3 17:12:28 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 3 Aug 2009 16:12:28 +0100 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <6a3ae47e0908030812u7ac60b58m1ebf6e20d1081f7@mail.gmail.com> I agree wholeheartedly, it would make so many things so much easier if you can move stuff around without it breaking. Interestingly enough, though, in terms of applications that are installed on machines in an environment managed by an IT department, you very quickly bounce against the "we need to know what's installed" problem. In a lot of cases this actually means "we do not want to allow just random things to run". In environments like that, having something that'll only work in exactly the location it was (properly) installed, is a "good" thing. I don't think it is necessarily the right way to solve that problem. But it's the currently established one :-( Robby From masklinn@REDACTED Mon Aug 3 17:47:00 2009 From: masklinn@REDACTED (Masklinn) Date: Mon, 3 Aug 2009 17:47:00 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> On 3 Aug 2009, at 15:04 , Joe Armstrong wrote: > Type B includes: > Erlang, HTML files, DRM protected files, erlang beam files, ... > I'm pretty sure HTML files do *not* break when you move them. They might lose their references to CSS, JS or image files linked stupidly (e.g. absolutely) but the HTML will always work. Now whether the HTML was correctly authored is another can o' worms. -m From roberto@REDACTED Mon Aug 3 19:01:11 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 3 Aug 2009 19:01:11 +0200 Subject: c-node and arbitrary erlang term Message-ID: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> dear all, i am currently sending a message from a c-node to an erlang node using the following: char *e_headers = "[{one, 1}, {two, 2}]"; erlterm = erl_format("~s", e_headers); erl_reg_send(fd, "testc", erlterm); erl_free_term(erlterm); free(e_headers); fd being the file descriptor. this works without any issues, and as expected on the process testc i get the string "[{one, 1}, {two, 2}]". however, since the string "[{one, 1}, {two, 2}]" is already in erlang format, i read from erl_format specs that i could use: ~w - Arbitrary Erlang term however, if i change in the above code the line to: erlterm = erl_format("~w", e_headers); i get a bus error and my c-node crashes. i could of course parse the string and re-build an erlang term from the incomed string, however this is obviously something i want to avoid. what am i missing? thank you, r. From dking@REDACTED Mon Aug 3 19:07:44 2009 From: dking@REDACTED (David King) Date: Mon, 3 Aug 2009 10:07:44 -0700 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> References: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> Message-ID: <0C3AA543-7E6F-42CA-9E24-5BDD9C865222@ketralnis.com> > char *e_headers = "[{one, 1}, {two, 2}]"; > erlterm = erl_format("~s", e_headers); > erl_reg_send(fd, "testc", erlterm); > erl_free_term(erlterm); > free(e_headers); Have you made sure that your bus error is on the line you think it is? If you're freeing a pointer to a literal char*, you'll get a bus error. This alone generates a bus error on my system: > int main() { > char *e_headers = "[{one, 1}, {two, 2}]"; > free(e_headers); > } From roberto@REDACTED Mon Aug 3 19:12:37 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 3 Aug 2009 19:12:37 +0200 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <0C3AA543-7E6F-42CA-9E24-5BDD9C865222@ketralnis.com> References: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> <0C3AA543-7E6F-42CA-9E24-5BDD9C865222@ketralnis.com> Message-ID: <79BA29A5-5F96-4BFD-B484-A558230A0E16@widetag.com> hi david, thank you. yes quite sure: char *e_headers = "[{one, 1}, {two, 2}]"; fprintf(stderr, "1\n"); erlterm = erl_format("{incoming_http, 'http_cnode@REDACTED', ~i, ~w}", reqid, e_headers); fprintf(stderr, "2\n"); erl_reg_send(fd, "misultinc", erlterm); fprintf(stderr, "3\n"); erl_free_term(erlterm); fprintf(stderr, "4\n"); produces the following output: 1 Bus error taking out the free(e_headers); doesn't change anything, since the code doesn't even get to that line. as i said, using the ~s operator does work, no error at all. On 03/ago/09, at 19:07, David King wrote: > > Have you made sure that your bus error is on the line you think it is? From roberto@REDACTED Mon Aug 3 19:14:59 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 3 Aug 2009 19:14:59 +0200 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <79BA29A5-5F96-4BFD-B484-A558230A0E16@widetag.com> References: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> <0C3AA543-7E6F-42CA-9E24-5BDD9C865222@ketralnis.com> <79BA29A5-5F96-4BFD-B484-A558230A0E16@widetag.com> Message-ID: <745955B7-8B63-4F53-8221-20EFA5009CC7@widetag.com> oops sorry that would be the simplified version: char *e_headers = "[{one, 1}, {two, 2}]"; fprintf(stderr, "1\n"); erlterm = erl_format("~w", e_headers); fprintf(stderr, "2\n"); erl_reg_send(fd, "testc", erlterm); fprintf(stderr, "3\n"); erl_free_term(erlterm); fprintf(stderr, "4\n"); free(e_headers); produces the following output: 1 Bus error taking out the free(e_headers); doesn't change anything, since the code doesn't even get to that line. as i said, using the ~s operator does work, no error at all. > On 03/ago/09, at 19:07, David King wrote: >> >> Have you made sure that your bus error is on the line you think it >> is? From erlang@REDACTED Mon Aug 3 19:58:18 2009 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 3 Aug 2009 19:58:18 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> Message-ID: <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> On Mon, Aug 3, 2009 at 5:47 PM, Masklinn wrote: > On 3 Aug 2009, at 15:04 , Joe Armstrong wrote: >> >> Type B includes: >> ? ?Erlang, HTML files, DRM protected files, erlang beam files, ... >> > I'm pretty sure HTML files do *not* break when you move them. > > They might lose their references to CSS, JS or image files linked stupidly > (e.g. absolutely) but the HTML will always work. Now whether the HTML was > correctly authored is another can o' worms. I consider them broken in the sense that they will not display the same thing if moved - I'm comparing them with PDF files which do not break when moved. Now you can embed js, css and even jpgs into the html so that they do work if moved but nobody does this. /Joe > > -m > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kamiseq@REDACTED Mon Aug 3 20:19:51 2009 From: kamiseq@REDACTED (=?UTF-8?B?cGF3ZcWCIGthbWnFhHNraQ==?=) Date: Mon, 3 Aug 2009 20:19:51 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> Message-ID: ok, but swf, jars, pdfs, avi... they create some "system" that everything what is needed to run is inside. so when you look at your project as on the system that have everything to run inside it, then moving things is just breaking that system and the same for pdf, it will not work if you download only 60% of it.. (or maybe I read posts to quickly and I dont follow you at all) anyway I would like to see where that conversation will end :) pozdrawiam Pawe? Kami?ski kamiseq@REDACTED pkaminski.prv@REDACTED ______________________ From dave.pawson@REDACTED Mon Aug 3 20:20:17 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 3 Aug 2009 19:20:17 +0100 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> Message-ID: <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> 2009/8/3 Joe Armstrong : > I consider them broken in the sense that they will not display the same > thing if moved - I'm comparing them with PDF files which do ?not break > when moved. Now you can embed js, css and even jpgs into the html > so that they do work if moved but nobody does this. Hopefully. And for good reason Joe. The 'cascade' provides for users to override CSS for such as accessibility reasons. Embedded CSS (and js for that matter) should be history by now. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From kamiseq@REDACTED Mon Aug 3 20:22:22 2009 From: kamiseq@REDACTED (=?UTF-8?B?cGF3ZcWCIGthbWnFhHNraQ==?=) Date: Mon, 3 Aug 2009 20:22:22 +0200 Subject: [erlang-questions] mnesia starting and then droping schema In-Reply-To: References: <7702c0610908030423x4086c5e9m39db35690151c8f7@mail.gmail.com> Message-ID: ok, I had to have some typo or other strange mistake cos now its working nicely, thanks for your replay pozdrawiam Pawe? Kami?ski kamiseq@REDACTED pkaminski.prv@REDACTED ______________________ From chsu79@REDACTED Mon Aug 3 20:28:17 2009 From: chsu79@REDACTED (Christian) Date: Mon, 3 Aug 2009 20:28:17 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: On Mon, Aug 3, 2009 at 15:04, Joe Armstrong wrote: > There's two kinds of stuff: > > ? ?A) Stuff which doesn't break when you move it > ? ?B) Stuff which breaks when you move it I'm not sure if you were just talking about general design but this example: > Experiment: > > ? ?# cd /usr/local/lib > ? ?# mv erlang globble > ? ?# globble/bin/erl > ? ?exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found This is surely just about the paths inside the script 'erl' itself. The ROOTDIR variable in there looks suspicious indeed. I actually quite like that erl stores the installation directory in itself. I prefer it over java's JAVA_HOME environment variable. If I want to use a specific java version i have installed I need to set JAVA_HOME correctly, AND start the right java binary. In erlang I point out what I want and that is what I get. Since argv[0] / $0 is unreliable for finding the installation dir, I think Erlang does the pragmatic best way for being insensitive to what its installation dir is. Also, about HTML, what some (you?) perceive as a disadvantage is someone else's advantage. If every HTML document would include the pictures, scripts and css, then you would have to load all that even if those parts were the same. From coa@REDACTED Mon Aug 3 20:32:20 2009 From: coa@REDACTED (=?ISO-8859-1?Q?Cl=E1udio_Amaral?=) Date: Mon, 03 Aug 2009 19:32:20 +0100 Subject: Type definition Message-ID: <4A772D34.2010407@dcc.fc.up.pt> Can one define polymorphic type definitions? For example: poly_tree I::integer B::type empty | {branch, [B], poly_tree(I,B),poly_tree(I,B)} where [B] is a list with I elements Regards, Cl?udio From kamiseq@REDACTED Mon Aug 3 20:34:54 2009 From: kamiseq@REDACTED (=?UTF-8?B?cGF3ZcWCIGthbWnFhHNraQ==?=) Date: Mon, 3 Aug 2009 20:34:54 +0200 Subject: mnesia transaction Message-ID: hej all, I tired to look for answers but all I got was about quering itslef and only highlighted that quering without transaction is very dangerous... :) (yeah tell me more) I have a question why my query in qlc cant be run without transaction?? Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map), C#client_map.mtr_clientID == ClientID]), Read = fun()-> qlc:e(Q) end, {atomic, List} = mnesia:transaction(Read), List. my first attempt was Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map), C#client_map.mtr_clientID == ClientID]), qlc:e(Q). more questions : 1)can I select rows dirtily?? 2)is there a way to read snapshot of data while other processes are still writing to db, so transaction is no needed. I ve read in man that ther is fun activate_checkpoint/1 but can I run a query without transaction that will implicitly create such a checkpoint.?? 3)then what is the difference between qlc and dirty_read, dirty_select or qlc is somehow compiled to dirty_* functions?? 4)what will exactly happened when I dirty_write to my table when 10 other processes are reading from it??? thanks pozdrawiam Pawe? Kami?ski kamiseq@REDACTED pkaminski.prv@REDACTED ______________________ From coa@REDACTED Mon Aug 3 20:46:52 2009 From: coa@REDACTED (=?ISO-8859-1?Q?Cl=E1udio_Amaral?=) Date: Mon, 03 Aug 2009 19:46:52 +0100 Subject: [erlang-questions] Type definition In-Reply-To: <4A772D34.2010407@dcc.fc.up.pt> References: <4A772D34.2010407@dcc.fc.up.pt> Message-ID: <4A77309C.9040000@dcc.fc.up.pt> Cl?udio Amaral escreveu: > Can one define polymorphic type definitions? > > For example: > > poly_tree I::integer B::type > empty > | {branch, [B], poly_tree(I,B),poly_tree(I,B)} > > where [B] is a list with I elements > > > Regards, > Cl?udio > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > Forgot to mention that B is a type and then [B] will have elements of type B From seancribbs@REDACTED Mon Aug 3 21:12:49 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 03 Aug 2009 15:12:49 -0400 Subject: [erlang-questions] Type definition In-Reply-To: <4A772D34.2010407@dcc.fc.up.pt> References: <4A772D34.2010407@dcc.fc.up.pt> Message-ID: <4A7736B1.8070308@gmail.com> Erlang doesn't have algebraic or polymorphic data types like Haskell. However, you often compose its simple types to make your own (a good example from stdlib is the proplist). When dealing with functions that return different types, you will need to use pattern matching (possibly with guards) to determine which simple type was returned. Sean Cl?udio Amaral wrote: > Can one define polymorphic type definitions? > > For example: > > poly_tree I::integer B::type > empty > | {branch, [B], poly_tree(I,B),poly_tree(I,B)} > > where [B] is a list with I elements > > > Regards, > Cl?udio > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From per@REDACTED Mon Aug 3 22:26:51 2009 From: per@REDACTED (Per Hedeland) Date: Mon, 3 Aug 2009 22:26:51 +0200 (CEST) Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <53E981AD-C086-430E-A6FA-BECC0992B4E3@widetag.com> Message-ID: <200908032026.n73KQpOV035682@pluto.hedeland.org> Roberto Ostinelli wrote: > >however, since the string "[{one, 1}, {two, 2}]" is already in erlang >format, i read from erl_format specs > that i could use: > >~w - Arbitrary Erlang term > >however, if i change in the above code the line to: > >erlterm = erl_format("~w", e_headers); > >i get a bus error and my c-node crashes. See the example just below in the doc - the argument corresponding to ~w should be an ETERM* - erl_interface does not include a full-blown Erlang parser.:-) >i could of course parse the string and re-build an erlang term from >the incomed string, however this is obviously something i want to >avoid. what am i missing? Sending it as a string to the Erlang node and parsing it there? --Per Hedeland From coa@REDACTED Mon Aug 3 22:32:47 2009 From: coa@REDACTED (=?UTF-8?B?Q2zDoXVkaW8gQW1hcmFs?=) Date: Mon, 03 Aug 2009 21:32:47 +0100 Subject: [erlang-questions] Type definition In-Reply-To: <4A7736B1.8070308@gmail.com> References: <4A772D34.2010407@dcc.fc.up.pt> <4A7736B1.8070308@gmail.com> Message-ID: <4A77496F.1050400@dcc.fc.up.pt> Yes, but with the "-type" directive we can make definitions in order to document code and stuff. What I want to know is: is it possible to do? If so, how? Sean Cribbs escreveu: > Erlang doesn't have algebraic or polymorphic data types like Haskell. > However, you often compose its simple types to make your own (a good > example from stdlib is the proplist). When dealing with functions > that return different types, you will need to use pattern matching > (possibly with guards) to determine which simple type was returned. > > Sean > > Cl?udio Amaral wrote: >> Can one define polymorphic type definitions? >> >> For example: >> >> poly_tree I::integer B::type >> empty >> | {branch, [B], poly_tree(I,B),poly_tree(I,B)} >> >> where [B] is a list with I elements >> >> >> Regards, >> Cl?udio >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From seancribbs@REDACTED Mon Aug 3 22:47:30 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 03 Aug 2009 16:47:30 -0400 Subject: [erlang-questions] Type definition In-Reply-To: <4A77496F.1050400@dcc.fc.up.pt> References: <4A772D34.2010407@dcc.fc.up.pt> <4A7736B1.8070308@gmail.com> <4A77496F.1050400@dcc.fc.up.pt> Message-ID: <4A774CE2.6080006@gmail.com> Yes, but that's only for documentation purposes (and for dialyzer, IIRC). edoc is the place to start if documentation is your concern: http://erlang.org/doc/apps/edoc/index.html Sean Cl?udio Amaral wrote: > Yes, but with the "-type" directive we can make definitions in order > to document code and stuff. What I want to know is: is it possible to > do? If so, how? > > Sean Cribbs escreveu: >> Erlang doesn't have algebraic or polymorphic data types like >> Haskell. However, you often compose its simple types to make your >> own (a good example from stdlib is the proplist). When dealing with >> functions that return different types, you will need to use pattern >> matching (possibly with guards) to determine which simple type was >> returned. >> >> Sean >> >> Cl?udio Amaral wrote: >>> Can one define polymorphic type definitions? >>> >>> For example: >>> >>> poly_tree I::integer B::type >>> empty >>> | {branch, [B], poly_tree(I,B),poly_tree(I,B)} >>> >>> where [B] is a list with I elements >>> >>> >>> Regards, >>> Cl?udio >>> >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From gleber.p@REDACTED Mon Aug 3 23:20:28 2009 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 3 Aug 2009 23:20:28 +0200 Subject: [erlang-questions] mnesia transaction In-Reply-To: References: Message-ID: <14f0e3620908031420g19ff3300yc1badd24c61f152f@mail.gmail.com> 2009/8/3 pawe? kami?ski : > hej all, > I tired to look for answers but all I got was about quering itslef and only > highlighted that quering without transaction is very dangerous... :) (yeah > tell me more) > > I have a question why my query in qlc cant be run without transaction?? > > Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map), > ? ? ? ? ? ? ? ? ? ? ? ?C#client_map.mtr_clientID == ClientID]), > ? ?Read = fun()-> > ? ? ? ? ? qlc:e(Q) > ? ? ? end, > ? ?{atomic, List} = mnesia:transaction(Read), > ? ?List. > > my first attempt was > Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map), > ? ? ? ? ? ? ? ? ? ? ? ?C#client_map.mtr_clientID == ClientID]), > ? ? ? ? ? qlc:e(Q). Probably qlc query could be run without transactions if you use mnesia:activity/* with context async_dirty or sync_dirty or you could use mnesia:async_dirty/1 or mnesia:sync_dirty/1, which, in fact, is the same. I have never tried it, but it should work. Please try this code: Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map), C#client_map.mtr_clientID == ClientID]), mnesia:async_dirty(fun() -> qlc:e(Q) end). > more questions : > 1)can I select rows dirtily?? See mnesia:dirty_match_object/1 or preferably mnesia:dirty_index_match_object/2,3. These should be optimal choice for your use case. mnesia:add_table_index(client_map, [rel_clientID]). mnesia:dirty_index_match_object(#client_map{rel_clientID = Id, _ = '_'}, rel_clientID). Please note, according to the manual: "The two index search functions described here are automatically invoked when searching tables with qlc list comprehensions and also when using the low level mnesia:[dirty_]match_object functions" So you can use qlc in dirty context. If you need more control you can try using mnesia:dirty_select/2. > 2)is there a way to read snapshot of data while other processes are still > writing to db, so transaction is no needed. I ve read in man that ther is > fun activate_checkpoint/1 but can I run a query without transaction that > will implicitly create such a checkpoint.?? Afaik transactions is the only way to archive this. I've tried the following: node@REDACTED and othernode@REDACTED shares table "simple". (node@REDACTED)> mnesia:activate_checkpoint([{name, test}, {max, [simple]}]). (othernode@REDACTED)> mnesia:dirty_write(simple, {simple, a, 1}). (node@REDACTED)> mnesia:dirty_all_keys(simple). [a] (node@REDACTED)> mnesia:dirty_read(simple, a). [{simple,a,1}] So checkpoints does not work for dirty operations. Please correct me if my experiment is flawed. > 3)then what is the difference between qlc and dirty_read, dirty_select or > qlc is somehow compiled to dirty_* functions?? afaik, qlc is a query language, which is "compiled" down to the appropriate functions [dirty_]read, [dirty_]select, etc. according to the context. So your first code snippet is the same as running mnesia:match_object in mnesia:transaction. My code for qlc in async_dirty context is probably the same as running mnesia:dirty_match_object. > 4)what will exactly happened when I dirty_write to my table when 10 other > processes are reading from it??? afaik other processes not using transactions will read or not written changes - it depends on the timing and it is a source of race conditions. If other processes use transactions they should be reading consistent snapshot of data as it was before running dirty_write. Please correct me if I'm wrong :) > > thanks > > pozdrawiam > Pawe? Kami?ski R?wnie? pozdrawiam, Gleb Peregud From yoursurrogategod@REDACTED Tue Aug 4 03:51:27 2009 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Mon, 3 Aug 2009 18:51:27 -0700 (PDT) Subject: Nested for-loops, there has to be a better way to do this In-Reply-To: <11152.194.88.55.211.1249306849.squirrel@localhost> References: <187b6a3f-498c-4281-bc30-0ad40a13c4c9@p36g2000prn.googlegroups.com> <9b08084c0907282335s7fc42eb5r8e925e9597dae34c@mail.gmail.com> <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> <11152.194.88.55.211.1249306849.squirrel@localhost> Message-ID: <32bc81a3-3d2b-424d-9de3-8b8b75063c66@e27g2000yqm.googlegroups.com> Cool. But I do wonder, what are the performance hits compared to one larger function? Reversing lists, returning values, etc. That's one of the reasons why I made the 'monolithic' function that I did. On Aug 3, 9:40?am, "Zoltan Lajos Kis" wrote: > for(List) -> > ? ? for(List, [], []). > > for([], [], Result) -> > ? ? lists:reverse(Result); > > for([], [Hd|Stack], Result) -> > ? ? for(Hd, Stack, Result); > > for([Hd|List], Stack, Result) -> > ? ? NewStack = case Hd > 1 of > ? ? ? ? true -> [[Hd-1|List]|Stack]; > ? ? ? ? false -> Stack > ? ? end, > ? ? for(List, NewStack, [Hd|Result]). > > > for:for([4,2,1,1]). > > [4,2,1,1,1,1,1,3,2,1,1,1,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1] > > Passed all TCs :) > > Regards, > Zoltan. > > > Not quite. > > > For your input, this should be your output: > > [4, 2, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, > > 1, 1, 1, 1, 1] > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From steven.charles.davis@REDACTED Tue Aug 4 05:28:50 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 3 Aug 2009 20:28:50 -0700 (PDT) Subject: Nested for-loops, there has to be a better way to do this In-Reply-To: <32bc81a3-3d2b-424d-9de3-8b8b75063c66@e27g2000yqm.googlegroups.com> References: <187b6a3f-498c-4281-bc30-0ad40a13c4c9@p36g2000prn.googlegroups.com> <9b08084c0907282335s7fc42eb5r8e925e9597dae34c@mail.gmail.com> <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> <11152.194.88.55.211.1249306849.squirrel@localhost> <32bc81a3-3d2b-424d-9de3-8b8b75063c66@e27g2000yqm.googlegroups.com> Message-ID: <4508c1c9-9c48-41b1-8ea3-5e161a83fe88@c1g2000yqi.googlegroups.com> No need to wonder. Have a read about fprof:apply. http://erlang.org/doc/man/fprof.html On Aug 3, 8:51?pm, "Yves S. Garret" wrote: > Cool. ?But I do wonder, what are the performance hits compared to one > larger function? ?Reversing lists, returning values, etc. ?That's one > of the reasons why I made the 'monolithic' function that I did. From mazen.harake@REDACTED Tue Aug 4 08:09:53 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 04 Aug 2009 09:09:53 +0300 Subject: [erlang-questions] Re: Nested for-loops, there has to be a better way to do this In-Reply-To: <11152.194.88.55.211.1249306849.squirrel@localhost> References: <187b6a3f-498c-4281-bc30-0ad40a13c4c9@p36g2000prn.googlegroups.com> <9b08084c0907282335s7fc42eb5r8e925e9597dae34c@mail.gmail.com> <9b08084c0907310634q1d155fd2y3b34b79380ac7d9e@mail.gmail.com> <1a83231c-38c2-4043-9dbd-f03a960ba449@r38g2000yqn.googlegroups.com> <11152.194.88.55.211.1249306849.squirrel@localhost> Message-ID: <4A77D0B1.40705@erlang-consulting.com> Cool! I did the same thing! Look: f([4,2,1,1]) -> [4,2,1,1,1,1,1,3,2,1,1,1,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1]. Passed TC beautifully! ^-^ /M Zoltan Lajos Kis wrote: > for(List) -> > for(List, [], []). > > for([], [], Result) -> > lists:reverse(Result); > > for([], [Hd|Stack], Result) -> > for(Hd, Stack, Result); > > for([Hd|List], Stack, Result) -> > NewStack = case Hd > 1 of > true -> [[Hd-1|List]|Stack]; > false -> Stack > end, > for(List, NewStack, [Hd|Result]). > > > >> for:for([4,2,1,1]). >> > [4,2,1,1,1,1,1,3,2,1,1,1,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1] > > Passed all TCs :) > > Regards, > Zoltan. > > > > >> Not quite. >> >> For your input, this should be your output: >> [4, 2, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, >> 1, 1, 1, 1, 1] >> >> > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From erlang@REDACTED Tue Aug 4 09:23:23 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 4 Aug 2009 09:23:23 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> On Mon, Aug 3, 2009 at 8:28 PM, Christian wrote: > On Mon, Aug 3, 2009 at 15:04, Joe Armstrong wrote: >> There's two kinds of stuff: >> >> ? ?A) Stuff which doesn't break when you move it >> ? ?B) Stuff which breaks when you move it > > I'm not sure if you were just talking about general design but this example: > >> Experiment: >> >> ? ?# cd /usr/local/lib >> ? ?# mv erlang globble >> ? ?# globble/bin/erl >> ? ?exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found > > This is surely just about the paths inside the script 'erl' itself. > The ROOTDIR variable in there looks suspicious indeed. > > I actually quite like that erl stores the installation directory in > itself. I prefer it over java's JAVA_HOME environment variable. If I > want to use a specific java version i have installed I need to set > JAVA_HOME correctly, AND start the right java binary. In erlang I > point out what I want and that is what I get. > > Since argv[0] / $0 is unreliable for finding the installation dir, I > think Erlang does the pragmatic best way for being insensitive to what > its installation dir is. > > Also, about HTML, what some (you?) perceive as a disadvantage is > someone else's advantage. If every HTML document would include the > pictures, scripts and css, then you would have to load all that even > if those parts were the same. The great ones said "verily verily I say unto you, premature optimization is the root of all evil" And this, my friend, is a premature optimization. Not only is it a premature optimization it is a widely spread notion that this is a good thing to do - but it is practice that causes incredibly large amounts of time to be wasted because HTML can break when you relocate it. If you *want* to optimize then it's easy - imagine storing two zip files zip1 and zip2 on machine A. A remote machine B first downloads zip1, then it wants zip2, a simple diff algorithm/protocol can be used to recreate zip2 on B by asking A to send the diffs between A and B. This should be totally invisible to the user. If file A includes B then it is a law of nature that if you move A from machine to machine you will one day loose B. If the versions of A and B matter then one day you will include the wrong version of B in A unless you have a version control system that guarantees correctness. If you put all your HTML etc. in a revision control system (or database) and have strong guarantees on consistency then fine - but most systems I see are not build this way - and they break when you move them. The (fundamental) difference between PDF and HTML is that I can send a PDF file to anybody, or put it in a storage system and retrieve it years later and still see the entire document. Sending an HTML file to a remote location (or storing it) in such a way that the content can be reproduced years later is highly error prone since it relies on an out-of-band mechanism to ensure that *all* the sub-components are also stores in a consistent way. Worse, this out-of-band mechanism is not standardized. There are no such problems with PDF everything is self contained. Software should not break when you move a file to a new directory - if it does this is a symptom of a deep-seated design problem. Go look at some HTML ages stored in the Internet Archive (www.archive.org) already many pages lack associated images. Imagine you're a historian in 1000 years time - at least with PDF files you have a chance to recover the data because you've got all the bits. If an application consists of a number of parts (and an HTML file with links to images and javascript can be considered as such) then it possible to break the application by moving some of the parts. In a well designed system this should be impossible. It should be impossible to move something without moving all the component parts. Another way to fix this would be to fix "mv" - ie "mv" *sghould* move zip files etc withouit complaining - but if asked to move an HTML file it would also miove any relative components in a consistent way so as not to break the application. So something is deeply wrong - either "mv" or html (in this example) - I guess this is one reason why "putting everything into a database" is not such a bad idea - since your can move the database as a whole, and have strong consistency checks on the data when you change it. /joe From roberto@REDACTED Tue Aug 4 09:33:07 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 4 Aug 2009 09:33:07 +0200 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <200908032026.n73KQpOV035682@pluto.hedeland.org> References: <200908032026.n73KQpOV035682@pluto.hedeland.org> Message-ID: <41EBCF9C-87C1-49C0-9733-6BBD1A76694A@widetag.com> On 03/ago/09, at 22:26, Per Hedeland wrote: > > See the example just below in the doc - the argument corresponding > to ~w > should be an ETERM* - erl_interface does not include a full-blown > Erlang > parser.:-) then may i suggest the documentation to explicitly state that, instead of "Arbitrary Erlang term" which i found confusing and believed erl_interface *did* have a parser :) > >> i could of course parse the string and re-build an erlang term from >> the incomed string, however this is obviously something i want to >> avoid. what am i missing? > > Sending it as a string to the Erlang node and parsing it there? yes, that was what i was trying to avoid. but it will be the way, obviously. thank you, r. From erlang@REDACTED Tue Aug 4 09:53:39 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 4 Aug 2009 09:53:39 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> Message-ID: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> On Mon, Aug 3, 2009 at 8:20 PM, Dave Pawson wrote: > 2009/8/3 Joe Armstrong : > >> I consider them broken in the sense that they will not display the same >> thing if moved - I'm comparing them with PDF files which do ?not break >> when moved. Now you can embed js, css and even jpgs into the html >> so that they do work if moved but nobody does this. > > Hopefully. > And for good reason Joe. > The 'cascade' provides for users to override CSS for such > as accessibility reasons. > > Embedded CSS (and js for that matter) should be history by now. M'lord I object, the witness is not a historian, the history of HTML and why is was a bad idea has not yet been written. Judge: Do you have any other comments? Try to keep them short, we will recess in twenty minutes. I will try, M'lord, if the court will permit ... Judge: get on with it ... Ladies and Gentelmen of the Jury, Image I have a a single web page with some js. I *never* intent to reuse the js in a second page. This is a one-off application. You are saying that I should store this in *two* pages - not one. This will have the following consequences: - One day I will move one of the files but not the other (I'll lose the js, for example) - the two files will live lives of their own and I'll get into version nightmares - fetching the file has not got transaction semantics. I might get the HTML and then get a link failure before fetching the js. I'd like to "either fetch both and it works" or "fetch nothing" - the thing I use (firefox) doesn't have transaction semantics. << suppose the HTML always assumes the js will be downloaded - the HTML prints some static content, then calls the JS - but the JS is not loaded the net consequence of this is that some text is displayed and this has disasterous consequnces, somebody dies or something. This is because the JS was not executed. Learned council can check if this has actually happened >> To avoid these things I have to set up a revision control system to make sure the parts cannot be separated - I have to change web browsers for transaction semantics. pending this we should ask for a court injunction to stop all browsers. My solution is to put the js in the file. With one file all the above problems disappear. It's a fundamental law of physics - if you have two things in two different places it's impossible to agree if they are in a consistent state - it's mathematically impossible (see http://en.wikipedia.org/wiki/Two_Generals'_Problem). There are *pragmatic* benefits of including css, js files - but this is a premature optimization and the net effect of include files can be achieved by a different (and sound) mechanism I rest my case M' lord. Cheers /Joe > regards > > > > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > From dave.pawson@REDACTED Tue Aug 4 10:04:46 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 4 Aug 2009 09:04:46 +0100 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> Message-ID: <711a73df0908040104i131a6011mb23ed9f77b674537@mail.gmail.com> 2009/8/4 Joe Armstrong : > Sending an HTML file to a remote location (or storing it) in such a > way that the content can be reproduced years later is highly error > prone since it relies on an out-of-band mechanism to > ensure that *all* the sub-components are also stores in a consistent > way. Worse, this > out-of-band mechanism is not standardized. Agreed. Not standardised, simply a recommendation. >From the authors of HTML, Tim and Friends at W3C. They don't write standards. Loosely though, it's been 'standard' since about html 3.1 Just so happens that you need the images, js, CSS as a number of files to make up a package that is viewable. Live with it, or use PDF. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From roger@REDACTED Tue Aug 4 10:18:52 2009 From: roger@REDACTED (Roger Price) Date: Tue, 4 Aug 2009 10:18:52 +0200 (CEST) Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: On Tue, 4 Aug 2009, Joe Armstrong wrote: > M'lord I object, the witness is not a historian, the history of > HTML and why is was a bad idea has not yet been written. When written, it may even say that TBL took ideas from SGML but did not take the OASIS catalog intended to mitigate the "N files" problem. Roger (Will it tell us about the meeting between TBL and CFG? Can I preorder?) From vladdu55@REDACTED Tue Aug 4 10:55:39 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 4 Aug 2009 10:55:39 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> Message-ID: <95be1d3b0908040155g33d26316lcca8f83fcaaccf75@mail.gmail.com> Hi Joe, I see your point and can't really say I disagree, but I'm not sure if I understand correctly what you're after. First, the one-off case isn't the most common. Most of the time, one wants to be able to share common resources. For one-off documents, one can include all needed resources, one way or another (most of the time). For example, you could include images as json data that are rendered with javascript. Clunky, but possible. Can be automated with a tool, so instead of zipping the separate files, you pack them with another command. Second, PDF files can still reference external resources, fonts and even images (I think). So just by having a PDF file, you're not certain that it is self-contained and you can view it as the author intended. Third, how do you draw the line between resources that are to be embedded and those that aren't? Examples of the first category may be images, fonts, properties files. The other category would include the application to view the file, the C libraries it requires, a compatible OS and a compatible hardware. The delimitation depends on the specifics of your case and what works well for one-off projects might be very wrong for a large distributed one. Or did I misunderstand you? best regards, Vlad From ttmrichter@REDACTED Tue Aug 4 12:42:53 2009 From: ttmrichter@REDACTED (ttmrichter@REDACTED) Date: Tue, 04 Aug 2009 10:42:53 +0000 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: <000e0cd151f8821c8604704e8cb3@google.com> Sounds to me, Joe, that you're looking for something like the Fossil SCM (http://www.fossil-scm.org) unless I'm misreading something very badly. On Aug 4, 2009 3:53pm, Joe Armstrong wrote: > Image I have aa single web page with some js. I *never* intent to reuse > the js in > a second page. This is a one-off application. > You are saying that I should store this in *two* pages - not one. This > will have the > following consequences: From erlang@REDACTED Tue Aug 4 14:07:05 2009 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 4 Aug 2009 14:07:05 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <000e0cd151f8821c8604704e8cb3@google.com> References: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> <000e0cd151f8821c8604704e8cb3@google.com> Message-ID: <9b08084c0908040507j23337808r596e3c00a3f3c151@mail.gmail.com> Wow - your read me correctly - amazing stuff. This is really itching my programmers nerve. So in Erlang we have dets files (containers) - a web server is trivial - diffing is easy - compression is easy - crypto is easy. Files are named by their SHA1 checksum and signed with an RSA key - trees are named by SHA1 of term_to_binary(Tree) etc. Embedding everything into a single file and signing all the trees seems to be like some kind of munge of the ideas in GIT and zip. This (fossil) stuff looks well worth studying - reading the Fossil documentation rings all the right bells - thanks for the link. /Joe On Tue, Aug 4, 2009 at 12:42 PM, wrote: > Sounds to me, Joe, that you're looking for something like the Fossil SCM > (http://www.fossil-scm.org) unless I'm misreading something very badly. > > On Aug 4, 2009 3:53pm, Joe Armstrong wrote: >> Image I have a a single web page with some js. I *never* intent to reuse >> the js in >> a second page. This is a one-off application. > >> You are saying that I should store this in *two* pages - not one. This >> will have the >> following consequences: From harveyd@REDACTED Tue Aug 4 14:09:37 2009 From: harveyd@REDACTED (Dale Harvey) Date: Tue, 4 Aug 2009 13:09:37 +0100 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: it is not premature as it is one of the major bottlenecks when trying to build fast loading websites, large enough that the yahoo performance team specifically recommend you make css / js external (except for possibly the home page) http://developer.yahoo.com/performance/rules.html 2009/8/4 Joe Armstrong > On Mon, Aug 3, 2009 at 8:20 PM, Dave Pawson wrote: > > 2009/8/3 Joe Armstrong : > > > >> I consider them broken in the sense that they will not display the same > >> thing if moved - I'm comparing them with PDF files which do not break > >> when moved. Now you can embed js, css and even jpgs into the html > >> so that they do work if moved but nobody does this. > > > > Hopefully. > > And for good reason Joe. > > The 'cascade' provides for users to override CSS for such > > as accessibility reasons. > > > > Embedded CSS (and js for that matter) should be history by now. > > M'lord I object, the witness is not a historian, the history of HTML > and why is was a bad idea > has not yet been written. > > Judge: Do you have any other comments? Try to keep them short, we will > recess in > twenty minutes. > > I will try, M'lord, if the court will permit ... > > Judge: get on with it ... > > Ladies and Gentelmen of the Jury, > > Image I have a a single web page with some js. I *never* intent to > reuse the js in > a second page. This is a one-off application. > > You are saying that I should store this in *two* pages - not one. This > will have the > following consequences: > > - One day I will move one of the files but not the other (I'll > lose the js, for example) > - the two files will live lives of their own and I'll get into > version nightmares > - fetching the file has not got transaction semantics. I might get > the HTML and then > get a link failure before fetching the js. I'd like to "either > fetch both and it works" > or "fetch nothing" - the thing I use (firefox) doesn't have > transaction semantics. > > << suppose the HTML always assumes the js will be downloaded - > the HTML prints some static content, then calls the JS - but > the JS is not loaded > the net consequence of this is that some text is displayed and > this has disasterous > consequnces, somebody dies or something. This is because the JS > was not executed. > > Learned council can check if this has actually happened >> > > To avoid these things I have to set up a revision control system > to make sure the parts > cannot be separated - I have to change web browsers for transaction > semantics. > pending this we should ask for a court injunction to stop all browsers. > > My solution is to put the js in the file. With one file all the > above problems disappear. > > It's a fundamental law of physics - if you have two things in > two different places > it's impossible to agree if they are in a consistent state - it's > mathematically impossible > (see http://en.wikipedia.org/wiki/Two_Generals'_Problem > ). > > There are *pragmatic* benefits of including css, js files - but > this is a premature optimization > and the net effect of include files can be achieved by a different > (and sound) mechanism > > I rest my case M' lord. > > Cheers > > /Joe > > > > > regards > > > > > > > > > > > > > > -- > > Dave Pawson > > XSLT XSL-FO FAQ. > > Docbook FAQ. > > http://www.dpawson.co.uk > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From carlmcdade@REDACTED Tue Aug 4 15:28:51 2009 From: carlmcdade@REDACTED (Carl McDade) Date: Tue, 4 Aug 2009 15:28:51 +0200 Subject: [Erlyaws-list] YAWS with PHP on Windows XP problem In-Reply-To: References: <4A61E732.8060905@pcinside.pl> <4A6477BD.1030603@pcinside.pl> <65b2728e0907200747x36578e22q5bf1244946ff06eb@mail.gmail.com> <4A6491DC.3050407@pcinside.pl> <4A64F3E1.5000401@tail-f.com> <4A64F476.3010203@pcinside.pl> <4A64F7D3.80508@tail-f.com> Message-ID: Is this being worked on? Or is it marked for testing/improvement in a later version? On Wed, Jul 29, 2009 at 6:49 AM, Carl McDade wrote: > Just to make sure I rolled back from 1.84 to 1.82 and received the same result. > > On Wed, Jul 29, 2009 at 6:19 AM, Carl McDade wrote: >> Hi, >> >> Confirming: I just tried this on Vista,PHP-CGI.exe and got the same >> result, which is a blank page and no error outside of the path error >> in the interactive window. >> >> /Carl >> >> >> >> On Tue, Jul 21, 2009 at 3:14 AM, andrew mmc wrote: >>> Forgive me if I'm stating the obvious now, but I think the first problem was >>> because the file extension was cgi, it tried to execute the file, which it >>> couldn't do because it is on windows.? When you changed the extension to >>> php, yaws knew to pass through the file as a parameter to the php executable >>> - the correct behaviour. >>> >>> I think the problem is now with php.? PHP has some default behaviour set for >>> security reasons.? e.g. on *nix you have to explicitly compile it with the >>> option to run as cgi.? It also by default will not allow itself to execute >>> anything outside of its docroot, so perhaps the test file isn't in or below >>> the docroot set in php.ini? >>> >>> Otherwise, perhaps some of the other cgi specific options there could have >>> an effect? >>> >>> >>> 2009/7/21 Claes Wikstrom >>>> >>>> > Yes, this path exists. And it's correct - YAWS throws an error with >>>> > incorrect path. >>>> > >>>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've >>>> > ?to change it but later ;)) >>>> > >>>> >>>> Nice :-) >>>> >>>> > Still, problem is unresolved... >>>> >>>> I'll take a look at it - but not now. As I said before, this just >>>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified >>>> so that we >>>> >>>> 1. see what get's open_ported() ed >>>> 2. figure out why that doesn't work. >>>> >>>> >>>> >>>> /klacke >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Enter the BlackBerry Developer Challenge >>>> This is your chance to win up to $100,000 in prizes! For a limited time, >>>> vendors submitting new applications to BlackBerry App World(TM) will have >>>> the opportunity to enter the BlackBerry Developer Challenge. See full >>>> prize >>>> details at: http://p.sf.net/sfu/Challenge >>>> _______________________________________________ >>>> Erlyaws-list mailing list >>>> Erlyaws-list@REDACTED >>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >>> >>> >>> ------------------------------------------------------------------------------ >>> Enter the BlackBerry Developer Challenge >>> This is your chance to win up to $100,000 in prizes! For a limited time, >>> vendors submitting new applications to BlackBerry App World(TM) will have >>> the opportunity to enter the BlackBerry Developer Challenge. See full prize >>> details at: http://p.sf.net/sfu/Challenge >>> _______________________________________________ >>> Erlyaws-list mailing list >>> Erlyaws-list@REDACTED >>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >>> >>> >> >> >> >> -- >> Carl McDade >> Lead Developer >> ____________________ >> >> FireOrb CMS >> www.fireorb.info >> > > > > -- > Carl McDade > Lead Developer > ____________________ > > FireOrb CMS > www.fireorb.info > -- Carl McDade Lead Developer FireOrb CMS - www.fireorb.info __________________________ Publisher and Editor Hiveminds Magazine -www.hiveminds.co.uk From roberto@REDACTED Tue Aug 4 15:56:50 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 4 Aug 2009 15:56:50 +0200 Subject: [erlang-questions] Re: Misultin v0.1 released In-Reply-To: <3E696E88-AB1E-4BB2-B97B-FFB95A771757@gmail.com> References: <544758AC-B45D-4D0C-9BF4-7BABA0C091C7@widetag.com> <3E696E88-AB1E-4BB2-B97B-FFB95A771757@gmail.com> Message-ID: thank you all for support. FYI, misultin V0.2 has been released. new benchmarks done on amazon EC2 are available here: http://code.google.com/p/misultin/wiki/Benchmarks versioning includes: - added trap exit for acceptor failure - added backlog option - added fallback if no connection header is present [issue track #1] - minor bug corrections cheers, r. From mazen.harake@REDACTED Tue Aug 4 16:43:17 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 04 Aug 2009 17:43:17 +0300 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <4A784905.70205@erlang-consulting.com> On what level is P-1 suppose to work? Should I be able to move the erlang directory? Should I be able to move the lib directory? Should I be able to move the applications in the lib directory? Should I be able to move the beams in the applications directory? Should I be able to move the bytes around in the beams? Basically you will give people that support convention a big head ache. I agree that some things you should be able to be moved without them breaking but you must DEFINE the units. When you say "Erlang", what exactly do you mean? You can't build anything using components without having either a convention or a mediator on how they should find each other. If you choose convention then you by definition _can't_ move it around unless you define each unit that you can move, but then you need some convention to move the movable unit around and so on...... unless you are going to bake your whole system into one extreamly large binary blob you won't get away from the fact that things will break as soon as you have two entities... but even if you _do_ have a huge blob you still want to split it up and find information in it and voila (I believe that is how it is spelt) you are back to square one. The only option (I believe) is to have a mediator that tells you where things are... and that mediator is the only thing that _all_ the units/enteties use to find other entities. And if something is moved, it can only be moved using that mediator and all calls have to go through this mediator (serialized) otherwise you have race conditions all over. This pretty much kills P-1 and P-2.... P-3 and P-4 however make perfect sense and should be part of any system. /Mazen Joe Armstrong wrote: > There's two kinds of stuff: > > A) Stuff which doesn't break when you move it > B) Stuff which breaks when you move it > > Type A includes: > zip files, PDF files, jpg files, mp3 files, ... > > > Type B includes: > Erlang, HTML files, DRM protected files, erlang beam files, ... > > > A good general principle is: > > P-1 - "Stuff should not break if you move it to a new directory" > > A is good B is bad. > > Experiment: > > # cd /usr/local/lib > # mv erlang globble > # globble/bin/erl > exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found > > Thus Erlang is in B. > > But it doesn't have to be so - this is a bug not a feature > > Note: 1) This problem (stuff breaking when you move it) is > a particular pain when you have to make something work > that depends upon several different components and each one > individually breaks when you move it. > > 2) Sometimes stuff cannot be moved to where the author wanted > you to move it to. So if you have not got admin rights > you *cannot* move your program to /bin (or whatever) > > So lets add: > > P-2: It should be possible to move stuff to *any* > directory in the file system to which you have write access > without breaking it. > > And while we're on the subject: > > P-3: We should be able to *remove* stuff without breaking > other stuff that is not dependent upon the stuff we have removed. > > And > > P-4: If we add stuff to the system and then remove it we should put > the system back to the state it was in before we added the > stuff that we removed. (Possibly we might change the state of the > system log to say that we have added and removed something, > but nothing else should happen) > > Very little software obeys principles P-1 to P-4. > > This is bad. > > Fix it. > > Cheers > > /Joe > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From mononcqc@REDACTED Tue Aug 4 16:53:30 2009 From: mononcqc@REDACTED (Fred Hebert (MononcQc)) Date: Tue, 4 Aug 2009 10:53:30 -0400 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: <8b9ee55b0908040753j6e6ff414ufae70c5dc48ccc16@mail.gmail.com> On Tue, Aug 4, 2009 at 3:53 AM, Joe Armstrong wrote: > On Mon, Aug 3, 2009 at 8:20 PM, Dave Pawson wrote: >> 2009/8/3 Joe Armstrong : >> > > M'lord I object, the witness is not a historian, the history of HTML > and why is was a bad idea > has not yet been written. > > Judge: Do you have any other comments? Try to keep them short, we will recess in > twenty minutes. > > I will try, M'lord, if the court will permit ... > > Judge: get on with it ... > > Ladies and Gentelmen of the Jury, > > Image I have a a single web page with some js. I *never* intent to > reuse the js in > a second page. This is a one-off application. - That's a valid time for some JS. However, lots of webpage end up re-using javascript and css on more than a page: menu highlights, header and footer styles, etc. > You are saying that I should store this in *two* pages - not one. This > will have the > following consequences: > > - One day I will move one of the files but not the other (I'll > lose the js, for example) > - the two files will live lives of their own and I'll get into > version nightmares Version nightmare will also be a possibility in case of having to maintain the same file over many pages, It's partially why files are split the way they are right now. Of course if it's a one-time use, nothing would keep you from having it embed in the page and fixing that problem, but in every other circumstance ever reusing the code, splitting it over many files is the way to go. > - fetching the file has not got transaction semantics. I might get > the HTML and then > get a link failure before fetching the js. I'd like to "either > fetch both and it works" > or "fetch nothing" - the thing I use (firefox) doesn't have > transaction semantics. > > << suppose the HTML always assumes the js will be downloaded - > the HTML prints some static content, then calls the JS - but > the JS is not loaded > the net consequence of this is that some text is displayed and > this has disasterous > consequnces, somebody dies or something. This is because the JS > was not executed. > > Learned council can check if this has actually happened >> Javascript is often (as it should be) not necessary to the functionning of a page. Same for CSS. It should be able to downgrade gracefully. If it doesn't, it usually is done at the cost of functionality (see webapps like last.fm or facebook chat). In these cases, no archiving is possible anyway, given a lot of interaction is needed with the server. Questions of same origin policies and 'is the server still there?' will ruin that. I can agree that this is problematic though, as it is for the degradation of images > To avoid these things I have to set up a revision control system > to make sure the parts > cannot be separated - I have to change web browsers for transaction semantics. > pending this we should ask for a court injunction to stop all browsers. > Other advantages of separate files have to do with distribution: in dynamic applications (serving thens of thousands of people), you want the actual servers to do as much computing as possible, not using server resources reading files from disk to send them to people. As easily over 90% of a page size (and load time) is in its static files, what you end up doing is using Content Delivery Networks (CDNs). CDNs an infrastructure of servers located all around the world with the only objective of delivering static content really fast. What they do by being on a different domain is allowing you to download files simultaneously (more than if they were embedded on the page), and faster due to proximity of servers and fine-tuning of everything needed. The following time the file is encountered, it is not even downloaded as it's kept in the browser. By using a diff, assuming a diff like the ones we have right now, is dowloading the changing line not once, but twice. One for the old line, one for the new line. You also deny the use of CDNs, making costs of bandwidth for many corporations much higher and load time for users much longer. You also want to send data as fast of possible, possibly sending every bit of text you've got before the page is even done loading. This is done by outputing parts of some pages as fast as possible when they're ready. By using a diff, you still need to generate the whole page, and then have the server compare data to make a diff file to send. Getting the diff done can be longer than just sending a new page over in these circumstances. It's also unclear what a diff would do to things like a chunked file sending, how it'd react to javascript queries. > My solution is to put the js in the file. With one file all the > above problems disappear. > > It's a fundamental law of physics - if you have two things in > two different places > it's impossible to agree if they are in a consistent state - it's > mathematically impossible > (see http://en.wikipedia.org/wiki/Two_Generals'_Problem). > > There are *pragmatic* benefits of including css, js files - but > this is a premature optimization > and the net effect of include files can be achieved by a different > (and sound) mechanism Given all the above, I would say it is NOT premature optimization when you know from the beginning you will have tens of thousands of simultaneous viewers at all time (over millions a month). It is although useful when you want to archive documents because changes and updates no longer interest you. This is -- I believe -- the biggest difference. The step needed to change a page from dynamic to static for archival and portability purposes requires you to separate it from its origins; you go through it with wget, which will change URLs, download dependent files and store them on your computer. This would be the equivalent of a compiler linking the files into a single executable and the .dlls around it in some cases. Or, if we take it back to Erlang, I see multiple files as the difference between defining all your functions in a single Erlang application file (reimplementing the standard library functions inseatd of -import()ing them), rather than counting on the system to do what is necessary to load files. Of course I may not exactly get exactly what you mean, but there are extremely good reasons to keep content separate in the case of web files and applications. You'd have to consider them for Erlang too. From coa@REDACTED Tue Aug 4 18:11:18 2009 From: coa@REDACTED (=?UTF-8?B?Q2zDoXVkaW8gQW1hcmFs?=) Date: Tue, 04 Aug 2009 17:11:18 +0100 Subject: [erlang-questions] Type definition Message-ID: <4A785DA6.7050002@dcc.fc.up.pt> The objective is not exactly document the code. I am translating erlang to another language that needs type annotations and I'm using the parsing libraries in order to have type definitions that I could manipulate in the abstract tree (and have them in the final program). Cl?udio. Sean Cribbs escreveu: > Yes, but that's only for documentation purposes (and for dialyzer, > IIRC). edoc is the place to start if documentation is your concern: > > http://erlang.org/doc/apps/edoc/index.html > > Sean > > Cl?udio Amaral wrote: >> Yes, but with the "-type" directive we can make definitions in order >> to document code and stuff. What I want to know is: is it possible to >> do? If so, how? >> >> Sean Cribbs escreveu: >>> Erlang doesn't have algebraic or polymorphic data types like >>> Haskell. However, you often compose its simple types to make your >>> own (a good example from stdlib is the proplist). When dealing with >>> functions that return different types, you will need to use pattern >>> matching (possibly with guards) to determine which simple type was >>> returned. >>> >>> Sean >>> >>> Cl?udio Amaral wrote: >>>> Can one define polymorphic type definitions? >>>> >>>> For example: >>>> >>>> poly_tree I::integer B::type >>>> empty >>>> | {branch, [B], poly_tree(I,B),poly_tree(I,B)} >>>> >>>> where [B] is a list with I elements >>>> >>>> >>>> Regards, >>>> Cl?udio >>>> >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> >>> >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From 0x6e6562@REDACTED Tue Aug 4 18:58:38 2009 From: 0x6e6562@REDACTED (Ben Hood) Date: Tue, 4 Aug 2009 17:58:38 +0100 Subject: [erlang-questions] include_lib and archives? In-Reply-To: <8aff81590905241438m38d3a90di4177b784ccfe68ce@mail.gmail.com> References: <8aff81590905241438m38d3a90di4177b784ccfe68ce@mail.gmail.com> Message-ID: <269388e30908040958k7b689ec7o403e4be81bf6391f@mail.gmail.com> Keith (or anybody else), On Sun, May 24, 2009 at 10:38 PM, Keith Irwin wrote: > The problem is that I can't use header files located inside the *.ez file. > With: > ??-include_lib("mylib/include/whatever.hrl"). > the compiler can't find the file, even if the *.ez is on the code path. > Am I doing something wrong here, or is it by design that header files must > reside OUTSIDE the compressed archive? Did you ever find a solution to this issue? I'm trying to package a common library that contains a few header definitions. Whenever I set the ERL_LIBS variable to point at the directory containing the .ez archive, erlc will only locate the header files if I unpack the archive. I'd like to be able to redistribute this common library and have people compile without having to unpack the archive. TIA, Ben From paul-trapexit@REDACTED Tue Aug 4 19:38:30 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Tue, 4 Aug 2009 10:38:30 -0700 (PDT) Subject: erl_eval function object Message-ID: The documentation for erl_eval says that the NonlocalFunctionHandler is called when a functional object (fun) is called; however I'm not seeing this. Any insight would be appreciated. Cheers, -- p ----- -module (evaltest). -compile (export_all). doit (String) -> { ok, Scanned, _ } = erl_scan:string (String), { ok, Parsed } = erl_parse:parse_exprs (Scanned), Bindings = erl_eval:new_bindings (), erl_eval:exprs (Parsed, Bindings, { value, fun local/2 }, { value, fun non_local/2 }). local (Name, Arguments) -> io:format ("local ~p ~p~n", [ Name, Arguments ]), false. non_local (FuncSpec, Arguments) -> io:format ("non_local ~p ~p~n", [ FuncSpec, Arguments ]), case FuncSpec of { M, F } -> erlang:apply (M, F, Arguments); Func when is_function (Func) -> erlang:apply (Func, Arguments) end. ----- % erl Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [kernel-poll:false] Eshell V5.6.5 (abort with ^G) 1> evaltest:doit ("(fun () -> 10 + 2 end) ()."). non_local {erlang,'+'} [10,2] {value,12,[]} ----- From baryluk@REDACTED Tue Aug 4 19:41:54 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Tue, 04 Aug 2009 19:41:54 +0200 Subject: [erlang-questions] erl_eval function object In-Reply-To: References: Message-ID: <1249407714.27964.0.camel@sredniczarny> Dnia 2009-08-04, wto o godzinie 10:38 -0700, Paul Mineiro pisze: > The documentation for erl_eval says that the NonlocalFunctionHandler is > called when a functional object (fun) is called; however I'm not seeing > this. ... > 1> evaltest:doit ("(fun () -> 10 + 2 end) ()."). > non_local {erlang,'+'} [10,2] > {value,12,[]} But it looks, that it is called here. :) -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From fritchie@REDACTED Wed Aug 5 00:46:40 2009 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 04 Aug 2009 17:46:40 -0500 Subject: Moving the OTP top level dir, was: Stuff that breaks when you move it In-Reply-To: Message of "Tue, 04 Aug 2009 17:43:17 +0300." <4A784905.70205@erlang-consulting.com> Message-ID: <1910.1249426000@snookles.snookles.com> Mazen Harake wrote: mh> Should I be able to move the erlang directory? [...] For those who are interested in doing exactly that, it isn't too hard. We've got a build system which builds various apps from scratch, including Erlang/OTP, using something like: (cd /path/to/otp/src && ./configure --prefix=/funky/path/with/time-of-day/embedded/in/it) ... which means that "make install" will put the build artifacts into a different directory each time. This script might work, but I've edited it slightly to remove some cruft, so it might not. -Scott --- snip --- snip --- snip --- snip --- snip --- snip --- snip --- #!/bin/sh ## ## For copying when configured via: ## ./configure --prefix=/some/place/that/is/not/the/final/installation/dir ## TAR_DEL_ARG="" if [ "X$1" = "X-d" ]; then shift TAR_DEL_ARG="--remove-files" fi if [ $# -ne 3 ]; then echo usage: $0 [-d] src-dir dst-dir path-dir echo example: $0 /usr/local/third-party/erlang /tmp/R13B01 /tmp/R13B01 echo "NOTE: In most cases, dst-dir and path-dir will be the same." echo " However, in some weird NFS cases, the dst-dir (where" echo " this script will copy files) may be different from" echo " path-dir (where final users will use/execute files)." echo NOTE: Both directories should be absolute paths. exit 1 fi SRCDIR=$1 DSTDIR=$2 NEW_ROOTDIR=$3/lib/erlang if [ ! -d $SRCDIR ]; then echo "Source directory $SRCDIR does not exist, aborting!" exit 1 fi if [ ! -d $DSTDIR ]; then echo "Destination directory $DSTDIR does not exist, creating" mkdir $DSTDIR if [ $? -ne 0 ]; then echo "mkdir $DSTDIR failed, aborting!" exit 1 fi fi echo -n "Copying files from $SRCDIR to $DSTDIR ... " (cd $SRCDIR ; tar cf - $TAR_DEL_ARG .) | (cd $DSTDIR ; tar xfp -) echo "done." echo -n "Performing relocation steps ... " cd $DSTDIR/bin for f in dialyzer epmd erl erlc escript run_erl start to_erl typer do if [ -h $f ]; then rm -f $f # Use wildcard to be Erlang-version-flexible (hopefully) ln -s ../lib/erlang/erts-*/bin/$f ./$f fi done cd ../lib/erlang/erts-*/bin for f in erl start start_erl do perl -np -e "s|%FINAL_ROOTDIR%|$NEW_ROOTDIR|" < $f.src > $f if [ -f $DSTDIR/lib/erlang/bin/$f ] ; then cp $f $DSTDIR/lib/erlang/bin/$f fi done echo "done." cd $DSTDIR/lib/erlang/bin rm epmd ln -s ../erts-*/bin/epmd ./epmd echo "" echo "To use the new runtime environment, add the following directory" echo "to your shell's PATH variable:" echo "" echo " $DSTDIR/bin" echo "" exit 0 From fritchie@REDACTED Wed Aug 5 01:19:30 2009 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 04 Aug 2009 18:19:30 -0500 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: Message of "Mon, 03 Aug 2009 19:14:59 +0200." <745955B7-8B63-4F53-8221-20EFA5009CC7@widetag.com> Message-ID: <4029.1249427970@snookles.snookles.com> Roberto Ostinelli wrote: ro> char *e_headers = "[{one, 1}, {two, 2}]"; ro> erlterm = erl_format("~w", e_headers); I agree with Per, that won't work. However, this should, if memory serves correctly. ETERM *erlterm = erl_format("[{one, 1}, {two, 2}]"); erl_format() won't work well with C programs with limited stack sizes (e.g. when using Pthreads). It uses naive recursion for formatting nested terms, which can cause problems for deeply-nested and/or extremely long lists. In those cases, you can usually get by with a small number of intermediate steps. ETERM *very_long_list = format_myself_by_hand(a_long_linked_list); ETERM *my_tuple = erl_format("{ok, ~w}", very_long_list); IIRC, erl_format() doesn't have a format command for dealing with binaries. But the ~w format command will work on a previously-created binary, e.g. ETERM *my_bin = erl_mk_binary("Hello!", 6). -Scott From bflatmaj7th@REDACTED Wed Aug 5 03:38:01 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Wed, 5 Aug 2009 11:38:01 +1000 Subject: ssl_esock spinning out of control in poll() Message-ID: <7702c0610908041838r1885b25akf7476b364b2c6801@mail.gmail.com> I have a problem with ssl_esock in R12B4 (Linux 32 bit). Symptoms: 1. esock consumes 100% CPU usage 2. poll() spinning constantly with events=POLLIN|POLLRDNORM, revents=POLLIN|POLLRDNORM for the affected SSL fd 3. No other syscalls between polls in strace 4. netstat shows the TCP Rx queue growing for the socket 5. No data messages received at the socket owning erlang process (corollary of 3.) I don't yet have a test case to trigger it but it seems to occur after the remote SSL peer sends a moderate sized block of data (eg. 2kB). Google didn't turn up anything that looked like what I'm seeing and I can't find anything in mor recent OTP changelogs. Does anyone know of this bug and if there is a patch anywhere? -- Rich From ok@REDACTED Wed Aug 5 03:57:44 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 5 Aug 2009 13:57:44 +1200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: What we have here is essentially the debate between static libraries and dynamically linked ones. To this day I remain hopping mad that Sun stopped providing a statically linked libc with Solaris 10. The argument for this was that customer programs would _certainly_ never need to be relinked when a new version of the operating system or library was installed. The downside was that profiling (cc -p / prof) became useless to me, because libc functions were no longer reported. There's also the extra cost of run-time loading, &c &c &c. Before Solaris 10, it was *my* choice whether I wanted the "complete self-contained fast starting" virtues of static linking or the "invisible updates to fix things like security bugs" virtues of dynamic linking. Now it isn't. Since much of the software I use is open source, and since new releases are comparatively frequent, and since I'm recompiling my own stuff all the time, for *me* the benefits of static linking are preponderant. For many commercial enterprises, I imagine the benefits of dynamic linking are preponderant. I note that Macintosh applications *behave* like single "objects", but they *are* directories containing a lot of files. I note that the technique Joe mentioned, where an HTML page can have "links" that point _without_ the single block of data transmitted in an HTTP message "behaves like" a collection of linked objects but "is" a single thing. And then you have things like .iso and .dmg files where one and the same thing "is" a single object and also "is" an entire file system. We've got the classic distinction between hard links and symbolic links: if I have a hard link from A to B and B is moved, A will still point to whatever B is, while if I have a symbolic link from A to B, B is renamed to C, and D is renamed to B, A will now point to D. When "something" is moved, what is "it", and do we always want the same thing to happen? It seems to me that the answer is that sometimes we want one kind of behaviour and sometimes we want another. There is a complete spectrum of behaviour from - install and work in one place only - install anywhere but it must stay there - install and move a subtree anywhere - be able to keep working if parts are moved - be able to keep working if some parts are translated into Russian and some into Swahili with components running on machines with randomly chosen byte sex and word size Last year, our system administrators moved all my files on my desktop Mac. Needless to say, a whole lot of software I'd installed stopped working. I completely bitterly and was solemnly assured it would never happen again. I still hadn't got everything back working when, guess what, they did it again. They forcibly amalgamated my Mac files and my Linux files into a single file system. (So ~/Desktop is now ~/MacDrive/ok/Desktop, except that there is now a _new_ ~/Desktop as well.) Again all of my paths and most of my installed software broke. What could be worse? I'll have to wait to next year to find out. There were good motives. The reason for forcibly amalgamating the file systems (without my advance knowledge, let alone permission) was so that everyone's files would be on the same file servers, available on any machine in the department, and with everything backed up the same way. The problem is that the file servers go down far more often than the isolated Mac used to, so the net result was *less* availability. Thank goodness for the sysadmin who looks after my SunBlade 100; she didn't touch my files and everything just works. What's the point of the story? Unexpected consequences. "Packaging" changes designed to improve things can not only make other things worse, they can even end up making the things they were intended to help with worse. One approach DOESN'T suit every need, and what looks like the obviously best thing may actually be disastrously wrong for someone. Wouldn't Joe's "everything should just keep working if you move it" have saved me? Not when my Mac found itself running my Linux ~/.profile instead of my Mac one: the problem here is not just that the thing expected to be at location X wasn't there, but that something else _was_ there. Even if stuff is packaged as single "things" that adapt to new locations, *something* has to find them. There'll always be *something* that breaks if some other thing is moved. Of course the Mac tries to handle that by associating applications with documents, and keeping track of where the applications are. So I have some .pdf files that open in Preview, some that open in Acrobat 8, some that open in Acrobat 9, and some that fail to open at all. Of course, when I say "open in Acrobat 9", what I really mean is "not open in Acrobat 9" because there's something dodgy about Acrobat 9... Members of the Jury, if you believe that there is a "one size fits all" solution to this kind of problem, I an only envy your easy faith. From andrewmmc@REDACTED Wed Aug 5 04:26:13 2009 From: andrewmmc@REDACTED (andrew mmc) Date: Wed, 5 Aug 2009 04:26:13 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <48360B3A-CFEC-425E-9B5F-2EDB168D7071@masklinn.net> <9b08084c0908031058p1184b066ud047df9189654cf9@mail.gmail.com> <711a73df0908031120v440589bbt9b2cc9816f7efb97@mail.gmail.com> <9b08084c0908040053q7f24321r89d6914124971834@mail.gmail.com> Message-ID: I have to agree there is not one solution. Dependent on the application there will be a balance of objectives, performance, portability, and expertise required. There is no point in going to tremendous effort to keep it totally portable if all users have sufficient knowledge to perform whatever tasks may be required. Simply mandating a minimum level of expertise removes constraints on portability and opens up opportunities in other areas. In the web server scenario that has been discussed, the objective is generally to have a dynamic, frequently changing website. Moving a website is trivial in most cases, but making it such that it cannot be broken (or even striving to achieve that) is a great deal more effort than simply educating a user on what they need to know in order to move it. And on top of it makes the original objective of the site being dynamic harder to achieve. An example of these changing priorities is the web archive example given: it is not an example of how the structure of the web is broken, but an indication of making a system design choice in order to achieve a particular goal: accept the loss of fidelity by not archiving the images, in order to be able to archive the whole web. If they had ensured fidelity, that goal would not be feasible. In reality every project has its own balance. On Wed, Aug 5, 2009 at 3:57 AM, Richard O'Keefe wrote: > What we have here is essentially the debate between > static libraries and dynamically linked ones. > > To this day I remain hopping mad that Sun stopped > providing a statically linked libc with Solaris 10. > The argument for this was that customer programs > would _certainly_ never need to be relinked when a > new version of the operating system or library was > installed. > > The downside was that profiling (cc -p / prof) became > useless to me, because libc functions were no longer > reported. There's also the extra cost of run-time > loading, &c &c &c. > > Before Solaris 10, it was *my* choice whether I wanted > the "complete self-contained fast starting" virtues of > static linking or the "invisible updates to fix things > like security bugs" virtues of dynamic linking. Now it > isn't. > > Since much of the software I use is open source, and since > new releases are comparatively frequent, and since I'm > recompiling my own stuff all the time, for *me* the benefits > of static linking are preponderant. For many commercial > enterprises, I imagine the benefits of dynamic linking are > preponderant. > > I note that Macintosh applications *behave* like single > "objects", but they *are* directories containing a lot of > files. I note that the technique Joe mentioned, where an > HTML page can have "links" that point _without_ the single > block of data transmitted in an HTTP message "behaves like" > a collection of linked objects but "is" a single thing. > And then you have things like .iso and .dmg files where > one and the same thing "is" a single object and also "is" > an entire file system. > > We've got the classic distinction between hard links and > symbolic links: if I have a hard link from A to B and B > is moved, A will still point to whatever B is, while if > I have a symbolic link from A to B, B is renamed to C, and > D is renamed to B, A will now point to D. When "something" > is moved, what is "it", and do we always want the same thing > to happen? > > It seems to me that the answer is that sometimes we want one > kind of behaviour and sometimes we want another. There is a > complete spectrum of behaviour from > - install and work in one place only > - install anywhere but it must stay there > - install and move a subtree anywhere > - be able to keep working if parts are moved > - be able to keep working if some parts are > translated into Russian and some into Swahili > with components running on machines with > randomly chosen byte sex and word size > > Last year, our system administrators moved all my files on > my desktop Mac. Needless to say, a whole lot of software > I'd installed stopped working. I completely bitterly and > was solemnly assured it would never happen again. I still > hadn't got everything back working when, guess what, they > did it again. They forcibly amalgamated my Mac files and > my Linux files into a single file system. (So ~/Desktop > is now ~/MacDrive/ok/Desktop, except that there is now a > _new_ ~/Desktop as well.) Again all of my paths and most > of my installed software broke. What could be worse? I'll > have to wait to next year to find out. > > There were good motives. The reason for forcibly amalgamating > the file systems (without my advance knowledge, let alone > permission) was so that everyone's files would be on the same > file servers, available on any machine in the department, and > with everything backed up the same way. The problem is that > the file servers go down far more often than the isolated Mac > used to, so the net result was *less* availability. > > Thank goodness for the sysadmin who looks after my SunBlade 100; > she didn't touch my files and everything just works. > > What's the point of the story? > > Unexpected consequences. > > "Packaging" changes designed to improve things can not only > make other things worse, they can even end up making the > things they were intended to help with worse. One approach > DOESN'T suit every need, and what looks like the obviously > best thing may actually be disastrously wrong for someone. > > Wouldn't Joe's "everything should just keep working if you > move it" have saved me? Not when my Mac found itself > running my Linux ~/.profile instead of my Mac one: the > problem here is not just that the thing expected to be at > location X wasn't there, but that something else _was_ there. > Even if stuff is packaged as single "things" that adapt to > new locations, *something* has to find them. There'll always > be *something* that breaks if some other thing is moved. > > Of course the Mac tries to handle that by associating applications > with documents, and keeping track of where the applications are. > So I have some .pdf files that open in Preview, some that open > in Acrobat 8, some that open in Acrobat 9, and some that fail > to open at all. Of course, when I say "open in Acrobat 9", > what I really mean is "not open in Acrobat 9" because there's > something dodgy about Acrobat 9... > > Members of the Jury, if you believe that there is a "one size > fits all" solution to this kind of problem, I an only envy > your easy faith. > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From christophe.romain@REDACTED Wed Aug 5 11:23:48 2009 From: christophe.romain@REDACTED (Christophe Romain) Date: Wed, 5 Aug 2009 11:23:48 +0200 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> Message-ID: <20090805092348.GC20428@localhost> Hi >Experiment: > > # cd /usr/local/lib > # mv erlang globble > # globble/bin/erl > exec: 28: /usr/local/lib/erlang/erts-5.7.1/bin/erlexec: not found to bypass this, cean's modified erl script uses this hack (using bin/erl, that uses erlang/lib) here=`which "$0"` base=`dirname "$here"`/.. [ -z "$BASEDIR" ] && BASEDIR=`cd "$base"; pwd` ROOTDIR="$BASEDIR/erlang" it still allows to have several version installed, starting the one we want, but allows to move the directory without breaking things. regards. From roberto@REDACTED Wed Aug 5 14:10:12 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 5 Aug 2009 14:10:12 +0200 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: <4029.1249427970@snookles.snookles.com> References: <4029.1249427970@snookles.snookles.com> Message-ID: <9343335B-E20D-4882-8890-3670FD37C4F1@widetag.com> On 05/ago/09, at 01:19, Scott Lystig Fritchie wrote: > Roberto Ostinelli wrote: > > ro> char *e_headers = "[{one, 1}, {two, 2}]"; > ro> erlterm = erl_format("~w", e_headers); > > I agree with Per, that won't work. However, this should, if memory > serves correctly. > > ETERM *erlterm = erl_format("[{one, 1}, {two, 2}]"); > > erl_format() won't work well with C programs with limited stack > sizes > (e.g. when using Pthreads). It uses naive recursion for formatting > nested terms, which can cause problems for deeply-nested and/or > extremely long lists. In those cases, you can usually get by with a > small number of intermediate steps. > > ETERM *very_long_list = format_myself_by_hand(a_long_linked_list); > ETERM *my_tuple = erl_format("{ok, ~w}", very_long_list); > > IIRC, erl_format() doesn't have a format command for dealing with > binaries. But the ~w format command will work on a previously-created > binary, e.g. ETERM *my_bin = erl_mk_binary("Hello!", 6). > > -Scott thank you scott, yes my point was i hoped i could get an erlang term already parsed at c level, instead of transmitting strings over. however i'm not even actually sure this would change anything in performance, so that will do. cheers, r. From kiszl@REDACTED Wed Aug 5 15:29:30 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 5 Aug 2009 15:29:30 +0200 (CEST) Subject: Variable binding within lists (and tuples) Message-ID: <49435.194.88.55.211.1249478970.squirrel@localhost> Hi, Could somebody explain what is the order of building the list and binding the variables in the following examples? > [A=2,A]. * 1: variable 'A' is unbound > [B=2,B=3]. ** exception error: no match of right hand side value 3 Thank you, Zoltan. From garry@REDACTED Wed Aug 5 21:08:41 2009 From: garry@REDACTED (Garry Hodgson) Date: Wed, 05 Aug 2009 15:08:41 -0400 Subject: error compiling old xmerl with r13b Message-ID: <4A79D8B9.2070006@sage.att.com> i'm trying to build some ancient code of ours using r13b, and have hit a snag having to do with records. the code in question is an old version of xmerl (0.17). boiled down to its essence, i have two files: foo.hrl: -record( xmlContext, { axis_type = forward }). foo.erl: -module(foo). -record(state, {context = #xmlContext{}, acc = []}). foo() -> bar. when i compile foo.erl using erlc from r13b, i get: --> erlc foo.erl ./foo.erl:7: record xmlContext undefined ./foo.erl:7: Warning: record state is unused ./foo.erl:10: Warning: function foo/0 is unused compiling using our old r9C setup works fine. i don't want to invest a lot of effort in updating the old code, since the only reason i need to build it with r13b is to compare its performance with a completely rewritten version that doesn't use xml at all. i assume something has changed in the language. can anyone tell me what, and what i need do to fix this with minimal effort? thanks From fritchie@REDACTED Wed Aug 5 22:26:56 2009 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 05 Aug 2009 15:26:56 -0500 Subject: [erlang-questions] c-node and arbitrary erlang term In-Reply-To: Message of "Wed, 05 Aug 2009 14:10:12 +0200." <9343335B-E20D-4882-8890-3670FD37C4F1@widetag.com> Message-ID: <87930.1249504016@snookles.snookles.com> Roberto Ostinelli wrote: >> ETERM *erlterm = erl_format("[{one, 1}, {two, 2}]"); ro> yes my point was i hoped i could get an erlang term already parsed ro> at c level, instead of transmitting strings over. Robert, unless I'm gravely mistaken, the "erlterm" above, when converted (implicitly by Erlang inter-node communication or explicitly by your app via binary_to_term()), will result in a list of length two, not a list of length 20. -Scott From kenneth.lundin@REDACTED Wed Aug 5 22:32:23 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 5 Aug 2009 22:32:23 +0200 Subject: [erlang-questions] error compiling old xmerl with r13b In-Reply-To: <4A79D8B9.2070006@sage.att.com> References: <4A79D8B9.2070006@sage.att.com> Message-ID: Hi, I am missing the include of foo.hrl. Isn't that the reason for the error message below? /Kenneth Erlang7OTP, Ericsson On Wed, Aug 5, 2009 at 9:08 PM, Garry Hodgson wrote: > i'm trying to build some ancient code of ours using r13b, > and have hit a snag having to do with records. ?the code > in question is an old version of xmerl (0.17). ?boiled down > to its essence, i have two files: > > foo.hrl: > > -record( xmlContext, { axis_type = forward }). > > foo.erl: > > -module(foo). > > -record(state, {context = #xmlContext{}, acc = []}). > > foo() -> bar. > > when i compile foo.erl using erlc from r13b, i get: > > --> erlc foo.erl > ./foo.erl:7: record xmlContext undefined > ./foo.erl:7: Warning: record state is unused > ./foo.erl:10: Warning: function foo/0 is unused > > compiling using our old r9C setup works fine. > i don't want to invest a lot of effort in updating the old code, > since the only reason i need to build it with r13b is to compare > its performance with a completely rewritten version that doesn't use > xml at all. > > i assume something has changed in the language. ?can anyone tell > me what, and what i need do to fix this with minimal effort? > > thanks > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From tuncer.ayaz@REDACTED Wed Aug 5 22:38:24 2009 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 5 Aug 2009 22:38:24 +0200 Subject: [erlang-questions] error compiling old xmerl with r13b In-Reply-To: <4A79D8B9.2070006@sage.att.com> References: <4A79D8B9.2070006@sage.att.com> Message-ID: <4ac8254d0908051338q4828ee8bl362dc1a4eadaa549@mail.gmail.com> On Wed, Aug 5, 2009 at 9:08 PM, Garry Hodgson wrote: > i'm trying to build some ancient code of ours using r13b, > and have hit a snag having to do with records. ?the code > in question is an old version of xmerl (0.17). ?boiled down R13 includes xmerl 1.2 if that is of any help. > to its essence, i have two files: > > foo.hrl: > > -record( xmlContext, { axis_type = forward }). > > foo.erl: > > -module(foo). > > -record(state, {context = #xmlContext{}, acc = []}). > > foo() -> bar. > > when i compile foo.erl using erlc from r13b, i get: > > --> erlc foo.erl > ./foo.erl:7: record xmlContext undefined I'm not sure how it was back in the day but nowadays one normally includes the .hrl file for the definition. > ./foo.erl:7: Warning: record state is unused > ./foo.erl:10: Warning: function foo/0 is unused The warnings are correct. > compiling using our old r9C setup works fine. > i don't want to invest a lot of effort in updating the old code, > since the only reason i need to build it with r13b is to compare > its performance with a completely rewritten version that doesn't use > xml at all. > > i assume something has changed in the language. ?can anyone tell > me what, and what i need do to fix this with minimal effort? The following is ok. %% foo.hrl -record( xmlContext, { axis_type = forward }). %% foo.erl -module(foo). %% if you don't export foo and do not use %% otherwise it is not used and that's the %% cause for the warning. -export([foo/0]). %% include foo.hrl for knowing about the xmlContext record -include("foo.hrl"). -record(state, {context = #xmlContext{}, acc = []}). foo() -> #state{context=#xmlContext{axis_type=backward}, acc=[7,2,5]}. From paul-trapexit@REDACTED Wed Aug 5 23:44:02 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 5 Aug 2009 14:44:02 -0700 (PDT) Subject: [erlang-questions] erl_eval function object In-Reply-To: <1249407714.27964.0.camel@sredniczarny> References: <1249407714.27964.0.camel@sredniczarny> Message-ID: That's the call to erlang:'+'/2. The call I'd like to (also) see is to the anonymous fun enclosing it. -- p On Tue, 4 Aug 2009, Witold Baryluk wrote: > Dnia 2009-08-04, wto o godzinie 10:38 -0700, Paul Mineiro pisze: > > The documentation for erl_eval says that the NonlocalFunctionHandler is > > called when a functional object (fun) is called; however I'm not seeing > > this. > ... > > 1> evaltest:doit ("(fun () -> 10 + 2 end) ()."). > > non_local {erlang,'+'} [10,2] > > {value,12,[]} > > > But it looks, that it is called here. :) > > > -- > Witold Baryluk > From erlang@REDACTED Thu Aug 6 10:01:53 2009 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 6 Aug 2009 10:01:53 +0200 Subject: [erlang-questions] Variable binding within lists (and tuples) In-Reply-To: <49435.194.88.55.211.1249478970.squirrel@localhost> References: <49435.194.88.55.211.1249478970.squirrel@localhost> Message-ID: <9b08084c0908060101u32be91fctb2e52ae03fb90bf0@mail.gmail.com> You are supposed to think of all the elements in a list or tuple being evaluated "in parallel" This is why both [A=2,A] or [A,A=2] are illegal. Now exactly how they are evaluated depends upon the implementation. If you evaluate [io:format("a"), io:format("b")] the system will either print out ab or ba and the return value will be the list [ok,ok]. if you have a list with function calls [f(...), g(...)] then you're not supposed to write code whose correctness depends upon the order of calling f and g. Now allowing function calls in lists or tuples would be incredibly restrictive, so it not enforced, setting up bindings in the different elements of a list or tuple can be detected at compile time and is considered an error. In general we could imagine many different evaluation strategies for evaluating [A,B,C,...] left-to-right right-to-left parallel undefined data-flow constrained and so on. In the old-days of single CPUs left-to-right was the easiest to implement - on a multicore you could imagine some kind of parallel evaluation. Erlang doesn't have an up-to-date formal specification of what-to-do in such circumstances, this is rather unsatisfactory. Suppose we mandated left-to-right, then this would make parallel evaluation pretty difficult to implement. If we mandate parallel evaluation then we can't guarantee that the same program run twice delivers the same results - the result might depend upon the order of the parallel evaluation. The approach we have taken is to reject programs that require a particular evaluation order of the arguments of a list - so in [A=2,A] or [A,A=2] we can analyse the program and say that the first list needs left-to-right evaluation and the second right-to-left. But we don't want you to write code that depends upon the order of evaluation, so we reject both cases. I think (but can't confirm) that the last version of the Erlang spec (which is way out of date) mandated left-to-right so [A=2,A] should be legal, but because we don't want you to write left-to-write code we forbid it :-) Robert will correct me if I'm wrong. Cheers /Joe 2009/8/5 Zoltan Lajos Kis : > Hi, > > Could somebody explain what is the order of building the list and binding > the variables in the following examples? > >> [A=2,A]. > * 1: variable 'A' is unbound > >> [B=2,B=3]. > ** exception error: no match of right hand side value 3 > > Thank you, > Zoltan. > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From Jouni.Ryno@REDACTED Fri Aug 7 13:35:04 2009 From: Jouni.Ryno@REDACTED (Jouni Ryno) Date: Fri, 07 Aug 2009 14:35:04 +0300 Subject: [erlang-questions] Stuff that breaks when you move it In-Reply-To: <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> References: <9b08084c0908030604r6f4b9105q61d4f6f114069f93@mail.gmail.com> <9b08084c0908040023g6d53f216o973c258e80ac3a11@mail.gmail.com> Message-ID: <1249644904.14812.18.camel@adic> I always thought the old Macintosh file had it right, each file had the data AND the resource part. Resource part being a (limited) database. But all nicely packed with file system support. So one could base everything in single database file, programs using a small library to access it. And then someone wants a hierarchical database and then the other one to move things around inside the database ... Jouni -- Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ http://space.fmi.fi/~ryno/ Finnish Meteorological Institute http://www.fmi.fi/ P.O.BOX 503 Tel (+358)-9-19294656 FIN-00101 Helsinki FAX (+358)-9-19294603 Finland priv-GSM (+358)-50-5302903 "It's just zeros and ones, it cannot be hard" From egarrulo@REDACTED Fri Aug 7 13:48:10 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Fri, 7 Aug 2009 11:48:10 +0000 Subject: Windows: checking for available packages? Message-ID: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> Hello, I apologize if this question gets posted twice, but I've tried the Google Groups interface and it seemed to not work. I'd like to know how you can learn whether a package is available in your Erlang installation. To be specific, I'd like to know whether wx, ssl and database support is available into precompiled Erlang setup for Windows. I've tried to import such packages from the Erlang console, but that fails. OTOH, "-import(lists)." fails too, and AFAIK "lists" is a standard package. What I'm doing wrong? Thanks. From bflatmaj7th@REDACTED Fri Aug 7 13:56:06 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Fri, 7 Aug 2009 21:56:06 +1000 Subject: [erlang-questions] Windows: checking for available packages? In-Reply-To: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> References: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> Message-ID: <7702c0610908070456k56dc7501t9d536a65d196d788@mail.gmail.com> If you think you know the name of the module you can try 1> code:load_file(mnesia). {module,mnesia} 2> code:load_file(kjhsdfsadf). {error,nofile} or if it's an application you could try application:start(appName). I find the most reliable way is to search the erlang installed filesystem tree for files that look like what I want. On Fri, Aug 7, 2009 at 9:48 PM, Elena Garrulo wrote: > Hello, > > I apologize if this question gets posted twice, but I've tried the > Google Groups interface and it seemed to not work. > > I'd like to know how you can learn whether a package is available in > your Erlang installation. To be specific, I'd like to know whether wx, > ssl and database support is available into precompiled Erlang setup > for Windows. > > I've tried to import such packages from the Erlang console, but that > fails. OTOH, "-import(lists)." fails too, and AFAIK "lists" is a > standard package. From bengt.kleberg@REDACTED Fri Aug 7 14:01:03 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 07 Aug 2009 14:01:03 +0200 Subject: [erlang-questions] Windows: checking for available packages? In-Reply-To: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> References: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> Message-ID: <1249646463.4915.22.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, When you say package do you mean application or do you mean module? If you mean module you can do: code:all_loaded{} and get all loaded modules. That gives you a property list that can be searched like this: proplists:get_value( lists, code:all_loaded()). "/vobs/otp/otp_delivery/suse_x86/lib/stdlib-1.14.5.3/ebin/lists.beam" bengt On Fri, 2009-08-07 at 11:48 +0000, Elena Garrulo wrote: > Hello, > > I apologize if this question gets posted twice, but I've tried the > Google Groups interface and it seemed to not work. > > I'd like to know how you can learn whether a package is available in > your Erlang installation. To be specific, I'd like to know whether wx, > ssl and database support is available into precompiled Erlang setup > for Windows. > > I've tried to import such packages from the Erlang console, but that > fails. OTOH, "-import(lists)." fails too, and AFAIK "lists" is a > standard package. > > What I'm doing wrong? > > Thanks. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ro4tub@REDACTED Fri Aug 7 14:28:25 2009 From: ro4tub@REDACTED (Oscar) Date: Fri, 7 Aug 2009 20:28:25 +0800 Subject: How access the gen_server across the network Message-ID: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> I've start the gen_server via gen_server:start_link({global, game_time_service}, ...) and access the service via gen_server:call({global, game_time_service}, get_time). It throws the nprpoc exception when I access it. Any suggestions? Thanks. From egarrulo@REDACTED Fri Aug 7 14:28:59 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Fri, 7 Aug 2009 12:28:59 +0000 Subject: [erlang-questions] Windows: checking for available packages? In-Reply-To: <7702c0610908070456k56dc7501t9d536a65d196d788@mail.gmail.com> References: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> <7702c0610908070456k56dc7501t9d536a65d196d788@mail.gmail.com> Message-ID: <9bd8a08a0908070528y112c1696o56b4d1989d922285@mail.gmail.com> That seems a quick way to check for available packages. I've found out that everything I was looking for is there. Thanks 2009/8/7 Richard Andrews : > If you think you know the name of the module you can try > > 1> code:load_file(mnesia). > {module,mnesia} > 2> code:load_file(kjhsdfsadf). > {error,nofile} > > or if it's an application you could try application:start(appName). > > I find the most reliable way is to search the erlang installed > filesystem tree for files that look like what I want. > > On Fri, Aug 7, 2009 at 9:48 PM, Elena Garrulo wrote: >> Hello, >> >> I apologize if this question gets posted twice, but I've tried the >> Google Groups interface and it seemed to not work. >> >> I'd like to know how you can learn whether a package is available in >> your Erlang installation. To be specific, I'd like to know whether wx, >> ssl and database support is available into precompiled Erlang setup >> for Windows. >> >> I've tried to import such packages from the Erlang console, but that >> fails. OTOH, "-import(lists)." fails too, and AFAIK "lists" is a >> standard package. > From egarrulo@REDACTED Fri Aug 7 14:33:45 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Fri, 7 Aug 2009 12:33:45 +0000 Subject: [erlang-questions] Windows: checking for available packages? In-Reply-To: <7702c0610908070456k56dc7501t9d536a65d196d788@mail.gmail.com> References: <9bd8a08a0908070448k765b09fdsb35eec81d9f94f20@mail.gmail.com> <7702c0610908070456k56dc7501t9d536a65d196d788@mail.gmail.com> Message-ID: <9bd8a08a0908070533l3f82b478s422e0826968161c3@mail.gmail.com> BTW, using code:load seems a clean way to do that. It loads every module I was looking for. Thanks again. 2009/8/7 Richard Andrews : > If you think you know the name of the module you can try > > 1> code:load_file(mnesia). > {module,mnesia} > 2> code:load_file(kjhsdfsadf). > {error,nofile} > > or if it's an application you could try application:start(appName). > > I find the most reliable way is to search the erlang installed > filesystem tree for files that look like what I want. > > On Fri, Aug 7, 2009 at 9:48 PM, Elena Garrulo wrote: >> Hello, >> >> I apologize if this question gets posted twice, but I've tried the >> Google Groups interface and it seemed to not work. >> >> I'd like to know how you can learn whether a package is available in >> your Erlang installation. To be specific, I'd like to know whether wx, >> ssl and database support is available into precompiled Erlang setup >> for Windows. >> >> I've tried to import such packages from the Erlang console, but that >> fails. OTOH, "-import(lists)." fails too, and AFAIK "lists" is a >> standard package. > From kevin@REDACTED Fri Aug 7 14:34:38 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Fri, 7 Aug 2009 08:34:38 -0400 Subject: [erlang-questions] How access the gen_server across the network In-Reply-To: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> References: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> Message-ID: <6F43C8D2-303D-41EF-BBD7-0C8AA907EBC3@hypotheticalabs.com> Do you connect the two nodes, either via net_adm:ping/1 or net_kernel:connect_node/1, before trying the gen_server call? If so, you might try running the sasl application on both nodes and recreating the error. SASL will provide a ton of crash information which can be really handy when debugging these types of failures. --Kevin On Aug 7, 2009, at 8:28 AM, Oscar wrote: > I've start the gen_server via gen_server:start_link({global, > game_time_service}, ...) and access the service via > gen_server:call({global, game_time_service}, get_time). > > It throws the nprpoc exception when I access it. > > Any suggestions? > > Thanks. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ro4tub@REDACTED Fri Aug 7 14:46:34 2009 From: ro4tub@REDACTED (Oscar) Date: Fri, 7 Aug 2009 20:46:34 +0800 Subject: [erlang-questions] How access the gen_server across the network In-Reply-To: <6F43C8D2-303D-41EF-BBD7-0C8AA907EBC3@hypotheticalabs.com> References: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> <6F43C8D2-303D-41EF-BBD7-0C8AA907EBC3@hypotheticalabs.com> Message-ID: <9a77767b0908070546s6c2b74beg1824b25751e11136@mail.gmail.com> yes. net_kernel:connect_node(server@REDACTED). returns true, but erlang:nodes(). returns an empty list. On Fri, Aug 7, 2009 at 8:34 PM, Kevin A. Smith wrote: > Do you connect the two nodes, either via net_adm:ping/1 or > net_kernel:connect_node/1, before trying the gen_server call? If so, you > might try running the sasl application on both nodes and recreating the > error. SASL will provide a ton of crash information which can be really > handy when debugging these types of failures. > > --Kevin > On Aug 7, 2009, at 8:28 AM, Oscar wrote: > >> I've start the gen_server via gen_server:start_link({global, >> game_time_service}, ...) and access the service via >> gen_server:call({global, game_time_service}, get_time). >> >> It throws the nprpoc exception when I access it. >> >> Any suggestions? >> >> Thanks. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > From colm.dougan@REDACTED Fri Aug 7 15:45:20 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Fri, 7 Aug 2009 14:45:20 +0100 Subject: [erlang-questions] Re: [Erlyaws-list] YAWS with PHP on Windows XP problem In-Reply-To: References: <4A61E732.8060905@pcinside.pl> <65b2728e0907200747x36578e22q5bf1244946ff06eb@mail.gmail.com> <4A6491DC.3050407@pcinside.pl> <4A64F3E1.5000401@tail-f.com> <4A64F476.3010203@pcinside.pl> <4A64F7D3.80508@tail-f.com> Message-ID: <24d4f39c0908070645k14fed86etb05997e74bc12cea@mail.gmail.com> Carl, I duplicated your config on Windows XP and was able to get it working on yaws-1.84. However I firstly had to work-around a problem with my php-cgi binary which was giving me empty HTTP response which may or may not be what you are running into. When I created a shell script and manually defined the same environment variables that yaws was passing to the php binary I got the following error : ### Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

### Speculatively I patched yaws to define the REDIRECT_STATUS environment variable (with a value of "1") and when I recompiled yaws and re-requested my test.php it worked fine. I then realized that this behavior must be configurable in php.ini but I wasn't sure where php was looking for the php.ini. When I printed out phpinfo() in my php script I could see it was looking for php.ini in C:\WINDOWS. When I copied the sample php.ini to that location and altered it to have the following setting : cgi.force_redirect = 0 ... then my php script worked fine with an unpatched yaws. I'm not sure if this is the same issue you were running into but I just wanted to confirm that it is possible to get php working on Windows in yaws-1.84. Colm On Tue, Aug 4, 2009 at 2:28 PM, Carl McDade wrote: > Is this being worked on? Or is it marked for testing/improvement in a > later version? > > On Wed, Jul 29, 2009 at 6:49 AM, Carl McDade wrote: >> Just to make sure I rolled back from 1.84 to 1.82 and received the same result. >> >> On Wed, Jul 29, 2009 at 6:19 AM, Carl McDade wrote: >>> Hi, >>> >>> Confirming: I just tried this on Vista,PHP-CGI.exe and got the same >>> result, which is a blank page and no error outside of the path error >>> in the interactive window. >>> >>> /Carl >>> >>> >>> >>> On Tue, Jul 21, 2009 at 3:14 AM, andrew mmc wrote: >>>> Forgive me if I'm stating the obvious now, but I think the first problem was >>>> because the file extension was cgi, it tried to execute the file, which it >>>> couldn't do because it is on windows.? When you changed the extension to >>>> php, yaws knew to pass through the file as a parameter to the php executable >>>> - the correct behaviour. >>>> >>>> I think the problem is now with php.? PHP has some default behaviour set for >>>> security reasons.? e.g. on *nix you have to explicitly compile it with the >>>> option to run as cgi.? It also by default will not allow itself to execute >>>> anything outside of its docroot, so perhaps the test file isn't in or below >>>> the docroot set in php.ini? >>>> >>>> Otherwise, perhaps some of the other cgi specific options there could have >>>> an effect? >>>> >>>> >>>> 2009/7/21 Claes Wikstrom >>>>> >>>>> > Yes, this path exists. And it's correct - YAWS throws an error with >>>>> > incorrect path. >>>>> > >>>>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've >>>>> > ?to change it but later ;)) >>>>> > >>>>> >>>>> Nice :-) >>>>> >>>>> > Still, problem is unresolved... >>>>> >>>>> I'll take a look at it - but not now. As I said before, this just >>>>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified >>>>> so that we >>>>> >>>>> 1. see what get's open_ported() ed >>>>> 2. figure out why that doesn't work. >>>>> >>>>> >>>>> >>>>> /klacke >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Enter the BlackBerry Developer Challenge >>>>> This is your chance to win up to $100,000 in prizes! For a limited time, >>>>> vendors submitting new applications to BlackBerry App World(TM) will have >>>>> the opportunity to enter the BlackBerry Developer Challenge. See full >>>>> prize >>>>> details at: http://p.sf.net/sfu/Challenge >>>>> _______________________________________________ >>>>> Erlyaws-list mailing list >>>>> Erlyaws-list@REDACTED >>>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Enter the BlackBerry Developer Challenge >>>> This is your chance to win up to $100,000 in prizes! For a limited time, >>>> vendors submitting new applications to BlackBerry App World(TM) will have >>>> the opportunity to enter the BlackBerry Developer Challenge. See full prize >>>> details at: http://p.sf.net/sfu/Challenge >>>> _______________________________________________ >>>> Erlyaws-list mailing list >>>> Erlyaws-list@REDACTED >>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list >>>> >>>> >>> >>> >>> >>> -- >>> Carl McDade >>> Lead Developer >>> ____________________ >>> >>> FireOrb CMS >>> www.fireorb.info >>> >> >> >> >> -- >> Carl McDade >> Lead Developer >> ____________________ >> >> FireOrb CMS >> www.fireorb.info >> > > > > -- > Carl McDade > Lead Developer > FireOrb CMS - www.fireorb.info > __________________________ > > Publisher and Editor > Hiveminds Magazine -www.hiveminds.co.uk > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From egarrulo@REDACTED Fri Aug 7 16:22:07 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Fri, 7 Aug 2009 14:22:07 +0000 Subject: How to exchange sensitive data with ports? Message-ID: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> Hello, I'd like to access smart cards from Erlang. Since there is not dedicated module, I'll have to use C for that. In this thread: http://groups.google.com/group/erlang-programming/browse_frm/thread/f27c205eab2e8f95/2ac047fd8840cc2f?lnk=gst&q=ffi#2ac047fd8840cc2f it is recommended that you use ports (that is: external processes) to exchange data with native libraries. However, the whole purpose of using smart cards is accessing sensitive information stored into the card itself. To my limited knowledge, opening a port (pipe) with an external process would allow sniffing. Is that true? If not, what tools should I use (preferably working both on Linux and Windows)? I apologize if the question is somewhat off-topic. Thanks. From egarrulo@REDACTED Fri Aug 7 16:47:00 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Fri, 7 Aug 2009 14:47:00 +0000 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <4d08db370908070740l6b58d714n24a16314b104b6b1@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <4d08db370908070740l6b58d714n24a16314b104b6b1@mail.gmail.com> Message-ID: <9bd8a08a0908070747v2ab5153cnf64664728c3dc5a@mail.gmail.com> Practically speaking, if both the Erlang process and the external one are running into user level (not root), other user level process can't sniff data. Is that true? Thanks 2009/8/7 Hynek Vychodil : > 1/ Can someone other read pipe? -? Yes, for example when is able trace > precess at any end of the pipe. > 2/ Is it security issue? - NO! If some one has those privileges you are > already doomed. He is already able to do you much more worse. He is able > patch your process on fly for example and so and so. > > On Fri, Aug 7, 2009 at 4:22 PM, Elena Garrulo wrote: >> >> Hello, >> >> I'd like to access smart cards from Erlang. Since there is not >> dedicated module, I'll have to use C for that. >> >> In this thread: >> >> >> http://groups.google.com/group/erlang-programming/browse_frm/thread/f27c205eab2e8f95/2ac047fd8840cc2f?lnk=gst&q=ffi#2ac047fd8840cc2f >> >> it is recommended that you use ports (that is: external processes) to >> exchange data with native libraries. >> >> However, the whole purpose of using smart cards is accessing sensitive >> information stored into the card itself. To my limited knowledge, >> opening a port (pipe) with an external process would allow sniffing. >> Is that true? If not, what tools ?should I use (preferably working >> both on Linux and Windows)? >> >> I apologize if the question is somewhat off-topic. >> >> Thanks. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > > > -- > --Hynek (Pichi) Vychodil > > Analyze your data in minutes. Share your insights instantly. Thrill your > boss. ?Be a data hero! > Try Good Data now for free: www.gooddata.com > From ro4tub@REDACTED Fri Aug 7 17:12:08 2009 From: ro4tub@REDACTED (Oscar) Date: Fri, 7 Aug 2009 23:12:08 +0800 Subject: [erlang-questions] How access the gen_server across the network In-Reply-To: <9a77767b0908070546s6c2b74beg1824b25751e11136@mail.gmail.com> References: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> <6F43C8D2-303D-41EF-BBD7-0C8AA907EBC3@hypotheticalabs.com> <9a77767b0908070546s6c2b74beg1824b25751e11136@mail.gmail.com> Message-ID: <9a77767b0908070812t48539bd1la13b286d431f555@mail.gmail.com> Now it works. But I still have two questions. 1. Must it connect the two nodes before trying the gen_server call? 2. Shall we make users decide to register it locally or globally while designing the gen_server behavior? Is there any good examples in ERLANG source package? On Fri, Aug 7, 2009 at 8:46 PM, Oscar wrote: > yes. net_kernel:connect_node(server@REDACTED). returns true, but > erlang:nodes(). returns an empty list. > > > On Fri, Aug 7, 2009 at 8:34 PM, Kevin A. Smith wrote: >> Do you connect the two nodes, either via net_adm:ping/1 or >> net_kernel:connect_node/1, before trying the gen_server call? If so, you >> might try running the sasl application on both nodes and recreating the >> error. SASL will provide a ton of crash information which can be really >> handy when debugging these types of failures. >> >> --Kevin >> On Aug 7, 2009, at 8:28 AM, Oscar wrote: >> >>> I've start the gen_server via gen_server:start_link({global, >>> game_time_service}, ...) and access the service via >>> gen_server:call({global, game_time_service}, get_time). >>> >>> It throws the nprpoc exception when I access it. >>> >>> Any suggestions? >>> >>> Thanks. >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >> >> > From joelr1@REDACTED Fri Aug 7 17:46:26 2009 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 7 Aug 2009 16:46:26 +0100 Subject: http:request hanging Message-ID: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> I'm issuing a GET to Amazon EC2 to start an instance, e.g. URL = "https://ec2.amazonaws.com/?Action=RunInstances&ImageId=amixxxxx&MinCount=1&MaxCount=1&KeyName=gsg-keypair&AWSAccessKeyId=xxxxx&Timestamp=2009-08-07T15%3A27%3A23Z&SignatureVersion=1&Version=2007-08-29&Signature=xxxx ". http:request(get, {URL, []}, [{ssl, []}], []). Pasting the URL above into Firefox returns XML and starts the instance. Issuing the http:request above from Erlang, on the other hand, just hangs. Any explanation for this? How would I go about debugging it? I'm using OTP R13B01. Thanks, Joel --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From kevin@REDACTED Fri Aug 7 17:49:17 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Fri, 7 Aug 2009 11:49:17 -0400 Subject: [erlang-questions] How access the gen_server across the network In-Reply-To: <9a77767b0908070812t48539bd1la13b286d431f555@mail.gmail.com> References: <9a77767b0908070528s640f4e79xb339373d9cde799e@mail.gmail.com> <6F43C8D2-303D-41EF-BBD7-0C8AA907EBC3@hypotheticalabs.com> <9a77767b0908070546s6c2b74beg1824b25751e11136@mail.gmail.com> <9a77767b0908070812t48539bd1la13b286d431f555@mail.gmail.com> Message-ID: <5E862149-2BD0-482D-8A17-D51DC67430AA@hypotheticalabs.com> On Aug 7, 2009, at 11:12 AM, Oscar wrote: > Now it works. > But I still have two questions. > > 1. Must it connect the two nodes before trying the gen_server call? Yes, connecting the two nodes is required. Synchronizing each node's view of the global namespace is part of the node connection process. > 2. Shall we make users decide to register it locally or globally while > designing the gen_server behavior? There is another option besides local or global registration. gen_server understands how to send messages with a ServerRef formatted like so: {RegisteredName, NodeName} where RegisteredName is a locally registered name. gen_server's manpages go into more detail. --Kevin > > Is there any good examples in ERLANG source package? > > On Fri, Aug 7, 2009 at 8:46 PM, Oscar wrote: >> yes. net_kernel:connect_node(server@REDACTED). returns true, but >> erlang:nodes(). returns an empty list. >> >> >> On Fri, Aug 7, 2009 at 8:34 PM, Kevin A. Smith> > wrote: >>> Do you connect the two nodes, either via net_adm:ping/1 or >>> net_kernel:connect_node/1, before trying the gen_server call? If >>> so, you >>> might try running the sasl application on both nodes and >>> recreating the >>> error. SASL will provide a ton of crash information which can be >>> really >>> handy when debugging these types of failures. >>> >>> --Kevin >>> On Aug 7, 2009, at 8:28 AM, Oscar wrote: >>> >>>> I've start the gen_server via gen_server:start_link({global, >>>> game_time_service}, ...) and access the service via >>>> gen_server:call({global, game_time_service}, get_time). >>>> >>>> It throws the nprpoc exception when I access it. >>>> >>>> Any suggestions? >>>> >>>> Thanks. >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>> >>> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From illo@REDACTED Fri Aug 7 17:52:04 2009 From: illo@REDACTED (Illo de' Illis) Date: Fri, 7 Aug 2009 17:52:04 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> Message-ID: <526B3DEE-49FD-4ACE-8ED3-66E049F92200@totalwire.it> On Aug 7, 2009, at 4:22 PM, Elena Garrulo wrote: > Hello, > > I'd like to access smart cards from Erlang. Since there is not > dedicated module, I'll have to use C for that. [...] > However, the whole purpose of using smart cards is accessing sensitive > information stored into the card itself. To my limited knowledge, > opening a port (pipe) with an external process would allow sniffing. > Is that true? If not, what tools should I use (preferably working > both on Linux and Windows)? What follows applies to Linux only. In your scenario, a good level of security can be obtained just by assuming that the following is true: - the bad guy is not logged as root or a malicious program is not running with root privileges during a smartcard transaction - should this be untrue, you would have a good deal more to worry about. That said, I would go with a port driver, in spite it being discouraged by the post you're referring to, since it would limit eavesdropping and pipe redirection/tracing/dumping. But whatever choice you're going to pick, you'll have to deal with the fact that you cannot tell the Erlang VM where to store the data you're sending. So even if you'd allocate an unpageable (secured) memory buffer to store sensitive data in your C code, that data could be paged out when passed to the VM. I would recommend storing the sensitive data in a secured memory buffer in the C code (accessing them by some sort of hash table keyed by terms) and exposing functions for filling the dictionary by obtaining sensitive information from both the user (i.e. by accessing / dev/tty) and the smartcard, managing this values and passing portions of the in-code dictionary from an erlang node to another (both coupled with your C code) securely by SSL or whatever suits your needs. This way you could provide a good level of overall security and performance, and the security issues could be limited to your context. Ciao, Illo. From illo@REDACTED Fri Aug 7 18:20:04 2009 From: illo@REDACTED (Illo de' Illis) Date: Fri, 7 Aug 2009 18:20:04 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <4d08db370908070907ubde9c62l7c120d34c4635f70@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <526B3DEE-49FD-4ACE-8ED3-66E049F92200@totalwire.it> <4d08db370908070907ubde9c62l7c120d34c4635f70@mail.gmail.com> Message-ID: <583DA448-9DC6-4B26-A3F8-C6BC158EC159@totalwire.it> On Aug 7, 2009, at 6:07 PM, Hynek Vychodil wrote: > No, no, no, you must be sure that bad guy has not ever been logged > as root or a malicious program has not been running with root > privileges in any time in past. You can't trust your kernel! It > could been patched! You must be sure that bad guy has not been > logged at your user level or a malicious program has not been > running in same time as any your still running process. It can be > new malicious program patched on fly. You must be sure that when you > start your Erlang VM or any other program you don't execute any code > which could be modified when bad guy has been logged or malicious > program has been running. Etc. I was talking about a _good_ level of security, not a _I'm freaking paranoid_ level of security. As it has been memed all over internet since ages, a secure system is a system which is switched off, not connected to internet, and locked up in a safe. And speaking of that, since the original poster is dealing with a smartcard, every transaction should be encrypted by the smartcard private and unaccessible key by using a lcoked-out computer in a vacuum chamber. Ciao, Illo. From illo@REDACTED Fri Aug 7 18:57:38 2009 From: illo@REDACTED (Illo de' Illis) Date: Fri, 7 Aug 2009 18:57:38 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <4d08db370908070941v6692b732vf3e57ae8d42711b7@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <526B3DEE-49FD-4ACE-8ED3-66E049F92200@totalwire.it> <4d08db370908070907ubde9c62l7c120d34c4635f70@mail.gmail.com> <583DA448-9DC6-4B26-A3F8-C6BC158EC159@totalwire.it> <4d08db370908070941v6692b732vf3e57ae8d42711b7@mail.gmail.com> Message-ID: <05CE76F7-9B79-40B1-993F-82EEDD7D7F7B@totalwire.it> I doubt your advices would be useful to the scenery the original poster is working with. Since she was afraid of a pipe I guess she is already dealing with an public/untrusted system, and I reckon locked memory (which I frankly wouldn't call "security by obscurity") and / dev/TTY access for user input to be a good starting point. Ciao, Illo. From joelr1@REDACTED Fri Aug 7 19:12:22 2009 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 7 Aug 2009 18:12:22 +0100 Subject: http:request hanging In-Reply-To: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> Message-ID: It appears to have something to do with SSL and, perhaps, the version of OpenSSL in particular. Does not work on Mac OSX Snow Leopard (x86-64) with OpenSSL 0.9.8k 25 Mar 2009, works on Ubuntu 9.04 with OpenSSL 0.9.8g 19 Oct 2007. On Aug 7, 2009, at 4:46 PM, Joel Reymont wrote: > I'm issuing a GET to Amazon EC2 to start an instance, e.g. > > URL = "https://ec2.amazonaws.com/?Action=RunInstances&ImageId=amixxxxx&MinCount=1&MaxCount=1&KeyName=gsg-keypair&AWSAccessKeyId=xxxxx&Timestamp=2009-08-07T15%3A27%3A23Z&SignatureVersion=1&Version=2007-08-29&Signature=xxxx > ". > http:request(get, {URL, []}, [{ssl, []}], []). > > Pasting the URL above into Firefox returns XML and starts the > instance. Issuing the http:request above from Erlang, on the other > hand, just hangs. > > Any explanation for this? How would I go about debugging it? I'm > using OTP R13B01. > --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From colm.dougan@REDACTED Fri Aug 7 21:19:06 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Fri, 7 Aug 2009 20:19:06 +0100 Subject: [erlang-questions] http:request hanging In-Reply-To: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> Message-ID: <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> On Fri, Aug 7, 2009 at 4:46 PM, Joel Reymont wrote: > I'm issuing a GET to Amazon EC2 to start an instance, e.g. > > URL = > "https://ec2.amazonaws.com/?Action=RunInstances&ImageId=amixxxxx&MinCount=1&MaxCount=1&KeyName=gsg-keypair&AWSAccessKeyId=xxxxx&Timestamp=2009-08-07T15%3A27%3A23Z&SignatureVersion=1&Version=2007-08-29&Signature=xxxx". > http:request(get, {URL, []}, [{ssl, []}], []). > > Pasting the URL above into Firefox returns XML and starts the instance. > Issuing the http:request above from Erlang, on the other hand, just hangs. > > Any explanation for this? How would I go about debugging it? I'm using OTP > R13B01. I get the same hang on on 12B-5. However when i firstly do "application:start(ssl)" I get a response. Colm From nik.epifanov@REDACTED Fri Aug 7 21:20:56 2009 From: nik.epifanov@REDACTED (Nikolay Epifanov) Date: Fri, 7 Aug 2009 23:20:56 +0400 Subject: SMP support in OpenBSD Message-ID: Hi, I couldn't find any clear answer to whether Erlang supports SMP in OpenBSD or not. On starting it prints: $ erl Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> But when I run test program only one beam.smp is started and maximum cpu load I can get is 100% total. It can be as a sum of load of 2 cores (for example 72% on one of them and 28% on the other) or 100% on a one core only leaving 3 other idle. Load jumps from on core to another but in total it keeps under 100%. Running erl with "-smp enable" and/or various "+S" didn't change anything. Is SMP supported in OpenBSD? And if not: is it planned to implement it? From rapsey@REDACTED Fri Aug 7 21:33:40 2009 From: rapsey@REDACTED (Rapsey) Date: Fri, 7 Aug 2009 21:33:40 +0200 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: Message-ID: <97619b170908071233g604b3db3xa91206ff2f48c425@mail.gmail.com> What is the test program? Sergej On Fri, Aug 7, 2009 at 9:20 PM, Nikolay Epifanov wrote: > Hi, > > I couldn't find any clear answer to whether Erlang supports SMP in OpenBSD > or not. > On starting it prints: > > $ erl > Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:4:4] [rq:4] > [async-threads:0] [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> > > But when I run test program only one beam.smp is started and maximum cpu > load I can get is 100% total. It can be as a sum of load of 2 cores (for > example 72% on one of them and 28% on the other) or 100% on a one core only > leaving 3 other idle. Load jumps from on core to another but in total it > keeps under 100%. Running erl with "-smp enable" and/or various "+S" didn't > change anything. > > Is SMP supported in OpenBSD? And if not: is it planned to implement it? > From nik.epifanov@REDACTED Fri Aug 7 21:39:24 2009 From: nik.epifanov@REDACTED (Nikolay Epifanov) Date: Fri, 7 Aug 2009 23:39:24 +0400 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: <97619b170908071233g604b3db3xa91206ff2f48c425@mail.gmail.com> References: <97619b170908071233g604b3db3xa91206ff2f48c425@mail.gmail.com> Message-ID: 2009/8/7 Rapsey > What is the test program? > Here it is: -------------------------------- -module(bsd_test). -compile(export_all). p(X, Y) -> p(X, X, Y). p(X, _, 1) -> X; p(X, Z, Y) -> p(X * Z, Z, Y-1). run() -> spawn(fun() -> p(999, 999999) end), run(). -------------------------------- Is it ok? From illo@REDACTED Fri Aug 7 22:17:47 2009 From: illo@REDACTED (Illo de' Illis) Date: Fri, 7 Aug 2009 22:17:47 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <4d08db370908071135u2780e287n7b7261ba1a4ad6ce@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <526B3DEE-49FD-4ACE-8ED3-66E049F92200@totalwire.it> <4d08db370908070907ubde9c62l7c120d34c4635f70@mail.gmail.com> <583DA448-9DC6-4B26-A3F8-C6BC158EC159@totalwire.it> <4d08db370908070941v6692b732vf3e57ae8d42711b7@mail.gmail.com> <05CE76F7-9B79-40B1-993F-82EEDD7D7F7B@totalwire.it> <4d08db370908071135u2780e287n7b7261ba1a4ad6ce@mail.gmail.com> Message-ID: <42214E35-4FB0-4181-A0C8-B4C609D621B7@totalwire.it> On 07/ago/2009, at 20.35, Hynek Vychodil wrote: > On Fri, Aug 7, 2009 at 6:57 PM, Illo de' Illis > wrote: > I doubt your advices would be useful to the scenery the original > poster is working with. Since she was afraid of a pipe I guess she > is already dealing with an public/untrusted system, and I reckon > locked memory (which I frankly wouldn't call "security by > obscurity") and /dev/TTY access for user input to be a good starting > point. > > If you are dealing with untrusted system there all effort just > Potemkin's village. It is worthless. One can make some masquerade > for dumb people but anyone who understand real security will laugh > at you. It is all a matter of perspective. I'd bet you would call a "masquerade for dumb people" locking someone's home door up to avoid thieves as well... Well, let's hope both our opinions will be of some use to Elena! Good luck for your smartcard project. Ciao, Illo. From joelr1@REDACTED Fri Aug 7 22:47:45 2009 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 7 Aug 2009 21:47:45 +0100 Subject: [erlang-questions] http:request hanging In-Reply-To: <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> Message-ID: On Aug 7, 2009, at 8:19 PM, Colm Dougan wrote: > I get the same hang on on 12B-5. However when i firstly do > "application:start(ssl)" I get a response. That's not it because the code has inets:start(), ssl:start(), etc. before the http request and it still hangs even after I explicitly start the applications. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From baryluk@REDACTED Fri Aug 7 22:52:20 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Fri, 07 Aug 2009 22:52:20 +0200 Subject: [erlang-questions] http:request hanging In-Reply-To: References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> Message-ID: <1249678340.9078.5.camel@sredniczarny> Dnia 2009-08-07, pi? o godzinie 21:47 +0100, Joel Reymont pisze: > On Aug 7, 2009, at 8:19 PM, Colm Dougan wrote: > > > I get the same hang on on 12B-5. However when i firstly do > > "application:start(ssl)" I get a response. > > That's not it because the code has inets:start(), ssl:start(), etc. > before the http request and it still hangs even after I explicitly > start the applications. > I have the same problem with 13B01. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From joelr1@REDACTED Fri Aug 7 22:56:26 2009 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 7 Aug 2009 21:56:26 +0100 Subject: [erlang-questions] http:request hanging In-Reply-To: <1249678340.9078.5.camel@sredniczarny> References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> <1249678340.9078.5.camel@sredniczarny> Message-ID: <204F3A83-3F30-4711-82AD-EEAF22925146@gmail.com> On Aug 7, 2009, at 9:52 PM, Witold Baryluk wrote: > I have the same problem with 13B01. What is your OS and 'openssl version'? This works fine on Ubuntu, btw, same R13B01. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From baryluk@REDACTED Fri Aug 7 23:02:39 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Fri, 07 Aug 2009 23:02:39 +0200 Subject: [erlang-questions] http:request hanging In-Reply-To: <204F3A83-3F30-4711-82AD-EEAF22925146@gmail.com> References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> <24d4f39c0908071219y30183ac9uc2a13b0411267018@mail.gmail.com> <1249678340.9078.5.camel@sredniczarny> <204F3A83-3F30-4711-82AD-EEAF22925146@gmail.com> Message-ID: <1249678959.9078.8.camel@sredniczarny> Dnia 2009-08-07, pi? o godzinie 21:56 +0100, Joel Reymont pisze: > On Aug 7, 2009, at 9:52 PM, Witold Baryluk wrote: > > > I have the same problem with 13B01. > > What is your OS and 'openssl version'? > > This works fine on Ubuntu, btw, same R13B01. Upgraded Erlang 5 minutes ago, and now it works. :) I can swear that it wasn't working yesterday (it was hanging). It is Debian Unstable. I will report it back, if this problem will repeat. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From mjtruog@REDACTED Sat Aug 8 00:18:36 2009 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 07 Aug 2009 15:18:36 -0700 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: Message-ID: <4A7CA83C.9060107@gmail.com> The "[smp:4:4]" suggests that smp support is working fine. The total cpu usage in top should reflect all available cores. The jobs should have affinity, making them stick to a core, but I really don't know details. As I understand it, the Erlang source code is not modified to compile on OpenBSD, except to work around some gcc specifics (but no SYSV specifics) so it should have the same functionality as on Linux (excluding ODBC and jinterface... not sure about those). Nikolay Epifanov wrote: > Hi, > > I couldn't find any clear answer to whether Erlang supports SMP in OpenBSD > or not. > On starting it prints: > > $ erl > Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:4:4] [rq:4] > [async-threads:0] [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> > > But when I run test program only one beam.smp is started and maximum cpu > load I can get is 100% total. It can be as a sum of load of 2 cores (for > example 72% on one of them and 28% on the other) or 100% on a one core only > leaving 3 other idle. Load jumps from on core to another but in total it > keeps under 100%. Running erl with "-smp enable" and/or various "+S" didn't > change anything. > > Is SMP supported in OpenBSD? And if not: is it planned to implement it? > > From wallentin.dahlberg@REDACTED Sat Aug 8 01:24:56 2009 From: wallentin.dahlberg@REDACTED (Wallentin Dahlberg) Date: Sat, 8 Aug 2009 01:24:56 +0200 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: <97619b170908071233g604b3db3xa91206ff2f48c425@mail.gmail.com> Message-ID: Rapid spawning of a serious amount of processes has an internal bottleneck (a lock congestion) in erts and is even more apparent in short lived processes (the latter is not the case here though). An infinite loop which purpose only is spawning new processes will serialize your runtime environment. It is considered good parallelizing practice to spawn a number of worker processes equal to the number of logical processing elements in your system, in your case four. In some cases it could be helpful to have a set of pre-spawned worker processes that you have in a work pool. The Rapid spawning serialization problem is known to us and the problem will be mitigated in a future release of Erlang/OTP. Try using a finite number of processes say between 4 and 256 and see if your cpu-utilization increases. Regards, Bj?rn-Egil Erlang/OTP 2009/8/7 Nikolay Epifanov > 2009/8/7 Rapsey > > > What is the test program? > > > > Here it is: > > -------------------------------- > -module(bsd_test). > -compile(export_all). > > p(X, Y) -> > p(X, X, Y). > > p(X, _, 1) -> > X; > p(X, Z, Y) -> > p(X * Z, Z, Y-1). > > run() -> > spawn(fun() -> p(999, 999999) end), > run(). > -------------------------------- > > Is it ok? > From colm.dougan@REDACTED Sat Aug 8 01:25:15 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Sat, 8 Aug 2009 00:25:15 +0100 Subject: [erlang-questions] Re: http:request hanging In-Reply-To: References: <51DBB632-538F-443C-8F1E-BA80CBEDF664@gmail.com> Message-ID: <24d4f39c0908071625i62ec1714pc2e72cdcc3751ea1@mail.gmail.com> On Fri, Aug 7, 2009 at 6:12 PM, Joel Reymont wrote: > It appears to have something to do with SSL and, perhaps, the version of > OpenSSL in particular. > > Does not work on Mac OSX Snow Leopard (x86-64) with OpenSSL 0.9.8k 25 Mar > 2009, works on Ubuntu 9.04 with OpenSSL 0.9.8g 19 Oct 2007. It works for me on Debian testing (squeeze) with OpenSSL 0.9.8k-3 and erlang 13B-01. Colm > > On Aug 7, 2009, at 4:46 PM, Joel Reymont wrote: > >> I'm issuing a GET to Amazon EC2 to start an instance, e.g. >> >> URL = >> "https://ec2.amazonaws.com/?Action=RunInstances&ImageId=amixxxxx&MinCount=1&MaxCount=1&KeyName=gsg-keypair&AWSAccessKeyId=xxxxx&Timestamp=2009-08-07T15%3A27%3A23Z&SignatureVersion=1&Version=2007-08-29&Signature=xxxx". >> http:request(get, {URL, []}, [{ssl, []}], []). >> >> Pasting the URL above into Firefox returns XML and starts the instance. >> Issuing the http:request above from Erlang, on the other hand, just hangs. >> >> Any explanation for this? How would I go about debugging it? I'm using OTP >> R13B01. >> > > --- > Mac hacker with a performance bent > http://www.linkedin.com/in/joelreymont > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From egarrulo@REDACTED Sat Aug 8 02:07:21 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Sat, 8 Aug 2009 02:07:21 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <42214E35-4FB0-4181-A0C8-B4C609D621B7@totalwire.it> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <526B3DEE-49FD-4ACE-8ED3-66E049F92200@totalwire.it> <4d08db370908070907ubde9c62l7c120d34c4635f70@mail.gmail.com> <583DA448-9DC6-4B26-A3F8-C6BC158EC159@totalwire.it> <4d08db370908070941v6692b732vf3e57ae8d42711b7@mail.gmail.com> <05CE76F7-9B79-40B1-993F-82EEDD7D7F7B@totalwire.it> <4d08db370908071135u2780e287n7b7261ba1a4ad6ce@mail.gmail.com> <42214E35-4FB0-4181-A0C8-B4C609D621B7@totalwire.it> Message-ID: <9bd8a08a0908071707u4c2a4f9fo270524c34e84f9e7@mail.gmail.com> An enlightening reading indeed... Thanks for your detailed replies. I didn't state it, but I was looking for a "reasonable" level of security, assuming that nobody had tampered with the system previously. Kind of what you do when you enter your credit card number into a web page: you trust your system to be clean of spyware... BTW, I've realized that I was tackling the problem at a low level, that is: wrapping calls to the smart card layer by means of an external process. A better solution is to make the external process have its own logic, make it deal with the sensitive data on its own (safely handling memory), and send back to the erlang process the data it needs. Ciao a tutti (= cheers to everyone) 2009/8/7 Illo de' Illis : > On 07/ago/2009, at 20.35, Hynek Vychodil wrote: > >> On Fri, Aug 7, 2009 at 6:57 PM, Illo de' Illis wrote: >> I doubt your advices would be useful to the scenery the original poster is >> working with. Since she was afraid of a pipe I guess she is already dealing >> with an public/untrusted system, and I reckon locked memory (which I frankly >> wouldn't call "security by obscurity") and /dev/TTY access for user input to >> be a good starting point. >> >> If you are dealing with untrusted system there all effort just Potemkin's >> village. It is worthless. One can make some masquerade for dumb people but >> anyone who understand real security will laugh at you. > > It is all a matter of perspective. ?I'd bet you would call a "masquerade for > dumb people" locking someone's home door up to avoid thieves as well... > > Well, let's hope both our opinions will be of some use to Elena! Good luck > for your smartcard project. > > Ciao, > Illo. > From dmitriid@REDACTED Sat Aug 8 12:15:44 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sat, 8 Aug 2009 13:15:44 +0300 Subject: [ANN] "Reverse" help lookup a la railsapi.com Message-ID: <58F5EA17-2E93-4981-9D6F-703A1C940019@gmail.com> http://erlapi.prepor.ru/docs/ Have you ever worked through somebody else's code and wondered what this or that function does? Thi is especially true when you're looking at source code for a well-known project in search for tips on how to solve certain problems. What does c:nc/2 do? What options does inet:setopts/2 accept? And so on. Andrew Rudenko [1] on the erlang-russian [2] mailing list decided to solve this problem. Getting his inspiration from the Rails API site [3], he made an analog for Erlang: http://erlapi.prepor.ru/docs/ You may think "yeah, right, just a pretty doc site" and you'll be wrong. Just try searching for the aforementioned c:nc and inet:setopts functions to get the idea of what this really is. - Generator (in Ruby) that was used to generate the docs is here: http://github.com/prepor/erlapi/tree - You can download generated docs for local viewing here: http://github.com/prepor/erlapi-static/tree/master [1] Andrew Rudenko: http://prepor.ru/ [2] erlang-russian mailing list: http://groups.google.com/group/erlang-russian/ [3] Rails API site: http://railsapi.com/doc/rails-v2.3.3.1/ From bflatmaj7th@REDACTED Sat Aug 8 13:09:58 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Sat, 8 Aug 2009 21:09:58 +1000 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> Message-ID: <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> On Sat, Aug 8, 2009 at 12:22 AM, Elena Garrulo wrote: > Hello, > > I'd like to access smart cards from Erlang. Since there is not > dedicated module, I'll have to use C for that. > > In this thread: > > http://groups.google.com/group/erlang-programming/browse_frm/thread/f27c205eab2e8f95/2ac047fd8840cc2f?lnk=gst&q=ffi#2ac047fd8840cc2f > > it is recommended that you use ports (that is: external processes) to > exchange data with native libraries. > > However, the whole purpose of using smart cards is accessing sensitive > information stored into the card itself. To my limited knowledge, > opening a port (pipe) with an external process would allow sniffing. > Is that true? If not, what tools ?should I use (preferably working > both on Linux and Windows)? Sheesh what a thread. You can use a linked-in driver. Write the driver in C and load it as a .so or .dll into the erlang node that needs to access the smart card libs. The data doesn't leave the process space - but it must get there somehow. Of course root can watch usually any data in any process (SELinux might prevent that). From egarrulo@REDACTED Sat Aug 8 13:35:37 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Sat, 8 Aug 2009 13:35:37 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> Message-ID: <9bd8a08a0908080435o5de40455i9b502dac2b0d920d@mail.gmail.com> 2009/8/8 Richard Andrews : > You can use a linked-in driver. Write the driver in C and load it as a > .so or .dll into the erlang node that needs to access the smart card > libs. The data doesn't leave the process space - but it must get there > somehow. What if C calls are time consuming? Does whole Erlang VM stop until the C procedure returns? > > Of course root can watch usually any data in any process (SELinux > might prevent that). > And user? Can a user process watch another (same) user process? Thanks From illo@REDACTED Sat Aug 8 13:41:23 2009 From: illo@REDACTED (Illo de' Illis) Date: Sat, 8 Aug 2009 13:41:23 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> Message-ID: On 08/ago/2009, at 13.09, Richard Andrews wrote: > On Sat, Aug 8, 2009 at 12:22 AM, Elena Garrulo > wrote: >> Hello, >> >> I'd like to access smart cards from Erlang. Since there is not >> dedicated module, I'll have to use C for that. [...] >> > Sheesh what a thread. > > You can use a linked-in driver. Isn't it the very same "port driver" I suggested? That is: http://erlang.org/doc/tutorial/c_portdriver.html Or, if not, in what differs? Would it be possible to share buffer pointers with your approach without breaking up erlang's garbage collector? Ciao, Illo. From egarrulo@REDACTED Sat Aug 8 13:58:19 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Sat, 8 Aug 2009 13:58:19 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> Message-ID: <9bd8a08a0908080458p6cc98a0w5e016e736663551b@mail.gmail.com> 2009/8/8 Illo de' Illis : > Isn't it the very same "port driver" I suggested? That is: > > http://erlang.org/doc/tutorial/c_portdriver.html Thank you for the link. Indeed, it seems that a blocking C procedure will block the Erlang process: in the given example, "example_drv_output" is synchronous. Or are the call to the linked-in driver managed on a different OS thread? Thanks From steven.charles.davis@REDACTED Sat Aug 8 15:19:07 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 8 Aug 2009 06:19:07 -0700 (PDT) Subject: [ANN] "Reverse" help lookup a la railsapi.com In-Reply-To: <58F5EA17-2E93-4981-9D6F-703A1C940019@gmail.com> References: <58F5EA17-2E93-4981-9D6F-703A1C940019@gmail.com> Message-ID: <6b74ab37-eb8e-494b-9f45-0ac896153d6f@g6g2000vbr.googlegroups.com> This is excellent - - one minor point -- erlang modules comprise "functions" not "methods"! ;) /sd On Aug 8, 5:15?am, Dmitrii Dimandt wrote: > http://erlapi.prepor.ru/docs/ > > Have you ever worked through somebody else's code and wondered what ? > this or that function does? Thi is especially true when you're looking ? > at source code for a well-known project in search for tips on how to ? > solve certain problems. > > What does c:nc/2 do? What options does inet:setopts/2 accept? And so on. > > Andrew Rudenko [1] on the erlang-russian [2] mailing list decided to ? > solve this problem. > > Getting his inspiration from the Rails API site [3], he made an analog ? > for Erlang:http://erlapi.prepor.ru/docs/ > > You may think "yeah, right, just a pretty doc site" and you'll be ? > wrong. Just try searching for the aforementioned c:nc and inet:setopts ? > functions to get the idea of what this really is. > > - Generator (in Ruby) that was used to generate the docs is here:http://github.com/prepor/erlapi/tree > - You can download generated docs for local viewing here:http://github.com/prepor/erlapi-static/tree/master > > [1] Andrew Rudenko:http://prepor.ru/ > > [2] erlang-russian mailing list:http://groups.google.com/group/erlang-russian/ > > [3] Rails API site:http://railsapi.com/doc/rails-v2.3.3.1/ > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From bflatmaj7th@REDACTED Sat Aug 8 15:26:51 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Sat, 8 Aug 2009 23:26:51 +1000 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <9bd8a08a0908080435o5de40455i9b502dac2b0d920d@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> <9bd8a08a0908080435o5de40455i9b502dac2b0d920d@mail.gmail.com> Message-ID: <7702c0610908080626j22cf1845m86dc03f800133ca4@mail.gmail.com> On Sat, Aug 8, 2009 at 9:35 PM, Elena Garrulo wrote: > 2009/8/8 Richard Andrews : >> You can use a linked-in driver. Write the driver in C and load it as a >> .so or .dll into the erlang node that needs to access the smart card >> libs. The data doesn't leave the process space - but it must get there >> somehow. > > What if C calls are time consuming? Does whole Erlang VM stop until > the C procedure returns? IIRC the "control" style driver would block but the IO style driver model would not. I think this requires that there is another thread somewhere which can issue a callback into erlang with a result. I've never implemented one of these. >> Of course root can watch usually any data in any process (SELinux >> might prevent that). >> > > And user? Can a user process watch another (same) user process? I don't think this is possible. From egarrulo@REDACTED Sat Aug 8 16:07:07 2009 From: egarrulo@REDACTED (Elena Garrulo) Date: Sat, 8 Aug 2009 16:07:07 +0200 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <7702c0610908080626j22cf1845m86dc03f800133ca4@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> <9bd8a08a0908080435o5de40455i9b502dac2b0d920d@mail.gmail.com> <7702c0610908080626j22cf1845m86dc03f800133ca4@mail.gmail.com> Message-ID: <9bd8a08a0908080707vab582ay7b4aec725c5a3f51@mail.gmail.com> 2009/8/8 Richard Andrews : > On Sat, Aug 8, 2009 at 9:35 PM, Elena Garrulo wrote: >> What if C calls are time consuming? Does whole Erlang VM stop until >> the C procedure returns? > > IIRC the "control" style driver would block but the IO style driver > model would not. I think this requires that there is another thread > somewhere which can issue a callback into erlang with a result. I've > never implemented one of these. That's what I was thinking about: making a worker thread handle the requests asynchronously, sending back the results when done. From your answer, I understand that is feasible, it's just not sketched into simpler (synchronous) examples. >> And user? Can a user process watch another (same) user process? > > I don't think this is possible. > Well, that's what I did know about Windows, and wondered whether things were different under Linux. OK, here is my roadmap: first make the (simpler) ports solution work, then implementing it as linked-in driver. Thanks. From micha-1@REDACTED Sat Aug 8 16:18:11 2009 From: micha-1@REDACTED (Micha) Date: Sat, 8 Aug 2009 16:18:11 +0200 Subject: two gen_udp questions Message-ID: <200908081618.11540.micha-1@fantasymail.de> Hi, I have two question about udp handling: 1. can a gen_server also receive udp messages? When do I have to open the udp port for doing this (start_link, init)? 2. if my server receives an udp message and spawns a process to handle the request, is it better to let the spawned process sent the answer back over the udp socket or should the process sent the answer back to my udp handler which in turn sents it over the udp socket to it's destination. thanks for answering, Michael From dmitriid@REDACTED Sat Aug 8 16:33:51 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sat, 8 Aug 2009 17:33:51 +0300 Subject: [erlang-questions] Re: [ANN] "Reverse" help lookup a la railsapi.com In-Reply-To: <6b74ab37-eb8e-494b-9f45-0ac896153d6f@g6g2000vbr.googlegroups.com> References: <58F5EA17-2E93-4981-9D6F-703A1C940019@gmail.com> <6b74ab37-eb8e-494b-9f45-0ac896153d6f@g6g2000vbr.googlegroups.com> Message-ID: Good point :) I'll pass it on to the author On Aug 8, 2009, at 4:19 PM, Steve Davis wrote: > This is excellent - > > - one minor point -- erlang modules comprise "functions" not > "methods"! ;) > > /sd > > > On Aug 8, 5:15 am, Dmitrii Dimandt wrote: >> http://erlapi.prepor.ru/docs/ >> >> Have you ever worked through somebody else's code and wondered what >> this or that function does? Thi is especially true when you're >> looking >> at source code for a well-known project in search for tips on how to >> solve certain problems. >> >> What does c:nc/2 do? What options does inet:setopts/2 accept? And >> so on. >> >> Andrew Rudenko [1] on the erlang-russian [2] mailing list decided to >> solve this problem. >> >> Getting his inspiration from the Rails API site [3], he made an >> analog >> for Erlang:http://erlapi.prepor.ru/docs/ >> >> You may think "yeah, right, just a pretty doc site" and you'll be >> wrong. Just try searching for the aforementioned c:nc and >> inet:setopts >> functions to get the idea of what this really is. >> >> - Generator (in Ruby) that was used to generate the docs is here:http://github.com/prepor/erlapi/tree >> - You can download generated docs for local viewing here:http://github.com/prepor/erlapi-static/tree/master >> >> [1] Andrew Rudenko:http://prepor.ru/ >> >> [2] erlang-russian mailing list:http://groups.google.com/group/erlang-russian/ >> >> [3] Rails API site:http://railsapi.com/doc/rails-v2.3.3.1/ >> >> ________________________________________________________________ >> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html >> erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From carlmcdade@REDACTED Sat Aug 8 16:51:36 2009 From: carlmcdade@REDACTED (Carl McDade) Date: Sat, 8 Aug 2009 16:51:36 +0200 Subject: [Erlyaws-list] [erlang-questions] Re: YAWS with PHP on Windows XP problem In-Reply-To: <24d4f39c0908080744l38b5e556q8e3e69ec9e9be8bb@mail.gmail.com> References: <4A61E732.8060905@pcinside.pl> <24d4f39c0908070645k14fed86etb05997e74bc12cea@mail.gmail.com> <4A7C39C5.1050500@pcinside.pl> <24d4f39c0908070737j39098c24l34d45a4da846bc05@mail.gmail.com> <4A7C4262.50800@pcinside.pl> <24d4f39c0908080744l38b5e556q8e3e69ec9e9be8bb@mail.gmail.com> Message-ID: Thanks! people. I got it working and posted the info on my blog for reference. * Log out * Entries * Comments Erlang Erlang and PHP on Yaws webserver By Carl McDade ? August 8, 2009 ? Post a comment ? This is from the joint efforts on the Yaws mailing list. It simplifies getting PHP up and running on the Yaws webserver. You can now try out Erlang in transition from PHP or use them together. PHP : 1. download windows version 5.3.0 non-threaded version 2. unzip to C:\php530 3. create php info file under doc root E:\yaws\www\phpinfo,php 4. Just like IIS cgi redirection need to be set to off. ; cgi.force_redirect is necessary to provide security running PHP as a CGI under ; most web servers. Left undefined, PHP turns this on by default. You can ; turn it off here AT YOUR OWN RISK ; **You CAN safely turn this off for IIS, in fact, you MUST.** ; http://php.net/cgi.force-redirect cgi.force_redirect = 0 Yaws: 1. set conf doc root ( E:\yaws\www ) 2. set conf cgi ( php yaws cgi ) 3. set php binary path ( php_exe_path = "C:\php530\php-cgi.exe" ) 4. start Yaws in interactive ( yaws -i ) 5. Yaws conf in the root of the Yaws install needs to look similar to: php_exe_path = "C:\php530\php-cgi.exe" port = 8080 listen = 0.0.0.0 docroot = "E:/yaws/www" allowed_scripts = php yaws cgi appmods = /Carl On Sat, Aug 8, 2009 at 4:44 PM, Colm Dougan wrote: > 2009/8/8 Carl McDade : >> 2009/8/8 Carl McDade : >>> Okay, >>> >>> There is something I am not getting here. Can someone me do a step-by >>> step? ?I have >>> >>> PHP : >>> >>> 1. download windows version 5.3.0 non-threaded >>> 2. unzip to C:\php530 >>> 3 ?create php info ?file E:\yaws\www\phpinfo,php > > You also need to : > > * copy the php.ini-production from your c:\php530 directory to > c:\WINDOWS\php.ini > * now edit c:\windows\php.ini ?and find the line that looks like this : > > ;cgi.force_redirect = 1 > > Change it to : > > cgi.force_redirect = 0 > > i.e. remove the leading semi-colon and change the 1 to 0. > > Save the changes and try running your php from yaws again. > > Colm > -- Carl McDade Lead Developer FireOrb CMS - www.fireorb.info __________________________ Publisher and Editor Hiveminds Magazine -www.hiveminds.co.uk From kaiduanx@REDACTED Sat Aug 8 19:31:31 2009 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Sat, 8 Aug 2009 13:31:31 -0400 Subject: [erlang-questions] two gen_udp questions In-Reply-To: <200908081618.11540.micha-1@fantasymail.de> References: <200908081618.11540.micha-1@fantasymail.de> Message-ID: Micha, Yes, gen_server can receive udp message. 1. Open the socket in the init function of gen_server. init() -> ... gen_udp:open(). 2. The incoming message will be handled in handle_info(). handle_info({udp, Socket, IPtuple, InPortNo, Packet}, State) -> 3. Either way will work. Thanks, kaiduan On Sat, Aug 8, 2009 at 10:18 AM, Micha wrote: > Hi, > > I have two question about udp handling: > > 1. can a gen_server also receive udp messages? When do I have to open the udp > port for doing this (start_link, init)? > > 2. if my server receives an udp message and spawns a process to handle the > request, is it better to let the spawned process sent the answer back over the > udp socket or should the process sent the answer back to my udp handler which > in turn sents it over the udp socket to it's destination. > > thanks for answering, > ?Michael > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From mjtruog@REDACTED Sat Aug 8 20:17:22 2009 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 08 Aug 2009 11:17:22 -0700 Subject: [erlang-questions] How to exchange sensitive data with ports? In-Reply-To: <9bd8a08a0908080707vab582ay7b4aec725c5a3f51@mail.gmail.com> References: <9bd8a08a0908070722k626d622djb7231fb07b738994@mail.gmail.com> <7702c0610908080409m1a54b7f8r9e80ff5a7f27b3f9@mail.gmail.com> <9bd8a08a0908080435o5de40455i9b502dac2b0d920d@mail.gmail.com> <7702c0610908080626j22cf1845m86dc03f800133ca4@mail.gmail.com> <9bd8a08a0908080707vab582ay7b4aec725c5a3f51@mail.gmail.com> Message-ID: <4A7DC132.7090009@gmail.com> The port driver can be made to make async function calls however there are some problems with doing this: 1) the port driver can not be unloaded to do a code swap (after the first async port driver call), since it is safer to keep the code loaded in case there is still a thread busy on an async request 2) the async thread pool takes a single thread count for all async requests used by the erlang VM, so your async requests are competing with file, crypto, and anything else that might choose to use the async thread pool. the async thread pool is implemented without a shared job queue, so you are at the mercy of any jobs that got to the thread's queue before your jobs. However, by limiting your usage of the async thread pool and setting the integer async thread pool limit high enough, you should avoid any contention for threads. Last time I looked, there was an environment variable to limit the file module usage of async calls, but I am not sure about the crypto usage of async calls... crypto may not be doing async requests. I did some code to automatically generate a port driver or port with preprocessor expansion that might help. To make a call async you can change a 0 to a 1 in the header file that defines the function calls: http://forum.trapexit.org/viewtopic.php?t=15118&sid=4174d776f9abc2b65ed145333e24886e http://github.com/okeuday/generic-erlang-port--driver-/tree/master Elena Garrulo wrote: > 2009/8/8 Richard Andrews : > >> On Sat, Aug 8, 2009 at 9:35 PM, Elena Garrulo wrote: >> >>> What if C calls are time consuming? Does whole Erlang VM stop until >>> the C procedure returns? >>> >> IIRC the "control" style driver would block but the IO style driver >> model would not. I think this requires that there is another thread >> somewhere which can issue a callback into erlang with a result. I've >> never implemented one of these. >> > > That's what I was thinking about: making a worker thread handle the > requests asynchronously, sending back the results when done. From your > answer, I understand that is feasible, it's just not sketched into > simpler (synchronous) examples. > > >>> And user? Can a user process watch another (same) user process? >>> >> I don't think this is possible. >> >> > > Well, that's what I did know about Windows, and wondered whether > things were different under Linux. > > OK, here is my roadmap: first make the (simpler) ports solution work, > then implementing it as linked-in driver. > > Thanks. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From micha-1@REDACTED Sat Aug 8 20:21:00 2009 From: micha-1@REDACTED (Micha) Date: Sat, 8 Aug 2009 20:21:00 +0200 Subject: [erlang-questions] two gen_udp questions In-Reply-To: References: <200908081618.11540.micha-1@fantasymail.de> Message-ID: <200908082021.01426.micha-1@fantasymail.de> On Saturday, 8. August 2009 19:31:31 Kaiduan Xie wrote: > > 1. Open the socket in the init function of gen_server. o.k. > 2. The incoming message will be handled in handle_info(). > > handle_info({udp, Socket, IPtuple, InPortNo, Packet}, State) -> ah thanks, that info was good :-) > 3. Either way will work. o.k., can't there be a race condition, if multiple threads want to send data over the socket? thanks Michael From ceo@REDACTED Sat Aug 8 20:47:08 2009 From: ceo@REDACTED (Andrew Rudenko) Date: Sat, 8 Aug 2009 22:47:08 +0400 Subject: [ANN] "Reverse" help lookup a la railsapi.com Message-ID: <8E1C64B9-21CD-42E5-98A4-E046D5568E44@prepor.ru> Fixed :) > This is excellent - > > - one minor point -- erlang modules comprise "functions" not > "methods"! ;) > > /sd From dmitriid@REDACTED Sat Aug 8 21:32:43 2009 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sat, 8 Aug 2009 22:32:43 +0300 Subject: [erlang-questions] Re: [ANN] "Reverse" help lookup a la railsapi.com In-Reply-To: <8E1C64B9-21CD-42E5-98A4-E046D5568E44@prepor.ru> References: <8E1C64B9-21CD-42E5-98A4-E046D5568E44@prepor.ru> Message-ID: Question to the list and people of Erlang :) Do you think these docs could appear on Erlang's site alongside the regular docs? On Aug 8, 2009, at 9:47 PM, Andrew Rudenko wrote: > Fixed :) > >> This is excellent - >> >> - one minor point -- erlang modules comprise "functions" not >> "methods"! ;) >> >> /sd > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From wolfmanjm@REDACTED Sat Aug 8 21:59:18 2009 From: wolfmanjm@REDACTED (Jim Morris) Date: Sat, 8 Aug 2009 12:59:18 -0700 (PDT) Subject: two gen_udp questions In-Reply-To: <200908082021.01426.micha-1@fantasymail.de> References: <200908081618.11540.micha-1@fantasymail.de> <200908082021.01426.micha-1@fantasymail.de> Message-ID: <98864791-93dd-49ed-81cd-c4d921e87b77@i4g2000prm.googlegroups.com> > > o.k., can't there be a race condition, if multiple threads want to send data > over the socket? The UDP protocol does not guarantee packets are delivered in order, so this should not be a concern, as the only side effect of several processes sending data to the UDP socket would be them being out of order. However if you send all the UDP packets to a single process to send them back and there are a lot of clients and/or packets you could cause that process to get backed up, increasing the latency on the packets and having the process message queue grow. I have found it is better to have several processes send the reply back to the same UDP socket, thereby distributing that load. The downside is the processes have to be from the same VM so can't be distributed over several servers (as the socket can only be shared by the same VM). Also note that when you do reply to a UDP packet to a client that is behind a residential type NAT router/firewall the UDP packet generally needs to come back from the same IP address and port to get through the firewall/NAT device. Google STUN clients for more info. From steven.charles.davis@REDACTED Sun Aug 9 00:33:09 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 8 Aug 2009 15:33:09 -0700 (PDT) Subject: [ANN] "Reverse" help lookup a la railsapi.com In-Reply-To: References: <8E1C64B9-21CD-42E5-98A4-E046D5568E44@prepor.ru> Message-ID: A usability suggestion. I and I suspect the majority of people rarely/never use modules from CORBA or megaco. Would it be possible to fold those up (or link separately) to avoid excessive scrolling every time? regs, /sd On Aug 8, 2:32?pm, Dmitrii Dimandt wrote: > Question to the list and people of Erlang :) > > Do you think these docs could appear on Erlang's site alongside the ? > regular docs? > > On Aug 8, 2009, at 9:47 PM, Andrew Rudenko wrote: > > > Fixed :) > > >> This is excellent - > > >> - one minor point -- erlang modules comprise "functions" not > >> "methods"! ;) > > >> /sd > > > ________________________________________________________________ > > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From magnus.falk@REDACTED Sun Aug 9 03:04:33 2009 From: magnus.falk@REDACTED (Magnus Falk) Date: Sun, 9 Aug 2009 03:04:33 +0200 Subject: [erlang-questions] Re: [ANN] "Reverse" help lookup a la railsapi.com In-Reply-To: References: <8E1C64B9-21CD-42E5-98A4-E046D5568E44@prepor.ru> Message-ID: <41086e200908081804s4a58e75bh3dc2b7731a33a4c@mail.gmail.com> Honestly, the usability of the real erlang docs is abysmal. Javadoc beats it in every single aspect. This is very welcome. /Magnus On Sat, Aug 8, 2009 at 9:32 PM, Dmitrii Dimandt wrote: > Question to the list and people of Erlang :) > > Do you think these docs could appear on Erlang's site alongside the regular > docs? > > > > On Aug 8, 2009, at 9:47 PM, Andrew Rudenko wrote: > > Fixed :) >> >> This is excellent - >>> >>> - one minor point -- erlang modules comprise "functions" not >>> "methods"! ;) >>> >>> /sd >>> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From deepak.nulu@REDACTED Sun Aug 9 08:42:55 2009 From: deepak.nulu@REDACTED (Deepak Nulu) Date: Sat, 8 Aug 2009 23:42:55 -0700 Subject: Mnesia transactions, locks, and table events Message-ID: Hi, If a transaction updates 3 tables (using only record level locks and not table level locks), is it possible for another simultaneous transaction to update these same tables, especially if the two transactions never update the same table at the same time? Is it possible for another simultaneous transaction to update a 4th (different) table? If multiple records (in one or more tables) are updated in a transaction, table events are sent for each updated record. If there are multiple simultaneous transactions, can the table events for these transactions get mixed, or is it guaranteed that all events for a single transaction are sent before the events for another transaction are sent? Thanks. -deepak nulu From nik.epifanov@REDACTED Sun Aug 9 10:18:14 2009 From: nik.epifanov@REDACTED (Nikolay Epifanov) Date: Sun, 9 Aug 2009 12:18:14 +0400 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: <97619b170908071233g604b3db3xa91206ff2f48c425@mail.gmail.com> Message-ID: > Try using a finite number of processes say between 4 and 256 and see if > your > cpu-utilization increases. > I tried running run() -> spawn(fun() -> p(999, 999999) end), spawn(fun() -> p(999, 999999) end), spawn(fun() -> p(999, 999999) end), spawn(fun() -> p(999, 999999) end). but it's all happened same way. It's probably OpenBSD's fault. So when Erlang is being run on SMP system only _one_ beam.smp process is started? And its threads are put on different cores? OpenBSD process affinity is coming soon. http://undeadly.org/cgi?action=article&sid=20090324210236 But it is unknown when threads will go multicore. http://groups.google.com/group/comp.unix.bsd.openbsd.misc/browse_thread/thread/cbea9c8b273ac0d6 But threads able to run on different cores are necessary, right? From micha-1@REDACTED Sun Aug 9 11:17:22 2009 From: micha-1@REDACTED (Micha) Date: Sun, 9 Aug 2009 11:17:22 +0200 Subject: limiting gen_server Message-ID: <200908091117.23443.micha-1@fantasymail.de> Hi, I want to restrict the simultanous calls my gen_server handles, since it calls a network service itself and should not flood it :-) I do it that way: I keep a counter in the state and when the counter reaches the maximum I do the following: %% normal handling: handle_info({udp, Socket, IPtuple, InPortNo, Packet}, State) when State#state.cnt < ?LIMIT -> spawn(fun() -> ... end), ...; %% max reached: handle_info({udp, _Socket, _IPtuple, _InPortNo, _Packet} = Msg, State) -> erlang:send_after(random:uniform(20)+10, self(), Msg), {noreply, State}; is this o.k. ? cheers, Michael From ulf.wiger@REDACTED Sun Aug 9 15:56:00 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 09 Aug 2009 15:56:00 +0200 Subject: [erlang-questions] limiting gen_server In-Reply-To: <200908091117.23443.micha-1@fantasymail.de> References: <200908091117.23443.micha-1@fantasymail.de> Message-ID: <4A7ED570.1000407@erlang-consulting.com> These are not calls, though, at least not in the normal gen_server vernacular. It is not really clear from this snippet what you are trying to achieve, and what these messages mean. In general, it might be better to have a middle-man process that buffers messages. Another common form of buffering in gen_servers (at least one that I commonly use), when the messages to be buffered are real gen_server calls, is: handle_call(Req, {Pid,_} = From, S) when ?should_buffer(S) -> MRef = erlang:monitor(process, Pid), S1 = buffer_req(MRef, {From, Req}, S), {noreply, S1}; where the buffer_req() function could store {MRef, {From,Req}} in a list. The point of doing this is that if the caller dies, you have a handle_info that handles it: handle_info({'DOWN', Ref, _, _, _}, S) -> Buffered = [{R,Req} || {R, Req} <- S#st.buffered, R =/= Ref], {noreply, S#st{buffered = Buffered}}; How you choose to attend to buffered calls is perhaps a matter of taste. You could order a timer, or keep track of outstanding calls, along the lines you suggest. I realise this is not really an answer to your question, but thought I'd expand the answer a bit. I would go with a buffering middle-manager in your case, I think. BR, Ulf W Micha wrote: > Hi, > > I want to restrict the simultanous calls my gen_server handles, since it calls > a network service itself and should not flood it :-) > > I do it that way: > I keep a counter in the state and when the counter reaches the maximum I do > the following: > %% normal handling: > handle_info({udp, Socket, IPtuple, InPortNo, Packet}, State) > when State#state.cnt < ?LIMIT -> spawn(fun() -> ... end), ...; > > %% max reached: > handle_info({udp, _Socket, _IPtuple, _InPortNo, _Packet} = Msg, State) -> > erlang:send_after(random:uniform(20)+10, self(), Msg), > {noreply, State}; > > > > is this o.k. ? > > cheers, > Michael > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From micha-1@REDACTED Sun Aug 9 18:44:35 2009 From: micha-1@REDACTED (Micha) Date: Sun, 9 Aug 2009 18:44:35 +0200 Subject: [erlang-questions] limiting gen_server In-Reply-To: <4A7ED570.1000407@erlang-consulting.com> References: <200908091117.23443.micha-1@fantasymail.de> <4A7ED570.1000407@erlang-consulting.com> Message-ID: <200908091844.35605.micha-1@fantasymail.de> On Sunday, 9. August 2009 15:56:00 Ulf Wiger wrote: > These are not calls, though, at least not in the normal > gen_server vernacular. It is not really clear from this > snippet what you are trying to achieve, and what these > messages mean. my gen_server get requests via udp and resolves them by asking another web service. I would like to like it to some maximum of allowed simultanous request (maybe 20, which should not happen btw.) So I thought it would suffice to just wait some little time and send the request again (to myself), in case the maximum is reached. Buffering is another option, thank you for your code. cheers Michael From ulf.wiger@REDACTED Sun Aug 9 19:04:09 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 09 Aug 2009 19:04:09 +0200 Subject: [erlang-questions] limiting gen_server In-Reply-To: <200908091844.35605.micha-1@fantasymail.de> References: <200908091117.23443.micha-1@fantasymail.de> <4A7ED570.1000407@erlang-consulting.com> <200908091844.35605.micha-1@fantasymail.de> Message-ID: <4A7F0189.1010007@erlang-consulting.com> Micha wrote: > On Sunday, 9. August 2009 15:56:00 Ulf Wiger wrote: >> These are not calls, though, at least not in the normal >> gen_server vernacular. It is not really clear from this >> snippet what you are trying to achieve, and what these >> messages mean. > > my gen_server get requests via udp and resolves them by asking another web > service. I would like to like it to some maximum of allowed simultanous > request (maybe 20, which should not happen btw.) > > So I thought it would suffice to just wait some little time and send the request > again (to myself), in case the maximum is reached. The main drawback with that solution, I guess, is that the ordering of packets changes, but given that it's UDP, ordering is undefined anyway. :) This brings up another option - to simply let them drop, by fetching one message at a time from the socket at the pace that suits you. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From roberto@REDACTED Mon Aug 10 10:42:45 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 10 Aug 2009 10:42:45 +0200 Subject: erlang/python,ruby,.. interfaces on tcp Message-ID: <979D9774F91440009D70FD961F9B09D3@neon> dear all, an old question here: i'd like to interface erlang with python, ruby, and other languages as i go. i am aware of the existance of port drivers however: . you need to develop one for each erlang / other language couple; . a crash in the port driver brings the emulator down too. therefore, i'm thinking to use a binary protocol over tcp/ip. this allows: . to have only a single exit/entry point from erlang structured as a tcp server; . to avoid crashing the emulator if something goes wrong in the client. since communication between erlang nodes is done by tcp, i think this could be an interesting thing to try out. questions: 1. do you think that this is worth a try, or you'd better really be off with port drivers? i know there's one for ruby http://github.com/mojombo/erlectricity/tree/master for instance. 2. what kind of fast binary protocol would you recommend? thank you, r. From kostis@REDACTED Mon Aug 10 10:45:12 2009 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 10 Aug 2009 11:45:12 +0300 Subject: [erlang-questions] Type definition In-Reply-To: <4A772D34.2010407@dcc.fc.up.pt> References: <4A772D34.2010407@dcc.fc.up.pt> Message-ID: <4A7FDE18.2030501@cs.ntua.gr> Cl?udio Amaral wrote: > Can one define polymorphic type definitions? > > For example: > > poly_tree I::integer B::type > empty > | {branch, [B], poly_tree(I,B),poly_tree(I,B)} > > where [B] is a list with I elements Writing polymorphic type definitions is possible in the current Erlang version. For example, you can write the following: -type pol_t(I, B) :: 'empty' | {'not_empty', I, [B]}. What is currently not possible is to write _recursive_ type definitions. So it is currently not possible to have a type declaration like the one you need for what you want to do. Kostis From rtrlists@REDACTED Mon Aug 10 10:56:11 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 10 Aug 2009 09:56:11 +0100 Subject: [erlang-questions] erlang/python,ruby,.. interfaces on tcp In-Reply-To: <979D9774F91440009D70FD961F9B09D3@neon> References: <979D9774F91440009D70FD961F9B09D3@neon> Message-ID: <6a3ae47e0908100156n44567cefud79d500dbcc1f2c3@mail.gmail.com> On Mon, Aug 10, 2009 at 9:42 AM, Roberto Ostinelli wrote: > dear all, > > an old question here: i'd like to interface erlang with python, ruby, and > other languages as i go. i am aware of the existance of port drivers > however: > > . you need to develop one for each erlang / other language couple; > . a crash in the port driver brings the emulator down too. > > therefore, i'm thinking to use a binary protocol over tcp/ip. this allows: > > . to have only a single exit/entry point from erlang structured as a tcp > server; > . to avoid crashing the emulator if something goes wrong in the client. > > since communication between erlang nodes is done by tcp, i think this could > be an interesting thing to try out. > > questions: > > 1. do you think that this is worth a try, or you'd better really be off > with > port drivers? i know there's one for ruby > http://github.com/mojombo/erlectricity/tree/master for instance. > > 2. what kind of fast binary protocol would you recommend? > > thank you, > > r. > > Have you had a look into implementing the native Erlang messaging protocol? The Jinterface Java code should be a good guide for this. And the binary format of Erlang terms is explained in http://www.erlang.org/doc/apps/erts/erl_ext_dist.html (forms section 8 of http://www.erlang.org/doc/apps/erts/part_frame.html). You could implement you own protocol, but use the Erlang term format for the values. Robby From roberto@REDACTED Mon Aug 10 12:16:53 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 10 Aug 2009 12:16:53 +0200 Subject: [erlang-questions] erlang/python,ruby,.. interfaces on tcp In-Reply-To: <6a3ae47e0908100156n44567cefud79d500dbcc1f2c3@mail.gmail.com> References: <979D9774F91440009D70FD961F9B09D3@neon> <6a3ae47e0908100156n44567cefud79d500dbcc1f2c3@mail.gmail.com> Message-ID: On 10/ago/09, at 10:56, Robert Raschke wrote: > Have you had a look into implementing the native Erlang messaging > protocol? The Jinterface Java code should be a good guide for this. > > And the binary format of Erlang terms is explained in http://www.erlang.org/doc/apps/erts/erl_ext_dist.html > (forms section 8 of http://www.erlang.org/doc/apps/erts/part_frame.html) > . You could implement you own protocol, but use the Erlang term > format for the values. > > Robby i believe this would definitely simplify the interfacing from erlang since it would only need term_to_binary/1, but it would make it rather complex on the recipient language.. From roberto@REDACTED Mon Aug 10 12:17:37 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 10 Aug 2009 12:17:37 +0200 Subject: [erlang-questions] erlang/python,ruby,.. interfaces on tcp In-Reply-To: References: <979D9774F91440009D70FD961F9B09D3@neon> Message-ID: <9DBD2142-8526-43BA-B4D9-3E3E82D006FF@widetag.com> hi joseph, this seems interesting and did take a look at it. do you have any benchmarks on this compared to normal erlang sending between nodes? On 10/ago/09, at 10:59, Joseph Wayne Norton wrote: > > Please see here for one approach for interfacing non-erlang (and > erlang) clients with an erlang-based server. > > http://github.com/norton/ubf/tree/master > > In addition the original UBF-based transport, several other new > transports have been added. Documentation and adding more examples > is still in progress. > > thanks, From clist@REDACTED Mon Aug 10 12:22:22 2009 From: clist@REDACTED (Angel) Date: Mon, 10 Aug 2009 12:22:22 +0200 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: Message-ID: <200908101222.23037.clist@uah.es> El Domingo, 9 de Agosto de 2009 10:18:14 Nikolay Epifanov escribi?: > > Try using a finite number of processes say between 4 and 256 and see if > > your > > cpu-utilization increases. > > > I tried running > > run() -> > spawn(fun() -> p(999, 999999) end), > spawn(fun() -> p(999, 999999) end), > spawn(fun() -> p(999, 999999) end), > spawn(fun() -> p(999, 999999) end). > > but it's all happened same way. It's probably OpenBSD's fault. > > > > So when Erlang is being run on SMP system only _one_ beam.smp process is > started? And its threads are put on different cores? > > OpenBSD process affinity is coming soon. > http://undeadly.org/cgi?action=article&sid=20090324210236 > > But it is unknown when threads will go multicore. > http://groups.google.com/group/comp.unix.bsd.openbsd.misc/browse_thread/thread/cbea9c8b273ac0d6 > > But threads able to run on different cores are necessary, right? > By reading above you can see OpenBSD seems to lack kernel mode threads where Linux provides Linuxthreads SMP Erlang seems to take advantage from N:M where N processes are scheduled on M kernel threads that can be bound to every core on the system so you can fully spread erlang schedulers across all processors. So until then you can fully exploit multiples core by running several erlang nodes on the same machine using "pool" and the like to spread computation to all cores thus achieving a N:M model where M are erlang nodes instead of erlang schedulers. -- Este correo no tiene dibujos. Las formas extra?as en la pantalla son letras. __________________________________________ Clist UAH a.k.a Angel __________________________________________ T? lo compras, yo lo copio. Todo legal. From roberto@REDACTED Mon Aug 10 14:22:12 2009 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 10 Aug 2009 14:22:12 +0200 Subject: erlang/python,ruby,.. interfaces on tcp In-Reply-To: <979D9774F91440009D70FD961F9B09D3@neon> References: <979D9774F91440009D70FD961F9B09D3@neon> Message-ID: <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> i'm currently using this approach: http://code.activestate.com/recipes/534162 and using json as string passed through. does anyone have something to say re this? i'm really eager to see what best can be achieved. thank you, r. From dave.pawson@REDACTED Mon Aug 10 14:27:10 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 10 Aug 2009 13:27:10 +0100 Subject: R13B01 modules, quick reference Message-ID: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> http://www.dpawson.co.uk/erlang/qr.txt I did it for my own reference. I use this, then open an appropriate http://erlang.org/doc/man_index.html page for details. Feedback appreciated. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From thatsnotright@REDACTED Mon Aug 10 14:49:54 2009 From: thatsnotright@REDACTED (Rob Elsner) Date: Mon, 10 Aug 2009 06:49:54 -0600 Subject: [erlang-questions] Re: erlang/python,ruby,.. interfaces on tcp In-Reply-To: <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> References: <979D9774F91440009D70FD961F9B09D3@neon> <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> Message-ID: Depending on your performance requirements, you might consider RabbitMQ. We've had excellent luck using it between erlang, java and C#. The http2 gateway is nice, as well, for javascript. We encode our messages using Google's protocol buffers. Of course this will induce latency in communication, but we've managed to push RabbitMQ pretty hard and have never been let down. Rob From deepak.nulu@REDACTED Mon Aug 10 18:59:18 2009 From: deepak.nulu@REDACTED (Deepak Nulu) Date: Mon, 10 Aug 2009 09:59:18 -0700 Subject: [erlang-questions] R13B01 modules, quick reference In-Reply-To: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> Message-ID: <1FE0BBCC-7186-4F8C-A622-99E402E09F63@gmail.com> Hi Dave, Thanks for this. I have wanted something like this so I can do a text search when I know only a part of the function name (usually a guess to see if something I want is already implemented). To make it easier to use, you might want to consider making this reference an HTML page with hyperlinks to the man pages. Thanks. -deepak On Aug 10, 2009, at 5:27 AM, Dave Pawson wrote: > http://www.dpawson.co.uk/erlang/qr.txt > > I did it for my own reference. > I use this, then open an appropriate > http://erlang.org/doc/man_index.html page > for details. > > Feedback appreciated. > > regards > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From dave.pawson@REDACTED Mon Aug 10 19:11:22 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 10 Aug 2009 18:11:22 +0100 Subject: [erlang-questions] R13B01 modules, quick reference In-Reply-To: <1FE0BBCC-7186-4F8C-A622-99E402E09F63@gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <1FE0BBCC-7186-4F8C-A622-99E402E09F63@gmail.com> Message-ID: <711a73df0908101011l50774a26gfe3c674f40d2f1ed@mail.gmail.com> 2009/8/10 Deepak Nulu : > Hi Dave, > > Thanks for this. I have wanted something like this so I can do a text search > when I know only a part of the function name (usually a guess to see if > something I want is already implemented). > > To make it easier to use, you might want to consider making this reference > an HTML page with hyperlinks to the man pages. For each module? Or just one to the index? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From garry@REDACTED Mon Aug 10 19:54:05 2009 From: garry@REDACTED (Garry Hodgson) Date: Mon, 10 Aug 2009 13:54:05 -0400 Subject: ssh module performance Message-ID: <4A805EBD.3090407@research.att.com> (i'm re-sending this, since it seems i wasn't subscribed the first time. sorry for any duplication). i am in the process of rewriting an old app in terms of current erlang/otp. as part of that, i hope to take advantage of the ssh module to provide secure remote access from python. part of the motivation for this is to reduce complexity vs. the current interface, and to hopefully achieve some performance gains by eliminating the overhead of xmlrpc processing. i have the basics working now, but have been surprised to find that the new system is considerably slower, by a factor of 3 or so, than the old one. the guts of the two remain the same for the most part; just the interface has changed. to clarify things, i hacked up the code a bit so the new one does nothing but echo the text sent to it, while the old one does all of its normal processing (mysql queries, aggregation, encodeing/decoding, etc). this minimal new one is still 3 times slower. the old interface began as a hand-rolled xmlrpc interface, built using xmerl (0.17) and joe armstrong's pico server framework. later, when it was necessary to secure it, someone modified the remote python client lib to use ssh to launch a local python server, which used the xmlrpc interface to talk to the erlang server and send back the results. i want to eliminate this excess code, as well as the overhead of xml encoding/decoding. the new code uses the erlang ssh module, somewhat like this (edited): init() -> Opts = [ { shell, fun( U, H ) -> start_repl( U, H ) end } ], { ok, DaemonRef } = ssh:daemon( any, Port, Opts ). ... start_repl( User, Peer ) -> spawn( fun() -> read_eval_print_loop() end ). % simple Read-Eval-Print loop read_eval_print_loop() -> Line = io:get_line( { format, "", [] } ), io:format( "~s~n!~n", [ Line ] ), read_eval_print_loop(). so the question is, is the performance i'm seeing to be expected? are there known issues around the ssh module performance? am i doing something dumb? are there better ways to use this (or related) modules, or other approaches altogether? it occurs to me the problem could be with my use of io:get_line() and io:format(). is the io module the problem? the messages i'm sending are small, perhaps 50 chars. are there better ways of doing that? any insight would be appreciated. i really like the approach of being able to talk to our servers this way. thanks From tomas.abrahamsson@REDACTED Mon Aug 10 20:31:09 2009 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Mon, 10 Aug 2009 20:31:09 +0200 Subject: [erlang-questions] Re: erlang/python,ruby,.. interfaces on tcp In-Reply-To: <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> References: <979D9774F91440009D70FD961F9B09D3@neon> <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> Message-ID: > i'm currently using this approach: > > http://code.activestate.com/recipes/534162 > > and using json as string passed through. > > does anyone have something to say re this? i'm really eager to see what best > can be achieved. For Python, you might want to take a look at http://www.lysator.liu.se/~tab/erlang/py_interface/ It is a JInterface-like thing, but for Python. BRs Tomas From prikrutil@REDACTED Mon Aug 10 21:26:42 2009 From: prikrutil@REDACTED (Sergey Samokhin) Date: Mon, 10 Aug 2009 12:26:42 -0700 Subject: Are pseudo functions fully equivalent to match specs? Message-ID: Hello! Are there features match specifications provide that can't be expressed using pseudo functions like dbg:fun2ms/1? -- Sergey Samokhin From deepak.nulu@REDACTED Mon Aug 10 23:40:56 2009 From: deepak.nulu@REDACTED (Deepak Nulu) Date: Mon, 10 Aug 2009 14:40:56 -0700 Subject: [erlang-questions] R13B01 modules, quick reference In-Reply-To: <711a73df0908101011l50774a26gfe3c674f40d2f1ed@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <1FE0BBCC-7186-4F8C-A622-99E402E09F63@gmail.com> <711a73df0908101011l50774a26gfe3c674f40d2f1ed@mail.gmail.com> Message-ID: <39B4960B-BA2B-4AEE-AA66-D5408BB6CE7B@gmail.com> Hi Dave, A link for each module that jumps to the man page for that module is what will make this easier. I noticed that you mention the module name at the top of each block as well as one each line that lists a function. The hyperlink would ideally be on each line that lists the function (since it requires less navigation once a desired function is found). And given that the man pages are auto-generated, I am guessing they use a particular naming convention for the anchors. If so you might also be able to make each function in your index a hyperlink that jumps to its description in its module's man page. This would be a great bonus! Thanks. -deepak p.s. there are 71 entries that are prefixed with erlang:erlang: (the module name appears twice). On Aug 10, 2009, at 10:11 AM, Dave Pawson wrote: > 2009/8/10 Deepak Nulu : >> Hi Dave, >> >> Thanks for this. I have wanted something like this so I can do a >> text search >> when I know only a part of the function name (usually a guess to >> see if >> something I want is already implemented). >> >> To make it easier to use, you might want to consider making this >> reference >> an HTML page with hyperlinks to the man pages. > > For each module? Or just one to the index? > > regards > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk From ok@REDACTED Tue Aug 11 01:32:32 2009 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 11 Aug 2009 11:32:32 +1200 Subject: [erlang-questions] erlang/python,ruby,.. interfaces on tcp In-Reply-To: <979D9774F91440009D70FD961F9B09D3@neon> References: <979D9774F91440009D70FD961F9B09D3@neon> Message-ID: <58487CC7-F0C7-4725-AE49-9037556D5C3A@cs.otago.ac.nz> On Aug 10, 2009, at 8:42 PM, Roberto Ostinelli wrote: > 2. what kind of fast binary protocol would you recommend? The Erlang term->binary representation is documented. I believe it was recently changed. Where's the new spec? You could always try Joe Armstrong's UBF. From amit.murthy@REDACTED Tue Aug 11 07:30:20 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Tue, 11 Aug 2009 11:00:20 +0530 Subject: odd now() behaviour Message-ID: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> Hi, I am seeing an odd behavior with now() on my laptop running ubuntu 8.04 with R13A. I had a running erlang shell when I closed the laptop, and the machine went into suspend mode. The next day when the laptop came out of suspend mode, on the erlang shell, calendar:local_time(). returned the correct date/time while calendar:now_to_local_time(now()). printed out the time which was behind by the same amount of time as the laptop was suspended. Is this a bug or the expected behaviour of now()? Regards, Amit From kiszl@REDACTED Tue Aug 11 07:39:41 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 11 Aug 2009 07:39:41 +0200 (CEST) Subject: [erlang-questions] odd now() behaviour In-Reply-To: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> References: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> Message-ID: <40643.194.88.55.211.1249969181.squirrel@localhost> Hi, Check the +c emulator flag and its description: http://erlang.org/doc/man/erl.html#emu_flags Regards, Zoltan. > Hi, > > I am seeing an odd behavior with now() on my laptop running ubuntu 8.04 > with > R13A. > > I had a running erlang shell when I closed the laptop, and the machine > went > into suspend mode. The next day when the laptop came out of suspend mode, > on > the > erlang shell, > > calendar:local_time(). returned the correct date/time while > > calendar:now_to_local_time(now()). printed out the time which was > behind > by the same amount of time as the laptop was suspended. > > Is this a bug or the expected behaviour of now()? > > Regards, > Amit > From kenneth.lundin@REDACTED Tue Aug 11 07:52:19 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 11 Aug 2009 07:52:19 +0200 Subject: [erlang-questions] odd now() behaviour In-Reply-To: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> References: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> Message-ID: Yes this is expected behavior. See the +c option to the erl command for an explanation on how erlang:now works. http://www.erlang.org/doc/man/erl.html /Kenneth Erlang/OTP Ericsson On Tue, Aug 11, 2009 at 7:30 AM, Amit Murthy wrote: > Hi, > > I am seeing an odd behavior with now() on my laptop running ubuntu 8.04 with > R13A. > > I had a running erlang shell when I closed the laptop, and the machine went > into suspend mode. The next day when the laptop came out of suspend mode, on > the > erlang shell, > > calendar:local_time(). ? ? returned the correct date/time while > > calendar:now_to_local_time(now()). ? ?printed out the time which was behind > by the same amount of time as the laptop was suspended. > > Is this a bug or the expected behaviour of now()? > > Regards, > ?Amit > From amit.murthy@REDACTED Tue Aug 11 07:55:01 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Tue, 11 Aug 2009 11:25:01 +0530 Subject: [erlang-questions] odd now() behaviour In-Reply-To: <40643.194.88.55.211.1249969181.squirrel@localhost> References: <4f5fdb630908102230r36688f64j6064ee4f68fbde2f@mail.gmail.com> <40643.194.88.55.211.1249969181.squirrel@localhost> Message-ID: <4f5fdb630908102255l187d0c58r89f849a8eef9ea63@mail.gmail.com> Thanks. 2009/8/11 Zoltan Lajos Kis > Hi, > > Check the +c emulator flag and its description: > http://erlang.org/doc/man/erl.html#emu_flags > > Regards, > Zoltan. > > > Hi, > > > > I am seeing an odd behavior with now() on my laptop running ubuntu 8.04 > > with > > R13A. > > > > I had a running erlang shell when I closed the laptop, and the machine > > went > > into suspend mode. The next day when the laptop came out of suspend mode, > > on > > the > > erlang shell, > > > > calendar:local_time(). returned the correct date/time while > > > > calendar:now_to_local_time(now()). printed out the time which was > > behind > > by the same amount of time as the laptop was suspended. > > > > Is this a bug or the expected behaviour of now()? > > > > Regards, > > Amit > > > > > From bflatmaj7th@REDACTED Tue Aug 11 08:18:25 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Tue, 11 Aug 2009 16:18:25 +1000 Subject: ssl_esock spinning out of control in poll() In-Reply-To: <7702c0610908041838r1885b25akf7476b364b2c6801@mail.gmail.com> References: <7702c0610908041838r1885b25akf7476b364b2c6801@mail.gmail.com> Message-ID: <7702c0610908102318o54de56cdjaf57d574152cc1da@mail.gmail.com> On Wed, Aug 5, 2009 at 11:38 AM, Richard Andrews wrote: > I have a problem with ssl_esock in R12B4 (Linux 32 bit). Symptoms: > ?1. esock consumes 100% CPU usage > ?2. poll() spinning constantly with events=POLLIN|POLLRDNORM, > revents=POLLIN|POLLRDNORM for the affected SSL fd > ?3. No other syscalls between polls in strace > ?4. netstat shows the TCP Rx queue growing for the socket > ?5. No data messages received at the socket owning erlang process > (corollary of 3.) > > I don't yet have a test case to trigger it but it seems to occur after > the remote SSL peer sends a moderate sized block of data (eg. 2kB). > > Google didn't turn up anything that looked like what I'm seeing and I > can't find anything in mor recent OTP changelogs. Does anyone know of > this bug and if there is a patch anywhere? I have analysed this bug. There is a fault in the interaction between esock_openssl.c and esock.c. The problem is triggered by bad SSL data over the TCP socket. The trigger is the remote peer behaving badly but the local program suffers catastrophic failure which is not acceptable. The openssl library correctly reports SSL_ERROR_SSL, but there is no way to propagate this back up to the main loop. A return value < 0 is taken to be a blocking artefact and is ignored under the assumption that it will be rectified by a future read. In this case there is a fatal SSL error which is unrecoverable. Calls to SSL_read() return -1 without reading from the fd. The calling code ignores this and goes around the loop again calling poll() which returns immediately because there is still unread data in the TCP Rx queue, etc. I think what needs to happen is that cp->eof or cp->bp needs to be set in response to SSL_ERROR_SSL so that the socket can be cleaned up gracefully. The code comments don't provide enough guidance about which I should set for this case. I'm hoping that someone familiar with the code can help me develop a patch which works the "right" way. Otherwise I'll just wing it. -- Rich From mazen.harake@REDACTED Tue Aug 11 08:31:11 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 09:31:11 +0300 Subject: Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> Message-ID: <4A81102F.9050703@erlang-consulting.com> This brings up a subject I've been meaning to bring up for a while. The online documentation needs modernisation... A few things that come to mind are: * Proper documentation search (please don't insult this by saying Google... that's just stupid) * Function overview in each module * Module summary on the modules page (and categorized) much like http://docs.python.org/3.1/library/index.html * Add anchors to the HTML so that a link can go straight to a function * Make HTML XHTML * More visually appealing. Probably this won't go very well with old-timers but frankly I have spoken to beginners in Erlang that say that when looking at the documentation it looks like something created 20 years ago and it doesn't look very... well... "appealing". The fact they are right about the age is not the point now is it ;) ? Probably many more issues exist.... just saying. /Mazen Dave Pawson wrote: > http://www.dpawson.co.uk/erlang/qr.txt > > I did it for my own reference. > I use this, then open an appropriate > http://erlang.org/doc/man_index.html page > for details. > > Feedback appreciated. > > regards > > From kiszl@REDACTED Tue Aug 11 08:44:09 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 11 Aug 2009 08:44:09 +0200 (CEST) Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A81102F.9050703@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> Message-ID: <24130.194.88.55.211.1249973049.squirrel@localhost> You can give the search engine at gotapi a try (http://www.gotapi.com/erlang). It needs some fixes, but probably will do what you want. Anchors already exist in the documentation, in the non-xhtml style () . Regards, Zoltan. > This brings up a subject I've been meaning to bring up for a while. The > online documentation needs modernisation... A few things that come to > mind are: > > * Proper documentation search (please don't insult this by saying > Google... that's just stupid) > * Function overview in each module > * Module summary on the modules page (and categorized) much like > http://docs.python.org/3.1/library/index.html > * Add anchors to the HTML so that a link can go straight to a function > * Make HTML XHTML > * More visually appealing. Probably this won't go very well with > old-timers but frankly I have spoken to beginners in Erlang that say > that when looking at the documentation it looks like something created > 20 years ago and it doesn't look very... well... "appealing". The fact > they are right about the age is not the point now is it ;) ? > > Probably many more issues exist.... just saying. > > /Mazen > > > Dave Pawson wrote: >> http://www.dpawson.co.uk/erlang/qr.txt >> >> I did it for my own reference. >> I use this, then open an appropriate >> http://erlang.org/doc/man_index.html page >> for details. >> >> Feedback appreciated. >> >> regards >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From dave.pawson@REDACTED Tue Aug 11 08:52:30 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 07:52:30 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A81102F.9050703@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> Message-ID: <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> 2009/8/11 Mazen Harake : > This brings up a subject I've been meaning to bring up for a while. The > online documentation needs modernisation... A few things that come to mind > are: > > * Proper documentation search (please don't insult this by saying Google... > that's just stupid) Define 'proper'? Some sort of hierarchy? root/module/function? > * Function overview in each module Is http://erlang.org/doc/man/lists.html the 'description' section sufficient or would you like to write more than that? Is that what you mean by an overview? > * Module summary on the modules page (and categorized) much like > http://docs.python.org/3.1/library/index.html This might match my definition of the 'description' above. > * Add anchors to the HTML so that a link can go straight to a function -1 on the grounds of size? Suggest go from module list to the module itself, then have a toc in the module listing and linked to the function itself? > * Make HTML XHTML :-) Mmm. Less keen here. ns declaration buggers up some browsers. Valid HTML I will agree with though. > * More visually appealing. Probably this won't go very well with old-timers > but frankly I have spoken to beginners in Erlang that say that when looking > at the documentation it looks like something created 20 years ago and it > doesn't look very... well... "appealing". The fact they are right about the > age is not the point now is it ;) ? Only if you can define 'appealing'. CSS decoration? > > Probably many more issues exist.... just saying. I now have a 'process' whereby I have full access in one stylesheet to all the module XML. (One file is broken, I've reported this to Joe). So none of the above is difficult. Once we have a clear definition of what's wanted. HTH -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From vengeance.storm@REDACTED Tue Aug 11 08:56:35 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Tue, 11 Aug 2009 14:56:35 +0800 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> Message-ID: <841721380908102356q40351a71r171f9fff2eeeaec2@mail.gmail.com> As a beginner in Erlang, I have to say that the strangest thing in Erlang doc is that there is no index! I can't even look up a function by name! Pan, Xingzhi 2009/8/11 Dave Pawson > 2009/8/11 Mazen Harake : > > This brings up a subject I've been meaning to bring up for a while. The > > online documentation needs modernisation... A few things that come to > mind > > are: > > > > * Proper documentation search (please don't insult this by saying > Google... > > that's just stupid) > > Define 'proper'? > Some sort of hierarchy? > root/module/function? > > > > * Function overview in each module > > > Is http://erlang.org/doc/man/lists.html the 'description' section > sufficient > or would you like to write more than that? Is that what you mean by > an overview? > > > > * Module summary on the modules page (and categorized) much like > > http://docs.python.org/3.1/library/index.html > > This might match my definition of the 'description' above. > > > * Add anchors to the HTML so that a link can go straight to a function > > -1 on the grounds of size? Suggest go from module list to > the module itself, then have a toc in the module listing and linked > to the function itself? > > > > * Make HTML XHTML > > :-) Mmm. Less keen here. ns declaration buggers up some browsers. > Valid HTML I will agree with though. > > > > * More visually appealing. Probably this won't go very well with > old-timers > > but frankly I have spoken to beginners in Erlang that say that when > looking > > at the documentation it looks like something created 20 years ago and it > > doesn't look very... well... "appealing". The fact they are right about > the > > age is not the point now is it ;) ? > > Only if you can define 'appealing'. CSS decoration? > > > > > > Probably many more issues exist.... just saying. > > I now have a 'process' whereby I have full access in one stylesheet to > all the module XML. (One file is broken, I've reported this to Joe). > > So none of the above is difficult. > Once we have a clear definition of what's wanted. > > > HTH > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From mazen.harake@REDACTED Tue Aug 11 09:06:49 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 10:06:49 +0300 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> Message-ID: <4A811889.4040705@erlang-consulting.com> Comments inline: /Mazen Dave Pawson wrote: > 2009/8/11 Mazen Harake : > >> This brings up a subject I've been meaning to bring up for a while. The >> online documentation needs modernisation... A few things that come to mind >> are: >> >> * Proper documentation search (please don't insult this by saying Google... >> that's just stupid) >> > > Define 'proper'? > Some sort of hierarchy? > root/module/function? > hierarchy would help in my manual search sure. I was thinking in lines of; I want to get a function that does this or that so I search the module/function names and descriptions and get results directly related to the documentation, not erlang-mailing list stuff etc. To get an idea of what I want go to http://docs.python.org/3.1/search.html and enter "read" (wo quotes) and then press search. > > >> * Function overview in each module >> > > > Is http://erlang.org/doc/man/lists.html the 'description' section sufficient > or would you like to write more than that? Is that what you mean by > an overview? > I want in that part of the page a list of functions (much like edoc) which says "foo/1 | blablabla" if this can't be done then skip the "blablabla" part, but just please give me an overview of the functions in the module... :) > > >> * Module summary on the modules page (and categorized) much like >> http://docs.python.org/3.1/library/index.html >> > > This might match my definition of the 'description' above. > No, I meant more like: "1 File system modules > 1.1 filelib 1.2 filename 1.3 file" etc. so that If I am looking (manually) for a function that has to do with say tracing then I know in which category I can look in. I don't know to what extent this makes sense but it feels like it would shorten the time to search for a specific function. One huge list of modules that really don't say anything (except for hint in name) until you click on the page is very annoying in the sense that my browser's back button is getting worn out :D > >> * Add anchors to the HTML so that a link can go straight to a function >> > > -1 on the grounds of size? Suggest go from module list to > the module itself, then have a toc in the module listing and linked > to the function itself? > > well... I just want anchors inside the HTML document itself so that me personally (or anyone else) linking to it can link straight to the function in question. > >> * Make HTML XHTML >> > > :-) Mmm. Less keen here. ns declaration buggers up some browsers. > Valid HTML I will agree with though. > Well... XHTML is just properly formed HTML... afaik... more or less anyway. > > >> * More visually appealing. Probably this won't go very well with old-timers >> but frankly I have spoken to beginners in Erlang that say that when looking >> at the documentation it looks like something created 20 years ago and it >> doesn't look very... well... "appealing". The fact they are right about the >> age is not the point now is it ;) ? >> > > Only if you can define 'appealing'. CSS decoration? > > Yes. No need for images etc, but perhaps a theme... The good'ol "scratch" is ugly. > >> Probably many more issues exist.... just saying. >> > > I now have a 'process' whereby I have full access in one stylesheet to > all the module XML. (One file is broken, I've reported this to Joe). > > So none of the above is difficult. > Once we have a clear definition of what's wanted. > > > HTH > > From mazen.harake@REDACTED Tue Aug 11 09:07:45 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 10:07:45 +0300 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <24130.194.88.55.211.1249973049.squirrel@localhost> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <24130.194.88.55.211.1249973049.squirrel@localhost> Message-ID: <4A8118C1.8030707@erlang-consulting.com> What page are you looking at? /Mazen Zoltan Lajos Kis wrote: > You can give the search engine at gotapi a try > (http://www.gotapi.com/erlang). It needs some fixes, but probably will do > what you want. > > Anchors already exist in the documentation, in the non-xhtml style ( name="anchor" />) . > > Regards, > Zoltan. > > >> This brings up a subject I've been meaning to bring up for a while. The >> online documentation needs modernisation... A few things that come to >> mind are: >> >> * Proper documentation search (please don't insult this by saying >> Google... that's just stupid) >> * Function overview in each module >> * Module summary on the modules page (and categorized) much like >> http://docs.python.org/3.1/library/index.html >> * Add anchors to the HTML so that a link can go straight to a function >> * Make HTML XHTML >> * More visually appealing. Probably this won't go very well with >> old-timers but frankly I have spoken to beginners in Erlang that say >> that when looking at the documentation it looks like something created >> 20 years ago and it doesn't look very... well... "appealing". The fact >> they are right about the age is not the point now is it ;) ? >> >> Probably many more issues exist.... just saying. >> >> /Mazen >> >> >> Dave Pawson wrote: >> >>> http://www.dpawson.co.uk/erlang/qr.txt >>> >>> I did it for my own reference. >>> I use this, then open an appropriate >>> http://erlang.org/doc/man_index.html page >>> for details. >>> >>> Feedback appreciated. >>> >>> regards >>> >>> >>> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > From kiszl@REDACTED Tue Aug 11 09:15:46 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 11 Aug 2009 09:15:46 +0200 (CEST) Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A8118C1.8030707@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <24130.194.88.55.211.1249973049.squirrel@localhost> <4A8118C1.8030707@erlang-consulting.com> Message-ID: <44762.194.88.55.211.1249974946.squirrel@localhost> The one the link leads to. There is a search box on the top left. Zoltan. > What page are you looking at? > > /Mazen > > Zoltan Lajos Kis wrote: >> You can give the search engine at gotapi a try >> (http://www.gotapi.com/erlang). It needs some fixes, but probably will >> do >> what you want. >> >> Anchors already exist in the documentation, in the non-xhtml style (> name="anchor" />) . >> >> Regards, >> Zoltan. >> >> >>> This brings up a subject I've been meaning to bring up for a while. The >>> online documentation needs modernisation... A few things that come to >>> mind are: >>> >>> * Proper documentation search (please don't insult this by saying >>> Google... that's just stupid) >>> * Function overview in each module >>> * Module summary on the modules page (and categorized) much like >>> http://docs.python.org/3.1/library/index.html >>> * Add anchors to the HTML so that a link can go straight to a function >>> * Make HTML XHTML >>> * More visually appealing. Probably this won't go very well with >>> old-timers but frankly I have spoken to beginners in Erlang that say >>> that when looking at the documentation it looks like something created >>> 20 years ago and it doesn't look very... well... "appealing". The fact >>> they are right about the age is not the point now is it ;) ? >>> >>> Probably many more issues exist.... just saying. >>> >>> /Mazen >>> >>> >>> Dave Pawson wrote: >>> >>>> http://www.dpawson.co.uk/erlang/qr.txt >>>> >>>> I did it for my own reference. >>>> I use this, then open an appropriate >>>> http://erlang.org/doc/man_index.html page >>>> for details. >>>> >>>> Feedback appreciated. >>>> >>>> regards >>>> >>>> >>>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From mazen.harake@REDACTED Tue Aug 11 09:17:22 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 10:17:22 +0300 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <44762.194.88.55.211.1249974946.squirrel@localhost> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <24130.194.88.55.211.1249973049.squirrel@localhost> <4A8118C1.8030707@erlang-consulting.com> <44762.194.88.55.211.1249974946.squirrel@localhost> Message-ID: <4A811B02.6080009@erlang-consulting.com> But there is no anchor to each function on a module page; which is what I want. /Mazen Zoltan Lajos Kis wrote: > The one the link leads to. There is a search box on the top left. > > Zoltan. > > >> What page are you looking at? >> >> /Mazen >> >> Zoltan Lajos Kis wrote: >> >>> You can give the search engine at gotapi a try >>> (http://www.gotapi.com/erlang). It needs some fixes, but probably will >>> do >>> what you want. >>> >>> Anchors already exist in the documentation, in the non-xhtml style (>> name="anchor" />) . >>> >>> Regards, >>> Zoltan. >>> >>> >>> >>>> This brings up a subject I've been meaning to bring up for a while. The >>>> online documentation needs modernisation... A few things that come to >>>> mind are: >>>> >>>> * Proper documentation search (please don't insult this by saying >>>> Google... that's just stupid) >>>> * Function overview in each module >>>> * Module summary on the modules page (and categorized) much like >>>> http://docs.python.org/3.1/library/index.html >>>> * Add anchors to the HTML so that a link can go straight to a function >>>> * Make HTML XHTML >>>> * More visually appealing. Probably this won't go very well with >>>> old-timers but frankly I have spoken to beginners in Erlang that say >>>> that when looking at the documentation it looks like something created >>>> 20 years ago and it doesn't look very... well... "appealing". The fact >>>> they are right about the age is not the point now is it ;) ? >>>> >>>> Probably many more issues exist.... just saying. >>>> >>>> /Mazen >>>> >>>> >>>> Dave Pawson wrote: >>>> >>>> >>>>> http://www.dpawson.co.uk/erlang/qr.txt >>>>> >>>>> I did it for my own reference. >>>>> I use this, then open an appropriate >>>>> http://erlang.org/doc/man_index.html page >>>>> for details. >>>>> >>>>> Feedback appreciated. >>>>> >>>>> regards >>>>> >>>>> >>>>> >>>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>>> >>>> >>> >>> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > From kiszl@REDACTED Tue Aug 11 09:27:25 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 11 Aug 2009 09:27:25 +0200 (CEST) Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A811B02.6080009@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <24130.194.88.55.211.1249973049.squirrel@localhost> <4A8118C1.8030707@erlang-consulting.com> <44762.194.88.55.211.1249974946.squirrel@localhost> <4A811B02.6080009@erlang-consulting.com> Message-ID: <19528.194.88.55.211.1249975645.squirrel@localhost> They are usually in the form #function-arity, for example: http://www.erlang.org/doc/man/ets.html#first-1 http://www.erlang.org/doc/man/ets.html#foldl-3 Or did you mean something completely different? Zoltan. > But there is no anchor to each function on a module page; which is what > I want. > > /Mazen > > Zoltan Lajos Kis wrote: >> The one the link leads to. There is a search box on the top left. >> >> Zoltan. >> >> >>> What page are you looking at? >>> >>> /Mazen >>> >>> Zoltan Lajos Kis wrote: >>> >>>> You can give the search engine at gotapi a try >>>> (http://www.gotapi.com/erlang). It needs some fixes, but probably will >>>> do >>>> what you want. >>>> >>>> Anchors already exist in the documentation, in the non-xhtml style (>>> name="anchor" />) . >>>> >>>> Regards, >>>> Zoltan. >>>> >>>> >>>> >>>>> This brings up a subject I've been meaning to bring up for a while. >>>>> The >>>>> online documentation needs modernisation... A few things that come to >>>>> mind are: >>>>> >>>>> * Proper documentation search (please don't insult this by saying >>>>> Google... that's just stupid) >>>>> * Function overview in each module >>>>> * Module summary on the modules page (and categorized) much like >>>>> http://docs.python.org/3.1/library/index.html >>>>> * Add anchors to the HTML so that a link can go straight to a >>>>> function >>>>> * Make HTML XHTML >>>>> * More visually appealing. Probably this won't go very well with >>>>> old-timers but frankly I have spoken to beginners in Erlang that say >>>>> that when looking at the documentation it looks like something >>>>> created >>>>> 20 years ago and it doesn't look very... well... "appealing". The >>>>> fact >>>>> they are right about the age is not the point now is it ;) ? >>>>> >>>>> Probably many more issues exist.... just saying. >>>>> >>>>> /Mazen >>>>> >>>>> >>>>> Dave Pawson wrote: >>>>> >>>>> >>>>>> http://www.dpawson.co.uk/erlang/qr.txt >>>>>> >>>>>> I did it for my own reference. >>>>>> I use this, then open an appropriate >>>>>> http://erlang.org/doc/man_index.html page >>>>>> for details. >>>>>> >>>>>> Feedback appreciated. >>>>>> >>>>>> regards >>>>>> >>>>>> >>>>>> >>>>>> >>>>> ________________________________________________________________ >>>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>>> erlang-questions (at) erlang.org >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >> >> >> > > From mazen.harake@REDACTED Tue Aug 11 09:29:16 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 10:29:16 +0300 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <19528.194.88.55.211.1249975645.squirrel@localhost> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <24130.194.88.55.211.1249973049.squirrel@localhost> <4A8118C1.8030707@erlang-consulting.com> <44762.194.88.55.211.1249974946.squirrel@localhost> <4A811B02.6080009@erlang-consulting.com> <19528.194.88.55.211.1249975645.squirrel@localhost> Message-ID: <4A811DCC.4020503@erlang-consulting.com> Ah! Nope that is exactly what I wanted! Cheers! /Mazen Zoltan Lajos Kis wrote: > They are usually in the form #function-arity, for example: > > http://www.erlang.org/doc/man/ets.html#first-1 > http://www.erlang.org/doc/man/ets.html#foldl-3 > > Or did you mean something completely different? > > Zoltan. > > >> But there is no anchor to each function on a module page; which is what >> I want. >> >> /Mazen >> >> Zoltan Lajos Kis wrote: >> >>> The one the link leads to. There is a search box on the top left. >>> >>> Zoltan. >>> >>> >>> >>>> What page are you looking at? >>>> >>>> /Mazen >>>> >>>> Zoltan Lajos Kis wrote: >>>> >>>> >>>>> You can give the search engine at gotapi a try >>>>> (http://www.gotapi.com/erlang). It needs some fixes, but probably will >>>>> do >>>>> what you want. >>>>> >>>>> Anchors already exist in the documentation, in the non-xhtml style (>>>> name="anchor" />) . >>>>> >>>>> Regards, >>>>> Zoltan. >>>>> >>>>> >>>>> >>>>> >>>>>> This brings up a subject I've been meaning to bring up for a while. >>>>>> The >>>>>> online documentation needs modernisation... A few things that come to >>>>>> mind are: >>>>>> >>>>>> * Proper documentation search (please don't insult this by saying >>>>>> Google... that's just stupid) >>>>>> * Function overview in each module >>>>>> * Module summary on the modules page (and categorized) much like >>>>>> http://docs.python.org/3.1/library/index.html >>>>>> * Add anchors to the HTML so that a link can go straight to a >>>>>> function >>>>>> * Make HTML XHTML >>>>>> * More visually appealing. Probably this won't go very well with >>>>>> old-timers but frankly I have spoken to beginners in Erlang that say >>>>>> that when looking at the documentation it looks like something >>>>>> created >>>>>> 20 years ago and it doesn't look very... well... "appealing". The >>>>>> fact >>>>>> they are right about the age is not the point now is it ;) ? >>>>>> >>>>>> Probably many more issues exist.... just saying. >>>>>> >>>>>> /Mazen >>>>>> >>>>>> >>>>>> Dave Pawson wrote: >>>>>> >>>>>> >>>>>> >>>>>>> http://www.dpawson.co.uk/erlang/qr.txt >>>>>>> >>>>>>> I did it for my own reference. >>>>>>> I use this, then open an appropriate >>>>>>> http://erlang.org/doc/man_index.html page >>>>>>> for details. >>>>>>> >>>>>>> Feedback appreciated. >>>>>>> >>>>>>> regards >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> ________________________________________________________________ >>>>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>>>> erlang-questions (at) erlang.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>>> >>>> >>> >>> >> > > > From dave.pawson@REDACTED Tue Aug 11 10:24:48 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 09:24:48 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A811889.4040705@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> <4A811889.4040705@erlang-consulting.com> Message-ID: <711a73df0908110124v513dba75q91a5358d782bd556@mail.gmail.com> 2009/8/11 Mazen Harake : >>> * Proper documentation search (please don't insult this by saying >>> Google... >>> that's just stupid) >>> >> >> Define 'proper'? >> Some sort of hierarchy? >> ?root/module/function? >> > > hierarchy would help in my manual search sure. I was thinking in lines of; I > want to get a function that does this or that so I search the > module/function names and descriptions and get results directly related to > the documentation, not erlang-mailing list stuff etc. To get an idea of what > I want go to http://docs.python.org/3.1/search.html and enter "read" (wo > quotes) and then press search. Sorry, I don't do javascript. If you can write it and host it... and update it? >> >> >>> >>> * Function overview in each module >>> >> >> >> Is http://erlang.org/doc/man/lists.html the 'description' section >> sufficient >> or would you like to write more than that? Is that what you mean by >> an overview? >> > > I want in that part of the page a list of functions (much like edoc) which > says "foo/1 ? ? ?| blablabla" if this can't be done then skip the > "blablabla" part, but just please give me an overview of the functions in > the module... :) -1, space constraints again. You have that in the current documentation. >> >> >>> >>> * Module summary on the modules page (and categorized) much like >>> http://docs.python.org/3.1/library/index.html >>> >> >> This might match my definition of the 'description' above. >> > > No, I meant more like: "1 File system modules > 1.1 filelib 1.2 filename 1.3 > file" etc. so that If I am looking (manually) for a function that has to do > with say tracing then I know in which category I can look in. I don't know > to what extent this makes sense None to me. Could you write it? but it feels like it would shorten the time > to search for a specific function. One huge list of modules that really > don't say anything (except for hint in name) until you click on the page is > very annoying in the sense that my browser's back button is getting worn out Proposal then please. >>> * Add anchors to the HTML so that a link can go straight to a function >>> >> >> -1 on the grounds of size? Suggest go from module list to >> the module itself, then have a toc in the module listing and linked >> to the function itself? >> >> > > well... I just want anchors inside the HTML document itself so that me > personally (or anyone else) linking to it can link straight to the function > in question. Not from me. >> >> >>> >>> * Make HTML XHTML >>> >> >> :-) ?Mmm. Less keen here. ns declaration buggers up some browsers. >> Valid HTML I will agree with though. >> > > Well... XHTML is just properly formed HTML... afaik... more or less anyway. I'm at home here. It isn't. It's namespaced. 'properly formatted'? I do provide well formed XML, which happens to be html (i.e. SGML to the html DTD), which may suite. >> >> >>> >>> * More visually appealing. >> Only if you can define 'appealing'. CSS decoration? >> >> > > Yes. No need for images etc, but perhaps a theme... The good'ol "scratch" is > ugly. ?? Not understood. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From mazen.harake@REDACTED Tue Aug 11 10:41:18 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 11 Aug 2009 11:41:18 +0300 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908110124v513dba75q91a5358d782bd556@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> <4A811889.4040705@erlang-consulting.com> <711a73df0908110124v513dba75q91a5358d782bd556@mail.gmail.com> Message-ID: <4A812EAE.9050605@erlang-consulting.com> I just realised that you might be thinking I was commenting on Your implementation?!? :-) I'm not, I'm commenting the official documentation :-) Your implementation just made me bring up something I had been meaning to bring up about the official one. Btw, create links from your implementation so that when you click on the function name it takes you straight to the function. Also, if I may ask, what does "-1" mean.... why are you using it? :P /Mazen Dave Pawson wrote: > 2009/8/11 Mazen Harake : > > >>>> * Proper documentation search (please don't insult this by saying >>>> Google... >>>> that's just stupid) >>>> >>>> >>> Define 'proper'? >>> Some sort of hierarchy? >>> root/module/function? >>> >>> >> hierarchy would help in my manual search sure. I was thinking in lines of; I >> want to get a function that does this or that so I search the >> module/function names and descriptions and get results directly related to >> the documentation, not erlang-mailing list stuff etc. To get an idea of what >> I want go to http://docs.python.org/3.1/search.html and enter "read" (wo >> quotes) and then press search. >> > > Sorry, I don't do javascript. If you can write it and host it... and update it? > > > > > >>> >>>> * Function overview in each module >>>> >>>> >>> Is http://erlang.org/doc/man/lists.html the 'description' section >>> sufficient >>> or would you like to write more than that? Is that what you mean by >>> an overview? >>> >>> >> I want in that part of the page a list of functions (much like edoc) which >> says "foo/1 | blablabla" if this can't be done then skip the >> "blablabla" part, but just please give me an overview of the functions in >> the module... :) >> > > -1, space constraints again. You have that in the current documentation. > > > >>> >>>> * Module summary on the modules page (and categorized) much like >>>> http://docs.python.org/3.1/library/index.html >>>> >>>> >>> This might match my definition of the 'description' above. >>> >>> >> No, I meant more like: "1 File system modules > 1.1 filelib 1.2 filename 1.3 >> file" etc. so that If I am looking (manually) for a function that has to do >> with say tracing then I know in which category I can look in. I don't know >> to what extent this makes sense >> > > None to me. Could you write it? > > but it feels like it would shorten the time > >> to search for a specific function. One huge list of modules that really >> don't say anything (except for hint in name) until you click on the page is >> very annoying in the sense that my browser's back button is getting worn out >> > > Proposal then please. > > > > > >>>> * Add anchors to the HTML so that a link can go straight to a function >>>> >>>> >>> -1 on the grounds of size? Suggest go from module list to >>> the module itself, then have a toc in the module listing and linked >>> to the function itself? >>> >>> >>> >> well... I just want anchors inside the HTML document itself so that me >> personally (or anyone else) linking to it can link straight to the function >> in question. >> > > Not from me. > > > >>> >>>> * Make HTML XHTML >>>> >>>> >>> :-) Mmm. Less keen here. ns declaration buggers up some browsers. >>> Valid HTML I will agree with though. >>> >>> >> Well... XHTML is just properly formed HTML... afaik... more or less anyway. >> > > I'm at home here. It isn't. It's namespaced. > 'properly formatted'? I do provide well formed XML, which happens > to be html (i.e. SGML to the html DTD), which may suite. > > > > >>> >>>> * More visually appealing. >>>> > > >>> Only if you can define 'appealing'. CSS decoration? >>> >>> >>> >> Yes. No need for images etc, but perhaps a theme... The good'ol "scratch" is >> ugly. >> > > ?? Not understood. > > > regards > > > > From bgustavsson@REDACTED Tue Aug 11 10:57:15 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Tue, 11 Aug 2009 10:57:15 +0200 Subject: [erlang-questions] compiler crash on very long module paths In-Reply-To: <781dd98c0906200614t4c417d54v3931726fdcdbe5a1@mail.gmail.com> References: <781dd98c0906200614t4c417d54v3931726fdcdbe5a1@mail.gmail.com> Message-ID: <6672d0160908110157t1344298s2d432a4798d608d@mail.gmail.com> On Sat, Jun 20, 2009 at 3:14 PM, Chris Newcombe wrote: > Please could the compiler be changed to not call list_to_atom/1 on module paths? Yes, we will do that in R13B02. Thanks for reporting this problem. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From francesco@REDACTED Tue Aug 11 13:25:58 2009 From: francesco@REDACTED (Francesco Cesarini (Erlang Training and Consulting)) Date: Tue, 11 Aug 2009 12:25:58 +0100 Subject: Erlang e-Learning Position Message-ID: <4A815546.5010207@erlang-consulting.com> Job: Erlang e-Learning Developer Location: London, UK Type: 2 year contract Salary: Competitive package based on experience Description: We are looking for a high-flying graduate to work with Erlang Training and Consulting (ETC) to transform their classroom training materials for Erlang into a state-of-the-art e-learning programme. ETC are the principal providers of Erlang training worldwide, and this programme will allow them to significantly expand their global business. You will have a good honours degree in computing, multimedia, or an IT-related subject. You will be committed to communicating technical ideas through different media: text, presentation, video, and Instant Messaging. You will be confident in finding out about, learning and using and integrating new technologies, including web systems, core multimedia systems as well as the basics of Erlang itself. This positi on is supported by the Knowledge Transfer Partnerships (KTP) programme, and as part of that you will receive management and other skills training, much like graduate training programmes in larger companies, leading to a Diploma in Management. You will also, if you wish, be able to register for a research degree in the School of Computing at Kent. Closing date for receipt of applications : Wednesday 02 Sep 2009. Interviews are likely to be held : Friday 11 Sep 2009. To apply for this position, you need to be eligible to work in the EU. We will not be sponsoring any visa applications. You can apply on our site at http://www.erlang-consulting.com/jobs/listing Regards, Francesco -- http://www.erlang-consulting.com From mononcqc@REDACTED Tue Aug 11 14:55:51 2009 From: mononcqc@REDACTED (Fred Hebert (MononcQc)) Date: Tue, 11 Aug 2009 08:55:51 -0400 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A81102F.9050703@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> Message-ID: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> On Tue, Aug 11, 2009 at 2:31 AM, Mazen Harake wrote: > > This brings up a subject I've been meaning to bring up for a while. The online documentation needs modernisation... A few things that come to mind are: > > * Proper documentation search (please don't insult this by saying Google... that's just stupid) I think this would depend on how we expect people to search: There is the http://erlapi.prepor.ru/docs/ approach, which is good if you know the module or function you're looking for. The problem with this way of searching is that while it helps those who know the modules, if you're looking for a simple concept like "list length", you won't find anything (even the python search doesn't do this too well). Google is usually the best way to search docs that way, though. Providing two ways to search could please both 'old-timers' and newcomers. > * Function overview in each module > * Module summary on the modules page (and categorized) much like http://docs.python.org/3.1/library/index.html > * Add anchors to the HTML so that a link can go straight to a function > * Make HTML XHTML Agreeing with each of these. Anchors would be useful; to reuse the 'list length' example; if the search engine pointed you to the 'length' function from the 'erlang' module, it would be a [minor] pain to have to scroll down to the function definition. HTML as XHTML would also make things easier to "scrape" with a normal XML parser, which is not bad. > * More visually appealing. Probably this won't go very well with old-timers but frankly I have spoken to beginners in Erlang that say that when looking at the documentation it looks like something created 20 years ago and it doesn't look very... well... "appealing". The fact they are right about the age is not the point now is it ;) ? I believe that before that, managing to get rid of frames would be better: frames are indeed outdated, and although somewhat practical in an indexed navigation (maybe just within a single module), they are annoying because you can't intuitively link them to other people without losing context. I believe usability should come before beauty when talking about technical and formal documentation. An example of nice things to have would include links to other modules when they are mentioned and anchors for 'global' types in function signatures. Take the io:read/3 function as an example: http://erlang.org/doc/man/io.html#read/3 The io_device() type is defined on top of the page, but assuming you're coming from an anchor to the function, the type won't mean much to the reader. Most people, rather than scrolling up, would probably start a new search to find what 'io_device()' is about. Adding an internal anchor of the kind io.html#type-io_device could probably fix that. Then when the function 'file:open/2' is mentioned, no link is provided. The user is expected to go through the URLs or a new search to follow documentation. In ideal circumstances, reading the documentation should require no effort past trying to understand what is written. I believe the Erlang doc is very thorough and has lots of details, but is mainly opaque to new users and a disaster in usability. The effort deployed at?http://erlapi.prepor.ru/docs/ is already an impressive amelioration and makes searching through the docs 10 times easier (thanks to Andrew Rudenko). > > Probably many more issues exist.... just saying. > > /Mazen > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From leap@REDACTED Tue Aug 11 16:27:10 2009 From: leap@REDACTED (Michael Turner) Date: Tue, 11 Aug 2009 14:27:10 +0000 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> Message-ID: >I believe the Erlang doc is very thorough and has lots of details, but >is mainly opaque to new users and a disaster in usability. I would say "translucent at best" rather than "opaque", and "unnecessarily limited" rather than "a disaster". But that's because I'm feeling diplomatic and forgiving at the moment. (Maybe it was that drink I had with dinner. In a few hours, I'm sure, I'll be back to my usual snarling, irritable self.) > The effort >deployed at http://erlapi.prepor.ru/docs/ is already an impressive >amelioration and makes searching through the docs 10 times easier >(thanks to Andrew Rudenko). I notice that Rudenko doesn't reproduce any Ericsson copyright notices. That's awfully brave of him. But his legal transgression does have the virtue of forcing the question: What rights do we have to republish the documentation in any modified form anyway? I've looked at the Erlang license, but it seems to apply only to the code, not the documentation. Presumably, then, the documentation is copyright Ericsson A.B. and nothing else -- hence available only on terms more restrictive (implicitly, at least) than those placed on us by the Erlang license with respect to the code. There's much in the documentation I'd like to fix -- typos, various grammatical infelicities -- but I'm not sure how I can get involved without stepping on Ericsson toes. Can I submit my edits to the bugs list, in standard patchfile format? Is that how it's usually done? Is there a "usually"? -michael turner From dave.pawson@REDACTED Tue Aug 11 16:28:16 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 15:28:16 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> Message-ID: <711a73df0908110728l6f74c7a2g5177e771f384882a@mail.gmail.com> Just picking up on one point Fred. The XML source: 2009/8/11 Fred Hebert (MononcQc) : > I believe usability should come before beauty when talking about > technical and formal documentation. An example of nice things to have > would include links to other modules when they are mentioned and > anchors for 'global' types in function signatures. Take the io:read/3 > function as an example: http://erlang.org/doc/man/io.html#read/3 > > The io_device() type is defined on top of the page, but assuming > you're coming from an anchor to the function, the type won't mean much > to the reader. Most people, rather than scrolling up, would probably > start a new search to find what 'io_device()' is about. Adding an > internal anchor of the kind io.html#type-io_device could probably fix > that. Then when the function 'file:open/2' is mentioned, no link is > provided. The user is expected to go through the URLs or a new search > to follow documentation. In ideal circumstances, reading the > documentation should require no effort past trying to understand what > is written. The xml source has no 'inter module' linking. A link base, some sort of standard xref or similar would be a feature request for the current authors. http://www.sagehill.net/docbookxsl/Db5Tools.html#Db5UnivLinking describes such a system. That would be easy, once implemented. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Tue Aug 11 16:32:44 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 15:32:44 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: References: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> Message-ID: <711a73df0908110732r5d747b6enf5d5ae9dd56a7b07@mail.gmail.com> Oh dear. Dreaded IPR! 2009/8/11 Michael Turner : > I notice that Rudenko doesn't reproduce any Ericsson copyright notices. > That's awfully brave of him. > > But his legal transgression does have the virtue of forcing the question: > What rights do we have to republish the documentation in any modified > form anyway? Are none of the document mainainters on this list? Who to ask at Ericsson? At least it would be advantageous to put a copyright notice on the XML source! Then we'd know when/if we transgress. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From ceo@REDACTED Tue Aug 11 16:43:35 2009 From: ceo@REDACTED (Andrew Rudenko) Date: Tue, 11 Aug 2009 18:43:35 +0400 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: References: Message-ID: <0FFDC340-5FAD-4427-922F-C22C9EA79D1E@prepor.ru> >> The effort >> deployed at http://erlapi.prepor.ru/docs/ is already an impressive >> amelioration and makes searching through the docs 10 times easier >> (thanks to Andrew Rudenko). > > I notice that Rudenko doesn't reproduce any Ericsson copyright > notices. > That's awfully brave of him. > > But his legal transgression does have the virtue of forcing the > question: > What rights do we have to republish the documentation in any modified > form anyway? I've looked at the Erlang license, but it seems to apply > only to the code, not the documentation. Presumably, then, the > documentation is copyright Ericsson A.B. and nothing else -- hence > available only on terms more restrictive (implicitly, at least) than > those placed on us by the Erlang license with respect to the code. > > There's much in the documentation I'd like to fix -- typos, various > grammatical infelicities -- but I'm not sure how I can get involved > without stepping on Ericsson toes. Can I submit my edits to the bugs > list, in standard patchfile format? Is that how it's usually done? > Is > there a "usually"? Copyrights, oh no :( But Ericsson can fork repo on github and puts copyright notices as they like ;) And pull fork to original repo, I'll accept it. Honestly! From dave.pawson@REDACTED Tue Aug 11 16:48:53 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 15:48:53 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <0FFDC340-5FAD-4427-922F-C22C9EA79D1E@prepor.ru> References: <0FFDC340-5FAD-4427-922F-C22C9EA79D1E@prepor.ru> Message-ID: <711a73df0908110748g1ab2b320rbd05ca7297501af3@mail.gmail.com> 2009/8/11 Andrew Rudenko : >From the erlang.xml file The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Anyone care to interpret? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From ulf.wiger@REDACTED Tue Aug 11 16:59:59 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 11 Aug 2009 16:59:59 +0200 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908110732r5d747b6enf5d5ae9dd56a7b07@mail.gmail.com> References: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> <711a73df0908110732r5d747b6enf5d5ae9dd56a7b07@mail.gmail.com> Message-ID: <4A81876F.9080205@erlang-consulting.com> You can reproduce it and modify it, but you must credit Ericsson for the original, and you are not allowed to put it under a more restrictive license More here: http://www.erlang.org/license/EPL1x0-explained.html BR, Ulf W Dave Pawson wrote: > Oh dear. Dreaded IPR! > > 2009/8/11 Michael Turner : > >> I notice that Rudenko doesn't reproduce any Ericsson copyright notices. >> That's awfully brave of him. >> >> But his legal transgression does have the virtue of forcing the question: >> What rights do we have to republish the documentation in any modified >> form anyway? > > Are none of the document mainainters on this list? > Who to ask at Ericsson? > > At least it would be advantageous to put a copyright notice > on the XML source! > Then we'd know when/if we transgress. > > regards > > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From ceo@REDACTED Tue Aug 11 17:19:18 2009 From: ceo@REDACTED (Andrew Rudenko) Date: Tue, 11 Aug 2009 19:19:18 +0400 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908110748g1ab2b320rbd05ca7297501af3@mail.gmail.com> References: <0FFDC340-5FAD-4427-922F-C22C9EA79D1E@prepor.ru> <711a73df0908110748g1ab2b320rbd05ca7297501af3@mail.gmail.com> Message-ID: <11A231BF-CCB2-4850-97B3-732D8A79042F@prepor.ru> In license: "``Original Code'' means Source Code of computer software code" Documentation is a computer software code? ;) But i added original copyright to docs ? http://erlapi.prepor.ru/docs/ On Aug 11, 2009, at 6:48 PM, Dave Pawson wrote: > 2009/8/11 Andrew Rudenko : > > > From the erlang.xml file > > > > The contents of this file are subject to the Erlang Public > License, > Version 1.1, (the "License"); you may not use this file except in > compliance with the License. You should have received a copy of > the > Erlang Public License along with this software. If not, it can be > retrieved online at http://www.erlang.org/. > > Software distributed under the License is distributed on an "AS > IS" > basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. > See > the License for the specific language governing rights and > limitations > under the License. > > > > > > Anyone care to interpret? > > From leap@REDACTED Tue Aug 11 17:31:24 2009 From: leap@REDACTED (Michael Turner) Date: Tue, 11 Aug 2009 15:31:24 +0000 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A81876F.9080205@erlang-consulting.com> Message-ID: <60Eu6Uxo.1250004684.3787840.leap@gol.com> On 8/11/2009, "Ulf Wiger" wrote: >You can reproduce it and modify it, but you must >credit Ericsson for the original, and you are not >allowed to put it under a more restrictive license Yes, but "it" is only the XML, in this case. What's generated from that XML source (if the docs at erlang.org are any indication) says just "Copyright (C) 1999-2009 Ericsson AB", with no reference to the EPL. Does this mean that Ericsson puts the properly [*] human-readable documentation under a more restrictive license than the XML source from which that documentation is generated? Or what? >More here: > >http://www.erlang.org/license/EPL1x0-explained.html Yeah, but it still just says "code" there. Nothing about the documentation. If the XML is considered code (and the code that generated the docs is *definitely* code), that still doesn't necessarily apply to what Ericsson is explicitly copyrights with *no* mention of EPL, i.e., the documentation that gets generated from the (EPL-covered) code. This is kind of crazy, I know. And stupid, too. But also legally interesting. (No, I am not a lawyer. Just a sometime software engineer and sometime patent translator who has spent some time in the company of IP lawyers. Let me tell you: they can smell fear. And you know those rumors that they can be repelled by crucifixes and/or garlic, and can be permanently laid to rest with silver bullets and/or stakes through the heart? Not true. None of them.) -michael turner [*] The cavalier use of "properly" has already raised a question of interpretation in this thread, so let me clarify for this context: I don't regard XML as properly human-readable, any more than a live chicken is properly human-edible. [**] [**] Refer to "geek" in a dictionary, if you are confused by this allusion. From vengeance.storm@REDACTED Tue Aug 11 17:36:03 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Tue, 11 Aug 2009 23:36:03 +0800 Subject: Does Erlang shell evaluate expressions in a separate process? Message-ID: <841721380908110836t315974bsfa3e32e774f3f90c@mail.gmail.com> Sorry if this is a boring question. I just started with Erlang. I'm asking this because I noticed that after every time an exception is thrown in shell, self() gives different result. Thanks, Pan, Xingzhi From ulf.wiger@REDACTED Tue Aug 11 17:38:47 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 11 Aug 2009 17:38:47 +0200 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <60Eu6Uxo.1250004684.3787840.leap@gol.com> References: <60Eu6Uxo.1250004684.3787840.leap@gol.com> Message-ID: <4A819087.5080600@erlang-consulting.com> Since you're referring to copyright lawyers here, I think we can relate to the media industry, and observe that if it's not ok to publish a video of your kid playing if the viewer can discern a Prince song in the background*, you should regard the documentation as a trivial (from a legal standpoint) re-packaging of the XML source. According to Swedish law, at least, it is enough (actually, not even required) to note the copyright without spelling out the license. Indeed, Prince didn't have to sing the words "you may not reproduce this song without my permission" for his legal rights to be enforceable. BR, Ulf W [*] This did happen (youtube), but I have no reference. Michael Turner wrote: > > On 8/11/2009, "Ulf Wiger" wrote: > >> You can reproduce it and modify it, but you must >> credit Ericsson for the original, and you are not >> allowed to put it under a more restrictive license > > Yes, but "it" is only the XML, in this case. What's generated from > that XML source (if the docs at erlang.org are any indication) says just > "Copyright (C) 1999-2009 Ericsson AB", with no reference to the EPL. > > Does this mean that Ericsson puts the properly [*] human-readable > documentation under a more restrictive license than the XML source from > which that documentation is generated? Or what? > >> More here: >> >> http://www.erlang.org/license/EPL1x0-explained.html > > Yeah, but it still just says "code" there. Nothing about the > documentation. If the XML is considered code (and the code that > generated the docs is *definitely* code), that still doesn't > necessarily apply to what Ericsson is explicitly copyrights with *no* > mention of EPL, i.e., the documentation that gets generated from the > (EPL-covered) code. > > This is kind of crazy, I know. And stupid, too. But also legally > interesting. (No, I am not a lawyer. Just a sometime software engineer > and sometime patent translator who has spent some time in the company of > IP lawyers. Let me tell you: they can smell fear. And you know those > rumors that they can be repelled by crucifixes and/or garlic, and can be > permanently laid to rest with silver bullets and/or stakes through the > heart? Not true. None of them.) > > -michael turner > > [*] The cavalier use of "properly" has already raised a question of > interpretation in this thread, so let me clarify for this context: I > don't regard XML as properly human-readable, any more than a live > chicken is properly human-edible. [**] > > [**] Refer to "geek" in a dictionary, if you are confused by this > allusion. > > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From attila.r.nohl@REDACTED Tue Aug 11 17:47:29 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 11 Aug 2009 17:47:29 +0200 Subject: [erlang-questions] Does Erlang shell evaluate expressions in a separate process? In-Reply-To: <841721380908110836t315974bsfa3e32e774f3f90c@mail.gmail.com> References: <841721380908110836t315974bsfa3e32e774f3f90c@mail.gmail.com> Message-ID: <401d3ba30908110847g2ca82ec3w5a40f62969acd2f7@mail.gmail.com> No. That's why you get a new self(), because the previous shell process crashed. 2009/8/11, Xingzhi Pan : > Sorry if this is a boring question. I just started with Erlang. I'm asking > this because I noticed that after every time an exception is thrown in > shell, self() gives different result. > > Thanks, > Pan, Xingzhi > From vengeance.storm@REDACTED Tue Aug 11 17:54:36 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Tue, 11 Aug 2009 23:54:36 +0800 Subject: [erlang-questions] Does Erlang shell evaluate expressions in a separate process? In-Reply-To: <401d3ba30908110847g2ca82ec3w5a40f62969acd2f7@mail.gmail.com> References: <841721380908110836t315974bsfa3e32e774f3f90c@mail.gmail.com> <401d3ba30908110847g2ca82ec3w5a40f62969acd2f7@mail.gmail.com> Message-ID: <841721380908110854r255679fbyaf065b176d52b44a@mail.gmail.com> Great. Thanks. Pan, Xingzhi 2009/8/11 Attila Rajmund Nohl > No. That's why you get a new self(), because the previous shell process > crashed. > > 2009/8/11, Xingzhi Pan : > > Sorry if this is a boring question. I just started with Erlang. I'm > asking > > this because I noticed that after every time an exception is thrown in > > shell, self() gives different result. > > > > Thanks, > > Pan, Xingzhi > > > From dave.pawson@REDACTED Tue Aug 11 17:59:54 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 16:59:54 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A81876F.9080205@erlang-consulting.com> References: <8b9ee55b0908110555r33b188e6u1905d9a318a46886@mail.gmail.com> <711a73df0908110732r5d747b6enf5d5ae9dd56a7b07@mail.gmail.com> <4A81876F.9080205@erlang-consulting.com> Message-ID: <711a73df0908110859q51e2e807of629c06a0c9dc320@mail.gmail.com> 2009/8/11 Ulf Wiger : > > You can reproduce it and modify it, but you must > credit Ericsson for the original, and you are not > allowed to put it under a more restrictive license > > More here: > > http://www.erlang.org/license/EPL1x0-explained.html Any suggestion what the 'accreditation' statement should be? I've no problem with that. "Source copyright, ericsson.com " or .... regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From leap@REDACTED Tue Aug 11 18:03:41 2009 From: leap@REDACTED (Michael Turner) Date: Tue, 11 Aug 2009 16:03:41 +0000 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01modules, quick reference) In-Reply-To: <4A819087.5080600@erlang-consulting.com> Message-ID: On 8/11/2009, "Ulf Wiger" wrote: > >Since you're referring to copyright lawyers here, I >think we can relate to the media industry, and observe >that if it's not ok to publish a video of your kid >playing if the viewer can discern a Prince song in the >background*, you should regard the documentation as a >trivial (from a legal standpoint) re-packaging of the >XML source. Under that interpretation, dig if you will the picture, I can modify the XML at will, of you and I engaged in a kiss, so that the docs produced are misleading, the sweat of your body covers me, because of some original and rather racy song lyrics I interpolate, can you my darling, and it would still be OK, can you picture this? You do that to the Erlang docs on your site, some Ericsson lawyers will give those doves something to cry about, I can tell you that much. Here's a general guiding principle of property law: no harm, no foul. (This gets stretched a little in America, where "someone was on my property and it scared the bejesus outa me, so I blew his head off" is considered an extenuating circumstance.) Under this interpretation, if you copy the documentation and improve it (even if only by making it more searchable and navigable, as you have), Ericsson, if properly credited, isn't harmed. Ericsson is actually helped, in a way, because some people might attribute the enhanced navigability to Ericsson, if they didn't know any better. So let's say some supposed copyright infringement action went all the way to court. The judge would probably shrug and say to Ericsson, "Well, you guys left it ambiguous, with this sloppy EPL you drafted, but now you're complaining? After somebody actually did you a *favor* under those ambiguous terms? Case dismissed!" Aren't you relieved? But let's say your Erlang doc site becomes the most popular link on Google when people search on "Erlang" and "documentation", but then you get bored, and you don't hand site maintenance off to anybody, and the docs go out of date, and people using Erlang according to your dated documentation get pissed off, because a recent release of Erlang/OTP doesn't work the way it's described on your site, and they get a negative impression of Ericsson in the process? Then it goes from "no harm (benefit, actually)", to "harm", thus to "foul." Maybe. I don't know. IANAL. Especially, IANAIPL. I just bite the heads off live chickens at carnival sideshows for a living, and write bad Python code as a hobby. -michael From ulf.wiger@REDACTED Tue Aug 11 18:15:42 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 11 Aug 2009 18:15:42 +0200 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01modules, quick reference) In-Reply-To: References: Message-ID: <4A81992E.2030800@erlang-consulting.com> Michael Turner wrote: > > Under this interpretation, if you copy the documentation and improve it > (even if only by making it more searchable and navigable, as you have), > Ericsson, if properly credited, isn't harmed. Ericsson is actually > helped, in a way, because some people might attribute the enhanced > navigability to Ericsson, if they didn't know any better. So let's > say some supposed copyright infringement action went all the way to > court. The judge would probably shrug and say to Ericsson, "Well, you > guys left it ambiguous, with this sloppy EPL you drafted, but now > you're complaining? After somebody actually did you a *favor* under > those ambiguous terms? Case dismissed!" > > Aren't you relieved? That was basically what I was aiming at. The EPL says it's ok to copy, modify and re-distribute the source, as long as you credit Ericsson for the original (a one-liner will surely suffice). It says it's /not/ ok to modify and keep it proprietary or distribute under a more limiting license than the EPL. As for the generated docs falling under this license, I say they do. Since all you have to do to be safe is to credit Ericsson and use a good Open Source license, there's no reason not to. License or not, this is in the spirit of Open Source, and you are doing a good deed. There haven't been many cases where Ericsson representatives have had reason to complain about uses in the Erlang world. There was a case of someone using the Ericsson logo on a web page without their permission (not related to Erlang or the EPL), and another case where the docs were included in teaching material without giving due credit. Of course, I don't work for Ericsson, so if they say different, they are the ones you should listen to. :) BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From joelr1@REDACTED Tue Aug 11 18:17:14 2009 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 11 Aug 2009 17:17:14 +0100 Subject: strange packet loss Message-ID: I'm facing a strange issue where packets are sent over the loopback interface from server to client but the client does not receive them. I've been scratching my head over this for a while now and I just can't see what's wrong. I'm running 10k clients and this only happens to 100-500 of them. I'm sending a subscribe packet to the server and the server replies with an ACK. If the server does not reply, the client will resend the subscription request. According to tcpdump: --- biggie:~ joelr$ sudo tcpdump -i lo0 -vv -X tcp port 47835 tcpdump: listening on lo0, link-type NULL (BSD loopback), capture size 65535 bytes 17:04:19.009254 IP (tos 0x0, ttl 64, id 49634, offset 0, flags [DF], proto TCP (6), length 92, bad cksum 0 (->7ab7)!) localhost.47835 > localhost.us-cli: Flags [P.], cksum 0xfe50 (incorrect -> 0x050a), seq 4234590488:4234590528, ack 2064297246, win 40830, options [nop,nop,TS val 960438746 ecr 960438703], length 40 0x0000: 4500 005c c1e2 4000 4006 0000 7f00 0001 E..\..@REDACTED@....... 0x0010: 7f00 0001 badb 1f92 fc66 b918 7b0a ad1e .........f..{... 0x0020: 8018 9f7e fe50 0000 0101 080a 393f 21da ...~.P......9?!. 0x0030: 393f 21af 0026 7b22 6163 7469 6f6e 223a 9?!..&{"action": 0x0040: 2273 7562 7363 7269 6265 222c 2264 6174 "subscribe","dat 0x0050: 6122 3a22 6576 656e 7473 227d a":"events"} 17:04:19.009265 IP (tos 0x0, ttl 64, id 28825, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 0 (->cc28)!) localhost.us-cli > localhost.47835: Flags [.], cksum 0xfe28 (incorrect -> 0x0a4a), seq 1, ack 40, win 65535, options [nop,nop,TS val 960438746 ecr 960438746], length 0 0x0000: 4500 0034 7099 4000 4006 0000 7f00 0001 E..4p.@REDACTED@....... 0x0010: 7f00 0001 1f92 badb 7b0a ad1e fc66 b940 ........{....f.@ 0x0020: 8010 ffff fe28 0000 0101 080a 393f 21da .....(......9?!. 0x0030: 393f 21da 9?!. 17:04:19.009795 IP (tos 0x0, ttl 64, id 40175, offset 0, flags [DF], proto TCP (6), length 57, bad cksum 0 (->9fcd)!) localhost.us-cli > localhost.47835: Flags [P.], cksum 0xfe2d (incorrect -> 0x7df6), seq 1:6, ack 40, win 65535, options [nop,nop,TS val 960438746 ecr 960438746], length 5 0x0000: 4500 0039 9cef 4000 4006 0000 7f00 0001 E..9..@REDACTED@....... 0x0010: 7f00 0001 1f92 badb 7b0a ad1e fc66 b940 ........{....f.@ 0x0020: 8018 ffff fe2d 0000 0101 080a 393f 21da .....-......9?!. 0x0030: 393f 21da 0003 4143 4b 9?!...ACK --- You can see that the client sends a subscription request and that the server replies with an ACK. According to Erlang, the send portion of the stats keeps changing but there's nothing received. --- (debug@REDACTED)11> inet:getstat(Sock). {ok,[{recv_oct,0}, {recv_cnt,0}, {recv_max,0}, {recv_avg,0}, {recv_dvi,0}, {send_oct,1044}, {send_cnt,27}, {send_max,40}, {send_avg,38}, {send_pend,0}]} (debug@REDACTED)12> inet:getstat(Sock). {ok,[{recv_oct,0}, {recv_cnt,0}, {recv_max,0}, {recv_avg,0}, {recv_dvi,0}, {send_oct,1124}, {send_cnt,29}, {send_max,40}, {send_avg,38}, {send_pend,0}]} --- I don't think it's the socket options: --- (debug@REDACTED)15> inet:getopts(Sock, [active]). {ok,[{active,true}]} (debug@REDACTED)18> inet:getopts(Sock, [reuseaddr]). {ok,[{reuseaddr,true}]} (debug@REDACTED)19> inet:getopts(Sock, [packet]). {ok,[{packet,2}]} --- The initial set of options setup looks like this: --- case gen_tcp:connect(State#state.host, State#state.port, [binary, {packet, 0}, {active, true}, {reuseaddr, true} ], 3000) of --- Any suggestions on how to solve this issue? Thanks, Joel P.S. Snow Leopard, 64-bit mode, OTP R13B01 Darwin biggie.local 10.0.0 Darwin Kernel Version 10.0.0: Sat Jul 18 23:34:57 PDT 2009; root:xnu-1456.1.22~1/RELEASE_X86_64 x86_64 Erlang R13B01 (erts-5.7.2) [source] [64-bit] [rq:1] [async-threads:0] [kernel-poll:true] --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From hakan@REDACTED Tue Aug 11 18:18:03 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 11 Aug 2009 18:18:03 +0200 (CEST) Subject: Mnesia transactions, locks, and table events In-Reply-To: References: Message-ID: On Sat, 8 Aug 2009, Deepak Nulu wrote: > If a transaction updates 3 tables (using only record level locks and > not table level locks), is it possible for another simultaneous > transaction to update these same tables, especially if the two > transactions never update the same table at the same time? Is it > possible for another simultaneous transaction to update a 4th > (different) table? Yes. As long as your transactions does not have any conflicting locks they can progress in parallel. > If multiple records (in one or more tables) are updated in a > transaction, table events are sent for each updated record. If there > are multiple simultaneous transactions, can the table events for these > transactions get mixed, or is it guaranteed that all events for a > single transaction are sent before the events for another transaction > are sent? No, there are no such guarantee. Events from one transaction may be interleaved with events from another transaction. But if you have two transactions that are updating the same record, the events will be serialized due to conflicting locks. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB From joelr1@REDACTED Tue Aug 11 18:21:30 2009 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 11 Aug 2009 17:21:30 +0100 Subject: strange packet loss In-Reply-To: References: Message-ID: Forgot to add... (debug@REDACTED)21> inet:sockname(Sock). {ok,{{127,0,0,1},47835}} (debug@REDACTED)22> inet:peername(Sock). {ok,{{127,0,0,1},8082}} http://www.speedguide.net/port.php?port=8082 gives us-cli so everything matches up. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From dave.pawson@REDACTED Tue Aug 11 18:39:30 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 17:39:30 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01modules, quick reference) In-Reply-To: <4A81992E.2030800@erlang-consulting.com> References: <4A81992E.2030800@erlang-consulting.com> Message-ID: <711a73df0908110939u21583c6v1f3b8965a66593e9@mail.gmail.com> 2009/8/11 Ulf Wiger : > As for the generated docs falling under this license, I say > they do. Since all you have to do to be safe is to credit > Ericsson and use a good Open Source license, there's no > reason not to. License or not, this is in the spirit of > Open Source, and you are doing a good deed. I'm less sure about using a 'good OS license' but I'd like to add an accreditation statement. The only lawyer I know is US based, but he is IPR trained. Would that keep Sweden happy? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Tue Aug 11 18:56:30 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 11 Aug 2009 17:56:30 +0100 Subject: Modules Message-ID: <711a73df0908110956o27df1800pbfde2fc3e93c523b@mail.gmail.com> http://www.dpawson.co.uk/erlang/modules.html#d518e1 First attempt. Accreditation added! I'll link them through to regular module stuff. Thoughts? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From deepak.nulu@REDACTED Tue Aug 11 20:06:51 2009 From: deepak.nulu@REDACTED (Deepak Nulu) Date: Tue, 11 Aug 2009 11:06:51 -0700 Subject: Mnesia transactions, locks, and table events In-Reply-To: References: Message-ID: <58DC745C-AC69-4BD5-8E96-FF606ACEB693@gmail.com> Hi Hakan, Thank you very much for your response. -deepak On Aug 11, 2009, at 9:18 AM, Hakan Mattsson wrote: > On Sat, 8 Aug 2009, Deepak Nulu wrote: > >> If a transaction updates 3 tables (using only record level locks and >> not table level locks), is it possible for another simultaneous >> transaction to update these same tables, especially if the two >> transactions never update the same table at the same time? Is it >> possible for another simultaneous transaction to update a 4th >> (different) table? > > Yes. As long as your transactions does not have any conflicting locks > they can progress in parallel. > >> If multiple records (in one or more tables) are updated in a >> transaction, table events are sent for each updated record. If there >> are multiple simultaneous transactions, can the table events for >> these >> transactions get mixed, or is it guaranteed that all events for a >> single transaction are sent before the events for another transaction >> are sent? > > No, there are no such guarantee. Events from one transaction may be > interleaved with events from another transaction. But if you have two > transactions that are updating the same record, the events will be > serialized due to conflicting locks. > > /H?kan > --- > H?kan Mattsson (uabhams) > Erlang/OTP, Ericsson AB From nate@REDACTED Tue Aug 11 21:00:19 2009 From: nate@REDACTED (Nate Murray) Date: Tue, 11 Aug 2009 12:00:19 -0700 Subject: [ANN] gen_server_mock: a simple gen_server mocking library Message-ID: <9c1993f20908111200i67ecfc15y567807adf7157fff@mail.gmail.com> Hey guys, I was inspired by [this post](http://erlang.org/pipermail/erlang-questions/2008-April/034140.html) to write a simple gen_server mocking library. [Github Repo](http://github.com/jashmenn/gen_server_mock) It is by no means complete. Currently it only supports specific ordered messages (although my hope is to eventually add at-least-N, at-most-N etc.). Here's a code example: {ok, Mock} = gen_server_mock:new(), gen_server_mock:expect_call(Mock, fun(one, _From, _State) -> ok end), gen_server_mock:expect_call(Mock, fun(two, _From, State) -> {ok, State} end), gen_server_mock:expect_call(Mock, fun(three, _From, State) -> {ok, good, State} end), gen_server_mock:expect_call(Mock, fun({echo, Response}, _From, State) -> {ok, Response, State} end), gen_server_mock:expect_cast(Mock, fun(fish, State) -> {ok, State} end), gen_server_mock:expect_info(Mock, fun(cat, State) -> {ok, State} end), ok = gen_server:call(Mock, one), ok = gen_server:call(Mock, two), good = gen_server:call(Mock, three), tree = gen_server:call(Mock, {echo, tree}), ok = gen_server:cast(Mock, fish), Mock ! cat, gen_server_mock:assert_expectations(Mock), {ok}. Download it here: git clone git://github.com/jashmenn/gen_server_mock.git Introductory blog post: http://www.xcombinator.com/2009/08/11/testing-erlang-gen_server-with-gen_server_mock/ Feedback and patches welcome. Nate Murray From discoloda@REDACTED Tue Aug 11 21:23:38 2009 From: discoloda@REDACTED (Vincent Adam Burns) Date: Tue, 11 Aug 2009 20:23:38 +0100 Subject: template programing in erlang Message-ID: <3de26b2b0908111223r499d4c8bpa1c3c6ffff7b0878@mail.gmail.com> I have been writing a little rfc2234 parser for a SMTP server and client in erlang, it doesn't parse the format directly but uses erlang functions to describe a form. I ended up with with format of programming: character(Character) -> fun(<>) when X == Character -> {<>, Rest}; (_) -> false end. space(Bin) -> (character(16#20))(Bin). And it came to my attention how slow this might be: I have to reduce character, create a function from scratch, and then reduce that function. So I decided that I could write a parse_transform that finds a list of function factories (such as character) and reduces it into expressions that call it, automatically inserting the arguments into the fun body. so the above example becomes after running the parse_transform: space(Bin) -> fun(<>) when X == 16#20 -> {<>, Rest}; (_) -> false end(Bin). And then after reading some of the AST some more, I found I could replace the clauses of the function entirely so now space looks like this: space(<>) when X == 16#20 -> {<>, Rest}; space(_) -> false. And now I had a special little thing going on; Template programming in Erlang. I could make functions that take many parameters, and inject parameters directly into the code. Another good thing about the code is the ability to run without the parse_transform module. Here is the source for the beginning of a AST optimizer that includes this functionality. blog post -- --- You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away. From prikrutil@REDACTED Tue Aug 11 21:24:52 2009 From: prikrutil@REDACTED (Sergey Samokhin) Date: Tue, 11 Aug 2009 12:24:52 -0700 Subject: Which distributed key-value storage do you use? Message-ID: Hello! Currently I'm using mesia to store detailed session information of each user my system serves. What worries me a bit is that as soon as my code gets into heavy load in production and the number of transactions increases, performance of mnesia might become an issue. Don't know exactly how heavy the load will be, but I want my system to be ready for a few thousand of transactions per second (with at least two machines involved in replication). I think there should be people who are using something other than mnesia (e.g. Dynamo, Kai, Tokyo Cabinet etc) in production to store session data in an efficient (=:= with partitioning) and distributed manner and can share their impressions. Which one have you chosen? -- Sergey Samokhin From chsu79@REDACTED Tue Aug 11 21:46:34 2009 From: chsu79@REDACTED (Christian) Date: Tue, 11 Aug 2009 21:46:34 +0200 Subject: [erlang-questions] [ANN] gen_server_mock: a simple gen_server mocking library In-Reply-To: <9c1993f20908111200i67ecfc15y567807adf7157fff@mail.gmail.com> References: <9c1993f20908111200i67ecfc15y567807adf7157fff@mail.gmail.com> Message-ID: Cool! Myself I made this: http://github.com/noss/emock it does not have expect-reply-assert as yours. It is plain internal state and manual checking of messages and their order. And no end assert on conditions, just crash and bring the test down as soon as something is wrong. My only feedback to you is that it would be nice if the code could look a little more tabular. Breaking it down like this and passing them all in one go could perhaps give it more "overview:ness". [{call, fun(one, _From, _State) -> ok end}, {call, fun(two, _From, State) -> {ok, State} end}, {call, fun(three, _From, State) -> {ok, good, State} end}, {call, fun({echo, Response},_From, State) -> {ok, Response, State} end}, {cast, fun(fish, State) -> {ok, State} end}, {info, fun(cat, State) -> {ok, State} end}] I find that I want my test code to be very tabular, any other way and it feels like I should have test cases for my testcases because it looks too messy to be obviously correct. Question to anyone: Is it possible to use parse-transforms to minimize the cruft in having to write out the fun? (They are here for their pattern matching capability.) On Tue, Aug 11, 2009 at 21:00, Nate Murray wrote: > Hey guys, I was inspired by [this > post](http://erlang.org/pipermail/erlang-questions/2008-April/034140.html) > to > write a simple gen_server mocking library. [Github > Repo](http://github.com/jashmenn/gen_server_mock) > > It is by no means complete. Currently it only supports specific > ordered messages (although my hope is to eventually add at-least-N, > at-most-N etc.). > Here's a code example: > > ? ? ? ? {ok, Mock} = gen_server_mock:new(), > > ? ? ? ? gen_server_mock:expect_call(Mock, fun(one, ?_From, _State) > ? ? ? ?-> ok end), > ? ? ? ? gen_server_mock:expect_call(Mock, fun(two, ?_From, ?State) > ? ? ? ?-> {ok, State} end), > ? ? ? ? gen_server_mock:expect_call(Mock, fun(three, _From, ?State) > ? ? ? ?-> {ok, good, State} end), > ? ? ? ? gen_server_mock:expect_call(Mock, fun({echo, Response}, > _From, State) -> {ok, Response, State} end), > ? ? ? ? gen_server_mock:expect_cast(Mock, fun(fish, State) -> {ok, State} end), > ? ? ? ? gen_server_mock:expect_info(Mock, fun(cat, ?State) -> {ok, State} end), > > ? ? ? ? ok = gen_server:call(Mock, one), > ? ? ? ? ok = gen_server:call(Mock, two), > ? ? ? ? good = gen_server:call(Mock, three), > ? ? ? ? tree = gen_server:call(Mock, {echo, tree}), > ? ? ? ? ok ? = gen_server:cast(Mock, fish), > ? ? ? ? Mock ! cat, > > ? ? ? ? gen_server_mock:assert_expectations(Mock), > ? ? ? ? {ok}. > > Download it here: git clone git://github.com/jashmenn/gen_server_mock.git > Introductory blog post: > http://www.xcombinator.com/2009/08/11/testing-erlang-gen_server-with-gen_server_mock/ > > Feedback and patches welcome. > > Nate Murray > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From joelr1@REDACTED Tue Aug 11 21:54:58 2009 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 11 Aug 2009 20:54:58 +0100 Subject: strange packet loss In-Reply-To: References: Message-ID: I thought it was a Mac or Snow Leopard, ie. OS issue but it doesn't seem to be the case. Tracing the client beam gives me the following... 70891/0xfcdc46: 818902 8 3 recvfrom(0x3E7, 0x1006AD568, 0x404D) = 5 0 libSystem.B.dylib`recvfrom+0xa beam`tcp_inet_drv_input+0x267 beam`erts_port_task_execute+0x48b "= 5 0" above is the 2-byte length and the ACK itself which means that Erlang is indeed receiving my packet. I still don't know why it's not delivering it. The mystery deepens. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From rapsey@REDACTED Tue Aug 11 22:41:11 2009 From: rapsey@REDACTED (Rapsey) Date: Tue, 11 Aug 2009 22:41:11 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: Message-ID: <97619b170908111341s2f460b6ep1164f5769ba9fd5b@mail.gmail.com> If key-value is enough, tokyo cabinet looks pretty good. If you want a document store, I would highly suggest MongoDB. Sergej On Tue, Aug 11, 2009 at 9:24 PM, Sergey Samokhin wrote: > Hello! > > Currently I'm using mesia to store detailed session information of > each user my system serves. > > What worries me a bit is that as soon as my code gets into heavy load > in production and the number of transactions increases, performance of > mnesia might become an issue. Don't know exactly how heavy the load > will be, but I want my system to be ready for a few thousand of > transactions per second (with at least two machines involved in > replication). > > I think there should be people who are using something other than > mnesia (e.g. Dynamo, Kai, Tokyo Cabinet etc) in production to store > session data in an efficient (=:= with partitioning) and distributed > manner and can share their impressions. > > Which one have you chosen? > > -- > Sergey Samokhin > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From tuncer.ayaz@REDACTED Wed Aug 12 00:27:09 2009 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 12 Aug 2009 00:27:09 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: Message-ID: <4ac8254d0908111527o75783041xb197ec3df436d304@mail.gmail.com> On Tue, Aug 11, 2009 at 9:24 PM, Sergey Samokhin wrote: > Hello! > > Currently I'm using mesia to store detailed session information of > each user my system serves. > > What worries me a bit is that as soon as my code gets into heavy load > in production and the number of transactions increases, performance of > mnesia might become an issue. Don't know exactly how heavy the load > will be, but I want my system to be ready for a few thousand of > transactions per second (with at least two machines involved in > replication). > > I think there should be people who are using something other than > mnesia (e.g. Dynamo, Kai, Tokyo Cabinet etc) in production to store > session data in an efficient (=:= with partitioning) and distributed > manner and can share their impressions. Also consider http://riak.basho.com. > Which one have you chosen? > > -- > Sergey Samokhin > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From joelr1@REDACTED Wed Aug 12 01:04:42 2009 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 12 Aug 2009 00:04:42 +0100 Subject: strange packet loss In-Reply-To: References: Message-ID: <0AEAB2C1-6165-495E-ACA3-6E03509BF2BD@gmail.com> The good sequence of events looks like this. Note tcp_remain and tcp_deliver (inet_drv.c) after the call to tcp_recv --- 0 -> tcp_inet_commandv tcp_inet_commandv (0x1006E69B0, 0x7FFF5FBFE890, 0x1004005C0) 0 -> tcp_inet_drv_input tcp_inet_drv_input (0x1006E69B0, 0xB, 0x100061A64) 0 -> tcp_recv tcp_recv(0x1006E69B0, 0x0, 0x0) 0 -> recvfrom recvfrom(0xB, 0x1006AD470, 0x5B4) 0 <- recvfrom recvfrom = 17 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 00 03 41 43 4b 7f 00 00 00 00 00 00 00 00 00 00 ..ACK........... 0 -> tcp_remain tcp_remain(0x1006E69B0, 0x7FFF5FBFE74C, 0x5) 0 <- tcp_remain tcp_remain = 144 0 -> tcp_deliver tcp_deliver (0x1006E69B0, 0x5, 0x3) 0 -> tcp_clear_input tcp_clear_input (0x1006E69B0, 0x10051BF00, 0x7FFF5FBFE568) 0 <- tcp_clear_input tcp_clear_input = 88 --- The bad sequence of events looks like this: --- 1 -> tcp_inet_commandv tcp_inet_commandv (0x1025294D8, 0x7FFF5FBFE890, 0x1004005C0) 0 -> tcp_inet_ctl tcp_inet_ctl (0x1025294D8, 0x7, 0x10029F028) 0 -> tcp_inet_commandv tcp_inet_commandv (0x1025294D8, 0x7FFF5FBFE890, 0x1004005C0) 0 -> tcp_inet_drv_input tcp_inet_drv_input (0x1025294D8, 0x25C, 0x100061A64) 0 -> tcp_recv tcp_recv(0x1025294D8, 0x0, 0x0) 0 -> recvfrom recvfrom(0x25C, 0x1006AD491, 0x4124) 0 <- recvfrom recvfrom = 17 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 00 03 41 43 4b 76 65 6e 74 73 22 2c 22 65 76 65 ..ACKvents","eve 0 <- tcp_recv tcp_recv = 198 0 <- tcp_inet_drv_input tcp_inet_drv_input = 132 --- I'm still investigating but it looks like the TCP driver wants to read more data into the buffer, as opposed to deliver the 3 bytes received. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From ok@REDACTED Wed Aug 12 01:45:55 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 12 Aug 2009 11:45:55 +1200 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> Message-ID: I'd just like to say that comparing the Erlang on-line documentation with typical JavaDoc -- including stuff from Sun -- makes me pathetically grateful for Erlang. I keep on pointing people at the R documentation for a great example. One thing which R shares with Pop-11 is *examples* which you can actually run. This is conspiciously lacking in JavaDoc, but could be supported by Erlang. In R, where > is the prompt > ?lm brings up a "man page" for the lm function (fits linear models). There's some example code at the bottom showing what it's like to use it. > example(lm) runs that example code in the REPL. There is a standard tool-supported R process for building a package for distribution. One step in that is automatically checking that the examples work. By the way, using information retrieval engines (locally) is a FINE way to navigate manuals. A few years ago our 3rd-year software engineering students were given as their project to write FTFM "Find The F* Manual", doing just this with the Linux man pages. Once they had done it. they found it very useful. We have our own research IR engine (it changes all the time, and students frequently break it, so don't ask). I've heard people speak well of ht://Dig (http://htdig.sourceforge.net/). It hasn't been updated for a while, but there are other free engines out there, like Zettair. The Erlang man pages are about 5 MB of lightly marked up text. The HTML pages are about 31 MB. They include more documents and are more verbosely marked up. By the standards of IR, these document collections are *tiny*. From dave.pawson@REDACTED Wed Aug 12 07:44:02 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Wed, 12 Aug 2009 06:44:02 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> Message-ID: <711a73df0908112244k4dcbe08dtf5daaa1bc1059173@mail.gmail.com> Lots of acronyms there Richard? 2009/8/12 Richard O'Keefe : > I'd just like to say that comparing the Erlang on-line > documentation with typical JavaDoc -- including stuff > from Sun -- makes me pathetically grateful for Erlang. I'm certainly not complaining about it. My 2 cents worth, for a newcomer to X, the documentation is as important if not more so than X. > > I keep on pointing people at the R documentation for > a great example. Is that a module? An application? Any URL please. > By the way, using information retrieval engines (locally) > is a FINE way to navigate manuals. ?A few years ago our > 3rd-year software engineering students were given as their > project to write FTFM "Find The F* Manual", doing just this > with the Linux man pages. ?Once they had done it. they found > it very useful. Could you give a thumbnail of FTFM please? What is it trying to find? Documentation on function X or 'something to give me http access in Erlang' etc? > > We have our own research IR engine (it changes all the time, > and students frequently break it, so don't ask). ?I've heard > people speak well of ht://Dig (http://htdig.sourceforge.net/). > It hasn't been updated for a while, but there are other free > engines out there, like Zettair. Searching on plain text or ... specially formatted content? Lucene class of application? htdig sounds not dissimilar to Lucene. > > The Erlang man pages are about 5 MB of lightly marked up text. > The HTML pages are about 31 MB. ?They include more documents > and are more verbosely marked up. ?By the standards of IR, > these document collections are *tiny*. Yes, but so far I'm finding the content quite hard to present in a comprehensive way without becoming cumbersome. Working with them is easy. They are generally well marked up. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Wed Aug 12 07:55:59 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Wed, 12 Aug 2009 06:55:59 +0100 Subject: Accreditation statement, on documentation Message-ID: <711a73df0908112255hbeaeaf5x19c0b36929ff0321@mail.gmail.com> I asked about an accreditation statement. This was the reply. Looks good to me. Any comments? Noted, the reference to code and not documentation? Wonder if Ericsson need telling about that? regards DaveP > Current copyright says > > ? ?The contents of this file are subject to the Erlang Public License, > ? ? ?Version 1.1, (the "License"); you may not use this file except in > ? ? ?compliance with the License. You should have received a copy of the > ? ? ?Erlang Public License along with this software. If not, it can be > ? ? ?retrieved online at http://www.erlang.org/. > > ? ? ?Software distributed under the License is distributed on an "AS IS" > ? ? ?basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See > ? ? ?the License for the specific language governing rights and limitations > ? ? ?under the License. > > ? ? > > I'm looking for something to add to my 'copy' that > says hey, this is accredited to Ericsson > or 'source accredited to Ericsson. > > Any suggested phrasing please? Maybe: "Modifications to this documentation file originally developed by Ericsson were made by Contributor Dave Pawson, Copyright 2009, and are licensed subject to the terms of the Erlang Public License." Section 3.5 of the License provides in relevant part: "If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A." ?"Contributor" is capitalized because it is a defined term in the License. The critical step seems to be adding the information to the end of Exhibit A of the Erlang Public License. Somewhat confusing because the license by its own terms applies only to executable and source code, not to documentation. ?But given the language in the documentation saying that it's subject to the EPL, my guess is that a judge would try to make some sense out of the situation rather than declaring the grant of rights void. Hope this helps. If you'd like me to remodel the suggested language, just let me know. -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From raimo+erlang-questions@REDACTED Wed Aug 12 09:19:33 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 12 Aug 2009 09:19:33 +0200 Subject: [erlang-questions] SMP support in OpenBSD In-Reply-To: References: Message-ID: <20090812071933.GA20338@erix.ericsson.se> On Fri, Aug 07, 2009 at 11:20:56PM +0400, Nikolay Epifanov wrote: > Hi, > > I couldn't find any clear answer to whether Erlang supports SMP in OpenBSD > or not. > On starting it prints: > > $ erl > Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:4:4] [rq:4] > [async-threads:0] [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> > > But when I run test program only one beam.smp is started and maximum cpu > load I can get is 100% total. It can be as a sum of load of 2 cores (for > example 72% on one of them and 28% on the other) or 100% on a one core only > leaving 3 other idle. Load jumps from on core to another but in total it > keeps under 100%. Running erl with "-smp enable" and/or various "+S" didn't > change anything. > > Is SMP supported in OpenBSD? And if not: is it planned to implement it? Put pressure on the OpenBSD folks: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/45020 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rtrlists@REDACTED Wed Aug 12 10:27:11 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 12 Aug 2009 09:27:11 +0100 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: Message-ID: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> On Tue, Aug 11, 2009 at 8:24 PM, Sergey Samokhin wrote: > Hello! > > Currently I'm using mesia to store detailed session information of > each user my system serves. > > What worries me a bit is that as soon as my code gets into heavy load > in production and the number of transactions increases, performance of > mnesia might become an issue. Don't know exactly how heavy the load > will be, but I want my system to be ready for a few thousand of > transactions per second (with at least two machines involved in > replication). > Lots of unknown sentiment in that paragraph. Why are you looking for an alternative technology if you don't even know that your current one is insufficient? I would recommend doing some measurements against your system. Creating some form of stress test for your system will cost you as much as investigating lots of funky new stuff. And then you will have some actual numbers to compare and contrast. Additionally, mnesia very helpfully tells you if it is starting to get "overloaded". Robby From ulf.wiger@REDACTED Wed Aug 12 11:48:22 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 12 Aug 2009 11:48:22 +0200 Subject: avoiding overloading mnesia Message-ID: <4A828FE6.2020007@erlang-consulting.com> There are some reoccuring themes when it comes to mnesia: 1 Mnesia handles partitioned networks poorly 2 Mnesia doesn't scale 3 Stay away from transactions I've argued that Mnesia provides the tools to handle [1], and that most DBMSs that guarantee transaction-level consistency are hard-pressed to do better. A few offer functionality (e.g. MySQL Cluster's Arbitrator) that could be added on top of the basic functionality provided by Mnesia. DBMSs that offer 'Eventual consistency' may fare better. OTOH, one should really think about what the consistency requirements of the application are, and pick a DBMS that aims for that level. Regarding [2], there are examples of Mnesia databases that have achieved very good scalability. It is not the best regarding writes/second to persistent storage, but as with [1], think about what your requirements are. Tcerl, just to name an example, gives much better write throughput, but requires you to explicitly flush to disk. Chances are that your data loss will be much greater if you suffer e.g. a power failure. Don't take this as criticism of tcerl, but think about what your recovery requirements are. I am very wary about [3], mainly because I've seen many abuses of dirty operations, and observed that many who use dirty updates do it just because "it has to be fast", without having measured performance using transactions, or thought about what they give up when using dirty updates. In some cases, transactions can even be faster than dirty. This is mainly true if you are doing batch updates on a table with many replicas. With dirty, you will replicate once for each write, whereas a transaction will replicate all changes in the commit message. Taking a table lock will more or less eliminate the locking overhead in this case, and sticky locks can make it even cheaper. Apart from the obvious problems with dirty writes (no concurrency protection above object-level atomicity, no guarantee that the replicas will stay consistent), there is also a bigger problem of overload. If you have a write-intensive system, and most writes take place from one node, and are replicated to one or more others, consider that the replication requests all go through the mnesia_tm process on the remote node, while the writers perform the 'rpc' from within their own process. Thus, if you have thousands of processes writing dirty to a table, the remote mnesia_tm process(es) may well become swamped. This doesn't happen as easily with transactions, since all processes using transactions also have to go through their local mnesia_tm. One thing that can be done to mitigate this is to use sync_dirty. This will cause the writer to wait for the remote mnesia_tm process(es) to reply. If you have some way of limiting the number of writers, you ought to be able to protect against this kind of overload. My personal preference is to always start with transactions, until they have proven inadequate. Most of the time, I find that they are just fine, but YMMV. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From joelr1@REDACTED Wed Aug 12 13:43:59 2009 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 12 Aug 2009 12:43:59 +0100 Subject: strange packet loss (solved, dtrace is your friend!) In-Reply-To: <0AEAB2C1-6165-495E-ACA3-6E03509BF2BD@gmail.com> References: <0AEAB2C1-6165-495E-ACA3-6E03509BF2BD@gmail.com> Message-ID: <622B357F-44DA-4BAC-B6AA-DB795BD8C84C@gmail.com> I solved this issue with the help of dtrace and thought I'd log the troubleshooting process for posterity. As I suspected, it was all my own fault. I'm on Mac OSX Snow Leopard but it should work on Leopard just as well. Solaris may require a few tweaks. I used tcpdump at first to make sure "lost" packets were getting to the receiver, e.g. --- 17:04:19.009795 IP (tos 0x0, ttl 64, id 40175, offset 0, flags [DF], proto TCP (6), length 57, bad cksum 0 (->9fcd)!) localhost.us-cli > localhost.47835: Flags [P.], cksum 0xfe2d (incorrect -> 0x7df6), seq 1:6, ack 40, win 65535, options [nop,nop,TS val 960438746 ecr 960438746], length 5 0x0000: 4500 0039 9cef 4000 4006 0000 7f00 0001 E..9..@REDACTED@....... 0x0010: 7f00 0001 1f92 badb 7b0a ad1e fc66 b940 ........{....f.@ 0x0020: 8018 ffff fe2d 0000 0101 080a 393f 21da .....-......9?!. 0x0030: 393f 21da 0003 4143 4b 9?!...ACK --- I then used dtruss to look at the system calls and noticed that Erlang used recvfrom to receive the packets. I proceeded to use dapptrace to look at the function calls and discovered tcp_recv. A simple grep located tcp_recv in the inet driver (erts/emulator/drivers/common/ inet_drv.c). I whipped out a custom dtrace script to dump the buffer populated by recvfrom as well as to look at the i_remain field of the tcp_descriptor structure. i_remain is what controls how much data there's to read. Notice in this output that there are 0 bytes remaining to read. --- 0 -> tcp_recv tcp_recv(0x1006E69B0, 0x0, 0x0), i_remain = 0 0 -> recvfrom recvfrom(0xB, 0x1006AD470, 0x5B4) 0 <- recvfrom recvfrom = 17 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 00 03 41 43 4b 7f 00 00 00 00 00 00 00 00 00 00 ..ACK........... --- There are bytes remaining to read when a "lost" packet gets into Erlang. --- 0 -> tcp_recv tcp_recv(0x1025C42E8, 0x0, 0x0), i_remain = 16706 0 -> recvfrom recvfrom(0x75B, 0x1006AD473, 0x4142) 0 <- recvfrom recvfrom = 17 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 00 03 41 43 4b 00 00 00 00 00 00 00 00 e5 73 c1 ..ACK.........s. --- Searching dtrace output from receives on the same socket (0x75B), I saw an ACK previously received without the 2-byte length prefix. --- -> tcp_recv tcp_recv(0x1025C42E8, 0x0, 0x0), i_remain = 0 1 -> recvfrom recvfrom(0x75B, 0x1006AD470, 0x5B4) 1 < - recvfrom recvfrom = 17 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 41 43 4b 43 4b 7f 00 00 00 00 00 00 00 00 00 00 ACKCK........... --- My server sent ACK without the size prefix, i.e. {packet, 0} and Erlang on the client size interpreted "AC" as the 2-byte packet size since the client is in {packet, 2} mode. Erlang then proceeded to gather network packets to reach the 16707 byte target and this looked like packet loss on the client side. --- <> = <<16#41, 16#43>>. <<"AC">> Size. 16707 --- Finally, here's the dtrace script that helped me take my foot out of my own mouth. --- #pragma D option flowindent typedef struct { char inet[400]; int high; int low; int send_timeout; int send_timeout_close; int busy_on_send; int i_bufsz; char* i_buf; char* i_ptr; char* i_ptr_start; int i_remain; int tcp_add_flags; int http_state; void *multi_first; void *multi_last; void *mtd; } tcp_descriptor; pid$target::recvfrom:entry { self->ptr = arg1; printf("%s(0x%X, 0x%X, 0x%X)\n", probefunc, arg0, arg1, arg2); } pid$target::recvfrom:return { printf("%s = %d\n", probefunc, (int)arg0); tracemem(copyin(self->ptr, (int)arg0), 16); } pid$target::tcp_recv:entry { self->desc = copyin(arg0, sizeof(tcp_descriptor)); printf("%s(0x%X, 0x%X, 0x%X), i_remain = %d\n", probefunc, arg0, arg1, arg2, ((tcp_descriptor *)self->desc)->i_remain); } --- I cheated by grabbing the size of 'struct inet_descriptor' in gdb (400 bytes on x86-64) and defining unessential pointers as 'void *'. Note my use of 'tracemem' to dump memory, 'copyin' to move memory into the local memory space (dtrace runs in the kernel) and, finally, the casting to 'tcp_descriptor *' to grab the i_remain field. Why the mucking about with packet size? This particular server handles flash connections. On the one hand, Flash doesn't know about {packet, 2} and on the other hand the only thing that Flash does that's out of programmer control is request the policy file. The server starts with {packet, 0} and looks for <<"", 0>>, sent automatically by browser Flash. Once Flash control is back to the programmer, <<255, 255, 255, 255>> is sent to switch the server into {packet, 2}. I use a gen_fsm to distinguish between packet length of 65535 (<<255, 255>>) and the <<255, 255, 255, 255>> switching sequence above. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From dave.pawson@REDACTED Wed Aug 12 15:01:09 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Wed, 12 Aug 2009 14:01:09 +0100 Subject: [erlang-questions] Erlang documentation cleanup (PREV: R13B01 modules, quick reference) In-Reply-To: <4A811889.4040705@erlang-consulting.com> References: <711a73df0908100527v40421e12x87d70497d72611ac@mail.gmail.com> <4A81102F.9050703@erlang-consulting.com> <711a73df0908102352r1efa974bsf611da87304c474@mail.gmail.com> <4A811889.4040705@erlang-consulting.com> Message-ID: <711a73df0908120601l46577f0g56c14f6e1c6ab6b1@mail.gmail.com> 2009/8/11 Mazen Harake : I've answered some of the 'I want' list See http://www.dpawson.co.uk/erlang/ Updated both modules and functions. Now html (hence bigger) both now have tocs and functions now link to formal docs. Copyright statement included and modifications statement added. HTH -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From steven.charles.davis@REDACTED Wed Aug 12 18:45:01 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 12 Aug 2009 09:45:01 -0700 (PDT) Subject: avoiding overloading mnesia In-Reply-To: <4A828FE6.2020007@erlang-consulting.com> References: <4A828FE6.2020007@erlang-consulting.com> Message-ID: I, for one, am very grateful that Ulf has taken the time to provide this clarification. I have suspected for a while that many concerns voiced here over mnesia performance were not properly grounded. /sd From paul-trapexit@REDACTED Wed Aug 12 19:08:22 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 12 Aug 2009 10:08:22 -0700 (PDT) Subject: [erlang-questions] avoiding overloading mnesia In-Reply-To: <4A828FE6.2020007@erlang-consulting.com> References: <4A828FE6.2020007@erlang-consulting.com> Message-ID: On Wed, 12 Aug 2009, Ulf Wiger wrote: > Regarding [2], there are examples of Mnesia databases that > have achieved very good scalability. It is not the best > regarding writes/second to persistent storage, but as with > [1], think about what your requirements are. Tcerl, just > to name an example, gives much better write throughput, but > requires you to explicitly flush to disk. Chances are that > your data loss will be much greater if you suffer e.g. > a power failure. Don't take this as criticism of tcerl, but > think about what your recovery requirements are. Totally accurate. In particular we developed tcerl for a system that runs distributed Mnesia on EC2. When you are using Mnesia in distributed mode you get a fresh copy of every table on startup by default, so trading off local consistency across erlang VM crashes for speed was a good choice. (In addition, on EC2, if you lose an entire instance, the local drive state is not recoverable anyway). So that's an example of what Ulf is talking about, thinking about your recovery requirements. -- p p.z. Tokyocabinet has transaction support but I haven't done the work to integrate it into tcerl. I'm such an EC2 fan, it just hasn't come up. From prikrutil@REDACTED Wed Aug 12 21:47:51 2009 From: prikrutil@REDACTED (Sergey Samokhin) Date: Wed, 12 Aug 2009 12:47:51 -0700 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> Message-ID: Hello. > Lots of unknown sentiment in that paragraph. Why are you looking for an > alternative technology if you don't even know that your current one is > insufficient? Don't get me wrong: I have already done some measurements and found mnesia *quite efficient* for the near future. What I'm trying to find out by posting messages here are other possible "routes to escape" if things go wrong with mnesia (ok, I may be too prudent). It's always a good idea to take into account more than one way to solve a problem. The more ways to solve a problem you have, the better one you end up with will be. So, I've decided to ask what other dbs people here are using =) Soon I'm going make a list of document oriented and Key-Value db with bindings for Erlang and post it in this thread. -- Sergey Samokhin From ulf.wiger@REDACTED Wed Aug 12 22:19:09 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 12 Aug 2009 22:19:09 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> Message-ID: <4A8323BD.4070001@erlang-consulting.com> If you are using disc_copies, I think that thousands of writes/sec is attainable. Personally, I think that disc_only copies seldom have a place nowadays, since they are limited to 2 GB, and 64-bit Erlang allows you to go way beyond that limit with disc_copies and good performance. There are some things to think about when going to 64 bit. The main rule of thumb is that the initial switch will nearly double the memory usage, unless you are using binaries heavily. After that, you can just keep growing. I once tested disc_copies up to about 13 GB on a 16 GB machine. Performance was excellent. http://erlang.org/pipermail/erlang-questions/2005-November/017728.html BR, Ulf W Sergey Samokhin wrote: > Hello. > >> Lots of unknown sentiment in that paragraph. Why are you looking for an >> alternative technology if you don't even know that your current one is >> insufficient? > > Don't get me wrong: I have already done some measurements and found > mnesia *quite efficient* for the near future. What I'm trying to find > out by posting messages here are other possible "routes to escape" if > things go wrong with mnesia (ok, I may be too prudent). > > It's always a good idea to take into account more than one way to > solve a problem. The more ways to solve a problem you have, the better > one you end up with will be. > > So, I've decided to ask what other dbs people here are using =) Soon > I'm going make a list of document oriented and Key-Value db with > bindings for Erlang and post it in this thread. > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From dizzyd@REDACTED Wed Aug 12 22:28:37 2009 From: dizzyd@REDACTED (Dave Smith) Date: Wed, 12 Aug 2009 14:28:37 -0600 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: <4A8323BD.4070001@erlang-consulting.com> References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> Message-ID: On Wed, Aug 12, 2009 at 2:19 PM, Ulf Wiger wrote: > > Personally, I think that disc_only copies seldom have a > place nowadays, since they are limited to 2 GB, and > 64-bit Erlang allows you to go way beyond that limit with > disc_copies and good performance. I apologize if this is a stupid question, but I was under the impression that using mnesia w/ disc_copies meant that your entire data set has to fit in RAM? For most large-scale datasets, even with a lot of RAM, that makes mnesia not really desirable as you'd get a low density of data-to-node (i.e. I can put 1 TB of disk in a node but probably can't afford that much RAM). D. From kunthar@REDACTED Thu Aug 13 00:22:18 2009 From: kunthar@REDACTED (Kunthar) Date: Thu, 13 Aug 2009 01:22:18 +0300 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> Message-ID: <9a09ca9a0908121522r64e5122bs2e112ac623ec1da5@mail.gmail.com> People newly coming to Erlang area mostly use dedicated hosting solutions. Some other well formed corporations could afford to use some ultra mega machines with several megabaytes of ram. But the naked truth is reasonable dedicated solution starts with 1GB RAM and goes up to 8GB ram. More then this means additional trouble. Not only money but trouble. You can prove yourself this, if you quickly check the hosting companies around the world. RAM is not cheap enough. CPU is not problem but ram is a dead end. Thanks to Basho guys and all others that they can see the the real world and they provide a real solutions. dets is not efficient for some problem domains, for example if you need to store 2GB/sec data, you're simply dead. I really would like to see someone could organise this silly Ericcson open source soap and create high traffic open source environment. And then i really would like to see, dets evolved like Dynamo to solve more problems better then others even Dynamo. For now, we have to look other choices if the bill is not fit to our pocket. Peace \|/ Kunthar On Wed, Aug 12, 2009 at 11:28 PM, Dave Smith wrote: > On Wed, Aug 12, 2009 at 2:19 PM, Ulf > Wiger wrote: >> >> Personally, I think that disc_only copies seldom have a >> place nowadays, since they are limited to 2 GB, and >> 64-bit Erlang allows you to go way beyond that limit with >> disc_copies and good performance. > > I apologize if this is a stupid question, but I was under the > impression that using mnesia w/ disc_copies meant that your entire > data set has to fit in RAM? For most large-scale datasets, even with a > lot of RAM, that makes mnesia not really desirable as you'd get a low > density of data-to-node (i.e. I can put ?1 TB of disk in a node but > probably can't afford that much RAM). > > D. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From ulf.wiger@REDACTED Thu Aug 13 01:30:29 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 13 Aug 2009 01:30:29 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> Message-ID: <4A835095.2090002@erlang-consulting.com> Dave Smith wrote: > On Wed, Aug 12, 2009 at 2:19 PM, Ulf > Wiger wrote: >> Personally, I think that disc_only copies seldom have a >> place nowadays, since they are limited to 2 GB, and >> 64-bit Erlang allows you to go way beyond that limit with >> disc_copies and good performance. > > I apologize if this is a stupid question, but I was under the > impression that using mnesia w/ disc_copies meant that your entire > data set has to fit in RAM? For most large-scale datasets, even with a > lot of RAM, that makes mnesia not really desirable as you'd get a low > density of data-to-node (i.e. I can put 1 TB of disk in a node but > probably can't afford that much RAM). I was just pointing out that given the 2 GB limit of dets, disc_copies is almost always the better option. Your entire data set doesn't have to fit in RAM on a single node. Using table fragmentation, you can scale further. Still, mnesia was not designed for TB databases, and if that is what you need, you need to look for other solutions. OTOH, the ODBC library allows you to connect to such DBMSs. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From ulf.wiger@REDACTED Thu Aug 13 01:50:42 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 13 Aug 2009 01:50:42 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: <9a09ca9a0908121522r64e5122bs2e112ac623ec1da5@mail.gmail.com> References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> <9a09ca9a0908121522r64e5122bs2e112ac623ec1da5@mail.gmail.com> Message-ID: <4A835552.7040202@erlang-consulting.com> Kunthar wrote: > > Thanks to Basho guys and all others that they can see the the real > world and they provide a real solutions. > dets is not efficient for some problem domains, for example if you > need to store 2GB/sec data, you're simply dead. > I really would like to see someone could organise this silly Ericcson > open source soap and create high traffic open source environment. You are of course free to move to any other solution, or interface with any other database out there. Mnesia may not meet your needs, but seeing as you don't have to pay a dime for it, and Ericsson does not force you to use it, I fail to see how this should inconvenience you much. The basho guys, the Dukes of Erl, et al, do marvellous work, but focus on the stuff they need, just like Ericsson does. That's a good strategy if you want to stay in business... The wonderful thing about Open Source is that they let you share the fruits of their labour (and expenses!). If it does what you need, great. Otherwise, you are free to search for some other community that offers you better components for free, or perhaps even spend some money on some of the many commercially available components out there. You can even do all of the above at the same time. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From nate@REDACTED Thu Aug 13 02:05:40 2009 From: nate@REDACTED (Nate Murray) Date: Wed, 12 Aug 2009 17:05:40 -0700 Subject: ttb.erl / observer - process_info only effective one-way Message-ID: <9c1993f20908121705q4ba01af2g9f258faaa51cffcc@mail.gmail.com> Hey guys, I'm just diving in to using ttb / observer.erl and I'm having a bit of trouble using it with gen_server. The Problem: `from` and `to` don't match. e.g. the trace contents resolves to: [{label, send}, {detail_level,40}, {from,<7070.77.0>}, {to,{<7070.65.0>,node2,'node@REDACTED'}}, {msg,{'$gen_cast',{etc}}}] Note that in `to` we properly receive a tuple due to the ttb:tracer option {process_info,true}. However in the `from` we have only a lowly pid. This causes the messages to have two targets rather than one. e.g. pid 7070.65.0 in the above example shows up in the logs as *both* {<7070.65.0>,node2,'node@REDACTED'} and <7070.65.0> . The Setup: ttb:tracer(node(), [{file,"trace/ttb"},{process_info,true}]), % ... ttb:p(Pid, [call,send]) MS1 = [{'_',[],[{return_trace},{message,{caller}}]}], % dbg:fun2ms(fun(_) -> return_trace(),message(caller()) end), ttb:tpl(gen_server, loop, MS1), % ... ttb:stop(), ttb:format("trace") An interesting fact is that if i set {process_info,false} then the pids *do* line up! I get the correct number of pids with no duplicates. The downside is I get only raw pid numbers and no registered names. Lack of registered names make it once again difficult to determine who is calling whom. Any thoughts on how to get process_info to work for both `from` and `to`? Nate From btolputt@REDACTED Wed Aug 12 23:53:29 2009 From: btolputt@REDACTED (Benjamin Tolputt) Date: Thu, 13 Aug 2009 07:53:29 +1000 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> Message-ID: <4A8339D9.7070809@bigpond.net.au> Dave Smith wrote: > I apologize if this is a stupid question, but I was under the > impression that using mnesia w/ disc_copies meant that your entire > data set has to fit in RAM? For most large-scale datasets, even with a > lot of RAM, that makes mnesia not really desirable as you'd get a low > density of data-to-node (i.e. I can put 1 TB of disk in a node but > probably can't afford that much RAM). > This was also my impression and is the reason I have avoided Mnesia to date for anything but small, in-memory distributed databases (such as keeping web session data and the like). I would love to be told I am wrong here! -- Regards, Benjamin Tolputt Analyst Programmer From btolputt@REDACTED Wed Aug 12 23:53:14 2009 From: btolputt@REDACTED (Benjamin Tolputt) Date: Thu, 13 Aug 2009 07:53:14 +1000 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> <4A8323BD.4070001@erlang-consulting.com> Message-ID: <4A8339CA.5020704@bigpond.net.au> Dave Smith wrote: > I apologize if this is a stupid question, but I was under the > impression that using mnesia w/ disc_copies meant that your entire > data set has to fit in RAM? For most large-scale datasets, even with a > lot of RAM, that makes mnesia not really desirable as you'd get a low > density of data-to-node (i.e. I can put 1 TB of disk in a node but > probably can't afford that much RAM). > This was also my impression and is the reason I have avoided Mnesia to date for anything but small, in-memory distributed databases (such as keeping web session data and the like). I would love to be told I am wrong here! -- Regards, Benjamin Tolputt Analyst Programmer Mob: 0417 456 505 Email: btolputt@REDACTED This email and any files transmitted with it are confidential to the intended recipient and may be privileged. If you have received this email inadvertently or you are not the intended recipient, you may not disseminate, distribute, copy or in any way rely on it. Further, you should notify the sender immediately and delete the email from your computer. Whilst we have taken precautions to alert us to the presence of computer viruses, we cannot guarantee that this email and any files transmitted with it are free from such viruses. From caio.ariede@REDACTED Thu Aug 13 15:26:23 2009 From: caio.ariede@REDACTED (caio ariede) Date: Thu, 13 Aug 2009 10:26:23 -0300 Subject: Stand alone Erlang on Windows Message-ID: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> Hello, Can I make a stand alone executable from an Erlang .beam? I saw here: http://www.sics.se/~joe/sae.html that there is a program called elink, but it appears to be a little out dated, and there is a note: "This does not work yet". Thanks in advance. Caio Ariede http://caioariede.com/ From erlang@REDACTED Thu Aug 13 17:06:12 2009 From: erlang@REDACTED (Dominic Williams) Date: Thu, 13 Aug 2009 17:06:12 +0200 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> Message-ID: <4A842BE4.9080002@dominicwilliams.net> Hello Caio, caio ariede a ?crit : > Hello, > > Can I make a stand alone executable from an Erlang .beam? > > I saw here: http://www.sics.se/~joe/sae.html that there is a program called > elink, but it appears to be a little out dated, and there is a note: "This > does not work yet". This is covered in the FAQ: http://www.erlang.org/faq/how_do_i.html#5.20 The short answer is you can't. Regards, Dominic Williams http://dominicwilliams.net > > Thanks in advance. > > Caio Ariede > http://caioariede.com/ > From caio.ariede@REDACTED Thu Aug 13 18:29:07 2009 From: caio.ariede@REDACTED (caio ariede) Date: Thu, 13 Aug 2009 13:29:07 -0300 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <4A842BE4.9080002@dominicwilliams.net> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> Message-ID: <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> Oh, thanks! Just enjoying the question with another two: Can be .beam reverse engineered? What's the best way to distribute Erlang powered, proprietary and non-proprietary, softwares? Caio Ariede http://caioariede.com/ On Thu, Aug 13, 2009 at 12:06 PM, Dominic Williams < erlang-dated-1250607977.c0c234@REDACTED> wrote: > Hello Caio, > > caio ariede a ?crit : > >> Hello, >> >> Can I make a stand alone executable from an Erlang .beam? >> >> I saw here: http://www.sics.se/~joe/sae.htmlthat there is a program called >> elink, but it appears to be a little out dated, and there is a note: "This >> does not work yet". >> > > This is covered in the FAQ: > > http://www.erlang.org/faq/how_do_i.html#5.20 > > The short answer is you can't. > > Regards, > > Dominic Williams > http://dominicwilliams.net > > > >> Thanks in advance. >> >> Caio Ariede >> http://caioariede.com/ >> >> From dmercer@REDACTED Thu Aug 13 18:51:39 2009 From: dmercer@REDACTED (David Mercer) Date: Thu, 13 Aug 2009 11:51:39 -0500 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> Message-ID: Related question: does Erlang on Windows install anything outside of the Program Files\erl directory? That is, could you archive the entire Erlang directory structure and package it in a single executable that simply unpacked the entire directory structure somewhere and ran erl.exe? > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of caio ariede > Sent: Thursday, August 13, 2009 11:29 AM > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Stand alone Erlang on Windows > > Oh, thanks! > > Just enjoying the question with another two: > > Can be .beam reverse engineered? > > What's the best way to distribute Erlang powered, proprietary and > non-proprietary, softwares? > > Caio Ariede > http://caioariede.com/ > > > On Thu, Aug 13, 2009 at 12:06 PM, Dominic Williams < > erlang-dated-1250607977.c0c234@REDACTED> wrote: > > > Hello Caio, > > > > caio ariede a ?crit : > > > >> Hello, > >> > >> Can I make a stand alone executable from an Erlang .beam? > >> > >> I saw here: > http://www.sics.se/~joe/sae.htmlthat > there is a program called > >> elink, but it appears to be a little out dated, and there is a note: > "This > >> does not work yet". > >> > > > > This is covered in the FAQ: > > > > http://www.erlang.org/faq/how_do_i.html#5.20 > > > > The short answer is you can't. > > > > Regards, > > > > Dominic Williams > > http://dominicwilliams.net > > > > > > > >> Thanks in advance. > >> > >> Caio Ariede > >> http://caioariede.com/ > >> > >> From chsu79@REDACTED Thu Aug 13 19:32:10 2009 From: chsu79@REDACTED (Christian) Date: Thu, 13 Aug 2009 19:32:10 +0200 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> Message-ID: On Thu, Aug 13, 2009 at 18:29, caio ariede wrote: > Can be .beam reverse engineered? No more than JVM or x86 machine code can be. However, if beams are made to include debug information they can contain the entire abstract syntax tree for the source. This is very useful to include so you know exactly what the customer is running if a bug is found. However, since you might not want the Chinese to steal your source code and make a duplicate in just 3 minutes, Erlang has a feature to encrypt the debug-information so that you can still go on-site and get access to the debug information with your secret key. But the customer does not have that peek-a-boo-ability. > > What's the best way to distribute Erlang powered, proprietary and > non-proprietary, softwares? The best way is to have a product that is so awesome that people give you money even though you have fully it open source and receive patches to make it even more awestruck. Nobody can argue with that. From joelr1@REDACTED Thu Aug 13 21:05:15 2009 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 13 Aug 2009 20:05:15 +0100 Subject: 500k user simulation on EC2 Message-ID: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> I'm creating a simulation on EC2 where I need to launch 500k clients. The clients need to connect to a cluster of servers, exchange packets, report latency and exit. I need to report the simulation as unsuccessful if a client fails and otherwise wait for all my clients to exit. I figured that I can make clients part of a simple_one_for_one supervisor. This way I can ensure that the simulation fails if at least one client fails. Would a supervisor have trouble with 500k pids on different nodes, though? Also, is there a way to have the supervisor exit once all the clients exit? I can't figure out a way to do this except for having a separate gen_server monitor clients and gather reported latencies. Any suggestions on how to best architect this? Thanks, Joel --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From vances@REDACTED Thu Aug 13 21:13:03 2009 From: vances@REDACTED (Vance Shipley) Date: Thu, 13 Aug 2009 15:13:03 -0400 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> Message-ID: <20090813191259.GA1171@h216-235-12-174.host.egate.net> On Thu, Aug 13, 2009 at 08:05:15PM +0100, Joel Reymont wrote: > Would a supervisor have trouble with 500k pids on different nodes, > though? Joel, The supervisor behavious doesn't really support distribution directly. There is a thread which starts here where we explored that a few years ago: http://erlang.org/pipermail/erlang-questions/2004-June/012534.html You can always build your own supervisors though. -- -Vance From joelr1@REDACTED Thu Aug 13 21:52:12 2009 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 13 Aug 2009 20:52:12 +0100 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <20090813191259.GA1171@h216-235-12-174.host.egate.net> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> <20090813191259.GA1171@h216-235-12-174.host.egate.net> Message-ID: <175CB350-6039-4F93-B69B-68A4BC682352@gmail.com> On Aug 13, 2009, at 8:13 PM, Vance Shipley wrote: > The supervisor behavious doesn't really support distribution directly. > There is a thread which starts here where we explored that a few years > ago: http://erlang.org/pipermail/erlang-questions/2004-June/ > 012534.html What's wrong with having the ad-hoc supervisor spawn something on the remote node, e.g. init([]) -> {ok, {_SupFlags = {simple_one_for_one, 1, ?MAX_TIME}, [ {undefined, {proc_lib, spawn, []}, temporary, 2000, worker, [] } ] } }. Wouldn't this be added to the local supervision tree? Thanks, Joel --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From vances@REDACTED Thu Aug 13 22:37:21 2009 From: vances@REDACTED (Vance Shipley) Date: Thu, 13 Aug 2009 16:37:21 -0400 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <175CB350-6039-4F93-B69B-68A4BC682352@gmail.com> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> <20090813191259.GA1171@h216-235-12-174.host.egate.net> <175CB350-6039-4F93-B69B-68A4BC682352@gmail.com> Message-ID: <20090813203720.GB1171@h216-235-12-174.host.egate.net> On Thu, Aug 13, 2009 at 08:52:12PM +0100, Joel Reymont wrote: > What's wrong with having the ad-hoc supervisor spawn something on the > remote node, e.g. [...] > Wouldn't this be added to the local supervision tree? It would but if the node goes down, or more likely the network between the nodes, the supervisor doesn't deal with these events. -- -Vance From baryluk@REDACTED Thu Aug 13 22:40:30 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 13 Aug 2009 22:40:30 +0200 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> Message-ID: <1250196031.29075.2.camel@sredniczarny> Dnia 2009-08-13, czw o godzinie 20:05 +0100, Joel Reymont pisze: > I'm creating a simulation on EC2 where I need to launch 500k clients. > The clients need to connect to a cluster of servers, exchange packets, > report latency and exit. > > I need to report the simulation as unsuccessful if a client fails and > otherwise wait for all my clients to exit. I figured that I can make > clients part of a simple_one_for_one supervisor. This way I can ensure > that the simulation fails if at least one client fails. > > Would a supervisor have trouble with 500k pids on different nodes, > though? Very big trouble. generic supervison have pid in list, just finding pid in list, and removing it will be disaster I think, and it will be gigantic and with lots of redundancy (same module names there). Try testing, and maybe change it to fast data structure. I would suggest taking OTP's supervisor source, and modifing it. And benchmarking it in the same time. Keep it simple and working. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From joelr1@REDACTED Thu Aug 13 22:58:54 2009 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 13 Aug 2009 21:58:54 +0100 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <1250196031.29075.2.camel@sredniczarny> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> <1250196031.29075.2.camel@sredniczarny> Message-ID: <9C573331-9E0C-45F5-ACDE-0D8DCC5F897F@gmail.com> On Aug 13, 2009, at 9:40 PM, Witold Baryluk wrote: > Very big trouble. generic supervison have pid in list, just > finding pid in list, and removing it will be disaster I think, > and it will be gigantic and with lots of redundancy (same module > names there). Try testing, and maybe change it to fast data structure. Actually, only the static children are kept in a list. The dynamic are kept in in a dict, i.e. a fast data structure. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From joelr1@REDACTED Thu Aug 13 23:01:23 2009 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 13 Aug 2009 22:01:23 +0100 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <1250196031.29075.2.camel@sredniczarny> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> <1250196031.29075.2.camel@sredniczarny> Message-ID: <74354394-CF3E-42AB-88E0-C496352DAAC8@gmail.com> On Aug 13, 2009, at 9:40 PM, Witold Baryluk wrote: > Very big trouble. generic supervison have pid in list, just > finding pid in list, and removing it will be disaster I think, > and it will be gigantic and with lots of redundancy (same module > names there). Try testing, and maybe change it to fast data structure. I meant to say that since I'm using dynamic children (simple_one_for_one), they will be kept in a dict and the whole thing should be fast as it is. --- Mac hacker with a performance bent http://www.linkedin.com/in/joelreymont From baryluk@REDACTED Thu Aug 13 23:31:17 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 13 Aug 2009 23:31:17 +0200 Subject: [erlang-questions] 500k user simulation on EC2 In-Reply-To: <74354394-CF3E-42AB-88E0-C496352DAAC8@gmail.com> References: <362884D1-34E6-497F-8A2E-1947C3571796@gmail.com> <1250196031.29075.2.camel@sredniczarny> <74354394-CF3E-42AB-88E0-C496352DAAC8@gmail.com> Message-ID: <1250199077.29075.5.camel@sredniczarny> Dnia 2009-08-13, czw o godzinie 22:01 +0100, Joel Reymont pisze: > On Aug 13, 2009, at 9:40 PM, Witold Baryluk wrote: > I meant to say that since I'm using dynamic children > (simple_one_for_one), > they will be kept in a dict and the whole thing should be fast as it is. Yes, you are right. Any way, i did not seen any benchmarks involving lots of children. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From vengeance.storm@REDACTED Fri Aug 14 02:36:49 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Fri, 14 Aug 2009 08:36:49 +0800 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> Message-ID: <841721380908131736q730b973fw59faedd2f5582573@mail.gmail.com> Hey watch your mouth! There are Chinese here. Pan, Xingzhi 2009/8/14 Christian > On Thu, Aug 13, 2009 at 18:29, caio ariede wrote: > > Can be .beam reverse engineered? > > No more than JVM or x86 machine code can be. However, if beams are > made to include debug information they can contain the entire abstract > syntax tree for the source. This is very useful to include so you know > exactly what the customer is running if a bug is found. > > However, since you might not want the Chinese to steal your source > code and make a duplicate in just 3 minutes, Erlang has a feature to > encrypt the debug-information so that you can still go on-site and get > access to the debug information with your secret key. But the customer > does not have that peek-a-boo-ability. > > > > > What's the best way to distribute Erlang powered, proprietary and > > non-proprietary, softwares? > > The best way is to have a product that is so awesome that people give > you money even though you have fully it open source and receive > patches to make it even more awestruck. Nobody can argue with that. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From ro4tub@REDACTED Fri Aug 14 04:01:50 2009 From: ro4tub@REDACTED (Oscar) Date: Fri, 14 Aug 2009 10:01:50 +0800 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> Message-ID: <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> hey man, Could you please give us any example about the Chinese steal source code? If not, please apologize it in this thread. Thank you, -Oscar Huang On Fri, Aug 14, 2009 at 1:32 AM, Christian wrote: > On Thu, Aug 13, 2009 at 18:29, caio ariede wrote: >> Can be .beam reverse engineered? > > No more than JVM or x86 machine code can be. However, if beams are > made to include debug information they can contain the entire abstract > syntax tree for the source. This is very useful to include so you know > exactly what the customer is running if a bug is found. > > However, since you might not want the Chinese to steal your source > code and make a duplicate in just 3 minutes, Erlang has a feature to > encrypt the debug-information so that you can still go on-site and get > access to the debug information with your secret key. But the customer > does not have that peek-a-boo-ability. > >> >> What's the best way to distribute Erlang powered, proprietary and >> non-proprietary, softwares? > > The best way is to have a product that is so awesome that people give > you money even though you have fully it open source and receive > patches to make it even more awestruck. Nobody can argue with that. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From chandrashekhar.mullaparthi@REDACTED Fri Aug 14 07:46:51 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 14 Aug 2009 06:46:51 +0100 Subject: Macro expansion Message-ID: Hi all, I need some help with passing command line parameters to the compiler. I have some macros in a module. I want to be able to pass the value for these macros at compile time as command line parameters. I'm using Makefiles which invoke 'erl -make'. How do I pass these macro values so that the compiler is able to extract them and compile the module? ta Chandru From kobergeek@REDACTED Fri Aug 14 09:20:00 2009 From: kobergeek@REDACTED (Felipe Kober) Date: Fri, 14 Aug 2009 01:20:00 -0600 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> Message-ID: no need to apologize. this feeling is widely known due to common violations of international patent law in china. i don't think it is a personal attack on you. it is summer, why take life so seriously? these are not code but we can all laugh together: http://icanhashappy.blogspot.com/2008/10/funny-chinese-knock-off-products.html Felipe. On Thu, Aug 13, 2009 at 8:01 PM, Oscar wrote: > hey man, > > Could you please give us any example about the Chinese steal source code? > If not, please apologize it in this thread. > > Thank you, > -Oscar Huang > > On Fri, Aug 14, 2009 at 1:32 AM, Christian wrote: >> On Thu, Aug 13, 2009 at 18:29, caio ariede wrote: >>> Can be .beam reverse engineered? >> >> No more than JVM or x86 machine code can be. However, if beams are >> made to include debug information they can contain the entire abstract >> syntax tree for the source. This is very useful to include so you know >> exactly what the customer is running if a bug is found. >> >> However, since you might not want the Chinese to steal your source >> code and make a duplicate in just 3 minutes, Erlang has a feature to >> encrypt the debug-information so that you can still go on-site and get >> access to the debug information with your secret key. But the customer >> does not have that peek-a-boo-ability. >> >>> >>> What's the best way to distribute Erlang powered, proprietary and >>> non-proprietary, softwares? >> >> The best way is to have a product that is so awesome that people give >> you money even though you have fully it open source and receive >> patches to make it even more awestruck. Nobody can argue with that. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From chsu79@REDACTED Fri Aug 14 09:39:52 2009 From: chsu79@REDACTED (Christian) Date: Fri, 14 Aug 2009 09:39:52 +0200 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> Message-ID: I'm sorry if anyone took offense personally. It is however a quite wide-spread directive from VCs that it is a very bad idea to let any Chinese company (actually, probably any company from developing economies) get access to intellectual property. It is how all developing economies have operated through history. Copy and under price until the industry is strong enough. I don't put much moral blame on it. From ttmrichter@REDACTED Fri Aug 14 09:51:58 2009 From: ttmrichter@REDACTED (ttmrichter@REDACTED) Date: Fri, 14 Aug 2009 07:51:58 +0000 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: Message-ID: <0016e64f80909f498f047115532f@google.com> You know, if ever there was any doubts as to why the #erlang-otp channel was made on Freenode, this thread should put said doubts to rest. From ckawatak@REDACTED Fri Aug 14 10:14:02 2009 From: ckawatak@REDACTED (Chiharu Kawatake) Date: Fri, 14 Aug 2009 17:14:02 +0900 Subject: [erlang-questions] erlang/python,ruby,.. interfaces on tcp In-Reply-To: <979D9774F91440009D70FD961F9B09D3@neon> References: <979D9774F91440009D70FD961F9B09D3@neon> Message-ID: <8033176c0908140114v1064efadx5a02f942c8c7e7f9@mail.gmail.com> I am also trying out the same approach as Mr. Rob Elsner does. I am using Apache Thrift to serialize and deserialize data. What I am doing to extend the transport layer of Thrift so that Thrift client (Erlang) and servers (C++) can communicate with RabbitMQ. As mentioned before, performance might not be really good. But I expect load-balancing and fault-tolerance by this approach, which are difficult by port drivers. Chiharu From vengeance.storm@REDACTED Fri Aug 14 10:16:44 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Fri, 14 Aug 2009 16:16:44 +0800 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> Message-ID: <841721380908140116m67538795m8495909202502f7d@mail.gmail.com> As a native Chinese (and a programmer) I am keenly aware on the intellectual property issue in my country. However this doesn't justify your behavior. All I can say is, I'm sorry for you if you still feel you didn't do anything wrong but if you're like that, let it be. Yeah maybe I'm being too serious (and maybe a little overreacting), but I hope you guys grow up and stop acting like that because this is a public mailing list about Erlang. I don't think users would love to see irrelevant and antipathetic topics brought here. So I'll stop bothering other users from this on, and I apologize for your precious time. Pan, Xingzhi 2009/8/14 Christian > I'm sorry if anyone took offense personally. It is however a quite > wide-spread directive from VCs that it is a very bad idea to let any > Chinese company (actually, probably any company from developing > economies) get access to intellectual property. It is how all > developing economies have operated through history. Copy and under > price until the industry is strong enough. I don't put much moral > blame on it. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From richardc@REDACTED Fri Aug 14 10:27:07 2009 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 14 Aug 2009 10:27:07 +0200 Subject: [erlang-questions] Macro expansion In-Reply-To: References: Message-ID: <4A851FDB.3050102@it.uu.se> Chandru wrote: > Hi all, > > I need some help with passing command line parameters to the compiler. > > I have some macros in a module. I want to be able to pass the value for > these macros at compile time as command line parameters. I'm using Makefiles > which invoke 'erl -make'. How do I pass these macro values so that the > compiler is able to extract them and compile the module? >From the documentation of make (the erlang module): the following Emakefile means that file1 shall be compiled with the options [debug_info,{i,"../foo"}], while all other files in the current directory shall be compiled with only the debug_info flag. {'file1',[debug_info,{i,"../foo"}]}. {'*',[debug_info]}. And from the documentation of the 'compile' module: {d,Macro} {d,Macro,Value} Defines a macro Macro to have the value Value. The default is true). /Richard From leap@REDACTED Fri Aug 14 10:40:59 2009 From: leap@REDACTED (Michael Turner) Date: Fri, 14 Aug 2009 08:40:59 +0000 Subject: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: Message-ID: >> What's the best way to distribute Erlang powered, proprietary and >> non-proprietary, softwares? > >The best way is to have a product that is so awesome that people give >you money even though you have fully it open source and receive >patches to make it even more awestruck. Nobody can argue with that. I can: I don't want to run "awestruck" software, I want to run *awesome* software. Last time I ran some "awestruck" software, I ended up having to reboot. Look, this was a serious question about packaging, not quality or, for that matter, open source ideology. And that should have been clear enough from the context. It's a question worthy of an answer. Moreover, it matters. I've heard it said that PHP began to beat out some other serious contenders for server-side web scripting *not* because it was clearly superior technology at the time, but simply because it was packaged for ease of installation. Packaging matters. Packaging on the world's most commonly used platform matters even more. (No, I don't count TRON-over-ARM in my camera as a "platform".) Windows is not going to vanish tomorrow. It's probably got another 15 years in it. Packaging Erlang-coded applications so that they seem to be regular full-fledged Windows apps might smack of treason to some, but it might also help push Erlang into the mainstream of programming practice. And I don't see how that hurts anybody here. So if somebody has an actual *helpful* answer to these sorts of questions, count me among the interested. After all, I want real users for what I write, and most of them will be on Windows, and I don't want to ask too much of them, or they will go away. "Write some awestruck software"? Not a helpful answer. We already have too much awestruck software; if anything Erlang is a (partial) solution to that problem. -michael turner From zheng.cuizh@REDACTED Fri Aug 14 11:02:52 2009 From: zheng.cuizh@REDACTED (Charles Cui) Date: Fri, 14 Aug 2009 17:02:52 +0800 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <841721380908140116m67538795m8495909202502f7d@mail.gmail.com> Message-ID: ??! On 09-8-14 ??4:16, "Xingzhi Pan" wrote: > As a native Chinese (and a programmer) I am keenly aware on the intellectual > property issue in my country. However this doesn't justify your behavior. > All I can say is, I'm sorry for you if you still feel you didn't do anything > wrong but if you're like that, let it be. > > Yeah maybe I'm being too serious (and maybe a little overreacting), but I > hope you guys grow up and stop acting like that because this is a public > mailing list about Erlang. I don't think users would love to see irrelevant > and antipathetic topics brought here. > > So I'll stop bothering other users from this on, and I apologize for your > precious time. > > Pan, Xingzhi > > > > 2009/8/14 Christian > >> I'm sorry if anyone took offense personally. It is however a quite >> wide-spread directive from VCs that it is a very bad idea to let any >> Chinese company (actually, probably any company from developing >> economies) get access to intellectual property. It is how all >> developing economies have operated through history. Copy and under >> price until the industry is strong enough. I don't put much moral >> blame on it. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> From ulf.wiger@REDACTED Fri Aug 14 11:04:05 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 14 Aug 2009 11:04:05 +0200 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: References: Message-ID: <4A852885.40109@erlang-consulting.com> Michael Turner wrote: >>> What's the best way to distribute Erlang powered, proprietary and >>> non-proprietary, softwares? >> The best way is to have a product that is so awesome that people give >> you money even though you have fully it open source and receive >> patches to make it even more awestruck. Nobody can argue with that. > > Look, this was a serious question about packaging, not quality or, for > that matter, open source ideology. And that should have been clear > enough from the context. It's a question worthy of an answer. > > Moreover, it matters. [...] There is no single "best" way. Historically, Erlang-based software have executed in closed clusters on proprietary platforms with a ton of software, of which perhaps half (sometimes more) has been erlang. Sometimes, it has made sense to have an erlang-centric packaging and release system, sometimes not. OTP has provided systools for more than a decade. It has a function called make_tar(), which is perfectly usable, if one is fine with first installing erlang, then unpacking and installing the application. Since some of the initial paying customers even ran Erlang on vxWorks, it was important that the packaging supported by Erlang/OTP was universal and highly portable. There have been several other attempts: - CEAN (http://cean.process-one.net/) - Erlware (http://www.erlware.org/) - SAE (initially by Joe Armstrong, now supported by OTP) - erlrc (http://dukesoferl.blogspot.com/2009/05/automatic-app-file-generation.html) BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From chandrashekhar.mullaparthi@REDACTED Fri Aug 14 11:15:46 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 14 Aug 2009 10:15:46 +0100 Subject: [erlang-questions] Macro expansion In-Reply-To: <4A851FDB.3050102@it.uu.se> References: <4A851FDB.3050102@it.uu.se> Message-ID: 2009/8/14 Richard Carlsson > Chandru wrote: > > Hi all, > > > > I need some help with passing command line parameters to the compiler. > > > > I have some macros in a module. I want to be able to pass the value for > > these macros at compile time as command line parameters. I'm using > Makefiles > > which invoke 'erl -make'. How do I pass these macro values so that the > > compiler is able to extract them and compile the module? > > From the documentation of make (the erlang module): > > the following Emakefile means that file1 shall be compiled with the > options [debug_info,{i,"../foo"}], while all other files in the > current directory shall be compiled with only the debug_info flag. > > {'file1',[debug_info,{i,"../foo"}]}. > {'*',[debug_info]}. > > And from the documentation of the 'compile' module: > > {d,Macro} > {d,Macro,Value} > Defines a macro Macro to have the value Value. The default is true). > Thanks Richard. I know about this feature, but I don't want to put the macro values in the Emakefile if I can help it. I want to be able to do 'erl -make' and then include the values for the macros on the command line. It seems to be possible, but I'm not able to figure out how I supply these on the command line. Chandru From dave.pawson@REDACTED Fri Aug 14 11:34:07 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Fri, 14 Aug 2009 10:34:07 +0100 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <4A852885.40109@erlang-consulting.com> References: <4A852885.40109@erlang-consulting.com> Message-ID: <711a73df0908140234r6f117d9cx8e63ecbe2d05948d@mail.gmail.com> 2009/8/14 Ulf Wiger : > Michael Turner wrote: >>>> >>>> What's the best way to distribute Erlang powered, proprietary and >>>> non-proprietary, softwares? > There is no single "best" way. > > Historically, Erlang-based software have executed in closed > clusters on proprietary platforms with a ton of software, > of which perhaps half (sometimes more) has been erlang. > Sometimes, it has made sense to have an erlang-centric > packaging and release system, sometimes not. > > OTP has provided systools for more than a decade. It has a > function called make_tar(), which is perfectly usable, if > one is fine with first installing erlang, then unpacking and > installing the application. Does this provide the app in an 'executable' format or source? I'm curious if there is an answer (best or not) to this question since I haven't as yet come around to leaving a dev environment. TIA -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From mikhailfranco@REDACTED Fri Aug 14 11:26:48 2009 From: mikhailfranco@REDACTED (mikhailfranco@REDACTED) Date: Fri, 14 Aug 2009 05:26:48 -0400 Subject: [erlang-questions] Stand alone Erlang on Windows Message-ID: <8CBEAD87B73D29E-8A4-2924@webmail-mf16.sysops.aol.com> I think you should apologize to everyone in the Southern Hemisphere for your unwarranted and prejudiced assumption that it is summer. I'm sure many trans-equatorial erlangers are taking life very seriously in their winter. We don't want a Northern bias to add to the Western bias. :) Mik > -----Original Message----- > From: erlang-questions@REDACTED > [mailto:erlang-questions@REDACTED]On > Behalf Of Felipe Kober > Sent: 14 August 2009 08:20 > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Stand alone Erlang on Windows > > no need to apologize. this feeling is widely known due to common > violations of international patent law in china. i don't think it is a > personal attack on you. it is summer, why take life so seriously? > > these are not code but we can all laugh together: > http://icanhashappy.blogspot.com/2008/10/funny-chinese-knock-off-products.html > > Felipe. From richardc@REDACTED Fri Aug 14 12:18:51 2009 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 14 Aug 2009 12:18:51 +0200 Subject: [erlang-questions] Macro expansion In-Reply-To: References: <4A851FDB.3050102@it.uu.se> Message-ID: <4A853A0B.6040105@it.uu.se> Chandru wrote: > Thanks Richard. I know about this feature, but I don't want to put the macro > values in the Emakefile if I can help it. I want to be able to do 'erl > -make' and then include the values for the macros on the command line. It > seems to be possible, but I'm not able to figure out how I supply these on > the command line. Since 'erl -make' calls make:all(), it's not possible to pass parameters that way, but you could use 'erl -eval "make:all(CompilerOptions)". (Note: passing Erlang strings and tuples this way, you're bound to get the shell quoting wrong the first dozen or so attempts. Don't give up.) /Richard From rtrlists@REDACTED Fri Aug 14 12:36:33 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Fri, 14 Aug 2009 11:36:33 +0100 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <711a73df0908140331x323e6a4fh3bf4028dbd77eb16@mail.gmail.com> References: <4A852885.40109@erlang-consulting.com> <711a73df0908140234r6f117d9cx8e63ecbe2d05948d@mail.gmail.com> <6a3ae47e0908140329pc32e0f2ib3d1be5ba87314b2@mail.gmail.com> <711a73df0908140331x323e6a4fh3bf4028dbd77eb16@mail.gmail.com> Message-ID: <6a3ae47e0908140336u51b1de27m14dc2d28f47994e@mail.gmail.com> On Fri, Aug 14, 2009 at 11:31 AM, Dave Pawson wrote: > 2009/8/14 Robert Raschke : > > > > On Fri, Aug 14, 2009 at 10:34 AM, Dave Pawson > wrote: > >> > >> Does this provide the app in an 'executable' format or source? > >> I'm curious if there is an answer (best or not) to this question > >> since I haven't as yet come around to leaving a dev environment. > > > > http://www.erlang.org/doc/man/systools.html > > > > The make_script and make_tar functions are what you need to create self > > contained Erlang applications. You get to choose if you want to ship > sources > > or not. > > > > A good supplemental read is > > http://www.erlang.org/doc/system_principles/create_target.html > > > > It only takes about a day or so of reading and experimenting to come to > > grips with building applications this way. > > > > If you need a setup.exe, use NSIS to package it all up. > > > > Thanks. Shouldn't this have gone to the list? > For the OP? > > Sure, must have hit the wrong button. Robby From dave.pawson@REDACTED Fri Aug 14 13:23:49 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Fri, 14 Aug 2009 12:23:49 +0100 Subject: Fwd: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <6a3ae47e0908140329pc32e0f2ib3d1be5ba87314b2@mail.gmail.com> References: <4A852885.40109@erlang-consulting.com> <711a73df0908140234r6f117d9cx8e63ecbe2d05948d@mail.gmail.com> <6a3ae47e0908140329pc32e0f2ib3d1be5ba87314b2@mail.gmail.com> Message-ID: <711a73df0908140423r2c773006me7353422808402f8@mail.gmail.com> >From Robert. ---------- Forwarded message ---------- From: Robert Raschke Date: 2009/8/14 Subject: Re: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) To: Dave Pawson On Fri, Aug 14, 2009 at 10:34 AM, Dave Pawson wrote: > > Does this provide the app in an 'executable' format or source? > I'm curious if there is an answer (best or not) to this question > since I haven't as yet come around to leaving a dev environment. http://www.erlang.org/doc/man/systools.html The make_script and make_tar functions are what you need to create self contained Erlang applications. You get to choose if you want to ship sources or not. A good supplemental read is http://www.erlang.org/doc/system_principles/create_target.html It only takes about a day or so of reading and experimenting to come to grips with building applications this way. If you need a setup.exe, use NSIS to package it all up. Robby -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dmercer@REDACTED Fri Aug 14 15:15:25 2009 From: dmercer@REDACTED (David Mercer) Date: Fri, 14 Aug 2009 08:15:25 -0500 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <0016e64f80909f498f047115532f@google.com> References: <0016e64f80909f498f047115532f@google.com> Message-ID: <264F94A5407244F5AAA49FA869D795E1@SSI.CORP> ttmrichter@REDACTED writes: > You know, if ever there was any doubts as to why the #erlang-otp channel > was made on Freenode, this thread should put said doubts to rest. Not having access to freenode myself, may I ask why? Are you saying that these questions are better answered on freenode, or that the banter between China and the southern hemisphere one-upmanship on who should be more offended is best left off this list? I myself still have a question outstanding on this subject, so if this answer was answered on freenode, could someone please repost here so that I may enjoy? Thank-you. Does Erlang on Windows install anything outside of the Program Files\erl directory? That is, could you archive the entire Erlang directory structure and package it in a single executable that simply unpacked the entire directory structure somewhere and ran erl.exe? Cheers, David > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of ttmrichter@REDACTED > Sent: Friday, August 14, 2009 2:52 AM > To: Erlang Users' List > Subject: Re: Re: [erlang-questions] Stand alone Erlang on Windows > > You know, if ever there was any doubts as to why the #erlang-otp channel > was made on Freenode, this thread should put said doubts to rest. From bgustavsson@REDACTED Fri Aug 14 15:30:23 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 14 Aug 2009 15:30:23 +0200 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: References: Message-ID: <6672d0160908140630j58e311d6g56945daac59e6992@mail.gmail.com> On Fri, Aug 14, 2009 at 10:40 AM, Michael Turner wrote: > >>> What's the best way to distribute Erlang powered, proprietary and >>> non-proprietary, softwares? >> >>The best way is to have a product that is so awesome that people give >>you money even though you have fully it open source and receive >>patches to make it even more awestruck. Nobody can argue with that. > > I can: I don't want to run "awestruck" software, I want to run > *awesome* software. Last time I ran some "awestruck" software, I > ended up having to reboot. > > Look, this was a serious question about packaging, not quality or, for > that matter, open source ideology. And that should have been clear > enough from the context. It's a question worthy of an answer. > The Wings3D application has an NSIS-based installer for Windows. The scripts used to package Wings3D and build the installer would need be modified to be used for another application, but they could serve as a useful starting point. The Wings3D source code can be found here: http://github.com/bjorng/wings The relevant part is the the win32 target in the top Makefile, and the directories tools and win32. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From seancribbs@REDACTED Fri Aug 14 15:54:32 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Fri, 14 Aug 2009 09:54:32 -0400 Subject: [erlang-questions] Stand alone Erlang on Windows Message-ID: <4A856C98.5050701@gmail.com> I think the original poster meant that discussions that should be purely technical sometimes become personal/ad hominem or simply inappropriate. One of the goals of #erlang-otp is to foster helpful discussion without ego-bashing. Sean > Not having access to freenode myself, may I ask why? Are you saying that > these questions are better answered on freenode, or that the banter between > China and the southern hemisphere one-upmanship on who should be more > offended is best left off this list? > From btolputt@REDACTED Fri Aug 14 11:05:06 2009 From: btolputt@REDACTED (Benjamin Tolputt) Date: Fri, 14 Aug 2009 19:05:06 +1000 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: References: Message-ID: <4A8528C2.4080504@bigpond.net.au> Michael Turner wrote: > Look, this was a serious question about packaging, not quality or, for > that matter, open source ideology. Packaging matters. > as a "platform".) > > Windows is not going to vanish tomorrow. It's probably got another 15 > years in it. Packaging Erlang-coded applications so that they seem to > be regular full-fledged Windows apps might smack of treason to some, but > it might also help push Erlang into the mainstream of programming > practice. And I don't see how that hurts anybody here. > I whole-heartedly agree with the above. Erlang/BEAM is a powerful platform that could have a wide variety of uses. In fact, I believe the idea of a quick & easy packaging method is something that would benefit Windows & Mac OSX users (my current client application targets). That said, others have achieved this without serious difficulty. For example, check out Wings 3D - one of the most intuitive mesh modelling applications I've had the pleasure to use. It use Erlang, as the original authors were quite enamoured by the language, and runs on Windows, Linux, & Mac without issues. Perhaps what you are after is something more automated than their method, but there are ways to deploy applications in a quick & easy fashion for Windows platforms :) > So if somebody has an actual *helpful* answer to these sorts of > questions, count me among the interested. After all, I want real users > for what I write, and most of them will be on Windows, and I don't want > to ask too much of them, or they will go away. > And this is where I start to disagree. Not so much with your desire to get more helpful answer, but with the idea that applications not running on Windows boxes are somehow less important than those running on other platforms (if that was not what you meant by "real users" than I apologise). Erlang/OTP is, by design, a platform best suited to running servers. Client applications generally don't need to be running thousands of processes (with the possible exception of games - my particular interest), so the primary benefits are lost. Not that they aren't useful or such like, just that the benefits Erlang can provide give best "bang for your buck" on server architectures :) As such, I've found Erlang developers are less worried about the ease of initial deployment (especially on Windows platforms) because it is not that common an occurrence for them. Updating an existing deployment on the other hand is a well explored topic. -- Regards, Benjamin Tolputt Analyst Programmer From john.erickson@REDACTED Fri Aug 14 16:31:25 2009 From: john.erickson@REDACTED (Erickson, John) Date: Fri, 14 Aug 2009 08:31:25 -0600 Subject: Profiling Compiled Code Message-ID: <3C44D46958109E408F5848593B05A1D8BFC25E30@rrsmsx505.amr.corp.intel.com> I tried using fprof on some of my code and found it only shows stats for non-native compiled functions. Is there any support for profiling compiled code? From ulf.wiger@REDACTED Fri Aug 14 16:41:06 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 14 Aug 2009 16:41:06 +0200 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <4A8528C2.4080504@bigpond.net.au> References: <4A8528C2.4080504@bigpond.net.au> Message-ID: <4A857782.3070805@erlang-consulting.com> Benjamin Tolputt wrote: > Michael Turner wrote: >> Look, this was a serious question about packaging, not quality or, for >> that matter, open source ideology. Packaging matters. >> as a "platform".) >> >> Windows is not going to vanish tomorrow. It's probably got another 15 >> years in it. Packaging Erlang-coded applications so that they seem to >> be regular full-fledged Windows apps might smack of treason to some, but >> it might also help push Erlang into the mainstream of programming >> practice. And I don't see how that hurts anybody here. >> > > I whole-heartedly agree with the above. Erlang/BEAM is a powerful > platform that could have a wide variety of uses. In fact, I believe the > idea of a quick & easy packaging method is something that would benefit > Windows & Mac OSX users (my current client application targets). > > That said, others have achieved this without serious difficulty. For > example, check out Wings 3D - one of the most intuitive mesh modelling > applications I've had the pleasure to use. It use Erlang, as the > original authors were quite enamoured by the language, and runs on > Windows, Linux, & Mac without issues. > > Perhaps what you are after is something more automated than their > method, but there are ways to deploy applications in a quick & easy > fashion for Windows platforms :) AFAIK, Sinan (part of erlware) doesn't work on Windows yet. http://code.google.com/p/faxien/issues/detail?id=49#c9 I'm sure the erlware developers would love to get some volunteers on this front. Erlware does aim to address not just the quick install, but continuous operation as well. >> So if somebody has an actual *helpful* answer to these sorts of >> questions, count me among the interested. After all, I want real users >> for what I write, and most of them will be on Windows, and I don't want >> to ask too much of them, or they will go away. >> > > And this is where I start to disagree. Not so much with your desire to > get more helpful answer, but with the idea that applications not running > on Windows boxes are somehow less important than those running on other > platforms (if that was not what you meant by "real users" than I > apologise). There is also the issue that many of those who are in possession of knowledge that would be helpful may choose not to answer due to /time constraints/ - not necessarily because they are unwilling to share. > Erlang/OTP is, by design, a platform best suited to running servers. > Client applications generally don't need to be running thousands of > processes (with the possible exception of games - my particular > interest), so the primary benefits are lost. Not that they aren't useful > or such like, just that the benefits Erlang can provide give best "bang > for your buck" on server architectures :) There are other aspects of Erlang that /are/ helpful even if you don't require massive concurrency. Even with modest concurrency, the erlang way of modeling with processes and message passing is powerful in its own right, as is the out-of-band error handling and "programming for the correct case" mentality. > As such, I've found Erlang developers are less worried about the ease of > initial deployment (especially on Windows platforms) because it is not > that common an occurrence for them. Updating an existing deployment on > the other hand is a well explored topic. This is largely true for the /paying/ customers of Erlang (i.e. the internal Ericsson projects.) The OTP team will do stuff for money. Unfortunately, there is no channel for getting money to them from the outside... yet. May I also point out that there are companies - not just Erlang Training and Consulting - who are more than happy to focus on improving Open Source components if you pay them. The work may be done anyway, perhaps even by the same companies, but asking someone to make something a /priority/ usually costs money. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From dave.pawson@REDACTED Fri Aug 14 16:56:25 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Fri, 14 Aug 2009 15:56:25 +0100 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <4A8528C2.4080504@bigpond.net.au> References: <4A8528C2.4080504@bigpond.net.au> Message-ID: <711a73df0908140756x57e82647g7fbbf57159281a14@mail.gmail.com> 2009/8/14 Benjamin Tolputt : > And this is where I start to disagree. Not so much with your desire to > get more helpful answer, but with the idea that applications not running > on Windows boxes are somehow less important than those running on other > platforms (if that was not what you meant by "real users" than I > apologise). > > Erlang/OTP is, by design, a platform best suited to running servers. > Client applications generally don't need to be running thousands of > processes (with the possible exception of games - my particular > interest), so the primary benefits are lost. Not that they aren't useful > or such like, just that the benefits Erlang can provide give best "bang > for your buck" on server architectures :) I think Microsoft also sell servers? More assumptions? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From cayle.spandon@REDACTED Fri Aug 14 18:03:32 2009 From: cayle.spandon@REDACTED (cayle.spandon@REDACTED) Date: Fri, 14 Aug 2009 16:03:32 +0000 Subject: httpd_util:convert_request_date bad_date handling broken? Message-ID: <000e0cd6a9e09ec8dc04711c3150@google.com> httpd_util:convert_request_date/1 is supposed to return bad_date if the date string is invalid. For some string it does indeed do that: > httpd_util:convert_request_date("Sun, 06 Nov 1994 08:49:37 GMT"). {{1994,11,6},{8,49,37}} > httpd_util:convert_request_date("Sun, 06 Nov 1994"). bad_date > httpd_util:convert_request_date("Nonsense"). bad_date However, for other strings it does not return bad_date: > httpd_util:convert_request_date("Sun"). ** exception error: no function clause matching httpd_util:convert_request_date("Sun") > httpd_util:convert_request_date("-1"). ** exception error: no function clause matching httpd_util:convert_request_date("-1") Is this a bug in convert_request_date or am I missing something? From hakan@REDACTED Fri Aug 14 18:03:03 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 14 Aug 2009 18:03:03 +0200 (CEST) Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) Message-ID: On Fri, Aug 14, 2009 at 11:05 AM, Benjamin Tolputt wrote: > Erlang/OTP is, by design, a platform best suited to running servers. > Client applications generally don't need to be running thousands of > processes (with the possible exception of games - my particular > interest), so the primary benefits are lost. Not that they aren't useful > or such like, just that the benefits Erlang can provide give best "bang > for your buck" on server architectures :) > > As such, I've found Erlang developers are less worried about the ease of > initial deployment (especially on Windows platforms) because it is not > that common an occurrence for them. Updating an existing deployment on > the other hand is a well explored topic. There are work in progress in the areas of packaging and stand-alone applications within Erlang/OTP. Some of it has already been released but there are more in the pipe. Stand-alone. Instead of trying to package an entire Erlang system into one single executable file we are aiming at rather few files (10?). Such a stand-alone system will have the same directory structure as a development system. It is already today possible to create such systems but more automation is needed. Archives. In order to shrink the number of files in an Erlang installation, we have made a few changes in the code loading mechanism to enable loading of code from archive files. An archive file contains a complete application or parts of an application. But if the application contains drivers or port programs, these must be situated outside the archive file. When you choose what parts of the application that should be included in the archive it is done on subdirectory basis. For example src, doc, ebin, priv etc. See the documentation of the 'code' module for more info. Escript. Escripts may nowdays contain an archive file which may contain single .beam and .erl files. But the archive may also contain entire applications. When you create an archive file and put it in an escript you get an executable program (at least on UNIX). But that executable program is today dependent on an already installed runtime system. In a coming release it will be possible to have a stand-alone system containing both escript(s) and the runtime system. Then you will have a bin directory with your escripts and a stripped runtime system that only contains the files that the escript(s) needs. In order to make escripts more useful it is nowdays possible to hardcode command line options to the emulator in the header of the escript. See the documentation of the 'escript' module for more info. Reltool. Reltool is a tool that both can analyze dependencies between applications on module level and generate customized target systems as a file tree. What you want to do with the generated file tree is up to you. You may want to package it as a tar-file, zip-file, rpm-file, deb-file, windows installer etc. In its current shape the target generation part of reltool it is not so useful, but you can already today use reltool to determine which dependencies your application (or escript) have to other applications and modules. Reltool will improve in coming releases. Installer. In order to use a newly downloaded Erlang system today it is not enough to unpack the files in the distribution and start the system. You must also run an installer that patches hardcoded paths into some files. In a coming release it will be possible to just unpack and run without prior use of an installer. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB From kiszl@REDACTED Fri Aug 14 18:15:55 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Fri, 14 Aug 2009 18:15:55 +0200 Subject: [erlang-questions] httpd_util:convert_request_date bad_date handling broken? In-Reply-To: <000e0cd6a9e09ec8dc04711c3150@google.com> References: <000e0cd6a9e09ec8dc04711c3150@google.com> Message-ID: <4A858DBB.5020603@tmit.bme.hu> Look at the source code. The function clause expects at least four characters to guess the parser function to use (three characters for day, forth for separator or continuation). If your input is shorter, the clause won't match and an exception is thrown. If it is long enough, the parser function will return bad_date. Regards, Zoltan. cayle.spandon@REDACTED wrote: > httpd_util:convert_request_date/1 is supposed to return bad_date if > the date string is invalid. > > For some string it does indeed do that: > >> httpd_util:convert_request_date("Sun, 06 Nov 1994 08:49:37 GMT"). > {{1994,11,6},{8,49,37}} > >> httpd_util:convert_request_date("Sun, 06 Nov 1994"). > bad_date > >> httpd_util:convert_request_date("Nonsense"). > bad_date > > However, for other strings it does not return bad_date: > >> httpd_util:convert_request_date("Sun"). > ** exception error: no function clause matching > httpd_util:convert_request_date("Sun") > >> httpd_util:convert_request_date("-1"). > ** exception error: no function clause matching > httpd_util:convert_request_date("-1") > > Is this a bug in convert_request_date or am I missing something? > From leap@REDACTED Fri Aug 14 18:30:30 2009 From: leap@REDACTED (Michael Turner) Date: Fri, 14 Aug 2009 16:30:30 +0000 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <711a73df0908140756x57e82647g7fbbf57159281a14@mail.gmail.com> Message-ID: >2009/8/14 Benjamin Tolputt : > >> And this is where I start to disagree. Not so much with your desire to >> get more helpful answer, but with the idea that applications not running >> on Windows boxes are somehow less important than those running on other >> platforms (if that was not what you meant by "real users" than I >> apologise). "Real users" might not have been the wisest choice of term, but I did say that *most* of the ones I anticipate would be on Windows, not all. And measures of importance depend on where you sit. >> Erlang/OTP is, by design, a platform best suited to running servers. I'd say rather that Erlang (the language), by design, is suited to parallelism of a kind most often seen now on the server side. OTP consists significantly of components typical of the server side. But in what I'm working on, I want to address mass-market client-side multicore, which could be big. And I'm hardly alone in that. >> Client applications generally don't need to be running thousands of >> processes (with the possible exception of games - my particular >> interest), so the primary benefits are lost. "Are" is a present-tense verb. And this is the computer industry we're talking about. As desktop machines move to 4-core and 8-core, Erlang might start to become more important there. On the games side -- well, *theoretically* I don't see why Erlang optimizing compilers couldn't become more stream-oriented, and eventually make use of GPUs, for graphics and for general acceleration, not just more (conventional-architecture) cores. But again, if so, the green field there will be Windows desktops and laptops, and eventually handheld multiprocessor devices with more audio and video signal processing capability than most of today's desktop PCs. >> Not that they aren't useful >> or such like, just that the benefits Erlang can provide give best "bang >> for your buck" on server architectures :) On 8/14/2009, "Dave Pawson" wrote: >I think Microsoft also sell servers? >More assumptions? At the risk of precipitating ravening hatred: I think portability of open source to Wintel has probably brought more open source value directly to more people, and given the concept of open source more general validation, than any other move to any other sort of platform. I have no love for Microsoft. Quite the contrary. But most people in the world are on Windows, and many corporate types can be persuaded to cave in to open source solutions when you tell them that they are platform-agnostic. As most are, actually. I used to hate it when marketing types explained their various unaesthetic product configurations in terms of "overcoming a sales objection." Eventually I saw the wisdom of it. Free software is not really free, because nothing is. You can face a sales objection even at a sticker price of zero. The objection won't necessarily be very rational. But that doesn't make it any less real. -michael turner From info@REDACTED Sat Aug 15 01:12:09 2009 From: info@REDACTED (info) Date: Sat, 15 Aug 2009 00:12:09 +0100 Subject: send sms Message-ID: <200908150012085264323@its3.ch> Hi all, Excepted oserl, are there others modules to send SMS ? John From dmercer@REDACTED Sat Aug 15 00:33:34 2009 From: dmercer@REDACTED (David Mercer) Date: Fri, 14 Aug 2009 17:33:34 -0500 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <264F94A5407244F5AAA49FA869D795E1@SSI.CORP> References: <0016e64f80909f498f047115532f@google.com> <264F94A5407244F5AAA49FA869D795E1@SSI.CORP> Message-ID: I wrote: Does Erlang on Windows install anything outside of the Program Files\erl directory? That is, could you archive the entire Erlang directory structure and package it in a single executable that simply unpacked the entire directory structure somewhere and ran erl.exe? For what it?s worth, I tried this on a machine that had never had Erlang installed, and it seemed to work. I did not do an exhaustive test, or anything; I just fired up the Erlang shell and tried a few commands. Is there anything in particular that I should have tried that might not have worked? David From baryluk@REDACTED Sat Aug 15 00:48:53 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Sat, 15 Aug 2009 00:48:53 +0200 Subject: [erlang-questions] send sms In-Reply-To: <200908150012085264323@its3.ch> References: <200908150012085264323@its3.ch> Message-ID: <20090814224853.GA13760@smp.if.uj.edu.pl> On 08-15 00:12, info wrote: > Hi all, > > Excepted oserl, are there others modules to send SMS ? > > John I can say, that new version (rewrite) of oserl is probably expected in some near time. BTW. I find few days ago that messagepub service have support for erlang. -- Witold Baryluk JID: witold.baryluk // jabster.pl -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From btolputt@REDACTED Sat Aug 15 03:34:29 2009 From: btolputt@REDACTED (Benjamin Tolputt) Date: Sat, 15 Aug 2009 11:34:29 +1000 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <711a73df0908140756x57e82647g7fbbf57159281a14@mail.gmail.com> References: <4A8528C2.4080504@bigpond.net.au> <711a73df0908140756x57e82647g7fbbf57159281a14@mail.gmail.com> Message-ID: <4A8610A5.8060001@bigpond.net.au> Dave Pawson wrote: > I think Microsoft also sell servers? > More assumptions Indeed they do. But in terms of their usage in high-throughput server applications, their deployment is not the majority case. I am not trying to start an operating system flame-war here... hell, I am primarily a Windows developer. -- Regards, Benjamin Tolputt Analyst Programmer From leap@REDACTED Sat Aug 15 07:08:33 2009 From: leap@REDACTED (Michael Turner) Date: Sat, 15 Aug 2009 05:08:33 +0000 Subject: No subject In-Reply-To: <4A8610A5.8060001@bigpond.net.au> Message-ID: On 8/15/2009, "Benjamin Tolputt" wrote: >Dave Pawson wrote: >> I think Microsoft also sell servers? >> More assumptions > >Indeed they do. But in terms of their usage in high-throughput server >applications, their deployment is not the majority case. I am not trying >to start an operating system flame-war here... hell, I am primarily a >Windows developer. True, but also, I believe, somewhat beside the point. If I may illustrate: Eons ago (i.e., during the Internet Bubble), I did something that an employee should never, ever, do: I contradicted my boss during an important sales pitch. My boss was selling a LAMP stack with some e-Commerce thing on top. The customer really only wanted the e-Commerce. My boss kept flogging (rather ignorantly) its LAMP infrastructure instead. The guy enduring all this techno-gibberish asked my boss: Why does it have to be Linux? My boss answered: because you need Apache to be on the Web, and Apache doesn't run on Windows NT. Suffering in silence up to that point, I cleared my throat and corrected him: Apache had, in fact, been running on NT since some fairly early releases. MySql and PHP also ran on NT. Because my boss turned to me then and frowned at my sinfulness, he didn't see what I noticed at the same moment: the relief washing over the face of the customer. The sale was made. It was understood that the initial delivered system, which was supposedly urgently required, would be running Linux. But only as a stopgap. The plan was to switch to Windows NT later, in due time. But they never did. Apache's portability to Windows NT got a Linux system through the door, where it proved itself on its merits. I doubt my story is an isolated case -- we were as generic as you could get, for web startups back then. And the client was a pretty generic client. I also have little doubt that Apache's availability on NT got some NT-based IT departments on the Web, which put those IT departments (hitherto mainly cost centers) solidly astride new revenue channels for the companies they served. Revenue channels that would be endangered if NT crashed. Which NT did -- rather a lot, in fact. And in that way, the portability of LAMP-minus-the-L to NT platforms helped sell even more Linux and BSD into that new arena of demand. Many more eons ago, there was a young man who committed heresy: he was writing a version of Unix (yay!) that would be GPLed (yay!), but (unlike GNU software) was targeted *initially* for only one hardware system architecture: IBM PC compatibles (BOO!). This was an ugly, highly sub-optimal architecture that had become standard in large part because the OSes and apps for it were very widely adopted de facto standards, through an evolutionary path going back to Z-80s, the S-100 bus, and CP/M (close your eyes, children). The system software on most computers was eventually almost entirely from Microsoft. And so were many of the apps. And this Macdonalds-like predictability (albeit with Macdonalds-like low quality) in computer software products somehow sold software like cheeseburgers, which helped beat down the cost of hardware to the point where a Finnish college student could hack on operating systems at home without even needing a continuous dialup connection after a certain point. What, you don't see anything miraculous about that? Bah. Kids these days. So spoiled. This young man has since become legend. His heresy, however -- Thou Shalt Not Worship Beautiful Universal Portability If You'll Get to There Faster by Focusing on Some Cheap and Ugly Single-Platform Route -- seems to have been largely forgotten. But it's true: Wintel helped make Linux possible. If it hadn't been Wintel, it might have been some even more revolting oligopoly. So, to get back to the point: yes, Microsoft lags on the server side, and it probably always will. But there are still big companies out there populated by people who want to run software from other big companies, because . . . because . . . I mean, because they are big, and, y'know, everybody buys from them, y'know? I.e., companies where tech buy decisions are still made by people who arguably shouldn't be making them. Every corporate IT generation will have its own "Nobody ever got fired for buying ___". When I started programming, the blank was filled by "IBM". That guy in that meeting where I saved the sale? Maybe even *he* knew Linux would be the better bet. But if so, I doubt his boss did, and maybe that boss could never have set aside enough time to be persuaded of why his prejudices were wrong. And maybe that boss never even discovered that he'd gotten Linux for the long run, instead of NT. More likely, that boss *did* discover it, later, but took credit for making an insanely great decision after it had proved to be, at least, a reasonably good one. I hate this kind of thing. Maybe we're inexorably leaving that world behind. But I don't think we're out of the woods yet. And Erlang straggles through those woods just like everything else has to. Go ahead, whip me, beat me, call me a cynical marketing flack. I've learned to love it. -michael turner From info@REDACTED Sat Aug 15 11:42:08 2009 From: info@REDACTED (info) Date: Sat, 15 Aug 2009 11:42:08 +0200 Subject: [erlang-questions] send sms References: <200908150012085264323@its3.ch>, <20090814224853.GA13760@smp.if.uj.edu.pl> Message-ID: <200908151142077076778@its3.ch> Hi Witold, Thank you. I also found messagepub but this is an "external" application. I don't like to be "dependent" of that. John On 08-15 00:12, info wrote: > Hi all, > > Excepted oserl, are there others modules to send SMS ? > > John I can say, that new version (rewrite) of oserl is probably expected in some near time. BTW. I find few days ago that messagepub service have support for erlang. -- Witold Baryluk JID: witold.baryluk // jabster.pl From steven.charles.davis@REDACTED Sat Aug 15 16:57:19 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 15 Aug 2009 07:57:19 -0700 (PDT) Subject: This file system path thing is getting me down... Message-ID: This isn't a problem specific to erlang but I find myself writing file path manipulation stuff over and over and/or having a ream of functions in the inevitable (but ugly) my_app util modules simply to deal with file paths. I was wondering whether anyone has opinions on elegant ways to deal with file paths in applications or could point to an erlang application that does this particularly well? TIA, Steve From seth@REDACTED Sat Aug 15 17:02:19 2009 From: seth@REDACTED (Seth Falcon) Date: Sat, 15 Aug 2009 08:02:19 -0700 Subject: [erlang-questions] This file system path thing is getting me down... In-Reply-To: References: Message-ID: <20090815150218.GJ286@ziti.local> * On 2009-08-15 at 07:57 -0700 Steve Davis wrote: > I was wondering whether anyone has opinions on elegant ways to deal > with file paths in applications or could point to an erlang > application that does this particularly well? I imagine you'll get a more useful response if you outline some specific tasks you want to be able to achieve. What are the functions, for example, that you find yourself always implementing in a util module for your apps? + seth From steven.charles.davis@REDACTED Sat Aug 15 17:57:42 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 15 Aug 2009 08:57:42 -0700 (PDT) Subject: This file system path thing is getting me down... In-Reply-To: <20090815150218.GJ286@ziti.local> References: <20090815150218.GJ286@ziti.local> Message-ID: <640c39c9-e488-465b-acea-5f014b837648@g31g2000yqc.googlegroups.com> Hi Seth, I'm sure you are right that reducing the scope will attract more responses, however part of the issue is that the problem is extremely fundamental. It's easy/obvious but laborious to do the filename path munging with functions available from existing modules e.g. file, filename, filelib, code, application, etc, so I'm not asking for a specific solution to a specific problem here. I'm fairly sure that the problems are compounded because when you read/ write, list, wildcard, etc, functions may expect/return (a list of) any of: 1) a filename 2) a relative path 3) an absolute path ...which then need post-processing to point to actual files for later manipulation. My current thinking is perhaps to abstract the entire file system as a data source and query it like a database (maybe using qlc) and only ever return absolute names. /sd On Aug 15, 10:02?am, Seth Falcon wrote: > What are the functions, for example, that you find yourself always > implementing in a util module for your apps? From vengeance.storm@REDACTED Sat Aug 15 20:51:23 2009 From: vengeance.storm@REDACTED (Xingzhi Pan) Date: Sun, 16 Aug 2009 02:51:23 +0800 Subject: ex 8.11 in Programming Erlang Message-ID: <841721380908151151j32975e5p7e65aac270944365@mail.gmail.com> Hi, I'm working through Joe's Programming Erlang and saw these nice exercises. I've read previous solution at http://erlang.org/pipermail/erlang-questions/2007-September/029405.html but I have a question regarding the exercise itself. For your convenience the problem is: Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). Make sure your program works correctly in the case when two parallel processes simultaneously evaluate start/2. In this case, you must guarantee that one of these processes succeeds and the other fails. So when the author wrote "simultaneously evaluates start/2", he also means "with the same AnAtom", right? 'Cause if not, it would make all those discussions baseless... Am I splitting hair? Thanks in advance. Pan, Xingzhi From info@REDACTED Sun Aug 16 19:37:45 2009 From: info@REDACTED (info) Date: Sun, 16 Aug 2009 19:37:45 +0200 Subject: sending email with erlang Message-ID: <200908161937454201605@its3.ch> Hi all, I am looking for a small application for sending only emails, running on Windows. Do you have examples or do you know examples easy to understand ? Thank you. John From info@REDACTED Mon Aug 17 11:24:01 2009 From: info@REDACTED (info) Date: Mon, 17 Aug 2009 11:24:01 +0200 Subject: sending email with erlang Message-ID: <200908171124010297305@its3.ch> Hi all, I am looking for a small application for sending only emails, running on Windows. Do you have examples or do you know examples easy to understand ? Thank you. John From kaczmarek.w@REDACTED Mon Aug 17 01:29:43 2009 From: kaczmarek.w@REDACTED (Wojciech Kaczmarek) Date: Mon, 17 Aug 2009 01:29:43 +0200 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> Message-ID: <31ae10910908161629m38274813i3c0f9f726cf64bff@mail.gmail.com> Political correctness strikes again.. On Fri, Aug 14, 2009 at 04:01, Oscar wrote: > hey man, > > Could you please give us any example about the Chinese steal source code? > If not, please apologize it in this thread. These are well known facts. You have to live with it, denying in the name of political correctness is the worst thing to do. If it will make you happier: some Chinese <> all Chinese cheers From kevin@REDACTED Mon Aug 17 05:16:54 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Sun, 16 Aug 2009 23:16:54 -0400 Subject: [erlang-questions] Re: erlang/python,ruby,.. interfaces on tcp In-Reply-To: <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> References: <979D9774F91440009D70FD961F9B09D3@neon> <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> Message-ID: <1B90CD82-657B-4D1A-A7A0-07EA3EC7660D@hypotheticalabs.com> Tom Preston-Warner's presentation from this year's Palo Alto Erlang Factory might shed some light on reverse engineering Erlang's wire protocol: http://www.erlang-factory.com/upload/presentations/36/tom_preston_werner_erlectricity.pdf The slide at the end about BERT and BERT-RPC look promising but I'm not sure if any work was done to make it a reality. --Kevin On Aug 10, 2009, at 8:22 AM, Roberto Ostinelli wrote: > i'm currently using this approach: > > http://code.activestate.com/recipes/534162 > > and using json as string passed through. > > does anyone have something to say re this? i'm really eager to see > what best can be achieved. > > thank you, > > r. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kevin@REDACTED Mon Aug 17 05:18:45 2009 From: kevin@REDACTED (Kevin A. Smith) Date: Sun, 16 Aug 2009 23:18:45 -0400 Subject: [erlang-questions] Re: erlang/python,ruby,.. interfaces on tcp In-Reply-To: <1B90CD82-657B-4D1A-A7A0-07EA3EC7660D@hypotheticalabs.com> References: <979D9774F91440009D70FD961F9B09D3@neon> <0852974A-6042-417A-A547-AA42661CECBD@widetag.com> <1B90CD82-657B-4D1A-A7A0-07EA3EC7660D@hypotheticalabs.com> Message-ID: I should've researched a bit before sending this. Tom's written BERT- RPC client & servers in Ruby: http://github.com/mojombo Maybe this could be extended to other langs? --Kevin On Aug 16, 2009, at 11:16 PM, Kevin A. Smith wrote: > Tom Preston-Warner's presentation from this year's Palo Alto Erlang > Factory might shed some light on reverse engineering Erlang's wire > protocol: > > http://www.erlang-factory.com/upload/presentations/36/tom_preston_werner_erlectricity.pdf > > The slide at the end about BERT and BERT-RPC look promising but I'm > not sure if any work was done to make it a reality. > > --Kevin > On Aug 10, 2009, at 8:22 AM, Roberto Ostinelli wrote: > >> i'm currently using this approach: >> >> http://code.activestate.com/recipes/534162 >> >> and using json as string passed through. >> >> does anyone have something to say re this? i'm really eager to see >> what best can be achieved. >> >> thank you, >> >> r. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > From ulf.wiger@REDACTED Mon Aug 17 15:02:37 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 17 Aug 2009 15:02:37 +0200 Subject: [erlang-questions] Stand alone Erlang on Windows In-Reply-To: <31ae10910908161629m38274813i3c0f9f726cf64bff@mail.gmail.com> References: <6a9ba5690908130626p1b861490jf465d9352e8f7b84@mail.gmail.com> <4A842BE4.9080002@dominicwilliams.net> <6a9ba5690908130929u42579175pdaee72e92e11c3da@mail.gmail.com> <9a77767b0908131901r3becafe7l88d8bae0e08cda54@mail.gmail.com> <31ae10910908161629m38274813i3c0f9f726cf64bff@mail.gmail.com> Message-ID: <4A8954ED.50101@erlang-consulting.com> Even so, I'm sure there are forums more appropriate than erlang-questions if you want to continue this argument. On the topic of disassembling beam code, it may well be easier to figure out the rough workings of a program by setting a detailed trace and exercising the program with suitable input. For those of you who find this disconcerting, it might be interesting to check out process_flag(sensitive, bool()). It toggles the ability to trace a process, or use process_info() on it. BR, Ulf W Wojciech Kaczmarek wrote: > Political correctness strikes again.. > > On Fri, Aug 14, 2009 at 04:01, Oscar wrote: >> hey man, >> >> Could you please give us any example about the Chinese steal source code? >> If not, please apologize it in this thread. > > These are well known facts. You have to live with it, denying in the > name of political correctness is the worst thing to do. > > If it will make you happier: > some Chinese <> all Chinese > > cheers > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From gsmyth@REDACTED Mon Aug 17 15:22:51 2009 From: gsmyth@REDACTED (Greg Smyth) Date: Mon, 17 Aug 2009 14:22:51 +0100 Subject: help with gen_fsm for a new erlang user Message-ID: <361b4e9d0908170622p3f859e77wd20c6717efee88fe@mail.gmail.com> Hi all, I'm learning erlang/OTP and I'm trying to write a pretty simple gen_fsm service, but i'm having a bit of trouble and was wondering if someone could help correct my mistakes:- The service should have 2 states:- 1) waiting - where it will be waiting on a specified timeout. 2) running - where it will be running a function over a list of hosts (specified in 'Hostlist' dictionary with the host as the key) The code i have compiles ok, and returns {ok, Pid} from start_link/1 - but i see none of my io:format messages ever appear... Here's the code:- %%%%%%%%% -module(runner_fsm). -behaviour(gen_fsm). %% API -export([start_link/1]). %% gen_fsm callbacks -export([init/1, wait/2, run/2, wait/3, run/3, handle_event/3, handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). %% internals -export([pinger/1]). -define(SERVER, ?MODULE). start_link(Hostlist) -> gen_fsm:start_link({local, ?SERVER}, ?MODULE, Hostlist, []). init(Hostlist) -> {ok, wait, Hostlist, 30000}. wait(timeout, State) -> {next_state, run, State}. run(_Event, State) -> Hosts = dict:fetch_keys(State), case lists:foreach(fun(Elem) -> runner_fsm:pinger(Elem) end, Hosts) of ok -> doNothingforNow; fail -> doNothingforNow end, {next_state, wait, State, 30000}. wait(_Event, _From, State) -> Reply = ok, {reply, Reply, wait, State, 30000}. run(_Event, _From, State) -> Reply = ok, {reply, Reply, run, State}. handle_event(_Event, StateName, State) -> {next_state, StateName, State}. handle_sync_event(Event, From, StateName, State) -> Reply = ok, {reply, Reply, StateName, State}. handle_info(_Info, StateName, State) -> {next_state, StateName, State}. terminate(_Reason, _StateName, _State) -> ok. code_change(_OldVsn, StateName, State, _Extra) -> {ok, StateName, State}. pinger(Host) -> Command = lists:concat(["ping -c 1 ", Host, "; echo $?"]), ExitCode = lists:last(string:tokens(os:cmd(Command), "\n")), case ExitCode of "0" -> io:format("OK: ~p~n", [Host]), ok; _ -> io:format("BAD: ~p~n", [Host]), fail end. %%%%%%%%%%% Any ideas/hints as to what i'm doing wrong? Many thanks, Greg From mazen.harake@REDACTED Sun Aug 16 07:50:08 2009 From: mazen.harake@REDACTED (Mazen Harake) Date: Sun, 16 Aug 2009 08:50:08 +0300 Subject: [erlang-questions] ex 8.11 in Programming Erlang In-Reply-To: <841721380908151151j32975e5p7e65aac270944365@mail.gmail.com> References: <841721380908151151j32975e5p7e65aac270944365@mail.gmail.com> Message-ID: <4A879E10.7090409@erlang-consulting.com> Yes that is correct; he means with the same atom. /Mazen Xingzhi Pan wrote: > Hi, > > I'm working through Joe's Programming Erlang and saw these nice exercises. > I've read previous solution at > http://erlang.org/pipermail/erlang-questions/2007-September/029405.html but > I have a question regarding the exercise itself. > > For your convenience the problem is: > > Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). Make > sure your program works correctly in the case when two parallel processes > simultaneously evaluate start/2. In this case, you must guarantee that one > of these processes succeeds and the other fails. > > So when the author wrote "simultaneously evaluates start/2", he also means > "with the same AnAtom", right? 'Cause if not, it would make all those > discussions baseless... > > Am I splitting hair? > > Thanks in advance. > > Pan, Xingzhi > > From torben.lehoff@REDACTED Mon Aug 17 16:10:24 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 17 Aug 2009 16:10:24 +0200 Subject: [erlang-questions] help with gen_fsm for a new erlang user In-Reply-To: <361b4e9d0908170622p3f859e77wd20c6717efee88fe@mail.gmail.com> References: <361b4e9d0908170622p3f859e77wd20c6717efee88fe@mail.gmail.com> Message-ID: Hi Greg, You have run into one of the small beauties of gen_fsm which can be a bit confusing when starting out with the state machines in Erlang. Your problem is that there is nothing driving your gen_fsm forward except for the initial timeout. In run you are waiting for an arbitrary event, but you never generate an event that will trigger the code. Speaking in terms of other state machine formalisms you are expecting an entry action to be executed when you enter a state, but there is no such thing out of the box for a gen_fsm. Given your requirements I might go as far as to suggest using a gen_server, but regardless you need to have something that drives your process. Suppose you create an API function for your existing code: run_stuff() -> gen_fsm:send_event(?MODULE,run_it). Then you add the following to run state: run(run_it,State) -> ... your old code This will allow you to call runner_fsm:run_stuff() from the command line and see some action. Doing this ever so often requires usage of functions from the timer module which I encourage you to investigate. You can use the timer module functions to call a function at your required rate inside or outside your gen_fsm. Hope this helps, Torben On Mon, Aug 17, 2009 at 15:22, Greg Smyth wrote: > Hi all, > > I'm learning erlang/OTP and I'm trying to write a pretty simple gen_fsm > service, but i'm having a bit of trouble and was wondering if someone could > help correct my mistakes:- > > The service should have 2 states:- > > 1) waiting - where it will be waiting on a specified timeout. > 2) running - where it will be running a function over a list of hosts > (specified in 'Hostlist' dictionary with the host as the key) > > The code i have compiles ok, and returns {ok, Pid} from start_link/1 - but > i > see none of my io:format messages ever appear... > > Here's the code:- > > %%%%%%%%% > > -module(runner_fsm). > -behaviour(gen_fsm). > > %% API > -export([start_link/1]). > > %% gen_fsm callbacks > -export([init/1, wait/2, run/2, wait/3, run/3, handle_event/3, > handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). > > %% internals > -export([pinger/1]). > > -define(SERVER, ?MODULE). > > start_link(Hostlist) -> > gen_fsm:start_link({local, ?SERVER}, ?MODULE, Hostlist, []). > > init(Hostlist) -> > {ok, wait, Hostlist, 30000}. > > wait(timeout, State) -> > {next_state, run, State}. > > run(_Event, State) -> > Hosts = dict:fetch_keys(State), > case lists:foreach(fun(Elem) -> runner_fsm:pinger(Elem) end, Hosts) of > ok -> > doNothingforNow; > fail -> > doNothingforNow > end, > {next_state, wait, State, 30000}. > > wait(_Event, _From, State) -> > Reply = ok, > {reply, Reply, wait, State, 30000}. > > run(_Event, _From, State) -> > Reply = ok, > {reply, Reply, run, State}. > > handle_event(_Event, StateName, State) -> > {next_state, StateName, State}. > > handle_sync_event(Event, From, StateName, State) -> > Reply = ok, > {reply, Reply, StateName, State}. > > handle_info(_Info, StateName, State) -> > {next_state, StateName, State}. > > terminate(_Reason, _StateName, _State) -> > ok. > > code_change(_OldVsn, StateName, State, _Extra) -> > {ok, StateName, State}. > > pinger(Host) -> > Command = lists:concat(["ping -c 1 ", Host, "; echo $?"]), > ExitCode = lists:last(string:tokens(os:cmd(Command), "\n")), > case ExitCode of > "0" -> io:format("OK: ~p~n", [Host]), > ok; > _ -> io:format("BAD: ~p~n", [Host]), > fail > end. > > %%%%%%%%%%% > > Any ideas/hints as to what i'm doing wrong? > > Many thanks, > Greg > -- http://www.linkedin.com/in/torbenhoffmann From baryluk@REDACTED Mon Aug 17 16:38:17 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 17 Aug 2009 16:38:17 +0200 Subject: [erlang-questions] sending email with erlang In-Reply-To: <200908161937454201605@its3.ch> References: <200908161937454201605@its3.ch> Message-ID: <1250519897.6320.457.camel@sredniczarny> Dnia 2009-08-16, nie o godzinie 19:37 +0200, info pisze: > Hi all, > I am looking for a small application for sending only emails, running on Windows. > Do you have examples or do you know examples easy to understand ? > Thank you. > John This http://www.erlang.org/contrib/smtp_client-1.1.tgz or http://www.trapexit.org/forum/viewtopic.php?t=6877 or http://www.trapexit.org/forum/viewtopic.php?t=9341 or this finally http://github.com/archaelus/esmtp/tree/master And evetnaully messagepub module mentioned few days ago. There is also two full blown SMTP servers in Erlang I think, they can be usefull if you want to have things like queueing, and sending directly to destination without "smarthost". -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From baryluk@REDACTED Mon Aug 17 16:46:30 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 17 Aug 2009 16:46:30 +0200 Subject: [erlang-questions] sending email with erlang In-Reply-To: <1250519897.6320.457.camel@sredniczarny> References: <200908161937454201605@its3.ch> <1250519897.6320.457.camel@sredniczarny> Message-ID: <1250520390.6320.470.camel@sredniczarny> Dnia 2009-08-17, pon o godzinie 16:38 +0200, Witold Baryluk pisze: > http://www.erlang.org/contrib/smtp_client-1.1.tgz > or > http://www.trapexit.org/forum/viewtopic.php?t=6877 > or > http://www.trapexit.org/forum/viewtopic.php?t=9341 > or this finally > http://github.com/archaelus/esmtp/tree/master > I even think that 3 of this links, have common code. esmtp is probably derived from smtp_client-1.1.tgz + + smtp_fsm.erl (which is just an update). So probably esmtp is the newest. I'm now trying to use it. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From info@REDACTED Mon Aug 17 17:07:26 2009 From: info@REDACTED (info) Date: Mon, 17 Aug 2009 17:07:26 +0200 Subject: gen_tcp:connect Message-ID: <200908171707262320427@its3.ch> Hello, I tried this: gen_tcp:connect("www.erlang.org",80,[binary,{packet,0}]). I obtain: {error,timeout} any idea ? From raimo+erlang-questions@REDACTED Mon Aug 17 17:21:09 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 17 Aug 2009 17:21:09 +0200 Subject: [erlang-questions] gen_tcp:connect In-Reply-To: <200908171707262320427@its3.ch> References: <200908171707262320427@its3.ch> Message-ID: <20090817152109.GA12284@erix.ericsson.se> On Mon, Aug 17, 2009 at 05:07:26PM +0200, info wrote: > Hello, > I tried this: > gen_tcp:connect("www.erlang.org",80,[binary,{packet,0}]). > I obtain: > {error,timeout} > > any idea ? The server has been down since saturday evening local time until monday 14:28. Sorry about that. Can this be the problem? Otherwise maybe an HTTP proxy? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From gsmyth@REDACTED Mon Aug 17 17:23:55 2009 From: gsmyth@REDACTED (Greg Smyth) Date: Mon, 17 Aug 2009 16:23:55 +0100 Subject: [erlang-questions] help with gen_fsm for a new erlang user In-Reply-To: References: <361b4e9d0908170622p3f859e77wd20c6717efee88fe@mail.gmail.com> Message-ID: <361b4e9d0908170823p534f0204r8a117b3b4e531cc0@mail.gmail.com> Thanks Torben! I ended up trying it in a slightly different way (using the 'timeout' event for the run state as well, rather than explicitly using the timeout module) - but your explanation helped me to see the mistakes in my thinking (how i needed an explicit event to drive into the run state). Cheers, Greg On Mon, Aug 17, 2009 at 3:10 PM, Torben Hoffmann < torben.lehoff@REDACTED> wrote: > Hi Greg, > > You have run into one of the small beauties of gen_fsm which can be a bit > confusing when starting out with the state machines in Erlang. > > Your problem is that there is nothing driving your gen_fsm forward except > for the initial timeout. > > In run you are waiting for an arbitrary event, but you never generate an > event that will trigger the code. > > Speaking in terms of other state machine formalisms you are expecting an > entry action to be executed when you enter a state, but there is no such > thing out of the box for a gen_fsm. > > Given your requirements I might go as far as to suggest using a gen_server, > but regardless you need to have something that drives your process. > > Suppose you create an API function for your existing code: > run_stuff() -> > gen_fsm:send_event(?MODULE,run_it). > > Then you add the following to run state: > run(run_it,State) -> > ... your old code > > This will allow you to call runner_fsm:run_stuff() from the command line > and see some action. > > Doing this ever so often requires usage of functions from the timer module > which I encourage you to investigate. > > You can use the timer module functions to call a function at your required > rate inside or outside your gen_fsm. > > Hope this helps, > Torben > > > > On Mon, Aug 17, 2009 at 15:22, Greg Smyth wrote: > >> Hi all, >> >> I'm learning erlang/OTP and I'm trying to write a pretty simple gen_fsm >> service, but i'm having a bit of trouble and was wondering if someone >> could >> help correct my mistakes:- >> >> The service should have 2 states:- >> >> 1) waiting - where it will be waiting on a specified timeout. >> 2) running - where it will be running a function over a list of hosts >> (specified in 'Hostlist' dictionary with the host as the key) >> >> The code i have compiles ok, and returns {ok, Pid} from start_link/1 - but >> i >> see none of my io:format messages ever appear... >> >> Here's the code:- >> >> %%%%%%%%% >> >> -module(runner_fsm). >> -behaviour(gen_fsm). >> >> %% API >> -export([start_link/1]). >> >> %% gen_fsm callbacks >> -export([init/1, wait/2, run/2, wait/3, run/3, handle_event/3, >> handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). >> >> %% internals >> -export([pinger/1]). >> >> -define(SERVER, ?MODULE). >> >> start_link(Hostlist) -> >> gen_fsm:start_link({local, ?SERVER}, ?MODULE, Hostlist, []). >> >> init(Hostlist) -> >> {ok, wait, Hostlist, 30000}. >> >> wait(timeout, State) -> >> {next_state, run, State}. >> >> run(_Event, State) -> >> Hosts = dict:fetch_keys(State), >> case lists:foreach(fun(Elem) -> runner_fsm:pinger(Elem) end, Hosts) of >> ok -> >> doNothingforNow; >> fail -> >> doNothingforNow >> end, >> {next_state, wait, State, 30000}. >> >> wait(_Event, _From, State) -> >> Reply = ok, >> {reply, Reply, wait, State, 30000}. >> >> run(_Event, _From, State) -> >> Reply = ok, >> {reply, Reply, run, State}. >> >> handle_event(_Event, StateName, State) -> >> {next_state, StateName, State}. >> >> handle_sync_event(Event, From, StateName, State) -> >> Reply = ok, >> {reply, Reply, StateName, State}. >> >> handle_info(_Info, StateName, State) -> >> {next_state, StateName, State}. >> >> terminate(_Reason, _StateName, _State) -> >> ok. >> >> code_change(_OldVsn, StateName, State, _Extra) -> >> {ok, StateName, State}. >> >> pinger(Host) -> >> Command = lists:concat(["ping -c 1 ", Host, "; echo $?"]), >> ExitCode = lists:last(string:tokens(os:cmd(Command), "\n")), >> case ExitCode of >> "0" -> io:format("OK: ~p~n", [Host]), >> ok; >> _ -> io:format("BAD: ~p~n", [Host]), >> fail >> end. >> >> %%%%%%%%%%% >> >> Any ideas/hints as to what i'm doing wrong? >> >> Many thanks, >> Greg >> > > > > -- > http://www.linkedin.com/in/torbenhoffmann > From info@REDACTED Mon Aug 17 17:34:12 2009 From: info@REDACTED (info) Date: Mon, 17 Aug 2009 17:34:12 +0200 Subject: [erlang-questions] gen_tcp:connect References: <200908171707262320427@its3.ch>, <20090817152109.GA12284@erix.ericsson.se> Message-ID: <200908171734119373276@its3.ch> I tried this: gen_tcp:connect(www.google.com,80,[binary,{packet,0}]). Same result. firewall problem ? On Mon, Aug 17, 2009 at 05:07:26PM +0200, info wrote: > Hello, > I tried this: > gen_tcp:connect("www.erlang.org",80,[binary,{packet,0}]). > I obtain: > {error,timeout} > > any idea ? The server has been down since saturday evening local time until monday 14:28. Sorry about that. Can this be the problem? Otherwise maybe an HTTP proxy? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From baryluk@REDACTED Mon Aug 17 17:34:54 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 17 Aug 2009 17:34:54 +0200 Subject: [erlang-questions] gen_tcp:connect In-Reply-To: <20090817152109.GA12284@erix.ericsson.se> References: <200908171707262320427@its3.ch> <20090817152109.GA12284@erix.ericsson.se> Message-ID: <1250523294.6320.520.camel@sredniczarny> Dnia 2009-08-17, pon o godzinie 17:21 +0200, Raimo Niskanen pisze: > On Mon, Aug 17, 2009 at 05:07:26PM +0200, info wrote: > > Hello, > > I tried this: > > gen_tcp:connect("www.erlang.org",80,[binary,{packet,0}]). > > I obtain: > > {error,timeout} > > > > any idea ? > > The server has been down since saturday evening local time > until monday 14:28. Sorry about that. > Can this be the problem? Otherwise maybe an HTTP proxy? > It works now. erlang.org is now up and running. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From amit.murthy@REDACTED Sun Aug 16 15:14:50 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Sun, 16 Aug 2009 18:44:50 +0530 Subject: tail recursion : sharing a learning and a question Message-ID: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> Hi, I just learned that every iteration of the below code goes onto the stack. The evaluation of the "catch" has something to do with it though I could understand why. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Bad code, Bad code, Bad code, Bad code, Bad code, Bad code, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% do_maintenance(CacheSz, HKIntvl, Oldest) -> try receive Message -> met_util:log_info(" pid -~p recieved unexpected message[~p]. ",[self(), Message]) after HKIntvl -> NOldest = do_cleanup(CacheSz, Oldest, 100), do_maintenance(CacheSz, HKIntvl, NOldest) end catch error:Error -> met_util:log("~p do_maintenance() caught exception -> ~p",[?MODULE, Error]), do_maintenance(CacheSz, HKIntvl, Oldest) end. %%%%%%% The right way of course is to not trap exceptions here, remove the try-catch and put the whole thing under a supervisor (with restart) behavior. Which is what I have done now. Would still like to know as to why the try-catch ends up killing tail recursion. Can't the compiler catch this (pun intended) and optimize it for tail recursion? Regards, Amit From baryluk@REDACTED Mon Aug 17 18:02:25 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 17 Aug 2009 18:02:25 +0200 Subject: [erlang-questions] tail recursion : sharing a learning and a question In-Reply-To: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> References: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> Message-ID: <1250524945.6320.552.camel@sredniczarny> Dnia 2009-08-16, nie o godzinie 18:44 +0530, Amit Murthy pisze: > Hi, > > I just learned that every iteration of the below code goes onto the stack. > The evaluation of the "catch" has something to do with it though I could > understand why. It is not tail recursive version, because there is some additional work after exit of last function, namely change catch handlers, to the previous ones. This should work. do_maintenance(CacheSz, HKIntvl, Oldest) -> try do_maintance0(CacheSz, HKIntvl, Oldest); catch error:Error -> met_util:log("~p do_maintenance() caught exception -> ~p",[?MODULE, Error]), do_maintenance(CacheSz, HKIntvl, Oldest) end. do_maintenance0(CacheSz, HKIntvl, Oldest) -> receive Message -> met_util:log_info(" pid -~p recieved unexpected message[~p].",[self(), Message]) after HKIntvl -> NOldest = do_cleanup(CacheSz, Oldest, 100), do_maintenance0(CacheSz, HKIntvl, NOldest) end. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From dmercer@REDACTED Mon Aug 17 18:25:59 2009 From: dmercer@REDACTED (David Mercer) Date: Mon, 17 Aug 2009 11:25:59 -0500 Subject: [erlang-questions] tail recursion : sharing a learning and a question In-Reply-To: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> References: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> Message-ID: <278458B5EF9C42188601CFE5D5574649@SSI.CORP> Amit wrote: > Would still like to know as to why the try-catch ends up killing tail > recursion. Can't the compiler catch this (pun intended) and optimize it > for > tail recursion? Well, you *could* remove the try-catch and put that in a function that calls do_maintenance/3, enabling the tail-call optimization, but that would change the semantics of the function. I believe the function, as written, would need to keep the stack around (that is, not optimize the tail-call - which isn't really a tail-call, since it is within the try-catch) unless you decide to carry around an accumulator with the state that would have been in the stack (specifically, a list of Oldest's). That is, whatever mechanism you use to handle errors in the error-handler would have to be handled in a tail-call-optimizable way. I'm sure someone else can explain it better than me, but I'm thinking of errors in the call on the following line: > do_maintenance(CacheSz, HKIntvl, Oldest) Your code, as written, handles that by pushing it up to the next exception handler on the stack. If you were to tail-call-optimize that stack frame away, then the behavior of your program has changed. Cheers, David > -----Original Message----- > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On > Behalf Of Amit Murthy > Sent: Sunday, August 16, 2009 8:15 AM > To: Erlang > Subject: [erlang-questions] tail recursion : sharing a learning and a > question > > Hi, > > I just learned that every iteration of the below code goes onto the stack. > The evaluation of the "catch" has something to do with it though I could > understand why. > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %% Bad code, Bad code, Bad code, Bad code, Bad code, Bad code, > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > do_maintenance(CacheSz, HKIntvl, Oldest) -> > try > receive > Message -> > met_util:log_info(" pid -~p recieved unexpected > message[~p]. > ",[self(), Message]) > > after HKIntvl -> > NOldest = do_cleanup(CacheSz, Oldest, 100), > do_maintenance(CacheSz, HKIntvl, NOldest) > end > catch > error:Error -> > met_util:log("~p do_maintenance() caught exception -> > ~p",[?MODULE, Error]), > do_maintenance(CacheSz, HKIntvl, Oldest) > end. > > %%%%%%% > > The right way of course is to not trap exceptions here, remove the try- > catch > and put the whole thing under a supervisor (with restart) behavior. > Which is what I have done now. > > Would still like to know as to why the try-catch ends up killing tail > recursion. Can't the compiler catch this (pun intended) and optimize it > for > tail recursion? > > Regards, > Amit From richardc@REDACTED Mon Aug 17 18:42:58 2009 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 17 Aug 2009 18:42:58 +0200 Subject: [erlang-questions] tail recursion : sharing a learning and a question In-Reply-To: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> References: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> Message-ID: <4A898892.1070305@it.uu.se> Amit Murthy wrote: > I just learned that every iteration of the below code goes onto the stack. > The evaluation of the "catch" has something to do with it > > do_maintenance(CacheSz, HKIntvl, Oldest) -> > try > receive > ... > after HKIntvl -> > ... > do_maintenance(CacheSz, HKIntvl, NOldest) > end > catch > error:Error -> > ... > do_maintenance(CacheSz, HKIntvl, Oldest) > end. > > The right way of course is to not trap exceptions here, remove the try-catch > and put the whole thing under a supervisor (with restart) behavior. > Which is what I have done now. It would be sufficient to rewrite it like this: do_maintenance(CacheSz, HKIntvl, Oldest) -> try receive ..., Oldest after HKIntvl -> ..., NOldest end of NewOldest -> do_maintenance(CacheSz, HKIntvl, NewOldest) catch error:Error -> ... do_maintenance(CacheSz, HKIntvl, Oldest) end. The "protected" part of the code is the one between 'try' and 'of', or between 'try' and 'catch' if there is no 'of' section. In the protected part, tail recursive calls are not possible. (The call in the 'catch...end' section, however, is tail recursive here.) Basically, what your version of the code says is "if the recursive call fails, we must catch that before we are allowed to exit from the current call". The rewritten version above says "do the receive and the log_info or cleanup, and catch any errors in that part (but only in that part), then do a tail call to exit from the current call". > Would still like to know as to why the try-catch ends up killing tail > recursion. Can't the compiler catch this (pun intended) and optimize it for > tail recursion? No, because what the code says is that it should catch errors that may happen in the recursive call, and handle the errors using the context of the current call (e.g., the current value of Oldest). This means that the compiler must keep the stack entry for the current call until the recursive call has finished. Hence, no tail recursion optimization. /Richard From info@REDACTED Mon Aug 17 19:08:58 2009 From: info@REDACTED (info) Date: Mon, 17 Aug 2009 19:08:58 +0200 Subject: [erlang-questions] gen_tcp:connect References: <200908171707262320427@its3.ch>, <20090817152109.GA12284@erix.ericsson.se> Message-ID: <200908171908582524437@its3.ch> I tried this: gen_tcp:connect("www.google.com",80,[binary,{packet,0}]). Same result: {error,timeout} firewall problem ? On Mon, Aug 17, 2009 at 05:07:26PM +0200, info wrote: > Hello, > I tried this: > gen_tcp:connect("www.erlang.org",80,[binary,{packet,0}]). > I obtain: > {error,timeout} > > any idea ? The server has been down since saturday evening local time until monday 14:28. Sorry about that. Can this be the problem? Otherwise maybe an HTTP proxy? -- / Raimo Niskanen, Erlang/OTP, Ericsson AB ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From amit.murthy@REDACTED Sun Aug 16 12:02:38 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Sun, 16 Aug 2009 15:32:38 +0530 Subject: eunit question Message-ID: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> Hi, I am using eunit for some simple tests and within a test have a need to sleep for a couple of seconds, i.e. the test function flows something like this: func_test() -> some erlang code... wait_for_2_seconds(), some more erlang code.... To implement the wait_for_2_seconds() I have tried receive after 2000 -> ok end, and timer:sleep(2000), as well as writing a simple spin wait function that just does idle recursive execution in place for 2 seconds. All of the above basically result in my eunit test function just hanging forever and the last line printed on screen is met_fb:request_content_ban_test...*timed out* where met_fb is the module under test and request_content_ban_test is the test function. The actual test function is request_content_ban_test() -> ?debugFmt("~n~nTEST : request_content_ban", []), ok = request_content_ban(2, 1, 1, 2, 1), ok = request_content_ban(3, 1, 1, 3, 2), % spin loop for 2 seconds spin_loop(epoch_secs(), 2), ?debugFmt("~n~nTEST : get_content_to_review", []), Now = epoch_secs(), [2,3] = get_content_to_review(1, 1, Now - 120), ok = request_content_ban(4, 1, 1, 9, 3), [4] = get_content_to_review(1, 1, Now - 1). Would appreciate any help in figuring out what is going on here. Regards, Amit From richardc@REDACTED Mon Aug 17 20:11:04 2009 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 17 Aug 2009 20:11:04 +0200 Subject: [erlang-questions] eunit question In-Reply-To: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> References: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> Message-ID: <4A899D38.9090208@it.uu.se> Amit Murthy wrote: > All of the above basically result in my eunit test function just hanging > forever and the last line printed on screen is > > met_fb:request_content_ban_test...*timed out* Older versions of eunit (before OTP R13B) used to have this kind of problem. Which version are you using? /Richard From amit.murthy@REDACTED Mon Aug 17 20:13:49 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Mon, 17 Aug 2009 23:43:49 +0530 Subject: [erlang-questions] tail recursion : sharing a learning and a question In-Reply-To: <4A898892.1070305@it.uu.se> References: <4f5fdb630908160614x54ae9c5dx644b32780c91e90d@mail.gmail.com> <4A898892.1070305@it.uu.se> Message-ID: <4f5fdb630908171113j5f890098y45abcf2194633b0c@mail.gmail.com> Thanks Richard. A pretty neat solution and a very clear explanation. Amit On Mon, Aug 17, 2009 at 10:12 PM, Richard Carlsson wrote: > Amit Murthy wrote: > >> I just learned that every iteration of the below code goes onto the stack. >> The evaluation of the "catch" has something to do with it >> >> do_maintenance(CacheSz, HKIntvl, Oldest) -> >> try >> receive >> ... >> after HKIntvl -> >> ... >> do_maintenance(CacheSz, HKIntvl, NOldest) >> end >> catch >> error:Error -> >> ... >> do_maintenance(CacheSz, HKIntvl, Oldest) >> end. >> >> The right way of course is to not trap exceptions here, remove the >> try-catch >> and put the whole thing under a supervisor (with restart) behavior. >> Which is what I have done now. >> > > It would be sufficient to rewrite it like this: > > do_maintenance(CacheSz, HKIntvl, Oldest) -> > try > receive > ..., > Oldest > after HKIntvl -> > ..., > NOldest > end > of > NewOldest -> do_maintenance(CacheSz, HKIntvl, NewOldest) > catch > error:Error -> > ... > do_maintenance(CacheSz, HKIntvl, Oldest) > end. > > The "protected" part of the code is the one between 'try' and 'of', > or between 'try' and 'catch' if there is no 'of' section. In the > protected part, tail recursive calls are not possible. (The call > in the 'catch...end' section, however, is tail recursive here.) > > Basically, what your version of the code says is "if the recursive > call fails, we must catch that before we are allowed to exit from > the current call". The rewritten version above says "do the receive > and the log_info or cleanup, and catch any errors in that part (but > only in that part), then do a tail call to exit from the current call". > > Would still like to know as to why the try-catch ends up killing tail >> recursion. Can't the compiler catch this (pun intended) and optimize it >> for >> tail recursion? >> > > No, because what the code says is that it should catch errors that may > happen in the recursive call, and handle the errors using the context of > the current call (e.g., the current value of Oldest). This means that > the compiler must keep the stack entry for the current call until the > recursive call has finished. Hence, no tail recursion optimization. > > /Richard > From amit.murthy@REDACTED Mon Aug 17 20:15:36 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Mon, 17 Aug 2009 23:45:36 +0530 Subject: [erlang-questions] eunit question In-Reply-To: <4A899D38.9090208@it.uu.se> References: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> <4A899D38.9090208@it.uu.se> Message-ID: <4f5fdb630908171115l3daaa4a6vb46a8c584e3a60ec@mail.gmail.com> R13A. I guess that explains it. On Mon, Aug 17, 2009 at 11:41 PM, Richard Carlsson wrote: > Amit Murthy wrote: > >> All of the above basically result in my eunit test function just hanging >> forever and the last line printed on screen is >> >> met_fb:request_content_ban_test...*timed out* >> > > Older versions of eunit (before OTP R13B) used to have this > kind of problem. Which version are you using? > > /Richard > > From prikrutil@REDACTED Mon Aug 17 21:40:30 2009 From: prikrutil@REDACTED (Sergey Samokhin) Date: Mon, 17 Aug 2009 12:40:30 -0700 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> Message-ID: Hello! > Soon I'm going make a list of document oriented and Key-Value db with > bindings for Erlang and post it in this thread. Here are listed distributed key-value storages I've found with Erlang bindings (with no particular order): 1) Dynomite http://github.com/cliffmoon/dynomite/tree/master 2) There are at least three interfaces for Tokyo Cabinet: http://code.google.com/p/tcerl/ http://github.com/mccoy/medici/tree/master http://github.com/mallipeddi/tora/tree/master (the last commit was in February 2009) 3) Kai http://sourceforge.net/projects/kai/ 4) Ringo. http://github.com/tuulos/ringo/tree/master It seems that Ringo is no longer under active development. The last commit was in December 17, 2008 5) Scalaris http://code.google.com/p/scalaris/ 6) Riak http://riak.basho.com/ 7) MongoDB http://github.com/eliast/mongo-erlang-driver/tree/master 8) CouchDB Search results on github: http://github.com/search?type=Repositories&language=erlang&q=couchdb&repo=&langOverride=&x=0&y=0&start_value=1 9) MotionDB http://github.com/dilshod/MotionDb/tree/master Let me know if I missed anything. Now it's time to test them =) -- Sergey Samokhin From kiszl@REDACTED Mon Aug 17 21:47:29 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 17 Aug 2009 21:47:29 +0200 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> Message-ID: <4A89B3D1.5020306@tmit.bme.hu> Memcached ? http://code.google.com/p/erlangmc/ http://code.google.com/p/cacherl/ Regards, Zoltan. Sergey Samokhin wrote: > Hello! > > >> Soon I'm going make a list of document oriented and Key-Value db with >> bindings for Erlang and post it in this thread. >> > > Here are listed distributed key-value storages I've found with Erlang > bindings (with no particular order): > > 1) Dynomite > > http://github.com/cliffmoon/dynomite/tree/master > > 2) There are at least three interfaces for Tokyo Cabinet: > > http://code.google.com/p/tcerl/ > http://github.com/mccoy/medici/tree/master > http://github.com/mallipeddi/tora/tree/master (the last commit was in > February 2009) > > 3) Kai > > http://sourceforge.net/projects/kai/ > > 4) Ringo. > > http://github.com/tuulos/ringo/tree/master > > It seems that Ringo is no longer under active development. The last > commit was in December 17, 2008 > > 5) Scalaris > > http://code.google.com/p/scalaris/ > > 6) Riak > > http://riak.basho.com/ > > 7) MongoDB > > http://github.com/eliast/mongo-erlang-driver/tree/master > > 8) CouchDB > > Search results on github: > > http://github.com/search?type=Repositories&language=erlang&q=couchdb&repo=&langOverride=&x=0&y=0&start_value=1 > > 9) MotionDB > > http://github.com/dilshod/MotionDb/tree/master > > Let me know if I missed anything. > > Now it's time to test them =) > > From john.erickson@REDACTED Mon Aug 17 22:35:48 2009 From: john.erickson@REDACTED (Erickson, John) Date: Mon, 17 Aug 2009 14:35:48 -0600 Subject: C++ port having trouble printing to cout Message-ID: <3C44D46958109E408F5848593B05A1D8BFCCC9D9@rrsmsx505.amr.corp.intel.com> Hi, I have written a C++ port for some Erlang code and although I am able to get data in and out of the port without any problems, trying to do output in the C++ code with cout is unreliable. Usually if something is printed in Erlang after the call to the port returns, it will be printed instead of the last couple hundred lines of output from C++. I have tried putting cout.flush() in my code but it does not help. Single stepping through the code in gdb will print all output, but anytime I run at full speed I lose output. John From jim.mccoy@REDACTED Mon Aug 17 22:46:42 2009 From: jim.mccoy@REDACTED (Jim McCoy) Date: Mon, 17 Aug 2009 13:46:42 -0700 Subject: [erlang-questions] Which distributed key-value storage do you use? In-Reply-To: References: <6a3ae47e0908120127k9013968n7dc172dd2411a4b1@mail.gmail.com> Message-ID: [...] > 2) There are at least three interfaces for Tokyo Cabinet: > > http://code.google.com/p/tcerl/ > http://github.com/mccoy/medici/tree/master > http://github.com/mallipeddi/tora/tree/master (the last commit was in > February 2009) Just for reference, tcerl is an linked-in driver interface for Tokyo Cabinet (the in-process db) while Harish and I provide interfaces to Tokyo Tyrant (the network-enabled stand-alone version of tokyo cabinet.) There are things that a "real" Tokyo Cabinet linked-in driver would be able to do that Tyrant interfaces will never be able to accomplish (e.g. iteration over all elements with any assurances that you will actually hit all elements, etc) and it will always be able to do it faster. The upside to Tyrant is that you can do everything over the network. Jim From mjtruog@REDACTED Mon Aug 17 23:08:56 2009 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 17 Aug 2009 14:08:56 -0700 Subject: [erlang-questions] C++ port having trouble printing to cout In-Reply-To: <3C44D46958109E408F5848593B05A1D8BFCCC9D9@rrsmsx505.amr.corp.intel.com> References: <3C44D46958109E408F5848593B05A1D8BFCCC9D9@rrsmsx505.amr.corp.intel.com> Message-ID: <4A89C6E8.2070006@gmail.com> Erlang ports normally use stdin/stdout for communication. To change it use erlang:open_port/2 with option nouse_stdio so that erlang does not communicate on stdin/stdout. Remember std::cerr is still available either way, and for some reason the linux/unix erlang shell prefers "\r\n" instead of std::endl ("\n") when outputting to stderr. Erickson, John wrote: > Hi, I have written a C++ port for some Erlang code and although I am able to get data in and out of the port without any problems, trying to do output in the C++ code with cout is unreliable. Usually if something is printed in Erlang after the call to the port returns, it will be printed instead of the last couple hundred lines of output from C++. I have tried putting cout.flush() in my code but it does not help. Single stepping through the code in gdb will print all output, but anytime I run at full speed I lose output. > > John > > From vss@REDACTED Mon Aug 17 23:22:49 2009 From: vss@REDACTED (Vlad Skvortsov) Date: Mon, 17 Aug 2009 14:22:49 -0700 Subject: erl -remsh doesn't connect to a running node -- solution Message-ID: <4A89CA29.6030908@73rus.com> Hi, for a long time I've been suffering from a weird issue. When connecting to our production boxes, e.g. devbox$ ssh prod prod$ erl -sname vss$$ -remsh node@REDACTED (note that the beam is running on the same box) ...I'd then issue something like "registered()." and note that I'm not really connected to the production Erlang. It would be just a brand new Erlang node. However, when connecting from another box, I'd successfully connect to our system. I was puzzled by that for quite a while and today my colleague pointed out that the issue is linked to the TERM setting I'd use. When ssh'ing from, say, Solaris to FreeBSD, the terminal setting gets set to "xtermc", which is invalid on FreeBSD. Running 'erl' in interactive mode with invalid TERM setting screws things up somehow and that's why 'erl' doesn't connect to a running beam, but starts a new node instead (yeah, without a warning). I hope this will be of help to someone else. -- Vlad Skvortsov, vss@REDACTED, http://vss.73rus.com From john.erickson@REDACTED Mon Aug 17 23:31:12 2009 From: john.erickson@REDACTED (Erickson, John) Date: Mon, 17 Aug 2009 15:31:12 -0600 Subject: [erlang-questions] C++ port having trouble printing to cout In-Reply-To: <4A89C6E8.2070006@gmail.com> References: <3C44D46958109E408F5848593B05A1D8BFCCC9D9@rrsmsx505.amr.corp.intel.com> <4A89C6E8.2070006@gmail.com> Message-ID: <3C44D46958109E408F5848593B05A1D8BFCCCAB8@rrsmsx505.amr.corp.intel.com> Thanks for the suggestion, but that doesn't seem to solve my problem. I should have mentioned earlier, I am using spawn_driver, which I believe does not use any file descriptors. I also tried using cerr, but it does not seem to work any better. -----Original Message----- From: Michael Truog [mailto:mjtruog@REDACTED] Sent: Monday, August 17, 2009 4:09 PM To: Erickson, John Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] C++ port having trouble printing to cout Erlang ports normally use stdin/stdout for communication. To change it use erlang:open_port/2 with option nouse_stdio so that erlang does not communicate on stdin/stdout. Remember std::cerr is still available either way, and for some reason the linux/unix erlang shell prefers "\r\n" instead of std::endl ("\n") when outputting to stderr. Erickson, John wrote: > Hi, I have written a C++ port for some Erlang code and although I am able to get data in and out of the port without any problems, trying to do output in the C++ code with cout is unreliable. Usually if something is printed in Erlang after the call to the port returns, it will be printed instead of the last couple hundred lines of output from C++. I have tried putting cout.flush() in my code but it does not help. Single stepping through the code in gdb will print all output, but anytime I run at full speed I lose output. > > John > > From info@REDACTED Tue Aug 18 01:04:56 2009 From: info@REDACTED (info) Date: Tue, 18 Aug 2009 00:04:56 +0100 Subject: difference for tcp between PHP and Erlang Message-ID: <200908180004564504146@its3.ch> Hi all, I can execute fsockopen("www.google.com",80) with PHP but not gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) with erlang which returns {error,timeout} ! why ? From amit.murthy@REDACTED Sun Aug 16 14:24:47 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Sun, 16 Aug 2009 17:54:47 +0530 Subject: eunit question In-Reply-To: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> References: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> Message-ID: <4f5fdb630908160524l64291318va733e04dddc396e2@mail.gmail.com> My bad. Seems like the default timeout for a single test is 5 seconds. I increased it using the "timeout" test descriptor and things are OK now. But I still don't understand why my erlang console should just hang after the "met_fb:request_content_ban_test...*timed out*" message is printed. Amit On Sun, Aug 16, 2009 at 3:32 PM, Amit Murthy wrote: > Hi, > > I am using eunit for some simple tests and within a test have a need to > sleep for a couple of seconds, i.e. the test function flows something like > this: > > func_test() -> > some erlang code... > wait_for_2_seconds(), > some more erlang code.... > > > To implement the wait_for_2_seconds() I have tried > receive after 2000 -> ok end, and > timer:sleep(2000), > as well as writing a simple spin wait function that just does idle > recursive execution in place for 2 seconds. > > All of the above basically result in my eunit test function just hanging > forever and the last line printed on screen is > > met_fb:request_content_ban_test...*timed out* > > where met_fb is the module under test and request_content_ban_test is the > test function. > > The actual test function is > > request_content_ban_test() -> > ?debugFmt("~n~nTEST : request_content_ban", []), > ok = request_content_ban(2, 1, 1, 2, 1), > ok = request_content_ban(3, 1, 1, 3, 2), > > % spin loop for 2 seconds > spin_loop(epoch_secs(), 2), > > ?debugFmt("~n~nTEST : get_content_to_review", []), > Now = epoch_secs(), > [2,3] = get_content_to_review(1, 1, Now - 120), > > > ok = request_content_ban(4, 1, 1, 9, 3), > [4] = get_content_to_review(1, 1, Now - 1). > > > > Would appreciate any help in figuring out what is going on here. > > Regards, > Amit > From baryluk@REDACTED Tue Aug 18 00:25:59 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Tue, 18 Aug 2009 00:25:59 +0200 Subject: [erlang-questions] difference for tcp between PHP and Erlang In-Reply-To: <200908180004564504146@its3.ch> References: <200908180004564504146@its3.ch> Message-ID: <1250547959.6089.326.camel@sredniczarny> Dnia 2009-08-18, wto o godzinie 00:04 +0100, info pisze: > gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) gen_tcp:connect("www.google.com",80,[binary,{packet,0}]). {ok,#Port<0.525>} Works here. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From mononcqc@REDACTED Tue Aug 18 03:11:57 2009 From: mononcqc@REDACTED (Fred Hebert (MononcQc)) Date: Mon, 17 Aug 2009 21:11:57 -0400 Subject: Learn you some Erlang for great good! In-Reply-To: <8b9ee55b0907281003g311d71f9ie6ef1ddb141646ae@mail.gmail.com> References: <8b9ee55b0907281003g311d71f9ie6ef1ddb141646ae@mail.gmail.com> Message-ID: <8b9ee55b0908171811g2bfd8629kfecb3b5a5abea447@mail.gmail.com> On Tue, Jul 28, 2009 at 1:03 PM, Fred Hebert (MononcQc) wrote: > Some of the readers of this list may be familiar with > http://learnyouahaskell.com/, an online book/tutorial dedicated to teaching > Haskell in a lighthearted way. > I've always thought Erlang had a steep learning curve unless you decide to > pay for books (the few of them are excellent, though). A good while ago, I > took time to discuss with the author of Learn You a Haskell and I decided to > start a version specifically for Erlang with his agreement. The objectives > are pretty much the same (lighthearted tutorials for beginners, free of > charge) and so is the concept. > I've written a few chapters already (Introduction, how to install, basic > shell commands, some of the basic data types) and although the text is still > very short, I've got a website up and running. > I'm looking for a few people with different levels of knowledge of Erlang in > order to review the first chapters. I'm looking to validate:? a. the > accessibility of information; b. if the information is right; c. gather > comments and criticism. I find it important to do a first review early in > the writing in order to fix flaws or improve on parts of the writing before > having to change too much stuff. > If you feel like giving me a helping hand in making the first chapters as > good as possible through your reviews, just send me an email back. I'll > forward the URL and user/password needed to see the info (I'm protecting > everything until reviewed, in order not to broadcast false or inappropriate > information). > Of course, once the first chapters are pushed in production, I'll keep > writing and might ask for some more help, if you don't mind the occasional > email. > Thanks in advance. Updating this to say Learn You Some Erlang's first 3 chapters are finally online! http://learnyousomeerlang.com Thanks to the bunch of people from this mailing list and the two erlang channels on IRC for the help, too! From amit.murthy@REDACTED Tue Aug 18 06:03:45 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Tue, 18 Aug 2009 09:33:45 +0530 Subject: [erlang-questions] eunit question In-Reply-To: <4f5fdb630908171115l3daaa4a6vb46a8c584e3a60ec@mail.gmail.com> References: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> <4A899D38.9090208@it.uu.se> <4f5fdb630908171115l3daaa4a6vb46a8c584e3a60ec@mail.gmail.com> Message-ID: <4f5fdb630908172103xccf3ce6s649f95899b67bf12@mail.gmail.com> Also the default timeout of around 5 seconds for a single test does not seem to have been documented anywhere. Once I increased it using the "timeout" control specification, my test cases went through. Amit On Mon, Aug 17, 2009 at 11:45 PM, Amit Murthy wrote: > R13A. I guess that explains it. > > > On Mon, Aug 17, 2009 at 11:41 PM, Richard Carlsson wrote: > >> Amit Murthy wrote: >> >>> All of the above basically result in my eunit test function just hanging >>> forever and the last line printed on screen is >>> >>> met_fb:request_content_ban_test...*timed out* >>> >> >> Older versions of eunit (before OTP R13B) used to have this >> kind of problem. Which version are you using? >> >> /Richard >> >> > From dave.pawson@REDACTED Tue Aug 18 09:27:05 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 18 Aug 2009 08:27:05 +0100 Subject: atoms used as status info, 'constants' etc Message-ID: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> I'm using atoms as status value returns from functions. Is there any 'best practice' in this area? In other languages I might keep them together as defined constants or some such? TIA -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From mingyan.wang@REDACTED Tue Aug 18 09:37:45 2009 From: mingyan.wang@REDACTED (Mingyan Wang) Date: Tue, 18 Aug 2009 15:37:45 +0800 Subject: [erlang-questions] atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> Message-ID: <69D40FFD34406846B48E3C55F9AC8EBE070E12B7@ecnshmw511.eapac.ericsson.se> Hi Dave, Define the constants in a hrl file. E.g. -define(status_a,"status_a"). Include this hrl file in your erl file and then you can use this syntax ?status_a. E.g. case Status of ?status_a -> ...... -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Dave Pawson Sent: 2009?8?18? 15:27 To: Erlang Questions Subject: [erlang-questions] atoms used as status info, 'constants' etc I'm using atoms as status value returns from functions. Is there any 'best practice' in this area? In other languages I might keep them together as defined constants or some such? TIA -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From mingyan.wang@REDACTED Tue Aug 18 09:50:28 2009 From: mingyan.wang@REDACTED (Mingyan Wang) Date: Tue, 18 Aug 2009 15:50:28 +0800 Subject: [erlang-questions] atoms used as status info, 'constants' etc In-Reply-To: <69D40FFD34406846B48E3C55F9AC8EBE070E12B7@ecnshmw511.eapac.ericsson.se> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <69D40FFD34406846B48E3C55F9AC8EBE070E12B7@ecnshmw511.eapac.ericsson.se> Message-ID: <69D40FFD34406846B48E3C55F9AC8EBE070E12F6@ecnshmw511.eapac.ericsson.se> Sorry for mistake. The following should be correct. -define(status_a,status_a). -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Mingyan Wang Sent: 2009?8?18? 15:38 To: Dave Pawson; Erlang Questions Subject: RE: [erlang-questions] atoms used as status info, 'constants' etc Hi Dave, Define the constants in a hrl file. E.g. -define(status_a,"status_a"). Include this hrl file in your erl file and then you can use this syntax ?status_a. E.g. case Status of ?status_a -> ...... -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Dave Pawson Sent: 2009?8?18? 15:27 To: Erlang Questions Subject: [erlang-questions] atoms used as status info, 'constants' etc I'm using atoms as status value returns from functions. Is there any 'best practice' in this area? In other languages I might keep them together as defined constants or some such? TIA -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From richardc@REDACTED Tue Aug 18 10:06:10 2009 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 18 Aug 2009 10:06:10 +0200 Subject: [erlang-questions] Re: eunit question In-Reply-To: <4f5fdb630908160524l64291318va733e04dddc396e2@mail.gmail.com> References: <4f5fdb630908160302uaee513dh4fffc4913b6a229f@mail.gmail.com> <4f5fdb630908160524l64291318va733e04dddc396e2@mail.gmail.com> Message-ID: <4A8A60F2.7070508@it.uu.se> Amit Murthy wrote: > My bad. > > Seems like the default timeout for a single test is 5 seconds. I increased > it using the "timeout" test descriptor and things are OK now. > > But I still don't understand why my erlang console should just hang after > the "met_fb:request_content_ban_test...*timed out*" message is printed. It's the eunit frontend that hangs; it's still waiting for some message from the test, and doesn't return to the shell. But as far as I know, this only happens in versions before R13B. /Richard From steven.charles.davis@REDACTED Tue Aug 18 10:24:38 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 18 Aug 2009 01:24:38 -0700 (PDT) Subject: atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> Message-ID: Dave, Here's my 2c on this one. 1) reuse atoms that are also used as return values from other modules in the OTP platform where it makes sense, 2) try to name the atoms cleverly for best grok-ability 3) if you return an unpredictable number of status values, then use "string" status values 3a) and... by "string" then probably it is "better" to use a binary representation of the text, e.g. <<"my unpredictable return value">> Regards, /sd On Aug 18, 2:27?am, Dave Pawson wrote: > I'm using atoms as status value returns from functions. > Is there any 'best practice' in this area? > ? In other languages I might keep them together as defined constants > or some such? > > TIA > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ.http://www.dpawson.co.uk > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From dave.pawson@REDACTED Tue Aug 18 10:24:58 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 18 Aug 2009 09:24:58 +0100 Subject: Fwd: FW: [erlang-questions] atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180124t591881d0gad0b53cf8ceda74b@mail.gmail.com> References: <69D40FFD34406846B48E3C55F9AC8EBE070E12DA@ecnshmw511.eapac.ericsson.se> <711a73df0908180124t591881d0gad0b53cf8ceda74b@mail.gmail.com> Message-ID: <711a73df0908180124y28a7a866x90050d7a3641c599@mail.gmail.com> Hi 2009/8/18 Mingyan Wang : > > If you use atom, define the constants in a hrl file. > E.g. > -define(status_a,status_a). As a macro? then >Include this hrl file in your erl file and then you can use this syntax ?status_a. >E.g. >case Status of ?>?status_a -> >..... I've only seen .hrl files used for records! Makes sense though. thanks for that. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Tue Aug 18 10:29:45 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 18 Aug 2009 09:29:45 +0100 Subject: [erlang-questions] Re: atoms used as status info, 'constants' etc In-Reply-To: References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> Message-ID: <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> Hi Steve. 2009/8/18 Steve Davis : > Dave, > Here's my 2c on this one. > > 1) reuse atoms that are also used as return values from other modules > in the OTP platform where it makes sense, Makes sense. I'm using ok etc as I've seen it used. > 2) try to name the atoms cleverly for best grok-ability :-) OK. by the reader I guess. > 3) if you return an unpredictable number of status values, then use > "string" status values See below* > 3a) and... by "string" then probably it is "better" to use a binary > representation of the text, e.g. <<"my unpredictable return value">> Never even seen that way of building a string! My problem is a function that should return, say, a record, yet the sought record does not exist? Return a 'dummy' / null record or Just a status value? Groking in the case would be by the Erlang code rather than the user. suggestions on how to handle this please? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From torben.lehoff@REDACTED Tue Aug 18 10:33:00 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 18 Aug 2009 10:33:00 +0200 Subject: Getting reltool to work Message-ID: Hi, I have a set of OTP applications that I would like to turn into a real, deployable release with minimum pain (as usual). Hence, I looked at reltool and tried to give it a spin, but when I try to point my root_dir to where I have all my applications I get complaints about the lack of a lib directory. This is 100% true - I do not have such a dir, not even in the directories for the individual applications (which all follow OTP directory structure). There seems to be some sort or requirements on my directory structure that I cannot read out of the reltool documentation - could someone please give me a hint on how to proceed? Thanks in advance, Torben -- http://www.linkedin.com/in/torbenhoffmann From amit.murthy@REDACTED Tue Aug 18 10:41:34 2009 From: amit.murthy@REDACTED (Amit Murthy) Date: Tue, 18 Aug 2009 14:11:34 +0530 Subject: [erlang-questions] Re: atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> Message-ID: <4f5fdb630908180141k469cd187t984b4a2eabb0541a@mail.gmail.com> Maybe tangentially relevant here. Whenever I have a large number of constants of the same type, which I would have defined as an enum in some other language, I just define a record for the same. For example, -record(myerrors, {ok, timedout, internal_err, err2, err3....}). And in the erlang code (and external database inserts wherever applicable), I just use the positional value of the enum, i.e. #myerrors.ok or #myerrors.internal_err and so on. This way I get code readability, external db representation as well as grouping of like entities. The enums of course end up starting from the number 2, but then I don't really care for the value. Amit On Tue, Aug 18, 2009 at 1:59 PM, Dave Pawson wrote: > Hi Steve. > > 2009/8/18 Steve Davis : > > Dave, > > Here's my 2c on this one. > > > > 1) reuse atoms that are also used as return values from other modules > > in the OTP platform where it makes sense, > > Makes sense. I'm using ok etc as I've seen it used. > > > > 2) try to name the atoms cleverly for best grok-ability > :-) OK. by the reader I guess. > > > > 3) if you return an unpredictable number of status values, then use > > "string" status values > > See below* > > > 3a) and... by "string" then probably it is "better" to use a binary > > representation of the text, e.g. <<"my unpredictable return value">> > > Never even seen that way of building a string! > > > My problem is a function that should return, say, a record, yet > the sought record does not exist? > Return a 'dummy' / null record or > Just a status value? > Groking in the case would be by the Erlang code rather > than the user. > > suggestions on how to handle this please? > > > regards > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From baryluk@REDACTED Tue Aug 18 10:54:12 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Tue, 18 Aug 2009 10:54:12 +0200 Subject: [erlang-questions] Re: atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> Message-ID: <1250585652.6089.450.camel@sredniczarny> Dnia 2009-08-18, wto o godzinie 09:29 +0100, Dave Pawson pisze: > Hi Steve. > > 2009/8/18 Steve Davis : > > Dave, > > Here's my 2c on this one. > > > > 1) reuse atoms that are also used as return values from other modules > > in the OTP platform where it makes sense, > > Makes sense. I'm using ok etc as I've seen it used. > > > > 2) try to name the atoms cleverly for best grok-ability > :-) OK. by the reader I guess. > > > > 3) if you return an unpredictable number of status values, then use > > "string" status values > > See below* > > > 3a) and... by "string" then probably it is "better" to use a binary > > representation of the text, e.g. <<"my unpredictable return value">> > > Never even seen that way of building a string! > > > My problem is a function that should return, say, a record, yet > the sought record does not exist? > Return a 'dummy' / null record or > Just a status value? > Groking in the case would be by the Erlang code rather > than the user. > > suggestions on how to handle this please? > > > regards > Generally it depends. If there is good default value, you can use "dummy" record, but mostly you want to distinguish beetween existing and not existing data. If you know that you always return record, anything which isn't record, like atom 'notfound', or 'error', or {error, not_found} will be sufficient, because in somewhere on calle side you will match returned value to the record, and this will crash (which is good). There are 4 main conventions in case of returning general values: 1. something which is distinguishable, because of type: return Tuple | false (like list:keyfind/3) or {ok, Value} | error (like dict:find/2) or {value, Value} | none (like gb_trees:lookup/2) 2. something which can be confused with value: return Value | undefined (erlang:get/1) or none | Value (like proplists:lookup/2) 3. throw exception if record is not found (like dict:fetch/2, orddict:fetch/2) 4. provide argument for default return value, (like proplists:lookup/3). -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From steven.charles.davis@REDACTED Tue Aug 18 11:03:13 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 18 Aug 2009 02:03:13 -0700 (PDT) Subject: "New" SSL - a problem (which could be mine) and a suggestion Message-ID: <16a9f999-54b7-49b5-9258-193cd97cb5e8@j21g2000yqe.googlegroups.com> I'm adding SSL to an http server, I'm only supporting the new_ssl implementation, and thus it's alpha quality for at least as long as the new_ssl implementation remains that way ;). However, be aware that the following comments apply to *new_ssl* and not "old ssl". 1) A problem: I'm finding that the ssl_accept hands over client sockets that appear to close out immediately, frequently and unexpectedly. The real problem is that this issue is intermittent. In about 50% of cases of a connection I'm getting: =INFO REPORT==== 18-Aug-2009::03:15:24 === SSL: Peer did not send close notify alert. ...but no other error(s) at all (This info report is generated from the ssl_connection module in the ssl app). In about 20% of these unexpected close cases, the socket also errors out with [[{initial_call,{ewok_tcp_srv,accept,['Argument__1']}}, {pid,<0.3865.0>}, {registered_name,[]}, {error_info,{error,{badmatch,{error,closed}}, [{ewok_tcp_srv,accept,1}, {proc_lib,init_p_do_apply,3}]}}, {ancestors,[ewok_http_srv,ewok_sup,<0.3830.0>]}, {messages,[]}, {links,[<0.3841.0>]}, {dictionary,[]}, {trap_exit,false}, {status,running}, {heap_size,610}, {stack_size,24}, {reductions,584}], []] Occasionally, ssl:send *silently* but entirely fails. Since the exact same socket handling code flow is used for the plain gen_tcp, which doesn't suffer from these issues, I'm suspecting that it isn't my code here. I'm making appropriate checks later in the handler to check for closed-out/timed out sockets but these checks are never reached/triggered. My question is whether this a known issue? i.e. if not, then I'll have to find time to pull out a vanilla repro from the server codebase to effectively bug-report -- that kind of time I am sadly sorely short of. 2) A suggestion: new_ssl is generally easier to use, however it suffers from one important API usage issue as old ssl... In order to use setopts/send/recv/close you need to know the transport (gen_tcp or ssl) throughout the socket lifetime. This means that throughout the later handling of the client socket, when you really do not (and should not have to) care what transport is being used, you are forced to case check at every turn whether the socket is ssl or inet. My suggestion is design-level and is that either inet/gen_tcp should be made aware of the differing transports or that some platform level abstracted interface to the socket implementation be provided so you can call socket:set_opts, socket:send, socket:recv, socket:close without checking which module to invoke. This would improve usability considerably. BR, /sd From hakan@REDACTED Tue Aug 18 11:07:42 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 18 Aug 2009 11:07:42 +0200 (CEST) Subject: [erlang-questions] Getting reltool to work In-Reply-To: References: Message-ID: On Tue, 18 Aug 2009, Torben Hoffmann wrote: > I have a set of OTP applications that I would like to turn into a real, > deployable release with minimum pain (as usual). > > Hence, I looked at reltool and tried to give it a spin, but when I try to > point my root_dir to where I have all my applications I get complaints about > the lack of a lib directory. > > This is 100% true - I do not have such a dir, not even in the directories > for the individual applications (which all follow OTP directory structure). > > There seems to be some sort or requirements on my directory structure that I > cannot read out of the reltool documentation - could someone please give me > a hint on how to proceed? The 'root_dir' must refer to the root directory of an installed Erlang system. If you have additional applications that do not reside under under its lib directory, you can either user the ERL_LIBS environment variable (see the man page for code) to refer to additional "lib" directories. Or you can use the configuration parameter 'lib_dirs' in reltool to obtain the same result. A lib direcory is expected to contain application top directories. Unfortunately the target generation part of reltool does not work so well in the current release.It will be greatly improved in R13B02. Contact me privately if you are interested in using it earlier than that. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB From info@REDACTED Tue Aug 18 11:15:27 2009 From: info@REDACTED (info) Date: Tue, 18 Aug 2009 11:15:27 +0200 Subject: [erlang-questions] difference for tcp between PHP and Erlang Message-ID: <200908181115275128214@its3.ch> Hi all, I can execute fsockopen("www.google.com",80) with PHP but not gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) with erlang which returns {error,timeout} ! why ? From dgud@REDACTED Tue Aug 18 11:18:23 2009 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 18 Aug 2009 11:18:23 +0200 Subject: [erlang-questions] "New" SSL - a problem (which could be mine) and a suggestion In-Reply-To: <16a9f999-54b7-49b5-9258-193cd97cb5e8@j21g2000yqe.googlegroups.com> References: <16a9f999-54b7-49b5-9258-193cd97cb5e8@j21g2000yqe.googlegroups.com> Message-ID: <4A8A71DF.1010209@erix.ericsson.se> Steve Davis wrote: > Since the exact same socket handling code flow is used for the plain > gen_tcp, which doesn't suffer from these issues, I'm suspecting that > it isn't my code here. I'm making appropriate checks later in the > handler to check for closed-out/timed out sockets but these checks are > never reached/triggered. > > My question is whether this a known issue? i.e. if not, then I'll have > to find time to pull out a vanilla repro from the server codebase to > effectively bug-report -- that kind of time I am sadly sorely short > of. No not a known issue, any help/debug-able example would be great. /Dan From steven.charles.davis@REDACTED Tue Aug 18 11:20:05 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 18 Aug 2009 02:20:05 -0700 (PDT) Subject: atoms used as status info, 'constants' etc In-Reply-To: <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> Message-ID: <1b6e5aa0-f5bf-4205-9cfb-21c864aab223@g10g2000yqh.googlegroups.com> A tip on records -- as I learned recently (on this list no less), the most efficient way of filtering returned records would be e.g... case Value of #my_rec_a{} -> ...; #my_rec_b{} -> ...; _ -> {error, {invalid_type, Value}} end This is far more efficient that using an is_record() guard /sd On Aug 18, 3:29?am, Dave Pawson wrote: > Hi Steve. > > 2009/8/18 Steve Davis : > > > Dave, > > Here's my 2c on this one. > > > 1) reuse atoms that are also used as return values from other modules > > in the OTP platform where it makes sense, > > Makes sense. I'm using ok etc as I've seen it used. > > > 2) try to name the atoms cleverly for best grok-ability > > :-) OK. by the reader I guess. > > > 3) if you return an unpredictable number of status values, then use > > "string" status values > > See below* > > > 3a) and... by "string" then probably it is "better" to use a binary > > representation of the text, e.g. <<"my unpredictable return value">> > > Never even seen that way of building a string! > > My problem is a function that should return, say, a record, yet > the sought record does not exist? > ? Return a 'dummy' / null record or > ? Just a status value? > Groking in the case would be by the Erlang code rather > than the user. > > suggestions on how to handle this please? > > regards > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ.http://www.dpawson.co.uk > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From steven.charles.davis@REDACTED Tue Aug 18 11:28:11 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 18 Aug 2009 04:28:11 -0500 Subject: [erlang-questions] "New" SSL - a problem (which could be mine) and a suggestion In-Reply-To: <4A8A71DF.1010209@erix.ericsson.se> References: <16a9f999-54b7-49b5-9258-193cd97cb5e8@j21g2000yqe.googlegroups.com> <4A8A71DF.1010209@erix.ericsson.se> Message-ID: <4A8A742B.1070300@gmail.com> Thanks, Dan - I'll spend time with it soon as I can get to it to make sure it's "not just me" and get some repro code across to erlang-bugs - I'll let you know either way. Best regards, Steve Dan Gudmundsson wrote: > No not a known issue, any help/debug-able example would be great. > > /Dan > From raimo+erlang-questions@REDACTED Tue Aug 18 12:25:49 2009 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Tue, 18 Aug 2009 12:25:49 +0200 Subject: [erlang-questions] difference for tcp between PHP and Erlang In-Reply-To: <200908180004564504146@its3.ch> References: <200908180004564504146@its3.ch> Message-ID: <20090818102549.GB12102@erix.ericsson.se> On Tue, Aug 18, 2009 at 12:04:56AM +0100, info wrote: > Hi all, > > I can execute fsockopen("www.google.com",80) with PHP but not > gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) with erlang which returns {error,timeout} ! > why ? Maybe you have a firewall problem, and PHP is configured to use a proxy... -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From flaboy.cn@REDACTED Tue Aug 18 12:41:48 2009 From: flaboy.cn@REDACTED (=?UTF-8?B?546L56OK?=) Date: Tue, 18 Aug 2009 18:41:48 +0800 Subject: [erlang-questions] difference for tcp between PHP and Erlang In-Reply-To: <200908180004564504146@its3.ch> References: <200908180004564504146@its3.ch> Message-ID: Same server?Same dns/ip response? Is there exists a erlang.hosts file? 2009/8/18 info > Hi all, > > I can execute fsockopen("www.google.com",80) with PHP but not > gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) with erlang which > returns {error,timeout} ! > why ? > From dave.pawson@REDACTED Tue Aug 18 13:16:07 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 18 Aug 2009 12:16:07 +0100 Subject: [erlang-questions] Re: atoms used as status info, 'constants' etc In-Reply-To: <1250585652.6089.450.camel@sredniczarny> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> <1250585652.6089.450.camel@sredniczarny> Message-ID: <711a73df0908180416n674aa259yaf1b86c954fe4071@mail.gmail.com> 2009/8/18 Witold Baryluk : >> >> My problem is a function that should return, say, a record, yet >> the sought record does not exist? >> ? Return a 'dummy' / null record or >> ? Just a status value? >> Groking in the case would be by the Erlang code rather >> than the user. >> >> suggestions on how to handle this please? > Generally it depends. If there is good default value, you can use > "dummy" record, but mostly you want to distinguish beetween existing and > not existing data. > > If you know that you always return record, anything which isn't record, > like atom 'notfound', or 'error', or {error, not_found} will be > sufficient, because in somewhere on calle side you will match returned > value to the record, and this will crash (which is good). I'd prefer not to crash and burn here, since the selection is based on user input which could contain a typo. > > > > There are 4 main conventions in case of returning general values: > > 1. something which is distinguishable, because of type: > ? return Tuple | false ?(like list:keyfind/3) > ? or ? ? {ok, Value} | error ? (like dict:find/2) > ? or ? ? {value, Value} | none (like gb_trees:lookup/2) This is the example that's been bothering me. Looking for a tuple, if not found, I've been returning false. > 2. something which can be confused with value: > ? return Value | undefined ?(erlang:get/1) > ? or ? ? none | Value ?(like proplists:lookup/2) > 3. throw exception if record is not found (like dict:fetch/2, > ? orddict:fetch/2) > 4. provide argument for default return value, (like proplists:lookup/3). Thanks for those Witold. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Tue Aug 18 13:18:17 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Tue, 18 Aug 2009 12:18:17 +0100 Subject: [erlang-questions] Re: atoms used as status info, 'constants' etc In-Reply-To: <1b6e5aa0-f5bf-4205-9cfb-21c864aab223@g10g2000yqh.googlegroups.com> References: <711a73df0908180027v22c82773xf32b9d408fbdb856@mail.gmail.com> <711a73df0908180129t854719pf338ef1805e4d099@mail.gmail.com> <1b6e5aa0-f5bf-4205-9cfb-21c864aab223@g10g2000yqh.googlegroups.com> Message-ID: <711a73df0908180418s5d1120c0q8458b0bf15028b46@mail.gmail.com> 2009/8/18 Steve Davis : > > A tip on records -- as I learned recently (on this list no less), the > most efficient way of filtering returned records would be e.g... > > case Value of > #my_rec_a{} -> ...; > #my_rec_b{} -> ...; > _ -> {error, {invalid_type, Value}} > end > > This is far more efficient that using an is_record() guard > > /sd Because of the function, I'd been using case false, _ with the function returning either the tuple or false, which seemed somehow wrong. I didn't like the function being context dependent. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From info@REDACTED Tue Aug 18 15:18:10 2009 From: info@REDACTED (info) Date: Tue, 18 Aug 2009 15:18:10 +0200 Subject: [erlang-questions] difference for tcp between PHP and Erlang References: <200908180004564504146@its3.ch>, <20090818102549.GB12102@erix.ericsson.se> Message-ID: <200908181518098437135@its3.ch> Probably ... or another one: I stopped my firewall and always the problem ! On Tue, Aug 18, 2009 at 12:04:56AM +0100, info wrote: > Hi all, > > I can execute fsockopen("www.google.com",80) with PHP but not > gen_tcp:connect("www.google.com",80,[binary,{packet,0}]) with erlang which returns {error,timeout} ! > why ? Maybe you have a firewall problem, and PHP is configured to use a proxy... -- / Raimo Niskanen, Erlang/OTP, Ericsson AB ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From christophe.romain@REDACTED Tue Aug 18 15:54:25 2009 From: christophe.romain@REDACTED (Christophe Romain) Date: Tue, 18 Aug 2009 15:54:25 +0200 Subject: erlsrv usage Message-ID: <20090818135425.GR4102@localhost> Hi I use erlsrv for ejabberd to run as service under windows. the service is registered that way: erlsrv add ejabberd -sname ejabberd-srv@REDACTED -w "C:\ejabberd-2.1.0\bin" -ar "-s win_service" -st "win_service:stop()." -onfail restart but the service name looks like: ejabberd01c9e46ae1733560 (and not "ejabberd" as requested) is there a reason for that ? by the way, reading http://erlang.org/doc/man/erlsrv.html it seems it's not possible to define service description on command line. is there an undocumented way for setting service description ? Thanks! BR. From dnonnenm@REDACTED Tue Aug 18 22:24:02 2009 From: dnonnenm@REDACTED (David Nonnenmacher) Date: Tue, 18 Aug 2009 22:24:02 +0200 Subject: escript and first target system Message-ID: <706aa0500908181324m396df72cn67b1eaca3835dac2@mail.gmail.com> Hello, I would like to know if this is possible to use escript command in the case of first target systems. I tried and failed to do it. I read http://erlang.org/doc/system_principles/create_target.html and http://streamhacker.com/2009/07/02/how-to-create-an-erlang-first-target-system/ . I think that I catched the main idea. So I just copied the erl into the bin directory, and then modified the ROOTDIR (I also did all the stuff about the boot file), but escript failed to run with an error message about a missing start_clean.boot. So I copied the start_clean.boot into the bin directory and copied the escript exe file into the bin directory, but there was a code path problem. Just for your information, erl works fine. Is there a trick or something special to configure to run escript command using a first target system ? Thank you David From jwhust@REDACTED Wed Aug 19 05:19:01 2009 From: jwhust@REDACTED (Jiang Wei) Date: Wed, 19 Aug 2009 11:19:01 +0800 Subject: SMP performance with hackbench Message-ID: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> Hi, list I write hackbench in erlang to test the performance, which is originally a benchmark for linux scheduler. (Hackbench contains several groups; each groups contains 20 pairs of senders and receivers; each sender needs to send some messages to the 20 receivers in the same group. The performance is measured by the time taken, less is better.) The tests are carried out on an Intel server with 2 quad-core processors and 4G memory. I am surprised with results I got: (1) SMP enable +S 8 root@REDACTED:~/hackbench# \time ./run_one_erl.sh Time is 62.260995 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata 0maxresident)k 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps The performance is 62 sec and the oprofile shows 28% cpu time is using in pthread_mutex_*. (2) SMP disable root@REDACTED:~/hackbench# \time ./run_one_erl.sh "-smp disable" Time is 54.14644 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata 0maxresident)k 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps The performance is 54 sec and using only 83% cpu. So it seems the erlang has problems with using all the smp resources for serious lock contention in smp scheduler. Am I right? And because I am new to erlang, the hackbench.erl may be in bad encoding, which will harm the performance. Can anyone help me review my code? I attach both the original C version of hackbench and my erlang version one. Thanks a lot! (I am sorry If it is the wrong place to post this letter.) -- Best Regards, Jiang, Wei -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hackbench_cmd.erl Type: application/octet-stream Size: 2709 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hackbench_old.c Type: application/octet-stream Size: 5492 bytes Desc: not available URL: From seancribbs@REDACTED Wed Aug 19 05:39:57 2009 From: seancribbs@REDACTED (Sean Cribbs) Date: Tue, 18 Aug 2009 23:39:57 -0400 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> Message-ID: <4A8B740D.6090307@gmail.com> In a dual quad-core setup, consider that there will be different message-passing speeds between: 1) cores on the same chip 2) cores on different chips 3) in some cases, cores in different combinations on the same chip (e.g. Nehalem quad-core processors have paired cores with some shared cache) If you're crossing boundaries between chips/cores frequently, you have to go through a cache or main RAM, which will be slower than running all on the same core. Try increasing the number of processes dramatically in your test and see how the SMP vs. non-SMP scenario pans out. 40 processes could be considered a small number of processes for an Erlang application. Sean Cribbs Jiang Wei wrote: > Hi, list > I write hackbench in erlang to test the performance, which is > originally a benchmark for linux scheduler. > (Hackbench contains several groups; each groups contains 20 pairs > of senders and receivers; each sender needs to send some messages to > the 20 receivers in the same group. The performance is measured by the > time taken, less is better.) > > The tests are carried out on an Intel server with 2 quad-core > processors and 4G memory. > I am surprised with results I got: > (1) SMP enable +S 8 > root@REDACTED:~/hackbench# \time ./run_one_erl.sh > Time is 62.260995 > 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata > 0maxresident)k > 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps > > The performance is 62 sec and the oprofile shows 28% cpu time is > using in pthread_mutex_*. > > (2) SMP disable > root@REDACTED:~/hackbench # \time > ./run_one_erl.sh "-smp disable" > Time is 54.14644 > 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata > 0maxresident)k > 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps > > The performance is 54 sec and using only 83% cpu. > > So it seems the erlang has problems with using all the smp > resources for serious lock contention in smp scheduler. Am I right? > And because I am new to erlang, the hackbench.erl may be in bad > encoding, which will harm the performance. Can anyone help me review > my code? > > I attach both the original C version of hackbench and my erlang > version one. > > Thanks a lot! > (I am sorry If it is the wrong place to post this letter.) > > -- > Best Regards, > Jiang, Wei > ------------------------------------------------------------------------ > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org From kiszl@REDACTED Wed Aug 19 08:35:35 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 19 Aug 2009 08:35:35 +0200 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> Message-ID: <4A8B9D37.1090500@tmit.bme.hu> Hi, First check if the cpu topology is properly identified: erlang:system_info(cpu_topology). If not, set it manually: erlang:system_flag(cpu_topology, Topo). (see slide* 27 for Topo). Then bind the schedulers to cpu cores: erlang:system_flag(scheduler_bind_type,default_bind). Check that the binding succeeded: erlang:system_info(scheduler_bindings). Try the SMP test again with these settings, and please tell us the new results. *see slides 22-28 in Kenneth's talk on multicore: http://www.erlang-factory.com/upload/presentations/105/KennethLundin-ErlangFactory2009London-AboutErlangOTPandMulti-coreperformanceinparticular.pdf Regards, Zoltan. Jiang Wei wrote: > Hi, list > I write hackbench in erlang to test the performance, which is > originally a benchmark for linux scheduler. > (Hackbench contains several groups; each groups contains 20 pairs > of senders and receivers; each sender needs to send some messages to > the 20 receivers in the same group. The performance is measured by the > time taken, less is better.) > > The tests are carried out on an Intel server with 2 quad-core > processors and 4G memory. > I am surprised with results I got: > (1) SMP enable +S 8 > root@REDACTED:~/hackbench# \time ./run_one_erl.sh > Time is 62.260995 > 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata > 0maxresident)k > 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps > > The performance is 62 sec and the oprofile shows 28% cpu time is > using in pthread_mutex_*. > > (2) SMP disable > root@REDACTED:~/hackbench # \time > ./run_one_erl.sh "-smp disable" > Time is 54.14644 > 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata > 0maxresident)k > 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps > > The performance is 54 sec and using only 83% cpu. > > So it seems the erlang has problems with using all the smp > resources for serious lock contention in smp scheduler. Am I right? > And because I am new to erlang, the hackbench.erl may be in bad > encoding, which will harm the performance. Can anyone help me review > my code? > > I attach both the original C version of hackbench and my erlang > version one. > > Thanks a lot! > (I am sorry If it is the wrong place to post this letter.) > > -- > Best Regards, > Jiang, Wei > ------------------------------------------------------------------------ > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org From jwhust@REDACTED Wed Aug 19 09:50:11 2009 From: jwhust@REDACTED (Jiang Wei) Date: Wed, 19 Aug 2009 15:50:11 +0800 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <4A8B9D37.1090500@tmit.bme.hu> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> <4A8B9D37.1090500@tmit.bme.hu> Message-ID: <95051b2c0908190050x6a3f169bie4f1eab69b08060@mail.gmail.com> The test machine topology is [(0,1,4,5), (2,3,6,7)], and erlang:system_info(cpu_topology) outputs: 1> erlang:system_info(cpu_topology). [{processor,[{core,{logical,0}}, {core,{logical,4}}, {core,{logical,1}}, {core,{logical,5}}]}, {processor,[{core,{logical,2}}, {core,{logical,6}}, {core,{logical,3}}, {core,{logical,7}}]}] So it's right. Then I bind schedulers to cpu cores: 2> erlang:system_flag(scheduler_bind_type,default_bind). unbound 3> erlang:system_info(scheduler_bindings). {0,2,4,6,1,3,5,7} Re-run the hackbench: 4> c(hackbench). ./hackbench.erl:56: Warning: variable 'Msg' is unused {ok,hackbench} 5> hackbench:main(300,1000). 71.174117 // 300 groups, each groups has 20 pairs of processes, total 300*(20*2)=12000 processes, msg is sent 1000 times 6> hackbench:main(300,1000). 75.165799 without binding and everything is in default: 3> hackbench:main(300,1000). 67.151053 4> hackbench:main(300,1000). 72.056573 It doesn't change much. With smp disable: 2> hackbench:main(300,1000). 53.942253 *More info is in the attachment. (including uname -a, /etc/issue, /proc/cpuinfo, erlang version, gcc version) 2009/8/19 Zoltan Lajos Kis > Hi, > First check if the cpu topology is properly identified: > erlang:system_info(cpu_topology). If not, set it manually: > erlang:system_flag(cpu_topology, Topo). (see slide* 27 for Topo). > Then bind the schedulers to cpu cores: > erlang:system_flag(scheduler_bind_type,default_bind). Check that the binding > succeeded: erlang:system_info(scheduler_bindings). > Try the SMP test again with these settings, and please tell us the new > results. > > *see slides 22-28 in Kenneth's talk on multicore: > > http://www.erlang-factory.com/upload/presentations/105/KennethLundin-ErlangFactory2009London-AboutErlangOTPandMulti-coreperformanceinparticular.pdf > > Regards, > Zoltan. > > Jiang Wei wrote: > > >> Hi, list I write hackbench in erlang to test the performance, which >> is originally a benchmark for linux scheduler. >> (Hackbench contains several groups; each groups contains 20 pairs of >> senders and receivers; each sender needs to send some messages to the 20 >> receivers in the same group. The performance is measured by the time taken, >> less is better.) >> The tests are carried out on an Intel server with 2 quad-core >> processors and 4G memory. >> I am surprised with results I got: >> (1) SMP enable +S 8 >> root@REDACTED:~/hackbench# \time ./run_one_erl.sh >> Time is 62.260995 >> 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata >> 0maxresident)k >> 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps >> The performance is 62 sec and the oprofile shows 28% cpu time is >> using in pthread_mutex_*. >> (2) SMP disable >> >> root@REDACTED:~/hackbench # \time >> ./run_one_erl.sh "-smp disable" Time is 54.14644 >> 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata >> 0maxresident)k >> 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps >> The performance is 54 sec and using only 83% cpu. >> So it seems the erlang has problems with using all the smp >> resources for serious lock contention in smp scheduler. Am I right? >> And because I am new to erlang, the hackbench.erl may be in bad >> encoding, which will harm the performance. Can anyone help me review my >> code? >> I attach both the original C version of hackbench and my erlang >> version one. >> Thanks a lot! >> (I am sorry If it is the wrong place to post this letter.) >> -- >> Best Regards, >> Jiang, Wei >> >> ------------------------------------------------------------------------ >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > > -- Best Regards, Jiang, Wei -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- root@REDACTED:~# uname -a Linux test 2.6.30.4 #1 SMP Tue Aug 18 17:14:45 CST 2009 x86_64 GNU/Linux root@REDACTED:~# cat /etc/issue Ubuntu 8.04.2 \n \l root@REDACTED:~# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3192.05 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 4 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.90 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 1 siblings : 4 core id : 0 cpu cores : 4 apicid : 4 initial apicid : 4 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.92 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 1 siblings : 4 core id : 2 cpu cores : 4 apicid : 6 initial apicid : 6 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.93 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 4 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 4 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.91 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 5 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 0 siblings : 4 core id : 3 cpu cores : 4 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.90 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 6 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 1 siblings : 4 core id : 1 cpu cores : 4 apicid : 5 initial apicid : 5 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.91 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 7 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Xeon(R) CPU E5310 @ 1.60GHz stepping : 11 cpu MHz : 1596.027 cache size : 4096 KB physical id : 1 siblings : 4 core id : 3 cpu cores : 4 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow vnmi flexpriority bogomips : 3191.93 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: root@REDACTED:~# erl -V Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) root@REDACTED:~/hackbench# gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3) From ulf.wiger@REDACTED Wed Aug 19 09:59:27 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 19 Aug 2009 09:59:27 +0200 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <95051b2c0908190050x6a3f169bie4f1eab69b08060@mail.gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> <4A8B9D37.1090500@tmit.bme.hu> <95051b2c0908190050x6a3f169bie4f1eab69b08060@mail.gmail.com> Message-ID: <4A8BB0DF.6070905@erlang-consulting.com> One thing you could try is to eliminate the shared binary and send a simple message instead, e.g. -define(DATA, 1). I don't know if it will make a big difference. Ideally, passing a shared binary will be as efficient, but this is at least a logical exclusion step. BR, Ulf W Jiang Wei wrote: > The test machine topology is [(0,1,4,5), (2,3,6,7)], and > erlang:system_info(cpu_topology) outputs: > > 1> erlang:system_info(cpu_topology). > [{processor,[{core,{logical,0}}, > {core,{logical,4}}, > {core,{logical,1}}, > {core,{logical,5}}]}, > {processor,[{core,{logical,2}}, > {core,{logical,6}}, > {core,{logical,3}}, > {core,{logical,7}}]}] > > So it's right. > Then I bind schedulers to cpu cores: > > 2> erlang:system_flag(scheduler_bind_type,default_bind). > unbound > 3> erlang:system_info(scheduler_bindings). > {0,2,4,6,1,3,5,7} > > Re-run the hackbench: > > 4> c(hackbench). > ./hackbench.erl:56: Warning: variable 'Msg' is unused > {ok,hackbench} > 5> hackbench:main(300,1000). > 71.174117 > // 300 groups, each groups has 20 pairs of processes, total > 300*(20*2)=12000 processes, msg is sent 1000 times > 6> hackbench:main(300,1000). > 75.165799 > > without binding and everything is in default: > > 3> hackbench:main(300,1000). > 67.151053 > 4> hackbench:main(300,1000). > 72.056573 > > It doesn't change much. > > With smp disable: > > 2> hackbench:main(300,1000). > 53.942253 > > *More info is in the attachment. (including uname -a, /etc/issue, > /proc/cpuinfo, erlang version, gcc version) > > 2009/8/19 Zoltan Lajos Kis > > > > Hi, > > First check if the cpu topology is properly identified: > erlang:system_info(cpu_topology). If not, set it manually: > erlang:system_flag(cpu_topology, Topo). (see slide* 27 for Topo). > Then bind the schedulers to cpu cores: > erlang:system_flag(scheduler_bind_type,default_bind). Check that the > binding succeeded: erlang:system_info(scheduler_bindings). > Try the SMP test again with these settings, and please tell us the > new results. > > *see slides 22-28 in Kenneth's talk on multicore: > http://www.erlang-factory.com/upload/presentations/105/KennethLundin-ErlangFactory2009London-AboutErlangOTPandMulti-coreperformanceinparticular.pdf > > Regards, > Zoltan. > > Jiang Wei wrote: > > > Hi, list > I write hackbench in erlang to test the performance, which > is originally a benchmark for linux scheduler. > (Hackbench contains several groups; each groups contains 20 > pairs of senders and receivers; each sender needs to send some > messages to the 20 receivers in the same group. The performance > is measured by the time taken, less is better.) > The tests are carried out on an Intel server with 2 > quad-core processors and 4G memory. > I am surprised with results I got: > (1) SMP enable +S 8 > root@REDACTED:~/hackbench# \time ./run_one_erl.sh > Time is 62.260995 > 295.67user 110.62system 1:14.27elapsed 546%CPU > (0avgtext+0avgdata 0maxresident)k > 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps > The performance is 62 sec and the oprofile shows 28% cpu > time is using in pthread_mutex_*. > (2) SMP disable > > root@REDACTED:~/hackbench :%7E/hackbench># \time ./run_one_erl.sh "-smp > disable" > Time is 54.14644 > 54.23user 0.33system 1:05.66elapsed 83%CPU > (0avgtext+0avgdata 0maxresident)k > 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps > The performance is 54 sec and using only 83% cpu. > So it seems the erlang has problems with using all the > smp resources for serious lock contention in smp scheduler. Am I > right? > And because I am new to erlang, the hackbench.erl may be in > bad encoding, which will harm the performance. Can anyone help > me review my code? > I attach both the original C version of hackbench and my > erlang version one. > Thanks a lot! > (I am sorry If it is the wrong place to post this letter.) > -- > Best Regards, > Jiang, Wei > > ------------------------------------------------------------------------ > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > > > > > -- > Best Regards, > Jiang, Wei > > > > ------------------------------------------------------------------------ > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From jwhust@REDACTED Wed Aug 19 10:17:34 2009 From: jwhust@REDACTED (Jiang Wei) Date: Wed, 19 Aug 2009 16:17:34 +0800 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <4A8B740D.6090307@gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> <4A8B740D.6090307@gmail.com> Message-ID: <95051b2c0908190117r7b6b668y8c82836b4f65092f@mail.gmail.com> I try hackbench with different processes number, the thread number will be calculated as (GroupNumber * 40), that is, 20 senders and 20 receivers in one group. Group smp smp Number 8:8 disable 1 0.605369 0.093884 10 4.951785 1.414963 50 17.635626 8.722577 100 25.744995 17.889164 200 56.963373 36.106899 The smp disbable is always better than the smp:8:8 case. Oprofiles shows almost 30% of cpu time is used by pthread_mutex_*. The migration logic may be responsible for it. I am looking into the erlang scheduler code and hope I can find the reason there. 2009/8/19 Sean Cribbs > In a dual quad-core setup, consider that there will be different > message-passing speeds between: > > 1) cores on the same chip > 2) cores on different chips > 3) in some cases, cores in different combinations on the same chip (e.g. > Nehalem quad-core processors have paired cores with some shared cache) > > If you're crossing boundaries between chips/cores frequently, you have to > go through a cache or main RAM, which will be slower than running all on the > same core. Try increasing the number of processes dramatically in your test > and see how the SMP vs. non-SMP scenario pans out. 40 processes could be > considered a small number of processes for an Erlang application. > > Sean Cribbs > > Jiang Wei wrote: > >> Hi, list >> I write hackbench in erlang to test the performance, which is >> originally a benchmark for linux scheduler. >> (Hackbench contains several groups; each groups contains 20 pairs of >> senders and receivers; each sender needs to send some messages to the 20 >> receivers in the same group. The performance is measured by the time taken, >> less is better.) >> The tests are carried out on an Intel server with 2 quad-core >> processors and 4G memory. >> I am surprised with results I got: >> (1) SMP enable +S 8 >> root@REDACTED:~/hackbench# \time ./run_one_erl.sh >> Time is 62.260995 >> 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata >> 0maxresident)k >> 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps >> The performance is 62 sec and the oprofile shows 28% cpu time is >> using in pthread_mutex_*. >> (2) SMP disable >> root@REDACTED:~/hackbench # \time >> ./run_one_erl.sh "-smp disable" >> Time is 54.14644 >> 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata >> 0maxresident)k >> 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps >> The performance is 54 sec and using only 83% cpu. >> So it seems the erlang has problems with using all the smp >> resources for serious lock contention in smp scheduler. Am I right? >> And because I am new to erlang, the hackbench.erl may be in bad >> encoding, which will harm the performance. Can anyone help me review my >> code? >> I attach both the original C version of hackbench and my erlang >> version one. >> Thanks a lot! >> (I am sorry If it is the wrong place to post this letter.) >> -- >> Best Regards, >> Jiang, Wei >> ------------------------------------------------------------------------ >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > -- Best Regards, Jiang, Wei From cowboymathu@REDACTED Wed Aug 19 10:27:18 2009 From: cowboymathu@REDACTED (MAthuvathanan Mou.) Date: Wed, 19 Aug 2009 13:57:18 +0530 Subject: How To Check Erlang Release? Message-ID: <90b4299d0908190127j3f6d119fm6d6de797dac9095@mail.gmail.com> Hi all, While being in a Erlang shell, how to check its release version like 12B or 13A? Is there any command? Or else how to check installed Erlang release? Thanks, -- Mathuvathanan Mou. From jwhust@REDACTED Wed Aug 19 10:32:07 2009 From: jwhust@REDACTED (Jiang Wei) Date: Wed, 19 Aug 2009 16:32:07 +0800 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <4A8BB0DF.6070905@erlang-consulting.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> <4A8B9D37.1090500@tmit.bme.hu> <95051b2c0908190050x6a3f169bie4f1eab69b08060@mail.gmail.com> <4A8BB0DF.6070905@erlang-consulting.com> Message-ID: <95051b2c0908190132w41d6b7cfo23fc97fe6f43b1da@mail.gmail.com> I use "-define(DATA, 1)." in hackbench.erl, but the result didn't change much. The smp disable is still better then the smp:8:8 ones. Erlang R13B01 (erts-5.7.2) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] 2> hackbench:main(300,1000). 66.791329 3> hackbench:main(300,1000). 68.51495800000001 smp disable Erlang R13B01 (erts-5.7.2) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] 2> hackbench:main(300,1000). 43.533186 3> hackbench:main(300,1000). 43.91207 The hackbench heavily rely on the scheduler performance. Because it needs to scheduler the right pair of sender and receiver. So I think the problem is in the smp logic, maybe it's the migration logic. 2009/8/19 Ulf Wiger > > One thing you could try is to eliminate the shared binary > and send a simple message instead, e.g. > > -define(DATA, 1). > > I don't know if it will make a big difference. Ideally, > passing a shared binary will be as efficient, but this > is at least a logical exclusion step. > > BR, > Ulf W > > Jiang Wei wrote: > >> The test machine topology is [(0,1,4,5), (2,3,6,7)], and >> erlang:system_info(cpu_topology) outputs: >> >> 1> erlang:system_info(cpu_topology). >> [{processor,[{core,{logical,0}}, >> {core,{logical,4}}, >> {core,{logical,1}}, >> {core,{logical,5}}]}, >> {processor,[{core,{logical,2}}, >> {core,{logical,6}}, >> {core,{logical,3}}, >> {core,{logical,7}}]}] >> >> So it's right. >> Then I bind schedulers to cpu cores: >> >> 2> erlang:system_flag(scheduler_bind_type,default_bind). >> unbound >> 3> erlang:system_info(scheduler_bindings). >> {0,2,4,6,1,3,5,7} >> >> Re-run the hackbench: >> >> 4> c(hackbench). >> ./hackbench.erl:56: Warning: variable 'Msg' is unused >> {ok,hackbench} >> 5> hackbench:main(300,1000). 71.174117 >> // 300 groups, each groups has 20 pairs of processes, total >> 300*(20*2)=12000 processes, msg is sent 1000 times >> 6> hackbench:main(300,1000). >> 75.165799 >> >> without binding and everything is in default: >> >> 3> hackbench:main(300,1000). >> 67.151053 >> 4> hackbench:main(300,1000). >> 72.056573 >> >> It doesn't change much. >> With smp disable: >> >> 2> hackbench:main(300,1000). >> 53.942253 >> >> *More info is in the attachment. (including uname -a, /etc/issue, >> /proc/cpuinfo, erlang version, gcc version) >> 2009/8/19 Zoltan Lajos Kis > >> >> >> >> Hi, >> First check if the cpu topology is properly identified: >> erlang:system_info(cpu_topology). If not, set it manually: >> erlang:system_flag(cpu_topology, Topo). (see slide* 27 for Topo). >> Then bind the schedulers to cpu cores: >> erlang:system_flag(scheduler_bind_type,default_bind). Check that the >> binding succeeded: erlang:system_info(scheduler_bindings). >> Try the SMP test again with these settings, and please tell us the >> new results. >> *see slides 22-28 in Kenneth's talk on multicore: >> >> http://www.erlang-factory.com/upload/presentations/105/KennethLundin-ErlangFactory2009London-AboutErlangOTPandMulti-coreperformanceinparticular.pdf >> Regards, >> Zoltan. >> Jiang Wei wrote: >> >> Hi, list >> I write hackbench in erlang to test the performance, which >> is originally a benchmark for linux scheduler. >> (Hackbench contains several groups; each groups contains 20 >> pairs of senders and receivers; each sender needs to send some >> messages to the 20 receivers in the same group. The performance >> is measured by the time taken, less is better.) >> The tests are carried out on an Intel server with 2 >> quad-core processors and 4G memory. >> I am surprised with results I got: >> (1) SMP enable +S 8 >> root@REDACTED:~/hackbench# \time ./run_one_erl.sh >> Time is 62.260995 >> 295.67user 110.62system 1:14.27elapsed 546%CPU >> (0avgtext+0avgdata 0maxresident)k >> 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps >> The performance is 62 sec and the oprofile shows 28% cpu >> time is using in pthread_mutex_*. >> (2) SMP disable >> root@REDACTED:~/hackbench > :%7E/hackbench># \time ./run_one_erl.sh "-smp >> disable" >> Time is 54.14644 >> 54.23user 0.33system 1:05.66elapsed 83%CPU >> (0avgtext+0avgdata 0maxresident)k >> 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps >> The performance is 54 sec and using only 83% cpu. >> So it seems the erlang has problems with using all the >> smp resources for serious lock contention in smp scheduler. Am I >> right? >> And because I am new to erlang, the hackbench.erl may be in >> bad encoding, which will harm the performance. Can anyone help >> me review my code? >> I attach both the original C version of hackbench and my >> erlang version one. >> Thanks a lot! >> (I am sorry If it is the wrong place to post this letter.) >> -- Best Regards, >> Jiang, Wei >> >> ------------------------------------------------------------------------ >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> >> -- >> Best Regards, >> Jiang, Wei >> >> >> ------------------------------------------------------------------------ >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > > -- > Ulf Wiger > CTO, Erlang Training & Consulting Ltd > http://www.erlang-consulting.com > -- Best Regards, Jiang, Wei From rapsey@REDACTED Wed Aug 19 10:34:11 2009 From: rapsey@REDACTED (Rapsey) Date: Wed, 19 Aug 2009 10:34:11 +0200 Subject: [erlang-questions] How To Check Erlang Release? In-Reply-To: <90b4299d0908190127j3f6d119fm6d6de797dac9095@mail.gmail.com> References: <90b4299d0908190127j3f6d119fm6d6de797dac9095@mail.gmail.com> Message-ID: <97619b170908190134w7797c8cfv9cdfc105a3f55c31@mail.gmail.com> erlang:system_info(otp_release). Sergej On Wed, Aug 19, 2009 at 10:27 AM, MAthuvathanan Mou. wrote: > Hi all, > While being in a Erlang shell, how to check its release version like 12B or > 13A? Is there any command? Or else how to check installed Erlang release? > > Thanks, > -- > Mathuvathanan Mou. > From dnonnenm@REDACTED Wed Aug 19 10:50:00 2009 From: dnonnenm@REDACTED (David Nonnenmacher) Date: Wed, 19 Aug 2009 10:50:00 +0200 Subject: escript and first target system In-Reply-To: <706aa0500908181324m396df72cn67b1eaca3835dac2@mail.gmail.com> References: <706aa0500908181324m396df72cn67b1eaca3835dac2@mail.gmail.com> Message-ID: <706aa0500908190150r7a1991bbx90d6854021b234ae@mail.gmail.com> I add some detailled information about the error message, I got this: *>>> ./escript a_file.escript escript: Internal error: undef [{compile, forms, [[{attribute,0,file,{"a_file.escript",1}}, {attribute,0,module,escript__1250671405497140}, {attribute,7,export,[{main,1}]}, {function, 13, main, 1, [{clause, ....* I run escript command from the directory that contains the start_boot.beam (thank you Charpi for the tip). But I had still the above error. What's the meaning of this error message ? Maybe I need to configure something else ? David 2009/8/18 David Nonnenmacher > Hello, > > I would like to know if this is possible to use escript command in the case > of first target systems. > > I tried and failed to do it. I read > http://erlang.org/doc/system_principles/create_target.html and > http://streamhacker.com/2009/07/02/how-to-create-an-erlang-first-target-system/ > . > I think that I catched the main idea. So I just copied the erl into the bin > directory, and then modified the ROOTDIR (I also did all the stuff about the > boot file), but escript failed to run with an error message about a missing > start_clean.boot. So I copied the start_clean.boot into the bin directory > and copied the escript exe file into the bin directory, but there was a code > path problem. > Just for your information, erl works fine. > > Is there a trick or something special to configure to run escript command > using a first target system ? > > Thank you > > > David > From rtrlists@REDACTED Wed Aug 19 11:03:14 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 19 Aug 2009 10:03:14 +0100 Subject: [erlang-questions] Re: escript and first target system In-Reply-To: <706aa0500908190150r7a1991bbx90d6854021b234ae@mail.gmail.com> References: <706aa0500908181324m396df72cn67b1eaca3835dac2@mail.gmail.com> <706aa0500908190150r7a1991bbx90d6854021b234ae@mail.gmail.com> Message-ID: <6a3ae47e0908190203s6d7177b5h2d2292774a404a3a@mail.gmail.com> On Wed, Aug 19, 2009 at 9:50 AM, David Nonnenmacher wrote: > I add some detailled information about the error message, I got this: > > *>>> ./escript a_file.escript > escript: Internal error: undef > [{compile, > forms, > [[{attribute,0,file,{"a_file.escript",1}}, > {attribute,0,module,escript__1250671405497140}, > {attribute,7,export,[{main,1}]}, > {function, > 13, > main, > 1, > [{clause, ....* > > I run escript command from the directory that contains the start_boot.beam > (thank you Charpi for the tip). But I had still the above error. > > What's the meaning of this error message ? Maybe I need to configure > something else ? > > Looks like the compile module is not part of your release. The error means that compile:forms function is undefined. So, when you have your rel file, try adding the compiler app into it. Robby From info@REDACTED Wed Aug 19 11:17:31 2009 From: info@REDACTED (info) Date: Wed, 19 Aug 2009 11:17:31 +0200 Subject: gethostbyname always timeout Message-ID: <200908191117302923990@its3.ch> Hello, on my machine with windows 2003 server, the function inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} why ? From kiszl@REDACTED Wed Aug 19 11:28:53 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 19 Aug 2009 11:28:53 +0200 Subject: [erlang-questions] gethostbyname always timeout In-Reply-To: <200908191117302923990@its3.ch> References: <200908191117302923990@its3.ch> Message-ID: <4A8BC5D5.8070404@tmit.bme.hu> Hi, Probably because there is something wrong. Check with windump, or any other packet analyzer how many UDP packets (if any) come and go when you issue the command to narrow down the search for the error. Regards, Zoltan. info wrote: > Hello, > on my machine with windows 2003 server, the function > inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} > > why ? > > From rtrlists@REDACTED Wed Aug 19 11:30:56 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 19 Aug 2009 10:30:56 +0100 Subject: [erlang-questions] gethostbyname always timeout In-Reply-To: <200908191117302923990@its3.ch> References: <200908191117302923990@its3.ch> Message-ID: <6a3ae47e0908190230v3a9245fbj8d4d15fd05b97831@mail.gmail.com> On Wed, Aug 19, 2009 at 10:17 AM, info wrote: > Hello, > on my machine with windows 2003 server, the function > inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} > > why ? > I recently had some bizarre issues with hostname lookups under Windows Server 2003. The inet_gethost.exe program was the culprit for me. For a vanilla Windows Server2003 build everything worked fine. But because I was sitting behind a proxy, I needed to use the Firewall Client for ISA to get to the outside world. And as soon as I installed that, the inet_gethost.exe call to gethostbyname() C system function never returned. Very odd, since a small program that uses that call worked fine. I never got to the bottom of it. Robby From flaboy.cn@REDACTED Wed Aug 19 11:48:44 2009 From: flaboy.cn@REDACTED (Wanglei) Date: Wed, 19 Aug 2009 17:48:44 +0800 Subject: [erlang-questions] gethostbyname always timeout In-Reply-To: <200908191117302923990@its3.ch> References: <200908191117302923990@its3.ch> Message-ID: whats the result in command console? ping www.erlang.orgnslookup www.erlang.org 2009/8/19 info > Hello, > on my machine with windows 2003 server, the function > inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} > > why ? > From info@REDACTED Wed Aug 19 11:58:07 2009 From: info@REDACTED (info) Date: Wed, 19 Aug 2009 11:58:07 +0200 Subject: [erlang-questions] gethostbyname always timeout References: <200908191117302923990@its3.ch>, <4A8BC5D5.8070404@tmit.bme.hu> Message-ID: <200908191158070201996@its3.ch> Hi, No packet sent or received during the command. Hi, Probably because there is something wrong. Check with windump, or any other packet analyzer how many UDP packets (if any) come and go when you issue the command to narrow down the search for the error. Regards, Zoltan. info wrote: > Hello, > on my machine with windows 2003 server, the function > inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} > > why ? > > ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From info@REDACTED Wed Aug 19 12:02:03 2009 From: info@REDACTED (info) Date: Wed, 19 Aug 2009 12:02:03 +0200 Subject: [erlang-questions] gethostbyname always timeout References: <200908191117302923990@its3.ch>, Message-ID: <200908191202026455149@its3.ch> The ping is correct, nslookup returns a correct dns address and the ip 193.180.168.20 for erlang.org whats the result in command console? ping www.erlang.org nslookup www.erlang.org 2009/8/19 info Hello, on my machine with windows 2003 server, the function inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} why ? From flaboy.cn@REDACTED Wed Aug 19 12:18:06 2009 From: flaboy.cn@REDACTED (Wanglei) Date: Wed, 19 Aug 2009 18:18:06 +0800 Subject: [erlang-questions] gethostbyname always timeout In-Reply-To: <200908191202026455149@its3.ch> References: <200908191117302923990@its3.ch> <200908191202026455149@its3.ch> Message-ID: check the windows log by c:\>eventvwr.msc is there sth strange? 2009/8/19 info > The ping is correct, nslookup returns a correct dns address and the ip > 193.180.168.20 for erlang.org > > whats the result in command console? > > ping www.erlang.org nslookup www.erlang.org > > > 2009/8/19 info > >> Hello, >> on my machine with windows 2003 server, the function >> inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} >> >> why ? >> > > From info@REDACTED Wed Aug 19 12:23:22 2009 From: info@REDACTED (info) Date: Wed, 19 Aug 2009 12:23:22 +0200 Subject: [erlang-questions] gethostbyname always timeout References: <200908191117302923990@its3.ch>, , <200908191202026455149@its3.ch>, Message-ID: <200908191223219040863@its3.ch> Just events 7001 because I disabled dhcp. Note that I also disabled my firewall ! I don't know if my DNS server is correctly configured. In IIS, default web site uses port 80: conflict ? check the windows log by c:\>eventvwr.msc is there sth strange? 2009/8/19 info The ping is correct, nslookup returns a correct dns address and the ip 193.180.168.20 for erlang.org whats the result in command console? ping www.erlang.org nslookup www.erlang.org 2009/8/19 info Hello, on my machine with windows 2003 server, the function inet:gethostbyname("www.erlang.org", inet) returns always {error,timeout} why ? From joelr1@REDACTED Wed Aug 19 13:47:59 2009 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 19 Aug 2009 12:47:59 +0100 Subject: troubleshooting systools:make_tar Message-ID: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> What is causing this and wow do I fix it? Thanks, Joel --- (janus@REDACTED)3> systools:make_tar("start_janus"). {{case_clause, {'EXIT', {function_clause, [{filename,join,[[]]}, {systools_make,add_appl,7}, {systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}]}}}, [{systools_make,'-add_applications/5-fun-0-',6}, {lists,foldl,3}, {systools_make,add_applications,5}, {systools_make,mk_tar,6}, {systools_make,mk_tar,5}, {systools_make,make_tar,2}, {erl_eval,do_apply,5}, {shell,exprs,6}]} error --- faster mac firefox http://tinyco.de From dnonnenm@REDACTED Wed Aug 19 14:17:03 2009 From: dnonnenm@REDACTED (David Nonnenmacher) Date: Wed, 19 Aug 2009 14:17:03 +0200 Subject: [erlang-questions] Re: escript and first target system In-Reply-To: <6a3ae47e0908190203s6d7177b5h2d2292774a404a3a@mail.gmail.com> References: <706aa0500908181324m396df72cn67b1eaca3835dac2@mail.gmail.com> <706aa0500908190150r7a1991bbx90d6854021b234ae@mail.gmail.com> <6a3ae47e0908190203s6d7177b5h2d2292774a404a3a@mail.gmail.com> Message-ID: <706aa0500908190517xbc0d9ccye741e73532f87ff8@mail.gmail.com> It works fine, you are right, I forgot the compiler application. thank you Robert, Hynek and Charpi David 2009/8/19 Robert Raschke > > On Wed, Aug 19, 2009 at 9:50 AM, David Nonnenmacher wrote: > >> I add some detailled information about the error message, I got this: >> >> *>>> ./escript a_file.escript >> escript: Internal error: undef >> [{compile, >> forms, >> [[{attribute,0,file,{"a_file.escript",1}}, >> {attribute,0,module,escript__1250671405497140}, >> {attribute,7,export,[{main,1}]}, >> {function, >> 13, >> main, >> 1, >> [{clause, ....* >> >> I run escript command from the directory that contains the start_boot.beam >> (thank you Charpi for the tip). But I had still the above error. >> >> What's the meaning of this error message ? Maybe I need to configure >> something else ? >> >> > Looks like the compile module is not part of your release. The error means > that compile:forms function is undefined. > > So, when you have your rel file, try adding the compiler app into it. > > Robby > > > From klacke@REDACTED Wed Aug 19 14:20:34 2009 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 19 Aug 2009 14:20:34 +0200 Subject: [erlang-questions] Re: Distributions of Erlang-coded SW on Windows (really) In-Reply-To: <6672d0160908140630j58e311d6g56945daac59e6992@mail.gmail.com> References: <6672d0160908140630j58e311d6g56945daac59e6992@mail.gmail.com> Message-ID: <4A8BEE12.6060300@hyber.org> Bjorn Gustavsson wrote: > The Wings3D application has an NSIS-based installer for Windows. Similarly, Yaws now has a proper win32 installer. I use InstallBuilder http://bitrock.com/ which is free (as in beer) for open source projects and (cheap - again as in beer) for commercial projects. Trick I used was to write a small exec wrapper ala... # cat yaws.c ...... if(CreateProcess(0, execString, NULL, NULL, FALSE, 0, 0, 0, &si, &pi)) { unsigned long ret = 0; // wait for process to finish WaitForSingleObject(pi.hProcess, INFINITE); if (GetExitCodeProcess(pi.hProcess, &ret) == 0) ret = 1; CloseHandle(pi.hProcess); CloseHandle(pi.hThread); return ret; } See http://github.com/klacke/yaws/blob/d9c2d32e2dfad0c8710c134ba261a5dfa82c73c7/win32/yaws.c For Yaws I chose to invoke erl from the path, for software I wrote at tail-f I invoke erl that get's installed together with my app. /klacke From rtrlists@REDACTED Wed Aug 19 14:21:31 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 19 Aug 2009 13:21:31 +0100 Subject: [erlang-questions] troubleshooting systools:make_tar In-Reply-To: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> References: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> Message-ID: <6a3ae47e0908190521n7881b9dbwfb19ad6fe2cb3ffe@mail.gmail.com> On Wed, Aug 19, 2009 at 12:47 PM, Joel Reymont wrote: > What is causing this and wow do I fix it? > > Thanks, Joel > > --- > > (janus@REDACTED)3> systools:make_tar("start_janus"). > {{case_clause, > {'EXIT', > {function_clause, > [{filename,join,[[]]}, > {systools_make,add_appl,7}, > {systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}]}}}, > [{systools_make,'-add_applications/5-fun-0-',6}, > {lists,foldl,3}, > {systools_make,add_applications,5}, > {systools_make,mk_tar,6}, > {systools_make,mk_tar,5}, > {systools_make,make_tar,2}, > {erl_eval,do_apply,5}, > {shell,exprs,6}]} > error > > Weird. I can't really see how systools_make:add_appl/7 could end up calling filename:join with an empty list as an argument. But saying that, what does your start_janus.rel file actually look like? Are you using the recommended directory structures, i.e., module dirs with ebin, src, etc. subdirs? Robby From joelr1@REDACTED Wed Aug 19 14:28:53 2009 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 19 Aug 2009 13:28:53 +0100 Subject: [erlang-questions] troubleshooting systools:make_tar In-Reply-To: <6a3ae47e0908190521n7881b9dbwfb19ad6fe2cb3ffe@mail.gmail.com> References: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> <6a3ae47e0908190521n7881b9dbwfb19ad6fe2cb3ffe@mail.gmail.com> Message-ID: <72ABB8E6-1BA0-497D-82C7-648BF954DCD6@gmail.com> On Aug 19, 2009, at 1:21 PM, Robert Raschke wrote: > But saying that, what does your start_janus.rel file actually look > like? Are > you using the recommended directory structures, i.e., module dirs > with ebin, > src, etc. subdirs? cat ebin/start_janus.rel {release, {"Janus","0.0.5"}, {erts, "5.7.2"}, [{kernel,"2.13.2"}, {stdlib,"1.16.2"}, {sasl, "2.1.6"}, {inets, "5.1"}, {erlsom, "1.2.1"}, {janus,"0.0.5"} ]}. I have ebin but I also have a couple of "apps" that live in their separate directories and are not proper OTP applications. I compile them such that beams go into my ebin but their source is not found during the making of the boot file. I thought I could disregard the warnings as they don't seem to affect anything. --- faster mac firefox http://tinyco.de From klacke@REDACTED Wed Aug 19 14:39:51 2009 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 19 Aug 2009 14:39:51 +0200 Subject: [erlang-questions] ssh module performance In-Reply-To: <4A805EBD.3090407@research.att.com> References: <4A805EBD.3090407@research.att.com> Message-ID: <4A8BF297.4020105@hyber.org> Garry Hodgson wrote: > so the question is, is the performance i'm seeing to be expected? > are there known issues around the ssh module performance? am i > doing something dumb? are there better ways to use this (or related) > modules, or other approaches altogether? I had (and solved) problems with ssh server side code that was related to sending a lot of really small ssh messages. Try to possibly buffer (for say 50 millisecs) before flushing the data to the ssh code. /klacke From torben.lehoff@REDACTED Wed Aug 19 14:48:10 2009 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 19 Aug 2009 14:48:10 +0200 Subject: [erlang-questions] Getting reltool to work In-Reply-To: References: Message-ID: On Tue, Aug 18, 2009 at 11:07, Hakan Mattsson wrote: > On Tue, 18 Aug 2009, Torben Hoffmann wrote: > > > I have a set of OTP applications that I would like to turn into a real, > > deployable release with minimum pain (as usual). > > > > Hence, I looked at reltool and tried to give it a spin, but when I try to > > point my root_dir to where I have all my applications I get complaints > about > > the lack of a lib directory. > > > > This is 100% true - I do not have such a dir, not even in the directories > > for the individual applications (which all follow OTP directory > structure). > > > > There seems to be some sort or requirements on my directory structure > that I > > cannot read out of the reltool documentation - could someone please give > me > > a hint on how to proceed? > > The 'root_dir' must refer to the root directory of an installed Erlang > system. If you have additional applications that do not reside under > under its lib directory, you can either user the ERL_LIBS environment > variable (see the man page for code) to refer to additional "lib" > directories. Or you can use the configuration parameter 'lib_dirs' in > reltool to obtain the same result. A lib direcory is expected to > contain application top directories. Ahh, that explains so I can understand it! Thanks!! But, alas, I cannot get it to work: 9> reltool:start([{sys,[{lib_dirs,["ErlangProject/abekat/"]}]}]). ** exception exit: {badmatch,{error,"Illegal parameter: {sys,[{lib_dirs,[\"ErlangProject/abekat\"]}]}"}} in function reltool_sys_win:do_init/1 in call from reltool_sys_win:init/1 in call from proc_lib:init_p_do_apply/3 Note that I am running this through cygwin and for the record I have tried using different paths, including the full path, to no avail. > > > Unfortunately the target generation part of reltool does not work so > well in the current release.It will be greatly improved in R13B02. > Contact me privately if you are interested in using it earlier than > that. Using it earlier depends on the roadmap for Erlang (can I wait for it?!?!) - I tried to look at erlang.org to find it, but was not able to dig it up... is there such a thing available for public eye? Or is that kind of info for EUC participants only??? ;-) Cheers, Torben > > > /H?kan > --- > H?kan Mattsson (uabhams) > Erlang/OTP, Ericsson AB -- http://www.linkedin.com/in/torbenhoffmann From attila.r.nohl@REDACTED Wed Aug 19 14:50:06 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Wed, 19 Aug 2009 14:50:06 +0200 Subject: [erlang-questions] ssh module performance In-Reply-To: <4A8BF297.4020105@hyber.org> References: <4A805EBD.3090407@research.att.com> <4A8BF297.4020105@hyber.org> Message-ID: <401d3ba30908190550p3d007821n72524f63830d8257@mail.gmail.com> 2009/8/19, Claes Wikstrom : > Garry Hodgson wrote: > >> so the question is, is the performance i'm seeing to be expected? >> are there known issues around the ssh module performance? am i >> doing something dumb? are there better ways to use this (or related) >> modules, or other approaches altogether? > > I had (and solved) problems with ssh server side code that was > related to sending a lot of really small ssh messages. > Try to possibly buffer (for say 50 millisecs) before flushing > the data to the ssh code. I also had problems with SFTP transfer speed (only with a specific client), actually the transfer stalled after a time, if the file was big enough (100+ MB). A lot of really small (2-4 bytes!) messages were involved there as well. From rtrlists@REDACTED Wed Aug 19 17:05:43 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 19 Aug 2009 16:05:43 +0100 Subject: [erlang-questions] troubleshooting systools:make_tar In-Reply-To: <72ABB8E6-1BA0-497D-82C7-648BF954DCD6@gmail.com> References: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> <6a3ae47e0908190521n7881b9dbwfb19ad6fe2cb3ffe@mail.gmail.com> <72ABB8E6-1BA0-497D-82C7-648BF954DCD6@gmail.com> Message-ID: <6a3ae47e0908190805x3ddb0384x5052b6e9a652738e@mail.gmail.com> On Wed, Aug 19, 2009 at 1:28 PM, Joel Reymont wrote: > > On Aug 19, 2009, at 1:21 PM, Robert Raschke wrote: > > But saying that, what does your start_janus.rel file actually look like? >> Are >> you using the recommended directory structures, i.e., module dirs with >> ebin, >> src, etc. subdirs? >> > > cat ebin/start_janus.rel > {release, {"Janus","0.0.5"}, {erts, "5.7.2"}, > [{kernel,"2.13.2"}, > {stdlib,"1.16.2"}, > {sasl, "2.1.6"}, > {inets, "5.1"}, > {erlsom, "1.2.1"}, > {janus,"0.0.5"} > ]}. > > I have ebin but I also have a couple of "apps" that live in their separate > directories and are not proper OTP applications. I compile them such that > beams go into my ebin but their source is not found during the making of the > boot file. I thought I could disregard the warnings as they don't seem to > affect anything. > > Hmm, when I build a tar file using just the rel filename, then I get tons of warnings about the sources not getting found. But it does build the tar file for me (this is on R12B5). Have you tried supplying some options, like [{path, ["*/ebin"]}] ? Maybe that'll highlight something? Just a shot in the dark, I'm afraid. It looks to me as if some of the file paths may not be what the systools expect. This could be either your own, or even some of the installation ones. Robby From garry@REDACTED Wed Aug 19 17:36:24 2009 From: garry@REDACTED (Garry Hodgson) Date: Wed, 19 Aug 2009 11:36:24 -0400 Subject: [erlang-questions] ssh module performance In-Reply-To: <4A8BF297.4020105@hyber.org> References: <4A805EBD.3090407@research.att.com> <4A8BF297.4020105@hyber.org> Message-ID: <4A8C1BF8.7040300@research.att.com> Claes Wikstrom wrote: > I had (and solved) problems with ssh server side code that was > related to sending a lot of really small ssh messages. > Try to possibly buffer (for say 50 millisecs) before flushing > the data to the ssh code. ok. i can try some tests that will result in fewer, larger requests, to see if this helps. thanks From seth@REDACTED Wed Aug 19 18:16:36 2009 From: seth@REDACTED (Seth Falcon) Date: Wed, 19 Aug 2009 09:16:36 -0700 Subject: Handling UTF-8 data when parsing XML using xmerl Message-ID: <20090819161636.GC380@ziti.local> Hi all, I'm using xmerl to parse Atom feed data and have encountered some surprising behavior with respect to how UTF-8 encoded data is handled. The problem I started to solve is as follows: Consider this XML: blah The goal is to extract the contents of the node as a single string. So parse_content(Xml) should return "blah". The approach I took was to use xmerl to parse the entire document, and then use xmerl:export_simple/2 on the children of to recapture the text. But in testing with UTF-8 data, I'm finding that while xmerl will parse UTF-8 data, it cannot later handle the representation it creates when calling xmerl:export_simple. Here's an example of what I'm seeing: First, here's the contents of file simple.xml (pasting the UTF-8 below, crossing fingers that it comes across in email). The body of the title tag can be reproduced in an Erlang session as: HiThere = [72,105,32,8230,32,116,104,101,114,101]. %% simple.xml: Hi ? there %% now here's what I see: 2> {Xml, _} = xmerl_scan:file("simple.xml"). {{xmlElement,title,title,[], {xmlNamespace,[],[]}, [],1,[], [{xmlText,[{title,1}], 1,[], [72,105,32,8230,32,116,104,101,114,101], text}], [],".",undeclared}, []} 3> Exported = lists:flatten(xmerl:export_simple([Xml], xmerl_xml)). [60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49, 46,48,34,63,62,60,116,105,116,108,101,62,72|...] 4> xmerl_scan:string(Exported). 3265- fatal: {error,{wfc_Legal_Character,{error,{bad_character,8230}}}} ** exception exit: {fatal, {{error,{wfc_Legal_Character,{error,{bad_character,8230}}}}, {file,file_name_unknown}, {line,1}, {col,34}}} in function xmerl_scan:fatal/2 in call from xmerl_scan:scan_char_data/5 in call from xmerl_scan:scan_content/11 in call from xmerl_scan:scan_element/12 in call from xmerl_scan:scan_document/2 in call from xmerl_scan:string/2 %% If I make the following transformation, things work again: 5> xmerl_scan:string(binary_to_list(unicode:characters_to_binary(Exported))). {{xmlElement,title,title,[], {xmlNamespace,[],[]}, [],1,[], [{xmlText,[{title,1}], 1,[], [72,105,32,8230,32,116,104,101,114,101], text}], [],"/opt/seth/EVRI/sg/GIT/zgst/rods",undeclared}, []} %% and strangely, given that I think I do have valid UTF-8, this also %% works: 6> xmerl_scan:string(Exported, [{encoding, latin1}]). Questions: * Is this the expected behavior? * Suggestions for a better way of doing the parsing or handling the UTF-8 strings? Thanks, + seth From seth@REDACTED Wed Aug 19 18:26:41 2009 From: seth@REDACTED (Seth Falcon) Date: Wed, 19 Aug 2009 09:26:41 -0700 Subject: [erlang-questions] troubleshooting systools:make_tar In-Reply-To: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> References: <046E769D-0BED-42A2-BE25-E011B3249285@gmail.com> Message-ID: <20090819162641.GD380@ziti.local> * On 2009-08-19 at 12:47 +0100 Joel Reymont wrote: > What is causing this and wow do I fix it? One thing to try is to be sure that all paths in your code path are either absolute paths or, at least, start with a "./". IMO this should not matter, but I recall having trouble getting systools to behave until someone made a similar suggestion. + seth From russell.brown@REDACTED Wed Aug 19 15:27:03 2009 From: russell.brown@REDACTED (Russell Brown) Date: Wed, 19 Aug 2009 14:27:03 +0100 Subject: Erlsom question, erlsom:scan fails but erlsom:scan_file ok Message-ID: <002C3E73-A14C-4340-96DD-70B39A395D83@mac.com> Hi, I hope it is OK posting this here. I tried looking at the erlsom support forum on Sourceforge and the last post was 2008 so I figured it was all but dead (or maybe perfect software, who knows?) I am using erlsom for an EC2 client I am writing. I created an XSD (munged from AWS wsdl file) and got erlsom to "compile" it to a model. I then use the Model to scan the result of an http call to an EC2 webservice. I get this: ** exception throw: {'EXIT', {error, [{exception, {function_clause, [{erlsom_parse,stateMachine, [startDocument, {state,undefined,undefined, {ok, {model, [{type,'_document',sequence,[{...}], [],...}, {type,'_document- UnmonitorInstancesResponse', sequence, [...],...}, {type,'_document- MonitorInstancesResponse', sequence,...}, {type,'_document- UnmonitorInstances',...}, {type,...}, {...}|...], [{ns, "http://ec2.amazonaws.com/doc/2009-04-04/ ", undefined}, {ns,"http://www.w3.org/2001/ XMLSchema",[...]}], "http://ec2.amazonaws.com/doc/2009-04-04/ ",[]}}, [],undefined,undefined}]}, {erlsom_parse,xml2StructCallback,2}, {erlsom_sax_list,wrapCallback,2}, {erlsom_sax_list,parse,2}, {erlsom,scan2,3}, {erl_eval,do_apply,5}, {shell,exprs,6}, {shell,eval_exprs,6}]}}, {stack,[undefined]}, {received,startDocument}]}} in function erlsom:scan2/3 The parameters to the function being the Model returned from {ok, Model} = erlsom:compile_xsd_file("ec2.xsd") and Body from {ok, {{_Version, 200, _ReasonPhrase}, _Headers, Body}} = http:request( Url ), However if I write the Body to a file with file:write_file("response.xml", Body) and then call erlsom:scan_file("response.xml", Model). it works as I would expect and as described in the documentation. what happens to that Body parameter in file:write_file and can I do that to the result of the http call before passing it erlsom:scan ? Many thanks in advance if you can help Cheers Russell From dave.pawson@REDACTED Wed Aug 19 19:32:47 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Wed, 19 Aug 2009 18:32:47 +0100 Subject: [erlang-questions] Handling UTF-8 data when parsing XML using xmerl In-Reply-To: <20090819161636.GC380@ziti.local> References: <20090819161636.GC380@ziti.local> Message-ID: <711a73df0908191032v56303c96ye8348f0e105054e1@mail.gmail.com> 2009/8/19 Seth Falcon : > Hi all, > > I'm using xmerl to parse Atom feed data and have encountered some > surprising behavior with respect to how UTF-8 encoded data is handled. > The approach I took was to use xmerl to parse the entire document, and > then use xmerl:export_simple/2 on the children of to > recapture the text. ?But in testing with UTF-8 data, I'm finding that > while xmerl will parse UTF-8 data, it cannot later handle the > representation it creates when calling xmerl:export_simple. I'm getting the impression that Erlang is late to the Unicode party. No encoding param on export? When will Erlang change to expect Unicode and deal with it internally? Please. regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From masklinn@REDACTED Wed Aug 19 19:43:44 2009 From: masklinn@REDACTED (Masklinn) Date: Wed, 19 Aug 2009 19:43:44 +0200 Subject: [erlang-questions] Handling UTF-8 data when parsing XML using xmerl In-Reply-To: <711a73df0908191032v56303c96ye8348f0e105054e1@mail.gmail.com> References: <20090819161636.GC380@ziti.local> <711a73df0908191032v56303c96ye8348f0e105054e1@mail.gmail.com> Message-ID: <949CE8F9-442D-4137-B037-6747F8B8747D@masklinn.net> On 19 Aug 2009, at 19:32 , Dave Pawson wrote: > I'm getting the impression that Erlang is late to the Unicode party. Late? As far as I know, it still hasn't opened the invitation. From mononcqc@REDACTED Wed Aug 19 19:56:18 2009 From: mononcqc@REDACTED (Fred Hebert (MononcQc)) Date: Wed, 19 Aug 2009 13:56:18 -0400 Subject: [erlang-questions] Handling UTF-8 data when parsing XML using xmerl In-Reply-To: <949CE8F9-442D-4137-B037-6747F8B8747D@masklinn.net> References: <20090819161636.GC380@ziti.local> <711a73df0908191032v56303c96ye8348f0e105054e1@mail.gmail.com> <949CE8F9-442D-4137-B037-6747F8B8747D@masklinn.net> Message-ID: <8b9ee55b0908191056k5e3ab72uf0621e23ecda5bc1@mail.gmail.com> On Wed, Aug 19, 2009 at 1:43 PM, Masklinn wrote: > On 19 Aug 2009, at 19:32 , Dave Pawson wrote: >> >> I'm getting the impression that Erlang is late to the Unicode party. > > Late? As far as I know, it still hasn't opened the invitation. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Unicode support in Erlang has started from release R13A, following EEP10*, and is still going. Details relative to Xmerl were included in the R13B01 release notes. Scroll to the bottom of http://erlang.org/download/otp_src_R13B01.readme for more information. This could help identify bugs. * http://erlang.org/eeps/eep-0010.html From w.a.de.jong@REDACTED Wed Aug 19 20:14:18 2009 From: w.a.de.jong@REDACTED (Willem de Jong) Date: Wed, 19 Aug 2009 20:14:18 +0200 Subject: [erlang-questions] Erlsom question, erlsom:scan fails but erlsom:scan_file ok In-Reply-To: <002C3E73-A14C-4340-96DD-70B39A395D83@mac.com> References: <002C3E73-A14C-4340-96DD-70B39A395D83@mac.com> Message-ID: <407d9ef80908191114p6428eeaen2124667701945847@mail.gmail.com> Hi Russel, Not quite dead, and not entirely perfect. But the bugs that I know of are small, and somebody posted a patch for the worst bug. The process to create a new version, run all the tests, package and deploy it to sourceforge takes me several hours, and I haven't found the time or the courage so far. Anyway, my impression from the error message below is that you have somehow passed {ok, Model} to erlsom:scan(), in stead of just Model. Is that possible? If not, please give me a bit more context so that I can do some testing. Regards, Willem On Wed, Aug 19, 2009 at 3:27 PM, Russell Brown wrote: > Hi, > I hope it is OK posting this here. I tried looking at the erlsom support > forum on Sourceforge and the last post was 2008 so I figured it was all but > dead (or maybe perfect software, who knows?) > > I am using erlsom for an EC2 client I am writing. I created an XSD (munged > from AWS wsdl file) and got erlsom to "compile" it to a model. I then use > the Model to scan the result of an http call to an EC2 webservice. I get > this: > > > ** exception throw: {'EXIT', > {error, > [{exception, > {function_clause, > [{erlsom_parse,stateMachine, > [startDocument, > {state,undefined,undefined, > {ok, > {model, > [{type,'_document',sequence,[{...}],[],...}, > > {type,'_document-UnmonitorInstancesResponse', > sequence, > [...],...}, > {type,'_document-MonitorInstancesResponse', > sequence,...}, > {type,'_document-UnmonitorInstances',...}, > {type,...}, > {...}|...], > [{ns, > "http://ec2.amazonaws.com/doc/2009-04-04/ > ", > undefined}, > {ns,"http://www.w3.org/2001/ > XMLSchema",[...]}], > "http://ec2.amazonaws.com/doc/2009-04-04/ > ",[]}}, > [],undefined,undefined}]}, > {erlsom_parse,xml2StructCallback,2}, > {erlsom_sax_list,wrapCallback,2}, > {erlsom_sax_list,parse,2}, > {erlsom,scan2,3}, > {erl_eval,do_apply,5}, > {shell,exprs,6}, > {shell,eval_exprs,6}]}}, > {stack,[undefined]}, > {received,startDocument}]}} > in function erlsom:scan2/3 > > > The parameters to the function being the Model returned from {ok, Model} = > erlsom:compile_xsd_file("ec2.xsd") and Body from {ok, {{_Version, 200, > _ReasonPhrase}, _Headers, Body}} = http:request( Url ), > > However if I write the Body to a file with file:write_file("response.xml", > Body) and then call erlsom:scan_file("response.xml", Model). it works as I > would expect and as described in the documentation. > > what happens to that Body parameter in file:write_file and can I do that to > the result of the http call before passing it erlsom:scan ? > > Many thanks in advance if you can help > > Cheers > > Russell > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From seth@REDACTED Wed Aug 19 21:02:00 2009 From: seth@REDACTED (Seth Falcon) Date: Wed, 19 Aug 2009 12:02:00 -0700 Subject: [erlang-questions] Handling UTF-8 data when parsing XML using xmerl In-Reply-To: <8b9ee55b0908191056k5e3ab72uf0621e23ecda5bc1@mail.gmail.com> References: <20090819161636.GC380@ziti.local> <711a73df0908191032v56303c96ye8348f0e105054e1@mail.gmail.com> <949CE8F9-442D-4137-B037-6747F8B8747D@masklinn.net> <8b9ee55b0908191056k5e3ab72uf0621e23ecda5bc1@mail.gmail.com> Message-ID: <20090819190200.GE380@ziti.local> * On 2009-08-19 at 13:56 -0400 Fred Hebert (MononcQc) wrote: > Details relative to Xmerl were included in the R13B01 release notes. > Scroll to the bottom of > http://erlang.org/download/otp_src_R13B01.readme for more information. > This could help identify bugs. Here's the more information (unless I'm missing something): The version is increased from 1.1.12 to 1.2 is due to that the new parser is dependent on the Unicode support that was added in OTP R13B. The old xmerl functionality is not changed. + seth From steven.charles.davis@REDACTED Wed Aug 19 21:16:55 2009 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 19 Aug 2009 12:16:55 -0700 (PDT) Subject: "New" SSL - a problem (which could be mine) and a suggestion In-Reply-To: <4A8A742B.1070300@gmail.com> References: <16a9f999-54b7-49b5-9258-193cd97cb5e8@j21g2000yqe.googlegroups.com> <4A8A71DF.1010209@erix.ericsson.se> <4A8A742B.1070300@gmail.com> Message-ID: <1827be82-44d1-4132-bed4-882293b0798e@q14g2000vbi.googlegroups.com> Hi Dan and anyone following this, So it turns out this issue is caused by a badly behaved browser - Google Chrome. The issue doesn't surface with Firefox. Right now it seemms that Chrome is being handed a client socket that it is (for some reason) closing out on immediately. I'll do some investigation with wireshark to find out exactly what's going on - it looks like a browser bug right now. /sd On Aug 18, 4:28?am, Steve Davis wrote: > Thanks, Dan - > > I'll spend time with it soon as I can get to it to make sure it's "not > just me" and get some repro code across to erlang-bugs - I'll let you > know either way. > > Best regards, > Steve > > Dan Gudmundsson wrote: > > No not a known issue, any help/debug-able example would be great. > > > /Dan > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From roger.larsson@REDACTED Thu Aug 20 00:47:06 2009 From: roger.larsson@REDACTED (Roger Larsson) Date: Thu, 20 Aug 2009 00:47:06 +0200 Subject: [erlang-questions] SMP performance with hackbench In-Reply-To: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> Message-ID: <200908200047.07766.roger.larsson@e-gatan.se> One thing - good or bad... The original code contains lines like this. /* Wait for start... */ ready(ready_out, wakefd); And in main() /* Kick them off */ if (write(wakefds[1], &dummy, 1) != 1) barf("Writing to start them"); This will ensure that setup and execute phases are not mixed. But the timer reported is the total time anyway. The processes are quite short lived. But will the list of receivers fit in the default data memory? Maybe the solution would be to add more processess... Coding... (Module name does not match in code) Testrun - it you sit by the computer you can hear the swapping... Aha, there is NO flow control. Each receiver might queue up ALL messages from ALL senders. The key here is the inputs/outputs/pagefaults - this application should not need any IO! > root@REDACTED:~/hackbench# \time ./run_one_erl.sh > Time is 62.260995 > 295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata > 0maxresident)k > 11776inputs+8outputs (27major+90965minor)pagefaults 0swaps > > (2) SMP disable > root@REDACTED:~/hackbench# \time ./run_one_erl.sh "-smp disable" > Time is 54.14644 > 54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata > 0maxresident)k > 3968inputs+8outputs (22major+36520minor)pagefaults 0swaps From a.thilani@REDACTED Thu Aug 20 08:01:06 2009 From: a.thilani@REDACTED (Thilani Abeysinghe) Date: Thu, 20 Aug 2009 11:31:06 +0530 Subject: terminate child under simple one for one supervisor Message-ID: hi, I have created following supervision tree. Sup1(one for all) Under Sup1 there is Sup2(simple one for one) and a gen_server Gen1(gen_server). Under Sup2(simple one for one) there is another gen_server. Gen2(gen_server). child is added by Gen1 calling supervisor:start_child(_,_) Gen2 starting successfuly. I want to know is there a way to stop the Gen2 gen_server. tried to use supervisor:terminate_child(SupRef, Id) it returned {error,simple_one_for_one} ~Thilani Abeysinghe From kiszl@REDACTED Thu Aug 20 10:14:01 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 20 Aug 2009 10:14:01 +0200 Subject: [erlang-questions] terminate child under simple one for one supervisor In-Reply-To: References: Message-ID: <4A8D05C9.7060705@tmit.bme.hu> Hi, That kind of child management is not possible with a simple_one_for_one supervisor: "The functions terminate_child/2, delete_child/2 and restart_child/2 are invalid for simple_one_for_one supervisors and will return {error,simple_one_for_one} if the specified supervisor uses this restart strategy." (http://www.erlang.org/doc/man/supervisor.html) If you need this, you can start a "regular" one_for_one supervisor with no initial children, and add the gen_fsm's later. Just be sure to use unique idenifiers for each them. Regards, Zoltan. Thilani Abeysinghe wrote: > hi, > I have created following supervision tree. > > Sup1(one for all) Under Sup1 there is Sup2(simple one for one) and a > gen_server Gen1(gen_server). > Under Sup2(simple one for one) there is another gen_server. > Gen2(gen_server). > > child is added by Gen1 calling supervisor:start_child(_,_) > > Gen2 starting successfuly. > I want to know is there a way to stop the Gen2 gen_server. > tried to use > supervisor:terminate_child(SupRef, Id) > it returned {error,simple_one_for_one} > > > ~Thilani Abeysinghe > > From sean.mcevoy@REDACTED Thu Aug 20 11:11:33 2009 From: sean.mcevoy@REDACTED (Sean McEvoy) Date: Thu, 20 Aug 2009 10:11:33 +0100 (BST) Subject: run_erl / Erlang configure script broken? In-Reply-To: <1018285.80261250714550079.JavaMail.root@zimbra> Message-ID: <8978893.80771250759493539.JavaMail.root@zimbra> Hello List, We're running R13B01 on a Solaris 10 machine (10/08 s10x_u6wos_07b X86, at a customer's site, configured in a non-standard way). When trying to use run_erl we see the error: run_erl:351 [13847] Wed Aug 19 13:34:15 2009 errno=2 'No such file or directory' Could not open pty master We see that the run_erl code tries a few different approaches to get a pty, and falls back to hard-coded paths if everything else fails. These paths aren't valid for Solaris, which keeps the pseudo-terminal files in /dev/pts. However, Solaris has a working posix_openpt() function -- which isn't getting called, because the HAVE_WORKING_POSIX_OPENPT macro is undefined. This is a result of the Erlang configure script being unable to detect that function. When running ./configure on a fresh copy of the R13B01 source on our system, we see the following message: checking for working posix_openpt implementation... no The C code that tests for posix_openpt() compiles on our system only when the -std=c99 flag is given. It's simple enough to force the configure script to use that flag: CFLAGS="-std=c99 $CFLAGS" ./configure ... checking for working posix_openpt implementation... yes But this breaks the build in other places. Has anyone seen this problem before? Any pointers on a fix or work around would be much appreciated. Thanks, Sean & Mietek. From hakan@REDACTED Thu Aug 20 12:22:53 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 20 Aug 2009 12:22:53 +0200 (CEST) Subject: [erlang-questions] Getting reltool to work In-Reply-To: References: Message-ID: On Wed, 19 Aug 2009, Torben Hoffmann wrote: >But, alas, I cannot get it to work: >9> reltool:start([{sys,[{lib_dirs,["ErlangProject/abekat/"]}]}]). >** exception exit: {badmatch,{error,"Illegal parameter: >{sys,[{lib_dirs,[\"ErlangProject/abekat\"]}]}"}} > in function reltool_sys_win:do_init/1 > in call from reltool_sys_win:init/1 > in call from proc_lib:init_p_do_apply/3 Try: reltool:start([{config, {sys,[{lib_dirs,["ErlangProject/abekat/"]}]}}]). > > Unfortunately the target generation part of reltool does not work so > > well in the current release.It will be greatly improved in R13B02. > > Contact me privately if you are interested in using it earlier than > > that. > > Using it earlier depends on the roadmap for Erlang (can I wait for it?!?!) - R13B02 will be released in the end of september. > I tried to look at erlang.org to find it, but was not able to dig it up... > is there such a thing available for public eye? No. > Or is that kind of info for EUC participants only??? ;-) No. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB From hans.bolinder@REDACTED Thu Aug 20 13:40:52 2009 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Thu, 20 Aug 2009 13:40:52 +0200 Subject: [erlang-questions] erl_eval function object In-Reply-To: References: Message-ID: <19085.13892.717455.638748@ornendil.du.uab.ericsson.se> [Paul Mineiro:] > The documentation for erl_eval says that the NonlocalFunctionHandler is > called when a functional object (fun) is called; however I'm not seeing > this. > ----- > -module (evaltest). > -compile (export_all). > > doit (String) -> > { ok, Scanned, _ } = erl_scan:string (String), > { ok, Parsed } = erl_parse:parse_exprs (Scanned), > Bindings = erl_eval:new_bindings (), > erl_eval:exprs (Parsed, > Bindings, > { value, fun local/2 }, > { value, fun non_local/2 }). > > local (Name, Arguments) -> > io:format ("local ~p ~p~n", [ Name, Arguments ]), > false. > > non_local (FuncSpec, Arguments) -> > io:format ("non_local ~p ~p~n", [ FuncSpec, Arguments ]), > case FuncSpec of > { M, F } -> erlang:apply (M, F, Arguments); > Func when is_function (Func) -> erlang:apply (Func, Arguments) > end. > ----- > > % erl > Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [kernel-poll:false] > Eshell V5.6.5 (abort with ^G) > 1> evaltest:doit ("(fun () -> 10 + 2 end) ()."). > non_local {erlang,'+'} [10,2] > {value,12,[]} There is a functional object for every fun-end expression, and it is created in one of the clauses of the erl_eval:expr/5 function. As indicated by the "ugly hack" comment in that clause, the fun's existence is an implementation detail; it is possible (but unlikely) that some day the fun will no longer be needed. When evaluating expressions erl_eval does a careful job not to call the non-local function handler function for such "helper" funs. The non-local function handler will be called with the fun as the first argument in cases like this: 1> evaltest:doit ("(fun math:sqrt/1) (2)."). non_local #Fun [2] {value,1.4142135623730951,[]} Best regards, Hans Bolinder, Erlang/OTP team, Ericsson From petr.sturc@REDACTED Thu Aug 20 15:58:26 2009 From: petr.sturc@REDACTED (Petr Sturc) Date: Thu, 20 Aug 2009 15:58:26 +0200 Subject: Clean/ignore dead process messages Message-ID: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> Folks, being newbee, I am stucked with following problem: I have a process simulating FIFO queue . You can store something by sending "in" message {in,Data} or get data by sending "out" message. When the queue is empty, the client gets blocked (waiting in its receive clause). The problem happens when client dies/disconnects while waiting for the response from the queue. The queue still have the "out" message from the now dead process in its inbox. When the queue gets non-empty the message matches and queue sends data to dead process and data are lost. Is there a way to remove all messages from killed/dead process from other's process inbox? Or do you see some other way to ensure that the data are not lost? Thanks for your ideas. Petr From james.hague@REDACTED Thu Aug 20 16:04:50 2009 From: james.hague@REDACTED (James Hague) Date: Thu, 20 Aug 2009 09:04:50 -0500 Subject: Windows: Erlang added TWICE to installed program list Message-ID: I've been seeing this for years: after installing Erlang under Windows there are two entries in the installed program list (that is, the list you see when you go to uninstall a program). If you uninstall Erlang, one of the entries goes away but not the other (the other causes an error if you try to remove it). I've verified this on at least four different PCs running various versions of XP and Vista. I don't know a thing about installers, but surely this is an easy fix? From baryluk@REDACTED Thu Aug 20 16:08:38 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 20 Aug 2009 16:08:38 +0200 Subject: [erlang-questions] Clean/ignore dead process messages In-Reply-To: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> References: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> Message-ID: <1250777318.19147.7.camel@sredniczarny> Dnia 2009-08-20, czw o godzinie 15:58 +0200, Petr Sturc pisze: > Folks, > Is there a way to remove all messages from killed/dead process from other's > process inbox? > Or do you see some other way to ensure that the data are not lost? you can link/1 to it, and when it dies, you will also die, efectivelly, cleaning this queue. You can also monitor/2 process, and scan queue for the pid of process died. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From kiszl@REDACTED Thu Aug 20 17:21:11 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 20 Aug 2009 17:21:11 +0200 Subject: [erlang-questions] Clean/ignore dead process messages In-Reply-To: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> References: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> Message-ID: <4A8D69E7.5000301@tmit.bme.hu> Hi, One way is to monitor all waiting processes in your fifo process. If the process dies, you will receive a 'DOWN' message, so you can remove the dead process from the remove queue. The other way is to change clients to polling: if the fifo is empty, send a message immediately immediately, and have the client ask for out again after some time. (http://erlang.org/doc/man/erlang.html#erlang:monitor-2) Regards, Zoltan. Petr Sturc wrote: > Folks, > > being newbee, I am stucked with following problem: > > I have a process simulating FIFO queue . You can store something by sending > "in" message {in,Data} or get data by sending "out" message. When the queue > is empty, the client gets blocked (waiting in its receive clause). > > The problem happens when client dies/disconnects while waiting for the > response from the queue. > > The queue still have the "out" message from the now dead process in its > inbox. When the queue gets non-empty the message matches and queue sends > data to dead process and data are lost. > > Is there a way to remove all messages from killed/dead process from other's > process inbox? > Or do you see some other way to ensure that the data are not lost? > > Thanks for your ideas. > Petr > > From colm.dougan@REDACTED Thu Aug 20 18:33:51 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 20 Aug 2009 17:33:51 +0100 Subject: ets memory usage Message-ID: <24d4f39c0908200933q255ede44l7712e7648d2c2d5c@mail.gmail.com> Hi, A question about ets memory usage : Eshell V5.6.5 (abort with ^G) 1> Tab = ets:new(foo, [set]). 16397 2> lists:foreach(fun(I) -> ets:insert(Tab, {I, 0}) end, lists:seq(1, 1000000)). ok 3> erlang:memory(ets). 48684012 So that looks like more than 40 bytes per entry. Pretty expensive, no? How about when the key is an md5sum : Eshell V5.6.5 (abort with ^G) 1> Tab = ets:new(foo, [set]). 16397 2> lists:foreach(fun(I) -> ets:insert(Tab, {erlang:md5(<>), 0}) end, lists:seq(1, 1000000)). ok 3> erlang:memory(ets). 72684940 So that is an additional 32 bytes per entry for an md5sum key instead of a (4 byte?) integer key. For a 30GB cache we would need about 7 million index entries which would minimally take up From colm.dougan@REDACTED Thu Aug 20 18:37:30 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Thu, 20 Aug 2009 17:37:30 +0100 Subject: ets memory usage In-Reply-To: <24d4f39c0908200933q255ede44l7712e7648d2c2d5c@mail.gmail.com> References: <24d4f39c0908200933q255ede44l7712e7648d2c2d5c@mail.gmail.com> Message-ID: <24d4f39c0908200937v11e9d927rffd87636d3b1c5a@mail.gmail.com> Gah - my email client sent this before I had finished typing it. But my question was really just: do my numbers seem reasonable and is there a way to be less memory intensive. BTW - my reference to a "30GB cache" was in relation to a block store we have in our app which uses 4k blocks. Thanks, Colm On Thu, Aug 20, 2009 at 5:33 PM, Colm Dougan wrote: > Hi, > > A question about ets memory usage : > > Eshell V5.6.5 ?(abort with ^G) > 1> Tab = ets:new(foo, [set]). > 16397 > 2> lists:foreach(fun(I) -> ets:insert(Tab, {I, 0}) end, lists:seq(1, 1000000)). > ok > 3> erlang:memory(ets). > 48684012 > > So that looks like more than 40 bytes per entry. ?Pretty expensive, no? > > How about when the key is an md5sum : > > Eshell V5.6.5 ?(abort with ^G) > 1> Tab = ets:new(foo, [set]). > 16397 > 2> ?lists:foreach(fun(I) -> ets:insert(Tab, {erlang:md5(<>), 0}) > end, lists:seq(1, 1000000)). > ok > 3> erlang:memory(ets). > 72684940 > > So that is an additional 32 bytes per entry for an md5sum key instead > of a (4 byte?) integer key. > > For a 30GB cache we would need about 7 million index entries which > would minimally take up > From attila.r.nohl@REDACTED Thu Aug 20 21:52:06 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 20 Aug 2009 21:52:06 +0200 Subject: [erlang-questions] Clean/ignore dead process messages In-Reply-To: <4A8D69E7.5000301@tmit.bme.hu> References: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> <4A8D69E7.5000301@tmit.bme.hu> Message-ID: <401d3ba30908201252k5b614a22oea660ad4a7ab1900@mail.gmail.com> If the "out" message is sent after the client process died, but before the 'DOWN' message is received, the data is still lost. 2009/8/20, Zoltan Lajos Kis : > Hi, > > One way is to monitor all waiting processes in your fifo process. If the > process dies, you will receive a 'DOWN' message, so you can remove the > dead process from the remove queue. [...] >> The queue still have the "out" message from the now dead process in its >> inbox. When the queue gets non-empty the message matches and queue sends >> data to dead process and data are lost. >> >> Is there a way to remove all messages from killed/dead process from >> other's >> process inbox? >> Or do you see some other way to ensure that the data are not lost? >> >> Thanks for your ideas. >> Petr >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Thu Aug 20 23:01:53 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 20 Aug 2009 23:01:53 +0200 Subject: [erlang-questions] Clean/ignore dead process messages In-Reply-To: <401d3ba30908201252k5b614a22oea660ad4a7ab1900@mail.gmail.com> References: <73b10e5b0908200658q74a47f6ft3ca8e74e42058458@mail.gmail.com> <4A8D69E7.5000301@tmit.bme.hu> <401d3ba30908201252k5b614a22oea660ad4a7ab1900@mail.gmail.com> Message-ID: <4A8DB9C1.3040906@tmit.bme.hu> Correct. Let's come up with a solution for the two generals' problem! Attila Rajmund Nohl wrote: > If the "out" message is sent after the client process died, but before > the 'DOWN' message is received, the data is still lost. > > 2009/8/20, Zoltan Lajos Kis : > >> Hi, >> >> One way is to monitor all waiting processes in your fifo process. If the >> process dies, you will receive a 'DOWN' message, so you can remove the >> dead process from the remove queue. >> > [...] > >>> The queue still have the "out" message from the now dead process in its >>> inbox. When the queue gets non-empty the message matches and queue sends >>> data to dead process and data are lost. >>> >>> Is there a way to remove all messages from killed/dead process from >>> other's >>> process inbox? >>> Or do you see some other way to ensure that the data are not lost? >>> >>> Thanks for your ideas. >>> Petr >>> >>> >>> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From raould@REDACTED Fri Aug 21 02:13:39 2009 From: raould@REDACTED (Raoul Duke) Date: Thu, 20 Aug 2009 17:13:39 -0700 Subject: LfE feature question: ?MODULE:fn() Message-ID: <91a2ba3e0908201713sf9bd15bo6220f6ab3fe4d9a2@mail.gmail.com> hi, is "?MODULE:fn()" supported? if so, what would the equivalent "(defun fn () ...)" look like for classic Erlang "?MODULE:fn() -> ..." syntax? thank you. From raould@REDACTED Fri Aug 21 02:41:21 2009 From: raould@REDACTED (Raoul Duke) Date: Thu, 20 Aug 2009 17:41:21 -0700 Subject: LfE .beam + Dialyzer Message-ID: <91a2ba3e0908201741p791fb9a7s6f31aad7d992b518@mail.gmail.com> hi, Dialyzer says that the .beam file from LfE compilation doesn't have debug info, so it can't process it. A cursory search in the LfE docs didn't show me how to trick LfE into generating such debug info into the .beam file. Is that available somehow? thank you. From rvirding@REDACTED Fri Aug 21 03:56:18 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 21 Aug 2009 03:56:18 +0200 Subject: [erlang-questions] LfE feature question: ?MODULE:fn() In-Reply-To: <91a2ba3e0908201713sf9bd15bo6220f6ab3fe4d9a2@mail.gmail.com> References: <91a2ba3e0908201713sf9bd15bo6220f6ab3fe4d9a2@mail.gmail.com> Message-ID: <3dbc6d1c0908201856m6687fe71jc3b6d33df5940140@mail.gmail.com> At the moment there is no predefined MODULE macro in LFE. It is easy to define your own: (defmacro MODULE () sune) and call it with (MODULE). Not as beautiful I know but if I get around to adding symbol macros it will be a little better. Another problem is that the macro expander knows practically no LFE at the moment only sexprs, but there is a way to fix rather shakiliy. Is it important? Robert P.S. Raoul I saw your mail but haven't got around to answering anything till now. 2009/8/21 Raoul Duke > hi, > > is "?MODULE:fn()" supported? if so, what would the equivalent "(defun > fn () ...)" look like for classic Erlang "?MODULE:fn() -> ..." syntax? > > thank you. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From rvirding@REDACTED Fri Aug 21 04:05:22 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 21 Aug 2009 04:05:22 +0200 Subject: [erlang-questions] LfE .beam + Dialyzer In-Reply-To: <91a2ba3e0908201741p791fb9a7s6f31aad7d992b518@mail.gmail.com> References: <91a2ba3e0908201741p791fb9a7s6f31aad7d992b518@mail.gmail.com> Message-ID: <3dbc6d1c0908201905w294eeb46ud082739784edeced@mail.gmail.com> Hi again, There is no way of doing that at the moment. I have a sneaking suspicion that it is not trivial, either you need an LFE parser for dialyzer so it can read LFE source files or the LFE compiler adds debug information which I guess has to be in vanilla erlang. I will admit that I haven't seriously looked into it yet, but I can put it in the pipe-line. Robert 2009/8/21 Raoul Duke > hi, > > Dialyzer says that the .beam file from LfE compilation doesn't have > debug info, so it can't process it. A cursory search in the LfE docs > didn't show me how to trick LfE into generating such debug info into > the .beam file. Is that available somehow? > > thank you. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vinayakapawar@REDACTED Fri Aug 21 09:21:07 2009 From: vinayakapawar@REDACTED (Vinayak Pawar) Date: Fri, 21 Aug 2009 12:51:07 +0530 Subject: Mnesia decision table size .... Message-ID: <23237d040908210021r79c01aeanaf4cdf936c22f313@mail.gmail.com> Hi all, We're doing load testing of our application that is using Mnesia. Each request to this application under test typically involves either doing writes, deletes, or selects in mnesia transaction context. During this testing, we've observed that mnesia_recover process is creating very very big decision tables occupying about 1.5 GB of memory. The actual tables themselves contain less than 10 MB of data. Can anyone let us know how these decision table sizes be kept under check? Here's the information returned by ets:i() id name type size mem owner ----------------------------------------------------------------------------------------------------------- 393238 mnesia_transient_decision set 3955076 59913208 mnesia_recover 259255369814 mnesia_transient_decision set 5326849 80702161 mnesia_recover 608416759878 mnesia_transient_decision set 5118008 77536777 mnesia_recover P.S.: Transactions are must. We cannot use any of *_dirty context in our application. Many thanks Regards, Vinayak From ruslan@REDACTED Fri Aug 21 09:55:14 2009 From: ruslan@REDACTED (Ruslan Babayev) Date: Fri, 21 Aug 2009 00:55:14 -0700 Subject: Erlang Open Sound Control app Message-ID: <315b1480908210055i3807b977yd3441233462ec714@mail.gmail.com> For those who might be interested, I have published my Erlang implementation of the OSC protocol and a simple dispatch server on github . Feedback is welcome. From bgustavsson@REDACTED Fri Aug 21 10:16:55 2009 From: bgustavsson@REDACTED (Bjorn Gustavsson) Date: Fri, 21 Aug 2009 10:16:55 +0200 Subject: [erlang-questions] LfE .beam + Dialyzer In-Reply-To: <3dbc6d1c0908201905w294eeb46ud082739784edeced@mail.gmail.com> References: <91a2ba3e0908201741p791fb9a7s6f31aad7d992b518@mail.gmail.com> <3dbc6d1c0908201905w294eeb46ud082739784edeced@mail.gmail.com> Message-ID: <6672d0160908210116w12df4f89g15f609771051dc03@mail.gmail.com> On Fri, Aug 21, 2009 at 4:05 AM, Robert Virding wrote: > There is no way of doing that at the moment. I have a sneaking suspicion > that it is not trivial, either you need an LFE parser for dialyzer so it can > read LFE source files or the LFE compiler adds debug information which I > guess has to be in vanilla erlang. I will admit that I haven't seriously > looked into it yet, but I can put it in the pipe-line. Dialyzer does its analysis on the Core Erlang code, so LFE could save its generated Core Erlang code in the .beam file (with a suitable chunk name). Dialyzer would then have to be modified to know to look for the Core Erlang chunk in .beam files. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From rob.charlton@REDACTED Fri Aug 21 12:17:38 2009 From: rob.charlton@REDACTED (Rob Charlton) Date: Fri, 21 Aug 2009 11:17:38 +0100 Subject: Reasons why erl -remsh might not work? Message-ID: <4A8E7442.9030503@savageminds.com> I am trying to connect a remote shell to a running erlang node on a remote customer's site. I am ssh'd into the machine on which the node is running. It is running Red Hat 4, erlang R12B If I start (what I think is the same) node on my own machine, then do: erl -sname test -remsh mynode@REDACTED then the shell works. If I ssh to the remote machine and type: erl -sname test -remsh theirnode@REDACTED -cookie theircookie then I get: *** ERROR: Shell process terminated! ... If I just start a local shell and try: net_adm:ping(theirnode@REDACTED) then I get: pang If I type: nodes(). then I get: [] At the linux console if I type: epmd -names then theirnode is listed. I can use to_erl to connect to the running node and get a console session, but there is too much logging output to do anything useful, hence my attempt to get a remote shell. I've run out of ideas for what to check next! Does anyone have any suggestions? Thanks Rob From rvirding@REDACTED Fri Aug 21 13:33:13 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 21 Aug 2009 13:33:13 +0200 Subject: Scheme Steering Committee Message-ID: <3dbc6d1c0908210433g6fec6daat5c346574e3976da4@mail.gmail.com> Here is an interesting position statement of the Scheme Steering Committee: http://scheme-reports.org/2009/position-statement.html Robert From joelr1@REDACTED Fri Aug 21 14:24:42 2009 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 21 Aug 2009 13:24:42 +0100 Subject: ez files and code server errors Message-ID: <2493AF17-DEA2-4D98-B9E4-1F5537EF7BC6@gmail.com> Does this ring the bell with anyone? {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: einval. Target: ./._janus-0.0.6.ez/ebin. Function: read_file_info. Process: code_server."} {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: einval. Target: ./._janus-0.0.6.ez/._janus-0.0.6/ebin. Function: read_file_info. Process: code_server."} {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: einval. Target: ./._sim-0.0.6.ez/ebin. Function: read_file_info. Process: code_server."} {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: einval. Target: ./._sim-0.0.6.ez/._sim-0.0.6/ebin. Function: read_file_info. Process: code_server."} The app seems to start fine afterwards. Thanks, Joel --- faster mac firefox http://wagerlabs.com From hans.bolinder@REDACTED Fri Aug 21 14:29:09 2009 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 21 Aug 2009 14:29:09 +0200 Subject: [erlang-questions] erl_eval function object In-Reply-To: References: Message-ID: <19086.37653.948063.492735@ornendil.du.uab.ericsson.se> [Paul Mineiro:] > The documentation for erl_eval says that the NonlocalFunctionHandler is > called when a functional object (fun) is called; however I'm not seeing > this. [I replied with some nonsense:] > There is a functional object for every fun-end expression, and it is > created in one of the clauses of the erl_eval:expr/5 function. As > indicated by the "ugly hack" comment in that clause, the fun's > existence is an implementation detail; it is possible (but unlikely) > that some day the fun will no longer be needed. Correction. A fun will always have to be created. The non-local function handler is primarily a means to implement the restricted shell mode (see shell(3)). Some harmless calls are skipped, which makes it somewhat simpler to write non-local function handlers. erlang:apply--which is skipped when calling non-local function handlers--is already mentioned in a note. I'll extend that note to mention shell funs as well. Best regards, Hans Bolinder, Erlang/OTP team, Ericsson From bengt.kleberg@REDACTED Fri Aug 21 15:33:05 2009 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 21 Aug 2009 15:33:05 +0200 Subject: [erlang-questions] Scheme Steering Committee In-Reply-To: <3dbc6d1c0908210433g6fec6daat5c346574e3976da4@mail.gmail.com> References: <3dbc6d1c0908210433g6fec6daat5c346574e3976da4@mail.gmail.com> Message-ID: <1250861585.4854.25.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Greetings, Many a true word there. However, I would like to see "the world's most unportable programming language" replaced with "the world's most unportable programs". bengt On Fri, 2009-08-21 at 13:33 +0200, Robert Virding wrote: > Here is an interesting position statement of the Scheme Steering Committee: > > http://scheme-reports.org/2009/position-statement.html > > Robert From hakan@REDACTED Fri Aug 21 15:33:05 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 21 Aug 2009 15:33:05 +0200 (CEST) Subject: [erlang-questions] ez files and code server errors In-Reply-To: <2493AF17-DEA2-4D98-B9E4-1F5537EF7BC6@gmail.com> References: <2493AF17-DEA2-4D98-B9E4-1F5537EF7BC6@gmail.com> Message-ID: On Fri, 21 Aug 2009, Joel Reymont wrote: > Does this ring the bell with anyone? No not directly. Perhaps it is easier to see what happens if you start Erlang with the -loader_debug flag. I can take a look at it if you do that and send the printouts to me. The full result from code:get_path(), init:get_arguments() and and os:getenv("ERL_LIBS") is also interesting. How does the file structure of your two .ez files look like? /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB > {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: > einval. Target: ./._janus-0.0.6.ez/ebin. Function: read_file_info. > Process: code_server."} > {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: > einval. Target: ./._janus-0.0.6.ez/._janus-0.0.6/ebin. Function: > read_file_info. Process: code_server."} > {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: > einval. Target: ./._sim-0.0.6.ez/ebin. Function: read_file_info. Process: > code_server."} > {error_logger,{{2009,8,21},{12,20,41}},std_error,"File operation error: > einval. Target: ./._sim-0.0.6.ez/._sim-0.0.6/ebin. Function: > read_file_info. Process: code_server."} > > The app seems to start fine afterwards. From hakan@REDACTED Fri Aug 21 15:56:59 2009 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 21 Aug 2009 15:56:59 +0200 (CEST) Subject: [erlang-questions] Mnesia decision table size .... In-Reply-To: <23237d040908210021r79c01aeanaf4cdf936c22f313@mail.gmail.com> References: <23237d040908210021r79c01aeanaf4cdf936c22f313@mail.gmail.com> Message-ID: On Fri, 21 Aug 2009, Vinayak Pawar wrote: > We're doing load testing of our application that is using Mnesia. Each > request to this application under test typically involves either doing > writes, deletes, or selects in mnesia transaction context. During this > testing, we've observed that mnesia_recover process is creating very very > big decision tables occupying about 1.5 GB of memory. The actual tables > themselves contain less than 10 MB of data. Can anyone let us know how > these decision table sizes be kept under check? You can try with lowering the dump_log thresholds. /H?kan --- H?kan Mattsson (uabhams) Erlang/OTP, Ericsson AB From masse@REDACTED Fri Aug 21 16:08:58 2009 From: masse@REDACTED (mats cronqvist) Date: Fri, 21 Aug 2009 16:08:58 +0200 Subject: Reasons why erl -remsh might not work? In-Reply-To: <4A8E7442.9030503@savageminds.com> (Rob Charlton's message of "Fri\, 21 Aug 2009 11\:17\:38 +0100") References: <4A8E7442.9030503@savageminds.com> Message-ID: <877hwx45tx.fsf@sterlett.hq.kred> Rob Charlton writes: > I am trying to connect a remote shell to a running erlang node on a > remote customer's site. I am ssh'd into the machine on which the node is > running. It is running Red Hat 4, erlang R12B > > If I start (what I think is the same) node on my own machine, then do: > erl -sname test -remsh mynode@REDACTED > then the shell works. > > If I ssh to the remote machine and type: > erl -sname test -remsh theirnode@REDACTED -cookie theircookie -setcookie perhaps? From pan+eq@REDACTED Fri Aug 21 16:27:48 2009 From: pan+eq@REDACTED (pan+eq@REDACTED) Date: Fri, 21 Aug 2009 16:27:48 +0200 (CEST) Subject: [erlang-questions] erlsrv usage In-Reply-To: <20090818135425.GR4102@localhost> References: <20090818135425.GR4102@localhost> Message-ID: Hi! Well... The "display name" will be ejabberd, but the internal windows name you see if you select "properties" will be ejabberd followed by some seemingly random numbers. It's not a bug, it's actually working as intended. The internal name never changes regardless of what the release handler in OTP does to the service (renames, creates new service with old name etc etc), why it needs to be unique and somewhat disconnected from the name erlsrv uses (which is also set as the windows "display name", which is what most users will ever see). However, even if it's working as once intended, there is no harm in adding options for those who don't use the release handler and don't need to do the icky things the release_handler does. Therefore the erlsrv command will take two new options when registering a service beginning from R13B02: -i -c The comment will show up as "Description" in the service manager and the "internal service name" will show up as "Service name" in the service manager's properties window. -i can only be used when adding a service while -c can be used subsequently in the "erlsrv set" context to change the comment. Changing your command to erlsrv add ejabberd -sname ejabberd-srv@REDACTED -w "C:\ejabberd-2.1.0\bin" -ar "-s win_service" -st "win_service:stop()." -onfail restart -i ejabberd -c "Cool application" will make it look nicer in service manager. R13B02 will be out in a month or so, hope you can cope until then. (just a note, do *not* use -i when registering a service that is to be managed by the OTP release_handler!) Cheers, /Patrik On Tue, 18 Aug 2009, Christophe Romain wrote: > Hi > > I use erlsrv for ejabberd to run as service under windows. > the service is registered that way: > > erlsrv add ejabberd -sname ejabberd-srv@REDACTED -w "C:\ejabberd-2.1.0\bin" > -ar "-s win_service" -st "win_service:stop()." -onfail restart > > but the service name looks like: ejabberd01c9e46ae1733560 > (and not "ejabberd" as requested) is there a reason for that ? > > by the way, reading http://erlang.org/doc/man/erlsrv.html > it seems it's not possible to define service description on command line. > is there an undocumented way for setting service description ? > > Thanks! > BR. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From rvirding@REDACTED Fri Aug 21 16:53:47 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 21 Aug 2009 16:53:47 +0200 Subject: [erlang-questions] Scheme Steering Committee In-Reply-To: <1250861585.4854.25.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> References: <3dbc6d1c0908210433g6fec6daat5c346574e3976da4@mail.gmail.com> <1250861585.4854.25.camel@seasc1137.dyn.rnd.as.sw.ericsson.se> Message-ID: <3dbc6d1c0908210753y7f8e95fem48d46618eff966f9@mail.gmail.com> Sorry, not on the comittee so I can't help you there. Robert 2009/8/21 Bengt Kleberg > Greetings, > > Many a true word there. However, I would like to see "the world's most > unportable programming language" replaced with "the world's most > unportable programs". > > bengt > > On Fri, 2009-08-21 at 13:33 +0200, Robert Virding wrote: > > Here is an interesting position statement of the Scheme Steering > Committee: > > > > http://scheme-reports.org/2009/position-statement.html > > > > Robert > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From rob.charlton@REDACTED Fri Aug 21 16:24:35 2009 From: rob.charlton@REDACTED (Rob Charlton) Date: Fri, 21 Aug 2009 15:24:35 +0100 Subject: [erlang-questions] Re: Reasons why erl -remsh might not work? In-Reply-To: <877hwx45tx.fsf@sterlett.hq.kred> References: <4A8E7442.9030503@savageminds.com> <877hwx45tx.fsf@sterlett.hq.kred> Message-ID: <4A8EAE23.2050306@savageminds.com> mats cronqvist wrote: > Rob Charlton writes: > >> If I ssh to the remote machine and type: >> erl -sname test -remsh theirnode@REDACTED -cookie theircookie >> > -setcookie perhaps Thanks Mats. "-cookie Cookie Obsolete flag without any effect and common misspelling for -setcookie. Use -setcookie instead." Ah. Cheers Rob From pan+eq@REDACTED Fri Aug 21 17:28:13 2009 From: pan+eq@REDACTED (pan+eq@REDACTED) Date: Fri, 21 Aug 2009 17:28:13 +0200 (CEST) Subject: [erlang-questions] Windows: Erlang added TWICE to installed program list In-Reply-To: References: Message-ID: Hi! It would surely be an "easy fix" if I could reproduce it... I've never seen that behaviour and I have (believe me :)) installed and removed erlang a *lot* of times on different versions of Windows over the years since i wrote the NSIS installer script for Erlang... The bug must occur under certain conditions that our test environments don't meet. What privileges do you have? Do you have a certain language installed (I've only tested on English and Swedish windows versions). Any special combination of options when installing? Any other things that might be of interest? Anyone else that has encountered this? If you could help me with some more info so I could reproduce it, I'll gladly fix it! Cheers, /Patrik On Thu, 20 Aug 2009, James Hague wrote: > I've been seeing this for years: after installing Erlang under Windows > there are two entries in the installed program list (that is, the list > you see when you go to uninstall a program). If you uninstall Erlang, > one of the entries goes away but not the other (the other causes an > error if you try to remove it). I've verified this on at least four > different PCs running various versions of XP and Vista. > > I don't know a thing about installers, but surely this is an easy fix? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From mononcqc@REDACTED Fri Aug 21 17:34:12 2009 From: mononcqc@REDACTED (Fred Hebert (MononcQc)) Date: Fri, 21 Aug 2009 11:34:12 -0400 Subject: [erlang-questions] Windows: Erlang added TWICE to installed program list In-Reply-To: References: Message-ID: <8b9ee55b0908210834l46e9b7edi83a25266c95179be@mail.gmail.com> On Fri, Aug 21, 2009 at 11:28 AM, wrote: > Hi! > > It would surely be an "easy fix" if I could reproduce it... > > I've never seen that behaviour and I have (believe me :)) installed and > removed erlang a *lot* of times on different versions of Windows over the > years since i wrote the NSIS installer script for Erlang... > > The bug must occur under certain conditions that our test environments don't > meet. > > What privileges do you have? Do you have a certain language installed (I've > only tested on English and Swedish windows versions). Any special > combination of options when installing? Any other things that might be of > interest? > > Anyone else that has encountered this? > > If you could help me with some more info so I could reproduce it, I'll > gladly fix it! > > Cheers, > /Patrik > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Could not reproduce on Windows 7 Build 7100. I have installed and uninstalled the last 3 releases without any probem. From raould@REDACTED Fri Aug 21 19:26:34 2009 From: raould@REDACTED (Raoul Duke) Date: Fri, 21 Aug 2009 10:26:34 -0700 Subject: [erlang-questions] LfE feature question: ?MODULE:fn() In-Reply-To: <3dbc6d1c0908201856m6687fe71jc3b6d33df5940140@mail.gmail.com> References: <91a2ba3e0908201713sf9bd15bo6220f6ab3fe4d9a2@mail.gmail.com> <3dbc6d1c0908201856m6687fe71jc3b6d33df5940140@mail.gmail.com> Message-ID: <91a2ba3e0908211026j6605ccd9x1b6261e55682bbc9@mail.gmail.com> > (defmacro MODULE () sune) thanks! i will experiment with that. (i'm really just doing very bad pattern matching / cargo cult programming in LfE at the moment, i haven't "groked" the whole LfE macro thing yet. i'm only doing this for personal edification so on the whole there's nothing urgent or important about it all.) sincerely. From corticalcomputer@REDACTED Fri Aug 21 20:03:39 2009 From: corticalcomputer@REDACTED (G.S.) Date: Fri, 21 Aug 2009 11:03:39 -0700 Subject: Converting a mnesia table from set to ordered_set. Message-ID: <2a67d3ff0908211103g56dcd664sf3739791a32a5528@mail.gmail.com> Hello, What's the best and fastest way to convert an already existing, fully populated, about 5 gig table that is of type set, to type = ordered_set? Thanks, -Gene From yogishb@REDACTED Fri Aug 21 20:40:14 2009 From: yogishb@REDACTED (Yogish Baliga) Date: Fri, 21 Aug 2009 11:40:14 -0700 (PDT) Subject: inet:gethostbyname issue Message-ID: <199154.33078.qm@web31815.mail.mud.yahoo.com> erl -name baliga@REDACTED 1> inet:gethostbyname("foo"). {ok, {hostent, "foo"....}} erl 1> inet:gethostbyname("foo"). {ok, {hostent, "foo.example.com"...}} When erlang node is started with long node name, inet:gethostbyname/1 return short hostname. But starting erlang node with short node name or no node name, inet:gethostbyname/1 return full hostname. Any fix for this? Thanx, -- baliga "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ From jarrod@REDACTED Sat Aug 22 00:18:31 2009 From: jarrod@REDACTED (Jarrod Roberson) Date: Fri, 21 Aug 2009 18:18:31 -0400 Subject: [erlang-questions] Windows: Erlang added TWICE to installed program list In-Reply-To: References: Message-ID: On Fri, Aug 21, 2009 at 11:28 AM, > wrote: > Hi! > > It would surely be an "easy fix" if I could reproduce it... > > I've never seen that behaviour and I have (believe me :)) installed and > removed erlang a *lot* of times on different versions of Windows over the > years since i wrote the NSIS installer script for Erlang... > > The bug must occur under certain conditions that our test environments > don't meet. > > What privileges do you have? Do you have a certain language installed (I've > only tested on English and Swedish windows versions). Any special > combination of options when installing? Any other things that might be of > interest? > > Anyone else that has encountered this? > > If you could help me with some more info so I could reproduce it, I'll > gladly fix it! > > Cheers, > /Patrik > this same double entry happens on my Windows XP SP3 machine since one of the early R12 releases and with all the R13 releases. From erlangy@REDACTED Sat Aug 22 00:26:55 2009 From: erlangy@REDACTED (Michael McDaniel) Date: Fri, 21 Aug 2009 15:26:55 -0700 Subject: [erlang-questions] inet:gethostbyname issue In-Reply-To: <199154.33078.qm@web31815.mail.mud.yahoo.com> References: <199154.33078.qm@web31815.mail.mud.yahoo.com> Message-ID: <20090821222654.GY30622@delora.autosys.us> On Fri, Aug 21, 2009 at 11:40:14AM -0700, Yogish Baliga wrote: > erl -name baliga@REDACTED > 1> inet:gethostbyname("foo"). > {ok, {hostent, "foo"....}} > > erl > 1> inet:gethostbyname("foo"). > {ok, {hostent, "foo.example.com"...}} > > When erlang node is started with long node name, inet:gethostbyname/1 return short hostname. But starting erlang node with short node name or no node name, inet:gethostbyname/1 return full hostname. > > Any fix for this? > > Thanx, > -- baliga > > > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inet:gethostbyname("delora"). works same for me however I started ... mmcdanie@REDACTED:~/misc/src/erlang/erlview$ uname -a Linux delora 2.6.24-24-386 #1 Tue Jul 7 19:12:52 UTC 2009 i686 GNU/Linux mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} 2> q(). ok 3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -sname fu Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> q(). ok (fu@REDACTED)3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> q(). ok (fu@REDACTED)3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu@REDACTED Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> ~Michael From yogishb@REDACTED Sat Aug 22 03:56:31 2009 From: yogishb@REDACTED (Yogish Baliga) Date: Fri, 21 Aug 2009 18:56:31 -0700 (PDT) Subject: [erlang-questions] inet:gethostbyname issue [solved] In-Reply-To: <20090821222654.GY30622@delora.autosys.us> References: <199154.33078.qm@web31815.mail.mud.yahoo.com> <20090821222654.GY30622@delora.autosys.us> Message-ID: <842214.85353.qm@web31805.mail.mud.yahoo.com> Got the solution. Have a inetrc file with the following content {lookup, [native]}. set the environment variable ERL_INETRC to the full path name of the inetrc file (default $HOME/.inetrc) By default dns lookup is done in file, dns, native order -- baliga "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ ________________________________ From: Michael McDaniel To: erlang-questions@REDACTED Sent: Friday, August 21, 2009 3:26:55 PM Subject: Re: [erlang-questions] inet:gethostbyname issue On Fri, Aug 21, 2009 at 11:40:14AM -0700, Yogish Baliga wrote: > erl -name baliga@REDACTED > 1> inet:gethostbyname("foo"). > {ok, {hostent, "foo"....}} > > erl > 1> inet:gethostbyname("foo"). > {ok, {hostent, "foo.example.com"...}} > > When erlang node is started with long node name, inet:gethostbyname/1 return short hostname. But starting erlang node with short node name or no node name, inet:gethostbyname/1 return full hostname. > > Any fix for this? > > Thanx, > -- baliga > > > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inet:gethostbyname("delora"). works same for me however I started ... mmcdanie@REDACTED:~/misc/src/erlang/erlview$ uname -a Linux delora 2.6.24-24-386 #1 Tue Jul 7 19:12:52 UTC 2009 i686 GNU/Linux mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} 2> q(). ok 3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -sname fu Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> q(). ok (fu@REDACTED)3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> q(). ok (fu@REDACTED)3> mmcdanie@REDACTED:~/misc/src/erlang/erlview$ erl -name fu@REDACTED Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) (fu@REDACTED)1> inet:gethostbyname("delora"). {ok,{hostent,"delora.autosys.us", ["localhost.localdomain","localhost","delora"], inet,4, [{127,0,0,1}]}} (fu@REDACTED)2> ~Michael ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From gene.tani@REDACTED Sun Aug 23 18:13:56 2009 From: gene.tani@REDACTED (Gene Tani) Date: Sun, 23 Aug 2009 09:13:56 -0700 (PDT) Subject: Google custom search engine Message-ID: Somewhat apropos of the discussion on cleaning up the docs, copyright, etc: I'm not able to find a current Google custom search engine for the top erlang sites, so i pulled up the last couple months delicious tags, counted domains, and this is what i get (top 75). Anybody have any others? ===============: learnyousomeerlang.com code.google.com erlang.org riak.basho.com github.com infoq.com process-one.net couchdb.apache.org trapexit.org beebole.com erlapi.prepor.ru discoproject.org planeterlang.org spawnlink.com erlang-factory.com yarivsblog.com lethain.com sics.se steve.vinoski.net bitbucket.org video.yahoo.com nitrogenproject.com metabrew.com rabbitmq.com books.couchdb.org en.wikipedia.org d.hatena.ne.jp medevyoujane.com dukesoferl.blogspot.com clickcaster.com pragdave.pragprog.com yaws.hyber.org armstrongonsoftware.blogspot.com browsertoolkit.com erlang.se beepbeep.dmitriid.com erldocs.com andy.wordpress.com tsung.erlang-projects.org erlang.shibu.jp janl.github.com roberthorvick.com highscalability.com weblog.hypotheticalabs.com pragprog.com ohloh.net ulf.wiger.net slideshare.net ldn.linuxfoundation.org wiki.reia-lang.org horicky.blogspot.com erlang-consulting.com weblog.miceda.org lshift.net damienkatz.net bc.tech.coop habrahabr.ru erlware.org erlang-web.org ruben.savanne.be wiki.github.com erlangprogramming.org video.google.com wiki.apache.org blog.socklabs.com support.process-one.net streamhacker.com vimeo.com easyerl.blogspot.com 20bits.com ibm.com erlyweb.org ejabberd.im groups.google.com/group/erlang-programming/ sourceforge.net From flaboy.cn@REDACTED Sun Aug 23 18:18:25 2009 From: flaboy.cn@REDACTED (Wanglei) Date: Mon, 24 Aug 2009 00:18:25 +0800 Subject: dict slower than ets? Message-ID: dict write x 10000 > {T,D} = timer:tc(test,dict_read,[]). {86177,... dict read x 10000 > timer:tc(test,dict_read,[D]). {17260, ----------------------------- ets write x 10000 > {T,E}=timer:tc(test,ets_write,[]). {18005,20493} dict read x 10000 > timer:tc(test,ets_read,[E]). {15706, test.erl ---------- 8< ------------------ -module(test). -export([dict_write/0,dict_read/1,ets_write/0,ets_read/1]). dict_write()-> D = dict:new(), dict_write(D,10000). dict_write(D,0)->D; dict_write(D,N)->dict_write(dict:store(N,N,D),N-1). dict_read(D)-> [ dict:find(X,D) || X<-lists:seq(0,10000) ]. ets_write()-> E = ets:new(test,[set]), [ ets:insert(E,{X,X}) || X<-lists:seq(0,10000) ], E. ets_read(E)-> [ ets:lookup(E,X) || X<-lists:seq(0,10000) ]. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.erl Type: application/octet-stream Size: 424 bytes Desc: not available URL: From gene.tani@REDACTED Sun Aug 23 18:54:33 2009 From: gene.tani@REDACTED (Gene Tani) Date: Sun, 23 Aug 2009 09:54:33 -0700 (PDT) Subject: Google custom search engine In-Reply-To: References: Message-ID: <0340592d-5a46-417f-ace8-adcb592398dd@v20g2000yqm.googlegroups.com> On Aug 23, 9:13?am, Gene Tani wrote: > Somewhat apropos of the discussion on cleaning up the docs, copyright, > etc: I'm not able to find a current Google custom search engine for > the top erlang sites, so i pulled up the last couple months delicious > tags, Just to be clear about how this list is sorted, this is the summation of domains of URL's tagged "erlang", not a count of individual URL's tagged "erlang", I didn't filter out any blogs by their (natural, spoken) language, and I'll keep upping the list from 75 to top 90, top 110, see where it hits diminishing value From gene.tani@REDACTED Sun Aug 23 19:03:27 2009 From: gene.tani@REDACTED (Gene Tani) Date: Sun, 23 Aug 2009 10:03:27 -0700 (PDT) Subject: Misultin v0.1 released In-Reply-To: <3E696E88-AB1E-4BB2-B97B-FFB95A771757@gmail.com> References: <544758AC-B45D-4D0C-9BF4-7BABA0C091C7@widetag.com> <3E696E88-AB1E-4BB2-B97B-FFB95A771757@gmail.com> Message-ID: On Jul 29, 1:59?am, Dmitrii Dimandt wrote: > >> Out of interest, you should take a look at the Yaws/Mochiweb > >> comparison (link?). These are interesting because Yaws does in ? > >> general > >> 50-80% more for you than Mochiweb but yet compares very favorably on > >> the benchmarks. > > > if you are referring to joe's bench i'm pretty familiar with it :) > > There's also this one: > > http://www.joeandmotorboat.com/2009/01/03/nginx-vs-yaws-vs-mochiweb-w... update for 13A: http://www.slideshare.net/logicalstack/web-server-deathmatch-2009-erlang-factory-joe-williams and this, kind of short on backup detail: http://developer.studivz.net/2009/02/03/webserver-scalability-and-reliability/ From piriyatheepan@REDACTED Sun Aug 23 21:30:16 2009 From: piriyatheepan@REDACTED (Piriyatheepan Nadarajah) Date: Mon, 24 Aug 2009 01:00:16 +0530 Subject: global_name_server bug? Message-ID: Hi There, Our application is distributed accross many erlang nodes in different hosts. Recently I came accross a problem when sending messages to globally registered names from one of the nodes. When I hacked couple of things, I found that, it is due to an entry in the global_locks ETS table in the global_name_server. The entry is as follows: [{ResourceId, LockReqId, PidRefs}] = ets:lookup(global_locks, global). [{global,[<10104.12.0>,<8820.13.0>], [{<8820.13.0>,<8820.13.0>,#Ref<0.0.89.206234>}]}] AND [X,Y] = LockReqId. (stuck_node@REDACTED)117> node(X). node1@REDACTED (stuck_node@REDACTED)118> node(Y). node2@REDACTED The problem is, this entry does not get removed from the table and this creates a looping in the global_name_server for the messages that are trying to aquire global locks. Is it a bug? Thanks, Theepan. From discoloda@REDACTED Sun Aug 23 22:30:19 2009 From: discoloda@REDACTED (Vincent Adam Burns) Date: Sun, 23 Aug 2009 21:30:19 +0100 Subject: wxAuiPaneInfo impossible to use Message-ID: <3de26b2b0908231330i3e1498d8tcaba1109d872bb27@mail.gmail.com> I cannot find a way to port the Aui example from c++ to erlang because i cannot create this object. All the functions in wxAuiPaneInfo take a This parameter. -- --- You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away. From colm.dougan@REDACTED Mon Aug 24 01:16:33 2009 From: colm.dougan@REDACTED (Colm Dougan) Date: Mon, 24 Aug 2009 00:16:33 +0100 Subject: [erlang-questions] dict slower than ets? In-Reply-To: References: Message-ID: <24d4f39c0908231616p1d82342al1b4d75caeee319e@mail.gmail.com> I'm pretty sure it would be expected that dict would be slower than ets for this use-case. All the ets calls and data structures are implemented directly in C while the 'dict' modules uses pure erlang to emulate similar functionality. If your keys are integers you could also look at the 'array' module which uses element/setelement under the hood rather than hashing. Colm On Sun, Aug 23, 2009 at 5:18 PM, Wanglei wrote: > dict write x?10000 >> {T,D} = timer:tc(test,dict_read,[]). > {86177,... > dict read x 10000 >> timer:tc(test,dict_read,[D]). > {17260, > ----------------------------- > ets write x 10000 >>?{T,E}=timer:tc(test,ets_write,[]). > {18005,20493} > dict read x 10000 >> timer:tc(test,ets_read,[E]). > {15706, > > test.erl > ---------- 8< ------------------ > -module(test). > -export([dict_write/0,dict_read/1,ets_write/0,ets_read/1]). > dict_write()-> > D = dict:new(), > dict_write(D,10000). > dict_write(D,0)->D; > dict_write(D,N)->dict_write(dict:store(N,N,D),N-1). > dict_read(D)-> > [ dict:find(X,D) || X<-lists:seq(0,10000) ]. > ets_write()-> > E = ets:new(test,[set]), > [ ets:insert(E,{X,X}) || X<-lists:seq(0,10000) ], > E. > ets_read(E)-> > [ ets:lookup(E,X) || X<-lists:seq(0,10000) ]. > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ngocdaothanh@REDACTED Mon Aug 24 02:41:22 2009 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Mon, 24 Aug 2009 09:41:22 +0900 Subject: [erlang-questions] dict slower than ets? In-Reply-To: <24d4f39c0908231616p1d82342al1b4d75caeee319e@mail.gmail.com> References: <24d4f39c0908231616p1d82342al1b4d75caeee319e@mail.gmail.com> Message-ID: <5c493e530908231741y2ca5ab1eq82c73069febac74f@mail.gmail.com> FYI: http://d.hatena.ne.jp/cooldaemon/20080722/1216706154 On my laptop: benchmark:run(1000000). ---- set:210(302)ms get:190(283)ms ---- set:59430(62403)ms get:790(841)ms ---- set:1470(1566)ms get:940(984)ms ---- set:10340(11286)ms get:690(763)ms On Mon, Aug 24, 2009 at 8:16 AM, Colm Dougan wrote: > I'm pretty sure it would be expected that dict would be slower than > ets for this use-case. All the ets calls and data structures are > implemented directly in C while the 'dict' modules uses pure erlang to > emulate similar functionality. If your keys are integers you could > also look at the 'array' module which uses element/setelement under > the hood rather than hashing. > > Colm > > > On Sun, Aug 23, 2009 at 5:18 PM, Wanglei wrote: > > dict write x 10000 > >> {T,D} = timer:tc(test,dict_read,[]). > > {86177,... > > dict read x 10000 > >> timer:tc(test,dict_read,[D]). > > {17260, > > ----------------------------- > > ets write x 10000 > >> {T,E}=timer:tc(test,ets_write,[]). > > {18005,20493} > > dict read x 10000 > >> timer:tc(test,ets_read,[E]). > > {15706, > > > > test.erl > > ---------- 8< ------------------ > > -module(test). > > -export([dict_write/0,dict_read/1,ets_write/0,ets_read/1]). > > dict_write()-> > > D = dict:new(), > > dict_write(D,10000). > > dict_write(D,0)->D; > > dict_write(D,N)->dict_write(dict:store(N,N,D),N-1). > > dict_read(D)-> > > [ dict:find(X,D) || X<-lists:seq(0,10000) ]. > > ets_write()-> > > E = ets:new(test,[set]), > > [ ets:insert(E,{X,X}) || X<-lists:seq(0,10000) ], > > E. > > ets_read(E)-> > > [ ets:lookup(E,X) || X<-lists:seq(0,10000) ]. > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From dgud@REDACTED Mon Aug 24 08:16:28 2009 From: dgud@REDACTED (Dan Gudmundsson) Date: Mon, 24 Aug 2009 08:16:28 +0200 Subject: [erlang-questions] wxAuiPaneInfo impossible to use In-Reply-To: <3de26b2b0908231330i3e1498d8tcaba1109d872bb27@mail.gmail.com> References: <3de26b2b0908231330i3e1498d8tcaba1109d872bb27@mail.gmail.com> Message-ID: <4A92303C.8000900@erix.ericsson.se> We noticed or rather Olle did when he wrote an example to the wx-demo application, that have been corrected and will be in the next release. You can find the code in our daily snapshots or in svn at sourceforge (wxerlang.sf.net) /Dan Vincent Adam Burns wrote: > I cannot find a way to port the Aui example from c++ to erlang because > i cannot create this object. All the functions in wxAuiPaneInfo take a > This parameter. > From ulf.wiger@REDACTED Mon Aug 24 09:33:48 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 24 Aug 2009 09:33:48 +0200 Subject: [erlang-questions] dict slower than ets? In-Reply-To: References: Message-ID: <4A92425C.4040701@erlang-consulting.com> Wanglei wrote: > dict write x 10000 > > > {T,D} = timer:tc(test,dict_read,[]). > {86177,... > > dict read x 10000 > > timer:tc(test,dict_read,[D]). > {17260, >[...] Yes, for small objects, dict is slower than ets. For larger objects, the copying overhead of using ets will tip the scales in dict's favor* - at least for a non- shared dictionary. If you need concurrent access to the dictionary, you need to keep the dict in a separate process, which will incur the same copying cost as for ets. * While both solutions use constant-time algorithms, dict will also suffer from garbage collection overhead, which is roughly proportional to the size of the live data set. Ets tables are not garbage collected. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From kagato@REDACTED Mon Aug 24 10:03:18 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 24 Aug 2009 01:03:18 -0700 Subject: Opening "Special" Files Message-ID: <3A84B730-D785-46BF-9F8B-A08039DE206D@souja.net> Dear Erlang Questions, I really need to open a block device. I'll treat it just like a file, I swear. I'll open it. I'll read from it. I'll write to it. I'll close it when I'm done. I'll even cuddle if it wants to. Where's the harm in that? Unfortunately, there's a rather bureaucratic function called efile_may_openfile in erts/emulator/drivers/unix/unix_efile.c. It's on line 800. It insists that anything but a purely vanilla file just won't do. As in: > 808 if (!ISREG(statbuf)) { > 809 errno = EISDIR; > 810 return check_error(-1, errInfo); > 811 } Ignoring for the moment that synthesizing a system-level error that isn't really there is probably bad form, I would greatly enjoy a way to override this. I should really not have to write my own port driver just to do this. I don't want to have to figure out how to deal with the async IO pool in C. Is this on the roadmap? Can it be on the roadmap? Is there a good workaround? Also, can anyone even tell me why this is there? Is there some odd behavior on an embedded system? Is it a primitive attempt at a security feature? Are we really afraid of getting SIGPIPE? Thanks, -- Jayson Vantuyl kagato@REDACTED From dmercer@REDACTED Mon Aug 24 17:06:30 2009 From: dmercer@REDACTED (David Mercer) Date: Mon, 24 Aug 2009 10:06:30 -0500 Subject: Supervisor Death Kills Workers? Message-ID: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> As workers are linked to their supervisors, the behaviour of a supervisor, therefore, is to kill its workers if it itself dies. I had thought that it was the job - and about the only job - of the supervisor to restart workers when they stop, not to stop the workers if not working under supervision. To my thinking, this introduces a single point of failure where previously there wasn't: if the top-level supervisor terminates, then you've lost your entire system. Am I misunderstanding supervision trees and the supervisor behaviour, or is there a reason for introducing a single point of failure into what was a distributed fault-tolerant system? Thanks for your help in understanding this. I was wondering about this all weekend. Cheers, David From rapsey@REDACTED Mon Aug 24 17:16:41 2009 From: rapsey@REDACTED (Rapsey) Date: Mon, 24 Aug 2009 17:16:41 +0200 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> Message-ID: <97619b170908240816t3b7d12d1hdf78b50755b2d476@mail.gmail.com> Trusting the supervisor is like trusting the erlang runtime, gen_server and everything else. If you can't trust that to work, what's the point of using Erlang anyway? Sergej On Mon, Aug 24, 2009 at 5:06 PM, David Mercer wrote: > As workers are linked to their supervisors, the behaviour of a supervisor, > therefore, is to kill its workers if it itself dies. I had thought that it > was the job - and about the only job - of the supervisor to restart workers > when they stop, not to stop the workers if not working under supervision. > To my thinking, this introduces a single point of failure where previously > there wasn't: if the top-level supervisor terminates, then you've lost your > entire system. > > > > Am I misunderstanding supervision trees and the supervisor behaviour, or is > there a reason for introducing a single point of failure into what was a > distributed fault-tolerant system? > > > > Thanks for your help in understanding this. I was wondering about this all > weekend. > > > > Cheers, > > > > David > > From ulf.wiger@REDACTED Mon Aug 24 17:27:44 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 24 Aug 2009 17:27:44 +0200 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> Message-ID: <4A92B170.1090805@erlang-consulting.com> David Mercer wrote: > As workers are linked to their supervisors, the behaviour of a supervisor, > therefore, is to kill its workers if it itself dies. I had thought that it > was the job - and about the only job - of the supervisor to restart workers > when they stop, not to stop the workers if not working under supervision. > To my thinking, this introduces a single point of failure where previously > there wasn't: if the top-level supervisor terminates, then you've lost your > entire system. > > Am I misunderstanding supervision trees and the supervisor behaviour, or is > there a reason for introducing a single point of failure into what was a > distributed fault-tolerant system? There is a rule of thumb, sometimes cited by Joe Armstrong among others (although I think it was Martin Bj?rklund who may have first formulated it): There are processes that can be allowed to fail, and processes that cannot. You have to make your mind up. Supervisors are processes that must be assumed correct, much like the VM must be assumed correct. Thus, if a supervisor dies, it had better be because it was told to, either explicitly or because its parent died. You can view this as an invariant of sorts. It does have the nice property that terminating an OTP application can be done simply by telling the top supervisor to shut down. It will pass on the shutdown order to all its children, and if they do not respond, it will kill them without mercy. This is in part to ensure that it is indeed possible to terminate the system. Joe Armstrong writes about this in his thesis (ch 5): http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From baryluk@REDACTED Mon Aug 24 17:30:10 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 24 Aug 2009 17:30:10 +0200 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> Message-ID: <1251127810.5916.108.camel@sredniczarny> Dnia 2009-08-24, pon o godzinie 10:06 -0500, David Mercer pisze: > As workers are linked to their supervisors, the behaviour of a supervisor, > therefore, is to kill its workers if it itself dies. I had thought that it > was the job - and about the only job - of the supervisor to restart workers > when they stop, not to stop the workers if not working under supervision. > To my thinking, this introduces a single point of failure where previously > there wasn't: if the top-level supervisor terminates, then you've lost your > entire system. This is the reason why you should not do any hackerish work with supervisors. You will for sure introduce some bugs and bring eventually whole system down. Keep it simple, keep it working. As it is now, it is well tested and do the right job. Any input to the supervisor (like child specification) is first full tested before using it in any way. So we can trust that supervisor code is correct an can be trusted, to never crash due to the errors there. But if there is any reason it will crash (like dropped messages or memory exhausted) , the best want anyone can do is kill all supervisor tree under it, because previous assumption is wrong, and restart it from scratch (eventually terminating/restarting whole system after multiple restarts in small period of time). -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From dave.pawson@REDACTED Mon Aug 24 17:52:58 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 24 Aug 2009 16:52:58 +0100 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <4A92B170.1090805@erlang-consulting.com> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> <4A92B170.1090805@erlang-consulting.com> Message-ID: <711a73df0908240852j47e29265ib83bca90b8d542ee@mail.gmail.com> 2009/8/24 Ulf Wiger : > Joe Armstrong writes about this in his thesis (ch 5): > http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf My version of acrobat reader shows that as being 'in error' in some way? Anyone else read it? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dave.pawson@REDACTED Mon Aug 24 17:55:18 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Mon, 24 Aug 2009 16:55:18 +0100 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <711a73df0908240852j47e29265ib83bca90b8d542ee@mail.gmail.com> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> <4A92B170.1090805@erlang-consulting.com> <711a73df0908240852j47e29265ib83bca90b8d542ee@mail.gmail.com> Message-ID: <711a73df0908240855o78d367dane9c75f79e40ff6eb@mail.gmail.com> 2009/8/24 Dave Pawson : > 2009/8/24 Ulf Wiger : > >> Joe Armstrong writes about this in his thesis (ch 5): >> http://www.sics.se/~joe/thesis/armstrong_thesis_2003.pdf > > My version of acrobat reader shows that as being 'in error' in some way? > > Anyone else read it? Take that back Pawson! Wouldn't open in the browser. Download and it reads OK in acrobat reader 9.1.1 Sorry to waste bandwidth Regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From dmercer@REDACTED Mon Aug 24 19:09:29 2009 From: dmercer@REDACTED (David Mercer) Date: Mon, 24 Aug 2009 12:09:29 -0500 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <4d08db370908240827s4595be4cg2dfc3e05f43f57d9@mail.gmail.com> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> <4d08db370908240827s4595be4cg2dfc3e05f43f57d9@mail.gmail.com> Message-ID: <34EB031B4B3A41608BC207ECE4274135@SSI.CORP> Hynek Vychodil wrote: It is little bit uncommon have distributed supervisor tree but distributed application. In which case supervisor can fail? It is total failure of HW or Erlang runtime and such. I think it is best what you can do to give up whole HW node. Yes, that was one of scenarios I had in my head, which was a supervisor on a different node than its workers. If the supervisor's node fails (could be an OS or HW failure), then it would result in workers on other nodes also terminating, which seems unnecessary and suboptimal. When I thought about this over the weekend, my conclusion was that I would only use supervisors to supervise workers on the same node, so as to avoid this possibility. Do I take it from your comment that that is the intended use of supervisors - that they are not intended to supervise workers on other nodes? Thanks, David _____ From: hynek@REDACTED [mailto:hynek@REDACTED] On Behalf Of Hynek Vychodil Sent: Monday, August 24, 2009 10:27 AM To: David Mercer Cc: Erlang Subject: Re: [erlang-questions] Supervisor Death Kills Workers? It is little bit uncommon have distributed supervisor tree but distributed application. In which case supervisor can fail? It is total failure of HW or Erlang runtime and such. I think it is best what you can do to give up whole HW node. On Mon, Aug 24, 2009 at 5:06 PM, David Mercer wrote: As workers are linked to their supervisors, the behaviour of a supervisor, therefore, is to kill its workers if it itself dies. I had thought that it was the job - and about the only job - of the supervisor to restart workers when they stop, not to stop the workers if not working under supervision. To my thinking, this introduces a single point of failure where previously there wasn't: if the top-level supervisor terminates, then you've lost your entire system. Am I misunderstanding supervision trees and the supervisor behaviour, or is there a reason for introducing a single point of failure into what was a distributed fault-tolerant system? Thanks for your help in understanding this. I was wondering about this all weekend. Cheers, David -- --Hynek (Pichi) Vychodil Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero! Try Good Data now for free: www.gooddata.com From dmercer@REDACTED Mon Aug 24 19:17:21 2009 From: dmercer@REDACTED (David Mercer) Date: Mon, 24 Aug 2009 12:17:21 -0500 Subject: [erlang-questions] Supervisor Death Kills Workers? In-Reply-To: <1251127810.5916.108.camel@sredniczarny> References: <254EF34CB8FA4F26B1ACEFEA8A293745@SSI.CORP> <1251127810.5916.108.camel@sredniczarny> Message-ID: Witold Baryluk wrote: > But if there is any reason it will crash (like dropped messages or > memory exhausted) , the best want anyone can do is kill all supervisor > tree under it, because previous assumption is wrong, and restart it from > scratch (eventually terminating/restarting whole system after multiple > restarts in small period of time). My thought is that if the supervisor crashes, the best you can want is that the workers continue working until either (1) a stand-by supervisor takes over supervision duties, or (2) the original supervisor comes back up. When either (1) or (2) occurs, the supervisor checks to see if any worker terminated during the interregnum and restarts it, if necessary. I'm not saying my approach is right and the current supervisory model is all wrong. On the contrary, I think the decades of experience with Erlang has evolved the current supervisor behaviour, and I am trying to understand why. Hynek's comment earlier ("It is little bit uncommon have distributed supervisor tree") may give a clue as to why OTP's supervisor is the way it is: that common usage of supervisors only uses them to supervise same-node workers, so it has been adequate and workable to make certain assumptions about the resilience of supervisors. Am I on the right track? Thanks, David > -----Original Message----- > From: Witold Baryluk [mailto:baryluk@REDACTED] > Sent: Monday, August 24, 2009 10:30 AM > To: David Mercer > Cc: 'Erlang' > Subject: Re: [erlang-questions] Supervisor Death Kills Workers? > > Dnia 2009-08-24, pon o godzinie 10:06 -0500, David Mercer pisze: > > As workers are linked to their supervisors, the behaviour of a > supervisor, > > therefore, is to kill its workers if it itself dies. I had thought that > it > > was the job - and about the only job - of the supervisor to restart > workers > > when they stop, not to stop the workers if not working under > supervision. > > To my thinking, this introduces a single point of failure where > previously > > there wasn't: if the top-level supervisor terminates, then you've lost > your > > entire system. > > This is the reason why you should not do any hackerish work with > supervisors. You will for sure introduce some bugs and bring eventually > whole system down. > > Keep it simple, keep it working. > > As it is now, it is well tested and do the right job. Any input to the > supervisor (like child specification) is first full tested before using > it in any way. > So we can trust that supervisor code is correct an can be trusted, to > never crash due to the errors there. > > But if there is any reason it will crash (like dropped messages or > memory exhausted) , the best want anyone can do is kill all supervisor > tree under it, because previous assumption is wrong, and restart it from > scratch (eventually terminating/restarting whole system after multiple > restarts in small period of time). > > > > -- > Witold Baryluk From vincent.dephily@REDACTED Mon Aug 24 19:44:51 2009 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Mon, 24 Aug 2009 19:44:51 +0200 Subject: Max open files and erlang memory Message-ID: <200908241944.51933.vincent.dephily@mobile-devices.fr> Hi list, I've got some enormous system memory usage whenever I run erlang (32bit linux system) : > $ erl > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] > [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> erlang:memory(). > [{total,302822080}, > {processes,489036}, > {processes_used,483292}, > {system,302333044}, > {atom,255645}, > {atom_used,254795}, > {binary,306280}, > {code,1775473}, > {ets,104668}] That's close to 300MB for a bare shell. Too much, if you ask me :p I've traced it back to the maximum number of open files allowed by the system. I use a big number here, to allow that many tcp connections to my server. If I reduce this limit, erlang memory usage returns to manageable levels: > $ for i in 999999 900000 800000 700000 600000 500000 400000 300000 200000 > 100000 50000 10000 5000 1000 500 100 50; do ulimit -n $i; echo -n $i; > erl -noinput -eval 'io:format(" ~p~n", [erlang:memory(system)])' -s erlang > halt; done > 999999 301852400 > 900000 296652448 > 800000 291452448 > 700000 286252464 > 600000 281052464 > 500000 152120480 > 400000 146920480 > 300000 141720496 > 200000 74654496 > 100000 38521504 > 50000 20455024 > 10000 6775136 > 5000 4581840 > 1000 2682176 > 500 2656176 > 100 2634088 > 50 2629488 I understand that opening more files uses more memory, but I haven't opened anything yet. I shouldn't be paying the price for a system limit I haven't reached yet. Also, note that the memory usage in the above example is not linear : there are jumps in the graph. I am not 100% sure, but I think this is a regression : I tested my software with a big max-open-file limit before and hadn't noticed the memory usage. For the immediate future, I'll size the system limit more conservatively. But I'm interested in a fix or workaround on the erlang side. Thanks. -- Vincent de Phily Mobile Devices +33 (0) 666 301 306 +33 (0) 142 119 325 Warning This message (and any associated files) is intended only for the use of its intended recipient and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author vincent.dephily@REDACTED and do not necessarily represent those of the company. Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. From per@REDACTED Mon Aug 24 23:09:25 2009 From: per@REDACTED (Per Hedeland) Date: Mon, 24 Aug 2009 23:09:25 +0200 (CEST) Subject: [erlang-questions] Max open files and erlang memory In-Reply-To: <200908241944.51933.vincent.dephily@mobile-devices.fr> Message-ID: <200908242109.n7OL9PO2045426@pluto.hedeland.org> Vincent de Phily wrote: > >I understand that opening more files uses more memory, but I haven't opened >anything yet. I shouldn't be paying the price for a system limit I haven't >reached yet. >Also, note that the memory usage in the above example is not linear : there >are jumps in the graph. > >I am not 100% sure, but I think this is a regression : I tested my software >with a big max-open-file limit before and hadn't noticed the memory usage. The runtime creates an array of port structures (100+ bytes IIRC) sized as the next power of two at or above your "max-open-files" (a.k.a. sysconf(_SC_OPEN_MAX)) - this has been true since at least R10, probably much earlier. I.e. the following from erlang(3) is only correct regarding the default if you have a "max-open-files" of 1024 (or less) - which happens to be the default on Linux I believe. The maximum number of ports that can be open at the same time is 1024 by default, but can be configured by the environment variable ERL_MAX_PORTS. The ERL_MAX_PORTS part *is* correct though - and you can use this to *reduce* the size of that port array. Oh, there is actually an upper limit - 2^28 as far as I can see. And 1024 is the *lower* limit. See init_io() in erts/emulator/beam/io.c. --Per Hedeland From rvirding@REDACTED Tue Aug 25 01:08:21 2009 From: rvirding@REDACTED (Robert Virding) Date: Tue, 25 Aug 2009 01:08:21 +0200 Subject: Y combinator in C# Message-ID: <3dbc6d1c0908241608m27ddbcbas69ccc38cc66d4f56@mail.gmail.com> I got this reference from Hacker news. Those who think that Erlangs fun syntax isn't the best and most concise should look at this blog where they define the Y combinator in C#: http://blogs.msdn.com/madst/archive/2007/05/11/recursive-lambda-expressions.aspx Robert From vladdu55@REDACTED Tue Aug 25 11:42:07 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Aug 2009 11:42:07 +0200 Subject: pasting input in werl.exe shell Message-ID: <95be1d3b0908250242p4f8e2339j534f6d5b92a53e8e@mail.gmail.com> Hi, When pasting some input in the werl.exe shell and if that input has tab characters at the beginning of the lines, the shell will handle those tabs as requests for completion and will print the list of modules. Seen in R13B01. Not a severe problem, but annoying. regards, Vlad From vincent.dephily@REDACTED Tue Aug 25 13:57:54 2009 From: vincent.dephily@REDACTED (Vincent de Phily) Date: Tue, 25 Aug 2009 13:57:54 +0200 Subject: [erlang-questions] Max open files and erlang memory In-Reply-To: <200908242109.n7OL9PO2045426@pluto.hedeland.org> References: <200908242109.n7OL9PO2045426@pluto.hedeland.org> Message-ID: <200908251357.55316.vincent.dephily@mobile-devices.fr> On Monday 24 August 2009 23:09:25 Per Hedeland wrote: > The runtime creates an array of port structures (100+ bytes IIRC) sized > as the next power of two at or above your "max-open-files" (a.k.a. > sysconf(_SC_OPEN_MAX)) - this has been true since at least R10, probably > much earlier. I.e. the following from erlang(3) is only correct > regarding the default if you have a "max-open-files" of 1024 (or less) - > which happens to be the default on Linux I believe. > > The maximum number of ports that can be open at the same time > is 1024 by default, but can be configured by the environment > variable ERL_MAX_PORTS. > > The ERL_MAX_PORTS part *is* correct though - and you can use this to > *reduce* the size of that port array. Oh, there is actually an upper > limit - 2^28 as far as I can see. And 1024 is the *lower* limit. See > init_io() in erts/emulator/beam/io.c. Thanks a lot for the pointers. I'll use ERL_MAX_PORTS to tweak memory usage on a per-instance basis. I still wish the memory wasn't allocated untill needed, but I won't try to argue against beam developpers regarding performance-related design decisions :) -- Vincent de Phily Mobile Devices +33 (0) 666 301 306 +33 (0) 142 119 325 Warning This message (and any associated files) is intended only for the use of its intended recipient and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author vincent.dephily@REDACTED and do not necessarily represent those of the company. Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments. From clist@REDACTED Tue Aug 25 15:11:03 2009 From: clist@REDACTED (Angel Alvarez) Date: Tue, 25 Aug 2009 15:11:03 +0200 Subject: bignum sqrt broken in erlang? Message-ID: <200908251511.03931.clist@uah.es> Hi let ab=N let M=(a+1)(b+1); M=ab+a+b+1 that is N +a +b +1 so M > N Ok but in erlang... Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.2 (abort with ^G) 1> N=71641520761751435455133616475667090434063332228247871795429. 71641520761751435455133616475667090434063332228247871795429 2> R0=trunc(math:sqrt(N)). 267659337146589062070609641472 3> R1=R0+1. 267659337146589062070609641473 4> M=R1*R1. 71641520761751431352030800763682813030352458120945601609729 5> M -N > 0. false where is the problem? That's erlang or the gmp library? /Angel -- Agua para todo? No, Agua para Todos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- DSpace me recuerda a Ice Age, el bichito que se apega a su casta?a y trata de llevarla a todos lados. From mikpe@REDACTED Tue Aug 25 15:35:49 2009 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 25 Aug 2009 15:35:49 +0200 Subject: [erlang-questions] bignum sqrt broken in erlang? In-Reply-To: <200908251511.03931.clist@uah.es> References: <200908251511.03931.clist@uah.es> Message-ID: <19091.59573.782418.700089@pilspetsen.it.uu.se> On Tue, 25 Aug 2009 15:11:03 +0200, Angel Alvarez wrote: > let ab=N > let M=(a+1)(b+1); > > M=ab+a+b+1 that is N +a +b +1 so M > N > > Ok but in erlang... > > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> N=71641520761751435455133616475667090434063332228247871795429. > 71641520761751435455133616475667090434063332228247871795429 > > 2> R0=trunc(math:sqrt(N)). > 267659337146589062070609641472 > > 3> R1=R0+1. > 267659337146589062070609641473 > > 4> M=R1*R1. > 71641520761751431352030800763682813030352458120945601609729 > > 5> M -N > 0. > false > > where is the problem? That's erlang or the gmp library? Not gmp because the Erlang runtime does all bignum arithmetic on its own. I suspect that math:sqrt/1 causes a conversion from bignum to flonum, which loses precision. From trevorw@REDACTED Tue Aug 25 15:39:53 2009 From: trevorw@REDACTED (Trevor Woollacott) Date: Tue, 25 Aug 2009 15:39:53 +0200 Subject: [erlang-questions] bignum sqrt broken in erlang? References: <200908251511.03931.clist@uah.es> Message-ID: <005001ca2589$8aa9ede0$706bd90a@mtn.co.za> Hi Erlang does not support arbitrary-precision arithmetic for square root, and instead it uses the normal C maths library to perform sqrt. So your math:sqrt(N) is not correct. Regards, Trevor ----- Original Message ----- From: "Angel Alvarez" To: Sent: Tuesday, August 25, 2009 3:11 PM Subject: [erlang-questions] bignum sqrt broken in erlang? > Hi > > let ab=N > let M=(a+1)(b+1); > > M=ab+a+b+1 that is N +a +b +1 so M > N > > Ok but in erlang... > > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] > [kernel-poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> N=71641520761751435455133616475667090434063332228247871795429. > 71641520761751435455133616475667090434063332228247871795429 > > 2> R0=trunc(math:sqrt(N)). > 267659337146589062070609641472 > > 3> R1=R0+1. > 267659337146589062070609641473 > > 4> M=R1*R1. > 71641520761751431352030800763682813030352458120945601609729 > > 5> M -N > 0. > false > > where is the problem? That's erlang or the gmp library? > > /Angel > > > > > > > > -- > Agua para todo? No, Agua para Todos. > ->>----------------------------------------------- > Clist UAH a.k.a Angel > ---------------------------------[www.uah.es]-<<-- > > DSpace me recuerda a Ice Age, el bichito que se apega a su casta?a y trata > de llevarla a todos lados. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From vladdu55@REDACTED Tue Aug 25 15:39:52 2009 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 25 Aug 2009 15:39:52 +0200 Subject: [erlang-questions] bignum sqrt broken in erlang? In-Reply-To: <200908251511.03931.clist@uah.es> References: <200908251511.03931.clist@uah.es> Message-ID: <95be1d3b0908250639t3f4c3fffqc41cfb755eebe4ce@mail.gmail.com> > 1> N=71641520761751435455133616475667090434063332228247871795429. > 71641520761751435455133616475667090434063332228247871795429 > > 2> R0=trunc(math:sqrt(N)). > 267659337146589062070609641472 Hi, math:sqrt() works with floats, and does some truncation. 2>R0*R0. 71641520761751431352030800763147494356059279996804382326784 which is not N. regards, Vlad From ulf.wiger@REDACTED Tue Aug 25 18:27:03 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 25 Aug 2009 18:27:03 +0200 Subject: [erlang-questions] Re: This file system path thing is getting me down... In-Reply-To: <640c39c9-e488-465b-acea-5f014b837648@g31g2000yqc.googlegroups.com> References: <20090815150218.GJ286@ziti.local> <640c39c9-e488-465b-acea-5f014b837648@g31g2000yqc.googlegroups.com> Message-ID: <4A9410D7.5000308@erlang-consulting.com> Steve Davis wrote: > > My current thinking is perhaps to abstract the entire file system as a > data source and query it like a database (maybe using qlc) and only > ever return absolute names. > > /sd FWIW, when I experimented with user-defined tables in the 'rdbms' contrib, one of the table types I played with was a file system. http://jungerl.cvs.sourceforge.net/viewvc/jungerl/jungerl/lib/rdbms/src/rdbms_rofs.erl?revision=1.1&view=markup The technique for adding user-defined tables was more or less copied in the Dukes of Erl project mnesiaex http://code.google.com/p/mnesiaex/ That is not to say that the two are compatible (I haven't looked into it). I never got around to documenting it, or even writing any test code for it, but basically, you would create a table (ordered_set) using [{external_copies, [{rdbms_rofs, Nodes}]}, {rofs_mount, MountPoint}|Attrs] Basically, the record could contain the following attributes: ValidAttrs = [path,name,data|record_info(fields, file_info)], where path was mandatory and held the full path name. The 'data' attribute would hold the contents of the file, if included among the record attributes. The idea was indeed to be able to query the file system using e.g. QLC, and do other fun databasey stuff. I only dared make it read-only, though. :) From my limited testing, it seemed to work, but the code hasn't been maintained, and rdbms is likely to break with anything other than mnesia-4.5. BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From cliff@REDACTED Tue Aug 25 20:03:24 2009 From: cliff@REDACTED (Cliff Moon) Date: Tue, 25 Aug 2009 11:03:24 -0700 Subject: process leak in http client? Message-ID: <4A94276C.20807@moonpolysoft.com> It looks like there's a process leak somewhere in Erlang's standard http client. I have a scraping system which goes against a third party website. Usually the scrapes work just fine, however every once in a while it bumps up against some rate limiting mechanism on the remote server and the server abruptly hangs up the tcp connection. After a while the process list is filled up with procs that look like this: <0.27047.5> erlang:apply/2 987 1898 0 http:handle_answer/3 9 <0.27094.3> erlang:apply/2 987 1911 0 http:handle_answer/3 9 <0.27114.3> erlang:apply/2 987 1911 0 http:handle_answer/3 9 <0.27121.5> erlang:apply/2 987 1911 0 http:handle_answer/3 9 <0.27137.3> erlang:apply/2 987 1898 0 http:handle_answer/3 9 <0.27153.1> erlang:apply/2 987 1911 0 http:handle_answer/3 9 <0.27159.3> erlang:apply/2 987 1890 0 http:handle_answer/3 9 <0.27202.5> erlang:apply/2 987 1911 0 http:handle_answer/3 9 <0.27223.1> erlang:apply/2 987 1897 0 http:handle_answer/3 9 Has anyone seen this behavior before? Is it due to the occasional hangups that happen from the server? From ok@REDACTED Wed Aug 26 00:15:45 2009 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 26 Aug 2009 10:15:45 +1200 Subject: [erlang-questions] bignum sqrt broken in erlang? In-Reply-To: <200908251511.03931.clist@uah.es> References: <200908251511.03931.clist@uah.es> Message-ID: On Aug 26, 2009, at 1:11 AM, Angel Alvarez wrote: > 2> R0=trunc(math:sqrt(N)). > 267659337146589062070609641472 Right there is your problem. math:sqrt/1 is a FLOATING-POINT square root. The argument is first rounded to floating point, then its square root taken, and then you truncate that. As far as I know, Erlang doesn't have a built-in integer square root function, but it's straightforward enough to write one. From clist@REDACTED Wed Aug 26 00:39:40 2009 From: clist@REDACTED (Angel Alvarez) Date: Wed, 26 Aug 2009 00:39:40 +0200 Subject: [erlang-questions] bignum sqrt broken in erlang? In-Reply-To: References: <200908251511.03931.clist@uah.es> Message-ID: <200908260039.41309.clist@uah.es> Thanks Ive written a minimal port program to do full bignums square roots from the complex port example from erlang docs. Surely its a lot slower than a bif but, better than nothing... for the record the c program does: #include #include #include #include "gmp.h" int main (int argc, char *argv[]) { char buf[500]; int len; mpz_t sq_me, sq_out, test; mpz_init(sq_me); mpz_init(sq_out); while (fgets(buf, 498, stdin) != NULL) { mpz_set_str(sq_me, buf, 10); mpz_sqrt(sq_out, sq_me); gmp_printf ("%Zd\n", sq_out); fflush(stdout); } return 0; } Regards, Angel El Mi?rcoles, 26 de Agosto de 2009 Richard O'Keefe escribi?: > > On Aug 26, 2009, at 1:11 AM, Angel Alvarez wrote: > > 2> R0=trunc(math:sqrt(N)). > > 267659337146589062070609641472 > > Right there is your problem. > math:sqrt/1 is a FLOATING-POINT square root. > The argument is first rounded to floating point, > then its square root taken, and then you truncate that. > > As far as I know, Erlang doesn't have a built-in > integer square root function, but it's straightforward > enough to write one. > > -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. ->>----------------------------------------------- Clist UAH a.k.a Angel ---------------------------------[www.uah.es]-<<-- Sex is a battle, love is war. From kagato@REDACTED Wed Aug 26 01:33:37 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 25 Aug 2009 16:33:37 -0700 Subject: [erlang-questions] Max open files and erlang memory In-Reply-To: <200908251357.55316.vincent.dephily@mobile-devices.fr> References: <200908242109.n7OL9PO2045426@pluto.hedeland.org> <200908251357.55316.vincent.dephily@mobile-devices.fr> Message-ID: I'm unclear on the design decisions that went into this, but having done some embedded work myself, these structures are almost always preallocated. The prevailing wisdom is that embedded systems must be able to make acceptable progress in the face of memory exhaustion. Since Erlang is designed to be highly fault-tolerant, I would imagine that this is the primary reason that the port-table (and, indeed, the atom table as well) are pre-allocated. In the embedded systems world, how something fails is often more important than how it succeeds. As an example of the behavior to be avoided, look no further than loading code. If the code-server can't load a file due to memory exhaustion, it may be unable to upgrade the system to fix the bug causing the memory exhaustion. Basically, no new code can be loaded, no configuration files read, etc. All because we don't have the memory to allocate "on-demand". This causes memory exhaustion to cause cascading failures in any system that didn't set aside some memory. This is exceptionally bad, because (under Erlang) it's quite likely that whatever is consuming memory will get killed and the memory pressure will go away. If we wedge the system in the meantime, that's just no good. From a failure perspective, this may increase the frequency of failures by creating artificial exhaustion of a resource (namely ports); but this is worthwhile because it makes those failures less severe (and more deterministic) by decoupling memory exhaustion failures from port allocation failures. Designing away "cascading failures" such as this creates a big design win--especially when you may end up building an embedded system where memory exhaustion must be tolerable (and is more often transient). On Aug 25, 2009, at 4:57 AM, Vincent de Phily wrote: > On Monday 24 August 2009 23:09:25 Per Hedeland wrote: >> The runtime creates an array of port structures (100+ bytes IIRC) >> sized >> as the next power of two at or above your "max-open-files" (a.k.a. >> sysconf(_SC_OPEN_MAX)) - this has been true since at least R10, >> probably >> much earlier. I.e. the following from erlang(3) is only correct >> regarding the default if you have a "max-open-files" of 1024 (or >> less) - >> which happens to be the default on Linux I believe. >> >> The maximum number of ports that can be open at the same time >> is 1024 by default, but can be configured by the environment >> variable ERL_MAX_PORTS. >> >> The ERL_MAX_PORTS part *is* correct though - and you can use this to >> *reduce* the size of that port array. Oh, there is actually an upper >> limit - 2^28 as far as I can see. And 1024 is the *lower* limit. See >> init_io() in erts/emulator/beam/io.c. > > Thanks a lot for the pointers. I'll use ERL_MAX_PORTS to tweak > memory usage on > a per-instance basis. > > I still wish the memory wasn't allocated untill needed, but I won't > try to > argue against beam developpers regarding performance-related design > decisions :) > > > -- > Vincent de Phily > Mobile Devices > +33 (0) 666 301 306 > +33 (0) 142 119 325 > > Warning > This message (and any associated files) is intended only for the use > of its > intended recipient and may contain information that is confidential, > subject > to copyright or constitutes a trade secret. If you are not the > intended > recipient you are hereby notified that any dissemination, copying or > distribution of this message, or files associated with this message, > is > strictly prohibited. If you have received this message in error, > please > notify us immediately by replying to the message and deleting it > from your > computer. Any views or opinions presented are solely those of the > author > vincent.dephily@REDACTED and do not necessarily represent > those of > the > company. Although the company has taken reasonable precautions to > ensure no > viruses are present in this email, the company cannot accept > responsibility > for any loss or damage arising from the use of this email or > attachments. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From bflatmaj7th@REDACTED Wed Aug 26 02:17:46 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Wed, 26 Aug 2009 10:17:46 +1000 Subject: Controlled interaction of two erlang distributed networks Message-ID: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> I have a distributed system that needs to run on two geographically isolated sites. Each site has a central manager node. I want a way to have the manager nodes from each site use erlang monitoring of each other and some specific processes only on the manager nodes; but I want to avoid node lists and global registrations expanding such that the nodes on different sites try and become connected together. How can I achieve this? -- Rich From carnildo@REDACTED Wed Aug 26 03:22:54 2009 From: carnildo@REDACTED (Mark Wagner) Date: Tue, 25 Aug 2009 18:22:54 -0700 Subject: [erlang-questions] Opening "Special" Files In-Reply-To: <3A84B730-D785-46BF-9F8B-A08039DE206D@souja.net> References: <3A84B730-D785-46BF-9F8B-A08039DE206D@souja.net> Message-ID: <31073ef90908251822k2b459cf7o5f726f38ca6d8b7a@mail.gmail.com> On Mon, Aug 24, 2009 at 01:03, Jayson Vantuyl wrote: > Dear Erlang Questions, > > I really need to open a block device. ?I'll treat it just like a file, I > swear. ?I'll open it. ?I'll read from it. ?I'll write to it. ?I'll close it > when I'm done. ?I'll even cuddle if it wants to. ?Where's the harm in that? > > Unfortunately, there's a rather bureaucratic function called > efile_may_openfile in erts/emulator/drivers/unix/unix_efile.c. ?It's on line > 800. ?It insists that anything but a purely vanilla file just won't do. > ... > Also, can anyone even tell me why this is there? ?Is there some odd behavior > on an embedded system? ?Is it a primitive attempt at a security feature? > ?Are we really afraid of getting SIGPIPE? My understanding based on discussions on the mailing list is that this is an effort to avoid blocking I/O: a OS-level block on read or write would result in all Erlang-level threads managed by the current process being suspended until the I/O completes or times out. -- Mark Wagner From kagato@REDACTED Wed Aug 26 03:28:45 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 25 Aug 2009 18:28:45 -0700 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> Message-ID: <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> You could use global_group to split each site into its own group and then make a node list of just the managers (which you already said you don't want to do). I think what you want is to roll you're own gossiped mesh like this. Once you "introduce" a node to any other node in the mesh, it all just syncs up eventually. This is a bit of work, but it really pays off. Version 1: Create an Mnesia table that holds tuples of the form {manager_node,Name,Clock,IpAddr}. Name is an atom that identifies a node (used to detect when they switch IP), and it needs to be unique per node. IpAddr is exactly what it looks like. Clock is a value that only increases and is used to detect old entries. This table should start out empty, although it should persist between restarts. Create a process that periodically gets the current IpAddress of the node and updates the local table with it. It should bump up the clock each time it changes the record. One way to do this is to start it out and zero and increment. Another is to just use the current machine timestamp. I'd recommend incrementing, as time-sync problems are a pain to track down. Create another process that periodically contacts all of the nodes and distributes the table over some well known port, probably using UDP. You don't have to reliably deliver it. If you're pedantic about security, you might use TCP + SSL. Formatting this request is not hard. Just use term_to_binary and binary_to_term. Create another process that listens on some well known port for the updates, and updates node entries. It should overwrite an entry with the same Name, but only if the Clock is higher. Now just create a utility that will "introduce" two nodes by putting an entry for the other Node in its table. For this version, just start with 0. After a little gossiping, they should know about each other. The persistence of the table should allow changes of IP address to be easily tolerated. Version 2: The previous version has a few problems. Most importantly, if you're using term_to_binary, it's possible for people to leak atoms. Also, you probably didn't encrypt it or put any sort of secret-key encryption. Add this to make it secure. Also, if you are starting with 0 on an "introduction", now is the time to enhance that. If you lose the node and want to deploy a new one, you can't just introduce it with 0, as the clock will already be higher. Extend the "introduction" to ask the remote end for the clock value it last saw for Name. This allows you to avoid that particular pitfall. Similarly, if you need to remove a node, use a special atom 'dead' in the place of IpAddr. You might add this to the utility as well. This should only be needed when a Name is permanently gone, and it mostly exists to prevent gossips to an address that will never need them and to prevent the node from being gossiped back into existence after you delete its entry. Version 3: Now add functionality to gossip the processes you want to monitor. NOTE: Just because a process isn't communicating, doesn't mean its not there. Be very careful with what you are trying to do (assuming you're doing automated failover, not just alerting). It's been well established for decades that a system can only sport two out of the three big qualities: "highly available", "tolerant of network partitions", and "data is consistent". If you think you've made something that does it, some very nasty mathematics will eventually bite you in the rear. You might ask why I wouldn't just monkey with Distributed Erlang to separate the globals into groups (see the global_group module). The problem is that Distributed Erlang still just isn't built for this sort of use-case. In Distributed Erlang getting the SSL stuff working right is hard, firewalls suck, NAT sucks even more, and the proper DNS setup is more trouble than maintaining a node-list ever was (and impossible to quickly fix, if you use high enough TTLs). On Aug 25, 2009, at 5:17 PM, Richard Andrews wrote: > I have a distributed system that needs to run on two geographically > isolated sites. Each site has a central manager node. > > I want a way to have the manager nodes from each site use erlang > monitoring of each other and some specific processes only on the > manager nodes; but I want to avoid node lists and global registrations > expanding such that the nodes on different sites try and become > connected together. > > How can I achieve this? > > -- > Rich > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From kagato@REDACTED Wed Aug 26 03:30:22 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 25 Aug 2009 18:30:22 -0700 Subject: [erlang-questions] Opening "Special" Files In-Reply-To: <31073ef90908251822k2b459cf7o5f726f38ca6d8b7a@mail.gmail.com> References: <3A84B730-D785-46BF-9F8B-A08039DE206D@souja.net> <31073ef90908251822k2b459cf7o5f726f38ca6d8b7a@mail.gmail.com> Message-ID: <9060D277-CC5F-426B-9073-3423BEE54761@souja.net> Isn't this prevented by the asynchronous I/O threading stuff (erl +A NNN)? I'm unsure why a block device would be that different than a file in that case. Both create a potentially random seek and both mitigate this with cache. On Aug 25, 2009, at 6:22 PM, Mark Wagner wrote: > My understanding based on discussions on the mailing list is that this > is an effort to avoid blocking I/O: a OS-level block on read or write > would result in all Erlang-level threads managed by the current > process being suspended until the I/O completes or times out. -- Jayson Vantuyl kagato@REDACTED From kruegger@REDACTED Wed Aug 26 03:43:22 2009 From: kruegger@REDACTED (Stephen Han) Date: Tue, 25 Aug 2009 18:43:22 -0700 Subject: R12B erlang node restart after system clock change Message-ID: <86f1f5350908251843jf7d768fwed81c75c23bdd951@mail.gmail.com> Hi I am facing an issue where erlang node is restarted by "heart" whenever I change the system clock forward. It seems beam got KILL signal and the "heart" restarting the node. The node got restarted even I move forward the system clock for 1 minute. FYI, I am using OTP R12B-3. The problem is I am not even sure whether the node got restarted by our application or Erlang/OTP. However, this is also not reproducible in our old software which used to use R10B-8. Is there any changes have been made to post R10B where Erlang node should restart if the system clock move forward? Can you suggest any good method to debugging this kind of problem? regards, From bflatmaj7th@REDACTED Wed Aug 26 05:20:10 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Wed, 26 Aug 2009 13:20:10 +1000 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> Message-ID: <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> On Wed, Aug 26, 2009 at 11:28 AM, Jayson Vantuyl wrote: > You might ask why I wouldn't just monkey with Distributed Erlang to separate > the globals into groups (see the global_group module). ?The problem is that > Distributed Erlang still just isn't built for this sort of use-case. ?In > Distributed Erlang getting the SSL stuff working right is hard, firewalls > suck, NAT sucks even more, and the proper DNS setup is more trouble than > maintaining a node-list ever was (and impossible to quickly fix, if you use > high enough TTLs). Security, NAT, etc. is a non-issue as any non-LAN traffic travels via IPSec between sites. Do you think this modifies your suggestions? From kagato@REDACTED Wed Aug 26 05:50:14 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 25 Aug 2009 20:50:14 -0700 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> Message-ID: <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> Actually, IPsec was mostly what I was worried about. That said, DNS is what will bite you. If you're cool with that, then you can try using global_group. On Aug 25, 2009, at 8:20 PM, Richard Andrews wrote: > On Wed, Aug 26, 2009 at 11:28 AM, Jayson Vantuyl > wrote: >> You might ask why I wouldn't just monkey with Distributed Erlang to >> separate >> the globals into groups (see the global_group module). The problem >> is that >> Distributed Erlang still just isn't built for this sort of use- >> case. In >> Distributed Erlang getting the SSL stuff working right is hard, >> firewalls >> suck, NAT sucks even more, and the proper DNS setup is more trouble >> than >> maintaining a node-list ever was (and impossible to quickly fix, if >> you use >> high enough TTLs). > > Security, NAT, etc. is a non-issue as any non-LAN traffic travels via > IPSec between sites. Do you think this modifies your suggestions? > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Jayson Vantuyl kagato@REDACTED From vik@REDACTED Wed Aug 26 07:19:56 2009 From: vik@REDACTED (Vik Olliver) Date: Wed, 26 Aug 2009 17:19:56 +1200 Subject: Problems with ibrowse 1.5.2 - send_req not causing stream_to Message-ID: <4A94C5FC.5010706@catalyst.net.nz> Hi folks. Stillhaving trouble with ibrowse. I'm calling: ibrowse:send_req(Url, [], get, [], [{stream_to, self()},{max_pipeline_size,1}]) to fetch 16 URLs in parallel. Now I have not changed the default sessions, so presumably it sits at 10. When the 5th URL GET is issued, no error is generated (I know this because I get {ibrowse_req_id, Ref} back) but no end_deliver/3 or end_deliver/4 is returned to self(). The same happens to the next 5 GETs. Curiously, the apache server on the other end of the GET request actually receives the 5th GET, and responds OK. The apache server is configured with 5 sessions. The apache server has been deliberately slowed down so that there is a 2 sec delay before the response is issued. Consequently, none of the other GETs return an end_deliver - the first actual OK is not seen by ERMS until after 16 URL GETs have gone out. Yes, we are deliberately overloading the apache server - to see what ibrowse does. Is there some error hook or similar that I should be catching to indicate a terminated ReqID, or should I be expecting {error, reason} from send_req/5? At the moment I get neither. Vik :v) From david@REDACTED Wed Aug 26 08:31:36 2009 From: david@REDACTED (David Brown) Date: Wed, 26 Aug 2009 01:31:36 -0500 Subject: EPMD responds with no data Message-ID: I'm trying to communicate with EPMD in C#. So far, I have a socket connected to EPMD and I've sent a "NAMES" request. However, my call to Socket.Receive(byte[]) returns without copying data to the byte array. I know there should be data, because calling net_adm:names() lists nodes. My data consists of a 2 byte length header with a value of 1 encoded in big endian format. The next byte has a value of 110. I'm fairly certain that the data is actually getting to EPMD, because if I don't build the header correctly (for example, by not using the correct endianness for the length), EPMD doesn't respond at all and Socket.Receive(byte[]) never returns. What could cause EPMD to respond with no data? From kagato@REDACTED Wed Aug 26 08:34:37 2009 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 25 Aug 2009 23:34:37 -0700 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> Message-ID: One more note. You may also need to use the option "-connect_all false". It keeps from having the nodes automatically connect to all of the nodes that a partner is connected to. I always forget about that one. On Aug 25, 2009, at 8:20 PM, Richard Andrews wrote: > On Wed, Aug 26, 2009 at 11:28 AM, Jayson Vantuyl > wrote: >> You might ask why I wouldn't just monkey with Distributed Erlang to >> separate >> the globals into groups (see the global_group module). The problem >> is that >> Distributed Erlang still just isn't built for this sort of use- >> case. In >> Distributed Erlang getting the SSL stuff working right is hard, >> firewalls >> suck, NAT sucks even more, and the proper DNS setup is more trouble >> than >> maintaining a node-list ever was (and impossible to quickly fix, if >> you use >> high enough TTLs). > > Security, NAT, etc. is a non-issue as any non-LAN traffic travels via > IPSec between sites. Do you think this modifies your suggestions? -- Jayson Vantuyl kagato@REDACTED From bflatmaj7th@REDACTED Wed Aug 26 09:28:38 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Wed, 26 Aug 2009 17:28:38 +1000 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> Message-ID: <7702c0610908260028w8ea355au447cf6c5a0bdfecc@mail.gmail.com> On Wed, Aug 26, 2009 at 4:34 PM, Jayson Vantuyl wrote: > One more note. ?You may also need to use the option "-connect_all false". > ?It keeps from having the nodes automatically connect to all of the nodes > that a partner is connected to. ?I always forget about that one. Using this is actually what spawned this thread. Adding this option appears to lead to breakage of the global name registry. Nodes get stuck doing what I suspect is a global:sync() with hosts that will not cooperate. So I'm looking for a way to quarantine global to each LAN and provide a proxy for communication across the WAN link. From ulf.wiger@REDACTED Wed Aug 26 09:43:07 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 26 Aug 2009 09:43:07 +0200 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> Message-ID: <4A94E78B.1090307@erlang-consulting.com> Jayson Vantuyl wrote: > One more note. You may also need to use the option "-connect_all > false". It keeps from having the nodes automatically connect to all of > the nodes that a partner is connected to. I always forget about that one. I don't think mixing global and connect_all false is a good idea. The docs for global mention connect_all, but also say that only locking, not name registration, will work then. BTW, I found this fairly confusing wording in the global_group man page: "For the processes and nodes to run smoothly using the global group functiontionality, the following criteria must be met: - ... - *All* nodes in the system should belong to exactly one global group." Presumably, it should be "Every node in the system should belong to exactly one global group." As it reads now, it could easily be interpreted as requiring that there must be exactly one global group, and all nodes must be members of that group - apart from the fact that this would clearly be absurd, as it would eliminate any reason for using global_group in the first place... BR, Ulf W > On Aug 25, 2009, at 8:20 PM, Richard Andrews wrote: > >> On Wed, Aug 26, 2009 at 11:28 AM, Jayson Vantuyl wrote: >>> You might ask why I wouldn't just monkey with Distributed Erlang to >>> separate >>> the globals into groups (see the global_group module). The problem >>> is that >>> Distributed Erlang still just isn't built for this sort of use-case. In >>> Distributed Erlang getting the SSL stuff working right is hard, >>> firewalls >>> suck, NAT sucks even more, and the proper DNS setup is more trouble than >>> maintaining a node-list ever was (and impossible to quickly fix, if >>> you use >>> high enough TTLs). >> >> Security, NAT, etc. is a non-issue as any non-LAN traffic travels via >> IPSec between sites. Do you think this modifies your suggestions? > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From ulf.wiger@REDACTED Wed Aug 26 10:29:14 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 26 Aug 2009 10:29:14 +0200 Subject: [erlang-questions] R12B erlang node restart after system clock change In-Reply-To: <86f1f5350908251843jf7d768fwed81c75c23bdd951@mail.gmail.com> References: <86f1f5350908251843jf7d768fwed81c75c23bdd951@mail.gmail.com> Message-ID: <4A94F25A.4080802@erlang-consulting.com> The documentation for heart does say: "It should be noted that if the system clock is adjusted with more than HEART_BEAT_TIMEOUT seconds, heart will timeout and try to reboot the system. This can happen, for example, if the system clock is adjusted automatically by use of NTP (Network Time Protocol)." (...even in R10B). However, the reason why you're not seeing this in R10B is, I think, that heart.c has been re-written to use the system timestamp by default, whereas it derived timestamps from system ticks in R10. One relevant difference in the code seems to be: /* * Implement time correction using times() call even on Linuxes * that can simulate gethrtime with clock_gettime, no use implementing * a phony gethrtime in this file as the time questions are so infrequent. */ #if defined(CORRET_USING_TIMES) || defined(GETHRTIME_WITH_CLOCK_GETTIME) # define HEART_CORRECT_USING_TIMES 1 #endif Timestamps are still simulated on WIN32 or if HAVE_GETHRTIME is not defined, but HEART_CORRECT_USING_TIMES is. (Please verify for yourself by reading erts/etc/common/heart.c, as this is not documented, from what I can tell, and you should never draw conclusions based solely on my sloppy reading of C code). Perhaps using ticks whenever possible would be the best strategy for heart.c, as it is hardly a feature that it goes bezerk if someone dabbles with the system clock. It doesn't need hi-res timestamps to begin with, as no one in their right mind would set HEART_BEAT_TIMEOUT to something in the millisecond range (I don't really recommend anything less than a minute, actually, as heart is just a last resort, and /will/ interfere will crash dump generation too, if given a chance). BR, Ulf W Stephen Han wrote: > Hi > > I am facing an issue where erlang node is restarted by "heart" whenever I > change the system clock forward. It seems beam got KILL signal and the > "heart" restarting the node. The node got restarted even I move forward the > system clock for 1 minute. > > FYI, I am using OTP R12B-3. > > The problem is I am not even sure whether the node got restarted by our > application or Erlang/OTP. > However, this is also not reproducible in our old software which used to use > R10B-8. > > Is there any changes have been made to post R10B where Erlang node should > restart if the system clock move forward? > > Can you suggest any good method to debugging this kind of problem? > > regards, > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From onceltuca@REDACTED Wed Aug 26 11:02:18 2009 From: onceltuca@REDACTED (Felix) Date: Wed, 26 Aug 2009 02:02:18 -0700 (PDT) Subject: Release upgrade Message-ID: <322811a4-c202-49e9-8187-2f322295a349@t13g2000yqt.googlegroups.com> Hi, I have some problem with code upgrade. Im tying to upgrade the code for uploading files with yaws while im uploading a file. My upgrade instruction in the .appup file is {load_module,my_upload_module}. The upgrade goes well but it seems like upgrade is done on the currently running upload module when im doing release_handler:install_release/1 and thus kills the upload. I expected that the upgrade would take effect first at newly started uploads... Should I give a different upgrade instruction? / Felix From ulf.wiger@REDACTED Wed Aug 26 12:08:04 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 26 Aug 2009 12:08:04 +0200 Subject: [erlang-questions] Release upgrade In-Reply-To: <322811a4-c202-49e9-8187-2f322295a349@t13g2000yqt.googlegroups.com> References: <322811a4-c202-49e9-8187-2f322295a349@t13g2000yqt.googlegroups.com> Message-ID: <4A950984.10201@erlang-consulting.com> The basic principle behind code upgrade in Erlang is that while you can simply load modules that are not stateful, you usually need to take greater care when state needs to be preserved or perhaps even transformed. If you want running processes to automatically pick up new code, you need to think through how to do this, and there are different approaches depending on what the code does. A gen_server, for example, will always call the latest version of the callback for each new request (since it makes a qualified call to an exported function in the callback module). For a controlled upgrade, you need to 'suspend' the gen_server, trigger the Callbac:code_change/3 function, and then 'resume' the process. The high-level instruction that gives this default behaviour is {update, Mod} If the process doesn't "cooperate", you can insert an instruction in the appup script that waits for e.g. uploads to complete, somehow also making sure that new uploads are not starting, then loads the module in question. The low-level instruction {apply, {M, F, A}} can be used to do this. http://www.erlang.org/documentation/doc-5.6.3/lib/sasl-2.1.5.3/doc/html/appup.html BR, Ulf W Felix wrote: > Hi, > I have some problem with code upgrade. > Im tying to upgrade the code for uploading files with yaws while im > uploading a file. > My upgrade instruction in the .appup file is > {load_module,my_upload_module}. > > The upgrade goes well but it seems like upgrade is done on the > currently running upload module when im doing > release_handler:install_release/1 and thus kills the upload. I > expected that the upgrade would take effect first at newly started > uploads... > Should I give a different upgrade instruction? > > / > > Felix > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From kenji.rikitake@REDACTED Wed Aug 26 14:09:51 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 26 Aug 2009 21:09:51 +0900 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> Message-ID: <20090826120951.GA52899@k2r.org> I understand Erlang rpc module and the related ones including global_group module are designed only for where arbitrary communication is possible and allowed between the BEAM instances *and* epmd programs. This assumption is unfortunately not feasible on a network across unsecure links, such as those over global Internet. I was once thinking about managing the two or more separated Erlang rpc links as a single network, but I still have no idea with that. In the message <8F9DAC3F-2CE4-4E43-B756-5560073A184D@REDACTED> dated Tue, Aug 25, 2009 at 08:49:50PM -0700, Jayson Vantuyl writes: > Actually, IPsec was mostly what I was worried about. IPsec over a NAT conversion is complicated and difficult. Configuring the IKE policy rules is a bit of headache unless making *all* communication between two IP addresses under IPsec. For running something depending on rpc module, Encryption of communication between epmd daemons is mandatory, as well as that between BEAM instances. Mandating IPsec to *all* involving hosts is a simple way, but enforcing the policy is a difficult task too. (And using inet_ssl_dist is actually *incomplete* for encrypting all necessary traffics, because it does not encrypt empd traffic at all.) > That said, DNS is what will bite you. If you're cool with that, then > you can try using global_group. Maintaining unified DNS domain across multiple private (RFC1918) networks is surely another headache. My 2 JPY worth, Kenji Rikitake From chandrashekhar.mullaparthi@REDACTED Wed Aug 26 15:03:47 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 26 Aug 2009 14:03:47 +0100 Subject: [erlang-questions] Problems with ibrowse 1.5.2 - send_req not causing stream_to In-Reply-To: <4A94C5FC.5010706@catalyst.net.nz> References: <4A94C5FC.5010706@catalyst.net.nz> Message-ID: Hi Vik, Could you please turn on ibrowse tracing and post the trace messages? It'll help in debugging. cheers Chandru 2009/8/26 Vik Olliver > Hi folks. Stillhaving trouble with ibrowse. I'm calling: > > ibrowse:send_req(Url, [], > get, [], > [{stream_to, self()},{max_pipeline_size,1}]) > > to fetch 16 URLs in parallel. Now I have not changed the default sessions, > so presumably it sits at 10. > > When the 5th URL GET is issued, no error is generated (I know this because > I get {ibrowse_req_id, Ref} back) but no end_deliver/3 or end_deliver/4 is > returned to self(). The same happens to the next 5 GETs. > > Curiously, the apache server on the other end of the GET request actually > receives the 5th GET, and responds OK. The apache server is configured with > 5 sessions. > > The apache server has been deliberately slowed down so that there is a 2 > sec delay before the response is issued. Consequently, none of the other > GETs return an end_deliver - the first actual OK is not seen by ERMS until > after 16 URL GETs have gone out. > > Yes, we are deliberately overloading the apache server - to see what > ibrowse does. Is there some error hook or similar that I should be catching > to indicate a terminated ReqID, or should I be expecting {error, reason} > from send_req/5? At the moment I get neither. > > Vik :v) > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From chandrashekhar.mullaparthi@REDACTED Wed Aug 26 15:22:40 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 26 Aug 2009 14:22:40 +0100 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> Message-ID: 2009/8/26 Richard Andrews > I have a distributed system that needs to run on two geographically > isolated sites. Each site has a central manager node. > > I want a way to have the manager nodes from each site use erlang > monitoring of each other and some specific processes only on the > manager nodes; but I want to avoid node lists and global registrations > expanding such that the nodes on different sites try and become > connected together. > > How can I achieve this? > > Start up the manager nodes with the '-hidden' parameter. That way, a fully meshed network is not formed when the two managers talk to each other. cheers Chandru From ciprian.craciun@REDACTED Wed Aug 26 17:23:40 2009 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Wed, 26 Aug 2009 18:23:40 +0300 Subject: [erlang-questions] Opening "Special" Files In-Reply-To: <9060D277-CC5F-426B-9073-3423BEE54761@souja.net> References: <3A84B730-D785-46BF-9F8B-A08039DE206D@souja.net> <31073ef90908251822k2b459cf7o5f726f38ca6d8b7a@mail.gmail.com> <9060D277-CC5F-426B-9073-3423BEE54761@souja.net> Message-ID: <8e04b5820908260823x12392db1wdd1f30e031a029dc@mail.gmail.com> On Wed, Aug 26, 2009 at 4:30 AM, Jayson Vantuyl wrote: > Isn't this prevented by the asynchronous I/O threading stuff (erl +A NNN)? > ?I'm unsure why a block device would be that different than a file in that > case. ?Both create a potentially random seek and both mitigate this with > cache. > > On Aug 25, 2009, at 6:22 PM, Mark Wagner wrote: >> >> My understanding based on discussions on the mailing list is that this >> is an effort to avoid blocking I/O: a OS-level block on read or write >> would result in all Erlang-level threads managed by the current >> process being suspended until the I/O completes or times out. > > -- > Jayson Vantuyl > kagato@REDACTED Indeed earlier (this year or last one) there was a similar discussion on the mailing list... And the result was as Mark pointed, that for a regular file there is no risk of having the read or write operation stall... Unfortunately I must say that this protection is not bullet-proof... For example I've played a lot with FUSE (File System in User Space), and it is very easy to create virtual regular files, for which read or write could stall... As a conclusion, I would propose to allow the user to specify a flag that would force OTP (at the risk of the user) to open any file. (Of course I don't think such a thing would be implemented...) So if you really want to be able to open any kind of file from Erlang (I mean here block devices, character devices, fifo's, unix domain sockets, etc.) You could just implement a simple FUSE application in C to wrap the file system (this would be reusable for other projects with similar problems)... (Or as you've said write a port-like process or driver...) Ciprian Craciun. From chandrashekhar.mullaparthi@REDACTED Wed Aug 26 18:20:44 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 26 Aug 2009 17:20:44 +0100 Subject: [erlang-questions] Converting a mnesia table from set to ordered_set. In-Reply-To: <2a67d3ff0908211103g56dcd664sf3739791a32a5528@mail.gmail.com> References: <2a67d3ff0908211103g56dcd664sf3739791a32a5528@mail.gmail.com> Message-ID: 2009/8/21 G.S. > Hello, > > What's the best and fastest way to convert an already existing, fully > populated, about 5 gig table that is of type set, to type = ordered_set? > > Thanks, > -Gene > One way to do it is to: * Write some code to traverse backup and re-insert records into new table * Take a backup of the database * Delete the table * Create the table as ordered_set * Invoke code written in step 1 Another way: * Take a backup of the database * Delete the table * Create the table as an ordered_set * mnesia:restore(Table_name, [{clear_tables, [Table_name]}, {default_op, skip_tables}]). cheers Chandru From kenneth.lundin@REDACTED Wed Aug 26 18:28:16 2009 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 26 Aug 2009 18:28:16 +0200 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <20090826120951.GA52899@k2r.org> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> Message-ID: > > (And using inet_ssl_dist is actually *incomplete* for encrypting all > necessary traffics, because it does not encrypt empd traffic at all.) > Why do you think it is important to encrypt the epmd traffic? Is there really any sensitive information exchanged there? It is really very little data with low frequency exchanged between epmd and the nodes. It is actually in practice only used during establishment of a new connection to an Erlang node. I am not saying that the Erlang distribution is perfect for the use over global internet but is really epmd a problem? /Kenneth Erlang/OTP Ericsson From baryluk@REDACTED Wed Aug 26 18:36:55 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Wed, 26 Aug 2009 18:36:55 +0200 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> Message-ID: <1251304615.18875.39.camel@sredniczarny> Dnia 2009-08-26, ?ro o godzinie 18:28 +0200, Kenneth Lundin pisze: > > > > (And using inet_ssl_dist is actually *incomplete* for encrypting all > > necessary traffics, because it does not encrypt empd traffic at all.) > > > Why do you think it is important to encrypt the epmd traffic? > Is there really any sensitive information exchanged there? > It is really very little data with low frequency exchanged between epmd > and the nodes. It is actually in practice only used during > establishment of a new connection to an Erlang node. > > I am not saying that the Erlang distribution is perfect for the use > over global internet but > is really epmd a problem? > > /Kenneth Erlang/OTP Ericsson > I think it allows spoofing registration of nodes. This can cause denial of service. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From rickard.s.green@REDACTED Wed Aug 26 23:23:51 2009 From: rickard.s.green@REDACTED (Rickard Green) Date: Wed, 26 Aug 2009 23:23:51 +0200 Subject: SMP performance with hackbench In-Reply-To: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> References: <95051b2c0908182019o239c8d89id8399f560b6ad559@mail.gmail.com> Message-ID: <4A95A7E7.8020204@ericsson.com> The major problem is lock contention on memory allocator locks. I've made a hack that reduces the lock contention and it seems to solve the problem. The final solution that can be released needs more work though. It wont make it into R13B02, but will most likely make it into R13B03. The lack of flowcontrol (that Roger Larsson noted) also caused problems since memory usage sometimes increased very much with multiple schedulers. The extra memory usage also damaged the performance. I made my own version of the erlang hackbench (ehb.erl attached) which have flowcontrol and passes about 100 bytes per message (on a 64-bit machine). I tested the hacked smp emulator on a 2x quad-core machine using a linux 2.6.16 kernel. I ran ehb with 8 schedulers resp. 1 scheduler on the hacked smp emulator and compared with the original hackbench_old.c benchmark using pipes (which scaled best) and affinity ff resp. 1, i.e., allowing processes on 8 cores resp. 1 core. The speedups were similar for ehb and hackbench_old.c and ranging from 4 to 8 depending on the number of groups and loops used. Sometimes ehb performed better and sometimes hackbench_old performed better. Note that I compared with the smp emulator with 1 scheduler and not the non-smp emulator, but I also compared with a linux kernel with smp support in the affinity 1 case. The non-smp emulator performs much better than the smp emulator with 1 scheduler when running this benchmark since this benchmark hammers on things that uses locks, but I'm guessing that we would see similar results when comparing the linux kernel with smp support resp. without smp support also. Regards, Rickard -- Rickard Green, Erlang/OTP, Ericsson AB. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ehb.erl URL: From bflatmaj7th@REDACTED Thu Aug 27 01:10:15 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Thu, 27 Aug 2009 09:10:15 +1000 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> Message-ID: <7702c0610908261610u2eee03edp5ad7594262b7ec4f@mail.gmail.com> On Wed, Aug 26, 2009 at 11:22 PM, Chandru wrote: > Start up the manager nodes with the '-hidden' parameter. That way, a fully > meshed network is not formed when the two managers talk to each other. This doesn't work because then the manager nodes are then also hidden in the site where they are meant to be a normal member. From kenji.rikitake@REDACTED Thu Aug 27 02:56:11 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 27 Aug 2009 09:56:11 +0900 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <1251304615.18875.39.camel@sredniczarny> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> Message-ID: <20090827005611.GA60925@k2r.org> Dear Kenneth, Witold and all: It is not just about the importance, but the encryption should be mandated on all protocols between BEAMs and epmds (or anything related to distributed operation of Erlang systems), if Ericsson and current Erlang users want to earn financial support of Erlang from the security-aware (i.e. ordinary) users. Port-mapping based RPCs in general, not only Erlang's but that of Sun RPC (or ONC RPC), have been a long-time source of security problems. You can learn this from the various security advisories regarding Sun RPC in 1990s, also known as "portmap" problems. Port-mapping based RPC is extremely unfriendly against firewalls, or proxies and packet filters. For example, allowing arbitrary ports for BEAM communication is almost infeasible in the modern end-user environment, due to entirely disabling incoming TCP connections, or at least minimizing it to those absolutely necessary (e.g., ports 80 and 443.) And under such circumstances IPsec is not a practical solution either, since UDP exchange other than DNS and NTP is usually prohibited. As Witold explains, information exchanged between epmds is an easy target for killing BEAMs. It includes P2P port mappings between the BEAMs, so you can easily locate the targets to attack. Communication between epmds must be encrypted to prevent this kind of attack. Of course epmd itself could be a target of DoS attack, but that's another issue. I am not denying the usefulness of current rpc module in Erlang. It's well-written, transparent, low programming overhead for parallelization, and is OK so long as being used in a network where arbitrary use of TCP ports are allowed. This style of RPC, however, does not scale in the hostile real-world Internet, unfortunately. Erlang has SSL and SSH built-in (with the help of crypto linked-in drivers), and I think the CPUs nowadays are fast enough to run something equivalent to epmd purely under Erlang without using a dedicated C program. So Erlang has a lot of possibilities in implementing secure protocols on top of it. I think making a new RPC protocol from scratch, such as: * with restricting the usage of TCP connection between two BEAMs to only one well-known destination port; * preferably being able to forwarded through proxies (i.e. the addressing mechanism of BEAMs does not depend on DNS, IP addresses, or port numbers); and * running everything within a BEAM (and linked-in drivers) without anything like epmd will open a new opportunity for Erlang to become a practical system for monitoring/controlling distant systems over Internet. This is a challenging but an interesting project. Regards, Kenji Rikitake In the message <1251304615.18875.39.camel@REDACTED> dated Wed, Aug 26, 2009 at 06:36:31PM +0200, Witold Baryluk writes: > Dnia 2009-08-26, ?ro o godzinie 18:28 +0200, Kenneth Lundin pisze: > > > > > > (And using inet_ssl_dist is actually *incomplete* for encrypting all > > > necessary traffics, because it does not encrypt empd traffic at all.) > > > > > Why do you think it is important to encrypt the epmd traffic? > > Is there really any sensitive information exchanged there? > > It is really very little data with low frequency exchanged between epmd > > and the nodes. It is actually in practice only used during > > establishment of a new connection to an Erlang node. > > > > I am not saying that the Erlang distribution is perfect for the use > > over global internet but > > is really epmd a problem? > > > > /Kenneth Erlang/OTP Ericsson > > > > I think it allows spoofing registration of nodes. This can cause denial > of service. > > -- > Witold Baryluk From dizzyd@REDACTED Thu Aug 27 05:38:00 2009 From: dizzyd@REDACTED (Dave Smith) Date: Wed, 26 Aug 2009 21:38:00 -0600 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <20090827005611.GA60925@k2r.org> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> <20090827005611.GA60925@k2r.org> Message-ID: I'm not sure it's worth anything, but I designed and implemented something along these lines for a class I took last year. You can read about it here: http://dizzyd.com/sdist.pdf I could also make the code available if it's interesting. However, it does have most of the security properties Kenji was describing. It would be very nice to have something which permits better port control than the current EPMD approach. Security guidelines in trusted environments have grown more stringent over the years and the "everyone grab a port and register it!" approach doesn't fit well with semi-trusted environments. Anyways, I hope this paper will at least stimulate some further discussion. :) D. 2009/8/26 Kenji Rikitake : > Dear Kenneth, Witold and all: > > It is not just about the importance, but the encryption should be > mandated on all protocols between BEAMs and epmds (or anything related > to distributed operation of Erlang systems), if Ericsson and current > Erlang users want to earn financial support of Erlang from the > security-aware (i.e. ordinary) users. > > Port-mapping based RPCs in general, not only Erlang's but that of Sun > RPC (or ONC RPC), have been a long-time source of security problems. > You can learn this from the various security advisories regarding Sun > RPC in 1990s, also known as "portmap" problems. > > Port-mapping based RPC is extremely unfriendly against firewalls, or > proxies and packet filters. ?For example, allowing arbitrary ports for > BEAM communication is almost infeasible in the modern end-user > environment, due to entirely disabling incoming TCP connections, or at > least minimizing it to those absolutely necessary (e.g., ports 80 and > 443.) ?And under such circumstances IPsec is not a practical solution > either, since UDP exchange other than DNS and NTP is usually prohibited. > > As Witold explains, information exchanged between epmds is an easy > target for killing BEAMs. ?It includes P2P port mappings between the > BEAMs, so you can easily locate the targets to attack. ?Communication > between epmds must be encrypted to prevent this kind of attack. > > Of course epmd itself could be a target of DoS attack, but that's > another issue. > > I am not denying the usefulness of current rpc module in Erlang. ?It's > well-written, transparent, low programming overhead for parallelization, > and is OK so long as being used in a network where arbitrary use of > TCP ports are allowed. ?This style of RPC, however, does not scale in > the hostile real-world Internet, unfortunately. > > Erlang has SSL and SSH built-in (with the help of crypto linked-in > drivers), and I think the CPUs nowadays are fast enough to run something > equivalent to epmd purely under Erlang without using a dedicated C > program. ?So Erlang has a lot of possibilities in implementing secure > protocols on top of it. > > I think making a new RPC protocol from scratch, such as: > > * with restricting the usage of TCP connection between two BEAMs to only > one well-known destination port; > > * preferably being able to forwarded through proxies (i.e. the > addressing mechanism of BEAMs does not depend on DNS, IP addresses, or > port numbers); and > > * running everything within a BEAM (and linked-in drivers) without > anything like epmd > > will open a new opportunity for Erlang to become a practical system for > monitoring/controlling distant systems over Internet. ?This is a > challenging but an interesting project. > > Regards, > Kenji Rikitake > > In the message <1251304615.18875.39.camel@REDACTED> > dated Wed, Aug 26, 2009 at 06:36:31PM +0200, > Witold Baryluk writes: >> Dnia 2009-08-26, ?ro o godzinie 18:28 +0200, Kenneth Lundin pisze: >> > > >> > > (And using inet_ssl_dist is actually *incomplete* for encrypting all >> > > necessary traffics, because it does not encrypt empd traffic at all.) >> > > >> > Why do you think it is important to encrypt the epmd traffic? >> > Is there really any sensitive information exchanged there? >> > It is really very little data with low frequency exchanged between epmd >> > and the nodes. It is actually in practice only used during >> > establishment of a new connection to an Erlang node. >> > >> > I am not saying that the Erlang distribution is perfect for the use >> > over global internet but >> > is really epmd a problem? >> > >> > /Kenneth Erlang/OTP Ericsson >> > >> >> I think it allows spoofing registration of nodes. This can cause denial >> of service. >> >> -- >> Witold Baryluk > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vik@REDACTED Thu Aug 27 06:48:48 2009 From: vik@REDACTED (Vik Olliver) Date: Thu, 27 Aug 2009 16:48:48 +1200 Subject: [erlang-questions] Problems with ibrowse 1.5.2 - send_req not causing stream_to In-Reply-To: References: <4A94C5FC.5010706@catalyst.net.nz> Message-ID: <4A961030.5050309@catalyst.net.nz> On 27/08/09 Chandru wrote: > Could you please turn on ibrowse tracing and post the trace messages? > It'll help in debugging. Certainly. I've put the trace at: http://olliver.family.gen.nz/~vik/sanitised.acp_report.log If you search for "697669" you'll see: =INFO REPORT==== 27-Aug-2009::13:28:37 === (<0.234.0> ibrowse:379) do_send_req exiting with Ret ({ibrowse_req_id, {1251,336517,697669}}) =INFO REPORT==== 27-Aug-2009::13:28:37 === (<0.234.0> erms_http_connection:161) DEBUG: Get has ID {1251,336517,697669} =INFO REPORT==== 27-Aug-2009::13:28:37 === (<0.234.0> erms_http_connection:151) "GREENPEACE-MO" GET "http://192.168.2.239/~gerald/erms/[redacted for privacy reasons] The DEBUG line shows the req_id returned by send_req/5, the next line shows the http command which I've had to censor and rename to GREENPEACE but timing-wise is accurate and indicates we though we issued it. I can't find 697669 anywhere else in the trace. EndDeliver and EndDeliverOK are the {stream_to,self()}. If you think I can supply further debug info or try things out to assist, please ask. Vik :v) From chandrashekhar.mullaparthi@REDACTED Thu Aug 27 11:16:24 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 27 Aug 2009 10:16:24 +0100 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908261610u2eee03edp5ad7594262b7ec4f@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <7702c0610908261610u2eee03edp5ad7594262b7ec4f@mail.gmail.com> Message-ID: 2009/8/27 Richard Andrews > On Wed, Aug 26, 2009 at 11:22 PM, > Chandru wrote: > > Start up the manager nodes with the '-hidden' parameter. That way, a > fully > > meshed network is not formed when the two managers talk to each other. > > This doesn't work because then the manager nodes are then also hidden > in the site where they are meant to be a normal member. > True - but can you not configure the nodes you are supposed to connect to and just ping them? That'll setup your internal mesh. And if an mnesia schema is shared across these nodes, they'll connect up to each other regardless of whether the node is set to be hidden. Chandru From chandrashekhar.mullaparthi@REDACTED Thu Aug 27 11:50:06 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 27 Aug 2009 10:50:06 +0100 Subject: [erlang-questions] Problems with ibrowse 1.5.2 - send_req not causing stream_to In-Reply-To: <4A961030.5050309@catalyst.net.nz> References: <4A94C5FC.5010706@catalyst.net.nz> <4A961030.5050309@catalyst.net.nz> Message-ID: 2009/8/27 Vik Olliver > On 27/08/09 Chandru wrote: > >> Could you please turn on ibrowse tracing and post the trace messages? >> It'll help in debugging. >> > > Certainly. I've put the trace at: > > http://olliver.family.gen.nz/~vik/sanitised.acp_report.log > > If you search for "697669" you'll see: > > =INFO REPORT==== 27-Aug-2009::13:28:37 === > (<0.234.0> ibrowse:379) do_send_req exiting with Ret ({ibrowse_req_id, > {1251,336517,697669}}) > =INFO REPORT==== 27-Aug-2009::13:28:37 === > (<0.234.0> erms_http_connection:161) DEBUG: Get has ID {1251,336517,697669} > > =INFO REPORT==== 27-Aug-2009::13:28:37 === > (<0.234.0> erms_http_connection:151) "GREENPEACE-MO" GET " > http://192.168.2.239/~gerald/erms/[redactedfor privacy reasons] > > The DEBUG line shows the req_id returned by send_req/5, the next line shows > the http command which I've had to censor and rename to GREENPEACE but > timing-wise is accurate and indicates we though we issued it. > > I can't find 697669 anywhere else in the trace. EndDeliver and EndDeliverOK > are the {stream_to,self()}. If you think I can supply further debug info or > try things out to assist, please ask. > > May I see a bit of your code which handles the responses? For async requests, if an error happens in handling them, ibrowse sends back: {ibrowse_async_response, Req_id, Err} and never sends back a {ibrowse_async_response_end, Req_id}. Are you always waiting for the latter message? If not, I'll try to reproduce the problem you have. regards, Chandru From bflatmaj7th@REDACTED Thu Aug 27 14:21:49 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Thu, 27 Aug 2009 22:21:49 +1000 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <20090827005611.GA60925@k2r.org> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> <20090827005611.GA60925@k2r.org> Message-ID: <7702c0610908270521p3eb6054ewe380b3962dad66ea@mail.gmail.com> > I think making a new RPC protocol from scratch, such as: > > * with restricting the usage of TCP connection between two BEAMs to only > one well-known destination port; inet_dist_listen_min + inet_dist_listen_max does this. > * preferably being able to forwarded through proxies (i.e. the > addressing mechanism of BEAMs does not depend on DNS, IP addresses, or > port numbers); and It would be nice if nodes did not keep opening more and more TCP connections between the same two nodes in different directions. Distribution over SCTP might solve this issue. Does this exist? > * running everything within a BEAM (and linked-in drivers) without > anything like epmd The directory (epmd) needs to be in a predictable location and it cannot be in a node as it must monitor those. I do dislike the inet and ssl helper processes that hang off beam nodes; although having them separate has helped me debug some problems. > will open a new opportunity for Erlang to become a practical system for > monitoring/controlling distant systems over Internet. ?This is a > challenging but an interesting project. You may be trying to re-cast erlang distribution for something it was not intended to do. -- Rich From kenji.rikitake@REDACTED Thu Aug 27 15:27:31 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 27 Aug 2009 22:27:31 +0900 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908270521p3eb6054ewe380b3962dad66ea@mail.gmail.com> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> <20090827005611.GA60925@k2r.org> <7702c0610908270521p3eb6054ewe380b3962dad66ea@mail.gmail.com> Message-ID: <20090827132731.GA71039@k2r.org> Disclaimer: I am not insisting to change Erlang rpc module as of now. The rpc module model works fine for the intended usage. (What I'm writing may be on a different track from the beginning of this thread.) I want to have something additional. In the message <7702c0610908270521p3eb6054ewe380b3962dad66ea@REDACTED> dated Thu, Aug 27, 2009 at 10:21:25PM +1000, Richard Andrews writes: > > * with restricting the usage of TCP connection between two BEAMs to only > > one well-known destination port; > > inet_dist_listen_min + inet_dist_listen_max does this. About rpc with inet_dist, true. This should be configured for all BEAMs individually though. Question: Why not only one destination port number is sufficient? > > * preferably being able to forwarded through proxies (i.e. the > > addressing mechanism of BEAMs does not depend on DNS, IP addresses, or > > port numbers); and > It would be nice if nodes did not keep opening more and more TCP > connections between the same two nodes in different directions. Agreed. Why not overlaying multiple Erlang node connections between two IP hosts into one TCP (or SCTP if needed) connection? > Distribution over SCTP might solve this issue. Does this exist? I've never heard of Erlang SCTP distribution. Surely an interesting project to try out. > > * running everything within a BEAM (and linked-in drivers) without > > anything like epmd > The directory (epmd) needs to be in a predictable location and it > cannot be in a node as it must monitor those. I do dislike the inet > and ssl helper processes that hang off beam nodes; although having > them separate has helped me debug some problems. I am not claiming to remove epmd functionality for rpc. I'd rather want it in an Erlang BEAM or something directly controllable from BEAM. One long-time argument for epmd: at least the source port address with bind() system call should be freely specified other than INADDR_ANY. I've seen this argument repeatedly on the list and I wonder why this has not been implemented yet. Binding to INADDR_ANY is the least preferable choice, especially a host has multiple addresses bound into a network interface. > > will open a new opportunity for Erlang to become a practical system for > > monitoring/controlling distant systems over Internet. ?This is a > > challenging but an interesting project. > > You may be trying to re-cast erlang distribution for something it was > not intended to do. Disclaimer repeated: I am not trying to re-cast the current rpc module-based distribution. I need something in Erlang to safely monitor/control/manipulate/whatever each other between BEAMs across the Internet. Read Dave Smith's paper as well. > Rich Kenji Rikitake From attila.r.nohl@REDACTED Thu Aug 27 17:22:53 2009 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 27 Aug 2009 17:22:53 +0200 Subject: Converting to new leex Message-ID: <401d3ba30908270822s7792988bxc4ffae1f9cf9cb1d@mail.gmail.com> Hello! I have some old code using an old leex version like this: S = lists:sublist(YYtext, 2, YYlen - 2) I know that I have to replace YYtext with TokenChars, but what shall I use instead of YYlen? From david@REDACTED Thu Aug 27 20:28:11 2009 From: david@REDACTED (David Brown) Date: Thu, 27 Aug 2009 13:28:11 -0500 Subject: Unresolved external symbol _WinDynDriverCallbacks Message-ID: I'm trying to build an Erlang port driver on Windows, but I keep getting this error message: error LNK2019: unresolved external symbol _WinDynDriverCallbacks referenced in function __driver_output erl_driver.h is included, I've define __WIN32__ and I'm linking with erts_MD.lib. What could I have missed? Thanks, David Brown From bflatmaj7th@REDACTED Fri Aug 28 00:21:02 2009 From: bflatmaj7th@REDACTED (Richard Andrews) Date: Fri, 28 Aug 2009 08:21:02 +1000 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <20090827132731.GA71039@k2r.org> References: <7702c0610908251717t1367958cs162001ff2c43a406@mail.gmail.com> <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> <20090827005611.GA60925@k2r.org> <7702c0610908270521p3eb6054ewe380b3962dad66ea@mail.gmail.com> <20090827132731.GA71039@k2r.org> Message-ID: <7702c0610908271521y5e070af3s7de5ea2d25e9b1d7@mail.gmail.com> >> It would be nice if nodes did not keep opening more and more TCP >> connections between the same two nodes in different directions. > > Agreed. > > Why not overlaying multiple Erlang node connections between two IP hosts > into one TCP (or SCTP if needed) connection? TCP is unsuitable due to head of line blocking. I expect this is the main reason for the many connections. SCTP would remove such an issue as a stream could be established for each purpose. > One long-time argument for epmd: at least the source port address with > bind() system call should be freely specified other than > INADDR_ANY. I've seen this argument repeatedly on the list and I wonder > why this has not been implemented yet. ?Binding to INADDR_ANY is the > least preferable choice, especially a host has multiple addresses bound > into a network interface. This is undesirable to me. > I need something in Erlang to safely monitor/control/manipulate/whatever > each other between BEAMs across the Internet. I just use sockets and term_to_bin. From rvirding@REDACTED Fri Aug 28 00:57:25 2009 From: rvirding@REDACTED (Robert Virding) Date: Fri, 28 Aug 2009 00:57:25 +0200 Subject: [erlang-questions] Converting to new leex In-Reply-To: <401d3ba30908270822s7792988bxc4ffae1f9cf9cb1d@mail.gmail.com> References: <401d3ba30908270822s7792988bxc4ffae1f9cf9cb1d@mail.gmail.com> Message-ID: <3dbc6d1c0908271557i5ec90823m23c358b4f773f13c@mail.gmail.com> 2009/8/27 Attila Rajmund Nohl > Hello! > > I have some old code using an old leex version like this: > > S = lists:sublist(YYtext, 2, YYlen - 2) > > I know that I have to replace YYtext with TokenChars, but what shall I > use instead of YYlen? TokenLen and the line number is in TokenLine. Robert From kenji.rikitake@REDACTED Fri Aug 28 02:08:49 2009 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 28 Aug 2009 09:08:49 +0900 Subject: [erlang-questions] Controlled interaction of two erlang distributed networks In-Reply-To: <7702c0610908271521y5e070af3s7de5ea2d25e9b1d7@mail.gmail.com> References: <66772AE8-39AD-44F2-9470-4B2E94405009@souja.net> <7702c0610908252020x2597b539s4a1ef9f597561783@mail.gmail.com> <8F9DAC3F-2CE4-4E43-B756-5560073A184D@souja.net> <20090826120951.GA52899@k2r.org> <1251304615.18875.39.camel@sredniczarny> <20090827005611.GA60925@k2r.org> <7702c0610908270521p3eb6054ewe380b3962dad66ea@mail.gmail.com> <20090827132731.GA71039@k2r.org> <7702c0610908271521y5e070af3s7de5ea2d25e9b1d7@mail.gmail.com> Message-ID: <20090828000849.GA78388@k2r.org> In the message <7702c0610908271521y5e070af3s7de5ea2d25e9b1d7@REDACTED> dated Fri, Aug 28, 2009 at 08:20:38AM +1000, Richard Andrews writes: > TCP is unsuitable due to head of line blocking. I expect this is the > main reason for the many connections. SCTP would remove such an issue > as a stream could be established for each purpose. Streams within a connection will be useful indeed. > > One long-time argument for epmd: at least the source port address with > > bind() system call should be freely specified other than > > INADDR_ANY. I've seen this argument repeatedly on the list and I wonder > > why this has not been implemented yet. ?Binding to INADDR_ANY is the > > least preferable choice, especially a host has multiple addresses bound > > into a network interface. > > This is undesirable to me. Running BEAM on a multiple interface machine often needs restricting showing epmd to one trusted network, e.g., on a dual-homed firewall, or in a FreeBSD Jail which requires processes in Jails to bind() on the specific addresses other than INADDR_ANY. Packet filters should be used anyway to prevent unwanted packets to reach epmd, but narrowing the acceptable packets to specify a non-INADDR_ANY address solves this issue in much simpler way. All I need is a command option to set the bind()ing address(es). An environment variable ERL_EPMD_PORT is recently added; ERL_EPMD_IPV4_ADDRESS (or the IPv6 one) looks easy to be added too. I know I can patch, but I'd rather want it as an epmd official function. > > I need something in Erlang to safely monitor/control/manipulate/whatever > > each other between BEAMs across the Internet. > > I just use sockets and term_to_bin. Yes this is a well-known first step; and I want it to do over an encrypted channel. inet_ssl_dist is not bad if epmd *were* encrypted. Unfortunately this is not the case so I need to think about something else. Fortunately Erlang has its own ssh module and I'm now playing around with it. Note: the default ssh_cli.erl has so many functions for command-line editing implemented, and those are not necessary at all for just passing binaries in Erlang External Term Format (at http://erlang.org/doc/apps/erts/erl_ext_dist.html on Web). Regards, Kenji Rikitake From vik@REDACTED Fri Aug 28 02:07:14 2009 From: vik@REDACTED (Vik Olliver) Date: Fri, 28 Aug 2009 12:07:14 +1200 Subject: [erlang-questions] Problems with ibrowse 1.5.2 - send_req not causing stream_to In-Reply-To: References: <4A94C5FC.5010706@catalyst.net.nz> <4A961030.5050309@catalyst.net.nz> Message-ID: <4A971FB2.6070808@catalyst.net.nz> On 27/08/09 Chandru wrote: > May I see a bit of your code which handles the responses? For async > requests, if an error happens in handling them, ibrowse sends back: > {ibrowse_async_response, Req_id, Err} and never sends back a > {ibrowse_async_response_end, Req_id}. That might explain what's going on. It's certainly something I've not got debug trace on: handle_info({ibrowse_async_response_end, _}, State) -> {noreply, State}; handle_info({ibrowse_async_response, _, _}, State) -> {noreply, State}; handle_info({ibrowse_async_headers, ReqId, Code, _Headers}, State) -> {noreply, end_deliver(State, ReqId, Code)}; handle_info(Info, State) -> ?WARN("Unexpected info ~p", [Info]), {noreply, State}. It appears that this code is not doing anything interesting with {ibrowse_async_response, Req_id, Err} - and I can see a flaw there straight away :) It's a wonder it worked for so long... Vik :v) From ulf.wiger@REDACTED Fri Aug 28 09:26:45 2009 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 28 Aug 2009 09:26:45 +0200 Subject: modifying epmd to look at the whole node name Message-ID: <4A9786B5.7080907@erlang-consulting.com> Many years ago, I made a small patch in epmd to have it look at the whole node name - not just the part before the @. The reason then was that I wanted to be able to test a distributed system by running all nodes on the same machine and not change the node names. Already today, you can start nodes using e.g. erl -sname n@REDACTED erl -sname n@REDACTED and so on, but they can't talk to each other, partly because epmd doesn't look at the host part (presumably because it's always supposed to be the local host). The other requirement for getting them to talk to each other is to rig the name lookup, but this functionality already exists. I no longer have the epmd hack, and don't feel particularly inclined to do it again. As far as I recall, I got it to work, though. It occured to me that this sort of functionality might be interesting in a cloud environment too, where hostnames are dynamic and may change over time. If the node name could be kept constant, independent of the current host's name, modifying only epmd and doing some inetrc trickery, it might be possible to run a distributed mnesia database in such an environment without having to worry about persistent schema information becoming outdated when host names change. What am I missing? BR, Ulf W -- Ulf Wiger CTO, Erlang Training & Consulting Ltd http://www.erlang-consulting.com From russell.brown@REDACTED Fri Aug 28 09:20:43 2009 From: russell.brown@REDACTED (Russell Brown) Date: Fri, 28 Aug 2009 08:20:43 +0100 Subject: Emailing from erlang (web apps) with Googlemail Message-ID: <7E6A5A87-5551-4508-81DC-939ACAD5964A@mac.com> Hi, A Nitrogen user (Benjamin Nortier) posted this (http://21ccw.blogspot.com/2009/05/how-to-send-email-via-gmail-using.html ) example on his blog a while ago. I used it for a couple of Nitrogen apps and ended up wrapping it in OTP (sort of, I am noob). The result is here http://github.com/russelldb/erlgmail/ If it is any use at all please use it. It is not well tested (not sure how to write the unit tests) but it is used a little in a couple of sites. Cheers Russell From gordon@REDACTED Fri Aug 28 12:43:17 2009 From: gordon@REDACTED (Gordon Guthrie) Date: Fri, 28 Aug 2009 11:43:17 +0100 Subject: Erlang Job in Edinburgh Message-ID: Edinburgh-based internet start-up hypernumbers is looking to recruit an engineer. The position is for a software engineer with skills over the full stack: * browser * back-end * operating system/cloud platform * infrastructure (DNS, e-mail, etc, etc) The successful applicant will have the following skills: * a good understanding of javascript, css and browser programming technologies * solid exposure to functional programming (Erlang experience is a bonus but not mandatory - training will be provided) * a good understanding of basic operating system install and deployment issues, including the ability to maintain their own development machines * a proven knowledge of the normal opensource development toolkit, eg version control, automated testing, trac/bugzilla, etc, etc * knowledge of infrastructure requirements like DNS, mail servers and the lac We are looking for a whiz-kid with strong all round design and development skills for a crucial role in the development of our platform who is willing to take on responsibility for driving forward complex and innovative technology. You will need to be a self-starter with a high degree of motiviation. This isn't just a techie job though - all staff need to work in front of the customer and be able to communicate clearly and freely with non-technical people This position is salaried and has equity. If you are interested in this job please respond to me directly or if you just wish to discuss it please feel free to phone me on (+44) 07776 251669 Please feel free to circulate this to any other interested parties. Cheers Gordon Guthrie CEO/CTO Hypernumbers From chandrashekhar.mullaparthi@REDACTED Fri Aug 28 13:24:28 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 28 Aug 2009 12:24:28 +0100 Subject: [erlang-questions] run_erl / Erlang configure script broken? In-Reply-To: <8978893.80771250759493539.JavaMail.root@zimbra> References: <1018285.80261250714550079.JavaMail.root@zimbra> <8978893.80771250759493539.JavaMail.root@zimbra> Message-ID: 2009/8/20 Sean McEvoy > Hello List, > > We're running R13B01 on a Solaris 10 machine (10/08 s10x_u6wos_07b X86, at > a customer's site, configured in a non-standard way). > When trying to use run_erl we see the error: > run_erl:351 [13847] Wed Aug 19 13:34:15 2009 > errno=2 'No such file or directory' > Could not open pty master > > Sorry Sean, I don't have a fix. I have the same problem! We are trying to install multiple erlang nodes on a blade server which has been divided into Solaris zones. Apparently, in such an env, /dev/pty/ poses a security risk and has been disabled by our sysadmins. Help please! Chandru From esobchenko@REDACTED Fri Aug 28 13:53:37 2009 From: esobchenko@REDACTED (Eugen Sobchenko) Date: Fri, 28 Aug 2009 04:53:37 -0700 (PDT) Subject: mnesia question: full database replication across the several nodes Message-ID: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Hi! I have a distributed mnesia application that have to create new tables during it's work. I want to keep all tables replicated on all mnesia nodes in my cluster. What if the table has been created at the moment when some of the cluster nodes were down? Is there a standard solution to make full database replication across the several nodes? From chandrashekhar.mullaparthi@REDACTED Fri Aug 28 14:27:18 2009 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 28 Aug 2009 13:27:18 +0100 Subject: [erlang-questions] mnesia question: full database replication across the several nodes In-Reply-To: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> References: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Message-ID: 2009/8/28 Eugen Sobchenko > Hi! I have a distributed mnesia application that have to create new > tables during it's work. > I want to keep all tables replicated on all mnesia nodes in my > cluster. > What if the table has been created at the moment when some of the > cluster nodes were down? Is there a standard solution to make full > database replication across the several nodes? > Table creation will fail if one (or more) of the nodes you've specified for table copies is not reachable. If you want it to succeed regardless of some nodes not being reachable, you have to create your table on whatever nodes exist, and have some code which makes copies of tables when nodes come up. cheers Chandru From sean.mcevoy@REDACTED Fri Aug 28 15:25:25 2009 From: sean.mcevoy@REDACTED (Sean McEvoy) Date: Fri, 28 Aug 2009 14:25:25 +0100 (BST) Subject: [erlang-questions] run_erl / Erlang configure script broken? In-Reply-To: <23212633.102331251465801682.JavaMail.root@zimbra> Message-ID: <8161826.102351251465925300.JavaMail.root@zimbra> Hi Chandru, How are you doing? I'm not sure I can help you here but I can show you all I did trying to fix this. I added some C code to run_erl.c, an include directory: #include and some extra code in the open_pty_master function, at line 975: static int open_pty_master(char **ptyslave) ... { int fds; mfd = open("/dev/ptmx", O_RDWR); /* open master */ grantpt(mfd); /* change permission of slave */ unlockpt(mfd); /* unlock slave */ ptyslave = ptsname(mfd); /* get name of slave */ fds = open(ptyslave, O_RDWR); /* open slave */ ioctl(fds, I_PUSH, "ptem"); /* push ptem */ ioctl(fds, I_PUSH, "ldterm"); /* push ldterm*/ return mfd; } #endif /* !HAVE_OPENPTY */ return -1; } This managed to open the PTY Master but not the slave, I think it's almost there but not working yet. It's the first time in 10 years I wrote C code so it might just be something simple missing. We needed this a solution quickly so a colleague took responsibility to start our node using a different method, not using run_erl. Your problem is one of permissions so I guess this might not be much use. //Sean. ----- Original Message ----- From: "Chandru" To: "Sean McEvoy" Cc: "erlang-questions Questions" , "Mietek B?k" Sent: Friday, 28 August, 2009 12:24:28 GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [erlang-questions] run_erl / Erlang configure script broken? 2009/8/20 Sean McEvoy < sean.mcevoy@REDACTED > Hello List, We're running R13B01 on a Solaris 10 machine (10/08 s10x_u6wos_07b X86, at a customer's site, configured in a non-standard way). When trying to use run_erl we see the error: run_erl:351 [13847] Wed Aug 19 13:34:15 2009 errno=2 'No such file or directory' Could not open pty master Sorry Sean, I don't have a fix. I have the same problem! We are trying to install multiple erlang nodes on a blade server which has been divided into Solaris zones. Apparently, in such an env, /dev/pty/ poses a security risk and has been disabled by our sysadmins. Help please! Chandru From paul-trapexit@REDACTED Fri Aug 28 17:42:11 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 28 Aug 2009 08:42:11 -0700 (PDT) Subject: [erlang-questions] mnesia question: full database replication across the several nodes In-Reply-To: References: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Message-ID: I wrote something called fragmentron originally intended for mnesia on EC2. It takes a desired number of data copies for a table. If you set this to a huge number (e.g., 999), you would get full replication of everything everywhere. http://code.google.com/p/fragmentron/ -- p On Fri, 28 Aug 2009, Chandru wrote: > 2009/8/28 Eugen Sobchenko > > > Hi! I have a distributed mnesia application that have to create new > > tables during it's work. > > I want to keep all tables replicated on all mnesia nodes in my > > cluster. > > What if the table has been created at the moment when some of the > > cluster nodes were down? Is there a standard solution to make full > > database replication across the several nodes? > > > > Table creation will fail if one (or more) of the nodes you've specified for > table copies is not reachable. If you want it to succeed regardless of some > nodes not being reachable, you have to create your table on whatever nodes > exist, and have some code which makes copies of tables when nodes come up. > > cheers > Chandru > From paul-trapexit@REDACTED Fri Aug 28 17:54:56 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Fri, 28 Aug 2009 08:54:56 -0700 (PDT) Subject: [erlang-questions] mnesia question: full database replication across the several nodes In-Reply-To: References: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Message-ID: Thinking about your exact problem, however, it's probably simplest just to have each node add the table copies to itself when it starts up. Something like mnesia:add_table_copy (TheTable, node (), TheTableType) where TheTable is the table name (e.g., 'mytable') and TheTableType is one of 'ram_copies', 'disc_copies', or 'disc_only_copies'. mnesia:add_table_copy/3 is idempotent so this is relatively harmless to do every time. It does create a schema transaction, which can be slow under extreme load. I used the following "dirty schema read" to make things faster in the case where typically the table already has a local copy. ----------- fast_add_table_copy (TableName, Node, CopyType) -> try lists:member (Node, used_nodes (TableName)) of true -> { aborted, { already_exists, TableName, Node } }; false -> mnesia:add_table_copy (TableName, Node, CopyType) catch _ : _ -> { aborted, { no_exists, TableName } } end. used_nodes (TableName) -> lists:usort (used_nodes (TableName, ram_copies) ++ used_nodes (TableName, disc_copies) ++ used_nodes (TableName, disc_only_copies)). used_nodes (TableName, CopyType) -> mnesia:table_info (TableName, CopyType). ----------- Cheers, -- p On Fri, 28 Aug 2009, Paul Mineiro wrote: > I wrote something called fragmentron originally intended for mnesia on > EC2. It takes a desired number of data copies for a table. If you set > this to a huge number (e.g., 999), you would get full replication of > everything everywhere. > > http://code.google.com/p/fragmentron/ > > -- p > > On Fri, 28 Aug 2009, Chandru wrote: > > > 2009/8/28 Eugen Sobchenko > > > > > Hi! I have a distributed mnesia application that have to create new > > > tables during it's work. > > > I want to keep all tables replicated on all mnesia nodes in my > > > cluster. > > > What if the table has been created at the moment when some of the > > > cluster nodes were down? Is there a standard solution to make full > > > database replication across the several nodes? > > > > > > > Table creation will fail if one (or more) of the nodes you've specified for > > table copies is not reachable. If you want it to succeed regardless of some > > nodes not being reachable, you have to create your table on whatever nodes > > exist, and have some code which makes copies of tables when nodes come up. > > > > cheers > > Chandru > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vances@REDACTED Fri Aug 28 20:24:03 2009 From: vances@REDACTED (Vance Shipley) Date: Fri, 28 Aug 2009 14:24:03 -0400 Subject: OpenDocument Format (ODF) Message-ID: <20090828182403.GK13211@h216-235-12-168.host.egate.net> Is anybody working on generating OpenDocument Format (ODF) in Erlang? One of my old tricks is to export data in the SYmbolic LinK (SYLK) file format as a ready built spreadsheet. The SYLK format is an undocumented early file format from Microsoft which is still supported by Microsoft Excel. It is an ASCII format which isn't too hard to understand and easy to produce from Erlang. Using this I can easily generate reports with spreadsheet formatting and rudimentary formulas (i.e. column totals). I'd like an updated solution which would be better supported and allow greater functionality. It seems that moving to ODF might be the best way forward. I haven't tried to grok the ODF syntax for spreadsheets yet, maybe it's not that much harder than SYLK. I though maybe someone else might be ahead of me on this though. How about a language binding to the OpenOffice UNO? -- -Vance http://en.wikipedia.org/wiki/OpenDocument http://en.wikipedia.org/wiki/SYmbolic_LinK_(SYLK) http://udk.openoffice.org/ From dave.pawson@REDACTED Fri Aug 28 20:46:58 2009 From: dave.pawson@REDACTED (Dave Pawson) Date: Fri, 28 Aug 2009 19:46:58 +0100 Subject: [erlang-questions] OpenDocument Format (ODF) In-Reply-To: <20090828182403.GK13211@h216-235-12-168.host.egate.net> References: <20090828182403.GK13211@h216-235-12-168.host.egate.net> Message-ID: <711a73df0908281146j2c7dd6f6rd6661b92eeb2aa98@mail.gmail.com> 2009/8/28 Vance Shipley : > Is anybody working on generating OpenDocument Format (ODF) in Erlang? > > One of my old tricks is to export data in the SYmbolic LinK (SYLK) > file format as a ready built spreadsheet. ?The SYLK format is an > undocumented early file format from Microsoft which is still supported > by Microsoft Excel. ?It is an ASCII format which isn't too hard to > understand and easy to produce from Erlang. ?Using this I can easily > generate reports with spreadsheet formatting and rudimentary formulas > (i.e. column totals). I've done some work, converting from ODF into other formats. Unsure about a lesser Office format, since some ODF suites can import M$ office documents directly. > > I'd like an updated solution which would be better supported and allow > greater functionality. ?It seems that moving to ODF might be the best > way forward. ODF is definately easier to generate than M$ office XML > > I haven't tried to grok the ODF syntax for spreadsheets yet, maybe > it's not that much harder than SYLK. ?I though maybe someone else > might be ahead of me on this though. ?How about a language binding > to the OpenOffice UNO? UNO? Not heard of that one. You're basically generating a few xml files then zipping them up. HTH -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk From esobchenko@REDACTED Sat Aug 29 11:59:26 2009 From: esobchenko@REDACTED (Eugen Sobchenko) Date: Sat, 29 Aug 2009 02:59:26 -0700 (PDT) Subject: mnesia question: full database replication across the several nodes In-Reply-To: References: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Message-ID: Got it. Thanks for your answers everyone. ;-) From esobchenko@REDACTED Sat Aug 29 13:43:11 2009 From: esobchenko@REDACTED (Eugen Sobchenko) Date: Sat, 29 Aug 2009 04:43:11 -0700 (PDT) Subject: mnesia question: full database replication across the several nodes In-Reply-To: References: <29bf5d37-6325-4465-8982-cc5ec3df0526@l35g2000pra.googlegroups.com> Message-ID: <5a670f44-bbb5-450a-a68c-609252752584@q35g2000vbi.googlegroups.com> Here is what I got: start_replica(Master_node) when is_atom(Master_node) -> ok = mnesia:start(), case mnesia:change_config(extra_db_nodes, [Master_node]) of {ok, _} -> ok; {error, E} -> erlang:error({change_config_failed, E}) end, mnesia:change_table_copy_type(schema, node(), disc_copies), Tables = mnesia:system_info(tables), Table_types = [ {T, mnesia:table_info(T, where_to_commit)} || T <- Tables ], [ {T, mnesia:add_table_copy(T, node(), Type) } || {T, [_, Type]} <- Table_types ]. Does this look reasonable or have I done something wrong? Thanks in advance. From cbenac@REDACTED Sat Aug 29 23:23:25 2009 From: cbenac@REDACTED (Clara Benac Earle) Date: Sat, 29 Aug 2009 23:23:25 +0200 Subject: Erlang Workshop 2009 Message-ID: <4A999C4D.1090409@fi.upm.es> As many of you are aware, the Erlang Workshop will take place next Saturday 5th of September in Edinburgh. Registration is still open at http://www.regmaster.com/conf/icfp2009.html After the workshop we will go for dinner at the Albanach, and afterwards we will have some drinks at the bar, the first drinks kindly sponsored by Erlang Training and Consulting (http://www.erlang-consulting.com/). Make sure you join us! Clara From kiszl@REDACTED Sun Aug 30 10:07:33 2009 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sun, 30 Aug 2009 10:07:33 +0200 Subject: [erlang-questions] Erlang Workshop 2009 In-Reply-To: <4A999C4D.1090409@fi.upm.es> References: <4A999C4D.1090409@fi.upm.es> Message-ID: <4A9A3345.40701@tmit.bme.hu> Please note that the online registration was closed on Thursday. There will be a registration desk on site, where registration is still possible during the following times: August 30 (Sun) : 8:15 - 17:00 August 31 (Mon) : 8:00 - 17:00 September 1 (Tue) : 8:30 - 17:00 September 2 (Wed) : 8:30 - 17:00 September 3 (Thu) : 8:30 - 14:00 Regards, Zoltan. Clara Benac Earle wrote: > As many of you are aware, the Erlang Workshop will take place next > Saturday 5th of September in Edinburgh. Registration is still open at > http://www.regmaster.com/conf/icfp2009.html > > After the workshop we will go for dinner at the Albanach, and > afterwards we will have some drinks at the bar, the first drinks > kindly sponsored by Erlang Training and Consulting > (http://www.erlang-consulting.com/). > > Make sure you join us! > Clara > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ngocdaothanh@REDACTED Mon Aug 31 08:32:17 2009 From: ngocdaothanh@REDACTED (ngocdaothanh) Date: Sun, 30 Aug 2009 23:32:17 -0700 (PDT) Subject: Use Mnesia backup on other machines Message-ID: Hi everyone, I would like to ask about Mnesia backup: 1. How to periodically create backup of Mnesia DB of a node? 2. How do to copy backup files to other machines and use them there? Regards. From info@REDACTED Mon Aug 31 15:56:57 2009 From: info@REDACTED (info) Date: Mon, 31 Aug 2009 15:56:57 +0200 Subject: request a task scheduler Message-ID: <200908311556569200273@its3.ch> Hi all, Excepted crone.erl do you know a task scheduler for erlang OTP application ? I look for a task scheduler with a fine timing (seconds, minutes, ..., months, ...). John From rtrlists@REDACTED Mon Aug 31 16:50:34 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 31 Aug 2009 15:50:34 +0100 Subject: [erlang-questions] request a task scheduler In-Reply-To: <200908311556569200273@its3.ch> References: <200908311556569200273@its3.ch> Message-ID: <6a3ae47e0908310750y1c0cee97sf775983bc267a1c4@mail.gmail.com> On Mon, Aug 31, 2009 at 2:56 PM, info wrote: > Hi all, > > Excepted crone.erl do you know a task scheduler for erlang OTP application > ? > I look for a task scheduler with a fine timing (seconds, minutes, ..., > months, ...). > > John > What's wrong with crone? Seems to fit the bill, except for tasks run at very large intervals. I guess the other thing missing from crone is scheduling against UTC instead of local time. Otherwise it's pretty trivial to mould to your needs. If you need scheduling on a yearly basis, you should be able to take the crone code and put a wrapper with coarse granularity around it very easily. Robby From info@REDACTED Mon Aug 31 17:13:26 2009 From: info@REDACTED (info) Date: Mon, 31 Aug 2009 17:13:26 +0200 Subject: [erlang-questions] request a task scheduler References: <200908311556569200273@its3.ch>, <6a3ae47e0908310750y1c0cee97sf775983bc267a1c4@mail.gmail.com> Message-ID: <200908311713263877072@its3.ch> Hi Robby, It seems that we cannot schedule tasks every 30 seconds or 5 minutes. Am I wrong ? John On Mon, Aug 31, 2009 at 2:56 PM, info wrote: > Hi all, > > Excepted crone.erl do you know a task scheduler for erlang OTP application > ? > I look for a task scheduler with a fine timing (seconds, minutes, ..., > months, ...). > > John > What's wrong with crone? Seems to fit the bill, except for tasks run at very large intervals. I guess the other thing missing from crone is scheduling against UTC instead of local time. Otherwise it's pretty trivial to mould to your needs. If you need scheduling on a yearly basis, you should be able to take the crone code and put a wrapper with coarse granularity around it very easily. Robby From baryluk@REDACTED Mon Aug 31 17:24:27 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 31 Aug 2009 17:24:27 +0200 Subject: [erlang-questions] request a task scheduler In-Reply-To: <200908311713263877072@its3.ch> References: <200908311556569200273@its3.ch> , <6a3ae47e0908310750y1c0cee97sf775983bc267a1c4@mail.gmail.com> <200908311713263877072@its3.ch> Message-ID: <1251732268.11769.28.camel@sredniczarny> Dnia 2009-08-31, pon o godzinie 17:13 +0200, info pisze: > Hi Robby, > It seems that we cannot schedule tasks every 30 seconds or 5 minutes. Am I wrong ? > John Yes, you can, kind of hack but should work {daily, {every, {30, sec}}, {between, {0,0,pm}, {11,39,am}}}. crone version available 2004 have lots of bugs and is quite slow in calculating schedules which are very frequent (like 30 seconds). You will probably need to tweak it somehow. We have some more improved and optimized version of crone, but unfortunately it isn't publicly available yet. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From daniel.kwiecinski@REDACTED Mon Aug 31 17:32:05 2009 From: daniel.kwiecinski@REDACTED (Daniel Kwiecinski) Date: Mon, 31 Aug 2009 16:32:05 +0100 Subject: erlang:fun_info behaving strangely Message-ID: Hi Can somebody explain the difference in results of calling the same code directy from erlang console as opposite to calling it via defined module: 1. direct console call *> erlang:fun_info(fun(A) -> A+1 end). [{pid,<0.33.0>}, {module,erl_eval}, {new_index,2}, {new_uniq,<<83,63,182,157,53,152,27,64,224,39,165,36,92, 123,196,191>>}, {index,6}, {uniq,13229925}, {name,'-expr/5-fun-2-'}, {arity,1}, {env,[[], {value,#Fun}, {eval,#Fun}, [{clause,1, [{var,1,'A'}], [], [{op,1,'+',{var,1,'A'},{integer,1,...}}]}]]}, {type,local}]* 2. calling from defined module *-module(test). -export([foo/0]). foo() -> **erlang:fun_info(fun(A) -> A+1 end).* *> test:foo(). [{pid,<0.33.0>}, {module,test}, {new_index,0}, {new_uniq,<<229,228,162,67,57,100,131,208,221,10,225,109, 150,95,53,238>>}, {index,0}, {uniq,133275216}, {name,'-foo/0-fun-0-'}, {arity,1}, {env,[]}, {type,local}]* Both functions are local but only the one defined directly in console had environment. Many Thanks in advance for any help on this., Daniel Kwiecinski From rtrlists@REDACTED Mon Aug 31 17:45:34 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 31 Aug 2009 16:45:34 +0100 Subject: [erlang-questions] request a task scheduler In-Reply-To: <200908311713263877072@its3.ch> References: <200908311556569200273@its3.ch> <6a3ae47e0908310750y1c0cee97sf775983bc267a1c4@mail.gmail.com> <200908311713263877072@its3.ch> Message-ID: <6a3ae47e0908310845h21a24ec5rfe76025331ae0f1a@mail.gmail.com> On Mon, Aug 31, 2009 at 4:13 PM, info wrote: > Hi Robby, > It seems that we cannot schedule tasks every 30 seconds or 5 minutes. Am I > wrong ? > John > > On Mon, Aug 31, 2009 at 2:56 PM, info wrote: > > > Hi all, > > > > > Excepted crone.erl do you know a task scheduler for erlang OTP application > > ? > > I look for a task scheduler with a fine timing (seconds, minutes, ..., > > months, ...). > > > > John > > > > > What's wrong with crone? Seems to fit the bill, except for tasks run at very > large intervals. I guess the other thing missing from crone is scheduling > > against UTC instead of local time. Otherwise it's pretty trivial to mould to > your needs. > > If you need scheduling on a yearly basis, you should be able to take the > crone code and put a wrapper with coarse granularity around it very easily. > > Robby > > The {daily, {every, {5, sec}, {between, {12, 0, 0, am}, {11, 59, 59, pm}}}} schedule works fine for me. (Disclaimer, I've changed the until_next_time() function to use simple 24 hour days for myself, so I hope that schedule is correct for the crone.erl you can get online.) I don't use the surrounding invocation code provided by crone though. I just use the until_next_time() to get me the amount of time to put into my gen_server timeout return values. The one thing that is a bit awkward is dealing with milli-seconds. The crone code only goes to second granularity. So if your task is over in less than a second, be sure to not invoke it again by accident. If I remember correctly there was some explicit sleep(1000) in the crone invocation code itself. Robby From baryluk@REDACTED Mon Aug 31 17:50:43 2009 From: baryluk@REDACTED (Witold Baryluk) Date: Mon, 31 Aug 2009 17:50:43 +0200 Subject: [erlang-questions] erlang:fun_info behaving strangely In-Reply-To: References: Message-ID: <1251733844.11769.30.camel@sredniczarny> Dnia 2009-08-31, pon o godzinie 16:32 +0100, Daniel Kwiecinski pisze: > Hi > > Can somebody explain the difference in results of calling the same code > directy from erlang console as opposite to calling it via defined module: > ... > > Both functions are local but only the one defined directly in console had > environment. > > > Many Thanks in advance for any help on this., code in shell is interpreted directly from abstract syntax tree using erl_eval code written in erlang, code in module is compiled to bytecode and then executed using fast bytecode interpretation inside of Erlang VM which is is written in C. This is the main difference. -- Witold Baryluk -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: To jest cz??? wiadomo?ci podpisana cyfrowo URL: From alexander.uvarov@REDACTED Mon Aug 31 18:25:50 2009 From: alexander.uvarov@REDACTED (Alexander Uvarov) Date: Mon, 31 Aug 2009 22:25:50 +0600 Subject: Efficient way to select a range of data between 2 values? Message-ID: I have ~100K ip2country records like {ip_address_map, {range_from, range_to, country_code}} and I am searching for fastest way to lookup country_code. There should be matching guard like range_from =< IP >= range_to. Any ideas, guys? I am not satisfied with ets (lookup time from 0.06s up to 1.6s). This is my current code (original http://code.google.com/p/ip2country-erlang/source/browse/trunk/ip2country.erl) : -record(ip_address_map, {range_from, range_to, country_code}). start() -> ets:new(ip, [named_table, public, {keypos, 2}]). lookup(IP) -> MatchHead = #ip_address_map{range_from='$1', range_to='$2', country_code='$3'}, Guard = [{'=<', '$1', IP}, {'>=', '$2', IP}], Result = '$3', ets:select(ip, [{MatchHead, Guard, [Result]}], 1). From rapsey@REDACTED Mon Aug 31 18:35:00 2009 From: rapsey@REDACTED (Rapsey) Date: Mon, 31 Aug 2009 18:35:00 +0200 Subject: [erlang-questions] Efficient way to select a range of data between 2 values? In-Reply-To: References: Message-ID: <97619b170908310935q4a90bb7ag644e68dcfd33d604@mail.gmail.com> This is a copy/paste from some programming forum (it was my post): GeoIP with Erlang You want to know what country your users are coming from? Download the DB in CSV format from: http://www.maxmind.com/app/geolitecountry The file is about 7.8MB in size and one line in the file looks like this: "4.20.73.32","4.23.128.183","68438304","68649143","US","United States" Whats what should be obvious. Lets turn this into something a bit more useful, a list of tuples: {IntMin, IntMax, CountryCode}. Speed is of no importance because you only do this once. code: {ok, File} = file:read_file(Filename), Lines = string:tokens(binary_to_list(File), "\n"), Ranges = lists:map(fun(Line) -> [_, _, MinStr, MaxStr, Country|_] = string:tokens(Line, ",\""), {list_to_integer(MinStr), list_to_integer(MaxStr), list_to_binary(Country)} end, Lines), Sorted = lists:keysort(1, Ranges) Sorted now holds a sorted list of tuples that represent IP ranges, from lowest IP range to highest. If we were stupid we could end it here and loop this list for every user, to find out where he is coming from. A tree structure makes a bit more sense though. So lets turn this list into a tree. Put the result of the last function into this one. cons_tree([]) -> undefined; cons_tree(L) -> {Left, Right} = lists:split(round(length(L)/2), L), [{Min, Max, Country}|LeftSide] = lists:reverse(Left), {Min, Max, Country, cons_tree(lists:reverse(LeftSide)), cons_tree(Right)}. And now we have a tree of tuples: {IntMin, IntMax, CountryCode, SmallerRanges, LargerRanges}. All we need now is a way to find the country code by IP: find_key({Min, Max, Country, _Left, _Right}, IP) when IP > Min, IP < Max -> Country; find_key({_Min, Max, _Country, _Left, Right}, IP) when IP >= Max -> find_key(Right, IP); find_key({Min, _Max, _Country, Left, _Right}, IP) when IP =< Min -> find_key(Left, IP); find_key(undefined, _) -> false. All we need now is to test how fast it is. Loop takes in number of iterations and the previously constructed tuple tree. loop(N, Ranges) -> io:format("~p~n", [now()]), quer(N, Ranges), io:format("~p~n", [now()]). quer(0, L) -> L; quer(N, L) -> find_key(L, random:uniform(4294967296)), quer(N-1, L). Result for 100k: geoip:loop(100000, T). {1235,667762,860389} {1235,667763,299972} About half a second. Pretty good no? Sergej On Mon, Aug 31, 2009 at 6:25 PM, Alexander Uvarov < alexander.uvarov@REDACTED> wrote: > I have ~100K ip2country records like {ip_address_map, {range_from, > range_to, country_code}} and I am searching for fastest way to lookup > country_code. There should be matching guard like range_from =< IP >= > range_to. Any ideas, guys? I am not satisfied with ets (lookup time from > 0.06s up to 1.6s). > > This is my current code (original > http://code.google.com/p/ip2country-erlang/source/browse/trunk/ip2country.erl > ): > > -record(ip_address_map, {range_from, range_to, country_code}). > > start() -> > ets:new(ip, [named_table, public, {keypos, 2}]). > > lookup(IP) -> > MatchHead = #ip_address_map{range_from='$1', range_to='$2', > country_code='$3'}, > Guard = [{'=<', '$1', IP}, {'>=', '$2', IP}], > Result = '$3', > ets:select(ip, [{MatchHead, Guard, [Result]}], 1). > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From hpjcon@REDACTED Mon Aug 31 16:44:21 2009 From: hpjcon@REDACTED (Jan Jacobs) Date: Mon, 31 Aug 2009 16:44:21 +0200 Subject: Duplicate substr and sub_string in string library. Message-ID: <4A9BE1C5.8010401@mweb.co.za> Hi, In the string library, is there a reason for the duplication of substr and sub_string? This is in both R13B01 and R12B5. Thanks Jan From paul-trapexit@REDACTED Mon Aug 31 18:43:29 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Mon, 31 Aug 2009 09:43:29 -0700 (PDT) Subject: [erlang-questions] Use Mnesia backup on other machines In-Reply-To: References: Message-ID: Inline. -- p On Sun, 30 Aug 2009, ngocdaothanh wrote: > Hi everyone, > > I would like to ask about Mnesia backup: > 1. How to periodically create backup of Mnesia DB of a node? You can have a gen_server which uses timer:send_interval/2 combined with handle_info/2 to trigger the backups. You can back up everything with mnesia:backup/1. In case the backup takes a very long time you should twiddle something in the gen_server state to prevent starting a new backup while an old one is happening. > 2. How do to copy backup files to other machines and use them there? Is this about the actual file movement, or about whether a mnesia backup done on cluster A can be restored on cluster B? On EC2, I store the backups on S3 via s3fs, then use mnesia:restore/2 when I want to restore the backup. I haven't tried to restore a backup on a cluster when all the node names have changed from when the backup was performed. -- p From paul-trapexit@REDACTED Mon Aug 31 18:49:21 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Mon, 31 Aug 2009 09:49:21 -0700 (PDT) Subject: [erlang-questions] Efficient way to select a range of data between 2 values? In-Reply-To: References: Message-ID: On Mon, 31 Aug 2009, Alexander Uvarov wrote: > I have ~100K ip2country records like {ip_address_map, {range_from, > range_to, country_code}} and I am searching for fastest way to lookup > country_code. There should be matching guard like range_from =< IP >= > range_to. Any ideas, guys? I am not satisfied with ets (lookup time > from 0.06s up to 1.6s). > > This is my current code (original http://code.google.com/p/ip2country-erlang/source/browse/trunk/ip2country.erl) > : > > -record(ip_address_map, {range_from, range_to, country_code}). > > start() -> > ets:new(ip, [named_table, public, {keypos, 2}]). > > lookup(IP) -> > MatchHead = #ip_address_map{range_from='$1', range_to='$2', > country_code='$3'}, > Guard = [{'=<', '$1', IP}, {'>=', '$2', IP}], > Result = '$3', > ets:select(ip, [{MatchHead, Guard, [Result]}], 1). Step 1 would be to make the ets table ordered_set type. Ideally, that would be sufficient, but as I discovered, ets does not optimize the inequality constraint in a match guard: http://dukesoferl.blogspot.com/2009/07/ets-ordered-set-select-efficiency.html However all is not lost, since you can iterate through the ets table using ets:next/2. This is less efficient than select when select is optimized, but can be a win in this case, especially if the number of elements to be examined is much less than the total number in the table. Since you say {'=<','$1',IP} you need to do an initial lookup of the lower bound to get the equality, but if the problem is {'<', '$1', IP} you don't even need to do that since the Key argument to ets:next/2 in an ordered_set table need not be a member of the table. -- p > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From paul-trapexit@REDACTED Mon Aug 31 19:00:13 2009 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Mon, 31 Aug 2009 10:00:13 -0700 (PDT) Subject: [erlang-questions] Efficient way to select a range of data between 2 values? In-Reply-To: References: Message-ID: On Mon, 31 Aug 2009, Paul Mineiro wrote: > > MatchHead = #ip_address_map{range_from='$1', range_to='$2', > > country_code='$3'}, > > Guard = [{'=<', '$1', IP}, {'>=', '$2', IP}], > > Result = '$3', > > ets:select(ip, [{MatchHead, Guard, [Result]}], 1). ... > Since you say {'=<','$1',IP} you need to do an initial lookup of the lower > bound to get the equality, but if the problem is {'<', '$1', IP} you don't > even need to do that since the Key argument to ets:next/2 in an > ordered_set table need not be a member of the table. Whoops ... used the wrong guard there in the text. Replace {'=<','$1',IP } with {'>=','$2',IP }, and {'<','$1',IP } with {'>','$2',IP }. Basically, just remember to do a ets:lookup (ip, LOWER_BOUND) to get records that exactly match the lower bound, and otherwise do ets:next (ip, Key) initially with Key = LOWER_BOUND and repeat until the Key1 returned by ets:next/2 exceeds UPPER_BOUND. Also do timing tests, because for this approach to make sense, the number of records iterated over has to be small enough, because there's alot of overhead in the repeated ets:next/2 calls. -- p p.z. you could always try tcerl, which optimizes this kind of select. however the constant factors are much worse than ets. Since your table size is so small (100K entries), I'm thinking you should look into in-memory based solutions. From rtrlists@REDACTED Mon Aug 31 19:34:47 2009 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 31 Aug 2009 18:34:47 +0100 Subject: [erlang-questions] Use Mnesia backup on other machines In-Reply-To: References: Message-ID: <6a3ae47e0908311034h59390e5rd4e5cf0dd5c89c62@mail.gmail.com> On Mon, Aug 31, 2009 at 5:43 PM, Paul Mineiro wrote: > Inline. > > -- p > > On Sun, 30 Aug 2009, ngocdaothanh wrote: > > > Hi everyone, > > > > I would like to ask about Mnesia backup: > > 1. How to periodically create backup of Mnesia DB of a node? > > You can have a gen_server which uses timer:send_interval/2 combined with > handle_info/2 to trigger the backups. You can back up everything with > mnesia:backup/1. In case the backup takes a very long time you should > twiddle something in the gen_server state to prevent starting a new backup > while an old one is happening. > > No need for the timer though, just use the gen_server's own timeout return value. Combine this with calculating a timeout value using the until_next_time() function from crone and you can have nicely scheduled backups. Minimal, untested and not even compiled example, started with something like mybackup:start_link("DB.BAK", {daily, {every, {1, hr}, {between, {12, 0, 0, am}, {11, 59, 59, pm}}}}) . -module(mybackup). -behaviour(gen_server). -export([start_link/2, init/1, handle_info/2]). start_link(Backup_File, Backup_When) -> gen_server:start_link({local, ?MODULE}, ?MODULE, [Backup_File, Backup_When], []). init([Backup_File, Backup_When]) -> {ok, {Backup_File, Backup_When}, 1000*crone:until_next_time(Backup_When)}. handle_info(timeout, {Backup_File, Backup_When} = State) -> mnesia:backup(Backup_File), % HACK: Just in case it took less than a second, make sure we don't do it again right away. timer:sleep(1000), {noreply, State, 1000*crone:until_next_time(Backup_When)}. Robby From rvirding@REDACTED Mon Aug 31 21:08:08 2009 From: rvirding@REDACTED (Robert Virding) Date: Mon, 31 Aug 2009 21:08:08 +0200 Subject: [erlang-questions] Duplicate substr and sub_string in string library. In-Reply-To: <4A9BE1C5.8010401@mweb.co.za> References: <4A9BE1C5.8010401@mweb.co.za> Message-ID: <3dbc6d1c0908311208qe0e5cbaxfa01e9d713c48fcb@mail.gmail.com> The string library is a combination of two earlier libraries and all functions from both were kept. This happened a *long* time ago. There is a note about it at the end of the documentation. Robert 2009/8/31 Jan Jacobs > Hi, > > In the string library, is there a reason for the duplication of substr and > sub_string? > > This is in both R13B01 and R12B5. > > Thanks > Jan > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From hpjcon@REDACTED Mon Aug 31 21:20:14 2009 From: hpjcon@REDACTED (Jan Jacobs) Date: Mon, 31 Aug 2009 21:20:14 +0200 Subject: [erlang-questions] Duplicate substr and sub_string in string library. In-Reply-To: <3dbc6d1c0908311208qe0e5cbaxfa01e9d713c48fcb@mail.gmail.com> References: <4A9BE1C5.8010401@mweb.co.za> <3dbc6d1c0908311208qe0e5cbaxfa01e9d713c48fcb@mail.gmail.com> Message-ID: <4A9C226E.5080409@mweb.co.za> Cool Thanks. Jan Robert Virding wrote: > The string library is a combination of two earlier libraries and all > functions from both were kept. This happened a *long* time ago. There is a > note about it at the end of the documentation. > > Robert > > 2009/8/31 Jan Jacobs > > >> Hi, >> >> In the string library, is there a reason for the duplication of substr and >> sub_string? >> >> This is in both R13B01 and R12B5. >> >> Thanks >> Jan >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.409 / Virus Database: 270.13.72/2337 - Release Date: 08/31/09 05:50:00 > >