From ok@REDACTED Thu Apr 1 03:18:38 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 1 Apr 2004 13:18:38 +1200 (NZST) Subject: user-defined operators Message-ID: <200404010118.i311Icqu497178@atlas.otago.ac.nz> I am now totally baffled: Samuel Rivas wrote: 1 > As you stress, a symbol that can represent different 1 > operations in different contexts is said to be "overloaded". + 1 > ++ and * are DIFFERENT operations, your definition says nothing 1 > about using the same function name to indicate those operations. I replied: 2 > Nor does it say anything about the Arian controversy, bimetallism, or the 2 > interpretation of quantum mechanics. Why should one little definition have 2 > to deal with quite irrelevant matters? Now Samuel Rivas has replied to that: 3 > It should deal with function names if you want it to justify your 3 > assertion: 3 > 3 > By the definition I use, a symbol which is bound to a single 3 > definition is not overloaded, no matter how many types that definition 3 > applies to. I am really confused by this. My assertion is "The definition of overloading I use is '...'." That's a fact about me. How could my definition of "the particular kind of user-defined operator I propose for Erlang" have any possible relevance to that? The definition of overloading I use just *IS* "a symbol (whether operator symbol of function symbol) is overloaded if and only if it is bound to more than one operation definition". The only way anyone could challenge that is by watching my behaviour for a couple of weeks and seeing whether I really do use "overloaded" that way. By that definition, C++ and Java have overloaded symbols (Java has system-defined and user-defined overloaded method symbols and system- defined but not user-defined operator symbols) and Haskell and Erlang do not. They just don't. It really is beyond debate that *by THAT definition*, they really don't. I don't have to justify this; anyone who doesn't believe it can check for themselves. I'm not proposing to change that. In this thread, I have nothing new to say about Erlang functions. It is quite unreasonable for someone to demand that my proposal for user-defined operators should say something about function names when I have already said over and over and over that I have nothing new to say about them. > In Erlang, +, ++, and * are bound to different definitions. > There is no proposal in this or any other thread to change that. Where did I write there is a proposal to change these operators? When you said that introducing user-defined operators would mean that you didn't know what operators (and you specifically mentioned + ++ *) meant any more. > Erlang *already* permits the definition of a function which sometimes > calls one, sometimes calls the other, of those operations. That function > is nevertheless itself still ONE "operation". So, is your f(X,Y) when integer(X) ... overloaded or not? In your previous mail you said that is a *single* definition, which necessarily lead us to the fact that an operator bound to f is not overloaded. How many times do I have to say it? f/2 in that example has ONE definition. It is a CONFUSING function but not an OVERLOADED function. Erlang simply doesn't have any mechanism for overloading functions. Therefore an operator `f` referring to f can no more be overloaded than f can. > People seem to be arguing against user-defined operators on the grounds that > operators have some kind of unique sacred character that makes them different > from functions. But in EXISTING Erlang this is not so. Agreed, that is not the point. If it isn't the point, what the h*** WAS your point? Erlang *with* user-defined operators will not have any problems that Erlang *without* user-defined operators does not have right now. If you agree with me, then you have no argument against user-defined operators. If you don't, then that *IS* precisely the point. > Currently you can have confusing functions, but the set of > operators is well defined and (more or less) widely accepted (I > really don't like the ++ operator since it's just the same as > lists:concatenate and you have to know it because of > optimisation issues). > > I don't know what is meant by "widely accepted" here. It is, of course, This is meant everybody can assume +, *, ++, /, !, ... will do what are supposed to do. AND THEY STILL CAN. I am not trying to say introducing user defined operators will change the meaning of these built-in operators but that you can find one operator that is not "universal" (and I trying to argue in favour of this will be not a good thing) Do you mean "CAN find" or "CAN'T find"? And what do you mean by "universal"? I am really having great trouble understanding this paragraph. > accepted that the set of Erlang operators is what it is; since the > language was first defined there can hardly ever have been a single day > when it was widely accepted that it was what it should be. Right at the > moment, Joe Armstrong has a proposal for an additional operator, !!, > which is *not* well defined, Perhaps "well defined" is not a good description. I meant "well known". In that case, so what? The proposal for user-defined operators does not change the set of "well known" operators in any what whatsoever. > Anyone who wants to pretend that + and * in Erlang do one and only one > thing is living in fantasy land. And you cannot use Erlang for long > without discovering that X!Y does different things depending on what X is. > (Related things, yes. The same things, no.) I still don't know where I wrote that. It is a reasonable inference from what you wrote: (A) You were attacking user-defined operators as bad. (B) Specifically, you were attacking them on the grounds of "overloading". (C) You implied that the existing set of operators was OK. But if acting differently for different argument types is bad, and any existing operators act differently for different argument types,' then the existing set of operators (leaving aside ++ which you said you didn't like, although oddly enough ++ and -- do NOT have this property) cannot be good. > "functions are bound to programmers skills"? I can make no sense of this. > Perhaps that proves your point, whatever it is. When you are reading a program written by someone you can't assume all functions do what you suppose them to do. Well, no. You as reader have a responsibility to read the internal documentation. So what? WHY SHOULD OPERATORS BE EXEMPT FROM THAT RULE? It is programmer responsibility to write his functions right. However you can assume what operators will do if the set of operators is defined by the language. You should imagine me pounding the keyboard and screaming in frustration here. (1) When you are reading a program in any programming language, you cannot assume that all operators do what you suppose them to do. (For example, the arithmetic operations in Erlang do *not* treat floating-point numbers in a way that I regard as tolerable, let alone reasonable. This came as a rather nasty surprise). You have the *SAME* obligation to read the documentation of built-in operators that you have for any other kind of symbol. (2) Built-in operators are in NO WAY different from built-in function symbols. When I'm using in C, I have the *same* (I really do mean, according to the standardisers, *exactly* the same) right to trust the behaviour of pow() as I have to trust the behaviour of *, the fact that one is written in parenthesis-call form and the other in operator form is WHOLLY IRRELEVANT. And I have the same obligation to read the documentation. (3) This applies quite generally. The things I have a right to trust are the BUILT-IN things, not the things that are invoked via some particular synyax. I have the SAME right to trust aString.length() in Java that I have to trust aString+aString; both are equally built-in. In Erlang, it isn't just the built-in OPERATORS that you get to use and trust, it's the built-in FUNCTIONS as well. There is no meaningful difference between ++ and length/1 here. The distinction you are making between operators and functions is not in fact the relevant distinction. (4) What is relevant? Well, we can split operations into several groups in several ways. {language-defined, in standard library, from others' code, own} x {familiar, unfamiliar} x {conforms to documentation, sort of does, doesn't} You are implying that if an operator is in the language definition, it is familiar and conforms to its documentation. Neither of these is necessarily true: Erlang has acquired several more operators since the Erlang book was published, so even an experienced Erlang programmer could find them unfamiliar, and there can be bugs anywhere. (For example, I once had to work around a C compiler which implemented <= as >= for unsigned integers. Strictly speaking, the compiler got it right, the assembler was the real culprit.) You are also implying that if a symbol is NOT a language-defined operator, then it isn't familiar and correct. If that implication does not hold, you have no argument. But it doesn't hold. printf() is not an operator in C, but there can be few C programmers who aren't familiar with it. length() is not an operator in Erlang, but there can be few Erlang programmers who are not familiar with it. An Erlang programmer should become very nearly as familiar with the functions in Erlang's stdlib as with the built-in operators. For reading, what counts is (i) Can I tell what the operation *is*? (legibility) (ii) Do I know what it means? (familiarity) (iii) If I don't, how hard is it to find out? (accessibility of docs) (iv) Does it actually do what it's supposed to? (correctness) Familiarity is the key here, not the form of syntax used. You can think reading an unknown operator is like reading an unknown function. I will not argue against that, it is only a personal point of view. I only want to point that, up to this moment, opening the set of operators will add more complexity to source code reading, and that can be worth doing it on not. (5) In the proposal we are discussing, it is COMPLETELY OBVIOUS which operators are built in (they don't have backquotes) and which are not (they do). Reading a use of an unknown operator really IS like reading a call of an unknown function, because it obviously ***IS*** a function call. If you "will not argue against that", then you have no grounds whatsoever, I really mean *NONE*, for your claim that this will add complexity to source code reading. In the presence of user-defined operators: anything that looks like a built-in operator has to *be* a built-in operator and is no less readable, anything with backquotes around it has to be a function call and is no less readable than any other function call (more so, in many cases). > Do you *REALLY* think that > > is_element(X, S) union(S1, S2) del_element(X, S) match(X, P) > > are better than > > X `in` S S1 `union` S2 S `without` X X `matches` P If they are not better they are, at least, the same. The () forms are quite clearly WORSE. We could argue about the better match for mathematical notation, we could argue about whether it is better for the words to be in the order that you would really like to say them, but it is not a matter of opinion that the operator forms have one great virtue for decoding: you don't have to count the commas. In C or Lisp or Haskell, you don't have to count arguments to figure out which function is involved; a function name consists solely of an identifier. But in Erlang it is not so. An Erlang function name consists of an identifier and an arity. To determine which function is involved in a call, you have to count the commas and add one. f(A,B) and f(A,B,C) call unrelated functions. When you see A `f` B, it can't possibly be a call to f/3. Languages are designed with a certain operator precedence to avoid the ambiguity, because infix notation IS ambiguous. Ah, now I understand your form of argument. Every man is a cripple, because if he didn't have his legs, he would be a cripple. Every system of infix operators is ambiguous, because if it didn't have its system of precedence, it would be ambiguous. This is a particularly dishonest way to attack user-defined operators, because in fact the proposal under consideration ISN'T ambiguous; for any given construct containing user-defined operators, there is only one possible way they can be read. Note, by the way, that it is entirely possible to have a notational system in which there are infix operators, but absolutely no ambiguity, even in the absence of any precedence. Anyone who wants to argue about notational engineering should be familiar with such systems. Yes, yes, my question was about the real meaning of / Who knows what the real meaning of / is? I was there responding to a claim about the operators taught in school, and at least in my generation, / was NOT the operator used for division in school. > I'm old enough to remember when 2/6 was half a crown, > feature of PL/I.) Oh! What function is supposed to be / then? (just curious, again) It's a punctuation mark: pounds/shillings/pence day/month/year I'm trying to set out my view, you can think I am a scaremonger if you want. For me I'll keep thinking it's only I don't agree with you like you don't agree with me. You are saying that user-defined operators will make things bad. You have no sound arguments for it, and you have no empirical evidence for it. That's scaremongering. I _have_ empirical evidence (Haskell and Prolog experience) that it doesn't make things bad, and sound arguments that it _can't_ make things worse. That's more than just disagreement. It may be that the majority of Erlang programmers have some kind of visual defect (or, more plausibly, horribly bad fonts) which will make it impossible for them to read tokens containing backquotes. It may be that their primary school teachers programmed them to get confused when they see backquotes (I see the fnords!). It may be that Erlang programmers just aren't as intelligent as Prolog or Haskell or Algol 68 programmers. So it's possible that empirical evidence could be found discrediting `operators`. But I have a high opinion of Erlang programmers and of primary school teachers. From valentin@REDACTED Thu Apr 1 08:24:07 2004 From: valentin@REDACTED (Valentin) Date: Thu, 1 Apr 2004 08:24:07 +0200 Subject: user-defined operators References: <200404010118.i311Icqu497178@atlas.otago.ac.nz> Message-ID: <015c01c417b1$f17651d0$0100a8c0@MONEYMAKER2> Insulting other people is saying even less about Arain controversy... let's put our over-inflated egos aside and go back to the reasons as to why would Erlang need ability to support user-defined operators. Personally, I think that user-defined-anything is not such a great idea, because inherently leads to more difficulties in understanding other people code, and ability to do this *fast* is a very important thing if you want to sustain a product/system/whatever beyond two months. On the other hand, I like to keep my mind open...but, cynicism does not sell good ideas. Valentin. PS Arian controversy is not realy a controversy... it is much easear to understand it than, say, holy trinity. ----- Original Message ----- From: "Richard A. O'Keefe" To: Sent: Thursday, April 01, 2004 3:18 AM Subject: Re: user-defined operators > 2 > Nor does it say anything about the Arian controversy, bimetallism, or the > 2 > interpretation of quantum mechanics. Why should one little definition have > 2 > to deal with quite irrelevant matters? > From vlad_dumitrescu@REDACTED Thu Apr 1 09:04:48 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 1 Apr 2004 09:04:48 +0200 Subject: user-defined operators References: <200404010118.i311Icqu497178@atlas.otago.ac.nz> <015c01c417b1$f17651d0$0100a8c0@MONEYMAKER2> Message-ID: From: "Valentin" > Personally, I think that user-defined-anything is not such a great idea, > because inherently leads to more difficulties in understanding other people > code, and ability to do this *fast* is a very important thing if you want to > sustain a product/system/whatever beyond two months. On the other hand, I > like to keep my mind open... Hi, I'd like to say that I used to think the same. Nowadays, I'm no longer that sure. The reason is that user-defined-stuff is just a tool, and it can be used or abused. In the former case, it can be very useful. I think the most useful thing that can be done with user-defined-stuff is to increase the level of abstraction. If (for example) I can design a banking system by reasoning about payments instead of tuples and lists that contain payment related data, then I think it is much easier to get a better system (not last because it's easier to involve non-developers that know the problem domain). Using user-defined-stuff to just increase the level of confusion is of course not good. ;-) regards, Vlad From samuel@REDACTED Thu Apr 1 10:42:37 2004 From: samuel@REDACTED (Samuel Rivas) Date: Thu, 1 Apr 2004 10:42:37 +0200 Subject: user-defined operators In-Reply-To: <200404010118.i311Icqu497178@atlas.otago.ac.nz> References: <200404010118.i311Icqu497178@atlas.otago.ac.nz> Message-ID: <20040401084237.GA28378@crusher.lfcia.pri> Richard A. O'Keefe wrote: > I am really confused by this. > By that definition, C++ and Java have overloaded symbols [...] > and Haskell and Erlang do not. They just don't. It really is beyond debate > that *by THAT definition*, they really don't. I don't have to justify this; > anyone who doesn't believe it can check for themselves. This can be your opinion, but is not beyond debate: "There is one final feature of Haskell's type system that sets it apart from other programming languages. The kind of polymorphism that we have talked about so far is commonly called parametric polymorphism. There is another kind called ad hoc polymorphism, better known as overloading" From: http://www.haskell.org/tutorial/classes.html [...] > > In Erlang, +, ++, and * are bound to different definitions. > > There is no proposal in this or any other thread to change that. > > Where did I write there is a proposal to change these operators? > > When you said that introducing user-defined operators would mean that > you didn't know what operators (and you specifically mentioned + ++ *) > meant any more. I haven't wrote that. I haven't say you will lose your knowledge about built-in operators. And I only mentioned those (+ ++ *) operators to say they are different operators. > Erlang *already* permits the definition of a function which sometimes > calls one, sometimes calls the other, of those operations. That function > is nevertheless itself still ONE "operation". [...] > f/2 in that example has ONE definition. > It is a CONFUSING function but not an OVERLOADED function. > Erlang simply doesn't have any mechanism for overloading functions. f/2 is NOT ONE operation (so it must be several) and f/2 has ONE definition. *Your* definition (p334 of a famous compiler textbook) says that symbol is overloaded. This discussion about overloading is beyond of "user-defined operators" and I won't continue it. [...] > > Anyone who wants to pretend that + and * in Erlang do one and only one > > thing is living in fantasy land. And you cannot use Erlang for long > > without discovering that X!Y does different things depending on what X is. > > (Related things, yes. The same things, no.) > > I still don't know where I wrote that. > > It is a reasonable inference from what you wrote: > (A) You were attacking user-defined operators as bad. > (B) Specifically, you were attacking them on the grounds of "overloading". > (C) You implied that the existing set of operators was OK. > But if acting differently for different argument types is bad, > and any existing operators act differently for different argument types,' > then the existing set of operators (leaving aside ++ which you said you > didn't like, although oddly enough ++ and -- do NOT have this property) > cannot be good. 1) I don't attack user defined operators on the grounds of "overloading", I wrote that OPERATORS (in general) overloading is confusing. I know Erlang operators are overloaded and I know they do not the same thing in different contexts. And I wrote that in a mail that is not related to this subthread and I don't know how you have infered I said user-defined operators are bad because of overloading. 2) I can't see why a) + c) (even + b what I said that is not correct) comes to the conclusion that + and * do only one thing. > [...] > > Do you *REALLY* think that > > > > is_element(X, S) union(S1, S2) del_element(X, S) match(X, P) > > > > are better than > > > > X `in` S S1 `union` S2 S `without` X X `matches` P > > If they are not better they are, at least, the same. > > The () forms are quite clearly WORSE. > we could argue about whether it is better for the words to be in > the order that you would really like to say them, > but it is not a matter of opinion that the operator forms have one > great virtue for decoding: you don't have to count the commas. [...] > When you see A `f` B, it can't possibly be a call to f/3. I don't see how you can confuse f(A,B) with f(A,B,C). > Languages are designed with a certain operator precedence to avoid the > ambiguity, because infix notation IS ambiguous. > > Ah, now I understand your form of argument. > Every man is a cripple, because if he didn't have his legs, he would > be a cripple. > Every system of infix operators is ambiguous, because if it didn't > have its system of precedence, it would be ambiguous. I didn't write "infix systems are ambiguous". I wrote "infix notation is ambiguous". In short: - I didn't say user defined operators are worse than functions. - I didn't say user defined operators are bad because of overloading. - I didn't say built in operators will lose their meaning. - I said user defined operators (in my opinion) are not more readable than functions. - I say that there is a clear difference between operators and functions (in Erlang): function names set is infinite and operators set is not. It is not true operators and functions are the same (at the moment). -- --------------------- | Samuel | --------------------- From ft@REDACTED Thu Apr 1 11:35:01 2004 From: ft@REDACTED (Fredrik Thulin) Date: Thu, 1 Apr 2004 11:35:01 +0200 Subject: inet6 support in inet:getaddr() Message-ID: <200404011134.51553.ft@it.su.se> Hi I've managed to get IPv6 support working in the Erlang SIP-server/stack called Yxa (http://www.stacken.kth.se/projekt/yxa/). To my delight, I found out that inet:getaddr() does handle inet6 (I'm using R9C-0) even though the documentation says is doesn't ;) My question is, will this be the way to do it or am I better off implementing my own DNS resolver functionality to obtain IPv6 as well as IPv4 addresses? I might have to do that anyways since I want to obtain all addresses for a hostname, not just the first one. Thanks, /Fredrik From luke@REDACTED Thu Apr 1 11:56:55 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 01 Apr 2004 11:56:55 +0200 Subject: dbg_iload:guard_test/1 patch Message-ID: Ahoy, The patch below adds support for two types of guards in the debugger's Erlang interpreter: Var not It just translates them into: Var == true /= true These seem to be new features added to Erlang but not this interpreter. If you use these guards in your programs and you have seen Distel blowing up when you interpret your modules, I recommend applying this in lib/debugger/src/ :-) P.S., is there any technical reason not to rewrite the Erlang interpreters in the debugger and/or shell to interpret Core Erlang instead? -------------- next part -------------- A non-text attachment was scrubbed... Name: dbg_iload.patch Type: text/x-patch Size: 734 bytes Desc: guard_test/1 fix URL: From dgud@REDACTED Thu Apr 1 12:11:16 2004 From: dgud@REDACTED (Dan Gudmundsson) Date: Thu, 1 Apr 2004 12:11:16 +0200 Subject: dbg_iload:guard_test/1 patch In-Reply-To: References: Message-ID: <16491.60100.689441.977955@rian.du.uab.ericsson.se> I have already fixed that, along with a long list of other bugs. It will be available in next erlang release. Cheers /Dan Luke Gorrie writes: > Ahoy, > > The patch below adds support for two types of guards in the > debugger's Erlang interpreter: > > Var > not > > It just translates them into: > > Var == true > /= true > > These seem to be new features added to Erlang but not this > interpreter. > > If you use these guards in your programs and you have seen Distel > blowing up when you interpret your modules, I recommend applying this > in lib/debugger/src/ :-) > > P.S., is there any technical reason not to rewrite the Erlang > interpreters in the debugger and/or shell to interpret Core Erlang > instead? > > --- dbg_iload.erl.~1.1.1.5.~ 2003-09-02 15:34:28.000000000 +0200 > +++ dbg_iload.erl 2004-04-01 11:29:01.000000000 +0200 > @@ -243,6 +243,8 @@ > error -> > {safe_bif,Line,erlang,F,As} > end; > +guard_test({op,Line,'not',L0}) -> > + guard_test({op,Line,'/=',L0,{atom,Line,true}}); > guard_test({op,Line,Op,L0}) -> > true = erl_internal:arith_op(Op, 1), %Assertion. > L1 = gexpr(L0), > @@ -258,7 +260,8 @@ > guard_test({char,_,_}=C) -> C; > guard_test({float,_,_}=F) -> F; > guard_test({atom,_,_}=A) -> A; > -guard_test({nil,_}=N) -> N. > +guard_test({nil,_}=N) -> N; > +guard_test({var,Line,_}=V) -> guard_test({op,Line,'==',V,{atom,Line,true}}). > > map_guard_bif(integer, 1) -> {ok,is_integer}; > map_guard_bif(float, 1) -> {ok,is_float}; -- Dan Gudmundsson Project: Mnesia, Erlang/OTP Ericsson Utvecklings AB Phone: +46 8 727 5762 UAB/F/P Mobile: +46 70 519 9469 S-125 25 Stockholm Visit addr: Armborstv 1 From richardc@REDACTED Thu Apr 1 12:54:45 2004 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 1 Apr 2004 12:54:45 +0200 (MEST) Subject: interpreting Core Erlang In-Reply-To: References: Message-ID: On Thu, 1 Apr 2004, Luke Gorrie wrote: > P.S., is there any technical reason not to rewrite the Erlang > interpreters in the debugger and/or shell to interpret Core Erlang > instead? In the debugger, the main reasons are that 1) it's easier to map a program point to the original sources if you are more or less already interpreting the original sources* - the Core code is harder to follow, and 2) if you'd make the effort to rewrite the debugger, it would be better to have it work directly on Beam code, with mappings from program points to source code lines, etc. In the shell, you'd still have to go through pretty much the same motions anyway in order to first translate the code to Core Erlang and then interpret that. So it doesn't really make anything simpler. /Richard *) For those of you who did not know this, the debugging info actually includes the syntax tree for the whole module (after preprocessing, expansion of record-syntax, and some other small things). Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From luke@REDACTED Thu Apr 1 13:03:59 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 01 Apr 2004 13:03:59 +0200 Subject: interpreting Core Erlang In-Reply-To: (Richard Carlsson's message of "Thu, 1 Apr 2004 12:54:45 +0200 (MEST)") References: Message-ID: Richard Carlsson writes: > if you'd make the effort to rewrite the debugger, it would be better > to have it work directly on Beam code, with mappings from program > points to source code lines, etc. And Beam code doesn't include any mapping information like that today, right? > In the shell, you'd still have to go through pretty much the same > motions anyway in order to first translate the code to Core Erlang and > then interpret that. So it doesn't really make anything simpler. Could you use the first few passes of the compiler for this? I suppose that Erlang doesn't change so much for this to be worth the effort though.. not to mention that Core Erlang can change too. -Luke From richardc@REDACTED Thu Apr 1 13:13:56 2004 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 1 Apr 2004 13:13:56 +0200 (MEST) Subject: interpreting Core Erlang In-Reply-To: References: Message-ID: On Thu, 1 Apr 2004, Luke Gorrie wrote: > Richard Carlsson writes: > > > if you'd make the effort to rewrite the debugger, it would be better > > to have it work directly on Beam code, with mappings from program > > points to source code lines, etc. > > And Beam code doesn't include any mapping information like that today, > right? Nope. All line numbers are embedded in the debug-info syntax tree. > > In the shell, you'd still have to go through pretty much the same > > motions anyway in order to first translate the code to Core Erlang and > > then interpret that. So it doesn't really make anything simpler. > > Could you use the first few passes of the compiler for this? Yes. Though you might need to do some trickery if you want to translate a single function rather than a whole module at a time. /R Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From bjorn@REDACTED Thu Apr 1 14:19:50 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 01 Apr 2004 14:19:50 +0200 Subject: Bang bang operators Message-ID: There has been a suggestion to add a '!!' or bang bang operator to Erlang as syntatic sugar for rpc:call(). We will not make '!!' an official operator, as we think that if you add an operator it should do something completely new that you couldn't do before. To avoid breaking code for those that have hacked their parsers to add the '!!' operator, we have left '!!' alone and we will not re-define it. Instead we will add the following operators to a special patch release of R9C: '!!!', or the triple-bang operator: Sends an email using the SMTP protocol. Example: bjorn@REDACTED !!! <<"Body of mail here...">> The operator will return only when an answer mail has been received (and return the complete email message including all headers). Further mails received from the same user will automatically be sent to the calling processes as messages looking like: {'!!!',MailText} '!!!!', or the quad-bang operator: Same, but allow you send mail to all users that you have previously send mail to in a domain using the '!!!' operator. For instance: mec.com !!!! <<"Body of mail here...">> will send mail to any user you have previously mailed using the '!!!' operator (only in the current Erlang emulator, but from any process within it). Returns only when at least one reply email has been received. '!!!!!', or the spam-bang operator: Same, but the operator will attempt to find out email addresses from the given domain and send the mail to all of them. Methods for finding email addresses include but is not limited to: scanning all web pages found in the domain, bribing sys admins, scanning google search results, and the IBM memo. '!!!!!!', or the super-bang operator: Tries to send mail to all email addresses on the Internet. Returns as soon as one reply email has been received. Example: ipv4 !!!! <<"Body of mail here...">> Spams all hosts running the IP4 protocol. '!!!!!!!', or the super-spam-bang operator (unary): Attemps to send to all mail hosts on both IPv4 and IPv6, as well as all of X400 net, CompuServe etc etc. Another great feature is that a disclaimer similar to the one below will be included in all sent email messages. The release is scheduled for later today, April 1, 2004. The Big Bang Bang Workgroup at OTP - Bjorn/Patrik/DanG This communication is not for you if you can read, or if you don't work here, or if you mind messages written in Swenglish. Different rules may apply if you are a Legoland citizen working in any city above artic circle. Same at the first full moon after any eclipse occuring below the latitude of Stockholm. This communication can be dangerous to your sanity. We are not responsible for any consequeneces of reading this communication, even if we have legally warned before in writing in seven duplicates (one to burned, one to buried at midnight, one to be archived, and the rest to get lost at sea). This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you. E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof. From hakan@REDACTED Thu Apr 1 16:03:09 2004 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 1 Apr 2004 16:03:09 +0200 (MEST) Subject: Bang bang operators In-Reply-To: Message-ID: On 1 Apr 2004, Bjorn Gustavsson wrote: bjorn> Instead we will add the following operators to a special patch bjorn> release of R9C: Are they compatible with the good old Chitty Chitty Bang Bang operator? See the trailer at: http://www.imdb.com/title/tt0062803 /H?kan From bry@REDACTED Thu Apr 1 21:31:10 2004 From: bry@REDACTED (bry@REDACTED) Date: Thu, 1 Apr 2004 21:31:10 CET Subject: Why Sablotron? Message-ID: <200404012131150.SM01020@Debug> One of the things that always puzzled me was why sablotron.erl was made, it seems to me that a binding to libxsl would be better, faster, more feature rich, etc. Was just wondering if there was any particular reason why sablotron was chosen? From mikael.karlsson@REDACTED Thu Apr 1 21:43:03 2004 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Thu, 1 Apr 2004 21:43:03 +0200 Subject: Why Sablotron? In-Reply-To: <200404012131150.SM01020@Debug> References: <200404012131150.SM01020@Debug> Message-ID: <200404012143.03741.mikael.karlsson@creado.com> My guess is that at the time the binding was made sablotron was more mature than libxslt. But you don't have to bind at all with Erlang since Erlang in itself is better, faster and more feature rich than any XSLT implementation. OK more fun anyway :-) http://www.creado.com/xmerl_xs/index.html /Mikael fredag 02 april 2004 02:31 skrev bry@REDACTED: > One of the things that always puzzled me was > why sablotron.erl was made, it seems to me > that a binding to libxsl would be better, > faster, more feature rich, etc. > > Was just wondering if there was any > particular reason why sablotron was chosen? From d.love@REDACTED Thu Apr 1 23:35:34 2004 From: d.love@REDACTED (Dave Love) Date: Thu, 01 Apr 2004 22:35:34 +0100 Subject: user-defined operators References: <200404010118.i311Icqu497178@atlas.otago.ac.nz> <015c01c417b1$f17651d0$0100a8c0@MONEYMAKER2> Message-ID: "Valentin" writes: > Insulting other people is saying even less about Arain controversy... let's > put our over-inflated egos aside and go back to the reasons as to why would > Erlang need ability to support user-defined operators. That seems entirely backwards if it's directed at Richard O'Keefe, as it appears. I'm surprised to join a list and see such a bizarre response to the kind of clear, authoritative explanations of the relevant language topics I'd expect from him. > Personally, I think that user-defined-anything is not such a great > idea, User-defined functions aren't a good idea?? From d.love@REDACTED Thu Apr 1 23:48:20 2004 From: d.love@REDACTED (Dave Love) Date: Thu, 01 Apr 2004 22:48:20 +0100 Subject: Anybody done this References: Message-ID: Joe Armstrong writes: > 2) Stopping and starting Erlang. > > I'd like to say erlang:suspend(File) which would suspend Erlang > dumping the state into a file and later say erlang:resume(File) which > would re-start the suspended Erlang from *exactly* the state it was > in. Emacs' unexec does basically that, but (a) unexec is a maintenance nightmare, whatever rms says -- use mmapped data instead -- and (b) you're stuffed if you want state like network connexions to persist. (Unexec has actually been used in a few things other than Emacs.) From ok@REDACTED Fri Apr 2 01:24:23 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 2 Apr 2004 11:24:23 +1200 (NZST) Subject: user-defined operators Message-ID: <200404012324.i31NONIo007504@atlas.otago.ac.nz> I wrote: > f/2 in that example has ONE definition. > It is a CONFUSING function but not an OVERLOADED function. > Erlang simply doesn't have any mechanism for overloading functions. Samuel Rivas wrote: f/2 is NOT ONE operation (so it must be several) and f/2 has ONE definition. It has one definition, and therefore it CANNOT POSSIBLY be more than one operation. It's a function d--nit! *Your* definition (p334 of a famous compiler textbook) says that symbol is overloaded. No, it doesn't. By that definition, f/2 is NOT overloaded. 1) I don't attack user defined operators on the grounds of "overloading", I wrote that OPERATORS (in general) overloading is confusing. But the proposal we are discussing DOES NOT HAVE ANY OPERATOR OVERLOADING. I don't know how you have infered I said user-defined operators are bad because of overloading. You have just written that "OPERATORS (in general) overloading is confusing". And you don't why why I inferred that you think "user-defined operators are bad because of overloading"? > Ah, now I understand your form of argument. > Every man is a cripple, because if he didn't have his legs, he would > be a cripple. > Every system of infix operators is ambiguous, because if it didn't > have its system of precedence, it would be ambiguous. I didn't write "infix systems are ambiguous". I wrote "infix notation is ambiguous". I never said that you wrote "infix systems are ambigous". The term I wrote was "system of infix operators", and it was clearly my paraphrase. Any application of infix notation *is* a system of infix operators. - I didn't say user defined operators are worse than functions. Then what the h**l is the point of opposing them? - I didn't say user defined operators are bad because of overloading. But you DID say that they are overloaded and you DID say that overloaded operators are bad. - I didn't say built in operators will lose their meaning. But you DID say that people won't know what they mean any more. (Not in those exact words.) - I said user defined operators (in my opinion) are not more readable than functions. You are entitled to hold any opinion you wish; if you want others to share it, you should provide evidence. - I say that there is a clear difference between operators and functions (in Erlang): function names set is infinite and operators set is not. Well, gee, if I wasn't already taking that for granted, there would be no point in suggesting a change, would there? It is not true operators and functions are the same (at the moment). They are not identical. But it *is* true that many, if not most, Erlang operators have the same *properties* as functions. Computations which can be invoked using existing Erlang operators can also be invoked using existing Erlang function invocation techniques. The *semantic* properties of Erlang operators are identical to the *semantic* properties of built-in functions. And the things which I claimed to be the same are *user-defined* operators and user-defined functions, because uses of user-defined operators simply *are* uses of the corresponding user-defined functions. I should point out that the widely used statistics environment S (commercial version: S-Plus from Insightful, open source rival R from http://www.r-project.org) has also had weakest-precedence user-defined operators for a long time, with a very similar lexical structure to current proposal. For example, x %in% stuff is a membership test. While %in% uses the syntax for user-defined operators, it's actually built-in. The S language has run-time types, just as Erlang has. I'm on the R mailing list. It's very very active with lots of messages every day. Guess what? People ask about all SORTS of stuff in R, but one thing I've never seen anyone have any problems with is %operators%. The evidence is in: after decades of experience with user-defined operators in many programming languages, the programming language community has learned that user-defined operators are *not* a problem in practice. From gulias@REDACTED Fri Apr 2 09:32:04 2004 From: gulias@REDACTED (Victor M. Gulias) Date: 02 Apr 2004 09:32:04 +0200 Subject: Why Sablotron? In-Reply-To: <200404012143.03741.mikael.karlsson@creado.com> References: <200404012131150.SM01020@Debug> <200404012143.03741.mikael.karlsson@creado.com> Message-ID: Mikael Karlsson writes: > My guess is that at the time the binding was made > sablotron was more mature than libxslt. That's right. At that time some fellows were using sablotron and we just helped them to exploit it in a cluster using Erlang. Regards, -- Victor M. Gulias From hakan@REDACTED Fri Apr 2 10:54:58 2004 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 2 Apr 2004 10:54:58 +0200 (MEST) Subject: user-defined operators In-Reply-To: <200404012324.i31NONIo007504@atlas.otago.ac.nz> Message-ID: On Fri, 2 Apr 2004, Richard A. O'Keefe wrote: > operation. It's a function d--nit! > Then what the h**l is the point of opposing them? > Well, gee, if I wasn't already taking that for granted, there would be Please, drop this infected thread. /H?kan From joe@REDACTED Fri Apr 2 11:36:01 2004 From: joe@REDACTED (Joe Armstrong) Date: Fri, 2 Apr 2004 11:36:01 +0200 (CEST) Subject: Anybody done this In-Reply-To: Message-ID: On Thu, 1 Apr 2004, Dave Love wrote: > Joe Armstrong writes: > > > 2) Stopping and starting Erlang. > > > > I'd like to say erlang:suspend(File) which would suspend Erlang > > dumping the state into a file and later say erlang:resume(File) which > > would re-start the suspended Erlang from *exactly* the state it was > > in. > > Emacs' unexec does basically that, but (a) unexec is a maintenance > nightmare, whatever rms says -- use mmapped data instead -- and (b) > you're stuffed if you want state like network connexions to persist. > (Unexec has actually been used in a few things other than Emacs.) To answer my own question - since what I really want to do is suspend Elang and resume it on another machine I could do this is a number of ways. 1) Hack Erlang to do this (difficult) 2) Hack the environment in which Erlang runs. Really I'd like a virtual OS which could be suspended and resumed - Oh and I'd like to "virtualise" all resources (hence my question on ext2). Somethink like VMWare cannot be arbitrarly suspended - so what else could we try? http://user-mode-linux.sourceforge.net/ http://a386.nocrew.org/ or http://plex86.sourceforge.net/ Has anybody thought about porting Erlang to one of these VM's? /Joe From luke@REDACTED Fri Apr 2 11:53:47 2004 From: luke@REDACTED (Luke Gorrie) Date: Fri, 02 Apr 2004 11:53:47 +0200 Subject: Anybody done this In-Reply-To: (Joe Armstrong's message of "Fri, 2 Apr 2004 11:36:01 +0200 (CEST)") References: Message-ID: Joe Armstrong writes: > Somethink like VMWare cannot be arbitrarly suspended So what does the 'Suspend' button do? :-) (Don't remember what version it appeared in.) VMware also lets you keep your disk changes as a delta/journal these days. I'm not sure if that helps you but, gee, it's awful nice :-) > http://user-mode-linux.sourceforge.net/ Generally I don't think you need to port stuff for any of these systems, since they all look like Linux/x86 from Erlang's point of view. NB: If you do try running Erlang in user-mode-linux ("UML") you might have to hack the configure script a bit -- for me it crashed the VM while testing floating point. -Luke From erlang@REDACTED Fri Apr 2 15:30:40 2004 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Fri, 2 Apr 2004 10:30:40 -0300 Subject: Mnesia and Hipe Message-ID: <003101c418b6$b20eded0$1e00a8c0@design> Does anyone know if there are any advantages on having mnesia nodes (replication and fragmentation) with Hipe (linux OS for example) over Windows without Hipe? thanks to all, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlad_dumitrescu@REDACTED Fri Apr 2 20:37:33 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 2 Apr 2004 20:37:33 +0200 Subject: Anybody done this References: Message-ID: From: "Joe Armstrong" > > > 2) Stopping and starting Erlang. > To answer my own question - since what I really want to do is > suspend Elang and resume it on another machine I could do this is a > number of ways. > 1) Hack Erlang to do this (difficult) > 2) Hack the environment in which Erlang runs. > Really I'd like a virtual OS which could be suspended and resumed - > Oh and I'd like to "virtualise" all resources (hence my question on ext2). > Somethink like VMWare cannot be arbitrarly suspended - so what else > could we try? Hi, VMware virtual machines can be suspended IIRC. But then the panomnicom could only be run on machines with it installed on, which probably only makes that company happy. Besides, there is also the already mentioned problem of the resources that can't be saved, network resources being probably the most proeminent - not only the connections break suddenly, but the new environment may be completely different (IP adress, firewalling policies, etc) I'm sure you already thought about this, but they may be worth mentioning anyway. Regards, Vlad From vances@REDACTED Fri Apr 2 21:56:54 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 2 Apr 2004 14:56:54 -0500 Subject: SCTP API Message-ID: <20040402195654.GI75018@frogman.motivity.ca> Has anyone given much thought as to how SCTP should be integrated into Erlang? The Stream Control Transmission Protocol (SCTP) [RFC2960] is now available from Sun as an experimental package(*) and will likely (IMHO) be included in Solaris 10. There are also implementations for BSD and Linux available. -Vance (*) http://playground.sun.com/sctp/ From hal@REDACTED Fri Apr 2 23:53:01 2004 From: hal@REDACTED (Hal Snyder) Date: Fri, 02 Apr 2004 15:53:01 -0600 Subject: SCTP API In-Reply-To: <20040402195654.GI75018@frogman.motivity.ca> (Vance Shipley's message of "Fri, 2 Apr 2004 14:56:54 -0500") References: <20040402195654.GI75018@frogman.motivity.ca> Message-ID: <878yhem4hu.fsf@ghidra.vail> Vance Shipley writes: > Has anyone given much thought as to how SCTP should be integrated > into Erlang? > > The Stream Control Transmission Protocol (SCTP) [RFC2960] is now > available from Sun as an experimental package(*) and will likely > (IMHO) be included in Solaris 10. There are also implementations for > BSD and Linux available. ISTR a draft submission on SCTP and Erlang transport for a workshop in the last couple years, but I can't find it at the moment... From valentin@REDACTED Sun Apr 4 13:35:12 2004 From: valentin@REDACTED (Valentin) Date: Sun, 4 Apr 2004 13:35:12 +0200 Subject: Fw: SCTP API Message-ID: <01d401c41a38$f5717240$0100a8c0@MONEYMAKER2> Sory for that invalid date on my previous posting... That happens when one has kids. Pls -- see below. V. ----- Original Message ----- From: "Valentin" To: Sent: Thursday, March 04, 2004 1:07 PM Subject: Re: SCTP API > Doing SCTP alone does not help much, and yet, all sorts of different efforts > will cover it good enough. I think that we should move focus up to M3UA. > It is fairly easy to write a (minimalist) C-Node bridge between vendor > specific SCTP end-point and Erlang. Such a bridge should push/pull > messages up (Erlang) and down (SCTP). A pure Erlang based M3UA would process > these messages and push/pull it to/from upper layers. > > A similar bridge may be written north-bound, between existing SCTP/TCAP/MAP > (ok... ISUP, INAP as well) implementations and Erlang-based M3UA. > > V. > > ----- Original Message ----- > From: "Hal Snyder" > To: > Sent: Friday, April 02, 2004 11:53 PM > Subject: Re: SCTP API > > > > Vance Shipley writes: > > > > > Has anyone given much thought as to how SCTP should be integrated > > > into Erlang? > > > > > > The Stream Control Transmission Protocol (SCTP) [RFC2960] is now > > > available from Sun as an experimental package(*) and will likely > > > (IMHO) be included in Solaris 10. There are also implementations for > > > BSD and Linux available. > > > > ISTR a draft submission on SCTP and Erlang transport for a workshop in > > the last couple years, but I can't find it at the moment... > From matthias@REDACTED Sun Apr 4 16:47:02 2004 From: matthias@REDACTED (Matthias Lang) Date: Sun, 4 Apr 2004 16:47:02 +0200 Subject: SCTP API In-Reply-To: <01c601c401d8$e58b6ca0$0100a8c0@MONEYMAKER2> References: <20040402195654.GI75018@frogman.motivity.ca> <878yhem4hu.fsf@ghidra.vail> <01c601c401d8$e58b6ca0$0100a8c0@MONEYMAKER2> Message-ID: <16496.8166.32244.432249@antilipe.corelatus.se> Valentin writes: > Doing SCTP alone does not help much, and yet, all sorts of different efforts > will cover it good enough. I think that we should move focus up to M3UA. Knowing Vance's background, he's probably thinking the same thing you are: he wants to get at SS7. And then you really want M3UA or M2UA, or both, depending on how much of the stack you want to implement "the hard way" and how much you want to implement in Erlang. But SCTP can be used for something of much wider interest: make Erlang distribution work well over duplicated networks (for redundancy), and then it has nothing to do with M3UA. Per Bergqvist presented an interesting hack at an EUC a few years ago: http://www.erlang.se/euc/01/Bergqvist2001/sld011.htm With SCTP you could the same thing "properly". It's just a shame that the linux versions appear* to be so buggy that the risk of SCTP causing a crash seems greater than the risk of a non-redundant network failing. Maybe SUN will lead the way. Matthias Linux SCTP implementation #1: www.openss7.org Linux SCTP implementation #2: http://sourceforge.net/projects/lksctp From francesco@REDACTED Mon Apr 5 08:12:26 2004 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 05 Apr 2004 07:12:26 +0100 Subject: Erlang workshop in the USA Message-ID: <4070F8CA.1040802@erlang-consulting.com> Hi all, this is just a reminder before everyone breaks up for their easter holidays that there will be an ACM SIGPLAN sponsored workshop just outside Salt Lake City, Utah this September. There has been a fair interest in submitting papers, but the more we get, the better. We are looking for cool research, products, open source developments or any other interesting issue that evolves around Erlang and presents a new concepts and ideas. The event is slightly more formal than the Erlang user conference as the proceedings will be published in the ACM digital library, and the workshop will be accredited by ACM SIGPLAN. Not to mean it will not be fun, as the past three workshops have all been successes. This will be the second Erlang event to be held in the US, and the perfect excuse for everyone in the US who is scared of flying but has always wanted to present Erlang related material :-). If you have any questions or are considering a paper, feel free to contact me or any other program committee member. The workshop URL and submission guidelines for this year are at http://www.erlang.se/workshop/2004/ All my best, Francesco -- http://www.erlang-consulting.com From dga@REDACTED Thu Apr 1 04:01:17 2004 From: dga@REDACTED (David G. Andersen) Date: Wed, 31 Mar 2004 21:01:17 -0500 Subject: [Planetlab-arch] Anybody done this In-Reply-To: References: Message-ID: <20040401020117.GB98517@lcs.mit.edu> On Wed, Mar 31, 2004 at 10:21:08AM -0800, Steve Muir scribed: > micro-response: > > On Wed, 31 Mar 2004, Joe Armstrong wrote: > > > Also I'd like to make ext2 file systems *inside* files and binaries - > > and send complete ext2 filesystems in binaries as messages. > > you can already do this in Linux using loopback mounts e.g., one can mount > an ISO CD-ROM image at a certain mountpoint and access the contents of the > image as a (read-only) directory tree. other UNIX-like systems may have > equivalent functionality. On bsd, it's the vnode functionality (4.x and under), or "md" functionality in 5.0. For 4-stable: vnconfig -c -v /dev/cn0 /path/to/image mount -t -o /dev/vn0 /mnt Ridiculously handy when trying to, say, distribute out filesystem images to remote Internet testbed machines. :) The path to moun you can get by just dd'ing a disk to an image file. -Dave -- work: dga@REDACTED me: dga@REDACTED MIT Laboratory for Computer Science http://www.angio.net/ From troscoe@REDACTED Thu Apr 1 06:40:39 2004 From: troscoe@REDACTED (Timothy Roscoe) Date: Wed, 31 Mar 2004 20:40:39 -0800 Subject: [Planetlab-arch] Anybody done this In-Reply-To: <20040401020117.GB98517@lcs.mit.edu> Message-ID: One of the few things that's not yet horribly baroque on Linux: mount -t -o loop /path/to/image /mnt -- Mothy At Wed, 31 Mar 2004 21:01:17 -0500, "David G. Andersen" wrote: > On Wed, Mar 31, 2004 at 10:21:08AM -0800, Steve Muir scribed: > > micro-response: > > > > On Wed, 31 Mar 2004, Joe Armstrong wrote: > > > > > Also I'd like to make ext2 file systems *inside* files and binaries - > > > and send complete ext2 filesystems in binaries as messages. > > > > you can already do this in Linux using loopback mounts e.g., one can mount > > an ISO CD-ROM image at a certain mountpoint and access the contents of the > > image as a (read-only) directory tree. other UNIX-like systems may have > > equivalent functionality. > > On bsd, it's the vnode functionality (4.x and under), or "md" > functionality in 5.0. For 4-stable: > > vnconfig -c -v /dev/cn0 /path/to/image > mount -t -o /dev/vn0 /mnt > > Ridiculously handy when trying to, say, distribute out filesystem > images to remote Internet testbed machines. :) The path to moun > you can get by just dd'ing a disk to an image file. > > -Dave > > -- > work: dga@REDACTED me: dga@REDACTED > MIT Laboratory for Computer Science http://www.angio.net/ > _______________________________________________ > Arch mailing list > Arch@REDACTED > http://lists.planet-lab.org/mailman/listinfo/arch > > > From pan@REDACTED Thu Apr 1 18:22:29 2004 From: pan@REDACTED (Patrik Nyblom) Date: Thu, 1 Apr 2004 18:22:29 +0200 (MEST) Subject: Bang bang operators In-Reply-To: Message-ID: Backward compatible? Really, Hakan, what do you think? Of course it is! Follow the unqestionable logic: Excerpt from the referenced webpage: [...] Plot Summary: An eccentric professor invents wacky machinery [...] Well, who else than us could invent such a plot, having first hand everyday experience? Of course people from OTP are behind this marvelous manuscript. As everyone knows, we are always backward compatible with *anything* that has ever had (or ever will have) any connection to OTP. We therefore have a special workgroup reviewing all new syntax for chitty chitty bang bang compatibility, the OMMCWG (Old Musical Manuscript Compatibility Workgroup). The new syntax is obviously OMMCWG-approved. QED. Please also note the user comment: [...]This is what happens when Musicals are on Crack.[...], which is nearly identical to the user comments regarding the match specification syntax. Obviously that clue should have made you understand the connection between us and the film. So please stop nagging me with questions to which you so easilly could have deduced an appropriate answer yourself, or I'll haunt your workplace and will eventually replace you with a very small shell-script. Best Regards, Patrik, BBWG (the big bang workgroup) ------------------------------------------------------------------------ The absence of the standard Ericsson disclaimer by no means mean that you're allowed to read what you have just read. If you moved your lips while reading, go wash your mouth with soap. ------------------------------------------------------------------------ On Thu, 1 Apr 2004, Hakan Mattsson wrote: > On 1 Apr 2004, Bjorn Gustavsson wrote: > > bjorn> Instead we will add the following operators to a special patch > bjorn> release of R9C: > > Are they compatible with the good old Chitty Chitty Bang Bang operator? > > See the trailer at: http://www.imdb.com/title/tt0062803 > > /H?kan > > From Olivier.Lefevre@REDACTED Fri Apr 2 15:27:30 2004 From: Olivier.Lefevre@REDACTED (Olivier Lefevre) Date: Fri, 2 Apr 2004 15:27:30 +0200 Subject: Antw: Anybody done this References: Message-ID: > I'd like to say erlang:suspend(File) which would suspend Erlang > dumping the state into a file and later say erlang:resume(File) which > would re-start the suspended Erlang from *exactly* the state it was in. That does not eaxctly answer Joe's question but I can't resist pointing out that in the olden days APLers used to do that all the time. I don't know whether it was a "maintenance nightmare" but from a user point of view it worked very well. -- O.L. From vlad_dumitrescu@REDACTED Mon Apr 5 10:08:55 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 5 Apr 2004 10:08:55 +0200 Subject: Lisp parser Message-ID: Hi, a small anouncement, in case someone is interested. I have written a (mostly) CommonLisp compliant reader/parser, with all the required features, like syntax macro characters. It is not complete, but works. Code available upton request (I couldn't commit to jungerl CVS). regards, Vlad From luke@REDACTED Mon Apr 5 10:12:48 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 10:12:48 +0200 Subject: Lisp parser In-Reply-To: (Vlad Dumitrescu's message of "Mon, 5 Apr 2004 10:08:55 +0200") References: Message-ID: "Vlad Dumitrescu" writes: > Code available upton request (I couldn't commit to jungerl CVS). Why not? Just the usual sourceforge "hiccups"? From luke@REDACTED Mon Apr 5 10:14:52 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 10:14:52 +0200 Subject: Antw: Anybody done this In-Reply-To: (Olivier Lefevre's message of "Fri, 2 Apr 2004 15:27:30 +0200") References: Message-ID: "Olivier Lefevre" writes: >> I'd like to say erlang:suspend(File) which would suspend Erlang >> dumping the state into a file and later say erlang:resume(File) which >> would re-start the suspended Erlang from *exactly* the state it was in. > > That does not eaxctly answer Joe's question but I can't resist pointing > out that in the olden days APLers used to do that all the time. I don't know > whether it was a "maintenance nightmare" but from a user point of view > it worked very well. This is still done with e.g. Squeak Smalltalk. If you had a pair of programs: save-to-internet load-from-internet based on some fancy peer to peer thingy then it might be really cool to use with VMware, Squeak, etc. Though if you really want it I imagine you can easily hook yourself up using rsync anyway, provided you have a shell somewhere. -Luke From vlad_dumitrescu@REDACTED Mon Apr 5 11:55:32 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 5 Apr 2004 11:55:32 +0200 Subject: Lisp parser References: Message-ID: ----- Original Message ----- From: "Luke Gorrie" > > Code available upon request (I couldn't commit to jungerl CVS). > > Why not? Just the usual sourceforge "hiccups"? I just get a "add" requires write permissions or something like that. Checking my permissions doesn't reveal anything out of order. Strange, yesterday, there were mailing list archives for the jungerl lists, now they're gone... /Vlad From vlad_dumitrescu@REDACTED Mon Apr 5 11:58:26 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 5 Apr 2004 11:58:26 +0200 Subject: Antw: Anybody done this References: Message-ID: > >> I'd like to say erlang:suspend(File) which would suspend Erlang > >> dumping the state into a file and later say erlang:resume(File) which > >> would re-start the suspended Erlang from *exactly* the state it was in. > > > > That does not eaxctly answer Joe's question but I can't resist pointing > > out that in the olden days APLers used to do that all the time. I don't know > > whether it was a "maintenance nightmare" but from a user point of view > > it worked very well. > > This is still done with e.g. Squeak Smalltalk. > > If you had a pair of programs: > > save-to-internet > load-from-internet > > based on some fancy peer to peer thingy then it might be really cool > to use with VMware, Squeak, etc. I wonder how practical it is with today's environments: a complete system dump should contain the whole file systems, and that means in the best case some 2-3GB. In the worst, 40-80GB... /Vlad From ft@REDACTED Mon Apr 5 12:42:58 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 5 Apr 2004 12:42:58 +0200 Subject: UDP over v6: payload truncated at 1024 bytes Message-ID: <200404051242.58501.ft@it.su.se> Hi I've started using IPv6 in my Erlang application and have encountered a problem. I open a listening socket like this : gen_udp:open(5060, [{reuseaddr, true}, inet6]) but when I receive a datagram of size 1343 bytes over that socket (passive mode) handle_info({udp, Socket, IPlist, Port, Packet}, State) -> Packet is truncated at 1024 bytes. If I don't use inet6, and send the same sized packet over ordinary IPv4 UDP then it does not get truncated. tcpdump shows there really is truncation happening at the receiving end : tcpdump output : 10:01:35.123298 2001:6b0:5:987:210:dcff:fe2a:618a.5060 > 2001:6b0:5:987:210:dcff:fe2a:65ab.5060: udp 1343 my applications logging : 2004-04-05 10:01:35.123 debug<0.115.0>: length(Packet) is 1024, socket #Port<0.118> 2004-04-05 10:01:35.124 debug<0.217.0>:Packet from udp6: [2001:06b0:0005:0987:0210:dcff:fe2a:618a]:5060 (receiver: <0.115.0>) : Is this a known problem or do I perhaps just need to pass some other flag to open()? Thanks, /Fredrik From d.love@REDACTED Mon Apr 5 13:10:30 2004 From: d.love@REDACTED (Dave Love) Date: Mon, 05 Apr 2004 12:10:30 +0100 Subject: Anybody done this References: Message-ID: Joe Armstrong writes: > To answer my own question - since what I really want to do is > suspend Elang and resume it on another machine That's what unexec allows (assuming another machine of the same OS/architecture, of course, and subject to what can actually persist). > I could do this is a number of ways. > > 1) Hack Erlang to do this (difficult) _Using_ unexec, say, isn't necessarily terribly difficult if you have it working on your system, though there are gotchas. > Really I'd like a virtual OS which could be suspended and > resumed - Is it clear this makes sense generally? Probably Squeak Smalltalk is the most portable system that supports dumping your world. Presumably it has lessons in what you can do, at least. > Oh and I'd like to "virtualise" all resources (hence my question on ext2). Inferno virtualizes resources, including the machine, but I'm not aware that you can dump the VM. (I assume there's no reason you couldn't use its protocol from Erlang, say with existing Inferno or Plan 9 servers.) Has it been considered as an example of `conceptual integrity'? [I'm sure the Grid could do all this with enough XML metadata for the Java application in your e-science environment. But perhaps you need to be in UK academia to understand...] From luke@REDACTED Mon Apr 5 13:41:59 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 13:41:59 +0200 Subject: Anybody done this In-Reply-To: (Dave Love's message of "Mon, 05 Apr 2004 12:10:30 +0100") References: Message-ID: Dave Love writes: > _Using_ unexec, say, isn't necessarily terribly difficult if you have > it working on your system, though there are gotchas. Aside - does Emacs just use unexec to create its standard "core" while building itself, or can you-the-user use it whenever you like? If the latter, how? > Inferno virtualizes resources, including the machine, but I'm not > aware that you can dump the VM. (I assume there's no reason you > couldn't use its protocol from Erlang, say with existing Inferno or > Plan 9 servers.) Has it been considered as an example of `conceptual > integrity'? Oh no! Don't get Joe started on the virtues of Styx again! (Luckily he's away on holiday.) -Luke From vances@REDACTED Mon Apr 5 13:49:25 2004 From: vances@REDACTED (Vance Shipley) Date: Mon, 5 Apr 2004 07:49:25 -0400 Subject: SCTP API In-Reply-To: <16496.8166.32244.432249@antilipe.corelatus.se> References: <20040402195654.GI75018@frogman.motivity.ca> <878yhem4hu.fsf@ghidra.vail> <01c601c401d8$e58b6ca0$0100a8c0@MONEYMAKER2> <16496.8166.32244.432249@antilipe.corelatus.se> Message-ID: <20040405114925.GK75018@frogman.motivity.ca> On Sun, Apr 04, 2004 at 04:47:02PM +0200, Matthias Lang wrote: } } Knowing Vance's background, he's probably thinking the same thing you } are: he wants to get at SS7. And then you really want M3UA or M2UA, or } both, depending on how much of the stack you want to implement "the } hard way" and how much you want to implement in Erlang. I'd like the UA layers implemented in Erlang. } But SCTP can be used for something of much wider interest: make Erlang } distribution work well over duplicated networks (for redundancy), and Indeed. With an sctp_dist.erl module implementing distribution over SCTP you could start your nodes as: $ erl -proto_dist sctp -sname node1 To accomplish both these things we could implement a gen_sctp.erl API module. I'm not clear yet on what needs to be done beneath that for an integrated solution following the existing design intent. -Vance From peter@REDACTED Mon Apr 5 14:10:59 2004 From: peter@REDACTED (Peter Lund) Date: Mon, 5 Apr 2004 13:10:59 +0100 (BST) Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <200404051242.58501.ft@it.su.se> References: <200404051242.58501.ft@it.su.se> Message-ID: <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> At least in IPv4 (and TCP) you cannot ever count on any packet of any size to arrive at the destination without being fragmented into 2 or more parts. If this is different for UDP and in v6, I do not know. But hopefully someone else can tell... > Hi > > I've started using IPv6 in my Erlang application and have encountered a > problem. I open a listening socket like this : > > gen_udp:open(5060, [{reuseaddr, true}, inet6]) > > but when I receive a datagram of size 1343 bytes over that socket (passive > mode) > > handle_info({udp, Socket, IPlist, Port, Packet}, State) -> > > Packet is truncated at 1024 bytes. If I don't use inet6, and send the same > sized packet over ordinary IPv4 UDP then it does not get truncated. > > tcpdump shows there really is truncation happening at the receiving end : > > tcpdump output : > > 10:01:35.123298 2001:6b0:5:987:210:dcff:fe2a:618a.5060 > > 2001:6b0:5:987:210:dcff:fe2a:65ab.5060: udp 1343 > > my applications logging : > > 2004-04-05 10:01:35.123 debug<0.115.0>: > length(Packet) is 1024, socket #Port<0.118> > 2004-04-05 10:01:35.124 debug<0.217.0>:Packet from udp6: > [2001:06b0:0005:0987:0210:dcff:fe2a:618a]:5060 (receiver: <0.115.0>) : > > Is this a known problem or do I perhaps just need to pass some other flag > to > open()? > > Thanks, > > /Fredrik > -- Peter Lund mobile: +46 70 543 9416 http://www.lundata.se From luke@REDACTED Mon Apr 5 14:35:04 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 14:35:04 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <200404051242.58501.ft@it.su.se> (Fredrik Thulin's message of "Mon, 5 Apr 2004 12:42:58 +0200") References: <200404051242.58501.ft@it.su.se> Message-ID: Fredrik Thulin writes: > I've started using IPv6 in my Erlang application and have encountered a > problem. I open a listening socket like this : [...] > Packet is truncated at 1024 bytes. If I don't use inet6, and send the same > sized packet over ordinary IPv4 UDP then it does not get truncated. I don't know anything about the actual problem, but I think the next step is to run 'strace' on the beam process to see the system call it makes to receive the packet and what that returns. -Luke From ft@REDACTED Mon Apr 5 14:37:11 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 5 Apr 2004 14:37:11 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> Message-ID: <200404051437.11917.ft@it.su.se> On Monday 05 April 2004 14.10, Peter Lund wrote: > At least in IPv4 (and TCP) you cannot ever count on any packet > of any size to arrive at the destination without being fragmented > into 2 or more parts. If this is different for UDP and in v6, > I do not know. But hopefully someone else can tell... But surely the operating system should re-assemble the two fragments before passing it to the application, even for UDP, no? Forgot to mention some facts in my original post : Erlang is R9C-0. Both hosts are connected to the same Ethernet segment and the MTU is 1500, so there really should be no fragmentation of UDP packet with 1343 bytes payload. Operating system on both sending and receiving hosts is Linux, running a RedHat kernel called 2.4.20-30.7. /Fredrik From peter@REDACTED Mon Apr 5 14:58:57 2004 From: peter@REDACTED (Peter Lund) Date: Mon, 5 Apr 2004 13:58:57 +0100 (BST) Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <200404051437.11917.ft@it.su.se> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> Message-ID: <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> > On Monday 05 April 2004 14.10, Peter Lund wrote: >> At least in IPv4 (and TCP) you cannot ever count on any packet >> of any size to arrive at the destination without being fragmented >> into 2 or more parts. If this is different for UDP and in v6, >> I do not know. But hopefully someone else can tell... > > But surely the operating system should re-assemble the two fragments > before > passing it to the application, even for UDP, no? No! The OS (any OS) does not help you when running TCP/IPv4. Using gen_tcp in erlang you will have to receive packets one at the time and after receiving each packet, you need to concatenate with any previous rest message and then decide if you have got it all or not. If all has arrived, then process... A common technique is to first send a length indicator, and then the actual message itself. In JAVA there is a special read .readFully(Buffer) That locks until the whole bufferlength has been filled to assist in this. In erlang you have to code it yourself. -- Peter Lund mobile: +46 70 543 9416 http://www.lundata.se From ft@REDACTED Mon Apr 5 15:21:19 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 5 Apr 2004 15:21:19 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: References: <200404051242.58501.ft@it.su.se> Message-ID: <200404051521.19479.ft@it.su.se> On Monday 05 April 2004 14.35, Luke Gorrie wrote: > Fredrik Thulin writes: > > I've started using IPv6 in my Erlang application and have encountered a > > problem. I open a listening socket like this : > > [...] > > > Packet is truncated at 1024 bytes. If I don't use inet6, and send the > > same sized packet over ordinary IPv4 UDP then it does not get truncated. > > I don't know anything about the actual problem, but I think the next > step is to run 'strace' on the beam process to see the system call it > makes to receive the packet and what that returns. Good idea, didn't think of that. Please read all of this message, it gets interesting near the end. On the sending side, I did (using the erl prompt) : Data = lists:duplicate(1300, " "). {ok, S} = gen_udp:open(5000, [{reuseaddr, true}, inet6]). gen_udp:send(S, "2001:6b0:5:987:210:dcff:fe2a:65ab", 5060, Data). on the receiving host, this was seen using tcpdump as : 15:03:42.439704 2001:6b0:5:987:210:dcff:fe2a:618a.5000 > 2001:6b0:5:987:210:dcff:fe2a:65ab.5060: udp 1300 My application once again received 1024 bytes of data, and the strace shows the following interesting output : recvfrom(16, " "..., 1024, 0, {sin_family=AF_INET6, sin6_port=htons(5000), inet_pton(AF_INET6, "2001:6b0:5:987:210:dcff:fe2a:618a", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 1024 recvfrom(16, 0x81b7db8, 1024, 0, 0xbffff060, 0xbffff03c) = -1 EAGAIN (Resource temporarily unavailable) It seems to me like Erlang is reading data in 1024 byte chunks using recvfrom(). My recvfrom(2) man-page says >If a message is too long to fit in the supplied buffer, excess >bytes may be discarded depending on the type of socket the message is >received from (see socket(2)). If that is the problem here, then I guess Erlang should recvfrom() into a buffer of 64kb to not loose any data. Of course, it is not very wise to send that large UDP packets... When I did the same test (sending and receiving hosts are the same) using v4, this is what the strace shows me : recvfrom(15, " "..., 8192, 0, {sin_family=AF_INET, sin_port=htons(5001), sin_addr=inet_addr("193.11.25.99")}}, [16]) = 1300 recvfrom(15, 0x81b7db8, 8192, 0, 0xbffff060, 0xbffff03c) = -1 EAGAIN (Resource temporarily unavailable) So it seems Erlang uses a 8k buffer for v4 and 1k buffer for v6. That does not seem right. In fact, since the biggest UDP datagram size is 64k I think the buffer ought to be 64k for both v4 and v6. /Fredrik From luke@REDACTED Mon Apr 5 15:26:07 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 15:26:07 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <200404051521.19479.ft@it.su.se> (Fredrik Thulin's message of "Mon, 5 Apr 2004 15:21:19 +0200") References: <200404051242.58501.ft@it.su.se> <200404051521.19479.ft@it.su.se> Message-ID: Fredrik Thulin writes: > So it seems Erlang uses a 8k buffer for v4 and 1k buffer for v6. That does not > seem right. In fact, since the biggest UDP datagram size is 64k I think the > buffer ought to be 64k for both v4 and v6. That sounds like the most reasonable default to me too. You can set this in your code when you open the sockets. Just include this option in gen_udp:open - {recbuf, 65535} The available options are in the 'erl -man inet' page, under setopts/2. gen_udp and gen_tcp accept these same options. -Luke From ft@REDACTED Mon Apr 5 15:37:00 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 5 Apr 2004 15:37:00 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: References: <200404051242.58501.ft@it.su.se> <200404051521.19479.ft@it.su.se> Message-ID: <200404051537.00307.ft@it.su.se> On Monday 05 April 2004 15.26, Luke Gorrie wrote: > Fredrik Thulin writes: > > So it seems Erlang uses a 8k buffer for v4 and 1k buffer for v6. That > > does not seem right. In fact, since the biggest UDP datagram size is 64k > > I think the buffer ought to be 64k for both v4 and v6. > > That sounds like the most reasonable default to me too. On second thought, 8k might not be such a bad default after all since (as a colleague of mine pointed out) you would otherwise use a megabyte of memory with just 16 threads waiting for data. > You can set this in your code when you open the sockets. Just include > this option in gen_udp:open - > > {recbuf, 65535} > > The available options are in the 'erl -man inet' page, under > setopts/2. gen_udp and gen_tcp accept these same options. That worked like a charm, thanks! Hopefully someone will increase the default v6 receive-buffer though... 1k is really too small. /Fredrik From serge@REDACTED Mon Apr 5 15:40:21 2004 From: serge@REDACTED (Serge Aleynikov) Date: Mon, 05 Apr 2004 09:40:21 -0400 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <200404051437.11917.ft@it.su.se> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> Message-ID: <407161C5.8010103@hq.idt.net> Fredrik, How many hops do you have between your client and the server? TCP handles fragmentation differently from UDP. TCP does it transparently for the programmer by defining a maximum segment size and breaking datagrams down into smaller messages of max segment size (at most) before transmission. For any given network node and a programmer using TCP is usually safe attempting to send long datagrams. As far as I know in UDP there is no concept similar to the max segment size. If the user sends a datagram longer than the MTU of the server's network link, it is immediately fragmented at the IP layer before transmission. If the receiver gets a fragment it waits a set amount of time for the remaining fragments to arrive. If all the fragments do not arrive with a given period the receiver throws away the collected fragments and any others that arrive late. If possible, the best option is to remain below the minimum MTU specified by IPv4 or IPv6, which, as far as I recall, is 567 and 1280 bytes. However, in IPv4 networks the most common value is 1500, which must be set on *all* hops in the packet's way in order for the receiver to get an unfragmented packet of 1500 bytes. VPNs and other technologies may add extra headers to packets when they encode data, which may also lead to an increased size of a packet and fragmentation. Thus, it is important that the data segment of UDP datagrams stay well below this MTU value if the application is to be used between nodes separated by several hops. Serge Fredrik Thulin wrote: > On Monday 05 April 2004 14.10, Peter Lund wrote: > >>At least in IPv4 (and TCP) you cannot ever count on any packet >>of any size to arrive at the destination without being fragmented >>into 2 or more parts. If this is different for UDP and in v6, >>I do not know. But hopefully someone else can tell... > > > But surely the operating system should re-assemble the two fragments before > passing it to the application, even for UDP, no? > > Forgot to mention some facts in my original post : Erlang is R9C-0. Both hosts > are connected to the same Ethernet segment and the MTU is 1500, so there > really should be no fragmentation of UDP packet with 1343 bytes payload. > > Operating system on both sending and receiving hosts is Linux, running a > RedHat kernel called 2.4.20-30.7. > > /Fredrik From d.love@REDACTED Mon Apr 5 18:36:44 2004 From: d.love@REDACTED (Dave Love) Date: Mon, 05 Apr 2004 17:36:44 +0100 Subject: Anybody done this References: Message-ID: Luke Gorrie writes: > Aside - does Emacs just use unexec to create its standard "core" while > building itself, or can you-the-user use it whenever you like? Yes, in principle. I think there was a bug last time I tried, but I have done it. The SCM scheme system, for instance, also does this (with caveats) via unexec and might be a better example. (This might well not be the best technique to dump and restore an Erlang system if that was really wanted.) > If the latter, how? See C-h f dump-emacs > Oh no! Don't get Joe started on the virtues of Styx again! > (Luckily he's away on holiday.) Sorry. A web search found no relevant mentions in an Erlang context, which surprised me; hence the question. Can one read about it somewhere? From luke@REDACTED Mon Apr 5 20:28:01 2004 From: luke@REDACTED (Luke Gorrie) Date: Mon, 05 Apr 2004 20:28:01 +0200 Subject: Anybody done this In-Reply-To: (Dave Love's message of "Mon, 05 Apr 2004 17:36:44 +0100") References: Message-ID: Dave Love writes: >> Oh no! Don't get Joe started on the virtues of Styx again! >> (Luckily he's away on holiday.) > > Sorry. A web search found no relevant mentions in an Erlang context, > which surprised me; hence the question. Can one read about it > somewhere? Hm, perhaps that didn't make it into 'net archives. I'm sure Joe will be glad to sing some praises of it when he gets back. -Luke From ok@REDACTED Tue Apr 6 05:54:31 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 Apr 2004 15:54:31 +1200 (NZST) Subject: Antw: Anybody done this Message-ID: <200404060354.i363sVmB083333@atlas.otago.ac.nz> One of the features of DEC-10 Prolog was that you could save a memory image and later restore it, resuming from exactly the save call. Quintus Prolog supported this, in a very emacs-like way. But eventually we deprecated it. Let me quote the relevant part of the manual. Unfortunately, it has not been possible to retain the semantics of save/[1,2] available in previous releases of Quintus Prolog. This is regrettable because it means that programs that incorporate code for building saved-states will need to be changed. This section explains why it was necessary to remove these predicates. Note, however, that save_program/1 is available and has the same semantics as previous releases (except for foreign code), although it is based on a new implementation using QOF files. A new predicate save_program/2, described in {manual(g-5-4)}, has been provided which supports the most common usage of save/[1,2] which was to specify an initial goal for a saved-state to call when run. The difference between save_program/1 and save/[1,2] in previous releases of Quintus Prolog was that save_program/1 saved only the Prolog database, whereas save/[1,2] saved both the Prolog database and the Prolog execution stacks. It has not been possible to retain the saving of the Prolog execution stacks in a way which is consistent with the Release 3 support of embeddability and the general portability of QOF files. This is why save/[1,2] have been removed. The reasoning goes as follows: 1. QOF files are a completely portable machine-independent representation of Prolog data. 2. It is difficult, if not impossible, to make the Prolog execution state portable in the same way as facts and rules in QOF files (see further points). 3. QOF files can also be combined and loaded in flexible ways, and it is unclear what this would mean for execution states. * 4. The QOF file saved-states do not save any C (or other foreign * language) state. This is a change from the previous Quintus Prolog * saved-states, and is further discussed below. * 5. In the general case, Prolog execution can now be arbitrarily * interleaved with C (or other) function calls since Prolog and C * are completely intercallable and can call each other recursively. 6. Since the C state is not saved, it is not possible to meaningfully save the Prolog execution state in the general case where it depends on interleaved C execution state. * 7. In addition, Prolog code embedded in a C (or other) application is * highly likely to be manipulating C data, such as pointers and * other process-specific information. This data would be meaningless * if restored into another process, and indeed would be likely to * cause faults. The model that an arbitrary Prolog execution state can be saved thus only works well within a Prolog-only situation. In the complex embedded environments supported by Quintus Prolog Release 3 this model cannot work properly. Hence the removal of the facility. As mentioned in points 4-7 above, an additional important aspect here is that Prolog no longer makes any attempt to save the state of C (or other foreign language) code. This was a feature of saved-states in previous releases where both the C code and its data structures were saved (as a memory image) into saved-states. This was a feature that caused many problems. A primary problem was that the saved C state was initialized (variables retained their values when restored) and yet the initialized C state could contain many items that were no longer valid in the new process, such as addresses and file descriptors. Such code would often fail when restored. In addition, Prolog was unable to guarantee that it had saved all the necessary foreign code state. With the advent of shared libraries and other complex memory management facilities in the operating system, it became impossible for Prolog to control and manage the states of other tools in the address space. When one takes a step back and looks at Prolog in the light of the goals of Release 3 ({manual(a-2)}) - where Prolog code is a component that can be embedded in complex applications written in many languages - it is clearly unreasonable for Prolog to try and control, let alone save, arbitrary non-Prolog state. The Prolog operations for saving and loading QOF files now operate solely on the Prolog database and these operations do not involve making any assumptions about non-Prolog state. This is a much cleaner and more robust approach, and is the most appropriate when Prolog applications become embedded software components. For example, in a couple of operating systems that Quintus Prolog ran on, a C program could *not* rely on getting the same addresses whenever it ran. Here's the kind of thing I'm getting at: #include static char c = 1; int main(void) { printf("%p %p\n", &c, (void *)main); return 0; } Compile that in a UNIX environment, and you expect to get the same numbers every time. Well, in a couple of operating systems, you didn't. So if QP saved out a memory image, and then you ran QP and restored that image, all the C code and static-storage-duration data would now be somewhere else, and all the addresses would be wrong. With dynamically loaded code, you can't even trust this kind of thing in UNIX any more; if foreign files foo.o and bar.o are loaded, when you restore things on startup, foo.o may now load a *different* version of the .so files it depends on, so bar.o may be loaded at a different address. Then there were things like people mapping a frame buffer into their address space, shared memory, System V message queues that didn't work on restoration because the other process wasn't there any more, socket connections that couldn't be restored, &c &c. The key sentences from the manual are these: >>> The model that an arbitrary Prolog execution state can be saved thus >>> only works well within a Prolog-only situation. >>> In the complex embedded environments supported by Quintus Prolog >>> Release 3 this model cannot work properly. The lesson for Erlang (and Joe) is that if you want to save out a suspended version of an Erlang node, and then restore it, even on the exact same machine one millisecond later, you must be running an Erlang(-and-runtime- library)-ONLY system; any drivers had better be statically linked into the runtime system and they had better be d--- careful about what they do. From mfroberg@REDACTED Tue Apr 6 08:51:55 2004 From: mfroberg@REDACTED (=?ISO-8859-1?Q?Magnus_Fr=F6berg?=) Date: Tue, 06 Apr 2004 08:51:55 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> Message-ID: <4072538B.9080702@nortelnetworks.com> Peter Lund wrote: > > Using gen_tcp in erlang you will have to receive packets one at > the time and after receiving each packet, you need to concatenate > with any previous rest message and then decide if you have got it > all or not. If all has arrived, then process... > > A common technique is to first send a length indicator, and then > the actual message itself. > > In JAVA there is a special read > .readFully(Buffer) > That locks until the whole bufferlength has been filled to assist > in this. In erlang you have to code it yourself. > Well, you can use the {packet, N} option and the packets are auto prepended with a N bytes length indicator and the recv will not return until the complete package is received. (if you are not using erlang in both ends you need to add the length bytes your self at the non-erlang side) See the inet man page. /Magnus -- Magnus Fr?berg Tel: +46 (0)8 545 55 026 Alteon WebSystems AB Email: mfroberg@REDACTED Sveav?gen 151, P.O. Box 6701 WWW: http://www.alteonwebsystems.com SE-113 85 Stockholm, SWEDEN From hakan@REDACTED Tue Apr 6 11:34:40 2004 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 6 Apr 2004 11:34:40 +0200 (MEST) Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <4072538B.9080702@nortelnetworks.com> Message-ID: On Tue, 6 Apr 2004, Magnus Fr?berg wrote: magnus> Well, you can use the {packet, N} option and the packets are magnus> auto prepended with a N bytes length indicator and the recv magnus> will not return until the complete package is received. magnus> (if you are not using erlang in both ends you need to add magnus> the length bytes your self at the non-erlang side) magnus> See the inet man page. You can also use {packet, tpkt} for this purpose. Search for 'tpkt' under megaco/src/tcp for an Erlang example. The TPKT format is standardized (RFC1006), but can only handle PDU sizes up to 65524 bytes. /H?kan From peter@REDACTED Tue Apr 6 11:52:56 2004 From: peter@REDACTED (Peter Lund) Date: Tue, 6 Apr 2004 10:52:56 +0100 (BST) Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <4072538B.9080702@nortelnetworks.com> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> <4072538B.9080702@nortelnetworks.com> Message-ID: <30063.149.254.120.136.1081245176.squirrel@www69.webcows.se> Yes, that is true. When I implemented (parts of) the SMPP protocol the length indicator was 4 bytes, but the VALUE differed by 4 between SMPP and gen_tcp. That was why I was not able to use the {packet,N} option. I think gen_tcp gives the value as the size of the following packet (after the indicator) but in SMPP the value should be including the 4 byte indicator. Thus a diff of 4, forcing me to handle this myself... Magnus Fr?berg wrote: > Well, you can use the {packet, N} option and the packets are > auto prepended with a N bytes length indicator and the recv > will not return until the complete package is received. > (if you are not using erlang in both ends you need to add > the length bytes your self at the non-erlang side) > See the inet man page. > > /Magnus > > -- > Magnus Fr?berg Tel: +46 (0)8 545 55 026 > Alteon WebSystems AB Email: mfroberg@REDACTED > Sveav?gen 151, P.O. Box 6701 WWW: http://www.alteonwebsystems.com > SE-113 85 Stockholm, SWEDEN -- Peter Lund mobile: +46 70 543 9416 http://www.lundata.se From luke@REDACTED Tue Apr 6 14:23:39 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 06 Apr 2004 14:23:39 +0200 Subject: dbg_iload:guard_test/1 patch In-Reply-To: <16491.60100.689441.977955@rian.du.uab.ericsson.se> (Dan Gudmundsson's message of "Thu, 1 Apr 2004 12:11:16 +0200") References: <16491.60100.689441.977955@rian.du.uab.ericsson.se> Message-ID: Dan Gudmundsson writes: > I have already fixed that, along with a long list of other bugs. > It will be available in next erlang release. We're hitting another debugger crash. This time it's a 'badarg' from the erts_debug:make_fun when called from dbg_ieval:expr. I don't have the exact backtrace handy, but conspicously the 'Uniq' variable was bound to 'undefined'. Does that sound like something you've fixed? Are there still OTP snapshots stashed in secret hideouts on the web? I could use one to diff against. -Luke From dgud@REDACTED Tue Apr 6 14:26:48 2004 From: dgud@REDACTED (Dan Gudmundsson) Date: Tue, 6 Apr 2004 14:26:48 +0200 Subject: dbg_iload:guard_test/1 patch In-Reply-To: References: <16491.60100.689441.977955@rian.du.uab.ericsson.se> Message-ID: <16498.41480.813189.195618@rian.du.uab.ericsson.se> Luke Gorrie writes: > Dan Gudmundsson writes: > > > I have already fixed that, along with a long list of other bugs. > > It will be available in next erlang release. > > We're hitting another debugger crash. This time it's a 'badarg' from > the erts_debug:make_fun when called from dbg_ieval:expr. I don't have > the exact backtrace handy, but conspicously the 'Uniq' variable was > bound to 'undefined'. > > Does that sound like something you've fixed? I don't know, I have rewritten how funs are handled, Probably because the erts_debug:make_fun are never called now. > Are there still OTP snapshots stashed in secret hideouts on the web? > I could use one to diff against. I don't know.. > -Luke /Dan From vlad_dumitrescu@REDACTED Tue Apr 6 14:37:01 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 6 Apr 2004 14:37:01 +0200 Subject: dbg_iload:guard_test/1 patch References: <16491.60100.689441.977955@rian.du.uab.ericsson.se> Message-ID: From: "Luke Gorrie" > Are there still OTP snapshots stashed in secret hideouts on the web? The only ones I know of is in the regular download directory. /Vlad From luke@REDACTED Tue Apr 6 14:48:25 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 06 Apr 2004 14:48:25 +0200 Subject: dbg_iload:guard_test/1 patch In-Reply-To: (Vlad Dumitrescu's message of "Tue, 6 Apr 2004 14:37:01 +0200") References: <16491.60100.689441.977955@rian.du.uab.ericsson.se> Message-ID: "Vlad Dumitrescu" writes: > From: "Luke Gorrie" >> Are there still OTP snapshots stashed in secret hideouts on the web? > > The only ones I know of is in the regular download directory. A fiendishly clever hiding place. Thanks, I've purloined today's snapshot. From ulf.wiger@REDACTED Wed Apr 7 14:07:40 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 07 Apr 2004 14:07:40 +0200 Subject: erlang ground breaking? Message-ID: I stumbled across a Wiki list of "ground breaking languages" http://c2.com/cgi/wiki?GroundBreakingLanguages Erlang is listed as the "interesting and useful" but not necessarily ground breaking. If anyone feels differently, there's a discussion page where you can voice your opinion. Personally, I can't make up my mind as to whether Erlang is truly ground breaking, but am not going to lose any sleep over it. /Uffe -- Ulf Wiger, Senior System Architect EAB/UPD/S From mickael.remond@REDACTED Wed Apr 7 14:42:58 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 07 Apr 2004 14:42:58 +0200 Subject: erlang ground breaking? In-Reply-To: References: Message-ID: On Wed, 07 Apr 2004 14:07:40 +0200, Ulf Wiger wrote: > > I stumbled across a Wiki list of "ground breaking languages" > > http://c2.com/cgi/wiki?GroundBreakingLanguages > > Erlang is listed as the "interesting and useful" but not necessarily > ground breaking. > > If anyone feels differently, there's a discussion page where you can > voice your opinion. > > Personally, I can't make up my mind as to whether Erlang is truly > ground breaking, but am not going to lose any sleep over it. I think that is the addition of several concepts that could make Erlang "ground breaking" (I do not know what this really means however). Concurrency alone, as stated on the page is not ground breaking, but for example the organisation of programs into a supervision tree seems to be a powerfull, innovative and maybe ground breaking idea. cheers, -- Micka?l R?mond http://www.erlang-projects.org/ From matthias@REDACTED Wed Apr 7 15:45:10 2004 From: matthias@REDACTED (Matthias Lang) Date: Wed, 7 Apr 2004 15:45:10 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> Message-ID: <16500.1510.752689.74601@antilipe.corelatus.se> I know that Fredrik's immediate problem [erlang's UDP receive buffer size was too small for his application] has been solved, but the claim that UDP packets aren't re-assembled by the OS has been bugging me for a few days: Peter Lund> At least in IPv4 (and TCP) you cannot ever count on any packet Peter Lund> of any size to arrive at the destination without being fragmented Peter Lund> into 2 or more parts. This is true at L1, but it is not relevant to Fredrik's problem. Fredrik> But surely the operating system should re-assemble the Fredrik> two fragments before passing it to the application, even Fredrik> for UDP, no? Peter Lund> No! The OS (any OS) does not help you when running TCP/IPv4. No!!!! Fredrik is correct. Linux DOES re-assemble fragmented IP datagrams for TCP/IPv4. The code for doing it is in net/ipv4/ip_fragment.c (2.4.25) the functions ip_defrag() and ip_frag_reasm() do the work. I suspect that re-assembling IP datagrams is required by POSIX, i.e. the behaviour will be the same for Solaris, BSD and modern variants of Windows. But I haven't checked that. Nor do I have my copy of Stevens handy. Matthias From hedeland@REDACTED Wed Apr 7 17:03:09 2004 From: hedeland@REDACTED (Per Hedeland) Date: Wed, 7 Apr 2004 17:03:09 +0200 (CEST) Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <16500.1510.752689.74601@antilipe.corelatus.se> Message-ID: <200404071503.i37F397p018593@tordmule.bluetail.com> Matthias Lang wrote: > >I know that Fredrik's immediate problem [erlang's UDP receive buffer >size was too small for his application] has been solved, but the claim >that UDP packets aren't re-assembled by the OS has been bugging me for >a few days: You get bugged too easily.:-) > Peter Lund> At least in IPv4 (and TCP) you cannot ever count on any packet > Peter Lund> of any size to arrive at the destination without being fragmented > Peter Lund> into 2 or more parts. > >This is true at L1, but it is not relevant to Fredrik's problem. > > Fredrik> But surely the operating system should re-assemble the > Fredrik> two fragments before passing it to the application, even > Fredrik> for UDP, no? > > Peter Lund> No! The OS (any OS) does not help you when running TCP/IPv4. > >No!!!! Fredrik is correct. > >Linux DOES re-assemble fragmented IP datagrams for TCP/IPv4. Yes, of course. >I suspect that re-assembling IP datagrams is required by POSIX, >i.e. the behaviour will be the same for Solaris, BSD and modern >variants of Windows. But I haven't checked that. Nor do I have my copy >of Stevens handy. Absolutely true - in fact there's no possible way for an application to handle IP fragmentation itself via the standard socket API - the information needed just isn't available (fragments can of course arrive out of order, or be lost). What Peter was talking about was something entirely different - the issue of implementing a datagram service on top of TCP (like, say, Erlang distribution does). Since TCP will not preserve the boundaries of these "user-level datagrams" for you, you have to do it yourself - otherwise you'll run the risk of not just getting datagram "fragments", but of multiple datagrams being concatenated, or any combination of the two (e.g. last part of one datagram and first part of the next one). This issue doesn't exist with UDP, since it's a "true" datagram service - it does preserve the boundaries for you. Instead there are many other issues, one of which Fredrik ran into. --Per Hedeland From sean.hinde@REDACTED Wed Apr 7 17:42:45 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 7 Apr 2004 16:42:45 +0100 Subject: ASN1 Private Constructor Message-ID: <37114D89-88AA-11D8-9E16-000A95927CCE@t-mobile.co.uk> Hi all, Anyone have any idea how to specify a privately tagged constructor in an asn1 source file? In other words it should behave like SEQUENCE but have a different tag value The reason is that I need to create a specific encoding which begins with 0xE1 then goes straight into the sequence of values, and I'd quite like to use the asn1 compiler. Thanks, Sean From bertil@REDACTED Wed Apr 7 17:58:27 2004 From: bertil@REDACTED (Bertil Karlsson) Date: Wed, 07 Apr 2004 17:58:27 +0200 Subject: ASN1 Private Constructor References: <37114D89-88AA-11D8-9E16-000A95927CCE@t-mobile.co.uk> Message-ID: <40742523.7070604@erix.ericsson.se> Try with something like: P ::= SEQUENCE { a INTEGER, b BOOLEAN } PwithPRIVATEtag ::= CHOICE { c [PRIVATE 1] P } /Bertil Sean Hinde wrote: > Hi all, > > Anyone have any idea how to specify a privately tagged constructor in an > asn1 source file? In other words it should behave like SEQUENCE but have > a different tag value > > The reason is that I need to create a specific encoding which begins > with 0xE1 then goes straight into the sequence of values, and I'd quite > like to use the asn1 compiler. > > Thanks, > Sean > > From sean.hinde@REDACTED Wed Apr 7 20:27:57 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 7 Apr 2004 19:27:57 +0100 Subject: ASN1 Private Constructor In-Reply-To: <40742523.7070604@erix.ericsson.se> References: <37114D89-88AA-11D8-9E16-000A95927CCE@t-mobile.co.uk> <40742523.7070604@erix.ericsson.se> Message-ID: <4AFA956E-88C1-11D8-9E16-000A95927CCE@mac.com> Hi, On 7 Apr 2004, at 16:58, Bertil Karlsson wrote: > Try with something like: > > P ::= SEQUENCE { > a INTEGER, > b BOOLEAN > } > > PwithPRIVATEtag ::= CHOICE { > c [PRIVATE 1] P > } The Erlang asn1 compiler produces the following from this (with a change to 2 integers): asn1ct:compile("CTPG.asn1"). Erlang ASN.1 version "2003.07.11" compiling "CTPG.asn1" Compiler Options: [] --{generated,"CTPG.asn1db"}-- --{generated,"CTPG.hrl"}-- --{generated,"CTPG.erl"}-- ok 148> c('CTPG'). {ok,'CTPG'} 149> 'CTPG':encode('PwithPRIVATEtag', {c, {'P', 1, 1}}). {ok,[225,8,48,6,2,1,1,2,1,1]} 150> shlib:formathex(<<225,8,48,6,2,1,1,2,1,1>>). < 0> e1 08 30 06 02 01 01 02 01 01 So, the e1 has been generated, great, but It has also generated a UNIVERSAL SEQUENCE before getting to the content. I am trying to generate: e1 06 02 01 01 02 01 01 It may be a bug in the compiler, or it may be something it is not possible to specify in a source file, or maybe the correct sequence of magic words has not been found - I have been unable to tell by reading around. It does appear to be valid BER. Sean > > /Bertil > > Sean Hinde wrote: >> Hi all, >> Anyone have any idea how to specify a privately tagged constructor in >> an asn1 source file? In other words it should behave like SEQUENCE >> but have a different tag value >> The reason is that I need to create a specific encoding which begins >> with 0xE1 then goes straight into the sequence of values, and I'd >> quite like to use the asn1 compiler. >> Thanks, >> Sean > From sean.hinde@REDACTED Wed Apr 7 23:49:12 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Wed, 7 Apr 2004 22:49:12 +0100 Subject: ASN1 Private Constructor In-Reply-To: <000001c41ce5$e5fa2140$a6b7fea9@snabbis> References: <000001c41ce5$e5fa2140$a6b7fea9@snabbis> Message-ID: <680476FD-88DD-11D8-9E16-000A95927CCE@mac.com> Perfect, Thank you. I just completed a horrible handraulic decoder which I can now happily throw away and replace with a nice clean asn.1 source file :-) Cheers, Sean On 7 Apr 2004, at 22:18, Kenneth Lundin wrote: > Hi, > > ? > > You use IMPLICIT TAGS to get a private tag without an universal tag > for a SEQUENCE. > > ? > > Example > > ? > > S DEFINITIONS IMPLICIT TAGS::= > > BEGIN > > S ::= [PRIVATE 1 ] SEQUENCE { > > ??????? a INTEGER, > > ??????? b BOOLEAN > > } > > ? > > ? > > END > > ? > > Note!, another way than the IMPLICIT TAGS as default on all tags > defined in the module is to define > > The type S like this (in a module with any tagdefault). > > ? > > S::= [PRIVATE 1] IMPLICIT SEQUENCE { ?. > > ? > > 6> asn1ct:compile("S"). > > Erlang ASN.1 version "1.4.2" compiling "S.asn" > > Compiler Options: [] > > --{generated,"S.asn1db"}-- > > --{generated,"S.hrl"}-- > > --{generated,"S.erl"}-- > > ok > > ? > > ? > > ? > > 9> 'S':encode('S',{'S',1,true}). > > {ok,[225,6,2,1,1,1,1,255]} > > ? > > 225 = Tag E1, (actually the tag is CONSTRUCTED,PRIVATE,TAGVALUE=1) > > 6 = length > > 2 = Tag UNIVERSAL 2 -> INTEGER > > 1 = length > > 1= Integervalue > > 1= Tag UNIVERSAL 1 -> BOOLEAN > > 1= length > > 255 = Boolean value which means ?TRUE? > > ? > > /Kenneth Lundin > > ? > > ? From spearce@REDACTED Thu Apr 8 02:45:52 2004 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 7 Apr 2004 19:45:52 -0500 Subject: erlang ground breaking? In-Reply-To: References: Message-ID: <20040408004552.GA5804@spearce.org> Ulf Wiger wrote: > > I stumbled across a Wiki list of "ground breaking languages" > > http://c2.com/cgi/wiki?GroundBreakingLanguages > > Erlang is listed as the "interesting and useful" but not necessarily > ground breaking. > > If anyone feels differently, there's a discussion page where you can > voice your opinion. > > Personally, I can't make up my mind as to whether Erlang is truly > ground breaking, but am not going to lose any sleep over it. I think when I first started using Erlang I felt that it was ground breaking, but perhaps only because threading was so painful and expensive in every other language/environment I've ever had the misfortune of using. When you add mnesia and OTP being present in the default install, Erlang/OTP is a pretty powerful platform... but we all know that already. I think the big things that struck me were: - processes - ! and receive - atoms - multiple function clauses but now that I've looked at a whole host of other languages, I see where Erlang's roots are. And understand why its only "interesting and useful" and not ground breaking. Lets all be happy Erlang wasn't ground breaking by bringing some horrible feature to the table like C++'s templates and their syntax. :-) (Of course, C++ wasn't the first generic programming language. It just happened to become the world's most popular way to screw up generic programming for the masses.) -- Shawn. Old Japanese proverb: There are two kinds of fools -- those who never climb Mt. Fuji, and those who climb it twice. From 08.55088832@REDACTED Wed Apr 7 23:21:24 2004 From: 08.55088832@REDACTED (Kenneth Lundin) Date: Wed, 7 Apr 2004 23:21:24 +0200 Subject: SV: Re: ASN1 Private Constructor Message-ID: <000701c41ce6$55cab3e0$a6b7fea9@snabbis> Hi, You use IMPLICIT TAGS to get a private tag without an universal tag for a SEQUENCE. Example S DEFINITIONS IMPLICIT TAGS::= BEGIN S ::= [PRIVATE 1 ] SEQUENCE { a INTEGER, b BOOLEAN } END Note!, another way than the IMPLICIT TAGS as default on all tags defined in the module is to define The type S like this (in a module with any tagdefault). S::= [PRIVATE 1] IMPLICIT SEQUENCE { .. 6> asn1ct:compile("S"). Erlang ASN.1 version "1.4.2" compiling "S.asn" Compiler Options: [] --{generated,"S.asn1db"}-- --{generated,"S.hrl"}-- --{generated,"S.erl"}-- ok From sverzijl@REDACTED Thu Apr 8 05:32:19 2004 From: sverzijl@REDACTED (Simeon Verzijl) Date: Thu, 8 Apr 2004 13:32:19 +1000 Subject: Error when using -sname option Message-ID: <200404080332.i383WJY03005@mail004.syd.optusnet.com.au> Hi, Bit of a beginner on using Erlang. I was following a tutorial and it said to run Erlang like follows: erl.exe -sname ping It fails miserably. I was wondering if it has got something to do with my OS (Windows XP) or something to do with how Erlang is set up? And of course, how do I fix it? The error was: C:\PROGRA~1\erl5.3>bin\erl.exe - -sname ping {error_logger,{{2004,4,8},{13,5,52- }},'Protocol: ~p: register/listen error: ~p~n' ,[inet_tcp,enotsock]} {error_logger,{{2004,4,8},{13,5,52- }},crash_report,[[{pid,<0.18.0>- },{registered_n ame,net_kernel},{error_info,{error- ,badarg}},{initial_call,{gen,init_- it,[gen_serv er,<0.15.0>,<0.15.0>,{- local,net_kernel},net_kernel,{ping- ,shortnames,15000},[]]}} ,{ancestors,[net_sup,kernel_sup,<- 0.8.0>]},{messages,[]},{links,[<- 0.15.0>]},{dict ionary,[{longnames,false}]},{trap_- exit,true},{status,running},{heap_- size,377},{s tack_size,21},{reductions,275}],[]- ]} {error_logger,{{2004,4,8},{13,5,52- }},supervisor_report,[{supervisor,- {local,net_s up}},{errorContext,start_error},{r- eason,{'EXIT',nodistribution}},{of- fender,[{pid ,undefined},{name,net_kernel},{mfa- ,{net_kernel,start_link,[[ping,sho- rtnames]]}}, {restart_type,permanent},{shutdown- ,2000},{child_type,worker}]}]} {error_logger,{{2004,4,8},{13,5,52- }},supervisor_report,[{supervisor,- {local,kerne l_sup}},{errorContext,start_error}- ,{reason,shutdown},{offender,[{pid- ,undefined}, {name,net_sup},{mfa,{erl_distribut- ion,start_link,[]}},{restart_type,- permanent},{ shutdown,infinity},{child_type,sup- ervisor}]}]} {error_logger,{{2004,4,8},{13,5,52- }},crash_report,[[{pid,<0.7.0>- },{registered_na me,[]},{error_info,{shutdown,{kern- el,start,[normal,[]]}}},{initial_c- all,{applica tion_master,init,[<0.5.0>,<- 0.6.0>,{appl_data,kernel,[appli- cation_controller,erl_ reply,auth,boot_server,code_server- ,disk_log_server,disk_log_sup,erl_- prim_loader, error_logger,file_server,file_serv- er_2,fixtable_server,global_group,- global_name_ server,heart,init,kernel_config,ke- rnel_sup,net_kernel,net_sup,rex,us- er,os_server ,ddll_server,erl_epmd,inet_db,pg2]- ,undefined,{kernel,[]},[applicatio- n,applicatio n_controller,application_master,ap- plication_starter,auth,code,code_a- ux,packages, code_server,dist_util,erl_boot_ser- ver,erl_distribution,erl_prim_load- er,erl_reply ,erlang,error_handler,error_logger- ,file,file_server,old_file_server,- file_io_serv er,prim_file,global,global_group,g- lobal_search,group,heart,inet6_tcp- ,inet6_tcp_d ist,inet6_udp,inet_config,inet_hos- ts,inet_gethost_native,inet_tcp_di- st,init,kern el,kernel_config,net,net_adm,net_k- ernel,os,ram_file,rpc,user,user_dr- v,user_sup,d isk_log,disk_log_1,disk_log_server- ,disk_log_sup,dist_ac,erl_ddll,erl- _epmd,erts_d ebug,gen_tcp,gen_udp,prim_inet,ine- t,inet_db,inet_dns,inet_parse,inet- _res,inet_tc p,inet_udp,pg2,seq_trace,socks5,so- cks5_auth,socks5_tcp,socks5_udp,wr- ap_log_reade r,zlib,otp_ring0],[],infinity,infi- nity},normal]}},{ancestors,[<0.- 6.0>]},{message s,[{'EXIT',<0.8.0>,normal}]}- ,{links,[<0.6.0>,<0.5.0>- ]},{dictionary,[]},{trap_exi t,true},{status,running},{heap_siz- e,610},{stack_size,21},{reductions- ,1080}],[]]} {error_logger,{{2004,4,8},{13,5,52- }},std_info,[{application,kernel},- {exited,{shu tdown,{kernel,start,[normal,[]]}}}- ,{type,permanent}]} {"Kernel pid terminated",application_controller- ,shutdown} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) (shutdown) Thanks, Simeon Verzijl -------------- next part -------------- An HTML attachment was scrubbed... URL: From valentin@REDACTED Thu Apr 8 08:52:24 2004 From: valentin@REDACTED (Valentin) Date: Thu, 8 Apr 2004 08:52:24 +0200 Subject: erlang ground breaking? References: Message-ID: <026d01c41d36$0d873220$0100a8c0@MONEYMAKER2> On Wed, 07 Apr 2004 14:07:40 +0200, Ulf Wiger wrote: > Personally, I can't make up my mind as to whether Erlang is truly > ground breaking, but am not going to lose any sleep over it. Ground breaking or not, Erlang is an amazing competitive advantage for an organization that decide to use it. My only problem with Erlang is that I don't want to use anything else anymore (and that had never happened to me before), thus, I've developed a serious silver-bullet syndrome -- I want to do everything in Erlang, even things that are not suitable for it (well, this I say just in case, haven't found one yet :-). Valentin. PS. And I was the guy saying that some things are far better handled in C/C++. From vlad_dumitrescu@REDACTED Thu Apr 8 09:31:10 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 8 Apr 2004 09:31:10 +0200 Subject: erlang ground breaking? References: <026d01c41d36$0d873220$0100a8c0@MONEYMAKER2> Message-ID: From: "Valentin" > My only problem with Erlang is that I > don't want to use anything else anymore (and that had never happened to me > before), thus, I've developed a serious silver-bullet syndrome -- I want to > do everything in Erlang, even things that are not suitable for it (well, > this I say just in case, haven't found one yet :-). Same here, except that (unfortunately) I did found things where Erlang is not only "not suitable", but practically impossible to use[*]. However, this doesn't affect my relationship with Erlang! :-) /Vlad [*] I refer to massive number-crunching. I have written very elegant solutions, but one just can't handle lists of some million of items... Should mutable binaries become part of the family, then it might work! From taj.khattra@REDACTED Thu Apr 8 09:44:09 2004 From: taj.khattra@REDACTED (Taj Khattra) Date: Thu, 8 Apr 2004 00:44:09 -0700 Subject: ASN1 Private Constructor In-Reply-To: <680476FD-88DD-11D8-9E16-000A95927CCE@mac.com> References: <000001c41ce5$e5fa2140$a6b7fea9@snabbis> <680476FD-88DD-11D8-9E16-000A95927CCE@mac.com> Message-ID: <20040408074409.GA966@localhost.localdomain> > I just completed a horrible handraulic decoder which I can now happily > throw away and replace with a nice clean asn.1 source file :-) "nice", "clean" and "asn.1" all in the same sentence - what's going on!? :) From fredrik.linder@REDACTED Thu Apr 8 10:04:16 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Thu, 8 Apr 2004 10:04:16 +0200 Subject: erlang ground breaking? Message-ID: > From: Vlad Dumitrescu > > From: "Valentin" > > My only problem with Erlang is that I > > don't want to use anything else anymore (and that had never > happened to me > > before), thus, I've developed a serious silver-bullet > syndrome -- I want to > > do everything in Erlang, even things that are not suitable > for it (well, > > this I say just in case, haven't found one yet :-). > > Same here, *snip* Same same From luke@REDACTED Thu Apr 8 11:35:18 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 08 Apr 2004 11:35:18 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: <16500.1510.752689.74601@antilipe.corelatus.se> (Matthias Lang's message of "Wed, 7 Apr 2004 15:45:10 +0200") References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> <16500.1510.752689.74601@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > I suspect that re-assembling IP datagrams is required by POSIX, > i.e. the behaviour will be the same for Solaris, BSD and modern > variants of Windows. But I haven't checked that. Nor do I have my copy > of Stevens handy. I can't quite chapter and verse either, but you're definitely right. Only the first UDP fragment would contain things like port number and checksum, and you couldn't test the checksum without reassembling. Certainly defragmentation of UDP packets does happen down at IP before it gets close to the user. I think the problem Peter alluded to is if you're naughty and try to send datagrams over TCP, i.e. expect read() to return exactly one thing that was write()'d on the other side, which doesn't work (except sometimes by accident) since TCP sockets supposed to be continuous streams. The issue here is TCP segment'ification rather than IP fragmentation. On the "bugging me for a few days" note.. why doesn't Erlang always use a 64K buffer for reading UDP? Since the emulator runs in a polling loop it should only need one such buffer in total: just make a non-blocking read() into it, create a binary, and it's free again "all in one go". Or? -Luke From luke@REDACTED Thu Apr 8 11:38:34 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 08 Apr 2004 11:38:34 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: (Luke Gorrie's message of "Thu, 08 Apr 2004 11:35:18 +0200") References: <200404051242.58501.ft@it.su.se> <34148.149.254.120.136.1081167059.squirrel@www69.webcows.se> <200404051437.11917.ft@it.su.se> <51847.149.254.120.136.1081169937.squirrel@www69.webcows.se> <16500.1510.752689.74601@antilipe.corelatus.se> Message-ID: Luke Gorrie writes: > I think the problem Peter alluded to is..... Oops, I was too quick to write before reading ahead :-). Change all that to "What Per said." -Luke From serge@REDACTED Thu Apr 8 15:30:16 2004 From: serge@REDACTED (Serge Aleynikov) Date: Thu, 08 Apr 2004 09:30:16 -0400 Subject: Error when using -sname option In-Reply-To: <200404080332.i383WJY03005@mail004.syd.optusnet.com.au> References: <200404080332.i383WJY03005@mail004.syd.optusnet.com.au> Message-ID: <407553E8.1090103@hq.idt.net> Simeon, I ran into exactly the same problem with Windows XP on one of my computers. http://www.erlang.org/ml-archive/erlang-questions/200308/msg00076.html So far I haven't figured out the solution to the problem, as distributed Erlang starts fine on other Windows XP machines, and there doesn't seem to be a port conflict according to netstat. Perhaps someone else can shed some light on where else to check? Serge Simeon Verzijl wrote: > Hi, > > > > Bit of a beginner on using Erlang. > > > > I was following a tutorial and it said to run Erlang like follows: > > erl.exe ?sname ping > > > > It fails miserably. I was wondering if it has got something to do with > my OS (Windows XP) or something to do with how Erlang is set up? And of > course, how do I fix it? > > > > The error was: > > C:\PROGRA~1\erl5.3>bin\erl.exe ? -sname ping > {error_logger,{{2004,4,8},{13,5,52? }},'Protocol: ~p: register/listen > error: ~p~n' > ,[inet_tcp,enotsock]} > {error_logger,{{2004,4,8},{13,5,52? }},crash_report,[[{pid,<0.18.0>? > },{registered_n > ame,net_kernel},{error_info,{error? ,badarg}},{initial_call,{gen,init_? > it,[gen_serv > er,<0.15.0>,<0.15.0>,{? local,net_kernel},net_kernel,{ping? > ,shortnames,15000},[]]}} > ,{ancestors,[net_sup,kernel_sup,]},{messages,[]},{links,[ 0.15.0>]},{dict > ionary,[{longnames,false}]},{trap_? exit,true},{status,running},{heap_? > size,377},{s > tack_size,21},{reductions,275}],[]? ]} > {error_logger,{{2004,4,8},{13,5,52? }},supervisor_report,[{supervisor,? > {local,net_s > up}},{errorContext,start_error},{r? eason,{'EXIT',nodistribution}},{of? > fender,[{pid > ,undefined},{name,net_kernel},{mfa? ,{net_kernel,start_link,[[ping,sho? > rtnames]]}}, > {restart_type,permanent},{shutdown? ,2000},{child_type,worker}]}]} > {error_logger,{{2004,4,8},{13,5,52? }},supervisor_report,[{supervisor,? > {local,kerne > l_sup}},{errorContext,start_error}? ,{reason,shutdown},{offender,[{pid? > ,undefined}, > {name,net_sup},{mfa,{erl_distribut? ion,start_link,[]}},{restart_type,? > permanent},{ > shutdown,infinity},{child_type,sup? ervisor}]}]} > {error_logger,{{2004,4,8},{13,5,52? }},crash_report,[[{pid,<0.7.0>? > },{registered_na > me,[]},{error_info,{shutdown,{kern? el,start,[normal,[]]}}},{initial_c? > all,{applica > tion_master,init,[<0.5.0>,,{appl_data,kernel,[appli? > cation_controller,erl_ > reply,auth,boot_server,code_server? ,disk_log_server,disk_log_sup,erl_? > prim_loader, > error_logger,file_server,file_serv? er_2,fixtable_server,global_group,? > global_name_ > server,heart,init,kernel_config,ke? rnel_sup,net_kernel,net_sup,rex,us? > er,os_server > ,ddll_server,erl_epmd,inet_db,pg2]? ,undefined,{kernel,[]},[applicatio? > n,applicatio > n_controller,application_master,ap? plication_starter,auth,code,code_a? > ux,packages, > code_server,dist_util,erl_boot_ser? ver,erl_distribution,erl_prim_load? > er,erl_reply > ,erlang,error_handler,error_logger? ,file,file_server,old_file_server,? > file_io_serv > er,prim_file,global,global_group,g? lobal_search,group,heart,inet6_tcp? > ,inet6_tcp_d > ist,inet6_udp,inet_config,inet_hos? ts,inet_gethost_native,inet_tcp_di? > st,init,kern > el,kernel_config,net,net_adm,net_k? ernel,os,ram_file,rpc,user,user_dr? > v,user_sup,d > isk_log,disk_log_1,disk_log_server? ,disk_log_sup,dist_ac,erl_ddll,erl? > _epmd,erts_d > ebug,gen_tcp,gen_udp,prim_inet,ine? t,inet_db,inet_dns,inet_parse,inet? > _res,inet_tc > p,inet_udp,pg2,seq_trace,socks5,so? cks5_auth,socks5_tcp,socks5_udp,wr? > ap_log_reade > r,zlib,otp_ring0],[],infinity,infi? nity},normal]}},{ancestors,[<0.? > 6.0>]},{message > s,[{'EXIT',<0.8.0>,normal}]}? ,{links,[<0.6.0>,<0.5.0>? > ]},{dictionary,[]},{trap_exi > t,true},{status,running},{heap_siz? e,610},{stack_size,21},{reductions? > ,1080}],[]]} > > {error_logger,{{2004,4,8},{13,5,52? }},std_info,[{application,kernel},? > {exited,{shu > tdown,{kernel,start,[normal,[]]}}}? ,{type,permanent}]} > {"Kernel pid terminated",application_controller? ,shutdown} > > Crash dump was written to: erl_crash.dump > Kernel pid terminated (application_controller) (shutdown) > > > > Thanks, > > Simeon Verzijl > From jhouchin@REDACTED Thu Apr 8 16:53:02 2004 From: jhouchin@REDACTED (Jimmie Houchin) Date: Thu, 08 Apr 2004 09:53:02 -0500 Subject: Erlang, Strings, Mnesia? Message-ID: <4075674E.9000309@cableone.net> Hello, I am trying to understand whether or not Erlang is right or a good option for a website I am building. Currently I am processing 422,000 files with 6.6gb of text to place in a database. I will have to regularly parse and process large volumes of textual data. The database will initially have 4-5 million rows/objects. This data in turn will be searchable. A prime purpose of the data. On this page of the Mnesia User Guide it says: #http://www.erlang.se/doc/doc-5.3/lib/mnesia-4.1.4/doc/html/Mnesia_chap1.html#1 # #On the other hand, Mnesia may not be appropriate with the following #types of applications: # # * Programs that process plain text or binary data files I am used to Squeak and Python and native string support. I understand well Erlang's strengths. I don't understand where it is weak. An example. Would Erlang be suitable for a Google type site? An Amazon? An eBay? Any wisdom, advise welcome and appreciated. Jimmie Houchin From enewhuis@REDACTED Thu Apr 8 16:51:26 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Thu, 8 Apr 2004 09:51:26 -0500 Subject: erlang ground breaking? In-Reply-To: <20040408004552.GA5804@spearce.org> References: <20040408004552.GA5804@spearce.org> Message-ID: <35FC04DE-896C-11D8-9B75-000A95D9A520@futuresource.com> I don't think Erlang is "ground breaking" at all. Ground breaking refers to a new beginning, sometimes the first baby step. Erlang, however, is far from a baby step. It has totally mastered the distributed application domain. And in that sense it is not breaking new ground but dominating it. Erlang is ground dominating. On Apr 7, 2004, at 7:45 PM, Shawn Pearce wrote: > Ulf Wiger wrote: >> >> I stumbled across a Wiki list of "ground breaking languages" >> >> http://c2.com/cgi/wiki?GroundBreakingLanguages >> >> Erlang is listed as the "interesting and useful" but not necessarily >> ground breaking. >> >> If anyone feels differently, there's a discussion page where you can >> voice your opinion. >> >> Personally, I can't make up my mind as to whether Erlang is truly >> ground breaking, but am not going to lose any sleep over it. > > I think when I first started using Erlang I felt that it was > ground breaking, but perhaps only because threading was so painful > and expensive in every other language/environment I've ever had the > misfortune of using. When you add mnesia and OTP being present in > the default install, Erlang/OTP is a pretty powerful platform... but > we all know that already. > > I think the big things that struck me were: > > - processes > - ! and receive > - atoms > - multiple function clauses > > but now that I've looked at a whole host of other languages, I see > where Erlang's roots are. And understand why its only "interesting > and useful" and not ground breaking. > > Lets all be happy Erlang wasn't ground breaking by bringing some > horrible feature to the table like C++'s templates and their syntax. > :-) > > (Of course, C++ wasn't the first generic programming language. It > just happened to become the world's most popular way to screw up > generic programming for the masses.) > > -- > Shawn. > > Old Japanese proverb: > There are two kinds of fools -- those who never climb Mt. Fuji, > and those who climb it twice. > From ulf.wiger@REDACTED Thu Apr 8 23:43:20 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 08 Apr 2004 23:43:20 +0200 Subject: Erlang, Strings, Mnesia? In-Reply-To: <4075674E.9000309@cableone.net> References: <4075674E.9000309@cableone.net> Message-ID: On Thu, 08 Apr 2004 09:53:02 -0500, Jimmie Houchin wrote: > Hello, > > I am trying to understand whether or not Erlang is right or a good > option for a website I am building. > > Currently I am processing 422,000 files with 6.6gb of text to place in a > database. I will have to regularly parse and process large volumes of > textual data. I guess that mySql would do a better job in this case. > The database will initially have 4-5 million rows/objects. I've had mnesia databases with >10 million objects. The number isn't really the issue, but the memory requirements are. If the database can fit in primary memory (which in practice means no more than, say 3GB of data, since Erlang currently only addresses up to 4 GB), then you face the problem that mnesia's disk storage was not designed to handle such large volumes. Also, text expands 8x if you represent it as a list of integers (the normal "string representation" in Erlang), so if you want to squeeze the data, you'd have to store the strings as - atoms, might work if you know that there's a finite string space (the atom table is not garbage collected.) Also, you must convert the atoms to strings (atom_to_list()) before you can analyse them. - binaries, which means no space explosion, and you can still process the binaries directly using the bit syntax, but debugging becomes a bit more awkward; I also have doubts about the GC characteristics if you really go overboard using gigabytes in millions of binaries. > This data in turn will be searchable. A prime purpose of the data. Assuming the data could fit in ets tables, the ets:select() feature is powerful, but mainly for structured, symbolic data. It gives little support for string processing. This means that for partial string matching, you generally need to read every object and scan it using a regular Erlang program. Not sure which type of database manager would be best. There are some tools that build indices on words. One database manager that does this is FileMaker, which also has some nice web support, and some (fairly limited) relational functionality. The feature that it indexes on every word in every table field is sometimes annoying, but it makes for some lightning-fast keyword searches. The newest version of FileMaker supports 2GB per field and 8TB per database. http://www.pcmag.com/article2/0,1759,1548051,00.asp Note, though, that it's not free. (I have no personal interest in FileMaker, except that I used it in a previous life, and liked it very much.) > Would Erlang be suitable for a Google type site? > An Amazon? An eBay? Probably no. /Uffe -- Ulf Wiger From jhouchin@REDACTED Fri Apr 9 01:11:00 2004 From: jhouchin@REDACTED (Jimmie Houchin) Date: Thu, 08 Apr 2004 18:11:00 -0500 Subject: Erlang, Strings, Mnesia? In-Reply-To: References: <4075674E.9000309@cableone.net> Message-ID: <4075DC04.10401@cableone.net> Ulf Wiger wrote: > On Thu, 08 Apr 2004 09:53:02 -0500, Jimmie Houchin > wrote: [snip] Hello, Thanks for the reply and the honest assessment. I expected no less from this group. Since lots of text and searches of that text is a very primary part of my website I just had to ask before proceeding. I know Erlang is most excellent for many things but just lacked confidence in this area. I wanted to be confident before building. Again, thanks. Jimmie Houchin From spearce@REDACTED Fri Apr 9 02:06:02 2004 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 8 Apr 2004 19:06:02 -0500 Subject: Erlang, Strings, Mnesia? In-Reply-To: References: <4075674E.9000309@cableone.net> Message-ID: <20040409000602.GA5394@spearce.org> Ulf Wiger wrote: > >Would Erlang be suitable for a Google type site? > >An Amazon? An eBay? > > Probably no. It would work well with yaws as the front end, but mnesia would not be a suitable database. You'd want to build a new database interface that used pure Erlang code to speak the database's native network protocol, and connect to a database that had better support for the types of operations you are doing. -- Shawn. From carsten@REDACTED Fri Apr 9 16:34:18 2004 From: carsten@REDACTED (Carsten Schultz) Date: Fri, 9 Apr 2004 16:34:18 +0200 Subject: Using an external unix filter Message-ID: <20040409143417.GB5031@penne.localnet> Hi, how can I close the stdin of a spawned port and still collect its output? I would like to do something like Port = open_port({spawn, SOME_UNIX_FILTER}, [exit_status, binary]), Port ! {self(), {command, Data}}, SOMEHOW TELL THE PORT I WILL NOT SEND MORE DATA, collect_loop(Port, []). collect_loop(Port, Acc) -> receive M={Port, {data, Bin}} -> collect_loop(Port, [Acc, Bin]); M={Port, _} -> Acc end. Thanks in advance, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From vances@REDACTED Sat Apr 10 00:20:52 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 9 Apr 2004 18:20:52 -0400 Subject: multiuser report browser patch Message-ID: <20040409222052.GA5728@frogman.motivity.ca> I've just posted a patch to the SASL report browser on the erlang-patches@REDACTED mailing list. I've been trying to use remote shells of late as I needed to support multi-user access for operations. Previously I've used to_erl to attach to running embedded systems. With this method you are attaching to the stdin/stdout of the Unix process running the emulator. The output from SASL shows up here. The trouble is that you can't share it. So now we have users running their own nodes and using the Job Control Mode (JCL) of the shell to start remote shells on the target node. This works relatively well however we do run into trouble with some output going to the main IO stream. For example using the report browser. On the client screen we see: Eshell V5.3.1 (abort with ^G) (vances@REDACTED)1> User switch command --> r mapper@REDACTED --> c Restricted Eshell V5.3.1 (abort with ^G) (mapper@REDACTED)1> rb:start([{max, 5}]). {ok,<3938.31940.1>} (mapper@REDACTED)4> rb:list(). ok The progress message and the report shows up under to_erl: rb: reading report... done. No Type Process Date Time == ==== ======= ==== ==== 5 error_report <0.84.0> 2004-04-07 17:53:22 4 error_report <0.84.0> 2004-04-07 17:53:23 3 error_report <0.84.0> 2004-04-07 17:53:37 2 error_report <0.84.0> 2004-04-07 17:53:38 1 error_report <0.84.0> 2004-04-07 17:53:40 With the patch it will keep track of where a request came from and send the progress messages and reports there. Does anyone use rb? -Vance From valentin@REDACTED Thu Apr 8 08:52:24 2004 From: valentin@REDACTED (Valentin) Date: Thu, 8 Apr 2004 08:52:24 +0200 Subject: erlang ground breaking? References: Message-ID: <026d01c41d36$0d873220$0100a8c0@MONEYMAKER2> On Wed, 07 Apr 2004 14:07:40 +0200, Ulf Wiger wrote: > Personally, I can't make up my mind as to whether Erlang is truly > ground breaking, but am not going to lose any sleep over it. Ground breaking or not, Erlang is an amazing competitive advantage for an organization that decide to use it. My only problem with Erlang is that I don't want to use anything else anymore (and that had never happened to me before), thus, I've developed a serious silver-bullet syndrome -- I want to do everything in Erlang, even things that are not suitable for it (well, this I say just in case, haven't found one yet :-). Valentin. PS. And I was the guy saying that some things are far better handled in C/C++. From spearce@REDACTED Sat Apr 10 07:08:03 2004 From: spearce@REDACTED (Shawn Pearce) Date: Sat, 10 Apr 2004 00:08:03 -0500 Subject: Yet another use for Erlang Message-ID: <20040410050803.GE22206@spearce.org> - as a desktop calculator! Anyone else just leave an Erlang shell open and use it for quick figuring? I used to have a little Perl script I'd hacked up for this purpose, but I just realized tonight that for the past 3 weeks I've been running a non-networked Erlang node just as a desktop calculator. It has a dedicated xterm on my desktop. Wastes a good amount of desktop space too I might add... Not exactly a strange use for Erlang, but I never thought about running a highly concurrent virtual machine like beam for this long and use it as nothing more than a desktop calculator. :) -- Shawn. From vlad_dumitrescu@REDACTED Sat Apr 10 12:56:59 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sat, 10 Apr 2004 12:56:59 +0200 Subject: Delphi on the client and Erlang on the server References: Message-ID: Hi, I have been tinkering at Delphi interfaces to Erlang, but nothing is 100% done. There are first some classes to handle port interfacing via stdin/stdout (which are probably good beta status), and also a beginning to port jinterface to Delphi. With the latter I am not sure the design decisions are really the best; it works some 80%, but the other 20% might be tricky. Is something like this that you are interested in? regards, /Vlad ----- Original Message ----- From: "JK" To: Sent: Monday, May 10, 2004 11:02 AM Subject: Delphi on the client and Erlang on the server > Hi All, > did somebody write something to use a Delphi application on the client > connected to an application server written in Erlang. Just not to begin > from zero. > > Thanks! > > // jilani > > -- > Jilani Khaldi > http://jkhaldi.oltrelinux.com > http://www.archsf.org > > > From tony@REDACTED Sat Apr 10 14:13:04 2004 From: tony@REDACTED (Tony Rogvall) Date: Sat, 10 Apr 2004 14:13:04 +0200 Subject: inet6 support in inet:getaddr() In-Reply-To: <200404011134.51553.ft@it.su.se> Message-ID: <6B2C4EF0-8AE8-11D8-8EC6-000A95EB4F88@rogvall.com> torsdagen den 1 april 2004 kl 11.35 skrev Fredrik Thulin: > Hi > > I've managed to get IPv6 support working in the Erlang > SIP-server/stack called > Yxa (http://www.stacken.kth.se/projekt/yxa/). To my delight, I found > out that > inet:getaddr() does handle inet6 (I'm using R9C-0) even though the > documentation says is doesn't ;) > > My question is, will this be the way to do it or am I better off > implementing > my own DNS resolver functionality to obtain IPv6 as well as IPv4 > addresses? I > might have to do that anyways since I want to obtain all addresses for > a > hostname, not just the first one. > Use inet:gethostbyname/2 it will return {ok, HEnt} where HEnt is a hostent record which is defined in kernel/include/inet.hrl Please look around in the resolver code to find out more goodies ... you may find the inet_dns/inet_res/inet_parse/inet_db and inet modules interesting. Example: 4> inet:gethostbyname("www.stacken.kth.se", inet6). {ok,{hostent,"www.stacken.kth.se", [], inet6, 16, [{8193,1712,1,234,2560,8447,65167,28815}]}} 6> inet:gethostbyname("www.stacken.kth.se", inet). {ok,{hostent,"www.stacken.kth.se",[],inet,4,[{130,237,234,41}]}} 7> inet_parse:ntoa({8193,1712,1,234,2560,8447,65167,28815}). "2001:6B0:1:EA:A00:20FF:FE8F:708F" 8> inet_parse:ntoa({130,237,234,41}). "130.237.234.41" Example with ipv4/ipv6 23> inet:gethostbyname("www.google.com", inet6). {ok,{hostent,"www.google.akadns.net", ["www.google.com"], inet6, 16, [{0,0,0,0,0,65535,16998,2915},{0,0,0,0,0,65535,16998,2920}]}} 24> 24> 24> inet_parse:ntoa({0,0,0,0,0,65535,16998,2915}). "::FFFF:66.102.11.99" 25> Regards /Tony From anders@REDACTED Sat Apr 10 15:16:35 2004 From: anders@REDACTED (Anders Ramsell) Date: Sat, 10 Apr 2004 15:16:35 +0200 Subject: Delphi on the client and Erlang on the server In-Reply-To: References: Message-ID: <4077F3B3.10206@theheartofgold.org> JK wrote: > Hi All, > did somebody write something to use a Delphi application on the client > connected to an application server written in Erlang. Just not to begin > from zero. > Yes, we are doing that at work. However we do not use any direct interfaces like the ones Vlad are working with. Our Delphi-clients connect to the Erlang-server using ordinary TCP/IP-sockets. On these sockets we communicate using plain text messages. For each connected client we have one Erlang-process responsible for interpreting messages from that client and sending back responses. This simple configuration works very well for us. /Anders From ulf.wiger@REDACTED Sat Apr 10 15:52:11 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 10 Apr 2004 15:52:11 +0200 Subject: Yet another use for Erlang In-Reply-To: <20040410050803.GE22206@spearce.org> References: <20040410050803.GE22206@spearce.org> Message-ID: On Sat, 10 Apr 2004 00:08:03 -0500, Shawn Pearce wrote: > - as a desktop calculator! > > Anyone else just leave an Erlang shell open and use it for quick > figuring? Oh yes, I do that all the time. (: The erlang shell is a superb desktop calculator. /Uffe -- Ulf Wiger From carsten@REDACTED Sat Apr 10 16:20:39 2004 From: carsten@REDACTED (Carsten Schultz) Date: Sat, 10 Apr 2004 16:20:39 +0200 Subject: Yet another use for Erlang In-Reply-To: <20040410050803.GE22206@spearce.org> References: <20040410050803.GE22206@spearce.org> Message-ID: <20040410142038.GF6293@penne.localnet> Perfect weekend (or even holiday) thread :-) On Sat, Apr 10, 2004 at 12:08:03AM -0500, Shawn Pearce wrote: > - as a desktop calculator! > > Anyone else just leave an Erlang shell open and use it for quick > figuring? Rarely. I prefer ghci :-) Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From tony@REDACTED Sun Apr 11 01:13:42 2004 From: tony@REDACTED (Tony Rogvall) Date: Sun, 11 Apr 2004 01:13:42 +0200 Subject: UDP over v6: payload truncated at 1024 bytes In-Reply-To: Message-ID: m?ndagen den 5 april 2004 kl 15.26 skrev Luke Gorrie: > Fredrik Thulin writes: > >> So it seems Erlang uses a 8k buffer for v4 and 1k buffer for v6. That >> does not >> seem right. In fact, since the biggest UDP datagram size is 64k I >> think the >> buffer ought to be 64k for both v4 and v6. > > That sounds like the most reasonable default to me too. > > You can set this in your code when you open the sockets. Just include > this option in gen_udp:open - > > {recbuf, 65535} > Well, I think that the recbuf option is mainly used by TCP, however the side effect of the recbuf options is to align the 'buffer' option to be at least the size of recbuf. In other words the {buffer, 8192} should be used in this case. The recbuf option should only be used (my opinion) when kernel buffer space is low (think proxy/server with lot of persistent connections). Also if one touch the recbuf option ONCE then one will affect the sliding window behaviour (at least under linux) and then one has to adjust it manually !? There is no way to reset the recbuf to the default (i.e let OS handle it) The reason why IPV4 has a reasonable default of 8k is found in the code for inet_udp.erl not in the driver. For some other reason (lack of time or whatever) the code in inet6_udp.erl was not updated with the very same default (uses the drivers default of 1k). On the allocation issue. When using packet option for TCP the driver will buffer until all bytes in the packet has arrived. This means that a buffer is use for storing the partial data. Same goes for calling recv in passive mode. For UDP NO buffer is pre allocated, the value of the buffer option is used to allocate a buffer used for doing the actual recvfrom system call. Then the data is delivered and the buffer is released (by the driver). (Even some nifty buffer pool code handling effective buffer reuse :-) Hope it explains things :-) /Tony From vlad_dumitrescu@REDACTED Sat Apr 10 20:42:17 2004 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Sat, 10 Apr 2004 20:42:17 +0200 Subject: Delphi on the client and Erlang on the server References: <4077F3B3.10206@theheartofgold.org> Message-ID: From: "Anders Ramsell" > Our Delphi-clients > connect to the Erlang-server using ordinary TCP/IP-sockets. On these > sockets we communicate using plain text messages. For each connected > client we have one Erlang-process responsible for interpreting messages > from that client and sending back responses. This simple configuration > works very well for us. I also came to think that this is a better solution. Neither the client nor the server get any hard links to the other one's environment. Using a proxy Erlang process that does the encoding/decoding is easy and generic. Also, handling Erlang data types on the Delphi side is bulky. Jilani: I have the stdio interface already zipped somewhere, and I will try to package the rest too. Maybe I could use the opportunity and publish them on Jungerl... But I'm not sure when, because of the Easter holiday. regards, Vlad From cedricpublic@REDACTED Tue Apr 13 03:22:38 2004 From: cedricpublic@REDACTED (Cedric Shock) Date: Mon, 12 Apr 2004 18:22:38 -0700 Subject: How to implement a spreadsheet? Message-ID: <407B40DE.4040201@shockfamily.net> Hello, Short version: When a bound variable is used in the definition of a new function via fun() is the value of the variable copied into the function definition, or is a reference used? Is there a short way to import a function from another module into yours so you can use it without the module: prefix? Long version: I would like to implement something like a spreadsheet in erlang. The ultimate goal in a project like this is to provide the simplest, most general, possible interface to the user. I have decided that the best possible solution would be if the formulas allowable for the user were plain erlang code. This would allow a user to do amazing things like make a formula that generates a function and stores it in a cell, and at a later timeframe a formula that applies a stored function to other data or functions. In addition it would remove other possible burdens like writing a parser for things like addition and subtraction or making a generator for functions that will work in formulas. So, the problem breaks down like this: We have some data and a context, and a formula from the user for the value of one cell of data in the next time frame. Somehow we need to slip the data and context into the user's formula without them seeing it. A nice formula would be something like: "sqrt(Data(1, 1)^2 + Data(1, 2)^2)" Here's the idea for how to do this. Define a function which takes as its arguments the position in the spreadsheet, and returns the value at that location. Then assign that function to the variable Data bound inside the evaluator. Then we will evaluate the function Formula in that context. It would look something like this: CalculateCell(Data, Context, Formula) -> DataFunction = fun(X, Y) -> LookupData(Data, Context, X, Y) end, ... Bindings = erl_eval:add_binding('Data', DataFunction, ...), ... eval(Formula, Bindings) ... So here's the question. Erlang does not have destructive assignment, so a variable like Data (which is going to be huge) can be safely passed around all over the place almost entirely by reference; I assume Erlang takes full advantage of an optimization like this. However, I do not know if it will do the same thing in my definition of a function. Will the function definition be in terms of references to Data and Context that would only get de-referenced when serialized, or is the entirety of Data copied into the definition of the function? Another issue is that it would be very desirable to have the math functions available when the formula is evaluated. What module does an evaluation happen in? I assume it happens in the module of the code that called it. It would be desirable for things like math:sin to be usable in a formula just through calling sin. Is there a shorter way to import them into your module than: sin(Theta) -> math:sin(Theta). cos(Theta) -> math:cos(Theta). etc...? Thanks in advance for your time and advice, Cedric A. Shock From spearce@REDACTED Tue Apr 13 05:12:43 2004 From: spearce@REDACTED (Shawn Pearce) Date: Mon, 12 Apr 2004 22:12:43 -0500 Subject: How to implement a spreadsheet? In-Reply-To: <407B40DE.4040201@shockfamily.net> References: <407B40DE.4040201@shockfamily.net> Message-ID: <20040413031242.GD4287@spearce.org> The definition of the function is actually done by (roughly) creating a hidden function within the module which implements the code, and then calling it with a tuple. Its roughly as if you had written: calculate_cell(Data, Context, Formula) -> DataFunction = {?MODULE, calculate_cell, {Data, Context}}, ... % to call: {M,F,{A,B}} = DataFunction, M:F(A, B, X, Y) calculate_cell_0(Data, Context, X, Y) -> lookup_data(Data, Context, X, Y). But a lot faster and makes a heck of a lot more sense. So you will get one copy of the code, and when you actually bind DataFunction to the fun, you actually get a tiny little data value which contains references to the code, Data and Context. Therefore if you made one million funs, you would still have just one copy of Data and just one copy of Context. However, if you send the fun in a message to another process, the entire set of data in Data and Context will get copied to during transit, so you don't want to put a huge amount of data in there if you are sending it around often. I'd suggest you look at ets if you want to implement a spreadsheet. It may work better for mutable term storage when dealing with huge amounts of data. Its a mutable data structure and its global, so multiple processes can access it at once without having to copy the data back and forth all of the time. Your little example already indicates one reason you may need to do the parser yourself. Erlang can't do: 157> 2^4. ** 1: syntax error before: '^' ** So you'll have to at least parse that expression into: 157> math:pow(2,4). 16.0000 which may be easy, but then you might want to make cell references like Excel and other popular spreadsheets do: 158> D18 * D12 - D15. ** 1: variable 'D18' is unbound ** So of course this requires you to scan the string, or bind every cell into a variable in the interpreter... ugly. As a matter of style, don't name functions with uppercase names in your modules - they look like variable names, and it looks out of place relative to everything else. (Not to mention that erlc will choke on it with an error message.) As for importing into your local module, look at the -import attribute. I think it's something like: -module(foo). -import(math, [sin/2, pow/2]). but I don't use it in my code. :-) Cedric Shock wrote: > Hello, > > Short version: > When a bound variable is used in the definition of a new function via > fun() is the value of the variable copied into the function definition, > or is a reference used? > > Is there a short way to import a function from another module into yours > so you can use it without the module: prefix? > > Long version: > > I would like to implement something like a spreadsheet in erlang. The > ultimate goal in a project like this is to provide the simplest, most > general, possible interface to the user. I have decided that the best > possible solution would be if the formulas allowable for the user were > plain erlang code. This would allow a user to do amazing things like > make a formula that generates a function and stores it in a cell, and at > a later timeframe a formula that applies a stored function to other data > or functions. In addition it would remove other possible burdens like > writing a parser for things like addition and subtraction or making a > generator for functions that will work in formulas. > > So, the problem breaks down like this: We have some data and a context, > and a formula from the user for the value of one cell of data in the > next time frame. Somehow we need to slip the data and context into the > user's formula without them seeing it. A nice formula would be something > like: > > "sqrt(Data(1, 1)^2 + Data(1, 2)^2)" > > Here's the idea for how to do this. Define a function which takes as its > arguments the position in the spreadsheet, and returns the value at that > location. Then assign that function to the variable Data bound inside > the evaluator. Then we will evaluate the function Formula in that > context. It would look something like this: > > CalculateCell(Data, Context, Formula) -> > DataFunction = fun(X, Y) -> LookupData(Data, Context, X, Y) end, > ... > Bindings = erl_eval:add_binding('Data', DataFunction, ...), > ... > eval(Formula, Bindings) > ... > > So here's the question. Erlang does not have destructive assignment, so > a variable like Data (which is going to be huge) can be safely passed > around all over the place almost entirely by reference; I assume Erlang > takes full advantage of an optimization like this. However, I do not > know if it will do the same thing in my definition of a function. Will > the function definition be in terms of references to Data and Context > that would only get de-referenced when serialized, or is the entirety of > Data copied into the definition of the function? > > Another issue is that it would be very desirable to have the math > functions available when the formula is evaluated. What module does an > evaluation happen in? I assume it happens in the module of the code that > called it. It would be desirable for things like math:sin to be usable > in a formula just through calling sin. Is there a shorter way to import > them into your module than: > > sin(Theta) -> > math:sin(Theta). > > cos(Theta) -> > math:cos(Theta). > > etc...? > > Thanks in advance for your time and advice, > > Cedric A. Shock > > > -- Shawn. Q: How do you play religious roulette? A: You stand around in a circle and blaspheme and see who gets struck by lightning first. From bengt.kleberg@REDACTED Tue Apr 13 10:29:24 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 13 Apr 2004 10:29:24 +0200 Subject: Anybody done this In-Reply-To: References: Message-ID: <407BA4E4.90506@ericsson.com> Dave Love wrote: > ...deleted > > > >>Oh no! Don't get Joe started on the virtues of Styx again! >>(Luckily he's away on holiday.) >> >> > >Sorry. A web search found no relevant mentions in an Erlang context, >which surprised me; hence the question. Can one read about it >somewhere? > > start at http://www.vitanuova.com/inferno/ for a general overview. move to http://www.vitanuova.com/inferno/papers/styx.html for the styx part. bengt From joe@REDACTED Tue Apr 13 15:51:20 2004 From: joe@REDACTED (Joe Armstrong) Date: Tue, 13 Apr 2004 15:51:20 +0200 (CEST) Subject: Erlang, Strings, Mnesia? In-Reply-To: <4075674E.9000309@cableone.net> Message-ID: On Thu, 8 Apr 2004, Jimmie Houchin wrote: > Hello, > > I am trying to understand whether or not Erlang is right or a good > option for a website I am building. > > Currently I am processing 422,000 files with 6.6gb of text to place in a > database. I will have to regularly parse and process large volumes of > textual data. > > The database will initially have 4-5 million rows/objects. > > This data in turn will be searchable. A prime purpose of the data. > > On this page of the Mnesia User Guide it says: > #http://www.erlang.se/doc/doc-5.3/lib/mnesia-4.1.4/doc/html/Mnesia_chap1.html#1 > # > #On the other hand, Mnesia may not be appropriate with the following > #types of applications: > # > # * Programs that process plain text or binary data files > > I am used to Squeak and Python and native string support. > > I understand well Erlang's strengths. I don't understand where it is weak. > > An example. > > Would Erlang be suitable for a Google type site? > An Amazon? An eBay? Based on what you have said so far there is no way of answering your question. Before doing *any* major bit of programming I always try to do the following: 1) Identify the most difficult problem(s) to be solved 2) Prototype solutions the the problems raised in 1) 3) Measure performance of prototype When this has converged you can go ahead and write the program. Premature optimizations and pre-conceived ideas about what is and is not efficient is a sure fired receipt for disaster. I would suggest you write a little parser and build a prototype *before* you make any decisions. Personally (now I'm *very* biased here) I'd go for yaws - why? Yaws got concurrency right. I know nothing about your application but there is a heck of a difference between having say 1000 users who just request a web page and then break the connection and 100,000 users who are logged in to chat systems and remain connected for hours at a time. Yaws is great for handling large numbers of persistent connections - outstanding. I would also (counter to what some other people have said) be very cautious about using *different* components in your system. If you use Erlang AND mySQL you have to learn to use two things - not one. The mySQL way of thinking (SQL) is NOT the Erlang way of thinking - and you will get an impedance mismatch between the two ways of thinking. Whenever I see projects that use A and B and C and D ... I judder in horror. Each new thing causes an explosion in complexity << and yes any problem no matter how trivial can be made nightmarishly difficult just by using Java, mySQL, Cobra, ASN.1, SOAP, WSDL, ...>> Projects that I complete in a small amount of time are almost invariably monolingual. Do *everything* in Erlang or C or whatever. IMHO - as soon as you start mixing things you get into a mess - as Wirth said (paraphrased) - mastery of one language is better than incomplete knowledge of several. So here's what I'd do: - Identify the HARD bits - do small prototypes of the hard bits - measure - if fast enough HOORAY if not fast enough ask this group why Cheers /Joe > > Any wisdom, advise welcome and appreciated. > > Jimmie Houchin > > From ft@REDACTED Tue Apr 13 16:36:02 2004 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 13 Apr 2004 16:36:02 +0200 Subject: inet6 support in inet:getaddr() In-Reply-To: <6B2C4EF0-8AE8-11D8-8EC6-000A95EB4F88@rogvall.com> References: <6B2C4EF0-8AE8-11D8-8EC6-000A95EB4F88@rogvall.com> Message-ID: <200404131636.02524.ft@it.su.se> On Saturday 10 April 2004 14.13, Tony Rogvall wrote: ... > Use > > inet:gethostbyname/2 > > it will return {ok, HEnt} where HEnt is a hostent record which is > defined in kernel/include/inet.hrl > > Please look around in the resolver code to find out more goodies ... > you may find the inet_dns/inet_res/inet_parse/inet_db and inet modules > interesting. Yummy. Thanks! Excellent. No more using regexps to determine if something is a valid IPv4 or v6 address ;) /Fredrik From ulf.wiger@REDACTED Tue Apr 13 16:39:58 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 13 Apr 2004 16:39:58 +0200 Subject: Erlang, Strings, Mnesia? Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402684@ESEALNT442.al.sw.ericsson.se> On Tue, 13 Apr 2004, Joe Armstrong wrote: > On Thu, 8 Apr 2004, Jimmie Houchin wrote: > > > > The database will initially have 4-5 million rows/objects. > > > > This data in turn will be searchable. A prime purpose of the data. > > [...] > > Would Erlang be suitable for a Google type site? > > An Amazon? An eBay? > > Based on what you have said so far there is no way of answering your > question. > > Before doing *any* major bit of programming I always try to do the > following: > > 1) Identify the most difficult problem(s) to be solved > 2) Prototype solutions the the problems raised in 1) > 3) Measure performance of prototype > > When this has converged you can go ahead and write the program. Well, as a general rule, I agree with Joe, but the fact remains that Mnesia is not terribly good at handling huge volumes of persistent data, and also not terribly good at string searching, nor storing huge amounts of string data in memory. Mnesia's disk-based storage is also weak compared to many of its competitors (part of which has to do with the wish to be able to handle variable-size records, something most DBMSes gladly refuse to do.) For one thing, mnesia lacks support for building word indices. This is something that you have to hack yourself if needed. Mnesia is very good at: - handling many tables; AXD 301 has > 500 tables in mnesia - fast access (from Erlang code) to memory-resident data - distributed processing and fault tolerance - scalability and low latency in transactions on horizontally fragmented data - on-line reconfiguration, including in-service upgrade I'm sure I've forgotten some things. I know of no one who's actually run a mnesia database containing 6 Gb of data. If you were to try it, you should try to partition the data into multiple tables, and if you still have very large tables, try to spread them across multiple processors in smaller fragments (but only if you can devise a smart access scheme to avoid whole-table searches.) My own personal record is a mnesia database totalling > 750 MB, split into 175 tables, where the largest table contains 1,750,000 records, for a total of 5.8 million records. This seems to work well, but I've done several rewrites optimizing the access patterns and try to store as much string data as atoms rather than strings (in some cases as binaries). This works, since I mostly match on whole strings. The Erlang VM plods along rather happily at 1.3 GB of RAM usage. (: (For a while, I went with a file system database, since I doubted mnesia's ability to cope with the volumes, but ran out of inodes. After that, I switched to mnesia, and it has worked well so far.) Finding a good way to cram the amount of data you're talking about into mnesia is surely, to cite Joe, one of the HARD bits. Regarding multi-component environments, well, Joe's argument is certainly not an argument for dropping Erlang out of the equation simply because you might have to go with another DBMS. The mainstream way of doing this is certainly to go with a multiple tool combo - say PHP, Perl and MySQL (shudder.) /Uffe From d.love@REDACTED Tue Apr 13 18:09:34 2004 From: d.love@REDACTED (Dave Love) Date: Tue, 13 Apr 2004 17:09:34 +0100 Subject: Anybody done this References: <407BA4E4.90506@ericsson.com> Message-ID: Bengt Kleberg writes: >>Sorry. A web search found no relevant mentions in an Erlang context, >>which surprised me; hence the question. Can one read about it >>somewhere? >> >> > start at http://www.vitanuova.com/inferno/ for a general > overview. move to http://www.vitanuova.com/inferno/papers/styx.html > for the styx part. Oh, I know Styx; it was the Erlang context I was interested in (but I wasn't thinking mainly of the protocol). Sorry for not being clear. From d.love@REDACTED Tue Apr 13 18:27:59 2004 From: d.love@REDACTED (Dave Love) Date: Tue, 13 Apr 2004 17:27:59 +0100 Subject: modified Emacs mode Message-ID: I sent changes to the Emacs mode to erlang-patches, but perhaps the modified erlang.el is useful now. It's currently at . The bulk of the changes are actually cosmetic commentary/doc fixes. The significant ones make it play better with Emacs 21 with up-to-date facilities. In particular, support for compilation error messages from an inferior erl (as opposed to batch compilation) works in the released Emacs 21, and currently with the development Emacs. It's only tested with Emacs 21, but shouldn't have broken anything else. I'm interested in reports of anything I've broken or anything else that wants fixing. From ft@REDACTED Tue Apr 13 18:38:56 2004 From: ft@REDACTED (Fredrik Thulin) Date: Tue, 13 Apr 2004 18:38:56 +0200 Subject: regexp match loop on ^+ Message-ID: <200404131838.56709.ft@it.su.se> Hi Magnus Ahltorp long ago implemented ENUM (RFC2916) support in Yxa. ENUM lets you enter for example a SIP URI equivalent with an E.164 number in DNS and uses regexps to make it possible to for example have DNS wildcard entrys for your phone numbers. Magnus then found a little implementation problem in implementing it in Erlang, because RFC2916 has examples containing ^+. On the last IETF there were a bit of talk about this. As far as I have heard, ^+ is not invalid but it is very implementation dependent how well it works. In Erlang, that is not very well :( >From RFC2916 : 3.2.3 Example 3 $ORIGIN 6.4.e164.arpa. * IN NAPTR 100 10 "u" "ldap+E2U" "!^+46(.*)$!ldap://ldap.se/cn=01!" . Tests : 1> regexp:match("+461234", "+46(.*)$"). {error,{illegal,"+"}} 2> regexp:match("+461234", "\\+46(.*)$"). {match,1,7} 3> regexp:match("+461234", "^+46(.*)$"). On the third one, Erlang (R9C-0) regexp implementation loops. regexp.erl was too complex for me to fix this myself, so I though I'd raise the issue on the list so that someone else might perhaps at least prevent the loop. /Fredrik From chandrashekhar.mullaparthi@REDACTED Wed Apr 14 11:16:53 2004 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 14 Apr 2004 10:16:53 +0100 Subject: xmerl usage question Message-ID: <77E0E8F4-8DF4-11D8-8353-000A95A09946@imp01ims.t-mobile.co.uk> Hi all, I'm trying to specify my own ETS table when using xmerl for parsing as follows. But the request fails the second time as below. 7> FetchFun = fun(_, State) -> {ok, {string, Dtd}, State} end. #Fun 19> xmerl_scan:string(Xml, [{fetch_fun, FetchFun}, {rules, myrules}]). {{xmlElement,'MyRequest', [], 1, [], [{xmlText,[{'MyRequest',1}],1,[],"\n"}, {xmlElement,'Elem1', [{'MyRequest',1}], 2, [], [{xmlText,[{'Elem1',2},{'MyRequest',1}],1,[],"abcd"}], [], 'Elem1', [], {xmlNamespace,[],[]}}, {xmlText,[{'MyRequest',1}],3,[],"\n"}, {xmlElement,'Elem2', [{'MyRequest',1}], 4, [], [{xmlText,[{'Elem2',4},{'MyRequest',1}],1,[],"abcd"}], [], 'Elem2', [], {xmlNamespace,[],[]}}, {xmlText,[{'MyRequest',1}],5,[],"\n"}], [], 'MyRequest', [], {xmlNamespace,[],[]}}, "\n"} 20> xmerl_scan:string(Xml, [{fetch_fun, FetchFun}, {rules, myrules}]). 871- fatal: {already_defined,'MyRequest'} ** exited: {fatal,{{already_defined,'MyRequest'},2,20}} ** Is there any way around this?? I see where this is happening, but I don't understand why xmerl flags this as an error. any help much appreciated. thanks, Chandru From ulf.wiger@REDACTED Wed Apr 14 11:57:25 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 14 Apr 2004 11:57:25 +0200 Subject: xmerl usage question In-Reply-To: <77E0E8F4-8DF4-11D8-8353-000A95A09946@imp01ims.t-mobile.co.uk> References: <77E0E8F4-8DF4-11D8-8353-000A95A09946@imp01ims.t-mobile.co.uk> Message-ID: On Wed, 14 Apr 2004 10:16:53 +0100, Chandrashekhar Mullaparthi wrote: > 20> xmerl_scan:string(Xml, [{fetch_fun, FetchFun}, {rules, myrules}]). > 871- fatal: {already_defined,'MyRequest'} > ** exited: {fatal,{{already_defined,'MyRequest'},2,20}} ** > > Is there any way around this?? I see where this is happening, but I > don't understand why xmerl flags this as an error. any help much > appreciated. The way dtd lookup in xmerl_scan is written, I couldn't immediately spot an obvious way to work around it. But then, I didn't write that code, ;), so perhaps someone else will be more successful finding a workaround. (to further emphasize the smiley, that's not intended to criticize the code or its author - merely pointing out that my understanding of it would possibly have been better if I had been the author.) I guess the rules_read_fun needs more information, or there needs to be a new option that allows already defined element definitions; then the rules_write_fun could check for conflicting definitions. /Uffe -- Ulf Wiger From fredrik.linder@REDACTED Wed Apr 14 13:33:21 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 14 Apr 2004 13:33:21 +0200 Subject: SV: xmerl usage question Message-ID: Hi Chandrashekhar First: It is an error in an external dtd spec to twice specify an element or its attrlst. I think it is allowed to re-define elements in the FetchFun = fun(_, State) -> {ok, {string, Dtd}, State} end. #Fun 19> xmerl_scan:string(Xml, [{fetch_fun, FetchFun}, {rules, myrules}]). {{xmlElement,'MyRequest', [], 1, [], [{xmlText,[{'MyRequest',1}],1,[],"\n"}, {xmlElement,'Elem1', [{'MyRequest',1}], 2, [], [{xmlText,[{'Elem1',2},{'MyRequest',1}],1,[],"abcd"}], [], 'Elem1', [], {xmlNamespace,[],[]}}, {xmlText,[{'MyRequest',1}],3,[],"\n"}, {xmlElement,'Elem2', [{'MyRequest',1}], 4, [], [{xmlText,[{'Elem2',4},{'MyRequest',1}],1,[],"abcd"}], [], 'Elem2', [], {xmlNamespace,[],[]}}, {xmlText,[{'MyRequest',1}],5,[],"\n"}], [], 'MyRequest', [], {xmlNamespace,[],[]}}, "\n"} 20> xmerl_scan:string(Xml, [{fetch_fun, FetchFun}, {rules, myrules}]). 871- fatal: {already_defined,'MyRequest'} ** exited: {fatal,{{already_defined,'MyRequest'},2,20}} ** Is there any way around this?? I see where this is happening, but I don't understand why xmerl flags this as an error. any help much appreciated. thanks, Chandru From erlang@REDACTED Wed Apr 14 18:31:15 2004 From: erlang@REDACTED (erlang@REDACTED) Date: Wed, 14 Apr 2004 17:31:15 +0100 Subject: Problem with porting ei program to MS Windows Message-ID: <704cc52846799b739278c405ffb6360f@tombob.com> Hi, I have a port program using the ei library running under Sparc Solaris. I have attemted porting it to Windows, but have come across the following problem. Most messages from my C program to Erlang cannot be correctly transformed with binary_to_term/1. I have reduced my program to something nice and small and have added debug output, and that shows identical streams of bytes being written. I am running R9C-0 on both Solaris and Windows XP. Any insights on this are happily received. Here is the run on Sparc Solaris: Eshell V5.3 (abort with ^G) 1> crashtest:start(). <0.30.0> 2> {ok,[{section,name,[],[],[locked,expanded],user,0,unknown}, {section,name,[],["one"],[],admin,1,bool}, {section,name,[],["one","two"],[locked],internal,2,integer}, {section,name,[],["one","two","three"],[expanded],deprecated,3,real}, {section,name,[],["one","two","three","four"],[locked],user,4,string}, {section,name,[],[],[],admin,5,enum}, {section,name,[],["one"],[locked,expanded],internal,6,pathname}, {section,name,[],["one","two"],[],deprecated,7,unknown}, {section,name,[],["one","two","three"],[locked],user,8,bool}, {section,name,[],["one","two","three","four"],[expanded],admin,9,integer}, {section,name,[],[],[locked],internal,10,real}, {section,name,[],["one"],[],deprecated,11,string}, {section,name,[],["one","two"],[locked,expanded],user,12,enum}, {section,name,[],["one","two","three"],[],admin,13,pathname}]} 2> ** exited: {port_terminated,{exit_status,0}} ** But on Windows XP I get: Eshell V5.3 (abort with ^G) 1> crashtest:start(). <0.30.0> 2> =ERROR REPORT==== 14-Apr-2004::17:18:33 === Error in process <0.30.0> with exit value: {badarg,[{erlang,binary_to_term,[<<1145 bytes>>]},{crashtest,loop,1}]} 2> ** exited: {badarg,[{erlang,binary_to_term, [<<131,104,2,100,0,2,111,107,108,0,0,0,1,104,8,100,0,7,115,101,99,...>>]}, {crashtest,loop,1}]} ** 2> Here is crashtest.erl: -module(crashtest). -export([start/0, stop/0,init/1]). start() -> spawn_link(?MODULE, init, ["./crashtest"]). stop() -> myserver ! stop. init(Cmd) -> register(myserver, self()), process_flag(trap_exit, true), Port = open_port({spawn, Cmd}, [binary, {packet, 4}, exit_status]), loop(Port). loop(Port) -> receive {Port, {data, Data}} -> io:fwrite("~p~n", [binary_to_term(Data)]), loop(Port); stop -> port_close(Port), exit(normal); {Port, {exit_status, Status}} -> exit({port_terminated, {exit_status, Status}}); {'EXIT', Port, Reason} -> exit({port_terminated, Reason}) end. And here is crashtest.c: #include #include #include #include #include #if defined(_WINDOWS) # include # include #else # include # include # include # include #endif #include "ei.h" /*support functions */ static int safe_write(char* buf, int len); static int send_msg(ei_x_buff *x); static void build_message(ei_x_buff *x); FILE *logfile; int main(int argc, char **argv) { ei_x_buff x; logfile = fopen("LOGFILE", "w"); fprintf(logfile, "Started.\n"); ei_x_new(&x); build_message(&x); if (send_msg(&x) < 0) fprintf(logfile, "No port to Erlang!\n"); ei_x_free(&x); return 0; } static int safe_write(char* buf, int len) { int tot = 0; int r; while (len > 0) { if ((r = write(1, buf, len)) <= 0) return r; tot += r; buf += r; len -= r; } return tot; } static void logbuff(char *b, int len, char *title) { int i; fprintf(logfile, "%s\n", title); for (i = 0; i < len; i++) { unsigned char c = b[i]; fprintf(logfile, " %03u (%c)\n", c, isprint(c) ? c : ' '); } fprintf(logfile, "\n"); } static int send_msg(ei_x_buff *x) { int host_len = x->index; int net_len = htonl(host_len); fprintf(logfile, "Sending %d bytes.\n", host_len); if (safe_write((char *) &net_len, 4) != 4) return -1; if (safe_write(x->buff, host_len) != host_len) return -1; logbuff(x->buff, host_len, "Sent:"); return host_len; } static void encode_string_list(ei_x_buff *x, int n, char **strings) { int i; for (i = 0; i < n; i++) { ei_x_encode_list_header(x, 1); ei_x_encode_string(x, strings[i]); } ei_x_encode_empty_list(x); } static void build_message(ei_x_buff *x) { int i; int n = 14; static void build_elem(ei_x_buff *x, int i); /* {ok, [Elem]} */ ei_x_encode_version(x); ei_x_encode_tuple_header(x, 2); ei_x_encode_atom(x, "ok"); for (i = 0; i < n; i++) { ei_x_encode_list_header(x, 1); build_elem(x, i); } ei_x_encode_empty_list(x); } static void build_elem(ei_x_buff *x, int i) { /* {"section", "name", [sysvalues], [uservalues], [locked|expanded], Access, sig_count, Sig_type, [sig_enumerations]} where Access = user | admin | internal | deprecated Sig_type = unknown | bool | integer | real | string | enum | pathname */ char *some_strings[] = { "one", "two", "three", "four", "five" }; char *sig_access2str[] = { "user", "admin", "internal", "deprecated" }; char *sig_type2str[] = { "unknown", "bool", "integer", "real", "string", "enum", "pathname" }; ei_x_encode_tuple_header(x, 8); ei_x_encode_atom(x, "section"); /* 1 */ ei_x_encode_atom(x, "name"); /* 2 */ encode_string_list(x, 0, NULL); /* 3 */ encode_string_list(x, i % 5, some_strings); /* 4 */ if (i % 2 == 0) { /* 5 */ ei_x_encode_list_header(x, 1); ei_x_encode_atom(x, "locked"); } if (i % 3 == 0) { ei_x_encode_list_header(x, 1); ei_x_encode_atom(x, "expanded"); } ei_x_encode_empty_list(x); ei_x_encode_atom(x, sig_access2str[i % 4]); /* 6 */ ei_x_encode_long(x, i); /* 7 */ ei_x_encode_atom(x, sig_type2str[i % 7]); /* 8 */ } Thank you for any help, Robby From taavi@REDACTED Wed Apr 14 18:53:03 2004 From: taavi@REDACTED (Taavi Talvik) Date: Wed, 14 Apr 2004 19:53:03 +0300 (EEST) Subject: Problem with porting ei program to MS Windows In-Reply-To: <704cc52846799b739278c405ffb6360f@tombob.com> Message-ID: <20040414195036.D86837-100000@valu.uninet.ee> On Wed, 14 Apr 2004 erlang@REDACTED wrote: Quite probably stdout in windows environment is open in "ASCII" mode. Which means, that "\r" is translated to "\r\n" or something. Try to change stdout flags. PS! This was the case 10 years ago. Maybe things are chenged now. best regards, taavi From pan+eq@REDACTED Wed Apr 14 18:59:06 2004 From: pan+eq@REDACTED (pan+eq@REDACTED) Date: Wed, 14 Apr 2004 18:59:06 +0200 (MEST) Subject: Problem with porting ei program to MS Windows In-Reply-To: <704cc52846799b739278c405ffb6360f@tombob.com> Message-ID: Hi, Rule of thumb, never use VC++ "unix/posix emulation thingie". ReadFile and WriteFile are the Win32 calls for reading and witing to file handles. This makes the program work though (context diff): *** crashtest.c.orig Wed Apr 14 18:52:41 2004 --- crashtest.c Wed Apr 14 18:53:48 2004 *************** *** 6,11 **** --- 6,12 ---- #if defined(_WINDOWS) # include + # include # include #else # include *************** *** 28,33 **** --- 29,37 ---- { ei_x_buff x; + #if defined(_WINDOWS) + _setmode(1,_O_BINARY); + #endif logfile = fopen("LOGFILE", "w"); fprintf(logfile, "Started.\n"); Cheers, /Patrik On Wed, 14 Apr 2004 erlang@REDACTED wrote: > Hi, > > I have a port program using the ei library running under Sparc Solaris. > I have attemted porting it to Windows, but have come across the > following problem. Most messages from my C program to Erlang cannot > be correctly transformed with binary_to_term/1. > > I have reduced my program to something nice and small and have added > debug output, and that shows identical streams of bytes being written. > I am running R9C-0 on both Solaris and Windows XP. > > Any insights on this are happily received. > > Here is the run on Sparc Solaris: > Eshell V5.3 (abort with ^G) > 1> crashtest:start(). > <0.30.0> > 2> {ok,[{section,name,[],[],[locked,expanded],user,0,unknown}, > {section,name,[],["one"],[],admin,1,bool}, > {section,name,[],["one","two"],[locked],internal,2,integer}, > {section,name,[],["one","two","three"],[expanded],deprecated,3,real}, > {section,name,[],["one","two","three","four"],[locked],user,4,string}, > {section,name,[],[],[],admin,5,enum}, > {section,name,[],["one"],[locked,expanded],internal,6,pathname}, > {section,name,[],["one","two"],[],deprecated,7,unknown}, > {section,name,[],["one","two","three"],[locked],user,8,bool}, > {section,name,[],["one","two","three","four"],[expanded],admin,9,integer}, > {section,name,[],[],[locked],internal,10,real}, > {section,name,[],["one"],[],deprecated,11,string}, > {section,name,[],["one","two"],[locked,expanded],user,12,enum}, > {section,name,[],["one","two","three"],[],admin,13,pathname}]} > 2> ** exited: {port_terminated,{exit_status,0}} ** > > But on Windows XP I get: > Eshell V5.3 (abort with ^G) > 1> crashtest:start(). > <0.30.0> > 2> > =ERROR REPORT==== 14-Apr-2004::17:18:33 === > Error in process <0.30.0> with exit value: {badarg,[{erlang,binary_to_term,[<<1145 bytes>>]},{crashtest,loop,1}]} > 2> ** exited: {badarg,[{erlang,binary_to_term, > [<<131,104,2,100,0,2,111,107,108,0,0,0,1,104,8,100,0,7,115,101,99,...>>]}, > {crashtest,loop,1}]} ** > 2> > > Here is crashtest.erl: > -module(crashtest). > > -export([start/0, stop/0,init/1]). > > start() -> > spawn_link(?MODULE, init, ["./crashtest"]). > > stop() -> > myserver ! stop. > > init(Cmd) -> > register(myserver, self()), > process_flag(trap_exit, true), > Port = open_port({spawn, Cmd}, [binary, {packet, 4}, exit_status]), > loop(Port). > > loop(Port) -> > receive > {Port, {data, Data}} -> > io:fwrite("~p~n", [binary_to_term(Data)]), > loop(Port); > stop -> > port_close(Port), > exit(normal); > {Port, {exit_status, Status}} -> > exit({port_terminated, {exit_status, Status}}); > {'EXIT', Port, Reason} -> > exit({port_terminated, Reason}) > end. > > > And here is crashtest.c: > #include > #include > #include > #include > #include > > #if defined(_WINDOWS) > # include > # include > #else > # include > # include > # include > # include > #endif > > #include "ei.h" > > /*support functions */ > static int safe_write(char* buf, int len); > static int send_msg(ei_x_buff *x); > static void build_message(ei_x_buff *x); > > FILE *logfile; > > int > main(int argc, char **argv) > { > ei_x_buff x; > > logfile = fopen("LOGFILE", "w"); > fprintf(logfile, "Started.\n"); > > ei_x_new(&x); > build_message(&x); > if (send_msg(&x) < 0) > fprintf(logfile, "No port to Erlang!\n"); > ei_x_free(&x); > > return 0; > } > > static int > safe_write(char* buf, int len) > { > int tot = 0; > int r; > > while (len > 0) { > if ((r = write(1, buf, len)) <= 0) > return r; > tot += r; > buf += r; > len -= r; > } > return tot; > } > > static void > logbuff(char *b, int len, char *title) > { > int i; > > fprintf(logfile, "%s\n", title); > for (i = 0; i < len; i++) > { > unsigned char c = b[i]; > fprintf(logfile, " %03u (%c)\n", c, isprint(c) ? c : ' '); > } > fprintf(logfile, "\n"); > } > > static int > send_msg(ei_x_buff *x) > { > int host_len = x->index; > int net_len = htonl(host_len); > > fprintf(logfile, "Sending %d bytes.\n", host_len); > > if (safe_write((char *) &net_len, 4) != 4) > return -1; > > if (safe_write(x->buff, host_len) != host_len) > return -1; > > logbuff(x->buff, host_len, "Sent:"); > > return host_len; > } > > > static void > encode_string_list(ei_x_buff *x, int n, char **strings) > { > int i; > > for (i = 0; i < n; i++) { > ei_x_encode_list_header(x, 1); > ei_x_encode_string(x, strings[i]); > } > ei_x_encode_empty_list(x); > } > > > static void > build_message(ei_x_buff *x) > { > int i; > int n = 14; > static void build_elem(ei_x_buff *x, int i); > > /* {ok, [Elem]} */ > ei_x_encode_version(x); > ei_x_encode_tuple_header(x, 2); > ei_x_encode_atom(x, "ok"); > for (i = 0; i < n; i++) { > ei_x_encode_list_header(x, 1); > build_elem(x, i); > } > ei_x_encode_empty_list(x); > } > > static void > build_elem(ei_x_buff *x, int i) > { > /* {"section", "name", [sysvalues], [uservalues], [locked|expanded], Access, > sig_count, Sig_type, [sig_enumerations]} > where > Access = user | admin | internal | deprecated > Sig_type = unknown | bool | integer | real | string | enum | pathname > */ > > char *some_strings[] = { "one", "two", "three", "four", "five" }; > char *sig_access2str[] = { "user", "admin", "internal", "deprecated" }; > char *sig_type2str[] = { "unknown", "bool", "integer", "real", "string", "enum", "pathname" }; > > ei_x_encode_tuple_header(x, 8); > ei_x_encode_atom(x, "section"); /* 1 */ > ei_x_encode_atom(x, "name"); /* 2 */ > encode_string_list(x, 0, NULL); /* 3 */ > encode_string_list(x, i % 5, some_strings); /* 4 */ > if (i % 2 == 0) { /* 5 */ > ei_x_encode_list_header(x, 1); > ei_x_encode_atom(x, "locked"); > } > if (i % 3 == 0) { > ei_x_encode_list_header(x, 1); > ei_x_encode_atom(x, "expanded"); > } > ei_x_encode_empty_list(x); > ei_x_encode_atom(x, sig_access2str[i % 4]); /* 6 */ > ei_x_encode_long(x, i); /* 7 */ > ei_x_encode_atom(x, sig_type2str[i % 7]); /* 8 */ > } > > > Thank you for any help, > Robby > From serge@REDACTED Thu Apr 15 00:08:57 2004 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 14 Apr 2004 18:08:57 -0400 Subject: Problem with porting ei program to MS Windows In-Reply-To: <704cc52846799b739278c405ffb6360f@tombob.com> References: <704cc52846799b739278c405ffb6360f@tombob.com> Message-ID: <407DB679.5050606@hq.idt.net> Try to use setmode() function on the stdout. I remember stumbling accross a similar problem on Windows: http://www.erlang.org/ml-archive/erlang-questions/200305/msg00259.html Serge erlang@REDACTED wrote: > Hi, > > I have a port program using the ei library running under Sparc Solaris. > I have attemted porting it to Windows, but have come across the > following problem. Most messages from my C program to Erlang cannot > be correctly transformed with binary_to_term/1. > > I have reduced my program to something nice and small and have added > debug output, and that shows identical streams of bytes being written. > I am running R9C-0 on both Solaris and Windows XP. > > Any insights on this are happily received. > > Here is the run on Sparc Solaris: > Eshell V5.3 (abort with ^G) > 1> crashtest:start(). > <0.30.0> > 2> {ok,[{section,name,[],[],[locked,expanded],user,0,unknown}, > {section,name,[],["one"],[],admin,1,bool}, > {section,name,[],["one","two"],[locked],internal,2,integer}, > {section,name,[],["one","two","three"],[expanded],deprecated,3,real}, > {section,name,[],["one","two","three","four"],[locked],user,4,string}, > {section,name,[],[],[],admin,5,enum}, > {section,name,[],["one"],[locked,expanded],internal,6,pathname}, > {section,name,[],["one","two"],[],deprecated,7,unknown}, > {section,name,[],["one","two","three"],[locked],user,8,bool}, > {section,name,[],["one","two","three","four"],[expanded],admin,9,integer}, > {section,name,[],[],[locked],internal,10,real}, > {section,name,[],["one"],[],deprecated,11,string}, > {section,name,[],["one","two"],[locked,expanded],user,12,enum}, > {section,name,[],["one","two","three"],[],admin,13,pathname}]} > 2> ** exited: {port_terminated,{exit_status,0}} ** > > But on Windows XP I get: > Eshell V5.3 (abort with ^G) > 1> crashtest:start(). > <0.30.0> > 2> > =ERROR REPORT==== 14-Apr-2004::17:18:33 === > Error in process <0.30.0> with exit value: {badarg,[{erlang,binary_to_term,[<<1145 bytes>>]},{crashtest,loop,1}]} > 2> ** exited: {badarg,[{erlang,binary_to_term, > [<<131,104,2,100,0,2,111,107,108,0,0,0,1,104,8,100,0,7,115,101,99,...>>]}, > {crashtest,loop,1}]} ** > 2> > > Here is crashtest.erl: > -module(crashtest). > > -export([start/0, stop/0,init/1]). > > start() -> > spawn_link(?MODULE, init, ["./crashtest"]). > > stop() -> > myserver ! stop. > > init(Cmd) -> > register(myserver, self()), > process_flag(trap_exit, true), > Port = open_port({spawn, Cmd}, [binary, {packet, 4}, exit_status]), > loop(Port). > > loop(Port) -> > receive > {Port, {data, Data}} -> > io:fwrite("~p~n", [binary_to_term(Data)]), > loop(Port); > stop -> > port_close(Port), > exit(normal); > {Port, {exit_status, Status}} -> > exit({port_terminated, {exit_status, Status}}); > {'EXIT', Port, Reason} -> > exit({port_terminated, Reason}) > end. > > > And here is crashtest.c: > #include > #include > #include > #include > #include > > #if defined(_WINDOWS) > # include > # include > #else > # include > # include > # include > # include > #endif > > #include "ei.h" > > /*support functions */ > static int safe_write(char* buf, int len); > static int send_msg(ei_x_buff *x); > static void build_message(ei_x_buff *x); > > FILE *logfile; > > int > main(int argc, char **argv) > { > ei_x_buff x; > > logfile = fopen("LOGFILE", "w"); > fprintf(logfile, "Started.\n"); > > ei_x_new(&x); > build_message(&x); > if (send_msg(&x) < 0) > fprintf(logfile, "No port to Erlang!\n"); > ei_x_free(&x); > > return 0; > } > > static int > safe_write(char* buf, int len) > { > int tot = 0; > int r; > > while (len > 0) { > if ((r = write(1, buf, len)) <= 0) > return r; > tot += r; > buf += r; > len -= r; > } > return tot; > } > > static void > logbuff(char *b, int len, char *title) > { > int i; > > fprintf(logfile, "%s\n", title); > for (i = 0; i < len; i++) > { > unsigned char c = b[i]; > fprintf(logfile, " %03u (%c)\n", c, isprint(c) ? c : ' '); > } > fprintf(logfile, "\n"); > } > > static int > send_msg(ei_x_buff *x) > { > int host_len = x->index; > int net_len = htonl(host_len); > > fprintf(logfile, "Sending %d bytes.\n", host_len); > > if (safe_write((char *) &net_len, 4) != 4) > return -1; > > if (safe_write(x->buff, host_len) != host_len) > return -1; > > logbuff(x->buff, host_len, "Sent:"); > > return host_len; > } > > > static void > encode_string_list(ei_x_buff *x, int n, char **strings) > { > int i; > > for (i = 0; i < n; i++) { > ei_x_encode_list_header(x, 1); > ei_x_encode_string(x, strings[i]); > } > ei_x_encode_empty_list(x); > } > > > static void > build_message(ei_x_buff *x) > { > int i; > int n = 14; > static void build_elem(ei_x_buff *x, int i); > > /* {ok, [Elem]} */ > ei_x_encode_version(x); > ei_x_encode_tuple_header(x, 2); > ei_x_encode_atom(x, "ok"); > for (i = 0; i < n; i++) { > ei_x_encode_list_header(x, 1); > build_elem(x, i); > } > ei_x_encode_empty_list(x); > } > > static void > build_elem(ei_x_buff *x, int i) > { > /* {"section", "name", [sysvalues], [uservalues], [locked|expanded], Access, > sig_count, Sig_type, [sig_enumerations]} > where > Access = user | admin | internal | deprecated > Sig_type = unknown | bool | integer | real | string | enum | pathname > */ > > char *some_strings[] = { "one", "two", "three", "four", "five" }; > char *sig_access2str[] = { "user", "admin", "internal", "deprecated" }; > char *sig_type2str[] = { "unknown", "bool", "integer", "real", "string", "enum", "pathname" }; > > ei_x_encode_tuple_header(x, 8); > ei_x_encode_atom(x, "section"); /* 1 */ > ei_x_encode_atom(x, "name"); /* 2 */ > encode_string_list(x, 0, NULL); /* 3 */ > encode_string_list(x, i % 5, some_strings); /* 4 */ > if (i % 2 == 0) { /* 5 */ > ei_x_encode_list_header(x, 1); > ei_x_encode_atom(x, "locked"); > } > if (i % 3 == 0) { > ei_x_encode_list_header(x, 1); > ei_x_encode_atom(x, "expanded"); > } > ei_x_encode_empty_list(x); > ei_x_encode_atom(x, sig_access2str[i % 4]); /* 6 */ > ei_x_encode_long(x, i); /* 7 */ > ei_x_encode_atom(x, sig_type2str[i % 7]); /* 8 */ > } > > > Thank you for any help, > Robby From cedricpublic@REDACTED Thu Apr 15 07:11:42 2004 From: cedricpublic@REDACTED (Cedric Shock) Date: Wed, 14 Apr 2004 22:11:42 -0700 Subject: How to make GS Widgets Message-ID: <407E198E.4070202@shockfamily.net> Hello, I have found a way to implement custom widgets for GS. Here's how it works: Spawn and link a new process for the widget. The new process (widget) will need at least the process id of its creator, and the gs reference to the container it will be placed in. Wait for the widget to respond with a gs reference to the frame it has made to contain itself. The widget will be able to manipulate this frame, and will recieve all the events from this frame. The widget process can now send event-like messages to the calling process. The widget process should monitor the process that created it, so that it will exit when its creator exits. The widget can provide an interface for feedback or control from the creating process. This method requires the creating process to posess the process id of the widget to fully manipulate it. For a small example of how this works, see the attachments. Are there any serious issues with taking advantage of this "undocumented feature" (the routing of events to the process that created the gs widget) to implement custom widgets? Will a process that is waiting at a receive clause use processor time, or will erlang put off executing it until there is a new message to consider? Thank you very much for your feedback, Cedric Shock -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: mywidgets.erl URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: widgettest.erl URL: From ulf.wiger@REDACTED Thu Apr 15 10:28:35 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Thu, 15 Apr 2004 10:28:35 +0200 Subject: How to make GS Widgets Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402689@ESEALNT442.al.sw.ericsson.se> Hello Cedric, Nice. Let me dodge your questions and instead volunteer a suggestion on a minor aspect of programming style: (: if is_tuple(SuppliedColor), size(SuppliedColor) == 3 -> {Red, Green, Blue} = SuppliedColor; true -> {Red, Green, Blue} = {0, 0, 0} end, If we tell the compiler to be a bit picky, it will warn against this type of code: erlc -W +warn_export_vars mywidgets.erl /home/etxuwig/work/erlang/mywidgets.erl:44: Warning: variable 'Red' exported from 'if' (line 35) /home/etxuwig/work/erlang/mywidgets.erl:47: Warning: variable 'Green' exported from 'if' (line 35) /home/etxuwig/work/erlang/mywidgets.erl:50: Warning: variable 'Blue' exported from 'if' (line 35) A very straightforward fix is: {Red, Green, Blue} = if is_tuple(SuppliedColor), size(SuppliedColor) == 3 -> SuppliedColor; true -> {0, 0, 0} end, Personally, I was a bit surprised that the compiler doesn't actually issue a warning when compiling mywidgets.erl, since Red, Green and Blue are in fact referred to after the 'if' expression. >From the man page for 'compile': "warn_export_vars Causes warnings to be emitted for all implicitly exported variables referred to after the primitives where they were first defined. No warnings for exported variables unless they are referred to in some pattern, which is the default, can be selected by the option nowarn_export_vars. " After a short experiment, I understand that the operative phrase is "in some pattern", but it's too early in the morning for me to grasp why one needs to issue warnings when implicitly exported variables are used in patterns, and not when they are used in expressions. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Cedric Shock > Sent: den 15 april 2004 07:12 > To: erlang-questions@REDACTED > Subject: How to make GS Widgets > > > Hello, > > I have found a way to implement custom widgets for GS. Here's > how it works: > > Spawn and link a new process for the widget. The new process (widget) > will need at least the process id of its creator, and the gs > reference > to the container it will be placed in. Wait for the widget to respond > with a gs reference to the frame it has made to contain itself. The > widget will be able to manipulate this frame, and will > recieve all the > events from this frame. The widget process can now send event-like > messages to the calling process. The widget process should > monitor the > process that created it, so that it will exit when its creator exits. > > The widget can provide an interface for feedback or control from the > creating process. This method requires the creating process to posess > the process id of the widget to fully manipulate it. > > For a small example of how this works, see the attachments. > > Are there any serious issues with taking advantage of this > "undocumented > feature" (the routing of events to the process that created the gs > widget) to implement custom widgets? Will a process that is > waiting at a > receive clause use processor time, or will erlang put off > executing it > until there is a new message to consider? > > Thank you very much for your feedback, > > Cedric Shock > > From erlang@REDACTED Thu Apr 15 11:01:43 2004 From: erlang@REDACTED (erlang@REDACTED) Date: Thu, 15 Apr 2004 10:01:43 +0100 Subject: Problem with porting ei program to MS Windows In-Reply-To: Message-ID: <4cc8e1b56b096b0553f5b8f4de51bf11@tombob.com> Thank you very much everyone. The setmode binary did the trick. I guess I should learn a bit more about Windows centric programming. Robby From chandrashekhar.mullaparthi@REDACTED Thu Apr 15 11:10:10 2004 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 15 Apr 2004 10:10:10 +0100 Subject: SV: xmerl usage question In-Reply-To: References: Message-ID: Hi Fredrik, On 14 Apr 2004, at 12:33, Fredrik Linder wrote: > Hi Chandrashekhar > > First: It is an error in an external dtd spec to twice specify an > element or its attrlst. I think it is allowed to re-define elements in > the > So back to xmerl: > > When xmerl parses the given string it will insert all information), and if there already is such information there it will > generate the error you've seen. Perfectly as it should be. The problem here is not that I have duplicate elements in my DTD. The problem is that when the same DTD is parsed again when parsing the next chunk of XML data, the parser complains about duplicate elements, because that element already exists in the rules table from the previous parse. > > Normally xmerl creates a *new* table for each call to > xmerl_scan:string/X, and hence will not generate that error. There seems to be a bug where the table is not deleted after the parse, resulting in the number of ETS tables to keep growing until the more ETS tables can be created (the default limit seems to be 1400) and the node then crashes. I haven't tracked down this bug yet. > > I'm I correct if I guess that you like to read the dtd files only > ones? If so, what you probably need to do is to at the second++ run > *not* read into the rules table and later swap to the one you earlier > read. You would proabably also need to play with the fetch options > when playing with the rules options in this way. > > And now a little about how we utilize this to only read the dtd files > ones: > > The way we do is to first parse a fake xml with all dtd information in > it using the {prolog, stop} and rules options, to initialize the > rules. > > Later we set the fetch options to choose the correct rules table > (instead of reading the dtd files) that matched the incoming dtd spec, > and switch to that rule set when the References: <37FB7AA6F5F9814FB634A7BF4C35A6F5402689@ESEALNT442.al.sw.ericsson.se> Message-ID: (Long explanation below, but it might be worth reading. Bear with me.) On Thu, 15 Apr 2004, Ulf Wiger (AL/EAB) wrote: > Let me dodge your questions and instead volunteer a suggestion > on a minor aspect of programming style: (: > > if > is_tuple(SuppliedColor), size(SuppliedColor) == 3 -> > {Red, Green, Blue} = SuppliedColor; > true -> > {Red, Green, Blue} = {0, 0, 0} > end, > > If we tell the compiler to be a bit picky, it will warn against > this type of code: > > erlc -W +warn_export_vars mywidgets.erl > /home/etxuwig/work/erlang/mywidgets.erl:44: Warning: variable 'Red' exported from 'if' (line 35) > /home/etxuwig/work/erlang/mywidgets.erl:47: Warning: variable 'Green' exported from 'if' (line 35) > /home/etxuwig/work/erlang/mywidgets.erl:50: Warning: variable 'Blue' exported from 'if' (line 35) Yes, but if the code is readable enough, as I would argue that it definitely is in the above case, there is no real reason to rewrite it to avoid "exporting variables from clauses". It's mostly a matter of personal taste, but after all, Erlang was designed from start to allow this way of binding variables, so why not use it as long as your code is readable? > Personally, I was a bit surprised that the compiler doesn't actually > issue a warning when compiling mywidgets.erl, since Red, Green and > Blue are in fact referred to after the 'if' expression. > > >From the man page for 'compile': > > "warn_export_vars > Causes warnings to be emitted for all implicitly exported variables > referred to after the primitives where they were first defined. No > warnings for exported variables unless they are referred to in some > pattern, which is the default, can be selected by the option > nowarn_export_vars. " > > After a short experiment, I understand that the operative phrase is > "in some pattern", but it's too early in the morning for me to grasp > why one needs to issue warnings when implicitly exported variables are > used in patterns, and not when they are used in expressions. Here's the explanation: 1. In the dawn of time, Erlang allowed case switches (and receives, etc.) to export variable bindings from clauses, as long as they were "safe", i.e., guaranteed to be bound no matter which clause was executed. All fine so far. 2. A particular form of errors became common, sometimes due to cut-and-paste programming, sometimes due to programmers forgetting which variable names they had already used further up in the same function, like this: case ... of true -> ..., X = foo, ...; false -> ..., X = bar, ... end, ... ... ... case Y of baz -> ...; X -> f(X) end, It's easy to miss that the "temporary local variable" X in the first case switch actually is legally exported (since it is bound in both clauses). As a consequence, the intended catch-all clause in the second case switch becomes not a binding occurrence, but a *test* to see if Y equals the value of X. Often, your program just crashes when this sort of thing happens, but sometimes it mysteriously keeps working, for instance if you instead had the following second case switch: case Y of {baz, X} -> f(X); _ -> g() end where the {baz, X} pattern would perhaps never match, and the catch-all is executed every time instead. Anyway, someone thus decided to add a compiler warning for all uses of exported variables, even the correct and reasonable ones. Since these warnings were enabled in several releases of Erlang, many people got used to the idea that exports were completely banned. 3. However, the following programming patterns are both correct, useful, and reasonable: X = f(...), ... case Y of {foo, X} -> ...; {foo, Other} -> ...; _ -> ... end (which did not cause any warnings), and case ... of true -> X = 1, Y = 2, Z = 3; false -> X = 2, Y = 4, Z = 8 end, R = f(X, Y, Z) which made the compiler complain (although it still compiled the code, since it is not at all incorrect). So it seems that the only place where a warning was really warranted was in the case I first described above, which is: A) a variable is exported from a case/if/receive B) the same variable is used in a pattern further down Of course, such a use could still be legal, but this rule seems to be a better compromise that allows you to use the language *feature* of exporting variables (without complaints), while still catching most typical mistakes. (I think this was done in R8, if I remember correctly.) /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From daniesc@REDACTED Thu Apr 15 13:52:51 2004 From: daniesc@REDACTED (Danie Schutte) Date: Thu, 15 Apr 2004 13:52:51 +0200 Subject: Erlang - C Node Timeout Question Message-ID: <200404151352.51358.daniesc@tebabank.com> Good afternoon all, I am wondering about the best solution for the following problem - I have an embedded C node - which is started by an Erlang node. The erlang node communicates with the C node and everything is working - except for an operation where the C node waits for security keys to be entered (takes about 3 minutes) - then the erlang node receives a timeout message - is there a place where this timeout value can be set - or is there another solution that might be suggested. Thanks to everyone ##################################################################################### The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy all copies. ##################################################################################### From hal@REDACTED Fri Apr 16 01:45:50 2004 From: hal@REDACTED (Hal Snyder) Date: Thu, 15 Apr 2004 18:45:50 -0500 Subject: Erlang - C Node Timeout Question In-Reply-To: <200404151352.51358.daniesc@tebabank.com> (Danie Schutte's message of "Thu, 15 Apr 2004 13:52:51 +0200") References: <200404151352.51358.daniesc@tebabank.com> Message-ID: <87wu4gztxt.fsf@ghidra.vail> Danie Schutte writes: > I am wondering about the best solution for the following problem - I > have an embedded C node - which is started by an Erlang node. The > erlang node communicates with the C node and everything is working - > except for an operation where the C node waits for security keys to > be entered (takes about 3 minutes) - then the erlang node receives a > timeout message - is there a place where this timeout value can be > set - or is there another solution that might be suggested. A guess would be the C node is not responding to an ERL_TICK when needed. But it would help to know more about how the C node and E node are talking. [Subversives here are pushing for more UBF, less ei. :) ] From vances@REDACTED Fri Apr 16 02:00:44 2004 From: vances@REDACTED (Vance Shipley) Date: Thu, 15 Apr 2004 20:00:44 -0400 Subject: Erlang - C Node Timeout Question In-Reply-To: <200404151352.51358.daniesc@tebabank.com> References: <200404151352.51358.daniesc@tebabank.com> Message-ID: <20040416000044.GE24440@frogman.motivity.ca> Danie, You may change the net ticktime with net_kernel:set_net_ticktime/1, or the kernel application environment variable net_ticktime: erl -kernel net_ticktime 180 The real solution is to avoid blocking the C node process for so long. -Vance From ok@REDACTED Fri Apr 16 03:11:28 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 16 Apr 2004 13:11:28 +1200 (NZST) Subject: exported variables (was: RE: How to make GS Widgets) Message-ID: <200404160111.i3G1BSpq260348@atlas.otago.ac.nz> Richard Carlsson wrote: Yes, but if the code is readable enough, as I would argue that it definitely is in the above case, there is no real reason to rewrite it to avoid "exporting variables from clauses". I would argue that the code in question is definitely NOT particularly readable. The most important thing about it is that it binds Red, Green, Blue. But the way it is written, it is hard to see that. In fact, there's something else hard to see: > if > is_tuple(SuppliedColor), size(SuppliedColor) == 3 -> > {Red, Green, Blue} = SuppliedColor; > true -> > {Red, Green, Blue} = {0, 0, 0} > end, Let's rewrite this for clarity: {Red,Green,Blue} = case SuppliedColor of {_,_,_} -> SuppliedColor; _ -> {0,0,0} end NOW it is obvious that (1) the purpose of the code is to determine Red, Green, Blue (2) SuppliedColor is used for this purpose if it looks right (3) 0,0,0 is used if it doesn't. (4) The test for SuppliedColor might not be strong enough; SuppliedColor = {green,eggs,ham} will in both versions of the code result in non-numeric values for Red, Green, Blue. It's rather easier to fix this using the 'case' form. It's mostly a matter of personal taste, but after all, Erlang was designed from start to allow this way of binding variables, so why not use it as long as your code is readable? On the other hand, why write long-winded unreadable code when short readable code is easily within reach? From cedricpublic@REDACTED Fri Apr 16 08:22:01 2004 From: cedricpublic@REDACTED (Cedric Shock) Date: Thu, 15 Apr 2004 23:22:01 -0700 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: <200404160111.i3G1BSpq260348@atlas.otago.ac.nz> References: <200404160111.i3G1BSpq260348@atlas.otago.ac.nz> Message-ID: <407F7B89.4040605@shockfamily.net> Richard O'Keefe and Ulf Wiger, Thank you for your suggestions of improved coding style. This is my first week of erlang programming, or even functional programming (I started by reading Concurrent Programming in Erlang a week ago). I am still strugling through documentation with almost everything I do. I like the style {Red,Green,Blue} = case SuppliedColor of {_,_,_} -> SuppliedColor; _ -> {0,0,0} end For its brevity and the way it makes the purpose of the code clear. I have been bothered by the weekness of my quards, but I do not know how to make them stronger. How can I put gaurds on the values of members of tuples? For example, I would like the SuppliedColor to be integers in the range [0, 255]. How could I write this guard clause? Is this the right thing to do? {Red,Green,Blue} = case SuppliedColor of {TestRed,TestGreen,TestBlue} when is_integer(TestRed), is_integer(TestGreen), is_integer(TestBlue), TestRed =< 255, TestRed => 0, TestGreen =< 255, TestGreen => 0, TestBlue =< 255, TestBlue => 0, -> SuppliedColor; _ -> {0,0,0} end Thanks for your input, Cedric Shock From luke@REDACTED Fri Apr 16 12:17:02 2004 From: luke@REDACTED (Luke Gorrie) Date: Fri, 16 Apr 2004 12:17:02 +0200 Subject: Erlang - C Node Timeout Question In-Reply-To: <87wu4gztxt.fsf@ghidra.vail> (Hal Snyder's message of "Thu, 15 Apr 2004 18:45:50 -0500") References: <200404151352.51358.daniesc@tebabank.com> <87wu4gztxt.fsf@ghidra.vail> Message-ID: Hal Snyder writes: > [Subversives here are pushing for more UBF, less ei. :) ] Speaking of UBF, do we know about Rivest's 1997 internet draft about "S-Expressions"? http://theory.lcs.mit.edu/~rivest/sexp.html It's very similar to UBF(A), not just plain ol' Lisp syntax. Cheers, Luke From valentin@REDACTED Fri Apr 16 14:44:26 2004 From: valentin@REDACTED (Valentin) Date: Fri, 16 Apr 2004 14:44:26 +0200 Subject: Erlang - C Node Timeout Question References: <200404151352.51358.daniesc@tebabank.com> <87wu4gztxt.fsf@ghidra.vail> Message-ID: <038501c423b0$8f2ec600$0100a8c0@MONEYMAKER2> Increasing net_ticktime is indiscriminate, and may cause trouble elsewhere. You might want to use "select" multiplexing, and check which stream is ready for reading, and then -- do the reading. Make sure that you check Erlang stream first. Another alternative is.... no, creating a dedicated reader thread is just going to foo bar your design. In some cases it might be as simple as re-connecting after failed transmission, but then you cannot monitor C-Node from dedicated server, etc. Best bet -- use select system call. V. PS > [Subversives here are pushing for more UBF, less ei. :) ] Just out of curiosity -- why is nobody using ERLANG RPC. It works so well for us, that it makes me worried that I do not see anyone else using it. It is very structured, and much closer to native Erlang than UBF. ----- Original Message ----- From: "Hal Snyder" To: Sent: Friday, April 16, 2004 1:45 AM Subject: Re: Erlang - C Node Timeout Question > Danie Schutte writes: > > > I am wondering about the best solution for the following problem - I > > have an embedded C node - which is started by an Erlang node. The > > erlang node communicates with the C node and everything is working - > > except for an operation where the C node waits for security keys to > > be entered (takes about 3 minutes) - then the erlang node receives a > > timeout message - is there a place where this timeout value can be > > set - or is there another solution that might be suggested. > > A guess would be the C node is not responding to an ERL_TICK when > needed. > > But it would help to know more about how the C node and E node are > talking. > > [Subversives here are pushing for more UBF, less ei. :) ] From tony@REDACTED Fri Apr 16 16:13:11 2004 From: tony@REDACTED (Tony Rogvall) Date: Fri, 16 Apr 2004 16:13:11 +0200 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: <407F7B89.4040605@shockfamily.net> Message-ID: <31C04986-8FB0-11D8-8417-000A95EB4F88@rogvall.com> fredagen den 16 april 2004 kl 08.22 skrev Cedric Shock: > Richard O'Keefe and Ulf Wiger, > > Thank you for your suggestions of improved coding style. This is my > first week of erlang programming, or even functional programming (I > started by reading Concurrent Programming in Erlang a week ago). I am > still strugling through documentation with almost everything I do. I > like the style > > {Red,Green,Blue} = case SuppliedColor of > {_,_,_} -> SuppliedColor; > _ -> {0,0,0} > end > > For its brevity and the way it makes the purpose of the code clear. I > have been bothered by the weekness of my quards, but I do not know how > to make them stronger. How can I put gaurds on the values of members > of tuples? For example, I would like the SuppliedColor to be integers > in the range [0, 255]. How could I write this guard clause? Is this > the right thing to do? > > {Red,Green,Blue} = case SuppliedColor of > {TestRed,TestGreen,TestBlue} when > is_integer(TestRed), > is_integer(TestGreen), > is_integer(TestBlue), > TestRed =< 255, TestRed => 0, > TestGreen =< 255, TestGreen => 0, > TestBlue =< 255, TestBlue => 0, -> > SuppliedColor; > _ -> > {0,0,0} > end > The above test is ok (except that you write >= not => in Erlang) An other version I like is to check all at once :-) the band/bor/bnot are bitwise operators. case SuppliedColor of {R,G,B} when (R bor G bor B) band (bnot 255) == 0 -> SuppliedColor; _ -> {0,0,0} end. /Tony From jay@REDACTED Fri Apr 16 17:55:47 2004 From: jay@REDACTED (Jay Nelson) Date: Fri, 16 Apr 2004 08:55:47 -0700 Subject: exported variables (was: RE: How to make GS Widgets) Message-ID: <4.2.2.20040416083930.00a6f100@duomark.com> Cedric wrote: >> {Red,Green,Blue} = case SuppliedColor of >> {TestRed,TestGreen,TestBlue} when >> is_integer(TestRed), >> is_integer(TestGreen), >> is_integer(TestBlue), >> TestRed =< 255, TestRed => 0, >> TestGreen =< 255, TestGreen => 0, >> TestBlue =< 255, TestBlue => 0, -> >> SuppliedColor; >> _ -> >> {0,0,0} >> end >> Tony replied: > The above test is ok (except that you write >= not => in Erlang) > An other version I like is to check all at once :-) > the band/bor/bnot are bitwise operators. > > case SuppliedColor of > {R,G,B} when (R bor G bor B) band (bnot 255) == 0 -> > SuppliedColor; > _ -> > {0,0,0} > end. I tend more towards Joe's inefficient clarity style. Make a support function so that you don't have this kind of complicated indentation: validate_colors({R, _, _}) when not is_integer(R); R < 0; R > 255 -> {0,0,0}; validate_colors({_, G, _}) when not is_integer(G); G < 0; G > 255 -> {0,0,0}; validate_colors({_, _, B}) when not is_integer(B); B < 0; B > 255 -> {0,0,0}; validate_colors({R, G, B}) -> {R, G, B}; validate_colors(_) -> {0,0,0}. Then in the code, call this: {Red, Green, Blue} = validate_colors(SuppliedColor) For me it is easier to test and to visually verify correctness, and easy to modify if the rules change. Whenever you find yourself doing complicated pattern matching with when clauses, case statements or an if, consider using a support function and let the language do the pattern matching in the function headers. jay From ulf.wiger@REDACTED Fri Apr 16 20:19:42 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 16 Apr 2004 20:19:42 +0200 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: <4.2.2.20040416083930.00a6f100@duomark.com> References: <4.2.2.20040416083930.00a6f100@duomark.com> Message-ID: On Fri, 16 Apr 2004 08:55:47 -0700, Jay Nelson wrote: > I tend more towards Joe's inefficient clarity style. Make a support > function so that you don't have this kind of complicated indentation: Agreed, but... > validate_colors({R, _, _}) when not is_integer(R); R < 0; R > 255 -> > {0,0,0}; > validate_colors({_, G, _}) when not is_integer(G); G < 0; G > 255 -> > {0,0,0}; > validate_colors({_, _, B}) when not is_integer(B); B < 0; B > 255 -> > {0,0,0}; > validate_colors({R, G, B}) -> > {R, G, B}; > validate_colors(_) -> > {0,0,0}. ... is how how I would write it. (: validate_colors({R, G, B}) -> VC = fun(C) -> validate_color(C) end, {VC(R), VC(G), VC(B)}. validate_color(C) when is_integer(C), C > 0, C < 255 -> C. /Uffe -- Ulf Wiger From jamesh@REDACTED Fri Apr 16 21:24:23 2004 From: jamesh@REDACTED (James Hague) Date: Fri, 16 Apr 2004 14:24:23 -0500 Subject: exported variables (was: RE: How to make GS Widgets) Message-ID: Jay Nelson wrote: >I tend more towards Joe's inefficient clarity >style. Make a support function so that you >don't have this kind of complicated indentation: I like that style as well. It's easier to write test cases for, too. And I *think* that the compiler removes the internal tuple creation in your code, as long as the helper functions aren't exported from the module. Or maybe just HiPE does this, and not the BEAM compiler? From jay@REDACTED Sat Apr 17 04:48:40 2004 From: jay@REDACTED (Jay Nelson) Date: Fri, 16 Apr 2004 19:48:40 -0700 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: References: <4.2.2.20040416083930.00a6f100@duomark.com> <4.2.2.20040416083930.00a6f100@duomark.com> Message-ID: <4.2.2.20040416192823.00dc78f0@duomark.com> At 08:19 PM 4/16/04 +0200, Ulf Wiger wrote: >... is how how I would write it. (: > >validate_colors({R, G, B}) -> > VC = fun(C) -> validate_color(C) end, > {VC(R), VC(G), VC(B)}. > >validate_color(C) when is_integer(C), C > 0, C < 255 -> > C. I assume you intended another clause for the non-valid cases to avoid the program failing with bad_match: validate_color(_) -> 0. Problem is you've changed the behavior. Consider what happens with validate_colors({-1, 52, 45}). Your version will either fail on bad_match or will return {0, 52, 45} if you add the clause I mentioned above. I think the original intent was to return {0, 0, 0} if any of the values is invalid or the shape of the tuple is wrong. In general, though, this exercise pointed out a technique for developing code as a beginning functional programmer. The problem is that most people come from an imperative or procedural background and have already learnt the brute force straight-ahead coding that the original case statement exemplifies. It leads to convoluted functional code but is the natural imperative way of attacking the problem. I would suggest the following approach: 1) Assume no invalid data and code the most clear and direct functions possible. 2) Once #1 is working, consider the most obvious and egregious errors and code the test for them as separate functions. 3) Test all #2 functions standalone in the interpreter. 4) Extend #1 with #2 functions by successive refinement: a_function(WithPossiblyBadData) -> NotEgregiouslyBadData = egregious(WithPossiblyBadData), MuchCleanerData = eliminate_end_cases(NotEgregiouslyBadData), GoodToGo = all_other_bad_cases(MuchCleanerData), a_function_accepting_only_good_data(GoodToGo). 5) If it works and is fast enough leave it alone, otherwise try to make it faster by profiling where the issues are. The most "revolutionary" concept for new programmers is the conversion from a procedural style to a functional style. Don't try to solve the whole problem. Get yourself part way there and then do it again on the remaining part (this is the easiest way to understand recursion as well). The series of suggestions from the original to Ulf's final version is a plausible trace of a real developer's "refactoring" of functional code. The less concise intermediate versions simplify testing and reveal the issues at the heart of solving the problem. Removing redundant code, simplifying functions and verifying that the results are the same all qualify as step #5 tasks. jay From ulf.wiger@REDACTED Sat Apr 17 22:59:46 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 17 Apr 2004 22:59:46 +0200 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: <4.2.2.20040416192823.00dc78f0@duomark.com> References: <4.2.2.20040416083930.00a6f100@duomark.com> <4.2.2.20040416083930.00a6f100@duomark.com> <4.2.2.20040416192823.00dc78f0@duomark.com> Message-ID: On Fri, 16 Apr 2004 19:48:40 -0700, Jay Nelson wrote: > At 08:19 PM 4/16/04 +0200, Ulf Wiger wrote: > >> ... is how how I would write it. (: >> >> validate_colors({R, G, B}) -> >> VC = fun(C) -> validate_color(C) end, >> {VC(R), VC(G), VC(B)}. >> >> validate_color(C) when is_integer(C), C > 0, C < 255 -> >> C. > > I assume you intended another clause for the non-valid > cases to avoid the program failing with bad_match: > > validate_color(_) -> > 0. Actually, no, but I was aware of the fact that by doing so, I changed the semantics of the code. I usually don't silently transform illegal input to default values, especially not in early versions. I find that it is almost always better to let the program fail in those cases. And function_clause is a perfectly good way to fail, IMHO. (: /Uffe -- Ulf Wiger From tony@REDACTED Sat Apr 17 23:52:28 2004 From: tony@REDACTED (Tony Rogvall) Date: Sat, 17 Apr 2004 23:52:28 +0200 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: Message-ID: <854D1EB3-90B9-11D8-9CEA-000A95EB4F88@rogvall.com> l?rdagen den 17 april 2004 kl 22.59 skrev Ulf Wiger: > On Fri, 16 Apr 2004 19:48:40 -0700, Jay Nelson wrote: > >> At 08:19 PM 4/16/04 +0200, Ulf Wiger wrote: >> >>> ... is how how I would write it. (: >>> >>> validate_colors({R, G, B}) -> >>> VC = fun(C) -> validate_color(C) end, >>> {VC(R), VC(G), VC(B)}. >>> >>> validate_color(C) when is_integer(C), C > 0, C < 255 -> >>> C. >> >> I assume you intended another clause for the non-valid >> cases to avoid the program failing with bad_match: >> >> validate_color(_) -> >> 0. > Why add an extra "named" function ? Why not ? validate_colors({R, G, B}) -> VC = fun(C) -> when C>=0, C=<255 -> C end, {VC(R), VC(G), VC(B)}. My guess is that is that R/G/B should be valid in the range [0,255] ! Note that I still think my version is the most elegant :-) (and efficient) /Tony From ulf.wiger@REDACTED Sun Apr 18 00:33:36 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 18 Apr 2004 00:33:36 +0200 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: <854D1EB3-90B9-11D8-9CEA-000A95EB4F88@rogvall.com> References: <854D1EB3-90B9-11D8-9CEA-000A95EB4F88@rogvall.com> Message-ID: On Sat, 17 Apr 2004 23:52:28 +0200, Tony Rogvall wrote: > Why add an extra "named" function ? Why not ? > > validate_colors({R, G, B}) -> > VC = fun(C) -> when C>=0, C=<255 -> C end, > {VC(R), VC(G), VC(B)}. ...because I decided ten seconds after hitting "send" that that was indeed the better solution. (: My first thought was that crash reports would be clearer with a separate function, but there's no significant difference. /Uffe -- Ulf Wiger From jay@REDACTED Sun Apr 18 00:39:11 2004 From: jay@REDACTED (Jay Nelson) Date: Sat, 17 Apr 2004 15:39:11 -0700 Subject: exported variables (was: RE: How to make GS Widgets) In-Reply-To: References: <4.2.2.20040416192823.00dc78f0@duomark.com> <4.2.2.20040416083930.00a6f100@duomark.com> <4.2.2.20040416083930.00a6f100@duomark.com> <4.2.2.20040416192823.00dc78f0@duomark.com> Message-ID: <4.2.2.20040417153552.00a6ebf0@duomark.com> At 10:59 PM 4/17/04 +0200, Ulf Wiger wrote: >>I assume you intended another clause for the non-valid >>cases to avoid the program failing with bad_match: >> >>validate_color(_) -> >> 0. > >Actually, no, but I was aware of the fact that by doing so, >I changed the semantics of the code. Oh, I was trying to reproduce the same semantics in a different way so that the original poster could compare them. >I usually don't silently transform illegal input to default >values, especially not in early versions. I find that it is >almost always better to let the program fail in those >cases. And function_clause is a perfectly good way to fail, >IMHO. (: I agree wholeheartedly with that approach. From baloghrobi@REDACTED Sun Apr 18 09:17:01 2004 From: baloghrobi@REDACTED (Robert Balogh) Date: Sun, 18 Apr 2004 09:17:01 +0200 Subject: combobox gs object Message-ID: Hej, I'm interesed has anybody combobox gs object? I try to find it in internet, but I can't :-( If has anybody this object, and it is "free-source" please send to me. Thanks for your help, /Robi -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Apr 19 04:56:29 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 19 Apr 2004 14:56:29 +1200 (NZST) Subject: exported variables (was: RE: How to make GS Widgets) Message-ID: <200404190256.i3J2uTqc318183@atlas.otago.ac.nz> Cedric Shock wrote: For its brevity and the way it makes the purpose of the code clear. I have been bothered by the weekness of my quards, but I do not know how to make them stronger. How can I put gaurds on the values of members of tuples? For example, I would like the SuppliedColor to be integers in the range [0, 255]. How could I write this guard clause? Is this the right thing to do? {Red,Green,Blue} = case SuppliedColor of {TestRed,TestGreen,TestBlue} when is_integer(TestRed), is_integer(TestGreen), is_integer(TestBlue), TestRed =< 255, TestRed => 0, TestGreen =< 255, TestGreen => 0, TestBlue =< 255, TestBlue => 0, -> SuppliedColor; _ -> {0,0,0} end Good programmers are lazy and have excellent precognitive skills. More truthfully, they have learned a number of language-independent rules of thumb which do the precognition for them. One of those rules of thumb is "If you have a data type, you probably want a recogniser for it." If I'm going to be dealing with colours in a program, I'm going to start by writing a comment that says what a "colour" looks like AND by writing a function which checks whether something is a colour. Even in a statically typed language there are often aspects of a data structure which cannot be checked by the type checker; in Haskell I'd have type Colour = (Int,Int,Int) is_colour (r,g,b) = 0 <= r <= 255 && 0 <= g <= 255 && 0 <= b <= 255 because the Haskell type system cannot express the range constraints. So in Erlang, let's write is_colour({R,G,B}) when integer(R), 0 <= R, R <= 255, % Red component integer(G), 0 <= G, G <= 255, % Green component integer(B), 0 <= B, B <= 255 % Blue component -> true; is_colour(_) -> false. and then write {Red,Green,Blue} = case is_colour(SuppliedColor) of true -> SuppliedColor; false -> {0,0,0} end If the alternatives are "a valid colour" and "something which is not a 3-tuple", then there's no need to do the full check; on the other hand there's no harm in it either. The abstract patterns stuff I proposed a few years ago (which turns out to be _almost_ but not quite the same thing as 'views' that have been implemented in some versions of Haskell) would let you set up an abstract pattern: #colour(R,G,B) when integer(R), 0 <= R, R <= 255, integer(G), 0 <= G, G <= 255, integer(B), 0 <= B, B <= 255 -> {R,G,B}. and then you would be able to write {Red,Green,Blue} = case SuppliedColor of #colour(_,_,_) -> SuppliedColor; _ -> {0,0,0} end Just as Joe Armstrong would really like to see !! in Erlang because it can do a lot of things, so I would like to see abstract patterns in Erlang because they can make some code a lot clearer. Until then, is_colour/1 is the way to go. From ft@REDACTED Mon Apr 19 08:33:42 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 19 Apr 2004 08:33:42 +0200 Subject: finding my own IPv6 address Message-ID: <200404190833.42412.ft@it.su.se> Hi In SIP, it is (unfortunately) necessary for you to know your own IP address from time to time. For IPv4 we (Yxa SIP-server/stack) have been using the undocumented and unsupported function inet:get_if() with great success. Now I'm wondering if there is maybe an equally undocumented and unsupported way of finding your own IPv6 address (without querying DNS for your hostname)? I tried the following : 1> {ok, S} = inet_udp:open(0,[inet6]). {ok,#Port<0.29>} 2> inet:ifget(S, "vr0", [addr, flags]). {ok,[{addr,{130,237,95,62}},{flags,[up,broadcast,running,multicast]}]} 3> to pass a v6-socket to prim_inet:ifget() instead of the default v4 socket inet:withsocket() would use, but unfortunately it only returns my v4 address. Anybody know a way of doing this? /Fredrik From tony@REDACTED Mon Apr 19 13:53:22 2004 From: tony@REDACTED (Tony Rogvall) Date: Mon, 19 Apr 2004 13:53:22 +0200 Subject: finding my own IPv6 address In-Reply-To: <200404190833.42412.ft@it.su.se> Message-ID: <28BD1968-91F8-11D8-9928-000A95EB4F88@rogvall.com> m?ndagen den 19 april 2004 kl 08.33 skrev Fredrik Thulin: > Hi > > In SIP, it is (unfortunately) necessary for you to know your own IP > address > from time to time. For IPv4 we (Yxa SIP-server/stack) have been using > the > undocumented and unsupported function inet:get_if() with great > success. Now > I'm wondering if there is maybe an equally undocumented and > unsupported way > of finding your own IPv6 address (without querying DNS for your > hostname)? > > I tried the following : > > 1> {ok, S} = inet_udp:open(0,[inet6]). Should be inet6_udp:open(0, []) or gen_udp:open(0, [inet6]). > {ok,#Port<0.29>} > 2> inet:ifget(S, "vr0", [addr, flags]). > > {ok,[{addr,{130,237,95,62}},{flags,[up,broadcast,running,multicast]}]} > 3> > For some reason this does not work (even if using a ipv6 socket) My guess is that the code in the inet_drv for getting ipv6 interface address is not correct. (The IPv6 support code was written in a early phase of IPv6, names and interfaces was non standard...) To get an interface address inet_drv is using SIOCGIFADDR ioctl, this does not work with IPv6 (tried solaris/linux/mac os X). Since IPv6 use a different method for adding and deleting addresses the interface must be changed to handle that. I assume that this goes for bsd/solairs virtual addresses as well, where you add/del slave interfaces. In linux it used to be simple (still is but changing?) just add a virtual interface say eth0:15 and set the address :-) I know that some people on the list has more input on this :-) (The work around? is as always to walk into the os:cmd swamp :-) os:cmd("ifconfig eth0 | grep \"inet6 addr:\""). Then start parsing) /Tony From ft@REDACTED Mon Apr 19 14:02:58 2004 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 19 Apr 2004 14:02:58 +0200 Subject: finding my own IPv6 address In-Reply-To: <28BD1968-91F8-11D8-9928-000A95EB4F88@rogvall.com> References: <28BD1968-91F8-11D8-9928-000A95EB4F88@rogvall.com> Message-ID: <200404191402.58563.ft@it.su.se> On Monday 19 April 2004 13.53, Tony Rogvall wrote: > m?ndagen den 19 april 2004 kl 08.33 skrev Fredrik Thulin: > > Hi > > > > In SIP, it is (unfortunately) necessary for you to know your own IP > > address > > from time to time. For IPv4 we (Yxa SIP-server/stack) have been using > > the > > undocumented and unsupported function inet:get_if() with great > > success. Now > > I'm wondering if there is maybe an equally undocumented and > > unsupported way > > of finding your own IPv6 address (without querying DNS for your > > hostname)? > > > > I tried the following : > > > > 1> {ok, S} = inet_udp:open(0,[inet6]). > > Should be inet6_udp:open(0, []) > or gen_udp:open(0, [inet6]). Silly me, I knew that. Should not test things before coffee on a monday morning ;) I then get another result. Less missguiding, but still not what I needed : 1> {ok, S} = gen_udp:open(0, [inet6]). {ok,#Port<0.31>} 2> inet:ifget(S, "vr0", [addr, flags]). {error,einval} 3> ... > (The work around? is as always to walk into the os:cmd swamp :-) > os:cmd("ifconfig eth0 | grep \"inet6 addr:\""). > Then start parsing) I don't want to go there, but thanks for your reply. /Fredrik From mickael.remond@REDACTED Mon Apr 19 16:32:36 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 19 Apr 2004 16:32:36 +0200 Subject: Problem building Erlang on HPPA Message-ID: Hello, I do not know if someone has managed to make Erlang work on HPPA architecture. It seems that the Debian distribution Erlang maintainer needs help for HPPA architecture: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=189591 The problem with the build on HPPA is that with this problem, Erlang will not be included in the latest Debian version, which is a pity. I do not have access to HPPA computer but if someone can help this would be helpfull for the distribution of Erlang ... -- Micka?l R?mond http://www.erlang-projects.org/ From dsolaz@REDACTED Mon Apr 19 20:15:22 2004 From: dsolaz@REDACTED (Daniel Solaz) Date: Mon, 19 Apr 2004 20:15:22 +0200 Subject: Problem building Erlang on HPPA In-Reply-To: References: Message-ID: <200404192015.22544.dsolaz@sistelcom.com> On Monday 19 April 2004 16:32, Mickael Remond wrote: > I do not know if someone has managed to make Erlang work on HPPA > architecture. > It seems that the Debian distribution Erlang maintainer needs help > for HPPA architecture: I do have Erlang running on HPPA debian unstable, but I compiled from sources. I can't tell the exact details (IIRC it is R9B-0 with threads, and shared heap or kernel poll, but most likely not hipe; the machine is a 32-bit big-endian HP 9000 D220) because I don't have access to the machine right now. But I remember it wasn't hard to get it going. I haven't stress-tested it in any way. > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=189591 Maybe I'm dumb, and I know very little about debian, but this page doesn't make much (or any) sense to me. What's the trouble? -Daniel From mickael.remond@REDACTED Tue Apr 20 00:23:14 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Mon, 19 Apr 2004 22:23:14 -0000 Subject: Problem building Erlang on HPPA In-Reply-To: <200404192015.22544.dsolaz@sistelcom.com> References: <200404192015.22544.dsolaz@sistelcom.com> Message-ID: On Mon, 19 Apr 2004 20:15:22 +0200, Daniel Solaz wrote: > On Monday 19 April 2004 16:32, Mickael Remond wrote: >> I do not know if someone has managed to make Erlang work on HPPA >> architecture. >> It seems that the Debian distribution Erlang maintainer needs help >> for HPPA architecture: > > I do have Erlang running on HPPA debian unstable, but I compiled from > sources. I can't tell the exact details (IIRC it is R9B-0 with > threads, and shared heap or kernel poll, but most likely not hipe; the > machine is a 32-bit big-endian HP 9000 D220) because I don't have > access to the machine right now. But I remember it wasn't hard to get > it going. I haven't stress-tested it in any way. Ok. I will try to contact the guy that has a problem with the erlang on HPPA to tell him that this should be working. >> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=189591 > > Maybe I'm dumb, and I know very little about debian, but this page > doesn't make much (or any) sense to me. What's the trouble? Yes, this is not very clear. From what I understand from the guy who told me about the problem, the Erlang virtual machine is crashing when you launch it. Thank you for your feedback. This was helpful ! -- Micka?l R?mond http://www.erlang-projects.org/ From bfulg@REDACTED Mon Apr 19 22:35:32 2004 From: bfulg@REDACTED (Brent Fulgham) Date: Mon, 19 Apr 2004 13:35:32 -0700 (PDT) Subject: Problem building Erlang on HPPA In-Reply-To: Message-ID: <20040419203532.8836.qmail@web80301.mail.yahoo.com> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=189591 > > The problem with the build on HPPA is that with this > problem, Erlang will > not be included in the latest Debian version, which > is a pity. > > I do not have access to HPPA computer but if someone > can help this would > be helpfull for the distribution of Erlang ... > Actually, I just closed this bug, as it seems to build just fine: http://buildd.debian.org/fetch.php?&pkg=erlang&ver=1%3A9.2-5&arch=hppa&stamp=1080342871&file=log&as=raw The old mac architecture seems to be the problem: http://buildd.debian.org/fetch.php?&pkg=erlang&ver=1%3A9.2-5&arch=m68k&stamp=1076437701&file=log&as=raw -Brent From matthias@REDACTED Mon Apr 19 23:18:19 2004 From: matthias@REDACTED (Matthias Lang) Date: Mon, 19 Apr 2004 23:18:19 +0200 Subject: Problem building Erlang on HPPA In-Reply-To: References: <200404192015.22544.dsolaz@sistelcom.com> Message-ID: <16516.16923.260479.516433@antilipe.corelatus.se> Mickael Remond writes: > >> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=189591 [...] > Yes, this is not very clear. From what I understand from the guy who told > me about the problem, the Erlang virtual machine is crashing when you > launch it. More specifically, it crashes while building Erlang. There's a complete build log at http://buildd.debian.org/fetch.php?&pkg=erlang&ver=1%3A9.1-2&arch=hppa&stamp=1052727248&file=log&as=raw Here's where it goes wrong: === Entering application kernel make[4]: Entering directory `/build/buildd/erlang-9.1/lib/kernel/src' erlc -W -bbeam +debug_info -I../include -o../ebin application.erl {"init terminating in do_boot",{'cannot load',erlang,get_file}} init terminating in do_boot () make[4]: *** [../ebin/application.beam] Error 1 make[4]: Leaving directory `/build/buildd/erlang-9.1/lib/kernel/src' Also, Gerd Flaig reported a problem with Debian's package with R9C in it. It doesn't happen if you compile R9C yourself. I have no idea whether this has been fixed in debian. I'm not sure if the debian maintainer is interested in bug reports without fixes. http://www.erlang.org/ml-archive/erlang-questions/200403/msg00178.html Matthias From dustin@REDACTED Tue Apr 20 10:22:48 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 01:22:48 -0700 Subject: spawn without linking? Message-ID: Hi, I'm pretty new to erlang, but one thing that seems to have caused me problems in my toys so far is spawning a process without linking. When is it a good idea to do such a thing? Every time I've thought it was, it just ended up covering up a bug that ended up being difficult to track down. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From joe@REDACTED Tue Apr 20 11:32:36 2004 From: joe@REDACTED (Joe Armstrong) Date: Tue, 20 Apr 2004 11:32:36 +0200 (CEST) Subject: spawn without linking? In-Reply-To: Message-ID: > > Hi, I'm pretty new to erlang, but one thing that seems to have caused > me problems in my toys so far is spawning a process without linking. > When is it a good idea to do such a thing? Every time I've thought it > was, it just ended up covering up a bug that ended up being difficult > to track down. Things that you want to be independent should not be linked together. If you have two entirely different applications A and B you absolutely do not want A to be linked to B. If you have some error logger L then you *do* want L to be linked to A and L to be linked to B. Errors in A or B should be reported by L. Links are in the language for error detection purposes. When a process terminates other processes in the system might need to know about this so they can do something about the situation. Suppose X dies - which other processes should be told about this? Answer: If X evaluates link(Y) then Y will told if X dies (this is symmetric so Y might evaluate link(X) for the same effect). spawn_link could *almost* be defined like this: spawn_link(F) -> Pid = spawn(Fun), link(Pid), Pid. But this is not correct (Why? - the process might die *between* the spawn and the link) - so spawn_link does spawn and link atomically. If you're new to Erlang I'd use spawn_link - as you build sexier applications you should think *carefully* about what should happen when things die and try to stop errors propagating between independent components. You might like to look at the documentation for erlang:monitor (do > erl -man man erlang) - this sets up a asymmetric link - which is often very useful. Cheers /Joe > > -- > SPY My girlfriend asked me which one I like better. > pub 1024/3CAE01D5 1994/11/03 Dustin Sallings > | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE > L_______________________ I hope the answer won't upset her. ____________ > From dustin@REDACTED Tue Apr 20 21:08:58 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 12:08:58 -0700 Subject: spawn without linking? In-Reply-To: References: Message-ID: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> On Apr 20, 2004, at 2:32, Joe Armstrong wrote: > Things that you want to be independent should not be linked together. > > If you have two entirely different applications A and B you absolutely > do not want A to be linked to B. > > If you have some error logger L then you *do* want L to be linked to A > and L to be linked to B. Errors in A or B should be reported by L. I suppose I've been thinking about A and B both being launched by M (like init(8)) so there would always be a process ultimately responsible for everything. > spawn_link could *almost* be defined like this: > > spawn_link(F) -> > Pid = spawn(Fun), > link(Pid), > Pid. It was before I found spawn_link! :) > But this is not correct (Why? - the process might die *between* the > spawn > and the link) - so spawn_link does spawn and link atomically. Definitely good to know. > If you're new to Erlang I'd use spawn_link - as you build sexier > applications > you should think *carefully* about what should happen when things die > and try to > stop errors propagating between independent components. Yeah, I've no doubt a lot to learn. > You might like to look at the documentation for erlang:monitor (do > > erl -man man erlang) > - this sets up a asymmetric link - which is often very useful. I'm using erlang:monitor for an exercise, but I guess I'm not entirely sure how to deal with abnormal exits that are propagated by links. For example, I've got the following code: % Demo process echo() -> receive {From, N} -> io:format("Sending back ~p from ~p\n", [N, self()]), From ! N, echo(); stop -> io:format("Stopping ~p\n", [self()]), true; error -> exit("Got an error"); Unknown -> error_logger:error_msg("~p exiting due to unhandled message: ~p\n", [self(), Unknown]) end. % Replace a process in a process list mcpReplaceProcess(OldPid, Procs) -> NewProc = spawn_link(coursemp, echo, []), % erlang:monitor(process, NewProc), io:format("Created new proc ~p\n", [NewProc]), OtherProcs = lists:filter(fun (P) -> not(P == OldPid) end, Procs), [NewProc | OtherProcs]. % Listen for messages from the processes this thing controls mcpLoop(Procs) -> io:format("Looping with procs: ~p\n", [Procs]), receive {sendto, N, Msg} -> lists:nth(N, Procs) ! Msg, mcpLoop(Procs); {'DOWN', _Ref, process, Pid, _Flag} -> io:format("MCP got down message for ~p\n", [Pid]), mcpLoop(mcpReplaceProcess(Pid, Procs)); Msg -> io:format("MCP got ~p\n", [Msg]), mcpLoop(Procs) end. % Start up a bunch of processes and loop mcpMonitor(N) -> Procs = listBuilder(fun () -> spawn_link(coursemp, echo, []) end, N, []), lists:foreach(fun (P) -> erlang:monitor(process, P) end, Procs), mcpLoop(Procs). % Get an Mcp process controlling the given number of echo processes mcp(N) -> spawn_link(coursemp, mcpMonitor, [N]). I'd like the 'error' message to be handled properly by the echo process in a similar fashion to what monitor is doing, but it seems to have different behavior: 1> Mcp = coursemp:mcp(5). Looping with procs: [<0.36.0>,<0.35.0>,<0.34.0>,<0.33.0>,<0.32.0>] <0.31.0> 2> Mcp ! {sendto, 3, echo}. Looping with procs: [<0.36.0>,<0.35.0>,<0.34.0>,<0.33.0>,<0.32.0>] {sendto,3,echo} =ERROR REPORT==== 20-Apr-2004::12:03:40 === <0.34.0> exiting due to unhandled message: echo MCP got down message for <0.34.0> Created new proc <0.39.0> Looping with procs: [<0.39.0>,<0.36.0>,<0.35.0>,<0.33.0>,<0.32.0>] 3> Mcp ! {sendto, 3, {Mcp, echo}}. Looping with procs: [<0.39.0>,<0.36.0>,<0.35.0>,<0.33.0>,<0.32.0>] {sendto,3,{<0.31.0>,echo}} Sending back echo from <0.35.0> MCP got echo Looping with procs: [<0.39.0>,<0.36.0>,<0.35.0>,<0.33.0>,<0.32.0>] 4> Mcp ! {sendto, 3, stop}. Looping with procs: [<0.39.0>,<0.36.0>,<0.35.0>,<0.33.0>,<0.32.0>] {sendto,3,stop} Stopping <0.35.0> MCP got down message for <0.35.0> Created new proc <0.42.0> Looping with procs: [<0.42.0>,<0.39.0>,<0.36.0>,<0.33.0>,<0.32.0>] 5> Mcp ! {sendto, 3, die}. Looping with procs: [<0.42.0>,<0.39.0>,<0.36.0>,<0.33.0>,<0.32.0>] {sendto,3,die} =ERROR REPORT==== 20-Apr-2004::12:04:04 === <0.36.0> exiting due to unhandled message: die MCP got down message for <0.36.0> Created new proc <0.44.0> Looping with procs: [<0.44.0>,<0.42.0>,<0.39.0>,<0.33.0>,<0.32.0>] 6> Mcp ! {sendto, 3, error}. Looping with procs: [<0.44.0>,<0.42.0>,<0.39.0>,<0.33.0>,<0.32.0>] {sendto,3,error} ** exited: "Got an error" ** 7> Mcp ! {sendto, 3, die}. {sendto,3,die} As of the 'error' message, the Mcp has died. Does this mean the Mcp should *not* be linked to the processes it controls, or is there a different way to handle the errors? Thanks for your help. Erlang may prove to be pretty useful in my line of work. -- Dustin Sallings From dustin@REDACTED Tue Apr 20 21:17:35 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 12:17:35 -0700 Subject: node connections Message-ID: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> (this was posted to another forum I'm not sure if anyone reads. If anyone here does, I apologize) Anyone got any tips on making node connections? I've got a couple of nodes, but I can't seem to get them talking to each other. I'm not even completely sure how to address the other box. Here's what I've got: (rubik@REDACTED)1> node(). 'rubik@REDACTED' (dustinti@REDACTED)1> node(). 'dustinti@REDACTED' (dustinti@REDACTED)2> net_adm:ping(rubik). pang (dustinti@REDACTED)3> net_adm:ping(rubik@REDACTED). pang (dustinti@REDACTED)4> net_adm:ping('rubik@REDACTED'). pang (dustinti@REDACTED)5> nodes(). [] -- Dustin Sallings From vances@REDACTED Wed Apr 21 04:09:23 2004 From: vances@REDACTED (Vance Shipley) Date: Tue, 20 Apr 2004 22:09:23 -0400 Subject: spawn without linking? In-Reply-To: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> Message-ID: <20040421020923.GD46451@frogman.motivity.ca> On Tue, Apr 20, 2004 at 12:08:58PM -0700, Dustin Sallings wrote: } } I'm using erlang:monitor for an exercise, but I guess I'm not } entirely sure how to deal with abnormal exits that are propagated by links. If you link to another process you get a birectional link. When one process exits it sends an {'EXIT', Reason} message to the other. Now these are normally trapped and result in the process exiting. If you are using spawn_link you are saying that your process is a special process and can handle these messages, or that you want the calling process to die when the spawned process does. In the shell for instance you will see your shell process goes away and is replaced by a new one: 1> self(). <0.24.0> 2> spawn_link(fun() -> receive after 1000 -> exit(timeout) end end). <0.32.0> ** exited: timeout ** 3> self(). <0.34.0> To start turning our process into a special process we can ask to trap exit signals: 4> process_flag(trap_exit, true). false 5> spawn_link(fun() -> receive after 1000 -> exit(timeout) end end). <0.37.0> 6> receive Exit -> Exit after 0 -> none end. {'EXIT',<0.37.0>,timeout} 7> self(). <0.34.0> Here's an example where we run SASL and use proc_lib:spawn_link/1: 3> application:start(sasl). [... deleted more progress reports ...] =PROGRESS REPORT==== 20-Apr-2004::21:50:48 === application: sasl started_at: nonode@REDACTED 4> proc_lib:spawn_link(fun() -> receive after 1000 -> exit(timeout) end end). <0.55.0> ** exited: timeout ** 5> =CRASH REPORT==== 20-Apr-2004::21:51:00 === crasher: pid: <0.55.0> registered_name: [] error_info: timeout initial_call: #Fun ancestors: [<0.34.0>] messages: [] links: [<0.34.0>] dictionary: [] trap_exit: false status: running heap_size: 233 stack_size: 21 reductions: 107 neighbours: neighbour: [{pid,<0.34.0>}, {registered_name,[]}, {initial_call,{erlang,apply,2}}, {current_function,{shell,eval_loop,2}}, {ancestors,[]}, {messages,[]}, {links,[<0.23.0>,<0.55.0>]}, {dictionary,[]}, {trap_exit,false}, {status,waiting}, {heap_size,610}, {stack_size,4}, {reductions,1025}] } I'd like the 'error' message to be handled properly by the echo } process in a similar fashion to what monitor is doing, but it seems to You can do this: mcpLoop(Procs) -> io:format("Looping with procs: ~p\n", [Procs]), receive {sendto, N, Msg} -> lists:nth(N, Procs) ! Msg, mcpLoop(Procs); +++ {'EXIT', Pid, _Reason} -> +++ io:format("MCP got exit message for ~p\n", [Pid]), +++ mcpLoop(mcpReplaceProcess(Pid, Procs)); {'DOWN', _Ref, process, Pid, _Flag} -> io:format("MCP got down message for ~p\n", [Pid]), mcpLoop(mcpReplaceProcess(Pid, Procs)); Msg -> io:format("MCP got ~p\n", [Msg]), mcpLoop(Procs) end. mcpMonitor(N) -> Procs = listBuilder(fun () -> spawn_link(coursemp, echo, []) end, N, []), lists:foreach(fun (P) -> erlang:monitor(process, P) end, Procs), +++ process_flag(trap_exit, true), mcpLoop(Procs). Note that there is certainly redundancy with monitor. } As of the 'error' message, the Mcp has died. Does this mean the Mcp } should *not* be linked to the processes it controls, or is there a } different way to handle the errors? The real solution is to use the design patterns in OTP. You need a top level supervisor which starts children and restarts them when necessary. The SASL application runs to handle error_reports, crash_reports and progress messages. Your server processes are instances of gen_server behaviours. You start the application using application:start/1. Using this framework you will create more resilient applications without having to think too hard about it. -Vance From dustin@REDACTED Wed Apr 21 04:22:59 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 19:22:59 -0700 Subject: node connections In-Reply-To: <20040421021237.GE46451@frogman.motivity.ca> References: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> <20040421021237.GE46451@frogman.motivity.ca> Message-ID: On Apr 20, 2004, at 19:12, Vance Shipley wrote: > The usu7al reason for this is that you need to share a secret cookie. > > Either look in you home directory and coipy .erlang.cookie to the > other machine or specify the cookie when you start up the nodes: > > rubik.west.spy.net$ erl -sname rubik -cookie supersecret > > dustinti.west.spy.net$ erl -sname dustinti -cookie supersecret Forgot to mention that part: (dustinti@REDACTED)1> erlang:get_cookie(). 'MWVWHHMACGOXDVFLJLYZ' (rubik@REDACTED)1> erlang:get_cookie(). 'MWVWHHMACGOXDVFLJLYZ' -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From dustin@REDACTED Wed Apr 21 04:39:57 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 19:39:57 -0700 Subject: spawn without linking? In-Reply-To: <20040421020923.GD46451@frogman.motivity.ca> References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> Message-ID: <2D519283-933D-11D8-930E-000A957659CC@spy.net> On Apr 20, 2004, at 19:09, Vance Shipley wrote: [lots of really useful information for which I'm grateful] > The real solution is to use the design patterns in OTP. You need a > top level supervisor which starts children and restarts them when > necessary. The SASL application runs to handle error_reports, > crash_reports and progress messages. Your server processes are > instances of gen_server behaviours. You start the application > using application:start/1. Using this framework you will create > more resilient applications without having to think too hard about > it. I was going through the course thing and trying to understand process relationships and stuff. Even with this, it doesn't seem *that* hard to do it manually, but I'm all for better ways to do things. Thanks much for your help. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From spearce@REDACTED Wed Apr 21 05:20:27 2004 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 20 Apr 2004 23:20:27 -0400 Subject: spawn without linking? In-Reply-To: <2D519283-933D-11D8-930E-000A957659CC@spy.net> References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> Message-ID: <20040421032027.GH8914@spearce.org> Actually, it is that hard to do... the OTP behaviors offer lots of well tested/debugging implementations which handle the border cases extremely well. Which a naive quick implementation using just the basic spawn_link/* and trap_exit won't get quite right on the first few tries. OTP rocks for that reason alone... but yea, gen_server isn't the most "Erlang" way to write a server, but its the Erlang/OTP way. Dustin Sallings wrote: > > On Apr 20, 2004, at 19:09, Vance Shipley wrote: > > [lots of really useful information for which I'm grateful] > > >The real solution is to use the design patterns in OTP. You need a > >top level supervisor which starts children and restarts them when > >necessary. The SASL application runs to handle error_reports, > >crash_reports and progress messages. Your server processes are > >instances of gen_server behaviours. You start the application > >using application:start/1. Using this framework you will create > >more resilient applications without having to think too hard about > >it. > > I was going through the course thing and trying to understand > process relationships and stuff. Even with this, it doesn't seem *that* > hard to do it manually, but I'm all for better ways to do things. -- Shawn. From bengt.kleberg@REDACTED Wed Apr 21 07:22:10 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Apr 2004 07:22:10 +0200 Subject: node connections In-Reply-To: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> References: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> Message-ID: <40860502.2090709@ericsson.com> Dustin Sallings wrote: ...deleted > Anyone got any tips on making node connections? I've got a couple of > nodes, but I can't seem to get them talking to each other. ...deleted have you set up your cookies correctly? see the module ''auth'' for more information. bengt From matthias@REDACTED Wed Apr 21 08:21:03 2004 From: matthias@REDACTED (Matthias Lang) Date: Wed, 21 Apr 2004 08:21:03 +0200 Subject: node connections In-Reply-To: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> References: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> Message-ID: <16518.4815.656146.76368@antilipe.corelatus.se> Dustin Sallings writes: > Anyone got any tips on making node connections? I've got a couple of > nodes, but I can't seem to get them talking to each other. > > I'm not even completely sure how to address the other box. Here's what > I've got: > > (rubik@REDACTED)1> node(). > 'rubik@REDACTED' > > (dustinti@REDACTED)1> node(). > 'dustinti@REDACTED' > (dustinti@REDACTED)2> net_adm:ping(rubik). > pang > (dustinti@REDACTED)3> > net_adm:ping(rubik@REDACTED). > pang > (dustinti@REDACTED)4> > net_adm:ping('rubik@REDACTED'). > pang > (dustinti@REDACTED)5> nodes(). > [] Have you tried something simple first, like connecting two nodes on the same machine? window1: erl -name a@REDACTED -setcookie blaha window2: erl -name b@REDACTED -setcookie blaha window1: net:ping('a@REDACTED'). pong There are a number of possible problems, some of which could be eliminated if I could guess what your command lines were, which Erlang release(s) you're running and which OS your machines are running. But my remote mind-reading powers aren't in such top form right now. Matthias From dustin@REDACTED Wed Apr 21 08:37:56 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 20 Apr 2004 23:37:56 -0700 Subject: node connections In-Reply-To: <16518.4815.656146.76368@antilipe.corelatus.se> References: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> <16518.4815.656146.76368@antilipe.corelatus.se> Message-ID: <6CD7290F-935E-11D8-8583-000A957659CC@spy.net> On Apr 20, 2004, at 23:21, Matthias Lang wrote: > Have you tried something simple first, like connecting two nodes on > the same machine? > > window1: erl -name a@REDACTED -setcookie blaha > > window2: erl -name b@REDACTED -setcookie blaha > > window1: net:ping('a@REDACTED'). > pong > > There are a number of possible problems, some of which could be > eliminated if I could guess what your command lines were, which Erlang > release(s) you're running and which OS your machines are running. But > my remote mind-reading powers aren't in such top form right now. I got it working between two nodes on the same machine. Here's what I've got: Both systems are Darwin 7.3 (MacOS X 10.3.3). I grabbed the latest erlang/OTP from source. The machines are on the same subnet (I'm on one of them and sshed into the other). dustinti:~/prog/snippets/erlang 507% erl -name dustinti -setcookie hi Erlang (BEAM) emulator version 5.3 [source] Eshell V5.3 (abort with ^G) (dustinti@REDACTED)1> auth:cookie(). hi (dustinti@REDACTED)2> net:ping('rubik@REDACTED'). pang rubik:~/prog/snippets/erlang 506% erl -name rubik -setcookie hi Erlang (BEAM) emulator version 5.3 [source] Eshell V5.3 (abort with ^G) (rubik@REDACTED)1> auth:cookie(). hi I've been using a cookie that was auto-generated on one machine and copied to the other. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From seb@REDACTED Wed Apr 21 09:46:38 2004 From: seb@REDACTED (Sebastian Strollo) Date: 21 Apr 2004 09:46:38 +0200 Subject: node connections In-Reply-To: <6CD7290F-935E-11D8-8583-000A957659CC@spy.net> References: <611CBDEC-92FF-11D8-81BB-000393CFE6B8@spy.net> <16518.4815.656146.76368@antilipe.corelatus.se> <6CD7290F-935E-11D8-8583-000A957659CC@spy.net> Message-ID: Hi Dustin The shortest answer is: Before trying net_adm:ping() try executing "inet_db:set_lookup([dns])." on both your nodes. If you want to know why, read on below. :-) Dustin Sallings writes: [...] > I got it working between two nodes on the same machine. > > Here's what I've got: > > Both systems are Darwin 7.3 (MacOS X 10.3.3). I grabbed the > latest erlang/OTP from source. The machines are on the same subnet > (I'm on one of them and sshed into the other). The next place to look then is name resolving, which is in a, well shall we just say that it can easily cause confusion... The Erlang system needs to be able to resolve the host names of the nodes (in your case "dustinti.west.spy.net" and "rubik.west.spy.net") in order to connect to them. And it doesn't just call gethostbyname(3) to get these names, instead Erlang has a built in resolver.... More about that below, but first I'd say that a lot of times the easiest way to avoid problems with resolving names is to use "short" names and have them in your /etc/hosts file, here is an example from my machine: albatross> erl -sname bar Erlang (BEAM) emulator version 5.3.b1 [source] Eshell V5.3.b1 (abort with ^G) (bar@REDACTED)1> And in another window: albatross> uname -a FreeBSD albatross.bluetail.com 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Thu Oct 2 13:18:30 CEST 2003 root@REDACTED:/usr/src/sys/i386/compile/ALBATROSS i386 albatross> erl -sname foo Erlang (BEAM) emulator version 5.3.b1 [source] Eshell V5.3.b1 (abort with ^G) (foo@REDACTED)1> net_adm:ping(bar@REDACTED). pong Now to the fullname part and the resolver issues... If I try to use on my machines it actually doesn't work either: albatross> erl -name bar Erlang (BEAM) emulator version 5.3.b1 [source] Eshell V5.3.b1 (abort with ^G) (bar@REDACTED)1> And then albatross> erl -name foo Erlang (BEAM) emulator version 5.3.b1 [source] Eshell V5.3.b1 (abort with ^G) (foo@REDACTED)1> net_adm:ping('bar@REDACTED'). pang Hmm, so let's see if Erlang can resolve "albatross.bluetail.com" (foo@REDACTED)2> inet:gethostbyname("albatross.bluetail.com"). {error,nxdomain} Nope - that's the problem then (resolving "albatross" works just fine though, I have that in my /etc/hosts). In my case the reason is discussed in this thread: http://www.erlang.org/ml-archive/erlang-questions/200310/msg00164.html (Aside: the detail of why it isn't working is that FreeBSD went from using /etc/host.conf to /etc/nsswitch.conf in version 5.x. In your case I think it is that darwin doesn't have an entry in the inet_config.erl at all and so Erlang will only look in the /etc/hosts file.) Okay, so how do you fix it? First you can verify that what I'm saying is actually the problem, by trying inet:gethostbyname/1 and then by querying Erlang on how it resolves host names: (foo@REDACTED)4> inet_db:res_option(lookup). [file] The return value is a list of how Erlang will resolv names; 'file' means look in the /etc/hosts file. (And I just fired up my MacOS X machine, and it is the same there). So let's tell it to use dns instead: (foo@REDACTED)5> inet_db:set_lookup([dns]). ok You can also tell it to first use files and then dns, by giving [files, dns] as arguments to inet_db:set_lookup/1. To verify that the DNS settings look right: (foo@REDACTED)6> inet_db:get_rc(). [{domain,"bluetail.com"}, {nameserver,{127,0,0,1}}, {search,["bluetail.com", "lab.bluetail.com", "us.nortel.com"]}] Which in my case is right (I am running a local name server on my machine). So let's see if we now can resolve the name now: (foo@REDACTED)7> inet:gethostbyname("albatross.bluetail.com"). {ok,{hostent,"albatross.bluetail.com",[],inet,4,[{192,168,128,60}]}} Good, let's fix the other machine too: (bar@REDACTED)1> inet_db:set_lookup([dns]). ok And now (foo@REDACTED)8> net_adm:ping('bar@REDACTED'). pong Voila. :-) In the above mentioned erlang-list archive thread I recall that Raimo (from the OTP group at Ericsson) said they were working on (or wanted to work on:-) the Erlang resolver - exactly because of these problems... :-) Oh, and reading that thread again I see that Raimo actually suggests using inet_db:set_lookup([native]) - which seems to work fine on both my FreeBSD and my MacOS X machines. Cheers, /Sebastian PS. You can e.g. add the inet_db:set_lookup/1 call to your ".erlang" file (which is read at startup). From vances@REDACTED Thu Apr 22 15:32:26 2004 From: vances@REDACTED (Vance Shipley) Date: Thu, 22 Apr 2004 09:32:26 -0400 Subject: io_lib:fread/2 and ~b Message-ID: <20040422133226.GR46451@frogman.motivity.ca> Am I doing something wrong or does io_lib:fread/2 not support the new format control sequence ~b? (vances@REDACTED)6> io_lib:fread("~2.16b", "f2"). {error,{fread,format}} -Vance From erlang@REDACTED Thu Apr 22 17:11:52 2004 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Thu, 22 Apr 2004 12:11:52 -0300 Subject: Processes priorities Message-ID: <003001c4287c$f0aea690$1e00a8c0@design> Can Erlang manage priorities between processes? Something like; calls to a process (Pid1) from a group of processes (Pid2, Pid3) have priority under other Pids. thanks in advance, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Thu Apr 22 18:57:40 2004 From: vances@REDACTED (Vance Shipley) Date: Thu, 22 Apr 2004 12:57:40 -0400 Subject: Processes priorities In-Reply-To: <003001c4287c$f0aea690$1e00a8c0@design> References: <003001c4287c$f0aea690$1e00a8c0@design> Message-ID: <20040422165740.GT46451@frogman.motivity.ca> On Thu, Apr 22, 2004 at 12:11:52PM -0300, Eduardo Figoli wrote: } } Can Erlang manage priorities between processes? } Something like; calls to a process (Pid1) from a group of processes } (Pid2, Pid3) have priority under other Pids. Do you mean something like this? PriorityPids = [Pid2, Pid3], ReceivePriority = fun(Pid) -> receive {Pid, Msg} -> do_priority_msg(Msg); after 0 -> none end end, lists:foreach(ReceivePriority, PriorityPids), -Vance From rpettit@REDACTED Thu Apr 22 19:42:37 2004 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 22 Apr 2004 12:42:37 -0500 Subject: io:format calls in mnesia Message-ID: <20040422174237.GA5887@vailsys.com> While working with a coworker we noticed that the mnesia sources are littered with io:format/1 and io:format/2 calls. This explains a problem we had starting nodes (which used mnesia) from Solaris inittab without redirecting stdout to some file or /dev/null (i.e. we believe Solaris sent a SIGPIPE in response to attempt to write to a non-existent stdout). Was the use of io:format/1 and io:format/2 (vs. error_logger routines, etc) intentional? -Rick From rpettit@REDACTED Thu Apr 22 20:54:44 2004 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 22 Apr 2004 13:54:44 -0500 Subject: io:format calls in mnesia src Message-ID: <20040422185444.GA6145@vailsys.com> While working with a coworker we noticed that the mnesia sources are littered with io:format/1 and io:format/2 calls. This explains a problem we had starting nodes (which used mnesia) from Solaris inittab without redirecting stdout to some file or /dev/null (i.e. we believe Solaris sent a SIGPIPE in response to attempt to write to a non-existent stdout). Was the use of io:format/1 and io:format/2 (vs. error_logger routines, etc) intentional? -Rick From yerl@REDACTED Thu Apr 22 23:39:55 2004 From: yerl@REDACTED (yerl@REDACTED) Date: Thu, 22 Apr 2004 23:39:55 CEST Subject: Redirecting functions calls ? Message-ID: Hi All, Is there a method to redirect the call of a function and execute another one instead. For exemple, lets assume 2 functions "foo" and "bar": foo(X) -> blablabla, 26. bar(Y) -> blablabla, 38. When calling foo(10), I want to intercept this call and replace with bar(10). Of course, the result of foo(10) is replaced by the one of bar(10). Can anyboby help me! Thanks Yerl From sean.hinde@REDACTED Fri Apr 23 00:18:18 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 22 Apr 2004 23:18:18 +0100 Subject: Redirecting functions calls ? In-Reply-To: References: Message-ID: Hi, On 23 Apr 2004, at 00:39, yerl@REDACTED wrote: > Hi All, > Is there a method to redirect the call of a function and execute > another one instead. > For exemple, lets assume 2 functions "foo" and "bar": > > foo(X) -> > blablabla, > 26. > > bar(Y) -> > blablabla, > 38. > > When calling foo(10), I want to intercept this call and replace with > bar(10). Of course, the result of foo(10) is replaced by the one of > bar(10). > > Can anyboby help me! Actually this is almost possible - I discovered a compiler bug just today: -module(compiler_bug). -export([test/1, wow/1]). test(A) when fred -> {ok, A}. wow(A) -> wow. This compiles fine. Trying this out: 175> compiler_bug:test(1). =ERROR REPORT==== 22-Apr-2004::23:11:45 === Error in process <0.1000.0> on node 'eradius@REDACTED' with exit value: {function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell,ev al_loop,2}]} ** exited: {function_clause,[{compiler_bug,wow,[1]}, {erl_eval,do_apply,5}, {shell,eval_loop,2}]} ** I haven't managed to make it correctly call wow(1), but the error report suggests that my call to test/1 did indeed result in a call to wow/1 :-) Sean From sean.hinde@REDACTED Fri Apr 23 00:32:52 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 22 Apr 2004 23:32:52 +0100 Subject: spawn without linking? In-Reply-To: <20040421032027.GH8914@spearce.org> References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> <20040421032027.GH8914@spearce.org> Message-ID: On 21 Apr 2004, at 04:20, Shawn Pearce wrote: > Actually, it is that hard to do... the OTP behaviors offer lots > of well tested/debugging implementations which handle the border > cases extremely well. Which a naive quick implementation using > just the basic spawn_link/* and trap_exit won't get quite right on > the first few tries. > > OTP rocks for that reason alone... but yea, gen_server isn't the > most "Erlang" way to write a server, but its the Erlang/OTP way. How about this which I had fun writing today. It is almost Erlangish, and it is something like OTP, and it is exactly Joe's selective receive example. I can't decide whether it is ugly or profoundly beautiful. Sean %% Call a bunch of gen_servers with different requests in %% parallel and return successes and failures. Any which %% fail to answer within Timeout ms are included as failures. %% We require that the calling process will continue to ignore %% late answers multi_call(Requests, Timeout) -> Mrefs = lists:map( fun({Name, Req}) -> Mref = erlang:monitor(process, Name), Name ! {'$gen_call', {self(), Mref}, Req}, {Name, Mref} end, Requests), get_results(Mrefs, [], [], Timeout, now()). get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) div 1000), 0), receive {Mref, Reply} -> erlang:demonitor(Mref), receive {'DOWN', Mref, _, _, _} -> get_results(T, [{Name, Reply}|Succ], Fail, Timeout, Now_at_start) after 0 -> get_results(T, [{Name, Reply}|Succ], Fail, Timeout, Now_at_start) end; {'DOWN', Mref, _, _, _} -> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) after Timeout_val -> erlang:demonitor(Mref), get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) end; get_results([], Succ, Fail, _, _) -> {Succ, Fail}. max(A, B) when A >= B -> A; max(A, B) -> B. From dustin@REDACTED Fri Apr 23 04:52:39 2004 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 22 Apr 2004 19:52:39 -0700 Subject: spawn without linking? In-Reply-To: References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> <20040421032027.GH8914@spearce.org> Message-ID: <485D9486-94D1-11D8-8D5E-000A957659CC@spy.net> On Apr 22, 2004, at 15:32, Sean Hinde wrote: > How about this which I had fun writing today. It is almost Erlangish, > and it is something like OTP, and it is exactly Joe's selective > receive example. I can't decide whether it is ugly or profoundly > beautiful. Is there an introduction to OTP somewhere that can get an application built and running quickly? The man pages seem to make a good reference, but don't really do a lot to get me started. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From yerl@REDACTED Fri Apr 23 09:57:50 2004 From: yerl@REDACTED (yerl@REDACTED) Date: Fri, 23 Apr 2004 09:57:50 CEST Subject: Redirecting functions calls ? Message-ID: Hi Sean, Incredible bug!! Is it fixed? The test/1 guard (i.e. when fred) is responsible of the error. Any onther idea to achieve what I want? Lot of thanks Youn?s ----Message d'origine---- >Copie ?: erlang-questions@REDACTED >De: Sean Hinde >Sujet: Re: Redirecting functions calls ? >Date: Thu, 22 Apr 2004 23:18:18 +0100 >A: yerl@REDACTED > >Hi, > > >On 23 Apr 2004, at 00:39, yerl@REDACTED wrote: > >> Hi All, >> Is there a method to redirect the call of a function and execute >> another one instead. >> For exemple, lets assume 2 functions "foo" and "bar": >> >> foo(X) -> >> blablabla, >> 26. >> >> bar(Y) -> >> blablabla, >> 38. >> >> When calling foo(10), I want to intercept this call and replace with >> bar(10). Of course, the result of foo(10) is replaced by the one of >> bar(10). >> >> Can anyboby help me! > >Actually this is almost possible - I discovered a compiler bug just >today: > >-module(compiler_bug). >-export([test/1, wow/1]). > >test(A) when fred -> > {ok, A}. > >wow(A) -> > wow. > >This compiles fine. Trying this out: > >175> compiler_bug:test(1). > >=ERROR REPORT==== 22-Apr-2004::23:11:45 === >Error in process <0.1000.0> on node 'eradius@REDACTED' with exit >value: >{function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell,ev >al_loop,2}]} > >** exited: {function_clause,[{compiler_bug,wow,[1]}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > >I haven't managed to make it correctly call wow(1), but the error >report suggests that my call to test/1 did indeed result in a call to >wow/1 > >:-) > >Sean > > From bjorn@REDACTED Fri Apr 23 11:31:06 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Apr 2004 11:31:06 +0200 Subject: Redirecting functions calls ? In-Reply-To: References: Message-ID: The bug has been corrected in our R10B development branch. If our paying customers would find it necessary, we will also release a compiler patch for R9C. The second function (wow/1 in this case) will never be correctly executed. There will always be a function clause exception. The only really bad case is if the second function expects more arguments than the first function - in that case the emulator could crash. /Bjorn Sean Hinde writes: > Hi, > > Actually this is almost possible - I discovered a compiler bug just > today: > > -module(compiler_bug). > -export([test/1, wow/1]). > > test(A) when fred -> > {ok, A}. > > wow(A) -> > wow. > > This compiles fine. Trying this out: > > 175> compiler_bug:test(1). > > =ERROR REPORT==== 22-Apr-2004::23:11:45 === > Error in process <0.1000.0> on node 'eradius@REDACTED' with exit > value: > {function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell,ev > al_loop,2}]} > > ** exited: {function_clause,[{compiler_bug,wow,[1]}, > {erl_eval,do_apply,5}, > {shell,eval_loop,2}]} ** > > I haven't managed to make it correctly call wow(1), but the error > report suggests that my call to test/1 did indeed result in a call to > wow/1 > > :-) > > Sean > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sean.hinde@REDACTED Fri Apr 23 11:40:34 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 23 Apr 2004 10:40:34 +0100 Subject: Redirecting functions calls ? In-Reply-To: References: Message-ID: <4500D00F-950A-11D8-9008-000A95927CCE@mac.com> Hi, I have heard that this is the sort of obfuscation that Java and C++ are designed for. For Erlang there is an obvious optimisation which will remove the need for what you want ... Otherwise I don't think so. Sean On 23 Apr 2004, at 10:57, yerl@REDACTED wrote: > Hi Sean, > > Incredible bug!! Is it fixed? > The test/1 guard (i.e. when fred) is responsible of the error. > Any onther idea to achieve what I want? > > Lot of thanks > Youn?s > > > ----Message d'origine---- >> Copie ?: erlang-questions@REDACTED >> De: Sean Hinde >> Sujet: Re: Redirecting functions calls ? >> Date: Thu, 22 Apr 2004 23:18:18 +0100 >> A: yerl@REDACTED >> >> Hi, >> >> >> On 23 Apr 2004, at 00:39, yerl@REDACTED wrote: >> >>> Hi All, >>> Is there a method to redirect the call of a function and execute >>> another one instead. >>> For exemple, lets assume 2 functions "foo" and "bar": >>> >>> foo(X) -> >>> blablabla, >>> 26. >>> >>> bar(Y) -> >>> blablabla, >>> 38. >>> >>> When calling foo(10), I want to intercept this call and replace with >>> bar(10). Of course, the result of foo(10) is replaced by the one of >>> bar(10). >>> >>> Can anyboby help me! >> >> Actually this is almost possible - I discovered a compiler bug just >> today: >> >> -module(compiler_bug). >> -export([test/1, wow/1]). >> >> test(A) when fred -> >> {ok, A}. >> >> wow(A) -> >> wow. >> >> This compiles fine. Trying this out: >> >> 175> compiler_bug:test(1). >> >> =ERROR REPORT==== 22-Apr-2004::23:11:45 === >> Error in process <0.1000.0> on node 'eradius@REDACTED' with exit >> value: >> {function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell, >> ev >> al_loop,2}]} >> >> ** exited: {function_clause,[{compiler_bug,wow,[1]}, >> {erl_eval,do_apply,5}, >> {shell,eval_loop,2}]} ** >> >> I haven't managed to make it correctly call wow(1), but the error >> report suggests that my call to test/1 did indeed result in a call to >> wow/1 >> >> :-) >> >> Sean >> >> > From erlang@REDACTED Fri Apr 23 12:32:39 2004 From: erlang@REDACTED (erlang@REDACTED) Date: Fri, 23 Apr 2004 11:32:39 +0100 Subject: Redirecting functions calls ? In-Reply-To: Message-ID: <3feb873f2e8e24f59516dccc8a2520f5@tombob.com> > Is there a method to redirect the call of a function and execute > another one instead. > For exemple, lets assume 2 functions "foo" and "bar": > > foo(X) -> > blablabla, > 26. > > bar(Y) -> > blablabla, > 38. > > When calling foo(10), I want to intercept this call and replace with > bar(10). Of course, the result of foo(10) is replaced by the one of > bar(10). Maybe I'm being too simplistic, as I don't really understand the discussion that followed about the compiler bug, but wouldn't this do what you want: foo(10) -> bar(10); foo(X) -> blablabla, 26. bar(Y) -> blablabla, 38. Robby From sean.hinde@REDACTED Fri Apr 23 13:00:54 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 23 Apr 2004 12:00:54 +0100 Subject: Redirecting functions calls ? In-Reply-To: References: Message-ID: <7DA08F1E-9515-11D8-9008-000A95927CCE@mac.com> I think we can wait, now that we are aware of it. We would not go back and re-build all of our running systems for this one. Thanks, Sean P.S. If anyone is wavering about buying a commercial licence then I'd suggest that it's worth every penny/cent and then some. Just access to the commercial patches is worth it for us - aside from the awesome support we get from Kenneth and the team. On 23 Apr 2004, at 10:31, Bjorn Gustavsson wrote: > The bug has been corrected in our R10B development branch. > > If our paying customers would find it necessary, we will also > release a compiler patch for R9C. > > The second function (wow/1 in this case) will never be correctly > executed. There will always be a function clause exception. The only > really bad case is if the second function expects more arguments than > the first function - in that case the emulator could crash. > > /Bjorn > > Sean Hinde writes: > >> Hi, >> >> Actually this is almost possible - I discovered a compiler bug just >> today: >> >> -module(compiler_bug). >> -export([test/1, wow/1]). >> >> test(A) when fred -> >> {ok, A}. >> >> wow(A) -> >> wow. >> >> This compiles fine. Trying this out: >> >> 175> compiler_bug:test(1). >> >> =ERROR REPORT==== 22-Apr-2004::23:11:45 === >> Error in process <0.1000.0> on node 'eradius@REDACTED' with exit >> value: >> {function_clause,[{compiler_bug,wow,[1]},{erl_eval,do_apply,5},{shell, >> ev >> al_loop,2}]} >> >> ** exited: {function_clause,[{compiler_bug,wow,[1]}, >> {erl_eval,do_apply,5}, >> {shell,eval_loop,2}]} ** >> >> I haven't managed to make it correctly call wow(1), but the error >> report suggests that my call to test/1 did indeed result in a call to >> wow/1 >> >> :-) >> >> Sean >> > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From sean.hinde@REDACTED Fri Apr 23 13:03:45 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 23 Apr 2004 12:03:45 +0100 Subject: gen_erver parallel call (was Re: spawn without linking?) In-Reply-To: References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> <20040421032027.GH8914@spearce.org> Message-ID: On 22 Apr 2004, at 23:32, Sean Hinde wrote: > > On 21 Apr 2004, at 04:20, Shawn Pearce wrote: > >> Actually, it is that hard to do... the OTP behaviors offer lots >> of well tested/debugging implementations which handle the border >> cases extremely well. Which a naive quick implementation using >> just the basic spawn_link/* and trap_exit won't get quite right on >> the first few tries. >> >> OTP rocks for that reason alone... but yea, gen_server isn't the >> most "Erlang" way to write a server, but its the Erlang/OTP way. > > How about this which I had fun writing today. It is almost Erlangish, > and it is something like OTP, and it is exactly Joe's selective > receive example. I can't decide whether it is ugly or profoundly > beautiful. > I've made the intent clearer I think in this version. This is going to be so useful for us that I'm sure it must be of some use for someone else: %% @doc Call one or more gen_servers multiple times with different %% queries concurrently. This is equivalent to calling %% gen_server:call(Name, Request, Timeout) multiple times except that %% they are handled in parallel. %% %% @spec multi_call(Requests, Timeout::integer()) -> %% {[{Name, Result}], [Failure]} %% Requests = [{Name, Request}] %% Name = pid() | atom() %% Request = term() %% Result = term() %% Failure = pid() | atom() multi_call(Requests, Timeout) when is_list(Requests), is_integer(Timeout) -> Mrefs = lists:map(fun({Name, Req}) -> Mref = erlang:monitor(process, Name), Name ! {'$gen_call', {self(), Mref}, Req}, {Name, Mref} end, Requests), Start = now(), lists:foldl( fun({Name, Mref}, {Succ, Fail}) -> Time_since_start = timer:now_diff(now(), Start) div 1000, Timeout_val = max(Timeout - Time_since_start, 0), receive {Mref, Reply} -> erlang:demonitor(Mref), receive {'DOWN', Mref, _, _, _} -> {[{Name, Reply}|Succ], Fail} after 0 -> {[{Name, Reply}|Succ], Fail} end; {'DOWN', Mref, _, _, _} -> {Succ, [Name|Fail]} after Timeout_val -> erlang:demonitor(Mref), {Succ, [Name|Fail]} end end, {[],[]}, Mrefs). max(A, B) when A >= B -> A; max(A, B) -> B. From sean.hinde@REDACTED Fri Apr 23 13:52:56 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 23 Apr 2004 12:52:56 +0100 Subject: spawn without linking? In-Reply-To: <485D9486-94D1-11D8-8D5E-000A957659CC@spy.net> References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> <20040421032027.GH8914@spearce.org> <485D9486-94D1-11D8-8D5E-000A957659CC@spy.net> Message-ID: On 23 Apr 2004, at 03:52, Dustin Sallings wrote: > > On Apr 22, 2004, at 15:32, Sean Hinde wrote: > >> How about this which I had fun writing today. It is almost Erlangish, >> and it is something like OTP, and it is exactly Joe's selective >> receive example. I can't decide whether it is ugly or profoundly >> beautiful. > > Is there an introduction to OTP somewhere that can get an application > built and running quickly? The man pages seem to make a good > reference, but don't really do a lot to get me started. I learnt what I know from the man pages and the "Design Principles" section of the HTML documentation. After a few reads through it should start to make some sort of sense - keep at it. The emacs erlang mode templates are a nice way to arrive at a skeleton working set of application, supervisor, gen_server. Sean From hakan@REDACTED Fri Apr 23 14:40:17 2004 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 23 Apr 2004 14:40:17 +0200 (MEST) Subject: io:format calls in mnesia In-Reply-To: <20040422174237.GA5887@vailsys.com> Message-ID: On Thu, 22 Apr 2004, Rick Pettit wrote: > While working with a coworker we noticed that the mnesia sources are littered > with io:format/1 and io:format/2 calls. This explains a problem we had starting > nodes (which used mnesia) from Solaris inittab without redirecting stdout to > some file or /dev/null (i.e. we believe Solaris sent a SIGPIPE in response > to attempt to write to a non-existent stdout). > > Was the use of io:format/1 and io:format/2 (vs. error_logger routines, etc) > intentional? Mnesia reports its errors to the error_logger and prints its debug info with io:format/X. By default, the debug printouts are turned off. Regardless of whether Mnesia prints stuff with io:format/X or not, you need to configure your system to deal with such printouts, as any Erlang application may have printouts. /H?kan From ahunter@REDACTED Fri Apr 23 17:23:03 2004 From: ahunter@REDACTED (Aaron Hunter) Date: Fri, 23 Apr 2004 11:23:03 -0400 Subject: Beginner: Unexplained network behavior Message-ID: <408934D7.20608@sharkbite.org> Hello, A long time Java developer I recently discovered Erlang and am very impressed. With a few improvements Erlang could very well be a J2EE killer. I wrote this simple module to explore how sockets work in Erlang but am puzzled by its behavior. It is supposed to scan 254 IP's simultaneously. looking for HTTP servers. Over the course of several runs, however, it gives me different answers and often misses HTTP servers. Can someone point out what I am doing wrong? Thank you. -module( scanner ). -export( [scan_http/1, scan_port/3] ). % Check for an open socket on the given port scan_port( PID, IP, Port ) -> case gen_tcp:connect( IP, Port, [], 5000) of { ok, Socket } -> gen_tcp:close( Socket ), PID ! { found, IP, Port }; { error, _ } -> PID ! { none, IP } end. % Wait for all 254 processes to finish wait( 254, Found ) -> io:fwrite("~nFound ~B HTTP servers: ~p~n", [ length( Found ), Found ]); wait( Count, Found ) -> receive { found, IP, Port } -> io:fwrite("+"), wait( Count + 1, [{IP,Port}|Found] ); { none, IP } -> io:fwrite("."), wait( Count + 1, Found ) end. % Call with a network IP tuple in the form {192,168,0,0} scan_http( {A,B,C,D} ) -> io:fwrite("Scanning ~n"), lists:foreach( fun(Host) -> spawn( ?MODULE, scan_port, [ self(), {A,B,C,Host}, 80 ] ) end, lists:seq(1,254) ), wait( 0, [] ). From vances@REDACTED Fri Apr 23 17:22:51 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 23 Apr 2004 11:22:51 -0400 Subject: Redirecting functions calls ? In-Reply-To: References: Message-ID: <20040423152251.GD54378@frogman.motivity.ca> Can someone tell me what this is supposed to do? (Apart from what was requested :) I really fail to see what is being attempted here. 'fred' is a guard expression. I see that a valid guard expression is "constants (terms and bound variables) all regarded as false". So wouldn't the the following be equivalent (and more clear)? test(A) when false -> As I read it you have a function with one clause which will never match and so never be called. -Vance Sean Hinde writes: } } -module(compiler_bug). } -export([test/1, wow/1]). } } test(A) when fred -> } {ok, A}. } } wow(A) -> } wow. From mickael.remond@REDACTED Fri Apr 23 18:12:06 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 23 Apr 2004 18:12:06 +0200 Subject: Beginner: Unexplained network behavior In-Reply-To: <408934D7.20608@sharkbite.org> References: <408934D7.20608@sharkbite.org> Message-ID: On Fri, 23 Apr 2004 11:23:03 -0400, Aaron Hunter wrote: > Hello, > > A long time Java developer I recently discovered Erlang and am very > impressed. With a few improvements Erlang could very well be a J2EE > killer. :-) > I wrote this simple module to explore how sockets work in Erlang but am > puzzled by its behavior. It is supposed to scan 254 IP's simultaneously. > looking for HTTP servers. Over the course of several runs, however, it > gives me different answers and often misses HTTP servers. Maybe this is because, it take more than five seconds to connect to the server ? Did you try you program with an increased gen_tcp:connect/4 timeout ? Is it more reliable when you use a timeout of 30 seconds ? I think when scanning 254 addresses range at a time the network latency increases. Some server might answer slowly (5 seconds can sometime be very short). > case gen_tcp:connect( IP, Port, [], 5000) of ^^^^ Try with 30000 I hope this helps. -- Micka?l R?mond http://www.erlang-projects.org/ From kris_prieb@REDACTED Sat Apr 24 04:09:58 2004 From: kris_prieb@REDACTED (Kris Prieb) Date: Fri, 23 Apr 2004 21:09:58 -0500 Subject: basic questions regarding message sequence guarantees... Message-ID: <0HWN00DM3KQEV5@gsbims.uchicago.edu> Hi, I am an Erlang beginner trying to understand Erlang's message order guarantees. I would greatly appreciate any help in clarifying the following points: 1.) Suppose I have a process 'A' and process 'B'. 'A' sends a sequence of messages to 'B'. My understanding is that Erlang guarantees that B will receive the messages from A in the order in which they were sent. Is this correct? 2.) Now suppose 'B' is monitoring 'A'. Suppose also that another process 'C' is monitoring 'A' and that a 'Down' message from 'A' to 'C' will trigger 'C' to send a message to 'B.' My understanding is that Erlang does _not_ guarantee that A's 'Down' message to B will arrive before C's message to B. Is this correct? 3.) Same as 2, except that B and C are on one node, and A is on another. Does this change anything? Thanks ahead of time! Kris Prieb -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Sat Apr 24 08:46:05 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 24 Apr 2004 08:46:05 +0200 Subject: basic questions regarding message sequence guarantees... In-Reply-To: <0HWN00DM3KQEV5@gsbims.uchicago.edu> References: <0HWN00DM3KQEV5@gsbims.uchicago.edu> Message-ID: On Fri, 23 Apr 2004 21:09:58 -0500, Kris Prieb wrote: > 1.) Suppose I have a process 'A' and process 'B'. 'A' sends a sequence > of messages to 'B'. > > My understanding is that Erlang guarantees that B will receive the > messages from A in the order in which they were sent. > Is this correct? Yes. > 2.) Now suppose 'B' is monitoring 'A'. Suppose also that another process > 'C' is monitoring 'A' and that a 'Down' message from 'A' to 'C' will > trigger 'C' to send a message to 'B.' > > My understanding is that Erlang does _not_ guarantee that A's 'Down' > message to B will arrive before C's message to B. Is this correct? Correct. > 3.) Same as 2, except that B and C are on one node, and A is on another. > Does this change anything? It doesn't change the fact that Erlang gives no guarantee regarding the relative order of messages if they travel different routes. In this particular case, I think internal scheduling aspects would determine the order in which messages arrive to B, so it's going to be as uncertain as in (2). Now, if 'A' and 'B' where on the same node, and 'C' were on a different node, one could venture to guess that B would always receive A's message first. However, there is still no guarantee, and I wouldn't base my application logic on it. If you'd change the distribution pattern for other reasons later, your code might break in mysterious ways. /Uffe -- Ulf Wiger From vances@REDACTED Sun Apr 25 01:55:42 2004 From: vances@REDACTED (Vance Shipley) Date: Sat, 24 Apr 2004 19:55:42 -0400 Subject: monitoring remote error logging In-Reply-To: <20040409222052.GA5728@frogman.motivity.ca> References: <20040409222052.GA5728@frogman.motivity.ca> Message-ID: <20040424235541.GA63466@frogman.motivity.ca> Continuing with my effort to use distribution for user interaction with running applications I have written a handler for error_logger which will forward specific reports to the user's local error_logger. The application is running on another node as an embedded system. The error_logger sends it's reports to standard_io which shows up in run_erl's log files. For OA&M users start their own node and use rpc and distribution to interact with the running application. To monitor the reports being sent to the error_logger on the embedded node we install a new handler in the embedded node's error_logger. The selected events are forwarded to the user's own error_logger. The attached user_default.erl demonstrates SASL report monitoring. It finds all nodes running SASL and installs the forward_error_logger.erl handler in each node's error_logger. -Vance Vance Shipley Motivity Telecom Inc. +1 519 240 3684 vances@REDACTED -------------- next part -------------- -module(user_default). -export([help/0, log/1]). help() -> shell_default:help(), io:fwrite("** commands from user_default **~n"), io:fwrite("log(sasl) -- start logging SASL events from all nodes~n"), io:fwrite("log(List) -- start logging List events from all nodes~n"), true. log(sasl) -> log([supervisor_report, crash_report, progress]); log(Events) when is_list(Events) -> %% if we're receiving sasl events we need the sasl report %% handler installed in the local error_logger SaslEvents = [supervisor_report, crash_report, progress], case SaslEvents -- Events of SaslEvents -> App = none; _ -> App = sasl, case lists:member(sasl_report_tty_h, gen_event:which_handlers(error_logger)) of true -> ok; false -> application:start(sasl) end end, log(log_nodes(App), Events). log([], Events) -> ok; log([Node|T], Events) -> %% install the forwarding handler at each remote node gen_event:add_handler({error_logger, Node}, forward_error_logger, [Events, whereis(error_logger)]), log(T, Events). %%% internal functions log_nodes(none) -> nodes(); log_nodes(App) -> Pred = fun(N) -> lists:keymember(App, 1, rpc:call(N, application, which_applications, [])) end, lists:filter(Pred, nodes()). -------------- next part -------------- -module(forward_error_logger). -author('vances@REDACTED'). %%% %%% An event handler for the error_logger which forwards specified %%% report types to a remote error_logger process. %%% %%% e.g. all error_report and info_report messages generated on %%% server@REDACTED sent to the error_logger process running on user@REDACTED: %%% %%% (user@REDACTED)1> gen_event:add_handler({error_logger, 'server@REDACTED'}, %%% forward_error_logger, [[error_report, info_report], whereis(error_logger)]). %%% -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2]). %% init(Args) -> {ok, State} %% Args = [Types, ErrorLogger] %% ErrorLogger = pid() of the remote error_logger %% Types = [Type] %% Type = EventType | ReportType %% EventType = error_report | info_report | error| info_msg | info | emulator %% ReportType = std_error | std_info | SASLType | OtherType %% SASLType = supervisor_report | crash_report | progress %% OtherType = term() Type in error_logger:error_report/2 & info_report/2 %% init([Types, ErrorLogger]) when is_list(Types), is_pid(ErrorLogger) -> Node = node(ErrorLogger), monitor_node(Node, true), {ok, {Types, Node, ErrorLogger}}. %% handler for error_report & info_report events handle_event({EventType, GroupLeader, {Epid, ReportType, Report}}, {Types, Node, Pid}) when node(GroupLeader) == node(), (error_report == EventType) or (info_report == EventType) -> case lists:member(EventType, Types) or lists:member(ReportType, Types) of true -> gen_event:notify(Pid, {EventType, Pid, {Epid, ReportType, Report}}); false -> ok end, {ok, {Types, Node, Pid}}; %% handler for error, info_msg & info events handle_event({EventType, GroupLeader, {Epid, Format, Args}}, {Types, Node, Pid}) when node(GroupLeader) == node(), (error == EventType) or (info_msg == EventType) or (info == EventType) -> case lists:member(EventType, Types) of true -> gen_event:notify(Pid, {EventType, Pid, {Epid, Format, Args}}); false -> ok end, {ok, {Types, Node, Pid}}; handle_event(_, State) -> {ok, State}. %% handler for emulator events from the runtime system handle_info({emulator, GroupLeader, Msg}, {Types, Node, Pid}) when node(GroupLeader) == node() -> case lists:member(emulator, Types) of true -> Pid ! {emulator, Pid, Msg}; false -> ok end, {ok, {Types, Node, Pid}}; handle_info({nodedown, Node}, {_Types, Node, _Pid}) -> remove_handler; handle_info(_, State) -> {ok, State}. handle_call(_Query, _) -> {error, bad_query}. terminate(_Reason, _State) -> []. From joe@REDACTED Mon Apr 26 14:56:01 2004 From: joe@REDACTED (Joe Armstrong) Date: Mon, 26 Apr 2004 14:56:01 +0200 (CEST) Subject: spawn without linking? In-Reply-To: Message-ID: On Thu, 22 Apr 2004, Sean Hinde wrote: > > On 21 Apr 2004, at 04:20, Shawn Pearce wrote: > > > Actually, it is that hard to do... the OTP behaviors offer lots > > of well tested/debugging implementations which handle the border > > cases extremely well. Which a naive quick implementation using > > just the basic spawn_link/* and trap_exit won't get quite right on > > the first few tries. > > > > OTP rocks for that reason alone... but yea, gen_server isn't the > > most "Erlang" way to write a server, but its the Erlang/OTP way. > > How about this which I had fun writing today. It is almost Erlangish, > and it is something like OTP, and it is exactly Joe's selective receive > example. I can't decide whether it is ugly or profoundly beautiful. It is of course profoundly beautiful, but the syntax obscures the beauty. Just overload the LHS of !! so you can write [A,B,C] !! M This means send M to three processes (machines or whatever's) and gather three replies yielding [V1,V2,V3] Cheers /Joe > > Sean > > %% Call a bunch of gen_servers with different requests in > %% parallel and return successes and failures. Any which > %% fail to answer within Timeout ms are included as failures. > > %% We require that the calling process will continue to ignore > %% late answers > > multi_call(Requests, Timeout) -> > Mrefs = lists:map( > fun({Name, Req}) -> > Mref = erlang:monitor(process, Name), > Name ! {'$gen_call', {self(), Mref}, Req}, > {Name, Mref} > end, Requests), > get_results(Mrefs, [], [], Timeout, now()). > > get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> > Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) > div 1000), 0), > receive > {Mref, Reply} -> > erlang:demonitor(Mref), > receive > {'DOWN', Mref, _, _, _} -> > get_results(T, [{Name, Reply}|Succ], Fail, Timeout, > Now_at_start) > after 0 -> > get_results(T, [{Name, Reply}|Succ], Fail, Timeout, > Now_at_start) > end; > {'DOWN', Mref, _, _, _} -> > get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) > after Timeout_val -> > erlang:demonitor(Mref), > get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) > end; > get_results([], Succ, Fail, _, _) -> > {Succ, Fail}. > > max(A, B) when A >= B -> A; > max(A, B) -> B. > From jeinhorn@REDACTED Mon Apr 26 16:07:14 2004 From: jeinhorn@REDACTED (Jeffrey M. Einhorn) Date: 26 Apr 2004 09:07:14 -0500 Subject: $ROOT Message-ID: <1082988434.22687.21.camel@dhcp-lom-194-199.futuresource.com> I created boot and script files that rely on the $ROOT var as part of the paths to my erlang libraries, but I could not figure out how to set the $ROOT variable from the startup script. I tried setting a $ROOT environment variable and I tried passing different parameters to -boot_var option to the startup script. thanks for your time, -jeff einhorn From chandrashekhar.mullaparthi@REDACTED Mon Apr 26 17:20:26 2004 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Mon, 26 Apr 2004 16:20:26 +0100 Subject: $ROOT In-Reply-To: <1082988434.22687.21.camel@dhcp-lom-194-199.futuresource.com> References: <1082988434.22687.21.camel@dhcp-lom-194-199.futuresource.com> Message-ID: <3EC4F46C-9795-11D8-A2FE-000A95A09946@imp01ims.t-mobile.co.uk> Under the erts/bin directory of your erlang installation should be a start.src file which can be modified to suit your needs. cheers Chandru Looks like this: #!/bin/sh # # This program invokes the erlang emulator by calling run_erl. # It should only be used at an embedded target system. # It should be modified to give the correct flags to erl (via start_erl), # e.g -mode embedded -sname XXX # # Usage: start [Data] # ROOTDIR=%FINAL_ROOTDIR% cd $ROOTDIR if [ -z "$RELDIR" ] then RELDIR=$ROOTDIR/releases fi START_ERL_DATA=${1:-$RELDIR/start_erl.data} $ROOTDIR/bin/run_erl -daemon /tmp/%NAME% $ROOTDIR/log "exec $ROOTDIR/bin/start_erl $ROOTDIR $RELDIR $START_ERL_DATA -mode embedded -sname %NAME% -setcookie %COOKIE%" > /dev/null 2>&1 & On 26 Apr 2004, at 15:07, Jeffrey M. Einhorn wrote: > I created boot and script files that rely on the $ROOT var as part of > the paths to my erlang libraries, but I could not figure out how to set > the $ROOT variable from the startup script. I tried setting a $ROOT > environment variable and I tried passing different parameters to > -boot_var option to the startup script. > thanks for your time, > -jeff einhorn From jeinhorn@REDACTED Mon Apr 26 18:18:12 2004 From: jeinhorn@REDACTED (Jeffrey M. Einhorn) Date: 26 Apr 2004 11:18:12 -0500 Subject: Listening to Multicast. Message-ID: <1082996292.22687.33.camel@dhcp-lom-194-199.futuresource.com> Is there an erlang library that allows you to join a multicast group and listen to multicast traffic? thanks for your time, -jeff From ulf.wiger@REDACTED Mon Apr 26 20:19:34 2004 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 26 Apr 2004 20:19:34 +0200 Subject: spawn without linking? In-Reply-To: References: Message-ID: On Mon, 26 Apr 2004 14:56:01 +0200 (CEST), Joe Armstrong wrote: > On Thu, 22 Apr 2004, Sean Hinde wrote: >> How about this which I had fun writing today. It is almost Erlangish, >> and it is something like OTP, and it is exactly Joe's selective receive >> example. I can't decide whether it is ugly or profoundly beautiful. > > It is of course profoundly beautiful, but the syntax obscures the beauty. > > Just overload the LHS of !! so you can write > > [A,B,C] !! M > > This means send M to three processes (machines or whatever's) and > gather three replies yielding [V1,V2,V3] Ah, but Joe, you changed the semantics. Sean had a timeout argument, which you don't. ;-) BTW, Sean, you should rethink the implementation of the timeout. I think it's better to start a timer and handle a timeout message. In your present implementation, the "timer" will restart anytime one of the servers responds, making it fuzzy what the timeout really means. Regards, Uffe >> %% Call a bunch of gen_servers with different requests in >> %% parallel and return successes and failures. Any which >> %% fail to answer within Timeout ms are included as failures. >> >> %% We require that the calling process will continue to ignore >> %% late answers >> >> multi_call(Requests, Timeout) -> >> Mrefs = lists:map( >> fun({Name, Req}) -> >> Mref = erlang:monitor(process, Name), >> Name ! {'$gen_call', {self(), Mref}, Req}, >> {Name, Mref} >> end, Requests), >> get_results(Mrefs, [], [], Timeout, now()). >> >> get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> >> Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) >> div 1000), 0), >> receive >> {Mref, Reply} -> >> erlang:demonitor(Mref), >> receive >> {'DOWN', Mref, _, _, _} -> >> get_results(T, [{Name, Reply}|Succ], Fail, Timeout, >> Now_at_start) >> after 0 -> >> get_results(T, [{Name, Reply}|Succ], Fail, Timeout, >> Now_at_start) >> end; >> {'DOWN', Mref, _, _, _} -> >> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >> after Timeout_val -> >> erlang:demonitor(Mref), >> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >> end; >> get_results([], Succ, Fail, _, _) -> >> {Succ, Fail}. >> >> max(A, B) when A >= B -> A; >> max(A, B) -> B. >> > -- Ulf Wiger From g.ask@REDACTED Mon Apr 26 21:09:44 2004 From: g.ask@REDACTED (=?ISO-8859-1?Q?G=F6sta_Ask?=) Date: Mon, 26 Apr 2004 21:09:44 +0200 Subject: Starting a slave node (in Gentoo Linux) Message-ID: <408D5E78.5060401@telia.com> Hi, I have this awkward problem of receiving a timeout error message when I try to start a slave node (even locally) from an Erlang shell on my Gentoo box. I have tried the fixes suggested both in http://www.erlang.org/ml-archive/erlang-questions/200404/msg00155.html and http://www.erlang.org/ml-archive/erlang-questions/200310/msg00121.html but to no avail. Maybe someone on this list who is more experienced with the Gentoo environment than I am can lend me a helping hand? At work we have also seen this timeout occur under very special circumstances - not always - under Solaris9. Under Gentoo I have so far been unable to get it to work at all. Eshell V5.3 (abort with ^G) (bar@REDACTED)1 > net_adm:world(). [foo@REDACTED,bar@REDACTED] (bar@REDACTED)2 > slave:start(falcon, foobar, ""). {error,timeout} (bar@REDACTED)3 > net_adm:ping(foo@REDACTED ). pong (bar@REDACTED)4 > inet:gethostbyname(falcon). {ok,{hostent,"falcon.mobilearts.local",[],inet,4,[{192,168,211,60}]}} askg@REDACTED askg $ more .erlang inet_db:set_lookup([files, dns]). askg@REDACTED askg $ uname -a Linux falcon 2.4.20-gentoo-r6 #1 Fri Feb 27 10:59:40 CET 2004 i686 Pentium II (Deschutes) GenuineIntel GNU/Linux On the RedHat boxes of my colleauges this is not a problem. So they are beginning to sneer at Gentoo. I still hope to get the better of it with a reasonable effort though... rgds /G?sta Ask (Mobile Arts) From francesco@REDACTED Mon Apr 26 21:36:00 2004 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 26 Apr 2004 20:36:00 +0100 Subject: Listening to Multicast. Message-ID: <408D64A0.3070904@erlang-consulting.com> Hi Jeff, I assume you are looking for process groups. Take a look at http://www.erlang.org/doc/r9c/lib/stdlib-1.12/doc/html/pg.html Rgds, Francesco -- http://www.erlang-consulting.com Jeffrey M. Einhorn wrote: >Is there an erlang library that allows you to join a multicast group and >listen to multicast traffic? > thanks for your time, > -jeff > > > > > From enewhuis@REDACTED Mon Apr 26 21:57:58 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Mon, 26 Apr 2004 14:57:58 -0500 Subject: Listening to Multicast. In-Reply-To: <408D64A0.3070904@erlang-consulting.com> References: <408D64A0.3070904@erlang-consulting.com> Message-ID: <03CB72F4-97BC-11D8-88F4-000A95D9A520@futuresource.com> No. He's looking for information on how to do a recvfrom on an IP multicast channel, which is essentially a UDP datagram after joining the multicast group. (IP class D addressing) From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/18925 ... Berkeley Sockets Multicast APIs The Berkeley Sockets Multicast APIs are the same as those described by Steve Deering (as mentioned earlier). They complement the existing Berkeley Sockets APIs, which were designed to allow creating of network applications using virtually any network protocol suite, including TCP/IP, the so-called ?Internet address family.? All of the Berkeley multicast APIs use the setsockopt() ?socket option? function to initiate their actions (and for some options, the getsockopt() function is also available to retrieve the current setting). IP_ADD_MEMBERSHIP to join a multicast group on a specific interface IP_DROP_MEMBERSHIP to leave a multicast group (no protocol action initiated with IGMP v1, but there is with IGMP v2) IP_MULTICAST_IF to set or get default interface for use with multicast sends IP_MULTICAST_LOOP to disable loopback of outgoing multicast datagrams IP_MULTICAST_TTL to set the IP time-to-live of outgoing multicast datagrams. Table 2: Summary of BSD set/getsockopt() multicast commands The setsockopt() IP_ADD_MEMBERSHIP function is the most significant of all the APIs, in several respects. It is required to receive any datagrams destined for the specified multicast (group) address. Unlike other socket options, it actually initiates some network activity; it causes the underlying IP protocol stack to issue an IGMP (Internet Group Message Protocol) host membership report to notify the local router(s) of the group membership, as prescribed by RFC 1112. For an example of how to use these de facto standard multicast APIs, see the ?Code Samples? section of this white paper. On Apr 26, 2004, at 2:36 PM, Francesco Cesarini wrote: > Hi Jeff, > > I assume you are looking for process groups. Take a look at > http://www.erlang.org/doc/r9c/lib/stdlib-1.12/doc/html/pg.html > > Rgds, > Francesco > -- > http://www.erlang-consulting.com > > Jeffrey M. Einhorn wrote: > >> Is there an erlang library that allows you to join a multicast group >> and >> listen to multicast traffic? >> thanks for your time, >> -jeff >> >> >> >> > From sean.hinde@REDACTED Mon Apr 26 22:56:53 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 26 Apr 2004 21:56:53 +0100 Subject: Redirecting functions calls ? In-Reply-To: <20040423152251.GD54378@frogman.motivity.ca> References: <20040423152251.GD54378@frogman.motivity.ca> Message-ID: <3F0014B6-97C4-11D8-A219-000A95927CCE@mac.com> Hi, What I was trying to do was something like: test(A) when is_integer-> i.e. I was distracted while typing in the guard Sean On 23 Apr 2004, at 16:22, Vance Shipley wrote: > > Can someone tell me what this is supposed to do? > (Apart from what was requested :) > > I really fail to see what is being attempted here. > 'fred' is a guard expression. I see that a valid > guard expression is "constants (terms and bound > variables) all regarded as false". So wouldn't > the the following be equivalent (and more clear)? > > test(A) when false -> > > As I read it you have a function with one clause > which will never match and so never be called. > > > -Vance > > > Sean Hinde writes: > } > } -module(compiler_bug). > } -export([test/1, wow/1]). > } > } test(A) when fred -> > } {ok, A}. > } > } wow(A) -> > } wow. From sean.hinde@REDACTED Mon Apr 26 23:10:27 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 26 Apr 2004 22:10:27 +0100 Subject: Beginner: Unexplained network behavior In-Reply-To: <408934D7.20608@sharkbite.org> References: <408934D7.20608@sharkbite.org> Message-ID: <2402D08C-97C6-11D8-A219-000A95927CCE@mac.com> Hi, On 23 Apr 2004, at 16:23, Aaron Hunter wrote: > Hello, > > A long time Java developer I recently discovered Erlang and am very > impressed. With a few improvements Erlang could very well be a J2EE > killer. Been there, done that (actually I need to be careful as our J2EE replacing system is not live yet...) > > I wrote this simple module to explore how sockets work in Erlang but > am puzzled by its behavior. It is supposed to scan 254 IP's > simultaneously. looking for HTTP servers. Over the course of several > runs, however, it gives me different answers and often misses HTTP > servers. > > Can someone point out what I am doing wrong? > Thank you. A couple of things could be improved: 1. If you use spawn_link rather than spawn then you guarantee to get a message of some sort from each spawned process, even if it crashes. If you use proc_lib:spawn_link, and have the sasl application running then you will also get nicely formatted crash reports if any process exits abnormally. 2. The documentation :-(. gen_tcp:connect/2 can actually throw an exception if it fails to connect rather than returning {error, Reason}. The implementation from gen_tcp.erl is: connect(Address, Port, Opts, Time) -> Timer = inet:start_timer(Time), Res = (catch connect1(Address,Port,Opts,Timer)), inet:stop_timer(Timer), case Res of {ok,S} -> {ok,S}; {error, einval} -> exit(badarg); {'EXIT',Reason} -> exit(Reason); Error -> Error end. The combination of these two things means that you could get your result. The lesson for you is to use spawn_link anywhere you are spawning a process to do some work where you always want an answer. It is unfortunate in the light of your opening comments that you have run into a documentation error so soon in your experimentation. I would say that the documentation is generally pretty accurate, but still could do with some work on return values here and there. Best of luck with Erlang. Regards, Sean > > -module( scanner ). > -export( [scan_http/1, scan_port/3] ). > > % Check for an open socket on the given port > scan_port( PID, IP, Port ) -> > case gen_tcp:connect( IP, Port, [], 5000) of > { ok, Socket } -> > gen_tcp:close( Socket ), > PID ! { found, IP, Port }; > { error, _ } -> > PID ! { none, IP } > end. > > % Wait for all 254 processes to finish > wait( 254, Found ) -> > io:fwrite("~nFound ~B HTTP servers: ~p~n", [ length( Found ), Found > ]); > wait( Count, Found ) -> > receive > { found, IP, Port } -> > io:fwrite("+"), > wait( Count + 1, [{IP,Port}|Found] ); > { none, IP } -> > io:fwrite("."), > wait( Count + 1, Found ) > end. > > % Call with a network IP tuple in the form {192,168,0,0} > scan_http( {A,B,C,D} ) -> > io:fwrite("Scanning ~n"), > lists:foreach( fun(Host) -> spawn( ?MODULE, scan_port, [ self(), > {A,B,C,Host}, 80 ] ) end, lists:seq(1,254) ), > wait( 0, [] ). > > > > > From sean.hinde@REDACTED Mon Apr 26 23:14:58 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 26 Apr 2004 22:14:58 +0100 Subject: spawn without linking? In-Reply-To: References: Message-ID: On 26 Apr 2004, at 19:19, Ulf Wiger wrote: > On Mon, 26 Apr 2004 14:56:01 +0200 (CEST), Joe Armstrong > wrote: > >> On Thu, 22 Apr 2004, Sean Hinde wrote: > >>> How about this which I had fun writing today. It is almost Erlangish, >>> and it is something like OTP, and it is exactly Joe's selective >>> receive >>> example. I can't decide whether it is ugly or profoundly beautiful. >> >> It is of course profoundly beautiful, but the syntax obscures the >> beauty. >> >> Just overload the LHS of !! so you can write >> >> [A,B,C] !! M >> >> This means send M to three processes (machines or whatever's) and >> gather three replies yielding [V1,V2,V3] > > Ah, but Joe, you changed the semantics. Sean had a timeout argument, > which you don't. ;-) > > BTW, Sean, you should rethink the implementation of the timeout. > I think it's better to start a timer and handle a timeout message. > In your present implementation, the "timer" will restart anytime > one of the servers responds, making it fuzzy what the timeout > really means. That was something like my first thought, but I was persuaded to do it like it is. I agree, I'll re-write it, thanks. Sean > > Regards, > Uffe > > >>> %% Call a bunch of gen_servers with different requests in >>> %% parallel and return successes and failures. Any which >>> %% fail to answer within Timeout ms are included as failures. >>> >>> %% We require that the calling process will continue to ignore >>> %% late answers >>> >>> multi_call(Requests, Timeout) -> >>> Mrefs = lists:map( >>> fun({Name, Req}) -> >>> Mref = erlang:monitor(process, Name), >>> Name ! {'$gen_call', {self(), Mref}, Req}, >>> {Name, Mref} >>> end, Requests), >>> get_results(Mrefs, [], [], Timeout, now()). >>> >>> get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> >>> Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) >>> div 1000), 0), >>> receive >>> {Mref, Reply} -> >>> erlang:demonitor(Mref), >>> receive >>> {'DOWN', Mref, _, _, _} -> >>> get_results(T, [{Name, Reply}|Succ], Fail, >>> Timeout, >>> Now_at_start) >>> after 0 -> >>> get_results(T, [{Name, Reply}|Succ], Fail, >>> Timeout, >>> Now_at_start) >>> end; >>> {'DOWN', Mref, _, _, _} -> >>> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >>> after Timeout_val -> >>> erlang:demonitor(Mref), >>> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >>> end; >>> get_results([], Succ, Fail, _, _) -> >>> {Succ, Fail}. >>> >>> max(A, B) when A >= B -> A; >>> max(A, B) -> B. >>> >> > > > > -- > Ulf Wiger > From sean.hinde@REDACTED Mon Apr 26 23:23:15 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Mon, 26 Apr 2004 22:23:15 +0100 Subject: spawn without linking? In-Reply-To: References: Message-ID: On 26 Apr 2004, at 13:56, Joe Armstrong wrote: > On Thu, 22 Apr 2004, Sean Hinde wrote: > >> >> On 21 Apr 2004, at 04:20, Shawn Pearce wrote: >> >>> Actually, it is that hard to do... the OTP behaviors offer lots >>> of well tested/debugging implementations which handle the border >>> cases extremely well. Which a naive quick implementation using >>> just the basic spawn_link/* and trap_exit won't get quite right on >>> the first few tries. >>> >>> OTP rocks for that reason alone... but yea, gen_server isn't the >>> most "Erlang" way to write a server, but its the Erlang/OTP way. >> >> How about this which I had fun writing today. It is almost Erlangish, >> and it is something like OTP, and it is exactly Joe's selective >> receive >> example. I can't decide whether it is ugly or profoundly beautiful. > > It is of course profoundly beautiful, but the syntax obscures the > beauty. And isn't there a lot of it. Not for the faint hearted playing with this stuff, but it should be bread and butter. > > Just overload the LHS of !! so you can write > > [A,B,C] !! M > > This means send M to three processes (machines or whatever's) and > gather three replies yielding [V1,V2,V3] So, would this include monitor semantics by default? And how could we make a timeout? -define(IANALD, true). case [A,B,C] !! M of [V1, V2, V3] -> success after 5000 -> exit(timeout) end, Sean > > Cheers > > /Joe > >> >> Sean >> >> %% Call a bunch of gen_servers with different requests in >> %% parallel and return successes and failures. Any which >> %% fail to answer within Timeout ms are included as failures. >> >> %% We require that the calling process will continue to ignore >> %% late answers >> >> multi_call(Requests, Timeout) -> >> Mrefs = lists:map( >> fun({Name, Req}) -> >> Mref = erlang:monitor(process, Name), >> Name ! {'$gen_call', {self(), Mref}, Req}, >> {Name, Mref} >> end, Requests), >> get_results(Mrefs, [], [], Timeout, now()). >> >> get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> >> Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) >> div 1000), 0), >> receive >> {Mref, Reply} -> >> erlang:demonitor(Mref), >> receive >> {'DOWN', Mref, _, _, _} -> >> get_results(T, [{Name, Reply}|Succ], Fail, >> Timeout, >> Now_at_start) >> after 0 -> >> get_results(T, [{Name, Reply}|Succ], Fail, >> Timeout, >> Now_at_start) >> end; >> {'DOWN', Mref, _, _, _} -> >> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >> after Timeout_val -> >> erlang:demonitor(Mref), >> get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) >> end; >> get_results([], Succ, Fail, _, _) -> >> {Succ, Fail}. >> >> max(A, B) when A >= B -> A; >> max(A, B) -> B. >> > From mscandar@REDACTED Tue Apr 27 00:09:18 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Mon, 26 Apr 2004 18:09:18 -0400 Subject: SAE redux (OTP R9C-0) Message-ID: <408D888E.7090904@cisco.com> I know this was discussed as recently as a month ago, but I'm stuck. ear and escript wouldn't run - it turns out they started with: #!/usr/bin/env beam_evm ERLANG_EARS=/users/mscandar/local/src/otp_src_R9C-0/erts/boot/src while ecc and elink started with: #!/bin/sh exec /users/mscandar/local/src/otp_src_R9C-0/bin/sparc-sun-solaris2.6/beam_evm $0 ${1+"$@"} ERLANG_EARS=/users/mscandar/local/src/otp_src_R9C-0/erts/boot/src So I added "/users/mscandar/local/src/otp_src_R9C-0/bin/sparc-sun-solaris2.6/" to my PATH. I could then escript like a madman. But I couldn't elink: > ecc foo.erl > elink foo.beam Cannot parse arguments:["foo.beam"] Usage: elink -t [windows | unix] [-d | -s] -o out[.exe] -S mod -m m1.beam m2.beam m2.beam ... > No combination of arguments produces any different result. Any hints would be appreciated. Thanks, Mark. From vances@REDACTED Tue Apr 27 01:37:12 2004 From: vances@REDACTED (Vance Shipley) Date: Mon, 26 Apr 2004 19:37:12 -0400 Subject: Listening to Multicast. In-Reply-To: <03CB72F4-97BC-11D8-88F4-000A95D9A520@futuresource.com> References: <408D64A0.3070904@erlang-consulting.com> <03CB72F4-97BC-11D8-88F4-000A95D9A520@futuresource.com> Message-ID: <20040426233712.GB2473@frogman.motivity.ca> 2> inet:options(). [reuseaddr, keepalive, dontroute, linger, broadcast, sndbuf, recbuf, nodelay, buffer, header, active, packet, deliver, mode, multicast_if, <------ undocumented multicast_ttl, < multicast_loop, < exit_on_close, high_watermark, low_watermark, bit8, send_timeout] From mikael.karlsson@REDACTED Tue Apr 27 06:48:20 2004 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 27 Apr 2004 06:48:20 +0200 Subject: Beginner: Unexplained network behavior In-Reply-To: <2402D08C-97C6-11D8-A219-000A95927CCE@mac.com> References: <408934D7.20608@sharkbite.org> <2402D08C-97C6-11D8-A219-000A95927CCE@mac.com> Message-ID: <200404270648.20339.mikael.karlsson@creado.com> Mon 26 april 2004 23:10, Sean Hinde wrote: > Hi, > > On 23 Apr 2004, at 16:23, Aaron Hunter wrote: > > Hello, > > > > A long time Java developer I recently discovered Erlang and am very > > impressed. With a few improvements Erlang could very well be a J2EE > > killer. > > Been there, done that (actually I need to be careful as our J2EE > replacing system is not live yet...) Please explore. Are you replacing your Erlang system with a J2EE system (!) or replacing a J2EE system with an Erlang system? I have been involved in a J2EE project and would *really* like to see an Erlang alternative, but if this is not "advisable" I would very much like to know why, and also any reasons for going in the opposite direction. I mean, just a thing like to be able to do parallel multi_calls in a beautiful way :) http://www.erlang.org/ml-archive/erlang-questions/200404/msg00170.html could be a killer argument in a web services environment. Regards Mikael From bry@REDACTED Tue Apr 27 07:59:37 2004 From: bry@REDACTED (bry@REDACTED) Date: Tue, 27 Apr 2004 07:59:37 CET Subject: Beginner: Unexplained network behavior Message-ID: <20040427075962.SM02048@Debug> > > A long time Java developer I recently discovered Erlang and am very > > impressed. With a few improvements Erlang could very well be a J2EE > > killer. > just a side question, as someone unfamiliar with J2EE other than cursorily inspecting monstrous books on the subject and thinking "these folks are crazeeeee!" what things in erlang could be improved to make it a J2EE killer? Not a language war question, just wondering if my original estimation was off. From mikael.karlsson@REDACTED Tue Apr 27 07:26:11 2004 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 27 Apr 2004 07:26:11 +0200 Subject: spawn without linking? In-Reply-To: References: Message-ID: <200404270726.11685.mikael.karlsson@creado.com> How do you send different messages do different processes with "!!"? This is is a nice feature and this is what multi_call does, like send Req1 to Name1 and Req2 to Name2: multi_call([{Name1, Req1}, {Name2, Req2}], Timout) Would this become [Name1,Name2] !! [Req1, Req] with bangbang? Regards Mikael Mon 26 April 2004 14:56, Joe Armstrong: > On Thu, 22 Apr 2004, Sean Hinde wrote: > > On 21 Apr 2004, at 04:20, Shawn Pearce wrote: > > > Actually, it is that hard to do... the OTP behaviors offer lots > > > of well tested/debugging implementations which handle the border > > > cases extremely well. Which a naive quick implementation using > > > just the basic spawn_link/* and trap_exit won't get quite right on > > > the first few tries. > > > > > > OTP rocks for that reason alone... but yea, gen_server isn't the > > > most "Erlang" way to write a server, but its the Erlang/OTP way. > > > > How about this which I had fun writing today. It is almost Erlangish, > > and it is something like OTP, and it is exactly Joe's selective receive > > example. I can't decide whether it is ugly or profoundly beautiful. > > It is of course profoundly beautiful, but the syntax obscures the beauty. > > Just overload the LHS of !! so you can write > > [A,B,C] !! M > > This means send M to three processes (machines or whatever's) and > gather three replies yielding [V1,V2,V3] > > Cheers > > /Joe > > > Sean > > > > %% Call a bunch of gen_servers with different requests in > > %% parallel and return successes and failures. Any which > > %% fail to answer within Timeout ms are included as failures. > > > > %% We require that the calling process will continue to ignore > > %% late answers > > > > multi_call(Requests, Timeout) -> > > Mrefs = lists:map( > > fun({Name, Req}) -> > > Mref = erlang:monitor(process, Name), > > Name ! {'$gen_call', {self(), Mref}, Req}, > > {Name, Mref} > > end, Requests), > > get_results(Mrefs, [], [], Timeout, now()). > > > > get_results([{Name, Mref}|T], Succ, Fail, Timeout, Now_at_start) -> > > Timeout_val = max(Timeout - (timer:now_diff(now(), Now_at_start) > > div 1000), 0), > > receive > > {Mref, Reply} -> > > erlang:demonitor(Mref), > > receive > > {'DOWN', Mref, _, _, _} -> > > get_results(T, [{Name, Reply}|Succ], Fail, Timeout, > > Now_at_start) > > after 0 -> > > get_results(T, [{Name, Reply}|Succ], Fail, Timeout, > > Now_at_start) > > end; > > {'DOWN', Mref, _, _, _} -> > > get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) > > after Timeout_val -> > > erlang:demonitor(Mref), > > get_results(T, Succ, [Name|Fail], Timeout, Now_at_start) > > end; > > get_results([], Succ, Fail, _, _) -> > > {Succ, Fail}. > > > > max(A, B) when A >= B -> A; > > max(A, B) -> B. From dustin@REDACTED Tue Apr 27 10:48:13 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 27 Apr 2004 01:48:13 -0700 Subject: guidance Message-ID: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> I've got thermometers that sit on my LAN and multicast readings and I wanted to pick up the readings and make them available. I have a little C program that uses the packet protocol to retransmit those messages into erlang. Currently, I've got the following code: --------------------- start() -> spawn(?MODULE, init, []). init() -> register(mrecv, self()), process_flag(trap_exit, true), Port = open_port({spawn, "./mrecv"}, [{packet, 1}]), loop(Port, dict:new()). loop(Port, Dict) -> receive {Port, {data, Data}} -> Vals = string:tokens(Data, "\t"), Key = lists:nth(2, Vals), Val = list_to_float(lists:nth(3, Vals)), loop(Port, dict:update(Key, fun(_) -> Val end, Val, Dict)); {lookup, From, SN} -> From ! dict:fetch(SN, Dict), loop(Port, Dict); {getdict, From} -> From ! Dict, loop(Port, Dict); Unhandled -> io:format("Unhandled message: ~p\n", [Unhandled]), loop(Port, Dict) end. getdict() -> mrecv ! {getdict, self()}, receive Rv -> Rv end. getval(SN) -> mrecv ! {lookup, self(), SN}, receive Rv -> Rv end. --------------------- I've got two problems with this which make me think it might not be the best way to do things. 1) It rather feels like OO. Is this normal? 2) It doesn't seem to work across a distributed connection. I can spawn it on a remote system, but I can't get readings from that remote system. I tried registering mrecv as the remote process ID, but I get the following error: (dustinti@REDACTED)1> Pid = spawn(rubik@REDACTED, mrecv, init, []). <4147.40.0> (dustinti@REDACTED)2> register(mrecv, Pid). true (dustinti@REDACTED)3> mrecv:getdict(). =ERROR REPORT==== 27-Apr-2004::01:43:17 === Error in process <0.30.0> on node 'dustinti@REDACTED' with exit value: {badarg,[{mrecv,getdict,0},{erl_eval,do_apply,5},{shell,eval_loop,2}]} ** exited: {badarg,[{mrecv,getdict,0}, {erl_eval,do_apply,5}, {shell,eval_loop,2}]} ** vs. the other system: (rubik@REDACTED)1> mrecv:getdict(). {dict,4, 16, 16, 8, 80, 48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[], [], [], [], [["10E8C214000000E4"|19.0500]], [], [], [], [["10258D2A000000EA"|18.2400]], [], [["10C8892A00000096"|22.8100]], [], [["1013A51E00000035"|23.9200]], [], [], []}}} -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From sean.hinde@REDACTED Tue Apr 27 11:18:44 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Tue, 27 Apr 2004 10:18:44 +0100 Subject: Beginner: Unexplained network behavior In-Reply-To: <200404270648.20339.mikael.karlsson@creado.com> References: <408934D7.20608@sharkbite.org> <2402D08C-97C6-11D8-A219-000A95927CCE@mac.com> <200404270648.20339.mikael.karlsson@creado.com> Message-ID: On 27 Apr 2004, at 05:48, Mikael Karlsson wrote: > Mon 26 april 2004 23:10, Sean Hinde wrote: >> Hi, >> >> On 23 Apr 2004, at 16:23, Aaron Hunter wrote: >>> Hello, >>> >>> A long time Java developer I recently discovered Erlang and am very >>> impressed. With a few improvements Erlang could very well be a J2EE >>> killer. >> >> Been there, done that (actually I need to be careful as our J2EE >> replacing system is not live yet...) > > Please explore. Are you replacing your Erlang system with a > J2EE system (!) or replacing a J2EE system with an Erlang system? > I have been involved in a J2EE project and would *really* like to see > an > Erlang alternative, but if this is not "advisable" I would very much > like to > know why, and also any reasons for going in the opposite direction. J2EE -> Erlang. > > I mean, just a thing like to be able to do parallel multi_calls in a > beautiful > way :) > http://www.erlang.org/ml-archive/erlang-questions/200404/msg00170.html > could be a killer argument in a web services environment. This is something like the reason. There was some difficulty achieving performance in the presence of latency from external platforms. The conclusion was that it is really hard to do concurrent programming in Java, and that is what was needed in this case. Regards, Sean From matthias@REDACTED Tue Apr 27 11:26:12 2004 From: matthias@REDACTED (Matthias Lang) Date: Tue, 27 Apr 2004 11:26:12 +0200 Subject: guidance In-Reply-To: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> References: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> Message-ID: <16526.10036.842205.762218@antilipe.corelatus.se> Dustin Sallings writes: > (dustinti@REDACTED)1> Pid = spawn(rubik@REDACTED, mrecv, init, []). > <4147.40.0> > (dustinti@REDACTED)2> register(mrecv, Pid). You can't use 'register' to register PIDs which are on another node. (This is kinda an RTFM, though the FM is not very clear about telling you that erlang:register is for local processes only. Also, while the manual says that register will give you a 'badarg' if Pid is remote, R8B doesn't actually do that. That is a bug.) Take a look at the 'global' module. Matthias From d.love@REDACTED Tue Apr 27 16:22:43 2004 From: d.love@REDACTED (Dave Love) Date: Tue, 27 Apr 2004 15:22:43 +0100 Subject: spawn without linking? References: <2D1854A3-92FE-11D8-81BB-000393CFE6B8@spy.net> <20040421020923.GD46451@frogman.motivity.ca> <2D519283-933D-11D8-930E-000A957659CC@spy.net> <20040421032027.GH8914@spearce.org> <485D9486-94D1-11D8-8D5E-000A957659CC@spy.net> Message-ID: Sean Hinde writes: >> Is there an introduction to OTP somewhere that can get an >> application built and running quickly? The man pages seem to make a >> good reference, but don't really do a lot to get me started. > > I learnt what I know from the man pages and the "Design Principles" > section of the HTML documentation. > > After a few reads through it should start to make some sort of sense - > keep at it. Actually, at least some of the examples don't even compile, and doc for at least one of the standard behaviours is missing (in the latest Debian package I have). I've been intending to make a coherent bug report when I get time. From Mark.Geib@REDACTED Tue Apr 27 17:12:25 2004 From: Mark.Geib@REDACTED (Geib, Mark) Date: Tue, 27 Apr 2004 09:12:25 -0600 Subject: using erlang to sniff network Message-ID: <1083078744.2416.109.camel@bilbo.dev.uplink> Is it possible to use erlang to open a network device for sniffing...in order to analyze traffic, etc. I need to see all the traffic on a device, and I can run as root. This is on linux. I want to do something like tcpdump | parser > logfile in a single erlang program. Any help is appreciated. Mark. From mikael.karlsson@REDACTED Tue Apr 27 17:33:55 2004 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 27 Apr 2004 17:33:55 +0200 Subject: Beginner: Unexplained network behavior In-Reply-To: References: <408934D7.20608@sharkbite.org> <200404270648.20339.mikael.karlsson@creado.com> Message-ID: <200404271733.55773.mikael.karlsson@creado.com> Tue 27 april 2004 11:18, Sean Hinde: > On 27 Apr 2004, at 05:48, Mikael Karlsson wrote: > > Mon 26 april 2004 23:10, Sean Hinde wrote: > >> Hi, > >> > >> On 23 Apr 2004, at 16:23, Aaron Hunter wrote: > >>> Hello, > >>> > >>> A long time Java developer I recently discovered Erlang and am very > >>> impressed. With a few improvements Erlang could very well be a J2EE > >>> killer. > >> > >> Been there, done that (actually I need to be careful as our J2EE > >> replacing system is not live yet...) > > > > Please explore. Are you replacing your Erlang system with a > > J2EE system (!) or replacing a J2EE system with an Erlang system? > > I have been involved in a J2EE project and would *really* like to see > > an > > Erlang alternative, but if this is not "advisable" I would very much > > like to > > know why, and also any reasons for going in the opposite direction. > > J2EE -> Erlang. Ah good, I got a bit worried there. > > I mean, just a thing like to be able to do parallel multi_calls in a > > beautiful > > way :) > > http://www.erlang.org/ml-archive/erlang-questions/200404/msg00170.html > > could be a killer argument in a web services environment. > > This is something like the reason. There was some difficulty achieving > performance in the presence of latency from external platforms. The > conclusion was that it is really hard to do concurrent programming in > Java, and that is what was needed in this case. I agree. Thanks Mikael From matthias@REDACTED Tue Apr 27 18:59:58 2004 From: matthias@REDACTED (Matthias Lang) Date: Tue, 27 Apr 2004 18:59:58 +0200 Subject: using erlang to sniff network In-Reply-To: <1083078744.2416.109.camel@bilbo.dev.uplink> References: <1083078744.2416.109.camel@bilbo.dev.uplink> Message-ID: <16526.37262.297124.137187@antilipe.corelatus.se> Geib, Mark writes: > Is it possible to use erlang to open a network device for sniffing...in > order to analyze traffic, etc. I need to see all the traffic on a > device, and I can run as root. This is on linux. > > I want to do something like tcpdump | parser > logfile in a single > erlang program. You'd need a driver (either a port program or a linked-in driver). As far as I know, nobody has written such a driver. Matt From mikael.karlsson@REDACTED Tue Apr 27 18:38:28 2004 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 27 Apr 2004 18:38:28 +0200 Subject: Beginner: Unexplained network behavior In-Reply-To: <20040427075962.SM02048@Debug> References: <20040427075962.SM02048@Debug> Message-ID: <200404271838.28047.mikael.karlsson@creado.com> Tue 27 April 2004 12:59, bry@REDACTED wrote: > > A long time Java developer I recently > > discovered Erlang and am very > > impressed. With a few improvements > > Erlang could very well be a J2EE > > killer. > > just a side question, as someone unfamiliar > with J2EE other than cursorily inspecting > monstrous books on the subject and > thinking "these folks are crazeeeee!" what > things in erlang could be improved to make > it a J2EE killer? Not a language war > question, just wondering if my original > estimation was off. Since J2EE compared to Erlang has a very large user/developer community and lots of libraries etc. maybe "killer" is a strong word, but who knows... Concerning performance I would say that Erlang together with Yaws webserver already is a killer. Some functions/applications that could improve things: - Erlang servlets; a framework application that integrates OTP application deployment together with an embeddedYaws web server to make it possible to deploy/start/stop/upgrade web applications. - Web Services (SOAP/WSDL) libraries. - Direct connectors to database backends like MySQL/Postgres ? I don't know about transactional support, Data Access Objects etc. - Security? (you are not allowed to do many things in a J2EE/EJB container). - parallel multi_calls, (already implemented by Sean Hinde ) - A distributed registry Regards Mikael From vances@REDACTED Tue Apr 27 19:42:23 2004 From: vances@REDACTED (Vance Shipley) Date: Tue, 27 Apr 2004 13:42:23 -0400 Subject: Listening to Multicast. In-Reply-To: <1083071164.22687.57.camel@dhcp-lom-194-199.futuresource.com> References: <408D64A0.3070904@erlang-consulting.com> <03CB72F4-97BC-11D8-88F4-000A95D9A520@futuresource.com> <20040426233712.GB2473@frogman.motivity.ca> <1083071164.22687.57.camel@dhcp-lom-194-199.futuresource.com> Message-ID: <20040427174223.GB5802@frogman.motivity.ca> We are still missing the add_membership and drop_membership options. There is a very simple patch required to add these options into inet.erl. The options are implemented however they are missing from inet:options/0 and so are unreachable. Raimo had said the patch was accepted for the R9 release however that doesn't seem to have happed. -Vance http://www.erlang.org/ml-archive/erlang-questions/200303/msg00314.html http://article.gmane.org/gmane.comp.lang.erlang.patches/15 http://article.gmane.org/gmane.comp.lang.erlang.patches/19 From dustin@REDACTED Tue Apr 27 20:29:20 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 27 Apr 2004 11:29:20 -0700 Subject: Listening to Multicast. In-Reply-To: <1082996292.22687.33.camel@dhcp-lom-194-199.futuresource.com> References: <1082996292.22687.33.camel@dhcp-lom-194-199.futuresource.com> Message-ID: On Apr 26, 2004, at 9:18, Jeffrey M. Einhorn wrote: > Is there an erlang library that allows you to join a multicast group > and > listen to multicast traffic? Here's some example code I'm using to watch my thermometers: http://bsdboy.west.spy.net/cgi-bin/viewarch.cgi/dustin@REDACTED projects-2004/snippets--erlang--1.0--patch-19/mrecv.erl Before this, I was just using a spawned port with a UNIX process which worked pretty well. I prefer more native stuff, though. :) -- Dustin Sallings From enewhuis@REDACTED Tue Apr 27 22:41:11 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Tue, 27 Apr 2004 15:41:11 -0500 Subject: Deadlock in global ? (we see global:random_sleep) Message-ID: <37E6E82E-988B-11D8-B6AD-000A95D9A520@futuresource.com> I've heard that use of the global app is dangerous because the algorithms do not recover properly if there is a temporary partitioning of the network that divides a single cloud into multiple clouds and then rejoins them. Today we had a multiple-node deadlock after running solid for several months. In fact the last time this happened was due to accidental manual tinkering. Our distributed application uses global to ensure only a single instance of a particular resource is connecting to our server farm. All our processes appear to be hung waiting on global:random_sleep. My question is if anyone knows if there is a "known problem" with global. And can someone describe what that problem is and perhaps point us in the direction of alternatives? The problem seems quite rare. So if it is a bug in global or a non-solvable problem then perhaps a workaround for now would be a means to reset the global state somehow? From tony@REDACTED Tue Apr 27 23:18:25 2004 From: tony@REDACTED (Tony Rogvall) Date: Tue, 27 Apr 2004 23:18:25 +0200 Subject: Listening to Multicast. In-Reply-To: <20040427174223.GB5802@frogman.motivity.ca> Message-ID: <6BACFDDC-9890-11D8-9221-000A95EB4F88@rogvall.com> tisdagen den 27 april 2004 kl 19.42 skrev Vance Shipley: > > We are still missing the add_membership and drop_membership > options. There is a very simple patch required to add these > options into inet.erl. The options are implemented however > they are missing from inet:options/0 and so are unreachable. > They are not missing, they are however not listed among inet:options :-) just do (on an udp socket) inet:setopts(S, [{add_membership,{MultiCastAddress, InterfaceAddress}}]) and inet:setopts(S, [{drop_membership,{MultiCastAddress, InterfaceAddress}}]) one reason for the options to not be listed could be that you can not use them in inet:getopts. so inet:getopts(S, inet:options()) will not work for add/drop membership. (Multicast has been working for years :-) Regards /Tony > Raimo had said the patch was accepted for the R9 release > however that doesn't seem to have happed. > > -Vance > > http://www.erlang.org/ml-archive/erlang-questions/200303/msg00314.html > http://article.gmane.org/gmane.comp.lang.erlang.patches/15 > http://article.gmane.org/gmane.comp.lang.erlang.patches/19 From enewhuis@REDACTED Tue Apr 27 23:38:06 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Tue, 27 Apr 2004 16:38:06 -0500 Subject: Listening to Multicast. In-Reply-To: <6BACFDDC-9890-11D8-9221-000A95EB4F88@rogvall.com> References: <6BACFDDC-9890-11D8-9221-000A95EB4F88@rogvall.com> Message-ID: <2B744FC0-9893-11D8-B6AD-000A95D9A520@futuresource.com> My faith thus has been restored. I shall waiver nevermore. On Apr 27, 2004, at 4:18 PM, Tony Rogvall wrote: > > tisdagen den 27 april 2004 kl 19.42 skrev Vance Shipley: > >> >> We are still missing the add_membership and drop_membership >> options. There is a very simple patch required to add these >> options into inet.erl. The options are implemented however >> they are missing from inet:options/0 and so are unreachable. >> > > They are not missing, they are however not listed among inet:options > :-) > > just do (on an udp socket) > > inet:setopts(S, [{add_membership,{MultiCastAddress, > InterfaceAddress}}]) > > and > > inet:setopts(S, [{drop_membership,{MultiCastAddress, > InterfaceAddress}}]) > > one reason for the options to not be listed could be that you can not > use them > in inet:getopts. so inet:getopts(S, inet:options()) will not work for > add/drop membership. > > (Multicast has been working for years :-) > > Regards > > /Tony > > >> Raimo had said the patch was accepted for the R9 release >> however that doesn't seem to have happed. >> >> -Vance >> >> http://www.erlang.org/ml-archive/erlang-questions/200303/msg00314.html >> http://article.gmane.org/gmane.comp.lang.erlang.patches/15 >> http://article.gmane.org/gmane.comp.lang.erlang.patches/19 > From dustin@REDACTED Wed Apr 28 06:18:39 2004 From: dustin@REDACTED (Dustin Sallings) Date: Tue, 27 Apr 2004 21:18:39 -0700 Subject: guidance In-Reply-To: <16526.10036.842205.762218@antilipe.corelatus.se> References: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> <16526.10036.842205.762218@antilipe.corelatus.se> Message-ID: <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> On Apr 27, 2004, at 2:26, Matthias Lang wrote: > You can't use 'register' to register PIDs which are on another node. > > (This is kinda an RTFM, though the FM is not very clear about telling > you that erlang:register is for local processes only. Also, while the > manual says that register will give you a 'badarg' if Pid is remote, > R8B doesn't actually do that. That is a bug.) > > Take a look at the 'global' module. Thanks, this does solve my mystery with register, but I was thinking it wasn't working at all through the cluster. I must have been doing something else stupid. :) Is it normal, though, for erlang to feel like OO? -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From matthias@REDACTED Wed Apr 28 08:27:57 2004 From: matthias@REDACTED (Matthias Lang) Date: Wed, 28 Apr 2004 08:27:57 +0200 Subject: guidance In-Reply-To: <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> References: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> <16526.10036.842205.762218@antilipe.corelatus.se> <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> Message-ID: <16527.20205.150484.434803@antilipe.corelatus.se> Dustin Sallings writes: > Is it normal, though, for erlang to feel like OO? This seems like the sort of question Chris Pressey lies awake at night writing novels about. At a guess, it's the access functions 'getdict' and 'getval' which are worrying you. Accessing data through functions is a part of OO and it's a part of other schools of thought too. Matthias From tony@REDACTED Wed Apr 28 08:31:42 2004 From: tony@REDACTED (Tony Rogvall) Date: Wed, 28 Apr 2004 08:31:42 +0200 Subject: guidance In-Reply-To: <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> Message-ID: onsdagen den 28 april 2004 kl 06.18 skrev Dustin Sallings: > > > > Is it normal, though, for erlang to feel like OO? > Only the first week :-) The functional part is easy to understand and most things are easy to trace. The process part makes Erlang real OO (~no side effects) but still easy to trace, and in my opinion the only language where you can program concurrent systems and get something to work (in reasonable time). Regards /Tony From mickael.remond@REDACTED Wed Apr 28 10:42:28 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 28 Apr 2004 08:42:28 -0000 Subject: using erlang to sniff network In-Reply-To: <16526.37262.297124.137187@antilipe.corelatus.se> References: <1083078744.2416.109.camel@bilbo.dev.uplink> <16526.37262.297124.137187@antilipe.corelatus.se> Message-ID: On Tue, 27 Apr 2004 18:59:58 +0200, Matthias Lang wrote: > Geib, Mark writes: > > Is it possible to use erlang to open a network device for > sniffing...in > > order to analyze traffic, etc. I need to see all the traffic on a > > device, and I can run as root. This is on linux. > > > > I want to do something like tcpdump | parser > logfile in a single > > erlang program. You should have a look at the EDTK distribution. This is a tool to write Erlang driver. It provides several examples and there is a libpcap driver among them. There are even example on how to use the libpcap driver from Erlang: http://www.snookles.com/erlang/edtk/ I hpope this answer your question. -- Micka?l R?mond http://www.erlang-projects.org/ From vances@REDACTED Wed Apr 28 09:50:59 2004 From: vances@REDACTED (Vance Shipley) Date: Wed, 28 Apr 2004 03:50:59 -0400 Subject: guidance In-Reply-To: <16527.20205.150484.434803@antilipe.corelatus.se> References: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> <16526.10036.842205.762218@antilipe.corelatus.se> <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> <16527.20205.150484.434803@antilipe.corelatus.se> Message-ID: <20040428075059.GE6059@frogman.motivity.ca> If you're new to Erlang and you're using the process dictionary you're probably doing the wrong thing. I have never used the process dictionary and I've been writing Erlang for seven years. The closest I've come to using it is recently in dealing with shell sessions. The command history uses the process dictionary. With the shell you need to have some persistence. In all other cases you pass accumulated state around in function arguments. One of the first things you miss when coming from a C background and start coding in Erlang is globals. The process dictionary seems to be the answer however it's existence is a compromise. It is not the Erlang way. -Vance On Wed, Apr 28, 2004 at 08:27:57AM +0200, Matthias Lang wrote: } } At a guess, it's the access functions 'getdict' and 'getval' which are } worrying you. Accessing data through functions is a part of OO and } it's a part of other schools of thought too. } } Matthias From dustin@REDACTED Wed Apr 28 10:48:30 2004 From: dustin@REDACTED (Dustin Sallings) Date: Wed, 28 Apr 2004 01:48:30 -0700 Subject: guidance In-Reply-To: <20040428075059.GE6059@frogman.motivity.ca> References: <9E0DF794-9827-11D8-8354-000A957659CC@spy.net> <16526.10036.842205.762218@antilipe.corelatus.se> <20918D77-98CB-11D8-82B9-000A957659CC@spy.net> <16527.20205.150484.434803@antilipe.corelatus.se> <20040428075059.GE6059@frogman.motivity.ca> Message-ID: On Apr 28, 2004, at 0:50, Vance Shipley wrote: > If you're new to Erlang and you're using the process dictionary > you're probably doing the wrong thing. I have never used the > process dictionary and I've been writing Erlang for seven years. > The closest I've come to using it is recently in dealing with shell > sessions. The command history uses the process dictionary. With > the shell you need to have some persistence. In all other cases > you pass accumulated state around in function arguments. I'm not using the process dictionary (I haven't found any reason I'd want to yet). I have a getdict and getval are functions inside my module that send messages to my process and receive a response. My concern is that I'm trying to do FP but it feels like OO with all the message sending and stuff. I'm not complaining, it is just a bit surprising. > One of the first things you miss when coming from a C background > and start coding in Erlang is globals. The process dictionary > seems to be the answer however it's existence is a compromise. It > is not the Erlang way. I'm not coming from a C background...well, not exactly, anyway. When I learn a new language, I try to learn the way of the new language. The erlang way is starting to feel a little like OO and I'm trying to figure out if that's because I do too much OO or it's a secret that you don't tell people when they're learning erlang. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From joe@REDACTED Wed Apr 28 11:01:43 2004 From: joe@REDACTED (Joe Armstrong) Date: Wed, 28 Apr 2004 11:01:43 +0200 (CEST) Subject: Rebranding distributed Erlang Message-ID: Thought of the day. Distributed Erlang *is* a P2P system. Should we rebrand it as P2PE? Distributed Erlang has the following properties. - to join a distributed Erlang session you need to know the name of a distributed Erlang node that is running. - how you get the name of such a node is "out of band." - once you know the name of a running node in a distributed you join the session by talking to the node. If the cookies match you join the distribution group. - once you're in a distributed Erlang session all nodes know about all other nodes. They get node up and node down message when new nodes join and leave the group. Now that, my friends, is pretty much what any decent peer to peer system does (or should do). Been there done that (years ago :-) - and before the P2P term was even though of. -oOo- BTW - what are the upper bounds on a the number of nodes in a distributed Erlang system? - If we assume that joins and leaves are rare and that nodes are on-line for long periods is it unrealistic to have a DE system with thousands/millions of nodes? - what is the limiting factor? - what breaks as the system gets large? From mickael.remond@REDACTED Wed Apr 28 13:39:53 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 28 Apr 2004 11:39:53 -0000 Subject: Rebranding distributed Erlang In-Reply-To: References: Message-ID: On Wed, 28 Apr 2004 11:01:43 +0200 (CEST), Joe Armstrong wrote: > BTW - what are the upper bounds on a the number of nodes in a > distributed Erlang system? - If we assume that joins and leaves are > rare and that nodes are on-line for long periods is it unrealistic to > have a DE system with thousands/millions of nodes? - what is the > limiting factor? - what breaks as the system gets large? As I understand it, you are most of the time supposed to have connections between all nodes of the Erlang cluster. A node in your Erlang cluster is typically connected with all other nodes in the cluster. So, I do not not the limit here, but I assume it is quite low (regarding the usual scale of a P2P network). You can partition your Erlang cluster network and have nodes only linked to some of the Erlang cluster nodes, but they are thus not aware of the nodes they are not linked to and there is no standard way to route messages from one node to a node I am not linked to. You need to code something on top of the Erlang protocol to handle routing. The current Erlang internode protocol is not yet made for P2P applications. To handle that you need adequate routing algorithms to be able to create a huge Erlang cluster without the need to connect all nodes with all the other, as this does not scale well. I hope i did not misunderstood something in the way the Erlang internode protocol is running. But adding P2P support at the level of the Erlang internode communication could be a good idea, to make Erlang clusters more scalable and to ease the development of P2P applications. -- Micka?l R?mond http://www.erlang-projects.org/ From bengt.kleberg@REDACTED Wed Apr 28 11:40:10 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Apr 2004 11:40:10 +0200 Subject: Rebranding distributed Erlang In-Reply-To: References: Message-ID: <408F7BFA.2060707@ericsson.com> Joe Armstrong wrote: ...deleted > Now that, my friends, is pretty much what any decent peer to peer >system does (or should do). > > security? afaik it is possible to do anything to another node once i have connected to it. bengt From fredrik.linder@REDACTED Wed Apr 28 12:16:54 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 28 Apr 2004 12:16:54 +0200 Subject: guidance Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Dustin Sallings > Sent: den 28 april 2004 10:49 > > On Apr 28, 2004, at 0:50, Vance Shipley wrote: > > > If you're new to Erlang and you're using the process dictionary > > you're probably doing the wrong thing. I have never used the > > process dictionary and I've been writing Erlang for seven years. > > The closest I've come to using it is recently in dealing with shell > > sessions. The command history uses the process dictionary. With > > the shell you need to have some persistence. In all other cases > > you pass accumulated state around in function arguments. > > I'm not using the process dictionary (I haven't found > any reason I'd > want to yet). I have a getdict and getval are functions inside my > module that send messages to my process and receive a response. My > concern is that I'm trying to do FP but it feels like OO with all the > message sending and stuff. > > I'm not complaining, it is just a bit surprising. Imo it is not at all surpricing that you get this feeling, especially since processes in fact are objects in one sense. Objects that has a thread of execution within them, so sending messages between two processes could be viewed as one object using the other. A difference though is that OO in itself do not cover execution, as the erlang model does (with its processes). In many OO languages/systems one needs to handle semafors and critical sections, wheras in erlang one only needs to concern about processes. And now I want to take the opportunety to thank those who created the concurrency part of erlang: I just *love* the concurrency solution -- the best I've seen so far! /Fredrik From ulf.wiger@REDACTED Wed Apr 28 12:53:18 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 28 Apr 2004 12:53:18 +0200 Subject: guidance Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F54026CE@ESEALNT442.al.sw.ericsson.se> On April 28, 2004, at 10:49, Dustin Sallings wrote: > My concern is that I'm trying to do FP but it feels like OO > with all the message sending and stuff. > > I'm not complaining, it is just a bit surprising. As others have pointed out, it's quite normal for Erlang programs to display OO-like characteristics. The module system is another area where one can find OO tendencies (without inheritance, that is.) Example: dict:new() -> Dict dict:append(Key, Value, Dict1) -> Dict2 ... (The functional part is that the return value is the updated object. Using a process, one can - as you have seen - circumvent this.) Then there is of course the polymorphism achieved through pattern matching in function clauses, and encapsulation through the use of closures ("funs"): mnesia:activity(ActivityType, Closure) -> Result. where ActivityType := transaction | dirty | ets | ..., and Closure is an opaque function object. 'mnesia' is the class, if you will, and 'activity' is the polymorphic method. It's perfectly Ok for Erlang programs to feel like OO, as long as they also feel like Erlang. (: > The erlang way is starting to feel a little like OO and I'm trying to > figure out if that's because I do too much OO or it's a > secret that you don't tell people when they're learning erlang. I think the proper way to approach the subject is to first learn Erlang, and then discover which OO principles can be (and in fact are) used in Erlang programs. People who approach Erlang with an "everything is an object" mindset have a tendency to waste lots of time trying to "fix" Erlang by adding inheritance. /Uffe From luke@REDACTED Wed Apr 28 13:55:09 2004 From: luke@REDACTED (Luke Gorrie) Date: Wed, 28 Apr 2004 13:55:09 +0200 Subject: using erlang to sniff network In-Reply-To: <1083078744.2416.109.camel@bilbo.dev.uplink> (Mark Geib's message of "Tue, 27 Apr 2004 09:12:25 -0600") References: <1083078744.2416.109.camel@bilbo.dev.uplink> Message-ID: "Geib, Mark" writes: > Is it possible to use erlang to open a network device for sniffing...in > order to analyze traffic, etc. I need to see all the traffic on a > device, and I can run as root. This is on linux. Oops, I forgot I have a program to do this. I just checked it into the Jungerl (sourceforge project 'jungerl') as the 'psocket' application. It opens an external port program that uses a PACKET(7) socket to read/write ethernet on some existing network interface (which is also how pcap/tcpdump works). You use it like this: $ sudo ~luke/hacking/jungerl/bin/jerl Erlang (BEAM) emulator version 5.3 [source] [hipe] Eshell V5.3 (abort with ^G) 1> psocket:open("eth0"). {ok,#Port<0.29>, <<0,8,116,228,110,188>>} 2> flush(). Shell got {#Port<0.29>, {data,<<255,255,255,255,255,255,0,48,72,66,201,78,8,6,0,1,8,0,6,4,0,1 ,0,48,72,66,201,78,192,168,128,3,0,0,0,0,0,0,192,168,128,245,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0>>}} ok I originally wrote it for a very specific purpose so it's not very featureful. Let me know if you have any questions. You might also like to look at the tuntap application in Jungerl, which is kinda similar. If you want code for actually pulling apart TCP/IP packets with the bit syntax then I think Tony Rogvall might be able to help you. -Luke From rpettit@REDACTED Wed Apr 28 15:02:15 2004 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 28 Apr 2004 08:02:15 -0500 Subject: Rebranding distributed Erlang In-Reply-To: <408F7BFA.2060707@ericsson.com> References: <408F7BFA.2060707@ericsson.com> Message-ID: <20040428130215.GI15627@vailsys.com> On Wed, Apr 28, 2004 at 11:40:10AM +0200, Bengt Kleberg wrote: > Joe Armstrong wrote: > ...deleted > > > Now that, my friends, is pretty much what any decent peer to peer > >system does (or should do). > > > > > security? afaik it is possible to do anything to another node once i > have connected to it. Out of the box, perhaps. It should be possible to modify the user-defined net_kernel process to employ other authentication mechanisms besides the clear-text-cookie. Of course doing something fancier with millions of nodes in the picture could get interesting. -Rick From mickael.remond@REDACTED Wed Apr 28 17:50:56 2004 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 28 Apr 2004 15:50:56 -0000 Subject: Rebranding distributed Erlang In-Reply-To: <20040428130215.GI15627@vailsys.com> References: <408F7BFA.2060707@ericsson.com> <20040428130215.GI15627@vailsys.com> Message-ID: On Wed, 28 Apr 2004 08:02:15 -0500, Rick Pettit wrote: > On Wed, Apr 28, 2004 at 11:40:10AM +0200, Bengt Kleberg wrote: >> Joe Armstrong wrote: >> ...deleted >> >> > Now that, my friends, is pretty much what any decent peer to peer >> >system does (or should do). >> > >> > >> security? afaik it is possible to do anything to another node once i >> have connected to it. > > Out of the box, perhaps. It should be possible to modify the user-defined > net_kernel process to employ other authentication mechanisms besides the > clear-text-cookie. Clear-text-cookie is not the only things to change to add peer2peer security. Bengt was refering to the fact that once you grant access to a node you grant this access with no restriction. This means that on node can execute os:cmd("rm -rf /"). on a target node. There have been several discussions on security already. The most advanced work on this side was the SSErl prototype: http://www.unsw.adfa.edu.au/~lpb/papers/tr9704.html -- Micka?l R?mond http://www.erlang-projects.org/ From frankv@REDACTED Wed Apr 28 16:49:18 2004 From: frankv@REDACTED (Frank D. Valencia) Date: Wed, 28 Apr 2004 16:49:18 +0200 Subject: CoLoPS04: Call for Papers Message-ID: <20040428144918.GA19429@ir> [[ -- Apologies for multiple copies of this message -- ]] =================================================================== CoLoPS 2004 International Workshop on COnstraint & LOgic Programming in Security December 5-11th, 2004 - Saint-Malo, France Satellite Workshop to ICLP 2004 ==================================================================== Scope of the workshop: Due to its practical relevance and complexity, the study of security has become a serious challenge involving several disciplines of computer science. A noteworthy aspect is that in several instances this study has used directly or indirectly tools and techniques from (Concurrent) Constraint Programming and (Linear) Logic Programming. For example, constraint solving has successfully been used for verifying security protocols, and several process algebras for modelling cryptographic protocols (e.g., recent variants of the spi calculus, SPL) have remarkable similarities with Concurrent Constraint Programming. Also (Linear) Logic Programming has been used as a framework for security protocols, and one of its central notions, unification, has been used for the symbolic execution of cryptographic calculi. CoLoPS aims at getting a broader perspective on the role of Constraint and Logic Programming in the study of security. Topics of interest include (but are not restricted to) frameworks for security using algorithms, verification techniques, process algebras or programming languages, with a Constraint or Logic Programming flavor. Submission and publication: Paper submissions should not exceed 15 pages. Submissions should be sent as a PDF or Postscript le via email to Frank D. Valencia (frankv@REDACTED). The email should have: 1. "COLOPS Submission" as subject, 2. submission title and authors' relevant information as body, and 3. submission le as an attachment. The accepted papers will be included in the workshop proceedings as a research report of Uppsala University. Accepted papers will be published in an ENTCS (Electronic Notes in Theoretical Computer Science) volume dedicated to ICLP 2004 workshops. Papers describing ongoing work or already published are also welcome but will not be part of the proceedings. Please mark your paper accordingly. Program Committee: Elvira Albert (UC Madrid, Spain) Maria Alpulente (UP Valencia, Spain) Stefano Bistarelli (ITT-CNR, Italy) Martin Leucker (TU Munich, Germany) Sebastian Moedersheim (ETH Zurich, Switzerland) Ugo Montanari (Universita di Pisa, Italy) Catuscia Palamidessi (INRIA, France) Justin Pearson (Uppsala University, Sweden) Fred Spiessens (Universit e catholique de Louvain, Belgium) Frank D. Valencia (Uppsala University, Sweden) Pascal Van Hentenryck (Brown University, USA) Vijay Saraswat (IBM, USA) Bjorn Victor (Uppsala University, Sweden) Alicia Villanueva (UP Valencia, Spain) Organizing Committee: Martin Leucker (TU Munich, Germany), Justin Pearson (Uppsala University, Sweden), Fred Spiessens (Universit e catholique de Louvain, Belgium), Frank D. Valencia (Uppsala University, Sweden) Important dates: Submission deadline: June 27, 2004 Notification of acceptance: July 18, 2004 Final version: August 15, 2004 Workshop: September 5th or 11th, 2004 (Dependent on ICLP organizers) For more and up-to-date information see the www page http://www.info.ucl.ac.be/people/fsp/colops2004/ From kris_prieb@REDACTED Wed Apr 28 20:04:25 2004 From: kris_prieb@REDACTED (Kris Prieb) Date: Wed, 28 Apr 2004 13:04:25 -0500 Subject: basic questions regarding message sequence guarantees... Message-ID: <0HWW00JT17L5YV@gsbims.uchicago.edu> Thanks Uffe! That really clarifies things. Kris ---------------------------------------------------------------------- On Fri, 23 Apr 2004 21:09:58 -0500, Kris Prieb wrote: > 1.) Suppose I have a process 'A' and process 'B'. 'A' sends a sequence > of messages to 'B'. > > My understanding is that Erlang guarantees that B will receive the > messages from A in the order in which they were sent. > Is this correct? Yes. > 2.) Now suppose 'B' is monitoring 'A'. Suppose also that another process > 'C' is monitoring 'A' and that a 'Down' message from 'A' to 'C' will > trigger 'C' to send a message to 'B.' > > My understanding is that Erlang does _not_ guarantee that A's 'Down' > message to B will arrive before C's message to B. Is this correct? Correct. > 3.) Same as 2, except that B and C are on one node, and A is on another. > Does this change anything? It doesn't change the fact that Erlang gives no guarantee regarding the relative order of messages if they travel different routes. In this particular case, I think internal scheduling aspects would determine the order in which messages arrive to B, so it's going to be as uncertain as in (2). Now, if 'A' and 'B' where on the same node, and 'C' were on a different node, one could venture to guess that B would always receive A's message first. However, there is still no guarantee, and I wouldn't base my application logic on it. If you'd change the distribution pattern for other reasons later, your code might break in mysterious ways. /Uffe -- Ulf Wiger -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Wed Apr 28 20:35:45 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 28 Apr 2004 11:35:45 -0700 (PDT) Subject: guidance In-Reply-To: Message-ID: <20040428183545.95690.qmail@web41906.mail.yahoo.com> --- Fredrik Linder wrote: > Imo it is not at all surpricing that you get this > feeling, especially since processes in fact are > objects in one sense. Objects that has a thread of > execution within them, so sending messages between > two processes could be viewed as one object using > the other. Note furthermore that erlang processes are more general than ordinary objects: the response to a message can change by using gen_fsm or multiple receives inside a single process. In a class, you have one set of method implementations per method name. In a process, the response depends on which receive you (or which state) you are in. The closest correspondence to this in OO, that I know of, is "predicate classes". Best, Thomas __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover From anders@REDACTED Thu Apr 29 01:48:33 2004 From: anders@REDACTED (Anders Ramsell) Date: Thu, 29 Apr 2004 01:48:33 +0200 Subject: basic questions regarding message sequence guarantees... In-Reply-To: <0HWN00DM3KQEV5@gsbims.uchicago.edu> References: <0HWN00DM3KQEV5@gsbims.uchicago.edu> Message-ID: <409042D1.8050103@theheartofgold.org> Kris Prieb wrote: > 2.) Now suppose ?B? is monitoring ?A?. Suppose also that another > process ?C? is monitoring ?A? and that a ?Down? message from ?A? to ?C? > will trigger ?C? to send a message to ?B.? > > My understanding is that Erlang does _/not/_ guarantee that A?s ?Down? > message to B will arrive before C?s message to B. Is this correct? > I have been thinking of asking about a variation of this question myself. In my scenario a process A first sends a message 'first' to a process B. After that it sends another message 'second' to an intermediary process C. When the process C receives the 'second' message and only then it will send a message 'second' to process B. In this scenario we know that two messages are sent from process A. Not just one of them. We also know in what order those messages are sent and that each message sent from process A will result in exactly one message being recieved by process B. Is it really possible in this scenario for the message 'second' to be recieved by the process B before it receives the message 'first'? A C B | | | | | |----> | (received second) | | | | | first | | | | ------------------------------------> | (received first) | second | | | | ----------------> | (received | | | | second) | | | | -----------| | | | | It seems funny that a detour can end up being a shortcut. In some cases it could be useful to know (if that is in fact the case) that the order of the messages 'first' and 'second' in the above scenario will be preserved. Of course if in fact such a guarantee can be made it seems to me that it would be broken by (almost?) any change to the scenario. I.e. not knowing or changing the order of the sends from process A, process C sending a 'second' message to process B without receiving one from process A, etc. But now I'm rambling... -- Anders Ramsell From bengt.kleberg@REDACTED Thu Apr 29 10:06:56 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 29 Apr 2004 10:06:56 +0200 Subject: basic questions regarding message sequence guarantees... In-Reply-To: <409042D1.8050103@theheartofgold.org> References: <0HWN00DM3KQEV5@gsbims.uchicago.edu> <409042D1.8050103@theheartofgold.org> Message-ID: <4090B7A0.50905@ericsson.com> Anders Ramsell wrote: ...deleted > I have been thinking of asking about a variation of this question > myself. In my scenario a process A first sends a message 'first' to a > process B. After that it sends another message 'second' to an > intermediary process C. When the process C receives the 'second' > message and only then it will send a message 'second' to process B. > if A, B and C are on different nodes one can assume very different transmission delays in such a manner that c-second will indeed arrive before a-second. if they are on the same node i can imagine that the message passing is preemtible in such a way that a-second will not be delivered untila after c-second. not that such a message passing system would be a good idea, but it is possible. bengt From matthias@REDACTED Thu Apr 29 10:09:35 2004 From: matthias@REDACTED (Matthias Lang) Date: Thu, 29 Apr 2004 10:09:35 +0200 Subject: guidance In-Reply-To: <20040428183545.95690.qmail@web41906.mail.yahoo.com> References: <20040428183545.95690.qmail@web41906.mail.yahoo.com> Message-ID: <16528.47167.753540.889908@antilipe.corelatus.se> Thomas Lindgren writes: > Note furthermore that erlang processes are more > general than ordinary objects: the response to a > message can change by using gen_fsm or multiple > receives inside a single process. In a class, you have > one set of method implementations per method name. In > a process, the response depends on which receive you > (or which state) you are in. Am I completely misunderstanding something? Surely you're not arguing that OO doesn't allow side effects?! If I rewrite your last sentence. "In a class, the response [can] depend[s] on which state you are in", that doesn't seem unnatural in many popular OO languages. Matthias From mbj@REDACTED Thu Apr 29 13:32:44 2004 From: mbj@REDACTED (Martin Bjorklund) Date: Thu, 29 Apr 2004 13:32:44 +0200 (CEST) Subject: compiler bug Message-ID: <20040429.133244.129321451.mbj@bluetail.com> Hi, Found this on R9B and R9C. Maybe known already... Consider this module: -module(x). -compile(export_all). -record(state, {ena = true}). y() -> spawn_link(?MODULE, loop, [#state{}]). loop(S) -> receive _ when S#state.ena == false -> io:format("here 1\n"), loop(S); test -> io:format("here 2\n"), loop(S); X -> io:format("here 3 ~p\n", [X]), loop(S) end. Sending 'test' to this process should print "here 2". But: 9> P=x:y(). <0.53.0> 10> P ! test. here 3 true test NOTE that the X argument has been bound to the value of 'ena' in the record! If you look at the x.S file, you'll see the problem... /martin From thomasl_erlang@REDACTED Thu Apr 29 14:35:40 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 29 Apr 2004 05:35:40 -0700 (PDT) Subject: guidance In-Reply-To: <16528.47167.753540.889908@antilipe.corelatus.se> Message-ID: <20040429123540.48639.qmail@web41902.mail.yahoo.com> --- Matthias Lang wrote: > Am I completely misunderstanding something? Surely > you're > not arguing that OO doesn't allow side effects?! > > If I rewrite your last sentence. "In a class, the > response [can] > depend[s] on which state you are in", that doesn't > seem unnatural > in many popular OO languages. That's right, both processes and objects are stateful. The difference is I am thinking of is what code is executed when a method is invoked (or a message is sent). Note also that this is a question of convenience rather than expressive power. (Both are Turing complete, right?) Let me take a silly example to illustrate: consider an object with two states (as in a state machine), open and closed. The methods/messages vary in implementation with the state and there are perhaps many methods. We implement this object as a process. In naive Erlang, using a single receive (corresponding to a single set of methods in a class): process(St) -> receive {From, is_open} -> case is_open(St) of true -> From ! true; false -> From ! false end, process(St); {From, flip_state} -> case get_state(St) of open -> process(set_state(closed, St)); closed -> process(set_state(open, St)); end; ... lots more methods ... end. That is, you need to look in your explicit state and modify it as you get messages/method calls. The state is encoded in the instance variables. If you have a lot of state variables, you may need to update a lot of them when the state changes. Adding new states can become tedious and error-prone, etc. In naive Erlang with one state per receive: open(St) -> receive {From, is_open} -> From ! true, open(St); {From, flip_state} -> closed(St); ... etc ... end. closed(St) -> receive {From, is_open} -> From ! false, closed(St); {From, flip_state} -> open(St); ... lots of other methods ... end. Adding a new state now means (a) a new state function, and (b) transitions to/from the new state. In Erlang/OTP, the difference between gen_server and gen_fsm, if you will. A similar construct for OO, "predicate classes", was proposed by Craig Chambers in 1993. (That paper was what made me think along these lines.) Anyway, I hope I have illustrated how standard OO method calls (without inheritance) differs from message passing to Erlang processes. Best, Thomas __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover From sean.hinde@REDACTED Thu Apr 29 21:04:10 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Thu, 29 Apr 2004 20:04:10 +0100 Subject: spawn without linking? In-Reply-To: References: Message-ID: >> > > Ah, but Joe, you changed the semantics. Sean had a timeout argument, > which you don't. ;-) > > BTW, Sean, you should rethink the implementation of the timeout. > I think it's better to start a timer and handle a timeout message. > In your present implementation, the "timer" will restart anytime > one of the servers responds, making it fuzzy what the timeout > really means. > OK, again ! I kept the foldl to emphasise that we visit each sent call exactly once while gathering results, so it has grown somewhat with the addition of a second state. %% @doc Call one or more gen_servers multiple times with different %% queries concurrently. This is equivalent to calling %% gen_server:call(Name, Request, Timeout) multiple times except that %% they are handled concurrently. %%

%% It is assumed that the calling process can tolerate late result %% messsages arriving after this routine has finished. %% %% @spec multi_call(Requests, Timeout::integer()) -> %% {[{Name, Result}], [Failure]} %% Requests = [{Name, Request}] %% Name = pid() | atom() %% Request = term() %% Result = term() %% Failure = pid() | atom() multi_call(Requests, Timeout) when is_list(Requests), is_integer(Timeout) -> Mrefs = lists:map(fun({Name, Req}) -> Mref = erlang:monitor(process, Name), Name ! {'$gen_call', {self(), Mref}, Req}, {Name, Mref} end, Requests), Timer = erlang:start_timer(Timeout, self(), timeout), Res = lists:foldl( fun({Name, Mref}, {within_time, Succ, Fail}) -> receive {Mref, Reply} -> demonitor(Mref), {within_time, [{Name, Reply}|Succ], Fail}; {'DOWN', Mref, _, _, _} -> {within_time, Succ, [Name|Fail]}; {timeout, Timer, timeout} -> demonitor(Mref), {outside_time, Succ, [Name|Fail]} end; ({Name, Mref}, {outside_time, Succ, Fail}) -> receive {Mref, Reply} -> demonitor(Mref), {outside_time, [{Name, Reply}|Succ], Fail}; {'DOWN', Mref, _, _, _} -> {outside_time, Succ, [Name|Fail]} after 0 -> demonitor(Mref), {outside_time, Succ, [Name|Fail]} end end, {within_time, [],[]}, Mrefs), case Res of {within_time, Succ, Fail} -> erlang:cancel_timer(Timer), receive {timeout, Timer, timeout} -> {Succ, Fail} after 0 -> {Succ, Fail} end; {outside_time, Succ, Fail} -> {Succ, Fail} end. demonitor(Mref) -> erlang:demonitor(Mref), receive {'DOWN', Mref, _, _, _} -> ok after 0 -> ok end. From mlogan@REDACTED Fri Apr 30 00:24:13 2004 From: mlogan@REDACTED (Martin J. Logan) Date: 29 Apr 2004 17:24:13 -0500 Subject: Non deterministic command line Message-ID: <1083277452.2117.8.camel@dhcp-lom-194-186.futuresource.com> Hello all, I have run into something a little strange with regard to erlang command line env vars. I noticed that passing command line environment variables to a node results in a non-deterministic sort and store for the env vars. Example: -galaxy_parser is_failover_enabled true" . . . -galaxy_parser galaxy_feed_port ", TickerPort, -galaxy_parser galaxy_feed_IP localhost", -galaxy_parser galaxy_timeout infinity ", -galaxy_parser is_failover_enabled false" results in is_failover_enabled being false while . . . -galaxy_parser is_failover_enabled true" -galaxy_parser is_failover_enabled false" -galaxy_parser galaxy_feed_port ", TickerPort, -galaxy_parser galaxy_feed_IP localhost", -galaxy_parser galaxy_timeout infinity ", results in is_failover_enabled being true. Why is this. A deterministic order would make a few things nice and easy for me right now because I need to count on what overrides what. Cheers, Martin From dustin@REDACTED Fri Apr 30 05:31:38 2004 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 29 Apr 2004 20:31:38 -0700 Subject: shutdown procedure for OTP/supervisor process Message-ID: What's the right way for having a supervisor managed process register for a shutdown procedure? An easy way I can think of is via a linked process that has trap_exit set and a receive that waits for the event. Just seems like there might be a more formal way. Specifically, I've got a crash in something that has a multicast socket bound and I want to leave the close the port and leave the group. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From chandrashekhar.mullaparthi@REDACTED Fri Apr 30 17:18:48 2004 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 30 Apr 2004 16:18:48 +0100 Subject: Rebranding distributed Erlang In-Reply-To: <408F7BFA.2060707@ericsson.com> References: <408F7BFA.2060707@ericsson.com> Message-ID: The RPC server should support some kind of ACL (access control list). We're rolling our own RPC client and server where it is possible to specify which clients can execute what functions in what modules. Chandru On 28 Apr 2004, at 10:40, Bengt Kleberg wrote: > Joe Armstrong wrote: > ...deleted > >> Now that, my friends, is pretty much what any decent peer to peer >> system does (or should do). >> > security? afaik it is possible to do anything to another node once i > have connected to it. > > > bengt From bjarne@REDACTED Fri Apr 30 21:13:53 2004 From: bjarne@REDACTED (=?Windows-1252?Q?Bjarne_D=E4cker?=) Date: Fri, 30 Apr 2004 21:13:53 +0200 Subject: Welcome to EUC'2004 !! Message-ID: <000201c42ee8$5fa73320$7a0869d4@segeltorp> Dear Erlang friends, This year's Erlang/OTP User Conference, EUC'2004, will take place in Stockholm on October 21. Please see the invitation and call for papers: http://www.erlang.se/euc/04/ This will be a special occasion since it is now 10 years since the first EUC in 1994. Presentations both on technology and on applications are welcome. Also demos to be shown during coffees between sessions. Make a note in your diaries already now ! See you in October Bjarne -------------- next part -------------- An HTML attachment was scrubbed... URL: