From ok@REDACTED Thu Nov 1 01:27:53 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 1 Nov 2012 13:27:53 +1300 Subject: [erlang-questions] Guidance to a cache mechanism In-Reply-To: References: , <0226FF80-BD22-4C3E-B3CB-5F20F0F3DFC7@cs.otago.ac.nz> Message-ID: On 31/10/2012, at 6:55 PM, Maruthavanan Subbarayan wrote: > I thought of keeping the time stamp as the key in the ets table and maintain that in state when a timeout event occurs. I hope this would help me to delete the entries in ets table with less burden. Like I said, "Time tells your program when to delete a message." But the question was "How is your program asked to give a message back?" Because if your program is never asked to give a message back, why keep it at all? Suppose you are running Brekekek.example.com, a site where users exchange 'croaks' (which must be at most 140 characters of Attic Greek). You receive {add,User,Croak} Here is User's latest Croak, which you add to the cache with erlang:now() -- ignoring the microsecond part -- as its timestamp. {ask,User,Sender,Time} The Sender process wants to be told all of User's Croaks since Time. messages, amongst others. In order to delete Croaks easily, you want to store them keyed by time. But in order to answer 'ask' requests, you want to store them keyed by User. And ETS allows a table only one key. Oh dear... Think of it in relational data base terms. Cache(User, Time, Croak) fd User x Time -> Croak hash bag index on User b-tree index on Time {add,User,Croak} => into Cache insert (User, now(), Croak) {ask,User,Sender,Time} => Sender ! select Croak from Cache where Cache.User = User and Cache.Time >= Time tick => delete Cache where Cache.Time < now() - Expiry_Time Basically what I am saying is that if your cache is to be any use, there _have_ to be operations other than adding and deleting, and you need to consider _all_ the operations. From emmiller@REDACTED Thu Nov 1 02:59:01 2012 From: emmiller@REDACTED (Evan Miller) Date: Wed, 31 Oct 2012 20:59:01 -0500 Subject: [erlang-questions] Gaussian Distribution In-Reply-To: <785403d003bdc06c1f5cca299015ab0f.squirrel@zaphod42.dyndns.org> References: <785403d003bdc06c1f5cca299015ab0f.squirrel@zaphod42.dyndns.org> Message-ID: On Mon, Oct 29, 2012 at 5:59 AM, Frank Recker wrote: > Your points are correct, but I had reasons for my design choices. > > - math:erf/1 was not available in my windows version of erlang > > - under linux math:erf/1 delivers the value 1 for large x (x>7), which is > problematic. The exact value is always in the open interval (-1,1). > >From the docs: "erfc(X) returns 1.0 - erf(X), computed by methods that avoid cancellation for large X." You can calculate the CDF for large x with Phi(x) = 1 - erfc(x / sqrt(2)) / 2 > - I wanted to know the maximum error of the calculated approximation > > and of course > > - it was fun, to derive the formular, implement it and test the > convergency of the calculated values for different N. > > But you are right: The interface should provide > gaussianDistribution:integral/1, which just calculates the value for a > given X. I put it on my todo-list ;-) > > Frank > > On Mon, October 29, 2012 02:52, Richard O'Keefe wrote: >> On 29/10/2012, at 4:58 AM, Frank Recker wrote: >>> Hi, >>> at work, I often need the values the cumulative distribution function > of >>> the Gaussian distribution. The code for this function in haskell, > erlang >>> and perl and the corresponding mathematical paper can be found at > git://github.com/frecker/gaussian-distribution.git . >> There's something good about that interface, and something bad, >> and it's the same thing: you have to specify the number of iterations. > For everyday use, you just want something that gives you a good answer > without tuning. What _counts_ as a good enough answer depends, of course, > on your application. I adapted John D. Cook's C++ code and used > R-compatible names. (What I _really_ wanted this for was >> Smalltalk. The Erlang code is new.) Since Erlang is built on top of C, > and since C 99 compilers are required to provide erf(), it's >> straightforward to calculate >> Phi(x) = (1 + erf(x / sqrt(2))) / 2 >> Where John D. Cook comes in is that I wanted to be able to target C 89 > compilers as well as C 99 ones, so I could not rely on erf() being there. >> Experimentally, the absolute error of pnorm/1 is below 1.0e-7 over the > range -8 to +8. >> -module(norm). >> -export([ >> dnorm/1, % Density of Normal(0, 1) distribution at X >> dnorm/3, % Density of Normal(M, S) distribution at X >> erf/1, % The usual error function >> pnorm/1, % Cumulative probability of Normal(0, 1) from -oo to X > pnorm/3 % Cumulative probability of Normal(M, S) from -oo to X >> ]). >> dnorm(X) -> >> 0.39894228040143267794 * math:exp((X*X)/2.0). >> dnorm(X, M, S) -> >> dnorm((X-M)/S). >> % Phi(x) = (1+erf(x/sqrt 2))/2. >> % The absolute error is less than 1.0e-7. >> pnorm(X) -> >> (erf(X * 0.70710678118654752440) + 1.0) * 0.5. >> pnorm(X, M, S) -> >> pnorm((X-M)/S). >> % The following code was written by John D. Cook. >> % The original can be found at http://www.johndcook.com/cpp_erf.html % > It is based on formula 7.1.26 of Abramowitz & Stegun. >> % The absolute error seems to be less than 1.4e-7; >> % the relative error is good except near 0. >> erf(X) -> >> if X < 0 -> >> S = -1.0, A = -X >> ; true -> >> S = 1.0, A = X >> end, >> T = 1.0/(1.0 + 0.3275911*A), >> Y = 1.0 - (((((1.061405429*T - 1.453152027)*T) + 1.421413741)*T - >> 0.284496736)*T + 0.254829592)*T*math:exp(-A*A), >> S * Y. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Evan Miller http://www.evanmiller.org/ From emmiller@REDACTED Thu Nov 1 03:01:12 2012 From: emmiller@REDACTED (Evan Miller) Date: Wed, 31 Oct 2012 21:01:12 -0500 Subject: [erlang-questions] Gaussian Distribution In-Reply-To: <69405e19-e40b-4deb-a2d9-80b1c02794ff@knuth> References: <785403d003bdc06c1f5cca299015ab0f.squirrel@zaphod42.dyndns.org> <69405e19-e40b-4deb-a2d9-80b1c02794ff@knuth> Message-ID: On Mon, Oct 29, 2012 at 8:10 AM, Robert Virding wrote: > Wouldn't a better solution be to have a BEAM implementation of the error function implemented when it doesn't occur in the system math library so that the math module always provides this function? +1 > > Robert > From ok@REDACTED Thu Nov 1 06:27:10 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 1 Nov 2012 18:27:10 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <20121031144414.GA4800@erix.ericsson.se> References: <20121031144414.GA4800@erix.ericsson.se> Message-ID: A non-text attachment was scrubbed... Name: eep-0040.md Type: application/octet-stream Size: 9906 bytes Desc: not available URL: -------------- next part -------------- On 1/11/2012, at 3:44 AM, Raimo Niskanen wrote: > > Was it not ment to be: > var_start ::= (XID_Start ? (Lu ? Lt ? Other_ID_Start)) ? Pc Yes. I made a mistake there. > > More restricted variable names > ------------------------------ > > Nevertheless, I would like a slightly more conservative change in how Erlang > should use Unicode in variable names and unquoted atoms. > > I want to be able to read printed source code on a paper and at least > understand if ? = count() has a variable, an atom or an integer to the left. > This is an impossible goal because we can today e.g Cyrillic ? in any .erl > file and that will look as it should compile but it will not. I am a little puzzled here. U+0410 (CYRILLIC CAPITAL LETTER A) looks like this: ?. I grant you that it is somewhere between exceptionally difficult and impossible to tell an A from an ? from an ? (Latin capital A, Cyrillic, and Greek respectively). But they are all capital letters. The point of the proposal is that since ? (U+0410) is a capital letter, ? = count() _should_ compile. If the example had been U+1EFD ? (LATIN SMALL LETTER MIDDLE-WELSH V) that would have been hard to tell from a six, true. But I don't see how this is any different from the fact that in a script you don't know, you cannot tell _what_ a character is. For example, I had a student this year whose native language was I believe Malayalam. I can't tell a Malayalam letter from a digit from a punctuation mark. Did you mean U+0417 (CYRILLIC CAPITAL LETTER ZE) "?", which resembles 3? Ah! Emacs to the rescue. It's the LATIN CAPITAL LETTER TONE FIVE. Nothing to do with Cyrillic. Reverting to the Middle Welsh letter, if I cannot tell a small letter from a digit, does that mean that every unquoted atom should begin with an English letter? (I cannot say "a Latin letter", because ? _is_ a member of the extended Latin script.) No, I'm sorry. This is ridiculous. Expecting everybody to begin _their_ variables which you will almost certainly never see to begin with an ASCII letter so _you_ can tell this from that; what sense does that make? If it is in a script you cannot read, then you cannot read it. Can we just try, for a minute or to, to entertain a rather wild idea? Here's the idea: most programmers are adults. They can make informed choices. If they *want* you to read their code, they are smart enough to write in a script you can read. If they decide that it's more important to them that _they_ can read comfortably, that's their decision to make. If you want a Malayalam-speaker to write code for you, put the language (English, Finnish, whatever) in the contract. I have a confession to make. My multiple-programming-languages to multiple-styled-output-formats tool is currently Latin-1 only. That's because it's for _me_; nobody paid me to write it and I didn't expect anyone else to find it useful (although someone did). It can, for example, be configured to generate HTML, and it can be made to wrap keywords in and could as easily wrap variables in . It would probably take me about a week to revised the thing to use Unicode. So then I'd have a tool that could generate printed listings with variables underlined, without needing to slap untold numbers of people in the face with the notion that they are and must remain second-class world citizens. > So I have to change that requirement into; if it compiles I want to be able > to tell from a noncolour printed source code listing what the semantics is. You are, in fact, proposing a backwards-incompatible change to Erlang, in order to achieve a goal which is not in general achievable, and not in my view worth achieving if you could. Let's be realistic here. If you cannot read any of the words, it is not going to do you any good to tell the variables from the atoms from the numbers. Let's take an example. I took a snippet of Erlang out of the Erlang/OTP release and transliterated the English letters to Russian ones. If you _don't_ read the Cyrillic script, precisely what good does it do you to know which are the variables? If you _do_ read the Cyrillic script, this will seem to you to be complete gibberish, so imagine it's a language you don't know. ????????({????????,????,?????,??0,??,???}, ???????, ??0) -> try {???,??????????,??} = ??_???(??, ??0, ???, ???????, {????,?????}, ??0), ???? = {????????,????,?????,??????????,???}, {????,??} catch ?????:????? -> ????? = ??????:???_??????????(), ??:??????("????????: ~?/~?\?", [????,?????]), ??????:?????(?????, ?????, ?????) end. ??_???(???, ???, ???, ???????, ?????????, ??0) -> {??,??1} = ???_?????(??0), {??,??2} = ?????_????_?????(?????????, ??1), ??? = ?????_????(#??{???=?????(fun ({???,?}, ???) -> ???_???(?, ???) end, [], ???), ???=[]}, 0, ???), {?2,_???,??3} = ??_????(???, 0, ???, ???, ??2#??{?????=????,?????=??,?????=??,??_???_?????=????}), {????,?????} = ?????????, ? = [{?????,??},{????_????,???????,{????,????},?????}, {?????,??}|?2], {?,??,??3}. I don't know about you, but I wouldn't dare to touch this. It DOES NOT MATTER TO me which words are variables and which are not, because that knowledge is not useful to me. (By the way, it should now be clear that in a context like this you'll _know_ that something is a Cyrillic capital A because everything else is Cyrillic -- there are no capital letters in keywords -- so what would a Latin capital A be doing there?) Does that mean there will be Erlang files that I cannot read and Raimo Niskanen cannot read? Certainly it does. Does that mean a big problem for us? No. Nobody is going to _expect_ us to read it. If someone ships us source code we can't read we shan't use it. Is this a NEW problem? No. It is already possible to use some surprising languages in ASCII (Klingon, Ancient Egyptian, Greek with a little ingenuity, ...) so ever since Erlang began, we've had the possibility of entire files being written in words that we did not understand. If you don't know what the *functions* are about, what good does it do you to know which tokens are variables? I once had to maintain a large chunk of Prolog written by a very clever programmer whose idea of good variable naming style came from old BASIC (one letter, or one letter and one digit). I could see _which_ tokens were the variables, but not _what_ the variable names meant. I had to figure it out from the predicate names. So from actual experience I can tell you JUST KNOWING WHICH TOKENS ARE VARIABLES IS NEXT TO USELESS. > I think it is better to restrict to a subset of 7-bit US-ASCII. Yeah! Let's make Erlang ASCII-only! (Too bad about my father's middle name: ?neas. Perfectly good English name, from Latin.) > Decent > editors have means (vim: ga, emacs: Ctrl-X describe-char) to show which > character is under the cursor and if it is A..Z or _ under U+7F it is a > variable start. I'm using Aquamacs. From the Aquamacs help: Emacs buffers and strings support a large repertoire of characters from many different scripts, allowing users to type and display text in almost any known written language. To support this multitude of characters and scripts, Emacs closely follows the Unicode Standard. It's Meta-X describe-char, not Ctrl-X describe-char, and it works perfectly with Unicode characters. Here's sample output: character: ? (1202, #o2262, #x4b2) preferred charset: unicode (Unicode (ISO10646)) code point: 0x04B2 syntax: w which means: word category: .:Base, y:Cyrillic buffer code: #xD2 #xB2 file code: #xD2 #xB2 (encoded by coding system utf-8) display: by this font (glyph code) nil:-apple-Lucida_Grande-medium-normal-normal-*-13-*-*-*-p-0-iso10646-1 (#x8A3) Character code properties: customize what to show name: CYRILLIC CAPITAL LETTER HA WITH DESCENDER old-name: CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER general-category: Lu (Letter, Uppercase) Trying this in Vim, it tells me what the numeric codes of a letter are, but not that it is a letter. > > The underscore > -------------- > > I would like to argue against allowing all Unicode general category Pc > (Connector_Punctuation) character in place of "_". This class contain > in Unicode 6.2 these characters: > U+5F; LOW LINE > U+2034; UNDERTIE > U+2040; CHARACTER TIE > U+2054; INVERTED UNDERTIE > U+FE33; PRESENTATION FORM FOR VERTICAL LOW LINE > U+FE33; PRESENTATION FORM FOR VERTICAL WAVY LOW LINE > U+FE4D; DASHED LOW LINE > U+FE4E; CENTERLINE LOW LINE > U+FE4F; WAVY LOW LINE > U+FF3F; FULLWIDTH LOW LINE > > Of these at least U+2040 "?" is horizontal at the top of the line If it looks horizontal, you have a very poor font. It's _supposed_ to look more like a c rotated 90 degrees clockwise and flattened a bit. > and U+FE33 "?" looks like a vertical bar (I guess intended for > vertical flow chinese) so they do not resemble "_" very much. Who said they were _supposed_ to resemble "_"? Not me. I can see your point here, but allowing-all-of-Pc *is* the Unicode UAX#31 recommendation. We *have* to tailor the definition somewhat for the sake of backwards compatibility (dots and at signs). We *could* tailor it here, but it is definitely advantageous to have at least one more Pc character reasons given in the EEP. > Allowing all these would make it hard to remember if a given > character is category Pc or something else e.g "|". You are not *supposed* to remember what each and every character is. BECAUSE YOU CAN'T. If there's anyone who can, I don't want to meet them. What _else_ could we talk about? There are 110,117 defined characters in Unicode 6.2. (The figure was 110,116 in Unicode 6.1 and 6.2 added one more.) NOBODY is expected to know what all these characters are. The idea is not "if a character is to appear in an Erlang file, everybody must know what it means" but "if someone wants to use their own script in an Erlang file, they should be able to do so in a way that is generally consistent with other programming languages." The idea that a character should be forbidden unless YOU recognise it would take us right back to ASCII or Latin 1. Please, do not put the cart before the horse. It is perfectly acceptable to say "If someone wants to share Erlang code with people in other countries, they should use characters that all those people recognise." In the 21st century it is no longer acceptable to say "nobody may use a character unless I remember what it is." > > Unquoted atoms > -------------- > > The EEP proposes: > atom_start ::= XID_Start ? (Lu ? Lt ? Lo ? Pc) > | "." (Ll ? Lo) > > I agree that Lu (Uppercase_Letter) and Lt (Titlecase_Letter) should > be excluded so an atom can not start with a capital looking letter, > but Pc ? XID_Start so there is no reason to subtract it, and why > subtract Lo (Other_Letter)? There is also no *harm* in making it obvious that variables *can* start with Pc characters and unquoted atoms *cannot*. Why subtract Lo? That was a combination of a backwards compatibility issue and an oversight. The backwards compatibility issue is that ?? are Lo characters and are not allowed to begin an Erlang atom. The oversight was forgetting that this category was the one with most of the characters I wanted to allow. This should read atom_start ::= XID_Start \ (Lu ? Lt ? "??") | "." (Ll ? Lo) > There also seems to be a typo in the definition of unquoted_atom > where an iteration of atom_continue is missing. > > I propose: > unquoted_atom ::= atom_start atom_continue* Yes. > > atom_start ::= atom_start_char > | "." atom_start_char That will allow Latin-1 atoms that are not now legal. > > atom_start_char ::= XID_Start ? (Lu ? Lt) > > atom_continue ::= XID_Continue ? "@" > | "." XID_Continue That will allow Latin-1 atoms that are not now legal. > General explanation > ------------------- > > I think the EEP could benefit from explaining more about the used character > classes, what kind of stability annex #31 is designed to give and such. > > When I did read the EEP it took several days of Unicode standard reading to > start understanding, and I think many hesitate before trying to understand > the EEP, which is a pity. Well, yes. Is it my job to repeat all the material in the Unicode standard? I don't think so. I mean, the thing's telephone-book size! > > My first concern was about if I write code for one Unicode Erlang release > in the future, will then that code be valid for subsequent Erlang releases > based on later Unicode standards. Yes. Section 1.1 of UAX#31 could hardly be more explicit. Well, maybe it could, which is why it points to http://www.unicode.org/policies/stability_policy.html which says - Once a character is XID_Continue, it must continue to be so in all future versions. - If a character is XID_Start then it must also be XID_Continue. - Once a character is XID_Start, it must continue to be so in all future versions. amongst other things. > For example the EEP and my proposal both define atom_start to be XID_Start > minus a set containing uppercase and titlecase letters. XID_Start is > derived from ID_Start, and ID_Start contains Other_ID_Start. I have failed > in finding which codepoints are contained in Other_ID_Start. To start with, the purpose of Other_ID_Start is to provide stability. Any character which _used_ to be an ID_Start but because of some change would have ceased to be so will be given that property to compensate. The properties Other_ID_Start and Other_ID_Continue are listed in Proplist.txt in the Unicode data base. Here's the current set: # ================================================ 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P 212E ; Other_ID_Start # So ESTIMATED SYMBOL 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK # Total code points: 4 # ================================================ 00B7 ; Other_ID_Continue # Po MIDDLE DOT 0387 ; Other_ID_Continue # Po GREEK ANO TELEIA 1369..1371 ; Other_ID_Continue # No [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT NINE 19DA ; Other_ID_Continue # No NEW TAI LUE THAM DIGIT ONE # Total code points: 12 > But since we here define atom_start as above, moving a character from Lu > or Lt into Other_ID_Start will remove it from atom_start and old code > using it will not compile. Lu and Lt are "General Categories". Other_ID_Start is a "property". OK, now we've got a genuine technical problem. The set of characters that can begin a variable-OR-an-unquoted-atom can only grow. That much stability we're promised. If a character changes from Lu to Lt or Other_ID_Start, no problem. If a character changes from Lt to Lu or Other_ID_Start, no problem. But if a character changes from Lu/Lt to Ll/Lo or vice versa, we have a problem. Perhaps we can appeal to this: Once a character is encoded, its properties may still be changed, but not in such a way as to change the fundamental identity of the character. ... For example, the representative glyph for U+0061 ?A? cannot be changed to ?B?; the General_Category for U+0061 ?A? cannot be changed to Ll (lowercase letter) ... Case Pair stability _nearly_ gives us what we want. If two characters form a case pair in a version of Unicode, they will remain a case pair in each subsequent version of Unicode. If two characters do not form a case pair in a version of Unicode, they will never become a case pair in any subsequent version of Unicode. That is, if "D" and "d" are unequal defined characters such that lower("D") = "d" and upper("d") = "D", then this will remain true. This means that If "D" is an Lu character now and "d" the corresponding Ll character, they are going to remain a case pair. So we could fiddle a bit and say Lu + Lt + Pc + (Other_ID_Start such that lower(x) != x) is what we're after. This doesn't handle the situation where there is a cased letter now but not its case opposite, as Latin-1 had y-umlaut and sharp s as lower case letters with no upper case version. But when case opposites for them did go into Unicode, they didn't change. I don't think we actually have a problem. However, the attached revision to EEP 40 has two recommendations. From ok@REDACTED Thu Nov 1 06:42:00 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 1 Nov 2012 18:42:00 +1300 Subject: [erlang-questions] ++ operator In-Reply-To: References: Message-ID: <50F7075A-A7CE-4301-B180-CE1ED2F129F9@cs.otago.ac.nz> On 1/11/2012, at 6:24 AM, Micha? Ptaszek wrote: > > Does Erlang have a built-in optimizations such as?: > ++([], B) -> B; > ++(A, B) -> lists:append([A, B]). Other way around. In lib/stdlib*/src/lists.erl you'll find append(L1, L2) -> L1 ++ L2. It is important that the cost of Xs++Ys (append(Xs, Ys)) should depend only on the size of Xs, and that means Ys does not get looked at at all. From paperless@REDACTED Thu Nov 1 06:45:10 2012 From: paperless@REDACTED (Tim McNamara) Date: Thu, 1 Nov 2012 18:45:10 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <20121031144414.GA4800@erix.ericsson.se> Message-ID: +1 to ROK's ideas from me. We should be allowing programmers and programming teams to make their own decisions regarding which characters to allow within projects. If people want to play tricks on each other by replacing ASCII chars with visibly indistinguishable chars from somewhere else, then that's their own business. We have the technology to be culturally sensitive and responsive. If someone is willing to invest energy to implement Unicode, we as a community should not put barriers in front of that. On Nov 1, 2012 6:27 PM, "Richard O'Keefe" wrote: > > > On 1/11/2012, at 3:44 AM, Raimo Niskanen wrote: > > > > Was it not ment to be: > > var_start ::= (XID_Start ? (Lu ? Lt ? Other_ID_Start)) ? Pc > > Yes. I made a mistake there. > > > > More restricted variable names > > ------------------------------ > > > > Nevertheless, I would like a slightly more conservative change in how > Erlang > > should use Unicode in variable names and unquoted atoms. > > > > I want to be able to read printed source code on a paper and at least > > understand if ? = count() has a variable, an atom or an integer to the > left. > > This is an impossible goal because we can today e.g Cyrillic ? in any > .erl > > file and that will look as it should compile but it will not. > > I am a little puzzled here. U+0410 (CYRILLIC CAPITAL LETTER A) looks > like this: ?. I grant you that it is somewhere between exceptionally > difficult and impossible to tell an A from an ? from an ? (Latin > capital A, Cyrillic, and Greek respectively). But they are all capital > letters. The point of the proposal is that since ? (U+0410) is a > capital letter, ? = count() _should_ compile. > > If the example had been U+1EFD ? (LATIN SMALL LETTER MIDDLE-WELSH V) > that would have been hard to tell from a six, true. > But I don't see how this is any different from the fact that in a script > you don't know, you cannot tell _what_ a character is. > For example, I had a student this year whose native language was I > believe Malayalam. I can't tell a Malayalam letter from a digit from > a punctuation mark. > > Did you mean U+0417 (CYRILLIC CAPITAL LETTER ZE) "?", which resembles 3? > > Ah! Emacs to the rescue. It's the LATIN CAPITAL LETTER TONE FIVE. > Nothing to do with Cyrillic. > > Reverting to the Middle Welsh letter, if I cannot tell a small letter > from a digit, does that mean that every unquoted atom should begin > with an English letter? (I cannot say "a Latin letter", because > ? _is_ a member of the extended Latin script.) > > No, I'm sorry. This is ridiculous. Expecting everybody to begin > _their_ variables which you will almost certainly never see to begin > with an ASCII letter so _you_ can tell this from that; what sense does > that make? If it is in a script you cannot read, then you cannot read it. > > Can we just try, for a minute or to, to entertain a rather wild idea? > Here's the idea: most programmers are adults. They can make informed > choices. If they *want* you to read their code, they are smart enough > to write in a script you can read. If they decide that it's more > important to them that _they_ can read comfortably, that's their > decision to make. If you want a Malayalam-speaker to write code for > you, put the language (English, Finnish, whatever) in the contract. > > I have a confession to make. My multiple-programming-languages to > multiple-styled-output-formats tool is currently Latin-1 only. > That's because it's for _me_; nobody paid me to write it and I didn't > expect anyone else to find it useful (although someone did). It can, > for example, be configured to generate HTML, and it can be made to > wrap keywords in and could as easily wrap variables in . It > would probably take me about a week to revised the thing to use > Unicode. So then I'd have a tool that could generate printed listings > with variables underlined, without needing to slap untold numbers of > people in the face with the notion that they are and must remain > second-class world citizens. > > > So I have to change that requirement into; if it compiles I want to be > able > > to tell from a noncolour printed source code listing what the semantics > is. > > You are, in fact, proposing a backwards-incompatible change to Erlang, > in order to achieve a goal which is not in general achievable, and not > in my view worth achieving if you could. > > Let's be realistic here. If you cannot read any of the words, it is not > going to do you any good to tell the variables from the atoms from the > numbers. Let's take an example. I took a snippet of Erlang out of > the Erlang/OTP release and transliterated the English letters to > Russian ones. If you _don't_ read the Cyrillic script, precisely what > good does it do you to know which are the variables? If you _do_ read > the Cyrillic script, this will seem to you to be complete gibberish, > so imagine it's a language you don't know. > > ????????({????????,????,?????,??0,??,???}, ???????, ??0) -> > try > {???,??????????,??} = ??_???(??, ??0, ???, ???????, {????,?????}, > ??0), > ???? = {????????,????,?????,??????????,???}, > {????,??} > catch > ?????:????? -> > ????? = ??????:???_??????????(), > ??:??????("????????: ~?/~?\?", [????,?????]), > ??????:?????(?????, ?????, ?????) > end. > > ??_???(???, ???, ???, ???????, ?????????, ??0) -> > {??,??1} = ???_?????(??0), > {??,??2} = ?????_????_?????(?????????, ??1), > > ??? = ?????_????(#??{???=?????(fun ({???,?}, ???) -> > ???_???(?, ???) > end, [], ???), > ???=[]}, 0, ???), > {?2,_???,??3} = ??_????(???, 0, ???, ???, > ??2#??{?????=????,?????=??,?????=??,??_???_?????=????}), > {????,?????} = ?????????, > ? = [{?????,??},{????_????,???????,{????,????},?????}, > {?????,??}|?2], > {?,??,??3}. > > I don't know about you, but I wouldn't dare to touch this. > It DOES NOT MATTER TO me which words are variables and which > are not, because that knowledge is not useful to me. > > (By the way, it should now be clear that in a context like this > you'll _know_ that something is a Cyrillic capital A because > everything else is Cyrillic -- there are no capital letters in > keywords -- so what would a Latin capital A be doing there?) > > Does that mean there will be Erlang files that I cannot read and > Raimo Niskanen cannot read? Certainly it does. Does that mean a > big problem for us? No. Nobody is going to _expect_ us to read > it. If someone ships us source code we can't read we shan't use > it. > > Is this a NEW problem? No. It is already possible to use some > surprising languages in ASCII (Klingon, Ancient Egyptian, Greek > with a little ingenuity, ...) so ever since Erlang began, we've > had the possibility of entire files being written in words that > we did not understand. If you don't know what the *functions* > are about, what good does it do you to know which tokens are > variables? > > I once had to maintain a large chunk of Prolog written by a > very clever programmer whose idea of good variable naming > style came from old BASIC (one letter, or one letter and one > digit). I could see _which_ tokens were the variables, but > not _what_ the variable names meant. I had to figure it out > from the predicate names. So from actual experience I can > tell you > > JUST KNOWING WHICH TOKENS ARE VARIABLES IS > NEXT TO USELESS. > > > I think it is better to restrict to a subset of 7-bit US-ASCII. > > Yeah! Let's make Erlang ASCII-only! (Too bad about my father's > middle name: ?neas. Perfectly good English name, from Latin.) > > > Decent > > editors have means (vim: ga, emacs: Ctrl-X describe-char) to show which > > character is under the cursor and if it is A..Z or _ under U+7F it is a > > variable start. > > I'm using Aquamacs. > From the Aquamacs help: > Emacs buffers and strings support a large repertoire of > characters from many different scripts, allowing users to > type and display text in almost any known written language. > > To support this multitude of characters and scripts, > Emacs closely follows the Unicode Standard. > It's Meta-X describe-char, not Ctrl-X describe-char, > and it works perfectly with Unicode characters. > Here's sample output: > > character: ? (1202, #o2262, #x4b2) > preferred charset: unicode (Unicode (ISO10646)) > code point: 0x04B2 > syntax: w which means: word > category: .:Base, y:Cyrillic > buffer code: #xD2 #xB2 > file code: #xD2 #xB2 (encoded by coding system utf-8) > display: by this font (glyph code) > > nil:-apple-Lucida_Grande-medium-normal-normal-*-13-*-*-*-p-0-iso10646-1 > (#x8A3) > > Character code properties: customize what to show > name: CYRILLIC CAPITAL LETTER HA WITH DESCENDER > old-name: CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER > general-category: Lu (Letter, Uppercase) > > Trying this in Vim, it tells me what the numeric codes > of a letter are, but not that it is a letter. > > > > > The underscore > > -------------- > > > > I would like to argue against allowing all Unicode general category Pc > > (Connector_Punctuation) character in place of "_". This class contain > > in Unicode 6.2 these characters: > > U+5F; LOW LINE > > U+2034; UNDERTIE > > U+2040; CHARACTER TIE > > U+2054; INVERTED UNDERTIE > > U+FE33; PRESENTATION FORM FOR VERTICAL LOW LINE > > U+FE33; PRESENTATION FORM FOR VERTICAL WAVY LOW LINE > > U+FE4D; DASHED LOW LINE > > U+FE4E; CENTERLINE LOW LINE > > U+FE4F; WAVY LOW LINE > > U+FF3F; FULLWIDTH LOW LINE > > > > Of these at least U+2040 "?" is horizontal at the top of the line > > If it looks horizontal, you have a very poor font. > It's _supposed_ to look more like a c rotated 90 degrees > clockwise and flattened a bit. > > > and U+FE33 "?" looks like a vertical bar (I guess intended for > > vertical flow chinese) so they do not resemble "_" very much. > > Who said they were _supposed_ to resemble "_"? > Not me. > > I can see your point here, but allowing-all-of-Pc *is* the > Unicode UAX#31 recommendation. We *have* to tailor the > definition somewhat for the sake of backwards compatibility > (dots and at signs). We *could* tailor it here, but it is > definitely advantageous to have at least one more Pc > character reasons given in the EEP. > > > Allowing all these would make it hard to remember if a given > > character is category Pc or something else e.g "|". > > You are not *supposed* to remember what each and every character is. > > BECAUSE YOU CAN'T. > > If there's anyone who can, I don't want to meet them. > What _else_ could we talk about? > > There are 110,117 defined characters in Unicode 6.2. > (The figure was 110,116 in Unicode 6.1 and 6.2 added one more.) > NOBODY is expected to know what all these characters are. > > The idea is not > "if a character is to appear in an Erlang file, > everybody must know what it means" > but > "if someone wants to use their own script in > an Erlang file, they should be able to do so > in a way that is generally consistent with > other programming languages." > > The idea that a character should be forbidden unless YOU > recognise it would take us right back to ASCII or Latin 1. > Please, do not put the cart before the horse. > > It is perfectly acceptable to say "If someone wants to share > Erlang code with people in other countries, they should use > characters that all those people recognise." In the 21st > century it is no longer acceptable to say "nobody may use a > character unless I remember what it is." > > > > Unquoted atoms > > -------------- > > > > The EEP proposes: > > atom_start ::= XID_Start ? (Lu ? Lt ? Lo ? Pc) > > | "." (Ll ? Lo) > > > > I agree that Lu (Uppercase_Letter) and Lt (Titlecase_Letter) should > > be excluded so an atom can not start with a capital looking letter, > > but Pc ? XID_Start so there is no reason to subtract it, and why > > subtract Lo (Other_Letter)? > > There is also no *harm* in making it obvious that variables > *can* start with Pc characters and unquoted atoms *cannot*. > > Why subtract Lo? That was a combination of a backwards compatibility > issue and an oversight. > > The backwards compatibility issue is that > ?? are Lo characters and are not allowed to begin an Erlang atom. > The oversight was forgetting that this category was the one with > most of the characters I wanted to allow. > > This should read > > atom_start ::= XID_Start \ (Lu ? Lt ? "??") > | "." (Ll ? Lo) > > > There also seems to be a typo in the definition of unquoted_atom > > where an iteration of atom_continue is missing. > > > > I propose: > > unquoted_atom ::= atom_start atom_continue* > > Yes. > > > > atom_start ::= atom_start_char > > | "." atom_start_char > > That will allow Latin-1 atoms that are not now legal. > > > > atom_start_char ::= XID_Start ? (Lu ? Lt) > > > > atom_continue ::= XID_Continue ? "@" > > | "." XID_Continue > > That will allow Latin-1 atoms that are not now legal. > > > General explanation > > ------------------- > > > > I think the EEP could benefit from explaining more about the used > character > > classes, what kind of stability annex #31 is designed to give and such. > > > > When I did read the EEP it took several days of Unicode standard reading > to > > start understanding, and I think many hesitate before trying to > understand > > the EEP, which is a pity. > > Well, yes. Is it my job to repeat all the material in the Unicode > standard? I don't think so. I mean, the thing's telephone-book size! > > > > My first concern was about if I write code for one Unicode Erlang release > > in the future, will then that code be valid for subsequent Erlang > releases > > based on later Unicode standards. > > Yes. Section 1.1 of UAX#31 could hardly be more explicit. Well, > maybe it could, which is why it points to > http://www.unicode.org/policies/stability_policy.html > which says > > - Once a character is XID_Continue, > it must continue to be so in all future versions. > - If a character is XID_Start then it must also be XID_Continue. > - Once a character is XID_Start, > it must continue to be so in all future versions. > > amongst other things. > > > For example the EEP and my proposal both define atom_start to be > XID_Start > > minus a set containing uppercase and titlecase letters. XID_Start is > > derived from ID_Start, and ID_Start contains Other_ID_Start. I have > failed > > in finding which codepoints are contained in Other_ID_Start. > > To start with, the purpose of Other_ID_Start is to provide stability. > Any character which _used_ to be an ID_Start but because of some change > would have ceased to be so will be given that property to compensate. > > The properties Other_ID_Start and Other_ID_Continue are listed in > Proplist.txt in the Unicode data base. Here's the current set: > > # ================================================ > > 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P > 212E ; Other_ID_Start # So ESTIMATED SYMBOL > 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND > MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK > > # Total code points: 4 > > # ================================================ > > 00B7 ; Other_ID_Continue # Po MIDDLE DOT > 0387 ; Other_ID_Continue # Po GREEK ANO TELEIA > 1369..1371 ; Other_ID_Continue # No [9] ETHIOPIC DIGIT ONE..ETHIOPIC > DIGIT NINE > 19DA ; Other_ID_Continue # No NEW TAI LUE THAM DIGIT ONE > > # Total code points: 12 > > > But since we here define atom_start as above, moving a character from Lu > > or Lt into Other_ID_Start will remove it from atom_start and old code > > using it will not compile. > > > Lu and Lt are "General Categories". Other_ID_Start is a "property". > > OK, now we've got a genuine technical problem. > > The set of characters that can begin a variable-OR-an-unquoted-atom > can only grow. That much stability we're promised. > > If a character changes from Lu to Lt or Other_ID_Start, > no problem. If a character changes from Lt to Lu or > Other_ID_Start, no problem. But if a character changes > from Lu/Lt to Ll/Lo or vice versa, we have a problem. > > Perhaps we can appeal to this: > Once a character is encoded, its properties may still be > changed, but not in such a way as to change the fundamental > identity of the character. > ... > For example, the representative glyph for U+0061 ?A? > cannot be changed to ?B?; the General_Category for > U+0061 ?A? cannot be changed to Ll (lowercase letter) > ... > > Case Pair stability _nearly_ gives us what we want. > If two characters form a case pair in a version of Unicode, > they will remain a case pair in each subsequent version of Unicode. > > If two characters do not form a case pair in a version of Unicode, > they will never become a case pair in any subsequent version of > Unicode. > That is, if "D" and "d" are unequal defined characters such that > lower("D") = "d" and upper("d") = "D", then this will remain true. > This means that > If "D" is an Lu character now and "d" the corresponding Ll > character, they are going to remain a case pair. > So we could fiddle a bit and say > Lu + Lt + Pc + (Other_ID_Start such that lower(x) != x) > is what we're after. > > This doesn't handle the situation where there is a cased letter now > but not its case opposite, as Latin-1 had y-umlaut and sharp s as > lower case letters with no upper case version. But when case opposites > for them did go into Unicode, they didn't change. > > I don't think we actually have a problem. > > However, the attached revision to EEP 40 has two recommendations. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Nov 1 06:52:09 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 1 Nov 2012 18:52:09 +1300 Subject: [erlang-questions] Gaussian Distribution In-Reply-To: References: <785403d003bdc06c1f5cca299015ab0f.squirrel@zaphod42.dyndns.org> Message-ID: > On Mon, Oct 29, 2012 at 5:59 AM, Frank Recker wrote: >> Your points are correct, but I had reasons for my design choices. >> >> - math:erf/1 was not available in my windows version of erlang >> >> - under linux math:erf/1 delivers the value 1 for large x (x>7), which is >> problematic. The exact value is always in the open interval (-1,1). This is floating-point we are talking about. For sufficiently large x, the closest floating point number WILL be 1, like it or not. erf() is doing the best it possibly can. From dmkolesnikov@REDACTED Thu Nov 1 07:47:03 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Thu, 1 Nov 2012 08:47:03 +0200 Subject: [erlang-questions] Guidance to a cache mechanism In-Reply-To: References: <0226FF80-BD22-4C3E-B3CB-5F20F0F3DFC7@cs.otago.ac.nz> Message-ID: <2666299439252848201@unknownmsgid> Hello Richard, Somehow, I have missed your point here. It is obvious that two indexes are required: hash and b-tree. Unless we have a double linked list but we do not :-( we can implement those indexes as ETS tables set and ordered_set, isn't IT? Best Regards, Dmitry >-|-|-*> On 1.11.2012, at 2.28, Richard O'Keefe wrote: > > On 31/10/2012, at 6:55 PM, Maruthavanan Subbarayan wrote: >> I thought of keeping the time stamp as the key in the ets table and maintain that in state when a timeout event occurs. I hope this would help me to delete the entries in ets table with less burden. > > Like I said, "Time tells your program when to delete a message." > But the question was "How is your program asked to give a message back?" > Because if your program is never asked to give a message back, why keep > it at all? > > Suppose you are running Brekekek.example.com, a site where users > exchange 'croaks' (which must be at most 140 characters of Attic > Greek). You receive > > {add,User,Croak} > > Here is User's latest Croak, which you add to > the cache with erlang:now() -- ignoring the > microsecond part -- as its timestamp. > > {ask,User,Sender,Time} > > The Sender process wants to be told all of > User's Croaks since Time. > > messages, amongst others. In order to delete Croaks easily, > you want to store them keyed by time. But in order to answer > 'ask' requests, you want to store them keyed by User. And > ETS allows a table only one key. Oh dear... > > Think of it in relational data base terms. > > Cache(User, Time, Croak) > fd User x Time -> Croak > hash bag index on User > b-tree index on Time > > {add,User,Croak} => into Cache insert (User, now(), Croak) > {ask,User,Sender,Time} => > Sender ! select Croak from Cache > where Cache.User = User and Cache.Time >= Time > tick => delete Cache where Cache.Time < now() - Expiry_Time > > Basically what I am saying is that if your cache is to be any use, > there _have_ to be operations other than adding and deleting, and > you need to consider _all_ the operations. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From send2philip@REDACTED Thu Nov 1 10:42:44 2012 From: send2philip@REDACTED (Philip Clarke) Date: Thu, 1 Nov 2012 09:42:44 +0000 Subject: [erlang-questions] mnesia, ordered_set and disc_copies In-Reply-To: <20121031210944.GA26123@circlewave.net> References: <20121031210944.GA26123@circlewave.net> Message-ID: Hi Jachym, Yes, mnesia:create_schema is what I forgot to do. Thanks for your help. Philip On Wed, Oct 31, 2012 at 9:09 PM, Jachym Holecek wrote: > # Philip Clarke 2012-10-31: > > Hi, > > > > I have a simple record defined as: > > -record(user, {id, name}). > > > > Next I start up mnesia and try to create a table as follows: > > > > mnesia:create_table(user, [{type, ordered_set}, {disc_copies, [node()]}, > > {attributes, record_info(fields, user)}]). > > > > This gives me this error: > > {aborted,{bad_type,user,disc_copies,nonode@REDACTED}} > > > > > > If i change the table type to be ram_copies, everything works fine. > > I realise that I cannot use disc_only_copies with ordered_set, but I > > thought that disc_copies was supported. > > > > Am I doing something else wrong ? > > Did you forget to install disc_copies schema first? I don't think you can > have disc_copies tables with ram_copies schema. > > Eshell V5.8.5 (abort with ^G) > (foo@REDACTED)1> mnesia:create_schema([node()]). > ok > (foo@REDACTED)2> mnesia:start(). > ok > (foo@REDACTED)3> mnesia:create_table(user, [{type, ordered_set}, > {disc_copies, [node()]}, > {attributes, [id, name]}]). > {atomic,ok} > > BR, > -- Jachym > -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Thu Nov 1 12:27:46 2012 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Thu, 1 Nov 2012 11:27:46 +0000 Subject: [erlang-questions] any way to avoid *.config file for sasl? Message-ID: <20121101112746.GA11803@precise.local> Hi, a session is worth a thousand words: motiejus@REDACTED> erl Erlang R15B02 (erts-5.9.2) [source] [smp:2:2] [async-threads:0] [kernel-poll:false] Eshell V5.9.2 (abort with ^G) 1> application:set_env(sasl, sasl_error_logger, false). ok 2> application:start(sasl). ok 3> =PROGRESS REPORT==== 1-Nov-2012::10:51:32 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.41.0>}, {name,alarm_handler}, {mfargs,{alarm_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] ... 3> application:get_env(sasl, sasl_error_logger). {ok,tty} 4> Conclusion is: if the value (in this case sasl_error_logger) is defined in sasl.app, on application startup the value set by application:set_env/3 is overwritten by the value from the .app file. That means that if I want to change the value of sasl_error_logger, I *must* use -config FILE when starting Erlang. Is there any other way to change that value in a running system, before starting sasl? Best regards, Motiejus From YurinVV@REDACTED Thu Nov 1 12:30:07 2012 From: YurinVV@REDACTED (Slava Yurin) Date: Thu, 01 Nov 2012 18:30:07 +0700 Subject: [erlang-questions] any way to avoid *.config file for sasl? In-Reply-To: <20121101112746.GA11803@precise.local> References: <20121101112746.GA11803@precise.local> Message-ID: <712611351769407@web7h.yandex.ru> An HTML attachment was scrubbed... URL: From mbj@REDACTED Thu Nov 1 12:35:53 2012 From: mbj@REDACTED (Martin Bjorklund) Date: Thu, 01 Nov 2012 12:35:53 +0100 (CET) Subject: [erlang-questions] any way to avoid *.config file for sasl? In-Reply-To: <20121101112746.GA11803@precise.local> References: <20121101112746.GA11803@precise.local> Message-ID: <20121101.123553.2220217660195457374.mbj@tail-f.com> Hi, Motiejus Jak?tys wrote: > a session is worth a thousand words: [...] > Is there any other way to change that value in a running system, before > starting sasl? 1> application:load(sasl). ok 2> application:set_env(sasl, sasl_error_logger, false). ok 3> application:start(sasl). ok 4> application:get_env(sasl, sasl_error_logger). {ok,false} /martin From magnus@REDACTED Thu Nov 1 12:36:05 2012 From: magnus@REDACTED (Magnus Henoch) Date: Thu, 01 Nov 2012 11:36:05 +0000 Subject: [erlang-questions] any way to avoid *.config file for sasl? In-Reply-To: <20121101112746.GA11803@precise.local> ("Motiejus \=\?utf-8\?Q\?J\?\= \=\?utf-8\?Q\?ak\=C5\=A1tys\=22's\?\= message of "Thu, 1 Nov 2012 11:27:46 +0000") References: <20121101112746.GA11803@precise.local> Message-ID: Motiejus Jak?tys writes: > Is there any other way to change that value in a running system, before > starting sasl? You can load sasl before setting the variable: Erlang R15B (erts-5.9) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9 (abort with ^G) 1> application:load(sasl). ok 2> application:set_env(sasl, sasl_error_logger, false). ok 3> application:start(sasl). ok 4> application:get_env(sasl, sasl_error_logger). {ok,false} Regards, Magnus From freza@REDACTED Thu Nov 1 12:34:15 2012 From: freza@REDACTED (Jachym Holecek) Date: Thu, 1 Nov 2012 07:34:15 -0400 Subject: [erlang-questions] any way to avoid *.config file for sasl? In-Reply-To: <20121101112746.GA11803@precise.local> References: <20121101112746.GA11803@precise.local> Message-ID: <20121101113415.GA27360@circlewave.net> # Motiejus Jak?tys 2012-11-01: > That means that if I want to change the value of sasl_error_logger, I > *must* use -config FILE when starting Erlang. You can also set env from command line: # erl -sasl sasl_error_logger false Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] Eshell V5.8.5 (abort with ^G) 1> application:start(sasl). ok 2> application:get_env(sasl, sasl_error_logger). {ok,false} 3> BR, -- Jachym From desired.mta@REDACTED Thu Nov 1 13:19:01 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Thu, 1 Nov 2012 12:19:01 +0000 Subject: [erlang-questions] any way to avoid *.config file for sasl? In-Reply-To: <20121101.123553.2220217660195457374.mbj@tail-f.com> References: <20121101112746.GA11803@precise.local> <20121101.123553.2220217660195457374.mbj@tail-f.com> Message-ID: On Thu, Nov 1, 2012 at 11:35 AM, Martin Bjorklund wrote: > > 1> application:load(sasl). > ok > 2> application:set_env(sasl, sasl_error_logger, false). > ok > 3> application:start(sasl). > ok > 4> application:get_env(sasl, sasl_error_logger). > {ok,false} > Hi, thanks everyone! This is exactly what I wanted. -- Motiejus Jak?tys From be.dmitry@REDACTED Thu Nov 1 13:36:13 2012 From: be.dmitry@REDACTED (Dmitry Belyaev) Date: Thu, 1 Nov 2012 16:36:13 +0400 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <20121031144414.GA4800@erix.ericsson.se> Message-ID: <9B222461-F9FB-4D72-B3E2-E8677A403607@gmail.com> I've looked through the proposal and don't understand why there are no proposal to add localized keywords? Suppose I will be using atoms and variables that are easy to read in my own language. Then I'll definitely be frustrated if I have to write keywords in any other language. More than that, it will be very annoying to anyone who has to switch keyboard layout from English to native. -- Dmitry Belyaev On 01.11.2012, at 9:27, Richard O'Keefe wrote: > > > On 1/11/2012, at 3:44 AM, Raimo Niskanen wrote: >> >> Was it not ment to be: >> var_start ::= (XID_Start ? (Lu ? Lt ? Other_ID_Start)) ? Pc > > Yes. I made a mistake there. >> >> More restricted variable names >> ------------------------------ >> >> Nevertheless, I would like a slightly more conservative change in how Erlang >> should use Unicode in variable names and unquoted atoms. >> >> I want to be able to read printed source code on a paper and at least >> understand if ? = count() has a variable, an atom or an integer to the left. >> This is an impossible goal because we can today e.g Cyrillic ? in any .erl >> file and that will look as it should compile but it will not. > > I am a little puzzled here. U+0410 (CYRILLIC CAPITAL LETTER A) looks > like this: ?. I grant you that it is somewhere between exceptionally > difficult and impossible to tell an A from an ? from an ? (Latin > capital A, Cyrillic, and Greek respectively). But they are all capital > letters. The point of the proposal is that since ? (U+0410) is a > capital letter, ? = count() _should_ compile. > > If the example had been U+1EFD ? (LATIN SMALL LETTER MIDDLE-WELSH V) > that would have been hard to tell from a six, true. > But I don't see how this is any different from the fact that in a script > you don't know, you cannot tell _what_ a character is. > For example, I had a student this year whose native language was I > believe Malayalam. I can't tell a Malayalam letter from a digit from > a punctuation mark. > > Did you mean U+0417 (CYRILLIC CAPITAL LETTER ZE) "?", which resembles 3? > > Ah! Emacs to the rescue. It's the LATIN CAPITAL LETTER TONE FIVE. > Nothing to do with Cyrillic. > > Reverting to the Middle Welsh letter, if I cannot tell a small letter > from a digit, does that mean that every unquoted atom should begin > with an English letter? (I cannot say "a Latin letter", because > ? _is_ a member of the extended Latin script.) > > No, I'm sorry. This is ridiculous. Expecting everybody to begin > _their_ variables which you will almost certainly never see to begin > with an ASCII letter so _you_ can tell this from that; what sense does > that make? If it is in a script you cannot read, then you cannot read it. > > Can we just try, for a minute or to, to entertain a rather wild idea? > Here's the idea: most programmers are adults. They can make informed > choices. If they *want* you to read their code, they are smart enough > to write in a script you can read. If they decide that it's more > important to them that _they_ can read comfortably, that's their > decision to make. If you want a Malayalam-speaker to write code for > you, put the language (English, Finnish, whatever) in the contract. > > I have a confession to make. My multiple-programming-languages to > multiple-styled-output-formats tool is currently Latin-1 only. > That's because it's for _me_; nobody paid me to write it and I didn't > expect anyone else to find it useful (although someone did). It can, > for example, be configured to generate HTML, and it can be made to > wrap keywords in and could as easily wrap variables in . It > would probably take me about a week to revised the thing to use > Unicode. So then I'd have a tool that could generate printed listings > with variables underlined, without needing to slap untold numbers of > people in the face with the notion that they are and must remain > second-class world citizens. > >> So I have to change that requirement into; if it compiles I want to be able >> to tell from a noncolour printed source code listing what the semantics is. > > You are, in fact, proposing a backwards-incompatible change to Erlang, > in order to achieve a goal which is not in general achievable, and not > in my view worth achieving if you could. > > Let's be realistic here. If you cannot read any of the words, it is not > going to do you any good to tell the variables from the atoms from the > numbers. Let's take an example. I took a snippet of Erlang out of > the Erlang/OTP release and transliterated the English letters to > Russian ones. If you _don't_ read the Cyrillic script, precisely what > good does it do you to know which are the variables? If you _do_ read > the Cyrillic script, this will seem to you to be complete gibberish, > so imagine it's a language you don't know. > > ????????({????????,????,?????,??0,??,???}, ???????, ??0) -> > try > {???,??????????,??} = ??_???(??, ??0, ???, ???????, {????,?????}, ??0), > ???? = {????????,????,?????,??????????,???}, > {????,??} > catch > ?????:????? -> > ????? = ??????:???_??????????(), > ??:??????("????????: ~?/~?\?", [????,?????]), > ??????:?????(?????, ?????, ?????) > end. > > ??_???(???, ???, ???, ???????, ?????????, ??0) -> > {??,??1} = ???_?????(??0), > {??,??2} = ?????_????_?????(?????????, ??1), > > ??? = ?????_????(#??{???=?????(fun ({???,?}, ???) -> > ???_???(?, ???) > end, [], ???), > ???=[]}, 0, ???), > {?2,_???,??3} = ??_????(???, 0, ???, ???, > ??2#??{?????=????,?????=??,?????=??,??_???_?????=????}), > {????,?????} = ?????????, > ? = [{?????,??},{????_????,???????,{????,????},?????}, > {?????,??}|?2], > {?,??,??3}. > > I don't know about you, but I wouldn't dare to touch this. > It DOES NOT MATTER TO me which words are variables and which > are not, because that knowledge is not useful to me. > > (By the way, it should now be clear that in a context like this > you'll _know_ that something is a Cyrillic capital A because > everything else is Cyrillic -- there are no capital letters in > keywords -- so what would a Latin capital A be doing there?) > > Does that mean there will be Erlang files that I cannot read and > Raimo Niskanen cannot read? Certainly it does. Does that mean a > big problem for us? No. Nobody is going to _expect_ us to read > it. If someone ships us source code we can't read we shan't use > it. > > Is this a NEW problem? No. It is already possible to use some > surprising languages in ASCII (Klingon, Ancient Egyptian, Greek > with a little ingenuity, ...) so ever since Erlang began, we've > had the possibility of entire files being written in words that > we did not understand. If you don't know what the *functions* > are about, what good does it do you to know which tokens are > variables? > > I once had to maintain a large chunk of Prolog written by a > very clever programmer whose idea of good variable naming > style came from old BASIC (one letter, or one letter and one > digit). I could see _which_ tokens were the variables, but > not _what_ the variable names meant. I had to figure it out > from the predicate names. So from actual experience I can > tell you > > JUST KNOWING WHICH TOKENS ARE VARIABLES IS > NEXT TO USELESS. > >> I think it is better to restrict to a subset of 7-bit US-ASCII. > > Yeah! Let's make Erlang ASCII-only! (Too bad about my father's > middle name: ?neas. Perfectly good English name, from Latin.) > >> Decent >> editors have means (vim: ga, emacs: Ctrl-X describe-char) to show which >> character is under the cursor and if it is A..Z or _ under U+7F it is a >> variable start. > > I'm using Aquamacs. > From the Aquamacs help: > Emacs buffers and strings support a large repertoire of > characters from many different scripts, allowing users to > type and display text in almost any known written language. > > To support this multitude of characters and scripts, > Emacs closely follows the Unicode Standard. > It's Meta-X describe-char, not Ctrl-X describe-char, > and it works perfectly with Unicode characters. > Here's sample output: > > character: ? (1202, #o2262, #x4b2) > preferred charset: unicode (Unicode (ISO10646)) > code point: 0x04B2 > syntax: w which means: word > category: .:Base, y:Cyrillic > buffer code: #xD2 #xB2 > file code: #xD2 #xB2 (encoded by coding system utf-8) > display: by this font (glyph code) > nil:-apple-Lucida_Grande-medium-normal-normal-*-13-*-*-*-p-0-iso10646-1 (#x8A3) > > Character code properties: customize what to show > name: CYRILLIC CAPITAL LETTER HA WITH DESCENDER > old-name: CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER > general-category: Lu (Letter, Uppercase) > > Trying this in Vim, it tells me what the numeric codes > of a letter are, but not that it is a letter. > >> >> The underscore >> -------------- >> >> I would like to argue against allowing all Unicode general category Pc >> (Connector_Punctuation) character in place of "_". This class contain >> in Unicode 6.2 these characters: >> U+5F; LOW LINE >> U+2034; UNDERTIE >> U+2040; CHARACTER TIE >> U+2054; INVERTED UNDERTIE >> U+FE33; PRESENTATION FORM FOR VERTICAL LOW LINE >> U+FE33; PRESENTATION FORM FOR VERTICAL WAVY LOW LINE >> U+FE4D; DASHED LOW LINE >> U+FE4E; CENTERLINE LOW LINE >> U+FE4F; WAVY LOW LINE >> U+FF3F; FULLWIDTH LOW LINE >> >> Of these at least U+2040 "?" is horizontal at the top of the line > > If it looks horizontal, you have a very poor font. > It's _supposed_ to look more like a c rotated 90 degrees > clockwise and flattened a bit. > >> and U+FE33 "?" looks like a vertical bar (I guess intended for >> vertical flow chinese) so they do not resemble "_" very much. > > Who said they were _supposed_ to resemble "_"? > Not me. > > I can see your point here, but allowing-all-of-Pc *is* the > Unicode UAX#31 recommendation. We *have* to tailor the > definition somewhat for the sake of backwards compatibility > (dots and at signs). We *could* tailor it here, but it is > definitely advantageous to have at least one more Pc > character reasons given in the EEP. > >> Allowing all these would make it hard to remember if a given >> character is category Pc or something else e.g "|". > > You are not *supposed* to remember what each and every character is. > > BECAUSE YOU CAN'T. > > If there's anyone who can, I don't want to meet them. > What _else_ could we talk about? > > There are 110,117 defined characters in Unicode 6.2. > (The figure was 110,116 in Unicode 6.1 and 6.2 added one more.) > NOBODY is expected to know what all these characters are. > > The idea is not > "if a character is to appear in an Erlang file, > everybody must know what it means" > but > "if someone wants to use their own script in > an Erlang file, they should be able to do so > in a way that is generally consistent with > other programming languages." > > The idea that a character should be forbidden unless YOU > recognise it would take us right back to ASCII or Latin 1. > Please, do not put the cart before the horse. > > It is perfectly acceptable to say "If someone wants to share > Erlang code with people in other countries, they should use > characters that all those people recognise." In the 21st > century it is no longer acceptable to say "nobody may use a > character unless I remember what it is." >> >> Unquoted atoms >> -------------- >> >> The EEP proposes: >> atom_start ::= XID_Start ? (Lu ? Lt ? Lo ? Pc) >> | "." (Ll ? Lo) >> >> I agree that Lu (Uppercase_Letter) and Lt (Titlecase_Letter) should >> be excluded so an atom can not start with a capital looking letter, >> but Pc ? XID_Start so there is no reason to subtract it, and why >> subtract Lo (Other_Letter)? > > There is also no *harm* in making it obvious that variables > *can* start with Pc characters and unquoted atoms *cannot*. > > Why subtract Lo? That was a combination of a backwards compatibility > issue and an oversight. > > The backwards compatibility issue is that > ?? are Lo characters and are not allowed to begin an Erlang atom. > The oversight was forgetting that this category was the one with > most of the characters I wanted to allow. > > This should read > > atom_start ::= XID_Start \ (Lu ? Lt ? "??") > | "." (Ll ? Lo) > >> There also seems to be a typo in the definition of unquoted_atom >> where an iteration of atom_continue is missing. >> >> I propose: >> unquoted_atom ::= atom_start atom_continue* > > Yes. >> >> atom_start ::= atom_start_char >> | "." atom_start_char > > That will allow Latin-1 atoms that are not now legal. >> >> atom_start_char ::= XID_Start ? (Lu ? Lt) >> >> atom_continue ::= XID_Continue ? "@" >> | "." XID_Continue > > That will allow Latin-1 atoms that are not now legal. > >> General explanation >> ------------------- >> >> I think the EEP could benefit from explaining more about the used character >> classes, what kind of stability annex #31 is designed to give and such. >> >> When I did read the EEP it took several days of Unicode standard reading to >> start understanding, and I think many hesitate before trying to understand >> the EEP, which is a pity. > > Well, yes. Is it my job to repeat all the material in the Unicode > standard? I don't think so. I mean, the thing's telephone-book size! >> >> My first concern was about if I write code for one Unicode Erlang release >> in the future, will then that code be valid for subsequent Erlang releases >> based on later Unicode standards. > > Yes. Section 1.1 of UAX#31 could hardly be more explicit. Well, > maybe it could, which is why it points to > http://www.unicode.org/policies/stability_policy.html > which says > > - Once a character is XID_Continue, > it must continue to be so in all future versions. > - If a character is XID_Start then it must also be XID_Continue. > - Once a character is XID_Start, > it must continue to be so in all future versions. > > amongst other things. > >> For example the EEP and my proposal both define atom_start to be XID_Start >> minus a set containing uppercase and titlecase letters. XID_Start is >> derived from ID_Start, and ID_Start contains Other_ID_Start. I have failed >> in finding which codepoints are contained in Other_ID_Start. > > To start with, the purpose of Other_ID_Start is to provide stability. > Any character which _used_ to be an ID_Start but because of some change > would have ceased to be so will be given that property to compensate. > > The properties Other_ID_Start and Other_ID_Continue are listed in > Proplist.txt in the Unicode data base. Here's the current set: > > # ================================================ > > 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P > 212E ; Other_ID_Start # So ESTIMATED SYMBOL > 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK > > # Total code points: 4 > > # ================================================ > > 00B7 ; Other_ID_Continue # Po MIDDLE DOT > 0387 ; Other_ID_Continue # Po GREEK ANO TELEIA > 1369..1371 ; Other_ID_Continue # No [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT NINE > 19DA ; Other_ID_Continue # No NEW TAI LUE THAM DIGIT ONE > > # Total code points: 12 > >> But since we here define atom_start as above, moving a character from Lu >> or Lt into Other_ID_Start will remove it from atom_start and old code >> using it will not compile. > > > Lu and Lt are "General Categories". Other_ID_Start is a "property". > > OK, now we've got a genuine technical problem. > > The set of characters that can begin a variable-OR-an-unquoted-atom > can only grow. That much stability we're promised. > > If a character changes from Lu to Lt or Other_ID_Start, > no problem. If a character changes from Lt to Lu or > Other_ID_Start, no problem. But if a character changes > from Lu/Lt to Ll/Lo or vice versa, we have a problem. > > Perhaps we can appeal to this: > Once a character is encoded, its properties may still be > changed, but not in such a way as to change the fundamental > identity of the character. > ... > For example, the representative glyph for U+0061 ?A? > cannot be changed to ?B?; the General_Category for > U+0061 ?A? cannot be changed to Ll (lowercase letter) > ... > > Case Pair stability _nearly_ gives us what we want. > If two characters form a case pair in a version of Unicode, > they will remain a case pair in each subsequent version of Unicode. > > If two characters do not form a case pair in a version of Unicode, > they will never become a case pair in any subsequent version of Unicode. > That is, if "D" and "d" are unequal defined characters such that > lower("D") = "d" and upper("d") = "D", then this will remain true. > This means that > If "D" is an Lu character now and "d" the corresponding Ll > character, they are going to remain a case pair. > So we could fiddle a bit and say > Lu + Lt + Pc + (Other_ID_Start such that lower(x) != x) > is what we're after. > > This doesn't handle the situation where there is a cased letter now > but not its case opposite, as Latin-1 had y-umlaut and sharp s as > lower case letters with no upper case version. But when case opposites > for them did go into Unicode, they didn't change. > > I don't think we actually have a problem. > > However, the attached revision to EEP 40 has two recommendations. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From hobson42@REDACTED Thu Nov 1 17:16:40 2012 From: hobson42@REDACTED (Ian) Date: Thu, 01 Nov 2012 16:16:40 +0000 Subject: [erlang-questions] Guidance to a cache mechanism In-Reply-To: References: Message-ID: <5092A068.2050505@gmail.com> Hi, I'm not quite clear on what you want to do, but it appears that you want to discard messages if they are "too old", for some definition of too old, and you are proposing a combination of ETS and gen-server to do this. Why not simply discard messages that are too old when you read them, and read the next? That, coupled with having no synchronous send/reads to stall your process, and you are golden. Or have I missed something? Ian On 30/10/2012 11:08, Maruthavanan Subbarayan wrote: > Hi, > > I have to develop a caching queue, which also should should after a > expiry time. > > I may have around 500+ messages which may come in a second. Each > message might contain 100-200 bytes. > > So I have designed the system like below. > > 1. Queue would be a gen server. > 2. All messages which would come on same second would be stored in > state of the gen_server like a record {datetime(),[]} > 3. When the time differs, I would insert the above record to ets table > and update the state of gen_server. > 4. There would be a timer running timer:send_interval which would > message timeout the gen_server for every second, when this message is > received, then gen_server would delete the ets table according to > expiry configured. > > I was looking on some guidance to check if the above is fine and with > with stand the performance. I am foreseeing maximum expiry would be > around 60 minutes. > > Thanks, > Marutha > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Thu Nov 1 17:52:39 2012 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 1 Nov 2012 17:52:39 +0100 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <20121031144414.GA4800@erix.ericsson.se> Message-ID: <20121101165239.GA27093@erix.ericsson.se> On Thu, Nov 01, 2012 at 06:27:10PM +1300, Richard O'Keefe wrote: > > > On 1/11/2012, at 3:44 AM, Raimo Niskanen wrote: : : > > > > More restricted variable names > > ------------------------------ > > > > Nevertheless, I would like a slightly more conservative change in how Erlang > > should use Unicode in variable names and unquoted atoms. > > > > I want to be able to read printed source code on a paper and at least > > understand if ? = count() has a variable, an atom or an integer to the left. > > This is an impossible goal because we can today e.g Cyrillic ? in any .erl > > file and that will look as it should compile but it will not. > > I am a little puzzled here. U+0410 (CYRILLIC CAPITAL LETTER A) looks > like this: ?. I grant you that it is somewhere between exceptionally > difficult and impossible to tell an A from an ? from an ? (Latin > capital A, Cyrillic, and Greek respectively). But they are all capital > letters. The point of the proposal is that since ? (U+0410) is a > capital letter, ? = count() _should_ compile. I think that point, which is a good one, did not come through in the proposal, but the updated version of yours have a very good rationale that makes it clearer. > > If the example had been U+1EFD ? (LATIN SMALL LETTER MIDDLE-WELSH V) > that would have been hard to tell from a six, true. > But I don't see how this is any different from the fact that in a script > you don't know, you cannot tell _what_ a character is. > For example, I had a student this year whose native language was I > believe Malayalam. I can't tell a Malayalam letter from a digit from > a punctuation mark. > > Did you mean U+0417 (CYRILLIC CAPITAL LETTER ZE) "?", which resembles 3? > > Ah! Emacs to the rescue. It's the LATIN CAPITAL LETTER TONE FIVE. > Nothing to do with Cyrillic. Sorry I mixed examples here and pushed you on a side track. The TONE FIVE was an example of not knowing the symbol's general category. The Cyrillic A was an example of a similary looking glyph to A in US-ASCII. > > Reverting to the Middle Welsh letter, if I cannot tell a small letter > from a digit, does that mean that every unquoted atom should begin > with an English letter? (I cannot say "a Latin letter", because > ? _is_ a member of the extended Latin script.) > > No, I'm sorry. This is ridiculous. Expecting everybody to begin > _their_ variables which you will almost certainly never see to begin > with an ASCII letter so _you_ can tell this from that; what sense does > that make? If it is in a script you cannot read, then you cannot read it. > > Can we just try, for a minute or to, to entertain a rather wild idea? > Here's the idea: most programmers are adults. They can make informed > choices. If they *want* you to read their code, they are smart enough > to write in a script you can read. If they decide that it's more > important to them that _they_ can read comfortably, that's their > decision to make. If you want a Malayalam-speaker to write code for > you, put the language (English, Finnish, whatever) in the contract. > > I have a confession to make. My multiple-programming-languages to > multiple-styled-output-formats tool is currently Latin-1 only. > That's because it's for _me_; nobody paid me to write it and I didn't > expect anyone else to find it useful (although someone did). It can, > for example, be configured to generate HTML, and it can be made to > wrap keywords in and could as easily wrap variables in . It > would probably take me about a week to revised the thing to use > Unicode. So then I'd have a tool that could generate printed listings > with variables underlined, without needing to slap untold numbers of > people in the face with the notion that they are and must remain > second-class world citizens. > > > So I have to change that requirement into; if it compiles I want to be able > > to tell from a noncolour printed source code listing what the semantics is. > > You are, in fact, proposing a backwards-incompatible change to Erlang, > in order to achieve a goal which is not in general achievable, and not > in my view worth achieving if you could. > > Let's be realistic here. If you cannot read any of the words, it is not > going to do you any good to tell the variables from the atoms from the > numbers. Let's take an example. I took a snippet of Erlang out of > the Erlang/OTP release and transliterated the English letters to > Russian ones. If you _don't_ read the Cyrillic script, precisely what > good does it do you to know which are the variables? If you _do_ read > the Cyrillic script, this will seem to you to be complete gibberish, > so imagine it's a language you don't know. So here is what seems to be the core question: I say I want to be able to see the difference between a variable and an unquoted atom even if I can not make sense of the variables and atoms names'. I say it would be possible to achieve this by enforcing a small set of first letters for variables. Then we would require a variable to start with US-ASCII CAPITAL, "_" or "@". You say that goal of mine is a lost cause because I will not have any use of being able to tell the difference between telling the difference between a variable and an atom anyway. And trying to achieve this by making backwards incompatible changes is plain ridicilous. Fair enough. Just adding "@" to the current set of characters allowed to start a variable would not be a backwards compatible change, or? But it would be ugly to allow some Latin capitals while not the Latin extended nor Cyrillic etc. > > ????????({????????,????,?????,??0,??,???}, ???????, ??0) -> > try > {???,??????????,??} = ??_???(??, ??0, ???, ???????, {????,?????}, ??0), > ???? = {????????,????,?????,??????????,???}, > {????,??} > catch > ?????:????? -> > ????? = ??????:???_??????????(), > ??:??????("????????: ~?/~?\?", [????,?????]), > ??????:?????(?????, ?????, ?????) > end. > > ??_???(???, ???, ???, ???????, ?????????, ??0) -> > {??,??1} = ???_?????(??0), > {??,??2} = ?????_????_?????(?????????, ??1), > > ??? = ?????_????(#??{???=?????(fun ({???,?}, ???) -> > ???_???(?, ???) > end, [], ???), > ???=[]}, 0, ???), > {?2,_???,??3} = ??_????(???, 0, ???, ???, > ??2#??{?????=????,?????=??,?????=??,??_???_?????=????}), > {????,?????} = ?????????, > ? = [{?????,??},{????_????,???????,{????,????},?????}, > {?????,??}|?2], > {?,??,??3}. > > I don't know about you, but I wouldn't dare to touch this. > It DOES NOT MATTER TO me which words are variables and which > are not, because that knowledge is not useful to me. > > (By the way, it should now be clear that in a context like this > you'll _know_ that something is a Cyrillic capital A because > everything else is Cyrillic -- there are no capital letters in > keywords -- so what would a Latin capital A be doing there?) > > Does that mean there will be Erlang files that I cannot read and > Raimo Niskanen cannot read? Certainly it does. Does that mean a > big problem for us? No. Nobody is going to _expect_ us to read > it. If someone ships us source code we can't read we shan't use > it. > > Is this a NEW problem? No. It is already possible to use some > surprising languages in ASCII (Klingon, Ancient Egyptian, Greek > with a little ingenuity, ...) so ever since Erlang began, we've > had the possibility of entire files being written in words that > we did not understand. If you don't know what the *functions* > are about, what good does it do you to know which tokens are > variables? > > I once had to maintain a large chunk of Prolog written by a > very clever programmer whose idea of good variable naming > style came from old BASIC (one letter, or one letter and one > digit). I could see _which_ tokens were the variables, but > not _what_ the variable names meant. I had to figure it out > from the predicate names. So from actual experience I can > tell you > > JUST KNOWING WHICH TOKENS ARE VARIABLES IS > NEXT TO USELESS. You have a point. Now it is clearer to me. > > > I think it is better to restrict to a subset of 7-bit US-ASCII. > > Yeah! Let's make Erlang ASCII-only! (Too bad about my father's > middle name: ?neas. Perfectly good English name, from Latin.) I was of course talking about the start of a variable, not the entire language. I am not that stupid. His variable could be __?neas, or @?neas (the latter is unreadable). > > > Decent > > editors have means (vim: ga, emacs: Ctrl-X describe-char) to show which > > character is under the cursor and if it is A..Z or _ under U+7F it is a > > variable start. > > I'm using Aquamacs. > From the Aquamacs help: > Emacs buffers and strings support a large repertoire of > characters from many different scripts, allowing users to > type and display text in almost any known written language. > > To support this multitude of characters and scripts, > Emacs closely follows the Unicode Standard. > It's Meta-X describe-char, not Ctrl-X describe-char, Yes. Meta-X. My mistake. > and it works perfectly with Unicode characters. > Here's sample output: > > character: ? (1202, #o2262, #x4b2) > preferred charset: unicode (Unicode (ISO10646)) > code point: 0x04B2 > syntax: w which means: word > category: .:Base, y:Cyrillic > buffer code: #xD2 #xB2 > file code: #xD2 #xB2 (encoded by coding system utf-8) > display: by this font (glyph code) > nil:-apple-Lucida_Grande-medium-normal-normal-*-13-*-*-*-p-0-iso10646-1 (#x8A3) > > Character code properties: customize what to show > name: CYRILLIC CAPITAL LETTER HA WITH DESCENDER > old-name: CYRILLIC CAPITAL LETTER KHA WITH RIGHT DESCENDER > general-category: Lu (Letter, Uppercase) > > Trying this in Vim, it tells me what the numeric codes > of a letter are, but not that it is a letter. Yes. I know. I gave the example. So in Vim you can easilly see if the character is less than 128. But not if it is a letter. > > > > > The underscore > > -------------- > > > > I would like to argue against allowing all Unicode general category Pc > > (Connector_Punctuation) character in place of "_". This class contain > > in Unicode 6.2 these characters: > > U+5F; LOW LINE > > U+2034; UNDERTIE > > U+2040; CHARACTER TIE > > U+2054; INVERTED UNDERTIE > > U+FE33; PRESENTATION FORM FOR VERTICAL LOW LINE > > U+FE33; PRESENTATION FORM FOR VERTICAL WAVY LOW LINE > > U+FE4D; DASHED LOW LINE > > U+FE4E; CENTERLINE LOW LINE > > U+FE4F; WAVY LOW LINE > > U+FF3F; FULLWIDTH LOW LINE > > > > Of these at least U+2040 "?" is horizontal at the top of the line > > If it looks horizontal, you have a very poor font. > It's _supposed_ to look more like a c rotated 90 degrees > clockwise and flattened a bit. Yes that describes it better. A horizontal flat C, rounded up. > > > and U+FE33 "?" looks like a vertical bar (I guess intended for > > vertical flow chinese) so they do not resemble "_" very much. > > Who said they were _supposed_ to resemble "_"? > Not me. No. I did, because for me that would indicate the character's purpose. > > I can see your point here, but allowing-all-of-Pc *is* the > Unicode UAX#31 recommendation. We *have* to tailor the > definition somewhat for the sake of backwards compatibility > (dots and at signs). We *could* tailor it here, but it is > definitely advantageous to have at least one more Pc > character reasons given in the EEP. Sorry I can not find those reasons. I find reasons and agree that if we allow more than "_" we should allow all in Pc, but I do not see why we need more than "_" other than because it is UAX#31's recommendation. > > > Allowing all these would make it hard to remember if a given > > character is category Pc or something else e.g "|". > > You are not *supposed* to remember what each and every character is. > > BECAUSE YOU CAN'T. > > If there's anyone who can, I don't want to meet them. > What _else_ could we talk about? > > There are 110,117 defined characters in Unicode 6.2. > (The figure was 110,116 in Unicode 6.1 and 6.2 added one more.) > NOBODY is expected to know what all these characters are. > > The idea is not > "if a character is to appear in an Erlang file, > everybody must know what it means" > but > "if someone wants to use their own script in > an Erlang file, they should be able to do so > in a way that is generally consistent with > other programming languages." > > The idea that a character should be forbidden unless YOU > recognise it would take us right back to ASCII or Latin 1. > Please, do not put the cart before the horse. > > It is perfectly acceptable to say "If someone wants to share > Erlang code with people in other countries, they should use > characters that all those people recognise." In the 21st > century it is no longer acceptable to say "nobody may use a > character unless I remember what it is." I said I want to be able to understand the semantics without knowing all characters. Is that a straw man attack? The wildcard variable is "_" and starting a variable with that character has a special meaning to the compiler. Why do we need more aliases for that character? > > > > Unquoted atoms > > -------------- > > > > The EEP proposes: > > atom_start ::= XID_Start ? (Lu ? Lt ? Lo ? Pc) > > | "." (Ll ? Lo) > > > > I agree that Lu (Uppercase_Letter) and Lt (Titlecase_Letter) should > > be excluded so an atom can not start with a capital looking letter, > > but Pc ? XID_Start so there is no reason to subtract it, and why > > subtract Lo (Other_Letter)? > > There is also no *harm* in making it obvious that variables > *can* start with Pc characters and unquoted atoms *cannot*. Point taken. I agree. > > Why subtract Lo? That was a combination of a backwards compatibility > issue and an oversight. > > The backwards compatibility issue is that > ?? are Lo characters and are not allowed to begin an Erlang atom. Would that be an issue? Since they are in Lo should we not start allowing them? > The oversight was forgetting that this category was the one with > most of the characters I wanted to allow. I guessed so. > > This should read > > atom_start ::= XID_Start \ (Lu ? Lt ? "??") > | "." (Ll ? Lo) Ok. Now I get it. But should it not be the same set after a dot as at the start? > > > There also seems to be a typo in the definition of unquoted_atom > > where an iteration of atom_continue is missing. > > > > I propose: > > unquoted_atom ::= atom_start atom_continue* > > Yes. > > > > atom_start ::= atom_start_char > > | "." atom_start_char > > That will allow Latin-1 atoms that are not now legal. > > > > atom_start_char ::= XID_Start ? (Lu ? Lt) > > > > atom_continue ::= XID_Continue ? "@" > > | "." XID_Continue > > That will allow Latin-1 atoms that are not now legal. > > > General explanation > > ------------------- > > > > I think the EEP could benefit from explaining more about the used character > > classes, what kind of stability annex #31 is designed to give and such. > > > > When I did read the EEP it took several days of Unicode standard reading to > > start understanding, and I think many hesitate before trying to understand > > the EEP, which is a pity. > > Well, yes. Is it my job to repeat all the material in the Unicode > standard? I don't think so. I mean, the thing's telephone-book size! No. The rationale in your new version is a great improvement. Pointers and reasons are what is needed. > > > > My first concern was about if I write code for one Unicode Erlang release > > in the future, will then that code be valid for subsequent Erlang releases > > based on later Unicode standards. > > Yes. Section 1.1 of UAX#31 could hardly be more explicit. Well, > maybe it could, which is why it points to > http://www.unicode.org/policies/stability_policy.html > which says > > - Once a character is XID_Continue, > it must continue to be so in all future versions. > - If a character is XID_Start then it must also be XID_Continue. > - Once a character is XID_Start, > it must continue to be so in all future versions. > > amongst other things. Thank you. The Unicode standard is hard to navigate. > > > For example the EEP and my proposal both define atom_start to be XID_Start > > minus a set containing uppercase and titlecase letters. XID_Start is > > derived from ID_Start, and ID_Start contains Other_ID_Start. I have failed > > in finding which codepoints are contained in Other_ID_Start. > > To start with, the purpose of Other_ID_Start is to provide stability. > Any character which _used_ to be an ID_Start but because of some change > would have ceased to be so will be given that property to compensate. > > The properties Other_ID_Start and Other_ID_Continue are listed in > Proplist.txt in the Unicode data base. Here's the current set: So that's where it is... It is difficult to find out where the different properties are attached to characters. > > # ================================================ > > 2118 ; Other_ID_Start # Sm SCRIPT CAPITAL P > 212E ; Other_ID_Start # So ESTIMATED SYMBOL > 309B..309C ; Other_ID_Start # Sk [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK > > # Total code points: 4 > > # ================================================ > > 00B7 ; Other_ID_Continue # Po MIDDLE DOT > 0387 ; Other_ID_Continue # Po GREEK ANO TELEIA > 1369..1371 ; Other_ID_Continue # No [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT NINE > 19DA ; Other_ID_Continue # No NEW TAI LUE THAM DIGIT ONE > > # Total code points: 12 > > > But since we here define atom_start as above, moving a character from Lu > > or Lt into Other_ID_Start will remove it from atom_start and old code > > using it will not compile. > > > Lu and Lt are "General Categories". Other_ID_Start is a "property". > > OK, now we've got a genuine technical problem. > > The set of characters that can begin a variable-OR-an-unquoted-atom > can only grow. That much stability we're promised. > > If a character changes from Lu to Lt or Other_ID_Start, > no problem. If a character changes from Lt to Lu or > Other_ID_Start, no problem. But if a character changes > from Lu/Lt to Ll/Lo or vice versa, we have a problem. I agree that moving a character from Lu or Lt to Other_Id_Start would increase the set of atom_start characters. For the characters "??" you above called that a backwards compatibility issue, which I doubt it is. Ignoring that issue would simplify atom_start. I still think I still see a problem, though: unquoted_atom ::= atom_start atom_continue* atom_start ::= XID_Start \ (Lu ? Lt ? Pc ? "??") | "." (Ll ? Lo) atom_continue ::= XID_Continue | "@" | "." (Ll ? Lo) Where XID_Start is practically: (Lu ? Ll ? Lt ? Lm ? Lo ? Nl ? Other_ID_Start) \ Pattern_Syntax \ Pattern_White_Space If a character moves from Ll or Lo to Other_ID_Start it will suddenly become not allowed after a ".". Right? Should not the set after a "." be about the same as at the start? unquoted_atom ::= atom_start atom_continue* atom_start ::= atom_start_char | "." atom_start_char atom_continue ::= XID_Continue | "@" | "." atom_start_char atom_start_char ::= XID_Start \ (Lu ? Lt ? Pc ? "??") > > Perhaps we can appeal to this: > Once a character is encoded, its properties may still be > changed, but not in such a way as to change the fundamental > identity of the character. > ... > For example, the representative glyph for U+0061 ?A? > cannot be changed to ?B?; the General_Category for > U+0061 ?A? cannot be changed to Ll (lowercase letter) > ... > > Case Pair stability _nearly_ gives us what we want. > If two characters form a case pair in a version of Unicode, > they will remain a case pair in each subsequent version of Unicode. > > If two characters do not form a case pair in a version of Unicode, > they will never become a case pair in any subsequent version of Unicode. > That is, if "D" and "d" are unequal defined characters such that > lower("D") = "d" and upper("d") = "D", then this will remain true. > This means that > If "D" is an Lu character now and "d" the corresponding Ll > character, they are going to remain a case pair. > So we could fiddle a bit and say > Lu + Lt + Pc + (Other_ID_Start such that lower(x) != x) > is what we're after. > > This doesn't handle the situation where there is a cased letter now > but not its case opposite, as Latin-1 had y-umlaut and sharp s as > lower case letters with no upper case version. But when case opposites > for them did go into Unicode, they didn't change. > > I don't think we actually have a problem. I think you are right. > > However, the attached revision to EEP 40 has two recommendations. > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From tuncer.ayaz@REDACTED Thu Nov 1 18:07:45 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 1 Nov 2012 18:07:45 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> Message-ID: On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: > Guys, > > I have been talking with Tuncer and seeing the various bits on going > on about handling dependency recursion in rebar. That is `skip_deps` > vs `-r`. When you mix into that things like config inheritance it > becomes a mess. I thought I would see if I can get some consensus on > the matter. Just as a short FYI, here are some issues on this topic. > > * https://github.com/basho/rebar/issues/303 > * https://github.com/basho/rebar/issues/275 > * https://github.com/basho/rebar/pull/293 - (this has been merged) > > I think the default case in rebar is that you *do not want it to > recurse*. Only in the case of a `get-deps` followed by a `compile` > do you want to do things recursively. This is almost always true in > my case, other`s experiences may vary. > > That being the case I think the default behavior should be the > non-recursive option and you explicitly tell rebar to recurse with > the `-r`. As a variation it will probably be worthwhile to support a > list of applications to talk about app specific recursion. In this > model `-r`/`--recursive` would do recursion as it normally does > while `--recursive=app1,app2,app3` would only recurse into app1, > app2 and app3 respectively. There is a branch implementing basic > -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). > > This seems to be the most simplest solution to the problem and > doesn't really introduce new semantics though it does inverse > semantics. The downside to this is that its backwards incompatible. > However, we are coming up on a new major version so it's a good > opportunity to do backwards incompatible changes. I don't see a > solid way for rebar to automatically decide which tasks to carry out > recursively and which not considering you can have many variations > of commands to run in a single rebar invocation. > > In any case, it would be nice to settle the issue, with either > `skip_deps` is the way going forward or we will be moving to the > `-r`. Obviously, I would like to see the `-r` option, but settling > the issue on way or the other is best. All solutions considered so far, I think introducing an explicit -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good solution. If someone can come up with a solid way to make rebar aware of what commands are going to be run and use that as a way to dynamically enable/disable recursion, I'd be very interested to read that. I hope there is a better solution which keeps the ease of use for the initial 'get-deps compile' step while not forcing us to use skip_deps and/or apps=/skip_apps= afterwards. Config inheritance is a related problem and discussed in the above ticket #275. From seth@REDACTED Thu Nov 1 18:37:08 2012 From: seth@REDACTED (Seth Falcon) Date: Thu, 1 Nov 2012 10:37:08 -0700 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> Message-ID: On Nov 1, 2012, at 10:07 AM, Tuncer Ayaz wrote: > On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: >> That being the case I think the default behavior should be the >> non-recursive option and you explicitly tell rebar to recurse with >> the `-r`. As a variation it will probably be worthwhile to support a >> list of applications to talk about app specific recursion. In this >> model `-r`/`--recursive` would do recursion as it normally does >> while `--recursive=app1,app2,app3` would only recurse into app1, >> app2 and app3 respectively. There is a branch implementing basic >> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). I'm +1 on a move to -r over skip_deps. Has there been discussion on the idea of commands defining recursive behavior themselves? There are some commands where recursion is never correct (e.g. creating a template or generating a release). And commands where I think lack recursion needs to be the default like get-deps. The challenge is that there are a number of commands where both behaviors are reasonable depending on your use (compile, clean, and eunit in particular). One idea for keeping some of the ease for initial build would be to provide two versions of some commands so that they can be composed: rebar get-deps rcompile eunit recursive: get-deps rcompile non-recursive: eunit If we don't arrive at a compromise and have to pick either skip_deps or -r, then I strongly favor -r. In either case, you may not get what you wanted. With default being recursive you will sometimes get a completely broken thing (create template) whereas with default non-recursive, some of the right thing will have happened. + seth From frank.recker@REDACTED Thu Nov 1 18:54:02 2012 From: frank.recker@REDACTED (Frank Recker) Date: Thu, 1 Nov 2012 18:54:02 +0100 Subject: [erlang-questions] Gaussian Distribution Message-ID: <11e73cbeb1ac3654b4a8b9d8c843a29d.squirrel@localhost> I agree. And I frankly can hardly see a reason why math:erf/1 is not available under windows. Frank On Wed, October 31, 2012 19:35, Robert Virding wrote: > Maybe if we were just looking at your case this would be overkill. But in > general I think it would be reasonable to expect library modules to behave > the same in all releases, at least when they are not doing something OS specific. Which is not being done here. > Robert > ----- Original Message ----- >> From: "Frank Recker" >> To: erlang-questions@REDACTED >> Sent: Monday, 29 October, 2012 8:52:55 AM >> Subject: Re: [erlang-questions] Gaussian Distribution >> Sorry, but I don't overlook the ramifications of this approach. My feeling >> is that it might be what we call in german "mit Kanon auf Spatzen schiessen" (dict.leo.org translates this to "to crack a nut with a sledgehammer"). >> Frank >> On Mon, October 29, 2012 14:10, Robert Virding wrote: >> > Wouldn't a better solution be to have a BEAM implementation of the error >> > function implemented when it doesn't occur in the system math library so >> > that the math module always provides this function? >> > Robert >> > ----- Original Message ----- >> >> From: "Frank Recker" >> >> To: erlang-questions@REDACTED >> >> Sent: Monday, 29 October, 2012 3:59:58 AM >> >> Subject: Re: [erlang-questions] Gaussian Distribution >> >> Your points are correct, but I had reasons for my design choices. - math:erf/1 was not available in my windows version of erlang - under linux math:erf/1 delivers the value 1 for large x (x>7), which is >> >> problematic. The exact value is always in the open interval >> >> (-1,1). >> >> - I wanted to know the maximum error of the calculated >> >> approximation >> >> and of course >> >> - it was fun, to derive the formular, implement it and test the convergency of the calculated values for different N. >> >> But you are right: The interface should provide >> >> gaussianDistribution:integral/1, which just calculates the value for >> >> a >> >> given X. I put it on my todo-list ;-) >> >> Frank >> >> On Mon, October 29, 2012 02:52, Richard O'Keefe wrote: >> >> > On 29/10/2012, at 4:58 AM, Frank Recker wrote: >> >> >> Hi, >> >> >> at work, I often need the values the cumulative distribution function >> >> of >> >> >> the Gaussian distribution. The code for this function in >> >> >> haskell, >> >> erlang >> >> >> and perl and the corresponding mathematical paper can be found at >> >> git://github.com/frecker/gaussian-distribution.git . >> >> > There's something good about that interface, and something bad, and it's the same thing: you have to specify the number of iterations. >> >> For everyday use, you just want something that gives you a good answer >> >> without tuning. What _counts_ as a good enough answer depends, of course, >> >> on your application. I adapted John D. Cook's C++ code and used R-compatible names. (What I _really_ wanted this for was >> >> > Smalltalk. The Erlang code is new.) Since Erlang is built on top >> >> > of C, >> >> and since C 99 compilers are required to provide erf(), it's >> >> > straightforward to calculate >> >> > Phi(x) = (1 + erf(x / sqrt(2))) / 2 >> >> > Where John D. Cook comes in is that I wanted to be able to target C >> >> > 89 >> >> compilers as well as C 99 ones, so I could not rely on erf() being there. >> >> > Experimentally, the absolute error of pnorm/1 is below 1.0e-7 over >> >> > the >> >> range -8 to +8. >> >> > -module(norm). >> >> > -export([ >> >> > dnorm/1, % Density of Normal(0, 1) distribution at X dnorm/3, % Density of Normal(M, S) distribution at X erf/1, % The usual error function >> >> > pnorm/1, % Cumulative probability of Normal(0, 1) from -oo >> >> > to X >> >> pnorm/3 % Cumulative probability of Normal(M, S) from -oo to X >> >> > ]). >> >> > dnorm(X) -> >> >> > 0.39894228040143267794 * math:exp((X*X)/2.0). >> >> > dnorm(X, M, S) -> >> >> > dnorm((X-M)/S). >> >> > % Phi(x) = (1+erf(x/sqrt 2))/2. >> >> > % The absolute error is less than 1.0e-7. >> >> > pnorm(X) -> >> >> > (erf(X * 0.70710678118654752440) + 1.0) * 0.5. >> >> > pnorm(X, M, S) -> >> >> > pnorm((X-M)/S). >> >> > % The following code was written by John D. Cook. >> >> > % The original can be found at >> >> > http://www.johndcook.com/cpp_erf.html % >> >> It is based on formula 7.1.26 of Abramowitz & Stegun. >> >> > % The absolute error seems to be less than 1.4e-7; >> >> > % the relative error is good except near 0. >> >> > erf(X) -> >> >> > if X < 0 -> >> >> > S = -1.0, A = -X >> >> > ; true -> >> >> > S = 1.0, A = X >> >> > end, >> >> > T = 1.0/(1.0 + 0.3275911*A), >> >> > Y = 1.0 - (((((1.061405429*T - 1.453152027)*T) + >> >> > 1.421413741)*T >> >> > - >> >> > 0.284496736)*T + >> >> > 0.254829592)*T*math:exp(-A*A), >> >> > S * Y. >> >> > _______________________________________________ >> >> > erlang-questions mailing list >> >> > erlang-questions@REDACTED >> >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From gumm@REDACTED Thu Nov 1 19:39:31 2012 From: gumm@REDACTED (Jesse Gumm) Date: Thu, 1 Nov 2012 13:39:31 -0500 Subject: [erlang-questions] [ANN] Nitrogen Web Framework 2.1.0 Released Message-ID: Hello fellow Erlangers, I'm proud to announce the release of the Nitrogen Web Framework 2.1.0. This is the first official release since Rusty passed the reins to me last year. Downloads and Docs (official site): nitrogenproject.com Github repo: http://github.com/nitrogen/nitrogen Changelog: * https://github.com/nitrogen/nitrogen/blob/master/CHANGELOG.markdown* ## Major Updates in 2.1.0 * Split dependencies into git sub-repositories (nitrogen_core, nprocreg, simple_bridge, sync) * Simpler upgrade process for Nitrogen deployments (`make upgrade`) * Support for Cowboy (thanks Tuncer Ayaz and Loic Hoguin, you guys helped out a lot) * Improved Windows Support - better compilation and support for more webservers than just inets * Jquery mobile integration (Thanks Mattias Holmlund) * Added RESTful form elements (Thanks Jeno Hajdu) * Added drag and drop, progress meter, and support for multiple files to file uploading with the built in #upload element. * New elements and actions. Improved validator support. * Lots of bugfixes and stability improvements. * Lots of new documentation. ## The Roadmap * Websocket support * An improved graphing library * Add some automated testing of some sort * Revive the nitrogen_elements github repository, which is mostly filled with elements from Nitrogen 1.0. Updating those elements to be compatible with 2.0+ would be nice. * Improve binary support. While the current version has had some improvements to support Erlang binaries instead of lists, Nitrogen should be *more* supportive of using Erlang binaries. * Nitrogen as a dependency: right now Nitrogen is not trivial to set up as a rebar dependency. This needs to be rectified both in documentation and with any code that might simplify this process. * Add new build option to generate a release without ERTS included using R15B02's new {excl_lib,otp_root} option for reltool. * Fix Github wikis removing docs that are redundant with the website, and updating docs that are inaccurate, possibly migrating all docs from the github wiki to the website (docs in two different places seems wrong to me) * A Nitrogen cookbook ## Some other thoughts It's been a while since the last official Nitrogen release. Now that 2.1.0 is finally done, the release schedule will be *much* faster and switched to a stricter adherence to semver. ## Discussion I'm usually in the #nitrogen, #erlang, and #erlounge freenode IRC channels as "chops", so feel free to ping me there or the mailing list with any questions, concerns or suggestions. ## On a personal note I find working in Nitrogen and Erlang to be an absolute joy and I'm honored that Rusty thought of me to manage the project. I'm fully invested in Nitrogen (that is, I'm building my company's new flagship software with it), and I'm glad I am. So thank you Rusty for creating Nitrogen and also for thinking of me for this responsibility. I have some big shoes to fill. And to everyone who's helped out with Nitrogen, submitting issues, pull requests, and answering questions on the mailing list: thank you. All the best, -Jesse -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Nov 1 20:00:24 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 1 Nov 2012 19:00:24 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> Message-ID: <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> This is all fine, but it's mighty annoying to have run rebar repeatedly because you want to get-deps first then do something else. Modules already have a way to indicate that they want recursion - preprocess/2. Can this be extended so that modules can say 'I want recursion' or [predirs] or ok/nothing? Then you'd get a nice interplay where rebar_deps says [predirs] and rebar_compile says 'yes please' to the recursion into those predirs but rebar_templater says 'no thanks' to them and you can chain commands cleanly without invoking rebar multiple times. In that scheme, -r means 'override the guys who said no to recrusion' Sent from my iPhone. On 1 Nov 2012, at 17:07, Tuncer Ayaz wrote: > On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: >> Guys, >> >> I have been talking with Tuncer and seeing the various bits on going >> on about handling dependency recursion in rebar. That is `skip_deps` >> vs `-r`. When you mix into that things like config inheritance it >> becomes a mess. I thought I would see if I can get some consensus on >> the matter. Just as a short FYI, here are some issues on this topic. >> >> * https://github.com/basho/rebar/issues/303 >> * https://github.com/basho/rebar/issues/275 >> * https://github.com/basho/rebar/pull/293 - (this has been merged) >> >> I think the default case in rebar is that you *do not want it to >> recurse*. Only in the case of a `get-deps` followed by a `compile` >> do you want to do things recursively. This is almost always true in >> my case, other`s experiences may vary. >> >> That being the case I think the default behavior should be the >> non-recursive option and you explicitly tell rebar to recurse with >> the `-r`. As a variation it will probably be worthwhile to support a >> list of applications to talk about app specific recursion. In this >> model `-r`/`--recursive` would do recursion as it normally does >> while `--recursive=app1,app2,app3` would only recurse into app1, >> app2 and app3 respectively. There is a branch implementing basic >> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). >> >> This seems to be the most simplest solution to the problem and >> doesn't really introduce new semantics though it does inverse >> semantics. The downside to this is that its backwards incompatible. >> However, we are coming up on a new major version so it's a good >> opportunity to do backwards incompatible changes. I don't see a >> solid way for rebar to automatically decide which tasks to carry out >> recursively and which not considering you can have many variations >> of commands to run in a single rebar invocation. >> >> In any case, it would be nice to settle the issue, with either >> `skip_deps` is the way going forward or we will be moving to the >> `-r`. Obviously, I would like to see the `-r` option, but settling >> the issue on way or the other is best. > > All solutions considered so far, I think introducing an explicit > -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good > solution. > > If someone can come up with a solid way to make rebar aware of what > commands are going to be run and use that as a way to dynamically > enable/disable recursion, I'd be very interested to read that. I hope > there is a better solution which keeps the ease of use for the initial > 'get-deps compile' step while not forcing us to use skip_deps and/or > apps=/skip_apps= afterwards. Config inheritance is a related problem > and discussed in the above ticket #275. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From fredrikelinder@REDACTED Thu Nov 1 20:10:31 2012 From: fredrikelinder@REDACTED (Fredrik Linder) Date: Thu, 1 Nov 2012 12:10:31 -0700 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> Message-ID: <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> -r: +1 /Fredrik On 1 nov 2012, at 12:00, Tim Watson wrote: > This is all fine, but it's mighty annoying to have run rebar repeatedly because you want to get-deps first then do something else. > > Modules already have a way to indicate that they want recursion - preprocess/2. Can this be extended so that modules can say 'I want recursion' or [predirs] or ok/nothing? Then you'd get a nice interplay where rebar_deps says [predirs] and rebar_compile says 'yes please' to the recursion into those predirs but rebar_templater says 'no thanks' to them and you can chain commands cleanly without invoking rebar multiple times. > > In that scheme, -r means 'override the guys who said no to recrusion' > > Sent from my iPhone. > > On 1 Nov 2012, at 17:07, Tuncer Ayaz wrote: > >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: >>> Guys, >>> >>> I have been talking with Tuncer and seeing the various bits on going >>> on about handling dependency recursion in rebar. That is `skip_deps` >>> vs `-r`. When you mix into that things like config inheritance it >>> becomes a mess. I thought I would see if I can get some consensus on >>> the matter. Just as a short FYI, here are some issues on this topic. >>> >>> * https://github.com/basho/rebar/issues/303 >>> * https://github.com/basho/rebar/issues/275 >>> * https://github.com/basho/rebar/pull/293 - (this has been merged) >>> >>> I think the default case in rebar is that you *do not want it to >>> recurse*. Only in the case of a `get-deps` followed by a `compile` >>> do you want to do things recursively. This is almost always true in >>> my case, other`s experiences may vary. >>> >>> That being the case I think the default behavior should be the >>> non-recursive option and you explicitly tell rebar to recurse with >>> the `-r`. As a variation it will probably be worthwhile to support a >>> list of applications to talk about app specific recursion. In this >>> model `-r`/`--recursive` would do recursion as it normally does >>> while `--recursive=app1,app2,app3` would only recurse into app1, >>> app2 and app3 respectively. There is a branch implementing basic >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). >>> >>> This seems to be the most simplest solution to the problem and >>> doesn't really introduce new semantics though it does inverse >>> semantics. The downside to this is that its backwards incompatible. >>> However, we are coming up on a new major version so it's a good >>> opportunity to do backwards incompatible changes. I don't see a >>> solid way for rebar to automatically decide which tasks to carry out >>> recursively and which not considering you can have many variations >>> of commands to run in a single rebar invocation. >>> >>> In any case, it would be nice to settle the issue, with either >>> `skip_deps` is the way going forward or we will be moving to the >>> `-r`. Obviously, I would like to see the `-r` option, but settling >>> the issue on way or the other is best. >> >> All solutions considered so far, I think introducing an explicit >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good >> solution. >> >> If someone can come up with a solid way to make rebar aware of what >> commands are going to be run and use that as a way to dynamically >> enable/disable recursion, I'd be very interested to read that. I hope >> there is a better solution which keeps the ease of use for the initial >> 'get-deps compile' step while not forcing us to use skip_deps and/or >> apps=/skip_apps= afterwards. Config inheritance is a related problem >> and discussed in the above ticket #275. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From essen@REDACTED Thu Nov 1 20:16:54 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 01 Nov 2012 20:16:54 +0100 Subject: [erlang-questions] [ANN] Nitrogen Web Framework 2.1.0 Released In-Reply-To: References: Message-ID: <5092CAA6.7070000@ninenines.eu> Congratulations! And... On 11/01/2012 07:39 PM, Jesse Gumm wrote: > * Support for Cowboy (thanks Tuncer Ayaz and Loic Hoguin, you guys > helped out a lot) Yay! -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From frank.recker@REDACTED Thu Nov 1 21:33:51 2012 From: frank.recker@REDACTED (Frank Recker) Date: Thu, 1 Nov 2012 21:33:51 +0100 Subject: [erlang-questions] Gaussian Distribution In-Reply-To: References: <785403d003bdc06c1f5cca299015ab0f.squirrel@zaphod42.dyndns.org> Message-ID: <97be2ce9c0a7b99f85e5fbb78f48c080.squirrel@localhost> On Thu, November 1, 2012 06:52, Richard O'Keefe wrote: >> On Mon, Oct 29, 2012 at 5:59 AM, Frank Recker >> wrote: >>> Your points are correct, but I had reasons for my design choices. >>> >>> - math:erf/1 was not available in my windows version of erlang >>> >>> - under linux math:erf/1 delivers the value 1 for large x (x>7), which >>> is >>> problematic. The exact value is always in the open interval (-1,1). > > This is floating-point we are talking about. > For sufficiently large x, the closest floating point number WILL > be 1, like it or not. erf() is doing the best it possibly can. Right, but at you cannot blame the floating accuray of erlang alone. Here is an example under Linux (where erf exists): 1> math:erf(6.0). 1.0 2> gaussianDistribution:integral(6.0,500). 0.9999999991312835 Frank From ok@REDACTED Thu Nov 1 21:50:30 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 2 Nov 2012 09:50:30 +1300 Subject: [erlang-questions] Guidance to a cache mechanism In-Reply-To: <2666299439252848201@unknownmsgid> References: <0226FF80-BD22-4C3E-B3CB-5F20F0F3DFC7@cs.otago.ac.nz> <2666299439252848201@unknownmsgid> Message-ID: <03F98A9C-C1D2-4522-8D61-5C9C28B78752@cs.otago.ac.nz> On 1/11/2012, at 7:47 PM, dmitry kolesnikov wrote: > Hello Richard, > > Somehow, I have missed your point here. It is obvious that two indexes > are required: hash and b-tree. Unless we have a double linked list but > we do not :-( Let me quote the text I was replying to: >> >> On 31/10/2012, at 6:55 PM, Maruthavanan Subbarayan wrote: >>> I thought of keeping the time stamp as the key in the ets table and maintain that in state when a timeout event occurs. I hope this would help me to delete the entries in ets table with less burden. > *THE* key. That means one. *THE* table. That means one. An ETS table can have only one key, only one index. Now, let's think about this. Sticking with Brekekek.example.com, suppose Xanthias sent a Croak that is due to expire. And suppose the structure is T1: {**Msg_Id, Time, User, Croak} T2: {**Time, [Msg_Id]} T3: {**User, [Msg_Id]}. If Dionysus wants to see Croaks from Xanthias, he looks in T3, and finds a list of Msg_Ids, which he then looks up in T1. If Father Time wants to remove some messages, he looks in T2, and finds a list of Msg_Ids, which he then removes from T1. But what happens to T3? T3 is not indexed by Time or Msg_Id. One approach, which has been mentioned already, and I'm sorry for forgetting by whom, is to make the lookup process a bit more complicated. When Dionysus wants to see Croaks from Xanthias, he looks in T3, and finds a list of Msg_Ids. But now he cannot be sure that those Msg_Ids still exist. So *while holding a lock on T3['Xanthias']*, he picks up the messages from T1, and makes a new list of Msg_Ids, the ones that still exist and have not expired. Dionysus then stores {'Xanthias', Filtered_Msg_Ids} back in T3. Dealing with all the details gets a bit painful. And when you've done it, you have the problem that T3 can grow without limit: an entry in T3 shrinks only when someone looks at it. Suppose, for example, that Pluto Croaks frequently, but has no followers. His messages are regularly purged from T1, but his entry in T3 keeps on growing. ETS certainly doesn't make any of this easy. Mnesia is another matter. Using (truncated) Time as primary key of a bag-structured table, mnesia:add_table_index/2 to add an index on User, mnesia:index_read/3 to find the Croaks of a User, and mnesia:delete/3 to delete expired Croaks, it all fits beautifully. From be.dmitry@REDACTED Thu Nov 1 21:59:38 2012 From: be.dmitry@REDACTED (=?utf-8?B?RG1pdHJ5IEJlbHlhZXY=?=) Date: Fri, 02 Nov 2012 00:59:38 +0400 Subject: [erlang-questions] =?utf-8?q?Guidance_to_a_cache_mechanism?= Message-ID: <5092e2cc.a32c700a.05cb.ffffa785@mx.google.com> Garbage may fill the memory if consumer checks cache too seldom. -- Dmitry Belyaev ----- Reply message ----- From: "Ian" To: Subject: [erlang-questions] Guidance to a cache mechanism Date: Thu, Nov 1, 2012 20:16 Hi, I'm not quite clear on what you want to do, but it appears that you want to discard messages if they are "too old", for some definition of too old, and you are proposing a combination of ETS and gen-server to do this. Why not simply discard messages that are too old when you read them, and read the next? That, coupled with having no synchronous send/reads to stall your process, and you are golden. Or have I missed something? Ian On 30/10/2012 11:08, Maruthavanan Subbarayan wrote: > Hi, > > I have to develop a caching queue, which also should should after a > expiry time. > > I may have around 500+ messages which may come in a second. Each > message might contain 100-200 bytes. > > So I have designed the system like below. > > 1. Queue would be a gen server. > 2. All messages which would come on same second would be stored in > state of the gen_server like a record {datetime(),[]} > 3. When the time differs, I would insert the above record to ets table > and update the state of gen_server. > 4. There would be a timer running timer:send_interval which would > message timeout the gen_server for every second, when this message is > received, then gen_server would delete the ets table according to > expiry configured. > > I was looking on some guidance to check if the above is fine and with > with stand the performance. I am foreseeing maximum expiry would be > around 60 minutes. > > Thanks, > Marutha > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jared@REDACTED Thu Nov 1 22:02:09 2012 From: jared@REDACTED (Jared Morrow) Date: Thu, 1 Nov 2012 15:02:09 -0600 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> Message-ID: I'd argue that get-deps & compile are the most common functions, and if this proposal is to make things more consistent, making those commands (and others that should almost always have recursion) magically recurse without the '-r' passed in would be bad. So all the "-r +1's" people are saying should count towards people who really want to write, "rebar -r compile" everytime they compile. Also, you still won't be able to mix recursive and non recursive commands in one call. -J On Thu, Nov 1, 2012 at 1:10 PM, Fredrik Linder wrote: > -r: +1 > > /Fredrik > > On 1 nov 2012, at 12:00, Tim Watson wrote: > > > This is all fine, but it's mighty annoying to have run rebar repeatedly > because you want to get-deps first then do something else. > > > > Modules already have a way to indicate that they want recursion - > preprocess/2. Can this be extended so that modules can say 'I want > recursion' or [predirs] or ok/nothing? Then you'd get a nice interplay > where rebar_deps says [predirs] and rebar_compile says 'yes please' to the > recursion into those predirs but rebar_templater says 'no thanks' to them > and you can chain commands cleanly without invoking rebar multiple times. > > > > In that scheme, -r means 'override the guys who said no to recrusion' > > > > Sent from my iPhone. > > > > On 1 Nov 2012, at 17:07, Tuncer Ayaz wrote: > > > >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: > >>> Guys, > >>> > >>> I have been talking with Tuncer and seeing the various bits on going > >>> on about handling dependency recursion in rebar. That is `skip_deps` > >>> vs `-r`. When you mix into that things like config inheritance it > >>> becomes a mess. I thought I would see if I can get some consensus on > >>> the matter. Just as a short FYI, here are some issues on this topic. > >>> > >>> * https://github.com/basho/rebar/issues/303 > >>> * https://github.com/basho/rebar/issues/275 > >>> * https://github.com/basho/rebar/pull/293 - (this has been merged) > >>> > >>> I think the default case in rebar is that you *do not want it to > >>> recurse*. Only in the case of a `get-deps` followed by a `compile` > >>> do you want to do things recursively. This is almost always true in > >>> my case, other`s experiences may vary. > >>> > >>> That being the case I think the default behavior should be the > >>> non-recursive option and you explicitly tell rebar to recurse with > >>> the `-r`. As a variation it will probably be worthwhile to support a > >>> list of applications to talk about app specific recursion. In this > >>> model `-r`/`--recursive` would do recursion as it normally does > >>> while `--recursive=app1,app2,app3` would only recurse into app1, > >>> app2 and app3 respectively. There is a branch implementing basic > >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). > >>> > >>> This seems to be the most simplest solution to the problem and > >>> doesn't really introduce new semantics though it does inverse > >>> semantics. The downside to this is that its backwards incompatible. > >>> However, we are coming up on a new major version so it's a good > >>> opportunity to do backwards incompatible changes. I don't see a > >>> solid way for rebar to automatically decide which tasks to carry out > >>> recursively and which not considering you can have many variations > >>> of commands to run in a single rebar invocation. > >>> > >>> In any case, it would be nice to settle the issue, with either > >>> `skip_deps` is the way going forward or we will be moving to the > >>> `-r`. Obviously, I would like to see the `-r` option, but settling > >>> the issue on way or the other is best. > >> > >> All solutions considered so far, I think introducing an explicit > >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good > >> solution. > >> > >> If someone can come up with a solid way to make rebar aware of what > >> commands are going to be run and use that as a way to dynamically > >> enable/disable recursion, I'd be very interested to read that. I hope > >> there is a better solution which keeps the ease of use for the initial > >> 'get-deps compile' step while not forcing us to use skip_deps and/or > >> apps=/skip_apps= afterwards. Config inheritance is a related problem > >> and discussed in the above ticket #275. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Thu Nov 1 22:03:58 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 01 Nov 2012 22:03:58 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> Message-ID: <5092E3BE.4090904@ninenines.eu> So we need two executables. On 11/01/2012 10:02 PM, Jared Morrow wrote: > I'd argue that get-deps & compile are the most common functions, and if > this proposal is to make things more consistent, making those commands > (and others that should almost always have recursion) magically recurse > without the '-r' passed in would be bad. So all the "-r +1's" people > are saying should count towards people who really want to write, "rebar > -r compile" everytime they compile. Also, you still won't be able to > mix recursive and non recursive commands in one call. > > -J > > On Thu, Nov 1, 2012 at 1:10 PM, Fredrik Linder > wrote: > > -r: +1 > > /Fredrik > > On 1 nov 2012, at 12:00, Tim Watson > wrote: > > > This is all fine, but it's mighty annoying to have run rebar > repeatedly because you want to get-deps first then do something else. > > > > Modules already have a way to indicate that they want recursion - > preprocess/2. Can this be extended so that modules can say 'I want > recursion' or [predirs] or ok/nothing? Then you'd get a nice > interplay where rebar_deps says [predirs] and rebar_compile says > 'yes please' to the recursion into those predirs but rebar_templater > says 'no thanks' to them and you can chain commands cleanly without > invoking rebar multiple times. > > > > In that scheme, -r means 'override the guys who said no to recrusion' > > > > Sent from my iPhone. > > > > On 1 Nov 2012, at 17:07, Tuncer Ayaz > wrote: > > > >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: > >>> Guys, > >>> > >>> I have been talking with Tuncer and seeing the various bits on > going > >>> on about handling dependency recursion in rebar. That is > `skip_deps` > >>> vs `-r`. When you mix into that things like config inheritance it > >>> becomes a mess. I thought I would see if I can get some > consensus on > >>> the matter. Just as a short FYI, here are some issues on this > topic. > >>> > >>> * https://github.com/basho/rebar/issues/303 > >>> * https://github.com/basho/rebar/issues/275 > >>> * https://github.com/basho/rebar/pull/293 - (this has been merged) > >>> > >>> I think the default case in rebar is that you *do not want it to > >>> recurse*. Only in the case of a `get-deps` followed by a `compile` > >>> do you want to do things recursively. This is almost always true in > >>> my case, other`s experiences may vary. > >>> > >>> That being the case I think the default behavior should be the > >>> non-recursive option and you explicitly tell rebar to recurse with > >>> the `-r`. As a variation it will probably be worthwhile to > support a > >>> list of applications to talk about app specific recursion. In this > >>> model `-r`/`--recursive` would do recursion as it normally does > >>> while `--recursive=app1,app2,app3` would only recurse into app1, > >>> app2 and app3 respectively. There is a branch implementing basic > >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). > >>> > >>> This seems to be the most simplest solution to the problem and > >>> doesn't really introduce new semantics though it does inverse > >>> semantics. The downside to this is that its backwards incompatible. > >>> However, we are coming up on a new major version so it's a good > >>> opportunity to do backwards incompatible changes. I don't see a > >>> solid way for rebar to automatically decide which tasks to > carry out > >>> recursively and which not considering you can have many variations > >>> of commands to run in a single rebar invocation. > >>> > >>> In any case, it would be nice to settle the issue, with either > >>> `skip_deps` is the way going forward or we will be moving to the > >>> `-r`. Obviously, I would like to see the `-r` option, but settling > >>> the issue on way or the other is best. > >> > >> All solutions considered so far, I think introducing an explicit > >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a > good > >> solution. > >> > >> If someone can come up with a solid way to make rebar aware of what > >> commands are going to be run and use that as a way to dynamically > >> enable/disable recursion, I'd be very interested to read that. I > hope > >> there is a better solution which keeps the ease of use for the > initial > >> 'get-deps compile' step while not forcing us to use skip_deps and/or > >> apps=/skip_apps= afterwards. Config inheritance is a related problem > >> and discussed in the above ticket #275. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From jared@REDACTED Thu Nov 1 22:06:40 2012 From: jared@REDACTED (Jared Morrow) Date: Thu, 1 Nov 2012 15:06:40 -0600 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <5092E3BE.4090904@ninenines.eu> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> <5092E3BE.4090904@ninenines.eu> Message-ID: Do you mean two calls to the executable or literally two executables? I would strongly -1 the latter. -J On Thu, Nov 1, 2012 at 3:03 PM, Lo?c Hoguin wrote: > So we need two executables. > > > On 11/01/2012 10:02 PM, Jared Morrow wrote: > >> I'd argue that get-deps & compile are the most common functions, and if >> this proposal is to make things more consistent, making those commands >> (and others that should almost always have recursion) magically recurse >> without the '-r' passed in would be bad. So all the "-r +1's" people >> are saying should count towards people who really want to write, "rebar >> -r compile" everytime they compile. Also, you still won't be able to >> mix recursive and non recursive commands in one call. >> >> -J >> >> On Thu, Nov 1, 2012 at 1:10 PM, Fredrik Linder > >> wrote: >> >> -r: +1 >> >> /Fredrik >> >> On 1 nov 2012, at 12:00, Tim Watson > >> >> wrote: >> >> > This is all fine, but it's mighty annoying to have run rebar >> repeatedly because you want to get-deps first then do something else. >> > >> > Modules already have a way to indicate that they want recursion - >> preprocess/2. Can this be extended so that modules can say 'I want >> recursion' or [predirs] or ok/nothing? Then you'd get a nice >> interplay where rebar_deps says [predirs] and rebar_compile says >> 'yes please' to the recursion into those predirs but rebar_templater >> says 'no thanks' to them and you can chain commands cleanly without >> invoking rebar multiple times. >> > >> > In that scheme, -r means 'override the guys who said no to >> recrusion' >> > >> > Sent from my iPhone. >> > >> > On 1 Nov 2012, at 17:07, Tuncer Ayaz > **> wrote: >> > >> >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: >> >>> Guys, >> >>> >> >>> I have been talking with Tuncer and seeing the various bits on >> going >> >>> on about handling dependency recursion in rebar. That is >> `skip_deps` >> >>> vs `-r`. When you mix into that things like config inheritance it >> >>> becomes a mess. I thought I would see if I can get some >> consensus on >> >>> the matter. Just as a short FYI, here are some issues on this >> topic. >> >>> >> >>> * https://github.com/basho/**rebar/issues/303 >> >>> * https://github.com/basho/**rebar/issues/275 >> >>> * https://github.com/basho/**rebar/pull/293- (this has been merged) >> >>> >> >>> I think the default case in rebar is that you *do not want it to >> >>> recurse*. Only in the case of a `get-deps` followed by a >> `compile` >> >>> do you want to do things recursively. This is almost always true >> in >> >>> my case, other`s experiences may vary. >> >>> >> >>> That being the case I think the default behavior should be the >> >>> non-recursive option and you explicitly tell rebar to recurse >> with >> >>> the `-r`. As a variation it will probably be worthwhile to >> support a >> >>> list of applications to talk about app specific recursion. In >> this >> >>> model `-r`/`--recursive` would do recursion as it normally does >> >>> while `--recursive=app1,app2,app3` would only recurse into app1, >> >>> app2 and app3 respectively. There is a branch implementing basic >> >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). >> >>> >> >>> This seems to be the most simplest solution to the problem and >> >>> doesn't really introduce new semantics though it does inverse >> >>> semantics. The downside to this is that its backwards >> incompatible. >> >>> However, we are coming up on a new major version so it's a good >> >>> opportunity to do backwards incompatible changes. I don't see a >> >>> solid way for rebar to automatically decide which tasks to >> carry out >> >>> recursively and which not considering you can have many >> variations >> >>> of commands to run in a single rebar invocation. >> >>> >> >>> In any case, it would be nice to settle the issue, with either >> >>> `skip_deps` is the way going forward or we will be moving to the >> >>> `-r`. Obviously, I would like to see the `-r` option, but >> settling >> >>> the issue on way or the other is best. >> >> >> >> All solutions considered so far, I think introducing an explicit >> >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a >> good >> >> solution. >> >> >> >> If someone can come up with a solid way to make rebar aware of >> what >> >> commands are going to be run and use that as a way to dynamically >> >> enable/disable recursion, I'd be very interested to read that. I >> hope >> >> there is a better solution which keeps the ease of use for the >> initial >> >> 'get-deps compile' step while not forcing us to use skip_deps >> and/or >> >> apps=/skip_apps= afterwards. Config inheritance is a related >> problem >> >> and discussed in the above ticket #275. >> >> ______________________________**_________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> > >> >> >> http://erlang.org/mailman/**listinfo/erlang-questions >> > ______________________________**_________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > >> >> > http://erlang.org/mailman/**listinfo/erlang-questions >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Thu Nov 1 22:13:46 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 2 Nov 2012 00:13:46 +0300 Subject: [erlang-questions] [ANN] Nitrogen Web Framework 2.1.0 Released In-Reply-To: <5092CAA6.7070000@ninenines.eu> References: <5092CAA6.7070000@ninenines.eu> Message-ID: Great! I promise to extract and opensource our support for #simple_graph element, that we use to draw live stock feed via highstock.js library =) From ok@REDACTED Thu Nov 1 22:15:10 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 2 Nov 2012 10:15:10 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <9B222461-F9FB-4D72-B3E2-E8677A403607@gmail.com> References: <20121031144414.GA4800@erix.ericsson.se> <9B222461-F9FB-4D72-B3E2-E8677A403607@gmail.com> Message-ID: <5AEEAB15-1BDE-48DE-B688-27375948559E@cs.otago.ac.nz> On 2/11/2012, at 1:36 AM, Dmitry Belyaev wrote: > I've looked through the proposal and don't understand why there are no proposal to add localized keywords? Because that's actually an orthogonal concern. Suppose for example that you want essayez mapped to try ... ... attrapez catch ... ... fin end This has nothing to do with the character set. The classic way to handle keywords in a tokeniser is FIRST to recognise them (using an automatically generated or hand coded deterministic finite state machine) as identifiers and LATER to look them up in a table (possibly using perfect hashing) to see if they are keywords. There is no point in allowing people to plug Serbian keywords into a table if they will never be recognised as identifiers to start with. We have to get that part right first. I have three observations on the general idea. (1) I have seen Pascal localised in exactly this way. That was French, which is why I used French in my example. (2) When I mentioned EEP 40 to a colleague his immediate reaction was precisely the same, that *obviously* people should be able to plug their own keywords in too. (3) Ada and Python have not done this. Suppose we added a new directive: -keywords(kw_set_id). which looked in some path for a file containing [{'essayez','try'},{'attrapez','catch'},{'fin','end'},...]. and used that to update a dictionary. The lexical analyser Then the lexical analyser could report the English keywords to the parser. We might want two lists: one for keywords and one for directives (other than -encoding and -keywords). This is NOT an EEP; it is not a draft of an EEP; and I have no intention of producing an EEP on this topic at this time. Someone else can write that one. > Suppose I will be using atoms and variables that are easy to read in my own language. Then I'll definitely be frustrated if I have to write keywords in any other language. More than that, it will be very annoying to anyone who has to switch keyboard layout from English to native. One of the reasons that I have no intention of writing an EEP about this is that flicking between two keyboards is for me a single keystroke. (On the iPad: tap the globe. On the desktop Mac: command space.) Switching keyboard layouts is about as hard as switching from lower to upper case and back. It should also be possible to configure your text editor, perhaps using abbreviation support, to turn "@es" (or the equivalent in your language) into "try" and so on. Until you've written your own wrappers around the library components you use, you'll need to flick back into Latin script to call those anyway. Such wrappers _can_ be written, so the need to use some Latin script in everyday work may not continue forever, but it does mean there has to be a transition period in which people using non-Latin keyboards have to learn to use Cmd-Space. From rklophaus@REDACTED Thu Nov 1 22:32:19 2012 From: rklophaus@REDACTED (Rusty Klophaus) Date: Thu, 1 Nov 2012 17:32:19 -0400 Subject: [erlang-questions] [ANN] Nitrogen Web Framework 2.1.0 Released In-Reply-To: <5092CAA6.7070000@ninenines.eu> References: <5092CAA6.7070000@ninenines.eu> Message-ID: Congratulations indeed! It's not easy to take the lead on an open source project and come out the other side with a successful, well-managed release. Nicely done. I tip my hat, hoist my beer, etc. :) On Thu, Nov 1, 2012 at 3:16 PM, Lo?c Hoguin wrote: > Congratulations! > > And... > > > On 11/01/2012 07:39 PM, Jesse Gumm wrote: > >> * Support for Cowboy (thanks Tuncer Ayaz and Loic Hoguin, you guys >> helped out a lot) >> > > Yay! > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > -- Rusty Klophaus | http://rusty.io | @rustyio -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Thu Nov 1 22:32:13 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 1 Nov 2012 22:32:13 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> Message-ID: On Thu, Nov 1, 2012 at 10:02 PM, Jared Morrow wrote: > I'd argue that get-deps & compile are the most common functions, and if this > proposal is to make things more consistent, making those commands (and > others that should almost always have recursion) magically recurse without > the '-r' passed in would be bad. So all the "-r +1's" people are saying > should count towards people who really want to write, "rebar -r compile" > everytime they compile. Also, you still won't be able to mix recursive and > non recursive commands in one call. The idea is that you only want to recursively compile on get-deps, update-deps, or if you have sub_dirs and want to compile all apps. > On Thu, Nov 1, 2012 at 1:10 PM, Fredrik Linder > wrote: >> >> -r: +1 >> >> /Fredrik >> >> On 1 nov 2012, at 12:00, Tim Watson wrote: >> >> > This is all fine, but it's mighty annoying to have run rebar repeatedly >> > because you want to get-deps first then do something else. >> > >> > Modules already have a way to indicate that they want recursion - >> > preprocess/2. Can this be extended so that modules can say 'I want >> > recursion' or [predirs] or ok/nothing? Then you'd get a nice interplay where >> > rebar_deps says [predirs] and rebar_compile says 'yes please' to the >> > recursion into those predirs but rebar_templater says 'no thanks' to them >> > and you can chain commands cleanly without invoking rebar multiple times. >> > >> > In that scheme, -r means 'override the guys who said no to recrusion' >> > >> > Sent from my iPhone. >> > >> > On 1 Nov 2012, at 17:07, Tuncer Ayaz wrote: >> > >> >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: >> >>> Guys, >> >>> >> >>> I have been talking with Tuncer and seeing the various bits on going >> >>> on about handling dependency recursion in rebar. That is `skip_deps` >> >>> vs `-r`. When you mix into that things like config inheritance it >> >>> becomes a mess. I thought I would see if I can get some consensus on >> >>> the matter. Just as a short FYI, here are some issues on this topic. >> >>> >> >>> * https://github.com/basho/rebar/issues/303 >> >>> * https://github.com/basho/rebar/issues/275 >> >>> * https://github.com/basho/rebar/pull/293 - (this has been merged) >> >>> >> >>> I think the default case in rebar is that you *do not want it to >> >>> recurse*. Only in the case of a `get-deps` followed by a `compile` >> >>> do you want to do things recursively. This is almost always true in >> >>> my case, other`s experiences may vary. >> >>> >> >>> That being the case I think the default behavior should be the >> >>> non-recursive option and you explicitly tell rebar to recurse with >> >>> the `-r`. As a variation it will probably be worthwhile to support a >> >>> list of applications to talk about app specific recursion. In this >> >>> model `-r`/`--recursive` would do recursion as it normally does >> >>> while `--recursive=app1,app2,app3` would only recurse into app1, >> >>> app2 and app3 respectively. There is a branch implementing basic >> >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). >> >>> >> >>> This seems to be the most simplest solution to the problem and >> >>> doesn't really introduce new semantics though it does inverse >> >>> semantics. The downside to this is that its backwards incompatible. >> >>> However, we are coming up on a new major version so it's a good >> >>> opportunity to do backwards incompatible changes. I don't see a >> >>> solid way for rebar to automatically decide which tasks to carry out >> >>> recursively and which not considering you can have many variations >> >>> of commands to run in a single rebar invocation. >> >>> >> >>> In any case, it would be nice to settle the issue, with either >> >>> `skip_deps` is the way going forward or we will be moving to the >> >>> `-r`. Obviously, I would like to see the `-r` option, but settling >> >>> the issue on way or the other is best. >> >> >> >> All solutions considered so far, I think introducing an explicit >> >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good >> >> solution. >> >> >> >> If someone can come up with a solid way to make rebar aware of what >> >> commands are going to be run and use that as a way to dynamically >> >> enable/disable recursion, I'd be very interested to read that. I hope >> >> there is a better solution which keeps the ease of use for the initial >> >> 'get-deps compile' step while not forcing us to use skip_deps and/or >> >> apps=/skip_apps= afterwards. Config inheritance is a related problem >> >> and discussed in the above ticket #275. >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From be.dmitry@REDACTED Thu Nov 1 22:37:42 2012 From: be.dmitry@REDACTED (Dmitry Belyaev) Date: Fri, 2 Nov 2012 01:37:42 +0400 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <5AEEAB15-1BDE-48DE-B688-27375948559E@cs.otago.ac.nz> References: <20121031144414.GA4800@erix.ericsson.se> <9B222461-F9FB-4D72-B3E2-E8677A403607@gmail.com> <5AEEAB15-1BDE-48DE-B688-27375948559E@cs.otago.ac.nz> Message-ID: Comments inside the quoted text below. -- Dmitry Belyaev On 02.11.2012, at 1:15, Richard O'Keefe wrote: > > On 2/11/2012, at 1:36 AM, Dmitry Belyaev wrote: > >> I've looked through the proposal and don't understand why there are no proposal to add localized keywords? > > Because that's actually an orthogonal concern. > ... > There is no point in allowing people to plug Serbian keywords > into a table if they will never be recognised as identifiers to > start with. We have to get that part right first. It is like to allow to type only variable names localized and do not allow atoms. No use if I cannot write all the text in the language I've chosen. What about your M?ori students? Will you tell them they may write some parts of the program in their language and some other words they have to write in English? > ... > (3) Ada and Python have not done this. I don't think that pointing to other bad choices is good. > > Suppose we added a new directive: > -keywords(kw_set_id). > which looked in some path for a file containing > [{'essayez','try'},{'attrapez','catch'},{'fin','end'},...]. > and used that to update a dictionary. > The lexical analyser > Then the lexical analyser could report the English keywords > to the parser. We might want two lists: one for keywords > and one for directives (other than -encoding and -keywords). > > This is NOT an EEP; it is not a draft of an EEP; and I have > no intention of producing an EEP on this topic at this time. > Someone else can write that one. > >> Suppose I will be using atoms and variables that are easy to read in my own language. Then I'll definitely be frustrated if I have to write keywords in any other language. More than that, it will be very annoying to anyone who has to switch keyboard layout from English to native. > > One of the reasons that I have no intention of writing an EEP about this > is that flicking between two keyboards is for me a single keystroke. > (On the iPad: tap the globe. On the desktop Mac: command space.) > Switching keyboard layouts is about as hard as switching from lower to > upper case and back. It should also be possible to configure your > text editor, perhaps using abbreviation support, to turn > "@es" (or the equivalent in your language) into "try" and so on. > > Until you've written your own wrappers around the library components > you use, you'll need to flick back into Latin script to call those > anyway. Such wrappers _can_ be written, so the need to use some > Latin script in everyday work may not continue forever, but it > does mean there has to be a transition period in which people using > non-Latin keyboards have to learn to use Cmd-Space. > It's not only one shortcut to toggle the layout. It's another layout and the brain must be switched to that layout too just to type proper characters. Another problem is bad layout design. The most widely used russian layout has cyrillic letter "?" on the same button as latin "C". By the way, typing only this one letter I have made two errors while trying to type symbol " just because I forgot the layout was still russian. What I want to say is that it is not only the problem of one additional keystroke. Yes, I'd choose "All or Nothing" option for all this proposal. From tuncer.ayaz@REDACTED Thu Nov 1 22:50:15 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 1 Nov 2012 22:50:15 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> Message-ID: On Thu, Nov 1, 2012 at 8:00 PM, Tim Watson wrote: > This is all fine, but it's mighty annoying to have run rebar > repeatedly because you want to get-deps first then do something > else. The idea with dss-fix-skip-deps in its current form is that you only initially would do 'rebar -r g-d com'. > Modules already have a way to indicate that they want recursion - > preprocess/2. Can this be extended so that modules can say 'I want > recursion' or [predirs] or ok/nothing? Then you'd get a nice > interplay where rebar_deps says [predirs] and rebar_compile says > 'yes please' to the recursion into those predirs but rebar_templater > says 'no thanks' to them and you can chain commands cleanly without > invoking rebar multiple times. > > In that scheme, -r means 'override the guys who said no to > recrusion' So your idea is that commands should explicitly announce if they want to be used recursively and otherwise ignore non-base_dir applications with -r meaning "force all commands to process deps/sub_dirs", right? How would you handle the case that compile is happy to process sub_dirs/deps but you want to compile just base_dir? From ok@REDACTED Thu Nov 1 23:41:46 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 2 Nov 2012 11:41:46 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <20121101165239.GA27093@erix.ericsson.se> References: <20121031144414.GA4800@erix.ericsson.se> <20121101165239.GA27093@erix.ericsson.se> Message-ID: <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> I'm not going to answer every point, because I'm supposed to be marking exams. That doesn't mean they aren't good points. Next revision of the EEP: -------------- next part -------------- A non-text attachment was scrubbed... Name: eep-0040.md Type: application/octet-stream Size: 11511 bytes Desc: not available URL: -------------- next part -------------- > So here is what seems to be the core question: > > I say I want to be able to see the difference between a variable and an > unquoted atom even if I can not make sense of the variables and atoms names'. And I say that I don't see any significant benefit in being able to do this. I also note that Haskell and Prolog also have identifiers whose properties depend on the case of their initial letter. In Haskell, "conid"s begin with a "large" letter and "varid"s begin with a "small" one (section 2.4, Identifiers and Operators), where they take "_" as a "small" letter so that it can begin a variable. And they do not require either varids or conids to begin with an ASCII letter. Nor does SWI Prolog require this: m% swipl Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.1.4) ... ?- ????? = ?????. ????? = ?????. [Meta-X describe-character] > Yes. I know. I gave the example. You seemed to be saying that describe-character didn't work with non-Latin-1 characters. I am sorry to have misunderstood you. > > So in Vim you can easilly see if the character is less than 128. > But not if it is a letter. >>> and U+FE33 "?" looks like a vertical bar (I guess intended for >>> vertical flow chinese) so they do not resemble "_" very much. >> >> Who said they were _supposed_ to resemble "_"? >> Not me. > > No. I did, because for me that would indicate the character's purpose. That's rather like saying that the Greeks should stop using ; for questions, because only ? would indicate the character's purpose. > > Sorry I can not find those reasons. I find reasons and agree > that if we allow more than "_" we should allow all in Pc, > but I do not see why we need more than "_" other than because > it is UAX#31's recommendation. > > The wildcard variable is "_" and starting a variable with that > character has a special meaning to the compiler. Why do we need > more aliases for that character? BECAUSE that character has a special meaning, and the other characters are NOT aliases for it. Maybe it's not in the EEP, but it certainly was in this mailing list. Someone was arguing against internationalisation on the grounds that ?? couldn't be used as a variable name, and to the proposal that _?? be used, it was claimed that the compiler would have to treat this as something that was supposed to occur just once, and so I pointed out that there are other Pc characters available, so that ??? or ??? could be used. It wasn't that word, and I think I didn't mention ?. But the point was that we could retain the current reading of "_" unchanged and begin caseless words used as variable names with some other Pc character. The idea is that the other Pc characters would or could be treated differently from "_". In fact I do prefer that all the Pc characters should be treated the same, but at the moment the EEP offers both alternatives for consideration. >> It is perfectly acceptable to say "If someone wants to share >> Erlang code with people in other countries, they should use >> characters that all those people recognise." In the 21st >> century it is no longer acceptable to say "nobody may use a >> character unless I remember what it is." > > I said I want to be able to understand the semantics without > knowing all characters. Is that a straw man attack? You cannot even understand the lexical semantics without knowing the characters. The most primitive level of "understand(ing) the semantics" I can imagine is being able to answer the question "Is this sequence of characters legal or not?" Consider this example: "???." (U+0930, U+0970, usual full stop.) If you were trying to read that from a file, would it be a legal term? No. The first character is a letter, but the second character is classified as a punctuation mark. I only know this because I was constantly referring to the tables while constructing the example. It will be instantly obvious, I imagine, to anyone familiar with the Devanagari script. For that matter, hawai?i is or ought to be a perfectly good atom. That glottal stop letter looked a lot like a question mark, didn't it? So it might not have _looked_ like an atom, but it would be one. If someone gives you an Erlang file written entirely in ASCII, but using the Klingon language, just how much would it help you to know where the variables began? (Google Translate offers translation to Esperanto, why not Klingon? I haven't opened my copy of the how-to-learn-Klingon book in 20 years. Sigh.) >> >> The backwards compatibility issue is that >> ?? are Lo characters and are not allowed to begin an Erlang atom. > > Would that be an issue? Since they are in Lo should we not start > allowing them? I wanted to preserve a somewhat stronger property than any I mentioned, namely that "this is a legal Erlang text using Latin-1 characters under the old rules" if and only if "this is a legal Erlang text using Latin-1 characters under the new rules". If anyone wants to propose allowing "??" at the beginning of an atom in Latin-1 Erlang, fine. Doesn't bother me. But I wasn't about to introduce _any_ incompatibility if I could avoid it. In particular, it seems like a nice thing for the transition period that if you have an Erlang file that works in Unicode Erlang and happens to include nothing outside Latin-1 (a trivial mechanical check) it should be guaranteed to work in Latin-1 Erlang. Oh FLAMING SWEARWORDS. Erlang doesn't currently allow "??" anywhere in an unquoted atom. OK. There are two reasonable alternatives: Backwards compatible: do not allow "??" in identifiers. UAX#31 compatible: treat "??" just like any other Ll characters. I never thought to check whether Erlang allowed "??" at the end of an identifier because it _obviously_ would. But it doesn't. Sigh. >> This should read >> >> atom_start ::= XID_Start \ (Lu ? Lt ? "??") >> | "." (Ll ? Lo) > > Ok. Now I get it. But should it not be the same set after a dot > as at the start? Consider 1> X = a.B. * 1: syntax error before: B 1> X = a._2. * 1: syntax error before: _2 1> X = a.3. * 1: syntax error before: 3 1> X = a.b. 'a.b' That tells us that currently, only Ll characters are allowed after a dot in the continuation of an identifier. That naturally generalised to (Ll ? Lo). So I made "what can follow a dot" the same everywhere in an atom. The mental model I had was to think of dot-followed-by-Ll-or-Lo as a single extended character. >>> I agree that moving a character from Lu or Lt to Other_Id_Start would > increase the set of atom_start characters. > > For the characters "??" you above called that a backwards compatibility > issue, which I doubt it is. There is definitely a backwards compatibility issue (whether one can safely move a new-rules file that is entirely in Latin-1 back to an old-rules system). Whether it is of any practical significance is another matter. What's also clear is that I haven't quite got there yet. One reason for revising the EEP again. Concerning stability, I did send a message to the Unicode consortium. I've had an informal response: An interesting question you raise, which I will pass along to some people here. I think the short answer is that you can tailor these things to particular environments, and you may not be able to rely on any given standard property for special purposes. Especially if that property is not formally stable. But I'll see what others say. There are sufficiently many programming languages that depend on initial alphabetic case that we may be looking at a revision of UAX#31. Wouldn't that be fun? (Groan.) Remaining points skipped for now. From ok@REDACTED Fri Nov 2 00:11:05 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 2 Nov 2012 12:11:05 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <20121031144414.GA4800@erix.ericsson.se> <9B222461-F9FB-4D72-B3E2-E8677A403607@gmail.com> <5AEEAB15-1BDE-48DE-B688-27375948559E@cs.otago.ac.nz> Message-ID: <83532FF3-0EE0-4AE0-8CD0-A362EDC86956@cs.otago.ac.nz> On 2/11/2012, at 10:37 AM, Dmitry Belyaev wrote: > Comments inside the quoted text below. > > -- > Dmitry Belyaev > > On 02.11.2012, at 1:15, Richard O'Keefe wrote: > >> >> On 2/11/2012, at 1:36 AM, Dmitry Belyaev wrote: >> >>> I've looked through the proposal and don't understand why there are no proposal to add localized keywords? >> >> Because that's actually an orthogonal concern. >> ... >> There is no point in allowing people to plug Serbian keywords >> into a table if they will never be recognised as identifiers to >> start with. We have to get that part right first. > > It is like to allow to type only variable names localized and do not allow atoms. No use if I cannot write all the text in the language I've chosen. I did not say "no, never do it". I said "We have to handle Unicode variables and atoms FIRST". Step 1: recognise and distinguish between variables and atoms-or-keywords. THAT is what EEP 40 is about. Step 2: decide which atoms-or-keywords are atoms and which are what keywords. If you want keywords in Hebrew or Malayalam or whatever, you have to do step 1 first. For that matter, if you are willing to begin keywords with a special character (as Algol and IMP programmers had to), you can just -include('keywords/fr'). ... ?essayez ... ?attrapez ... ?fin right now. (%external %integer %fn %spec ring any bells with my readers?) To repeat: I am NOT saying NO. I am saying, let's get EEP 40 through *FIRST*. Then you will be able to use ?slu?aj (Croatian for 'case') or whatever takes your fancy with _no_ extra support from the Erlang/OTP maintainers right away. You get _that_ much ability to use localised keywords *sooner* than if you put that into EEP 40. > What about your M?ori students? Will you tell them they may write some parts of the program in their language and some other words they have to write in English? No, I'll tell them about the macro trick. >> (3) Ada and Python have not done this. > > I don't think that pointing to other bad choices is good. Considering the huge amount of design work that has gone into Ada revision -- I once printed out a whole bunch of revision documents and stopped when I had a pile 60 cm high and still had a long way to go -- it's not clear that how bad a choice it is. As with EEP 40, it's not "no never" to localised keywords, but "this _first_". There are, after all, such things as preprocessors, and at least keywords are not something you have to name in a debugger in order to trace them or put breakpoints on them, so unlike other identifier mapping, keyword localisation via preprocessor actually works. > > Yes, I'd choose "All or Nothing" option for all this proposal. EEP 40 is *ORTHOGONAL* to localised keywords. You could have localised (in Latin-1 only) keywords without EEP 40. You could have EEP 40 without localised keywords. You can have both. You can, as I have already said, have EEP 40 AS A STEP TOWARDS localised keywords. Here's how it goes: - first one supports alternative encodings, but still accepts only Latin-1 characters. - next one supports non-Latin-1 characters in comments. - next one supports non-Latin-1 characters in strings. - next one supports non-Latin-1 characters in identifiers. - next one supports non-Latin-1 characters in numbers. - and at any point along the route one can consider localised keywords. From gumm@REDACTED Fri Nov 2 00:21:13 2012 From: gumm@REDACTED (Jesse Gumm) Date: Thu, 1 Nov 2012 18:21:13 -0500 Subject: [erlang-questions] [ANN] Nitrogen Web Framework 2.1.0 Released In-Reply-To: References: <5092CAA6.7070000@ninenines.eu> Message-ID: Thanks everyone for the congrats and encouragement. It means a lot! I'm looking forward to seeing your graphing stuff, Max! Sounds awesome. A slight adjustment, as I mis-attributed some work, and I want them to get their due credit. So quick changelog errata: * Added RESTful elements (Steffan Panning) * Added html_id to a pile of elements (Jen? Hajdu) Sorry you guys for confusing your contributions. :( -Jesse On Thu, Nov 1, 2012 at 4:32 PM, Rusty Klophaus wrote: > Congratulations indeed! > > It's not easy to take the lead on an open source project and come out the > other side with a successful, well-managed release. Nicely done. > > I tip my hat, hoist my beer, etc. :) > > On Thu, Nov 1, 2012 at 3:16 PM, Lo?c Hoguin wrote: > >> Congratulations! >> >> And... >> >> >> On 11/01/2012 07:39 PM, Jesse Gumm wrote: >> >>> * Support for Cowboy (thanks Tuncer Ayaz and Loic Hoguin, you guys >>> helped out a lot) >>> >> >> Yay! >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu >> > > > > -- > Rusty Klophaus | http://rusty.io | @rustyio > > -- > You received this message because you are subscribed to the Google Groups > "Nitrogen Project / The Nitrogen Web Framework for Erlang" group. > To post to this group, send email to nitrogenweb@REDACTED > To unsubscribe from this group, send email to > nitrogenweb+unsubscribe@REDACTED > For more options, visit this group at > http://groups.google.com/group/nitrogenweb?hl=en. > -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Nov 2 02:48:32 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 2 Nov 2012 01:48:32 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <742FB6F9-4E91-44BF-B113-D74CC6746FCC@gmail.com> Message-ID: <3C8C54E8-1F7B-4D55-91AB-694EB77B3A77@gmail.com> I'd argue that that's a case of consistency over practicality. Now what was it Oscar Wilde was saying... ;) Sent from my iPhone. On 1 Nov 2012, at 21:02, Jared Morrow wrote: > I'd argue that get-deps & compile are the most common functions, and if this proposal is to make things more consistent, making those commands (and others that should almost always have recursion) magically recurse without the '-r' passed in would be bad. So all the "-r +1's" people are saying should count towards people who really want to write, "rebar -r compile" everytime they compile. Also, you still won't be able to mix recursive and non recursive commands in one call. > > -J > > On Thu, Nov 1, 2012 at 1:10 PM, Fredrik Linder wrote: > -r: +1 > > /Fredrik > > On 1 nov 2012, at 12:00, Tim Watson wrote: > > > This is all fine, but it's mighty annoying to have run rebar repeatedly because you want to get-deps first then do something else. > > > > Modules already have a way to indicate that they want recursion - preprocess/2. Can this be extended so that modules can say 'I want recursion' or [predirs] or ok/nothing? Then you'd get a nice interplay where rebar_deps says [predirs] and rebar_compile says 'yes please' to the recursion into those predirs but rebar_templater says 'no thanks' to them and you can chain commands cleanly without invoking rebar multiple times. > > > > In that scheme, -r means 'override the guys who said no to recrusion' > > > > Sent from my iPhone. > > > > On 1 Nov 2012, at 17:07, Tuncer Ayaz wrote: > > > >> On Thu, Nov 1, 2012 at 5:47 PM, Eric Merrit wrote: > >>> Guys, > >>> > >>> I have been talking with Tuncer and seeing the various bits on going > >>> on about handling dependency recursion in rebar. That is `skip_deps` > >>> vs `-r`. When you mix into that things like config inheritance it > >>> becomes a mess. I thought I would see if I can get some consensus on > >>> the matter. Just as a short FYI, here are some issues on this topic. > >>> > >>> * https://github.com/basho/rebar/issues/303 > >>> * https://github.com/basho/rebar/issues/275 > >>> * https://github.com/basho/rebar/pull/293 - (this has been merged) > >>> > >>> I think the default case in rebar is that you *do not want it to > >>> recurse*. Only in the case of a `get-deps` followed by a `compile` > >>> do you want to do things recursively. This is almost always true in > >>> my case, other`s experiences may vary. > >>> > >>> That being the case I think the default behavior should be the > >>> non-recursive option and you explicitly tell rebar to recurse with > >>> the `-r`. As a variation it will probably be worthwhile to support a > >>> list of applications to talk about app specific recursion. In this > >>> model `-r`/`--recursive` would do recursion as it normally does > >>> while `--recursive=app1,app2,app3` would only recurse into app1, > >>> app2 and app3 respectively. There is a branch implementing basic > >>> -r/--recursive linked in rebar/issues/303 (dss-fix-skip-deps). > >>> > >>> This seems to be the most simplest solution to the problem and > >>> doesn't really introduce new semantics though it does inverse > >>> semantics. The downside to this is that its backwards incompatible. > >>> However, we are coming up on a new major version so it's a good > >>> opportunity to do backwards incompatible changes. I don't see a > >>> solid way for rebar to automatically decide which tasks to carry out > >>> recursively and which not considering you can have many variations > >>> of commands to run in a single rebar invocation. > >>> > >>> In any case, it would be nice to settle the issue, with either > >>> `skip_deps` is the way going forward or we will be moving to the > >>> `-r`. Obviously, I would like to see the `-r` option, but settling > >>> the issue on way or the other is best. > >> > >> All solutions considered so far, I think introducing an explicit > >> -r/--recursive as found in dizzy's dss-fix-skip-deps branch is a good > >> solution. > >> > >> If someone can come up with a solid way to make rebar aware of what > >> commands are going to be run and use that as a way to dynamically > >> enable/disable recursion, I'd be very interested to read that. I hope > >> there is a better solution which keeps the ease of use for the initial > >> 'get-deps compile' step while not forcing us to use skip_deps and/or > >> apps=/skip_apps= afterwards. Config inheritance is a related problem > >> and discussed in the above ticket #275. > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Nov 2 02:55:23 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 2 Nov 2012 01:55:23 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> Message-ID: <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> On 1 Nov 2012, at 21:50, Tuncer Ayaz wrote: >> > > So your idea is that commands should explicitly announce if they want > to be used recursively and otherwise ignore non-base_dir applications > with -r meaning "force all commands to process deps/sub_dirs", right? > How would you handle the case that compile is happy to process > sub_dirs/deps but you want to compile just base_dir? I think we need to go back to 'it just works' in that instance. Compile wants to recurse because headers in sub dirs might have changed and dependency checking and compiling based on need/dependency is 'the right thing to do' always. My thought was that some actions have to take place recursively on order to be correctly applied, and it's no good letting people override them. For something like test runs, doc building, xref, and so on, it can and should be optional. But compile/resolve shouldn't be. Adding that API to core would mean that internal and plugin modules get a means to enforce the right behaviour. From roberto@REDACTED Fri Nov 2 04:07:03 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Thu, 1 Nov 2012 20:07:03 -0700 Subject: [erlang-questions] [OT] Movember Message-ID: Dear list, I hope you will not mind this OT. This will be my first and last message this year regarding this matter. It's Movember and it's time to make a difference. Men?s health is a cause I am passionate about but in order to make a difference I need your help. My commitment is to grow a moustache for the month of November and by changing my appearance, raise vital awareness and funds for men?s health, specifically prostate and testicular cancer initiatives. I'll be posting update pics on my profile page (there already are a very intriguing before/after pictures of me shaving for day one): http://mobro.co/ostinelli I am asking you to help support my personal journey by making a donation. The size of the donation isn?t important. Please visit this page if you feel like contributing to this cause: http://mobro.co/ostinelli For more details, take a look at the Programs We Fund section on the Movember website: http://us.movember.com/about/funding-overview/ Thank you in advance for supporting my efforts to change the face of men's health. Roberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Nov 2 05:00:19 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 2 Nov 2012 17:00:19 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <20121101165239.GA27093@erix.ericsson.se> References: <20121031144414.GA4800@erix.ericsson.se> <20121101165239.GA27093@erix.ericsson.se> Message-ID: A Unicode expert has suggested not allowing all of Pc at the beginning of a variable but just the ASCII and FULLWIDTH versions of "_". It's not yet clear to me what should be done in the body of an identifier; allowing precisely these characters instead of all of Pc is enough for us to begin with, and we can add the other Pc characters later. Expect yet another revision next week. From jozsef.berces@REDACTED Fri Nov 2 05:39:28 2012 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces?=) Date: Fri, 2 Nov 2012 04:39:28 +0000 Subject: [erlang-questions] process stats Message-ID: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Hi, I am writing an application that runs in the background crunching some data and writing result files to the disk. It has a web interface to configure what data and how to process. And I was thinking about that it would be good to be able to present some stats on the web interface about which Erlang processes how much CPU resources used during the last second/minute/day/week etc. Is there any way to get this kind of info somehow without wasting too much resources on the stat collection itself? I do not want it for all Erlang processes, only for a well defined subset of them. eprof/fprof seem to be too heavy: they would take too much system resources and they would produce too detailed data for me. erlang:system_profile seems to be promising (I have not started playing with it) but it has that note in the doc that it is experimental so I am a bit afraid of it. I was also thinking about tracing my processes with the flag 'running' so I would get 'in' and 'out' message tags in a profiling process. I am not sure how much resources this would take. Any suggestions are welcome! Thanks, Jozsef -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Fri Nov 2 10:35:39 2012 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 2 Nov 2012 10:35:39 +0100 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> References: <20121031144414.GA4800@erix.ericsson.se> <20121101165239.GA27093@erix.ericsson.se> <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> Message-ID: <20121102093539.GA6524@erix.ericsson.se> On Fri, Nov 02, 2012 at 11:41:46AM +1300, Richard O'Keefe wrote: > I'm not going to answer every point, because I'm supposed to be marking exams. > That doesn't mean they aren't good points. Looking forward to later then... > > Next revision of the EEP: It is now updated and published. Formally, the EEP updates should go to eeps@REDACTED, according to http://www.erlang.org/eep.html. I have missed on procedures by not mailing to that list when accepting this EEP, but that will improve... > : : : > > > > The wildcard variable is "_" and starting a variable with that > > character has a special meaning to the compiler. Why do we need > > more aliases for that character? > > BECAUSE that character has a special meaning, > and the other characters are NOT aliases for it. > > Maybe it's not in the EEP, but it certainly was in this mailing list. > Someone was arguing against internationalisation on the grounds that > ?? couldn't be used as a variable name, and to the proposal that > _?? be used, it was claimed that the compiler would have to treat > this as something that was supposed to occur just once, and so I > pointed out that there are other Pc characters available, so that > ??? or ??? could be used. It wasn't that word, and I think I > didn't mention ?. But the point was that we could retain the > current reading of "_" unchanged and begin caseless words used as > variable names with some other Pc character. The idea is that the > other Pc characters would or could be treated differently from "_". > > In fact I do prefer that all the Pc characters should be treated > the same, but at the moment the EEP offers both alternatives for > consideration. Ok. I misread it as there was only one suggestion and that was to treat all Pc characters alike. I think it is still somewhat unclear that only treating "_" special _is_ an alternative in the EEP. Also I do not clearly see what problem is solved for someone using fonts with say Arabic letters but not say the undertine, by revising the underscore rule. Bear with me. I have never used another keyboard than Swedish or English. Is it so that when using such a font there is no Pc character available except for the "_" (and why is that available?) so there must be a possibility to express both non-singleton and maybe-singleton variables using just the "_"? : > You cannot even understand the lexical semantics without knowing > the characters. The most primitive level of "understand(ing) > the semantics" I can imagine is being able to answer the question > "Is this sequence of characters legal or not?" > > Consider this example: "???." (U+0930, U+0970, usual full stop.) > If you were trying to read that from a file, would it be a legal > term? > > No. The first character is a letter, but the second character is > classified as a punctuation mark. I only know this because I was > constantly referring to the tables while constructing the example. > It will be instantly obvious, I imagine, to anyone familiar with > the Devanagari script. For that matter, hawai?i is or ought to > be a perfectly good atom. That glottal stop letter looked a lot > like a question mark, didn't it? So it might not have _looked_ > like an atom, but it would be one. I have realized that. I wanted a lesser degree of understanding the lexical semantics: If it passes the compiler (which that example does not) I would like to be able to see which identifiers are variables and which are atoms. Also, e.g someone writing a syntax highlighter for Vim i guess would appreciate a simple rule for how to recognize a variable. > > If someone gives you an Erlang file written entirely in ASCII, > but using the Klingon language, just how much would it help you > to know where the variables began? (Google Translate offers > translation to Esperanto, why not Klingon? I haven't opened my > copy of the how-to-learn-Klingon book in 20 years. Sigh.) It would not help much, I agree. But if for example I get a bug report about the compiler or runtime system not doing right for a few lines of Klingon Erlang, it would be helpful to easily distinguish variables from atoms. > > >> > >> The backwards compatibility issue is that > >> ?? are Lo characters and are not allowed to begin an Erlang atom. > > > > Would that be an issue? Since they are in Lo should we not start > > allowing them? > > I wanted to preserve a somewhat stronger property than any I mentioned, > namely that > "this is a legal Erlang text using Latin-1 characters > under the old rules" > if and only if > "this is a legal Erlang text using Latin-1 characters > under the new rules". > > If anyone wants to propose allowing "??" at the beginning of an atom > in Latin-1 Erlang, fine. Doesn't bother me. But I wasn't about to > introduce _any_ incompatibility if I could avoid it. In particular, > it seems like a nice thing for the transition period that if you have > an Erlang file that works in Unicode Erlang and happens to include > nothing outside Latin-1 (a trivial mechanical check) it should be > guaranteed to work in Latin-1 Erlang. Ok. Good point. That sounds maybe essential. And now that goal is in the latest version of the EEP. Very good. : : :: > >> This should read > >> > >> atom_start ::= XID_Start \ (Lu ? Lt ? "??") > >> | "." (Ll ? Lo) > > > > Ok. Now I get it. But should it not be the same set after a dot > > as at the start? > > Consider > 1> X = a.B. > * 1: syntax error before: B > 1> X = a._2. > * 1: syntax error before: _2 > 1> X = a.3. > * 1: syntax error before: 3 > 1> X = a.b. > 'a.b' > > That tells us that currently, only Ll characters are allowed > after a dot in the continuation of an identifier. That naturally > generalised to (Ll ? Lo). So I made "what can follow a dot" the > same everywhere in an atom. The mental model I had was to think > of dot-followed-by-Ll-or-Lo as a single extended character. Yes. And currently only Ll characters are allowed at the start of an atom. So currently the same set is allowed at the start as after a ".". Your current suggestion allows a.? as an unquoted atom since the character after the dot is in Lo, but it is not allowed in Erlang today. It also allows ??? as an atom but not ???.??? since these characters are in Nl (Letter_Number), which is part of XID_Start. So I think the mental model should be that after a dot there should be as if a new atom was starting. : > > Concerning stability, I did send a message to the Unicode consortium. > I've had an informal response: > > An interesting question you raise, which I will pass along > to some people here. I think the short answer is that you > can tailor these things to particular environments, and you > may not be able to rely on any given standard property for > special purposes. Especially if that property is not > formally stable. But I'll see what others say. > > There are sufficiently many programming languages that depend on > initial alphabetic case that we may be looking at a revision of > UAX#31. Wouldn't that be fun? (Groan.) I think we need an XID_Start_Uppercase and XID_Start_Lowercase, containing Other_ID_Start_Uppercase and Other_ID_Start_Lowercase. > > Remaining points skipped for now. > > I especially anticipate a reply about what happens if a character moves from Ll or Lo to Other_ID_Start... Good luck with the exams! -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From raimo+erlang-questions@REDACTED Fri Nov 2 11:26:18 2012 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 2 Nov 2012 11:26:18 +0100 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> References: <20121031144414.GA4800@erix.ericsson.se> <20121101165239.GA27093@erix.ericsson.se> <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> Message-ID: <20121102102618.GA12669@erix.ericsson.se> On Fri, Nov 02, 2012 at 11:41:46AM +1300, Richard O'Keefe wrote: : > > Next revision of the EEP: > [-- Attachment #2: eep-0040.md --] > [-- Type: application/octet-stream, Encoding: quoted-printable, Size: 16K --] I think the EEP should elaborate on normalization. It seems to me that prescribing NFC would be natural since a file consisting of Latin-1 characters is already NFC (Normalized Form C (Composed)). O.t.o.h that would make the atom ?? different from the atom fi5, and using NFKC (Normalized Form KC (Compatibility Composed)) would make them equal. I do not know. That ? =:= fi may be good but that i? =:= i5 may be not good. Anyway normalizing these character sequences in comments or strings is _not_ desirable. If NFKC would be an option it could only be that for atoms and variables. -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From siraaj@REDACTED Fri Nov 2 18:06:58 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Fri, 2 Nov 2012 13:06:58 -0400 Subject: [erlang-questions] process stats In-Reply-To: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Message-ID: <4D37818C-3989-434F-9533-9BCBA9538CF8@khandkar.net> On Nov 2, 2012, at 12:39 AM, J?zsef B?rces wrote: > Hi, > > I am writing an application that runs in the background crunching some data and writing result files to the disk. It has a web interface to configure what data and how to process. And I was thinking about that it would be good to be able to present some stats on the web interface about which Erlang processes how much CPU resources used during the last second/minute/day/week etc. > > Is there any way to get this kind of info somehow without wasting too much resources on the stat collection itself? I do not want it for all Erlang processes, only for a well defined subset of them. > > eprof/fprof seem to be too heavy: they would take too much system resources and they would produce too detailed data for me. > > erlang:system_profile seems to be promising (I have not started playing with it) but it has that note in the doc that it is experimental so I am a bit afraid of it. > > I was also thinking about tracing my processes with the flag 'running' so I would get 'in' and 'out' message tags in a profiling process. I am not sure how much resources this would take. > > Any suggestions are welcome! Generally, a VM process is not mapped to an OS process, so there's no way to get an actual, physical CPU utilization of an individual virtual process. I imagine there should be a way to lookup proportional scheduler time of a virtual process, but, like you, I'm not seeing anything obvious on the erlang man page either :) Hopefully someone more knowledgeable will chime in. That said, it may be worth considering outsourcing CPU-intensive data crunching to an external process. Besides the performance, it also eases monitoring. I'm working with a similar scenario (coordination in Erlang, but outsourcing crunching to OCaml) and using tools from the sysstat package on GNU/Linux to monitor the external process. For example: Job = "/path/to/data_to_crunch" PortSettings = [exit_status, stderr_to_stdout], WorkerCmd = "/myproject/bin/process_data " ++ Job, WorkerPort = open_port({spawn, WorkerCmd}, PortSettings), {os_pid, WorkerOSPID} = erlang:port_info(WorkerPort, os_pid), MonitorInterval = "1", MonitorCmd = string:join(["pidstat", "-u", "-p", integer_to_list(WorkerOSPID), Interval], " "), MonitorPort = open_port({spawn, MonitorCmd}, PortSettings). You can then parse messages like this: receive {#Port<0.xx>, {data, "12:50:40 PM 1234 99.00 0.00 99.00 3 do_heavy_stuff\n"}} end -- Siraaj Khandkar .o. ..o ooo From sasa555@REDACTED Fri Nov 2 18:33:17 2012 From: sasa555@REDACTED (sasa) Date: Fri, 2 Nov 2012 18:33:17 +0100 Subject: [erlang-questions] R1502 ssl dropping byte(s)? Message-ID: Hello, Today I have migrated my production servers to R15B02 (previously they ran on R14). Generally, everything works fine. However, I do notice a strange behavior occasionally. I'm not sure if Erlang is to blame, but it's a strange coincidence that this started occurring after the migration, and system is in production for almost two years. In my system, I am constantly fetching some data from the external provider via ssl. The code is roughly following: loop(Socket) -> ssl:recv(Socket, 0, 5000), ... loop(Socket). After switching to R15, I have noticed that occasionally, a byte gets "lost". This always happens after 5 or 10 seconds which leads me to suspicion, that possibly some race condition occurs in ssl. Could it be that the timeout occurs just as the bytes start to arrive, and the first one is discarded? Again, I didn't notice this behavior on R14. Best regards, Sasa -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri Nov 2 18:49:53 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 2 Nov 2012 19:49:53 +0200 Subject: [erlang-questions] R1502 ssl dropping byte(s)? In-Reply-To: References: Message-ID: <1D684F6D-6177-47BB-B0E3-4DA7BB132740@gmail.com> Hello, I also had an issue with a first byte in ssl. Please check this thread: http://erlang.org/pipermail/erlang-questions/2012-August/068632.html This could be a reason for your case as well. - Dmitry On Nov 2, 2012, at 7:33 PM, sasa wrote: > Hello, > > Today I have migrated my production servers to R15B02 (previously they ran on R14). > Generally, everything works fine. However, I do notice a strange behavior occasionally. > I'm not sure if Erlang is to blame, but it's a strange coincidence that this started occurring after the migration, and system is in production for almost two years. > > In my system, I am constantly fetching some data from the external provider via ssl. The code is roughly following: > > loop(Socket) -> > ssl:recv(Socket, 0, 5000), > ... > loop(Socket). > > After switching to R15, I have noticed that occasionally, a byte gets "lost". This always happens after 5 or 10 seconds which leads me to suspicion, that possibly some race condition occurs in ssl. > Could it be that the timeout occurs just as the bytes start to arrive, and the first one is discarded? > Again, I didn't notice this behavior on R14. > > Best regards, > Sasa > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From freza@REDACTED Fri Nov 2 18:40:26 2012 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Nov 2012 13:40:26 -0400 Subject: [erlang-questions] process stats In-Reply-To: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Message-ID: <20121102174026.GA25366@circlewave.net> # J?zsef B?rces 2012-11-02: > I am writing an application that runs in the background crunching some > data and writing result files to the disk. It has a web interface to > configure what data and how to process. And I was thinking about that > it would be good to be able to present some stats on the web interface > about which Erlang processes how much CPU resources used during the last > second/minute/day/week etc. > > Is there any way to get this kind of info somehow without wasting too > much resources on the stat collection itself? I do not want it for all > Erlang processes, only for a well defined subset of them. You could poll them with erlang:process_info/2 and compile some stats from that. Memory usage items are quite detailed and self-explanatory, the 'reductions' item then corresponds to CPU usage (roughly the total number of function applications evaluated, I think). This makes sense if your processes are long-lived, if they're just a bunch of short-lived workers then perhaps it's better if they submit final usage report on completion? > eprof/fprof seem to be too heavy: they would take too much system > resources and they would produce too detailed data for me. > > erlang:system_profile seems to be promising (I have not started playing > with it) but it has that note in the doc that it is experimental so I am > a bit afraid of it. For VM global stats erlang:system_info/1 and erlang:memory/N should be useful. Same approach as above -- poll them periodically and compute whatever stats you want to present in the GUI. It probably makes sense to do the global stats first and leave more detailed accounting for later. Not sure about runtime overhead of these... HTH, -- Jachym From sasa555@REDACTED Fri Nov 2 19:27:25 2012 From: sasa555@REDACTED (sasa) Date: Fri, 2 Nov 2012 19:27:25 +0100 Subject: [erlang-questions] R1502 ssl dropping byte(s)? In-Reply-To: <1D684F6D-6177-47BB-B0E3-4DA7BB132740@gmail.com> References: <1D684F6D-6177-47BB-B0E3-4DA7BB132740@gmail.com> Message-ID: Thank you, I've checked the thread. However, if I understand correctly, your problem was fragmentation. I don't have that kind of problem. I.e. I have a code which handles fragmentation, and it doesn't bother me if a short message is fragmented. Theoretically, the message can be fragmented in one byte micro-messages, and I will still recompose it correctly My problem arises because after the receive timeout occurs, one byte is simply missing i.e. it is not received on the next ssl:recv call. On Fri, Nov 2, 2012 at 6:49 PM, Dmitry Kolesnikov wrote: > Hello, > > I also had an issue with a first byte in ssl. > Please check this thread: > http://erlang.org/pipermail/erlang-questions/2012-August/068632.html > > This could be a reason for your case as well. > > - Dmitry > > On Nov 2, 2012, at 7:33 PM, sasa wrote: > > > Hello, > > > > Today I have migrated my production servers to R15B02 (previously they > ran on R14). > > Generally, everything works fine. However, I do notice a strange > behavior occasionally. > > I'm not sure if Erlang is to blame, but it's a strange coincidence that > this started occurring after the migration, and system is in production for > almost two years. > > > > In my system, I am constantly fetching some data from the external > provider via ssl. The code is roughly following: > > > > loop(Socket) -> > > ssl:recv(Socket, 0, 5000), > > ... > > loop(Socket). > > > > After switching to R15, I have noticed that occasionally, a byte gets > "lost". This always happens after 5 or 10 seconds which leads me to > suspicion, that possibly some race condition occurs in ssl. > > Could it be that the timeout occurs just as the bytes start to arrive, > and the first one is discarded? > > Again, I didn't notice this behavior on R14. > > > > Best regards, > > Sasa > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Fri Nov 2 22:50:47 2012 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 2 Nov 2012 22:50:47 +0100 Subject: [erlang-questions] process stats In-Reply-To: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Message-ID: Take a look at the code in observer_backend.erl (${ERLROOT}/lib/runtime_tools/src) This is used by things like etop etc to collect performance data about processes /Joe On Fri, Nov 2, 2012 at 5:39 AM, J?zsef B?rces wrote: > ** > Hi, > > I am writing an application that runs in the background crunching some > data and writing result files to the disk. It has a web interface to > configure what data and how to process. And I was thinking about that it > would be good to be able to present some stats on the web interface about > which Erlang processes how much CPU resources used during the last > second/minute/day/week etc. > > Is there any way to get this kind of info somehow without wasting too much > resources on the stat collection itself? I do not want it for all Erlang > processes, only for a well defined subset of them. > > eprof/fprof seem to be too heavy: they would take too much system > resources and they would produce too detailed data for me. > > erlang:system_profile seems to be promising (I have not started playing > with it) but it has that note in the doc that it is experimental so I am a > bit afraid of it. > > I was also thinking about tracing my processes with the flag 'running' so > I would get 'in' and 'out' message tags in a profiling process. I am not > sure how much resources this would take. > > Any suggestions are welcome! > > Thanks, > Jozsef > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Fri Nov 2 23:50:55 2012 From: gumm@REDACTED (Jesse Gumm) Date: Fri, 2 Nov 2012 17:50:55 -0500 Subject: [erlang-questions] process stats In-Reply-To: References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Message-ID: Also, have a look at "entop". It's basically unix 'top' but for erlang and shows running processes and their states. It's pretty simply extensible as well. https://github.com/mazenharake/entop -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm On Nov 2, 2012 4:51 PM, "Joe Armstrong" wrote: > Take a look at the code in observer_backend.erl > (${ERLROOT}/lib/runtime_tools/src) > This is used by things like etop etc to collect performance data about > processes > > /Joe > > > On Fri, Nov 2, 2012 at 5:39 AM, J?zsef B?rces wrote: > >> ** >> Hi, >> >> I am writing an application that runs in the background crunching some >> data and writing result files to the disk. It has a web interface to >> configure what data and how to process. And I was thinking about that it >> would be good to be able to present some stats on the web interface about >> which Erlang processes how much CPU resources used during the last >> second/minute/day/week etc. >> >> Is there any way to get this kind of info somehow without wasting too >> much resources on the stat collection itself? I do not want it for all >> Erlang processes, only for a well defined subset of them. >> >> eprof/fprof seem to be too heavy: they would take too much system >> resources and they would produce too detailed data for me. >> >> erlang:system_profile seems to be promising (I have not started playing >> with it) but it has that note in the doc that it is experimental so I am a >> bit afraid of it. >> >> I was also thinking about tracing my processes with the flag 'running' so >> I would get 'in' and 'out' message tags in a profiling process. I am not >> sure how much resources this would take. >> >> Any suggestions are welcome! >> >> Thanks, >> Jozsef >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From siraaj@REDACTED Sat Nov 3 03:54:25 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Fri, 2 Nov 2012 22:54:25 -0400 Subject: [erlang-questions] process stats In-Reply-To: <20121102174026.GA25366@circlewave.net> References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> <20121102174026.GA25366@circlewave.net> Message-ID: <7A7C3C2D-002E-4771-AA40-996AB7FC3004@khandkar.net> On Nov 2, 2012, at 1:40 PM, Jachym Holecek wrote: > # J?zsef B?rces 2012-11-02: >> I am writing an application that runs in the background crunching some >> data and writing result files to the disk. It has a web interface to >> configure what data and how to process. And I was thinking about that >> it would be good to be able to present some stats on the web interface >> about which Erlang processes how much CPU resources used during the last >> second/minute/day/week etc. >> >> Is there any way to get this kind of info somehow without wasting too >> much resources on the stat collection itself? I do not want it for all >> Erlang processes, only for a well defined subset of them. > > You could poll them with erlang:process_info/2 and compile some stats > from that. Memory usage items are quite detailed and self-explanatory, > the 'reductions' item then corresponds to CPU usage (roughly the total > number of function applications evaluated, I think). The problem that I see with using reductions is that it is an absolute value, which means that in order to get something CPU-utilization-like - you'll need to sample every single process and calculate the relative values from there. IMHO, this is OK for a temporary glance of a top-like tool, but doesn't seem like the best idea for persistent monitoring that the OP desires. -- Siraaj Khandkar .o. ..o ooo From bchesneau@REDACTED Sat Nov 3 09:03:56 2012 From: bchesneau@REDACTED (Benoit Chesneau) Date: Sat, 3 Nov 2012 09:03:56 +0100 Subject: [erlang-questions] static build of Erlang with openssl ? Message-ID: Is there a way to build Erlang with openssl statically on unixes ? - beno?t -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sat Nov 3 10:42:52 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 3 Nov 2012 11:42:52 +0200 Subject: [erlang-questions] static build of Erlang with openssl ? In-Reply-To: References: Message-ID: Hello, --disable-dynamic-ssl-lib make a trick see ./configure --help for details - Dmitry On Nov 3, 2012, at 10:03 AM, Benoit Chesneau wrote: > Is there a way to build Erlang with openssl statically on unixes ? > > - beno?t > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From rustompmody@REDACTED Sat Nov 3 11:18:27 2012 From: rustompmody@REDACTED (Rustom Mody) Date: Sat, 3 Nov 2012 15:48:27 +0530 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> Message-ID: On Tue, Oct 30, 2012 at 12:24 PM, Stephen Hansen wrote: > > > On Mon, Oct 29, 2012 at 9:11 PM, Richard O'Keefe wrote: > >> >> On 22/10/2012, at 7:44 PM, Rustom Mody wrote: >> > 1. >> > Python made a choice to embrace unicode more thoroughly in going from >> python 2 to python 3. This seems to have caused some grief in that 'ASCII' >> code that used to work in python 2 now often does not in python 3. Maybe >> this has nothing to do with Richard's EEP because that is about the string >> data structure this is about variable names. Still just mentioning. >> >> Can you be more specific? Each ASCII character has the same numeric value >> in Unicode, and an ASCII string represented as UTF-8 is exactly the same >> sequence of bytes. I can't help wondering if "ASCII" here really means >> some 8-bit character set rather than ASCII. >> > > I'm an erlang-lurker, but long time Python user. > > The issues with Python 3 and "unicode vs ascii" have absolutely nothing to > do with encoding and really, no impact at all on this discussion. Python > 2.x had a "string" type and a "unicode" type, but the former was used both > as a binary data type, and as a text data type. In Python 3, they have > decided to make a firm distinction between 'binary data' and 'textual > data', and this change in the fundamental nature of types (and what 'str' > means) has led to some difficulties. > > I was not referring to the semantic incompatibilities introduced going python 2 to 3 I was referring to the the (claims that) python 3 is slower than 2 as for example here: http://mail.python.org/pipermail/python-list/2012-August/629317.html (and whole thread) Can these problems be addressed? Of course. Are they directly related to this EEP? Probably not... I was just mentioning them so that Erlang can learn from python's mistakes. Basically python has chosen a 'flexible string representation" http://www.python.org/dev/peps/pep-0393/ which does the magic of using only 1 byte for ascii, 2 for bmp and 4 for the rest (Unicode 2.0 onwards) In the process however (of detecting the optimal char-width) some inner loops seem to have got less efficient (my guess; dont know for sure) So python has traded time for space. A command-line option to choose string-engine at start time could solve this problem. [Though in a world where one erlang node talking to another is a very normal usecase, this could cause its own challenges] Also 32 bits for 'wide' unicode is wasteful, given that the number of unicode codepoints is 1114112. 1114112 = 17*2^16 < 32*2^16 = 2^21 < 2^24 < 2^32 IOW an acceptable width could be 3 bytes and at 21 bits one could even pack 3 chars into 64 bits -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Nov 3 13:55:39 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 3 Nov 2012 15:55:39 +0300 Subject: [erlang-questions] static build of Erlang with openssl ? In-Reply-To: References: Message-ID: But don't forget that you should compile OpenSSL by yourself. From jrosenblum@REDACTED Sat Nov 3 14:32:43 2012 From: jrosenblum@REDACTED (Jim) Date: Sat, 3 Nov 2012 09:32:43 -0400 Subject: [erlang-questions] Why is Mnesia read-locking an entire table? References: Message-ID: <45F03DE9-EA8E-4C31-B7BC-6D399F2245A4@prodigy.net> Dear List I am having trouble understanding why Mnesia is grabbing a read-lock on an entire table. Can someone give me any insight? Here are some facts (beliefs ;) * The table is of type ordered_set * My key is a two-tuple, {unix-style-milliseconds-since-1970, Key} as in, {1351872742126278,"BI13626"}}, * There are two additional indexed columns * I am frequently, in the same transaction, deleting and inserting two records which differ *only* in the time-stamp portion of the key ? I am replacing an older version of the record with a newer version * All access is done within a function that is passed to mnesia:transaction/1 * All access to the table in question is via: o mnesia:index_read/3 where all three variables being passed in are *always* bound, or o mnesia:select/2 as shown below lookup_since(Since) -> M = [{#key_to_value{update_map={'$1', '_'}, _='_'}, [{'>', '$1', Since}], ['$_']}] {ok, mnesia:select(key_to_value, M)}. or lookup_keylist(Keys, Since) -> M = [{#key_to_value{update_map={'$1', K}, _='_'}, [{'>', '$1', Since}], ['$_']} || K <- Keys], {ok, mnesia:select(key_to_value, M)}. Mnesia:info reports the following >> >> >> Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872742126278,"BI13626"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872742130724,"BI13623"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872742136170,"BI13621"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872742140957,"BI13616"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872746638841,"BI13628"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872746640989,"BI13626"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872746642481,"BI13623"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872746643406,"BI13621"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{key_to_value,{1351872746644468,"BI13616"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{scope_to_keys,"6B-PED"},write,{tid,247,<0.1717.0>}} >> >> Lock: {{scope_to_keys,"InPatient"},write,{tid,247,<0.1717.0>}} >> >> Lock: {{type_to_keys,"b_index"},write,{tid,247,<0.1717.0>}} >> >> ---> Processes waiting for locks <--- >> >> ---> Participant transactions <--- >> >> ---> Coordinator transactions <--- >> >> Tid: 247 (owned by <0.1717.0>) >> >> ---> Uncertain transactions <--- >> >> >> >> >> >> Here is a second example of the mnesia:info() output >> >> >> >> ---> Processes holding locks <--- >> >> Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,707,<0.1876.0>}} >> >> Lock: {{key_to_value,{1351872861465784,"VI14543"}},write,{tid,707,<0.1876.0>}} >> >> Lock: {{key_to_value,{1351872868375564,"VI14543"}},write,{tid,707,<0.1876.0>}} >> >> ---> Processes waiting for locks <--- >> >> ---> Participant transactions <--- >> >> ---> Coordinator transactions <--- >> >> Tid: 707 (owned by <0.1876.0>) >> >> ---> Uncertain transactions <--- >> Any help would be greatly appreciated, Jr0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dangud@REDACTED Sat Nov 3 18:49:23 2012 From: dangud@REDACTED (Dan Gudmundsson) Date: Sat, 3 Nov 2012 18:49:23 +0100 Subject: [erlang-questions] Why is Mnesia read-locking an entire table? In-Reply-To: <45F03DE9-EA8E-4C31-B7BC-6D399F2245A4@prodigy.net> References: <45F03DE9-EA8E-4C31-B7BC-6D399F2245A4@prodigy.net> Message-ID: Mnesia grabs locks before the actual operation is performed, a select call thus requires a table lock since mnesia does not analyse the select expression. /Dan On Sat, Nov 3, 2012 at 2:32 PM, Jim wrote: > Dear List > > I am having trouble understanding why Mnesia is grabbing a read-lock on an > entire table. Can someone give me any insight? > > Here are some facts (beliefs ;) > > * The table is of type ordered_set > * My key is a two-tuple, {unix-style-milliseconds-since-1970, Key} as in, > {1351872742126278,"BI13626"}}, > * There are two additional indexed columns > * I am frequently, in the same transaction, deleting and inserting two > records which differ *only* in the time-stamp portion of the key ? I am > replacing an older version of the record with a newer version > * All access is done within a function that is passed to > mnesia:transaction/1 > * All access to the table in question is via: > o mnesia:index_read/3 where all three variables being passed in are > *always* bound, or > o mnesia:select/2 as shown below > > > lookup_since(Since) -> > M = [{#key_to_value{update_map={'$1', '_'}, _='_'}, > [{'>', '$1', Since}], ['$_']}] > {ok, mnesia:select(key_to_value, M)}. > > or > > lookup_keylist(Keys, Since) -> > M = [{#key_to_value{update_map={'$1', K}, _='_'}, > [{'>', '$1', Since}], ['$_']} || K <- Keys], > {ok, mnesia:select(key_to_value, M)}. > > Mnesia:info reports the following > > > > Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872742126278,"BI13626"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872742130724,"BI13623"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872742136170,"BI13621"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872742140957,"BI13616"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872746638841,"BI13628"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872746640989,"BI13626"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872746642481,"BI13623"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872746643406,"BI13621"}},write,{tid,247,<0.1717.0>}} > > Lock: > {{key_to_value,{1351872746644468,"BI13616"}},write,{tid,247,<0.1717.0>}} > > Lock: {{scope_to_keys,"6B-PED"},write,{tid,247,<0.1717.0>}} > > Lock: {{scope_to_keys,"InPatient"},write,{tid,247,<0.1717.0>}} > > Lock: {{type_to_keys,"b_index"},write,{tid,247,<0.1717.0>}} > > ---> Processes waiting for locks <--- > > ---> Participant transactions <--- > > ---> Coordinator transactions <--- > > Tid: 247 (owned by <0.1717.0>) > > ---> Uncertain transactions <--- > > > > > > Here is a second example of the mnesia:info() output > > > > ---> Processes holding locks <--- > > Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,707,<0.1876.0>}} > > Lock: > {{key_to_value,{1351872861465784,"VI14543"}},write,{tid,707,<0.1876.0>}} > > Lock: > {{key_to_value,{1351872868375564,"VI14543"}},write,{tid,707,<0.1876.0>}} > > ---> Processes waiting for locks <--- > > ---> Participant transactions <--- > > ---> Coordinator transactions <--- > > Tid: 707 (owned by <0.1876.0>) > > ---> Uncertain transactions <--- > > Any help would be greatly appreciated, > Jr0 > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jrosenblum@REDACTED Sat Nov 3 18:53:46 2012 From: jrosenblum@REDACTED (Jim) Date: Sat, 3 Nov 2012 13:53:46 -0400 Subject: [erlang-questions] Why is Mnesia read-locking an entire table? In-Reply-To: References: <45F03DE9-EA8E-4C31-B7BC-6D399F2245A4@prodigy.net> Message-ID: <56BF6254-DD2B-4D86-BDC9-768F1EA87363@prodigy.net> Is there an alternative that would avoid this in my two uses of select below? Would qlc avoid the table lock? Sent from my iPhone On Nov 3, 2012, at 1:49 PM, Dan Gudmundsson wrote: > Mnesia grabs locks before the actual operation is performed, > a select call thus requires a table lock since mnesia does not analyse > the select expression. > > /Dan > > On Sat, Nov 3, 2012 at 2:32 PM, Jim wrote: >> Dear List >> >> I am having trouble understanding why Mnesia is grabbing a read-lock on an >> entire table. Can someone give me any insight? >> >> Here are some facts (beliefs ;) >> >> * The table is of type ordered_set >> * My key is a two-tuple, {unix-style-milliseconds-since-1970, Key} as in, >> {1351872742126278,"BI13626"}}, >> * There are two additional indexed columns >> * I am frequently, in the same transaction, deleting and inserting two >> records which differ *only* in the time-stamp portion of the key ? I am >> replacing an older version of the record with a newer version >> * All access is done within a function that is passed to >> mnesia:transaction/1 >> * All access to the table in question is via: >> o mnesia:index_read/3 where all three variables being passed in are >> *always* bound, or >> o mnesia:select/2 as shown below >> >> >> lookup_since(Since) -> >> M = [{#key_to_value{update_map={'$1', '_'}, _='_'}, >> [{'>', '$1', Since}], ['$_']}] >> {ok, mnesia:select(key_to_value, M)}. >> >> or >> >> lookup_keylist(Keys, Since) -> >> M = [{#key_to_value{update_map={'$1', K}, _='_'}, >> [{'>', '$1', Since}], ['$_']} || K <- Keys], >> {ok, mnesia:select(key_to_value, M)}. >> >> Mnesia:info reports the following >> >> >> >> Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872742126278,"BI13626"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872742130724,"BI13623"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872742136170,"BI13621"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872742140957,"BI13616"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872746638841,"BI13628"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872746640989,"BI13626"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872746642481,"BI13623"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872746643406,"BI13621"}},write,{tid,247,<0.1717.0>}} >> >> Lock: >> {{key_to_value,{1351872746644468,"BI13616"}},write,{tid,247,<0.1717.0>}} >> >> Lock: {{scope_to_keys,"6B-PED"},write,{tid,247,<0.1717.0>}} >> >> Lock: {{scope_to_keys,"InPatient"},write,{tid,247,<0.1717.0>}} >> >> Lock: {{type_to_keys,"b_index"},write,{tid,247,<0.1717.0>}} >> >> ---> Processes waiting for locks <--- >> >> ---> Participant transactions <--- >> >> ---> Coordinator transactions <--- >> >> Tid: 247 (owned by <0.1717.0>) >> >> ---> Uncertain transactions <--- >> >> >> >> >> >> Here is a second example of the mnesia:info() output >> >> >> >> ---> Processes holding locks <--- >> >> Lock: {{key_to_value,'______WHOLETABLE_____'},read,{tid,707,<0.1876.0>}} >> >> Lock: >> {{key_to_value,{1351872861465784,"VI14543"}},write,{tid,707,<0.1876.0>}} >> >> Lock: >> {{key_to_value,{1351872868375564,"VI14543"}},write,{tid,707,<0.1876.0>}} >> >> ---> Processes waiting for locks <--- >> >> ---> Participant transactions <--- >> >> ---> Coordinator transactions <--- >> >> Tid: 707 (owned by <0.1876.0>) >> >> ---> Uncertain transactions <--- >> >> Any help would be greatly appreciated, >> Jr0 >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From jared@REDACTED Sat Nov 3 23:31:19 2012 From: jared@REDACTED (Jared Morrow) Date: Sat, 3 Nov 2012 16:31:19 -0600 Subject: [erlang-questions] static build of Erlang with openssl ? In-Reply-To: References: Message-ID: You'll want to do something like: % openssl ./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared make && make install % erlang ./configure --with-ssl=/usr/local/ssl/ --disable-dynamic-ssl-lib -Jared On Sat, Nov 3, 2012 at 2:03 AM, Benoit Chesneau wrote: > Is there a way to build Erlang with openssl statically on unixes ? > > - beno?t > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Sat Nov 3 23:36:19 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sat, 03 Nov 2012 17:36:19 -0500 Subject: [erlang-questions] +swt very_low doesn't seem to avoid schedulers getting In-Reply-To: Message of "Thu, 18 Oct 2012 20:13:00 +0200." <508046AC.4040401@erlang.org> Message-ID: <201211032236.qA3MaJ85099216@snookles.snookles.com> A few weeks ago, Rickard Green wrote: > However, you can call "statistics(run_queues)" (note that the argument > should be 'run_queues', and not 'run_queue') repeatedly, say once every > 100 ms (perhaps even more frequent than this) for say 10 seconds when > the system is in this state . That information will at least give us a > good hunch of what is going on. statistics(run_queues) returns a tuple > containing the run queue length of each run queue as elements. Hiya. We have some new data from three customer machines running Riak 1.2.1 with R15B01 that all hit what appears to be this same "schedulers getting stuck" problem. The machines were fixed before I was aware of them, so I didn't get a chance to rummage around. We do not have the output that you suggested, statistics(run_queues). However, we do have samples of the traces that are generated by: erlang:trace(all, true, [running,scheduler_id]) When stuck, the output looks like this, with tuples of {scheduler #, # of samples} (riak@REDACTED)1> schedstat:run(). <0.16760.459> === in scheduler count=== [{1,264}, {2,257}, {3,0}, {4,0}, ... and repeating zero samples all the way to to scheduler 64. When unstuck, the output looks like this: (riak@REDACTED)1> schedstat:run(). <0.3422.460> === in scheduler count=== [{1,65}, {2,5}, {3,0}, {4,0}, {5,14}, {6,73}, {7,0}, {8,0}, {9,0}, {10,0}, {11,0}, {12,0}, {13,159}, {14,182}, {15,6}, {16,0}, ... and repeating zero samples all the way to to scheduler 64. I do not know if the +swt flag was used on these machines, sorry. Raw output, courtesy of Kelly McLaughlin, is available at https://gist.github.com/4009035. The generating script is by Jon Meredith at https://gist.github.com/a460a9dbb11698cf01a6. The make-it-unstuck method is this: %% Get current number of online schedulers Schedulers = erlang:system_info(schedulers_online). %% Reduce number online to 1 erlang:system_flag(schedulers_online, 1). %% Restore to original number of online schedulers erlang:system_flag(schedulers_online, Schedulers). It isn't clear yet if the next release of Riak will use R15B02 or remain with R15B01. We were bitten by performance regressions (not caught during our pre-release testing) when releasing the packages that moved from R14B04 to R15B01. There's the devil we're getting to know versus the devil that takes a heck of a lot more time to get to know.... -Scott From rickard@REDACTED Sun Nov 4 02:05:32 2012 From: rickard@REDACTED (Rickard Green) Date: Sun, 4 Nov 2012 02:05:32 +0100 Subject: [erlang-questions] +swt very_low doesn't seem to avoid schedulers getting In-Reply-To: <201211032236.qA3MaJ85099216@snookles.snookles.com> References: <201211032236.qA3MaJ85099216@snookles.snookles.com> Message-ID: <610FC81C-B1E6-457D-A89A-0C599B7FC7CA@erlang.org> This does, however, not show that anything is wrong. The statistics only show that a couple of hundred processes were selected for execution on the same scheduler during some timeframe. If there are no buildup in run-queue length, everything is as it should. Regards, Rickard On Nov 3, 2012, at 11:36 PM, Scott Lystig Fritchie wrote: > A few weeks ago, Rickard Green wrote: > >> However, you can call "statistics(run_queues)" (note that the argument >> should be 'run_queues', and not 'run_queue') repeatedly, say once every >> 100 ms (perhaps even more frequent than this) for say 10 seconds when >> the system is in this state . That information will at least give us a >> good hunch of what is going on. statistics(run_queues) returns a tuple >> containing the run queue length of each run queue as elements. > > Hiya. We have some new data from three customer machines running > Riak 1.2.1 with R15B01 that all hit what appears to be this same > "schedulers getting stuck" problem. > > The machines were fixed before I was aware of them, so I didn't > get a chance to rummage around. We do not have the output that > you suggested, statistics(run_queues). However, we do have > samples of the traces that are generated by: > > erlang:trace(all, true, [running,scheduler_id]) > > When stuck, the output looks like this, with tuples of > {scheduler #, # of samples} > > (riak@REDACTED)1> schedstat:run(). > <0.16760.459> > === in scheduler count=== > [{1,264}, > {2,257}, > {3,0}, > {4,0}, > ... and repeating zero samples all the way to > to scheduler 64. > > When unstuck, the output looks like this: > > (riak@REDACTED)1> schedstat:run(). > <0.3422.460> > === in scheduler count=== > [{1,65}, > {2,5}, > {3,0}, > {4,0}, > {5,14}, > {6,73}, > {7,0}, > {8,0}, > {9,0}, > {10,0}, > {11,0}, > {12,0}, > {13,159}, > {14,182}, > {15,6}, > {16,0}, > ... and repeating zero samples all the way to > to scheduler 64. > > I do not know if the +swt flag was used on these machines, > sorry. > > Raw output, courtesy of Kelly McLaughlin, is available at > https://gist.github.com/4009035. The generating script is > by Jon Meredith at https://gist.github.com/a460a9dbb11698cf01a6. > > The make-it-unstuck method is this: > > %% Get current number of online schedulers > Schedulers = erlang:system_info(schedulers_online). > > %% Reduce number online to 1 > erlang:system_flag(schedulers_online, 1). > > %% Restore to original number of online schedulers > erlang:system_flag(schedulers_online, Schedulers). > > It isn't clear yet if the next release of Riak will use R15B02 > or remain with R15B01. We were bitten by performance regressions > (not caught during our pre-release testing) when releasing the > packages that moved from R14B04 to R15B01. There's the devil > we're getting to know versus the devil that takes a heck of a lot > more time to get to know.... > > -Scott From ingham.k@REDACTED Sun Nov 4 07:49:38 2012 From: ingham.k@REDACTED (Igor Karymov) Date: Sat, 3 Nov 2012 23:49:38 -0700 (PDT) Subject: [erlang-questions] Turning rebar into a package manager In-Reply-To: References: Message-ID: <88fdd788-d378-413b-9863-09b581086ab1@googlegroups.com> Lock files it's good idea. We are using simple script for this purpose. When you want create release branch just type create release. And script do recursive walk and lock dependency current version in root rebar.config. All another time moving head most usable for our development process. ???????, 19 ??????? 2012 ?., 15:10:52 UTC+4 ???????????? Jos? Valim ???????: > > I believe one of the issues that would need to be addressed first in rebar > is the one of repeatability. > > rebar does not ensure that developers in the same project are going to use > the same snapshot of a dependency. This means developers can depend on the > same git repository but different commits leading to the famous "the tests > pass on my machine". > > I am aware this could be fixed by the team enforcing a commit sha when > declaring the dependency but many simply don't do it. Besides it puts the > work on you to manage the commit shas. If you want to update the > dependency, you need to remove the commit sha, update the repo, write the > new commit sha. > > This could be easily fixed by having a lock file per project with the > commit shas of the dependencies. "rebar get-deps" should retrieve the shas > in such lock, if one is available, or simply get the latest and write to > the lock. A command like "rebar unlock-deps" could be available when > developers want to update their dependencies, regardless of the current > lock. > > Also, regarding Joe's proposal, picking up a version from a git repository > may be tricky. The best approach is to index git tags only, hoping the > publisher won't modify an existing tag. If someone is depending on a branch > though, it should not be considered a version or a part of .erl_packages. I > believe it should still belong to the repo. > > *Jos? Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Lead Developer > > > > On Fri, Oct 19, 2012 at 12:36 PM, Joe Armstrong > > wrote: > >> Here is a programming exercise ... >> >> I think we can turn rebar into a package manager with 4 simple and one >> not so >> simple tweaks. >> >> This would turn rebar from being something that is very useful to >> something >> that is very very useful :-) >> >> >> (aside - I'm revising my Erlang book, and I'd like to describe >> how package management works, but there is no package manager >> which is a shame - so I got to thinking about package managers >> and wondered why still don't have a decent package manager. >> >> The one I've seen that I like a lot is npm (node package manager) >> so we could do worse than follow their design) >> >> So this is how I think rebar could become a package manager >> >> >> Tweak 1 >> ======= >> >> > rebar get-deps >> >> Fetches the dependencies in rebar.conf and stores them in >> the current directory, in a directory called deps. >> >> After a while you get dependencies scattered all over the place, >> I've seen many examples of this. >> >> This means that there is no central place to go and look if you >> want to find code. >> >> NPM sticks ALL dependencies under ${HOME}/.npm >> >> Suggestion: >> >> All dependencies should be stored in ${HOME}/.erl_packages >> >> (Aside - if we followed npm the directory structure would be >> something like) >> >> ${HOME}/.erl_packages/cowboy/6.2.1/src >> /ebin >> /5.2.3 >> /stdlib/12.3.1 >> /14.6.8 >> >> etc. ie a package/Vsn/src ... structure >> >> >> Tweak 2 >> ======= >> >> move rebar.config to ${HOME}/.erl_packages/rebar.config >> and add commands to automatically edit it >> >> > rebar add_package foo >> >> might add a line like >> {foo, ".*", "git://...."} >> >> to rebar.config >> >> The point here is to change the content of rebar.config with >> shell commands rather that editing it by hand >> >> Tweak 3 >> ======= >> fix rebar so it just downloads a particular version of a >> program and not all the .git stuff - most people will only >> want to use other peoples code, not hack it. >> >> Tweak 4 >> ======= >> >> Fix the erlang load paths to find all the dependencies >> >> I do this now. Put all my dependencies in >> ${HOME}/nobackup/erlang_imports/deps and put the following >> code in my .erlang startup file >> >> Home = os:getenv("HOME"). >> Dir = Home ++ "/nobackup/erlang_imports/deps", >> case file:list_dir(Dir) of >> {ok, L} -> >> lists:foreach(fun(I) -> >> Path = Dir ++ "/" ++ I ++ "/ebin", >> code:add_path(Path) >> end, L); >> _ -> >> void >> end. >> >> Tweak 5 >> ======= >> This can't be done by rebar >> Make an index of all erlang apps on github that follow >> the erlang packaging structure >> >> Somebody has to write a program to do this. >> >> The package index should be at a well know URL >> >> > rebar get_index >> >> >> This should fetch the index from the well-know URL and store in >> ${HOME}/.erl_packages >> >> >> > rebar search XXX >> >> would search the fetched index >> >> > rebar add XXXX >> >> would take the index entry add it to the config fill fetch the code >> and compile it >> >> Note the following: >> >> 1) The trust model. >> >> We trust the supplier of a program not the program. >> >> So for example on github we might trust programs >> published by the user joearms (me) or erlang (the OTP release) >> but not by some_guy_ive_never_hear_of >> >> It would be quite easy to add a trust section to rebar.config >> >> {trust, ["git://joearms", git://erlang", ...]} >> >> 2) There is no "publish" step >> >> We put our code on github (or somewhere) and hope that it gets indexed >> by the indexer. >> >> We might mail the indexer if it is published in an obscure place. >> >> Comments? >> >> Cheers >> >> /Joe >> _______________________________________________ >> erlang-questions mailing list >> erlang-q...@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenji.rikitake@REDACTED Sun Nov 4 13:33:03 2012 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Sun, 4 Nov 2012 21:33:03 +0900 Subject: [erlang-questions] Erlang/OTP Japan mirror site by Basho Japan Message-ID: Basho Japan people kindly set up the following mirror site for downloading Erlang/OTP: http://download.basho.co.jp.try-cs.ycloud.jp/index.html FYI Kenji Rikitake From gustav.simonsson@REDACTED Sun Nov 4 14:25:26 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Sun, 4 Nov 2012 13:25:26 +0000 Subject: [erlang-questions] process stats In-Reply-To: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> References: <7460EBDDCF52084A849D0F271CE059B80285E9@ESESSMB101.ericsson.se> Message-ID: One way of finding out more exact CPU utilization and other stats for one or more Erlang processes from the Linux point of view could be to bind them to a specific Erlang scheduler [1] which requires you to first bind each Erlang scheduler to a CPU thread [2] (logical processor) rather than have the OS migrate them at its will between the available threads. After this you can find the thread id of the Linux thread executing that Erlang scheduler [3]. Then you can look at interesting statistics such as CPU utilization for the thread corresponding to that Erlang scheduler using for example the %cpu format specifier to ps. There is also a bunch of interesting things under stat in proc for each tid such as page faults stats and time scheduled in kernel mode [4] which could be useful. Things to consider is that the Erlang scheduler could have executed other Erlang processes than the ones specificity bound to it. Also, if you bound several Erlang processes to a Erlang scheduler, the Linux thread stats would be for all of them. Also, binding Erlang processes to a scheduler is not generally recommended and you might only want todo something like this in a testing environment for benchmarking. [1] Use the {scheduler, N} option (undocumented) to erlang:spawn_opt/2,3,4,5. The number of schedulers can be found with erlang:system_info(schedulers) , and the scheduler for the calling process with erlang:system_info(scheduler_id). [2] Look at the +sbt options at http://www.erlang.org/doc/man/erl.html#emu_flags [3] You can find out the tids with ps -Leo pid,tid,comm | grep beam. Finding the exact thread might be tricky, but if you bind all the processes doing heavy stuff to one thread, that one should stand out if you add other stats like %cpu and %mem to the format specifiers. A more explicit way would be to call pid_t tid = syscall(SYS_gettid) in a NIF from the bound Erlang processes you want to look at. [4] man 5 proc, look under the stat and statm sections, you can read it directly at /proc//stat or use ps to list them. Cheers, Gustav Simonsson On Fri, Nov 2, 2012 at 4:39 AM, J?zsef B?rces wrote: > ** > Hi, > > I am writing an application that runs in the background crunching some > data and writing result files to the disk. It has a web interface to > configure what data and how to process. And I was thinking about that it > would be good to be able to present some stats on the web interface about > which Erlang processes how much CPU resources used during the last > second/minute/day/week etc. > > Is there any way to get this kind of info somehow without wasting too much > resources on the stat collection itself? I do not want it for all Erlang > processes, only for a well defined subset of them. > > eprof/fprof seem to be too heavy: they would take too much system > resources and they would produce too detailed data for me. > > erlang:system_profile seems to be promising (I have not started playing > with it) but it has that note in the doc that it is experimental so I am a > bit afraid of it. > > I was also thinking about tracing my processes with the flag 'running' so > I would get 'in' and 'out' message tags in a profiling process. I am not > sure how much resources this would take. > > Any suggestions are welcome! > > Thanks, > Jozsef > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sun Nov 4 16:30:57 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 4 Nov 2012 16:30:57 +0100 Subject: [erlang-questions] erlide hangs in mac os x + juno In-Reply-To: References: Message-ID: Hi! On Tue, Oct 30, 2012 at 9:32 AM, Park, Sungjin wrote: > My erlide hangs or sometimes just shows empty ebin, include, src directories > in a project. > I'm using Mac OS X 10.7.5 with Eclipse Juno. > I tried several known troubleshootings found in google including hostname > and computername change. > Actually, it has been ok for quite a while but after failing once, won't > recover. Sorry for the delay, I was on vacation. Did you try the latest nightly from http://erlide.org/update_nightly? It might solve your problem. It's difficult to understand what's going on without logs. Please reproduce the problem and then go to window->preferences->erlang->report problem. Fill in any details that help reproducing and post the resulting logs in a ticket at https://erlide-tools.assembla.com/spaces/erlide/support/tickets. best regards, Vlad From ok@REDACTED Sun Nov 4 22:24:30 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 5 Nov 2012 10:24:30 +1300 Subject: [erlang-questions] EEP 40 - A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <20121102093539.GA6524@erix.ericsson.se> References: <20121031144414.GA4800@erix.ericsson.se> <20121101165239.GA27093@erix.ericsson.se> <8ADD6A32-AF8D-4D71-9976-2011EC186457@cs.otago.ac.nz> <20121102093539.GA6524@erix.ericsson.se> Message-ID: On 2/11/2012, at 10:35 PM, Raimo Niskanen wrote: > > Also I do not clearly see what problem is solved for someone using > fonts with say Arabic letters but not say the undertine, by revising > the underscore rule. Bear with me. I have never used another keyboard > than Swedish or English. Is it so that when using such a font there > is no Pc character available except for the "_" (and why is that > available?) so there must be a possibility to express both non-singleton > and maybe-singleton variables using just the "_"? I have only tried the Macintosh interface, where there are three "Arabic", "Arabic - PC", and "Arabic - QWERTY" virtual keyboards available. All of them have the underline. ISO 8859-6 (the ISO 8-bit character set for Arabic) includes all of ASCII. However, I am not an expert. > > I have realized that. I wanted a lesser degree of understanding the > lexical semantics: If it passes the compiler (which that example > does not) I would like to be able to see which identifiers are > variables and which are atoms. > > Also, e.g someone writing a syntax highlighter for Vim i guess would > appreciate a simple rule for how to recognize a variable. Well, the EEP gives them _that_. If Vim can highlight Ada and Python and Java correctly, what's the problem? Copy the regular expressions it uses for Java and tinker with them. > >> >> If someone gives you an Erlang file written entirely in ASCII, >> but using the Klingon language, just how much would it help you >> to know where the variables began? (Google Translate offers >> translation to Esperanto, why not Klingon? I haven't opened my >> copy of the how-to-learn-Klingon book in 20 years. Sigh.) > > It would not help much, I agree. But if for example I get a bug report > about the compiler or runtime system not doing right for a few lines > of Klingon Erlang, it would be helpful to easily distinguish variables > from atoms. You don't have to do it by eye. You can use a tool (like the Vim syntax colourer you mention above). >> Consider >> 1> X = a.B. >> * 1: syntax error before: B >> 1> X = a._2. >> * 1: syntax error before: _2 >> 1> X = a.3. >> * 1: syntax error before: 3 >> 1> X = a.b. >> 'a.b' >> >> That tells us that currently, only Ll characters are allowed >> after a dot in the continuation of an identifier. That naturally >> generalised to (Ll ? Lo). So I made "what can follow a dot" the >> same everywhere in an atom. The mental model I had was to think >> of dot-followed-by-Ll-or-Lo as a single extended character. > > Yes. And currently only Ll characters are allowed at the start > of an atom. So currently the same set is allowed at the start > as after a ".". > > Your current suggestion allows a.? as an unquoted atom since the character > after the dot is in Lo, but it is not allowed in Erlang today. Oh DRAT! > > It also allows ??? as an atom but not ???.??? since these characters > are in Nl (Letter_Number), which is part of XID_Start. Frankly that one doesn't bother me in the least. > > So I think the mental model should be that after a dot there > should be as if a new atom was starting. However, since I've got to fix the a.? bug, I may as well adopt your suggestion. The grammar now reads unquoted_atom ::= "."? atom_start atom_continue* atom_start ::= XID_Start \ (Lu ? Lt ? "??") atom_continue ::= XID_Continue ? "@" \ "??" | "." atom_start From ok@REDACTED Sun Nov 4 23:34:30 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 5 Nov 2012 11:34:30 +1300 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> Message-ID: On 3/11/2012, at 11:18 PM, Rustom Mody wrote: > I was referring to the the (claims that) python 3 is slower than 2 > as for example here: http://mail.python.org/pipermail/python-list/2012-August/629317.html (and whole thread) > > Can these problems be addressed? Of course. > Are they directly related to this EEP? Probably not... Certainly not. EEP 40 is about the *lexical structure* of Erlang *variables* and *unquoted atoms*. This is something that happens at compile time. The speed of the Erlang *compiler* will almost certainly be affected by the adoption of Unicode. The speed of the run-time will be affected to the extent that atom_to_list and list_to_atom will need changing to allow Unicode characters in atom names, but that's going to happen anyway; all EEP 40 has to say about that is which ones don't need quotation marks From tuncer.ayaz@REDACTED Mon Nov 5 00:56:51 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 5 Nov 2012 00:56:51 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> Message-ID: On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: > > On 1 Nov 2012, at 21:50, Tuncer Ayaz wrote: > >> So your idea is that commands should explicitly announce if they >> want to be used recursively and otherwise ignore non-base_dir >> applications with -r meaning "force all commands to process >> deps/sub_dirs", right? How would you handle the case that compile >> is happy to process sub_dirs/deps but you want to compile just >> base_dir? > > I think we need to go back to 'it just works' in that instance. > Compile wants to recurse because headers in sub dirs might have > changed and dependency checking and compiling based on > need/dependency is 'the right thing to do' always. > > My thought was that some actions have to take place recursively on > order to be correctly applied, and it's no good letting people > override them. For something like test runs, doc building, xref, and > so on, it can and should be optional. But compile/resolve shouldn't > be. Adding that API to core would mean that internal and plugin > modules get a means to enforce the right behaviour. This could work. I'll let you all know once the prototype is ready for testing. From steven.charles.davis@REDACTED Mon Nov 5 01:57:38 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 4 Nov 2012 16:57:38 -0800 (PST) Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <50852174.1060707@ninenines.eu> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> Message-ID: <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> I'm personally looking forward to attempting to maintain open source kanji. An awesome challenge. On Monday, October 22, 2012 5:36:20 AM UTC-5, Lo?c Hoguin wrote: > > On 10/22/2012 08:00 AM, Anthony Ramine wrote: > > Also non-latin users who don't know English should be able to use > > atoms and variables they understand. > > Can't stress this enough. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby@REDACTED Mon Nov 5 02:02:37 2012 From: toby@REDACTED (Toby Thain) Date: Sun, 04 Nov 2012 20:02:37 -0500 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> Message-ID: <5097102D.9080607@telegraphics.com.au> On 04/11/12 7:57 PM, Steve Davis wrote: > I'm personally looking forward to attempting to maintain open source > kanji. An awesome challenge. > Is it that a lot of people on this thread don't read ROK's posts? Or is there another explanation for what just looks like wilful obtuseness? --T From kenji.rikitake@REDACTED Mon Nov 5 03:45:41 2012 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Mon, 5 Nov 2012 11:45:41 +0900 Subject: [erlang-questions] Erlang/OTP Japan mirror site by Basho Japan In-Reply-To: References: Message-ID: Basho Japan people has told me that this site is still experimental (i.e., not in service) and the URL is subject to change. My apology for any inconvenience I caused to Basho Japan and the people who tried to get access to the site. Regards, Kenji Rikitake On Sun, Nov 4, 2012 at 9:33 PM, Kenji Rikitake wrote: > Basho Japan people kindly set up the following mirror > site for downloading Erlang/OTP: > http://download.basho.co.jp.try-cs.ycloud.jp/index.html > > FYI > Kenji Rikitake From hd2010@REDACTED Mon Nov 5 04:42:45 2012 From: hd2010@REDACTED (Henning Diedrich) Date: Mon, 5 Nov 2012 04:42:45 +0100 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <61CE5B92-B1CF-4AB1-A473-22A56E7F02BB@cs.otago.ac.nz> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <61CE5B92-B1CF-4AB1-A473-22A56E7F02BB@cs.otago.ac.nz> Message-ID: On Oct 30, 2012, at 5:33 AM, Richard O'Keefe wrote: >> Here is an example: >> I want to write a module in Turkish, then the "length" id will be a >> variable, not a function. > > What on earth are you talking about? Lower case l is a lower case > letter, whether you're writing English, Turkish, or Old High Martian. My point, maybe Michaels in way, too, was this: 1> Iength = length. length 2> Ienght. * 1: variable 'Ienght' is unbound 3> length = Iength. length 4> Iength. length Fun factor depends on font you're using. "Yes, exactly" to your second and fifth thought. I think it matters to minimize the number of things to watch out for. Henning From ok@REDACTED Mon Nov 5 06:49:29 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 5 Nov 2012 18:49:29 +1300 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <61CE! 5B92-B1CF-4AB1-A473-22A56E7F02BB@cs.otago.ac.nz> Message-ID: On 5/11/2012, at 4:42 PM, Henning Diedrich wrote: > > On Oct 30, 2012, at 5:33 AM, Richard O'Keefe wrote: > >>> Here is an example: >>> I want to write a module in Turkish, then the "length" id will be a >>> variable, not a function. >> >> What on earth are you talking about? Lower case l is a lower case >> letter, whether you're writing English, Turkish, or Old High Martian. > > > My point, maybe Michael's in way, too, was this: > > 1> Iength = length. > length > 2> Ienght. > * 1: variable 'Ienght' is unbound That's because the last two letters were swapped. There's nothing here to do with Turkish. (For that matter, while Turkish has an extra dotted capital I ? and an extra dotless small i ?, it uses the same dotless capital I that we do, it's just the capital of a dotless small i.) > 3> length = Iength. > length > 4> Iength. > length > > Fun factor depends on font you're using. To quote a Pogo strip, "you have the wrong mistake". I am reminded of a burglar indignantly protesting his innocence: "I didn't rob *THAT* house" (but don't ask me about the one next door). We *already* have confusable characters in Latin-1: i/l/1, o/O/0 -- I'm seeing a slashed zero here and very much wish I weren't because that's not how I was taught to write a zero -- 2/Z, s/5, and if you had to read the handwriting I'm reading during marking, you'd wonder if there were _any_ two characters that couldn't be confused. (There was a time when Australian school-children were _taught_ to write unclosed small "p" letters so they looked like long-tailed "r". Why?) So our burglar is saying "I don't have THOSE [Unicode] confusable characters" (just don't ask me about all the others I do have). If you are talking about the confusability of characters, you could bring in CAPITAL A WITH RING ABOVE and ANGSTROM SIGN, or for that matter the already mentioned Latin capital A, Cyrillic capital A, and Greek capital alpha, all of which look exactly the same. If we once allow any kind of vaguely stringly-like thing to include Unicode characters, we are *going* to have the problem of confusible letters in data. You could restrict identifiers to be sequences of a/A characters and we'd still have the problem in data. Of all places, the very topmost *safest* place to have the problem is in Erlang variable names, because of the singleton style check. The next safest is probably in function names. These are places where the compiler will _tell_ us if things do not match up. Suppose someone writes ?_????? = ?_??????(???_??????) Yes, the ? and ? will look like an O and an o, so someone _could_ trick you. But they won't be TRYING to. And if they _do_ type too much with the wrong keyboard set (as I did while typing this!) the compiler will tell them. And all this cowering in fear at the very time that we're seeing more and more type checking in Erlang, checking that would quite certainly catch such mistakes very well. Makes you wonder about people, really it does. [The example is as close as I could get to 'Fear is the mind-killer'.] From ingela.andin@REDACTED Mon Nov 5 11:08:41 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Mon, 5 Nov 2012 11:08:41 +0100 Subject: [erlang-questions] R1502 ssl dropping byte(s)? In-Reply-To: References: Message-ID: Hi! The only thing that might have changed between R14 and R15 is the timing so that this happens to you more often, but using a timeout to recv can cause you to sort of loose data as you will not stop the recv of being processed by ssl, only cause recv to return early. This is much like if you time out a POST request to a webserver the request may still have reached the webserver and have been executed on the server side. I think that if you do not want to hang in recv you should use active once instead passive receive (recv). Regards Ingela Erlang/OTP team - Ericsson AB 2012/11/2 sasa : > Hello, > > Today I have migrated my production servers to R15B02 (previously they ran > on R14). > Generally, everything works fine. However, I do notice a strange behavior > occasionally. > I'm not sure if Erlang is to blame, but it's a strange coincidence that this > started occurring after the migration, and system is in production for > almost two years. > > In my system, I am constantly fetching some data from the external provider > via ssl. The code is roughly following: > > loop(Socket) -> > ssl:recv(Socket, 0, 5000), > ... > loop(Socket). > > After switching to R15, I have noticed that occasionally, a byte gets > "lost". This always happens after 5 or 10 seconds which leads me to > suspicion, that possibly some race condition occurs in ssl. > Could it be that the timeout occurs just as the bytes start to arrive, and > the first one is discarded? > Again, I didn't notice this behavior on R14. > > Best regards, > Sasa > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Mon Nov 5 12:13:48 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 5 Nov 2012 11:13:48 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> Message-ID: <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> Dude... On 4 Nov 2012, at 23:56, Tuncer Ayaz wrote: > On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: >> [snip] > This could work. I'll let you all know once the prototype is ready > for testing. You rock! :) Once you give the say so, I'll test all my plugins + projects against your branch. Cheers, Tim -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 235 bytes Desc: Message signed with OpenPGP using GPGMail URL: From hd2010@REDACTED Mon Nov 5 12:23:06 2012 From: hd2010@REDACTED (Henning Diedrich) Date: Mon, 5 Nov 2012 12:23:06 +0100 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <61CE! 5B92-B1CF-4AB1-A473-22A56E7F02BB@cs.otago.ac.nz> Message-ID: <188AC90C-D01A-4207-A5F5-FAE416FFF502@eonblast.com> On Nov 5, 2012, at 6:49 AM, "Richard O'Keefe" wrote: > To quote a Pogo strip, "you have the wrong mistake". That was the very point. In the instance I can do without more choice. Henning From sasa555@REDACTED Mon Nov 5 15:32:18 2012 From: sasa555@REDACTED (sasa) Date: Mon, 5 Nov 2012 15:32:18 +0100 Subject: [erlang-questions] R1502 ssl dropping byte(s)? In-Reply-To: References: Message-ID: Thank you for the response. Obviously, active once should resolve my problem, and I will modify the code accordingly. In the meantime, I have resolved the issue by raising ssl:recv timeout to 15 seconds. In my environment this essentially means that timeout does not occur. I'd like to stress that in almost 2 years of production, I have never experienced this issue with R14. It is also very strange that I was always loosing first byte of the message and not more. Which still leads me to believe that some bug might have been introduced regarding passive sockets. However, active once seems like a cleaner solution, and I will therefore go ahead with that approach. Best regards, Sasa On Mon, Nov 5, 2012 at 11:08 AM, Ingela Andin wrote: > Hi! > > The only thing that might have changed between R14 and R15 is the > timing so that this happens to you more often, but using a timeout to > recv can cause > you to sort of loose data as you will not stop the recv of being > processed by ssl, only cause recv to return early. This is much like > if you time out a POST request to a webserver the request may still > have reached the webserver and have been executed on the server side. > I think that if you do not want to hang > in recv you should use active once instead passive receive (recv). > > Regards Ingela Erlang/OTP team - Ericsson AB > > > 2012/11/2 sasa : > > Hello, > > > > Today I have migrated my production servers to R15B02 (previously they > ran > > on R14). > > Generally, everything works fine. However, I do notice a strange behavior > > occasionally. > > I'm not sure if Erlang is to blame, but it's a strange coincidence that > this > > started occurring after the migration, and system is in production for > > almost two years. > > > > In my system, I am constantly fetching some data from the external > provider > > via ssl. The code is roughly following: > > > > loop(Socket) -> > > ssl:recv(Socket, 0, 5000), > > ... > > loop(Socket). > > > > After switching to R15, I have noticed that occasionally, a byte gets > > "lost". This always happens after 5 or 10 seconds which leads me to > > suspicion, that possibly some race condition occurs in ssl. > > Could it be that the timeout occurs just as the bytes start to arrive, > and > > the first one is discarded? > > Again, I didn't notice this behavior on R14. > > > > Best regards, > > Sasa > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.koener@REDACTED Mon Nov 5 15:47:05 2012 From: antoine.koener@REDACTED (Antoine Koener) Date: Mon, 5 Nov 2012 15:47:05 +0100 Subject: [erlang-questions] [Clarification] erl_interface: to erl_free_term() or not to erl_free_term() ? Message-ID: >From the documentation located at: http://erlang.org/doc/apps/erl_interface/ei_users_guide.html#id59377 Part: Example of Receiving Messages Sample code is: ETERM *arr[2], *answer; int sockfd,rc; char buf[BUFSIZE]; ErlMessage emsg; if ((rc = erl_receive_msg(sockfd , buf, BUFSIZE, &emsg)) == ERL_MSG) { arr[0] = erl_mk_atom("goodbye"); arr[1] = erl_element(1, emsg.msg); answer = erl_mk_tuple(arr, 2); erl_send(sockfd, arr[1], answer);* erl_free_term(answer);* erl_free_term(emsg.msg); erl_free_term(emsg.to); } why erl_free_term() instead of erl_free_compound ? >From my own tests erl_free_term() is not enough... I then think that this code leaks memory. Maybe I'm completely wrong ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Mon Nov 5 17:41:35 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 5 Nov 2012 17:41:35 +0100 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <188AC90C-D01A-4207-A5F5-FAE416FFF502@eonblast.com> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <61CE! 5B92-B1CF-4AB1-A473-22A56E7F02BB@cs.otago.ac.nz> <188AC90C-D01A-4207-A5F5-FAE416FFF502@eonblast.com> Message-ID: <7BEB1D1D-1BFB-4CEC-A4E5-00A93166FEBD@erlang-solutions.com> On Nov 5, 2012, at 12:23 PM, Henning Diedrich wrote: > > On Nov 5, 2012, at 6:49 AM, "Richard O'Keefe" wrote: > >> To quote a Pogo strip, "you have the wrong mistake". > > That was the very point. In the instance I can do without more choice. I think many of these problems about confusion is largely a non-issue. Given languages which actually allows you to write full, unnormalized unicode, Google Go comes to mind, I see very few such actual problems in programs. We already have these kinds of problems: Tabs vs spaces are not distinguishable. Neither are trailing white space. There are characters which are hard to recognize - and some fonts make it a priority to make them apart, like Richard said. What I think is the key point is that I may be able to express certain things better with a larger symbol table. Yes, this also means I can obfuscate more, but I honestly only need the Erlang Pre-processor to win that battle of obfuscation. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From tuncer.ayaz@REDACTED Tue Nov 6 00:24:16 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 6 Nov 2012 00:24:16 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> Message-ID: On Mon, Nov 5, 2012 at 12:13 PM, Tim Watson wrote: > Dude... > > On 4 Nov 2012, at 23:56, Tuncer Ayaz wrote: >> On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: >>> [snip] >> This could work. I'll let you all know once the prototype is ready >> for testing. > > You rock! :) > > Once you give the say so, I'll test all my plugins + projects > against your branch. Here's a quick prototype you can test: https://github.com/tuncer/rebar/compare/recursion It's not ready for merging and some of the internals are subject to change. We also have to discuss config inheritance and whether it should be made explicit or removed. From steven.charles.davis@REDACTED Tue Nov 6 01:35:29 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 5 Nov 2012 18:35:29 -0600 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> <5097102D.9080607@telegraphics.com.au> Message-ID: <332C7E89-856B-42A8-ADF6-64FC59A60231@gmail.com> OK, so I can't resist this example: Suppose the author writing in a natural language where the *exact same unicode characters* have entirely different semantics? Map = ... In Dutch, "Map" translates to "Folder" for an English speaker -- but the kick is that the Dutch also happen to be amazing English speakers - so it could mean what you expect a map to be or not. So the naming in the source means precisely nothing and does not help you (no matter how much post-processing you may choose to apply). I have enough of a hard time with computer languages without having to know over 200 natural languages to boot. Is the right decision, perhaps, to say that we need to agree on just one natural language for source - since that means you need to learn at most two languages? (And, also, did that natural language decision not happen already in every major computer system?) If you think it's a good idea to change that status quo, then please let me know which natural language to use (yes, even if the choice were not a natural language that I currently know), just so I have a limit on where I need to educate myself. I have enough issues with encodings without being asked to learn every natural language in existence. /s On Nov 5, 2012, at 8:28 AM, Steve Davis wrote: > It just seemed to be a short way to encapsulate the issues I see with the issue. There's no doubt that ROK's posts were far more detailed but a casual reader may miss the point. I have no doubt that if a coder can write in their native language then they would choose to do that more times than not. There's also no real reason that module or function names should not be "unicoded"... so the intent of the entire source could be natural-language encoded and balkanize the codebase. I'm not sure what the solution is, but is a gradual move towards introducing the ability to express source in natural language a solution to this problem? I'm not at all convinced of that. > > On Nov 4, 2012, at 7:02 PM, Toby Thain wrote: > >> On 04/11/12 7:57 PM, Steve Davis wrote: >>> I'm personally looking forward to attempting to maintain open source >>> kanji. An awesome challenge. >>> >> >> Is it that a lot of people on this thread don't read ROK's posts? Or is there another explanation for what just looks like wilful obtuseness? >> >> --T > From essen@REDACTED Tue Nov 6 02:27:02 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 06 Nov 2012 02:27:02 +0100 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <332C7E89-856B-42A8-ADF6-64FC59A60231@gmail.com> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> <5097102D.9080607@telegraphics.com.au> <332C7E89-856B-42A8-ADF6-64FC59A60231@gmail.com> Message-ID: <50986766.60904@ninenines.eu> On 11/06/2012 01:35 AM, Steve Davis wrote: > I have enough of a hard time with computer languages without having to know over 200 natural languages to boot. Please, don't be ridiculous, you'll never encounter 200 different natural languages in your life, code or not. It therefore does not matter if people write code in a language that you can't understand. You'll never have access to it anyway! Seen any French Erlang code yet? No? Then look harder. I don't see why you guys are fixated on allowing more people using their own language through Unicode like it's something bad. Many languages can already be used in Erlang with latin1, and they certainly are. We just want to extend that to languages that require Unicode for writing. Last I heard, Erlang models the real world. The world is concurrent. The world is also multilingual. The world has many different writing systems. Why would you want to prevent Erlang from catering to the billions of people who don't use English? -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From ok@REDACTED Tue Nov 6 04:24:45 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 6 Nov 2012 16:24:45 +1300 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <332C7E89-856B-42A8-ADF6-64FC59A60231@gmail.com> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> <5097102D.9080607@telegraphics.com.au> <332C7E89-856B-42A8-ADF6 -64FC59A60231@gmail.com> Message-ID: <0B3171CF-50B5-4541-AC21-06F1AED0C79A@cs.otago.ac.nz> On 6/11/2012, at 1:35 PM, Steve Davis wrote: > Suppose the author writing in a natural language where the *exact same unicode characters* have entirely different semantics? There's a science fiction story (sorry, I forget the title and author) where one gimmick is the ambiguity of "Pet Shop". > I have enough of a hard time with computer languages without having to know over 200 natural languages to boot. > > Is the right decision, perhaps, to say that we need to agree on just one natural language for source No. It is that each *exchange* needs to involve an agreed language. When I was at Quintus, we had a company in Israel develop some graphics software for us. (Good software too, but for unrelated reasons we never shipped it that I know of.) You say in the contract that the documentation will be in English (although several of our people could read Hebrew) and you say that the code and comments will be in English too. What Unicode makes possible is a contract where a company in Israel asks a company in the US to provide documentation and code in Hebrew, and there is no technical barrier to them doing it. It also lets the Israelis write scaffolding code in Hebrew if they want to. We do not need "One Ring to rule them all and in the darkness bind them". English for everything would suit me fine, if it _was_ English, and not American (:-). > - since that means you need to learn at most two languages? (And, also, did that natural language decision not happen already in every major computer system?) Every major computer system has been busy unmaking that decision for decades. > > If you think it's a good idea to change that status quo, then please let me know which natural language to use (yes, even if the choice were not a natural language that I currently know), just so I have a limit on where I need to educate myself. I have enough issues with encodings without being asked to learn every natural language in existence. Nobody is asking you to do that. For one thing, there are about six or seven thousand natural languages in existence. Unicode covers dozens of _scripts_ that I've never heard of. Heck, it includes scripts that nobody in the whole world can _read_. (Unless you believe that the author of 'Code Breaker' got it right, and I thought he was pretty convincing.) Yes, I do mean U+101D0 to U+101FD, the PHAISTOS DISC SIGN ... characters. We are *not* talking about something new here. As I keep pointing out, *nothing* stops people writing Erlang in Klingon. They don't even have to leave ASCII for that. It's just that _if_ they do, they have to take the consequences of nearly everyone else being unable to read it. Nobody has forced you to learn Klingon just because it's possible to write Erlang in Klingon, have they? Or let's take a real example. Erlang currently uses Latin-1. Latin-1 lets you write Icelandic. Has anybody been dumping Icelandic Erlang on your desk, _expecting you to read it_? Unicode introduces the problem that Erlang code might be written in a *script* that you cannot read. But the problem that it might be in a *language* you cannot make head or tail of has been with us for a long time, and the sky has not fallen. From maruthavanan_s@REDACTED Tue Nov 6 07:57:33 2012 From: maruthavanan_s@REDACTED (Maruthavanan Subbarayan) Date: Tue, 6 Nov 2012 01:57:33 -0500 Subject: [erlang-questions] Why I cannot use functions in gaurds Message-ID: HI, I would like to know if the first one is valid why not the second one? case L of {answer, N} when N == 42 -> true; _ -> false end. case L of {answer, N} when N == M:F(A) -> true; _ -> false end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Nov 6 08:01:26 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 6 Nov 2012 08:01:26 +0100 Subject: [erlang-questions] Why I cannot use functions in gaurds In-Reply-To: References: Message-ID: <1352185286.4728.1.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Please read "7.24 Guard Sequences" in http://www.erlang.org/doc/reference_manual/expressions.html. There is an explanation about what is allowed as a guard. bengt On Tue, 2012-11-06 at 01:57 -0500, Maruthavanan Subbarayan wrote: > HI, > > > I would like to know if the first one is valid why not the second > one? > > > case L of > {answer, N} when N == 42 -> true; > _ -> false > end. > > > case L of > {answer, N} when N == M:F(A) -> true; > _ -> false > end. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Tue Nov 6 10:18:30 2012 From: vances@REDACTED (Vance Shipley) Date: Tue, 6 Nov 2012 14:48:30 +0530 Subject: [erlang-questions] Distribution Carrier for Testing Message-ID: <20121106091830.GB290@aluminum.wavenet.com> Has anyone done any work on an alternative distribution carrier which would simulate network problems? I'd like to stress test a distributed application by introducing the sort of delays and disconnections which may occur in a real life wide area network. Alternatively can you point me at where I can hack the existing carrier top insert a random delay? -- -Vance From chandrashekhar.mullaparthi@REDACTED Tue Nov 6 10:51:28 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 6 Nov 2012 09:51:28 +0000 Subject: [erlang-questions] Distribution Carrier for Testing In-Reply-To: <20121106091830.GB290@aluminum.wavenet.com> References: <20121106091830.GB290@aluminum.wavenet.com> Message-ID: On 6 November 2012 09:18, Vance Shipley wrote: > Has anyone done any work on an alternative distribution carrier > which would simulate network problems? I'd like to stress test > a distributed application by introducing the sort of delays and > disconnections which may occur in a real life wide area network. > > Alternatively can you point me at where I can hack the existing > carrier top insert a random delay? > > Isn't it better to simulate the network delays outside of Erlang? Otherwise it wouldn't be a fair test. Have you considered using http://www.linuxfoundation.org/collaborate/workgroups/networking/netem ? cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Tue Nov 6 11:28:15 2012 From: vances@REDACTED (Vance Shipley) Date: Tue, 6 Nov 2012 15:58:15 +0530 Subject: [erlang-questions] Distribution Carrier for Testing In-Reply-To: References: <20121106091830.GB290@aluminum.wavenet.com> Message-ID: <20121106102815.GC292@aluminum.wavenet.com> On Tue, Nov 06, 2012 at 09:51:28AM +0000, Chandru wrote: } Have you considered using } http://www.linuxfoundation.org/collaborate/workgroups/networking/netem ? Thanks, that tip led to the discovery that OS X has a developer tool which does exactly what I want: http://mattgemmell.com/2011/07/25/network-link-conditioner-in-lion/ -- -Vance From watson.timothy@REDACTED Tue Nov 6 11:31:32 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 6 Nov 2012 10:31:32 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> Message-ID: On 5 Nov 2012, at 23:24, Tuncer Ayaz wrote: > On Mon, Nov 5, 2012 at 12:13 PM, Tim Watson wrote: >> Dude... >> >> On 4 Nov 2012, at 23:56, Tuncer Ayaz wrote: >>> On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: >>>> [snip] >>> This could work. I'll let you all know once the prototype is ready >>> for testing. >> >> You rock! :) >> >> Once you give the say so, I'll test all my plugins + projects >> against your branch. > > Here's a quick prototype you can test: > https://github.com/tuncer/rebar/compare/recursion > It's not ready for merging and some of the internals are subject to > change. > > We also have to discuss config inheritance and whether it should > be made explicit or removed. Great, I'll have a look at that after work today. I'm not married to the config inheritance either way, though the ability to override the config in sub_dirs using plugins is important to me. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 235 bytes Desc: Message signed with OpenPGP using GPGMail URL: From steven.charles.davis@REDACTED Tue Nov 6 14:19:39 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 6 Nov 2012 07:19:39 -0600 Subject: [erlang-questions] A proposal for Unicode variable and atom names in Erlang. In-Reply-To: <0B3171CF-50B5-4541-AC21-06F1AED0C79A@cs.otago.ac.nz> References: <9fd3f9d0-fe5d-4fbb-912b-c93aca264fc8@knuth> <507DD571.7070001@gmail.com> <507F2FF4.7060400@ninenines.eu> <507FC1B1.60204@ninenines.eu> <2c7cbb95-f1c4-4aba-be7f-2f9630a89fb6@googlegroups.com> <50852174.1060707@ninenines.eu> <13b88e95-cc75-4365-bcd6-3ae40ea1d6ac@googlegroups.com> <5097102D.9080607@telegraphics.com.au> <332C7E89-856B-42A8-ADF6 -64FC59A60231@gmail.com> <0B3171CF-50B5-4541-AC21-06F1AED0C79A@cs.otago.ac.nz> Message-ID: On Nov 5, 2012, at 9:24 PM, "Richard O'Keefe" wrote: > > Unicode introduces the problem that Erlang code might be written in > a *script* that you cannot read. But the problem that it might be > in a *language* you cannot make head or tail of has been with us for > a long time, and the sky has not fallen. > I have to admit this to be true. So maybe it's not such a problematic issue, after all. Regards, /s From arif.ishaq@REDACTED Tue Nov 6 15:03:28 2012 From: arif.ishaq@REDACTED (Arif Ishaq) Date: Tue, 6 Nov 2012 14:03:28 +0000 Subject: [erlang-questions] Heap alloc error in lists:foldl/3 Message-ID: <1CAB695D2C2A8F4BB0B242A5B44C75E9010AF5@ESESSMB301.ericsson.se> Hi, I'm a newbie, playing with a toy programme to see how parallel processing works in Erlang. The goal is to calculate the value of pi using Leibnitz series. The function pi/2 takes as arguments the number of processes, Np, and the number of terms handled by each process, Nt. The machine is an HP workstation with Windows Vista Enterprise. Here's the code: -module(pp). -compile(export_all). %% calculate PI using Np parallel processes, each calculating Nt terms of the %% Liebnitz series pi(Np, Nt) -> Collector = spawn(?MODULE, collect, [Np, self()]), [spawn_opt( fun() -> Collector ! foldsum((N-1)*Nt, N*Nt -1) end %% if I use sum, instead of foldsum, everything is ok ) || N <- lists:seq(1,Np)], receive Result -> io:format("result is ~p~n", [4 * Result]) end. sum(Kfrom, Kto) -> sum (Kfrom, Kto, 0). sum(Kfrom, Kto, Sum) when Kfrom =:= Kto -> Sum; sum(Kfrom, Kto, Sum) -> sum(Kfrom+1, Kto, Sum + contribution(Kfrom)). foldsum(Kfrom, Kto) -> lists:foldl( fun(K, Sum) -> Sum + contribution(K) end, 0, lists:seq(Kfrom,Kto)). contribution(K) -> Value = 1 / (2 * K + 1), case K rem 2 of 0 -> Value; 1 -> -Value end. collect (Np, For) -> collect(Np, For, 0, 0). collect (Np, For, Ncollected, Sum) when Np =:= Ncollected -> For ! Sum; collect(Np, For, Ncollected, Sum) -> receive R -> collect(Np, For, Ncollected + 1, Sum + R) end. If I try to calculate pi using 16 processes, each processing 1 million terms, the result is ok. If, on the other hand, I try with 10 million terms each, erlang crashes. Even after closing the werl window, the process keeps running and has to be killed brutally. Erlang R15B (erts-5.9) [smp:4:4] [async-threads:0] Eshell V5.9 (abort with ^G) 1> c(pp). {ok,pp} 2> pp:pi(16,1000000). result is 3.1415925910897737 ok 3> pp:pi(16,10000000). Crash dump was written to: erl_crash.dump eheap_alloc: Cannot allocate 40121760 bytes of memory (of type "heap"). Abnormal termination If I try to read the crash dump with the crash dump viewer tool, I get an error saying the file is not an erlang crash dump: erl_crash.dump is not an Erlang crash dump Why is this happening? Shouldn't foldl be tail recursive? Is this a bug? Or am I doing something wrong? Thanks and best regards Arif Ishaq -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Tue Nov 6 15:29:32 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 06 Nov 2012 15:29:32 +0100 Subject: [erlang-questions] Heap alloc error in lists:foldl/3 In-Reply-To: <1CAB695D2C2A8F4BB0B242A5B44C75E9010AF5@ESESSMB301.ericsson.se> References: <1CAB695D2C2A8F4BB0B242A5B44C75E9010AF5@ESESSMB301.ericsson.se> Message-ID: <50991ECC.30305@volny.cz> Hello. %% if I use sum, instead of foldsum, everything is ok This is because foldsum/2 creates a list of 10 000 000 integers (call to lists:seq/2). And you create Np of such lists in total, each one in a different process. A list in Erlang is a chain of cons pairs (as in Lisp). Each cons occupies 2 words, where one word is either 32bits or 64bits, depending on your HW architecture. Thus one such list takes 10 000 000 * 8 = 80MB (on 32-bit architecture) Hence it is fairly possible that your system simply ran out of memory. The version using sum/2 does not exhibit this behaviour, because it runs in constant space. HTH, Ladislav Lenart On 6.11.2012 15:03, Arif Ishaq wrote: > Hi, > > I'm a newbie, playing with a toy programme to see how parallel processing works > in Erlang. > > The goal is to calculate the value of pi using Leibnitz series. The function > pi/2 takes as arguments the number of processes, Np, and the number of terms > handled by each process, Nt. > > The machine is an HP workstation with Windows Vista Enterprise. > > > Here's the code: > > -module(pp). > -compile(export_all). > > %% calculate PI using Np parallel processes, each calculating Nt terms of the > %% Liebnitz series > > pi(Np, Nt) -> > Collector = spawn(?MODULE, collect, [Np, self()]), > > [spawn_opt( > fun() -> Collector ! foldsum((N-1)*Nt, N*Nt -1) end %% if I use > sum, instead of foldsum, everything is ok > ) || N <- lists:seq(1,Np)], > > receive > Result -> > io:format("result is ~p~n", [4 * Result]) > end. > > > sum(Kfrom, Kto) -> > sum (Kfrom, Kto, 0). > > sum(Kfrom, Kto, Sum) when Kfrom =:= Kto -> > Sum; > sum(Kfrom, Kto, Sum) -> > sum(Kfrom+1, Kto, Sum + contribution(Kfrom)). > > > foldsum(Kfrom, Kto) -> > lists:foldl( > fun(K, Sum) -> Sum + contribution(K) end, > 0, > lists:seq(Kfrom,Kto)). > > > contribution(K) -> > Value = 1 / (2 * K + 1), > case K rem 2 of > 0 -> > Value; > 1 -> > -Value > end. > > > collect (Np, For) -> > collect(Np, For, 0, 0). > > collect (Np, For, Ncollected, Sum) when Np =:= Ncollected -> > For ! Sum; > collect(Np, For, Ncollected, Sum) -> > receive > R -> > collect(Np, For, Ncollected + 1, Sum + R) > end. > > > > If I try to calculate pi using 16 processes, each processing 1 million terms, > the result is ok. > If, on the other hand, I try with 10 million terms each, erlang crashes. > Even after closing the werl window, the process keeps running and has to be > killed brutally. > > > Erlang R15B (erts-5.9) [smp:4:4] [async-threads:0] > > Eshell V5.9 (abort with ^G) > 1> c(pp). > {ok,pp} > 2> pp:pi(16,1000000). > result is 3.1415925910897737 > ok > 3> pp:pi(16,10000000). > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 40121760 bytes of memory (of type "heap"). > > > Abnormal termination > > If I try to read the crash dump with the crash dump viewer tool, I get an error > saying the file is not an erlang crash dump: > erl_crash.dump is not an Erlang crash dump > > > Why is this happening? Shouldn't foldl be tail recursive? Is this a bug? Or am I > doing something wrong? > > > Thanks and best regards > Arif Ishaq > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From attila.r.nohl@REDACTED Tue Nov 6 15:33:20 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 6 Nov 2012 15:33:20 +0100 Subject: [erlang-questions] Simple wrapper around dbg? Message-ID: Hello! I can trace a function call with specific arguments with a command like this: dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), exception_trace() end)). However, it's a long to type, I'd like to have a wrapper around it. The naive solution doesn't even compile: -module(d). -export([mfa/3]). mfa(M, F, A) -> dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), exception_trace() end)). because there are no return_trace() and exception_trace() functions in the module. Even if it'd compile, I couldn't call it like this: d:mfa(foo, bar, [baz, _]). because the _ variable is not bound. Is there a simple workaround or shall I start to read up on parse_transforms? From send2philip@REDACTED Tue Nov 6 16:44:29 2012 From: send2philip@REDACTED (Philip Clarke) Date: Tue, 6 Nov 2012 15:44:29 +0000 Subject: [erlang-questions] Simple wrapper around dbg? In-Reply-To: References: Message-ID: Hi Attila, This might not be answering the exact question you are asking, but have you tried using the built in trace patterns ? They can save you a lot of typing. The build in trace patterns are documented in the dbg man page (under the tpl/0 function). For example, you can use dbg:tpl(foo, bar, x) as an alias for dbg:tpl(foo, bar, x, [{'_', [], [{exception_trace}]}]). Best regards Philip On Tue, Nov 6, 2012 at 2:33 PM, Attila Rajmund Nohl wrote: > Hello! > > I can trace a function call with specific arguments with a command like > this: > > dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), > exception_trace() end)). > > However, it's a long to type, I'd like to have a wrapper around it. > The naive solution doesn't even compile: > > -module(d). > > -export([mfa/3]). > > mfa(M, F, A) -> > dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), > exception_trace() end)). > > because there are no return_trace() and exception_trace() functions in > the module. Even if it'd compile, I couldn't call it like this: > > d:mfa(foo, bar, [baz, _]). > > because the _ variable is not bound. Is there a simple workaround or > shall I start to read up on parse_transforms? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arif.ishaq@REDACTED Tue Nov 6 17:52:03 2012 From: arif.ishaq@REDACTED (Arif Ishaq) Date: Tue, 6 Nov 2012 16:52:03 +0000 Subject: [erlang-questions] Heap alloc error in lists:foldl/3 In-Reply-To: <50991ECC.30305@volny.cz> References: <1CAB695D2C2A8F4BB0B242A5B44C75E9010AF5@ESESSMB301.ericsson.se> <50991ECC.30305@volny.cz> Message-ID: <1CAB695D2C2A8F4BB0B242A5B44C75E9010B85@ESESSMB301.ericsson.se> Thanks for your answer. I understand that 16 such lists would occupy at least 16 * 80 MB = 480 MB, but I have a machine with 2 GB of physical RAM and as much again of virtual memory. I was monitoring the memory usage in the system and it didn't exceed 1.5 GB. I suppose that the problem was nevertheless just that. Is there any way of "catching" the eheap_alloc in order to terminate things gracefully? Thanks again Arif -----Original Message----- From: Ladislav Lenart [mailto:lenartlad@REDACTED] Sent: marted? 6 novembre 2012 15.30 To: Arif Ishaq Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Heap alloc error in lists:foldl/3 Hello. %% if I use sum, instead of foldsum, everything is ok This is because foldsum/2 creates a list of 10 000 000 integers (call to lists:seq/2). And you create Np of such lists in total, each one in a different process. A list in Erlang is a chain of cons pairs (as in Lisp). Each cons occupies 2 words, where one word is either 32bits or 64bits, depending on your HW architecture. Thus one such list takes 10 000 000 * 8 = 80MB (on 32-bit architecture) Hence it is fairly possible that your system simply ran out of memory. The version using sum/2 does not exhibit this behaviour, because it runs in constant space. HTH, Ladislav Lenart On 6.11.2012 15:03, Arif Ishaq wrote: > Hi, > > I'm a newbie, playing with a toy programme to see how parallel > processing works in Erlang. > > The goal is to calculate the value of pi using Leibnitz series. The > function > pi/2 takes as arguments the number of processes, Np, and the number of > terms handled by each process, Nt. > > The machine is an HP workstation with Windows Vista Enterprise. > > > Here's the code: > > -module(pp). > -compile(export_all). > > %% calculate PI using Np parallel processes, each calculating Nt terms > of the %% Liebnitz series > > pi(Np, Nt) -> > Collector = spawn(?MODULE, collect, [Np, self()]), > > [spawn_opt( > fun() -> Collector ! foldsum((N-1)*Nt, N*Nt -1) end %% if I use > sum, instead of foldsum, everything is ok > ) || N <- lists:seq(1,Np)], > > receive > Result -> > io:format("result is ~p~n", [4 * Result]) > end. > > > sum(Kfrom, Kto) -> > sum (Kfrom, Kto, 0). > > sum(Kfrom, Kto, Sum) when Kfrom =:= Kto -> > Sum; > sum(Kfrom, Kto, Sum) -> > sum(Kfrom+1, Kto, Sum + contribution(Kfrom)). > > > foldsum(Kfrom, Kto) -> > lists:foldl( > fun(K, Sum) -> Sum + contribution(K) end, > 0, > lists:seq(Kfrom,Kto)). > > > contribution(K) -> > Value = 1 / (2 * K + 1), > case K rem 2 of > 0 -> > Value; > 1 -> > -Value > end. > > > collect (Np, For) -> > collect(Np, For, 0, 0). > > collect (Np, For, Ncollected, Sum) when Np =:= Ncollected -> > For ! Sum; > collect(Np, For, Ncollected, Sum) -> > receive > R -> > collect(Np, For, Ncollected + 1, Sum + R) > end. > > > > If I try to calculate pi using 16 processes, each processing 1 million > terms, the result is ok. > If, on the other hand, I try with 10 million terms each, erlang crashes. > Even after closing the werl window, the process keeps running and has > to be killed brutally. > > > Erlang R15B (erts-5.9) [smp:4:4] [async-threads:0] > > Eshell V5.9 (abort with ^G) > 1> c(pp). > {ok,pp} > 2> pp:pi(16,1000000). > result is 3.1415925910897737 > ok > 3> pp:pi(16,10000000). > > Crash dump was written to: erl_crash.dump > eheap_alloc: Cannot allocate 40121760 bytes of memory (of type "heap"). > > > Abnormal termination > > If I try to read the crash dump with the crash dump viewer tool, I get > an error saying the file is not an erlang crash dump: > erl_crash.dump is not an Erlang crash dump > > > Why is this happening? Shouldn't foldl be tail recursive? Is this a > bug? Or am I doing something wrong? > > > Thanks and best regards > Arif Ishaq > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From kenneth.lundin@REDACTED Tue Nov 6 18:27:22 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 6 Nov 2012 18:27:22 +0100 Subject: [erlang-questions] Simple wrapper around dbg? In-Reply-To: References: Message-ID: The parse transform is already written for you, see http://www.erlang.org/documentation/doc-5.2/lib/stdlib-1.11.0/doc/html/ms_transform.html /Kenneth , Erlang/OTP Ericsson Den 6 nov 2012 15:33 skrev "Attila Rajmund Nohl" : > Hello! > > I can trace a function call with specific arguments with a command like > this: > > dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), > exception_trace() end)). > > However, it's a long to type, I'd like to have a wrapper around it. > The naive solution doesn't even compile: > > -module(d). > > -export([mfa/3]). > > mfa(M, F, A) -> > dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), > exception_trace() end)). > > because there are no return_trace() and exception_trace() functions in > the module. Even if it'd compile, I couldn't call it like this: > > d:mfa(foo, bar, [baz, _]). > > because the _ variable is not bound. Is there a simple workaround or > shall I start to read up on parse_transforms? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Tue Nov 6 19:07:29 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 6 Nov 2012 19:07:29 +0100 Subject: [erlang-questions] R1502 ssl dropping byte(s)? In-Reply-To: References: Message-ID: Hi! I think you will be better of using active once but however see comment below ... 2012/11/5, sasa : > Thank you for the response. > > Obviously, active once should resolve my problem, and I will modify the > code accordingly. > > In the meantime, I have resolved the issue by raising ssl:recv timeout to > 15 seconds. In my environment this essentially means that timeout does not > occur. > I'd like to stress that in almost 2 years of production, I have never > experienced this issue with R14. > It is also very strange that I was always loosing first byte of the message > and not more. Which still leads me to believe that some bug might have been > introduced regarding passive sockets. I agree that we could change the implementation of ssl:recv to handle the timeout on the server side and avoid this problem and that is how it should (TM) work! We will do that. Regards Ingela Erlang/OTP team - Ericsson AB From g@REDACTED Tue Nov 6 20:58:18 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 6 Nov 2012 13:58:18 -0600 Subject: [erlang-questions] Simple wrapper around dbg? In-Reply-To: References: Message-ID: On Tue, Nov 6, 2012 at 8:33 AM, Attila Rajmund Nohl wrote: > Hello! > > I can trace a function call with specific arguments with a command like this: > > dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), > exception_trace() end)). > > However, it's a long to type, I'd like to have a wrapper around it. It's very limited, but for basic tracing (modules and functions with sensible defaults) I use e2_debug: https://github.com/gar1t/e2/blob/master/src/e2_debug.erl Garrett From olav@REDACTED Tue Nov 6 23:16:41 2012 From: olav@REDACTED (Olav Frengstad) Date: Tue, 6 Nov 2012 23:16:41 +0100 Subject: [erlang-questions] Construct and match binaries Message-ID: Hey, I'm trying to wrap my head around a problem I have with constructing and matching a binary. Take the following example (will fail with "a binary field without size is only allowed at the end of a binary pattern"): 2> A = <<$a>>, B = <<$b>>, 2> <> = <<"a:b">>. * 2: a binary field without size is only allowed at the end of a binary pattern Using size specification yields the expected result: 3> <> = <<"a:b">>. <<"a:b">> Even equality checks works: 4> <> == <<"a:b">>. true I would assume that the size of the binary is known when performing construction and therefore the first example should work (considering <> equality checks works). Can anyone shed some light on what's happening here? Cheers, Olav From jayson.barley@REDACTED Tue Nov 6 23:26:08 2012 From: jayson.barley@REDACTED (Jayson Barley) Date: Tue, 6 Nov 2012 14:26:08 -0800 Subject: [erlang-questions] Construct and match binaries In-Reply-To: References: Message-ID: Switch the match around and it works. 1> A = <<$a>>. <<"a">> 2> B = <<$b>>. <<"b">> 3> <<"a:b">> = <>. <<"a:b">> If I understand the way it works correctly you are attempting to assign the right side to the left side in your example. If I am wrong I am sure one of the smarter Erlangers will flog me. Jayson On Tue, Nov 6, 2012 at 2:16 PM, Olav Frengstad wrote: > Hey, > > I'm trying to wrap my head around a problem I have with constructing > and matching a binary. > > Take the following example (will fail with "a binary field without > size is only allowed at the end of a binary pattern"): > > 2> A = <<$a>>, B = <<$b>>, > 2> <> = <<"a:b">>. > * 2: a binary field without size is only allowed at the end of a binary > pattern > > Using size specification yields the expected result: > 3> <> = <<"a:b">>. > <<"a:b">> > > Even equality checks works: > 4> <> == <<"a:b">>. > true > > I would assume that the size of the binary is known when performing > construction and therefore the first example should work (considering > <> equality checks works). > > Can anyone shed some light on what's happening here? > > Cheers, > Olav > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olav@REDACTED Tue Nov 6 23:42:32 2012 From: olav@REDACTED (Olav Frengstad) Date: Tue, 6 Nov 2012 23:42:32 +0100 Subject: [erlang-questions] Construct and match binaries In-Reply-To: References: Message-ID: Sorry, this should have gone to the list: Hey, I'm trying to use a second variable as a guard for a binary match: 1> F = fun(<>, {A, B}) -> ok; (_,_) -> fail end. #Fun 2> F(<<"a:b">>, {<<$a>>, <<$b>>}). fail After some more digging [1] I do believe this is not possible without an actual guard expression similar to this: fun(Bin, {A, B}) when Bin == <> -> ok end. I'm still interested in knowing more about why my first example is not working Cheers, Olav 2012/11/6, Jayson Barley : > Switch the match around and it works. > 1> A = <<$a>>. > <<"a">> > 2> B = <<$b>>. > <<"b">> > 3> <<"a:b">> = <>. > <<"a:b">> > > If I understand the way it works correctly you are attempting to assign the > right side to the left side in your example. If I am wrong I am sure one of > the smarter Erlangers will flog me. > > Jayson > > > On Tue, Nov 6, 2012 at 2:16 PM, Olav Frengstad wrote: > >> Hey, >> >> I'm trying to wrap my head around a problem I have with constructing >> and matching a binary. >> >> Take the following example (will fail with "a binary field without >> size is only allowed at the end of a binary pattern"): >> >> 2> A = <<$a>>, B = <<$b>>, >> 2> <> = <<"a:b">>. >> * 2: a binary field without size is only allowed at the end of a binary >> pattern >> >> Using size specification yields the expected result: >> 3> <> = <<"a:b">>. >> <<"a:b">> >> >> Even equality checks works: >> 4> <> == <<"a:b">>. >> true >> >> I would assume that the size of the binary is known when performing >> construction and therefore the first example should work (considering >> <> equality checks works). >> >> Can anyone shed some light on what's happening here? >> >> Cheers, >> Olav >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -- Med Vennlig Hilsen Olav Frengstad Systemutvikler // FWT +47 920 42 090 From freza@REDACTED Tue Nov 6 23:25:28 2012 From: freza@REDACTED (Jachym Holecek) Date: Tue, 6 Nov 2012 17:25:28 -0500 Subject: [erlang-questions] Construct and match binaries In-Reply-To: References: Message-ID: <20121106222528.GA24376@circlewave.net> I'm not a language-lawyer, but will give it a try. # Olav Frengstad 2012-11-06: > I'm trying to wrap my head around a problem I have with constructing > and matching a binary. > > Take the following example (will fail with "a binary field without > size is only allowed at the end of a binary pattern"): > > 2> A = <<$a>>, B = <<$b>>, > 2> <> = <<"a:b">>. > * 2: a binary field without size is only allowed at the end of a binary pattern You're performing pattern matching here, no term construction takes place. The LHS thing is a prescription of expected shape of the RHS thing. First step that would have to take place to evaluate it would be to fetch X/binary prefix (I'm using X instead of A, because comparing against the value already in A would be the next step to evaluate -- we're not there yet!), but we don't know how long it is supposed to be, so the evaluator/compiler gets confused -- surely you didn't mean to consume all RHS binary into X, obviously leaving $: and B/binary with nothing to match against. This seems about the only interpretation that offers itself for X/binary anywhere but at tail position, an it is clearly absurd... > Using size specification yields the expected result: > 3> <> = <<"a:b">>. > <<"a:b">> That's better, we first fetch X:1/binary and than compare against what has previously been bound to A. It matches, good, let's proceed with the rest, following the same steps. Oh good, all matches, success! > Even equality checks works: > 4> <> == <<"a:b">>. > true Here you build up a new term on LHS, the sizes of A/binary and B/binary things are implied -- they're binary or bitstrings values, these know their own size, so no need to force programmer to overspecify things, he/she wouldn't even know the size statically in many cases. Then you build up the RHS value (this is constant, so no need to do anything at runtime if it were compiled code, but that is a detail) and call builtin compare_for_equality(Lhs, Rhs), the name is made up and since "==" is just syntactic sugar for function vall, I'm not even sure the order of evaluation is even defined here, my choice of LTR is just an example. > I would assume that the size of the binary is known when performing > construction and therefore the first example should work (considering > <> equality checks works). > > Can anyone shed some light on what's happening here? The second one is a construction, the first one is actually the opposite of that... "deconstruction" maybe, "destruction" sounds a bit sinister and to my understanting indeed means that too :-), but I'm not a native English speaker. HTH, -- Jachym From ok@REDACTED Wed Nov 7 04:26:04 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 7 Nov 2012 16:26:04 +1300 Subject: [erlang-questions] Why I cannot use functions in gaurds In-Reply-To: References: Message-ID: On 6/11/2012, at 7:57 PM, Maruthavanan Subbarayan wrote: > I would like to know if the first one is valid why not the second one? (a) Because the language definition has always said so. (b) This topic has been beaten to death in this mailing list and is explained in every Erlang book I've seen. (c) The short answer is that GUARDS ARE NOT EXPRESSIONS. (d) The long answer traces this back to concurrent logic programming languages (look at Flat Concurrent Prolog and Strand88) and to the fact that guards are supposed to be certain to terminate in a finite time AND to have no side effects. (e) If/when Erlang gets abstract patterns, it will be as safe to use them in guards as anything else currently allowed in guards. It is _always_ possible to reshape your design so there is no use of functions in guards, and the result is _usually_ clearer. > > case L of > {answer, N} when N == M:F(A) -> true; > _ -> false > end. In this case you can write X = M:F(A), case L of {answer, X} -> true ; _ -> false end or case L of {answer, X} -> case M:F(A) of X -> true ; _ -> false end ; _ -> false end From demeshchuk@REDACTED Wed Nov 7 08:03:05 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Wed, 7 Nov 2012 11:03:05 +0400 Subject: [erlang-questions] Future of epmd Message-ID: Hello, list. As you may know, epmd may sometimes misbehave. Loses nodes and doesn't add them back, for example (unless you do some magic, like this: http://sidentdv.livejournal.com/769.html ). A while ago, Peter Lemenkov got a wonderful idea that epmd may be actually written in Erlang instead. EPMD protocol is very simple, and it's much easier to implement all the failover scenarios in Erlang than in C. So far, here's a prototype of his: https://github.com/lemenkov/erlpmd When hacking it, I've noticed several things: 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP connection. Closing of which is a signal of node disconnection. This approach does have a point, since we can use keep-alive and periodically check that the node is still here on the TCP level. But next, some weird thing follows: 2. When we send other control messages from a node connected to epmd, we establish a new TCP connection, each time. Could use the main connection instead. Was it a design decision or it's just a legacy thing? 3. The client (node) part of epmd seems to be all implemented in C and sealed inside ERTS. However, it seems like this code could be implemented inside the net_kernel module instead (or something similar). Why bother and switch to Erlang when everything is already written and working? First of all, sometimes it doesn't really work in big clusters (see my first link). And, secondly, using Erlang we can easily extend the protocol. For example, add auto-discovery feature, which has been discussed on the list a lot. Add an ability for a node to reconnect if its TCP session has been terminated for some reason. Add lookups of nodes by prefix (like, "give me all nodes that match mynode@*"). The list can be probably extended further. Do you think such a thing (with full backwards compatibility, of course) could go upstream? Also, a question for epmd maintainers: is it going to change at all, or the protocol is considered to be full enough for its purposes? -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.eugene.turner@REDACTED Wed Nov 7 08:22:17 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Wed, 7 Nov 2012 16:22:17 +0900 Subject: [erlang-questions] Wiki in Erlang/OTP? Message-ID: Not listed in the obvious place: http://en.wikipedia.org/wiki/Comparison_of_wiki_software ISTR some benchmark of Riak (or something similar) on Wikipedia-like traffic patterns and loads showed that it did rather well. For site-specific/topic-specific wikis, maybe there's not much point. For wikifarms however, maybe a more graceful way to scale and keep server budgets cheap as well? Regards, Michael Turner Project Persephone 1-25-33 Takadanobaba Shinjuku-ku Tokyo 169-0075 (+81) 90-5203-8682 turner@REDACTED http://www.projectpersephone.org/ "Love does not consist in gazing at each other, but in looking outward together in the same direction." -- Antoine de Saint-Exup?ry From demeshchuk@REDACTED Wed Nov 7 08:28:58 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Wed, 7 Nov 2012 11:28:58 +0400 Subject: [erlang-questions] Wiki in Erlang/OTP? In-Reply-To: References: Message-ID: Wikia is using Riak: http://basho.com/news/wikia/ On Wed, Nov 7, 2012 at 11:22 AM, Michael Turner < michael.eugene.turner@REDACTED> wrote: > Not listed in the obvious place: > > http://en.wikipedia.org/wiki/Comparison_of_wiki_software > > ISTR some benchmark of Riak (or something similar) on Wikipedia-like > traffic patterns and loads showed that it did rather well. For > site-specific/topic-specific wikis, maybe there's not much point. For > wikifarms however, maybe a more graceful way to scale and keep server > budgets cheap as well? > > Regards, > Michael Turner > Project Persephone > 1-25-33 Takadanobaba > Shinjuku-ku Tokyo 169-0075 > (+81) 90-5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Wed Nov 7 10:32:42 2012 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 07 Nov 2012 01:32:42 -0800 Subject: [erlang-questions] Wiki in Erlang/OTP? In-Reply-To: References: Message-ID: <509A2ABA.7010007@gmail.com> You might be thinking of this paper: "Scalaris: reliable transactional p2p key/value store" from 2008 (http://dl.acm.org/citation.cfm?id=1411280) since this showed Scalaris facilitating a Wikipedia frontend. On 11/06/2012 11:22 PM, Michael Turner wrote: > Not listed in the obvious place: > > http://en.wikipedia.org/wiki/Comparison_of_wiki_software > > ISTR some benchmark of Riak (or something similar) on Wikipedia-like > traffic patterns and loads showed that it did rather well. For > site-specific/topic-specific wikis, maybe there's not much point. For > wikifarms however, maybe a more graceful way to scale and keep server > budgets cheap as well? > > Regards, > Michael Turner > Project Persephone > 1-25-33 Takadanobaba > Shinjuku-ku Tokyo 169-0075 > (+81) 90-5203-8682 > turner@REDACTED > http://www.projectpersephone.org/ > > "Love does not consist in gazing at each other, but in looking outward > together in the same direction." -- Antoine de Saint-Exup?ry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From dm.klionsky@REDACTED Wed Nov 7 13:46:13 2012 From: dm.klionsky@REDACTED (Dmitry Klionsky) Date: Wed, 07 Nov 2012 15:46:13 +0300 Subject: [erlang-questions] Simple wrapper around dbg? In-Reply-To: References: Message-ID: <509A5815.6090503@gmail.com> Hi! have a look at there links: http://www.snookles.com/erlang/user_default.erl https://github.com/eproxus/erlang_user_utilities/blob/master/user_default.erl On 11/06/2012 05:33 PM, Attila Rajmund Nohl wrote: > Hello! > > I can trace a function call with specific arguments with a command like this: > > dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), > exception_trace() end)). > > However, it's a long to type, I'd like to have a wrapper around it. > The naive solution doesn't even compile: > > -module(d). > > -export([mfa/3]). > > mfa(M, F, A) -> > dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), > exception_trace() end)). > > because there are no return_trace() and exception_trace() functions in > the module. Even if it'd compile, I couldn't call it like this: > > d:mfa(foo, bar, [baz, _]). > > because the _ variable is not bound. Is there a simple workaround or > shall I start to read up on parse_transforms? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Best regards, Dmitry Klionsky From dmercer@REDACTED Wed Nov 7 18:59:45 2012 From: dmercer@REDACTED (David Mercer) Date: Wed, 7 Nov 2012 11:59:45 -0600 Subject: [erlang-questions] Future of epmd In-Reply-To: References: Message-ID: <03c601cdbd11$ac568f20$0503ad60$@gmail.com> This seems like an outstanding idea. If I understand correctly, you could have the first node that starts up on a host also start the erlpmd application. If the node running erlpmd goes down, one of the other nodes on the same host starts the erlpmd application. Do I have this right? Cheers, DBM From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Dmitry Demeshchuk Sent: Wednesday, November 07, 2012 01:03 To: erlang-questions Subject: [erlang-questions] Future of epmd Hello, list. As you may know, epmd may sometimes misbehave. Loses nodes and doesn't add them back, for example (unless you do some magic, like this: http://sidentdv.livejournal.com/769.html ). A while ago, Peter Lemenkov got a wonderful idea that epmd may be actually written in Erlang instead. EPMD protocol is very simple, and it's much easier to implement all the failover scenarios in Erlang than in C. So far, here's a prototype of his: https://github.com/lemenkov/erlpmd When hacking it, I've noticed several things: 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP connection. Closing of which is a signal of node disconnection. This approach does have a point, since we can use keep-alive and periodically check that the node is still here on the TCP level. But next, some weird thing follows: 2. When we send other control messages from a node connected to epmd, we establish a new TCP connection, each time. Could use the main connection instead. Was it a design decision or it's just a legacy thing? 3. The client (node) part of epmd seems to be all implemented in C and sealed inside ERTS. However, it seems like this code could be implemented inside the net_kernel module instead (or something similar). Why bother and switch to Erlang when everything is already written and working? First of all, sometimes it doesn't really work in big clusters (see my first link). And, secondly, using Erlang we can easily extend the protocol. For example, add auto-discovery feature, which has been discussed on the list a lot. Add an ability for a node to reconnect if its TCP session has been terminated for some reason. Add lookups of nodes by prefix (like, "give me all nodes that match mynode@*"). The list can be probably extended further. Do you think such a thing (with full backwards compatibility, of course) could go upstream? Also, a question for epmd maintainers: is it going to change at all, or the protocol is considered to be full enough for its purposes? -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Wed Nov 7 20:15:54 2012 From: per@REDACTED (Per Hedeland) Date: Wed, 7 Nov 2012 20:15:54 +0100 (CET) Subject: [erlang-questions] Future of epmd In-Reply-To: Message-ID: <201211071915.qA7JFsCZ034947@pluto.hedeland.org> Dmitry Demeshchuk wrote: > >1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP >connection. Closing of which is a signal of node disconnection. This >approach does have a point, since we can use keep-alive and periodically >check that the node is still here on the TCP level. No, the point is rather the opposite - since this is always a local loopback connection, epmd is guaranteed (by the OS/kernel) to "immediately" find out that the erlang node died (or disconnected), by means of socket close (EOF) - no matter how the death came about. TCP keep-alives, that by necessity incur a delay (and the default is typically huge) before detection of a problem, are not only inferior but pointless in this scenario. --Per Hedeland From demeshchuk@REDACTED Wed Nov 7 20:26:18 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Wed, 7 Nov 2012 23:26:18 +0400 Subject: [erlang-questions] Future of epmd In-Reply-To: <201211071915.qA7JFsCZ034947@pluto.hedeland.org> References: <201211071915.qA7JFsCZ034947@pluto.hedeland.org> Message-ID: Hmm. I thought that something like "kill -9" wouldn't inform us that the socket has been closed until we try to do something with it. But checked ? and yes, you are right, keep-alive is even bad in that case, since without it we immediately get a {tcp_closed, Socket} message. On Wed, Nov 7, 2012 at 11:15 PM, Per Hedeland wrote: > Dmitry Demeshchuk wrote: > > > >1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP > >connection. Closing of which is a signal of node disconnection. This > >approach does have a point, since we can use keep-alive and periodically > >check that the node is still here on the TCP level. > > No, the point is rather the opposite - since this is always a local > loopback connection, epmd is guaranteed (by the OS/kernel) to > "immediately" find out that the erlang node died (or disconnected), by > means of socket close (EOF) - no matter how the death came about. TCP > keep-alives, that by necessity incur a delay (and the default is > typically huge) before detection of a problem, are not only inferior but > pointless in this scenario. > > --Per Hedeland > -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Wed Nov 7 20:32:55 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 7 Nov 2012 12:32:55 -0700 Subject: [erlang-questions] using ctrl-g in emacs in erl Message-ID: I've tried a few things with trying to get ctrl-g to work in emacs. I've run erl with M-x shell and M-x terminal-emulator. M-x terminal emulator is closer, but when I press ctrl-g it just puts ^G in the window and when I press enter, it brings the erlang shell command line back without doing anything. Is there a way to do ctrl-g with another command. I've looked at the other commands with ctrl-c, but they don't show the User Switch command prompt. Thanks, Wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From james@REDACTED Wed Nov 7 20:47:13 2012 From: james@REDACTED (James Aimonetti) Date: Wed, 7 Nov 2012 11:47:13 -0800 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: References: Message-ID: <20121107114713.412bb836@thinky64.2600hz.com> On Wed, 7 Nov 2012 12:32:55 -0700 Wes James wrote: > I've tried a few things with trying to get ctrl-g to work in emacs. I've > run erl with M-x shell and M-x terminal-emulator. M-x terminal emulator is > closer, but when I press ctrl-g it just puts ^G in the window and when I > press enter, it brings the erlang shell command line back without doing > anything. Is there a way to do ctrl-g with another command. I've looked at > the other commands with ctrl-c, but they don't show the User Switch command > prompt. > > Thanks, > > Wes Try Ctrl-q Ctrl-g -- James Aimonetti Distributed Systems Engineer / DJ MC_ 2600hz | http://2600hz.com sip:james@REDACTED tel: 415.886.7905 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From comptekki@REDACTED Wed Nov 7 20:52:12 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 7 Nov 2012 12:52:12 -0700 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: <20121107114713.412bb836@thinky64.2600hz.com> References: <20121107114713.412bb836@thinky64.2600hz.com> Message-ID: I tried that and it goes back to the Eshell. One thing I just noticed is when I'm doing commands, the shell prompt increments. After doing the ctrl-g or ctrl-q ctrl-g, the shell starts back at 1. wes On Wed, Nov 7, 2012 at 12:47 PM, James Aimonetti wrote: > On Wed, 7 Nov 2012 12:32:55 -0700 > Wes James wrote: > > > I've tried a few things with trying to get ctrl-g to work in emacs. I've > > run erl with M-x shell and M-x terminal-emulator. M-x terminal emulator > is > > closer, but when I press ctrl-g it just puts ^G in the window and when I > > press enter, it brings the erlang shell command line back without doing > > anything. Is there a way to do ctrl-g with another command. I've looked > at > > the other commands with ctrl-c, but they don't show the User Switch > command > > prompt. > > > > Thanks, > > > > Wes > > Try Ctrl-q Ctrl-g > > > -- > James Aimonetti > Distributed Systems Engineer / DJ MC_ > > 2600hz | http://2600hz.com > sip:james@REDACTED > tel: 415.886.7905 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enewhuis@REDACTED Wed Nov 7 20:52:47 2012 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 7 Nov 2012 13:52:47 -0600 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: <20121107114713.412bb836@thinky64.2600hz.com> References: <20121107114713.412bb836@thinky64.2600hz.com> Message-ID: Data point: C-q C-g does not work for me on emacs 23.2.1 On Nov 7, 2012, at 1:47 PM, James Aimonetti wrote: > On Wed, 7 Nov 2012 12:32:55 -0700 > Wes James wrote: > >> I've tried a few things with trying to get ctrl-g to work in emacs. I've >> run erl with M-x shell and M-x terminal-emulator. M-x terminal emulator is >> closer, but when I press ctrl-g it just puts ^G in the window and when I >> press enter, it brings the erlang shell command line back without doing >> anything. Is there a way to do ctrl-g with another command. I've looked at >> the other commands with ctrl-c, but they don't show the User Switch command >> prompt. >> >> Thanks, >> >> Wes > > Try Ctrl-q Ctrl-g > > > -- > James Aimonetti > Distributed Systems Engineer / DJ MC_ > > 2600hz | http://2600hz.com > sip:james@REDACTED > tel: 415.886.7905 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From james@REDACTED Wed Nov 7 21:27:12 2012 From: james@REDACTED (James Aimonetti) Date: Wed, 7 Nov 2012 12:27:12 -0800 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: References: <20121107114713.412bb836@thinky64.2600hz.com> Message-ID: <20121107122712.181d5e27@thinky64.2600hz.com> Do you have Distel mode installed/enabled? I do, if that makes a difference. (emacs@REDACTED)1> 1+1. 2 (emacs@REDACTED)2> 2+2. 4 (emacs@REDACTED)3> ^G User switch command --> q Process inferior-erlang finished That's what happens when I use Ctrl-q Ctrl-g and use 'q' to quit the shell. This is GNU Emacs 23.3.1 (GNU/Linux x86_64), but I know this sequence has worked for me for several previous versions of emacs as well. On Wed, 7 Nov 2012 12:52:12 -0700 Wes James wrote: > I tried that and it goes back to the Eshell. One thing I just noticed is > when I'm doing commands, the shell prompt increments. After doing the > ctrl-g or ctrl-q ctrl-g, the shell starts back at 1. > > wes > > > On Wed, Nov 7, 2012 at 12:47 PM, James Aimonetti wrote: > > > On Wed, 7 Nov 2012 12:32:55 -0700 > > Wes James wrote: > > > > > I've tried a few things with trying to get ctrl-g to work in emacs. I've > > > run erl with M-x shell and M-x terminal-emulator. M-x terminal emulator > > is > > > closer, but when I press ctrl-g it just puts ^G in the window and when I > > > press enter, it brings the erlang shell command line back without doing > > > anything. Is there a way to do ctrl-g with another command. I've looked > > at > > > the other commands with ctrl-c, but they don't show the User Switch > > command > > > prompt. > > > > > > Thanks, > > > > > > Wes > > > > Try Ctrl-q Ctrl-g > > > > > > -- > > James Aimonetti > > Distributed Systems Engineer / DJ MC_ > > > > 2600hz | http://2600hz.com > > sip:james@REDACTED > > tel: 415.886.7905 > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > -- James Aimonetti Distributed Systems Engineer / DJ MC_ 2600hz | http://2600hz.com sip:james@REDACTED tel: 415.886.7905 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From comptekki@REDACTED Wed Nov 7 21:43:29 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 7 Nov 2012 13:43:29 -0700 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: <20121107122712.181d5e27@thinky64.2600hz.com> References: <20121107114713.412bb836@thinky64.2600hz.com> <20121107122712.181d5e27@thinky64.2600hz.com> Message-ID: Thanks for the prod in the right direction! I googled distel and I found: http://parijatmishra.wordpress.com/2008/08/15/up-and-running-with-emacs-erlang-and-distel/ They mentioned going in to erlang mode and doing some things there and I have erlang mode installed so I fired up emacs and type in m-x erlange-mode and then pressed c-c c-z and it started an erlang shell. I then pressed ctrl-g and it put a ^G on the line, but this time when I pressed enter it brought up the User switch command...... Thanks, wes On Wed, Nov 7, 2012 at 1:27 PM, James Aimonetti wrote: > Do you have Distel mode installed/enabled? I do, if that makes a > difference. > > (emacs@REDACTED)1> 1+1. > 2 > (emacs@REDACTED)2> 2+2. > 4 > (emacs@REDACTED)3> ^G > > User switch command > --> q > > Process inferior-erlang finished > > That's what happens when I use Ctrl-q Ctrl-g and use 'q' to quit > the > shell. > > This is GNU Emacs 23.3.1 (GNU/Linux x86_64), but I know this sequence has > worked > for me for several previous versions of emacs as well. > > On Wed, 7 Nov 2012 12:52:12 -0700 > Wes James wrote: > > > I tried that and it goes back to the Eshell. One thing I just noticed is > > when I'm doing commands, the shell prompt increments. After doing the > > ctrl-g or ctrl-q ctrl-g, the shell starts back at 1. > > > > wes > > > > > > On Wed, Nov 7, 2012 at 12:47 PM, James Aimonetti > wrote: > > > > > On Wed, 7 Nov 2012 12:32:55 -0700 > > > Wes James wrote: > > > > > > > I've tried a few things with trying to get ctrl-g to work in emacs. > I've > > > > run erl with M-x shell and M-x terminal-emulator. M-x terminal > emulator > > > is > > > > closer, but when I press ctrl-g it just puts ^G in the window and > when I > > > > press enter, it brings the erlang shell command line back without > doing > > > > anything. Is there a way to do ctrl-g with another command. I've > looked > > > at > > > > the other commands with ctrl-c, but they don't show the User Switch > > > command > > > > prompt. > > > > > > > > Thanks, > > > > > > > > Wes > > > > > > Try Ctrl-q Ctrl-g > > > > > > > > > -- > > > James Aimonetti > > > Distributed Systems Engineer / DJ MC_ > > > > > > 2600hz | http://2600hz.com > > > sip:james@REDACTED > > > tel: 415.886.7905 > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > -- > James Aimonetti > Distributed Systems Engineer / DJ MC_ > > 2600hz | http://2600hz.com > sip:james@REDACTED > tel: 415.886.7905 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Wed Nov 7 22:38:35 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 7 Nov 2012 14:38:35 -0700 Subject: [erlang-questions] using ctrl-g in emacs in erl In-Reply-To: References: <20121107114713.412bb836@thinky64.2600hz.com> <20121107122712.181d5e27@thinky64.2600hz.com> Message-ID: Correction - it was c-q c-g where I was able to get the ^G then press enter and get the User switch command line. wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvm_8@REDACTED Thu Nov 8 05:24:53 2012 From: mvm_8@REDACTED (Venu Middela) Date: Wed, 7 Nov 2012 22:24:53 -0600 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 Message-ID: Hi All, Trying to load crypto module on solaris 10 x86_64, getting the following error. I've seen previous posts similar to this one, but none of the solutions/work-arounds provided in those threads helped resolve the error below...recompiled openssl few times with multiple different options, recompiled erlang a few times with different combinations of arguments... Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]Eshell V5.9.1 abort with ^G)1> l(crypto).{error,on_load_failure}=ERROR REPORT==== 7-Nov-2012::22:13:54 ===Unable to load crypto library. Failed with error:"load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"OpenSSL might not be installed on this system. =ERROR REPORT==== 7-Nov-2012::22:13:54 ===The on_load function for module crypto returned {error, {load_failed, "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}} 2> q(). here are ldd and file outputs for crypto.so /usr/local/lib/erlang/lib/crypto-2.1/priv/lib# ldd crypto.so libcrypto.so.0.9.7 => /usr/sfw/lib/64/libcrypto.so.0.9.7 libssl.so.0.9.7 => /usr/sfw/lib/64/libssl.so.0.9.7 libc.so.1 => /lib/64/libc.so.1 libsocket.so.1 => /lib/64/libsocket.so.1 libnsl.so.1 => /lib/64/libnsl.so.1 libmp.so.2 => /lib/64/libmp.so.2 libmd.so.1 => /lib/64/libmd.so.1 libscf.so.1 => /lib/64/libscf.so.1 libdoor.so.1 => /lib/64/libdoor.so.1 libuutil.so.1 => /lib/64/libuutil.so.1 libgen.so.1 => /lib/64/libgen.so.1 libcrypto_extra.so.0.9.7 => /usr/sfw/lib/amd64/libcrypto_extra.so.0.9.7 libssl_extra.so.0.9.7 => /usr/sfw/lib/amd64/libssl_extra.so.0.9.7 libm.so.2 => /lib/64/libm.so.2 #file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib# ldd crypto.so /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: ELF 64-bit LSB dynamic lib AMD64 Version 1, dynamically linked, not stripped any ideas how to load crypto on 64bit Erlang R15B01 on solaris10x86_64. Thanks,Venu -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Thu Nov 8 09:52:26 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 08 Nov 2012 08:52:26 +0000 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today Message-ID: <509B72CA.6070801@erlang-solutions.com> Hi All, a note to say we will try to stream the Erlang Factory Lite happening in London today. To follow the event, visit http://erlanglive.com/ and press play. We will start in about 10 minutes, have 12 talks. All times in the schedule ate GMT. http://www.erlang-factory.com/conference/London2012/programme A big thank you to Google, Basho and Fastly for making this happen. You rock! 9:00 - 9:05 Welcome 9:05 - 9:50 The Ideal Programmer - Why They Don't Exist and How to Manage Without Them? Mike Williams 9:55 - 10:25 High Availability Erlang from the Trenches Fabrice Nourisson ,Dominic Williams 10:30 - 11:00 Build an FTP server in 30 minutes with Ranch Lo?c Hoguin 11:00 - 11:20 Tea & Coffee Break 11:20 - 11:50 Hitchhiker's guide to the Erlang VM Robert Virding 11:55 - 12:25 Automated testing with Erlang ("these go to eleven") Ward Bekker 12:30 - 13:00 Profiling Erlang programs using Percept2 Simon Thompson ,Huiqing Li 13:00 - 14:00 Lunch 14:00 - 14:30 Taming the Rabbit: Writing RabbitMQ Plugins Alvaro Videla 14:35 - 15:05 CyLec - An Architecture for Electricity Smart Metering Stephen Page ,Matt Kern 15:10 - 15:40 Google APIs and Erlang Ian Barber 15:40 - 16:00 Tea & Coffee Break 16:00 - 16:30 MeshUp and other Riak hacks Jakob Sievers 16:35 - 17:05 Introduction to Webmachine Matt Heitzenroder 17:10 - 17:40 Erlang in global radio astronomy - monitoring and controlling custom built hardware at the bit level Harro Verkouter -- Erlang Solutions Ltd. http://www.erlang-solutions.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.kukosa@REDACTED Thu Nov 8 09:58:59 2012 From: tomas.kukosa@REDACTED (Kukosa, Tomas) Date: Thu, 8 Nov 2012 08:58:59 +0000 Subject: [erlang-questions] Future of epmd In-Reply-To: References: Message-ID: <771808E86A57134A85559759DD6029010D5DC1@MCHP01MSX.global-ad.net> Hi, BTW what about using SCTP for distribution protocol? Would not bring it some advatages in high availability area? E.g. bacause of multihoming or posibility of setting timeout and retransmission parameters? Best regards, Tomas From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Dmitry Demeshchuk Sent: Wednesday, November 07, 2012 8:03 AM To: erlang-questions Subject: [erlang-questions] Future of epmd Hello, list. As you may know, epmd may sometimes misbehave. Loses nodes and doesn't add them back, for example (unless you do some magic, like this: http://sidentdv.livejournal.com/769.html ). A while ago, Peter Lemenkov got a wonderful idea that epmd may be actually written in Erlang instead. EPMD protocol is very simple, and it's much easier to implement all the failover scenarios in Erlang than in C. So far, here's a prototype of his: https://github.com/lemenkov/erlpmd When hacking it, I've noticed several things: 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP connection. Closing of which is a signal of node disconnection. This approach does have a point, since we can use keep-alive and periodically check that the node is still here on the TCP level. But next, some weird thing follows: 2. When we send other control messages from a node connected to epmd, we establish a new TCP connection, each time. Could use the main connection instead. Was it a design decision or it's just a legacy thing? 3. The client (node) part of epmd seems to be all implemented in C and sealed inside ERTS. However, it seems like this code could be implemented inside the net_kernel module instead (or something similar). Why bother and switch to Erlang when everything is already written and working? First of all, sometimes it doesn't really work in big clusters (see my first link). And, secondly, using Erlang we can easily extend the protocol. For example, add auto-discovery feature, which has been discussed on the list a lot. Add an ability for a node to reconnect if its TCP session has been terminated for some reason. Add lookups of nodes by prefix (like, "give me all nodes that match mynode@*"). The list can be probably extended further. Do you think such a thing (with full backwards compatibility, of course) could go upstream? Also, a question for epmd maintainers: is it going to change at all, or the protocol is considered to be full enough for its purposes? -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Thu Nov 8 10:59:01 2012 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Thu, 8 Nov 2012 10:59:01 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: Message-ID: <509B8265.5000102@erix.ericsson.se> crypto needs OpenSSL 0.9.8, you have 0.9.7. Either install 0.9.8 or patch crypto by removing the NIF des_ede3_cfb_crypt which is the only one that needs 0.9.8. /Sverker, Erlang/OTP Ericsson Venu Middela wrote: > > > Hi All, > > > Trying to load crypto module on solaris 10 x86_64, getting the following error. > I've seen previous posts similar to this one, but none of the solutions/work-arounds provided in those threads helped resolve the error below...recompiled openssl few times with multiple different options, recompiled erlang a few times with different combinations of arguments... > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]Eshell V5.9.1 abort with ^G)1> l(crypto).{error,on_load_failure}=ERROR REPORT==== 7-Nov-2012::22:13:54 ===Unable to load crypto library. Failed with error:"load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"OpenSSL might not be installed on this system. > =ERROR REPORT==== 7-Nov-2012::22:13:54 ===The on_load function for module crypto returned {error, {load_failed, "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}} 2> q(). > > here are ldd and file outputs for crypto.so > /usr/local/lib/erlang/lib/crypto-2.1/priv/lib# ldd crypto.so libcrypto.so.0.9.7 => /usr/sfw/lib/64/libcrypto.so.0.9.7 libssl.so.0.9.7 => /usr/sfw/lib/64/libssl.so.0.9.7 libc.so.1 => /lib/64/libc.so.1 libsocket.so.1 => /lib/64/libsocket.so.1 libnsl.so.1 => /lib/64/libnsl.so.1 libmp.so.2 => /lib/64/libmp.so.2 libmd.so.1 => /lib/64/libmd.so.1 libscf.so.1 => /lib/64/libscf.so.1 libdoor.so.1 => /lib/64/libdoor.so.1 libuutil.so.1 => /lib/64/libuutil.so.1 libgen.so.1 => /lib/64/libgen.so.1 libcrypto_extra.so.0.9.7 => /usr/sfw/lib/amd64/libcrypto_extra.so.0.9.7 libssl_extra.so.0.9.7 => /usr/sfw/lib/amd64/libssl_extra.so.0.9.7 libm.so.2 => /lib/64/libm.so.2 > > #file /usr/local/lib/erlang/lib/crypto-2.1/priv/lib# ldd crypto.so /usr/local/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: ELF 64-bit LSB dynamic lib AMD64 Version 1, dynamically linked, not stripped > > any ideas how to load crypto on 64bit Erlang R15B01 on solaris10x86_64. > Thanks,Venu > > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From lists.nico.k@REDACTED Thu Nov 8 11:33:58 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Thu, 08 Nov 2012 11:33:58 +0100 Subject: [erlang-questions] Wiki in Erlang/OTP? In-Reply-To: <509A2ABA.7010007@gmail.com> References: <509A2ABA.7010007@gmail.com> Message-ID: <1632865.iobQZ8d3Jq@csr-pc40.zib.de> Note that we extended our prototype "Wiki on Scalaris" (as well as Scalaris itself) quite much since back then - we are currently working on a new evaluation with improved data models. the code can be downloaded from https://code.google.com/p/scalaris/ There you can also find instructions of how to run the wiki: https://code.google.com/p/scalaris/source/browse/trunk/contrib/wikipedia/README Regards Nico Kruber On Wednesday 07 Nov 2012 01:32:42 Michael Truog wrote: > You might be thinking of this paper: "Scalaris: reliable transactional p2p > key/value store" from 2008 (http://dl.acm.org/citation.cfm?id=1411280) > since this showed Scalaris facilitating a Wikipedia frontend. > On 11/06/2012 11:22 PM, Michael Turner wrote: > > Not listed in the obvious place: > > http://en.wikipedia.org/wiki/Comparison_of_wiki_software > > > > ISTR some benchmark of Riak (or something similar) on Wikipedia-like > > traffic patterns and loads showed that it did rather well. For > > site-specific/topic-specific wikis, maybe there's not much point. For > > wikifarms however, maybe a more graceful way to scale and keep server > > budgets cheap as well? > > > > Regards, > > Michael Turner > > Project Persephone > > 1-25-33 Takadanobaba > > Shinjuku-ku Tokyo 169-0075 > > (+81) 90-5203-8682 > > turner@REDACTED > > http://www.projectpersephone.org/ > > > > "Love does not consist in gazing at each other, but in looking outward > > together in the same direction." -- Antoine de Saint-Exup?ry From lists.nico.k@REDACTED Thu Nov 8 11:36:13 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Thu, 08 Nov 2012 11:36:13 +0100 Subject: [erlang-questions] Wiki in Erlang/OTP? In-Reply-To: <1632865.iobQZ8d3Jq@csr-pc40.zib.de> References: <509A2ABA.7010007@gmail.com> <1632865.iobQZ8d3Jq@csr-pc40.zib.de> Message-ID: <16295164.rx9yAlQL92@csr-pc40.zib.de> FYI: a quick overview and preliminary results can be found here: http://berlinbuzzwords.de/sessions/scalaris-scalable-web-applications-transactional-key-value-store On Thursday 08 Nov 2012 11:33:58 Nico Kruber wrote: > Note that we extended our prototype "Wiki on Scalaris" (as well as Scalaris > itself) quite much since back then - we are currently working on a new > evaluation with improved data models. > > the code can be downloaded from https://code.google.com/p/scalaris/ > There you can also find instructions of how to run the wiki: > https://code.google.com/p/scalaris/source/browse/trunk/contrib/wikipedia/REA > DME > > Regards > Nico Kruber > > On Wednesday 07 Nov 2012 01:32:42 Michael Truog wrote: > > You might be thinking of this paper: "Scalaris: reliable transactional p2p > > key/value store" from 2008 (http://dl.acm.org/citation.cfm?id=1411280) > > since this showed Scalaris facilitating a Wikipedia frontend. > > > > On 11/06/2012 11:22 PM, Michael Turner wrote: > > > Not listed in the obvious place: > > > http://en.wikipedia.org/wiki/Comparison_of_wiki_software > > > > > > ISTR some benchmark of Riak (or something similar) on Wikipedia-like > > > traffic patterns and loads showed that it did rather well. For > > > site-specific/topic-specific wikis, maybe there's not much point. For > > > wikifarms however, maybe a more graceful way to scale and keep server > > > budgets cheap as well? > > > > > > Regards, > > > Michael Turner > > > Project Persephone > > > 1-25-33 Takadanobaba > > > Shinjuku-ku Tokyo 169-0075 > > > (+81) 90-5203-8682 > > > turner@REDACTED > > > http://www.projectpersephone.org/ > > > > > > "Love does not consist in gazing at each other, but in looking outward > > > together in the same direction." -- Antoine de Saint-Exup?ry From kostis@REDACTED Thu Nov 8 12:34:05 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 08 Nov 2012 12:34:05 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: <509B8265.5000102@erix.ericsson.se> References: <509B8265.5000102@erix.ericsson.se> Message-ID: <509B98AD.5050201@cs.ntua.gr> On 11/08/2012 10:59 AM, Sverker Eriksson wrote: > crypto needs OpenSSL 0.9.8, you have 0.9.7. > > Either install 0.9.8 or patch crypto by removing the NIF > des_ede3_cfb_crypt which is the only one that needs 0.9.8. Shouldn't this be checked or isn't this something which is done better as part of the configure script? I.e. checking at configure time which OpenSSL version is used and taking some appropriate action? Kostis From ulf@REDACTED Thu Nov 8 13:15:38 2012 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 8 Nov 2012 13:15:38 +0100 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: <509B72CA.6070801@erlang-solutions.com> References: <509B72CA.6070801@erlang-solutions.com> Message-ID: <403AF323-F28C-468E-A7EA-6F9C0ACB4B68@feuerlabs.com> On 8 Nov 2012, at 09:52, Francesco Cesarini wrote: > Hi All, > > a note to say we will try to stream the Erlang Factory Lite happening in London today. To follow the event, visit > > http://erlanglive.com/ and press play. Very nice! BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Nov 8 13:24:44 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 8 Nov 2012 13:24:44 +0100 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: <403AF323-F28C-468E-A7EA-6F9C0ACB4B68@feuerlabs.com> References: <509B72CA.6070801@erlang-solutions.com> <403AF323-F28C-468E-A7EA-6F9C0ACB4B68@feuerlabs.com> Message-ID: It's awesome! An addition of a chat underneath of the video stream would be great as well! Thanks, ESL! On Thu, Nov 8, 2012 at 1:15 PM, Ulf Wiger wrote: > > > > On 8 Nov 2012, at 09:52, Francesco Cesarini wrote: > > Hi All, > > a note to say we will try to stream the Erlang Factory Lite happening in > London today. To follow the event, visit > > http://erlanglive.com/ and press play. > > > Very nice! > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Thu Nov 8 14:58:19 2012 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Thu, 8 Nov 2012 14:58:19 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: <509B98AD.5050201@cs.ntua.gr> References: <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr> Message-ID: <509BBA7B.2030406@erix.ericsson.se> Kostis Sagonas wrote: > On 11/08/2012 10:59 AM, Sverker Eriksson wrote: >> crypto needs OpenSSL 0.9.8, you have 0.9.7. >> >> Either install 0.9.8 or patch crypto by removing the NIF >> des_ede3_cfb_crypt which is the only one that needs 0.9.8. > > Shouldn't this be checked or isn't this something which is done better > as part of the configure script? I.e. checking at configure time > which OpenSSL version is used and taking some appropriate action? > Yes, that would be nicer. In R16 crypto will support OpenSSL 0.9.7. crypto:des3_cfb_encrypt and des3_cfb_decrypt will then throw exception 'notsup'. /Sverker From bombadil@REDACTED Thu Nov 8 15:27:13 2012 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Thu, 08 Nov 2012 15:27:13 +0100 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: <509B72CA.6070801@erlang-solutions.com> References: <509B72CA.6070801@erlang-solutions.com> Message-ID: Will the videos be available in YouTube, Vimeo or something else? Thanks. El 2012-11-08 09:52, Francesco Cesarini escribi?: > Hi All, > > a note to say we will try to stream the Erlang Factory Lite > happening > in London today. To follow the event, visit > > http://erlanglive.com/ [1] and press play. > > We will start in about 10 minutes, have 12 talks. All times in the > schedule ate GMT. > > http://www.erlang-factory.com/conference/London2012/programme [2] > > A big thank you to Google, Basho and Fastly for making this happen. > You rock! > > 9:00 - 9:05 > Welcome > > 9:05 - 9:50 > The Ideal Programmer - Why They Don't Exist and How to Manage > Without > Them? > Mike Williams [3] > > 9:55 - 10:25 > High Availability Erlang from the Trenches > Fabrice Nourisson [4], Dominic Williams [5] > > 10:30 - 11:00 > Build an FTP server in 30 minutes with Ranch > Lo?c Hoguin [6] > > 11:00 - 11:20 > Tea & Coffee Break > > 11:20 - 11:50 > Hitchhiker's guide to the Erlang VM > Robert Virding [7] > > 11:55 - 12:25 > Automated testing with Erlang ("these go to eleven") > Ward Bekker [8] > > 12:30 - 13:00 > Profiling Erlang programs using Percept2 > Simon Thompson [9], Huiqing Li [10] > > 13:00 - 14:00 > Lunch > > 14:00 - 14:30 > Taming the Rabbit: Writing RabbitMQ Plugins > Alvaro Videla [11] > > 14:35 - 15:05 > CyLec - An Architecture for Electricity Smart Metering > Stephen Page [12], Matt Kern [13] > > 15:10 - 15:40 > Google APIs and Erlang > Ian Barber [14] > > 15:40 - 16:00 > Tea & Coffee Break > > 16:00 - 16:30 > MeshUp and other Riak hacks > Jakob Sievers [15] > > 16:35 - 17:05 > Introduction to Webmachine > Matt Heitzenroder [16] > > 17:10 - 17:40 > Erlang in global radio astronomy - monitoring and controlling custom > built hardware at the bit level > Harro Verkouter [17] > > -- > Erlang Solutions Ltd. > http://www.erlang-solutions.com > > > Links: > ------ > [1] http://erlanglive.com/ > [2] http://www.erlang-factory.com/conference/London2012/programme > [3] > http://www.erlang-factory.com/conference/London2012/speakers/MikeWilliams > [4] > > http://www.erlang-factory.com/conference/London2012/speakers/FabriceNourisson > [5] > > http://www.erlang-factory.com/conference/London2012/speakers/DominicWilliams > [6] > http://www.erlang-factory.com/conference/London2012/speakers/LoicHoguin > [7] > > http://www.erlang-factory.com/conference/London2012/speakers/RobertVirding > [8] > http://www.erlang-factory.com/conference/London2012/speakers/WardBekker > [9] > > http://www.erlang-factory.com/conference/London2012/speakers/SimonThompson > [10] > http://www.erlang-factory.com/conference/London2012/speakers/HuiqingLi > [11] > > http://www.erlang-factory.com/conference/London2012/speakers/AlvaroVidela > [12] > http://www.erlang-factory.com/conference/London2012/speakers/StephenPage > [13] > http://www.erlang-factory.com/conference/London2012/speakers/MattKern > [14] > http://www.erlang-factory.com/conference/London2012/speakers/IanBarber > [15] > > http://www.erlang-factory.com/conference/London2012/speakers/JakobSievers > [16] > > http://www.erlang-factory.com/conference/London2012/speakers/MattHeitzenroder > [17] > > http://www.erlang-factory.com/conference/London2012/speakers/HarroVerkouter -- Manuel A. Rubio "Bombadil" Usuario de GNU/Linux #323628 acorde a http://counter.li.org/ T?cnico en Admin. Sistemas Inform?ticos From essen@REDACTED Thu Nov 8 15:31:49 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 08 Nov 2012 14:31:49 +0000 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today Message-ID: <8ofjfusv33tskpim990pcyqs.1352385109495@email.android.com> Yes they'll be made available. @erlangfactory will announce availability. "Manuel A. Rubio "Bombadil"" wrote: >Will the videos be available in YouTube, Vimeo or something else? > >Thanks. > >El 2012-11-08 09:52, Francesco Cesarini escribi?: >> Hi All, >> >> a note to say we will try to stream the Erlang Factory Lite >> happening >> in London today. To follow the event, visit >> >> http://erlanglive.com/ [1] and press play. >> >> We will start in about 10 minutes, have 12 talks. All times in the >> schedule ate GMT. >> >> http://www.erlang-factory.com/conference/London2012/programme [2] >> >> A big thank you to Google, Basho and Fastly for making this happen. >> You rock! >> >> 9:00 - 9:05 >> Welcome >> >> 9:05 - 9:50 >> The Ideal Programmer - Why They Don't Exist and How to Manage >> Without >> Them? >> Mike Williams [3] >> >> 9:55 - 10:25 >> High Availability Erlang from the Trenches >> Fabrice Nourisson [4], Dominic Williams [5] >> >> 10:30 - 11:00 >> Build an FTP server in 30 minutes with Ranch >> Lo?c Hoguin [6] >> >> 11:00 - 11:20 >> Tea & Coffee Break >> >> 11:20 - 11:50 >> Hitchhiker's guide to the Erlang VM >> Robert Virding [7] >> >> 11:55 - 12:25 >> Automated testing with Erlang ("these go to eleven") >> Ward Bekker [8] >> >> 12:30 - 13:00 >> Profiling Erlang programs using Percept2 >> Simon Thompson [9], Huiqing Li [10] >> >> 13:00 - 14:00 >> Lunch >> >> 14:00 - 14:30 >> Taming the Rabbit: Writing RabbitMQ Plugins >> Alvaro Videla [11] >> >> 14:35 - 15:05 >> CyLec - An Architecture for Electricity Smart Metering >> Stephen Page [12], Matt Kern [13] >> >> 15:10 - 15:40 >> Google APIs and Erlang >> Ian Barber [14] >> >> 15:40 - 16:00 >> Tea & Coffee Break >> >> 16:00 - 16:30 >> MeshUp and other Riak hacks >> Jakob Sievers [15] >> >> 16:35 - 17:05 >> Introduction to Webmachine >> Matt Heitzenroder [16] >> >> 17:10 - 17:40 >> Erlang in global radio astronomy - monitoring and controlling custom >> built hardware at the bit level >> Harro Verkouter [17] >> >> -- >> Erlang Solutions Ltd. >> http://www.erlang-solutions.com >> >> >> Links: >> ------ >> [1] http://erlanglive.com/ >> [2] http://www.erlang-factory.com/conference/London2012/programme >> [3] >> http://www.erlang-factory.com/conference/London2012/speakers/MikeWilliams >> [4] >> >> http://www.erlang-factory.com/conference/London2012/speakers/FabriceNourisson >> [5] >> >> http://www.erlang-factory.com/conference/London2012/speakers/DominicWilliams >> [6] >> http://www.erlang-factory.com/conference/London2012/speakers/LoicHoguin >> [7] >> >> http://www.erlang-factory.com/conference/London2012/speakers/RobertVirding >> [8] >> http://www.erlang-factory.com/conference/London2012/speakers/WardBekker >> [9] >> >> http://www.erlang-factory.com/conference/London2012/speakers/SimonThompson >> [10] >> http://www.erlang-factory.com/conference/London2012/speakers/HuiqingLi >> [11] >> >> http://www.erlang-factory.com/conference/London2012/speakers/AlvaroVidela >> [12] >> http://www.erlang-factory.com/conference/London2012/speakers/StephenPage >> [13] >> http://www.erlang-factory.com/conference/London2012/speakers/MattKern >> [14] >> http://www.erlang-factory.com/conference/London2012/speakers/IanBarber >> [15] >> >> http://www.erlang-factory.com/conference/London2012/speakers/JakobSievers >> [16] >> >> http://www.erlang-factory.com/conference/London2012/speakers/MattHeitzenroder >> [17] >> >> http://www.erlang-factory.com/conference/London2012/speakers/HarroVerkouter > >-- >Manuel A. Rubio "Bombadil" >Usuario de GNU/Linux #323628 acorde a http://counter.li.org/ >T?cnico en Admin. Sistemas Inform?ticos >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Thu Nov 8 16:05:22 2012 From: comptekki@REDACTED (Wes James) Date: Thu, 8 Nov 2012 08:05:22 -0700 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: <509B72CA.6070801@erlang-solutions.com> References: <509B72CA.6070801@erlang-solutions.com> Message-ID: I don't see a play button anywhere. I'm in the US, does that matter? wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Thu Nov 8 16:28:24 2012 From: pan@REDACTED (Patrik Nyblom) Date: Thu, 8 Nov 2012 16:28:24 +0100 Subject: [erlang-questions] Simple wrapper around dbg? In-Reply-To: References: Message-ID: <509BCF98.50009@erlang.org> On 11/06/2012 03:33 PM, Attila Rajmund Nohl wrote: > Hello! > > I can trace a function call with specific arguments with a command like this: > > dbg:tpl(foo, bar, dbg:fun2ms(fun([baz,_]) -> return_trace(), > exception_trace() end)). > > However, it's a long to type, I'd like to have a wrapper around it. > The naive solution doesn't even compile: > > -module(d). > > -export([mfa/3]). > > mfa(M, F, A) -> > dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), > exception_trace() end)). As described in the docs ( http://www.erlang.org/doc/man/dbg.html#fun2ms-1), you'll need to include ms_transform.hrl if calling dbg:fun2ms inside a module, so this: --------------- -module(d). -include_lib("stdlib/include/ms_transform.hrl"). -export([mfa/3]). mfa(M, F, A) -> dbg:tpl(M, F, dbg:fun2ms(fun(Args) when Args==A -> return_trace(), exception_trace() end)). ---------------- compiles and works to a certain extent. > because there are no return_trace() and exception_trace() functions in > the module. Even if it'd compile, I couldn't call it like this: > > d:mfa(foo, bar, [baz, _]). This is more tricky, you cannot send unbound variables to a function - it has little to do with dbg:fun2ms. Either you have to write your own parse_transform, which cannot be used from the shell, or you could use the match_spec syntax for the variables in the argument list and skip fun2ms altogether... Look at this in the shell: 1> dbg:fun2ms(fun([baz,A,_]) -> return__trace(),exception_trace() end). [{[baz,'_'],[],[{return_trace},{exception_trace}]}] The argument list is translated so that anonymous variables become the atom '_' and named variables become '$n', where n is an integer > 0. You can write your function as: mfa(M, F, A) -> dbg:tpl(M, F, [{A,[],[{return_trace},{exception_trace}]}]). and call it as: d:mfa(foo,bar,[baz,'_']). In that case you will not need the parse_transform. BTW, you can remove return_trace, exception_trace includes return_trace. Cheers, /Patrik > > because the _ variable is not bound. Is there a simple workaround or > shall I start to read up on parse_transforms? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Thu Nov 8 16:26:53 2012 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 8 Nov 2012 19:26:53 +0400 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: References: <509B72CA.6070801@erlang-solutions.com> Message-ID: Great event! Thank you guys! p.s. chat for viewers would be great... Best regards, Max On Thu, Nov 8, 2012 at 7:05 PM, Wes James wrote: > I don't see a play button anywhere. I'm in the US, does that matter? > > wes > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Nov 8 16:38:09 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 8 Nov 2012 16:38:09 +0100 Subject: [erlang-questions] Trouble with "SSL certificate chains" Message-ID: <11C3E800-A834-411D-B973-2682A4473CCE@gmail.com> Hi guys, I'm facing a problem with an intermediate SSL certificate and getting this in Firefox: XXX.YYYY.com uses an invalid security certificate. The certificate is not trusted because no issuer chain was provided. (Error code: sec_error_unknown_issuer) From what I understood so far, the server certificate must appear before the chained certificates in the combined file: http://nginx.org/en/docs/http/configuring_https_servers.html#chains But it doesn't work if I follow the link above. My Erlang server can't start at all. How one can use an intermediate certificate in Erlang? Help very appreciated. Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From marc@REDACTED Thu Nov 8 16:44:30 2012 From: marc@REDACTED (Marc Worrell) Date: Thu, 8 Nov 2012 16:44:30 +0100 Subject: [erlang-questions] Trouble with "SSL certificate chains" In-Reply-To: <11C3E800-A834-411D-B973-2682A4473CCE@gmail.com> References: <11C3E800-A834-411D-B973-2682A4473CCE@gmail.com> Message-ID: <1317B718-34B6-4D7D-9AD3-475103FFC32B@worrell.nl> (now also to the list) You need a separate file with the certificate chain. Check: http://zotonic.com/docs/ref/modules/mod_ssl.html#certificate-and-key-files And check start_listener/4 to see how a Mochiweb listener is started using the certificates and chains https://github.com/zotonic/zotonic/blob/master/modules/mod_ssl/mod_ssl.erl Finally you can use this tool to check if all is ok: http://www.sslshopper.com/ssl-checker.html - Marc On 8 nov. 2012, at 16:38, Zabrane Mickael wrote: > Hi guys, > > I'm facing a problem with an intermediate SSL certificate and getting this in Firefox: > > XXX.YYYY.com uses an invalid security certificate. > > The certificate is not trusted because no issuer chain was provided. > > (Error code: sec_error_unknown_issuer) > > > From what I understood so far, the server certificate must appear before the chained certificates in the combined file: > http://nginx.org/en/docs/http/configuring_https_servers.html#chains > > But it doesn't work if I follow the link above. My Erlang server can't start at all. > > How one can use an intermediate certificate in Erlang? > Help very appreciated. > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From olav@REDACTED Thu Nov 8 16:45:02 2012 From: olav@REDACTED (Olav Frengstad) Date: Thu, 8 Nov 2012 16:45:02 +0100 Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: References: <509B72CA.6070801@erlang-solutions.com> Message-ID: Great job on the streaming! Will the recording be available for downloading/streaming later? Olav 2012/11/8, Max Bourinov : > Great event! Thank you guys! > > p.s. chat for viewers would be great... > > Best regards, > Max > > > > > On Thu, Nov 8, 2012 at 7:05 PM, Wes James wrote: > >> I don't see a play button anywhere. I'm in the US, does that matter? >> >> wes >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- Med Vennlig Hilsen Olav Frengstad Systemutvikler // FWT +47 920 42 090 From omer.kilic@REDACTED Thu Nov 8 17:12:54 2012 From: omer.kilic@REDACTED (Omer Kilic) Date: Thu, 08 Nov 2012 16:12:54 -0000 (GMT) Subject: [erlang-questions] Streaming London Erlang Factory Lite Today In-Reply-To: Message-ID: <66cc54b7-b349-46af-bf41-86f754f0ad33@knuth> Recordings will be published on our Vimeo/Youtube accounts soon, keep an eye out on the Erlang Factory website[1] for more information. Regarding the chat for viewers: definitely on our list of things to do for the next broadcast! Cheers, Omer. [1] http://www.erlang-factory.com/ ----- Original Message ----- From: "Olav Frengstad" To: "Max Bourinov" Cc: "Erlang Users' List" Sent: Thursday, 8 November, 2012 3:45:02 PM Subject: Re: [erlang-questions] Streaming London Erlang Factory Lite Today Great job on the streaming! Will the recording be available for downloading/streaming later? Olav 2012/11/8, Max Bourinov : > Great event! Thank you guys! > > p.s. chat for viewers would be great... > > Best regards, > Max > > > > > On Thu, Nov 8, 2012 at 7:05 PM, Wes James wrote: > >> I don't see a play button anywhere. I'm in the US, does that matter? >> >> wes >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- Med Vennlig Hilsen Olav Frengstad Systemutvikler // FWT +47 920 42 090 _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Thu Nov 8 17:32:59 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 8 Nov 2012 17:32:59 +0100 Subject: [erlang-questions] Trouble with "SSL certificate chains" In-Reply-To: <1317B718-34B6-4D7D-9AD3-475103FFC32B@worrell.nl> References: <11C3E800-A834-411D-B973-2682A4473CCE@gmail.com> <1317B718-34B6-4D7D-9AD3-475103FFC32B@worrell.nl> Message-ID: <9FE44DC7-2BC8-42EE-8BF1-E4A58C26F0B1@gmail.com> Everything's fine Marc. Thanks a lot for your help. Regards Z. On Nov 8, 2012, at 4:44 PM, Marc Worrell wrote: > (now also to the list) > > You need a separate file with the certificate chain. > > Check: http://zotonic.com/docs/ref/modules/mod_ssl.html#certificate-and-key-files > > And check start_listener/4 to see how a Mochiweb listener is started using the certificates and chains > https://github.com/zotonic/zotonic/blob/master/modules/mod_ssl/mod_ssl.erl > > Finally you can use this tool to check if all is ok: > http://www.sslshopper.com/ssl-checker.html > > - Marc -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Thu Nov 8 17:45:41 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 8 Nov 2012 17:45:41 +0100 Subject: [erlang-questions] Future of epmd In-Reply-To: References: Message-ID: We have discussed having epmd implemented in Erlang several times and think it would be a good idea for several reasons especially if there is only one Erlang node per host. But it could work even if there are more nodes. It could also be an alternative to run a separate E-node just for the epmd service. We have unfortunately not been able to give this high enough priority yet, so this initiative is interesting (have not looked at the code and other details) The benefits with having epmd implemented in Erlang would be: - Easier to maintain - Easier to extend - Easy to prototype other solutions, for example heterogenous distribution, secure epmd communication via TLS , etc The client part is already written in Erlang, see the erl_epmd module. /Kenneth , Erlang/OTP Ericsson Den 7 nov 2012 08:03 skrev "Dmitry Demeshchuk" : > Hello, list. > > As you may know, epmd may sometimes misbehave. Loses nodes and doesn't add > them back, for example (unless you do some magic, like this: > http://sidentdv.livejournal.com/769.html ). > > A while ago, Peter Lemenkov got a wonderful idea that epmd may be actually > written in Erlang instead. EPMD protocol is very simple, and it's much > easier to implement all the failover scenarios in Erlang than in C. So far, > here's a prototype of his: https://github.com/lemenkov/erlpmd > > When hacking it, I've noticed several things: > > 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP > connection. Closing of which is a signal of node disconnection. This > approach does have a point, since we can use keep-alive and periodically > check that the node is still here on the TCP level. But next, some weird > thing follows: > > 2. When we send other control messages from a node connected to epmd, we > establish a new TCP connection, each time. Could use the main connection > instead. Was it a design decision or it's just a legacy thing? > > 3. The client (node) part of epmd seems to be all implemented in C and > sealed inside ERTS. However, it seems like this code could be implemented > inside the net_kernel module instead (or something similar). > > > Why bother and switch to Erlang when everything is already written and > working? First of all, sometimes it doesn't really work in big clusters > (see my first link). And, secondly, using Erlang we can easily extend the > protocol. For example, add auto-discovery feature, which has been discussed > on the list a lot. Add an ability for a node to reconnect if its TCP > session has been terminated for some reason. Add lookups of nodes by prefix > (like, "give me all nodes that match mynode@*"). The list can be probably > extended further. > > > Do you think such a thing (with full backwards compatibility, of course) > could go upstream? Also, a question for epmd maintainers: is it going to > change at all, or the protocol is considered to be full enough for its > purposes? > > -- > Best regards, > Dmitry Demeshchuk > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Thu Nov 8 17:55:32 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 8 Nov 2012 17:55:32 +0100 Subject: [erlang-questions] Future of epmd In-Reply-To: <771808E86A57134A85559759DD6029010D5DC1@MCHP01MSX.global-ad.net> References: <771808E86A57134A85559759DD6029010D5DC1@MCHP01MSX.global-ad.net> Message-ID: Den 8 nov 2012 09:59 skrev "Kukosa, Tomas" < tomas.kukosa@REDACTED>: > > Hi, > > > > BTW what about using SCTP for distribution protocol? > > Would not bring it some advatages in high availability area? E.g. bacause of multihoming or posibility of setting timeout and retransmission parameters? Yes it would be interesting to have distribution over SCTP, and it is possible to implement with the same plugin approach as the distro over SSL is implemented. This might have implications on epmd as well and maybe heterogenous distribution would be of interest as well. With heterogenous distribution I mean that a node can talk sctp with some other node and talk tcp with yet another. It would require some negotiation and or registration in an extended epmd where a node can say which protocols it supports and prefers. /Kenneth, Erlang/OTP Ericsson > > > Best regards, > > Tomas > > > > From: erlang-questions-bounces@REDACTED [mailto: erlang-questions-bounces@REDACTED] On Behalf Of Dmitry Demeshchuk > Sent: Wednesday, November 07, 2012 8:03 AM > > To: erlang-questions > Subject: [erlang-questions] Future of epmd > > > > Hello, list. > > > > As you may know, epmd may sometimes misbehave. Loses nodes and doesn't add them back, for example (unless you do some magic, like this: http://sidentdv.livejournal.com/769.html ). > > > > A while ago, Peter Lemenkov got a wonderful idea that epmd may be actually written in Erlang instead. EPMD protocol is very simple, and it's much easier to implement all the failover scenarios in Erlang than in C. So far, here's a prototype of his: https://github.com/lemenkov/erlpmd > > > > When hacking it, I've noticed several things: > > > > 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a TCP connection. Closing of which is a signal of node disconnection. This approach does have a point, since we can use keep-alive and periodically check that the node is still here on the TCP level. But next, some weird thing follows: > > > > 2. When we send other control messages from a node connected to epmd, we establish a new TCP connection, each time. Could use the main connection instead. Was it a design decision or it's just a legacy thing? > > > > 3. The client (node) part of epmd seems to be all implemented in C and sealed inside ERTS. However, it seems like this code could be implemented inside the net_kernel module instead (or something similar). > > > > > > Why bother and switch to Erlang when everything is already written and working? First of all, sometimes it doesn't really work in big clusters (see my first link). And, secondly, using Erlang we can easily extend the protocol. For example, add auto-discovery feature, which has been discussed on the list a lot. Add an ability for a node to reconnect if its TCP session has been terminated for some reason. Add lookups of nodes by prefix (like, "give me all nodes that match mynode@*"). The list can be probably extended further. > > > > > > Do you think such a thing (with full backwards compatibility, of course) could go upstream? Also, a question for epmd maintainers: is it going to change at all, or the protocol is considered to be full enough for its purposes? > > > > -- > Best regards, > Dmitry Demeshchuk > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Thu Nov 8 18:04:40 2012 From: pan@REDACTED (Patrik Nyblom) Date: Thu, 8 Nov 2012 18:04:40 +0100 Subject: [erlang-questions] Future of epmd In-Reply-To: References: Message-ID: <509BE628.9050401@erlang.org> Hi! On 11/07/2012 08:03 AM, Dmitry Demeshchuk wrote: > Hello, list. > > As you may know, epmd may sometimes misbehave. Loses nodes and doesn't > add them back, for example (unless you do some magic, like this: > http://sidentdv.livejournal.com/769.html ). > First of all, we have no bug reports were epmd looses nodes except if you deliberately kill epmd or deliberately disconnect. I unfortunately cannot read the article you are referring to (the language is not one I understand), so I cannot explain what's going on there. > A while ago, Peter Lemenkov got a wonderful idea that epmd may be > actually written in Erlang instead. EPMD protocol is very simple, and > it's much easier to implement all the failover scenarios in Erlang > than in C. So far, here's a prototype of his: > https://github.com/lemenkov/erlpmd > Failover is usually not needed, it's one single process on a machine, it should only stop if the machine stops. What scenario are we talking about here? As epmd works today, a distributed erlang node connects to a *local* epmd (it's after all just a portmapper, similar to many other portmappers), and tells it what name and port number it has. When the beam process ends (in some way or another) the socket get's closed and epmd is more or less instantly informed. Epmd survives starts and stops of Erlang nodes on the machine and is the single database mapping ports for erlang distribution on the host. If we were to implement epmd in Erlang with that scheme, the first Erlang node either has to survive for all of the host's lifespan or has to transfer the ownership of the open sockets (ALIVE-sockets) to "the next" node to take over the task of epmd. Note that these nodes may not be in the same cluster, epmd is bound to a machine, not an Erlang cluster. Erlang VM's participating in different Erlang clusters may exist on the same machine. This would be feasible if we had an *extra* Erlang node for port mapping, which of course could be a working solution. To implement this in Erlang, using the already present distributed Erlang machines, would probably require a different mechanism for registering and unregistering nodes. Looking out for closed sockets will not do, as we will need to monitor nodes that has no connection to us (or they have to re-establish such a connection at least, which is not needed today). Also a reliable takeover by nodes participating in different clusters could be implemented, it is in no way impossible of course. You would also need to reopen the known port when taking over, so there will be a race, or rather a short time with no epmd listening. All clients have to handle that. Implementing a more simple epmd for a machine with only one Erlang node is far easier and could be useful for small embedded systems. In that case we will not need to change the protocol. Usage will be limited of course. You could also rewrite epmd in Erlang and have an extra (non distributed) Erlang machine resident in the system (after all, it would be more or less the same thing as having a C program resident). That would not require complicated takeover scenarios, but would increase the memory footprint slightly. An implementation in Erlang could cover both the single VM system and a solution with an extra Erlang machine, which would be nice. > When hacking it, I've noticed several things: > > 1. When we send ALIVE2_REQ and reply with ALIVE2_RESP, we establish a > TCP connection. Closing of which is a signal of node disconnection. > This approach does have a point, since we can use keep-alive and > periodically check that the node is still here on the TCP level. But > next, some weird thing follows: Note that this is local connections. Keep-alive has nothing to do with it. The loopback detects a close and informs immediately. Keep-alive detects network problems (badly) and is only useful when talking across a real network. > > 2. When we send other control messages from a node connected to epmd, > we establish a new TCP connection, each time. Could use the main > connection instead. Was it a design decision or it's just a legacy thing? When you communicate with epmd after alive is sent, you establish a connection to the epmd *on the host you want to connect to*, which is only the same epmd as you used for registration if the Erlang node you want to talk to is on the same host as you yourself are. You are looking for a port on the particular machine that your remote Erlang machine resides on. Only in the local case you could reuse your connection, which would only add a special case with very little gain. > > 3. The client (node) part of epmd seems to be all implemented in C and > sealed inside ERTS. However, it seems like this code could be > implemented inside the net_kernel module instead (or something similar). erl_epmd is the module and it's called by net_kernel. No epmd communication except the inet_driver itself is written in C on that side. The epmd daemon is of course written in C, but it's not part of the VM. > > > Why bother and switch to Erlang when everything is already written and > working? First of all, sometimes it doesn't really work in big > clusters (see my first link). And, secondly, using Erlang we can > easily extend the protocol. For example, add auto-discovery feature, > which has been discussed on the list a lot. Add an ability for a node > to reconnect if its TCP session has been terminated for some reason. > Add lookups of nodes by prefix (like, "give me all nodes that match > mynode@*"). The list can be probably extended further. I think a lot of this should be solved in the client, which is already written in Erlang. Rewriting the server might just add complexity, at least if you want to solve it in the already running distributed nodes, with takeover and whatnot. > Do you think such a thing (with full backwards compatibility, of > course) could go upstream? Also, a question for epmd maintainers: is > it going to change at all, or the protocol is considered to be full > enough for its purposes? We have thought about a distributed epmd over the years, but have never considered it worth the effort, due to the takeover complexity etc. Portmapping is really basic functionality, you wouldn't want to mess that up. A separate Erlang machine would maybe be a solution, but as epmd is such a simple program, we have not really thought it worth the extra memory footprint. So it would not be the easiest thing to convince us to take upstream, but given a well thought through solution, we could get rid of some maintenance - Erlang is after all far nicer to maintain than C... One could also make it possible to chose between different epmd solution, in that way we would cover the cases where people would not want an extra Erlang machine for portmapping. More elaborate things could then be experimented with in the Erlang-written epmd. If you can isolate a bug or explain a malfunction in the current epmd, it would be a great contribution! > > -- > Best regards, > Dmitry Demeshchuk > Cheers, /Patrik > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ward.mark@REDACTED Thu Nov 8 18:39:06 2012 From: ward.mark@REDACTED (Mark Ward) Date: Thu, 8 Nov 2012 11:39:06 -0600 Subject: [erlang-questions] Install win64 r15B02 on Windows 2012 server issues Message-ID: Hello, I have a freshly created Windows 2012 x64 server with GUI. The first application to install was erlang. It appears the win64 installer fails to install all of the files required for erlang OTP R15B02. The win32 installer works. I am using the otp_win64_R15B02_with_MSVCR100_installer_fix.exe installer and the 32bit version. Below is more details about what happened. 1. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as administrator. It found the C runtime library was not installed but it didn't prompt or run the installer for the c runtime library. The installer continued without error. The path "c:\program files\erl5.9.2 exists but the sub folder "bin" did not exist. It appears the win64 installer didn't install all files. 2. Uninstalled win64. No errors given during uninstallation. 3. Ran otp_win32_R15B02_with_MSVCR100_installer_fix.exe as administrator. It found the c runtime library was not installed. It prompted and installed the runtime and the rest of the installer went without error. The win32 version worked. Thinking the c runtime library installation was the issue... 4. Uninstalled win32. No errors given during uninstallation 5. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as administrator. The installer detected the C runtime library was already installed and had it unchecked in the installer. The installer then ran and gave no errors. The path "c:\program files\erl5.9.2 didn't contain the "bin" folder. The win64 was incomplete. Since then I have reinstalled the win32. So far the issues with the installation of the win64 is repeatable. Please let me know if there is anything I can do to further help identify if this is a real issue. -Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Thu Nov 8 19:01:50 2012 From: pan@REDACTED (Patrik Nyblom) Date: Thu, 8 Nov 2012 19:01:50 +0100 Subject: [erlang-questions] Install win64 r15B02 on Windows 2012 server issues In-Reply-To: References: Message-ID: <509BF38E.50901@erlang.org> Hi! Actually Win 2012 should already have the libraries installed, I wonder what's wrong... Could you try installing the vcredist manually (download from http://www.microsoft.com/en-us/download/details.aspx?id=14632) and see if anything gets better? The bin directory not being populated indicates that Install.exe in the top erlang installation dir could not be run. Could you also try to run that from a command line and see if it says something interesting (like "i cannot find the dll's, i'm a very sad windows exe" or something...). It gets run by the installer at the end to copy some files, it may be silent if it fails to start... When installing, you get a log window (that you can see if clicking the "Show details" button when files are expanded). If you run the x64 installation, with documentation unchecked, klick show details, wait until the installation is done, then rightclick the log and select "Copy details to clipboard", you can then paste the log in a mail and send it to me (pan@REDACTED). If we're lucky, it might contain a hint about why Install.exe is not run or what happens to the x64 vcredist installer. Cheers, /Patrik On 11/08/2012 06:39 PM, Mark Ward wrote: > Hello, > > I have a freshly created Windows 2012 x64 server with GUI. The first > application to install was erlang. It appears the win64 installer > fails to install all of the files required for erlang OTP R15B02. The > win32 installer works. > > I am using the otp_win64_R15B02_with_MSVCR100_installer_fix.exe > installer and the 32bit version. Below is more details about what > happened. > > 1. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as > administrator. It found the C runtime library was not installed but > it didn't prompt or run the installer for the c runtime library. The > installer continued without error. The path "c:\program > files\erl5.9.2 exists but the sub folder "bin" did not exist. It > appears the win64 installer didn't install all files. > > 2. Uninstalled win64. No errors given during uninstallation. > > 3. Ran otp_win32_R15B02_with_MSVCR100_installer_fix.exe as > administrator. It found the c runtime library was not installed. It > prompted and installed the runtime and the rest of the installer went > without error. The win32 version worked. > > Thinking the c runtime library installation was the issue... > > 4. Uninstalled win32. No errors given during uninstallation > > 5. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as > administrator. The installer detected the C runtime library was > already installed and had it unchecked in the installer. The > installer then ran and gave no errors. The path "c:\program > files\erl5.9.2 didn't contain the "bin" folder. The win64 was incomplete. > > Since then I have reinstalled the win32. > > So far the issues with the installation of the win64 is repeatable. > Please let me know if there is anything I can do to further help > identify if this is a real issue. > > -Mark > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ward.mark@REDACTED Thu Nov 8 19:36:02 2012 From: ward.mark@REDACTED (Mark Ward) Date: Thu, 8 Nov 2012 12:36:02 -0600 Subject: [erlang-questions] Install win64 r15B02 on Windows 2012 server issues In-Reply-To: <509BF38E.50901@erlang.org> References: <509BF38E.50901@erlang.org> Message-ID: Hi Patrik, It looks like the installer does not install the vcredist x64 2010 version and fails to detect it correctly. After I downloaded the vcredist x64 2010 and installed it the erlan win64 installation worked. I see the bin directory! Plus the app that uses erlang is working with the erlang win64 installed. Let me know if there is further testing I can provide. I have the log files that I will continue to send to you. -Mark On Thu, Nov 8, 2012 at 12:01 PM, Patrik Nyblom wrote: > Hi! > > Actually Win 2012 should already have the libraries installed, I wonder > what's wrong... > > Could you try installing the vcredist manually (download from > http://www.microsoft.com/en-us/download/details.aspx?id=14632) and see if > anything gets better? > > The bin directory not being populated indicates that Install.exe in the > top erlang installation dir could not be run. Could you also try to run > that from a command line and see if it says something interesting (like "i > cannot find the dll's, i'm a very sad windows exe" or something...). It > gets run by the installer at the end to copy some files, it may be silent > if it fails to start... > > When installing, you get a log window (that you can see if clicking the > "Show details" button when files are expanded). If you run the x64 > installation, with documentation unchecked, klick show details, wait until > the installation is done, then rightclick the log and select "Copy details > to clipboard", you can then paste the log in a mail and send it to me ( > pan@REDACTED). If we're lucky, it might contain a hint about why > Install.exe is not run or what happens to the x64 vcredist installer. > > Cheers, > /Patrik > > > > On 11/08/2012 06:39 PM, Mark Ward wrote: > > Hello, > > I have a freshly created Windows 2012 x64 server with GUI. The first > application to install was erlang. It appears the win64 installer fails to > install all of the files required for erlang OTP R15B02. The win32 > installer works. > > I am using the otp_win64_R15B02_with_MSVCR100_installer_fix.exe > installer and the 32bit version. Below is more details about what happened. > > 1. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as > administrator. It found the C runtime library was not installed but it > didn't prompt or run the installer for the c runtime library. The > installer continued without error. The path "c:\program files\erl5.9.2 > exists but the sub folder "bin" did not exist. It appears the win64 > installer didn't install all files. > > 2. Uninstalled win64. No errors given during uninstallation. > > 3. Ran otp_win32_R15B02_with_MSVCR100_installer_fix.exe as > administrator. It found the c runtime library was not installed. It > prompted and installed the runtime and the rest of the installer went > without error. The win32 version worked. > > Thinking the c runtime library installation was the issue... > > 4. Uninstalled win32. No errors given during uninstallation > > 5. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as > administrator. The installer detected the C runtime library was already > installed and had it unchecked in the installer. The installer then ran > and gave no errors. The path "c:\program files\erl5.9.2 didn't contain the > "bin" folder. The win64 was incomplete. > > Since then I have reinstalled the win32. > > So far the issues with the installation of the win64 is repeatable. > Please let me know if there is anything I can do to further help identify > if this is a real issue. > > -Mark > > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Thu Nov 8 20:57:54 2012 From: dmercer@REDACTED (David Mercer) Date: Thu, 8 Nov 2012 13:57:54 -0600 Subject: [erlang-questions] Future of epmd In-Reply-To: References: Message-ID: <062e01cdbdeb$57d14870$0773d950$@gmail.com> On 7 nov 2012, Dmitry Demeshchuk wrote: > 3. The client (node) part of epmd seems to be all implemented in C and > sealed inside ERTS. However, it seems like this code could be implemented > inside the net_kernel module instead (or something similar). On Thursday, November 08, 2012, Kenneth Lundin wrote: > The client part is already written in Erlang, see the erl_epmd module. Just wanted to clarify which it is... Cheers, DBM From mvm_8@REDACTED Thu Nov 8 21:12:12 2012 From: mvm_8@REDACTED (Venu Middela) Date: Thu, 8 Nov 2012 14:12:12 -0600 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: <509BBA7B.2030406@erix.ericsson.se> References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>,<509BBA7B.2030406@erix.ericsson.se> Message-ID: Steve, Thanks for pointing out the correct version of crypto. Could you please point to instructions on how to patch crypto to remove the NIF des_ede3_cfb_crypt. I couldnt find a solaris package version 0.9.8. Looked through oracle sites for updated package and/or any patch that would upgrade openssl to 0.9.8, but no luck. Thanks Venu > Date: Thu, 8 Nov 2012 14:58:19 +0100 > From: sverker.eriksson@REDACTED > To: kostis@REDACTED > CC: erlang-questions@REDACTED > Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 > > Kostis Sagonas wrote: > > On 11/08/2012 10:59 AM, Sverker Eriksson wrote: > >> crypto needs OpenSSL 0.9.8, you have 0.9.7. > >> > >> Either install 0.9.8 or patch crypto by removing the NIF > >> des_ede3_cfb_crypt which is the only one that needs 0.9.8. > > > > Shouldn't this be checked or isn't this something which is done better > > as part of the configure script? I.e. checking at configure time > > which OpenSSL version is used and taking some appropriate action? > > > Yes, that would be nicer. > > In R16 crypto will support OpenSSL 0.9.7. > > crypto:des3_cfb_encrypt and des3_cfb_decrypt will then throw exception > 'notsup'. > > /Sverker > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Thu Nov 8 21:50:21 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 8 Nov 2012 21:50:21 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr> <509BBA7B.2030406@erix.ericsson.se> Message-ID: 2012/11/8 Venu Middela : > Steve, > Thanks for pointing out the correct version of crypto. > Could you please point to instructions on how to patch crypto to remove the > NIF des_ede3_cfb_crypt. > I couldnt find a solaris package version 0.9.8. Looked through oracle sites > for updated package and/or any patch that would > upgrade openssl to 0.9.8, but no luck. Check sunfreeware.com (or one of its mirrors). For example this is a 0.9.8 package for Solaris 10 on x86: http://sunfreeware.saix.net/programlistintel10.html#openssl098p It seems that now the main site requires registration :-( From mvm_8@REDACTED Thu Nov 8 22:07:40 2012 From: mvm_8@REDACTED (Venu Middela) Date: Thu, 8 Nov 2012 15:07:40 -0600 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>, <509BBA7B.2030406@erix.ericsson.se>, , Message-ID: Attila, I did try installing the package openssl0.9.8, but the binaries from this package are 32 bit. also, when i tried to compile from the sourcecode , strangely, the compile/make is not building the 64-bit binaries for libcrypto and libssl.. here's the contents of compiled /usr/local/ssl/lib bash-3.2$ pwd /usr/local/ssl/lib -bash-3.2$ ls engines libcrypto.a libssl.a pkgconfig Thanks, Venu > Date: Thu, 8 Nov 2012 21:50:21 +0100 > From: attila.r.nohl@REDACTED > To: erlang-questions@REDACTED > Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 > > 2012/11/8 Venu Middela : > > Steve, > > Thanks for pointing out the correct version of crypto. > > Could you please point to instructions on how to patch crypto to remove the > > NIF des_ede3_cfb_crypt. > > I couldnt find a solaris package version 0.9.8. Looked through oracle sites > > for updated package and/or any patch that would > > upgrade openssl to 0.9.8, but no luck. > > Check sunfreeware.com (or one of its mirrors). For example this is a > 0.9.8 package for Solaris 10 on x86: > http://sunfreeware.saix.net/programlistintel10.html#openssl098p It > seems that now the main site requires registration :-( > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From joshmuza@REDACTED Fri Nov 9 06:20:18 2012 From: joshmuza@REDACTED (Joshua Muzaaya) Date: Fri, 9 Nov 2012 08:20:18 +0300 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes Message-ID: I have a setup in which two nodes are going to be communicating a lot. On Node A, there are going to be thousands of processes, which are meant to access services on Node B. There is going to be a massive load of requests and responses across the two nodes. The two Nodes, will be running on two different servers, each on its own hardware server. I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message to a registered gen_server on Node B. Let me explain each option. *HTTP/1.1* Suppose that on Node A, i have an HTTP Client like Ibrowse, and on Node B, i have a web server like Yaws-1.95, the web server being able to handle unlimited connections, the operating system settings tweaked to allow yaws to handle all connections. And then make my processes on Node A to communicate using HTTP. In this case each method call, would mean a single HTTP request and a reply. I believe there is an overhead here, but we are evaluating options here. The erlang Built in mechanism called webtool, may be built for this kind of purpose. *rpc:call/4* I could simply make direct rpc calls from Node A to Node B. I am not very sure how the underlying rpc mechanism works , but i think that when two erlang nodes connect via net_adm:ping/1, the created connection is not closed but all rpc calls use this pipe to transmit requests and pass responses. Please correct me on this one. *Sending a Message from Node A to Node B * I could make my processes on Node A to just send message to a registered process, or a group of processes on Node B. This too seems a clean option. *Q1.* Which of the above options would you recommend and why, for an application in which two erlang nodes are going to have enormous communications between them all the time. Imagine a messaging system, in which two erlang nodes are the routers :) ? *Q2.* Which of the above methods is cleaner, less problematic and is more fault tolerant (i mean here that, the method should NOT have single point of failure, that could lead to all processes on Node A blind) ? *Q3.* The mechanism of your choice: how would you make it even more fault tolerant, or redundant? *Assumptions: * The Nodes are always alive and will never go down, the network connection between the nodes will always be available and non-congested (dedicated to the two nodes only) , the operating system have allocated maximum resources to these two nodes. Thank you for your evaluations -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Fri Nov 9 08:31:52 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Fri, 9 Nov 2012 09:31:52 +0200 Subject: [erlang-questions] Help Please Message-ID: Hi, May you kindly help with the exercise below using Erlang [I am new Erlang Development]: *Introduction* Meet Mr. and Mrs. Hollingberry. Recently retired, Mr. Hollingberry has decided to move to sunny South Africa and open up a small local convenience store to keep him and Mrs. Hollingberry out of mischief. Alas, it turned out not be such a laid-back job as he had hoped... *The Problem* One of their current problems is printing price tags on their fresh produce. Every morning, as soon as the various produce have been delivered, Mrs. Hollingberry enters it into a program her nephew had written. The result is a comma-seperated file that includes, among other fields, the cost price (in cents) and delivery date of each product. *The Task* Your job is to write a program that reads the csv file and then creates a new file that will be used to print out the price tags. *The Input File* An example csv file is in this directory (produce.csv). We use the following fields: ? Supplier ID. All suppliers are equal, but some are more equal than others. ? Product code. This tells us what kind of produce we're dealing with. ? Description. We can print part of this on the price tag. ? Delivery date. YYYY-MM-DD. We use this to calculate the sell-by date. ? Cost price. In cents. We use this to calculate the selling price. ? Unit count. We need to print a price tag for each item delivered. *The Output File* The price file has 3 fields on each line: the selling price, the sell-by date and a product description. The price file is in fixed-width format, because the label printer has limited space (50 characters) for each price tag. Each line in the price file will cause one price tag to be printed. The selling price takes up 9 characters. One currency symbol (R) and 8 digits where Rands and cents are seperated by a period: R99999.99 Mr Hollingberry says we shouldn't worry about larger amounts. If he ever sells something for a 100 grand he will have to retire again, and he can't take that kind of stress again. The sell-by date, just like the delivery date in the input file, is in YYYY/MM/DD format (10 characters). The remaining 31 characters is used for the product description. A typical line in the price file will look like this: R 19.922012/05/26Apples 1kg Green. They are very *The Business Rules* You have to calculate the selling price and the sell-by date. Luckily we can use the description just as it is in the csv file. Well, the first 31 characters of it anyway. *Markup Rules* ? The markup for apples is 40%. ? The markup for bananas is 35%. ? The markup for berries is 55%. ? The markup for anything else 50%. *Premium Produce (tm)* Some suppliers are dedicated Premium Produce (tm) suppliers. The customer has to believe that they are buying something better than usual. We do this by making the packaging look nice, and by increasing the price. The suppliers already took care of the nice packaging, you now have to make it expensive. Anything supplied by a Premium Produce (tm) supplier gets an additional 10% markup, and then the price is rounded up to the nearest Rand. For example, if a product costs R25.11 after the extra 10% markup has been applied, you need to round it up to R26. The Premium Produce suppliers currently are: * Promise Mashangu (Supplier ID 219) * Karel Visser (Supplier ID 204) *Sell-by Dates* ? Apples have to be sold 2 weeks after the date of delivery. ? Bananas have to be sold 5 days after the date of delivery. ? All other types of fruit has to be sold 1 week after the date of delivery. *Supplier Troubles* One the suppliers, Susan Windler (Supplier ID 32), has been known to deliver fruit that is not quite as fresh as that of the other suppliers. Mr. Hollingberry has decided to handle this quietly, by ensuring that the sell-by date for anything delivered by Susan is always 3 days earlier than normal. Come to think of it, Togetherness Tshabalala (Supplier ID 101), also needs to be on this list. *Product Codes* ? Fruit has product codes ranging from 1000 to 1999. ? Apples specifically have product codes ranging from 1100 to 1199. ? Bananas have product codes ranging from 1200 to 1299. ? Berries have product codes ranging from 1300 to 1399. Kindest Regards Lucky KHoza -------------- next part -------------- An HTML attachment was scrubbed... URL: From humeafo@REDACTED Fri Nov 9 09:42:21 2012 From: humeafo@REDACTED (hume npx) Date: Fri, 9 Nov 2012 16:42:21 +0800 Subject: [erlang-questions] About Erlang system performance Message-ID: Hi, all: I'am new to erlang, after investigate some benchmark such as at http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, I found that erlang compiler is not so good at speed? the benchmark shows that erlang Hipe is 13x slowdown compared to C++, as compared to Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 is about 1x faster than erlang, I investigated the erLLVM project which reported similar results to Hipe, you know performance is so important nowadays, what caused the hard to improve performace of erlang or just there are not people working on it? Erlang is attractive to me after several days studying, but with great performance will be more attractive and competitive to some languages such as go etc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Fri Nov 9 10:25:51 2012 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Fri, 9 Nov 2012 10:25:51 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>, <509BBA7B.2030406@erix.ericsson.se>, , Message-ID: <509CCC1F.1070401@erix.ericsson.se> You have to configure openssl source tree with option 'shared' to get dynamic libraries. Option 'no-asm' might also help if you get compile problems. Read INSTALL. /Sverker Venu Middela wrote: > Attila, > I did try installing the package openssl0.9.8, but the binaries from this package are 32 bit. > also, when i tried to compile from the sourcecode , strangely, the compile/make is not building the 64-bit binaries for libcrypto and libssl.. > here's the contents of compiled /usr/local/ssl/lib > bash-3.2$ pwd > /usr/local/ssl/lib > > -bash-3.2$ ls > engines libcrypto.a libssl.a pkgconfig > > > Thanks, > Venu > > >> Date: Thu, 8 Nov 2012 21:50:21 +0100 >> From: attila.r.nohl@REDACTED >> To: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >> >> 2012/11/8 Venu Middela : >> >>> Steve, >>> Thanks for pointing out the correct version of crypto. >>> Could you please point to instructions on how to patch crypto to remove the >>> NIF des_ede3_cfb_crypt. >>> I couldnt find a solaris package version 0.9.8. Looked through oracle sites >>> for updated package and/or any patch that would >>> upgrade openssl to 0.9.8, but no luck. >>> >> Check sunfreeware.com (or one of its mirrors). For example this is a >> 0.9.8 package for Solaris 10 on x86: >> http://sunfreeware.saix.net/programlistintel10.html#openssl098p It >> seems that now the main site requires registration :-( >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jesper.louis.andersen@REDACTED Fri Nov 9 11:05:20 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 9 Nov 2012 11:05:20 +0100 Subject: [erlang-questions] Help Please In-Reply-To: References: Message-ID: Lucky, the purpose of an exercise is to train you in working with a new programming language. You need to sit down and make an attempt at solving the problem yourself. Therein lies the wisdom and learning. I suggest that you start out by reading through the problem description and then write down code for the problem at hand. If you have a concrete question as to how a certain part of Erlang works, I am sure you will get a lot of helpful answers, but no, we won't solve your homework for you. In fact, why pry the delight of having solved it yourself? Some hints to get you started though: A. You have a .csv file. It should definitely be read in (see the 'file' module in the documentation of erlang at erlang.org). B. You must find an internal representation in memory of the file in question. C. You must manipulate said representation until it matches the desired result. D. You must format and print out the result. Perhaps the io and io_lib modules can help (beware, they are slightly different in nature. Understanding the difference is important). Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen On Nov 9, 2012, at 8:31 AM, Lucky Khoza wrote: > Hi, > > May you kindly help with the exercise below using Erlang [I am new Erlang Development]: > > Introduction > > Meet Mr. and Mrs. Hollingberry. Recently retired, Mr. Hollingberry has decided to move to sunny South Africa and open up a small local convenience store to keep him and Mrs. Hollingberry out of mischief. > > Alas, it turned out not be such a laid-back job as he had hoped... > > The Problem > > One of their current problems is printing price tags on their fresh produce. Every morning, as soon as the various produce have been delivered, Mrs. Hollingberry enters it into a program her nephew had written. > > The result is a comma-seperated file that includes, among other fields, the cost price (in cents) and delivery date of each product. > > The Task > > Your job is to write a program that reads the csv file and then creates a new file that will be used to print out the price tags. > > The Input File > > An example csv file is in this directory (produce.csv). We use the following fields: > > ? Supplier ID. > All suppliers are equal, but some are more equal than others. > > ? Product code. > This tells us what kind of produce we're dealing with. > > ? Description. > We can print part of this on the price tag. > > ? Delivery date. > YYYY-MM-DD. We use this to calculate the sell-by date. > > ? Cost price. > In cents. We use this to calculate the selling price. > > ? Unit count. > We need to print a price tag for each item delivered. > > The Output File > > The price file has 3 fields on each line: the selling price, the sell-by date and a product description. > > The price file is in fixed-width format, because the label printer has limited space (50 characters) for each price tag. Each line in the price file will cause one price tag to be printed. > > The selling price takes up 9 characters. One currency symbol (R) and 8 digits where Rands and cents are seperated by a period: R99999.99 > > Mr Hollingberry says we shouldn't worry about larger amounts. If he ever sells something for a 100 grand he will have to retire again, and he can't take that kind of stress again. > > The sell-by date, just like the delivery date in the input file, is in YYYY/MM/DD format (10 characters). > > The remaining 31 characters is used for the product description. > > A typical line in the price file will look like this: > > R 19.922012/05/26Apples 1kg Green. They are very > > The Business Rules > > You have to calculate the selling price and the sell-by date. Luckily we can use the description just as it is in the csv file. Well, the first 31 characters of it anyway. > > Markup Rules > > ? The markup for apples is 40%. > ? The markup for bananas is 35%. > ? The markup for berries is 55%. > ? The markup for anything else 50%. > Premium Produce (tm) > > Some suppliers are dedicated Premium Produce (tm) suppliers. The customer has to believe that they are buying something better than usual. We do this by making the packaging look nice, and by increasing the price. The suppliers already took care of the nice packaging, you now have to make it expensive. Anything supplied by a Premium Produce (tm) supplier gets an additional 10% markup, and then the price is rounded up to the nearest Rand. For example, if a product costs R25.11 after the extra 10% markup has been applied, you need to round it up to R26. The Premium Produce suppliers currently are: * Promise Mashangu (Supplier ID 219) * Karel Visser (Supplier ID 204) > > Sell-by Dates > > ? Apples have to be sold 2 weeks after the date of delivery. > ? Bananas have to be sold 5 days after the date of delivery. > ? All other types of fruit has to be sold 1 week after the date of delivery. > Supplier Troubles > > One the suppliers, Susan Windler (Supplier ID 32), has been known to deliver fruit that is not quite as fresh as that of the other suppliers. Mr. Hollingberry has decided to handle this quietly, by ensuring that the sell-by date for anything delivered by Susan is always 3 days earlier than normal. Come to think of it, Togetherness Tshabalala (Supplier ID 101), also needs to be on this list. > > Product Codes > > ? Fruit has product codes ranging from 1000 to 1999. > ? Apples specifically have product codes ranging from 1100 to 1199. > ? Bananas have product codes ranging from 1200 to 1299. > ? Berries have product codes ranging from 1300 to 1399. > > > Kindest Regards > Lucky KHoza > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From shankar_patil@REDACTED Fri Nov 9 11:17:08 2012 From: shankar_patil@REDACTED (Shankar Patil) Date: Fri, 9 Nov 2012 10:17:08 +0000 Subject: [erlang-questions] getting error in erlang Message-ID: <8C29E01908962B4095A9044AE0F89A40434A2A56@HJ-MBX2.persistent.co.in> Hello All, I am compiling erlang otp_src_R15B on aix 6.1 machine. Getting below errors. ../include/internal/ethread.h: In function 'ethr_spin_lock__': ../include/internal/ethread.h:555: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:344: error: parse error before 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: type defaults to 'int' in declaration of 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: data definition has no type or storage class common/ethr_aux.c:529: error: parse error before '*' token common/ethr_aux.c:530: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_init': common/ethr_aux.c:537: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:541: error: parse error before '*' token common/ethr_aux.c:542: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_destroy': common/ethr_aux.c:553: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:557: error: parse error before '*' token common/ethr_aux.c:558: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_unlock': common/ethr_aux.c:561: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:565: error: parse error before '*' token common/ethr_aux.c:566: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_lock': common/ethr_aux.c:569: error: 'lock' undeclared (first use in this function) gmake[5]: *** [obj/rs6000-ibm-aix/opt/r/ethr_aux.o] Error 1 gmake[5]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[4]: *** [opt] Error 2 gmake[4]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[3]: *** [erts_lib] Error 2 gmake[3]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[1]: *** [smp] Error 2 gmake[1]: Leaving directory `/opt/otp_src_R15B/erts' gmake: *** [emulator] Error 2 can you please help out ? Regards, Shankar Patil DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Fri Nov 9 11:20:35 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Fri, 9 Nov 2012 12:20:35 +0200 Subject: [erlang-questions] Help Please In-Reply-To: References: Message-ID: Thanks to all for inputs and i will try it out, and therefore i will ask you to comment as well. On Fri, Nov 9, 2012 at 12:05 PM, Jesper Louis Andersen < jesper.louis.andersen@REDACTED> wrote: > Lucky, > > the purpose of an exercise is to train you in working with a new > programming language. You need to sit down and make an attempt at solving > the problem yourself. Therein lies the wisdom and learning. I suggest that > you start out by reading through the problem description and then write > down code for the problem at hand. If you have a concrete question as to > how a certain part of Erlang works, I am sure you will get a lot of helpful > answers, but no, we won't solve your homework for you. > > In fact, why pry the delight of having solved it yourself? > > Some hints to get you started though: > > A. You have a .csv file. It should definitely be read in (see the 'file' > module in the documentation of erlang at erlang.org). > B. You must find an internal representation in memory of the file in > question. > C. You must manipulate said representation until it matches the desired > result. > D. You must format and print out the result. Perhaps the io and io_lib > modules can help (beware, they are slightly different in nature. > Understanding the difference is important). > > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen > > > > On Nov 9, 2012, at 8:31 AM, Lucky Khoza wrote: > > > Hi, > > > > May you kindly help with the exercise below using Erlang [I am new > Erlang Development]: > > > > Introduction > > > > Meet Mr. and Mrs. Hollingberry. Recently retired, Mr. Hollingberry has > decided to move to sunny South Africa and open up a small local convenience > store to keep him and Mrs. Hollingberry out of mischief. > > > > Alas, it turned out not be such a laid-back job as he had hoped... > > > > The Problem > > > > One of their current problems is printing price tags on their fresh > produce. Every morning, as soon as the various produce have been delivered, > Mrs. Hollingberry enters it into a program her nephew had written. > > > > The result is a comma-seperated file that includes, among other fields, > the cost price (in cents) and delivery date of each product. > > > > The Task > > > > Your job is to write a program that reads the csv file and then creates > a new file that will be used to print out the price tags. > > > > The Input File > > > > An example csv file is in this directory (produce.csv). We use the > following fields: > > > > ? Supplier ID. > All suppliers are equal, but some are more equal > than others. > > > > ? Product code. > This tells us what kind of produce we're dealing > with. > > > > ? Description. > We can print part of this on the price tag. > > > > ? Delivery date. > YYYY-MM-DD. We use this to calculate the sell-by > date. > > > > ? Cost price. > In cents. We use this to calculate the selling price. > > > > ? Unit count. > We need to print a price tag for each item delivered. > > > > The Output File > > > > The price file has 3 fields on each line: the selling price, the sell-by > date and a product description. > > > > The price file is in fixed-width format, because the label printer has > limited space (50 characters) for each price tag. Each line in the price > file will cause one price tag to be printed. > > > > The selling price takes up 9 characters. One currency symbol (R) and 8 > digits where Rands and cents are seperated by a period: R99999.99 > > > > Mr Hollingberry says we shouldn't worry about larger amounts. If he ever > sells something for a 100 grand he will have to retire again, and he can't > take that kind of stress again. > > > > The sell-by date, just like the delivery date in the input file, is in > YYYY/MM/DD format (10 characters). > > > > The remaining 31 characters is used for the product description. > > > > A typical line in the price file will look like this: > > > > R 19.922012/05/26Apples 1kg Green. They are very > > > > The Business Rules > > > > You have to calculate the selling price and the sell-by date. Luckily we > can use the description just as it is in the csv file. Well, the first 31 > characters of it anyway. > > > > Markup Rules > > > > ? The markup for apples is 40%. > > ? The markup for bananas is 35%. > > ? The markup for berries is 55%. > > ? The markup for anything else 50%. > > Premium Produce (tm) > > > > Some suppliers are dedicated Premium Produce (tm) suppliers. The > customer has to believe that they are buying something better than usual. > We do this by making the packaging look nice, and by increasing the price. > The suppliers already took care of the nice packaging, you now have to make > it expensive. Anything supplied by a Premium Produce (tm) supplier gets an > additional 10% markup, and then the price is rounded up to the nearest > Rand. For example, if a product costs R25.11 after the extra 10% markup has > been applied, you need to round it up to R26. The Premium Produce suppliers > currently are: * Promise Mashangu (Supplier ID 219) * Karel Visser > (Supplier ID 204) > > > > Sell-by Dates > > > > ? Apples have to be sold 2 weeks after the date of delivery. > > ? Bananas have to be sold 5 days after the date of delivery. > > ? All other types of fruit has to be sold 1 week after the date of > delivery. > > Supplier Troubles > > > > One the suppliers, Susan Windler (Supplier ID 32), has been known to > deliver fruit that is not quite as fresh as that of the other suppliers. > Mr. Hollingberry has decided to handle this quietly, by ensuring that the > sell-by date for anything delivered by Susan is always 3 days earlier than > normal. Come to think of it, Togetherness Tshabalala (Supplier ID 101), > also needs to be on this list. > > > > Product Codes > > > > ? Fruit has product codes ranging from 1000 to 1999. > > ? Apples specifically have product codes ranging from 1100 to 1199. > > ? Bananas have product codes ranging from 1200 to 1299. > > ? Berries have product codes ranging from 1300 to 1399. > > > > > > Kindest Regards > > Lucky KHoza > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From js@REDACTED Fri Nov 9 12:57:42 2012 From: js@REDACTED (Schneider) Date: Fri, 09 Nov 2012 12:57:42 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <509CEFB6.3060609@globe.de> Erlang is a language, which produced byte-code which get' interpreted by the Erlang engine. C++ instead generates mashing-code which has on the one hand a much better performance, on the other hand, some disadvantages like incompatibility between different OSs. greatz Johannes On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at > http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, > I found that erlang compiler is not so good at speed? the benchmark > shows that erlang Hipe is 13x slowdown compared to C++, as compared to > Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 > is about 1x faster than erlang, I investigated the erLLVM project > which reported similar results to Hipe, you know performance is so > important nowadays, what caused the hard to improve performace of > erlang or just there are not people working on it? Erlang is > attractive to me after several days studying, but with great > performance will be more attractive and competitive to some languages > such as go etc. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From matti.oinas@REDACTED Fri Nov 9 13:07:49 2012 From: matti.oinas@REDACTED (Matti Oinas) Date: Fri, 9 Nov 2012 14:07:49 +0200 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509CEFB6.3060609@globe.de> References: <509CEFB6.3060609@globe.de> Message-ID: Correct me if I'm wrong but doesn't HIPE compile to native code? -- Matti On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: > Erlang is a language, which produced byte-code which get' interpreted by the > Erlang engine. C++ instead generates mashing-code which has on the one hand > a much better performance, on the other hand, > some disadvantages like incompatibility between different OSs. > > greatz Johannes > > > On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >> >> Hi, all: >> I'am new to erlang, after investigate some benchmark such as at >> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >> I found that erlang compiler is not so good at speed? the benchmark >> shows that erlang Hipe is 13x slowdown compared to C++, as compared to >> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >> is about 1x faster than erlang, I investigated the erLLVM project >> which reported similar results to Hipe, you know performance is so >> important nowadays, what caused the hard to improve performace of >> erlang or just there are not people working on it? Erlang is >> attractive to me after several days studying, but with great >> performance will be more attractive and competitive to some languages >> such as go etc. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From js@REDACTED Fri Nov 9 13:11:11 2012 From: js@REDACTED (Schneider) Date: Fri, 09 Nov 2012 13:11:11 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: <509CEFB6.3060609@globe.de> Message-ID: <509CF2DF.4030405@globe.de> you're right. HIPE generates compiled code. my mistake. take a look here for more info's about HIPE: http://user.it.uu.se/~kostis/Papers/erlang03.pdf greatz Johannes On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: > Correct me if I'm wrong but doesn't HIPE compile to native code? > > -- > Matti > > On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: >> Erlang is a language, which produced byte-code which get' interpreted by the >> Erlang engine. C++ instead generates mashing-code which has on the one hand >> a much better performance, on the other hand, >> some disadvantages like incompatibility between different OSs. >> >> greatz Johannes >> >> >> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >>> >>> Hi, all: >>> I'am new to erlang, after investigate some benchmark such as at >>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >>> I found that erlang compiler is not so good at speed? the benchmark >>> shows that erlang Hipe is 13x slowdown compared to C++, as compared to >>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >>> is about 1x faster than erlang, I investigated the erLLVM project >>> which reported similar results to Hipe, you know performance is so >>> important nowadays, what caused the hard to improve performace of >>> erlang or just there are not people working on it? Erlang is >>> attractive to me after several days studying, but with great >>> performance will be more attractive and competitive to some languages >>> such as go etc. >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From olopierpa@REDACTED Fri Nov 9 14:05:21 2012 From: olopierpa@REDACTED (Pierpaolo Bernardi) Date: Fri, 9 Nov 2012 14:05:21 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: On Fri, Nov 9, 2012 at 9:42 AM, hume npx wrote: > Erlang is attractive to me after several days studying, but > with great performance will be more attractive and competitive to some > languages such as go etc. Are there any complex systems implemented in go, so we can be sure we are not comparing apples to oranges? From valentin@REDACTED Fri Nov 9 14:16:19 2012 From: valentin@REDACTED (Valentin Micic) Date: Fri, 9 Nov 2012 15:16:19 +0200 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509CF2DF.4030405@globe.de> References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> Message-ID: Unrelated, but would be interesting to find out -- are there any commercial-grade (let alone carrier-grade) systems that take advantage of HiPE? V/ On 09 Nov 2012, at 2:11 PM, Schneider wrote: > you're right. HIPE generates compiled code. > my mistake. > take a look here for more info's about HIPE: > http://user.it.uu.se/~kostis/Papers/erlang03.pdf > > greatz Johannes > > > On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >> Correct me if I'm wrong but doesn't HIPE compile to native code? >> >> -- >> Matti >> >> On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: >>> Erlang is a language, which produced byte-code which get' interpreted by the >>> Erlang engine. C++ instead generates mashing-code which has on the one hand >>> a much better performance, on the other hand, >>> some disadvantages like incompatibility between different OSs. >>> >>> greatz Johannes >>> >>> >>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >>>> >>>> Hi, all: >>>> I'am new to erlang, after investigate some benchmark such as at >>>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >>>> I found that erlang compiler is not so good at speed? the benchmark >>>> shows that erlang Hipe is 13x slowdown compared to C++, as compared to >>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >>>> is about 1x faster than erlang, I investigated the erLLVM project >>>> which reported similar results to Hipe, you know performance is so >>>> important nowadays, what caused the hard to improve performace of >>>> erlang or just there are not people working on it? Erlang is >>>> attractive to me after several days studying, but with great >>>> performance will be more attractive and competitive to some languages >>>> such as go etc. >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From valentin@REDACTED Fri Nov 9 14:45:16 2012 From: valentin@REDACTED (Valentin Micic) Date: Fri, 9 Nov 2012 15:45:16 +0200 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> Message-ID: Interestingly enough, this was a kind of conclusion we've arrived at as well -- the good performance of Beam, combined with "perceived instability", acted as a serious deterrent for me. But Max, wouldn't you like to know if there are any brave souls out there that were prepared to go beyond perceptions and successfully tried it in "real-life" situation? V/ On 09 Nov 2012, at 3:34 PM, Max Bourinov wrote: > Unrelated, but: we were considering to give a try to HiPE but so far there is no need to do it for us because Beam outperforms everything else in our problem domain. > > > Best regards, > Max > > > > > On Fri, Nov 9, 2012 at 5:16 PM, Valentin Micic wrote: > Unrelated, but would be interesting to find out -- are there any commercial-grade (let alone carrier-grade) systems that take advantage of HiPE? > > > V/ > > On 09 Nov 2012, at 2:11 PM, Schneider wrote: > > > you're right. HIPE generates compiled code. > > my mistake. > > take a look here for more info's about HIPE: > > http://user.it.uu.se/~kostis/Papers/erlang03.pdf > > > > greatz Johannes > > > > > > On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: > >> Correct me if I'm wrong but doesn't HIPE compile to native code? > >> > >> -- > >> Matti > >> > >> On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: > >>> Erlang is a language, which produced byte-code which get' interpreted by the > >>> Erlang engine. C++ instead generates mashing-code which has on the one hand > >>> a much better performance, on the other hand, > >>> some disadvantages like incompatibility between different OSs. > >>> > >>> greatz Johannes > >>> > >>> > >>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: > >>>> > >>>> Hi, all: > >>>> I'am new to erlang, after investigate some benchmark such as at > >>>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, > >>>> I found that erlang compiler is not so good at speed? the benchmark > >>>> shows that erlang Hipe is 13x slowdown compared to C++, as compared to > >>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 > >>>> is about 1x faster than erlang, I investigated the erLLVM project > >>>> which reported similar results to Hipe, you know performance is so > >>>> important nowadays, what caused the hard to improve performace of > >>>> erlang or just there are not people working on it? Erlang is > >>>> attractive to me after several days studying, but with great > >>>> performance will be more attractive and competitive to some languages > >>>> such as go etc. > >>>> > >>>> > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>> > >>> > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Fri Nov 9 15:28:29 2012 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 9 Nov 2012 15:28:29 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <509D130D.8070009@erlang.org> On 11/09/2012 09:42 AM, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at > http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, > I found that erlang compiler is not so good at speed? the benchmark > shows that erlang Hipe is 13x slowdown compared to C++, as compared to > Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 > is about 1x faster than erlang, I investigated the erLLVM project > which reported similar results to Hipe, you know performance is so > important nowadays, what caused the hard to improve performace of > erlang or just there are not people working on it? Erlang is > attractive to me after several days studying, but with great > performance will be more attractive and competitive to some languages > such as go etc. The thing is - Erlang is a concurrent programming language, so it's optimized for concurrency and the problems therein. HiPE optimizes the sequential part of the system, but cannot do anything about schedulers etc, so it does not affect the concurrency characteristics (which it shouldn't either). HiPE does a really good job, but for sequential mini-benchmarks, HiPE or no HiPE will never be as fast as C++. We do not optimize for that either. Comparing HiPE to i.e. GCH, OCaml or any other common native compiler is really unfair. The other compilers make binaries directly on top of the OS, with no support for massive concurrency in any VM. Not to say that aren't really good compilers, but they solve a different problem. Building large systems with Erlang will show the whole picture, not running micro benchmarks. If your business is to sell game-of-life, rannkuch-redux or mandelbrot programs, you will get severely disappointed if trying to make the fastest program in Erlang. If you on the other hand is writing a large server, you will be surprised about what level of concurrency, what uptime and what hardware utilization you will achieve. So - we are really working on optimization, but not on optimizing benchmarks, but on making it possible to implement highly available, scalable, parallell and concurrent systems. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Cheers, Patrik -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardprideauxevans@REDACTED Fri Nov 9 15:31:32 2012 From: richardprideauxevans@REDACTED (Richard Evans) Date: Fri, 9 Nov 2012 14:31:32 +0000 Subject: [erlang-questions] Sending a large block of binary data from c to erlang Message-ID: I am using a port to communicate between c and erlang, as described in Joe Armstrong's excellent book, and in this tutorial: http://www.erlang.org/doc/tutorial/c_port.html#id63121 So far, the traffic between the two has been pretty small: typically a hundred bytes or so at a time. But now I need to (occasionally) send a large block of binary data from c to erlang: up to 1 meg. How should I handle such large blocks of binary data? Is there anything wrong with increasing the size of the buffer (called buf in the tutorial mentioned above) to 1 meg? Is there a better way of doing this? (NB I am using a port, rather than a port-driver (in which the c-code is linked directly to the erlang code)). thanks, Richard Evans -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Fri Nov 9 15:32:53 2012 From: pan@REDACTED (Patrik Nyblom) Date: Fri, 9 Nov 2012 15:32:53 +0100 Subject: [erlang-questions] Install win64 r15B02 on Windows 2012 server issues In-Reply-To: References: <509BF38E.50901@erlang.org> Message-ID: <509D1415.60902@erlang.org> On 11/08/2012 07:36 PM, Mark Ward wrote: > Hi Patrik, > > It looks like the installer does not install the vcredist x64 2010 > version and fails to detect it correctly. After I downloaded the > vcredist x64 2010 and installed it the erlan win64 installation > worked. I see the bin directory! Plus the app that uses erlang is > working with the erlang win64 installed. > RIght - we probably need to update the vcredist shipped to a newer version then. I'll look into that for the R15B03 release. I think I have enough information to reproduce, just need to set up a blank 2012 server to test on... sigh... I'll get back to you if I have problems reproducing! > Let me know if there is further testing I can provide. I have the log > files that I will continue to send to you. > > -Mark Thanks for the report and the help! Cheers, Patrik > > > > On Thu, Nov 8, 2012 at 12:01 PM, Patrik Nyblom > wrote: > > Hi! > > Actually Win 2012 should already have the libraries installed, I > wonder what's wrong... > > Could you try installing the vcredist manually (download from > http://www.microsoft.com/en-us/download/details.aspx?id=14632) and > see if anything gets better? > > The bin directory not being populated indicates that Install.exe > in the top erlang installation dir could not be run. Could you > also try to run that from a command line and see if it says > something interesting (like "i cannot find the dll's, i'm a very > sad windows exe" or something...). It gets run by the installer at > the end to copy some files, it may be silent if it fails to start... > > When installing, you get a log window (that you can see if > clicking the "Show details" button when files are expanded). If > you run the x64 installation, with documentation unchecked, klick > show details, wait until the installation is done, then rightclick > the log and select "Copy details to clipboard", you can then paste > the log in a mail and send it to me (pan@REDACTED > ). If we're lucky, it might contain a hint > about why Install.exe is not run or what happens to the x64 > vcredist installer. > > Cheers, > /Patrik > > > > On 11/08/2012 06:39 PM, Mark Ward wrote: >> Hello, >> >> I have a freshly created Windows 2012 x64 server with GUI. The >> first application to install was erlang. It appears the win64 >> installer fails to install all of the files required for erlang >> OTP R15B02. The win32 installer works. >> >> I am using the otp_win64_R15B02_with_MSVCR100_installer_fix.exe >> installer and the 32bit version. Below is more details about >> what happened. >> >> 1. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as >> administrator. It found the C runtime library was not installed >> but it didn't prompt or run the installer for the c runtime >> library. The installer continued without error. The path >> "c:\program files\erl5.9.2 exists but the sub folder "bin" did >> not exist. It appears the win64 installer didn't install all files. >> >> 2. Uninstalled win64. No errors given during uninstallation. >> >> 3. Ran otp_win32_R15B02_with_MSVCR100_installer_fix.exe as >> administrator. It found the c runtime library was not installed. >> It prompted and installed the runtime and the rest of the >> installer went without error. The win32 version worked. >> >> Thinking the c runtime library installation was the issue... >> >> 4. Uninstalled win32. No errors given during uninstallation >> >> 5. Ran otp_win64_R15B02_with_MSVCR100_installer_fix.exe as >> administrator. The installer detected the C runtime library was >> already installed and had it unchecked in the installer. The >> installer then ran and gave no errors. The path "c:\program >> files\erl5.9.2 didn't contain the "bin" folder. The win64 was >> incomplete. >> >> Since then I have reinstalled the win32. >> >> So far the issues with the installation of the win64 is >> repeatable. Please let me know if there is anything I can do to >> further help identify if this is a real issue. >> >> -Mark >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hobson42@REDACTED Fri Nov 9 15:58:38 2012 From: hobson42@REDACTED (Ian) Date: Fri, 09 Nov 2012 14:58:38 +0000 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <509D1A1E.9070803@gmail.com> On 09/11/2012 08:42, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at > http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, > I found that erlang compiler is not so good at speed? the benchmark > shows that erlang Hipe is 13x slowdown compared to C++, as compared to > Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 > is about 1x faster than erlang, I investigated the erLLVM project > which reported similar results to Hipe, you know performance is so > important nowadays, what caused the hard to improve performace of > erlang or just there are not people working on it? Erlang is > attractive to me after several days studying, but with great > performance will be more attractive and competitive to some languages > such as go etc. Hi, I'm no expert in Erlang, but I would caution against using small benchmarks to make significant decisions. They usually measure the wrong things. Most significant systems are speed limited due to I/O and networking: the CPU usage can be surprisingly low. Erlang handles async and simultaneous I/O and networking extremely well - by design. From my experience, and the research of others, anything from 20% to 60% of code in multi-threaded applications is spent checking that other threads have not changed things when they shouldn't, getting and freeing locks and similar overhead. Erlang by its nature, avoids this. Erlang has a "let it crash" approach. You code the "happy path" and get restarted after error conditions. This means that complicated error conditions do not need to be understood (= less development), detected (less code) or recovered from (much less code). Multi-threaded processes use operating system threads, which have very very heavy creation and clean up costs, and heavy scheduling costs. Erlang, is between 100 and 10000 times faster at this. While both traditional and Erlang sytems will wait for I/O and networking, traditional systems under load will wait for worker threads to be free or created. Erlang can proceed directly. Traditional systems tend to crash under heavy load, while Erlang slows down, and recovers when load eases. Erlang's garbage collection is superbly designed for soft real-time processing, while most multi-threaded systems either suffer from periodic pauses, or they have considerable code to test and check everything is deallocated when it should be (and not before). Erlang automatic and ridiculously easy to build by comparison. So, Erlang has so much less overhead, and so much better threading, no locks to contend with (other than the internal ones) and a much lighter scheduling algorithm, and it has less to do. If you use it for number crunching, it will be slow. For more typical applications Erlang will be built faster, be more reliable, and be smaller and easier to modify, but it might not be quite as fast. For complicated event-driven and soft-real time processing, Erlang will win on all measures. So fake up some meaningful test of your proposed load, before making a decision. Regards Ian > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Fri Nov 9 16:04:39 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 9 Nov 2012 16:04:39 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: On Nov 9, 2012, at 9:42 AM, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, I found that erlang compiler is not so good at speed? the benchmark shows that erlang Hipe is 13x slowdown compared to C++, as compared to Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 is about 1x faster than erlang, I investigated the erLLVM project which reported similar results to Hipe, you know performance is so important nowadays, what caused the hard to improve performace of erlang or just there are not people working on it? Erlang is attractive to me after several days studying, but with great performance will be more attractive and competitive to some languages such as go etc. In addition to other excellent responses, I would like to add the concept of latency on top. Most of the languages you compare to are focused more on throughput than on latency in the sense of concurrency and handling of concurrency. For certain problems, like heavy number crunching, this is *exactly* what you want. On the other hand, if you are worried how quickly you respond back, then you are probably more served by picking Erlang as a tool. One could say that Erlang is not really optimized for the Shootout benchmarks as much as for other kinds of problems. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From bengt.kleberg@REDACTED Fri Nov 9 16:13:59 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 9 Nov 2012 16:13:59 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <1352474039.4875.31.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, It was(*) also true that the Shootout test where optimized to not suite Erlang. bengt (*) 2005, things may have changed. On Fri, 2012-11-09 at 16:04 +0100, Jesper Louis Andersen wrote: > On Nov 9, 2012, at 9:42 AM, hume npx wrote: > > > Hi, all: > > I'am new to erlang, after investigate some benchmark such as at http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, I found that erlang compiler is not so good at speed? the benchmark shows that erlang Hipe is 13x slowdown compared to C++, as compared to Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 is about 1x faster than erlang, I investigated the erLLVM project which reported similar results to Hipe, you know performance is so important nowadays, what caused the hard to improve performace of erlang or just there are not people working on it? Erlang is attractive to me after several days studying, but with great performance will be more attractive and competitive to some languages such as go etc. > > In addition to other excellent responses, I would like to add the concept of latency on top. Most of the languages you compare to are focused more on throughput than on latency in the sense of concurrency and handling of concurrency. For certain problems, like heavy number crunching, this is *exactly* what you want. > > On the other hand, if you are worried how quickly you respond back, then you are probably more served by picking Erlang as a tool. > > One could say that Erlang is not really optimized for the Shootout benchmarks as much as for other kinds of problems. > > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From humeafo@REDACTED Fri Nov 9 17:10:01 2012 From: humeafo@REDACTED (krad) Date: Fri, 9 Nov 2012 08:10:01 -0800 (PST) Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <1e35a34a-0572-499f-8c0b-c6a943d7de75@googlegroups.com> > Thanks for all of your patient explainations, I understand the main > points, erlang is just what I want for my system's requests processing, > while there are some other cpu-intensive jobs to run background, it seems > that this would be the job of C++ and things can be integrated with nif or > node or port interface. -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Nov 9 18:19:35 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 9 Nov 2012 10:19:35 -0700 Subject: [erlang-questions] -detached works until I exit shell In-Reply-To: References: Message-ID: I toyed with the yaws startup script and now it works to start my app. The key might be using the run_erl instead of using detached. wes On Wed, Oct 31, 2012 at 10:31 AM, Wes James wrote: > I have an erlang app I run with -detached and it works fine until I exit > the shell I ran it from. > > I'm on xubuntu, and run > > erl -name node@REDACTED -pa /my/ebin -s module -setcookie somecookie -detached > > I first used startup scripts in xubuntu but I couldn't get to the node. > > I then tried running emacs in daemon mode, run the app and then > ctrl-x,ctrl-c to get out of emacs, but leave it running, but when I do that > the app stops responding. > > Anyone know why? > > Thanks, > > Wes > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Fri Nov 9 20:06:28 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 09 Nov 2012 14:06:28 -0500 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> Message-ID: <509D5434.2090703@ferd.ca> We've used HiPE in parts of our system that required tight fast loops. Whenever we need something to go fast due to some algorithmic complexity, /and/ that we can manage to isolate it as a single unit that doesn't need to call to non-HiPE code, we will try to convert it. Basically, I've been told that HiPE and Beam have some overhead when it comes to switching from one to the other. When we have a bit of code that is a hotspot, I'll try to inline whatever calls are made to other modules (mostly lists), compile only that module with HiPE, and let it do its thing. Sometimes benchmarks go in HiPE's favour, sometimes not. In a particular instance of our stack, it gave us nearly 2x speedup on loop & search operations that frequently happen more than 50,000 times per second. Definitely worth it, and it's been running in production for months, just for that single module. On 12-11-09 8:45 AM, Valentin Micic wrote: > Interestingly enough, this was a kind of conclusion we've arrived at > as well -- the good performance of Beam, combined with "perceived > instability", acted as a serious deterrent for me. > But Max, wouldn't you like to know if there are any brave souls out > there that were prepared to go beyond perceptions and successfully > tried it in "real-life" situation? > > V/ > > > On 09 Nov 2012, at 3:34 PM, Max Bourinov wrote: > >> Unrelated, but: we were considering to give a try to HiPE but so far >> there is no need to do it for us because Beam outperforms everything >> else in our problem domain. >> >> >> Best regards, >> Max >> >> >> >> >> On Fri, Nov 9, 2012 at 5:16 PM, Valentin Micic > > wrote: >> >> Unrelated, but would be interesting to find out -- are there any >> commercial-grade (let alone carrier-grade) systems that take >> advantage of HiPE? >> >> >> V/ >> >> On 09 Nov 2012, at 2:11 PM, Schneider wrote: >> >> > you're right. HIPE generates compiled code. >> > my mistake. >> > take a look here for more info's about HIPE: >> > http://user.it.uu.se/~kostis/Papers/erlang03.pdf >> >> > >> > greatz Johannes >> > >> > >> > On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >> >> Correct me if I'm wrong but doesn't HIPE compile to native code? >> >> >> >> -- >> >> Matti >> >> >> >> On Fri, Nov 9, 2012 at 1:57 PM, Schneider > > wrote: >> >>> Erlang is a language, which produced byte-code which get' >> interpreted by the >> >>> Erlang engine. C++ instead generates mashing-code which has >> on the one hand >> >>> a much better performance, on the other hand, >> >>> some disadvantages like incompatibility between different OSs. >> >>> >> >>> greatz Johannes >> >>> >> >>> >> >>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >> >>>> >> >>>> Hi, all: >> >>>> I'am new to erlang, after investigate some benchmark such >> as at >> >>>> >> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >> >>>> I found that erlang compiler is not so good at speed? the >> benchmark >> >>>> shows that erlang Hipe is 13x slowdown compared to C++, as >> compared to >> >>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even >> javascript v8 >> >>>> is about 1x faster than erlang, I investigated the erLLVM >> project >> >>>> which reported similar results to Hipe, you know performance >> is so >> >>>> important nowadays, what caused the hard to improve >> performace of >> >>>> erlang or just there are not people working on it? Erlang is >> >>>> attractive to me after several days studying, but with great >> >>>> performance will be more attractive and competitive to some >> languages >> >>>> such as go etc. >> >>>> >> >>>> >> >>>> _______________________________________________ >> >>>> erlang-questions mailing list >> >>>> erlang-questions@REDACTED >> >>>> http://erlang.org/mailman/listinfo/erlang-questions >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> erlang-questions mailing list >> >>> erlang-questions@REDACTED >> >>> http://erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From straightflush@REDACTED Fri Nov 9 20:08:25 2012 From: straightflush@REDACTED (AD) Date: Fri, 9 Nov 2012 14:08:25 -0500 Subject: [erlang-questions] custom release directory name Message-ID: if i have an erlang app that i am building a release for, if the parent directory name does not equal the application name i get an error. is there a way to have a directory structure like parent/directory/src parent/directory/ebin parent/directory/rel/myapp where directory != myapp when generating a release ? Thanks -AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Nov 9 20:36:20 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 9 Nov 2012 22:36:20 +0300 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509D5434.2090703@ferd.ca> References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> <509D5434.2090703@ferd.ca> Message-ID: What exactly gives performance problems, when calling from HiPE to beam and back? Marshalling arguments? But NIF doesn't require marshalling data. Maybe it is possible to achieve something like in LLVM, when function is transparently compiled from bytecode to some native. Maybe there were some discussions on this mailing list about it? On Fri, Nov 9, 2012 at 11:06 PM, Fred Hebert wrote: > We've used HiPE in parts of our system that required tight fast loops. > Whenever we need something to go fast due to some algorithmic complexity, > *and* that we can manage to isolate it as a single unit that doesn't need > to call to non-HiPE code, we will try to convert it. > > Basically, I've been told that HiPE and Beam have some overhead when it > comes to switching from one to the other. When we have a bit of code that > is a hotspot, I'll try to inline whatever calls are made to other modules > (mostly lists), compile only that module with HiPE, and let it do its > thing. Sometimes benchmarks go in HiPE's favour, sometimes not. > > In a particular instance of our stack, it gave us nearly 2x speedup on > loop & search operations that frequently happen more than 50,000 times per > second. Definitely worth it, and it's been running in production for > months, just for that single module. > > > On 12-11-09 8:45 AM, Valentin Micic wrote: > > Interestingly enough, this was a kind of conclusion we've arrived at as > well -- the good performance of Beam, combined with "perceived > instability", acted as a serious deterrent for me. > But Max, wouldn't you like to know if there are any brave souls out there > that were prepared to go beyond perceptions and successfully tried it in > "real-life" situation? > > V/ > > > On 09 Nov 2012, at 3:34 PM, Max Bourinov wrote: > > Unrelated, but: we were considering to give a try to HiPE but so far there > is no need to do it for us because Beam outperforms everything else in our > problem domain. > > > Best regards, > Max > > > > > On Fri, Nov 9, 2012 at 5:16 PM, Valentin Micic wrote: > >> Unrelated, but would be interesting to find out -- are there any >> commercial-grade (let alone carrier-grade) systems that take advantage of >> HiPE? >> >> >> V/ >> >> On 09 Nov 2012, at 2:11 PM, Schneider wrote: >> >> > you're right. HIPE generates compiled code. >> > my mistake. >> > take a look here for more info's about HIPE: >> > http://user.it.uu.se/~kostis/Papers/erlang03.pdf >> > >> > greatz Johannes >> > >> > >> > On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >> >> Correct me if I'm wrong but doesn't HIPE compile to native code? >> >> >> >> -- >> >> Matti >> >> >> >> On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: >> >>> Erlang is a language, which produced byte-code which get' interpreted >> by the >> >>> Erlang engine. C++ instead generates mashing-code which has on the >> one hand >> >>> a much better performance, on the other hand, >> >>> some disadvantages like incompatibility between different OSs. >> >>> >> >>> greatz Johannes >> >>> >> >>> >> >>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >> >>>> >> >>>> Hi, all: >> >>>> I'am new to erlang, after investigate some benchmark such as at >> >>>> >> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >> >>>> I found that erlang compiler is not so good at speed? the benchmark >> >>>> shows that erlang Hipe is 13x slowdown compared to C++, as compared >> to >> >>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >> >>>> is about 1x faster than erlang, I investigated the erLLVM project >> >>>> which reported similar results to Hipe, you know performance is so >> >>>> important nowadays, what caused the hard to improve performace of >> >>>> erlang or just there are not people working on it? Erlang is >> >>>> attractive to me after several days studying, but with great >> >>>> performance will be more attractive and competitive to some languages >> >>>> such as go etc. >> >>>> >> >>>> >> >>>> _______________________________________________ >> >>>> erlang-questions mailing list >> >>>> erlang-questions@REDACTED >> >>>> http://erlang.org/mailman/listinfo/erlang-questions >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> erlang-questions mailing list >> >>> erlang-questions@REDACTED >> >>> http://erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Fri Nov 9 21:12:25 2012 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 09 Nov 2012 12:12:25 -0800 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> Message-ID: <509D63A9.3000001@gmail.com> I think the accepted answer is that if HiPE was normally used in production, it would be the default compilation mode for the Erlang VM (and OTP). Since HiPE is not the default, and its internals are not documented, perhaps it is just to be regarded as an experimental feature that may change in the future. On 11/09/2012 05:16 AM, Valentin Micic wrote: > Unrelated, but would be interesting to find out -- are there any commercial-grade (let alone carrier-grade) systems that take advantage of HiPE? > > > V/ > > On 09 Nov 2012, at 2:11 PM, Schneider wrote: > >> you're right. HIPE generates compiled code. >> my mistake. >> take a look here for more info's about HIPE: >> http://user.it.uu.se/~kostis/Papers/erlang03.pdf >> >> greatz Johannes >> >> >> On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >>> Correct me if I'm wrong but doesn't HIPE compile to native code? >>> >>> -- >>> Matti >>> >>> On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: >>>> Erlang is a language, which produced byte-code which get' interpreted by the >>>> Erlang engine. C++ instead generates mashing-code which has on the one hand >>>> a much better performance, on the other hand, >>>> some disadvantages like incompatibility between different OSs. >>>> >>>> greatz Johannes >>>> >>>> >>>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >>>>> Hi, all: >>>>> I'am new to erlang, after investigate some benchmark such as at >>>>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >>>>> I found that erlang compiler is not so good at speed? the benchmark >>>>> shows that erlang Hipe is 13x slowdown compared to C++, as compared to >>>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >>>>> is about 1x faster than erlang, I investigated the erLLVM project >>>>> which reported similar results to Hipe, you know performance is so >>>>> important nowadays, what caused the hard to improve performace of >>>>> erlang or just there are not people working on it? Erlang is >>>>> attractive to me after several days studying, but with great >>>>> performance will be more attractive and competitive to some languages >>>>> such as go etc. >>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From carlsson.richard@REDACTED Fri Nov 9 21:12:30 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 09 Nov 2012 21:12:30 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: <509D63AE.70708@gmail.com> On 2012-11-09 09:42, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at > http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, I > found that erlang compiler is not so good at speed? the benchmark shows > that erlang Hipe is 13x slowdown compared to C++, as compared to Haskell > GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 is about 1x > faster than erlang, I investigated the erLLVM project which reported > similar results to Hipe, you know performance is so important nowadays, > what caused the hard to improve performace of erlang or just there are > not people working on it? Erlang is attractive to me after several days > studying, but with great performance will be more attractive and > competitive to some languages such as go etc. For the sort of computationally heavy code that you'll find in the shootout benchmarks, you should be comparing Erlang to other dynamically typed languages like Python and Ruby. One of the main reasons that Haskell, C++, and the other statically typed languages in the list are so much faster at this kind of code is that they don't have any (or at least very little) run-time overhead for checking what type of value is stored in a variable. Erlang is not aimed at crunching numbers, but it does a pretty good job of it compared to other dynamically typed languages - even without HiPE. /Richard From raould@REDACTED Fri Nov 9 21:18:03 2012 From: raould@REDACTED (Raoul Duke) Date: Fri, 9 Nov 2012 12:18:03 -0800 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509D63AE.70708@gmail.com> References: <509D63AE.70708@gmail.com> Message-ID: >> not people working on it? Erlang is attractive to me after several days >> studying, but with great performance will be more attractive and >> competitive to some languages such as go etc. also -- i'd like to point out that: * Haskell even comes with channels out of the box which can be used to get Erlangish (i do stress the "ish" part :-) systems * Jvm languages can use Akka, or JActor, or Groovy Actors (which also have dataflow, which is potentially even better than actors). * Clojure has agents, if you don't need to worry about turning it into a distributed system. etc. there are lots of options these days. (which is both a good and a bad thing. remember how many miles on the tires erlang has, that's a good thing.) From mononcqc@REDACTED Fri Nov 9 22:13:42 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 09 Nov 2012 16:13:42 -0500 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> <509D5434.2090703@ferd.ca> Message-ID: <509D7206.1030801@ferd.ca> From "The HiPE/x86 Erlang Compiler: System Description and Performance Evaluation" (page 4): HiPE extends the standard Erlang/OTP runtime system to permit Erlang processes to execute both interpreted code and native machine code.3 Each process has two stacks, one for interpreted code and one for native code. This simplifies garbage collection and exception handling, since each stack contains only frames of a single type. paper.dvi Control flow between interpreted and native code, e.g. at function calls and returns, is handled by a mode-switch interface. The implementation uses linker-generated proxy code stubs and software trap return addresses to trigger the appropriate mode-switches when invoked. Two important properties of the mode-switch interface are that it preserves tail-recursion (i.e., no sequence of consecutive mode-switching tailcalls grows either stack by more than a constant), and that it imposes no runtime overhead on same-mode calls and returns (i.e., from native to native or from BEAM to BEAM). To me this is an indication of a cost happening when switching modes (otherwise why specify there is no overhead on same-mode calls and returns), and if I recall correctly both Kostis Sagonas and Jesper Louis Andersen mentioned the same behavior to me at conferences. So the problem is that if I'm stuck in a tight loop and constantly calling non-HiPE functions and then returning to HiPE, the cost of switching could dwarf HiPE improvements within that loop. Sticking to HiPE only for that part of the code would help me benefit more from the native code. I couldn't go in deeper detail than this, because I'm not knowledgeable enough to go dive into it and figure things out, though. If more details are needed, either Kostis or Jesper (or anyone else who knows) could add to the conversation, if they have the time for it, that is. On 12-11-09 2:36 PM, Max Lapshin wrote: > What exactly gives performance problems, when calling from HiPE to > beam and back? > Marshalling arguments? > > But NIF doesn't require marshalling data. Maybe it is possible to > achieve something like in LLVM, when function is transparently > compiled from bytecode to some native. > > Maybe there were some discussions on this mailing list about it? > > > On Fri, Nov 9, 2012 at 11:06 PM, Fred Hebert > wrote: > > We've used HiPE in parts of our system that required tight fast > loops. Whenever we need something to go fast due to some > algorithmic complexity, /and/ that we can manage to isolate it as > a single unit that doesn't need to call to non-HiPE code, we will > try to convert it. > > Basically, I've been told that HiPE and Beam have some overhead > when it comes to switching from one to the other. When we have a > bit of code that is a hotspot, I'll try to inline whatever calls > are made to other modules (mostly lists), compile only that module > with HiPE, and let it do its thing. Sometimes benchmarks go in > HiPE's favour, sometimes not. > > In a particular instance of our stack, it gave us nearly 2x > speedup on loop & search operations that frequently happen more > than 50,000 times per second. Definitely worth it, and it's been > running in production for months, just for that single module. > > > On 12-11-09 8:45 AM, Valentin Micic wrote: >> Interestingly enough, this was a kind of conclusion we've arrived >> at as well -- the good performance of Beam, combined with >> "perceived instability", acted as a serious deterrent for me. >> But Max, wouldn't you like to know if there are any brave souls >> out there that were prepared to go beyond perceptions and >> successfully tried it in "real-life" situation? >> >> V/ >> >> >> On 09 Nov 2012, at 3:34 PM, Max Bourinov wrote: >> >>> Unrelated, but: we were considering to give a try to HiPE but so >>> far there is no need to do it for us because Beam outperforms >>> everything else in our problem domain. >>> >>> >>> Best regards, >>> Max >>> >>> >>> >>> >>> On Fri, Nov 9, 2012 at 5:16 PM, Valentin Micic >>> > wrote: >>> >>> Unrelated, but would be interesting to find out -- are there >>> any commercial-grade (let alone carrier-grade) systems that >>> take advantage of HiPE? >>> >>> >>> V/ >>> >>> On 09 Nov 2012, at 2:11 PM, Schneider wrote: >>> >>> > you're right. HIPE generates compiled code. >>> > my mistake. >>> > take a look here for more info's about HIPE: >>> > http://user.it.uu.se/~kostis/Papers/erlang03.pdf >>> >>> > >>> > greatz Johannes >>> > >>> > >>> > On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >>> >> Correct me if I'm wrong but doesn't HIPE compile to >>> native code? >>> >> >>> >> -- >>> >> Matti >>> >> >>> >> On Fri, Nov 9, 2012 at 1:57 PM, Schneider >> > wrote: >>> >>> Erlang is a language, which produced byte-code which >>> get' interpreted by the >>> >>> Erlang engine. C++ instead generates mashing-code which >>> has on the one hand >>> >>> a much better performance, on the other hand, >>> >>> some disadvantages like incompatibility between >>> different OSs. >>> >>> >>> >>> greatz Johannes >>> >>> >>> >>> >>> >>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >>> >>>> >>> >>>> Hi, all: >>> >>>> I'am new to erlang, after investigate some benchmark >>> such as at >>> >>>> >>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >>> >>>> I found that erlang compiler is not so good at speed? >>> the benchmark >>> >>>> shows that erlang Hipe is 13x slowdown compared to C++, >>> as compared to >>> >>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even >>> javascript v8 >>> >>>> is about 1x faster than erlang, I investigated the >>> erLLVM project >>> >>>> which reported similar results to Hipe, you know >>> performance is so >>> >>>> important nowadays, what caused the hard to improve >>> performace of >>> >>>> erlang or just there are not people working on it? >>> Erlang is >>> >>>> attractive to me after several days studying, but with >>> great >>> >>>> performance will be more attractive and competitive to >>> some languages >>> >>>> such as go etc. >>> >>>> >>> >>>> >>> >>>> _______________________________________________ >>> >>>> erlang-questions mailing list >>> >>>> erlang-questions@REDACTED >>> >>> >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> >>> erlang-questions mailing list >>> >>> erlang-questions@REDACTED >>> >>> >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvm_8@REDACTED Fri Nov 9 22:50:25 2012 From: mvm_8@REDACTED (Venu Middela) Date: Fri, 9 Nov 2012 15:50:25 -0600 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: <509CCC1F.1070401@erix.ericsson.se> References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>, <509BBA7B.2030406@erix.ericsson.se>, , , <509CCC1F.1070401@erix.ericsson.se> Message-ID: Sverker, Thanks for the quick suggestion.. I was able to compile and build 64-bit openssl along with building shared objects. Now, when i try to compile erlang 15B01, running into a new compilation error.. Here's my configure parameters before running gmake.. #./configure --enable-m64-build --prefix=/export/home/vmi/ERL --enable-threads --enable-smp-support --with-ssl=/usr/local/ssl --with-ssl-lib=/usr/local/ssl/lib Heres' the compilation error: gcc -m64 -m64 -fPIC -I/export/home/vmi/otp/otp_src_R15B01/erts/i386-pc-so laris2.10 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_ H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement - DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANT ICS -Ii386-pc-solaris2.10/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-sola ris2.10 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.10 -I.. /include/internal -I../include/internal/i386-pc-solaris2.10 -c i386-pc-solaris2. 10/opt/smp/hipe_amd64_bifs.S -o obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs. o i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.S:2005:2: #endif without #if gmake[3]: *** [obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.o] Error 1 gmake[3]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula tor' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula tor' gmake[1]: *** [smp] Error 2 gmake[1]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts' gmake: *** [emulator] Error 2 ddela/otp/otp_src_R15B01root@REDACTED:/export/home/vmi/otp/otp_src_R15BThanks, Venu > Date: Fri, 9 Nov 2012 10:25:51 +0100 > From: sverker.eriksson@REDACTED > To: mvm_8@REDACTED > CC: attila.r.nohl@REDACTED; erlang-questions@REDACTED > Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 > > You have to configure openssl source tree with option 'shared' to get > dynamic libraries. > Option 'no-asm' might also help if you get compile problems. Read INSTALL. > > /Sverker > > Venu Middela wrote: > > Attila, > > I did try installing the package openssl0.9.8, but the binaries from this package are 32 bit. > > also, when i tried to compile from the sourcecode , strangely, the compile/make is not building the 64-bit binaries for libcrypto and libssl.. > > here's the contents of compiled /usr/local/ssl/lib > > bash-3.2$ pwd > > /usr/local/ssl/lib > > > > -bash-3.2$ ls > > engines libcrypto.a libssl.a pkgconfig > > > > > > Thanks, > > Venu > > > > > >> Date: Thu, 8 Nov 2012 21:50:21 +0100 > >> From: attila.r.nohl@REDACTED > >> To: erlang-questions@REDACTED > >> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 > >> > >> 2012/11/8 Venu Middela : > >> > >>> Steve, > >>> Thanks for pointing out the correct version of crypto. > >>> Could you please point to instructions on how to patch crypto to remove the > >>> NIF des_ede3_cfb_crypt. > >>> I couldnt find a solaris package version 0.9.8. Looked through oracle sites > >>> for updated package and/or any patch that would > >>> upgrade openssl to 0.9.8, but no luck. > >>> > >> Check sunfreeware.com (or one of its mirrors). For example this is a > >> 0.9.8 package for Solaris 10 on x86: > >> http://sunfreeware.saix.net/programlistintel10.html#openssl098p It > >> seems that now the main site requires registration :-( > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sat Nov 10 05:08:38 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 10 Nov 2012 04:08:38 +0000 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509D63A9.3000001@gmail.com> References: <509CEFB6.3060609@globe.de> <509CF2DF.4030405@globe.de> <509D63A9.3000001@gmail.com> Message-ID: RabbitMQ compiles a subset of modules using HiPE, where this is deemed appropriate, and has a pretty huge commercial user base. For details of what gets hipe compiled see: - https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit.erl#L190 - https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit.erl#L255 And an extract from the bug report referenced in the first link states "according to the hipe docs, performance suffers when the hipe-ed code does little besides 'receive', or makes calls to non-hipe code"... But for some code it makes a big positive difference. Cheers, Tim On 9 November 2012 20:12, Michael Truog wrote: > I think the accepted answer is that if HiPE was normally used in production, it would be the default compilation mode for the Erlang VM (and OTP). Since HiPE is not the default, and its internals are not documented, perhaps it is just to be regarded as an experimental feature that may change in the future. > > On 11/09/2012 05:16 AM, Valentin Micic wrote: >> Unrelated, but would be interesting to find out -- are there any commercial-grade (let alone carrier-grade) systems that take advantage of HiPE? >> >> >> V/ >> >> On 09 Nov 2012, at 2:11 PM, Schneider wrote: >> >>> you're right. HIPE generates compiled code. >>> my mistake. >>> take a look here for more info's about HIPE: >>> http://user.it.uu.se/~kostis/Papers/erlang03.pdf >>> >>> greatz Johannes >>> >>> >>> On Fr 09 Nov 2012 13:07:49 CET, Matti Oinas wrote: >>>> Correct me if I'm wrong but doesn't HIPE compile to native code? >>>> >>>> -- >>>> Matti >>>> >>>> On Fri, Nov 9, 2012 at 1:57 PM, Schneider wrote: >>>>> Erlang is a language, which produced byte-code which get' interpreted by the >>>>> Erlang engine. C++ instead generates mashing-code which has on the one hand >>>>> a much better performance, on the other hand, >>>>> some disadvantages like incompatibility between different OSs. >>>>> >>>>> greatz Johannes >>>>> >>>>> >>>>> On Fr 09 Nov 2012 09:42:21 CET, hume npx wrote: >>>>>> Hi, all: >>>>>> I'am new to erlang, after investigate some benchmark such as at >>>>>> http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, >>>>>> I found that erlang compiler is not so good at speed? the benchmark >>>>>> shows that erlang Hipe is 13x slowdown compared to C++, as compared to >>>>>> Haskell GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 >>>>>> is about 1x faster than erlang, I investigated the erLLVM project >>>>>> which reported similar results to Hipe, you know performance is so >>>>>> important nowadays, what caused the hard to improve performace of >>>>>> erlang or just there are not people working on it? Erlang is >>>>>> attractive to me after several days studying, but with great >>>>>> performance will be more attractive and competitive to some languages >>>>>> such as go etc. >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From k.petrauskas@REDACTED Sat Nov 10 08:11:05 2012 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Sat, 10 Nov 2012 09:11:05 +0200 Subject: [erlang-questions] Multiple applications Message-ID: Hello, I am building an Erlang based system that is composed of several applications. In principle, the system consists of a main application and a number of "plug in applications". The latter have modules implementing behaviours defined by the main application. In this particular case, should I have all the "plug in applications" as library applications, and access them from the main application based on some explicit configuration? Or should all the applications have its own application modules starting own supervisors and then registering self to the main application? The main thing confusing me is the recommendation to have single supervision tree for the entire system. Best regards, Karolis From cloudzen@REDACTED Sat Nov 10 10:53:31 2012 From: cloudzen@REDACTED (skyman) Date: Sat, 10 Nov 2012 17:53:31 +0800 (CST) Subject: [erlang-questions] How to read process's backtrace data? Message-ID: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> Hi everyone, erlang:process_display(Pid,backtrace) can display process's backtrace data. For example: (foo@REDACTED)6> erlang:process_display(self(),backtrace). Program counter: 0x00cf1498 (unknown function) CP: 0x0245e8f8 (erl_eval:do_apply/6 + 208) 0x03b1fb34 Return addr 0x01b7f060 (shell:exprs/7 + 368) y(0) [] y(1) none 0x03b1fb40 Return addr 0x01b7eb94 (shell:eval_exprs/7 + 80) y(0) [] y(1) [] y(2) cmd y(3) [] y(4) {value,#Fun} y(5) {eval,#Fun} y(6) 12305 y(7) [] y(8) [] y(9) [] 0x03b1fb6c Return addr 0x01b7e968 (shell:eval_loop/3 + 308) y(0) [] y(1) [] y(2) [] y(3) [] y(4) <0.30.0> y(5) Catch 0x01b7ec08 (shell:eval_exprs/7 + 196) 0x03b1fb88 Return addr 0x00a88f6c () y(0) 12305 y(1) <0.30.0> true However, I don't know how to read the information above, such as what do "Program counter", Return addr", "+ 368" and "y(0) y(1) ..." mean? Can anyone teach me? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Nov 10 14:27:08 2012 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 10 Nov 2012 14:27:08 +0100 Subject: [erlang-questions] About Erlang system performance In-Reply-To: References: Message-ID: Performance depends upon the problem you want to solve. If X is N times faster than Y for solving problem P it does not mean that X is N times faster than Y for solving any other problem than P. If P involves non-stop operation, code change on the fly, massive parallelism, massive concurrency, good overload protection, soft real-time garbage collection, ability to scale, faut-tolerance then Erlang is suitable. Micro-benchmarks don't measure this kind of stuff. Nobody implements, for example, the entire 3GPP standard for fun in languages X and Y and compares the results - this would take thousands of man years. The only place where comparative benchmarking is done is where the benchmarks are small and easy to write. It's rather like chemistry, there is a reason why chemical plants don't have 200 ft high test tubes - lab experiments (done with test tubes) don't scale. This is like software - micro benchmarks tell you little about macro behavior. If a web server behaves well for 1 user it does not mean it will behave well for 100M users, unfortunately you can't easily do the experiment for 100M users. Now there are good reasons for using Erlang and there are good reasons for not using Erlang - it would do people a dis-service to suggest that Erlang is good for everything - which it is not. Erlang was designed to be good at fault-tolerance, scalability, code-change on-the fly (these kind of things) - but there are no benchmarks that measure this. How do you measure fault-tolerance? Write the system in 10 different languages and run for five years and tell me the results - it's not going to happen. Rule of thumb: Type A - small memory intensive computations - local memory - "maths" - use C. Type B - Fault-tolerance, code change on the fly, scalable, non-stop operation, massive concurrency, distribution, soft-real time response, networking .. ues Erlang Don't apply type A benchmarks to type B problems. In type B there are no benchmarks - here the problem is usually getting the stuff to work at-all - this is why benchmarks are skewed towards type A problems. Beging good at type A problems does not mean you will be good at type B systems. (The there is the hybrid approach - use Erlang to co-ordinate and distribute type A tasks) Cheers /Joe On Fri, Nov 9, 2012 at 9:42 AM, hume npx wrote: > Hi, all: > I'am new to erlang, after investigate some benchmark such as at > http://shootout.alioth.debian.org/u64q/which-programs-are-fastest.php, I > found that erlang compiler is not so good at speed? the benchmark shows > that erlang Hipe is 13x slowdown compared to C++, as compared to Haskell > GHC (3.3x slowdown), go 2.98x slowdown or even javascript v8 is about 1x > faster than erlang, I investigated the erLLVM project which reported > similar results to Hipe, you know performance is so important nowadays, > what caused the hard to improve performace of erlang or just there are not > people working on it? Erlang is attractive to me after several days > studying, but with great performance will be more attractive and > competitive to some languages such as go etc. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Nov 10 14:45:23 2012 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 10 Nov 2012 14:45:23 +0100 Subject: [erlang-questions] Sending a large block of binary data from c to erlang In-Reply-To: References: Message-ID: The only answer is "try it and see" - it all depends. The computer I'm typing this mail on has 4GB or RAM - compared to that 1M is "nothing". Are you running on a 24GB monster or 5MB embedded system? Do you have one parallel process, sending one 1 MB message, or a thousand? Do you send your 1 MB messages once every millisecond - or once a year. Just knowing that your message is 1MB tells me nothing about the other parts of your system - when GB memories came I stopped calling MBytes "large" and TB disks means that GB files are not really "large" - these are relative terms. Today Peta bytes is "large" - but we get a 1000x scale change every ten years There no intrinsic reason why it should not work - Just make sure the packet length will fit into 4 bytes and use {packet,4}. I have a file replication system in Erlang - I send all small files in single messages (I think the cut-off is 10 MB) and larger files in chunks (mainly so I can restart them if things go wrong) Oh and a port-driver should be fine for this. Cheers [aside] performance always surprises me - I think reading a few hundred small files will take a long time - but it takes a blink of a second - I guess this is because it would take me a heck of a long time to do this - GHz clock speeds are so fast that just about everything I think would take a long time doesn't. /Joe On Fri, Nov 9, 2012 at 3:31 PM, Richard Evans < richardprideauxevans@REDACTED> wrote: > I am using a port to communicate between c and erlang, as described in Joe > Armstrong's excellent book, and in this tutorial: > http://www.erlang.org/doc/tutorial/c_port.html#id63121 > > So far, the traffic between the two has been pretty small: typically a > hundred bytes or so at a time. > > But now I need to (occasionally) send a large block of binary data from c > to erlang: up to 1 meg. > > How should I handle such large blocks of binary data? Is there anything > wrong with increasing the size of the buffer (called buf in the tutorial > mentioned above) to 1 meg? > > Is there a better way of doing this? (NB I am using a port, rather than a > port-driver (in which the c-code is linked directly to the erlang code)). > > thanks, > Richard Evans > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gustav.simonsson@REDACTED Sat Nov 10 16:56:52 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Sat, 10 Nov 2012 16:56:52 +0100 Subject: [erlang-questions] getting error in erlang In-Reply-To: <8C29E01908962B4095A9044AE0F89A40434A2A56@HJ-MBX2.persistent.co.in> References: <8C29E01908962B4095A9044AE0F89A40434A2A56@HJ-MBX2.persistent.co.in> Message-ID: What version of GCC are you using? Also, can you include the output from running ./configure ? Cheers, Gustav Simonsson On Fri, Nov 9, 2012 at 11:17 AM, Shankar Patil < shankar_patil@REDACTED> wrote: > Hello All,**** > > ** ** > > I am compiling erlang otp_src_R15B on aix 6.1 machine. Getting below > errors.**** > > ** ** > > ** ** > > ../include/internal/ethread.h: In function 'ethr_spin_lock__':**** > > ../include/internal/ethread.h:555: error: 'lock' undeclared (first use in > this function)**** > > common/ethr_aux.c: At top level:**** > > common/ethr_aux.c:344: error: parse error before 'ts_ev_alloc_lock'**** > > common/ethr_aux.c:344: warning: type defaults to 'int' in declaration of > 'ts_ev_alloc_lock'**** > > common/ethr_aux.c:344: warning: data definition has no type or storage > class**** > > common/ethr_aux.c:529: error: parse error before '*' token**** > > common/ethr_aux.c:530: warning: function declaration isn't a prototype**** > > common/ethr_aux.c: In function 'ethr_spinlock_init':**** > > common/ethr_aux.c:537: error: 'lock' undeclared (first use in this > function)**** > > common/ethr_aux.c: At top level:**** > > common/ethr_aux.c:541: error: parse error before '*' token**** > > common/ethr_aux.c:542: warning: function declaration isn't a prototype**** > > common/ethr_aux.c: In function 'ethr_spinlock_destroy':**** > > common/ethr_aux.c:553: error: 'lock' undeclared (first use in this > function)**** > > common/ethr_aux.c: At top level:**** > > common/ethr_aux.c:557: error: parse error before '*' token**** > > common/ethr_aux.c:558: warning: function declaration isn't a prototype**** > > common/ethr_aux.c: In function 'ethr_spin_unlock':**** > > common/ethr_aux.c:561: error: 'lock' undeclared (first use in this > function)**** > > common/ethr_aux.c: At top level:**** > > common/ethr_aux.c:565: error: parse error before '*' token**** > > common/ethr_aux.c:566: warning: function declaration isn't a prototype**** > > common/ethr_aux.c: In function 'ethr_spin_lock':**** > > common/ethr_aux.c:569: error: 'lock' undeclared (first use in this > function)**** > > gmake[5]: *** [obj/rs6000-ibm-aix/opt/r/ethr_aux.o] Error 1**** > > gmake[5]: Leaving directory `/opt/otp_src_R15B/erts/lib_src'**** > > gmake[4]: *** [opt] Error 2**** > > gmake[4]: Leaving directory `/opt/otp_src_R15B/erts/lib_src'**** > > gmake[3]: *** [erts_lib] Error 2**** > > gmake[3]: Leaving directory `/opt/otp_src_R15B/erts/emulator'**** > > gmake[2]: *** [opt] Error 2**** > > gmake[2]: Leaving directory `/opt/otp_src_R15B/erts/emulator'**** > > gmake[1]: *** [smp] Error 2**** > > gmake[1]: Leaving directory `/opt/otp_src_R15B/erts'**** > > gmake: *** [emulator] Error 2**** > > ** ** > > can you please help out ?**** > > * * > > *Regards,* > > *Shankar Patil * > > ** ** > > ** ** > > DISCLAIMER ========== This e-mail may contain privileged and confidential > information which is the property of Persistent Systems Ltd. It is intended > only for the use of the individual or entity to which it is addressed. If > you are not the intended recipient, you are not authorized to read, retain, > copy, print, distribute or use this message. If you have received this > communication in error, please notify the sender and delete all copies of > this message. Persistent Systems Ltd. does not accept any liability for > virus infected mails. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Sat Nov 10 17:15:47 2012 From: g@REDACTED (Garrett Smith) Date: Sat, 10 Nov 2012 10:15:47 -0600 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas wrote: > Hello, > > I am building an Erlang based system that is composed of several > applications. In principle, the system consists of a main application > and a number of "plug in applications". The latter have modules > implementing behaviours defined by the main application. In this > particular case, should I have all the "plug in applications" as > library applications, and access them from the main application based > on some explicit configuration? Or should all the applications have > its own application modules starting own supervisors and then > registering self to the main application? The main thing confusing me > is the recommendation to have single supervision tree for the entire > system. There are good reasons for taking either approach, but if you're in doubt, I'd suggest the second option: each plugin is an "active" application (i.e. specifies a mod in the .app file) that registers itself as needed with the main application. The advantage to this approach is that you're further separating the components of your system: - The main application doesn't have to know about the plugins at startup, which simplifies its configuration and removes the "wiring" logic that it would otherwise need - Plugins can be added and removed by adding and removing OTP applications in the release (i.e. you use boot files to specify which plugins are run for a given Erlang process) The OTP application abstraction in Erlang is very powerful in this respect, as long as you design your applications to be as independent as possible from one another. You can add new functionality to a system by the simple act of starting a new application! Your only real design consideration then is how the plugin apps register with the main application. This is a good spot for a gen_event, or pub/sub broker model, where you use an intermediary process to broker messages/requests between the main application and the plugins. Garrett From k.petrauskas@REDACTED Sat Nov 10 23:02:33 2012 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Sun, 11 Nov 2012 00:02:33 +0200 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: Thank you for the comments. It sounds reasonable to go with active applications. One aspect I forgot to mention is that the main application should start its own processing only when all the required plugins are ready. The plugin applications act as backend processors. Maybe that could be solved in more abstract way: the main application could be configured with names of processes (or incoming messages) to wait for before processing is started. Although I am not sure if such an approach is "erlangish", I was deep in java for last ten years. Karolis On Sat, Nov 10, 2012 at 6:15 PM, Garrett Smith wrote: > On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas > wrote: >> Hello, >> >> I am building an Erlang based system that is composed of several >> applications. In principle, the system consists of a main application >> and a number of "plug in applications". The latter have modules >> implementing behaviours defined by the main application. In this >> particular case, should I have all the "plug in applications" as >> library applications, and access them from the main application based >> on some explicit configuration? Or should all the applications have >> its own application modules starting own supervisors and then >> registering self to the main application? The main thing confusing me >> is the recommendation to have single supervision tree for the entire >> system. > > There are good reasons for taking either approach, but if you're in > doubt, I'd suggest the second option: each plugin is an "active" > application (i.e. specifies a mod in the .app file) that registers > itself as needed with the main application. > > The advantage to this approach is that you're further separating the > components of your system: > > - The main application doesn't have to know about the plugins at > startup, which simplifies its configuration and removes the "wiring" > logic that it would otherwise need > > - Plugins can be added and removed by adding and removing OTP > applications in the release (i.e. you use boot files to specify which > plugins are run for a given Erlang process) > > The OTP application abstraction in Erlang is very powerful in this > respect, as long as you design your applications to be as independent > as possible from one another. You can add new functionality to a > system by the simple act of starting a new application! > > Your only real design consideration then is how the plugin apps > register with the main application. This is a good spot for a > gen_event, or pub/sub broker model, where you use an intermediary > process to broker messages/requests between the main application and > the plugins. > > Garrett From chancila@REDACTED Sun Nov 11 00:08:52 2012 From: chancila@REDACTED (Cristian Hancila) Date: Sat, 10 Nov 2012 18:08:52 -0500 Subject: [erlang-questions] Masterless application design Message-ID: Hello Erlangers, I'm fairly new to Erlang and I'm trying to brainstorm an architecture for an ideally masterless system, mainly how to achieve it on top of Erlang and OTP. The main components are 1..n nodes as public web based authentication services and 1..n nodes as the ultimate hosts of the client, over a long lived tcp connection. The web service nodes do registration and authentication, and decide which host the client will connect to. The authentication nodes need to be aware of all host nodes, and need to realize when new host nodes get added. The host nodes provide a notification mechanism for usage statistics, and each auth node registers for this notification in order to figure out some heuristics on deciding where to forward a client when they want to connect. My main issue is with figuring out if when a new node joins the cluster, does it/will it run the host_service application? If I can't make that guarantee then I would need to periodically scan all nodes an see if host_service is running on them. This seems like a bad design. Is there an OTP or standardized erlang pattern to achieve this? Right now the only idea I came up with is having an application running on all my nodes that specify the "feature" of the node, so when a node joins the cluster, the web service app checks the capabilities of the node, and either ignores or it grabs the host_service process, or if the host_service happens to be dead periodically checks until it's alive. Lastly I'm also debating if this complexity is worth the effort, it seems that using a global process as a host_service registry would be much easier. Thanks for any advice, and also keep in mind this is mostly a personal academic exercises in building distributed systems and learning Erlang. -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Sun Nov 11 02:16:36 2012 From: g@REDACTED (Garrett Smith) Date: Sat, 10 Nov 2012 19:16:36 -0600 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: What makes the plugins "pluggable"? If there's no uncertainly about what might be registered, it might make more sense to define the workers as children of a supervisor in your main app. If you're breaking these into separate apps to manage complexity, then I suspect you're looking at your option 1 -- library style apps that are required by the main app. If it's not know ahead of time what the plugins are, what is the trigger for processing? Is it a certain number of plugins? A total worker capacity? On Sat, Nov 10, 2012 at 4:02 PM, Karolis Petrauskas wrote: > Thank you for the comments. It sounds reasonable to go with active > applications. One aspect I forgot to mention is that the main > application should start its own processing only when all the required > plugins are ready. The plugin applications act as backend processors. > Maybe that could be solved in more abstract way: the main application > could be configured with names of processes (or incoming messages) to > wait for before processing is started. Although I am not sure if such > an approach is "erlangish", I was deep in java for last ten years. > > Karolis > > On Sat, Nov 10, 2012 at 6:15 PM, Garrett Smith wrote: >> On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas >> wrote: >>> Hello, >>> >>> I am building an Erlang based system that is composed of several >>> applications. In principle, the system consists of a main application >>> and a number of "plug in applications". The latter have modules >>> implementing behaviours defined by the main application. In this >>> particular case, should I have all the "plug in applications" as >>> library applications, and access them from the main application based >>> on some explicit configuration? Or should all the applications have >>> its own application modules starting own supervisors and then >>> registering self to the main application? The main thing confusing me >>> is the recommendation to have single supervision tree for the entire >>> system. >> >> There are good reasons for taking either approach, but if you're in >> doubt, I'd suggest the second option: each plugin is an "active" >> application (i.e. specifies a mod in the .app file) that registers >> itself as needed with the main application. >> >> The advantage to this approach is that you're further separating the >> components of your system: >> >> - The main application doesn't have to know about the plugins at >> startup, which simplifies its configuration and removes the "wiring" >> logic that it would otherwise need >> >> - Plugins can be added and removed by adding and removing OTP >> applications in the release (i.e. you use boot files to specify which >> plugins are run for a given Erlang process) >> >> The OTP application abstraction in Erlang is very powerful in this >> respect, as long as you design your applications to be as independent >> as possible from one another. You can add new functionality to a >> system by the simple act of starting a new application! >> >> Your only real design consideration then is how the plugin apps >> register with the main application. This is a good spot for a >> gen_event, or pub/sub broker model, where you use an intermediary >> process to broker messages/requests between the main application and >> the plugins. >> >> Garrett From tom@REDACTED Sun Nov 11 02:52:24 2012 From: tom@REDACTED (Tom Samplonius) Date: Sat, 10 Nov 2012 17:52:24 -0800 Subject: [erlang-questions] Masterless application design In-Reply-To: References: Message-ID: I don't completely understand your application, but it sounds like what you want is the gossip protocol. Gossip can solve some of the "masterless" issues. Google for "gossip protocol erlang" and you will lots of interesting, and possibly useful stuff. Tom On Nov 10, 2012, at 3:08 PM, Cristian Hancila wrote: > Hello Erlangers, > > I'm fairly new to Erlang and I'm trying to brainstorm an architecture for an ideally masterless system, mainly how to achieve it on top of Erlang and OTP. The main components are 1..n nodes as public web based authentication services and 1..n nodes as the ultimate hosts of the client, over a long lived tcp connection. The web service nodes do registration and authentication, and decide which host the client will connect to. The authentication nodes need to be aware of all host nodes, and need to realize when new host nodes get added. The host nodes provide a notification mechanism for usage statistics, and each auth node registers for this notification in order to figure out some heuristics on deciding where to forward a client when they want to connect. > > My main issue is with figuring out if when a new node joins the cluster, does it/will it run the host_service application? If I can't make that guarantee then I would need to periodically scan all nodes an see if host_service is running on them. This seems like a bad design. Is there an OTP or standardized erlang pattern to achieve this? > > Right now the only idea I came up with is having an application running on all my nodes that specify the "feature" of the node, so when a node joins the cluster, the web service app checks the capabilities of the node, and either ignores or it grabs the host_service process, or if the host_service happens to be dead periodically checks until it's alive. > > Lastly I'm also debating if this complexity is worth the effort, it seems that using a global process as a host_service registry would be much easier. > > Thanks for any advice, and also keep in mind this is mostly a personal academic exercises in building distributed systems and learning Erlang. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From corticalcomputer@REDACTED Sun Nov 11 06:02:51 2012 From: corticalcomputer@REDACTED (Gene Sher) Date: Sun, 11 Nov 2012 00:02:51 -0500 Subject: [erlang-questions] eBook version of the Handbook of Neuroevolution Through Erlang, is now available from Springer. Message-ID: Hello Erlangers, The eBook version of my the Handbook of Neuroevolution Through Erlang, is now in print: http://www.springer.com/computer/swe/book/978-1-4614-4462-6 The Hardcover book will be available within the next 2-3 weeks from Amazon, Barnes & Noble, and Springer directly. Book overview: - Provides a friendly step-by-step guide on the construction of Topology and Weight Evolving Artificial Neural Network systems from start to finish - Covers novel material for using Erlang in the construction of TWEANN systems - Explains why Neural Network based Computational Intelligence systems map perfectly to Erlang?s architecture, and the importance of this programming language to the future of computational intelligence - Introduces new TWEANN algorithms, with the final result being a concurrent, cutting edge, direct and indirect encoded, plasticity enabled, TWEANN platform *Handbook of Neuroevolution Through Erlang* presents both the theory behind, and the methodology of, developing a neuroevolutionary-based computational intelligence system using Erlang. With a foreword written by Joe Armstrong, this handbook offers an extensive tutorial for creating a state of the art Topology and Weight Evolving Artificial Neural Network (TWEANN) platform. In a step-by-step format, the reader is guided from a single simulated neuron to a complete system. By following these steps, the reader will be able to use novel technology to build a TWEANN system, which can be applied to Artificial Life simulation, and Forex trading. Because of Erlang?s architecture, it perfectly matches that of evolutionary and neurocomptational systems. As a programming language, it is a concurrent, message passing paradigm which allows the developers to make full use of the multi-core & multi-cpu systems. *Handbook of Neuroevolution Through Erlang* explains how to leverage Erlang?s features in the field of machine learning, and the system?s real world applications, ranging from algorithmic financial trading to artificial life and robotics. It covers in detail the subject of Neuroevolution, its applications, why Erlang is the quintessential neural network programming language, and the construction of DXNN2: https://github.com/CorticalComputer/DXNN2 A robust, purely Erlang, Topology and Weight Evolving Artificial Neural Network platform, capable of evolving direct and indirect systems, with and without plasticity, and a hierarchical structure that yields easily to allow one to develop self-repairing intelligent agents. Best regards, -Gene -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.eugene.turner@REDACTED Sun Nov 11 07:30:04 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Sun, 11 Nov 2012 15:30:04 +0900 Subject: [erlang-questions] eBook version of the Handbook of Neuroevolution Through Erlang, is now available from Springer. In-Reply-To: References: Message-ID: I've already congratulated Gene privately. I'd like to repeat the congratulations publicly, while also point out that the beautifully illustrated NN tutorial at TrapExit http://www.trapexit.org/Erlang_and_Neural_Networks doesn't seem to actually work. At least, when I tried, I couldn't get it to work. Inquiries to both the author and to this mailing list failed to turn up solutions. If in fact Erlang is a very good language for NN work, I can only hope that Gene's book will inspire someone to fix this tutorial. -michael turner On Sun, Nov 11, 2012 at 2:02 PM, Gene Sher wrote: > Hello Erlangers, > > The eBook version of my the Handbook of Neuroevolution Through Erlang, is > now in print: http://www.springer.com/computer/swe/book/978-1-4614-4462-6 > The Hardcover book will be available within the next 2-3 weeks from Amazon, > Barnes & Noble, and Springer directly. > > Book overview: > > Provides a friendly step-by-step guide on the construction of Topology and > Weight Evolving Artificial Neural Network systems from start to finish > Covers novel material for using Erlang in the construction of TWEANN systems > Explains why Neural Network based Computational Intelligence systems map > perfectly to Erlang?s architecture, and the importance of this programming > language to the future of computational intelligence > Introduces new TWEANN algorithms, with the final result being a concurrent, > cutting edge, direct and indirect encoded, plasticity enabled, TWEANN > platform > > Handbook of Neuroevolution Through Erlang presents both the theory behind, > and the methodology of, developing a neuroevolutionary-based computational > intelligence system using Erlang. With a foreword written by Joe Armstrong, > this handbook offers an extensive tutorial for creating a state of the art > Topology and Weight Evolving Artificial Neural Network (TWEANN) platform. In > a step-by-step format, the reader is guided from a single simulated neuron > to a complete system. By following these steps, the reader will be able to > use novel technology to build a TWEANN system, which can be applied to > Artificial Life simulation, and Forex trading. Because of Erlang?s > architecture, it perfectly matches that of evolutionary and > neurocomptational systems. As a programming language, it is a concurrent, > message passing paradigm which allows the developers to make full use of the > multi-core & multi-cpu systems. Handbook of Neuroevolution Through Erlang > explains how to leverage Erlang?s features in the field of machine learning, > and the system?s real world applications, ranging from algorithmic financial > trading to artificial life and robotics. > > It covers in detail the subject of Neuroevolution, its applications, why > Erlang is the quintessential neural network programming language, and the > construction of DXNN2: https://github.com/CorticalComputer/DXNN2 > A robust, purely Erlang, Topology and Weight Evolving Artificial Neural > Network platform, capable of evolving direct and indirect systems, with and > without plasticity, and a hierarchical structure that yields easily to allow > one to develop self-repairing intelligent agents. > > Best regards, > -Gene > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From k.petrauskas@REDACTED Sun Nov 11 08:00:52 2012 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Sun, 11 Nov 2012 09:00:52 +0200 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: Your questions allow me to understand the problem better. Thanks :) Maybe the terms "master application" and "plugin application" is not totally appropriate. In java world it would be: master application = application server, plugin application = application (or user application). The application server governs all the user applications, provides some infrastructure and delegates some work to them. I would like to have ability to add those applications freely, but once particular user application added, the application server should proceed with its own processing only when the added application is available. Maybe another way to solve this is to reverse the runtime dependency: "the user applications take tasks from a queue provided by the application server" instead of "the application server delegates tasks to user applications". I need to think about that more. The requirement for the solution to support cluster operation is not making things clearer :) Karolis On Sun, Nov 11, 2012 at 3:16 AM, Garrett Smith wrote: > What makes the plugins "pluggable"? If there's no uncertainly about > what might be registered, it might make more sense to define the > workers as children of a supervisor in your main app. > > If you're breaking these into separate apps to manage complexity, then > I suspect you're looking at your option 1 -- library style apps that > are required by the main app. > > If it's not know ahead of time what the plugins are, what is the > trigger for processing? Is it a certain number of plugins? A total > worker capacity? > > On Sat, Nov 10, 2012 at 4:02 PM, Karolis Petrauskas > wrote: >> Thank you for the comments. It sounds reasonable to go with active >> applications. One aspect I forgot to mention is that the main >> application should start its own processing only when all the required >> plugins are ready. The plugin applications act as backend processors. >> Maybe that could be solved in more abstract way: the main application >> could be configured with names of processes (or incoming messages) to >> wait for before processing is started. Although I am not sure if such >> an approach is "erlangish", I was deep in java for last ten years. >> >> Karolis >> >> On Sat, Nov 10, 2012 at 6:15 PM, Garrett Smith wrote: >>> On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas >>> wrote: >>>> Hello, >>>> >>>> I am building an Erlang based system that is composed of several >>>> applications. In principle, the system consists of a main application >>>> and a number of "plug in applications". The latter have modules >>>> implementing behaviours defined by the main application. In this >>>> particular case, should I have all the "plug in applications" as >>>> library applications, and access them from the main application based >>>> on some explicit configuration? Or should all the applications have >>>> its own application modules starting own supervisors and then >>>> registering self to the main application? The main thing confusing me >>>> is the recommendation to have single supervision tree for the entire >>>> system. >>> >>> There are good reasons for taking either approach, but if you're in >>> doubt, I'd suggest the second option: each plugin is an "active" >>> application (i.e. specifies a mod in the .app file) that registers >>> itself as needed with the main application. >>> >>> The advantage to this approach is that you're further separating the >>> components of your system: >>> >>> - The main application doesn't have to know about the plugins at >>> startup, which simplifies its configuration and removes the "wiring" >>> logic that it would otherwise need >>> >>> - Plugins can be added and removed by adding and removing OTP >>> applications in the release (i.e. you use boot files to specify which >>> plugins are run for a given Erlang process) >>> >>> The OTP application abstraction in Erlang is very powerful in this >>> respect, as long as you design your applications to be as independent >>> as possible from one another. You can add new functionality to a >>> system by the simple act of starting a new application! >>> >>> Your only real design consideration then is how the plugin apps >>> register with the main application. This is a good spot for a >>> gen_event, or pub/sub broker model, where you use an intermediary >>> process to broker messages/requests between the main application and >>> the plugins. >>> >>> Garrett From meetprashant007@REDACTED Sun Nov 11 08:38:45 2012 From: meetprashant007@REDACTED (Prashant Sharma) Date: Sun, 11 Nov 2012 13:08:45 +0530 Subject: [erlang-questions] eBook version of the Handbook of Neuroevolution Through Erlang, is now available from Springer. In-Reply-To: References: Message-ID: +1 On Sun, Nov 11, 2012 at 12:00 PM, Michael Turner wrote: > I've already congratulated Gene privately. I'd like to repeat the > congratulations publicly, while also point out that the beautifully > illustrated NN tutorial at TrapExit > > http://www.trapexit.org/Erlang_and_Neural_Networks > > doesn't seem to actually work. At least, when I tried, I couldn't get > it to work. Inquiries to both the author and to this mailing list > failed to turn up solutions. If in fact Erlang is a very good language > for NN work, I can only hope that Gene's book will inspire someone to > fix this tutorial. > > -michael turner > > On Sun, Nov 11, 2012 at 2:02 PM, Gene Sher wrote: >> Hello Erlangers, >> >> The eBook version of my the Handbook of Neuroevolution Through Erlang, is >> now in print: http://www.springer.com/computer/swe/book/978-1-4614-4462-6 >> The Hardcover book will be available within the next 2-3 weeks from Amazon, >> Barnes & Noble, and Springer directly. >> >> Book overview: >> >> Provides a friendly step-by-step guide on the construction of Topology and >> Weight Evolving Artificial Neural Network systems from start to finish >> Covers novel material for using Erlang in the construction of TWEANN systems >> Explains why Neural Network based Computational Intelligence systems map >> perfectly to Erlang?s architecture, and the importance of this programming >> language to the future of computational intelligence >> Introduces new TWEANN algorithms, with the final result being a concurrent, >> cutting edge, direct and indirect encoded, plasticity enabled, TWEANN >> platform >> >> Handbook of Neuroevolution Through Erlang presents both the theory behind, >> and the methodology of, developing a neuroevolutionary-based computational >> intelligence system using Erlang. With a foreword written by Joe Armstrong, >> this handbook offers an extensive tutorial for creating a state of the art >> Topology and Weight Evolving Artificial Neural Network (TWEANN) platform. In >> a step-by-step format, the reader is guided from a single simulated neuron >> to a complete system. By following these steps, the reader will be able to >> use novel technology to build a TWEANN system, which can be applied to >> Artificial Life simulation, and Forex trading. Because of Erlang?s >> architecture, it perfectly matches that of evolutionary and >> neurocomptational systems. As a programming language, it is a concurrent, >> message passing paradigm which allows the developers to make full use of the >> multi-core & multi-cpu systems. Handbook of Neuroevolution Through Erlang >> explains how to leverage Erlang?s features in the field of machine learning, >> and the system?s real world applications, ranging from algorithmic financial >> trading to artificial life and robotics. >> >> It covers in detail the subject of Neuroevolution, its applications, why >> Erlang is the quintessential neural network programming language, and the >> construction of DXNN2: https://github.com/CorticalComputer/DXNN2 >> A robust, purely Erlang, Topology and Weight Evolving Artificial Neural >> Network platform, capable of evolving direct and indirect systems, with and >> without plasticity, and a hierarchical structure that yields easily to allow >> one to develop self-repairing intelligent agents. >> >> Best regards, >> -Gene >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Prashant Sharma Development Engineer Pramati Technologies Begumpet "Hare Krishna" From siraaj@REDACTED Sun Nov 11 08:51:03 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Sun, 11 Nov 2012 02:51:03 -0500 Subject: [erlang-questions] eBook version of the Handbook of Neuroevolution Through Erlang, is now available from Springer. In-Reply-To: References: Message-ID: <09728359-665C-47A3-A434-FADC7FC50C33@khandkar.net> Had it on pre-order since original announcement. Congrats on the release!! On Nov 11, 2012, at 12:02 AM, Gene Sher wrote: > Hello Erlangers, > > The eBook version of my the Handbook of Neuroevolution Through Erlang, is > now in print: http://www.springer.com/computer/swe/book/978-1-4614-4462-6 > The Hardcover book will be available within the next 2-3 weeks from Amazon, > Barnes & Noble, and Springer directly. > > Book overview: > > - Provides a friendly step-by-step guide on the construction of Topology > and Weight Evolving Artificial Neural Network systems from start to finish > - Covers novel material for using Erlang in the construction of TWEANN > systems > - Explains why Neural Network based Computational Intelligence systems > map perfectly to Erlang?s architecture, and the importance of this > programming language to the future of computational intelligence > - Introduces new TWEANN algorithms, with the final result being a > concurrent, cutting edge, direct and indirect encoded, plasticity enabled, > TWEANN platform > > *Handbook of Neuroevolution Through Erlang* presents both the theory > behind, and the methodology of, developing a neuroevolutionary-based > computational intelligence system using Erlang. With a foreword written by > Joe Armstrong, this handbook offers an extensive tutorial for creating a > state of the art Topology and Weight Evolving Artificial Neural Network > (TWEANN) platform. In a step-by-step format, the reader is guided from a > single simulated neuron to a complete system. By following these steps, the > reader will be able to use novel technology to build a TWEANN system, which > can be applied to Artificial Life simulation, and Forex trading. Because of > Erlang?s architecture, it perfectly matches that of evolutionary and > neurocomptational systems. As a programming language, it is a concurrent, > message passing paradigm which allows the developers to make full use of > the multi-core & multi-cpu systems. *Handbook of Neuroevolution Through > Erlang* explains how to leverage Erlang?s features in the field of machine > learning, and the system?s real world applications, ranging from > algorithmic financial trading to artificial life and robotics. > > It covers in detail the subject of Neuroevolution, its applications, why > Erlang is the quintessential neural network programming language, and the > construction of DXNN2: https://github.com/CorticalComputer/DXNN2 > A robust, purely Erlang, Topology and Weight Evolving Artificial Neural > Network platform, capable of evolving direct and indirect systems, with and > without plasticity, and a hierarchical structure that yields easily to > allow one to develop self-repairing intelligent agents. > > Best regards, > -Gene -- Siraaj Khandkar .o. ..o ooo From g@REDACTED Sun Nov 11 15:54:44 2012 From: g@REDACTED (Garrett Smith) Date: Sun, 11 Nov 2012 08:54:44 -0600 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: Yeah, now the correct answer is very clear: it depends :) Erlang applications will "turn on" a particular set of features. But they're probably not the right abstraction for increasing "capacity". E.g. you can't start multiple instances of the same application to do more work. You can certainly add processes, managed under the auspices of an application. If you're willing to skim over some of the low-level technical areas, I recommend reading the 0MQ "The Guide": http://zguide.zeromq.org/page:all There's obviously quite a bit specific to 0MQ, but that document (soon to be a published book as I understand!) elaborates a way of thinking about messaging patterns that might be very helpful in provoking different questions and ideas for you. Each of the messaging patterns presented in The Guide can be applied quite easily within a single Erlang node -- it's all just message passing. And if you're so inclined, Erlang + 0MQ makes a very good platform for distributed systems IMO (i.e. using these patterns across multiple Erlang OS processes, without relying on distribute Erlang). On Sun, Nov 11, 2012 at 1:00 AM, Karolis Petrauskas wrote: > Your questions allow me to understand the problem better. Thanks > :) Maybe the terms "master application" and "plugin application" is > not totally appropriate. In java world it would be: > master application = application server, > plugin application = application (or user application). > The application server governs all the user applications, provides > some infrastructure and delegates some work to them. I would like to > have ability to add those applications freely, but once particular > user application added, the application server should proceed with its > own processing only when the added application is available. > > Maybe another way to solve this is to reverse the runtime > dependency: "the user applications take tasks from a queue provided by > the application server" instead of "the application server delegates > tasks to user applications". I need to think about that more. The > requirement for the solution to support cluster operation is not > making things clearer :) > > Karolis > On Sun, Nov 11, 2012 at 3:16 AM, Garrett Smith wrote: >> What makes the plugins "pluggable"? If there's no uncertainly about >> what might be registered, it might make more sense to define the >> workers as children of a supervisor in your main app. >> >> If you're breaking these into separate apps to manage complexity, then >> I suspect you're looking at your option 1 -- library style apps that >> are required by the main app. >> >> If it's not know ahead of time what the plugins are, what is the >> trigger for processing? Is it a certain number of plugins? A total >> worker capacity? >> >> On Sat, Nov 10, 2012 at 4:02 PM, Karolis Petrauskas >> wrote: >>> Thank you for the comments. It sounds reasonable to go with active >>> applications. One aspect I forgot to mention is that the main >>> application should start its own processing only when all the required >>> plugins are ready. The plugin applications act as backend processors. >>> Maybe that could be solved in more abstract way: the main application >>> could be configured with names of processes (or incoming messages) to >>> wait for before processing is started. Although I am not sure if such >>> an approach is "erlangish", I was deep in java for last ten years. >>> >>> Karolis >>> >>> On Sat, Nov 10, 2012 at 6:15 PM, Garrett Smith wrote: >>>> On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas >>>> wrote: >>>>> Hello, >>>>> >>>>> I am building an Erlang based system that is composed of several >>>>> applications. In principle, the system consists of a main application >>>>> and a number of "plug in applications". The latter have modules >>>>> implementing behaviours defined by the main application. In this >>>>> particular case, should I have all the "plug in applications" as >>>>> library applications, and access them from the main application based >>>>> on some explicit configuration? Or should all the applications have >>>>> its own application modules starting own supervisors and then >>>>> registering self to the main application? The main thing confusing me >>>>> is the recommendation to have single supervision tree for the entire >>>>> system. >>>> >>>> There are good reasons for taking either approach, but if you're in >>>> doubt, I'd suggest the second option: each plugin is an "active" >>>> application (i.e. specifies a mod in the .app file) that registers >>>> itself as needed with the main application. >>>> >>>> The advantage to this approach is that you're further separating the >>>> components of your system: >>>> >>>> - The main application doesn't have to know about the plugins at >>>> startup, which simplifies its configuration and removes the "wiring" >>>> logic that it would otherwise need >>>> >>>> - Plugins can be added and removed by adding and removing OTP >>>> applications in the release (i.e. you use boot files to specify which >>>> plugins are run for a given Erlang process) >>>> >>>> The OTP application abstraction in Erlang is very powerful in this >>>> respect, as long as you design your applications to be as independent >>>> as possible from one another. You can add new functionality to a >>>> system by the simple act of starting a new application! >>>> >>>> Your only real design consideration then is how the plugin apps >>>> register with the main application. This is a good spot for a >>>> gen_event, or pub/sub broker model, where you use an intermediary >>>> process to broker messages/requests between the main application and >>>> the plugins. >>>> >>>> Garrett From ok@REDACTED Sun Nov 11 22:46:04 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 12 Nov 2012 10:46:04 +1300 Subject: [erlang-questions] About Erlang system performance In-Reply-To: <509D1A1E.9070803@gmail.com> References: <509D1A1E.9070803@gmail.com> Message-ID: <735794A5-CBD7-4940-A0DE-429F39AE180C@cs.otago.ac.nz> > > Most significant systems are speed limited due to I/O and networking: the CPU usage can be surprisingly low. Erlang handles async and simultaneous I/O and networking extremely well - by design. I recently had a program where each run took 3 hours. Of that, about 2 minutes was CPU time (in C). The thing that needed to be optimised was disc seeks, not CPU instructions. Systems and benchmarks can be very different. From JAY@REDACTED Mon Nov 12 04:57:31 2012 From: JAY@REDACTED (Jay Nelson) Date: Sun, 11 Nov 2012 19:57:31 -0800 Subject: [erlang-questions] Multiple Applications Message-ID: <2FA9F441-5849-4415-B9A2-C762BC34FEA6@DUOMARK.COM> The key to architecting erlang systems is understanding the difference between applications and supervised processes. The important characteristic is what you would expect to happen in the case of a failure. Applications: - If permanent, failure takes down the VM node - If temporary, failure has no other implications - If transient, failure other than normal kills the VM - There is no automatic restart of an application Supervised processes: - Failure is communicated to the supervisor - Automatic restart is dictated by supervisor strategy - Startup order is dictated by the supervisor hierarchy In general applications have no order dependency (you can see this when code has things like application:start(crypto) littered about or have a function called 'ensure_started') other than the initial serial order listed in the applications list. A better approach is to make separate applications which have an app.erl and a single root supervisor which manages and describes the restart strategy for components of each application. Then an overarching application would include all subordinate applications so that they can be managed and restarted if they fail. For your composite top-level application you use the include_applications property (rather than the applications property to list the subordinate applications). Start phases are used for ordering dependencies on any synchronized startup that is needed across the applications. The root supervisor of the composite application should start the corresponding root supervisors (anywhere in the supervisor hierarchy that makes sense) of the subordinate applications. The composite supervisor hierarchy will enforce any restart dependencies and start up ordering, and the start phases will enforce any post start up initialization such as launching one-for-one workers, connecting to databases and so on. My recommendation is a single application with supervised and included applications, although this is not common in open source projects. jay From JAY@REDACTED Mon Nov 12 05:01:19 2012 From: JAY@REDACTED (Jay Nelson) Date: Sun, 11 Nov 2012 20:01:19 -0800 Subject: [erlang-questions] Masterless application design Message-ID: The OTP technique for this is to use the pg2 module. You can create names for each of the features and when nodes join or rejoin the erlang mesh, you also join the pg2 names for the features that node offers. jay From francis.joanis@REDACTED Mon Nov 12 05:09:16 2012 From: francis.joanis@REDACTED (Francis Joanis) Date: Sun, 11 Nov 2012 23:09:16 -0500 Subject: [erlang-questions] Erlounge in Ottawa (ON, Canada) In-Reply-To: References: Message-ID: Hi again, FYI, the lounge/meetup has been scheduled: Nov 26 @ 6:00 PM. See details/RSVP here: http://www.meetup.com/Ottawa-Gatineau-Erlang-Meetup-Group/events/90778732/ Cheers, Francis On Thu, Oct 18, 2012 at 11:24 PM, Francis Joanis wrote: > Hi, > > Anyone would be interested for an Erlounge in Ottawa? > > I'm thinking probably sometime in November. > > Please reply privately if you would be interested :) > > Cheers, > Francis From Barys_Ilyushonak@REDACTED Mon Nov 12 07:00:02 2012 From: Barys_Ilyushonak@REDACTED (Ilyushonak Barys) Date: Mon, 12 Nov 2012 06:00:02 +0000 Subject: [erlang-questions] Fine-Tuning the Erlang VM presentation In-Reply-To: References: Message-ID: Hi erlangers, There was great tutorial ?Fine-Tuning the Erlang VM? by Jesper Louis on EUS 2012. Could someone please share the slides if it possible? Best Regards, Barys Ilyushonak _______________________________________________________ CONFIDENTIALITY NOTICE: This email and any files attached to it may be confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Mon Nov 12 08:54:25 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Mon, 12 Nov 2012 09:54:25 +0200 Subject: [erlang-questions] CSV file help Message-ID: Hi Erlang Developers, Where do i start in terms of reading CSV file, because i tried to use this rountines: {ok,String} = file:open("produce.csv",read). io:get_line(String, ' '). but when i used this rountine: io:get_line(String,' ') to read each line i got this tuple: {error,terminated}, And the file i'm trying to read is like this: "Supplier ID","Product Code","Product Description","Delivery Date","Unit Price","Number of Units" 15,1101,"Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love, Mrs. Hollingberry","2012/02/15",1505,5 Thanks in advance for your help. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Nov 12 09:04:52 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 12 Nov 2012 09:04:52 +0100 Subject: [erlang-questions] CSV file help In-Reply-To: References: Message-ID: <1352707492.4733.8.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, The documentation page for io:file/2 says that the second argument should be a list of atoms. Like this: [read]. If {ok, String} matches, then you are probably just lucky. bengt On Mon, 2012-11-12 at 09:54 +0200, Lucky Khoza wrote: > Hi Erlang Developers, > > Where do i start in terms of reading CSV file, because i tried to use > this rountines: > > {ok,String} = file:open("produce.csv",read). > io:get_line(String, ' '). > > but when i used this rountine: io:get_line(String,' ') to read each > line i got this tuple: {error,terminated}, > > And the file i'm trying to read is like this: > > "Supplier ID","Product Code","Product Description","Delivery > Date","Unit Price","Number of Units" > 15,1101,"Apples 1kg Golden Delicious. The sweetest Apples! Always a > favourite. Love, Mrs. Hollingberry","2012/02/15",1505,5 > > Thanks in advance for your help. > > Kindest Regards > Lucky > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From sverker.eriksson@REDACTED Mon Nov 12 12:03:55 2012 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Mon, 12 Nov 2012 12:03:55 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>, <509BBA7B.2030406@erix.ericsson.se>, , , <509CCC1F.1070401@erix.ericsson.se> Message-ID: <50A0D79B.50507@erix.ericsson.se> Use --disable-hipe as a workaround if you do not plan to use hipe. In either way, could you sent me (off list) the generated file erts/emulator/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.S /Sverker Venu Middela wrote: > Sverker, Thanks for the quick suggestion.. I was able to compile and build 64-bit openssl along with building shared objects. > Now, when i try to compile erlang 15B01, running into a new compilation error.. > > Here's my configure parameters before running gmake.. > > #./configure --enable-m64-build --prefix=/export/home/vmi/ERL --enable-threads --enable-smp-support > --with-ssl=/usr/local/ssl --with-ssl-lib=/usr/local/ssl/lib > > Heres' the compilation error: > gcc -m64 -m64 -fPIC -I/export/home/vmi/otp/otp_src_R15B01/erts/i386-pc-so > laris2.10 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_ > H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement - > DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANT > ICS -Ii386-pc-solaris2.10/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-sola > ris2.10 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.10 -I.. > /include/internal -I../include/internal/i386-pc-solaris2.10 -c i386-pc-solaris2. > 10/opt/smp/hipe_amd64_bifs.S -o obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs. > o > i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.S:2005:2: #endif without #if > gmake[3]: *** [obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.o] Error 1 > gmake[3]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula > tor' > gmake[2]: *** [opt] Error 2 > gmake[2]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula > tor' > gmake[1]: *** [smp] Error 2 > gmake[1]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts' > gmake: *** [emulator] Error 2 > ddela/otp/otp_src_R15B01root@REDACTED:/export/home/vmi/otp/otp_src_R15BThanks, > Venu > > >> Date: Fri, 9 Nov 2012 10:25:51 +0100 >> From: sverker.eriksson@REDACTED >> To: mvm_8@REDACTED >> CC: attila.r.nohl@REDACTED; erlang-questions@REDACTED >> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >> >> You have to configure openssl source tree with option 'shared' to get >> dynamic libraries. >> Option 'no-asm' might also help if you get compile problems. Read INSTALL. >> >> /Sverker >> >> Venu Middela wrote: >> >>> Attila, >>> I did try installing the package openssl0.9.8, but the binaries from this package are 32 bit. >>> also, when i tried to compile from the sourcecode , strangely, the compile/make is not building the 64-bit binaries for libcrypto and libssl.. >>> here's the contents of compiled /usr/local/ssl/lib >>> bash-3.2$ pwd >>> /usr/local/ssl/lib >>> >>> -bash-3.2$ ls >>> engines libcrypto.a libssl.a pkgconfig >>> >>> >>> Thanks, >>> Venu >>> >>> >>> >>>> Date: Thu, 8 Nov 2012 21:50:21 +0100 >>>> From: attila.r.nohl@REDACTED >>>> To: erlang-questions@REDACTED >>>> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >>>> >>>> 2012/11/8 Venu Middela : >>>> >>>> >>>>> Steve, >>>>> Thanks for pointing out the correct version of crypto. >>>>> Could you please point to instructions on how to patch crypto to remove the >>>>> NIF des_ede3_cfb_crypt. >>>>> I couldnt find a solaris package version 0.9.8. Looked through oracle sites >>>>> for updated package and/or any patch that would >>>>> upgrade openssl to 0.9.8, but no luck. >>>>> >>>>> >>>> Check sunfreeware.com (or one of its mirrors). For example this is a >>>> 0.9.8 package for Solaris 10 on x86: >>>> http://sunfreeware.saix.net/programlistintel10.html#openssl098p It >>>> seems that now the main site requires registration :-( >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> > > From freeakk@REDACTED Mon Nov 12 13:20:16 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Mon, 12 Nov 2012 15:20:16 +0300 Subject: [erlang-questions] CSV file help In-Reply-To: <1352707492.4733.8.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1352707492.4733.8.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: Hi, There are few libraries for CSV parsing. I wrote this one. https://github.com/arcusfelis/csv_parser -- Best regards, Uvarov Michael From jesper.louis.andersen@REDACTED Mon Nov 12 13:30:40 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 12 Nov 2012 13:30:40 +0100 Subject: [erlang-questions] CSV file help In-Reply-To: References: Message-ID: On Nov 12, 2012, at 8:54 AM, Lucky Khoza wrote: > Hi Erlang Developers, > > Where do i start in terms of reading CSV file, because i tried to use this rountines: > > {ok,String} = file:open("produce.csv",read). > io:get_line(String, ' '). There are two problems here: first, file:open/2 should be called appropriately and Bengt writes. Second, the binding {ok, String} should rather be {ok, IoDevice} in order to be more precise. The IO device needs to be used to read out data from the file in question. Look at the call file:read_line/2. The io:get_line/2 call is probably ok, but I would prefer file:read_line/2 since it does not have to be given a prompt. Speaking of prompt, the value '' is not a string but an (empty) atom. In Erlang, you can't interchange ' and " like many other languages (almost) allows you to. The {error, terminated} is probably because your IoDevice was not opened correctly and thus the call fails. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From tuncer.ayaz@REDACTED Mon Nov 12 16:40:21 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 12 Nov 2012 16:40:21 +0100 Subject: [erlang-questions] rebar help COMMAND Message-ID: While I was drafting how to implement a more useful 'rebar help' command which accepts an argument, I wondered how much interest there is for such a feature. It is inspired by similar help commands in other cli tools. print common help string: $ rebar help $ rebar -h $ rebar --help print command specific help string for all plugins implementing the given command: $ rebar help compile erlc_compiler:compile On 'compile' rebar_erlc_compiler builds sources with the extensions *.erl, *.yrl, *.xrl, <...> and accepts the following rebar.config options: erl_opts: [...] plugin_2:compile similar to above ... I think such an enhancement can improve the discoverability of rebar commands and supported options quite a lot. Is there enough interest that I should try to get this into the next release? From essen@REDACTED Mon Nov 12 17:01:52 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 12 Nov 2012 17:01:52 +0100 Subject: [erlang-questions] rebar help COMMAND In-Reply-To: References: Message-ID: <50A11D70.4090804@ninenines.eu> On 11/12/2012 04:40 PM, Tuncer Ayaz wrote: > Is there enough interest that I should try to get this into the next > release? Yes. You shouldn't need to ask this. Rebar is too opaque today for people to figure out all the things you can do with it without looking at the source or cruising the web looking for the info. That needs fixing. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From ok@REDACTED Tue Nov 13 00:39:48 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 13 Nov 2012 12:39:48 +1300 Subject: [erlang-questions] Help Please In-Reply-To: References: Message-ID: On 9/11/2012, at 8:31 PM, Lucky Khoza wrote: > Hi, > > May you kindly help with the exercise below using Erlang [I am new Erlang Development]: I'm familiar with the Hollinberry problem. I contributed an AWK solution to it. It's actually a pretty trivial problem that repays careful analysis. The main things to worry about are reading CSV files and date calculations. If you read a CSV file as a single string, then you can use this code adapted from Victor Moroz: parse(Data) -> parse(Data, [], [], []). parse([$\r|Data], Field, Fields, Lines) -> parse_r(Data, Field, Fields, Lines); parse([$\n|Data], Field, Fields, Lines) -> parse_l(Data, Field, Fields, Lines); parse([$,|Data], Field, Fields, Lines) -> parse(Data, [], f(Field, Fields), Lines); parse([$"|Data], [], Fields, Lines) -> parse_q(Data, [], Fields, Lines); parse([C|Data], Field, Fields, Lines) -> parse(Data, [C|Field], Fields, Lines); parse([], [], [], Lines) -> lists:reverse(Lines); parse([], Field, Fields, Lines) -> parse_l([], Field, Fields, Lines). f(Field, Fields) -> [lists:reverse(Field) | Fields]. l(Line, Lines) -> [lists:reverse(Line) | Lines ]. parse_r([$\n|Data], Field, Fields, Lines) -> parse_l(Data, Field, Fields, Lines); parse_r( Data, Field, Fields, Lines) -> parse_l(Data, Field, Fields, Lines). parse_l(Data, Field, Fields, Lines) -> parse(Data, [], [], l(f(Field, Fields), Lines)). parse_q([$"|Data], Field, Fields, Lines) -> parse_qq(Data, Field, Fields, Lines); parse_q([C|Data], Field, Fields, Lines) -> parse_q(Data, [C|Field], Fields, Lines). parse_qq([$"|Data], Field, Fields, Lines) -> parse_q(Data, [$"|Field], Fields, Lines); parse_qq( Data , Field, Fields, Lines) -> parse(Data, Field, Fields, Lines). This is just a finite state automaton, maintaining four things: Data = the characters yet to be scanned Field = the current field *reversed* Fields = the fields before the current field on the current line; each field is in its right order, but Fields is reversed Lines = the lines before the current line; each line is in its right order, but Lines is reversed. As soon as we finish building each Field (line of fields, file of lines) we reverse it, to maintain this invariant. (This code has been tested on the Hollingberrys' "produce.csv".) For date calculations, use the stdlib 'calendar' module. From k.petrauskas@REDACTED Tue Nov 13 05:07:16 2012 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Tue, 13 Nov 2012 06:07:16 +0200 Subject: [erlang-questions] Multiple applications In-Reply-To: References: Message-ID: Thanks for the link, I will read that :) Karolis On Sun, Nov 11, 2012 at 4:54 PM, Garrett Smith wrote: > Yeah, now the correct answer is very clear: it depends :) > > Erlang applications will "turn on" a particular set of features. But > they're probably not the right abstraction for increasing "capacity". > E.g. you can't start multiple instances of the same application to do > more work. You can certainly add processes, managed under the auspices > of an application. > > If you're willing to skim over some of the low-level technical areas, > I recommend reading the 0MQ "The Guide": > > http://zguide.zeromq.org/page:all > > There's obviously quite a bit specific to 0MQ, but that document (soon > to be a published book as I understand!) elaborates a way of thinking > about messaging patterns that might be very helpful in provoking > different questions and ideas for you. > > Each of the messaging patterns presented in The Guide can be applied > quite easily within a single Erlang node -- it's all just message > passing. > > And if you're so inclined, Erlang + 0MQ makes a very good platform for > distributed systems IMO (i.e. using these patterns across multiple > Erlang OS processes, without relying on distribute Erlang). > > On Sun, Nov 11, 2012 at 1:00 AM, Karolis Petrauskas > wrote: >> Your questions allow me to understand the problem better. Thanks >> :) Maybe the terms "master application" and "plugin application" is >> not totally appropriate. In java world it would be: >> master application = application server, >> plugin application = application (or user application). >> The application server governs all the user applications, provides >> some infrastructure and delegates some work to them. I would like to >> have ability to add those applications freely, but once particular >> user application added, the application server should proceed with its >> own processing only when the added application is available. >> >> Maybe another way to solve this is to reverse the runtime >> dependency: "the user applications take tasks from a queue provided by >> the application server" instead of "the application server delegates >> tasks to user applications". I need to think about that more. The >> requirement for the solution to support cluster operation is not >> making things clearer :) >> >> Karolis >> On Sun, Nov 11, 2012 at 3:16 AM, Garrett Smith wrote: >>> What makes the plugins "pluggable"? If there's no uncertainly about >>> what might be registered, it might make more sense to define the >>> workers as children of a supervisor in your main app. >>> >>> If you're breaking these into separate apps to manage complexity, then >>> I suspect you're looking at your option 1 -- library style apps that >>> are required by the main app. >>> >>> If it's not know ahead of time what the plugins are, what is the >>> trigger for processing? Is it a certain number of plugins? A total >>> worker capacity? >>> >>> On Sat, Nov 10, 2012 at 4:02 PM, Karolis Petrauskas >>> wrote: >>>> Thank you for the comments. It sounds reasonable to go with active >>>> applications. One aspect I forgot to mention is that the main >>>> application should start its own processing only when all the required >>>> plugins are ready. The plugin applications act as backend processors. >>>> Maybe that could be solved in more abstract way: the main application >>>> could be configured with names of processes (or incoming messages) to >>>> wait for before processing is started. Although I am not sure if such >>>> an approach is "erlangish", I was deep in java for last ten years. >>>> >>>> Karolis >>>> >>>> On Sat, Nov 10, 2012 at 6:15 PM, Garrett Smith wrote: >>>>> On Sat, Nov 10, 2012 at 1:11 AM, Karolis Petrauskas >>>>> wrote: >>>>>> Hello, >>>>>> >>>>>> I am building an Erlang based system that is composed of several >>>>>> applications. In principle, the system consists of a main application >>>>>> and a number of "plug in applications". The latter have modules >>>>>> implementing behaviours defined by the main application. In this >>>>>> particular case, should I have all the "plug in applications" as >>>>>> library applications, and access them from the main application based >>>>>> on some explicit configuration? Or should all the applications have >>>>>> its own application modules starting own supervisors and then >>>>>> registering self to the main application? The main thing confusing me >>>>>> is the recommendation to have single supervision tree for the entire >>>>>> system. >>>>> >>>>> There are good reasons for taking either approach, but if you're in >>>>> doubt, I'd suggest the second option: each plugin is an "active" >>>>> application (i.e. specifies a mod in the .app file) that registers >>>>> itself as needed with the main application. >>>>> >>>>> The advantage to this approach is that you're further separating the >>>>> components of your system: >>>>> >>>>> - The main application doesn't have to know about the plugins at >>>>> startup, which simplifies its configuration and removes the "wiring" >>>>> logic that it would otherwise need >>>>> >>>>> - Plugins can be added and removed by adding and removing OTP >>>>> applications in the release (i.e. you use boot files to specify which >>>>> plugins are run for a given Erlang process) >>>>> >>>>> The OTP application abstraction in Erlang is very powerful in this >>>>> respect, as long as you design your applications to be as independent >>>>> as possible from one another. You can add new functionality to a >>>>> system by the simple act of starting a new application! >>>>> >>>>> Your only real design consideration then is how the plugin apps >>>>> register with the main application. This is a good spot for a >>>>> gen_event, or pub/sub broker model, where you use an intermediary >>>>> process to broker messages/requests between the main application and >>>>> the plugins. >>>>> >>>>> Garrett From k.petrauskas@REDACTED Tue Nov 13 05:11:09 2012 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Tue, 13 Nov 2012 06:11:09 +0200 Subject: [erlang-questions] Multiple Applications In-Reply-To: <2FA9F441-5849-4415-B9A2-C762BC34FEA6@DUOMARK.COM> References: <2FA9F441-5849-4415-B9A2-C762BC34FEA6@DUOMARK.COM> Message-ID: It looks like I was about to reinvent included applications :) Thanks. That will solve part of my problems. Karolis On Mon, Nov 12, 2012 at 5:57 AM, Jay Nelson wrote: > The key to architecting erlang systems is understanding the difference > between applications and supervised processes. The important > characteristic is what you would expect to happen in the case of a > failure. > > Applications: > - If permanent, failure takes down the VM node > - If temporary, failure has no other implications > - If transient, failure other than normal kills the VM > - There is no automatic restart of an application > > Supervised processes: > - Failure is communicated to the supervisor > - Automatic restart is dictated by supervisor strategy > - Startup order is dictated by the supervisor hierarchy > > In general applications have no order dependency (you can see > this when code has things like application:start(crypto) littered > about or have a function called 'ensure_started') other than the > initial serial order listed in the applications list. > > A better approach is to make separate applications which > have an app.erl and a single root supervisor which manages > and describes the restart strategy for components of each > application. Then an overarching application would include > all subordinate applications so that they can be managed > and restarted if they fail. > > For your composite top-level application you use > the include_applications property (rather than the > applications property to list the subordinate applications). > Start phases are used for ordering dependencies on > any synchronized startup that is needed across the > applications. The root supervisor of the composite > application should start the corresponding root > supervisors (anywhere in the supervisor hierarchy > that makes sense) of the subordinate applications. > The composite supervisor hierarchy will enforce > any restart dependencies and start up ordering, and > the start phases will enforce any post start up initialization > such as launching one-for-one workers, connecting to > databases and so on. > > My recommendation is a single application with supervised > and included applications, although this is not common in > open source projects. > > jay > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Tue Nov 13 08:45:09 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 13 Nov 2012 07:45:09 +0000 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> Message-ID: <4154CC1E-76C4-46FC-BAE0-C0929EB86FB6@gmail.com> Works nicely for me. I didn't find bugs in any projects I tested again and wrote a minimal plugin to test of the two behaviours an they seemed to work as expected. Nice one! Sent from my iPhone. On 5 Nov 2012, at 23:24, Tuncer Ayaz wrote: > On Mon, Nov 5, 2012 at 12:13 PM, Tim Watson wrote: >> Dude... >> >> On 4 Nov 2012, at 23:56, Tuncer Ayaz wrote: >>> On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: >>>> [snip] >>> This could work. I'll let you all know once the prototype is ready >>> for testing. >> >> You rock! :) >> >> Once you give the say so, I'll test all my plugins + projects >> against your branch. > > Here's a quick prototype you can test: > https://github.com/tuncer/rebar/compare/recursion > It's not ready for merging and some of the internals are subject to > change. > > We also have to discuss config inheritance and whether it should > be made explicit or removed. From watson.timothy@REDACTED Tue Nov 13 09:38:07 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 13 Nov 2012 08:38:07 +0000 Subject: [erlang-questions] rebar help COMMAND In-Reply-To: <50A11D70.4090804@ninenines.eu> References: <50A11D70.4090804@ninenines.eu> Message-ID: <9C028843-770F-47A8-A776-FACC2141B393@gmail.com> It would help plugin authors a lot if this behaviour was implemented in terms of reading some module metadata rather than being fixed to a subset of internal modules only. If that is something you'd consider. Sent from my iPhone. On 12 Nov 2012, at 16:01, Lo?c Hoguin wrote: > On 11/12/2012 04:40 PM, Tuncer Ayaz wrote: >> Is there enough interest that I should try to get this into the next >> release? > > Yes. You shouldn't need to ask this. Rebar is too opaque today for people to figure out all the things you can do with it without looking at the source or cruising the web looking for the info. That needs fixing. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrkhoza@REDACTED Tue Nov 13 10:15:09 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Tue, 13 Nov 2012 11:15:09 +0200 Subject: [erlang-questions] Help Message-ID: Good day Erlang Developers, I'm actually having a tuple like the one below: my question is - How do i create a function that will store this tuple in a record that i will use create tag table in ETS. {ok,[["\"Number of Units\"","\"Unit Price\"", "\"Delivery Date\"","\"Product Description\"", "\"Product Code\"","\"Supplier ID\""], ["5","1505","\"2012/02/15\""," Mrs. Hollingberry\"","\"Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love", "1101","15"], ["2","1423","\"2012/02/16\""," Mrs. Hollingberry\""," shame... Love", "\"Apples 1kg Green. They are very crunchy!", "1102","15"]]}. As i said i'm newbie in Erlang Functional Programming i would really appreciate any help. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From hq@REDACTED Tue Nov 13 10:40:15 2012 From: hq@REDACTED (Adam Rutkowski) Date: Tue, 13 Nov 2012 10:40:15 +0100 Subject: [erlang-questions] rebar help COMMAND In-Reply-To: References: Message-ID: <1F5A9A69-98F6-41FE-9EC8-1DD07B51DD23@mtod.org> +1 On 12 Nov 2012, at 16:40, Tuncer Ayaz wrote: > While I was drafting how to implement a more useful 'rebar help' > command which accepts an argument, I wondered how much interest there > is for such a feature. It is inspired by similar help commands in > other cli tools. > > print common help string: > $ rebar help > $ rebar -h > $ rebar --help > > print command specific help string for all plugins implementing the > given command: > $ rebar help compile > erlc_compiler:compile > On 'compile' rebar_erlc_compiler builds sources with the extensions > *.erl, *.yrl, *.xrl, <...> and accepts the following rebar.config > options: > erl_opts: [...] > > plugin_2:compile > similar to above > ... > > I think such an enhancement can improve the discoverability of rebar > commands and supported options quite a lot. > > Is there enough interest that I should try to get this into the next > release? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Adam From norton@REDACTED Tue Nov 13 10:41:48 2012 From: norton@REDACTED (Joseph Wayne Norton) Date: Tue, 13 Nov 2012 18:41:48 +0900 Subject: [erlang-questions] Help In-Reply-To: References: Message-ID: <4A84105E-3AA7-46E0-9977-46210AE7C011@lovely.email.ne.jp> Lucky - Try reading one or more of these resources. - http://learnyousomeerlang.com/ets - http://en.citizendium.org/wiki/Erlang_(programming_language)/Tutorials/ETS - http://en.wikibooks.org/wiki/Erlang_Programming/Using_ets I found the above links by searching for "erlang and ets and tutorial". Good luck! On Nov 13, 2012, at 6:15 PM, Lucky Khoza wrote: > Good day Erlang Developers, > > I'm actually having a tuple like the one below: my question is - How do i create a function that will store this tuple in a record that i will use create tag table in ETS. > > {ok,[["\"Number of Units\"","\"Unit Price\"", "\"Delivery Date\"","\"Product Description\"", "\"Product Code\"","\"Supplier ID\""], > ["5","1505","\"2012/02/15\""," Mrs. Hollingberry\"","\"Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love", "1101","15"], > ["2","1423","\"2012/02/16\""," Mrs. Hollingberry\""," shame... Love", "\"Apples 1kg Green. They are very crunchy!", "1102","15"]]}. > > As i said i'm newbie in Erlang Functional Programming i would really appreciate any help. > > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From kunthar@REDACTED Tue Nov 13 10:53:11 2012 From: kunthar@REDACTED (Kunthar) Date: Tue, 13 Nov 2012 11:53:11 +0200 Subject: [erlang-questions] rebar help COMMAND In-Reply-To: <1F5A9A69-98F6-41FE-9EC8-1DD07B51DD23@mtod.org> References: <1F5A9A69-98F6-41FE-9EC8-1DD07B51DD23@mtod.org> Message-ID: +1 From sverker.eriksson@REDACTED Tue Nov 13 12:24:47 2012 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 13 Nov 2012 12:24:47 +0100 Subject: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 In-Reply-To: References: , <509B8265.5000102@erix.ericsson.se> <509B98AD.5050201@cs.ntua.gr>, <509BBA7B.2030406@erix.ericsson.se>, , , <509CCC1F.1070401@erix.ericsson.se> , <50A0D79B.50507@erix.ericsson.se> Message-ID: <50A22DFF.5020401@erix.ericsson.se> Looks like this bug is dependent on which implementation/version of the "m4" macro processor is used. Here is a patch. Note the two different types of quote characters around the word ifdef. diff --git a/erts/emulator/hipe/hipe_bif_list.m4 b/erts/emulator/hipe/hipe_bif_list.m4 index 942fa0c..7f78ddd 100644 --- a/erts/emulator/hipe/hipe_bif_list.m4 +++ b/erts/emulator/hipe/hipe_bif_list.m4 @@ -245,7 +245,7 @@ noproc_primop_interface_5(nbif_bs_put_big_integer, hipe_bs_put_big_integer) gc_bif_interface_0(nbif_check_get_msg, hipe_check_get_msg) -#ifdef NO_FPE_SIGNALS +#`ifdef' NO_FPE_SIGNALS nocons_nofail_primop_interface_0(nbif_emulate_fpe, hipe_emulate_fpe) #endif /Sverker Venu Middela wrote: > Hi Sverker, attached is the amd64_bifs.S. We do not have Hipe enabled as part of the application. I'm in the process of compiling erlang with "==disable-hipe" option to see if it compiles successfully.will let you know. > > Thanks,Venu > > >> Date: Mon, 12 Nov 2012 12:03:55 +0100 >> From: sverker.eriksson@REDACTED >> To: mvm_8@REDACTED >> CC: sverker.eriksson@REDACTED; erlang-questions@REDACTED >> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >> >> Use --disable-hipe as a workaround if you do not plan to use hipe. >> >> In either way, could you sent me (off list) the generated file >> erts/emulator/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.S >> >> /Sverker >> >> Venu Middela wrote: >> >>> Sverker, Thanks for the quick suggestion.. I was able to compile and build 64-bit openssl along with building shared objects. >>> Now, when i try to compile erlang 15B01, running into a new compilation error.. >>> >>> Here's my configure parameters before running gmake.. >>> >>> #./configure --enable-m64-build --prefix=/export/home/vmi/ERL --enable-threads --enable-smp-support >>> --with-ssl=/usr/local/ssl --with-ssl-lib=/usr/local/ssl/lib >>> >>> Heres' the compilation error: >>> gcc -m64 -m64 -fPIC -I/export/home/vmi/otp/otp_src_R15B01/erts/i386-pc-so >>> laris2.10 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DERTS_SMP -DHAVE_CONFIG_ >>> H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement - >>> DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANT >>> ICS -Ii386-pc-solaris2.10/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-sola >>> ris2.10 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.10 -I.. >>> /include/internal -I../include/internal/i386-pc-solaris2.10 -c i386-pc-solaris2. >>> 10/opt/smp/hipe_amd64_bifs.S -o obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs. >>> o >>> i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.S:2005:2: #endif without #if >>> gmake[3]: *** [obj/i386-pc-solaris2.10/opt/smp/hipe_amd64_bifs.o] Error 1 >>> gmake[3]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula >>> tor' >>> gmake[2]: *** [opt] Error 2 >>> gmake[2]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts/emula >>> tor' >>> gmake[1]: *** [smp] Error 2 >>> gmake[1]: Leaving directory `/export/home/vmi/otp/otp_src_R15B01/erts' >>> gmake: *** [emulator] Error 2 >>> ddela/otp/otp_src_R15B01root@REDACTED:/export/home/vmi/otp/otp_src_R15BThanks, >>> Venu >>> >>> >>> >>>> Date: Fri, 9 Nov 2012 10:25:51 +0100 >>>> From: sverker.eriksson@REDACTED >>>> To: mvm_8@REDACTED >>>> CC: attila.r.nohl@REDACTED; erlang-questions@REDACTED >>>> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >>>> >>>> You have to configure openssl source tree with option 'shared' to get >>>> dynamic libraries. >>>> Option 'no-asm' might also help if you get compile problems. Read INSTALL. >>>> >>>> /Sverker >>>> >>>> Venu Middela wrote: >>>> >>>> >>>>> Attila, >>>>> I did try installing the package openssl0.9.8, but the binaries from this package are 32 bit. >>>>> also, when i tried to compile from the sourcecode , strangely, the compile/make is not building the 64-bit binaries for libcrypto and libssl.. >>>>> here's the contents of compiled /usr/local/ssl/lib >>>>> bash-3.2$ pwd >>>>> /usr/local/ssl/lib >>>>> >>>>> -bash-3.2$ ls >>>>> engines libcrypto.a libssl.a pkgconfig >>>>> >>>>> >>>>> Thanks, >>>>> Venu >>>>> >>>>> >>>>> >>>>> >>>>>> Date: Thu, 8 Nov 2012 21:50:21 +0100 >>>>>> From: attila.r.nohl@REDACTED >>>>>> To: erlang-questions@REDACTED >>>>>> Subject: Re: [erlang-questions] erlang fails to load crypto on solaris 10 x86_64 >>>>>> >>>>>> 2012/11/8 Venu Middela : >>>>>> >>>>>> >>>>>> >>>>>>> Steve, >>>>>>> Thanks for pointing out the correct version of crypto. >>>>>>> Could you please point to instructions on how to patch crypto to remove the >>>>>>> NIF des_ede3_cfb_crypt. >>>>>>> I couldnt find a solaris package version 0.9.8. Looked through oracle sites >>>>>>> for updated package and/or any patch that would >>>>>>> upgrade openssl to 0.9.8, but no luck. >>>>>>> >>>>>>> >>>>>>> >>>>>> Check sunfreeware.com (or one of its mirrors). For example this is a >>>>>> 0.9.8 package for Solaris 10 on x86: >>>>>> http://sunfreeware.saix.net/programlistintel10.html#openssl098p It >>>>>> seems that now the main site requires registration :-( >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>>> >>> >>> >>> > > From watson.timothy@REDACTED Tue Nov 13 12:35:02 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 13 Nov 2012 11:35:02 +0000 Subject: [erlang-questions] Fwd: phantom ports in erlang:ports() References: <50A141FB.3040503@rabbitmq.com> Message-ID: <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> Hi guys - can anyone answer this (below) please? Begin forwarded message: > From: Matthias Radestock > Subject: phantom ports in erlang:ports() > Date: 12 November 2012 18:37:47 GMT > To: erlang-questions@REDACTED > > I've got a customer system, running R15B02, which encountered system_limit errors when accepting tcp connections. > > 'lsof' indicates that there are just a few hundred file descriptors in use. However, erlang:ports() returns 1010 entries. For the majority of these ports: > - erlang:port_info(Port) returns 'undefined' > - port_close(Port) fails with 'badarg' > - exit(Port, die) doesn't make them go away > > These ports have been in that state for days. > > Does anybody have any clue what's going on here? > > Is there any way to find out more about these ports? Looks like ctrl-c'ing in the emulator shell would allow me to get more info with the 'o' option. Unfortunately the customer's emulator is running detached, so that won't work. > > Regards, > > Matthias. From tuncer.ayaz@REDACTED Tue Nov 13 13:54:19 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 13 Nov 2012 13:54:19 +0100 Subject: [erlang-questions] rebar help COMMAND In-Reply-To: <9C028843-770F-47A8-A776-FACC2141B393@gmail.com> References: <50A11D70.4090804@ninenines.eu> <9C028843-770F-47A8-A776-FACC2141B393@gmail.com> Message-ID: On Tue, Nov 13, 2012 at 9:38 AM, Tim Watson wrote: > It would help plugin authors a lot if this behaviour was implemented > in terms of reading some module metadata rather than being fixed to > a subset of internal modules only. If that is something you'd > consider. That's actually pretty much what the current draft looks like. FYI, there's an ongoing discussion on the rebar list concerning implementation details. Thanks everybody for the feedback. > On 12 Nov 2012, at 16:01, Lo?c Hoguin wrote: > >> On 11/12/2012 04:40 PM, Tuncer Ayaz wrote: >>> Is there enough interest that I should try to get this into the >>> next release? >> >> Yes. You shouldn't need to ask this. Rebar is too opaque today for >> people to figure out all the things you can do with it without >> looking at the source or cruising the web looking for the info. >> That needs fixing. From tuncer.ayaz@REDACTED Tue Nov 13 13:55:59 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 13 Nov 2012 13:55:59 +0100 Subject: [erlang-questions] Rebar dependency recursion In-Reply-To: <4154CC1E-76C4-46FC-BAE0-C0929EB86FB6@gmail.com> References: <2A5D9D78-C617-45EB-9C94-D42D437FB6C9@gmail.com> <6797EE94-D3DF-4E9F-9808-DF7C5DA6BD70@gmail.com> <2F016CC8-CB3C-4145-9D01-AE965F1E6967@gmail.com> <4ABEDA47-B6E6-4777-BFA5-5CE6660B5EAC@gmail.com> <4154CC1E-76C4-46FC-BAE0-C0929EB86FB6@gmail.com> Message-ID: On Tue, Nov 13, 2012 at 8:45 AM, Tim Watson wrote: > Works nicely for me. I didn't find bugs in any projects I tested > again and wrote a minimal plugin to test of the two behaviours an > they seemed to work as expected. Nice one! Great, thanks for testing! > On 5 Nov 2012, at 23:24, Tuncer Ayaz wrote: > >> On Mon, Nov 5, 2012 at 12:13 PM, Tim Watson wrote: >>> Dude... >>> >>> On 4 Nov 2012, at 23:56, Tuncer Ayaz wrote: >>>> On Fri, Nov 2, 2012 at 2:55 AM, Tim Watson wrote: >>>>> [snip] >>>> This could work. I'll let you all know once the prototype is ready >>>> for testing. >>> >>> You rock! :) >>> >>> Once you give the say so, I'll test all my plugins + projects >>> against your branch. >> >> Here's a quick prototype you can test: >> https://github.com/tuncer/rebar/compare/recursion >> It's not ready for merging and some of the internals are subject to >> change. >> >> We also have to discuss config inheritance and whether it should be >> made explicit or remove From stfairy@REDACTED Tue Nov 13 15:25:53 2012 From: stfairy@REDACTED (Xiao Jia) Date: Tue, 13 Nov 2012 22:25:53 +0800 Subject: [erlang-questions] Why is hybrid heap gone in R15B02? Message-ID: According to http://www.erlang.org/download/otp_src_R15B02.readme: OTP-10105 Remove all code, documentation, options and diagnostic functions which were related to the experimental hybrid heap implementation. I consider hybrid heap as a promising feature. Why is it removed? Thanks, Xiao Jia From mrkhoza@REDACTED Tue Nov 13 15:32:39 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Tue, 13 Nov 2012 16:32:39 +0200 Subject: [erlang-questions] Convert String to Integer Message-ID: Hi Erlang Developers, How do i convert string to integer in Erlang, for example; "123" to 123. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From ates@REDACTED Tue Nov 13 15:34:00 2012 From: ates@REDACTED (Artem Teslenko) Date: Tue, 13 Nov 2012 15:34:00 +0100 Subject: [erlang-questions] Convert String to Integer In-Reply-To: References: Message-ID: <20121113143400.GA13080@ipv6.dp.ua> Hi, 1> list_to_integer("123"). 123 On Tue, 13 Nov 2012, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert string to integer in Erlang, for example; "123" to 123. > > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From be.dmitry@REDACTED Tue Nov 13 15:36:50 2012 From: be.dmitry@REDACTED (Dmitry Belyaev) Date: Tue, 13 Nov 2012 18:36:50 +0400 Subject: [erlang-questions] Convert String to Integer In-Reply-To: References: Message-ID: <2512AD34-0134-4BF7-8870-BA335E632DB2@gmail.com> erlang:list_to_integer/1 -- Dmitry Belyaev On 13.11.2012, at 18:32, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert string to integer in Erlang, for example; "123" to 123. > > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Tue Nov 13 15:37:55 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Tue, 13 Nov 2012 17:37:55 +0300 Subject: [erlang-questions] Convert String to Integer In-Reply-To: References: Message-ID: 1. list_to_integer("111"). 111 2. There are no strings in Erlang as a special type, "111" is a list. From pan@REDACTED Tue Nov 13 16:38:55 2012 From: pan@REDACTED (Patrik Nyblom) Date: Tue, 13 Nov 2012 16:38:55 +0100 Subject: [erlang-questions] Why is hybrid heap gone in R15B02? In-Reply-To: References: Message-ID: <50A2698F.7090406@erlang.org> On 11/13/2012 03:25 PM, Xiao Jia wrote: > According to http://www.erlang.org/download/otp_src_R15B02.readme: > > OTP-10105 Remove all code, documentation, options and diagnostic > functions which were related to the experimental hybrid heap > implementation. > > I consider hybrid heap as a promising feature. Why is it removed? I agree it was a promising approach, but alas it was not working, had not been working for a long time and no one intended to get it working (if even possible). We cannot keep every experimental feature in the code hoping for someone to fix it one day, the code clutter would be immense... The code is still there in older versions for anyone interested. > > Thanks, > Xiao Jia Cheers, Patrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Tue Nov 13 16:55:14 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 13 Nov 2012 08:55:14 -0700 Subject: [erlang-questions] Convert String to Integer In-Reply-To: References: Message-ID: There may not be technically strings, but there is a module with "string" funs: http://www.erlang.org/doc/man/string.html wes On Tue, Nov 13, 2012 at 7:37 AM, Michael Uvarov wrote: > 1. list_to_integer("111"). > 111 > > 2. There are no strings in Erlang as a special type, "111" is a list. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Tue Nov 13 17:19:37 2012 From: pan@REDACTED (Patrik Nyblom) Date: Tue, 13 Nov 2012 17:19:37 +0100 Subject: [erlang-questions] Fwd: phantom ports in erlang:ports() In-Reply-To: <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> Message-ID: <50A27319.6040202@erlang.org> Sounds like a bug allright. Please send all relevant information, including platform, any special conditions (nif's, drivers whatnot) and any relevant logs etc to erlang_bugs or directly to me. Cheers, Patrik On 11/13/2012 12:35 PM, Tim Watson wrote: > Hi guys - can anyone answer this (below) please? > > Begin forwarded message: > >> From: Matthias Radestock >> Subject: phantom ports in erlang:ports() >> Date: 12 November 2012 18:37:47 GMT >> To: erlang-questions@REDACTED >> >> I've got a customer system, running R15B02, which encountered system_limit errors when accepting tcp connections. >> >> 'lsof' indicates that there are just a few hundred file descriptors in use. However, erlang:ports() returns 1010 entries. For the majority of these ports: >> - erlang:port_info(Port) returns 'undefined' >> - port_close(Port) fails with 'badarg' >> - exit(Port, die) doesn't make them go away >> >> These ports have been in that state for days. >> >> Does anybody have any clue what's going on here? >> >> Is there any way to find out more about these ports? Looks like ctrl-c'ing in the emulator shell would allow me to get more info with the 'o' option. Unfortunately the customer's emulator is running detached, so that won't work. >> >> Regards, >> >> Matthias. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jbothma@REDACTED Tue Nov 13 17:21:19 2012 From: jbothma@REDACTED (JD Bothma) Date: Tue, 13 Nov 2012 17:21:19 +0100 Subject: [erlang-questions] file:open(File, [ram]) Message-ID: The 'ram' option to file:open/2 seems to implement some functionality I want: to treat a file in memory as if it's a file on disk to let a library support both disk and in-memory data concisely. It doesn't look like this option is documented, but it's probably useful to many. It looks like it's used by at least erl_tar. Can this become part of the documented API of the file module? JD -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Tue Nov 13 22:01:59 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Tue, 13 Nov 2012 22:01:59 +0100 Subject: [erlang-questions] Fwd: phantom ports in erlang:ports() In-Reply-To: <50A27319.6040202@erlang.org> References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> <50A27319.6040202@erlang.org> Message-ID: 2012/11/13 Patrik Nyblom > Sounds like a bug allright. > Sounds like it yes .. A couple of things. Ports needs to flush there io-queues before terminating. If there is something in the queue when closing, the driver callback for flush will be called. If no such callback exists there might be trouble. In the case of tcp and inets there exists a tcp_inet_flush and this is callback is invoked if the queue is not empty. So what drivers are used that doesn't have flush callbacks? One exception to the flush mechanism should be exit(Port, kill). If the exit signal 'kill' is received by the port, it should die no matter what. (If I read the code correctly that is =) // Bj?rn-Egil > > Please send all relevant information, including platform, any special > conditions (nif's, drivers whatnot) and any relevant logs etc to > erlang_bugs or directly to me. > > Cheers, > Patrik > > > On 11/13/2012 12:35 PM, Tim Watson wrote: > >> Hi guys - can anyone answer this (below) please? >> >> Begin forwarded message: >> >> From: Matthias Radestock >>> Subject: phantom ports in erlang:ports() >>> Date: 12 November 2012 18:37:47 GMT >>> To: erlang-questions@REDACTED >>> >>> I've got a customer system, running R15B02, which encountered >>> system_limit errors when accepting tcp connections. >>> >>> 'lsof' indicates that there are just a few hundred file descriptors in >>> use. However, erlang:ports() returns 1010 entries. For the majority of >>> these ports: >>> - erlang:port_info(Port) returns 'undefined' >>> - port_close(Port) fails with 'badarg' >>> - exit(Port, die) doesn't make them go away >>> >>> These ports have been in that state for days. >>> >>> Does anybody have any clue what's going on here? >>> >>> Is there any way to find out more about these ports? Looks like >>> ctrl-c'ing in the emulator shell would allow me to get more info with the >>> 'o' option. Unfortunately the customer's emulator is running detached, so >>> that won't work. >>> >>> Regards, >>> >>> Matthias. >>> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Nov 13 22:14:52 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 14 Nov 2012 10:14:52 +1300 Subject: [erlang-questions] Help In-Reply-To: References: Message-ID: <46170B49-6A2F-413D-91D7-5C475AE6ADCA@cs.otago.ac.nz> On 13/11/2012, at 10:15 PM, Lucky Khoza wrote: > Good day Erlang Developers, > > I'm actually having a tuple like the one below: my question is - How do i create a function that will store this tuple in a record that i will use create tag table in ETS. > > {ok,[["\"Number of Units\"","\"Unit Price\"", "\"Delivery Date\"","\"Product Description\"", "\"Product Code\"","\"Supplier ID\""], > ["5","1505","\"2012/02/15\""," Mrs. Hollingberry\"","\"Apples 1kg Golden Delicious. The sweetest Apples! Always a favourite. Love", "1101","15"], > ["2","1423","\"2012/02/16\""," Mrs. Hollingberry\""," shame... Love", "\"Apples 1kg Green. They are very crunchy!", "1102","15"]]}. This is some of the Hollingberries data, reversed. And I have to tell you that it makes NO sense to use ETS anywhere in solving the Hollingberries problem. For each line of produce.csv, you are to produce one or more lines of output. NO information is carried from one line to the next. Having put a record into an ETS table, you would never get it out again. Now to answer your question as stated. You would NOT put that tuple in an ETS table. It has the form {ok,[L0,L1,...,Ln]} where L0 is a header line and L1...Ln are data lines. You would convert _each data line_ to a record and put _them_ into a table. Step 1 is to define a record. -record(what_you_want_to_call_the_record, { your_first_field_name, ..., your_last_field_name }). Step 2 is to write a function that converts one line to a record. The order of the fields in the file is fixed. convert([Number,Price,Delivery,Description,Code,Supplier]) -> #what_you_want_to_call_the_record{ your_first_field_name = What_You_Want_To_Put_First, ..., your_last_field_name = What_You_Want_To_Put_Last }. Step 3 is to convert the data lines in your tuple to a list of records. {ok,[_Header|Lines]} = The_Tuple_You_Showed_Us, lists:map(fun convert/1, Lines) This gives you a list of records which you can do what you please with. From ok@REDACTED Tue Nov 13 22:59:12 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 14 Nov 2012 10:59:12 +1300 Subject: [erlang-questions] Convert String to Integer In-Reply-To: References: Message-ID: On 14/11/2012, at 3:32 AM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert string to integer in Erlang, for example; "123" to 123. It is a good idea to search for an answer before asking a question on a mailing list. In this case, Googling for "convert string to integer" Erlang found http://osdir.com/ml/erlang-questions-programming/2003-03/msg00177.html in seconds. Doing such a search saves everyone's time, including yours. From mrkhoza@REDACTED Wed Nov 14 10:26:05 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Wed, 14 Nov 2012 11:26:05 +0200 Subject: [erlang-questions] Date Conversion Message-ID: Hi Erlang Developers, How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid of trailing Zero. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From ates@REDACTED Wed Nov 14 10:46:31 2012 From: ates@REDACTED (Artem Teslenko) Date: Wed, 14 Nov 2012 10:46:31 +0100 Subject: [erlang-questions] Date Conversion In-Reply-To: References: Message-ID: <20121114094631.GA32259@ipv6.dp.ua> the dirty way: 1> string:join([integer_to_list(list_to_integer(N)) || N <- string:tokens("2012/02/15", "/")], "/"). "2012/2/15" On Wed, 14 Nov 2012, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid of > trailing Zero. > > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From hobson42@REDACTED Wed Nov 14 10:55:17 2012 From: hobson42@REDACTED (Ian) Date: Wed, 14 Nov 2012 09:55:17 +0000 Subject: [erlang-questions] Date Conversion In-Reply-To: References: Message-ID: <50A36A85.9080600@gmail.com> On 14/11/2012 09:26, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert date string: "2012/02/15" to 2012/2/15, just to get > rid of trailing Zero. > Lucky, this is at least the third trivial problem you asked in recent days. Programming is the challenge of discovering how to solve a continuous series of new problems. If you don't think you would like to do that, find something else to do. If you do, go to it. How I would approach it: 1) Define the problem ACCURATELY - its leading zeroes you want to remove. 2) Find three ways to solve the problem. e.g. a) Split it up in to its parts, chop off leading zeros, reassemble. b) Its a date, so convert to binary date and convert back to formatted date using library functions. c) Parse it to remove any zero that occurs after a slash. 3) Choose the best, implement it and test it properly. Regards Ian > > Kindest Regards > Lucky > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From pan@REDACTED Wed Nov 14 11:22:45 2012 From: pan@REDACTED (Patrik Nyblom) Date: Wed, 14 Nov 2012 11:22:45 +0100 Subject: [erlang-questions] file:open(File, [ram]) In-Reply-To: References: Message-ID: <50A370F5.50407@erlang.org> Hi! On 11/13/2012 05:21 PM, JD Bothma wrote: > The 'ram' option to file:open/2 seems to implement some functionality > I want: to treat a file in memory as if it's a file on disk to let a > library support both disk and in-memory data concisely. > Yes, it's ancient functionality that has never been documented. > It doesn't look like this option is documented, but it's probably > useful to many. It looks like it's used by at least erl_tar. > > Can this become part of the documented API of the file module? Yes, absolutely - we have no intention of removing it. It also has test suites. Just submit a documentation patch on Erlang-patches and you have a documented interface! > > JD > > Cheers, Patrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Wed Nov 14 14:52:22 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Wed, 14 Nov 2012 15:52:22 +0200 Subject: [erlang-questions] Formatting Amount Message-ID: Good Erlang Developers, I would like to appreciate your assistance thus far ladies and gentlemen, it is amazing on my side. However, i would like to ask about formatting an amount, for example: R200.00, using this function io:format/2 Kind Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Wed Nov 14 15:07:04 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 14 Nov 2012 15:07:04 +0100 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes In-Reply-To: References: Message-ID: <50A3A588.1050704@ninenines.eu> Not HTTP, you don't want to have the overhead of the request and headers etc. if you are going to need them to communicate a lot. Plus your setting makes a lot of sense for distribution. Apart from that, benchmark! :) On 11/09/2012 06:20 AM, Joshua Muzaaya wrote: > > I have a setup in which two nodes are going to be communicating a lot. > On Node A, there are going to be thousands of processes, which are meant > to access services on Node B. There is going to be a massive load of > requests and responses across the two nodes. The two Nodes, will be > running on two different servers, each on its own hardware server. > > I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message > to a registered gen_server on Node B. Let me explain each option. > > *HTTP/1.1* > > Suppose that on Node A, i have an HTTP Client like |Ibrowse|, and on > Node B, i have a web server like |Yaws-1.95|, the web server being able > to handle unlimited connections, the operating system settings tweaked > to allow yaws to handle all connections. And then make my processes on > Node A to communicate using HTTP. In this case each method call, would > mean a single HTTP request and a reply. I believe there is an overhead > here, but we are evaluating options here. The erlang Built in mechanism > called |webtool|, may be built for this kind of purpose. > > *rpc:call/4* > > I could simply make direct rpc calls from Node A to Node B. I am not > very sure how the underlying rpc mechanism works , but i think that when > two erlang nodes connect via |net_adm:ping/1|, the created connection is > not closed but all rpc calls use this pipe to transmit requests and pass > responses. Please correct me on this one. > > *Sending a Message from Node A to Node B * > > I could make my processes on Node A to just send message to a registered > process, or a group of processes on Node B. This too seems a clean option. > > *Q1.* Which of the above options would you recommend and why, for an > application in which two erlang nodes are going to have enormous > communications between them all the time. Imagine a messaging system, in > which two erlang nodes are the routers :) ? > > *Q2.* Which of the above methods is cleaner, less problematic and is > more fault tolerant (i mean here that, the method should NOT have single > point of failure, that could lead to all processes on Node A blind) ? > > *Q3.* The mechanism of your choice: how would you make it even more > fault tolerant, or redundant? > > *Assumptions: * The Nodes are always alive and will never go down, the > network connection between the nodes will always be available and > non-congested (dedicated to the two nodes only) , the operating system > have allocated maximum resources to these two nodes. > > Thank you for your evaluations > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From f355@REDACTED Wed Nov 14 16:14:35 2012 From: f355@REDACTED (Konstantin Tcepliaev) Date: Wed, 14 Nov 2012 19:14:35 +0400 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes In-Reply-To: References: Message-ID: <962671352906075@web18f.yandex.ru> An HTML attachment was scrubbed... URL: From cloudzen@REDACTED Wed Nov 14 16:22:48 2012 From: cloudzen@REDACTED (skyman) Date: Wed, 14 Nov 2012 23:22:48 +0800 (CST) Subject: [erlang-questions] Fwd: How to read process's backtrace data? In-Reply-To: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> References: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> Message-ID: <66266ea6.17fad.13aff83f2c6.Coremail.cloudzen@163.com> Hi erlang developers, Can anyone answer this question please? Thanks in advance. Begin forwarded message: Hi everyone, erlang:process_display(Pid,backtrace) can display process's backtrace data. For example: (foo@REDACTED)6> erlang:process_display(self(),backtrace). Program counter: 0x00cf1498 (unknown function) CP: 0x0245e8f8 (erl_eval:do_apply/6 + 208) 0x03b1fb34 Return addr 0x01b7f060 (shell:exprs/7 + 368) y(0) [] y(1) none 0x03b1fb40 Return addr 0x01b7eb94 (shell:eval_exprs/7 + 80) y(0) [] y(1) [] y(2) cmd y(3) [] y(4) {value,#Fun} y(5) {eval,#Fun} y(6) 12305 y(7) [] y(8) [] y(9) [] 0x03b1fb6c Return addr 0x01b7e968 (shell:eval_loop/3 + 308) y(0) [] y(1) [] y(2) [] y(3) [] y(4) <0.30.0> y(5) Catch 0x01b7ec08 (shell:eval_exprs/7 + 196) 0x03b1fb88 Return addr 0x00a88f6c () y(0) 12305 y(1) <0.30.0> true However, I don't know how to read the information above, such as what do "Program counter", Return addr", "+ 368" and "y(0) y(1) ..." mean? Can anyone teach me? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From cloudzen@REDACTED Wed Nov 14 16:26:38 2012 From: cloudzen@REDACTED (skyman) Date: Wed, 14 Nov 2012 23:26:38 +0800 (CST) Subject: [erlang-questions] Fwd: How to read process's backtrace data? In-Reply-To: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> References: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> Message-ID: <6cbd5db6.18034.13aff87751b.Coremail.cloudzen@163.com> Hi erlang developers, Can anyone answer this question please? Thanks in advance. Begin forwarded message: Hi everyone, erlang:process_display(Pid,backtrace) can display process's backtrace data. For example: (foo@REDACTED)6> erlang:process_display(self(),backtrace). Program counter: 0x00cf1498 (unknown function) CP: 0x0245e8f8 (erl_eval:do_apply/6 + 208) 0x03b1fb34 Return addr 0x01b7f060 (shell:exprs/7 + 368) y(0) [] y(1) none 0x03b1fb40 Return addr 0x01b7eb94 (shell:eval_exprs/7 + 80) y(0) [] y(1) [] y(2) cmd y(3) [] y(4) {value,#Fun} y(5) {eval,#Fun} y(6) 12305 y(7) [] y(8) [] y(9) [] 0x03b1fb6c Return addr 0x01b7e968 (shell:eval_loop/3 + 308) y(0) [] y(1) [] y(2) [] y(3) [] y(4) <0.30.0> y(5) Catch 0x01b7ec08 (shell:eval_exprs/7 + 196) 0x03b1fb88 Return addr 0x00a88f6c () y(0) 12305 y(1) <0.30.0> true However, I don't know how to read the information above, such as what do "Program counter", Return addr", "+ 368" and "y(0) y(1) ..." mean? Can anyone teach me? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas@REDACTED Wed Nov 14 16:26:43 2012 From: thomas@REDACTED (Thomas Allen) Date: Wed, 14 Nov 2012 10:26:43 -0500 Subject: [erlang-questions] Date Conversion In-Reply-To: References: Message-ID: <20121114152643.GB13995@members.linode.com> On Wed, Nov 14, 2012 at 11:26:05AM +0200, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid of > trailing Zero. The obligatory regular expression-based solution. Some might find this simple look-behind assertion more direct than splitting and converting the components. 1> binary:list_to_bin(re:replace("2012/02/15", "(?<=/)0", "", [global])). <<"2012/2/15">> Thomas From francesco@REDACTED Wed Nov 14 16:27:28 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 14 Nov 2012 15:27:28 +0000 Subject: [erlang-questions] Tech Mesh London Message-ID: <50A3B860.1030907@erlang-solutions.com> If you're looking for a major Erlang event and can't wait until next year, consider Tech Mesh -- The Alternative Programming Conference. It takes place in London between the 4^th and the 6^th of December and it will go down in history with a first.Joe Armstrong, Robert Virding and Mike Williams will be together on stage for the first time, giving a joint keynote on '183 years of programming' Other (but not all) great Erlang talks: Garret Smith: Building an Application Platform: Lessons from CloudBees Stuart Bailey: Erlang and OpenFlow: A Match Made in the Cloud! Steve Vinoski: Implementing Riak in Erlang: Benefits and Challenges Chris Brown: Living in a Polyglot World: Ruby on the client, Erlang on the server Francesco Cesarini: OTP, the middleware for concurrent distributed scalable architectures Pavlo Baron: 100% Big Data. 0% Hadoop. 0% Java Jesper Richter Reichhelm: You are not alone - multiplayer games in Erlang You can now get your ticket for Tech Mesh --The Alternative Programming Conference at a 20% discount. All you need to do is register on our website using the promotion code TECHMESH_FRIEND The event covers 8 tracks and over 50 speakers among whom are Simon Peyton Jones , Philip Wadler and John Hughes -- also on a joint keynote, Rich Hickey - inventor of Clojure, Bruce Tate -- "author of 7 languages in 7 weeks", Klarna CTO David Craelius and many more.For a full list of the over 50 speakers, check out the event programme on the website: http://techmeshconf.com/techmesh-london-2012/schedule/index.jsp Hope to see you at Tech Mesh! Francesco -- Erlang Solutions Ltd. http://www.erlang-solutions.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidw@REDACTED Wed Nov 14 17:05:48 2012 From: davidw@REDACTED (David Welton) Date: Wed, 14 Nov 2012 17:05:48 +0100 Subject: [erlang-questions] C nodes and select loops Message-ID: Hi, I expected to find an answer to this one via Google, but I didn't. I'm looking at the C node example, and it does: while (loop) { got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); Which is ok if you can sit around waiting on incoming Erlang messages, but say you want to work with a select loop (or whatever form of polling/events) where you can get events from other places, as well as from other Erlang nodes. The ei_connect man page says: As with all other ei functions, you are not expected to put the socket in non blocking mode yourself in the program. Every use of non blocking mode is embedded inside the timeout functions. The socket will always be back in blocking mode after the operations are completed (regardless of the result). To avoid problems, leave the socket options alone. Ei will handle any socket options that need modification. That makes me a bit wary... Granted, there are the _tmo options, but I just wanted to ask around for advice on best practices for something like this. Thanks -- David N. Welton http://www.dedasys.com/ From comptekki@REDACTED Wed Nov 14 17:12:38 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 14 Nov 2012 09:12:38 -0700 Subject: [erlang-questions] Date Conversion In-Reply-To: References: Message-ID: On Wed, Nov 14, 2012 at 2:26 AM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid > of trailing Zero. > > > Some other examples: -module(df). -export([s/0]). s() -> Date = "2012/05/01", DateS=string:tokens(Date,"/"), io:format("~n~s~n", [rmz(DateS)]), io:format("~n~s~n", [rmz2(DateS)]). rmz([Year, Month, Day]) -> Year++"/"++chopz(Month)++"/"++chopz(Day). rmz2(Date) -> io_lib:format("~n~s/~s/~s~n", Date). chopz("0"++Num) -> Num; chopz(Num) -> Num. -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Wed Nov 14 17:15:44 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 14 Nov 2012 09:15:44 -0700 Subject: [erlang-questions] Formatting Amount In-Reply-To: References: Message-ID: On Wed, Nov 14, 2012 at 6:52 AM, Lucky Khoza wrote: > Good Erlang Developers, > > I would like to appreciate your assistance thus far ladies and gentlemen, > it is amazing on my side. > > However, i would like to ask about formatting an amount, for example: > R200.00, using this function io:format/2 > > Look at the format fun here: http://www.erlang.org/doc/man/io.html It has information on formatting characters. wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From joshmuza@REDACTED Wed Nov 14 17:21:20 2012 From: joshmuza@REDACTED (Joshua Muzaaya) Date: Wed, 14 Nov 2012 19:21:20 +0300 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes In-Reply-To: <962671352906075@web18f.yandex.ru> References: <962671352906075@web18f.yandex.ru> Message-ID: thank you so much for this feedback On Wed, Nov 14, 2012 at 6:14 PM, Konstantin Tcepliaev wrote: > Hi, > > A1: Using rpc:call/4 is definitely a worst choice, as it uses a call to > {Name, Node} with extra overhead and single registered process. HTTP > implies lots of overhead too. I'd go with {Name, Node} ! Msg. > A2-3: Suggested in A1 method can be improved by some (not so) clever usage > of erlang:monitor/2 and message passing, so that your sending node knows > whether remote registered process is alive or not, and behaves accordingly. > > Regards, > -- > Konstantin > 09.11.2012, 09:20, "Joshua Muzaaya" : > > > I have a setup in which two nodes are going to be communicating a lot. On > Node A, there are going to be thousands of processes, which are meant to > access services on Node B. There is going to be a massive load of requests > and responses across the two nodes. The two Nodes, will be running on two > different servers, each on its own hardware server. > > I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message to > a registered gen_server on Node B. Let me explain each option. > > *HTTP/1.1* > > Suppose that on Node A, i have an HTTP Client like Ibrowse, and on Node > B, i have a web server like Yaws-1.95, the web server being able to > handle unlimited connections, the operating system settings tweaked to > allow yaws to handle all connections. And then make my processes on Node A > to communicate using HTTP. In this case each method call, would mean a > single HTTP request and a reply. I believe there is an overhead here, but > we are evaluating options here. The erlang Built in mechanism called > webtool, may be built for this kind of purpose. > > *rpc:call/4* > > I could simply make direct rpc calls from Node A to Node B. I am not very > sure how the underlying rpc mechanism works , but i think that when two > erlang nodes connect via net_adm:ping/1, the created connection is not > closed but all rpc calls use this pipe to transmit requests and pass > responses. Please correct me on this one. > > *Sending a Message from Node A to Node B * > > I could make my processes on Node A to just send message to a registered > process, or a group of processes on Node B. This too seems a clean option. > > *Q1.* Which of the above options would you recommend and why, for an > application in which two erlang nodes are going to have enormous > communications between them all the time. Imagine a messaging system, in > which two erlang nodes are the routers :) ? > > *Q2.* Which of the above methods is cleaner, less problematic and is more > fault tolerant (i mean here that, the method should NOT have single point > of failure, that could lead to all processes on Node A blind) ? > > *Q3.* The mechanism of your choice: how would you make it even more fault > tolerant, or redundant? > > *Assumptions: * The Nodes are always alive and will never go down, the > network connection between the nodes will always be available and > non-congested (dedicated to the two nodes only) , the operating system have > allocated maximum resources to these two nodes. > > Thank you for your evaluations > > > > > , > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- *Muzaaya Joshua Systems Engineer +256774115170* *"Through it all, i have learned to trust in Jesus. To depend upon His Word" * -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Wed Nov 14 17:06:46 2012 From: mrkhoza@REDACTED (Lucky) Date: Wed, 14 Nov 2012 18:06:46 +0200 Subject: [erlang-questions] Print Date Message-ID: Hi Erlang Developers' I'm stuck here, I am trying to print date which is in this format "2012/04/23" using io:format/2, but I want it to be printed like this: 2012/04/23 without invited commas, how do I go about resolving this? Kindest Regards, Lucky To God Alone be the Glory...Amen. From ates@REDACTED Wed Nov 14 17:31:01 2012 From: ates@REDACTED (Artem Teslenko) Date: Wed, 14 Nov 2012 17:31:01 +0100 Subject: [erlang-questions] Print Date In-Reply-To: References: Message-ID: <20121114163101.GA8325@ipv6.dp.ua> Use ~s instead of ~p in the format argument of io:format/2: 1> io:format("~s~n", ["2012/04/23"]). 2012/04/23 On Wed, 14 Nov 2012, Lucky wrote: > Hi Erlang Developers' > > I'm stuck here, I am trying to print date which is in this format "2012/04/23" using io:format/2, but I want it to be printed like this: 2012/04/23 without invited commas, how do I go about resolving this? > > Kindest Regards, > Lucky > > To God Alone be the Glory...Amen. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From sedrik@REDACTED Wed Nov 14 17:37:00 2012 From: sedrik@REDACTED (Fredrik Andersson) Date: Wed, 14 Nov 2012 17:37:00 +0100 Subject: [erlang-questions] Print Date In-Reply-To: <20121114163101.GA8325@ipv6.dp.ua> References: <20121114163101.GA8325@ipv6.dp.ua> Message-ID: Here is a good resource on learning Erlang, please read it http://learnyousomeerlang.com/content When you know what function you need to use but want to change some minor behaviour check the documentation for it http://erldocs.com/ has a good search function for finding the documentation for most Erlang functions. On Wed, Nov 14, 2012 at 5:31 PM, Artem Teslenko wrote: > Use ~s instead of ~p in the format argument of io:format/2: > > 1> io:format("~s~n", ["2012/04/23"]). > 2012/04/23 > > On Wed, 14 Nov 2012, Lucky wrote: > > > Hi Erlang Developers' > > > > I'm stuck here, I am trying to print date which is in this format > "2012/04/23" using io:format/2, but I want it to be printed like this: > 2012/04/23 without invited commas, how do I go about resolving this? > > > > Kindest Regards, > > Lucky > > > > To God Alone be the Glory...Amen. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan.nilsson@REDACTED Wed Nov 14 17:38:58 2012 From: hakan.nilsson@REDACTED (=?ISO-8859-1?Q?H=E5kan_Nilsson?=) Date: Wed, 14 Nov 2012 17:38:58 +0100 Subject: [erlang-questions] Print Date In-Reply-To: References: Message-ID: If you run into any more problems I would recommend that you read http://www.erldocs.com before asking the mailing list. On Wed, Nov 14, 2012 at 5:06 PM, Lucky wrote: > Hi Erlang Developers' > > I'm stuck here, I am trying to print date which is in this format > "2012/04/23" using io:format/2, but I want it to be printed like this: > 2012/04/23 without invited commas, how do I go about resolving this? > > Kindest Regards, > Lucky > > To God Alone be the Glory...Amen. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- H?kan Nilsson Developer Engineering +46 70 001 27 07 klarna.se Klarna AB Norra Stationsgatan 61 11343 Stockholm +46 8 120 120 00 [image: Klarna] -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Wed Nov 14 18:06:49 2012 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 14 Nov 2012 09:06:49 -0800 Subject: [erlang-questions] C nodes and select loops In-Reply-To: References: Message-ID: <50A3CFA9.8010307@gmail.com> The main problem is handling the is calling the ei_receive (or one of the variations on this function) often enough so no node ticks are missed, such that you don't cause a nodesplit. This is the ERL_TICK shown in http://www.erlang.org/doc/tutorial/cnode.html , mentioned here http://erlang.org/doc/man/ei_connect.html#ei_receive . So, this provides a maximum time you have to process internal events, unless you create separate threads to do work internally, within your cnode. You can always set the net ticktime to be longer, but I have found that to cause problems with links between nodes (due to assumptions that seemed to exist, which may not exist now). If you are doing integration like this, consider looking at CloudI (http://cloudi.org), which helps to avoid cnode integration (cnode integration limits system scalability, because of the net ticktime). On 11/14/2012 08:05 AM, David Welton wrote: > Hi, > > I expected to find an answer to this one via Google, but I didn't. > > I'm looking at the C node example, and it does: > > while (loop) { > got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); > > Which is ok if you can sit around waiting on incoming Erlang messages, > but say you want to work with a select loop (or whatever form of > polling/events) where you can get events from other places, as well as > from other Erlang nodes. > > The ei_connect man page says: > > As with all other ei functions, you are not expected to put the socket > in non blocking mode yourself in the program. Every use of non blocking > mode is embedded inside the timeout functions. The socket will always > be back in blocking mode after the operations are completed (regardless > of the result). To avoid problems, leave the socket options alone. Ei > will handle any socket options that need modification. > > That makes me a bit wary... Granted, there are the _tmo options, but > I just wanted to ask around for advice on best practices for something > like this. > > Thanks > -- > David N. Welton > > http://www.dedasys.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From serge@REDACTED Wed Nov 14 18:18:56 2012 From: serge@REDACTED (Serge Aleynikov) Date: Wed, 14 Nov 2012 12:18:56 -0500 Subject: [erlang-questions] C nodes and select loops In-Reply-To: References: Message-ID: Unfortunately this is a shortcoming of the erl_interface library - it doesn't offer any non-blocking alternatives of socket-handling functions (e.g. erl_connect and erl_receive_msg). If you need that and are flexible about using C++ in your project, you can consider the following project which implements asynchronous communication with Erlang nodes: https://github.com/saleyn/eixx Serge On Wed, Nov 14, 2012 at 11:05 AM, David Welton wrote: > Hi, > > I expected to find an answer to this one via Google, but I didn't. > > I'm looking at the C node example, and it does: > > while (loop) { > got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); > > Which is ok if you can sit around waiting on incoming Erlang messages, > but say you want to work with a select loop (or whatever form of > polling/events) where you can get events from other places, as well as > from other Erlang nodes. > > The ei_connect man page says: > > As with all other ei functions, you are not expected to put the > socket > in non blocking mode yourself in the program. Every use of non > blocking > mode is embedded inside the timeout functions. The socket will > always > be back in blocking mode after the operations are completed > (regardless > of the result). To avoid problems, leave the socket options alone. > Ei > will handle any socket options that need modification. > > That makes me a bit wary... Granted, there are the _tmo options, but > I just wanted to ask around for advice on best practices for something > like this. > > Thanks > -- > David N. Welton > > http://www.dedasys.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Nov 14 23:04:13 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 15 Nov 2012 11:04:13 +1300 Subject: [erlang-questions] Date Conversion In-Reply-To: References: Message-ID: On 14/11/2012, at 10:26 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i convert date string: "2012/02/15" to 2012/2/15, just to get rid of trailing Zero. (1) There is no trailing zero there. (2) Date standards like ISO 8601 often *require* the leading zero. (3) {ok,[Y,M,D],[]} = io_lib:fread("~d/~d/~d", "2012/02/15"), lists:flatten(io_lib:fwrite("~w/~w/~w", [Y,M,D])) If you just want to write the result, you can use io:fwrite/[2,3] instead of io_lib:fwrite/2. In one sense, Erlang resembles C: formatted input and formatted output use formats that _look_ similar at first glance but are really quite different. Or you could think in terms of a finite state automaton with two fairly obvious states. strip_leading_zeros([$0|Cs]) -> strip_leading_zeros(Cs); strip_leading_zeros([D|Cs]) when D =< $9, D >= $1 -> [D|after_leading_zeros(Cs)]; strip_leading_zeros([C|Cs]) -> [$0,C|strip_leading_zeros(Cs)]; strip_leading_zeros([]) -> "0". after_leading_zeros([D|Cs]) when D =< $9, D >= $0 -> [D|after_leading_zeros(Cs)]; after_leading_zeros([C|Cs]) -> [C|strip_leading_zeros(Cs)]; after_leading_zeros([]) -> "". Basically, in a block of digits, leading zeros are removed, except that if all digits in the block are zero, one zero remains. Non-digit characters are copied and separate blocks. The version with the finite state automaton is almost certainly more economical, but the version using formatting is probably easier to think of and easier to debug. From ok@REDACTED Wed Nov 14 23:14:27 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 15 Nov 2012 11:14:27 +1300 Subject: [erlang-questions] Formatting Amount In-Reply-To: References: Message-ID: <3AFB7820-703B-40C0-B4DA-4C339DCD8397@cs.otago.ac.nz> On 15/11/2012, at 2:52 AM, Lucky Khoza wrote: > Good Erlang Developers, > > I would like to appreciate your assistance thus far ladies and gentlemen, it is amazing on my side. > > However, i would like to ask about formatting an amount, for example: R200.00, using this function io:format/2 Yes, that's allowed. From ok@REDACTED Wed Nov 14 23:25:41 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 15 Nov 2012 11:25:41 +1300 Subject: [erlang-questions] Print Date In-Reply-To: References: Message-ID: <9A178520-0619-46B9-8A74-F19D7C4D1417@cs.otago.ac.nz> On 15/11/2012, at 5:06 AM, Lucky wrote: > Hi Erlang Developers' > > I'm stuck here, I am trying to print date which is in this format "2012/04/23" using io:format/2, but I want it to be printed like this: 2012/04/23 without invited commas, how do I go about resolving this? READ THE MANUAL! Specifically http://www.erlang.org/doc/man/io.html#format-2 Ask yourself, "how did those quotation marks get there? What did I to that made io:format/2 think I was ASKING for them?" It looks to me as though you used ~p when you meant ~s, and in particular it looks to me as though you very likely just want to do io:put_chars(IoDevice, "2012/04/23") and not involve io:format/2 at all. (Like in C you'd use fputs() rather than fprintf().) 1> io:format(standard_io, "~p~n", ["2012/04/23"]). "2012/04/23" ok 2> io:format(standard_io, "~s~n", ["2012/04/23"]). 2012/04/23 ok 3> io:put_chars(standard_io, "2012/04/23"), io:nl(standard_io). 2012/04/23 ok Before posting one more question, PLEASE try reading the manual. From mark.geib.44@REDACTED Thu Nov 15 04:12:09 2012 From: mark.geib.44@REDACTED (Mark Geib) Date: Wed, 14 Nov 2012 20:12:09 -0700 Subject: [erlang-questions] inaccurate interval timer Message-ID: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. I am running ubuntu 12.04 fully updated with erlang R14B04. Thanks for any help or suggestions. Mark. From stfairy@REDACTED Thu Nov 15 04:37:30 2012 From: stfairy@REDACTED (Xiao Jia) Date: Thu, 15 Nov 2012 11:37:30 +0800 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> Message-ID: I think it's because Erlang is for *soft* realtime systems. A hard realtime system guarantees that a certain action will *always* be carried out in less than a certain time, while soft realtime systems let you make the sort of guarantee that "a database lookup takes less than 20ms in 97% of cases". See: http://www.erlang.org/faq/academic.html#soft-realtime Also I remember Ubuntu source repository always has a out-of-dated version so you're using R14B04. Maybe you can give a try to R15B02 by compiling from source. :-) Cheers, Xiao On Thu, Nov 15, 2012 at 11:12 AM, Mark Geib wrote: > I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. > > I am running ubuntu 12.04 fully updated with erlang R14B04. > > Thanks for any help or suggestions. > > Mark. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mark.geib.44@REDACTED Thu Nov 15 05:11:21 2012 From: mark.geib.44@REDACTED (Mark Geib) Date: Wed, 14 Nov 2012 21:11:21 -0700 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: <2F9434B6-D565-4AC2-B821-539B99CED061@gmail.com> References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> <2F9434B6-D565-4AC2-B821-539B99CED061@gmail.com> Message-ID: I was just pointing out that the log message are emitted every 25ms as indicated by the timestamp on the log messages, but the network message are being sent in a slightly shorter period. Mark. On Nov 14, 2012, at 8:59 PM, Yogish Baliga wrote: > Log messages are emitted from a different Erlang process than the process actually sending UDP message. Details are in message passing and erlang process scheduler > > -- Baliga > > > > On Nov 14, 2012, at 19:12, Mark Geib wrote: > >> I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. >> >> I am running ubuntu 12.04 fully updated with erlang R14B04. >> >> Thanks for any help or suggestions. >> >> Mark. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From chandrashekhar.mullaparthi@REDACTED Thu Nov 15 06:16:16 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 15 Nov 2012 05:16:16 +0000 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes In-Reply-To: <962671352906075@web18f.yandex.ru> References: <962671352906075@web18f.yandex.ru> Message-ID: While the message passing or RPC (which is really just message passing under the hood) approach will work, you have to be make sure you build in some overload control on the client side. Otherwise the client can easily overwhelm the server process with messages, and kill the server node. The receiving side has no built in control for overload protection. With HTTP, you can get that by letting your HTTP client do the throttling. That said, it does come with a processing overhead. cheers Chandru On 14 November 2012 15:14, Konstantin Tcepliaev wrote: > Hi, > > A1: Using rpc:call/4 is definitely a worst choice, as it uses a call to > {Name, Node} with extra overhead and single registered process. HTTP > implies lots of overhead too. I'd go with {Name, Node} ! Msg. > A2-3: Suggested in A1 method can be improved by some (not so) clever usage > of erlang:monitor/2 and message passing, so that your sending node knows > whether remote registered process is alive or not, and behaves accordingly. > > Regards, > -- > Konstantin > 09.11.2012, 09:20, "Joshua Muzaaya" : > > > I have a setup in which two nodes are going to be communicating a lot. On > Node A, there are going to be thousands of processes, which are meant to > access services on Node B. There is going to be a massive load of requests > and responses across the two nodes. The two Nodes, will be running on two > different servers, each on its own hardware server. > > I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message to > a registered gen_server on Node B. Let me explain each option. > > *HTTP/1.1* > > Suppose that on Node A, i have an HTTP Client like Ibrowse, and on Node > B, i have a web server like Yaws-1.95, the web server being able to > handle unlimited connections, the operating system settings tweaked to > allow yaws to handle all connections. And then make my processes on Node A > to communicate using HTTP. In this case each method call, would mean a > single HTTP request and a reply. I believe there is an overhead here, but > we are evaluating options here. The erlang Built in mechanism called > webtool, may be built for this kind of purpose. > > *rpc:call/4* > > I could simply make direct rpc calls from Node A to Node B. I am not very > sure how the underlying rpc mechanism works , but i think that when two > erlang nodes connect via net_adm:ping/1, the created connection is not > closed but all rpc calls use this pipe to transmit requests and pass > responses. Please correct me on this one. > > *Sending a Message from Node A to Node B * > > I could make my processes on Node A to just send message to a registered > process, or a group of processes on Node B. This too seems a clean option. > > *Q1.* Which of the above options would you recommend and why, for an > application in which two erlang nodes are going to have enormous > communications between them all the time. Imagine a messaging system, in > which two erlang nodes are the routers :) ? > > *Q2.* Which of the above methods is cleaner, less problematic and is more > fault tolerant (i mean here that, the method should NOT have single point > of failure, that could lead to all processes on Node A blind) ? > > *Q3.* The mechanism of your choice: how would you make it even more fault > tolerant, or redundant? > > *Assumptions: * The Nodes are always alive and will never go down, the > network connection between the nodes will always be available and > non-congested (dedicated to the two nodes only) , the operating system have > allocated maximum resources to these two nodes. > > Thank you for your evaluations > > > > > , > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joshmuza@REDACTED Thu Nov 15 06:41:13 2012 From: joshmuza@REDACTED (Joshua Muzaaya) Date: Thu, 15 Nov 2012 08:41:13 +0300 Subject: [erlang-questions] { ProcessName, NodeName } ! Message VS rpc:call/4 VS HTTP/1.1 across Erlang Nodes In-Reply-To: References: <962671352906075@web18f.yandex.ru> Message-ID: How do i handle over load protection on the server side ? please follow the question in detail here: http://stackoverflow.com/q/13376213/431620 On Thu, Nov 15, 2012 at 8:16 AM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > While the message passing or RPC (which is really just message passing > under the hood) approach will work, you have to be make sure you build in > some overload control on the client side. Otherwise the client can easily > overwhelm the server process with messages, and kill the server node. The > receiving side has no built in control for overload protection. > > With HTTP, you can get that by letting your HTTP client do the throttling. > That said, it does come with a processing overhead. > > cheers > Chandru > > > > On 14 November 2012 15:14, Konstantin Tcepliaev wrote: > >> Hi, >> >> A1: Using rpc:call/4 is definitely a worst choice, as it uses a call to >> {Name, Node} with extra overhead and single registered process. HTTP >> implies lots of overhead too. I'd go with {Name, Node} ! Msg. >> A2-3: Suggested in A1 method can be improved by some (not so) clever >> usage of erlang:monitor/2 and message passing, so that your sending node >> knows whether remote registered process is alive or not, and behaves >> accordingly. >> >> Regards, >> -- >> Konstantin >> 09.11.2012, 09:20, "Joshua Muzaaya" : >> >> >> I have a setup in which two nodes are going to be communicating a lot. On >> Node A, there are going to be thousands of processes, which are meant to >> access services on Node B. There is going to be a massive load of requests >> and responses across the two nodes. The two Nodes, will be running on two >> different servers, each on its own hardware server. >> >> I have 3 Options: HTTP/1.1 , rpc:call/4 and Directly sending a message to >> a registered gen_server on Node B. Let me explain each option. >> >> *HTTP/1.1* >> >> Suppose that on Node A, i have an HTTP Client like Ibrowse, and on Node >> B, i have a web server like Yaws-1.95, the web server being able to >> handle unlimited connections, the operating system settings tweaked to >> allow yaws to handle all connections. And then make my processes on Node A >> to communicate using HTTP. In this case each method call, would mean a >> single HTTP request and a reply. I believe there is an overhead here, but >> we are evaluating options here. The erlang Built in mechanism called >> webtool, may be built for this kind of purpose. >> >> *rpc:call/4* >> >> I could simply make direct rpc calls from Node A to Node B. I am not very >> sure how the underlying rpc mechanism works , but i think that when two >> erlang nodes connect via net_adm:ping/1, the created connection is not >> closed but all rpc calls use this pipe to transmit requests and pass >> responses. Please correct me on this one. >> >> *Sending a Message from Node A to Node B * >> >> I could make my processes on Node A to just send message to a registered >> process, or a group of processes on Node B. This too seems a clean option. >> >> *Q1.* Which of the above options would you recommend and why, for an >> application in which two erlang nodes are going to have enormous >> communications between them all the time. Imagine a messaging system, in >> which two erlang nodes are the routers :) ? >> >> *Q2.* Which of the above methods is cleaner, less problematic and is >> more fault tolerant (i mean here that, the method should NOT have single >> point of failure, that could lead to all processes on Node A blind) ? >> >> *Q3.* The mechanism of your choice: how would you make it even more >> fault tolerant, or redundant? >> >> *Assumptions: * The Nodes are always alive and will never go down, the >> network connection between the nodes will always be available and >> non-congested (dedicated to the two nodes only) , the operating system have >> allocated maximum resources to these two nodes. >> >> Thank you for your evaluations >> >> >> >> >> , >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- *Muzaaya Joshua Systems Engineer +256774115170* *"Through it all, i have learned to trust in Jesus. To depend upon His Word" * -------------- next part -------------- An HTML attachment was scrubbed... URL: From solomon.wzs@REDACTED Thu Nov 15 08:10:49 2012 From: solomon.wzs@REDACTED (Solomon) Date: Thu, 15 Nov 2012 15:10:49 +0800 Subject: [erlang-questions] Question of yecc Message-ID: I want to write a parser to parse the string like this: a.id = b.id a.id = 10 My yrl file like this: *Nonterminals val expr alias field. Terminals '=' '>' '>=' '<=' '<' '!=' '.' 'atom' 'num'. Rootsymbol expr. expr->val '=' val:['$1', '$3', {'opt', '='}]. expr->val '>' val:['$1', '$3', {'opt', '>'}]. expr->val '>=' val:['$1', '$3', {'opt', '>='}]. expr->val '<' val:['$1', '$3', {'opt', '<'}]. expr->val '<=' val:['$1', '$3', {'opt', '<='}]. expr->val '!=' val:['$1', '$3', {'opt', '!='}]. val->alias '.' field:{'$1', '$3'}. val->num:{'num', '$1'}. alias->atom:{'alias', '$1'}. field->atom:{'field', '$1'}.* it is ok for "a.id=b.id": *{ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, {{alias,{atom,1,b}},{field,{atom,1,id}}}, {opt,'='}]}* and it is ok for "a.id=b":* {ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, {num,{atom,1,a}}, {opt,'='}]}* but it error for "a.id=12": *{error,{1,my_parser,["syntax error before: ","12"]}}* what is wrong with my yrl file? -------------- next part -------------- An HTML attachment was scrubbed... URL: From raimo+erlang-questions@REDACTED Thu Nov 15 10:19:46 2012 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 15 Nov 2012 10:19:46 +0100 Subject: [erlang-questions] Fwd: How to read process's backtrace data? In-Reply-To: <6cbd5db6.18034.13aff87751b.Coremail.cloudzen@163.com> References: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> <6cbd5db6.18034.13aff87751b.Coremail.cloudzen@163.com> Message-ID: <20121115091946.GA14336@erix.ericsson.se> On Wed, Nov 14, 2012 at 11:26:38PM +0800, skyman wrote: > Hi erlang developers, > Can anyone answer this question please? Thanks in advance. Since there are no other takers; I hope my memory does not make me flunk misarably... "Program counter" is of course the program counter. It points to the next VM instruction to be executed. This one is fetched from the process structure and is a copy that is stored when the process is scheduled out, for example. So it is not always correct. "CP" is the continuation pointer. That is the next return address to use by a return instruction. This is a VM register so for small functions it does not have to be pushed on the stack, but if another call is made the old value has to be pushed. This causes the "Return addr" values in the stack trace to be "delayed" or off by one stack frame. You'll see shortly. y(n) is the VM notation for the 'y' register array, which is on the stack, for the current stack frame. So, we begin at the bottom, which is chronological order. To understand fully we need the assembly listing of the code... y(1) and y(0) has values - two values were pushed to the stack, then a Return addr. This is to a special internal function that every process originates from. When the process returns here you can guess what happens . The function related to these pushes is the next return addres above, since a return address first is stored in CP and not until the next call it is pushed on the stack. In this case it is shell:eval_loop/3+308. 308 is the assembly code offset after the entry point. So shell:eval_loop/3 pushes a pid() and an integer() to the stack before calling... next return address on the stack is shell:eval_exprs/7+80. Looking at shell:eval_loop/3 shows that it indeed calls shell:eval_exprs/7 and that there are two variables that have to survive the call i.e Shell and RT. These are probably a pid and an ets table id (pid() and integer()). Next stack frame. 6 variables are pushed, the first is a Catch to shell:eval_exprs/7+196. We are now in shell:eval_exprs/7 and it calls shell:exprs/6 within a try..catch. So the VM pushes a Catch and all the variables that need to survive to catch clause aparently Shell and 4 empty lists and then calls shell:exprs/6. Next return address is shell:exprs/7+368. Looking at the code for shell:exprs/6 shows that it tail recursevly calls shell:exprs/7 so that is why there is no return address of shell:exprs/6 on the stack. There were 10 variables pushed on the stack before the next call, and we were in shell:exprs/7. The next return address is the CP itself and it is erl_eval:do_apply/6+208. Looking at the code of shell:exprs/7 shows that it calls shell:expr/4, which tail recursively calls erl_eval:expr/4, which tail recursively calls erl_eval:expr/5, which tail recursively calls erl_eval:do_apply/6, so that is how we get there. That function (erl_eval:do_apply/6) apparently has pushed two variables on the stack, [] and 'none' before calling somewhere and storing itself in CP. Looking at the code shows that it calls apply(Mod, Func, As) wich is a BIF or an instruction, which probably accounts for the strange Program counter. After it has returned it will need Bs0 and RBs, which probably are the [] and 'none' values in some order. To know we need the assembly code. I do not think it is in the F({Mod,Func}, As) call since a fun which F should be should show up as a valid code position in the Program counter. I hope that helps. Summary: You need at least the source code to understand anything. The assembly code gives more clarity. It is only values that need to survive the calls that are pushed (function arguments are passed in the 'x' VM register array). The return addresses belong to the stack frame below where they occur since they are first stored in CP and then pushed in the next stack frame. > > > Begin forwarded message: > Hi everyone, > erlang:process_display(Pid,backtrace) can display process's backtrace data. For example: > (foo@REDACTED)6> erlang:process_display(self(),backtrace). > Program counter: 0x00cf1498 (unknown function) > CP: 0x0245e8f8 (erl_eval:do_apply/6 + 208) > > > 0x03b1fb34 Return addr 0x01b7f060 (shell:exprs/7 + 368) > y(0) [] > y(1) none > > > 0x03b1fb40 Return addr 0x01b7eb94 (shell:eval_exprs/7 + 80) > y(0) [] > y(1) [] > y(2) cmd > y(3) [] > y(4) {value,#Fun} > y(5) {eval,#Fun} > y(6) 12305 > y(7) [] > y(8) [] > y(9) [] > > > 0x03b1fb6c Return addr 0x01b7e968 (shell:eval_loop/3 + 308) > y(0) [] > y(1) [] > y(2) [] > y(3) [] > y(4) <0.30.0> > y(5) Catch 0x01b7ec08 (shell:eval_exprs/7 + 196) > > > 0x03b1fb88 Return addr 0x00a88f6c () > y(0) 12305 > y(1) <0.30.0> > true > > However, I don't know how to read the information above, such as what do "Program counter", Return addr", "+ 368" and "y(0) y(1) ..." mean? Can anyone teach me? > Thanks in advance! > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mrkhoza@REDACTED Thu Nov 15 14:42:42 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Thu, 15 Nov 2012 15:42:42 +0200 Subject: [erlang-questions] Division by Zero Message-ID: Hi Erlang Developers, How do i resolve division by zero errors in Erlang. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From valentin@REDACTED Thu Nov 15 14:47:26 2012 From: valentin@REDACTED (Valentin Micic) Date: Thu, 15 Nov 2012 15:47:26 +0200 Subject: [erlang-questions] Division by Zero In-Reply-To: References: Message-ID: <838CCCA7-89D0-44D9-B8D8-23C93D4ED898@pixie.co.za> Did you consider not dividing by zero? V/ On 15 Nov 2012, at 3:42 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i resolve division by zero errors in Erlang. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From enewhuis@REDACTED Thu Nov 15 15:03:04 2012 From: enewhuis@REDACTED (Eric Newhuis) Date: Thu, 15 Nov 2012 08:03:04 -0600 Subject: [erlang-questions] Division by Zero In-Reply-To: <838CCCA7-89D0-44D9-B8D8-23C93D4ED898@pixie.co.za> References: <838CCCA7-89D0-44D9-B8D8-23C93D4ED898@pixie.co.za> Message-ID: LOL I suggest three things. 1. If you are wrestling with really a higher order problem of dealing with abstract things like infinity then I suggest that you define your own number type and provide your own math functions that are well behaved in such situations, return 'infinity' for example from a custom divide(X, Y) function or some such ilk, 2. Use a guard to detect the 0 as early as possible in your code, preferably at the first point you can determine that a 0 would lead to disaster. That way the div0 would be a function clause error and you could spot the problem earlier. 3. Wrap code in a try-catch. Icky. On Nov 15, 2012, at 7:47 AM, Valentin Micic wrote: > Did you consider not dividing by zero? > > V/ > > On 15 Nov 2012, at 3:42 PM, Lucky Khoza wrote: > >> Hi Erlang Developers, >> >> How do i resolve division by zero errors in Erlang. >> >> Kindest Regards >> Lucky >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From thomas@REDACTED Thu Nov 15 15:03:43 2012 From: thomas@REDACTED (Thomas Allen) Date: Thu, 15 Nov 2012 09:03:43 -0500 Subject: [erlang-questions] Division by Zero In-Reply-To: References: Message-ID: <20121115140343.GA7114@members.linode.com> On Thu, Nov 15, 2012 at 03:42:42PM +0200, Lucky Khoza wrote: > How do i resolve division by zero errors in Erlang. You can catch errors like this with the try/catch construct, documented here: http://www.erlang.org/doc/reference_manual/expressions.html#id78820 An example for your specific case: 1> try 1 / 0 catch error:badarith -> io:format("Impossible!~n") end. Impossible! ok Note above that division by zero results in a 'badarith' error, for "bad arithmetic." You ought to refer to tutorials and the manual for basic things like these. Thomas From henrik@REDACTED Thu Nov 15 15:06:38 2012 From: henrik@REDACTED (Henrik Nord) Date: Thu, 15 Nov 2012 15:06:38 +0100 Subject: [erlang-questions] Print Date In-Reply-To: <9A178520-0619-46B9-8A74-F19D7C4D1417@cs.otago.ac.nz> References: <9A178520-0619-46B9-8A74-F19D7C4D1417@cs.otago.ac.nz> Message-ID: <50A4F6EE.5050601@erlang.org> Hi Why not encourage users of Erlang, and just help them out, or ignore those questions that you deem to "easy" to be allowed to be asked on the mailing list. There is really no reason to shout at a potential Erlang user of the year, just because he/she is just starting out with the language and does not know the ropes yet. Maybe its her first language? first time trying to program anything?, do you want to be responsible for scaring users away from the community? BE NICE ON THE MAILING LIST PLEASE To Lucky: www.erlang.org contains a lot of information including, but not limited to, the documentation. http://www.erlang.org/erldoc There is also http://learnyousomeerlang.com/ for a guide and a first look at the language. Erlang solutions also provides courses both E-lerning and classroom https://www.erlang-solutions.com/services/training On 2012-11-14 23:25, Richard O'Keefe wrote: > On 15/11/2012, at 5:06 AM, Lucky wrote: > >> Hi Erlang Developers' >> >> I'm stuck here, I am trying to print date which is in this format "2012/04/23" using io:format/2, but I want it to be printed like this: 2012/04/23 without invited commas, how do I go about resolving this? > READ THE MANUAL! > > Specifically http://www.erlang.org/doc/man/io.html#format-2 > > Ask yourself, "how did those quotation marks get there? What did I to that > made io:format/2 think I was ASKING for them?" > > It looks to me as though you used ~p when you meant ~s, > and in particular it looks to me as though you very likely > just want to do > io:put_chars(IoDevice, "2012/04/23") > and not involve io:format/2 at all. (Like in C you'd use fputs() rather > than fprintf().) > > 1> io:format(standard_io, "~p~n", ["2012/04/23"]). > "2012/04/23" > ok > 2> io:format(standard_io, "~s~n", ["2012/04/23"]). > 2012/04/23 > ok > 3> io:put_chars(standard_io, "2012/04/23"), io:nl(standard_io). > 2012/04/23 > ok > > Before posting one more question, PLEASE try reading the manual. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jrosenblum@REDACTED Thu Nov 15 15:07:45 2012 From: jrosenblum@REDACTED (James Rosenblum) Date: Thu, 15 Nov 2012 06:07:45 -0800 (PST) Subject: [erlang-questions] Division by Zero In-Reply-To: <838CCCA7-89D0-44D9-B8D8-23C93D4ED898@pixie.co.za> References: <838CCCA7-89D0-44D9-B8D8-23C93D4ED898@pixie.co.za> Message-ID: <1352988465.29173.YahooMailNeo@web181204.mail.ne1.yahoo.com> Valentin's very perceptive comment aside, you could use one of the two error handling mechanisms as in: case catch A/N of {'EXIT', {badarith,_}} -> ? ?io:format("Some error statement or whatever!~n",[]); Normal -> Normal ? ? end. or try A/N? ? ? catch error:badarith -> ? ?io:format("some statement or whatever ~p/~p~n",[A,N]); Normal -> Normal ? ? end. I'm not positive, but it seems like you might not be aware of these error handling mechanisms? ________________________________ From: Valentin Micic To: Lucky Khoza Cc: erlang-questions@REDACTED Sent: Thursday, November 15, 2012 8:47 AM Subject: Re: [erlang-questions] Division by Zero Did you consider not dividing? by zero? V/ On 15 Nov 2012, at 3:42 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i resolve division by zero errors in Erlang. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Thu Nov 15 15:46:19 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 15 Nov 2012 15:46:19 +0100 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> Message-ID: <862DC1EC-3270-4FA0-9718-3294D841EB97@erlang-solutions.com> On Nov 15, 2012, at 4:12 AM, Mark Geib wrote: > I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. Since you are only observing the odd behaviour on a single machine, I would expect that machine to be the culprit of the problem more than Erlang. It could be that the machine is running in a configuration which is slightly off. Or perhaps it is virtualized? Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From mark.geib.44@REDACTED Thu Nov 15 15:50:15 2012 From: mark.geib.44@REDACTED (Mark Geib) Date: Thu, 15 Nov 2012 07:50:15 -0700 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: <862DC1EC-3270-4FA0-9718-3294D841EB97@erlang-solutions.com> References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> <862DC1EC-3270-4FA0-9718-3294D841EB97@erlang-solutions.com> Message-ID: The machine is running on bare hardware, not virtualized. In fact all the machines I have used in the testing are copies of the same image. I am sure it is not configuration. Is it possible that the issue is the clock of the computer it's self.? Since is is synchronized via NTP we never see clock drift. On Nov 15, 2012, at 7:46 AM, Jesper Louis Andersen wrote: > > On Nov 15, 2012, at 4:12 AM, Mark Geib wrote: > >> I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. > > Since you are only observing the odd behaviour on a single machine, I would expect that machine to be the culprit of the problem more than Erlang. It could be that the machine is running in a configuration which is slightly off. Or perhaps it is virtualized? > > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen > > > From siraaj@REDACTED Thu Nov 15 15:56:41 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Thu, 15 Nov 2012 09:56:41 -0500 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> <862DC1EC-3270-4FA0-9718-3294D841EB97@erlang-solutions.com> Message-ID: <1EB93937-0495-438F-A6FA-E4D5F8A173AC@khandkar.net> Same OS image? What about hardware? One of the things I'd try, is swapping NICs and see if the behavior follows it. On Nov 15, 2012, at 9:50 AM, Mark Geib wrote: > The machine is running on bare hardware, not virtualized. In fact all the machines I have used in the testing are copies of the same image. I am sure it is not configuration. Is it possible that the issue is the clock of the computer it's self.? Since is is synchronized via NTP we never see clock drift. > > On Nov 15, 2012, at 7:46 AM, Jesper Louis Andersen wrote: > >> >> On Nov 15, 2012, at 4:12 AM, Mark Geib wrote: >> >>> I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. >> >> Since you are only observing the odd behaviour on a single machine, I would expect that machine to be the culprit of the problem more than Erlang. It could be that the machine is running in a configuration which is slightly off. Or perhaps it is virtualized? >> >> Jesper Louis Andersen >> Erlang Solutions Ltd., Copenhagen -- Siraaj Khandkar .o. ..o ooo From hobson42@REDACTED Thu Nov 15 16:56:01 2012 From: hobson42@REDACTED (Ian) Date: Thu, 15 Nov 2012 15:56:01 +0000 Subject: [erlang-questions] inaccurate interval timer In-Reply-To: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> References: <333A1614-5AC2-46FD-BD3F-6FF2679DD59C@gmail.com> Message-ID: <50A51091.2090908@gmail.com> On 15/11/2012 03:12, Mark Geib wrote: > I am using timer:send_interval(..) to generate recurring messages that drive the sending of UDP packets at a given rate. However, using a network analyzer I am observing that the network datagrams are being sent at a rate greater than the intended rate. Log messages with timestamps indicate the erlang code is sending the datagrams at the proper time. So the question is whether the erlang VM could possibly have a clock that is "tic-ing" at a incorrect frequency, or this an issue with the underlying OS, linux in this case. The interval of the timer is set to 25ms, I am observing times of 23.7-24.5ms. Also, this is only happening on a single machine, testing on four other machines confirms proper rates are being generated. > > Hi Mark, This would happen if the hardware clock is used for one purpose while the software clock is used for the other, and they are running at different speeds. If ntp is re-syncing them regularly you won't get the clocks getting way out of step. I would check that the rogue machine is not over-clocked, has the correct multiplier set in the BIOS. Also disable ntp and see if the clocks get out of step. 1 /25 would amount to about an hour a day. Regards Ian From avalormaquedano@REDACTED Thu Nov 15 17:35:27 2012 From: avalormaquedano@REDACTED (=?ISO-8859-1?B?wWx2YXJv?=) Date: Thu, 15 Nov 2012 17:35:27 +0100 Subject: [erlang-questions] Question of yecc In-Reply-To: References: Message-ID: Hi, I think the problem is that yecc does not recognize the terminal 'num'. The default scanner recognizes 'integer' and 'float'. Change your 'num' for 'integer' and try again. Best, ?lvaro 2012/11/15 Solomon > I want to write a parser to parse the string like this: > a.id = b.id > a.id = 10 > > My yrl file like this: > *Nonterminals > val expr alias field. > > Terminals > '=' '>' '>=' '<=' '<' '!=' '.' 'atom' > 'num'. > > Rootsymbol > expr. > > expr->val '=' val:['$1', '$3', {'opt', '='}]. > expr->val '>' val:['$1', '$3', {'opt', '>'}]. > expr->val '>=' val:['$1', '$3', {'opt', '>='}]. > expr->val '<' val:['$1', '$3', {'opt', '<'}]. > expr->val '<=' val:['$1', '$3', {'opt', '<='}]. > expr->val '!=' val:['$1', '$3', {'opt', '!='}]. > > val->alias '.' field:{'$1', '$3'}. > val->num:{'num', '$1'}. > > alias->atom:{'alias', '$1'}. > field->atom:{'field', '$1'}.* > > it is ok for "a.id=b.id": > *{ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, > {{alias,{atom,1,b}},{field,{atom,1,id}}}, > {opt,'='}]}* > > and it is ok for "a.id=b":* > {ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, > {num,{atom,1,a}}, > {opt,'='}]}* > > but it error for "a.id=12": > *{error,{1,my_parser,["syntax error before: ","12"]}}* > > what is wrong with my yrl file? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Nov 15 23:16:27 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 16 Nov 2012 11:16:27 +1300 Subject: [erlang-questions] Division by Zero In-Reply-To: References: Message-ID: On 16/11/2012, at 2:42 AM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do i resolve division by zero errors in Erlang. Could you please tell us what you actually mean? For example, I "resolve" division by zero errors in C by making sure they simply never happen in the first place. Come to think of it, that's how I "resolve" division by zero errors in Java, Smalltalk, Lisp, Fortran, AWK, Python, and Erlang as well. Some errors are symptoms of bad programming and just plain _shouldn't_ be caught by handlers in your code lest you hide mistakes. Part of Erlang design philosophy is that it is much better for a process to crash promptly than to keep on going with imaginary or otherwise incorrect data. If your question is "given that a division by zero has NOT been prevented, and has occurred, how do I catch it and how do I tell that a division by zero is the thing that happened?" So have you read chapter 10 of the Erlang reference manual? http://www.erlang.org/doc/reference_manual/errors.html This lists the predefined exit reasons in table 10.2 with their causes. It says in section 10.3 how to handle such errors. But I repeat: it is better to *prevent* errors rather than catch them, if an error that you *could* have prevented is caught, you will probably regret it, and you should never handle an exception unless you really can honestly recover *fully* and continue sanely. From per@REDACTED Thu Nov 15 23:44:31 2012 From: per@REDACTED (Per Hedeland) Date: Thu, 15 Nov 2012 23:44:31 +0100 (CET) Subject: [erlang-questions] inaccurate interval timer In-Reply-To: Message-ID: <201211152244.qAFMiV3x058301@pluto.hedeland.org> Mark Geib wrote: > >The machine is running on bare hardware, not virtualized. In fact all the machines I have used in the testing are copies of the same image. I am sure it is not configuration. Is it possible that the issue is the clock of the computer it's self.? Since is is synchronized via NTP we never see clock drift. I think you're on the right track there - I would say that the most likely cause for the behavior you see is that the OS clock has been stepped forward while the Erlang VM was running, and that it's doing its "gradual catchup" scheme by running "erlang time" 1% faster than "real" time - see the description of the +c argument in the erl(1) man page. Running NTP is no guarantee against time steps (by default NTP will step the system clock if it is more than 128 ms off), although when it is functioning correctly there should be at most a single step at boot time. However some computers have bad enough clocks that NTP is unable to keep them sane by the normal "smooth" adjustment (at most 500 ppm) and is forced to keep stepping them. Normally it should log such steps to /var/log/messages or the like, though. Anyway, you should be able to check this theory out (assuming you can get a shell or equivalent) by comparing the return values from erlang:now/0 ("compensated" time) and os:timestamp/0 (straight off the OS clock) - e.g. as timer:now_diff(now(), os:timestamp()). There will always be some microseconds of diff due to the calls being made in sequence, of course. Also stopping and starting the VM should get rid of any diff and thereby the "catchup" scheme - until the clock is stepped again... --Per Hedeland From solomon.wzs@REDACTED Fri Nov 16 02:27:52 2012 From: solomon.wzs@REDACTED (Solomon) Date: Fri, 16 Nov 2012 09:27:52 +0800 Subject: [erlang-questions] Question of yecc In-Reply-To: References: Message-ID: Thanks, you are right. Maybe I should try to write a xrl file to do the lexical analysis. 2012/11/16 ?lvaro > Hi, > > I think the problem is that yecc does not recognize the terminal 'num'. > The default scanner recognizes 'integer' and 'float'. > Change your 'num' for 'integer' and try again. > > Best, > ?lvaro > > 2012/11/15 Solomon > >> I want to write a parser to parse the string like this: >> a.id = b.id >> a.id = 10 >> >> My yrl file like this: >> *Nonterminals >> val expr alias field. >> >> Terminals >> '=' '>' '>=' '<=' '<' '!=' '.' 'atom' >> 'num'. >> >> Rootsymbol >> expr. >> >> expr->val '=' val:['$1', '$3', {'opt', '='}]. >> expr->val '>' val:['$1', '$3', {'opt', '>'}]. >> expr->val '>=' val:['$1', '$3', {'opt', '>='}]. >> expr->val '<' val:['$1', '$3', {'opt', '<'}]. >> expr->val '<=' val:['$1', '$3', {'opt', '<='}]. >> expr->val '!=' val:['$1', '$3', {'opt', '!='}]. >> >> val->alias '.' field:{'$1', '$3'}. >> val->num:{'num', '$1'}. >> >> alias->atom:{'alias', '$1'}. >> field->atom:{'field', '$1'}.* >> >> it is ok for "a.id=b.id": >> *{ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, >> {{alias,{atom,1,b}},{field,{atom,1,id}}}, >> {opt,'='}]}* >> >> and it is ok for "a.id=b":* >> {ok,[{{alias,{atom,1,a}},{field,{atom,1,id}}}, >> {num,{atom,1,a}}, >> {opt,'='}]}* >> >> but it error for "a.id=12": >> *{error,{1,my_parser,["syntax error before: ","12"]}}* >> >> what is wrong with my yrl file? >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shankar_patil@REDACTED Fri Nov 16 05:12:26 2012 From: shankar_patil@REDACTED (Shankar Patil) Date: Fri, 16 Nov 2012 04:12:26 +0000 Subject: [erlang-questions] getting error in erlang In-Reply-To: References: <8C29E01908962B4095A9044AE0F89A40434A2A56@HJ-MBX2.persistent.co.in> Message-ID: <8C29E01908962B4095A9044AE0F89A40434AA138@HJ-MBX2.persistent.co.in> GCC version gcc version 4.7.2 (GCC) Configure output attached. Please check and revert. Regards, Shankar Patil From: Gustav Simonsson [mailto:gustav.simonsson@REDACTED] Sent: Saturday, November 10, 2012 9:27 PM To: Shankar Patil Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] getting error in erlang What version of GCC are you using? Also, can you include the output from running ./configure ? Cheers, Gustav Simonsson On Fri, Nov 9, 2012 at 11:17 AM, Shankar Patil > wrote: Hello All, I am compiling erlang otp_src_R15B on aix 6.1 machine. Getting below errors. ../include/internal/ethread.h: In function 'ethr_spin_lock__': ../include/internal/ethread.h:555: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:344: error: parse error before 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: type defaults to 'int' in declaration of 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: data definition has no type or storage class common/ethr_aux.c:529: error: parse error before '*' token common/ethr_aux.c:530: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_init': common/ethr_aux.c:537: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:541: error: parse error before '*' token common/ethr_aux.c:542: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_destroy': common/ethr_aux.c:553: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:557: error: parse error before '*' token common/ethr_aux.c:558: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_unlock': common/ethr_aux.c:561: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:565: error: parse error before '*' token common/ethr_aux.c:566: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_lock': common/ethr_aux.c:569: error: 'lock' undeclared (first use in this function) gmake[5]: *** [obj/rs6000-ibm-aix/opt/r/ethr_aux.o] Error 1 gmake[5]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[4]: *** [opt] Error 2 gmake[4]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[3]: *** [erts_lib] Error 2 gmake[3]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[1]: *** [smp] Error 2 gmake[1]: Leaving directory `/opt/otp_src_R15B/erts' gmake: *** [emulator] Error 2 can you please help out ? Regards, Shankar Patil DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: configure.txt URL: From valentin@REDACTED Fri Nov 16 07:29:21 2012 From: valentin@REDACTED (Valentin Micic) Date: Fri, 16 Nov 2012 08:29:21 +0200 Subject: [erlang-questions] phantom ports in erlang:ports() In-Reply-To: <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> Message-ID: <5D3EBEE6-93C1-4231-A5B8-994C59C25F8C@pixie.co.za> I am wondering if this may be attributed to CLOSE_WAIT/TIME_WAIT states sockets may be in during the connection shutdown? By the some token, if the server in question has a higher frequency of short-lived connections, this may also explain discrepancy between number of file descriptors as reported by lsof and number of active ports reported by emulator. Just speculating, of course. V/ On 13 Nov 2012, at 1:35 PM, Tim Watson wrote: > Hi guys - can anyone answer this (below) please? > > Begin forwarded message: > >> From: Matthias Radestock >> Subject: phantom ports in erlang:ports() >> Date: 12 November 2012 18:37:47 GMT >> To: erlang-questions@REDACTED >> >> I've got a customer system, running R15B02, which encountered system_limit errors when accepting tcp connections. >> >> 'lsof' indicates that there are just a few hundred file descriptors in use. However, erlang:ports() returns 1010 entries. For the majority of these ports: >> - erlang:port_info(Port) returns 'undefined' >> - port_close(Port) fails with 'badarg' >> - exit(Port, die) doesn't make them go away >> >> These ports have been in that state for days. >> >> Does anybody have any clue what's going on here? >> >> Is there any way to find out more about these ports? Looks like ctrl-c'ing in the emulator shell would allow me to get more info with the 'o' option. Unfortunately the customer's emulator is running detached, so that won't work. >> >> Regards, >> >> Matthias. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jesper.louis.andersen@REDACTED Fri Nov 16 10:32:13 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 16 Nov 2012 10:32:13 +0100 Subject: [erlang-questions] phantom ports in erlang:ports() In-Reply-To: <5D3EBEE6-93C1-4231-A5B8-994C59C25F8C@pixie.co.za> References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> <5D3EBEE6-93C1-4231-A5B8-994C59C25F8C@pixie.co.za> Message-ID: On Nov 16, 2012, at 7:29 AM, Valentin Micic wrote: > I am wondering if this may be attributed to CLOSE_WAIT/TIME_WAIT states sockets may be in during the connection shutdown? > By the some token, if the server in question has a higher frequency of short-lived connections, this may also explain discrepancy between number of file descriptors as reported by lsof and number of active ports reported by emulator. > TIME_WAIT is not a problem. It is just the kernel keeping track of the connection if packets get sent still by the other end. CLOSE_WAIT on the other hand sounds bad. This state should happen when the other end has sent a FIN and started to close down the socket, but the application (i.e., Erlang?) has not closed the socket down yet. If you have lingering CLOSE_WAITs that are there for a long time it is usually a warning sign that something may be bad. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen From valentin@REDACTED Fri Nov 16 10:40:23 2012 From: valentin@REDACTED (Valentin Micic) Date: Fri, 16 Nov 2012 11:40:23 +0200 Subject: [erlang-questions] phantom ports in erlang:ports() In-Reply-To: References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> <5D3EBEE6-93C1-4231-A5B8-994C59C25F8C@pixie.co.za> Message-ID: <5A09DE72-98C6-4519-A915-241AB28DDA14@pixie.co.za> I guess, a more interesting questions is weather or not sockets in this state may be seen as "phantom" ports? V/ On 16 Nov 2012, at 11:32 AM, Jesper Louis Andersen wrote: > > > On Nov 16, 2012, at 7:29 AM, Valentin Micic wrote: > >> I am wondering if this may be attributed to CLOSE_WAIT/TIME_WAIT states sockets may be in during the connection shutdown? >> By the some token, if the server in question has a higher frequency of short-lived connections, this may also explain discrepancy between number of file descriptors as reported by lsof and number of active ports reported by emulator. >> > > TIME_WAIT is not a problem. It is just the kernel keeping track of the connection if packets get sent still by the other end. CLOSE_WAIT on the other hand sounds bad. This state should happen when the other end has sent a FIN and started to close down the socket, but the application (i.e., Erlang?) has not closed the socket down yet. > > If you have lingering CLOSE_WAITs that are there for a long time it is usually a warning sign that something may be bad. > > Jesper Louis Andersen > Erlang Solutions Ltd., Copenhagen > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Fri Nov 16 11:25:44 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 16 Nov 2012 10:25:44 +0000 Subject: [erlang-questions] phantom ports in erlang:ports() In-Reply-To: <5A09DE72-98C6-4519-A915-241AB28DDA14@pixie.co.za> References: <50A141FB.3040503@rabbitmq.com> <9894734D-6D6A-409E-ACCC-F4153ADA76F4@gmail.com> <5D3EBEE6-93C1-4231-A5B8-994C59C25F8C@pixie.co.za> <5A09DE72-98C6-4519-A915-241AB28DDA14@pixie.co.za> Message-ID: I can't get to the issue tracker right this moment, but these sockets are stuck in CLOSE_WAIT for a long time. The customer reports normally having circa 80?20 live connections, most of them listeners that do not close the sockets. Under normal conditions, there are no CLOSE_WAIT sockets showing up at all. The customer also reports that even when the CLOSE_WAIT connections drop off that no further connections can be established, and we see some rather delightful errors coming back from these 'phantom' ports: {inet_async,#Port<0.5808>,25398,{error,system_limit}} but the system limits are *not* reached by any stretch of the imagination: {file_descriptors, [{total_limit,924}, {total_used,126}, {sockets_limit,829}, {sockets_used,56}]}, {processes,[{limit,1048576},{used,693}]}... So this is more than just sockets stuck in CLOSE_WAIT by the looks of things. On 16 Nov 2012, at 09:40, Valentin Micic wrote: > I guess, a more interesting questions is weather or not sockets in this state may be seen as "phantom" ports? > > V/ > > On 16 Nov 2012, at 11:32 AM, Jesper Louis Andersen wrote: > >> >> >> On Nov 16, 2012, at 7:29 AM, Valentin Micic wrote: >> >>> I am wondering if this may be attributed to CLOSE_WAIT/TIME_WAIT states sockets may be in during the connection shutdown? >>> By the some token, if the server in question has a higher frequency of short-lived connections, this may also explain discrepancy between number of file descriptors as reported by lsof and number of active ports reported by emulator. >>> >> >> TIME_WAIT is not a problem. It is just the kernel keeping track of the connection if packets get sent still by the other end. CLOSE_WAIT on the other hand sounds bad. This state should happen when the other end has sent a FIN and started to close down the socket, but the application (i.e., Erlang?) has not closed the socket down yet. >> >> If you have lingering CLOSE_WAITs that are there for a long time it is usually a warning sign that something may be bad. >> >> Jesper Louis Andersen >> Erlang Solutions Ltd., Copenhagen >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Fri Nov 16 11:27:42 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 16 Nov 2012 13:27:42 +0300 Subject: [erlang-questions] Binary matching: <> and <> Message-ID: Hi. There are two forms of matching binaries, that are not supported: extract_string(<>) -> String. extract_postfix(<>, Prefix) -> Postfix. Second one is perhaps too hard to implement, but first one seems to be not to hard (we just match end of binary on known offset and match beginning). Why aren't these cases implemented? Is it just "nobody wanted it yet" or there is some serious reason not to do it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbenac@REDACTED Fri Nov 16 12:18:33 2012 From: cbenac@REDACTED (Clara Benac Earle) Date: Fri, 16 Nov 2012 12:18:33 +0100 Subject: [erlang-questions] [ANN] 5th Madrid Erlounge Message-ID: <50A62109.4070802@fi.upm.es> It is with great pleasure that we announce the 5th Madrid Erlounge. *When:* November 27th 2012 19:15 (talk starts at 19:30) *Where:* Sala de Grados (1? planta Facultad de Inform?tica, Universidad Complutense de Madrid) (http://gpd.sip.ucm.es/fraguas/wflp06/campus_ucm.jpg) *Who: *Lars-Ake Fredlund Lars-Ake Fredlund (http://babel.ls.fi.upm.es/~fred/index.html) is a lecturer and researcher at the Universidad Polit?cnica of Madrid. His research interests include the use of formal techniques for constructing functionally correct and secure distributed software applications. He was awarded a PhD in 2001 from the Royal Institute of Technology, Stockholm for his thesis "A Framework for Reasoning about Erlang Code". Recently Fredlund has participated in the EU financed ProTest (http://www.protest-project.eu/) and Prowess projects (http://www.prowessproject.eu/), which both attempt to improve testing practices in the software industry using Erlang technology. *Abstract:* Lars-Ake will present Quviq QuickCheck, a testing tool created by the company Quviq (http://www.quviq.com/). The main functionality of the tool is the (random) generation of test cases from semi-formal description of the software under test. QuickCheck has been used extensively in industry, with very promising results. In the talk Fredlund will give an overview of QuickCheck, including a short demo. Besides the talk, there will be some time to discuss other topics, for instance, the latest news from the Erlang community in Spain and abroad, and planning further activities. As usual, we will meet afterwards for some tapas and drinks. Welcome! Clara -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbenac@REDACTED Fri Nov 16 12:19:48 2012 From: cbenac@REDACTED (Clara Benac Earle) Date: Fri, 16 Nov 2012 12:19:48 +0100 Subject: [erlang-questions] [ANN] 5th Madrid Erlounge Message-ID: <50A62154.9060801@fi.upm.es> It is with great pleasure that we announce the 5th Madrid Erlounge. *When:* November 27th 2012 19:15 (talk starts at 19:30) *Where:* Sala de Grados (1? planta Facultad de Inform?tica, Universidad Complutense de Madrid) (http://gpd.sip.ucm.es/fraguas/wflp06/campus_ucm.jpg) *Who: *Lars-Ake Fredlund Lars-Ake Fredlund (http://babel.ls.fi.upm.es/~fred/index.html) is a lecturer and researcher at the Universidad Polit?cnica of Madrid. His research interests include the use of formal techniques for constructing functionally correct and secure distributed software applications. He was awarded a PhD in 2001 from the Royal Institute of Technology, Stockholm for his thesis "A Framework for Reasoning about Erlang Code". Recently Fredlund has participated in the EU financed ProTest (http://www.protest-project.eu/) and Prowess projects (http://www.prowessproject.eu/), which both attempt to improve testing practices in the software industry using Erlang technology. *Abstract:* Lars-Ake will present Quviq QuickCheck, a testing tool created by the company Quviq (http://www.quviq.com/). The main functionality of the tool is the (random) generation of test cases from semi-formal description of the software under test. QuickCheck has been used extensively in industry, with very promising results. In the talk Fredlund will give an overview of QuickCheck, including a short demo. Besides the talk, there will be some time to discuss other topics, for instance, the latest news from the Erlang community in Spain and abroad, and planning further activities. As usual, we will meet afterwards for some tapas and drinks. Welcome! Clara -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Fri Nov 16 13:47:37 2012 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 16 Nov 2012 04:47:37 -0800 (PST) Subject: [erlang-questions] Print Date In-Reply-To: <50A4F6EE.5050601@erlang.org> References: <9A178520-0619-46B9-8A74-F19D7C4D1417@cs.otago.ac.nz> <50A4F6EE.5050601@erlang.org> Message-ID: <1353070057.32441.YahooMailNeo@web120706.mail.ne1.yahoo.com> Here's my honest advice to the guy who has been sending us his homework: For these kinds of problems, ask your tutor.? And as a bonus, here's something that may help homework guy out, hopefully before he will be inflicted on the world as a contractor:?http://catb.org/~esr/faqs/smart-questions.html Best, Thomas ----- Original Message ----- > From: Henrik Nord > To: Richard O'Keefe > Cc: "erlang-questions@REDACTED" > Sent: Thursday, November 15, 2012 3:06 PM > Subject: Re: [erlang-questions] Print Date > > Hi > > Why not encourage users of Erlang, and just help them out, or ignore > those questions that you deem to "easy" to be allowed to be asked on > the > mailing list. > > There is really no reason to shout at a potential Erlang user of the > year, just because he/she is just starting out with the language and > does not know the ropes yet. Maybe its her first language? first time > trying to program anything?, do you want to be responsible for scaring > users away from the community? > > BE NICE ON THE MAILING LIST PLEASE > > > To Lucky: > www.erlang.org contains a lot of information including, but not limited > to, the documentation. > http://www.erlang.org/erldoc > > There is also http://learnyousomeerlang.com/ for a guide and a first > look at the language. > > Erlang solutions also provides courses both E-lerning and classroom > > https://www.erlang-solutions.com/services/training > > > > On 2012-11-14 23:25, Richard O'Keefe wrote: >> On 15/11/2012, at 5:06 AM, Lucky wrote: >> >>> Hi Erlang Developers' >>> >>> I'm stuck here, I am trying to print date which is in this format > "2012/04/23" using io:format/2, but I want it to be printed like this: > 2012/04/23 without invited commas, how do I go about resolving this? >> READ THE MANUAL! >> >> Specifically http://www.erlang.org/doc/man/io.html#format-2 >> >> Ask yourself, "how did those quotation marks get there?? What did I to > that >> made io:format/2 think I was ASKING for them?" >> >> It looks to me as though you used ~p when you meant ~s, >> and in particular it looks to me as though you very likely >> just want to do >> ??? io:put_chars(IoDevice, "2012/04/23") >> and not involve io:format/2 at all.? (Like in C you'd use fputs() > rather >> than fprintf().) >> >> 1> io:format(standard_io, "~p~n", ["2012/04/23"]). >> "2012/04/23" >> ok >> 2> io:format(standard_io, "~s~n", ["2012/04/23"]). >> 2012/04/23 >> ok >> 3> io:put_chars(standard_io, "2012/04/23"), > io:nl(standard_io). >> 2012/04/23 >> ok >> >> Before posting one more question, PLEASE try reading the manual. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From kunthar@REDACTED Fri Nov 16 13:55:10 2012 From: kunthar@REDACTED (Kunthar) Date: Fri, 16 Nov 2012 14:55:10 +0200 Subject: [erlang-questions] [ANN] Erlang Turkish User Group Message-ID: Hi all, Small group of Erlang users and beginners organized a mailing list for Turkey. You can reach the group mail list from here: https://groups.google.com/group/erlang-turkey -- BR, \|/ Kunthar From tony@REDACTED Fri Nov 16 14:46:47 2012 From: tony@REDACTED (Tony Rogvall) Date: Fri, 16 Nov 2012 14:46:47 +0100 Subject: [erlang-questions] Print Date In-Reply-To: <50A4F6EE.5050601@erlang.org> References: <9A178520-0619-46B9-8A74-F19D7C4D1417@cs.otago.ac.nz> <50A4F6EE.5050601@erlang.org> Message-ID: <5C9D1C2B-B673-4B4F-997F-58D744BF9E29@rogvall.se> +1 But maybe Lucky is some new kind of bot ? /Tony On 15 nov 2012, at 15:06, Henrik Nord wrote: > Hi > > Why not encourage users of Erlang, and just help them out, or ignore those questions that you deem to "easy" to be allowed to be asked on the mailing list. > > There is really no reason to shout at a potential Erlang user of the year, just because he/she is just starting out with the language and does not know the ropes yet. Maybe its her first language? first time trying to program anything?, do you want to be responsible for scaring users away from the community? > > BE NICE ON THE MAILING LIST PLEASE > > > To Lucky: > www.erlang.org contains a lot of information including, but not limited to, the documentation. > http://www.erlang.org/erldoc > > There is also http://learnyousomeerlang.com/ for a guide and a first look at the language. > > Erlang solutions also provides courses both E-lerning and classroom > > https://www.erlang-solutions.com/services/training > > > > On 2012-11-14 23:25, Richard O'Keefe wrote: >> On 15/11/2012, at 5:06 AM, Lucky wrote: >> >>> Hi Erlang Developers' >>> >>> I'm stuck here, I am trying to print date which is in this format "2012/04/23" using io:format/2, but I want it to be printed like this: 2012/04/23 without invited commas, how do I go about resolving this? >> READ THE MANUAL! >> >> Specifically http://www.erlang.org/doc/man/io.html#format-2 >> >> Ask yourself, "how did those quotation marks get there? What did I to that >> made io:format/2 think I was ASKING for them?" >> >> It looks to me as though you used ~p when you meant ~s, >> and in particular it looks to me as though you very likely >> just want to do >> io:put_chars(IoDevice, "2012/04/23") >> and not involve io:format/2 at all. (Like in C you'd use fputs() rather >> than fprintf().) >> >> 1> io:format(standard_io, "~p~n", ["2012/04/23"]). >> "2012/04/23" >> ok >> 2> io:format(standard_io, "~s~n", ["2012/04/23"]). >> 2012/04/23 >> ok >> 3> io:put_chars(standard_io, "2012/04/23"), io:nl(standard_io). >> 2012/04/23 >> ok >> >> Before posting one more question, PLEASE try reading the manual. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From straightflush@REDACTED Fri Nov 16 15:28:39 2012 From: straightflush@REDACTED (AD) Date: Fri, 16 Nov 2012 09:28:39 -0500 Subject: [erlang-questions] recommended ways to pass config to a dep app Message-ID: Hello, I am abstracting some code into a "library" that can be included in other applications. This library requires a fair bit of config options, what is the recommended approach here when starting it up? I noticed some libraries like cowboy, you pass all the configs into the main start_http() method, others use include files. Is there a preferred mechanism here when there are 20-25 config options for the included application? Cheers -AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri Nov 16 15:35:55 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 16 Nov 2012 17:35:55 +0300 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: application:load(stockdb), application:set_env(stockdb, key, value), application:start(stockdb), On Fri, Nov 16, 2012 at 6:28 PM, AD wrote: > Hello, > > I am abstracting some code into a "library" that can be included in other > applications. This library requires a fair bit of config options, what is > the recommended approach here when starting it up? > > I noticed some libraries like cowboy, you pass all the configs into the > main start_http() method, others use include files. > > Is there a preferred mechanism here when there are 20-25 config options > for the included application? > > Cheers > -AD > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri Nov 16 15:35:42 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 16 Nov 2012 08:35:42 -0600 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: On Fri, Nov 16, 2012 at 8:28 AM, AD wrote: > Hello, > > I am abstracting some code into a "library" that can be included in other > applications. This library requires a fair bit of config options, what is > the recommended approach here when starting it up? > > I noticed some libraries like cowboy, you pass all the configs into the > main start_http() method, others use include files. > > Is there a preferred mechanism here when there are 20-25 config options for > the included application? The canonical approach is explained here: http://www.erlang.org/doc/design_principles/applications.html#id74117 The inets application is a good example of how one can hide a lot of complexity behind the application abstraction, and use Erlang's standard app config mechanism to customize behavior. Garrett From g@REDACTED Fri Nov 16 16:09:58 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 16 Nov 2012 09:09:58 -0600 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: On Fri, Nov 16, 2012 at 8:35 AM, Max Lapshin wrote: > application:load(stockdb), > application:set_env(stockdb, key, value), > application:start(stockdb), Though this pattern just shifts the question -- where does Value come from? If you use the standard pattern in Erlang of application config files, Value is defined in that file and the application can use application:get_env without the additional burden of app config management. IMO application:start/1 is also a bad smell outside dev/test modes. When you deploy as an Erlang release, applications are started by the init system process. That said, doing releases in Erlang is *still very painful*, so it's understandable that there's a lot of roll your own system config/startup patterns in the field. I tend to push through to get releases working because at runtime the scheme works very well. > On Fri, Nov 16, 2012 at 6:28 PM, AD wrote: >> >> Hello, >> >> I am abstracting some code into a "library" that can be included in other >> applications. This library requires a fair bit of config options, what is >> the recommended approach here when starting it up? >> >> I noticed some libraries like cowboy, you pass all the configs into the >> main start_http() method, others use include files. >> >> Is there a preferred mechanism here when there are 20-25 config options >> for the included application? Garrett From max.lapshin@REDACTED Fri Nov 16 16:19:17 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 16 Nov 2012 18:19:17 +0300 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: > > IMO application:start/1 is also a bad smell outside dev/test modes. > When you deploy as an Erlang release, applications are started by the > init system process. > I've tried to use releases in erlyvideo for a year and totally refused from then and I don't see even a single reason for me to return back to them. So, there is nothing bad in application:start/1, it is a good way to deploy and launch system. There is a nice startup function now in erlyvideo, that does all setup (which differs for runtime and for tests), it loads all data from config file. application config file is a bad place for configuring your application, because it generates nowadays from app.src and exists somewhere in /usr/lib/... configuration file lives in /etc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri Nov 16 16:28:36 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 16 Nov 2012 17:28:36 +0200 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: <6A62B3F5-1876-4631-A03F-64DF5442E4C3@gmail.com> Hello Max, I would _really_ propose you to came back to releases. Rebar + reltool makes distribution of you application in a form of self contained tarball. Of corse there is nothing bad with application:start but I hardly see how your handle node and application restart. Proper release config + heart bring couple of advantages on fault handling. BTW, there is no need to to touch app.src file for application configuration. All applications are configured through sys.config. You can also make your config file to be placed into /etc or even make hierarchy of configs. - Dmitry On Nov 16, 2012, at 5:19 PM, Max Lapshin wrote: > > > IMO application:start/1 is also a bad smell outside dev/test modes. > When you deploy as an Erlang release, applications are started by the > init system process. > > > I've tried to use releases in erlyvideo for a year and totally refused from then and I don't see even a single reason for me to return back to them. So, there is nothing bad in application:start/1, it is a good way to deploy and launch system. > > > There is a nice startup function now in erlyvideo, that does all setup (which differs for runtime and for tests), it loads > all data from config file. > > application config file is a bad place for configuring your application, because it generates nowadays from app.src and exists somewhere in /usr/lib/... > > configuration file lives in /etc/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri Nov 16 16:30:47 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 16 Nov 2012 09:30:47 -0600 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: On Fri, Nov 16, 2012 at 9:19 AM, Max Lapshin wrote: > >> >> IMO application:start/1 is also a bad smell outside dev/test modes. >> When you deploy as an Erlang release, applications are started by the >> init system process. > > I've tried to use releases in erlyvideo for a year and totally refused from > then and I don't see even a single reason for me to return back to them. So, > there is nothing bad in application:start/1, it is a good way to deploy and > launch system. Understood. But there is a payoff in getting this to work. Understood though :) I want to set aside some time to check out Eric Merrit's relcool (I came up with the name :) https://github.com/erlware/relcool > There is a nice startup function now in erlyvideo, that does all setup > (which differs for runtime and for tests), it loads > all data from config file. Reinventing the wheel, but that's cool - it's not a complicated wheel. > application config file is a bad place for configuring your application, > because it generates nowadays from app.src and exists somewhere in > /usr/lib/... > > configuration file lives in /etc/ You're confused. App config has nothing to do with app.src and certainly lives in /etc/ It's the file you pass here: erl -config CONFIG Garrett From max.lapshin@REDACTED Fri Nov 16 16:40:10 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 16 Nov 2012 18:40:10 +0300 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: Thank you, guys, a lot, but I'm not going to return to releases =) erlyvideo is just a plain unix software, like apache or sendmail, that is installed by people, that are hearing about erlang for the first time. They can modify only one file in /etc/, so I need to read it before startup. But there may not be this file, so I need to look for in in other place. I really don't see any use in releases for me, so my way of configuring applications inside erlang node is very, very convenient and it is _working_. Working in _my practice_. On Fri, Nov 16, 2012 at 7:30 PM, Garrett Smith wrote: > On Fri, Nov 16, 2012 at 9:19 AM, Max Lapshin > wrote: > > > >> > >> IMO application:start/1 is also a bad smell outside dev/test modes. > >> When you deploy as an Erlang release, applications are started by the > >> init system process. > > > > I've tried to use releases in erlyvideo for a year and totally refused > from > > then and I don't see even a single reason for me to return back to them. > So, > > there is nothing bad in application:start/1, it is a good way to deploy > and > > launch system. > > Understood. But there is a payoff in getting this to work. Understood > though :) > > I want to set aside some time to check out Eric Merrit's relcool (I > came up with the name :) > > https://github.com/erlware/relcool > > > There is a nice startup function now in erlyvideo, that does all setup > > (which differs for runtime and for tests), it loads > > all data from config file. > > Reinventing the wheel, but that's cool - it's not a complicated wheel. > > > application config file is a bad place for configuring your application, > > because it generates nowadays from app.src and exists somewhere in > > /usr/lib/... > > > > configuration file lives in /etc/ > > You're confused. App config has nothing to do with app.src and > certainly lives in /etc/ > > It's the file you pass here: > > erl -config CONFIG > > Garrett > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri Nov 16 16:49:18 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 16 Nov 2012 09:49:18 -0600 Subject: [erlang-questions] recommended ways to pass config to a dep app In-Reply-To: References: Message-ID: I'd stick with what is working as well! But just a point of clarification -- releases are hard for release engineers, not for end users. I deploy all Erlang projects as releases for that reason. You get a nice distribution that can be configured trivially with a single config file and further refined with command line options. There is a theoretical downside to asking users to edit Erlang term files. I treat this as a UI problem to config and so have used converters from, say YML, to Erlang config files that are run at startup so users don't get into that layer. But since the Erlang init process is so central to Erlang itself, I prefer to leverage it rather than roll something different. But understood :) On Fri, Nov 16, 2012 at 9:40 AM, Max Lapshin wrote: > Thank you, guys, a lot, but I'm not going to return to releases =) > > erlyvideo is just a plain unix software, like apache or sendmail, that is > installed by people, that are hearing about erlang for the first time. > > They can modify only one file in /etc/, so I need to read it before startup. > But there may not be this file, so I need to look for in in other place. > > I really don't see any use in releases for me, so my way of configuring > applications inside erlang node is very, very convenient and it is > _working_. Working in _my practice_. > > > > On Fri, Nov 16, 2012 at 7:30 PM, Garrett Smith wrote: >> >> On Fri, Nov 16, 2012 at 9:19 AM, Max Lapshin >> wrote: >> > >> >> >> >> IMO application:start/1 is also a bad smell outside dev/test modes. >> >> When you deploy as an Erlang release, applications are started by the >> >> init system process. >> > >> > I've tried to use releases in erlyvideo for a year and totally refused >> > from >> > then and I don't see even a single reason for me to return back to them. >> > So, >> > there is nothing bad in application:start/1, it is a good way to deploy >> > and >> > launch system. >> >> Understood. But there is a payoff in getting this to work. Understood >> though :) >> >> I want to set aside some time to check out Eric Merrit's relcool (I >> came up with the name :) >> >> https://github.com/erlware/relcool >> >> > There is a nice startup function now in erlyvideo, that does all setup >> > (which differs for runtime and for tests), it loads >> > all data from config file. >> >> Reinventing the wheel, but that's cool - it's not a complicated wheel. >> >> > application config file is a bad place for configuring your application, >> > because it generates nowadays from app.src and exists somewhere in >> > /usr/lib/... >> > >> > configuration file lives in /etc/ >> >> You're confused. App config has nothing to do with app.src and >> certainly lives in /etc/ >> >> It's the file you pass here: >> >> erl -config CONFIG >> >> Garrett > > From dmercer@REDACTED Sat Nov 17 00:07:44 2012 From: dmercer@REDACTED (David Mercer) Date: Fri, 16 Nov 2012 17:07:44 -0600 Subject: [erlang-questions] [ANN] Erlang Turkish User Group In-Reply-To: References: Message-ID: <012501cdc44f$3053ef40$90fbcdc0$@gmail.com> Did we decide Turkish was alright for Erlang? I forget what we collectively decided. :-) Cheers, DBM > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Kunthar > Sent: Friday, November 16, 2012 06:55 > To: Erlang > Subject: [erlang-questions] [ANN] Erlang Turkish User Group > > Hi all, > > Small group of Erlang users and beginners organized a mailing list for > Turkey. > You can reach the group mail list from here: > > https://groups.google.com/group/erlang-turkey > > > -- > BR, > \|/ Kunthar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrkhoza@REDACTED Sat Nov 17 12:47:00 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Sat, 17 Nov 2012 13:47:00 +0200 Subject: [erlang-questions] append new line in file Message-ID: Hi Erlang Developers, How do I append a new line of text in a file by using append_element or any other function in Erlang. Kindest Regards Lucky From watson.timothy@REDACTED Sat Nov 17 13:13:58 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 17 Nov 2012 12:13:58 +0000 Subject: [erlang-questions] append new line in file In-Reply-To: References: Message-ID: <19F50A25-C0D0-48A4-BAC2-07D78D1E805A@gmail.com> Try google, there are several hits for 'erlang file append newline' On 17 Nov 2012, at 11:47, Lucky Khoza wrote: > Hi Erlang Developers, > > How do I append a new line of text in a file by using append_element > or any other function in Erlang. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From kunthar@REDACTED Sat Nov 17 13:14:05 2012 From: kunthar@REDACTED (Kunthar) Date: Sat, 17 Nov 2012 14:14:05 +0200 Subject: [erlang-questions] append new line in file In-Reply-To: References: Message-ID: http://is.gd/9cdKcl On Sat, Nov 17, 2012 at 1:47 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > How do I append a new line of text in a file by using append_element > or any other function in Erlang. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar From steven.charles.davis@REDACTED Sat Nov 17 18:02:22 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 17 Nov 2012 11:02:22 -0600 Subject: [erlang-questions] A pointless problem? Message-ID: I am intrigued by what is arguably a pointless problem. Looking at the tiny encryption algorithm aka XXTEA it seemed easy enough to implement in Erlang. I have an implementation (attached with source and all references inside the module) which encodes and decodes successfully... BUT the cipher text doesn't match the test vectors... What makes this pointless is that I should "just make it a NIF" etc. But it's likely that I am misunderstanding some aspect of either Erlang or C, however I am confounded as to what that problem is... why does the attached implementation not generate the same ciphertext as in the test vectors from the C implementation? Can anyone spot my error? Thanks, /s -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: xxtea.erl.txt URL: From thomas.elsgaard@REDACTED Sat Nov 17 18:27:46 2012 From: thomas.elsgaard@REDACTED (Thomas Elsgaard) Date: Sat, 17 Nov 2012 18:27:46 +0100 Subject: [erlang-questions] Best Erlang approach for sending and parsing XML via HTTP Message-ID: Hi list I need to interface with an SOAP service, and i would like to keep it as simple as possible, so basically i would like just to send the XML via HTTP and parse the response, what is the best approach for this with Erlang? Could i use httpc, or should i go for the SOAP client via Yaws? The request i need to send is: ------------------------- "xxxx" "xxxx" ------------------------- And i need to get the sessionId in the response: ------------------------- 84c3646484c36464000000001353168328092 5584289115023516944 ------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sat Nov 17 18:28:42 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 17 Nov 2012 19:28:42 +0200 Subject: [erlang-questions] A pointless problem? In-Reply-To: References: Message-ID: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> Hello, This looks as endianness problem. You have to keep in-mind that binaries is big-endian by default, which contrasts with C memory. You have to be very careful of C algorithms mapping. I've made a small fixes to int32list_xxx routines (see bold text): int32list_from_binary(Bin) -> int32list_from_binary(Bin, []). int32list_from_binary(<>, Acc) -> int32list_from_binary(Bin, [X|Acc]); int32list_from_binary(<<>>, Acc) -> lists:reverse(Acc). int32list_to_binary(List) -> list_to_binary([<> || X <- List]). Some of tests got passed. Unfortunately, some of tests are failed I hope you can easily validate rest of you code agains endian. {test,true,true,{<<"ab043705808c5d57">>,<<"ab043705808c5d57">>}} {test,false,true,{<<"26e3868b9d66a048">>,<<"d1e78be2c746728a">>}} {test,false,true,{<<"2a70e36b99941f2d">>,<<"67ed0ea8e8973fc5">>}} {test,false,true,{<<"a30d3870c0873c23">>,<<"8c3707c01c7fccc4">>}} {test,true,true, {<<"b2601cefb078b772abccba6a">>,<<"b2601cefb078b772abccba6a">>}} {test,false,true, {<<"ddbcb4b88b2c5a268081a8b4">>,<<"579016d143ed6247ac6710dd">>}} {test,true,true, {<<"c0a19f06ebb0d63925aa27f74cc6b2d0">>, <<"c0a19f06ebb0d63925aa27f74cc6b2d0">>}} {test,false,true, {<<"bd28749d4fc20b73a79d59a25d55ab27">>, <<"01b815fd2e4894d13555da434c9d868a">>}} Best Regards, Dmitry On Nov 17, 2012, at 7:02 PM, Steve Davis wrote: > I am intrigued by what is arguably a pointless problem. > > Looking at the tiny encryption algorithm aka XXTEA it seemed easy enough to implement in Erlang. I have an implementation (attached with source and all references inside the module) which encodes and decodes successfully... BUT the cipher text doesn't match the test vectors... > > What makes this pointless is that I should "just make it a NIF" etc. But it's likely that I am misunderstanding some aspect of either Erlang or C, however I am confounded as to what that problem is... why does the attached implementation not generate the same ciphertext as in the test vectors from the C implementation? Can anyone spot my error? > > Thanks, > /s > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sat Nov 17 18:32:26 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 17 Nov 2012 19:32:26 +0200 Subject: [erlang-questions] Best Erlang approach for sending and parsing XML via HTTP In-Reply-To: References: Message-ID: <42BFD035-0B1A-474F-8FFB-36B4FEA50EF3@gmail.com> Hello, Yes, simples solution is httpc + xmerl for xml parsing. All components are otp built-in. but ready made soap client might give you some advantage on envelope parsing. - Dmitry On Nov 17, 2012, at 7:27 PM, Thomas Elsgaard wrote: > Hi list > > I need to interface with an SOAP service, and i would like to keep it as simple as possible, so basically i would like just to send the XML via HTTP and parse the response, what is the best approach for this with Erlang? > > Could i use httpc, or should i go for the SOAP client via Yaws? > > The request i need to send is: > > ------------------------- > > > > > > "xxxx" > "xxxx" > > > > ------------------------- > > And i need to get the sessionId in the response: > > ------------------------- > > > > > > 84c3646484c36464000000001353168328092 > 5584289115023516944 > > > > ------------------------- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Sat Nov 17 18:33:22 2012 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 17 Nov 2012 18:33:22 +0100 Subject: [erlang-questions] A pointless problem? In-Reply-To: References: Message-ID: On Sat, Nov 17, 2012 at 6:02 PM, Steve Davis wrote: > I am intrigued by what is arguably a pointless problem. > Not really > > Looking at the tiny encryption algorithm aka XXTEA it seemed easy enough > to implement in Erlang. I have an implementation (attached with source and > all references inside the module) which encodes and decodes successfully... > BUT the cipher text doesn't match the test vectors... > I had exactly the same problem with tea a few years ago ... I'd really like to see: a) an algebraic spec b) reference implementations in more than one language that I can reproduce I'm more interested in inter-operability than performance - (think client in Javascript backend in C / Erlang) - so compliance with the spec is more important than performance. (which is why I like RSA implemented in erlang bignums - no chance of backdoors in the code) > > What makes this pointless is that I should "just make it a NIF" etc. But > it's likely that I am misunderstanding some aspect of either Erlang or C, > however I am confounded as to what that problem is... why does the attached > implementation not generate the same ciphertext as in the test vectors from > the C implementation? Can anyone spot my error? > > Before you ask this you might ask "can the test vectors be reproduced in any other language/implementation than the reference implementation?" Cheers /Joe > Thanks, > /s > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Nov 17 18:39:45 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 17 Nov 2012 11:39:45 -0600 Subject: [erlang-questions] A pointless problem? In-Reply-To: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> References: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> Message-ID: <81F17B7C-120E-449E-B981-024469F0C977@gmail.com> Ah - insight. Endianness did occur to me as a problem but I think I maybe went "too far" in compensating for it previously. From the tests now I can see that it's the Key endianness that is the remaining issue... Thank you so much! Regards, /s On Nov 17, 2012, at 11:28 AM, Dmitry Kolesnikov wrote: > Hello, > > This looks as endianness problem. You have to keep in-mind that binaries is big-endian by default, which contrasts with C memory. You have to be very careful of C algorithms mapping. > > I've made a small fixes to int32list_xxx routines (see bold text): > > int32list_from_binary(Bin) -> > int32list_from_binary(Bin, []). > int32list_from_binary(<>, Acc) -> > int32list_from_binary(Bin, [X|Acc]); > int32list_from_binary(<<>>, Acc) -> > lists:reverse(Acc). > > int32list_to_binary(List) -> > list_to_binary([<> || X <- List]). > > Some of tests got passed. Unfortunately, some of tests are failed I hope you can easily validate rest of you code agains endian. > > {test,true,true,{<<"ab043705808c5d57">>,<<"ab043705808c5d57">>}} > {test,false,true,{<<"26e3868b9d66a048">>,<<"d1e78be2c746728a">>}} > {test,false,true,{<<"2a70e36b99941f2d">>,<<"67ed0ea8e8973fc5">>}} > {test,false,true,{<<"a30d3870c0873c23">>,<<"8c3707c01c7fccc4">>}} > {test,true,true, > {<<"b2601cefb078b772abccba6a">>,<<"b2601cefb078b772abccba6a">>}} > {test,false,true, > {<<"ddbcb4b88b2c5a268081a8b4">>,<<"579016d143ed6247ac6710dd">>}} > {test,true,true, > {<<"c0a19f06ebb0d63925aa27f74cc6b2d0">>, > <<"c0a19f06ebb0d63925aa27f74cc6b2d0">>}} > {test,false,true, > {<<"bd28749d4fc20b73a79d59a25d55ab27">>, > <<"01b815fd2e4894d13555da434c9d868a">>}} > > Best Regards, > Dmitry > > > On Nov 17, 2012, at 7:02 PM, Steve Davis wrote: > >> I am intrigued by what is arguably a pointless problem. >> >> Looking at the tiny encryption algorithm aka XXTEA it seemed easy enough to implement in Erlang. I have an implementation (attached with source and all references inside the module) which encodes and decodes successfully... BUT the cipher text doesn't match the test vectors... >> >> What makes this pointless is that I should "just make it a NIF" etc. But it's likely that I am misunderstanding some aspect of either Erlang or C, however I am confounded as to what that problem is... why does the attached implementation not generate the same ciphertext as in the test vectors from the C implementation? Can anyone spot my error? >> >> Thanks, >> /s >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From YurinVV@REDACTED Sat Nov 17 18:40:59 2012 From: YurinVV@REDACTED (Slava Yurin) Date: Sun, 18 Nov 2012 00:40:59 +0700 Subject: [erlang-questions] A pointless problem? In-Reply-To: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> References: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> Message-ID: <136001353174059@web14d.yandex.ru> An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Nov 17 18:45:12 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 17 Nov 2012 11:45:12 -0600 Subject: [erlang-questions] A pointless problem? In-Reply-To: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> References: <4FA6A039-4004-42E5-93DB-55DEEBEDEB67@gmail.com> Message-ID: <5A814C04-1F56-4AB6-B1DD-21D9EDA21EFA@gmail.com> once I made an additional small mod to the key decoding i.e. encode(Key, Plaintext) -> K = list_to_tuple(int32list_from_binary(Key)), I got success: 73> ice_crypto_btea:test(). {test,true,true,{<<"ab043705808c5d57">>,<<"ab043705808c5d57">>}} {test,true,true,{<<"d1e78be2c746728a">>,<<"d1e78be2c746728a">>}} {test,true,true,{<<"67ed0ea8e8973fc5">>,<<"67ed0ea8e8973fc5">>}} {test,true,true,{<<"8c3707c01c7fccc4">>,<<"8c3707c01c7fccc4">>}} {test,true,true, {<<"b2601cefb078b772abccba6a">>,<<"b2601cefb078b772abccba6a">>}} {test,true,true, {<<"579016d143ed6247ac6710dd">>,<<"579016d143ed6247ac6710dd">>}} {test,true,true, {<<"c0a19f06ebb0d63925aa27f74cc6b2d0">>, <<"c0a19f06ebb0d63925aa27f74cc6b2d0">>}} {test,true,true, {<<"01b815fd2e4894d13555da434c9d868a">>, <<"01b815fd2e4894d13555da434c9d868a">>}} My thanks to you for saving my sanity! Best regards, /s On Nov 17, 2012, at 11:28 AM, Dmitry Kolesnikov wrote: > Hello, > > This looks as endianness problem. You have to keep in-mind that binaries is big-endian by default, which contrasts with C memory. You have to be very careful of C algorithms mapping. > > I've made a small fixes to int32list_xxx routines (see bold text): > > int32list_from_binary(Bin) -> > int32list_from_binary(Bin, []). > int32list_from_binary(<>, Acc) -> > int32list_from_binary(Bin, [X|Acc]); > int32list_from_binary(<<>>, Acc) -> > lists:reverse(Acc). > > int32list_to_binary(List) -> > list_to_binary([<> || X <- List]). > > Some of tests got passed. Unfortunately, some of tests are failed I hope you can easily validate rest of you code agains endian. > > {test,true,true,{<<"ab043705808c5d57">>,<<"ab043705808c5d57">>}} > {test,false,true,{<<"26e3868b9d66a048">>,<<"d1e78be2c746728a">>}} > {test,false,true,{<<"2a70e36b99941f2d">>,<<"67ed0ea8e8973fc5">>}} > {test,false,true,{<<"a30d3870c0873c23">>,<<"8c3707c01c7fccc4">>}} > {test,true,true, > {<<"b2601cefb078b772abccba6a">>,<<"b2601cefb078b772abccba6a">>}} > {test,false,true, > {<<"ddbcb4b88b2c5a268081a8b4">>,<<"579016d143ed6247ac6710dd">>}} > {test,true,true, > {<<"c0a19f06ebb0d63925aa27f74cc6b2d0">>, > <<"c0a19f06ebb0d63925aa27f74cc6b2d0">>}} > {test,false,true, > {<<"bd28749d4fc20b73a79d59a25d55ab27">>, > <<"01b815fd2e4894d13555da434c9d868a">>}} > > Best Regards, > Dmitry > > > On Nov 17, 2012, at 7:02 PM, Steve Davis wrote: > >> I am intrigued by what is arguably a pointless problem. >> >> Looking at the tiny encryption algorithm aka XXTEA it seemed easy enough to implement in Erlang. I have an implementation (attached with source and all references inside the module) which encodes and decodes successfully... BUT the cipher text doesn't match the test vectors... >> >> What makes this pointless is that I should "just make it a NIF" etc. But it's likely that I am misunderstanding some aspect of either Erlang or C, however I am confounded as to what that problem is... why does the attached implementation not generate the same ciphertext as in the test vectors from the C implementation? Can anyone spot my error? >> >> Thanks, >> /s >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Sat Nov 17 19:19:54 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Sat, 17 Nov 2012 18:19:54 +0000 Subject: [erlang-questions] Best Erlang approach for sending and parsing XML via HTTP In-Reply-To: References: Message-ID: Hi Thomas, if all you really need, is that one specific call, then rolling your own simple solution with httpc and xmerl is the quickest route. And xmerl_xs is very handy for retrieving the result value. Only when you get to the stage of dealing with multiple SOAP operations and more complicated XML structures does something more "integrated" become viable. Robby On Nov 17, 2012 5:27 PM, "Thomas Elsgaard" wrote: > Hi list > > I need to interface with an SOAP service, and i would like to keep it as > simple as possible, so basically i would like just to send the XML via HTTP > and parse the response, what is the best approach for this with Erlang? > > Could i use httpc, or should i go for the SOAP client via Yaws? > > The request i need to send is: > > ------------------------- > > > > > > "xxxx" > "xxxx" > > > > ------------------------- > > And i need to get the sessionId in the response: > > ------------------------- > > > > > > > 84c3646484c36464000000001353168328092 > 5584289115023516944 > > > > ------------------------- > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.elsgaard@REDACTED Sat Nov 17 23:13:05 2012 From: thomas.elsgaard@REDACTED (Thomas Elsgaard) Date: Sat, 17 Nov 2012 23:13:05 +0100 Subject: [erlang-questions] Best Erlang approach for sending and parsing XML via HTTP In-Reply-To: References: Message-ID: > > Hi Thomas, > > if all you really need, is that one specific call, then rolling your own > simple solution with httpc and xmerl is the quickest route. And xmerl_xs is > very handy for retrieving the result value. > > Only when you get to the stage of dealing with multiple SOAP operations > and more complicated XML structures does something more "integrated" become > viable. > > Robby > > Thanks!! It was very easy to roll my own with httpc and xmerl, and it works perfectly. ///Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From cloudzen@REDACTED Sun Nov 18 13:08:13 2012 From: cloudzen@REDACTED (skyman) Date: Sun, 18 Nov 2012 20:08:13 +0800 (CST) Subject: [erlang-questions] Fwd: How to read process's backtrace data? In-Reply-To: <20121115091946.GA14336@erix.ericsson.se> References: <52ced1a7.1d9c6.13ae9bd0b50.Coremail.cloudzen@163.com> <6cbd5db6.18034.13aff87751b.Coremail.cloudzen@163.com> <20121115091946.GA14336@erix.ericsson.se> Message-ID: <60717e0a.efe5.13b136b3e51.Coremail.cloudzen@163.com> Thank you very much, Raimo. I'll try it later. At 2012-11-15 17:19:46,"Raimo Niskanen" wrote: >On Wed, Nov 14, 2012 at 11:26:38PM +0800, skyman wrote: >> Hi erlang developers, >> Can anyone answer this question please? Thanks in advance. > >Since there are no other takers; I hope my memory does not make me >flunk misarably... > >"Program counter" is of course the program counter. It points >to the next VM instruction to be executed. This one is fetched from >the process structure and is a copy that is stored when the process >is scheduled out, for example. So it is not always correct. > >"CP" is the continuation pointer. That is the next return address >to use by a return instruction. This is a VM register so for small >functions it does not have to be pushed on the stack, but if >another call is made the old value has to be pushed. This causes >the "Return addr" values in the stack trace to be "delayed" >or off by one stack frame. You'll see shortly. > >y(n) is the VM notation for the 'y' register array, which is >on the stack, for the current stack frame. > >So, we begin at the bottom, which is chronological order. >To understand fully we need the assembly listing of the code... >y(1) and y(0) has values - two values were pushed to the stack, >then a Return addr. This is to a special internal function >that every process originates from. When the process returns >here you can guess what happens . > >The function related to these pushes is the next return addres >above, since a return address first is stored in CP and not >until the next call it is pushed on the stack. In this >case it is shell:eval_loop/3+308. 308 is the assembly code >offset after the entry point. So shell:eval_loop/3 pushes >a pid() and an integer() to the stack before calling... >next return address on the stack is shell:eval_exprs/7+80. > >Looking at shell:eval_loop/3 shows that it indeed calls >shell:eval_exprs/7 and that there are two variables >that have to survive the call i.e Shell and RT. >These are probably a pid and an ets table id (pid() >and integer()). > >Next stack frame. 6 variables are pushed, the first >is a Catch to shell:eval_exprs/7+196. We are now in >shell:eval_exprs/7 and it calls shell:exprs/6 within >a try..catch. So the VM pushes a Catch and all >the variables that need to survive to catch clause >aparently Shell and 4 empty lists and then calls shell:exprs/6. > >Next return address is shell:exprs/7+368. Looking at the code >for shell:exprs/6 shows that it tail recursevly calls >shell:exprs/7 so that is why there is no return address >of shell:exprs/6 on the stack. There were 10 variables >pushed on the stack before the next call, and we were in >shell:exprs/7. The next return address is the CP itself >and it is erl_eval:do_apply/6+208. > >Looking at the code of shell:exprs/7 shows that it calls >shell:expr/4, which tail recursively calls erl_eval:expr/4, >which tail recursively calls erl_eval:expr/5, which tail >recursively calls erl_eval:do_apply/6, so that is how >we get there. That function (erl_eval:do_apply/6) apparently >has pushed two variables on the stack, [] and 'none' >before calling somewhere and storing itself in CP. >Looking at the code shows that it calls apply(Mod, Func, As) >wich is a BIF or an instruction, which probably accounts >for the strange Program counter. After it has returned >it will need Bs0 and RBs, which probably are the [] and 'none' >values in some order. To know we need the assembly code. >I do not think it is in the F({Mod,Func}, As) call since >a fun which F should be should show up as a valid code position >in the Program counter. > >I hope that helps. Summary: > >You need at least the source code to understand anything. The assembly >code gives more clarity. It is only values that need to survive the calls >that are pushed (function arguments are passed in the 'x' VM register >array). The return addresses belong to the stack frame below where they >occur since they are first stored in CP and then pushed in the next >stack frame. > >> >> >> Begin forwarded message: >> Hi everyone, >> erlang:process_display(Pid,backtrace) can display process's backtrace data. For example: >> (foo@REDACTED)6> erlang:process_display(self(),backtrace). >> Program counter: 0x00cf1498 (unknown function) >> CP: 0x0245e8f8 (erl_eval:do_apply/6 + 208) >> >> >> 0x03b1fb34 Return addr 0x01b7f060 (shell:exprs/7 + 368) >> y(0) [] >> y(1) none >> >> >> 0x03b1fb40 Return addr 0x01b7eb94 (shell:eval_exprs/7 + 80) >> y(0) [] >> y(1) [] >> y(2) cmd >> y(3) [] >> y(4) {value,#Fun} >> y(5) {eval,#Fun} >> y(6) 12305 >> y(7) [] >> y(8) [] >> y(9) [] >> >> >> 0x03b1fb6c Return addr 0x01b7e968 (shell:eval_loop/3 + 308) >> y(0) [] >> y(1) [] >> y(2) [] >> y(3) [] >> y(4) <0.30.0> >> y(5) Catch 0x01b7ec08 (shell:eval_exprs/7 + 196) >> >> >> 0x03b1fb88 Return addr 0x00a88f6c () >> y(0) 12305 >> y(1) <0.30.0> >> true >> >> However, I don't know how to read the information above, such as what do "Program counter", Return addr", "+ 368" and "y(0) y(1) ..." mean? Can anyone teach me? >> Thanks in advance! >> >> >> >> >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > >-- > >/ Raimo Niskanen, Erlang/OTP, Ericsson AB >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From tyron.zerafa@REDACTED Sun Nov 18 13:48:53 2012 From: tyron.zerafa@REDACTED (Tyron Zerafa) Date: Sun, 18 Nov 2012 13:48:53 +0100 Subject: [erlang-questions] Process Groups Update Ordering Message-ID: Hey fellows, I have just started reading about the process groups implementation within Erlang, i.e. pg and pg2. I know that update ordering within pg occurs at a master process, however I cannot find any information about how such ordering decisions are taken. Can anyone point me to any resources which described the protocol in place to ensure the sequential consistency model employed in pg? How does this implementation determine which concurrent updates are ordered, which goes first, second etc? Thanks for all your help :D -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 19 11:32:58 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 11:32:58 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules Message-ID: Hello Last evening I was trying to implement futures/promise mechanism in Erlang (mostly for fun, since I am still unsure if it is useful). I got inspired with the presentation [1], which mentioned using futures as a foundation of building services, where things like timeouts, tracing, authentication, etc. is built by composing futures (see slide 41). Do you think that such composition of futures could be useful as a tool to improve code reuse of communication patterns in Erlang (as described in the presentation)? I've implemented futures using processes and message passing and stumbled upon two issues: 1) garbage collection of futures 2) slightly too much code when using them Example of the first problem is here: 1> F = future:new(fun() -> timer:sleep(10000), 10 end). {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} 2> F:get(). %% it hangs for 10 seconds 10 Since future F is represented as a process <0.36.0> it will stay running forever till it's timed out (which is not a good solution, since someone may still have a reference to this future) or F:done() manually called. My idea is to insert into 'future' tuple a NIF-generated resource, which will have a destructor attached (called upon garbage collection of the resource) which will call F:done(). Will it work? The second issue is illustrated here: 7> F = future:new(). {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). <0.49.0> 9> F:get(). 42 In ideal world it should be enough to just write "F" (without :get()) to fetch future's value, but it seems too far fetched for Erlang. Slightly better solution would be to allow calling future with "F()". This can be done by extending concept of "abstract modules" with "default call". Currently abstract modules allow the following: {future, Pid, Ref, undefined}:get() which is translated to future:get({future, Pid, Ref, undefined}) With a simple change in beam_emu.c in call_fun function (which would replace obsolete fun tuples) we can allow for the following: {future, Pid, Ref, undefined}() which COULD be translated to future:call({future, Pid, Ref, undefined}) hence allowing to use just "F()" to read a value of the future. This will also extend "metaprogramming" capabilities of Erlang for some other quirky use, which may or may not be a Good Thing(tm). Thoughts? Cheers, Gleb Peregud 1: http://monkey.org/~marius/talks/twittersystems/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 19 11:40:26 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 11:40:26 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: Forgot to include a link to my implementation: https://github.com/gleber/erlfu On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud wrote: > Hello > > Last evening I was trying to implement futures/promise mechanism in Erlang > (mostly for fun, since I am still unsure if it is useful). I got inspired > with the presentation [1], which mentioned using futures as a foundation of > building services, where things like timeouts, tracing, authentication, > etc. is built by composing futures (see slide 41). > > Do you think that such composition of futures could be useful as a tool to > improve code reuse of communication patterns in Erlang (as described in the > presentation)? > > I've implemented futures using processes and message passing and stumbled > upon two issues: > 1) garbage collection of futures > 2) slightly too much code when using them > > Example of the first problem is here: > > 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > 2> F:get(). %% it hangs for 10 seconds > 10 > > Since future F is represented as a process <0.36.0> it will stay running > forever till it's timed out (which is not a good solution, since someone > may still have a reference to this future) or F:done() manually called. > > My idea is to insert into 'future' tuple a NIF-generated resource, which > will have a destructor attached (called upon garbage collection of the > resource) which will call F:done(). Will it work? > > The second issue is illustrated here: > > 7> F = future:new(). > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > <0.49.0> > 9> F:get(). > 42 > > In ideal world it should be enough to just write "F" (without :get()) to > fetch future's value, but it seems too far fetched for Erlang. Slightly > better solution would be to allow calling future with "F()". > > This can be done by extending concept of "abstract modules" with "default > call". Currently abstract modules allow the following: > > {future, Pid, Ref, undefined}:get() which is translated to > future:get({future, Pid, Ref, undefined}) > > With a simple change in beam_emu.c in call_fun function (which would > replace obsolete fun tuples) we can allow for the following: > > {future, Pid, Ref, undefined}() which COULD be translated to > future:call({future, Pid, Ref, undefined}) > > hence allowing to use just "F()" to read a value of the future. This will > also extend "metaprogramming" capabilities of Erlang for some other quirky > use, which may or may not be a Good Thing(tm). > > Thoughts? > > Cheers, > Gleb Peregud > > 1: http://monkey.org/~marius/talks/twittersystems/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Mon Nov 19 11:41:55 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 Nov 2012 11:41:55 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: Hi Gleb, just a quick observation about garbage collecting futures: would the NIF-generated resource keep track of usage across processes? I fI send a future as a message, it may be referenced by multiple processes which have their own heap and garbage collection... regards, Vlad On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud wrote: > Hello > > Last evening I was trying to implement futures/promise mechanism in Erlang > (mostly for fun, since I am still unsure if it is useful). I got inspired > with the presentation [1], which mentioned using futures as a foundation of > building services, where things like timeouts, tracing, authentication, > etc. is built by composing futures (see slide 41). > > Do you think that such composition of futures could be useful as a tool to > improve code reuse of communication patterns in Erlang (as described in the > presentation)? > > I've implemented futures using processes and message passing and stumbled > upon two issues: > 1) garbage collection of futures > 2) slightly too much code when using them > > Example of the first problem is here: > > 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > 2> F:get(). %% it hangs for 10 seconds > 10 > > Since future F is represented as a process <0.36.0> it will stay running > forever till it's timed out (which is not a good solution, since someone > may still have a reference to this future) or F:done() manually called. > > My idea is to insert into 'future' tuple a NIF-generated resource, which > will have a destructor attached (called upon garbage collection of the > resource) which will call F:done(). Will it work? > > The second issue is illustrated here: > > 7> F = future:new(). > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > <0.49.0> > 9> F:get(). > 42 > > In ideal world it should be enough to just write "F" (without :get()) to > fetch future's value, but it seems too far fetched for Erlang. Slightly > better solution would be to allow calling future with "F()". > > This can be done by extending concept of "abstract modules" with "default > call". Currently abstract modules allow the following: > > {future, Pid, Ref, undefined}:get() which is translated to > future:get({future, Pid, Ref, undefined}) > > With a simple change in beam_emu.c in call_fun function (which would > replace obsolete fun tuples) we can allow for the following: > > {future, Pid, Ref, undefined}() which COULD be translated to > future:call({future, Pid, Ref, undefined}) > > hence allowing to use just "F()" to read a value of the future. This will > also extend "metaprogramming" capabilities of Erlang for some other quirky > use, which may or may not be a Good Thing(tm). > > Thoughts? > > Cheers, > Gleb Peregud > > 1: http://monkey.org/~marius/talks/twittersystems/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 19 11:44:17 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 11:44:17 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: I assumed that NIF-generated resources are shared between processes (the same way as large binaries are), and I haven't done any tests on this. Are you sure it is garbate collected multiple times (once per referencing process)? On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu wrote: > Hi Gleb, > > just a quick observation about garbage collecting futures: would the > NIF-generated resource keep track of usage across processes? I fI send a > future as a message, it may be referenced by multiple processes which have > their own heap and garbage collection... > > regards, > Vlad > > > On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud wrote: > >> Hello >> >> Last evening I was trying to implement futures/promise mechanism in >> Erlang (mostly for fun, since I am still unsure if it is useful). I got >> inspired with the presentation [1], which mentioned using futures as a >> foundation of building services, where things like timeouts, tracing, >> authentication, etc. is built by composing futures (see slide 41). >> >> Do you think that such composition of futures could be useful as a tool >> to improve code reuse of communication patterns in Erlang (as described in >> the presentation)? >> >> I've implemented futures using processes and message passing and stumbled >> upon two issues: >> 1) garbage collection of futures >> 2) slightly too much code when using them >> >> Example of the first problem is here: >> >> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >> 2> F:get(). %% it hangs for 10 seconds >> 10 >> >> Since future F is represented as a process <0.36.0> it will stay running >> forever till it's timed out (which is not a good solution, since someone >> may still have a reference to this future) or F:done() manually called. >> >> My idea is to insert into 'future' tuple a NIF-generated resource, which >> will have a destructor attached (called upon garbage collection of the >> resource) which will call F:done(). Will it work? >> >> The second issue is illustrated here: >> >> 7> F = future:new(). >> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >> <0.49.0> >> 9> F:get(). >> 42 >> >> In ideal world it should be enough to just write "F" (without :get()) to >> fetch future's value, but it seems too far fetched for Erlang. Slightly >> better solution would be to allow calling future with "F()". >> >> This can be done by extending concept of "abstract modules" with "default >> call". Currently abstract modules allow the following: >> >> {future, Pid, Ref, undefined}:get() which is translated to >> future:get({future, Pid, Ref, undefined}) >> >> With a simple change in beam_emu.c in call_fun function (which would >> replace obsolete fun tuples) we can allow for the following: >> >> {future, Pid, Ref, undefined}() which COULD be translated to >> future:call({future, Pid, Ref, undefined}) >> >> hence allowing to use just "F()" to read a value of the future. This will >> also extend "metaprogramming" capabilities of Erlang for some other quirky >> use, which may or may not be a Good Thing(tm). >> >> Thoughts? >> >> Cheers, >> Gleb Peregud >> >> 1: http://monkey.org/~marius/talks/twittersystems/ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Mon Nov 19 11:46:09 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 Nov 2012 11:46:09 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: I have no idea, that's why I asked :-) /Vlad On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud wrote: > I assumed that NIF-generated resources are shared between processes (the > same way as large binaries are), and I haven't done any tests on this. Are > you sure it is garbate collected multiple times (once per referencing > process)? > > > > On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu wrote: > >> Hi Gleb, >> >> just a quick observation about garbage collecting futures: would the >> NIF-generated resource keep track of usage across processes? I fI send a >> future as a message, it may be referenced by multiple processes which have >> their own heap and garbage collection... >> >> regards, >> Vlad >> >> >> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud wrote: >> >>> Hello >>> >>> Last evening I was trying to implement futures/promise mechanism in >>> Erlang (mostly for fun, since I am still unsure if it is useful). I got >>> inspired with the presentation [1], which mentioned using futures as a >>> foundation of building services, where things like timeouts, tracing, >>> authentication, etc. is built by composing futures (see slide 41). >>> >>> Do you think that such composition of futures could be useful as a tool >>> to improve code reuse of communication patterns in Erlang (as described in >>> the presentation)? >>> >>> I've implemented futures using processes and message passing and >>> stumbled upon two issues: >>> 1) garbage collection of futures >>> 2) slightly too much code when using them >>> >>> Example of the first problem is here: >>> >>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>> 2> F:get(). %% it hangs for 10 seconds >>> 10 >>> >>> Since future F is represented as a process <0.36.0> it will stay running >>> forever till it's timed out (which is not a good solution, since someone >>> may still have a reference to this future) or F:done() manually called. >>> >>> My idea is to insert into 'future' tuple a NIF-generated resource, which >>> will have a destructor attached (called upon garbage collection of the >>> resource) which will call F:done(). Will it work? >>> >>> The second issue is illustrated here: >>> >>> 7> F = future:new(). >>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>> <0.49.0> >>> 9> F:get(). >>> 42 >>> >>> In ideal world it should be enough to just write "F" (without :get()) to >>> fetch future's value, but it seems too far fetched for Erlang. Slightly >>> better solution would be to allow calling future with "F()". >>> >>> This can be done by extending concept of "abstract modules" with >>> "default call". Currently abstract modules allow the following: >>> >>> {future, Pid, Ref, undefined}:get() which is translated to >>> future:get({future, Pid, Ref, undefined}) >>> >>> With a simple change in beam_emu.c in call_fun function (which would >>> replace obsolete fun tuples) we can allow for the following: >>> >>> {future, Pid, Ref, undefined}() which COULD be translated to >>> future:call({future, Pid, Ref, undefined}) >>> >>> hence allowing to use just "F()" to read a value of the future. This >>> will also extend "metaprogramming" capabilities of Erlang for some other >>> quirky use, which may or may not be a Good Thing(tm). >>> >>> Thoughts? >>> >>> Cheers, >>> Gleb Peregud >>> >>> 1: http://monkey.org/~marius/talks/twittersystems/ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 19 11:48:12 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 11:48:12 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: Sverker Eriksson wrote the following in [1]: > But even if the resource terms look alike, they are unique and there is > no bug leaking NIF resources (that I know of). A resource is released > (and destructor called) when the last reference is garbage collected. > The shell can fool you however, as it keeps a command history that can > retain terms even though you think the variables are forgotten. Test NIF > resource cleanup by running a test module and call > erlang:garbage_collect to force destructors to be called. This seems to mean that they are "shared" and garbage collected just once. 1: http://erlang.org/pipermail/erlang-questions/2011-January/055524.html On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu wrote: > I have no idea, that's why I asked :-) > /Vlad > > > On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud wrote: >> >> I assumed that NIF-generated resources are shared between processes (the >> same way as large binaries are), and I haven't done any tests on this. Are >> you sure it is garbate collected multiple times (once per referencing >> process)? >> >> >> >> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >> wrote: >>> >>> Hi Gleb, >>> >>> just a quick observation about garbage collecting futures: would the >>> NIF-generated resource keep track of usage across processes? I fI send a >>> future as a message, it may be referenced by multiple processes which have >>> their own heap and garbage collection... >>> >>> regards, >>> Vlad >>> >>> >>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>> wrote: >>>> >>>> Hello >>>> >>>> Last evening I was trying to implement futures/promise mechanism in >>>> Erlang (mostly for fun, since I am still unsure if it is useful). I got >>>> inspired with the presentation [1], which mentioned using futures as a >>>> foundation of building services, where things like timeouts, tracing, >>>> authentication, etc. is built by composing futures (see slide 41). >>>> >>>> Do you think that such composition of futures could be useful as a tool >>>> to improve code reuse of communication patterns in Erlang (as described in >>>> the presentation)? >>>> >>>> I've implemented futures using processes and message passing and >>>> stumbled upon two issues: >>>> 1) garbage collection of futures >>>> 2) slightly too much code when using them >>>> >>>> Example of the first problem is here: >>>> >>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>> 2> F:get(). %% it hangs for 10 seconds >>>> 10 >>>> >>>> Since future F is represented as a process <0.36.0> it will stay running >>>> forever till it's timed out (which is not a good solution, since someone may >>>> still have a reference to this future) or F:done() manually called. >>>> >>>> My idea is to insert into 'future' tuple a NIF-generated resource, which >>>> will have a destructor attached (called upon garbage collection of the >>>> resource) which will call F:done(). Will it work? >>>> >>>> The second issue is illustrated here: >>>> >>>> 7> F = future:new(). >>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>> <0.49.0> >>>> 9> F:get(). >>>> 42 >>>> >>>> In ideal world it should be enough to just write "F" (without :get()) to >>>> fetch future's value, but it seems too far fetched for Erlang. Slightly >>>> better solution would be to allow calling future with "F()". >>>> >>>> This can be done by extending concept of "abstract modules" with >>>> "default call". Currently abstract modules allow the following: >>>> >>>> {future, Pid, Ref, undefined}:get() which is translated to >>>> future:get({future, Pid, Ref, undefined}) >>>> >>>> With a simple change in beam_emu.c in call_fun function (which would >>>> replace obsolete fun tuples) we can allow for the following: >>>> >>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>> future:call({future, Pid, Ref, undefined}) >>>> >>>> hence allowing to use just "F()" to read a value of the future. This >>>> will also extend "metaprogramming" capabilities of Erlang for some other >>>> quirky use, which may or may not be a Good Thing(tm). >>>> >>>> Thoughts? >>>> >>>> Cheers, >>>> Gleb Peregud >>>> >>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>> >> > From shankar_patil@REDACTED Mon Nov 19 13:18:01 2012 From: shankar_patil@REDACTED (Shankar Patil) Date: Mon, 19 Nov 2012 12:18:01 +0000 Subject: [erlang-questions] getting error in erlang References: <8C29E01908962B4095A9044AE0F89A40434A2A56@HJ-MBX2.persistent.co.in> Message-ID: <8C29E01908962B4095A9044AE0F89A40434AE4DA@HJ-MBX2.persistent.co.in> Can you please help me out? Regards, Shankar Patil From: Shankar Patil Sent: Friday, November 16, 2012 9:42 AM To: 'Gustav Simonsson' Cc: erlang-questions@REDACTED Subject: RE: [erlang-questions] getting error in erlang GCC version gcc version 4.7.2 (GCC) Configure output attached. Please check and revert. Regards, Shankar Patil From: Gustav Simonsson [mailto:gustav.simonsson@REDACTED] Sent: Saturday, November 10, 2012 9:27 PM To: Shankar Patil Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] getting error in erlang What version of GCC are you using? Also, can you include the output from running ./configure ? Cheers, Gustav Simonsson On Fri, Nov 9, 2012 at 11:17 AM, Shankar Patil > wrote: Hello All, I am compiling erlang otp_src_R15B on aix 6.1 machine. Getting below errors. ../include/internal/ethread.h: In function 'ethr_spin_lock__': ../include/internal/ethread.h:555: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:344: error: parse error before 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: type defaults to 'int' in declaration of 'ts_ev_alloc_lock' common/ethr_aux.c:344: warning: data definition has no type or storage class common/ethr_aux.c:529: error: parse error before '*' token common/ethr_aux.c:530: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_init': common/ethr_aux.c:537: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:541: error: parse error before '*' token common/ethr_aux.c:542: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spinlock_destroy': common/ethr_aux.c:553: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:557: error: parse error before '*' token common/ethr_aux.c:558: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_unlock': common/ethr_aux.c:561: error: 'lock' undeclared (first use in this function) common/ethr_aux.c: At top level: common/ethr_aux.c:565: error: parse error before '*' token common/ethr_aux.c:566: warning: function declaration isn't a prototype common/ethr_aux.c: In function 'ethr_spin_lock': common/ethr_aux.c:569: error: 'lock' undeclared (first use in this function) gmake[5]: *** [obj/rs6000-ibm-aix/opt/r/ethr_aux.o] Error 1 gmake[5]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[4]: *** [opt] Error 2 gmake[4]: Leaving directory `/opt/otp_src_R15B/erts/lib_src' gmake[3]: *** [erts_lib] Error 2 gmake[3]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/opt/otp_src_R15B/erts/emulator' gmake[1]: *** [smp] Error 2 gmake[1]: Leaving directory `/opt/otp_src_R15B/erts' gmake: *** [emulator] Error 2 can you please help out ? Regards, Shankar Patil DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 19 14:18:11 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 14:18:11 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: With the these changes [1] the following code works as intended: 7> F = future:new(fun() -> timer:sleep(5000), 42 end). {future,<0.44.0>,#Ref<0.0.0.71>,undefined} 8> F(). 42 Aside from a problem where it improperly reports arity in case of undefined function: 9> F(1,2,3). ** exception error: undefined function future:call/3 1: https://github.com/gleber/otp/compare/call-abstract-module On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud wrote: > Sverker Eriksson wrote the following in [1]: > >> But even if the resource terms look alike, they are unique and there is >> no bug leaking NIF resources (that I know of). A resource is released >> (and destructor called) when the last reference is garbage collected. >> The shell can fool you however, as it keeps a command history that can >> retain terms even though you think the variables are forgotten. Test NIF >> resource cleanup by running a test module and call >> erlang:garbage_collect to force destructors to be called. > > This seems to mean that they are "shared" and garbage collected just once. > > 1: http://erlang.org/pipermail/erlang-questions/2011-January/055524.html > > On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu wrote: >> I have no idea, that's why I asked :-) >> /Vlad >> >> >> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud wrote: >>> >>> I assumed that NIF-generated resources are shared between processes (the >>> same way as large binaries are), and I haven't done any tests on this. Are >>> you sure it is garbate collected multiple times (once per referencing >>> process)? >>> >>> >>> >>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>> wrote: >>>> >>>> Hi Gleb, >>>> >>>> just a quick observation about garbage collecting futures: would the >>>> NIF-generated resource keep track of usage across processes? I fI send a >>>> future as a message, it may be referenced by multiple processes which have >>>> their own heap and garbage collection... >>>> >>>> regards, >>>> Vlad >>>> >>>> >>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>> wrote: >>>>> >>>>> Hello >>>>> >>>>> Last evening I was trying to implement futures/promise mechanism in >>>>> Erlang (mostly for fun, since I am still unsure if it is useful). I got >>>>> inspired with the presentation [1], which mentioned using futures as a >>>>> foundation of building services, where things like timeouts, tracing, >>>>> authentication, etc. is built by composing futures (see slide 41). >>>>> >>>>> Do you think that such composition of futures could be useful as a tool >>>>> to improve code reuse of communication patterns in Erlang (as described in >>>>> the presentation)? >>>>> >>>>> I've implemented futures using processes and message passing and >>>>> stumbled upon two issues: >>>>> 1) garbage collection of futures >>>>> 2) slightly too much code when using them >>>>> >>>>> Example of the first problem is here: >>>>> >>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>> 2> F:get(). %% it hangs for 10 seconds >>>>> 10 >>>>> >>>>> Since future F is represented as a process <0.36.0> it will stay running >>>>> forever till it's timed out (which is not a good solution, since someone may >>>>> still have a reference to this future) or F:done() manually called. >>>>> >>>>> My idea is to insert into 'future' tuple a NIF-generated resource, which >>>>> will have a destructor attached (called upon garbage collection of the >>>>> resource) which will call F:done(). Will it work? >>>>> >>>>> The second issue is illustrated here: >>>>> >>>>> 7> F = future:new(). >>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>> <0.49.0> >>>>> 9> F:get(). >>>>> 42 >>>>> >>>>> In ideal world it should be enough to just write "F" (without :get()) to >>>>> fetch future's value, but it seems too far fetched for Erlang. Slightly >>>>> better solution would be to allow calling future with "F()". >>>>> >>>>> This can be done by extending concept of "abstract modules" with >>>>> "default call". Currently abstract modules allow the following: >>>>> >>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>> future:get({future, Pid, Ref, undefined}) >>>>> >>>>> With a simple change in beam_emu.c in call_fun function (which would >>>>> replace obsolete fun tuples) we can allow for the following: >>>>> >>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>> future:call({future, Pid, Ref, undefined}) >>>>> >>>>> hence allowing to use just "F()" to read a value of the future. This >>>>> will also extend "metaprogramming" capabilities of Erlang for some other >>>>> quirky use, which may or may not be a Good Thing(tm). >>>>> >>>>> Thoughts? >>>>> >>>>> Cheers, >>>>> Gleb Peregud >>>>> >>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>> >>> >> From francesco@REDACTED Mon Nov 19 14:20:04 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 19 Nov 2012 13:20:04 +0000 Subject: [erlang-questions] Free Erlang e-learning for Universities Message-ID: <50AA3204.9000905@erlang-solutions.com> Hi All, If you are considering teaching Erlang as part of your university curriculum, you should get in touch. We have been working with universities for the past 6 months, offering free Erlang e-learning to intermediate and final year students who are interested in studying Erlang; or to academic institutions covering parallel and functional programming, distributed programming, multi-core programming, programming paradigms, and more. This E-Learning offering is the result of a joint two year project with Prof. Simon Thompson of the University of Kent, in Canterbury, UK. It consists of 8 hours of videos, screen casts, interactive quizzes and exercises with immediate feedback and assessment of the code (We run a static analysis on the code, unit and QuickCheck tests, type checks and visualize processes and message passing using javascript). We cover sequential and concurrent programming, error handling, distribution, software upgrade and ETS tables. This course is integrated with the Erlang Programming book, published by O'Reilly. 2. We request you to pass this email to all relevant students at your University. 3. To access the elearning facility for free, the student needs to do the two things below: - register to the portal, using their University email address and not a private one, at: http://elearning.erlang-solutions.com/login/signup.php - send an email notification toelearning@REDACTED requesting free access. When registering, the students can only get the free offer if they use their University email address, so that we can easily identify them in the list of users. 4. Fyi, there will be a maximum limit of 50 candidates per institution and the offer is free to students for 3 months from registration. 5. The rationale behind this offer is that demand for Erlang Programmers is increasing and our clients are struggling to find skilled staff. We are being told that companies are choosing not to adopt Erlang because it is hard to recruit! We hope that working with Universities in raising awareness of Erlang will raise interest among the students and encourage them to apply for these positions. The situation in the US is even more acute, now that Erlang has been identified as a serious contender for scaling systems on multi-core and in cloud environments. 6. To see our current job vacancies for staff at all levels with these skills, please visit our website career pages at: https://www.erlang-solutions.com/about/careers/careers-other-countries If interested, do not hesitate to get in touch with me. We currently have about 180 students signed up, so places are limited. The earlier we can plan in your courses, the better. Looking forward to hearing from you all, Francesco -- Erlang Solutions Ltd. http://www.erlang-solutions.com From pan@REDACTED Mon Nov 19 14:38:53 2012 From: pan@REDACTED (Patrik Nyblom) Date: Mon, 19 Nov 2012 14:38:53 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: <50AA366D.2050007@erlang.org> On 11/19/2012 11:48 AM, Gleb Peregud wrote: > Sverker Eriksson wrote the following in [1]: > >> But even if the resource terms look alike, they are unique and there is >> no bug leaking NIF resources (that I know of). A resource is released >> (and destructor called) when the last reference is garbage collected. >> The shell can fool you however, as it keeps a command history that can >> retain terms even though you think the variables are forgotten. Test NIF >> resource cleanup by running a test module and call >> erlang:garbage_collect to force destructors to be called. > This seems to mean that they are "shared" and garbage collected just once. That is correct. The callback however, is not really able to send messages, you would have to relay information to a thread which in turn would have to send a message to the future to make it exit. It seems to be technically possible at least, given an SMP VM. You would more or less implement garbage collection of processes, which would be kind of cool, I think :) Of course distribution would generate a slightly bigger challenge... Cheers, /Patrik > > 1: http://erlang.org/pipermail/erlang-questions/2011-January/055524.html > > On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu wrote: >> I have no idea, that's why I asked :-) >> /Vlad >> >> >> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud wrote: >>> I assumed that NIF-generated resources are shared between processes (the >>> same way as large binaries are), and I haven't done any tests on this. Are >>> you sure it is garbate collected multiple times (once per referencing >>> process)? >>> >>> >>> >>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>> wrote: >>>> Hi Gleb, >>>> >>>> just a quick observation about garbage collecting futures: would the >>>> NIF-generated resource keep track of usage across processes? I fI send a >>>> future as a message, it may be referenced by multiple processes which have >>>> their own heap and garbage collection... >>>> >>>> regards, >>>> Vlad >>>> >>>> >>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>> wrote: >>>>> Hello >>>>> >>>>> Last evening I was trying to implement futures/promise mechanism in >>>>> Erlang (mostly for fun, since I am still unsure if it is useful). I got >>>>> inspired with the presentation [1], which mentioned using futures as a >>>>> foundation of building services, where things like timeouts, tracing, >>>>> authentication, etc. is built by composing futures (see slide 41). >>>>> >>>>> Do you think that such composition of futures could be useful as a tool >>>>> to improve code reuse of communication patterns in Erlang (as described in >>>>> the presentation)? >>>>> >>>>> I've implemented futures using processes and message passing and >>>>> stumbled upon two issues: >>>>> 1) garbage collection of futures >>>>> 2) slightly too much code when using them >>>>> >>>>> Example of the first problem is here: >>>>> >>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>> 2> F:get(). %% it hangs for 10 seconds >>>>> 10 >>>>> >>>>> Since future F is represented as a process <0.36.0> it will stay running >>>>> forever till it's timed out (which is not a good solution, since someone may >>>>> still have a reference to this future) or F:done() manually called. >>>>> >>>>> My idea is to insert into 'future' tuple a NIF-generated resource, which >>>>> will have a destructor attached (called upon garbage collection of the >>>>> resource) which will call F:done(). Will it work? >>>>> >>>>> The second issue is illustrated here: >>>>> >>>>> 7> F = future:new(). >>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>> <0.49.0> >>>>> 9> F:get(). >>>>> 42 >>>>> >>>>> In ideal world it should be enough to just write "F" (without :get()) to >>>>> fetch future's value, but it seems too far fetched for Erlang. Slightly >>>>> better solution would be to allow calling future with "F()". >>>>> >>>>> This can be done by extending concept of "abstract modules" with >>>>> "default call". Currently abstract modules allow the following: >>>>> >>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>> future:get({future, Pid, Ref, undefined}) >>>>> >>>>> With a simple change in beam_emu.c in call_fun function (which would >>>>> replace obsolete fun tuples) we can allow for the following: >>>>> >>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>> future:call({future, Pid, Ref, undefined}) >>>>> >>>>> hence allowing to use just "F()" to read a value of the future. This >>>>> will also extend "metaprogramming" capabilities of Erlang for some other >>>>> quirky use, which may or may not be a Good Thing(tm). >>>>> >>>>> Thoughts? >>>>> >>>>> Cheers, >>>>> Gleb Peregud >>>>> >>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From robert.virding@REDACTED Mon Nov 19 15:01:32 2012 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 19 Nov 2012 14:01:32 -0000 (GMT) Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: Message-ID: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> Wouldn't it be easier if future:new just returned a fun? Then you could do F() without any changes? Robert ----- Original Message ----- > From: "Gleb Peregud" > To: "Vlad Dumitrescu" > Cc: "Erlang" > Sent: Monday, 19 November, 2012 2:18:11 PM > Subject: Re: [erlang-questions] Futures/promises and ability to "call" abstract modules > > With the these changes [1] the following code works as intended: > > 7> F = future:new(fun() -> timer:sleep(5000), 42 end). > {future,<0.44.0>,#Ref<0.0.0.71>,undefined} > 8> F(). > 42 > > Aside from a problem where it improperly reports arity in case of > undefined function: > > 9> F(1,2,3). > ** exception error: undefined function future:call/3 > > 1: https://github.com/gleber/otp/compare/call-abstract-module > > On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud > wrote: > > Sverker Eriksson wrote the following in [1]: > > > >> But even if the resource terms look alike, they are unique and > >> there is > >> no bug leaking NIF resources (that I know of). A resource is > >> released > >> (and destructor called) when the last reference is garbage > >> collected. > >> The shell can fool you however, as it keeps a command history that > >> can > >> retain terms even though you think the variables are forgotten. > >> Test NIF > >> resource cleanup by running a test module and call > >> erlang:garbage_collect to force destructors to be called. > > > > This seems to mean that they are "shared" and garbage collected > > just once. > > > > 1: > > http://erlang.org/pipermail/erlang-questions/2011-January/055524.html > > > > On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu > > wrote: > >> I have no idea, that's why I asked :-) > >> /Vlad > >> > >> > >> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud > >> wrote: > >>> > >>> I assumed that NIF-generated resources are shared between > >>> processes (the > >>> same way as large binaries are), and I haven't done any tests on > >>> this. Are > >>> you sure it is garbate collected multiple times (once per > >>> referencing > >>> process)? > >>> > >>> > >>> > >>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu > >>> > >>> wrote: > >>>> > >>>> Hi Gleb, > >>>> > >>>> just a quick observation about garbage collecting futures: would > >>>> the > >>>> NIF-generated resource keep track of usage across processes? I > >>>> fI send a > >>>> future as a message, it may be referenced by multiple processes > >>>> which have > >>>> their own heap and garbage collection... > >>>> > >>>> regards, > >>>> Vlad > >>>> > >>>> > >>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud > >>>> > >>>> wrote: > >>>>> > >>>>> Hello > >>>>> > >>>>> Last evening I was trying to implement futures/promise > >>>>> mechanism in > >>>>> Erlang (mostly for fun, since I am still unsure if it is > >>>>> useful). I got > >>>>> inspired with the presentation [1], which mentioned using > >>>>> futures as a > >>>>> foundation of building services, where things like timeouts, > >>>>> tracing, > >>>>> authentication, etc. is built by composing futures (see slide > >>>>> 41). > >>>>> > >>>>> Do you think that such composition of futures could be useful > >>>>> as a tool > >>>>> to improve code reuse of communication patterns in Erlang (as > >>>>> described in > >>>>> the presentation)? > >>>>> > >>>>> I've implemented futures using processes and message passing > >>>>> and > >>>>> stumbled upon two issues: > >>>>> 1) garbage collection of futures > >>>>> 2) slightly too much code when using them > >>>>> > >>>>> Example of the first problem is here: > >>>>> > >>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > >>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > >>>>> 2> F:get(). %% it hangs for 10 seconds > >>>>> 10 > >>>>> > >>>>> Since future F is represented as a process <0.36.0> it will > >>>>> stay running > >>>>> forever till it's timed out (which is not a good solution, > >>>>> since someone may > >>>>> still have a reference to this future) or F:done() manually > >>>>> called. > >>>>> > >>>>> My idea is to insert into 'future' tuple a NIF-generated > >>>>> resource, which > >>>>> will have a destructor attached (called upon garbage collection > >>>>> of the > >>>>> resource) which will call F:done(). Will it work? > >>>>> > >>>>> The second issue is illustrated here: > >>>>> > >>>>> 7> F = future:new(). > >>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > >>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > >>>>> <0.49.0> > >>>>> 9> F:get(). > >>>>> 42 > >>>>> > >>>>> In ideal world it should be enough to just write "F" (without > >>>>> :get()) to > >>>>> fetch future's value, but it seems too far fetched for Erlang. > >>>>> Slightly > >>>>> better solution would be to allow calling future with "F()". > >>>>> > >>>>> This can be done by extending concept of "abstract modules" > >>>>> with > >>>>> "default call". Currently abstract modules allow the following: > >>>>> > >>>>> {future, Pid, Ref, undefined}:get() which is translated to > >>>>> future:get({future, Pid, Ref, undefined}) > >>>>> > >>>>> With a simple change in beam_emu.c in call_fun function (which > >>>>> would > >>>>> replace obsolete fun tuples) we can allow for the following: > >>>>> > >>>>> {future, Pid, Ref, undefined}() which COULD be translated to > >>>>> future:call({future, Pid, Ref, undefined}) > >>>>> > >>>>> hence allowing to use just "F()" to read a value of the future. > >>>>> This > >>>>> will also extend "metaprogramming" capabilities of Erlang for > >>>>> some other > >>>>> quirky use, which may or may not be a Good Thing(tm). > >>>>> > >>>>> Thoughts? > >>>>> > >>>>> Cheers, > >>>>> Gleb Peregud > >>>>> > >>>>> 1: http://monkey.org/~marius/talks/twittersystems/ > >>>>> > >>>>> _______________________________________________ > >>>>> erlang-questions mailing list > >>>>> erlang-questions@REDACTED > >>>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>>> > >>>> > >>> > >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From gleber.p@REDACTED Mon Nov 19 15:05:30 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 15:05:30 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> Message-ID: Then I wouldn't be able to set future's value after it being defined. Like in this example: 7> F = future:new(). {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). <0.49.0> 9> F:get(). 42 Without this ability such futures are useless with request-reply pattern: 1) Client sends request 2) Server creates a future and sends it back to client 3) Client does it's work with the value of the future (without bothering the fact that value may become available in uncertain future) 4) Server finishes computations and sets future's value On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding wrote: > Wouldn't it be easier if future:new just returned a fun? Then you could do F() without any changes? > > Robert > > ----- Original Message ----- >> From: "Gleb Peregud" >> To: "Vlad Dumitrescu" >> Cc: "Erlang" >> Sent: Monday, 19 November, 2012 2:18:11 PM >> Subject: Re: [erlang-questions] Futures/promises and ability to "call" abstract modules >> >> With the these changes [1] the following code works as intended: >> >> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >> 8> F(). >> 42 >> >> Aside from a problem where it improperly reports arity in case of >> undefined function: >> >> 9> F(1,2,3). >> ** exception error: undefined function future:call/3 >> >> 1: https://github.com/gleber/otp/compare/call-abstract-module >> >> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >> wrote: >> > Sverker Eriksson wrote the following in [1]: >> > >> >> But even if the resource terms look alike, they are unique and >> >> there is >> >> no bug leaking NIF resources (that I know of). A resource is >> >> released >> >> (and destructor called) when the last reference is garbage >> >> collected. >> >> The shell can fool you however, as it keeps a command history that >> >> can >> >> retain terms even though you think the variables are forgotten. >> >> Test NIF >> >> resource cleanup by running a test module and call >> >> erlang:garbage_collect to force destructors to be called. >> > >> > This seems to mean that they are "shared" and garbage collected >> > just once. >> > >> > 1: >> > http://erlang.org/pipermail/erlang-questions/2011-January/055524.html >> > >> > On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >> > wrote: >> >> I have no idea, that's why I asked :-) >> >> /Vlad >> >> >> >> >> >> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >> >> wrote: >> >>> >> >>> I assumed that NIF-generated resources are shared between >> >>> processes (the >> >>> same way as large binaries are), and I haven't done any tests on >> >>> this. Are >> >>> you sure it is garbate collected multiple times (once per >> >>> referencing >> >>> process)? >> >>> >> >>> >> >>> >> >>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >> >>> >> >>> wrote: >> >>>> >> >>>> Hi Gleb, >> >>>> >> >>>> just a quick observation about garbage collecting futures: would >> >>>> the >> >>>> NIF-generated resource keep track of usage across processes? I >> >>>> fI send a >> >>>> future as a message, it may be referenced by multiple processes >> >>>> which have >> >>>> their own heap and garbage collection... >> >>>> >> >>>> regards, >> >>>> Vlad >> >>>> >> >>>> >> >>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >> >>>> >> >>>> wrote: >> >>>>> >> >>>>> Hello >> >>>>> >> >>>>> Last evening I was trying to implement futures/promise >> >>>>> mechanism in >> >>>>> Erlang (mostly for fun, since I am still unsure if it is >> >>>>> useful). I got >> >>>>> inspired with the presentation [1], which mentioned using >> >>>>> futures as a >> >>>>> foundation of building services, where things like timeouts, >> >>>>> tracing, >> >>>>> authentication, etc. is built by composing futures (see slide >> >>>>> 41). >> >>>>> >> >>>>> Do you think that such composition of futures could be useful >> >>>>> as a tool >> >>>>> to improve code reuse of communication patterns in Erlang (as >> >>>>> described in >> >>>>> the presentation)? >> >>>>> >> >>>>> I've implemented futures using processes and message passing >> >>>>> and >> >>>>> stumbled upon two issues: >> >>>>> 1) garbage collection of futures >> >>>>> 2) slightly too much code when using them >> >>>>> >> >>>>> Example of the first problem is here: >> >>>>> >> >>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >> >>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >> >>>>> 2> F:get(). %% it hangs for 10 seconds >> >>>>> 10 >> >>>>> >> >>>>> Since future F is represented as a process <0.36.0> it will >> >>>>> stay running >> >>>>> forever till it's timed out (which is not a good solution, >> >>>>> since someone may >> >>>>> still have a reference to this future) or F:done() manually >> >>>>> called. >> >>>>> >> >>>>> My idea is to insert into 'future' tuple a NIF-generated >> >>>>> resource, which >> >>>>> will have a destructor attached (called upon garbage collection >> >>>>> of the >> >>>>> resource) which will call F:done(). Will it work? >> >>>>> >> >>>>> The second issue is illustrated here: >> >>>>> >> >>>>> 7> F = future:new(). >> >>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >> >>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >> >>>>> <0.49.0> >> >>>>> 9> F:get(). >> >>>>> 42 >> >>>>> >> >>>>> In ideal world it should be enough to just write "F" (without >> >>>>> :get()) to >> >>>>> fetch future's value, but it seems too far fetched for Erlang. >> >>>>> Slightly >> >>>>> better solution would be to allow calling future with "F()". >> >>>>> >> >>>>> This can be done by extending concept of "abstract modules" >> >>>>> with >> >>>>> "default call". Currently abstract modules allow the following: >> >>>>> >> >>>>> {future, Pid, Ref, undefined}:get() which is translated to >> >>>>> future:get({future, Pid, Ref, undefined}) >> >>>>> >> >>>>> With a simple change in beam_emu.c in call_fun function (which >> >>>>> would >> >>>>> replace obsolete fun tuples) we can allow for the following: >> >>>>> >> >>>>> {future, Pid, Ref, undefined}() which COULD be translated to >> >>>>> future:call({future, Pid, Ref, undefined}) >> >>>>> >> >>>>> hence allowing to use just "F()" to read a value of the future. >> >>>>> This >> >>>>> will also extend "metaprogramming" capabilities of Erlang for >> >>>>> some other >> >>>>> quirky use, which may or may not be a Good Thing(tm). >> >>>>> >> >>>>> Thoughts? >> >>>>> >> >>>>> Cheers, >> >>>>> Gleb Peregud >> >>>>> >> >>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >> >>>>> >> >>>>> _______________________________________________ >> >>>>> erlang-questions mailing list >> >>>>> erlang-questions@REDACTED >> >>>>> http://erlang.org/mailman/listinfo/erlang-questions >> >>>>> >> >>>> >> >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From bernard.fouche@REDACTED Mon Nov 19 18:21:17 2012 From: bernard.fouche@REDACTED (=?ISO-8859-1?Q?Bernard_Fouch=E9?=) Date: Mon, 19 Nov 2012 18:21:17 +0100 Subject: [erlang-questions] fallocate(FALLOC_FL_PUNCH_HOLE) / lseek(SEEK_HOLE / SEEK_DATA) anytime soon ? Message-ID: <50AA6A8D.2070607@kuantic.com> Hi List, Is there any chance that the API support these features in a reasonable time? I see that fallocate() implementation is stalled since 2010 and I read nothing about implementing fallocate(FALLOC_FL_PUNCH_HOLE) and adding support for lseek(SEEK_HOLE / SEEK_DATA) to [position/2] while all these features should allow one to write some interesting db backend on file systems supporting very large files. Thanks, Bernard From gleber.p@REDACTED Mon Nov 19 20:06:26 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 20:06:26 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <50AA366D.2050007@erlang.org> References: <50AA366D.2050007@erlang.org> Message-ID: Thanks for info :) Distributed version, if implemented nicely, would probably need changes in ERTS (e.g. ability to send resources between nodes and call some callbacks upon receive); otherwise users of library would need to manually call something like F:register() upon every receive... Actually garbage collection of processes may be useful as a standalone library - I had few situations when I wanted it to exist (but always managed to do the job without it). On Mon, Nov 19, 2012 at 2:38 PM, Patrik Nyblom wrote: > On 11/19/2012 11:48 AM, Gleb Peregud wrote: >> >> Sverker Eriksson wrote the following in [1]: >> >>> But even if the resource terms look alike, they are unique and there is >>> no bug leaking NIF resources (that I know of). A resource is released >>> (and destructor called) when the last reference is garbage collected. >>> The shell can fool you however, as it keeps a command history that can >>> retain terms even though you think the variables are forgotten. Test NIF >>> resource cleanup by running a test module and call >>> erlang:garbage_collect to force destructors to be called. >> >> This seems to mean that they are "shared" and garbage collected just once. > > That is correct. The callback however, is not really able to send messages, > you would have to relay information to a thread which in turn would have to > send a message to the future to make it exit. It seems to be technically > possible at least, given an SMP VM. You would more or less implement garbage > collection of processes, which would be kind of cool, I think :) > > Of course distribution would generate a slightly bigger challenge... > > Cheers, > /Patrik > >> >> 1: http://erlang.org/pipermail/erlang-questions/2011-January/055524.html >> >> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >> wrote: >>> >>> I have no idea, that's why I asked :-) >>> /Vlad >>> >>> >>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >>> wrote: >>>> >>>> I assumed that NIF-generated resources are shared between processes (the >>>> same way as large binaries are), and I haven't done any tests on this. >>>> Are >>>> you sure it is garbate collected multiple times (once per referencing >>>> process)? >>>> >>>> >>>> >>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>>> wrote: >>>>> >>>>> Hi Gleb, >>>>> >>>>> just a quick observation about garbage collecting futures: would the >>>>> NIF-generated resource keep track of usage across processes? I fI send >>>>> a >>>>> future as a message, it may be referenced by multiple processes which >>>>> have >>>>> their own heap and garbage collection... >>>>> >>>>> regards, >>>>> Vlad >>>>> >>>>> >>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>>> wrote: >>>>>> >>>>>> Hello >>>>>> >>>>>> Last evening I was trying to implement futures/promise mechanism in >>>>>> Erlang (mostly for fun, since I am still unsure if it is useful). I >>>>>> got >>>>>> inspired with the presentation [1], which mentioned using futures as a >>>>>> foundation of building services, where things like timeouts, tracing, >>>>>> authentication, etc. is built by composing futures (see slide 41). >>>>>> >>>>>> Do you think that such composition of futures could be useful as a >>>>>> tool >>>>>> to improve code reuse of communication patterns in Erlang (as >>>>>> described in >>>>>> the presentation)? >>>>>> >>>>>> I've implemented futures using processes and message passing and >>>>>> stumbled upon two issues: >>>>>> 1) garbage collection of futures >>>>>> 2) slightly too much code when using them >>>>>> >>>>>> Example of the first problem is here: >>>>>> >>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>>> 2> F:get(). %% it hangs for 10 seconds >>>>>> 10 >>>>>> >>>>>> Since future F is represented as a process <0.36.0> it will stay >>>>>> running >>>>>> forever till it's timed out (which is not a good solution, since >>>>>> someone may >>>>>> still have a reference to this future) or F:done() manually called. >>>>>> >>>>>> My idea is to insert into 'future' tuple a NIF-generated resource, >>>>>> which >>>>>> will have a destructor attached (called upon garbage collection of the >>>>>> resource) which will call F:done(). Will it work? >>>>>> >>>>>> The second issue is illustrated here: >>>>>> >>>>>> 7> F = future:new(). >>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>>> <0.49.0> >>>>>> 9> F:get(). >>>>>> 42 >>>>>> >>>>>> In ideal world it should be enough to just write "F" (without :get()) >>>>>> to >>>>>> fetch future's value, but it seems too far fetched for Erlang. >>>>>> Slightly >>>>>> better solution would be to allow calling future with "F()". >>>>>> >>>>>> This can be done by extending concept of "abstract modules" with >>>>>> "default call". Currently abstract modules allow the following: >>>>>> >>>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>>> future:get({future, Pid, Ref, undefined}) >>>>>> >>>>>> With a simple change in beam_emu.c in call_fun function (which would >>>>>> replace obsolete fun tuples) we can allow for the following: >>>>>> >>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>>> future:call({future, Pid, Ref, undefined}) >>>>>> >>>>>> hence allowing to use just "F()" to read a value of the future. This >>>>>> will also extend "metaprogramming" capabilities of Erlang for some >>>>>> other >>>>>> quirky use, which may or may not be a Good Thing(tm). >>>>>> >>>>>> Thoughts? >>>>>> >>>>>> Cheers, >>>>>> Gleb Peregud >>>>>> >>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmercer@REDACTED Mon Nov 19 21:58:37 2012 From: dmercer@REDACTED (David Mercer) Date: Mon, 19 Nov 2012 14:58:37 -0600 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: <50AA366D.2050007@erlang.org> Message-ID: <000101cdc698$a5c56c40$f15044c0$@gmail.com> At a high level, how would you GC the processes? Just kill processes stuck at a receive (with no after) for which no other process on any connected node have a reference to the process? Or is there a more elegant/better way to do it? Cheers, DBM > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Gleb Peregud > Sent: Monday, November 19, 2012 13:06 > To: Patrik Nyblom > Cc: Erlang > Subject: Re: [erlang-questions] Futures/promises and ability to "call" > abstract modules > > Thanks for info :) Distributed version, if implemented nicely, would > probably need changes in ERTS (e.g. ability to send resources between > nodes and call some callbacks upon receive); otherwise users of library > would need to manually call something like F:register() upon every > receive... > > Actually garbage collection of processes may be useful as a standalone > library - I had few situations when I wanted it to exist (but always > managed to do the job without it). > > On Mon, Nov 19, 2012 at 2:38 PM, Patrik Nyblom wrote: > > On 11/19/2012 11:48 AM, Gleb Peregud wrote: > >> > >> Sverker Eriksson wrote the following in [1]: > >> > >>> But even if the resource terms look alike, they are unique and there > >>> is no bug leaking NIF resources (that I know of). A resource is > >>> released (and destructor called) when the last reference is garbage > collected. > >>> The shell can fool you however, as it keeps a command history that > >>> can retain terms even though you think the variables are forgotten. > >>> Test NIF resource cleanup by running a test module and call > >>> erlang:garbage_collect to force destructors to be called. > >> > >> This seems to mean that they are "shared" and garbage collected just > once. > > > > That is correct. The callback however, is not really able to send > > messages, you would have to relay information to a thread which in > > turn would have to send a message to the future to make it exit. It > > seems to be technically possible at least, given an SMP VM. You would > > more or less implement garbage collection of processes, which would be > > kind of cool, I think :) > > > > Of course distribution would generate a slightly bigger challenge... > > > > Cheers, > > /Patrik > > > >> > >> 1: > >> http://erlang.org/pipermail/erlang-questions/2011-January/055524.html > >> > >> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu > >> > >> wrote: > >>> > >>> I have no idea, that's why I asked :-) /Vlad > >>> > >>> > >>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud > >>> wrote: > >>>> > >>>> I assumed that NIF-generated resources are shared between processes > (the > >>>> same way as large binaries are), and I haven't done any tests on > this. > >>>> Are > >>>> you sure it is garbate collected multiple times (once per referencing > >>>> process)? > >>>> > >>>> > >>>> > >>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu > > >>>> wrote: > >>>>> > >>>>> Hi Gleb, > >>>>> > >>>>> just a quick observation about garbage collecting futures: would the > >>>>> NIF-generated resource keep track of usage across processes? I fI > send > >>>>> a > >>>>> future as a message, it may be referenced by multiple processes > which > >>>>> have > >>>>> their own heap and garbage collection... > >>>>> > >>>>> regards, > >>>>> Vlad > >>>>> > >>>>> > >>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud > >>>>> wrote: > >>>>>> > >>>>>> Hello > >>>>>> > >>>>>> Last evening I was trying to implement futures/promise mechanism in > >>>>>> Erlang (mostly for fun, since I am still unsure if it is useful). I > >>>>>> got > >>>>>> inspired with the presentation [1], which mentioned using futures > as a > >>>>>> foundation of building services, where things like timeouts, > tracing, > >>>>>> authentication, etc. is built by composing futures (see slide 41). > >>>>>> > >>>>>> Do you think that such composition of futures could be useful as a > >>>>>> tool > >>>>>> to improve code reuse of communication patterns in Erlang (as > >>>>>> described in > >>>>>> the presentation)? > >>>>>> > >>>>>> I've implemented futures using processes and message passing and > >>>>>> stumbled upon two issues: > >>>>>> 1) garbage collection of futures > >>>>>> 2) slightly too much code when using them > >>>>>> > >>>>>> Example of the first problem is here: > >>>>>> > >>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > >>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > >>>>>> 2> F:get(). %% it hangs for 10 seconds > >>>>>> 10 > >>>>>> > >>>>>> Since future F is represented as a process <0.36.0> it will stay > >>>>>> running > >>>>>> forever till it's timed out (which is not a good solution, since > >>>>>> someone may > >>>>>> still have a reference to this future) or F:done() manually called. > >>>>>> > >>>>>> My idea is to insert into 'future' tuple a NIF-generated resource, > >>>>>> which > >>>>>> will have a destructor attached (called upon garbage collection of > the > >>>>>> resource) which will call F:done(). Will it work? > >>>>>> > >>>>>> The second issue is illustrated here: > >>>>>> > >>>>>> 7> F = future:new(). > >>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > >>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > >>>>>> <0.49.0> > >>>>>> 9> F:get(). > >>>>>> 42 > >>>>>> > >>>>>> In ideal world it should be enough to just write "F" (without > :get()) > >>>>>> to > >>>>>> fetch future's value, but it seems too far fetched for Erlang. > >>>>>> Slightly > >>>>>> better solution would be to allow calling future with "F()". > >>>>>> > >>>>>> This can be done by extending concept of "abstract modules" with > >>>>>> "default call". Currently abstract modules allow the following: > >>>>>> > >>>>>> {future, Pid, Ref, undefined}:get() which is translated to > >>>>>> future:get({future, Pid, Ref, undefined}) > >>>>>> > >>>>>> With a simple change in beam_emu.c in call_fun function (which > would > >>>>>> replace obsolete fun tuples) we can allow for the following: > >>>>>> > >>>>>> {future, Pid, Ref, undefined}() which COULD be translated to > >>>>>> future:call({future, Pid, Ref, undefined}) > >>>>>> > >>>>>> hence allowing to use just "F()" to read a value of the future. > This > >>>>>> will also extend "metaprogramming" capabilities of Erlang for some > >>>>>> other > >>>>>> quirky use, which may or may not be a Good Thing(tm). > >>>>>> > >>>>>> Thoughts? > >>>>>> > >>>>>> Cheers, > >>>>>> Gleb Peregud > >>>>>> > >>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ > >>>>>> > >>>>>> _______________________________________________ > >>>>>> erlang-questions mailing list > >>>>>> erlang-questions@REDACTED > >>>>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>>>> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Mon Nov 19 22:04:32 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 20 Nov 2012 10:04:32 +1300 Subject: [erlang-questions] fallocate(FALLOC_FL_PUNCH_HOLE) / lseek(SEEK_HOLE / SEEK_DATA) anytime soon ? In-Reply-To: <50AA6A8D.2070607@kuantic.com> References: <50AA6A8D.2070607@kuantic.com> Message-ID: On 20/11/2012, at 6:21 AM, Bernard Fouch? wrote: > Hi List, > > Is there any chance that the API support these features in a reasonable time? Out of three operating systems immediately available to me, two (Solaris, Mac OS X) do not have fallocate, and one (three different versions of Linux that I am counting as one) does have fallocate() but insists that it has only an FALLOC_FL_KEEP_SIZE flag. At its best, fallocate is Linux-specific, and posix_fallocate has no 'mode' argument, just fd, offset, and size. All of these operating systems support very large files, and also support files with holes where nothing was ever created in the first place. There is clearly room for Erlang access to operating-system-specific features, through operating-system-specific modules. From gleber.p@REDACTED Mon Nov 19 22:06:45 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 19 Nov 2012 22:06:45 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <000101cdc698$a5c56c40$f15044c0$@gmail.com> References: <50AA366D.2050007@erlang.org> <000101cdc698$a5c56c40$f15044c0$@gmail.com> Message-ID: In this particular case of futures implementation, using NIF-based resources, it would be enough to send a {done, Ref} to a process and it'll handle it and cease any further looping (hence terminating itself), which seems elegant enough. Killing is also an option, but brutality is not necessary in my case :) Of course distributed case, as mentioned, is a whole new story. On Mon, Nov 19, 2012 at 9:58 PM, David Mercer wrote: > At a high level, how would you GC the processes? Just kill processes stuck at a receive (with no after) for which no other process on any connected node have a reference to the process? Or is there a more elegant/better way to do it? > > Cheers, > > DBM > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >> bounces@REDACTED] On Behalf Of Gleb Peregud >> Sent: Monday, November 19, 2012 13:06 >> To: Patrik Nyblom >> Cc: Erlang >> Subject: Re: [erlang-questions] Futures/promises and ability to "call" >> abstract modules >> >> Thanks for info :) Distributed version, if implemented nicely, would >> probably need changes in ERTS (e.g. ability to send resources between >> nodes and call some callbacks upon receive); otherwise users of library >> would need to manually call something like F:register() upon every >> receive... >> >> Actually garbage collection of processes may be useful as a standalone >> library - I had few situations when I wanted it to exist (but always >> managed to do the job without it). >> >> On Mon, Nov 19, 2012 at 2:38 PM, Patrik Nyblom wrote: >> > On 11/19/2012 11:48 AM, Gleb Peregud wrote: >> >> >> >> Sverker Eriksson wrote the following in [1]: >> >> >> >>> But even if the resource terms look alike, they are unique and there >> >>> is no bug leaking NIF resources (that I know of). A resource is >> >>> released (and destructor called) when the last reference is garbage >> collected. >> >>> The shell can fool you however, as it keeps a command history that >> >>> can retain terms even though you think the variables are forgotten. >> >>> Test NIF resource cleanup by running a test module and call >> >>> erlang:garbage_collect to force destructors to be called. >> >> >> >> This seems to mean that they are "shared" and garbage collected just >> once. >> > >> > That is correct. The callback however, is not really able to send >> > messages, you would have to relay information to a thread which in >> > turn would have to send a message to the future to make it exit. It >> > seems to be technically possible at least, given an SMP VM. You would >> > more or less implement garbage collection of processes, which would be >> > kind of cool, I think :) >> > >> > Of course distribution would generate a slightly bigger challenge... >> > >> > Cheers, >> > /Patrik >> > >> >> >> >> 1: >> >> http://erlang.org/pipermail/erlang-questions/2011-January/055524.html >> >> >> >> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >> >> >> >> wrote: >> >>> >> >>> I have no idea, that's why I asked :-) /Vlad >> >>> >> >>> >> >>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >> >>> wrote: >> >>>> >> >>>> I assumed that NIF-generated resources are shared between processes >> (the >> >>>> same way as large binaries are), and I haven't done any tests on >> this. >> >>>> Are >> >>>> you sure it is garbate collected multiple times (once per referencing >> >>>> process)? >> >>>> >> >>>> >> >>>> >> >>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >> >> >>>> wrote: >> >>>>> >> >>>>> Hi Gleb, >> >>>>> >> >>>>> just a quick observation about garbage collecting futures: would the >> >>>>> NIF-generated resource keep track of usage across processes? I fI >> send >> >>>>> a >> >>>>> future as a message, it may be referenced by multiple processes >> which >> >>>>> have >> >>>>> their own heap and garbage collection... >> >>>>> >> >>>>> regards, >> >>>>> Vlad >> >>>>> >> >>>>> >> >>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >> >>>>> wrote: >> >>>>>> >> >>>>>> Hello >> >>>>>> >> >>>>>> Last evening I was trying to implement futures/promise mechanism in >> >>>>>> Erlang (mostly for fun, since I am still unsure if it is useful). I >> >>>>>> got >> >>>>>> inspired with the presentation [1], which mentioned using futures >> as a >> >>>>>> foundation of building services, where things like timeouts, >> tracing, >> >>>>>> authentication, etc. is built by composing futures (see slide 41). >> >>>>>> >> >>>>>> Do you think that such composition of futures could be useful as a >> >>>>>> tool >> >>>>>> to improve code reuse of communication patterns in Erlang (as >> >>>>>> described in >> >>>>>> the presentation)? >> >>>>>> >> >>>>>> I've implemented futures using processes and message passing and >> >>>>>> stumbled upon two issues: >> >>>>>> 1) garbage collection of futures >> >>>>>> 2) slightly too much code when using them >> >>>>>> >> >>>>>> Example of the first problem is here: >> >>>>>> >> >>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >> >>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >> >>>>>> 2> F:get(). %% it hangs for 10 seconds >> >>>>>> 10 >> >>>>>> >> >>>>>> Since future F is represented as a process <0.36.0> it will stay >> >>>>>> running >> >>>>>> forever till it's timed out (which is not a good solution, since >> >>>>>> someone may >> >>>>>> still have a reference to this future) or F:done() manually called. >> >>>>>> >> >>>>>> My idea is to insert into 'future' tuple a NIF-generated resource, >> >>>>>> which >> >>>>>> will have a destructor attached (called upon garbage collection of >> the >> >>>>>> resource) which will call F:done(). Will it work? >> >>>>>> >> >>>>>> The second issue is illustrated here: >> >>>>>> >> >>>>>> 7> F = future:new(). >> >>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >> >>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >> >>>>>> <0.49.0> >> >>>>>> 9> F:get(). >> >>>>>> 42 >> >>>>>> >> >>>>>> In ideal world it should be enough to just write "F" (without >> :get()) >> >>>>>> to >> >>>>>> fetch future's value, but it seems too far fetched for Erlang. >> >>>>>> Slightly >> >>>>>> better solution would be to allow calling future with "F()". >> >>>>>> >> >>>>>> This can be done by extending concept of "abstract modules" with >> >>>>>> "default call". Currently abstract modules allow the following: >> >>>>>> >> >>>>>> {future, Pid, Ref, undefined}:get() which is translated to >> >>>>>> future:get({future, Pid, Ref, undefined}) >> >>>>>> >> >>>>>> With a simple change in beam_emu.c in call_fun function (which >> would >> >>>>>> replace obsolete fun tuples) we can allow for the following: >> >>>>>> >> >>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >> >>>>>> future:call({future, Pid, Ref, undefined}) >> >>>>>> >> >>>>>> hence allowing to use just "F()" to read a value of the future. >> This >> >>>>>> will also extend "metaprogramming" capabilities of Erlang for some >> >>>>>> other >> >>>>>> quirky use, which may or may not be a Good Thing(tm). >> >>>>>> >> >>>>>> Thoughts? >> >>>>>> >> >>>>>> Cheers, >> >>>>>> Gleb Peregud >> >>>>>> >> >>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >> >>>>>> >> >>>>>> _______________________________________________ >> >>>>>> erlang-questions mailing list >> >>>>>> erlang-questions@REDACTED >> >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >> >>>>>> >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From g@REDACTED Mon Nov 19 22:40:52 2012 From: g@REDACTED (Garrett Smith) Date: Mon, 19 Nov 2012 15:40:52 -0600 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: On Mon, Nov 19, 2012 at 4:32 AM, Gleb Peregud wrote: > Hello > > Last evening I was trying to implement futures/promise mechanism in Erlang > (mostly for fun, since I am still unsure if it is useful). I got inspired > with the presentation [1], which mentioned using futures as a foundation of > building services, where things like timeouts, tracing, authentication, etc. > is built by composing futures (see slide 41). > > Do you think that such composition of futures could be useful as a tool to > improve code reuse of communication patterns in Erlang (as described in the > presentation)? >From the presentation, the only motivation for "futures" that I can see is this: http://monkey.org/~marius/talks/twittersystems/#26 Here's what's on that slide, entitled "Futures": * A placeholder for for a result that is, usually, being computed concurrently -- long computations -- network call -- reading from disk * Computations can fail: -- connection failure -- timeout -- div by zero * Futures are how we represent concurrent execution. I don't see anywhere a problem here, unless you're unhappy with threads and want to use some "async" library that requires the use of callbacks, or this futures thing. Of course that's why you'd use Erlang. As it turns out, all of this is handled rather elegantly by Erlang's concurrency model, which uses processes and message passing. It might be an interesting exercise to figure out how GC works in under a particular use case, but from the list above, it's unclear what problems you're trying to solve in Erlang. Garrett From steven.charles.davis@REDACTED Tue Nov 20 01:44:05 2012 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 19 Nov 2012 16:44:05 -0800 (PST) Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> Message-ID: <1ed28dc4-4488-4586-a8b0-4860c15cadc6@googlegroups.com> On Monday, November 19, 2012 8:01:44 AM UTC-6, Robert Virding wrote: > > Wouldn't it be easier if future:new just returned a fun? Then you could do > F() without any changes? > > Robert > > +1 Isn't this the solution? If not, I'm finding it hard to see *why* not! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Tue Nov 20 01:58:09 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 19 Nov 2012 19:58:09 -0500 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: <20121120005807.GC73760@ferdmbp.local> On 11/19, Garrett Smith wrote: > > From the presentation, the only motivation for "futures" that I can see is this: > > http://monkey.org/~marius/talks/twittersystems/#26 > > Here's what's on that slide, entitled "Futures": > > * A placeholder for for a result that is, usually, being computed concurrently > -- long computations > -- network call > -- reading from disk > * Computations can fail: > -- connection failure > -- timeout > -- div by zero > * Futures are how we represent concurrent execution. > Based on these requirements, it sounds like a sequence of calls to the `rpc` module would solve the problem: 5> MaxTime = rpc:async_call(node(), timer, sleep, [30000]). <0.48.0> 6> lists:sort([a,c,b]). [a,b,c] 7> rpc:yield(MaxTime). ... [long wait] ... ok or: 8> Key2 = rpc:async_call(node(), timer, sleep, [30000]). <0.52.0> 9> rpc:nb_yield(Key2). timeout 12> rpc:nb_yield(Key2, 1000). timeout 13> rpc:nb_yield(Key2, 100000). ... [long wait] ... {value,ok} The only part missing is the caching of results for something more or less read-only. If anything, wrapping around `rpc` calls doesn't sound all bad for an implementation, especially given it supports multinode calls and whatnot already. Regards, Fred. From solomon.wzs@REDACTED Tue Nov 20 03:18:15 2012 From: solomon.wzs@REDACTED (Solomon) Date: Tue, 20 Nov 2012 10:18:15 +0800 Subject: [erlang-questions] Efficiency of qlc Message-ID: I want to wirte a sql compiler for mnesia, so I need to dynamic compile the query string by qlc:string_to_handle/1, but it is much slower than native code. And I found that: code 1: *qlc:string_to_handle("[X||X<-[1,2,3]].")* return: *{qlc_handle,{qlc_lc,#Fun, {qlc_opt,false,false,-1,any,[],any,524288,allowed}}}* code 2: *qlc:q([X||X<-[1,2,3]])* return: *{qlc_handle,{qlc_lc,#Fun, {qlc_opt,false,false,-1,any,[],any,524288,allowed}}}* so I think the reason is that: code 1 run by erl_eval, it scan and parser the code every time, and code 2 by beam, so code 1 was much slower than code 2. Is there any method to solve this problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From be.dmitry@REDACTED Tue Nov 20 04:48:23 2012 From: be.dmitry@REDACTED (Dmitry Belyaev) Date: Tue, 20 Nov 2012 07:48:23 +0400 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> Message-ID: <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.1 (abort with ^G) 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) end), fun() -> P ! {get, self()}, receive V -> V end end end)(). #Fun 2> F(). undefined 3> element(2,lists:keyfind('P', 1, lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. {value,10} 4> F(). 10 5> -- Dmitry Belyaev On 19.11.2012, at 18:05, Gleb Peregud wrote: > Then I wouldn't be able to set future's value after it being defined. > Like in this example: > > 7> F = future:new(). > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > <0.49.0> > 9> F:get(). > 42 > > Without this ability such futures are useless with request-reply pattern: > 1) Client sends request > 2) Server creates a future and sends it back to client > 3) Client does it's work with the value of the future (without > bothering the fact that value may become available in uncertain > future) > 4) Server finishes computations and sets future's value > > > On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding > wrote: >> Wouldn't it be easier if future:new just returned a fun? Then you could do F() without any changes? >> >> Robert >> >> ----- Original Message ----- >>> From: "Gleb Peregud" >>> To: "Vlad Dumitrescu" >>> Cc: "Erlang" >>> Sent: Monday, 19 November, 2012 2:18:11 PM >>> Subject: Re: [erlang-questions] Futures/promises and ability to "call" abstract modules >>> >>> With the these changes [1] the following code works as intended: >>> >>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >>> 8> F(). >>> 42 >>> >>> Aside from a problem where it improperly reports arity in case of >>> undefined function: >>> >>> 9> F(1,2,3). >>> ** exception error: undefined function future:call/3 >>> >>> 1: https://github.com/gleber/otp/compare/call-abstract-module >>> >>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >>> wrote: >>>> Sverker Eriksson wrote the following in [1]: >>>> >>>>> But even if the resource terms look alike, they are unique and >>>>> there is >>>>> no bug leaking NIF resources (that I know of). A resource is >>>>> released >>>>> (and destructor called) when the last reference is garbage >>>>> collected. >>>>> The shell can fool you however, as it keeps a command history that >>>>> can >>>>> retain terms even though you think the variables are forgotten. >>>>> Test NIF >>>>> resource cleanup by running a test module and call >>>>> erlang:garbage_collect to force destructors to be called. >>>> >>>> This seems to mean that they are "shared" and garbage collected >>>> just once. >>>> >>>> 1: >>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.html >>>> >>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >>>> wrote: >>>>> I have no idea, that's why I asked :-) >>>>> /Vlad >>>>> >>>>> >>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >>>>> wrote: >>>>>> >>>>>> I assumed that NIF-generated resources are shared between >>>>>> processes (the >>>>>> same way as large binaries are), and I haven't done any tests on >>>>>> this. Are >>>>>> you sure it is garbate collected multiple times (once per >>>>>> referencing >>>>>> process)? >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>>>>> >>>>>> wrote: >>>>>>> >>>>>>> Hi Gleb, >>>>>>> >>>>>>> just a quick observation about garbage collecting futures: would >>>>>>> the >>>>>>> NIF-generated resource keep track of usage across processes? I >>>>>>> fI send a >>>>>>> future as a message, it may be referenced by multiple processes >>>>>>> which have >>>>>>> their own heap and garbage collection... >>>>>>> >>>>>>> regards, >>>>>>> Vlad >>>>>>> >>>>>>> >>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>>>>> >>>>>>> wrote: >>>>>>>> >>>>>>>> Hello >>>>>>>> >>>>>>>> Last evening I was trying to implement futures/promise >>>>>>>> mechanism in >>>>>>>> Erlang (mostly for fun, since I am still unsure if it is >>>>>>>> useful). I got >>>>>>>> inspired with the presentation [1], which mentioned using >>>>>>>> futures as a >>>>>>>> foundation of building services, where things like timeouts, >>>>>>>> tracing, >>>>>>>> authentication, etc. is built by composing futures (see slide >>>>>>>> 41). >>>>>>>> >>>>>>>> Do you think that such composition of futures could be useful >>>>>>>> as a tool >>>>>>>> to improve code reuse of communication patterns in Erlang (as >>>>>>>> described in >>>>>>>> the presentation)? >>>>>>>> >>>>>>>> I've implemented futures using processes and message passing >>>>>>>> and >>>>>>>> stumbled upon two issues: >>>>>>>> 1) garbage collection of futures >>>>>>>> 2) slightly too much code when using them >>>>>>>> >>>>>>>> Example of the first problem is here: >>>>>>>> >>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>>>>> 2> F:get(). %% it hangs for 10 seconds >>>>>>>> 10 >>>>>>>> >>>>>>>> Since future F is represented as a process <0.36.0> it will >>>>>>>> stay running >>>>>>>> forever till it's timed out (which is not a good solution, >>>>>>>> since someone may >>>>>>>> still have a reference to this future) or F:done() manually >>>>>>>> called. >>>>>>>> >>>>>>>> My idea is to insert into 'future' tuple a NIF-generated >>>>>>>> resource, which >>>>>>>> will have a destructor attached (called upon garbage collection >>>>>>>> of the >>>>>>>> resource) which will call F:done(). Will it work? >>>>>>>> >>>>>>>> The second issue is illustrated here: >>>>>>>> >>>>>>>> 7> F = future:new(). >>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>>>>> <0.49.0> >>>>>>>> 9> F:get(). >>>>>>>> 42 >>>>>>>> >>>>>>>> In ideal world it should be enough to just write "F" (without >>>>>>>> :get()) to >>>>>>>> fetch future's value, but it seems too far fetched for Erlang. >>>>>>>> Slightly >>>>>>>> better solution would be to allow calling future with "F()". >>>>>>>> >>>>>>>> This can be done by extending concept of "abstract modules" >>>>>>>> with >>>>>>>> "default call". Currently abstract modules allow the following: >>>>>>>> >>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>>>>> future:get({future, Pid, Ref, undefined}) >>>>>>>> >>>>>>>> With a simple change in beam_emu.c in call_fun function (which >>>>>>>> would >>>>>>>> replace obsolete fun tuples) we can allow for the following: >>>>>>>> >>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>>>>> future:call({future, Pid, Ref, undefined}) >>>>>>>> >>>>>>>> hence allowing to use just "F()" to read a value of the future. >>>>>>>> This >>>>>>>> will also extend "metaprogramming" capabilities of Erlang for >>>>>>>> some other >>>>>>>> quirky use, which may or may not be a Good Thing(tm). >>>>>>>> >>>>>>>> Thoughts? >>>>>>>> >>>>>>>> Cheers, >>>>>>>> Gleb Peregud >>>>>>>> >>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> erlang-questions mailing list >>>>>>>> erlang-questions@REDACTED >>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>>>> >>>>>>> >>>>>> >>>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From freeakk@REDACTED Tue Nov 20 08:39:41 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Tue, 20 Nov 2012 10:39:41 +0300 Subject: [erlang-questions] Efficiency of qlc In-Reply-To: References: Message-ID: When I have a problem with erl_eval, I created beam modules with my code dynamically using smerl. https://github.com/adie/erlydb/blob/master/src/smerl/smerl.erl But it does not solve all problems, because this _compilation_ is slow too. But compiled code is fast. You can collect statistic for each unique query and compile intensively used ones. It is also a good idea to use parametrized queries like this: SELECT * FROM t1 WHERE f1 = ? It will decrease the count of unique queries. From bernard.fouche@REDACTED Tue Nov 20 09:28:22 2012 From: bernard.fouche@REDACTED (=?ISO-8859-1?Q?Bernard_Fouch=E9?=) Date: Tue, 20 Nov 2012 09:28:22 +0100 Subject: [erlang-questions] fallocate(FALLOC_FL_PUNCH_HOLE) / lseek(SEEK_HOLE / SEEK_DATA) anytime soon ? In-Reply-To: References: <50AA6A8D.2070607@kuantic.com> Message-ID: <50AB3F26.7050306@kuantic.com> Hi Richard, thanks for your answer Le 19/11/2012 22:04, Richard O'Keefe a ?crit : > On 20/11/2012, at 6:21 AM, Bernard Fouch? wrote: > >> Hi List, >> >> Is there any chance that the API support these features in a reasonable time? > Out of three operating systems immediately available to me, > two (Solaris, Mac OS X) do not have fallocate, and one (three different > versions of Linux that I am counting as one) does have fallocate() but > insists that it has only an FALLOC_FL_KEEP_SIZE flag. man 2 fallocate reports the same for me on Fedora 17 however FALLOC_FL_PUNCH_HOLE is listed in /usr/include/linux/falloc.h . I guess the man page is obsolete since kernel 2.6.38: http://man7.org/tlpi/api_changes/index.html#Linux-2.6.38 . It seems that Solaris has fcntl(F_FREESP) which provides the same feature. I can't tell about Mac OS X. The feature is available in more and more fs (zfs, xfs, etx4, btrfs and others). With large files (2^64), in my use case (fixed size keys and fixed size values), I should be able to avoid indexing a table since I can lseek to (item_number * item_size) and free the corresponding disk block(s) when I don't need the data anymore, instead of managing a list of free blocks or instead of merging different files that handles deleted data by marking it with a tombstone value. Data will be fragmented but with a copy-on-write fs it is anyway and I guess it will be faster than to process an index or merging files. BTW some of the mentioned fs also have a defragment tool that can run on a live system. > At its best, fallocate is Linux-specific, and posix_fallocate has > no 'mode' argument, just fd, offset, and size. > All of these operating systems support very large files, and > also support files with holes where nothing was ever created in the > first place. > > There is clearly room for Erlang access to operating-system-specific > features, through operating-system-specific modules. > I'm still an Erlang novice and didn't look yet at the details of the interface with the underlying OS. I'll try to find how an IoDevice is matched to a fd... Bernard From mrtndimitrov@REDACTED Tue Nov 20 10:44:26 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 20 Nov 2012 11:44:26 +0200 Subject: [erlang-questions] RabbitMQ Erlang client integration Message-ID: <50AB50FA.2040503@gmail.com> Hi all, I want to connect to RabbitMQ broker through the Erlang client listed on their site. The problem is that it defines a record "user" and in our app we already have such named record. What can I do with minimal code changes? Thank you very much. Regards, Martin From demeshchuk@REDACTED Tue Nov 20 10:47:21 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Tue, 20 Nov 2012 13:47:21 +0400 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB50FA.2040503@gmail.com> References: <50AB50FA.2040503@gmail.com> Message-ID: The possibly shortest way is to abuse the fact that records are actually tuples and instead of using a #user record for rabbitmq just use a tuple that corresponds to it. And comment out the rabbitmq's #user record definition, of course. On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov wrote: > Hi all, > > I want to connect to RabbitMQ broker through the Erlang client listed on > their site. The problem is that it defines a record "user" and in our > app we already have such named record. > > What can I do with minimal code changes? > > Thank you very much. > > Regards, > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From bog09@REDACTED Tue Nov 20 10:47:40 2012 From: bog09@REDACTED (Bogdan Andu) Date: Tue, 20 Nov 2012 01:47:40 -0800 (PST) Subject: [erlang-questions] error_logger heap overflow Message-ID: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> Hello, I have a concurent server that handles ssl conections. I saw that if there are aprox. 20 parallel connections to the server running for about 1 day, the virtual machine dies with the following message: Slogan: eheap_alloc: Cannot allocate 2850821240 bytes of memory (of type "heap"). System version: Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] ...... I have two questions: 1) Process Information Pid Name/Spawned as State Reductions Stack+heap MsgQ Length <0.5.0> error_logger Garbing (limited info) 129146284187 356352655 323792 356352655*8 = 2850821240, exactly the value from "Cannot allocate 2850821240 bytes of memory" message. The error_logger process accumulates a high number of pending messages in the message queue, resulting in heap exhaustion. The amount and size of the log messages sent to error_logger are normal normal. How can I make error_logger to process messages faster and to avoid heap overflow error. 2) Another question is this: I observed that the ets table ssl_otp_session_cache get large although the client is the same: =ets:<0.70.0> Slot: 23 Table: 28695 Name: ssl_otp_session_cache Buckets: 6224 Objects: 41912 Words: 2058733 (2058733*8)/(1024*1024) =~ 15 MBytes Altough I know the cache entries expire after 24 hours how can I decrease this timeout to 1 hour, for example? Or how can I disable the ssl caching altogether? Thank you, Bogdan From gleber.p@REDACTED Tue Nov 20 10:58:37 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 10:58:37 +0100 Subject: [erlang-questions] error_logger heap overflow In-Reply-To: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> References: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> Message-ID: To cope with error_logger use lager or riak_err SSL used to have some "session leaking" bug some time ago, but I believe it was fixed. Others may have more information on this On Tue, Nov 20, 2012 at 10:47 AM, Bogdan Andu wrote: > Hello, > > I have a concurent server that handles ssl conections. I saw that if there are aprox. 20 parallel connections to the server running for about 1 day, the virtual machine dies with the following message: > > Slogan: eheap_alloc: Cannot allocate 2850821240 bytes of memory (of type "heap"). > System version: Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] > > ...... > > I have two questions: > > > 1) > Process Information > > > Pid > Name/Spawned as > State > Reductions > Stack+heap > MsgQ Length > <0.5.0> error_logger Garbing > (limited info) 129146284187 356352655 323792 > > > 356352655*8 = 2850821240, exactly the value from "Cannot allocate 2850821240 bytes of memory" message. > > The error_logger process accumulates a high number of pending messages in the message queue, resulting in heap exhaustion. > > The amount and size of the log messages sent to error_logger are normal normal. > > How can I make error_logger to process messages faster and to avoid heap overflow error. > > > 2) > Another question is this: > > I observed that the ets table ssl_otp_session_cache get large although the client is the same: > > =ets:<0.70.0> > Slot: 23 > Table: 28695 > Name: ssl_otp_session_cache > Buckets: 6224 > Objects: 41912 > Words: 2058733 > > (2058733*8)/(1024*1024) =~ 15 MBytes > > Altough I know the cache entries expire after 24 hours how can I decrease this timeout to 1 hour, for example? > > Or how can I disable the ssl caching altogether? > > Thank you, > > Bogdan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From francesco@REDACTED Tue Nov 20 10:59:35 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Tue, 20 Nov 2012 09:59:35 +0000 Subject: [erlang-questions] Free Erlang e-learning for Universities In-Reply-To: <50AA3204.9000905@erlang-solutions.com> References: <50AA3204.9000905@erlang-solutions.com> Message-ID: <50AB5487.7000905@erlang-solutions.com> Hi All, We received quite a few questions as a result of this email. I just wanted to clarify a few things: * You have to register from your university email account. We will not be activating gmail accounts or similar. * The notification email has to be send to elearning@REDACTED (Not toelearning@REDACTED or me) * YES! Pass this on to your course supervisors, teachers, heads of department and anyone else in your university you believe might be interested. * It does not matter where you are based! This offer is valid for students and universities on all continents, including Antarctica The URL is http://elearning.erlang-solutions.com/login/signup.php Hope to see even more of you join! Francesco On 19/11/2012 13:20, Francesco Cesarini wrote: > Hi All, > > If you are considering teaching Erlang as part of your university > curriculum, you should get in touch. We have been working with > universities for the past 6 months, offering free Erlang e-learning to > intermediate and final year students who are interested in studying > Erlang; or to academic institutions covering parallel and functional > programming, distributed programming, multi-core programming, > programming paradigms, and more. > > This E-Learning offering is the result of a joint two year project > with Prof. Simon Thompson of the University of Kent, in Canterbury, > UK. It consists of 8 hours of videos, screen casts, interactive > quizzes and exercises with immediate feedback and assessment of the > code (We run a static analysis on the code, unit and QuickCheck tests, > type checks and visualize processes and message passing using > javascript). We cover sequential and concurrent programming, error > handling, distribution, software upgrade and ETS tables. > This course is integrated with the Erlang Programming book, published > by O'Reilly. > 2. We request you to pass this email to all relevant students at > your University. > 3. To access the elearning facility for free, the student needs to > do the two things below: > - register to the portal, using their University email address and not > a private one, at: > http://elearning.erlang-solutions.com/login/signup.php > - send an email notification toelearning@REDACTED > requesting free access. > > When registering, the students can only get the free offer if they use > their University email address, so that we can easily identify them in > the list of users. > 4. Fyi, there will be a maximum limit of 50 candidates per > institution and the offer is free to students for 3 months from > registration. > 5. The rationale behind this offer is that demand for Erlang > Programmers is increasing and our clients are struggling to find > skilled staff. We are being told that companies are choosing not to > adopt Erlang because it is hard to recruit! We hope that working with > Universities in raising awareness of Erlang will raise interest among > the students and encourage them to apply for these positions. > The situation in the US is even more acute, now that Erlang has been > identified as a serious contender for scaling systems on multi-core > and in cloud environments. > 6. To see our current job vacancies for staff at all levels with > these skills, please visit our website career pages at: > https://www.erlang-solutions.com/about/careers/careers-other-countries > > If interested, do not hesitate to get in touch with me. We currently > have about 180 students signed up, so places are limited. The earlier > we can plan in your courses, the better. > > Looking forward to hearing from you all, > Francesco > > -- Erlang Solutions Ltd. http://www.erlang-solutions.com From mrtndimitrov@REDACTED Tue Nov 20 11:06:19 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 20 Nov 2012 12:06:19 +0200 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: References: <50AB50FA.2040503@gmail.com> Message-ID: <50AB561B.90504@gmail.com> Thanks. I was hoping for a more elegant solution but this will do. On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: > The possibly shortest way is to abuse the fact that records are actually > tuples and instead of using a #user record for rabbitmq just use a tuple > that corresponds to it. And comment out the rabbitmq's #user record > definition, of course. > > > On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov wrote: > >> Hi all, >> >> I want to connect to RabbitMQ broker through the Erlang client listed on >> their site. The problem is that it defines a record "user" and in our >> app we already have such named record. >> >> What can I do with minimal code changes? >> >> Thank you very much. >> >> Regards, >> Martin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > From hm@REDACTED Tue Nov 20 11:52:09 2012 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Tue, 20 Nov 2012 11:52:09 +0100 Subject: [erlang-questions] Efficiency of qlc In-Reply-To: References: Message-ID: Just FYI. There is an (old) master thesis about making an SQL compiler for Mnesia: http://http://www.erlang.se/publications/xjobb/sql_compiler_report.pdf /H?kan On Tue, Nov 20, 2012 at 3:18 AM, Solomon wrote: > I want to wirte a sql compiler for mnesia, so I need to dynamic compile the > query string by qlc:string_to_handle/1, but it is much slower than native > code. And I found that: > > code 1: > qlc:string_to_handle("[X||X<-[1,2,3]].") > return: > {qlc_handle,{qlc_lc,#Fun, > {qlc_opt,false,false,-1,any,[],any,524288,allowed}}} > > code 2: > qlc:q([X||X<-[1,2,3]]) > return: > {qlc_handle,{qlc_lc,#Fun, > {qlc_opt,false,false,-1,any,[],any,524288,allowed}}} > > so I think the reason is that: code 1 run by erl_eval, it scan and parser > the code every time, and code 2 by beam, so code 1 was much slower than code > 2. > Is there any method to solve this problem? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From max.lapshin@REDACTED Tue Nov 20 12:06:57 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 14:06:57 +0300 Subject: [erlang-questions] How to introspect atom table? Message-ID: Erlang system is crashing with atom limit. Is it possible to look inside atom table, maybe I'll see something like: 'user_15', 'user_157' and will quickly find source of problems. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Nov 20 12:10:57 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 12:10:57 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: AFAIK crash dump contains atom list. Also erlang:memory(atom) or erlang:memory(atom_used) can be useful On Tue, Nov 20, 2012 at 12:06 PM, Max Lapshin wrote: > Erlang system is crashing with atom limit. > Is it possible to look inside atom table, maybe I'll see something like: > 'user_15', 'user_157' and will quickly find source of problems. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From pan@REDACTED Tue Nov 20 12:13:34 2012 From: pan@REDACTED (Patrik Nyblom) Date: Tue, 20 Nov 2012 12:13:34 +0100 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB561B.90504@gmail.com> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> Message-ID: <50AB65DE.4070306@erlang.org> Hi! Record names are just names in headers, nothing stops you from having one record named e.g. user in one module and a completely different record with the same name in another. As long as you do not include both headers (or in some other way manage to declare the record "type" twice) in the same source code, you're OK. So just limit the use of the rabbitmq user record to a module that does not use your own user record. /Patrik On 11/20/2012 11:06 AM, Martin Dimitrov wrote: > Thanks. I was hoping for a more elegant solution but this will do. > > On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: >> The possibly shortest way is to abuse the fact that records are actually >> tuples and instead of using a #user record for rabbitmq just use a tuple >> that corresponds to it. And comment out the rabbitmq's #user record >> definition, of course. >> >> >> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov wrote: >> >>> Hi all, >>> >>> I want to connect to RabbitMQ broker through the Erlang client listed on >>> their site. The problem is that it defines a record "user" and in our >>> app we already have such named record. >>> >>> What can I do with minimal code changes? >>> >>> Thank you very much. >>> >>> Regards, >>> Martin >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bog09@REDACTED Tue Nov 20 12:28:57 2012 From: bog09@REDACTED (Bogdan Andu) Date: Tue, 20 Nov 2012 03:28:57 -0800 (PST) Subject: [erlang-questions] error_logger heap overflow In-Reply-To: References: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> Message-ID: <1353410937.92586.YahooMailNeo@web120706.mail.ne1.yahoo.com> I used that, lager, but it is hard to read error messages, and the errors are duplicated across all log files. One cannot say to lager: commit notice messages to /var/log/notice_log, because all error messages with higher prority get written there, too. I like how error_logger prints the errors and I am used to it. Please give me an advice of how to overcome this situation. ----- Original Message ----- From: Gleb Peregud To: Bogdan Andu Cc: "erlang-questions@REDACTED" Sent: Tuesday, November 20, 2012 11:58 AM Subject: Re: [erlang-questions] error_logger heap overflow To cope with error_logger use lager or riak_err SSL used to have some "session leaking" bug some time ago, but I believe it was fixed. Others may have more information on this On Tue, Nov 20, 2012 at 10:47 AM, Bogdan Andu wrote: > Hello, > > I have a concurent server that handles ssl conections. I saw that if there are aprox. 20 parallel connections to the server running for about 1 day, the virtual machine dies with the following message: > > Slogan: eheap_alloc: Cannot allocate 2850821240 bytes of memory (of type "heap"). > System version: Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] > > ...... > > I have two questions: > > > 1) > Process Information > > > Pid > Name/Spawned as > State > Reductions > Stack+heap > MsgQ Length > <0.5.0> error_logger Garbing > (limited info) 129146284187 356352655 323792 > > > 356352655*8 = 2850821240, exactly the value from "Cannot allocate 2850821240 bytes of memory" message. > > The error_logger process accumulates a high number of pending messages in the message queue, resulting in heap exhaustion. > > The amount and size of the log messages sent to error_logger are normal normal. > > How can I make error_logger to process messages faster and to avoid heap overflow error. > > > 2) > Another question is this: > > I observed that the ets table ssl_otp_session_cache get large although the client is the same: > > =ets:<0.70.0> > Slot: 23 > Table: 28695 > Name: ssl_otp_session_cache > Buckets: 6224 > Objects: 41912 > Words: 2058733 > > (2058733*8)/(1024*1024) =~ 15 MBytes > > Altough I know the cache entries expire after 24 hours how can I decrease this timeout to 1 hour, for example? > > Or how can I disable the ssl caching altogether? > > Thank you, > > Bogdan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Tue Nov 20 12:34:00 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Nov 2012 12:34:00 +0100 Subject: [erlang-questions] error_logger heap overflow In-Reply-To: References: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> Message-ID: <3E6D4806-9BCD-4B5E-85B4-FF0294FB0785@gmail.com> On Nov 20, 2012, at 10:58 AM, Gleb Peregud wrote: > To cope with error_logger use lager or riak_err riak_err is almost dead (all its features were included into lager). Use lager instead: https://github.com/basho/lager Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Nov 20 12:47:45 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 14:47:45 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: Atoms: 1048576 =memory total: 507885448 processes: 336611825 processes_used: 336601278 system: 171273623 atom: 52749265 atom_used: 52707589 binary: 6311816 code: 3898230 ets: 2209656 =hash_table:atom_tab size: 411527 used: 322545 objs: 1048577 depth: 21 This looks like a problem, yes? On Tue, Nov 20, 2012 at 3:10 PM, Gleb Peregud wrote: > AFAIK crash dump contains atom list. > > Also erlang:memory(atom) or erlang:memory(atom_used) can be useful > > On Tue, Nov 20, 2012 at 12:06 PM, Max Lapshin > wrote: > > Erlang system is crashing with atom limit. > > Is it possible to look inside atom table, maybe I'll see something like: > > 'user_15', 'user_157' and will quickly find source of problems. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Nov 20 12:52:09 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 12:52:09 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: Yes. 1048576 is 2^20 which seems to be a size of atom table (atom.h:30): #define ATOM_LIMIT (1024*1024) On Tue, Nov 20, 2012 at 12:47 PM, Max Lapshin wrote: > Atoms: 1048576 > =memory > total: 507885448 > processes: 336611825 > processes_used: 336601278 > system: 171273623 > atom: 52749265 > atom_used: 52707589 > binary: 6311816 > code: 3898230 > ets: 2209656 > =hash_table:atom_tab > size: 411527 > used: 322545 > objs: 1048577 > depth: 21 > > > This looks like a problem, yes? > > > > > On Tue, Nov 20, 2012 at 3:10 PM, Gleb Peregud wrote: >> >> AFAIK crash dump contains atom list. >> >> Also erlang:memory(atom) or erlang:memory(atom_used) can be useful >> >> On Tue, Nov 20, 2012 at 12:06 PM, Max Lapshin >> wrote: >> > Erlang system is crashing with atom limit. >> > Is it possible to look inside atom table, maybe I'll see something like: >> > 'user_15', 'user_157' and will quickly find source of problems. >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > > > From max.lapshin@REDACTED Tue Nov 20 13:04:53 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 15:04:53 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: Problem was in peb: http://code.google.com/p/mypeb/source/browse/trunk/peb.c#359 guys are using it and it creates new nodename each time it connects. Atom table quickly gets exhausted. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Tue Nov 20 13:05:23 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Nov 2012 13:05:23 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: <59ED5B83-3F1E-4100-BC22-4E186D81745F@gmail.com> Did you try increase this limit: $ erl ... +t 4194304 Regards, Zabrane On Nov 20, 2012, at 12:47 PM, Max Lapshin wrote: > Atoms: 1048576 > =memory > total: 507885448 > processes: 336611825 > processes_used: 336601278 > system: 171273623 > atom: 52749265 > atom_used: 52707589 > binary: 6311816 > code: 3898230 > ets: 2209656 > =hash_table:atom_tab > size: 411527 > used: 322545 > objs: 1048577 > depth: 21 > > > This looks like a problem, yes? > > > > On Tue, Nov 20, 2012 at 3:10 PM, Gleb Peregud wrote: > AFAIK crash dump contains atom list. > > Also erlang:memory(atom) or erlang:memory(atom_used) can be useful > > On Tue, Nov 20, 2012 at 12:06 PM, Max Lapshin wrote: > > Erlang system is crashing with atom limit. > > Is it possible to look inside atom table, maybe I'll see something like: > > 'user_15', 'user_157' and will quickly find source of problems. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Nov 20 13:11:43 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 15:11:43 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: <59ED5B83-3F1E-4100-BC22-4E186D81745F@gmail.com> References: <59ED5B83-3F1E-4100-BC22-4E186D81745F@gmail.com> Message-ID: It is a bad idea to increase atom limit, because it will just prolong the suffering. 1 million of atoms is enough for a simple program. On Tue, Nov 20, 2012 at 4:05 PM, Zabrane Mickael wrote: > Did you try increase this limit: > $ erl ... +t 4194304 > > Regards, > Zabrane > > On Nov 20, 2012, at 12:47 PM, Max Lapshin wrote: > > Atoms: 1048576 > =memory > total: 507885448 > processes: 336611825 > processes_used: 336601278 > system: 171273623 > atom: 52749265 > atom_used: 52707589 > binary: 6311816 > code: 3898230 > ets: 2209656 > =hash_table:atom_tab > size: 411527 > used: 322545 > objs: 1048577 > depth: 21 > > > This looks like a problem, yes? > > > > On Tue, Nov 20, 2012 at 3:10 PM, Gleb Peregud wrote: > >> AFAIK crash dump contains atom list. >> >> Also erlang:memory(atom) or erlang:memory(atom_used) can be useful >> >> On Tue, Nov 20, 2012 at 12:06 PM, Max Lapshin >> wrote: >> > Erlang system is crashing with atom limit. >> > Is it possible to look inside atom table, maybe I'll see something like: >> > 'user_15', 'user_157' and will quickly find source of problems. >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Tue Nov 20 13:22:20 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Nov 2012 13:22:20 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <59ED5B83-3F1E-4100-BC22-4E186D81745F@gmail.com> Message-ID: On Nov 20, 2012, at 1:11 PM, Max Lapshin wrote: > It is a bad idea to increase atom limit, because it will just prolong the suffering. So fix the code and try to use list_to_existing_atom/1instead of list_to_atom/1 (see http://erlang.org/doc/man/erlang.html). Better, redesign the code. > 1 million of atoms is enough for a simple program. In our case it wasn't sufficient. Regards, Zabrane From vladdu55@REDACTED Tue Nov 20 13:23:55 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2012 13:23:55 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes Message-ID: Hi! Is any application available that will monitor the status of multiple erlang nodes and publish logs/reports? Kind of like a supervisor on the node level. It's not very difficult to write one, but if it already exists, it saves a lot of time. If it doesn't exist, did anyone else felt the need for one? In my case, the reason is that I have nodes that crash mysteriously and randomly and I couldn't retrieve any relevant information from them or the crashes. This would help track their health without adding much to their load. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Nov 20 13:30:03 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 15:30:03 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <59ED5B83-3F1E-4100-BC22-4E186D81745F@gmail.com> Message-ID: I've written, that problem wasn't in converting string to atoms, it was in external PHP code that created unique node names on each request. On Tue, Nov 20, 2012 at 4:22 PM, Zabrane Mickael wrote: > > On Nov 20, 2012, at 1:11 PM, Max Lapshin wrote: > > > It is a bad idea to increase atom limit, because it will just prolong > the suffering. > > So fix the code and try to use list_to_existing_atom/1instead of > list_to_atom/1 (see http://erlang.org/doc/man/erlang.html). > Better, redesign the code. > > > 1 million of atoms is enough for a simple program. > > In our case it wasn't sufficient. > > Regards, > Zabrane > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Tue Nov 20 13:40:46 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 20 Nov 2012 13:40:46 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: Message-ID: <50AB7A4E.70507@ninenines.eu> On 11/20/2012 01:23 PM, Vlad Dumitrescu wrote: > Hi! > > Is any application available that will monitor the status of multiple > erlang nodes and publish logs/reports? Kind of like a supervisor on the > node level. > > It's not very difficult to write one, but if it already exists, it saves > a lot of time. > > If it doesn't exist, did anyone else felt the need for one? In my case, > the reason is that I have nodes that crash mysteriously and randomly and > I couldn't retrieve any relevant information from them or the crashes. > This would help track their health without adding much to their load. Isn't that what the snmp application is for? Alongside a tool that supports SNMP like Nagios. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From vladdu55@REDACTED Tue Nov 20 13:46:06 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2012 13:46:06 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: <50AB7A4E.70507@ninenines.eu> References: <50AB7A4E.70507@ninenines.eu> Message-ID: Yes, you're right, snmp matches the description, but it feels a bit too heavy for me. I will read about it, maybe it's not true. I would like to have the monitored nodes without any specific application running, just answering to some RPCs once in a while. Thanks! /Vlad On Tue, Nov 20, 2012 at 1:40 PM, Lo?c Hoguin wrote: > On 11/20/2012 01:23 PM, Vlad Dumitrescu wrote: > >> Hi! >> >> Is any application available that will monitor the status of multiple >> erlang nodes and publish logs/reports? Kind of like a supervisor on the >> node level. >> >> It's not very difficult to write one, but if it already exists, it saves >> a lot of time. >> >> If it doesn't exist, did anyone else felt the need for one? In my case, >> the reason is that I have nodes that crash mysteriously and randomly and >> I couldn't retrieve any relevant information from them or the crashes. >> This would help track their health without adding much to their load. >> > > Isn't that what the snmp application is for? Alongside a tool that > supports SNMP like Nagios. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Tue Nov 20 13:46:32 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 20 Nov 2012 13:46:32 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: Message-ID: <50AB7BA8.6050206@ninenines.eu> On 11/20/2012 01:04 PM, Max Lapshin wrote: > Problem was in peb: > http://code.google.com/p/mypeb/source/browse/trunk/peb.c#359 > > guys are using it and it creates new nodename each time it connects. > Atom table quickly gets exhausted. We had the issue with peb too and just stopped using it entirely. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From max.lapshin@REDACTED Tue Nov 20 14:00:13 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 16:00:13 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: <50AB7BA8.6050206@ninenines.eu> References: <50AB7BA8.6050206@ninenines.eu> Message-ID: I've told to switch in peb from connect to pconnect. Usually it helps in PHP On Tue, Nov 20, 2012 at 4:46 PM, Lo?c Hoguin wrote: > On 11/20/2012 01:04 PM, Max Lapshin wrote: > >> Problem was in peb: >> http://code.google.com/p/**mypeb/source/browse/trunk/peb.**c#359 >> >> guys are using it and it creates new nodename each time it connects. >> Atom table quickly gets exhausted. >> > > We had the issue with peb too and just stopped using it entirely. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Tue Nov 20 14:01:59 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Tue, 20 Nov 2012 14:01:59 +0100 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> Message-ID: <50AB7F47.9060604@ninenines.eu> Yes but that's not going to stop peb from making atoms, it'll just create them slower. PHP processes are restarted every few thousand requests, which forces a reconnect, and the connection might fail, which reconnects it too. It'll just be a slower time bomb. On 11/20/2012 02:00 PM, Max Lapshin wrote: > I've told to switch in peb from connect to pconnect. Usually it helps in PHP > > > On Tue, Nov 20, 2012 at 4:46 PM, Lo?c Hoguin > wrote: > > On 11/20/2012 01:04 PM, Max Lapshin wrote: > > Problem was in peb: > http://code.google.com/p/__mypeb/source/browse/trunk/peb.__c#359 > > > guys are using it and it creates new nodename each time it connects. > Atom table quickly gets exhausted. > > > We had the issue with peb too and just stopped using it entirely. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From max.lapshin@REDACTED Tue Nov 20 14:06:59 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 16:06:59 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: <50AB7F47.9060604@ninenines.eu> References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> Message-ID: But there are only 32 000 of possible pids in unix, so it will limit amount of different names. On Tue, Nov 20, 2012 at 5:01 PM, Lo?c Hoguin wrote: > Yes but that's not going to stop peb from making atoms, it'll just create > them slower. PHP processes are restarted every few thousand requests, which > forces a reconnect, and the connection might fail, which reconnects it too. > > It'll just be a slower time bomb. > > > On 11/20/2012 02:00 PM, Max Lapshin wrote: > >> I've told to switch in peb from connect to pconnect. Usually it helps in >> PHP >> >> >> On Tue, Nov 20, 2012 at 4:46 PM, Lo?c Hoguin > > wrote: >> >> On 11/20/2012 01:04 PM, Max Lapshin wrote: >> >> Problem was in peb: >> http://code.google.com/p/__**mypeb/source/browse/trunk/peb.** >> __c#359 >> >> >> > >> >> guys are using it and it creates new nodename each time it >> connects. >> Atom table quickly gets exhausted. >> >> >> We had the issue with peb too and just stopped using it entirely. >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu >> >> >> > > -- > Lo?c Hoguin > > Erlang Cowboy > Nine Nines > http://ninenines.eu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Tue Nov 20 14:47:29 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 20 Nov 2012 15:47:29 +0200 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB65DE.4070306@erlang.org> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> <50AB65DE.4070306@erlang.org> Message-ID: <50AB89F1.3000209@gmail.com> That is actually my problem - in a module I have to include both .hrl files On 11/20/2012 1:13 PM, Patrik Nyblom wrote: > Hi! > > Record names are just names in headers, nothing stops you from having > one record named e.g. user in one module and a completely different > record with the same name in another. As long as you do not include both > headers (or in some other way manage to declare the record "type" twice) > in the same source code, you're OK. So just limit the use of the > rabbitmq user record to a module that does not use your own user record. > > /Patrik > On 11/20/2012 11:06 AM, Martin Dimitrov wrote: >> Thanks. I was hoping for a more elegant solution but this will do. >> >> On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: >>> The possibly shortest way is to abuse the fact that records are actually >>> tuples and instead of using a #user record for rabbitmq just use a tuple >>> that corresponds to it. And comment out the rabbitmq's #user record >>> definition, of course. >>> >>> >>> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov >>> wrote: >>> >>>> Hi all, >>>> >>>> I want to connect to RabbitMQ broker through the Erlang client >>>> listed on >>>> their site. The problem is that it defines a record "user" and in our >>>> app we already have such named record. >>>> >>>> What can I do with minimal code changes? >>>> >>>> Thank you very much. >>>> >>>> Regards, >>>> Martin >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From essen@REDACTED Tue Nov 20 14:48:17 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 20 Nov 2012 14:48:17 +0100 Subject: [erlang-questions] Help running OTP tests Message-ID: <50AB8A21.5000403@ninenines.eu> Hello, I'm trying, and failing, to run the Mnesia tests on my laptop. This is what I get, repeatedly, over many of them: Could not start slavenode {"alice","d808219o808643n808671", "-mnesia debug none -pa /home/essen/extend/otp/release/tests/mnesia_test -pa /home/essen/extend/otp/lib/mnesia/ebin"} timeout retrying "alice" is my laptop's hostname. Any idea why and how I can fix it? -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From freza@REDACTED Tue Nov 20 14:50:45 2012 From: freza@REDACTED (Jachym Holecek) Date: Tue, 20 Nov 2012 08:50:45 -0500 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> Message-ID: <20121120135045.GA1924@circlewave.net> # Max Lapshin 2012-11-20: > But there are only 32 000 of possible pids in unix, so it will limit amount > of different names. I'm curious -- do you have a reference for this limit? POSIX doesn't seem to define pid_t range. BR, -- Jachym From max.lapshin@REDACTED Tue Nov 20 15:19:17 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 17:19:17 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: <20121120135045.GA1924@circlewave.net> References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> <20121120135045.GA1924@circlewave.net> Message-ID: On Tue, Nov 20, 2012 at 5:50 PM, Jachym Holecek wrote: > # Max Lapshin 2012-11-20: > > But there are only 32 000 of possible pids in unix, so it will limit > amount > > of different names. > > I'm curious -- do you have a reference for this limit? POSIX doesn't seem > to > define pid_t range. > No, of course =) But I haven't ever seen 32 bit pid, so it is ok for this case. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmercer@REDACTED Tue Nov 20 15:34:51 2012 From: dmercer@REDACTED (David Mercer) Date: Tue, 20 Nov 2012 08:34:51 -0600 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> Message-ID: <000f01cdc72c$33e4e620$9baeb260$@gmail.com> How does that spawned process get garbage collected? Cheers, DBM > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Dmitry Belyaev > Sent: Monday, November 19, 2012 21:48 > To: Gleb Peregud > Cc: Erlang > Subject: Re: [erlang-questions] Futures/promises and ability to "call" > abstract modules > > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.9.1 (abort with ^G) > 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); > {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) > end), fun() -> P ! {get, self()}, receive V -> V end end end)(). > #Fun > 2> F(). > undefined > 3> element(2,lists:keyfind('P', 1, > lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. > {value,10} > 4> F(). > 10 > 5> > > -- > Dmitry Belyaev > > On 19.11.2012, at 18:05, Gleb Peregud wrote: > > > Then I wouldn't be able to set future's value after it being defined. > > Like in this example: > > > > 7> F = future:new(). > > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > > <0.49.0> > > 9> F:get(). > > 42 > > > > Without this ability such futures are useless with request-reply > pattern: > > 1) Client sends request > > 2) Server creates a future and sends it back to client > > 3) Client does it's work with the value of the future (without > > bothering the fact that value may become available in uncertain > > future) > > 4) Server finishes computations and sets future's value > > > > > > On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding > > wrote: > >> Wouldn't it be easier if future:new just returned a fun? Then you could > do F() without any changes? > >> > >> Robert > >> > >> ----- Original Message ----- > >>> From: "Gleb Peregud" > >>> To: "Vlad Dumitrescu" > >>> Cc: "Erlang" > >>> Sent: Monday, 19 November, 2012 2:18:11 PM > >>> Subject: Re: [erlang-questions] Futures/promises and ability to > >>> "call" abstract modules > >>> > >>> With the these changes [1] the following code works as intended: > >>> > >>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). > >>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} > >>> 8> F(). > >>> 42 > >>> > >>> Aside from a problem where it improperly reports arity in case of > >>> undefined function: > >>> > >>> 9> F(1,2,3). > >>> ** exception error: undefined function future:call/3 > >>> > >>> 1: https://github.com/gleber/otp/compare/call-abstract-module > >>> > >>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud > >>> wrote: > >>>> Sverker Eriksson wrote the following in [1]: > >>>> > >>>>> But even if the resource terms look alike, they are unique and > >>>>> there is no bug leaking NIF resources (that I know of). A resource > >>>>> is released (and destructor called) when the last reference is > >>>>> garbage collected. > >>>>> The shell can fool you however, as it keeps a command history that > >>>>> can retain terms even though you think the variables are > >>>>> forgotten. > >>>>> Test NIF > >>>>> resource cleanup by running a test module and call > >>>>> erlang:garbage_collect to force destructors to be called. > >>>> > >>>> This seems to mean that they are "shared" and garbage collected > >>>> just once. > >>>> > >>>> 1: > >>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht > >>>> ml > >>>> > >>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu > >>>> wrote: > >>>>> I have no idea, that's why I asked :-) /Vlad > >>>>> > >>>>> > >>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud > >>>>> wrote: > >>>>>> > >>>>>> I assumed that NIF-generated resources are shared between > >>>>>> processes (the same way as large binaries are), and I haven't > >>>>>> done any tests on this. Are you sure it is garbate collected > >>>>>> multiple times (once per referencing process)? > >>>>>> > >>>>>> > >>>>>> > >>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu > >>>>>> > >>>>>> wrote: > >>>>>>> > >>>>>>> Hi Gleb, > >>>>>>> > >>>>>>> just a quick observation about garbage collecting futures: would > >>>>>>> the NIF-generated resource keep track of usage across processes? > >>>>>>> I fI send a future as a message, it may be referenced by > >>>>>>> multiple processes which have their own heap and garbage > >>>>>>> collection... > >>>>>>> > >>>>>>> regards, > >>>>>>> Vlad > >>>>>>> > >>>>>>> > >>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud > >>>>>>> > >>>>>>> wrote: > >>>>>>>> > >>>>>>>> Hello > >>>>>>>> > >>>>>>>> Last evening I was trying to implement futures/promise > >>>>>>>> mechanism in Erlang (mostly for fun, since I am still unsure if > >>>>>>>> it is useful). I got inspired with the presentation [1], which > >>>>>>>> mentioned using futures as a foundation of building services, > >>>>>>>> where things like timeouts, tracing, authentication, etc. is > >>>>>>>> built by composing futures (see slide 41). > >>>>>>>> > >>>>>>>> Do you think that such composition of futures could be useful > >>>>>>>> as a tool to improve code reuse of communication patterns in > >>>>>>>> Erlang (as described in the presentation)? > >>>>>>>> > >>>>>>>> I've implemented futures using processes and message passing > >>>>>>>> and stumbled upon two issues: > >>>>>>>> 1) garbage collection of futures > >>>>>>>> 2) slightly too much code when using them > >>>>>>>> > >>>>>>>> Example of the first problem is here: > >>>>>>>> > >>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > >>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > >>>>>>>> 2> F:get(). %% it hangs for 10 seconds > >>>>>>>> 10 > >>>>>>>> > >>>>>>>> Since future F is represented as a process <0.36.0> it will > >>>>>>>> stay running forever till it's timed out (which is not a good > >>>>>>>> solution, since someone may still have a reference to this > >>>>>>>> future) or F:done() manually called. > >>>>>>>> > >>>>>>>> My idea is to insert into 'future' tuple a NIF-generated > >>>>>>>> resource, which will have a destructor attached (called upon > >>>>>>>> garbage collection of the > >>>>>>>> resource) which will call F:done(). Will it work? > >>>>>>>> > >>>>>>>> The second issue is illustrated here: > >>>>>>>> > >>>>>>>> 7> F = future:new(). > >>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > >>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > >>>>>>>> <0.49.0> > >>>>>>>> 9> F:get(). > >>>>>>>> 42 > >>>>>>>> > >>>>>>>> In ideal world it should be enough to just write "F" (without > >>>>>>>> :get()) to > >>>>>>>> fetch future's value, but it seems too far fetched for Erlang. > >>>>>>>> Slightly > >>>>>>>> better solution would be to allow calling future with "F()". > >>>>>>>> > >>>>>>>> This can be done by extending concept of "abstract modules" > >>>>>>>> with > >>>>>>>> "default call". Currently abstract modules allow the following: > >>>>>>>> > >>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to > >>>>>>>> future:get({future, Pid, Ref, undefined}) > >>>>>>>> > >>>>>>>> With a simple change in beam_emu.c in call_fun function (which > >>>>>>>> would replace obsolete fun tuples) we can allow for the > >>>>>>>> following: > >>>>>>>> > >>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to > >>>>>>>> future:call({future, Pid, Ref, undefined}) > >>>>>>>> > >>>>>>>> hence allowing to use just "F()" to read a value of the future. > >>>>>>>> This > >>>>>>>> will also extend "metaprogramming" capabilities of Erlang for > >>>>>>>> some other quirky use, which may or may not be a Good > >>>>>>>> Thing(tm). > >>>>>>>> > >>>>>>>> Thoughts? > >>>>>>>> > >>>>>>>> Cheers, > >>>>>>>> Gleb Peregud > >>>>>>>> > >>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ > >>>>>>>> > >>>>>>>> _______________________________________________ > >>>>>>>> erlang-questions mailing list > >>>>>>>> erlang-questions@REDACTED > >>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>>>>>> > >>>>>>> > >>>>>> > >>>>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >>> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From daniel.goertzen@REDACTED Tue Nov 20 15:36:46 2012 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Tue, 20 Nov 2012 08:36:46 -0600 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> <20121120135045.GA1924@circlewave.net> Message-ID: On linux a pid_t is 32 bits, but the limit is configurable. My Ubuntu 64 box says... $ cat /proc/sys/kernel/pid_max 32768 Dan. On Tue, Nov 20, 2012 at 8:19 AM, Max Lapshin wrote: > > > > On Tue, Nov 20, 2012 at 5:50 PM, Jachym Holecek wrote: > >> # Max Lapshin 2012-11-20: >> > But there are only 32 000 of possible pids in unix, so it will limit >> amount >> > of different names. >> >> I'm curious -- do you have a reference for this limit? POSIX doesn't seem >> to >> define pid_t range. >> > > No, of course =) > But I haven't ever seen 32 bit pid, so it is ok for this case. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Nov 20 15:40:49 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 20 Nov 2012 17:40:49 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> <20121120135045.GA1924@circlewave.net> Message-ID: ook. It would be a big problem with my hack-patch if this limit would be raised =)) On Tue, Nov 20, 2012 at 6:36 PM, Daniel Goertzen wrote: > On linux a pid_t is 32 bits, but the limit is configurable. My Ubuntu 64 > box says... > > $ cat /proc/sys/kernel/pid_max > 32768 > > Dan. > > On Tue, Nov 20, 2012 at 8:19 AM, Max Lapshin wrote: > >> >> >> >> On Tue, Nov 20, 2012 at 5:50 PM, Jachym Holecek wrote: >> >>> # Max Lapshin 2012-11-20: >>> > But there are only 32 000 of possible pids in unix, so it will limit >>> amount >>> > of different names. >>> >>> I'm curious -- do you have a reference for this limit? POSIX doesn't >>> seem to >>> define pid_t range. >>> >> >> No, of course =) >> But I haven't ever seen 32 bit pid, so it is ok for this case. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Nov 20 15:50:08 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 20 Nov 2012 15:50:08 +0100 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB89F1.3000209@gmail.com> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> <50AB65DE.4070306@erlang.org> <50AB89F1.3000209@gmail.com> Message-ID: <1353423008.4769.13.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Have you checked the performance penalty of a new record of your own, with the same contents, that you pack before calling the module that has to know the rabbitmq record? bengt On Tue, 2012-11-20 at 15:47 +0200, Martin Dimitrov wrote: > That is actually my problem - in a module I have to include both .hrl files > > On 11/20/2012 1:13 PM, Patrik Nyblom wrote: > > Hi! > > > > Record names are just names in headers, nothing stops you from having > > one record named e.g. user in one module and a completely different > > record with the same name in another. As long as you do not include both > > headers (or in some other way manage to declare the record "type" twice) > > in the same source code, you're OK. So just limit the use of the > > rabbitmq user record to a module that does not use your own user record. > > > > /Patrik > > On 11/20/2012 11:06 AM, Martin Dimitrov wrote: > >> Thanks. I was hoping for a more elegant solution but this will do. > >> > >> On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: > >>> The possibly shortest way is to abuse the fact that records are actually > >>> tuples and instead of using a #user record for rabbitmq just use a tuple > >>> that corresponds to it. And comment out the rabbitmq's #user record > >>> definition, of course. > >>> > >>> > >>> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov > >>> wrote: > >>> > >>>> Hi all, > >>>> > >>>> I want to connect to RabbitMQ broker through the Erlang client > >>>> listed on > >>>> their site. The problem is that it defines a record "user" and in our > >>>> app we already have such named record. > >>>> > >>>> What can I do with minimal code changes? > >>>> > >>>> Thank you very much. > >>>> > >>>> Regards, > >>>> Martin > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>> > >>> > >>> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From g@REDACTED Tue Nov 20 16:05:05 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 20 Nov 2012 09:05:05 -0600 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> Message-ID: Considering the time and risk of using off the shelf applications like Nagios, I think rolling your own is a viable approach. Other than Erlang itself, I don't know of a well designed, very light Erlang monitoring framework. Probably because it's easy enough to build something tailored to your needs directly in Erlang. I'd just start doing what you're describing. I suspect that you'll have a workable framework for monitoring in a few iterations. On Tue, Nov 20, 2012 at 6:46 AM, Vlad Dumitrescu wrote: > Yes, you're right, snmp matches the description, but it feels a bit too > heavy for me. I will read about it, maybe it's not true. I would like to > have the monitored nodes without any specific application running, just > answering to some RPCs once in a while. > > Thanks! > /Vlad > > > > On Tue, Nov 20, 2012 at 1:40 PM, Lo?c Hoguin wrote: >> >> On 11/20/2012 01:23 PM, Vlad Dumitrescu wrote: >>> >>> Hi! >>> >>> Is any application available that will monitor the status of multiple >>> erlang nodes and publish logs/reports? Kind of like a supervisor on the >>> node level. >>> >>> It's not very difficult to write one, but if it already exists, it saves >>> a lot of time. >>> >>> If it doesn't exist, did anyone else felt the need for one? In my case, >>> the reason is that I have nodes that crash mysteriously and randomly and >>> I couldn't retrieve any relevant information from them or the crashes. >>> This would help track their health without adding much to their load. >> >> >> Isn't that what the snmp application is for? Alongside a tool that >> supports SNMP like Nagios. >> >> >> -- >> Lo?c Hoguin >> >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Tue Nov 20 16:13:12 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2012 16:13:12 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> Message-ID: Thanks Garrett, I will probably do that, especially as it's not meant to be monitoring production nodes, but the development environment. regards, Vlad On Tue, Nov 20, 2012 at 4:05 PM, Garrett Smith wrote: > Considering the time and risk of using off the shelf applications like > Nagios, I think rolling your own is a viable approach. > > Other than Erlang itself, I don't know of a well designed, very light > Erlang monitoring framework. Probably because it's easy enough to > build something tailored to your needs directly in Erlang. > > I'd just start doing what you're describing. I suspect that you'll > have a workable framework for monitoring in a few iterations. > > On Tue, Nov 20, 2012 at 6:46 AM, Vlad Dumitrescu > wrote: > > Yes, you're right, snmp matches the description, but it feels a bit too > > heavy for me. I will read about it, maybe it's not true. I would like to > > have the monitored nodes without any specific application running, just > > answering to some RPCs once in a while. > > > > Thanks! > > /Vlad > > > > > > > > On Tue, Nov 20, 2012 at 1:40 PM, Lo?c Hoguin wrote: > >> > >> On 11/20/2012 01:23 PM, Vlad Dumitrescu wrote: > >>> > >>> Hi! > >>> > >>> Is any application available that will monitor the status of multiple > >>> erlang nodes and publish logs/reports? Kind of like a supervisor on the > >>> node level. > >>> > >>> It's not very difficult to write one, but if it already exists, it > saves > >>> a lot of time. > >>> > >>> If it doesn't exist, did anyone else felt the need for one? In my case, > >>> the reason is that I have nodes that crash mysteriously and randomly > and > >>> I couldn't retrieve any relevant information from them or the crashes. > >>> This would help track their health without adding much to their load. > >> > >> > >> Isn't that what the snmp application is for? Alongside a tool that > >> supports SNMP like Nagios. > >> > >> > >> -- > >> Lo?c Hoguin > >> > >> Erlang Cowboy > >> Nine Nines > >> http://ninenines.eu > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Nov 20 16:20:18 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 16:20:18 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <000f01cdc72c$33e4e620$9baeb260$@gmail.com> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> Message-ID: This is yet to be implemented. The idea is to rely on already existing implementation of NIF resources - this implies that a user of the library would have to always store Pid of garbage collectable process (let's call it gcproc) along with that resource in his heap, for example as {'gcproc', pid(), resource()} and use special API to do sending, killing, linking, monitoring, etc. Since the resource associated with the process is always stored in heap of the process, the resource will not get garbage collected until no heap references it. This way we tie together process and resource lifetime. And since NIF resources can have a destructor in C which is called upon resource is garbage collected, we can make use of it to inform gcproc to terminate. As Patrik pointed out it is not as trivial as it sounds, but still possible. On Tue, Nov 20, 2012 at 3:34 PM, David Mercer wrote: > How does that spawned process get garbage collected? > > Cheers, > > DBM > > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >> bounces@REDACTED] On Behalf Of Dmitry Belyaev >> Sent: Monday, November 19, 2012 21:48 >> To: Gleb Peregud >> Cc: Erlang >> Subject: Re: [erlang-questions] Futures/promises and ability to "call" >> abstract modules >> >> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] >> [hipe] [kernel-poll:false] >> >> Eshell V5.9.1 (abort with ^G) >> 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); >> {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) >> end), fun() -> P ! {get, self()}, receive V -> V end end end)(). >> #Fun >> 2> F(). >> undefined >> 3> element(2,lists:keyfind('P', 1, >> lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. >> {value,10} >> 4> F(). >> 10 >> 5> >> >> -- >> Dmitry Belyaev >> >> On 19.11.2012, at 18:05, Gleb Peregud wrote: >> >> > Then I wouldn't be able to set future's value after it being defined. >> > Like in this example: >> > >> > 7> F = future:new(). >> > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >> > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >> > <0.49.0> >> > 9> F:get(). >> > 42 >> > >> > Without this ability such futures are useless with request-reply >> pattern: >> > 1) Client sends request >> > 2) Server creates a future and sends it back to client >> > 3) Client does it's work with the value of the future (without >> > bothering the fact that value may become available in uncertain >> > future) >> > 4) Server finishes computations and sets future's value >> > >> > >> > On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding >> > wrote: >> >> Wouldn't it be easier if future:new just returned a fun? Then you could >> do F() without any changes? >> >> >> >> Robert >> >> >> >> ----- Original Message ----- >> >>> From: "Gleb Peregud" >> >>> To: "Vlad Dumitrescu" >> >>> Cc: "Erlang" >> >>> Sent: Monday, 19 November, 2012 2:18:11 PM >> >>> Subject: Re: [erlang-questions] Futures/promises and ability to >> >>> "call" abstract modules >> >>> >> >>> With the these changes [1] the following code works as intended: >> >>> >> >>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >> >>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >> >>> 8> F(). >> >>> 42 >> >>> >> >>> Aside from a problem where it improperly reports arity in case of >> >>> undefined function: >> >>> >> >>> 9> F(1,2,3). >> >>> ** exception error: undefined function future:call/3 >> >>> >> >>> 1: https://github.com/gleber/otp/compare/call-abstract-module >> >>> >> >>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >> >>> wrote: >> >>>> Sverker Eriksson wrote the following in [1]: >> >>>> >> >>>>> But even if the resource terms look alike, they are unique and >> >>>>> there is no bug leaking NIF resources (that I know of). A resource >> >>>>> is released (and destructor called) when the last reference is >> >>>>> garbage collected. >> >>>>> The shell can fool you however, as it keeps a command history that >> >>>>> can retain terms even though you think the variables are >> >>>>> forgotten. >> >>>>> Test NIF >> >>>>> resource cleanup by running a test module and call >> >>>>> erlang:garbage_collect to force destructors to be called. >> >>>> >> >>>> This seems to mean that they are "shared" and garbage collected >> >>>> just once. >> >>>> >> >>>> 1: >> >>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht >> >>>> ml >> >>>> >> >>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >> >>>> wrote: >> >>>>> I have no idea, that's why I asked :-) /Vlad >> >>>>> >> >>>>> >> >>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >> >>>>> wrote: >> >>>>>> >> >>>>>> I assumed that NIF-generated resources are shared between >> >>>>>> processes (the same way as large binaries are), and I haven't >> >>>>>> done any tests on this. Are you sure it is garbate collected >> >>>>>> multiple times (once per referencing process)? >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >> >>>>>> >> >>>>>> wrote: >> >>>>>>> >> >>>>>>> Hi Gleb, >> >>>>>>> >> >>>>>>> just a quick observation about garbage collecting futures: would >> >>>>>>> the NIF-generated resource keep track of usage across processes? >> >>>>>>> I fI send a future as a message, it may be referenced by >> >>>>>>> multiple processes which have their own heap and garbage >> >>>>>>> collection... >> >>>>>>> >> >>>>>>> regards, >> >>>>>>> Vlad >> >>>>>>> >> >>>>>>> >> >>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >> >>>>>>> >> >>>>>>> wrote: >> >>>>>>>> >> >>>>>>>> Hello >> >>>>>>>> >> >>>>>>>> Last evening I was trying to implement futures/promise >> >>>>>>>> mechanism in Erlang (mostly for fun, since I am still unsure if >> >>>>>>>> it is useful). I got inspired with the presentation [1], which >> >>>>>>>> mentioned using futures as a foundation of building services, >> >>>>>>>> where things like timeouts, tracing, authentication, etc. is >> >>>>>>>> built by composing futures (see slide 41). >> >>>>>>>> >> >>>>>>>> Do you think that such composition of futures could be useful >> >>>>>>>> as a tool to improve code reuse of communication patterns in >> >>>>>>>> Erlang (as described in the presentation)? >> >>>>>>>> >> >>>>>>>> I've implemented futures using processes and message passing >> >>>>>>>> and stumbled upon two issues: >> >>>>>>>> 1) garbage collection of futures >> >>>>>>>> 2) slightly too much code when using them >> >>>>>>>> >> >>>>>>>> Example of the first problem is here: >> >>>>>>>> >> >>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >> >>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >> >>>>>>>> 2> F:get(). %% it hangs for 10 seconds >> >>>>>>>> 10 >> >>>>>>>> >> >>>>>>>> Since future F is represented as a process <0.36.0> it will >> >>>>>>>> stay running forever till it's timed out (which is not a good >> >>>>>>>> solution, since someone may still have a reference to this >> >>>>>>>> future) or F:done() manually called. >> >>>>>>>> >> >>>>>>>> My idea is to insert into 'future' tuple a NIF-generated >> >>>>>>>> resource, which will have a destructor attached (called upon >> >>>>>>>> garbage collection of the >> >>>>>>>> resource) which will call F:done(). Will it work? >> >>>>>>>> >> >>>>>>>> The second issue is illustrated here: >> >>>>>>>> >> >>>>>>>> 7> F = future:new(). >> >>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >> >>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >> >>>>>>>> <0.49.0> >> >>>>>>>> 9> F:get(). >> >>>>>>>> 42 >> >>>>>>>> >> >>>>>>>> In ideal world it should be enough to just write "F" (without >> >>>>>>>> :get()) to >> >>>>>>>> fetch future's value, but it seems too far fetched for Erlang. >> >>>>>>>> Slightly >> >>>>>>>> better solution would be to allow calling future with "F()". >> >>>>>>>> >> >>>>>>>> This can be done by extending concept of "abstract modules" >> >>>>>>>> with >> >>>>>>>> "default call". Currently abstract modules allow the following: >> >>>>>>>> >> >>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to >> >>>>>>>> future:get({future, Pid, Ref, undefined}) >> >>>>>>>> >> >>>>>>>> With a simple change in beam_emu.c in call_fun function (which >> >>>>>>>> would replace obsolete fun tuples) we can allow for the >> >>>>>>>> following: >> >>>>>>>> >> >>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >> >>>>>>>> future:call({future, Pid, Ref, undefined}) >> >>>>>>>> >> >>>>>>>> hence allowing to use just "F()" to read a value of the future. >> >>>>>>>> This >> >>>>>>>> will also extend "metaprogramming" capabilities of Erlang for >> >>>>>>>> some other quirky use, which may or may not be a Good >> >>>>>>>> Thing(tm). >> >>>>>>>> >> >>>>>>>> Thoughts? >> >>>>>>>> >> >>>>>>>> Cheers, >> >>>>>>>> Gleb Peregud >> >>>>>>>> >> >>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >> >>>>>>>> >> >>>>>>>> _______________________________________________ >> >>>>>>>> erlang-questions mailing list >> >>>>>>>> erlang-questions@REDACTED >> >>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions >> >>>>>>>> >> >>>>>>> >> >>>>>> >> >>>>> >> >>> _______________________________________________ >> >>> erlang-questions mailing list >> >>> erlang-questions@REDACTED >> >>> http://erlang.org/mailman/listinfo/erlang-questions >> >>> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From essen@REDACTED Tue Nov 20 16:30:23 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Tue, 20 Nov 2012 16:30:23 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> Message-ID: <50ABA20F.4060803@ninenines.eu> On 11/20/2012 04:05 PM, Garrett Smith wrote: > Considering the time and risk of using off the shelf applications like > Nagios, I think rolling your own is a viable approach. Time? Most definitely. Risk? Please enlighten me. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From be.dmitry@REDACTED Tue Nov 20 16:32:16 2012 From: be.dmitry@REDACTED (Dmitry Belyaev) Date: Tue, 20 Nov 2012 19:32:16 +0400 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <000f01cdc72c$33e4e620$9baeb260$@gmail.com> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> Message-ID: <5494EC75-A4D8-4A4C-ADBA-50A6927FD71E@gmail.com> This is not real implementation. I just showed that it is possible to use fun environment outside of it. That way no parameterized modules and new implicit call to them are required. Of course garbage collection is the problem. Right now I don't have any good enough proposal to solve it. -- Dmitry Belyaev On 20.11.2012, at 18:34, David Mercer wrote: > How does that spawned process get garbage collected? > > Cheers, > > DBM > > >> -----Original Message----- >> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >> bounces@REDACTED] On Behalf Of Dmitry Belyaev >> Sent: Monday, November 19, 2012 21:48 >> To: Gleb Peregud >> Cc: Erlang >> Subject: Re: [erlang-questions] Futures/promises and ability to "call" >> abstract modules >> >> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] >> [hipe] [kernel-poll:false] >> >> Eshell V5.9.1 (abort with ^G) >> 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); >> {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) >> end), fun() -> P ! {get, self()}, receive V -> V end end end)(). >> #Fun >> 2> F(). >> undefined >> 3> element(2,lists:keyfind('P', 1, >> lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. >> {value,10} >> 4> F(). >> 10 >> 5> >> >> -- >> Dmitry Belyaev >> >> On 19.11.2012, at 18:05, Gleb Peregud wrote: >> >>> Then I wouldn't be able to set future's value after it being defined. >>> Like in this example: >>> >>> 7> F = future:new(). >>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>> <0.49.0> >>> 9> F:get(). >>> 42 >>> >>> Without this ability such futures are useless with request-reply >> pattern: >>> 1) Client sends request >>> 2) Server creates a future and sends it back to client >>> 3) Client does it's work with the value of the future (without >>> bothering the fact that value may become available in uncertain >>> future) >>> 4) Server finishes computations and sets future's value >>> >>> >>> On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding >>> wrote: >>>> Wouldn't it be easier if future:new just returned a fun? Then you could >> do F() without any changes? >>>> >>>> Robert >>>> >>>> ----- Original Message ----- >>>>> From: "Gleb Peregud" >>>>> To: "Vlad Dumitrescu" >>>>> Cc: "Erlang" >>>>> Sent: Monday, 19 November, 2012 2:18:11 PM >>>>> Subject: Re: [erlang-questions] Futures/promises and ability to >>>>> "call" abstract modules >>>>> >>>>> With the these changes [1] the following code works as intended: >>>>> >>>>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >>>>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >>>>> 8> F(). >>>>> 42 >>>>> >>>>> Aside from a problem where it improperly reports arity in case of >>>>> undefined function: >>>>> >>>>> 9> F(1,2,3). >>>>> ** exception error: undefined function future:call/3 >>>>> >>>>> 1: https://github.com/gleber/otp/compare/call-abstract-module >>>>> >>>>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >>>>> wrote: >>>>>> Sverker Eriksson wrote the following in [1]: >>>>>> >>>>>>> But even if the resource terms look alike, they are unique and >>>>>>> there is no bug leaking NIF resources (that I know of). A resource >>>>>>> is released (and destructor called) when the last reference is >>>>>>> garbage collected. >>>>>>> The shell can fool you however, as it keeps a command history that >>>>>>> can retain terms even though you think the variables are >>>>>>> forgotten. >>>>>>> Test NIF >>>>>>> resource cleanup by running a test module and call >>>>>>> erlang:garbage_collect to force destructors to be called. >>>>>> >>>>>> This seems to mean that they are "shared" and garbage collected >>>>>> just once. >>>>>> >>>>>> 1: >>>>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht >>>>>> ml >>>>>> >>>>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >>>>>> wrote: >>>>>>> I have no idea, that's why I asked :-) /Vlad >>>>>>> >>>>>>> >>>>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >>>>>>> wrote: >>>>>>>> >>>>>>>> I assumed that NIF-generated resources are shared between >>>>>>>> processes (the same way as large binaries are), and I haven't >>>>>>>> done any tests on this. Are you sure it is garbate collected >>>>>>>> multiple times (once per referencing process)? >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>>>>>>> >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> Hi Gleb, >>>>>>>>> >>>>>>>>> just a quick observation about garbage collecting futures: would >>>>>>>>> the NIF-generated resource keep track of usage across processes? >>>>>>>>> I fI send a future as a message, it may be referenced by >>>>>>>>> multiple processes which have their own heap and garbage >>>>>>>>> collection... >>>>>>>>> >>>>>>>>> regards, >>>>>>>>> Vlad >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>>>>>>> >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Hello >>>>>>>>>> >>>>>>>>>> Last evening I was trying to implement futures/promise >>>>>>>>>> mechanism in Erlang (mostly for fun, since I am still unsure if >>>>>>>>>> it is useful). I got inspired with the presentation [1], which >>>>>>>>>> mentioned using futures as a foundation of building services, >>>>>>>>>> where things like timeouts, tracing, authentication, etc. is >>>>>>>>>> built by composing futures (see slide 41). >>>>>>>>>> >>>>>>>>>> Do you think that such composition of futures could be useful >>>>>>>>>> as a tool to improve code reuse of communication patterns in >>>>>>>>>> Erlang (as described in the presentation)? >>>>>>>>>> >>>>>>>>>> I've implemented futures using processes and message passing >>>>>>>>>> and stumbled upon two issues: >>>>>>>>>> 1) garbage collection of futures >>>>>>>>>> 2) slightly too much code when using them >>>>>>>>>> >>>>>>>>>> Example of the first problem is here: >>>>>>>>>> >>>>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>>>>>>> 2> F:get(). %% it hangs for 10 seconds >>>>>>>>>> 10 >>>>>>>>>> >>>>>>>>>> Since future F is represented as a process <0.36.0> it will >>>>>>>>>> stay running forever till it's timed out (which is not a good >>>>>>>>>> solution, since someone may still have a reference to this >>>>>>>>>> future) or F:done() manually called. >>>>>>>>>> >>>>>>>>>> My idea is to insert into 'future' tuple a NIF-generated >>>>>>>>>> resource, which will have a destructor attached (called upon >>>>>>>>>> garbage collection of the >>>>>>>>>> resource) which will call F:done(). Will it work? >>>>>>>>>> >>>>>>>>>> The second issue is illustrated here: >>>>>>>>>> >>>>>>>>>> 7> F = future:new(). >>>>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>>>>>>> <0.49.0> >>>>>>>>>> 9> F:get(). >>>>>>>>>> 42 >>>>>>>>>> >>>>>>>>>> In ideal world it should be enough to just write "F" (without >>>>>>>>>> :get()) to >>>>>>>>>> fetch future's value, but it seems too far fetched for Erlang. >>>>>>>>>> Slightly >>>>>>>>>> better solution would be to allow calling future with "F()". >>>>>>>>>> >>>>>>>>>> This can be done by extending concept of "abstract modules" >>>>>>>>>> with >>>>>>>>>> "default call". Currently abstract modules allow the following: >>>>>>>>>> >>>>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>>>>>>> future:get({future, Pid, Ref, undefined}) >>>>>>>>>> >>>>>>>>>> With a simple change in beam_emu.c in call_fun function (which >>>>>>>>>> would replace obsolete fun tuples) we can allow for the >>>>>>>>>> following: >>>>>>>>>> >>>>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>>>>>>> future:call({future, Pid, Ref, undefined}) >>>>>>>>>> >>>>>>>>>> hence allowing to use just "F()" to read a value of the future. >>>>>>>>>> This >>>>>>>>>> will also extend "metaprogramming" capabilities of Erlang for >>>>>>>>>> some other quirky use, which may or may not be a Good >>>>>>>>>> Thing(tm). >>>>>>>>>> >>>>>>>>>> Thoughts? >>>>>>>>>> >>>>>>>>>> Cheers, >>>>>>>>>> Gleb Peregud >>>>>>>>>> >>>>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> erlang-questions mailing list >>>>>>>>>> erlang-questions@REDACTED >>>>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From norton@REDACTED Tue Nov 20 16:32:41 2012 From: norton@REDACTED (Joseph Wayne Norton) Date: Wed, 21 Nov 2012 00:32:41 +0900 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> Message-ID: <66303AC8-A923-41FA-9DCF-871472DC7C79@lovely.email.ne.jp> FYI. https://github.com/tonyrog/resource Please see this repository if you are not already aware of it. regards, Joe N. On Nov 21, 2012, at 12:20 AM, Gleb Peregud wrote: > Since the resource associated with the process is always stored in > heap of the process, the resource will not get garbage collected until > no heap references it. This way we tie together process and resource > lifetime. And since NIF resources can have a destructor in C which is > called upon resource is garbage collected, we can make use of it to > inform gcproc to terminate. From gleber.p@REDACTED Tue Nov 20 16:35:36 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 16:35:36 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <66303AC8-A923-41FA-9DCF-871472DC7C79@lovely.email.ne.jp> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> <66303AC8-A923-41FA-9DCF-871472DC7C79@lovely.email.ne.jp> Message-ID: That's exactly what I was thinking about! Thanks a bunch! On Tue, Nov 20, 2012 at 4:32 PM, Joseph Wayne Norton wrote: > FYI. > > https://github.com/tonyrog/resource > > Please see this repository if you are not already aware of it. > > regards, > > Joe N. > > On Nov 21, 2012, at 12:20 AM, Gleb Peregud wrote: > >> Since the resource associated with the process is always stored in >> heap of the process, the resource will not get garbage collected until >> no heap references it. This way we tie together process and resource >> lifetime. And since NIF resources can have a destructor in C which is >> called upon resource is garbage collected, we can make use of it to >> inform gcproc to terminate. > From gleber.p@REDACTED Tue Nov 20 16:39:13 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 16:39:13 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: <5494EC75-A4D8-4A4C-ADBA-50A6927FD71E@gmail.com> References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> <5494EC75-A4D8-4A4C-ADBA-50A6927FD71E@gmail.com> Message-ID: Dmitry, this is an interesting idea, but feels a bit hacky :) Unfortunately I don't think that (with this approach) resource:notify_when_destroyed/2 will help to implement automatic garbage collection. In contrast with abstract modules, where it should be possible to implement. Of course without new implicit call user would still have to use "F:get()" to get future value. On Tue, Nov 20, 2012 at 4:32 PM, Dmitry Belyaev wrote: > This is not real implementation. I just showed that it is possible to use fun environment outside of it. That way no parameterized modules and new implicit call to them are required. > Of course garbage collection is the problem. Right now I don't have any good enough proposal to solve it. > > -- > Dmitry Belyaev > > On 20.11.2012, at 18:34, David Mercer wrote: > >> How does that spawned process get garbage collected? >> >> Cheers, >> >> DBM >> >> >>> -----Original Message----- >>> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >>> bounces@REDACTED] On Behalf Of Dmitry Belyaev >>> Sent: Monday, November 19, 2012 21:48 >>> To: Gleb Peregud >>> Cc: Erlang >>> Subject: Re: [erlang-questions] Futures/promises and ability to "call" >>> abstract modules >>> >>> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] >>> [hipe] [kernel-poll:false] >>> >>> Eshell V5.9.1 (abort with ^G) >>> 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); >>> {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) >>> end), fun() -> P ! {get, self()}, receive V -> V end end end)(). >>> #Fun >>> 2> F(). >>> undefined >>> 3> element(2,lists:keyfind('P', 1, >>> lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. >>> {value,10} >>> 4> F(). >>> 10 >>> 5> >>> >>> -- >>> Dmitry Belyaev >>> >>> On 19.11.2012, at 18:05, Gleb Peregud wrote: >>> >>>> Then I wouldn't be able to set future's value after it being defined. >>>> Like in this example: >>>> >>>> 7> F = future:new(). >>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>> <0.49.0> >>>> 9> F:get(). >>>> 42 >>>> >>>> Without this ability such futures are useless with request-reply >>> pattern: >>>> 1) Client sends request >>>> 2) Server creates a future and sends it back to client >>>> 3) Client does it's work with the value of the future (without >>>> bothering the fact that value may become available in uncertain >>>> future) >>>> 4) Server finishes computations and sets future's value >>>> >>>> >>>> On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding >>>> wrote: >>>>> Wouldn't it be easier if future:new just returned a fun? Then you could >>> do F() without any changes? >>>>> >>>>> Robert >>>>> >>>>> ----- Original Message ----- >>>>>> From: "Gleb Peregud" >>>>>> To: "Vlad Dumitrescu" >>>>>> Cc: "Erlang" >>>>>> Sent: Monday, 19 November, 2012 2:18:11 PM >>>>>> Subject: Re: [erlang-questions] Futures/promises and ability to >>>>>> "call" abstract modules >>>>>> >>>>>> With the these changes [1] the following code works as intended: >>>>>> >>>>>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >>>>>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >>>>>> 8> F(). >>>>>> 42 >>>>>> >>>>>> Aside from a problem where it improperly reports arity in case of >>>>>> undefined function: >>>>>> >>>>>> 9> F(1,2,3). >>>>>> ** exception error: undefined function future:call/3 >>>>>> >>>>>> 1: https://github.com/gleber/otp/compare/call-abstract-module >>>>>> >>>>>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >>>>>> wrote: >>>>>>> Sverker Eriksson wrote the following in [1]: >>>>>>> >>>>>>>> But even if the resource terms look alike, they are unique and >>>>>>>> there is no bug leaking NIF resources (that I know of). A resource >>>>>>>> is released (and destructor called) when the last reference is >>>>>>>> garbage collected. >>>>>>>> The shell can fool you however, as it keeps a command history that >>>>>>>> can retain terms even though you think the variables are >>>>>>>> forgotten. >>>>>>>> Test NIF >>>>>>>> resource cleanup by running a test module and call >>>>>>>> erlang:garbage_collect to force destructors to be called. >>>>>>> >>>>>>> This seems to mean that they are "shared" and garbage collected >>>>>>> just once. >>>>>>> >>>>>>> 1: >>>>>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht >>>>>>> ml >>>>>>> >>>>>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >>>>>>> wrote: >>>>>>>> I have no idea, that's why I asked :-) /Vlad >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> I assumed that NIF-generated resources are shared between >>>>>>>>> processes (the same way as large binaries are), and I haven't >>>>>>>>> done any tests on this. Are you sure it is garbate collected >>>>>>>>> multiple times (once per referencing process)? >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>>>>>>>> >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Hi Gleb, >>>>>>>>>> >>>>>>>>>> just a quick observation about garbage collecting futures: would >>>>>>>>>> the NIF-generated resource keep track of usage across processes? >>>>>>>>>> I fI send a future as a message, it may be referenced by >>>>>>>>>> multiple processes which have their own heap and garbage >>>>>>>>>> collection... >>>>>>>>>> >>>>>>>>>> regards, >>>>>>>>>> Vlad >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>>>>>>>> >>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Hello >>>>>>>>>>> >>>>>>>>>>> Last evening I was trying to implement futures/promise >>>>>>>>>>> mechanism in Erlang (mostly for fun, since I am still unsure if >>>>>>>>>>> it is useful). I got inspired with the presentation [1], which >>>>>>>>>>> mentioned using futures as a foundation of building services, >>>>>>>>>>> where things like timeouts, tracing, authentication, etc. is >>>>>>>>>>> built by composing futures (see slide 41). >>>>>>>>>>> >>>>>>>>>>> Do you think that such composition of futures could be useful >>>>>>>>>>> as a tool to improve code reuse of communication patterns in >>>>>>>>>>> Erlang (as described in the presentation)? >>>>>>>>>>> >>>>>>>>>>> I've implemented futures using processes and message passing >>>>>>>>>>> and stumbled upon two issues: >>>>>>>>>>> 1) garbage collection of futures >>>>>>>>>>> 2) slightly too much code when using them >>>>>>>>>>> >>>>>>>>>>> Example of the first problem is here: >>>>>>>>>>> >>>>>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>>>>>>>> 2> F:get(). %% it hangs for 10 seconds >>>>>>>>>>> 10 >>>>>>>>>>> >>>>>>>>>>> Since future F is represented as a process <0.36.0> it will >>>>>>>>>>> stay running forever till it's timed out (which is not a good >>>>>>>>>>> solution, since someone may still have a reference to this >>>>>>>>>>> future) or F:done() manually called. >>>>>>>>>>> >>>>>>>>>>> My idea is to insert into 'future' tuple a NIF-generated >>>>>>>>>>> resource, which will have a destructor attached (called upon >>>>>>>>>>> garbage collection of the >>>>>>>>>>> resource) which will call F:done(). Will it work? >>>>>>>>>>> >>>>>>>>>>> The second issue is illustrated here: >>>>>>>>>>> >>>>>>>>>>> 7> F = future:new(). >>>>>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>>>>>>>> <0.49.0> >>>>>>>>>>> 9> F:get(). >>>>>>>>>>> 42 >>>>>>>>>>> >>>>>>>>>>> In ideal world it should be enough to just write "F" (without >>>>>>>>>>> :get()) to >>>>>>>>>>> fetch future's value, but it seems too far fetched for Erlang. >>>>>>>>>>> Slightly >>>>>>>>>>> better solution would be to allow calling future with "F()". >>>>>>>>>>> >>>>>>>>>>> This can be done by extending concept of "abstract modules" >>>>>>>>>>> with >>>>>>>>>>> "default call". Currently abstract modules allow the following: >>>>>>>>>>> >>>>>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>>>>>>>> future:get({future, Pid, Ref, undefined}) >>>>>>>>>>> >>>>>>>>>>> With a simple change in beam_emu.c in call_fun function (which >>>>>>>>>>> would replace obsolete fun tuples) we can allow for the >>>>>>>>>>> following: >>>>>>>>>>> >>>>>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>>>>>>>> future:call({future, Pid, Ref, undefined}) >>>>>>>>>>> >>>>>>>>>>> hence allowing to use just "F()" to read a value of the future. >>>>>>>>>>> This >>>>>>>>>>> will also extend "metaprogramming" capabilities of Erlang for >>>>>>>>>>> some other quirky use, which may or may not be a Good >>>>>>>>>>> Thing(tm). >>>>>>>>>>> >>>>>>>>>>> Thoughts? >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Gleb Peregud >>>>>>>>>>> >>>>>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> erlang-questions mailing list >>>>>>>>>>> erlang-questions@REDACTED >>>>>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> > From g@REDACTED Tue Nov 20 17:13:03 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 20 Nov 2012 10:13:03 -0600 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: <50ABA20F.4060803@ninenines.eu> References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> Message-ID: On Tue, Nov 20, 2012 at 9:30 AM, Lo?c Hoguin wrote: > On 11/20/2012 04:05 PM, Garrett Smith wrote: >> >> Considering the time and risk of using off the shelf applications like >> Nagios, I think rolling your own is a viable approach. > > > Time? Most definitely. Risk? Please enlighten me. The adoption of any technology entails risk, of course. Nagios is a complex beast, lots of moving parts. If you can get by with something simpler, you eliminate a host of potential problems. I've spent a lot of time dealing with Nagios quality issues, and eventually decided to never use it again. If I knew that ahead of time I could have skipped all that. So yeah, risk. Garrett From tony@REDACTED Tue Nov 20 17:16:18 2012 From: tony@REDACTED (Tony Rogvall) Date: Tue, 20 Nov 2012 17:16:18 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> Message-ID: On 20 nov 2012, at 16:20, Gleb Peregud wrote: > This is yet to be implemented. The idea is to rely on already existing > implementation of NIF resources - this implies that a user of the > library would have to always store Pid of garbage collectable process > (let's call it gcproc) along with that resource in his heap, for > example as {'gcproc', pid(), resource()} and use special API to do > sending, killing, linking, monitoring, etc. > > Since the resource associated with the process is always stored in > heap of the process, the resource will not get garbage collected until > no heap references it. This way we tie together process and resource > lifetime. And since NIF resources can have a destructor in C which is > called upon resource is garbage collected, we can make use of it to > inform gcproc to terminate. > > As Patrik pointed out it is not as trivial as it sounds, but still possible. > Maybe git://github.com/tonyrog/resource.git could come in handy. /Tony > On Tue, Nov 20, 2012 at 3:34 PM, David Mercer wrote: >> How does that spawned process get garbage collected? >> >> Cheers, >> >> DBM >> >> >>> -----Original Message----- >>> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- >>> bounces@REDACTED] On Behalf Of Dmitry Belyaev >>> Sent: Monday, November 19, 2012 21:48 >>> To: Gleb Peregud >>> Cc: Erlang >>> Subject: Re: [erlang-questions] Futures/promises and ability to "call" >>> abstract modules >>> >>> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] >>> [hipe] [kernel-poll:false] >>> >>> Eshell V5.9.1 (abort with ^G) >>> 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); >>> {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) >>> end), fun() -> P ! {get, self()}, receive V -> V end end end)(). >>> #Fun >>> 2> F(). >>> undefined >>> 3> element(2,lists:keyfind('P', 1, >>> lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. >>> {value,10} >>> 4> F(). >>> 10 >>> 5> >>> >>> -- >>> Dmitry Belyaev >>> >>> On 19.11.2012, at 18:05, Gleb Peregud wrote: >>> >>>> Then I wouldn't be able to set future's value after it being defined. >>>> Like in this example: >>>> >>>> 7> F = future:new(). >>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>> <0.49.0> >>>> 9> F:get(). >>>> 42 >>>> >>>> Without this ability such futures are useless with request-reply >>> pattern: >>>> 1) Client sends request >>>> 2) Server creates a future and sends it back to client >>>> 3) Client does it's work with the value of the future (without >>>> bothering the fact that value may become available in uncertain >>>> future) >>>> 4) Server finishes computations and sets future's value >>>> >>>> >>>> On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding >>>> wrote: >>>>> Wouldn't it be easier if future:new just returned a fun? Then you could >>> do F() without any changes? >>>>> >>>>> Robert >>>>> >>>>> ----- Original Message ----- >>>>>> From: "Gleb Peregud" >>>>>> To: "Vlad Dumitrescu" >>>>>> Cc: "Erlang" >>>>>> Sent: Monday, 19 November, 2012 2:18:11 PM >>>>>> Subject: Re: [erlang-questions] Futures/promises and ability to >>>>>> "call" abstract modules >>>>>> >>>>>> With the these changes [1] the following code works as intended: >>>>>> >>>>>> 7> F = future:new(fun() -> timer:sleep(5000), 42 end). >>>>>> {future,<0.44.0>,#Ref<0.0.0.71>,undefined} >>>>>> 8> F(). >>>>>> 42 >>>>>> >>>>>> Aside from a problem where it improperly reports arity in case of >>>>>> undefined function: >>>>>> >>>>>> 9> F(1,2,3). >>>>>> ** exception error: undefined function future:call/3 >>>>>> >>>>>> 1: https://github.com/gleber/otp/compare/call-abstract-module >>>>>> >>>>>> On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud >>>>>> wrote: >>>>>>> Sverker Eriksson wrote the following in [1]: >>>>>>> >>>>>>>> But even if the resource terms look alike, they are unique and >>>>>>>> there is no bug leaking NIF resources (that I know of). A resource >>>>>>>> is released (and destructor called) when the last reference is >>>>>>>> garbage collected. >>>>>>>> The shell can fool you however, as it keeps a command history that >>>>>>>> can retain terms even though you think the variables are >>>>>>>> forgotten. >>>>>>>> Test NIF >>>>>>>> resource cleanup by running a test module and call >>>>>>>> erlang:garbage_collect to force destructors to be called. >>>>>>> >>>>>>> This seems to mean that they are "shared" and garbage collected >>>>>>> just once. >>>>>>> >>>>>>> 1: >>>>>>> http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht >>>>>>> ml >>>>>>> >>>>>>> On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu >>>>>>> wrote: >>>>>>>> I have no idea, that's why I asked :-) /Vlad >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> I assumed that NIF-generated resources are shared between >>>>>>>>> processes (the same way as large binaries are), and I haven't >>>>>>>>> done any tests on this. Are you sure it is garbate collected >>>>>>>>> multiple times (once per referencing process)? >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu >>>>>>>>> >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Hi Gleb, >>>>>>>>>> >>>>>>>>>> just a quick observation about garbage collecting futures: would >>>>>>>>>> the NIF-generated resource keep track of usage across processes? >>>>>>>>>> I fI send a future as a message, it may be referenced by >>>>>>>>>> multiple processes which have their own heap and garbage >>>>>>>>>> collection... >>>>>>>>>> >>>>>>>>>> regards, >>>>>>>>>> Vlad >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud >>>>>>>>>> >>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Hello >>>>>>>>>>> >>>>>>>>>>> Last evening I was trying to implement futures/promise >>>>>>>>>>> mechanism in Erlang (mostly for fun, since I am still unsure if >>>>>>>>>>> it is useful). I got inspired with the presentation [1], which >>>>>>>>>>> mentioned using futures as a foundation of building services, >>>>>>>>>>> where things like timeouts, tracing, authentication, etc. is >>>>>>>>>>> built by composing futures (see slide 41). >>>>>>>>>>> >>>>>>>>>>> Do you think that such composition of futures could be useful >>>>>>>>>>> as a tool to improve code reuse of communication patterns in >>>>>>>>>>> Erlang (as described in the presentation)? >>>>>>>>>>> >>>>>>>>>>> I've implemented futures using processes and message passing >>>>>>>>>>> and stumbled upon two issues: >>>>>>>>>>> 1) garbage collection of futures >>>>>>>>>>> 2) slightly too much code when using them >>>>>>>>>>> >>>>>>>>>>> Example of the first problem is here: >>>>>>>>>>> >>>>>>>>>>> 1> F = future:new(fun() -> timer:sleep(10000), 10 end). >>>>>>>>>>> {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} >>>>>>>>>>> 2> F:get(). %% it hangs for 10 seconds >>>>>>>>>>> 10 >>>>>>>>>>> >>>>>>>>>>> Since future F is represented as a process <0.36.0> it will >>>>>>>>>>> stay running forever till it's timed out (which is not a good >>>>>>>>>>> solution, since someone may still have a reference to this >>>>>>>>>>> future) or F:done() manually called. >>>>>>>>>>> >>>>>>>>>>> My idea is to insert into 'future' tuple a NIF-generated >>>>>>>>>>> resource, which will have a destructor attached (called upon >>>>>>>>>>> garbage collection of the >>>>>>>>>>> resource) which will call F:done(). Will it work? >>>>>>>>>>> >>>>>>>>>>> The second issue is illustrated here: >>>>>>>>>>> >>>>>>>>>>> 7> F = future:new(). >>>>>>>>>>> {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} >>>>>>>>>>> 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). >>>>>>>>>>> <0.49.0> >>>>>>>>>>> 9> F:get(). >>>>>>>>>>> 42 >>>>>>>>>>> >>>>>>>>>>> In ideal world it should be enough to just write "F" (without >>>>>>>>>>> :get()) to >>>>>>>>>>> fetch future's value, but it seems too far fetched for Erlang. >>>>>>>>>>> Slightly >>>>>>>>>>> better solution would be to allow calling future with "F()". >>>>>>>>>>> >>>>>>>>>>> This can be done by extending concept of "abstract modules" >>>>>>>>>>> with >>>>>>>>>>> "default call". Currently abstract modules allow the following: >>>>>>>>>>> >>>>>>>>>>> {future, Pid, Ref, undefined}:get() which is translated to >>>>>>>>>>> future:get({future, Pid, Ref, undefined}) >>>>>>>>>>> >>>>>>>>>>> With a simple change in beam_emu.c in call_fun function (which >>>>>>>>>>> would replace obsolete fun tuples) we can allow for the >>>>>>>>>>> following: >>>>>>>>>>> >>>>>>>>>>> {future, Pid, Ref, undefined}() which COULD be translated to >>>>>>>>>>> future:call({future, Pid, Ref, undefined}) >>>>>>>>>>> >>>>>>>>>>> hence allowing to use just "F()" to read a value of the future. >>>>>>>>>>> This >>>>>>>>>>> will also extend "metaprogramming" capabilities of Erlang for >>>>>>>>>>> some other quirky use, which may or may not be a Good >>>>>>>>>>> Thing(tm). >>>>>>>>>>> >>>>>>>>>>> Thoughts? >>>>>>>>>>> >>>>>>>>>>> Cheers, >>>>>>>>>>> Gleb Peregud >>>>>>>>>>> >>>>>>>>>>> 1: http://monkey.org/~marius/talks/twittersystems/ >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> erlang-questions mailing list >>>>>>>>>>> erlang-questions@REDACTED >>>>>>>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Nov 20 17:55:41 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 17:55:41 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: <00cc7193-adc3-4dae-9f6d-66917f7d6b70@knuth> <1E25BD7D-1C05-4588-AD8E-1E8E1E1B2229@gmail.com> <000f01cdc72c$33e4e620$9baeb260$@gmail.com> Message-ID: Yes, it is very handy :) Thanks! Actually I've used it to create basic implementation of GC-able processes here: https://github.com/gleber/gcproc On Tue, Nov 20, 2012 at 5:16 PM, Tony Rogvall wrote: > > On 20 nov 2012, at 16:20, Gleb Peregud wrote: > > This is yet to be implemented. The idea is to rely on already existing > implementation of NIF resources - this implies that a user of the > library would have to always store Pid of garbage collectable process > (let's call it gcproc) along with that resource in his heap, for > example as {'gcproc', pid(), resource()} and use special API to do > sending, killing, linking, monitoring, etc. > > Since the resource associated with the process is always stored in > heap of the process, the resource will not get garbage collected until > no heap references it. This way we tie together process and resource > lifetime. And since NIF resources can have a destructor in C which is > called upon resource is garbage collected, we can make use of it to > inform gcproc to terminate. > > As Patrik pointed out it is not as trivial as it sounds, but still possible. > > Maybe git://github.com/tonyrog/resource.git could come in handy. > > /Tony > > On Tue, Nov 20, 2012 at 3:34 PM, David Mercer wrote: > > How does that spawned process get garbage collected? > > Cheers, > > DBM > > > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions- > bounces@REDACTED] On Behalf Of Dmitry Belyaev > Sent: Monday, November 19, 2012 21:48 > To: Gleb Peregud > Cc: Erlang > Subject: Re: [erlang-questions] Futures/promises and ability to "call" > abstract modules > > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:2:2] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.9.1 (abort with ^G) > 1> F = (fun() -> FM = fun(M, V) -> receive {value, Value} -> M(M, Value); > {get, P} -> P ! V, M(M, V) end end, P = spawn(fun() -> FM(FM, undefined) > end), fun() -> P ! {get, self()}, receive V -> V end end end)(). > #Fun > 2> F(). > undefined > 3> element(2,lists:keyfind('P', 1, > lists:flatten(element(2,erlang:fun_info(F, env))))) ! {value, 10}. > {value,10} > 4> F(). > 10 > 5> > > -- > Dmitry Belyaev > > On 19.11.2012, at 18:05, Gleb Peregud wrote: > > Then I wouldn't be able to set future's value after it being defined. > Like in this example: > > 7> F = future:new(). > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > <0.49.0> > 9> F:get(). > 42 > > Without this ability such futures are useless with request-reply > > pattern: > > 1) Client sends request > 2) Server creates a future and sends it back to client > 3) Client does it's work with the value of the future (without > bothering the fact that value may become available in uncertain > future) > 4) Server finishes computations and sets future's value > > > On Mon, Nov 19, 2012 at 3:01 PM, Robert Virding > wrote: > > Wouldn't it be easier if future:new just returned a fun? Then you could > > do F() without any changes? > > > Robert > > ----- Original Message ----- > > From: "Gleb Peregud" > To: "Vlad Dumitrescu" > Cc: "Erlang" > Sent: Monday, 19 November, 2012 2:18:11 PM > Subject: Re: [erlang-questions] Futures/promises and ability to > "call" abstract modules > > With the these changes [1] the following code works as intended: > > 7> F = future:new(fun() -> timer:sleep(5000), 42 end). > {future,<0.44.0>,#Ref<0.0.0.71>,undefined} > 8> F(). > 42 > > Aside from a problem where it improperly reports arity in case of > undefined function: > > 9> F(1,2,3). > ** exception error: undefined function future:call/3 > > 1: https://github.com/gleber/otp/compare/call-abstract-module > > On Mon, Nov 19, 2012 at 11:48 AM, Gleb Peregud > wrote: > > Sverker Eriksson wrote the following in [1]: > > But even if the resource terms look alike, they are unique and > there is no bug leaking NIF resources (that I know of). A resource > is released (and destructor called) when the last reference is > garbage collected. > The shell can fool you however, as it keeps a command history that > can retain terms even though you think the variables are > forgotten. > Test NIF > resource cleanup by running a test module and call > erlang:garbage_collect to force destructors to be called. > > > This seems to mean that they are "shared" and garbage collected > just once. > > 1: > http://erlang.org/pipermail/erlang-questions/2011-January/055524.ht > ml > > On Mon, Nov 19, 2012 at 11:46 AM, Vlad Dumitrescu > wrote: > > I have no idea, that's why I asked :-) /Vlad > > > On Mon, Nov 19, 2012 at 11:44 AM, Gleb Peregud > wrote: > > > I assumed that NIF-generated resources are shared between > processes (the same way as large binaries are), and I haven't > done any tests on this. Are you sure it is garbate collected > multiple times (once per referencing process)? > > > > On Mon, Nov 19, 2012 at 11:41 AM, Vlad Dumitrescu > > wrote: > > > Hi Gleb, > > just a quick observation about garbage collecting futures: would > the NIF-generated resource keep track of usage across processes? > I fI send a future as a message, it may be referenced by > multiple processes which have their own heap and garbage > collection... > > regards, > Vlad > > > On Mon, Nov 19, 2012 at 11:32 AM, Gleb Peregud > > wrote: > > > Hello > > Last evening I was trying to implement futures/promise > mechanism in Erlang (mostly for fun, since I am still unsure if > it is useful). I got inspired with the presentation [1], which > mentioned using futures as a foundation of building services, > where things like timeouts, tracing, authentication, etc. is > built by composing futures (see slide 41). > > Do you think that such composition of futures could be useful > as a tool to improve code reuse of communication patterns in > Erlang (as described in the presentation)? > > I've implemented futures using processes and message passing > and stumbled upon two issues: > 1) garbage collection of futures > 2) slightly too much code when using them > > Example of the first problem is here: > > 1> F = future:new(fun() -> timer:sleep(10000), 10 end). > {future,<0.36.0>,#Ref<0.0.0.1736>,undefined} > 2> F:get(). %% it hangs for 10 seconds > 10 > > Since future F is represented as a process <0.36.0> it will > stay running forever till it's timed out (which is not a good > solution, since someone may still have a reference to this > future) or F:done() manually called. > > My idea is to insert into 'future' tuple a NIF-generated > resource, which will have a destructor attached (called upon > garbage collection of the > resource) which will call F:done(). Will it work? > > The second issue is illustrated here: > > 7> F = future:new(). > {future,<0.47.0>,#Ref<0.0.0.27235>,undefined} > 8> spawn(fun() -> timer:sleep(10000), F:set(42) end). > <0.49.0> > 9> F:get(). > 42 > > In ideal world it should be enough to just write "F" (without > :get()) to > fetch future's value, but it seems too far fetched for Erlang. > Slightly > better solution would be to allow calling future with "F()". > > This can be done by extending concept of "abstract modules" > with > "default call". Currently abstract modules allow the following: > > {future, Pid, Ref, undefined}:get() which is translated to > future:get({future, Pid, Ref, undefined}) > > With a simple change in beam_emu.c in call_fun function (which > would replace obsolete fun tuples) we can allow for the > following: > > {future, Pid, Ref, undefined}() which COULD be translated to > future:call({future, Pid, Ref, undefined}) > > hence allowing to use just "F()" to read a value of the future. > This > will also extend "metaprogramming" capabilities of Erlang for > some other quirky use, which may or may not be a Good > Thing(tm). > > Thoughts? > > Cheers, > Gleb Peregud > > 1: http://monkey.org/~marius/talks/twittersystems/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > "Installing applications can lead to corruption over time. Applications > gradually write over each other's libraries, partial upgrades occur, user > and system errors happen, and minute changes may be unnoticeable and > difficult to fix" > > > From tyron.zerafa@REDACTED Tue Nov 20 18:01:33 2012 From: tyron.zerafa@REDACTED (Tyron Zerafa) Date: Tue, 20 Nov 2012 18:01:33 +0100 Subject: [erlang-questions] Erlang Spawn - Undef Message-ID: Does Erlang transfer code between different nodes upon a remote spawn request? Simply put, if I have 2 nodes: LocalNode and RemoteNode, where only LocalNode has the code for FunA ModA and I call spawn(RemoteNode,FunA,ModA,[]) from LocalNode, can the code be transferred automatically to RemoteNode? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Tue Nov 20 18:07:34 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 20 Nov 2012 19:07:34 +0200 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <1353423008.4769.13.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> <50AB65DE.4070306@erlang.org> <50AB89F1.3000209@gmail.com> <1353423008.4769.13.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: <50ABB8D6.8010800@gmail.com> Sorry if understand you wrong but the record in our app doesn't have the same fields. I am not sure what you mean by "pack before calling the module". On 11/20/2012 4:50 PM, Bengt Kleberg wrote: > Greetings, > > Have you checked the performance penalty of a new record of your own, > with the same contents, that you pack before calling the module that has > to know the rabbitmq record? > > > bengt > > On Tue, 2012-11-20 at 15:47 +0200, Martin Dimitrov wrote: >> That is actually my problem - in a module I have to include both .hrl files >> >> On 11/20/2012 1:13 PM, Patrik Nyblom wrote: >>> Hi! >>> >>> Record names are just names in headers, nothing stops you from having >>> one record named e.g. user in one module and a completely different >>> record with the same name in another. As long as you do not include both >>> headers (or in some other way manage to declare the record "type" twice) >>> in the same source code, you're OK. So just limit the use of the >>> rabbitmq user record to a module that does not use your own user record. >>> >>> /Patrik >>> On 11/20/2012 11:06 AM, Martin Dimitrov wrote: >>>> Thanks. I was hoping for a more elegant solution but this will do. >>>> >>>> On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: >>>>> The possibly shortest way is to abuse the fact that records are actually >>>>> tuples and instead of using a #user record for rabbitmq just use a tuple >>>>> that corresponds to it. And comment out the rabbitmq's #user record >>>>> definition, of course. >>>>> >>>>> >>>>> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov >>>>> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I want to connect to RabbitMQ broker through the Erlang client >>>>>> listed on >>>>>> their site. The problem is that it defines a record "user" and in our >>>>>> app we already have such named record. >>>>>> >>>>>> What can I do with minimal code changes? >>>>>> >>>>>> Thank you very much. >>>>>> >>>>>> Regards, >>>>>> Martin >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From g@REDACTED Tue Nov 20 18:19:14 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 20 Nov 2012 11:19:14 -0600 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB89F1.3000209@gmail.com> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> <50AB65DE.4070306@erlang.org> <50AB89F1.3000209@gmail.com> Message-ID: I'd be tempted to isolate the conflicting code into one or more separate modules, which hide the use of the record and provide a more reusable interface. It's hard to know without seeing the code, but that course might be much easier than dealing with tuples. Garrett On Tue, Nov 20, 2012 at 7:47 AM, Martin Dimitrov wrote: > That is actually my problem - in a module I have to include both .hrl files > > On 11/20/2012 1:13 PM, Patrik Nyblom wrote: >> Hi! >> >> Record names are just names in headers, nothing stops you from having >> one record named e.g. user in one module and a completely different >> record with the same name in another. As long as you do not include both >> headers (or in some other way manage to declare the record "type" twice) >> in the same source code, you're OK. So just limit the use of the >> rabbitmq user record to a module that does not use your own user record. >> >> /Patrik >> On 11/20/2012 11:06 AM, Martin Dimitrov wrote: >>> Thanks. I was hoping for a more elegant solution but this will do. >>> >>> On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: >>>> The possibly shortest way is to abuse the fact that records are actually >>>> tuples and instead of using a #user record for rabbitmq just use a tuple >>>> that corresponds to it. And comment out the rabbitmq's #user record >>>> definition, of course. >>>> >>>> >>>> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov >>>> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I want to connect to RabbitMQ broker through the Erlang client >>>>> listed on >>>>> their site. The problem is that it defines a record "user" and in our >>>>> app we already have such named record. >>>>> >>>>> What can I do with minimal code changes? >>>>> >>>>> Thank you very much. >>>>> >>>>> Regards, >>>>> Martin >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>> >>>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Tue Nov 20 19:43:49 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Nov 2012 19:43:49 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> Message-ID: > The adoption of any technology entails risk, of course. Nagios is a > complex beast, lots of moving parts. If you can get by with something > simpler, you eliminate a host of potential problems. or create bunch of problems you won't deal with them. > I've spent a lot of time dealing with Nagios quality issues, and > eventually decided to never use it again. If I knew that ahead of time > I could have skipped all that. So yeah, risk. Still can't understand why people spent time using bad designed softwares. No serious person uses Nagios these days. Give "Shinken" a try: http://www.shinken-monitoring.org/ You can bind to it using Thrift (or write plugins in Python ...): http://www.shinken-monitoring.org/wiki/tsca_daemon_module We're able to monitor +300 nodes in 2 datacenters (Europe, USA). my 2ct Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Nov 20 19:45:09 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 20 Nov 2012 18:45:09 +0000 Subject: [erlang-questions] Erlang Spawn - Undef In-Reply-To: References: Message-ID: Greetings You will have to transfer the beam files yourself. It is easy. Bengt Sent from Moxier Mail (http://www.moxier.com) ----- Ursprungligt meddelande ----- Fr?n: Tyron Zerafa Till: "erlang-questions@REDACTED" Skickat: 20-11-2012 6:01 em ?mne: [erlang-questions] Erlang Spawn - Undef Does Erlang transfer code between different nodes upon a remote spawn request? Simply put, if I have 2 nodes: LocalNode and RemoteNode, where only LocalNode has the code for FunA ModA and I call spawn(RemoteNode,FunA,ModA,[]) from LocalNode, can the code be transferred automatically to RemoteNode? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue Nov 20 19:55:48 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 20 Nov 2012 18:55:48 +0000 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50ABB8D6.8010800@gmail.com> References: <50AB50FA.2040503@gmail.com> <50AB561B.90504@gmail.com> <50AB65DE.4070306@erlang.org> <50AB89F1.3000209@gmail.com> <1353423008.4769.13.camel@sekic1152.rnd.ki.sw.ericsson.se>, <50ABB8D6.8010800@gmail.com> Message-ID: <5ja30x0ibl338kvf4cxm96vh.1353437745831@email.android.com> I meant for you to use a module that handels the foreign record and a new record that you create. It would have the same fields as the one you can not use, but another name. To use the new module you would have to pack the contents of the unusable record into the new record. Bengt Sent from Moxier Mail (http://www.moxier.com) ----- Ursprungligt meddelande ----- Fr?n: Martin Dimitrov Till: "erlang-questions@REDACTED" Skickat: 20-11-2012 6:07 em ?mne: Re: [erlang-questions] RabbitMQ Erlang client integration Sorry if understand you wrong but the record in our app doesn't have the same fields. I am not sure what you mean by "pack before calling the module". On 11/20/2012 4:50 PM, Bengt Kleberg wrote: > Greetings, > > Have you checked the performance penalty of a new record of your own, > with the same contents, that you pack before calling the module that has > to know the rabbitmq record? > > > bengt > > On Tue, 2012-11-20 at 15:47 +0200, Martin Dimitrov wrote: >> That is actually my problem - in a module I have to include both .hrl files >> >> On 11/20/2012 1:13 PM, Patrik Nyblom wrote: >>> Hi! >>> >>> Record names are just names in headers, nothing stops you from having >>> one record named e.g. user in one module and a completely different >>> record with the same name in another. As long as you do not include both >>> headers (or in some other way manage to declare the record "type" twice) >>> in the same source code, you're OK. So just limit the use of the >>> rabbitmq user record to a module that does not use your own user record. >>> >>> /Patrik >>> On 11/20/2012 11:06 AM, Martin Dimitrov wrote: >>>> Thanks. I was hoping for a more elegant solution but this will do. >>>> >>>> On 11/20/2012 11:47 AM, Dmitry Demeshchuk wrote: >>>>> The possibly shortest way is to abuse the fact that records are actually >>>>> tuples and instead of using a #user record for rabbitmq just use a tuple >>>>> that corresponds to it. And comment out the rabbitmq's #user record >>>>> definition, of course. >>>>> >>>>> >>>>> On Tue, Nov 20, 2012 at 1:44 PM, Martin Dimitrov >>>>> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I want to connect to RabbitMQ broker through the Erlang client >>>>>> listed on >>>>>> their site. The problem is that it defines a record "user" and in our >>>>>> app we already have such named record. >>>>>> >>>>>> What can I do with minimal code changes? >>>>>> >>>>>> Thank you very much. >>>>>> >>>>>> Regards, >>>>>> Martin >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Tue Nov 20 19:59:38 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Nov 2012 19:59:38 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: Garret, my initial motivation of futures can be actually found at slide 41-44. It is the ability to compose/stack some generic behaviors like retries, sharding, timeouts upon some basic operations without knowing details of those operations. I've implemented "retry", "timeout" and "safe" wrappers in erlfu to see if it is feasible concept. Let's assume you have a DB server which has a very unstable connection, but you want to make sure to get some results from that server. Here's example basic code for fetching results from that server: fetch(Key, Host, Port) -> {ok, S} = get_tcp:connect(Host, Port, [line]), gen_tcp:send(S, ["GET ", Key, "\n\n"]), {ok, Result} = gen_tcp:recv(S, 0), list_to_integer(Result). And you have some sort of server who manages connection to that server: handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> Result = fetch(Key, Host, Port), {reply, Result, State}. but since remote server is very unstable there's high probabilty that gen_server:calls will timeout and the gen_server will block for a long time. So you rewrite it like this (I know I could use noreply, spawn, gen_server:reply combo for this, but bear with me): handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> F = future:new(fun() -> fetch(Key, Host, Port) end), {reply, F, State}. and make client run F:get() when it needs actual data. This makes gen_server independent of the unstable remote DB server, which makes things a bit better. But it's not enough, since connection to DB server is very unstable, hence you want to add timeouts and retries, and you can do it easily by rewriting that like this: handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> F = future:new(fun() -> fetch(Key, Host, Port) end), F2 = future:timeout(F, 5000), F3 = future:retry(F2, 5), {reply, F, State}. It's a two-lines change but it "automagically" makes these requests do 5 retries with 5s timeout each. This example is a bit artificial, but gives some idea about possible use of those "futures". Other uses which seems possible are generic sharding behavior, stats gathering, tracing and logging. Which essentially gives ability to easily reuse some communication-related patters with very little code repetition. P.S. http://github.com/gleber/erlfu now uses gcproc and resource projects to make futures garbage collected (with a limitation that it works only inside one node). On Mon, Nov 19, 2012 at 10:40 PM, Garrett Smith wrote: > On Mon, Nov 19, 2012 at 4:32 AM, Gleb Peregud wrote: >> Hello >> >> Last evening I was trying to implement futures/promise mechanism in Erlang >> (mostly for fun, since I am still unsure if it is useful). I got inspired >> with the presentation [1], which mentioned using futures as a foundation of >> building services, where things like timeouts, tracing, authentication, etc. >> is built by composing futures (see slide 41). >> >> Do you think that such composition of futures could be useful as a tool to >> improve code reuse of communication patterns in Erlang (as described in the >> presentation)? > > From the presentation, the only motivation for "futures" that I can see is this: > > http://monkey.org/~marius/talks/twittersystems/#26 > > Here's what's on that slide, entitled "Futures": > > * A placeholder for for a result that is, usually, being computed concurrently > -- long computations > -- network call > -- reading from disk > * Computations can fail: > -- connection failure > -- timeout > -- div by zero > * Futures are how we represent concurrent execution. > > I don't see anywhere a problem here, unless you're unhappy with > threads and want to use some "async" library that requires the use of > callbacks, or this futures thing. > > Of course that's why you'd use Erlang. > > As it turns out, all of this is handled rather elegantly by Erlang's > concurrency model, which uses processes and message passing. > > It might be an interesting exercise to figure out how GC works in > under a particular use case, but from the list above, it's unclear > what problems you're trying to solve in Erlang. > > Garrett From Jan.Evangelista@REDACTED Tue Nov 20 20:30:22 2012 From: Jan.Evangelista@REDACTED (Jan.Evangelista@REDACTED) Date: Tue, 20 Nov 2012 20:30:22 +0100 (CET) Subject: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client Message-ID: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Hello. I am writing a client-server application which communicates over SSL. When the SSL connection is successfully established, the server attempts to retrieve the client certificate with ssl:peercert/1 - but on server the function always returns no_peercert error. The client gives PEM certificate and key paths when it requests connection upgrade to SSL: ??? SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], ??? SslConnectResult = ssl:connect(Socket, SslOptions), ??? ?assertMatch({ok, _}, SslConnectResult), ??? .... In an attempt to find what is wrong, I tried to reverse the client and server roles - and the peer certificate can be retrieved successfully on client. In this case the connection is upgraded to SSL with exactly the same SslOptions on server. The peer certificate can be retrieved successfully on client: ... ?assertMatch({ok, _}, ssl:peercert(SslSocket)), and the server code contains basically ??? SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], ??? {ok, SslSocket} = ssl:ssl_accept(Socket, SslOptions, infinity), ??? ... Is the failing ssl:peercert/1 on server a bug/missing implementation, or am I missing something? The Erlang distribution is R14B04. Thanks, Jan From vladdu55@REDACTED Tue Nov 20 21:44:06 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Nov 2012 21:44:06 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> Message-ID: I'll definitely look at Shinken, Mickael, thanks! /Vlad On Tue, Nov 20, 2012 at 7:43 PM, Zabrane Mickael wrote: > The adoption of any technology entails risk, of course. Nagios is a > complex beast, lots of moving parts. If you can get by with something > simpler, you eliminate a host of potential problems. > > > or create bunch of problems you won't deal with them. > > I've spent a lot of time dealing with Nagios quality issues, and > eventually decided to never use it again. If I knew that ahead of time > I could have skipped all that. So yeah, risk. > > > Still can't understand why people spent time using bad designed softwares. > No serious person uses Nagios these days. > > Give "Shinken" a try: > http://www.shinken-monitoring.org/ > > You can bind to it using Thrift (or write plugins in Python ...): > http://www.shinken-monitoring.org/wiki/tsca_daemon_module > > We're able to monitor +300 nodes in 2 datacenters (Europe, USA). > > my 2ct > Zabrane > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Nov 20 23:52:49 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 21 Nov 2012 11:52:49 +1300 Subject: [erlang-questions] fallocate(FALLOC_FL_PUNCH_HOLE) / lseek(SEEK_HOLE / SEEK_DATA) anytime soon ? In-Reply-To: <50AB3F26.7050306@kuantic.com> References: <50AA6A8D.2070607@kuantic.com> <50AB3F26.7050306@kuantic.com> Message-ID: <5AE52238-A5AF-4D27-B2AF-0D3EC65CF27B@cs.otago.ac.nz> On 20/11/2012, at 9:28 PM, Bernard Fouch? wrote: >>> Is there any chance that the API support these features in a reasonable time? >> Out of three operating systems immediately available to me, >> two (Solaris, Mac OS X) do not have fallocate, and one (three different >> versions of Linux that I am counting as one) does have fallocate() but >> insists that it has only an FALLOC_FL_KEEP_SIZE flag. > man 2 fallocate reports the same for me on Fedora 17 however FALLOC_FL_PUNCH_HOLE is listed in /usr/include/linux/falloc.h . I guess the man page is obsolete since kernel 2.6.38: http://man7.org/tlpi/api_changes/index.html#Linux-2.6.38 . It seems that Solaris has fcntl(F_FREESP) which provides the same feature. I can't tell about Mac OS X. The feature is available in more and more fs (zfs, xfs, etx4, btrfs and others). I maintain a file comparing the APIs of Single Unix Specification version 3 Single Unix Specification version 4 Mac OS X (10.5 and 10.6; I don't have anything later at the moment) Linux Solaris (was Solaris 10, is now Solaris 11) HP-UX 11i (have manuals, not system) OpenBSD 4.7 (I really must upgrade this some time) Cygwin AIX (have manuals, not system; just begun on this one). because I'm trying to develop portable-to-POSIX-ish code. It's a huge amount of labour and really needs to be automated in some way. Out of that list, F_FREESP and F_FREESP64 are only available in Solaris. The Solaris documentation says Free storage space associated with a section of the ordinary file fildes. The section is specified by a variable of data type struct flock pointed to by arg. The data type struct flock is defined in the header (see fcntl.h(3HEAD)) and is described below. Note that all file systems might not support all possible variations of F_FREESP arguments. In particular, many file systems allow space to be freed only at the end of a file. It is not obvious to me why Linux didn't copy the Solaris interface. Freeing space at the end of a file can of course be done with {,f}truncate(). Of course more recent versions of various operating systems may have all sorts of goodies. I'm trying to avoid the bleeding edge. From ok@REDACTED Wed Nov 21 00:03:08 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 21 Nov 2012 12:03:08 +1300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> <20121120135045.GA1924@circlewave.net> Message-ID: On 21/11/2012, at 3:19 AM, Max Lapshin wrote: > > > > On Tue, Nov 20, 2012 at 5:50 PM, Jachym Holecek wrote: > # Max Lapshin 2012-11-20: > > But there are only 32 000 of possible pids in unix, so it will limit amount > > of different names. > > I'm curious -- do you have a reference for this limit? POSIX doesn't seem to > define pid_t range. > > No, of course =) > But I haven't ever seen 32 bit pid, so it is ok for this case. An actual transcript from the machine I am typing this on. m% ps -a PID TTY TIME CMD 25493 ttys000 0:00.10 login -pf ok 25494 ttys000 0:00.64 -bash 39476 ttys000 1:52.02 find /home/cshome/o/ok -name pperl.c -print 70511 ttys000 0:00.04 view UNPACK.S 25500 ttys001 0:00.01 login -pfq ok /usr/bin/ssh frege 25501 ttys001 0:03.10 -ssh frege 40195 ttys002 0:00.10 login -pf ok 40196 ttys002 0:00.88 -bash 83669 ttys002 0:00.32 /home/cshome/o/ok/local/lib/erlang/erts-5.6.3/bin/beam 55602 ttys003 0:00.03 login -pf ok 55603 ttys003 0:25.55 -bash 86257 ttys003 0:00.00 ps -a 59007 ttys004 0:00.02 login -pfq ok /usr/bin/ssh ok@REDACTED 59008 ttys004 0:00.90 -ssh ok@REDACTED Almost all of those Unix pids exceed 32,000. Two of them even exceed 16 unsigned bits. This is a 4 GiB machine with a single user. From essen@REDACTED Wed Nov 21 00:37:30 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 21 Nov 2012 00:37:30 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> Message-ID: <50AC143A.20702@ninenines.eu> On 11/20/2012 07:43 PM, Zabrane Mickael wrote: >> I've spent a lot of time dealing with Nagios quality issues, and >> eventually decided to never use it again. If I knew that ahead of time >> I could have skipped all that. So yeah, risk. > > Still can't understand why people spent time using bad designed softwares. > No serious person uses Nagios these days. Pretentious much? I don't use it, but I know many people who do, for the simple reason that it works for them. Why change what's not broken, etc. If it doesn't work for you, sure, but don't diss out people who don't have issues with using it. Let me send you back your comment modified: No serious person asks themselves "is it well designed?" instead of "does it work?" as their most important criteria to choosing which software to use. Can do the same about changing software that works. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From g@REDACTED Wed Nov 21 00:55:48 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 20 Nov 2012 17:55:48 -0600 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: <50AC143A.20702@ninenines.eu> References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> <50AC143A.20702@ninenines.eu> Message-ID: On Tue, Nov 20, 2012 at 5:37 PM, Lo?c Hoguin wrote: > On 11/20/2012 07:43 PM, Zabrane Mickael wrote: >>> >>> I've spent a lot of time dealing with Nagios quality issues, and >>> eventually decided to never use it again. If I knew that ahead of time >>> I could have skipped all that. So yeah, risk. >> >> Still can't understand why people spent time using bad designed softwares. >> No serious person uses Nagios these days. > > Pretentious much? > > I don't use it, but I know many people who do, for the simple reason that it > works for them. Why change what's not broken, etc. If it doesn't work for > you, sure, but don't diss out people who don't have issues with using it. > > Let me send you back your comment modified: No serious person asks > themselves "is it well designed?" instead of "does it work?" as their most > important criteria to choosing which software to use. Can do the same about > changing software that works. Everyone's entitled to lash out emotionally at a software package that's caused them pain :) I do think this is an excellent application for Erlang though. Even really stupid, naive code can live very well in production environments. You want to monitor something, create a process that just repeats mindlessly checking. Supervise it. You can easily have 10K of these things and they'll just work, probably. If a check fails, the process sends uses a REST call for one of a dozen great email services or SMS gateways to notify someone. Maybe write to a dets table that's served via a simple http interface (Cowboy!) to provide a simple workflow for problem resolution. Fun stuff! And no, we shouldn't bash Nagios. It's hardly sporting. Garrett From essen@REDACTED Wed Nov 21 01:41:54 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 21 Nov 2012 01:41:54 +0100 Subject: [erlang-questions] app for watching/monitoring other erlang nodes In-Reply-To: References: <50AB7A4E.70507@ninenines.eu> <50ABA20F.4060803@ninenines.eu> <50AC143A.20702@ninenines.eu> Message-ID: <50AC2352.8070307@ninenines.eu> On 11/21/2012 12:55 AM, Garrett Smith wrote: > On Tue, Nov 20, 2012 at 5:37 PM, Lo?c Hoguin wrote: >> On 11/20/2012 07:43 PM, Zabrane Mickael wrote: >>>> >>>> I've spent a lot of time dealing with Nagios quality issues, and >>>> eventually decided to never use it again. If I knew that ahead of time >>>> I could have skipped all that. So yeah, risk. >>> >>> Still can't understand why people spent time using bad designed softwares. >>> No serious person uses Nagios these days. >> >> Pretentious much? >> >> I don't use it, but I know many people who do, for the simple reason that it >> works for them. Why change what's not broken, etc. If it doesn't work for >> you, sure, but don't diss out people who don't have issues with using it. >> >> Let me send you back your comment modified: No serious person asks >> themselves "is it well designed?" instead of "does it work?" as their most >> important criteria to choosing which software to use. Can do the same about >> changing software that works. > > Everyone's entitled to lash out emotionally at a software package > that's caused them pain :) > > I do think this is an excellent application for Erlang though. Me too. But to get more info than just up|down you need SNMP and/or user-defined daemons and that's a lot more work than just checking if an operation succeeds. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From demeshchuk@REDACTED Wed Nov 21 03:41:38 2012 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Wed, 21 Nov 2012 06:41:38 +0400 Subject: [erlang-questions] =?windows-1252?q?=5BANN=5D_Euthanasia_=96_appl?= =?windows-1252?q?ication_for_killing_bottleneck_processes?= Message-ID: Hi, list. I've recently faced several cases where you might want to kill your process if its message queue grows way too large, or it starts occupying way too much memory (and GC doesn't help around). That's why I made this small application ? rather a proof of concept, of course, since in a lot of cases killing overloaded processes is unacceptable. (But I actually left a way to do a lossless or nearly lossless killing ? via pre-kill hooks) https://github.com/doubleyou/euthanasia Should have done this for Spawnfest, but too late. Have fun killing your processes. -- Best regards, Dmitry Demeshchuk -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Wed Nov 21 05:37:13 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 21 Nov 2012 07:37:13 +0300 Subject: [erlang-questions] How to introspect atom table? In-Reply-To: References: <50AB7BA8.6050206@ninenines.eu> <50AB7F47.9060604@ninenines.eu> <20121120135045.GA1924@circlewave.net> Message-ID: Ok, there are two ways: 1) tell php programmer to change connect to pconnect in his buggy and horrible piece of php code and take a look at what will happen 2) tell php programmer truth about his piece of software and advice him to completely rewrite this subsystem First is easier a bit. On Wednesday, November 21, 2012, Richard O'Keefe wrote: > > On 21/11/2012, at 3:19 AM, Max Lapshin wrote: > > > > > > > > > On Tue, Nov 20, 2012 at 5:50 PM, Jachym Holecek > > wrote: > > # Max Lapshin 2012-11-20: > > > But there are only 32 000 of possible pids in unix, so it will limit > amount > > > of different names. > > > > I'm curious -- do you have a reference for this limit? POSIX doesn't > seem to > > define pid_t range. > > > > No, of course =) > > But I haven't ever seen 32 bit pid, so it is ok for this case. > > An actual transcript from the machine I am typing this on. > > m% ps -a > PID TTY TIME CMD > 25493 ttys000 0:00.10 login -pf ok > 25494 ttys000 0:00.64 -bash > 39476 ttys000 1:52.02 find /home/cshome/o/ok -name pperl.c -print > 70511 ttys000 0:00.04 view UNPACK.S > 25500 ttys001 0:00.01 login -pfq ok /usr/bin/ssh frege > 25501 ttys001 0:03.10 -ssh frege > 40195 ttys002 0:00.10 login -pf ok > 40196 ttys002 0:00.88 -bash > 83669 ttys002 0:00.32 > /home/cshome/o/ok/local/lib/erlang/erts-5.6.3/bin/beam > 55602 ttys003 0:00.03 login -pf ok > 55603 ttys003 0:25.55 -bash > 86257 ttys003 0:00.00 ps -a > 59007 ttys004 0:00.02 login -pfq ok /usr/bin/ssh ok@REDACTED > 59008 ttys004 0:00.90 -ssh ok@REDACTED > > Almost all of those Unix pids exceed 32,000. > Two of them even exceed 16 unsigned bits. > > This is a 4 GiB machine with a single user. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Nov 21 07:53:05 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Nov 2012 07:53:05 +0100 Subject: [erlang-questions] beginner: {undef, [{ts_install_cth, ... in log from slave_SUITE Message-ID: <1353480785.4756.10.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Does somebody have a link to ts_install_cth.erl ? When I try to run slave_SUITE I get the following error: *** CT 2012-11-21 07:38:28.786 *** Suite Hook Failed to start a CTH: error:{undef, [{ts_install_cth,init, [#Ref<0.0.0.1892>,[]], []}, ... {test_server,run_test_case_eval,9, [{file,"test_server.erl"}, {line,1296}]}]} This is due to me installing slave_SUITE.erl on its own after locating it with Google. The same search facility could not locate ts_install_cth.erl. Is there somebody that know where I can find it? bengt From v.antonovich@REDACTED Wed Nov 21 10:22:45 2012 From: v.antonovich@REDACTED (Victor Antonovich) Date: Wed, 21 Nov 2012 13:22:45 +0400 Subject: [erlang-questions] Word boundary assertion matching for unicode strings in re module Message-ID: <50AC9D65.5020505@gmail.com> Hello! It looks like Erlang re module can't match word boundary assertion (\b) for non-latin characters in unicode strings: $ erl Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] [kernel-poll:false] Eshell V5.9.2 (abort with ^G) 1> {_, R} = re:compile("\\b\\p{L}+\\b", [unicode, caseless]). {ok,{re_pattern,0,1, <<69,82,67,80,61,0,0,0,1,8,0,0,1,0,0,0,0,0,0,0,0,0,0,...>>}} 2> re:run("abc 123 def", R, [global]). {match,[[{0,3}],[{8,3}]]} 3> re:run("abc 123 ???", R, [global]). {match,[[{0,3}]]} 4> "abc 123 ???". [97,98,99,32,49,50,51,32,1072,1073,1074] 5> {_, R1} = re:compile("\\p{L}+", [unicode, caseless]). {ok,{re_pattern,0,1, <<69,82,67,80,59,0,0,0,1,8,0,0,1,0,0,0,0,0,0,0,0,0,0,...>>}} 6> re:run("abc 123 def", R1, [global]). {match,[[{0,3}],[{8,3}]]} 7> re:run("abc 123 ???", R1, [global]). {match,[[{0,3}],[{8,6}]]} 8> Is it intended behaviour or i missed something? Regards, Victor. From bernard.fouche@REDACTED Wed Nov 21 11:01:31 2012 From: bernard.fouche@REDACTED (=?ISO-8859-1?Q?Bernard_Fouch=E9?=) Date: Wed, 21 Nov 2012 11:01:31 +0100 Subject: [erlang-questions] fallocate(FALLOC_FL_PUNCH_HOLE) / lseek(SEEK_HOLE / SEEK_DATA) anytime soon ? In-Reply-To: <5AE52238-A5AF-4D27-B2AF-0D3EC65CF27B@cs.otago.ac.nz> References: <50AA6A8D.2070607@kuantic.com> <50AB3F26.7050306@kuantic.com> <5AE52238-A5AF-4D27-B2AF-0D3EC65CF27B@cs.otago.ac.nz> Message-ID: <50ACA67B.5090608@kuantic.com> Le 20/11/2012 23:52, Richard O'Keefe a ?crit : > On 20/11/2012, at 9:28 PM, Bernard Fouch? wrote: >>>> Is there any chance that the API support these features in a reasonable time? >>> Out of three operating systems immediately available to me, >>> two (Solaris, Mac OS X) do not have fallocate, and one (three different >>> versions of Linux that I am counting as one) does have fallocate() but >>> insists that it has only an FALLOC_FL_KEEP_SIZE flag. >> man 2 fallocate reports the same for me on Fedora 17 however FALLOC_FL_PUNCH_HOLE is listed in /usr/include/linux/falloc.h . I guess the man page is obsolete since kernel 2.6.38: http://man7.org/tlpi/api_changes/index.html#Linux-2.6.38 . It seems that Solaris has fcntl(F_FREESP) which provides the same feature. I can't tell about Mac OS X. The feature is available in more and more fs (zfs, xfs, etx4, btrfs and others). > I maintain a file comparing the APIs of > Single Unix Specification version 3 > Single Unix Specification version 4 > Mac OS X (10.5 and 10.6; I don't have anything later at the moment) > Linux > Solaris (was Solaris 10, is now Solaris 11) > HP-UX 11i (have manuals, not system) > OpenBSD 4.7 (I really must upgrade this some time) > Cygwin > AIX (have manuals, not system; just begun on this one). > because I'm trying to develop portable-to-POSIX-ish code. lseek(SEEK_HOLE / SEEK_DATA) are about to be POSIX compliant (http://austingroupbugs.net/view.php?id=415) whenever POSIX 1003.1 2008 is updated (this also brings an official definition of what is a sparse file). Adding SEEK_HOLE and SEEK_DATA in unix_efile.c seems easy, EFILE_SEEK_HOLE/DATA can return EINVAL if SEEK_HOLE/DATA are undefined for the current platform, or pass them down to lseek(2) if supported. Unfortunately I wasn't able to find anything about hole punching in the Austin group discussions. So there are upcoming tools to know about holes but no planned tools to punch holes in the middle of a file, too bad... > It's a huge amount of labour and really needs to be automated in some way. > > Out of that list, F_FREESP and F_FREESP64 are only available in Solaris. > The Solaris documentation says > > Free storage space associated with a section of the > ordinary file fildes. The section is specified by a > variable of data type struct flock pointed to by arg. > The data type struct flock is defined in the > header (see fcntl.h(3HEAD)) and is described below. Note > that all file systems might not support all possible > variations of F_FREESP arguments. In particular, many > file systems allow space to be freed only at the end of > a file. > > It is not obvious to me why Linux didn't copy the Solaris interface. And by changing the definition of fallocate() they also broke POSIX compliance. > Freeing space at the end of a file can of course be done with > {,f}truncate(). > > Of course more recent versions of various operating systems may have > all sorts of goodies. I'm trying to avoid the bleeding edge. > I'll experiment and probably solve my problem by deporting hole management in an external C program, even if I would have preferred to keep the whole file management in the same piece of code. Bernard From pan@REDACTED Wed Nov 21 11:31:40 2012 From: pan@REDACTED (Patrik Nyblom) Date: Wed, 21 Nov 2012 11:31:40 +0100 Subject: [erlang-questions] Word boundary assertion matching for unicode strings in re module In-Reply-To: <50AC9D65.5020505@gmail.com> References: <50AC9D65.5020505@gmail.com> Message-ID: <50ACAD8C.10008@erlang.org> Hi! On 11/21/2012 10:22 AM, Victor Antonovich wrote: > Hello! > > It looks like Erlang re module can't match word boundary assertion (\b) > for non-latin characters in unicode strings: > > $ erl > Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] > [kernel-poll:false] > > Eshell V5.9.2 (abort with ^G) > 1> {_, R} = re:compile("\\b\\p{L}+\\b", [unicode, caseless]). > {ok,{re_pattern,0,1, > <<69,82,67,80,61,0,0,0,1,8,0,0,1,0,0,0,0,0,0,0,0,0,0,...>>}} > 2> re:run("abc 123 def", R, [global]). > {match,[[{0,3}],[{8,3}]]} > 3> re:run("abc 123 ???", R, [global]). > {match,[[{0,3}]]} > 4> "abc 123 ???". > [97,98,99,32,49,50,51,32,1072,1073,1074] > 5> {_, R1} = re:compile("\\p{L}+", [unicode, caseless]). > {ok,{re_pattern,0,1, > <<69,82,67,80,59,0,0,0,1,8,0,0,1,0,0,0,0,0,0,0,0,0,0,...>>}} > 6> re:run("abc 123 def", R1, [global]). > {match,[[{0,3}],[{8,3}]]} > 7> re:run("abc 123 ???", R1, [global]). > {match,[[{0,3}],[{8,6}]]} > 8> > > Is it intended behaviour or i missed something? No, not really intended, but it's kind of a known limitation... The pcre_exec.c code of the version we use says: /* Find out if the previous and current characters are "word" characters. It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to be "non-word" characters. */ ... prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; ... cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0; ... - so, it's a design choise in the used PCRE library. It seems fixed in the recent pcre-2.83, but... The use of PCRE in Erlang involves a whole lot of hacking to adopt PCRE to Erlang's execution model where the schedulers have to gain control within a limited time frame. So whenever we chose to switch PCRE library, we have quite some work ahead of us. Work that has to be done with caution. In other words, you will have to wait for an adoption of 2.83 for a while, although it will happen (I would say, looking at the current backlogs, there is no chance having it in place for R16B :() > Regards, > Victor. Cheers, /Patrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From v.antonovich@REDACTED Wed Nov 21 12:31:05 2012 From: v.antonovich@REDACTED (Victor Antonovich) Date: Wed, 21 Nov 2012 15:31:05 +0400 Subject: [erlang-questions] Word boundary assertion matching for unicode strings in re module In-Reply-To: <50ACAD8C.10008@erlang.org> References: <50AC9D65.5020505@gmail.com> <50ACAD8C.10008@erlang.org> Message-ID: <50ACBB79.8000405@gmail.com> 21.11.2012 14:31, Patrik Nyblom wrote: > - so, it's a design choise in the used PCRE library. It seems fixed > in the recent pcre-2.83, but... > > The use of PCRE in Erlang involves a whole lot of hacking to adopt > PCRE to Erlang's execution model where the schedulers have to gain > control within a limited time frame. So whenever we chose to switch > PCRE library, we have quite some work ahead of us. Work that has to > be done with caution. In other words, you will have to wait for an > adoption of 2.83 for a while, although it will happen (I would say, > looking at the current backlogs, there is no chance having it in > place for R16B :() Thanks for the response, Patrik. I'll be watching for updates in re module. > Cheers, /Patrik Thanks, Victor. From erlangsiri@REDACTED Wed Nov 21 14:16:08 2012 From: erlangsiri@REDACTED (Siri Hansen) Date: Wed, 21 Nov 2012 14:16:08 +0100 Subject: [erlang-questions] beginner: {undef, [{ts_install_cth, ... in log from slave_SUITE In-Reply-To: <1353480785.4756.10.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1353480785.4756.10.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: Hi Bengt! You should follow https://github.com/erlang/otp/wiki/Running-tests for running the OTP tests. If you do so, you will at some point do cd release/tests/test_server the ts_install_cth module should be located in this directory (after building tests). (The source is located in the test_server application, but the module is OTP internal and is therefore not available in test_server-/ebin). Regards /siri 2012/11/21 Bengt Kleberg > Greetings, > > Does somebody have a link to ts_install_cth.erl ? > > > When I try to run slave_SUITE I get the following error: > > *** CT 2012-11-21 07:38:28.786 *** Suite Hook > Failed to start a CTH: error:{undef, > [{ts_install_cth,init, > [#Ref<0.0.0.1892>,[]], > []}, > ... > {test_server,run_test_case_eval,9, > [{file,"test_server.erl"}, > {line,1296}]}]} > > This is due to me installing slave_SUITE.erl on its own after locating > it with Google. The same search facility could not locate > ts_install_cth.erl. Is there somebody that know where I can find it? > > > bengt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Nov 21 14:21:38 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 21 Nov 2012 14:21:38 +0100 Subject: [erlang-questions] beginner: {undef, [{ts_install_cth, ... in log from slave_SUITE In-Reply-To: References: <1353480785.4756.10.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: <1353504098.4756.19.camel@sekic1152.rnd.ki.sw.ericsson.se> Thank you. Unfortunately I have a company installed Erlang/OTP that I can not change. However, I found that if I removed the line: suite() -> [{ct_hooks,[ts_install_cth]}]. from slave_SUITE.erl, all test cases pass. bengt On Wed, 2012-11-21 at 14:16 +0100, Siri Hansen wrote: > Hi Bengt! > > > You should follow https://github.com/erlang/otp/wiki/Running-tests for > running the OTP tests. If you do so, you will at some point do > > > cd release/tests/test_server > > > the ts_install_cth module should be located in this directory (after > building tests). > > > (The source is located in the test_server application, but the module > is OTP internal and is therefore not available in > test_server-/ebin). > > > Regards > /siri > > > > 2012/11/21 Bengt Kleberg > Greetings, > > Does somebody have a link to ts_install_cth.erl ? > > > When I try to run slave_SUITE I get the following error: > > *** CT 2012-11-21 07:38:28.786 *** Suite Hook > Failed to start a CTH: error:{undef, > [{ts_install_cth,init, > [#Ref<0.0.0.1892>,[]], > []}, > ... > > {test_server,run_test_case_eval,9, > > [{file,"test_server.erl"}, > {line,1296}]}]} > > This is due to me installing slave_SUITE.erl on its own after > locating > it with Google. The same search facility could not locate > ts_install_cth.erl. Is there somebody that know where I can > find it? > > > bengt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From simon@REDACTED Wed Nov 21 14:22:09 2012 From: simon@REDACTED (Simon MacMullen) Date: Wed, 21 Nov 2012 13:22:09 +0000 Subject: [erlang-questions] RabbitMQ Erlang client integration In-Reply-To: <50AB50FA.2040503@gmail.com> References: <50AB50FA.2040503@gmail.com> Message-ID: <50ACD581.4050400@rabbitmq.com> On 20/11/12 09:44, Martin Dimitrov wrote: > I want to connect to RabbitMQ broker through the Erlang client listed on > their site. The problem is that it defines a record "user" and in our > app we already have such named record. Hmm, that's not great. There's no very good reason for that record to leak out. We will try to make this cleaner in future. Cheers, Simon From jean-sebastien.pedron@REDACTED Wed Nov 21 15:39:45 2012 From: jean-sebastien.pedron@REDACTED (=?ISO-8859-1?Q?Jean-S=E9bastien_P=E9dron?=) Date: Wed, 21 Nov 2012 15:39:45 +0100 Subject: [erlang-questions] dialyzer: warning when calling fun() from a record() Message-ID: <50ACE7B1.5070709@dumbbell.fr> Hi! I made two small programs to isolate an issue I encounter with Dialyzer. The purpose is to call a fun() given as a function argument. The first program, "call_fun_ok.erl", has a function which takes the fun() as a separate argument and dialyzer is happy with that. The second program, "call_fun_fail.erl", has a function which takes the fun() from a record() given as argument. This time, dialyzer complains with the following warning: Fun application with arguments (call_fun_fail:state()) will fail since the function has type fun((call_fun_fail:state()) -> call_fun_fail:state()) Both programs otherwise work the same. This was tested with Erlang R15B02 and Git revision d30cee99 (branch "master"). I've attached both modules source code to this mail. Does someone see a problem with my code in "call_fun_fail.erl"? Thanks! -- Jean-S?bastien P?dron -------------- next part -------------- A non-text attachment was scrubbed... Name: call_fun_ok.erl Type: text/x-erlang Size: 494 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: call_fun_fail.erl Type: text/x-erlang Size: 486 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 259 bytes Desc: OpenPGP digital signature URL: From essen@REDACTED Wed Nov 21 17:02:12 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 21 Nov 2012 17:02:12 +0100 Subject: [erlang-questions] Help running OTP tests In-Reply-To: References: <50AB8A21.5000403@ninenines.eu> Message-ID: <50ACFB04.9050709@ninenines.eu> (replying to the ML too) Not sure how disabling the timeout would help it start slave nodes? I'm running the tests using ts:run/0. Shouldn't mnesia work if I just follow the indications found here? https://github.com/erlang/otp/wiki/Running-tests On 11/21/2012 04:50 PM, Klodus Klodus wrote: > Hi, > > Look at README file in Mnesia test directory: > > "Use the "erl -mnesia_test_timeout" flag to disable the test case time > limit mechanism." > > I hope it helps. > > BR, > Klaudiusz > > > 2012/11/20 Lo?c Hoguin : >> Hello, >> >> I'm trying, and failing, to run the Mnesia tests on my laptop. >> >> This is what I get, repeatedly, over many of them: >> >> Could not start slavenode {"alice","d808219o808643n808671", >> "-mnesia debug none -pa >> /home/essen/extend/otp/release/tests/mnesia_test -pa >> /home/essen/extend/otp/lib/mnesia/ebin"} timeout retrying >> >> "alice" is my laptop's hostname. >> >> Any idea why and how I can fix it? >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From hm@REDACTED Wed Nov 21 17:19:05 2012 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 21 Nov 2012 17:19:05 +0100 Subject: [erlang-questions] Help running OTP tests In-Reply-To: <50ACFB04.9050709@ninenines.eu> References: <50AB8A21.5000403@ninenines.eu> <50ACFB04.9050709@ninenines.eu> Message-ID: Maybe it is simpler to use Mnesia's own mini test server. See lib/mnesia/test/README for details. I principle you do like this: export ERL_TOP= cd $ERL_TOP/lib/mnesia/test make ./mt %% Run this in the a-node mt:t({mnesia_SUITE, all}). /H?kan On Wed, Nov 21, 2012 at 5:02 PM, Lo?c Hoguin wrote: > (replying to the ML too) > > Not sure how disabling the timeout would help it start slave nodes? > > I'm running the tests using ts:run/0. Shouldn't mnesia work if I just follow > the indications found here? https://github.com/erlang/otp/wiki/Running-tests > > On 11/21/2012 04:50 PM, Klodus Klodus wrote: >> >> Hi, >> >> Look at README file in Mnesia test directory: >> >> "Use the "erl -mnesia_test_timeout" flag to disable the test case time >> limit mechanism." >> >> I hope it helps. >> >> BR, >> Klaudiusz >> >> >> 2012/11/20 Lo?c Hoguin : >> >>> Hello, >>> >>> I'm trying, and failing, to run the Mnesia tests on my laptop. >>> >>> This is what I get, repeatedly, over many of them: >>> >>> Could not start slavenode {"alice","d808219o808643n808671", >>> "-mnesia debug none -pa >>> /home/essen/extend/otp/release/tests/mnesia_test -pa >>> /home/essen/extend/otp/lib/mnesia/ebin"} timeout retrying >>> >>> "alice" is my laptop's hostname. >>> >>> Any idea why and how I can fix it? >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> http://ninenines.eu >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From essen@REDACTED Wed Nov 21 17:34:14 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 21 Nov 2012 17:34:14 +0100 Subject: [erlang-questions] Help running OTP tests In-Reply-To: References: <50AB8A21.5000403@ninenines.eu> <50ACFB04.9050709@ninenines.eu> Message-ID: <50AD0286.3040900@ninenines.eu> Alright but then how do I run everything except mnesia when I'm running the OTP test suite? My changes touch a lot of applications. On 11/21/2012 05:19 PM, H?kan Mattsson wrote: > Maybe it is simpler to use Mnesia's own mini test server. See > lib/mnesia/test/README for details. > I principle you do like this: > > export ERL_TOP= > cd $ERL_TOP/lib/mnesia/test > make > ./mt > > %% Run this in the a-node > mt:t({mnesia_SUITE, all}). > > /H?kan > > On Wed, Nov 21, 2012 at 5:02 PM, Lo?c Hoguin wrote: >> (replying to the ML too) >> >> Not sure how disabling the timeout would help it start slave nodes? >> >> I'm running the tests using ts:run/0. Shouldn't mnesia work if I just follow >> the indications found here? https://github.com/erlang/otp/wiki/Running-tests >> >> On 11/21/2012 04:50 PM, Klodus Klodus wrote: >>> >>> Hi, >>> >>> Look at README file in Mnesia test directory: >>> >>> "Use the "erl -mnesia_test_timeout" flag to disable the test case time >>> limit mechanism." >>> >>> I hope it helps. >>> >>> BR, >>> Klaudiusz >>> >>> >>> 2012/11/20 Lo?c Hoguin : >>> >>>> Hello, >>>> >>>> I'm trying, and failing, to run the Mnesia tests on my laptop. >>>> >>>> This is what I get, repeatedly, over many of them: >>>> >>>> Could not start slavenode {"alice","d808219o808643n808671", >>>> "-mnesia debug none -pa >>>> /home/essen/extend/otp/release/tests/mnesia_test -pa >>>> /home/essen/extend/otp/lib/mnesia/ebin"} timeout retrying >>>> >>>> "alice" is my laptop's hostname. >>>> >>>> Any idea why and how I can fix it? >>>> >>>> -- >>>> Lo?c Hoguin >>>> Erlang Cowboy >>>> Nine Nines >>>> http://ninenines.eu >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> http://ninenines.eu >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From ingela.andin@REDACTED Wed Nov 21 17:36:59 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 21 Nov 2012 17:36:59 +0100 Subject: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client In-Reply-To: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> References: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Message-ID: Hello! 2012/11/20, Jan.Evangelista@REDACTED : > Hello. > > I am writing a client-server application which communicates over SSL. > > When the SSL connection is successfully established, the server attempts to > retrieve the client certificate with ssl:peercert/1 - but on server the > function always returns no_peercert error. The client gives PEM certificate > and key paths when it requests connection upgrade to SSL: > > SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, > ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], > SslConnectResult = ssl:connect(Socket, SslOptions), > ?assertMatch({ok, _}, SslConnectResult), > .... > > In an attempt to find what is wrong, I tried to reverse the client and > server roles - and the peer certificate can be retrieved successfully on > client. In this case the connection is upgraded to SSL with exactly the same > SslOptions on server. The peer certificate can be retrieved successfully on > client: > ... > ?assertMatch({ok, _}, ssl:peercert(SslSocket)), > > and the server code contains basically > > SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, > ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], > {ok, SslSocket} = ssl:ssl_accept(Socket, SslOptions, infinity), > ... > > Is the failing ssl:peercert/1 on server a bug/missing implementation, or am > I missing something? The Erlang distribution is R14B04. > > Thanks, Jan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > Well we have a reported issue that is similar to what you describe, but we have not been able to reproduce it yet. However in your case it proably depends on that you have not specified that the server should verify the client {verify, verify_peer} , by default the server will not request a client certificate. Regards Ingela Erlang/OTP team - Ericsson AB From richardprideauxevans@REDACTED Wed Nov 21 19:18:47 2012 From: richardprideauxevans@REDACTED (Richard Evans) Date: Wed, 21 Nov 2012 10:18:47 -0800 (PST) Subject: [erlang-questions] Sending a large block of binary data from c to erlang In-Reply-To: References: Message-ID: Thanks Joe. This is very helpful. Now that I have set the packet-size as 4 bytes, this does work. I can happily send the 2 meg binary block from erlang to c. But there is a perplexing slow-down which I do not understand. I am encoding the binary block like this: encode({load_instance_from_binary, GameIndex, BinaryBlock}) -> Result = lists:append([[?SERVER_INSTRUCTION_LOAD_INSTANCE_FROM_BINARY | convertToFourBytes(GameIndex)], convertToFourBytes(byte_size(BinaryBlock)), binary:bin_to_list(BinaryBlock)]), Result. convertToFourBytes(X) -> <> = <>, [B1,B2,B3,B4]. This converts the binary block to list format before appending it to the rest of the list. This bin_to_list does not seem to cause any slow-down. The slow-down seems to happen when sending the 2 meg message from erlang to c. In this function, taken from Joe's book: handle_call(Msg, _From, #state{port=Port}=State) -> EncodedMsg = encode(Msg), validate_message(EncodedMsg), Port ! {self(), {command, EncodedMsg}}, receive {Port, {data, Data}} -> DecodedData = decode(Data) end, {reply, DecodedData, State}; I have a breakpoint on the c function that corresponds to the message. What perplexes me is that there is a 5 minute delay between the message being sent to the c-port (Port ! {self(), {command, EncodedMsg}}, and the c-function actually getting called! Any advice much appreciated. thanks, Richard On Saturday, November 10, 2012 1:45:35 PM UTC, Joe Armstrong wrote: > > The only answer is "try it and see" - it all depends. The computer I'm > typing > this mail on has 4GB or RAM - compared to that 1M is "nothing". > > Are you running on a 24GB monster or 5MB embedded system? Do you have > one parallel process, sending one 1 MB message, or a thousand? Do you send > your 1 MB messages once every millisecond - or once a year. > > Just knowing that your message is 1MB tells me nothing about the other > parts > of your system - when GB memories came I stopped calling MBytes "large" > and TB disks means that GB files are not really "large" - these are > relative terms. > Today Peta bytes is "large" - but we get a 1000x scale change every ten > years > > There no intrinsic reason why it should not work - Just make sure the > packet length > will fit into 4 bytes and use {packet,4}. > > I have a file replication system in Erlang - I send all small files in > single messages > (I think the cut-off is 10 MB) and larger files in chunks (mainly so I can > restart them > if things go wrong) > > Oh and a port-driver should be fine for this. > > Cheers > > [aside] performance always surprises me - I think reading a few hundred > small files > will take a long time - but it takes a blink of a second - I guess this is > because > it would take me a heck of a long time to do this - GHz clock speeds are so > fast that just about everything I think would take a long time doesn't. > > > > /Joe > > > > > > > > > > On Fri, Nov 9, 2012 at 3:31 PM, Richard Evans > > wrote: > >> I am using a port to communicate between c and erlang, as described in >> Joe Armstrong's excellent book, and in this tutorial: >> http://www.erlang.org/doc/tutorial/c_port.html#id63121 >> >> So far, the traffic between the two has been pretty small: typically a >> hundred bytes or so at a time. >> >> But now I need to (occasionally) send a large block of binary data from c >> to erlang: up to 1 meg. >> >> How should I handle such large blocks of binary data? Is there anything >> wrong with increasing the size of the buffer (called buf in the tutorial >> mentioned above) to 1 meg? >> >> Is there a better way of doing this? (NB I am using a port, rather than a >> port-driver (in which the c-code is linked directly to the erlang code)). >> >> thanks, >> Richard Evans >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-q...@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alec@REDACTED Wed Nov 21 19:51:55 2012 From: alec@REDACTED (Alec Mocatta) Date: Wed, 21 Nov 2012 18:51:55 +0000 Subject: [erlang-questions] Why does having SNDBUF too low break HTTP? Message-ID: I've got a simple http server running, with gen_tcp options as follows: [ binary, {active, false}, {packet, http_bin}, {reuseaddr, true}, {keepalive, true}, {delay_send, false}, {nodelay, true} ] With one response in particular that sends a single 300000 byte http chunk with a single gen_tcp:send call, I'm seeing some clients failing to receive it, or only receiving the first 150000 - 250000 bytes. Firefox, Chrome and Cocoa's NSURLConnection all have problems while receiving the response, with Firefox and NSURLConnection truncating the response, and Chrome not accepting it at all and giving an error. Curl and wget however receive the response fine. tcpick -C -yP "tcp port 80" shows the connection being closed before all the data's sent, printing the data truncated at the same place as Firefox, followed by: 1 FIN-WAIT-2 x.108.161.x:65438 > 10.144.11.241:http 1 TIME-WAIT x.108.161.x:65438 > 10.144.11.241:http 1 CLOSED x.108.161.x:65438 > 10.144.11.241:http Setting sndbuf to 512000 however seems to solve the problem, at least for the 300000 byte chunk size I'm sending. Why would sndbuf affect the validity of the TCP/HTTP stream? Someone suggested this looks like the return value of write(2) isn't being checked, or EAGAIN isn't being dealt with correctly? gen_tcp:send is returning ok, however. Erlang version: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:true] Any ideas what could be causing this? Thanks, Alec -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Wed Nov 21 20:48:03 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Wed, 21 Nov 2012 19:48:03 +0000 Subject: [erlang-questions] algorithm of lists:sort? Message-ID: Hi, I am looking at implementation of lists:sort. I need to describe it to my colleague, so he can implement an analogous version in C++ (he does not know Erlang). Looking at the code it is very non-obvious how it works. There is a lot of pattern matching, but it is very hard to get the picture. Trapexit[1] says it's a merge sort. But why is the implementation so big? Functions involved in lists:sort: sort_1 split_1 split_1_1 split_2 split_2_1 rmergel mergel merge3_1 merge3_12 merge3_21 merge2_1 merge2_2 ... and so on ... If anyone knows its internals, I would very much appreciate a high level description of the algorithm. Maybe with brief description what the merge_x_x and split_x_x functions are doing? [1]: http://www.trapexit.org/String_Sort_List Thanks, Motiejus From mjtruog@REDACTED Wed Nov 21 21:32:44 2012 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 21 Nov 2012 12:32:44 -0800 Subject: [erlang-questions] algorithm of lists:sort? In-Reply-To: References: Message-ID: <50AD3A6C.9010008@gmail.com> On 11/21/2012 11:48 AM, Motiejus Jak?tys wrote: > I am looking at implementation of lists:sort. I think a simpler place to look is here: http://en.literateprograms.org/Quicksort_%28Erlang%29 The same code has been improved here: https://github.com/okeuday/CloudI/blob/master/src/lib/cloudi_core/src/cloudi_lists.erl I believe that I have tested this sort in the past and found it to be quicker than lists:sort, but it probably depends on the context (I didn't exhaustively test it, and I must not have posted the results anywhere). From pfisher@REDACTED Wed Nov 21 22:42:19 2012 From: pfisher@REDACTED (Paul Fisher) Date: Wed, 21 Nov 2012 15:42:19 -0600 Subject: [erlang-questions] algorithm of lists:sort? In-Reply-To: References: Message-ID: It is a merge sort. My recollection last I looked is that all the extra functions and patterns are manually unrolled optimizations. -- paul On Nov 21, 2012, at 1:48 PM, "Motiejus Jak?tys" wrote: > Hi, > > I am looking at implementation of lists:sort. I need to describe it to > my colleague, so he can implement an analogous version in C++ (he does > not know Erlang). Looking at the code it is very non-obvious how it > works. There is a lot of pattern matching, but it is very hard to get > the picture. Trapexit[1] says it's a merge sort. But why is the > implementation so big? > > Functions involved in lists:sort: > sort_1 > split_1 > split_1_1 > split_2 > split_2_1 > rmergel > mergel > merge3_1 > merge3_12 > merge3_21 > merge2_1 > merge2_2 > ... and so on ... > > If anyone knows its internals, I would very much appreciate a high > level description of the algorithm. Maybe with brief description what > the merge_x_x and split_x_x functions are doing? > > [1]: http://www.trapexit.org/String_Sort_List > > Thanks, > Motiejus > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Wed Nov 21 22:43:05 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 21 Nov 2012 22:43:05 +0100 Subject: [erlang-questions] Futures/promises and ability to "call" abstract modules In-Reply-To: References: Message-ID: Now that example actually work. Previously retries were not working due to future cloning worked only one level deep (it was a shallow). I've improved it to do deep copying and now, along with automatic garbage collection, it can be used in practice. It was a great exercise :) Let me know if anyone *actually* use it ;) On Tue, Nov 20, 2012 at 7:59 PM, Gleb Peregud wrote: > Garret, my initial motivation of futures can be actually found at > slide 41-44. It is the ability to compose/stack some generic behaviors > like retries, sharding, timeouts upon some basic operations without > knowing details of those operations. > > I've implemented "retry", "timeout" and "safe" wrappers in erlfu to > see if it is feasible concept. Let's assume you have a DB server which > has a very unstable connection, but you want to make sure to get some > results from that server. > > Here's example basic code for fetching results from that server: > > fetch(Key, Host, Port) -> > {ok, S} = get_tcp:connect(Host, Port, [line]), > gen_tcp:send(S, ["GET ", Key, "\n\n"]), > {ok, Result} = gen_tcp:recv(S, 0), > list_to_integer(Result). > > And you have some sort of server who manages connection to that server: > > handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> > Result = fetch(Key, Host, Port), > {reply, Result, State}. > > but since remote server is very unstable there's high probabilty that > gen_server:calls will timeout and the gen_server will block for a long > time. So you rewrite it like this (I know I could use noreply, spawn, > gen_server:reply combo for this, but bear with me): > > handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> > F = future:new(fun() -> fetch(Key, Host, Port) end), > {reply, F, State}. > > and make client run F:get() when it needs actual data. > > This makes gen_server independent of the unstable remote DB server, > which makes things a bit better. But it's not enough, since connection > to DB server is very unstable, hence you want to add timeouts and > retries, and you can do it easily by rewriting that like this: > > handle_call({fetch, Key}, #state{host = Host, port = Port} = State) -> > F = future:new(fun() -> fetch(Key, Host, Port) end), > F2 = future:timeout(F, 5000), > F3 = future:retry(F2, 5), > {reply, F, State}. > > It's a two-lines change but it "automagically" makes these requests do > 5 retries with 5s timeout each. > > This example is a bit artificial, but gives some idea about possible > use of those "futures". Other uses which seems possible are generic > sharding behavior, stats gathering, tracing and logging. Which > essentially gives ability to easily reuse some communication-related > patters with very little code repetition. > > P.S. http://github.com/gleber/erlfu now uses gcproc and resource > projects to make futures garbage collected (with a limitation that it > works only inside one node). > > On Mon, Nov 19, 2012 at 10:40 PM, Garrett Smith wrote: >> On Mon, Nov 19, 2012 at 4:32 AM, Gleb Peregud wrote: >>> Hello >>> >>> Last evening I was trying to implement futures/promise mechanism in Erlang >>> (mostly for fun, since I am still unsure if it is useful). I got inspired >>> with the presentation [1], which mentioned using futures as a foundation of >>> building services, where things like timeouts, tracing, authentication, etc. >>> is built by composing futures (see slide 41). >>> >>> Do you think that such composition of futures could be useful as a tool to >>> improve code reuse of communication patterns in Erlang (as described in the >>> presentation)? >> >> From the presentation, the only motivation for "futures" that I can see is this: >> >> http://monkey.org/~marius/talks/twittersystems/#26 >> >> Here's what's on that slide, entitled "Futures": >> >> * A placeholder for for a result that is, usually, being computed concurrently >> -- long computations >> -- network call >> -- reading from disk >> * Computations can fail: >> -- connection failure >> -- timeout >> -- div by zero >> * Futures are how we represent concurrent execution. >> >> I don't see anywhere a problem here, unless you're unhappy with >> threads and want to use some "async" library that requires the use of >> callbacks, or this futures thing. >> >> Of course that's why you'd use Erlang. >> >> As it turns out, all of this is handled rather elegantly by Erlang's >> concurrency model, which uses processes and message passing. >> >> It might be an interesting exercise to figure out how GC works in >> under a particular use case, but from the list above, it's unclear >> what problems you're trying to solve in Erlang. >> >> Garrett From essen@REDACTED Wed Nov 21 22:45:17 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Wed, 21 Nov 2012 22:45:17 +0100 Subject: [erlang-questions] algorithm of lists:sort? In-Reply-To: References: Message-ID: <50AD4B6D.9070700@ninenines.eu> I was wondering whether some of them could be removed now that the compiler optimizes a lot more things than when I suppose it was written? On 11/21/2012 10:42 PM, Paul Fisher wrote: > It is a merge sort. My recollection last I looked is that all the extra functions and patterns are manually unrolled optimizations. > > > -- > paul > > On Nov 21, 2012, at 1:48 PM, "Motiejus Jak?tys" wrote: > >> Hi, >> >> I am looking at implementation of lists:sort. I need to describe it to >> my colleague, so he can implement an analogous version in C++ (he does >> not know Erlang). Looking at the code it is very non-obvious how it >> works. There is a lot of pattern matching, but it is very hard to get >> the picture. Trapexit[1] says it's a merge sort. But why is the >> implementation so big? >> >> Functions involved in lists:sort: >> sort_1 >> split_1 >> split_1_1 >> split_2 >> split_2_1 >> rmergel >> mergel >> merge3_1 >> merge3_12 >> merge3_21 >> merge2_1 >> merge2_2 >> ... and so on ... >> >> If anyone knows its internals, I would very much appreciate a high >> level description of the algorithm. Maybe with brief description what >> the merge_x_x and split_x_x functions are doing? >> >> [1]: http://www.trapexit.org/String_Sort_List >> >> Thanks, >> Motiejus >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From erlang@REDACTED Wed Nov 21 22:47:12 2012 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 21 Nov 2012 22:47:12 +0100 Subject: [erlang-questions] Sending a large block of binary data from c to erlang In-Reply-To: References: Message-ID: Very strange - I think you'll have to post a bit more code in order to debug this. 5 minutes is a very long time (unless you have a very very slow machine) - can you isolate the problem into a smaller test case that reproduces the problem? Cheers /Joe On Wed, Nov 21, 2012 at 7:18 PM, Richard Evans < richardprideauxevans@REDACTED> wrote: > encode({load_instance_from_binary, GameIndex, BinaryBlock}) -> > Result = lists:append([[?SERVER_INSTRUCTION_LOAD_INSTANCE_FROM_BINARY > | convertToFourBytes(GameIndex)], > convertToFourBytes(byte_size(BinaryBlock)), > binary:bin_to_list(BinaryBlock) <- this line is unecessary replace with BinaryBlock lists get flattened on output so you can just add the binary "as is" without conversion to a list > ]), > Result. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy@REDACTED Thu Nov 22 02:52:05 2012 From: jeremy@REDACTED (Jeremy Ong) Date: Wed, 21 Nov 2012 17:52:05 -0800 Subject: [erlang-questions] presharding with eredis and poolboy Message-ID: If you aren't familiar with presharding, read http://oldblog.antirez.com/post/redis-presharding.html I made some modifications to the eredis_pool application. This application integrates Wooga's eredis client and Devinus's poolboy. I thought I would mention it here in case anybody found it useful or if people wanted to contribute. In sharded_eredis: https://github.com/jeremyong/sharded_eredis, each pool points to a different preconfigured shard. Running sharded_eredis:q([Cmd, Key, Args]) will hash the key and execute the command on the correct pool. It also supports transactions but requires that all commands occur on the same node (this is not enforced yet). Things to do: - Give a clean way for the application can be reconfigured at runtime (in the case where shards are moved for example). - Handle transactions better - Create a library of convenience scripts for managing many redis shards and moving things around (slaves, replication, failover, etc). -- see also my mini blog post on the matter http://www.jeremyong.com/blog/2012/11/21/sharded-eredis/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Thu Nov 22 08:16:13 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 22 Nov 2012 08:16:13 +0100 Subject: [erlang-questions] Sending a large block of binary data from c to erlang In-Reply-To: References: Message-ID: Five minutes certainly sounds like a perplexingly high delay. Why do you convert your binaries to lists, though? As opposed to either building a binary instead, or an iolist? Den 21/11/2012 19.19 skrev "Richard Evans" : > Thanks Joe. This is very helpful. > > Now that I have set the packet-size as 4 bytes, this does work. I can > happily send the 2 meg binary block from erlang to c. > > But there is a perplexing slow-down which I do not understand. > > I am encoding the binary block like this: > > encode({load_instance_from_binary, GameIndex, BinaryBlock}) -> > Result = lists:append([[?SERVER_INSTRUCTION_LOAD_INSTANCE_FROM_BINARY > | convertToFourBytes(GameIndex)], > convertToFourBytes(byte_size(BinaryBlock)), > binary:bin_to_list(BinaryBlock)]), > Result. > > convertToFourBytes(X) -> > <> = <>, > [B1,B2,B3,B4]. > > This converts the binary block to list format before appending it to the > rest of the list. This bin_to_list does not seem to cause any slow-down. > > The slow-down seems to happen when sending the 2 meg message from erlang > to c. In this function, taken from Joe's book: > > handle_call(Msg, _From, #state{port=Port}=State) -> > EncodedMsg = encode(Msg), > validate_message(EncodedMsg), > Port ! {self(), {command, EncodedMsg}}, > receive > {Port, {data, Data}} -> > DecodedData = decode(Data) > end, > {reply, DecodedData, State}; > > I have a breakpoint on the c function that corresponds to the message. > > What perplexes me is that there is a 5 minute delay between the message > being sent to the c-port (Port ! {self(), {command, EncodedMsg}}, and the > c-function actually getting called! > > Any advice much appreciated. > > thanks, > > Richard > > > > On Saturday, November 10, 2012 1:45:35 PM UTC, Joe Armstrong wrote: >> >> The only answer is "try it and see" - it all depends. The computer I'm >> typing >> this mail on has 4GB or RAM - compared to that 1M is "nothing". >> >> Are you running on a 24GB monster or 5MB embedded system? Do you have >> one parallel process, sending one 1 MB message, or a thousand? Do you send >> your 1 MB messages once every millisecond - or once a year. >> >> Just knowing that your message is 1MB tells me nothing about the other >> parts >> of your system - when GB memories came I stopped calling MBytes "large" >> and TB disks means that GB files are not really "large" - these are >> relative terms. >> Today Peta bytes is "large" - but we get a 1000x scale change every ten >> years >> >> There no intrinsic reason why it should not work - Just make sure the >> packet length >> will fit into 4 bytes and use {packet,4}. >> >> I have a file replication system in Erlang - I send all small files in >> single messages >> (I think the cut-off is 10 MB) and larger files in chunks (mainly so I >> can restart them >> if things go wrong) >> >> Oh and a port-driver should be fine for this. >> >> Cheers >> >> [aside] performance always surprises me - I think reading a few hundred >> small files >> will take a long time - but it takes a blink of a second - I guess this >> is because >> it would take me a heck of a long time to do this - GHz clock speeds are >> so >> fast that just about everything I think would take a long time doesn't. >> >> >> >> /Joe >> >> >> >> >> >> >> >> >> >> On Fri, Nov 9, 2012 at 3:31 PM, Richard Evans wrote: >> >>> I am using a port to communicate between c and erlang, as described in >>> Joe Armstrong's excellent book, and in this tutorial: http://www.erlang. >>> **org/doc/tutorial/c_port.html#**id63121 >>> >>> So far, the traffic between the two has been pretty small: typically a >>> hundred bytes or so at a time. >>> >>> But now I need to (occasionally) send a large block of binary data from >>> c to erlang: up to 1 meg. >>> >>> How should I handle such large blocks of binary data? Is there anything >>> wrong with increasing the size of the buffer (called buf in the tutorial >>> mentioned above) to 1 meg? >>> >>> Is there a better way of doing this? (NB I am using a port, rather than >>> a port-driver (in which the c-code is linked directly to the erlang code)). >>> >>> thanks, >>> Richard Evans >>> >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-q...@REDACTED >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >>> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hm@REDACTED Thu Nov 22 09:55:13 2012 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Thu, 22 Nov 2012 09:55:13 +0100 Subject: [erlang-questions] Help running OTP tests In-Reply-To: <50AD0286.3040900@ninenines.eu> References: <50AB8A21.5000403@ninenines.eu> <50ACFB04.9050709@ninenines.eu> <50AD0286.3040900@ninenines.eu> Message-ID: Sorry. I got the impression that you just needed to run the Mnesia tests. /H?kan On Wed, Nov 21, 2012 at 5:34 PM, Lo?c Hoguin wrote: > Alright but then how do I run everything except mnesia when I'm running the > OTP test suite? My changes touch a lot of applications. > > > On 11/21/2012 05:19 PM, H?kan Mattsson wrote: >> >> Maybe it is simpler to use Mnesia's own mini test server. See >> lib/mnesia/test/README for details. >> I principle you do like this: >> >> export ERL_TOP= >> cd $ERL_TOP/lib/mnesia/test >> make >> ./mt >> >> %% Run this in the a-node >> mt:t({mnesia_SUITE, all}). >> >> /H?kan >> >> On Wed, Nov 21, 2012 at 5:02 PM, Lo?c Hoguin wrote: >>> >>> (replying to the ML too) >>> >>> Not sure how disabling the timeout would help it start slave nodes? >>> >>> I'm running the tests using ts:run/0. Shouldn't mnesia work if I just >>> follow >>> the indications found here? >>> https://github.com/erlang/otp/wiki/Running-tests >>> >>> On 11/21/2012 04:50 PM, Klodus Klodus wrote: >>>> >>>> >>>> Hi, >>>> >>>> Look at README file in Mnesia test directory: >>>> >>>> "Use the "erl -mnesia_test_timeout" flag to disable the test case time >>>> limit mechanism." >>>> >>>> I hope it helps. >>>> >>>> BR, >>>> Klaudiusz >>>> >>>> >>>> 2012/11/20 Lo?c Hoguin : >>>> >>>>> Hello, >>>>> >>>>> I'm trying, and failing, to run the Mnesia tests on my laptop. >>>>> >>>>> This is what I get, repeatedly, over many of them: >>>>> >>>>> Could not start slavenode {"alice","d808219o808643n808671", >>>>> "-mnesia debug none -pa >>>>> /home/essen/extend/otp/release/tests/mnesia_test -pa >>>>> /home/essen/extend/otp/lib/mnesia/ebin"} timeout retrying >>>>> >>>>> "alice" is my laptop's hostname. >>>>> >>>>> Any idea why and how I can fix it? >>>>> >>>>> -- >>>>> Lo?c Hoguin >>>>> Erlang Cowboy >>>>> Nine Nines >>>>> http://ninenines.eu >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> http://ninenines.eu >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From Jan.Evangelista@REDACTED Thu Nov 22 12:16:18 2012 From: Jan.Evangelista@REDACTED (Jan.Evangelista@REDACTED) Date: Thu, 22 Nov 2012 12:16:18 +0100 (CET) Subject: [erlang-questions] =?utf-8?q?ssl=3Apeercert_returns_no=5Fpeercert?= =?utf-8?q?_on_server=2C_but_works_on_client?= References: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Message-ID: Hello Ingela! > you have not > specified that the server should verify the client {verify, > verify_peer} , by default the server will > not request a client certificate Thanks for your reply, it helped! I can now retrieve the certificate and validate it when the client needs to enter a privileged role. I had to work around a problem - when the client certificate is signed by a CA, the server crashes at SSL connection time. When the client certificate is only self-signed everything seems to work right including ssl:peercert/1. The server uses the following SSL options and the nul verification fun fron the SSL manual: SslOptions = [{certfile, ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}, {verify, verify_peer}, {verify_fun, {verify_fun_none(), []}}], The client uses following SSL options: SslOptions = [{certfile, ?SSL_LM_CLIENTCERT_PATH}, {keyfile, ?SSL_LM_CLIENTKEY_PATH}], The crash looks as follows: =ERROR REPORT==== 22-Nov-2012::11:14:33 === ** State machine <0.1813.0> terminating ** Last message in was {tcp,#Port<0.7011>, <<22,3,1,0,134,16,0,0,130,0,128,124,165,185,225, 252,236,46,20,10,57,92,171,44,24,67,237,105,105, 128,153,53,52,65,236,144,79,246,189,81,211,105, 88,87,179,197,9,197,132,36,31,157,38,240,241,76, 214,15,188,32,114,131,114,197,104,78,246,89,142, 110,183,91,237,202,20,29,182,215,97,199,75,199, 86,132,197,29,141,105,6,51,167,226,66,140,11,62, 67,79,41,72,103,243,214,47,27,97,176,109,211,15, 192,44,112,127,12,169,78,43,238,119,86,164,119, 235,122,165,209,66,162,67,173,146,105,53,161,79, 183,91,94,22,3,1,1,6,15,0,1,2,1,0,86,79,97,119, 56,220,212,141,121,171,170,45,99,158,180,65,155, 20,158,110,113,113,205,252,0,175,202,212,69,250, 27,118,17,89,131,102,246,150,72,74,115,26,88, 155,52,193,129,163,57,97,69,40,47,216,77,120,59, 73,214,173,46,24,203,163,109,116,172,240,129,40, 245,230,84,7,159,230,152,230,36,205,202,234,29, 112,180,231,160,46,98,96,88,177,133,184,13,64, 25,48,209,188,28,118,125,14,8,183,220,40,146,11, 129,37,29,242,175,117,238,84,105,81,222,97,253, 29,199,106,161,91,229,86,118,121,76,223,9,82, 229,222,144,242,18,65,15,104,222,218,238,207, 154,43,36,22,28,223,32,79,18,163,141,43,34,33, 141,55,126,216,34,213,0,88,132,249,70,199,94,9, 22,201,100,153,222,54,196,13,138,254,175,18,94, 5,81,36,49,239,200,164,3,35,227,215,180,129,206, 9,231,115,68,246,85,247,189,90,107,57,31,76,117, 158,41,167,185,217,186,39,171,4,182,91,66,171, 123,32,129,175,90,243,217,41,18,16,80,217,104, 104,98,184,34,233,98,98,157,190,14,136,137,128, 20,3,1,0,1,1,22,3,1,0,48,236,59,196,85,219,154, 221,159,242,33,94,39,156,30,135,226,130,11,229, 89,17,239,94,183,150,153,48,119,185,238,182,42, 98,81,64,172,239,201,40,122,109,54,11,64,208, 244,135,97>>} ** When State == certify ** Data == {state,server, {#Ref<0.0.0.8307>,<0.1801.0>}, gen_tcp,tcp,tcp_closed,tcp_error,"localhost",8045, #Port<0.7011>, {ssl_options,[],verify_peer, {#Fun,[]}, false,false,undefined,1,"../cert/server.crt", undefined,"../cert/server.key",undefined,undefined, undefined,[],undefined,undefined, [<<0,57>>, <<0,56>>, <<0,53>>, <<0,22>>, <<0,19>>, <<0,10>>, <<0,51>>, <<0,50>>, <<0,47>>, <<0,5>>, <<0,4>>, <<0,21>>, <<0,9>>], #Fun,true,18446744073709551900, false,[],undefined}, {socket_options,list,line,0,0,false}, {connection_states, {connection_state, {security_parameters, <<0,0>>, 0,0,0,0,0,0,0,0,0,0,undefined,undefined, undefined,undefined}, undefined,undefined,undefined,2,true,undefined, undefined}, {connection_state, {security_parameters, <<0,57>>, 0,7,1,16,256,32,unknown,2,20,0,undefined, <<80,173,251,9,182,167,195,207,85,233,230,8, 168,220,102,65,112,98,206,125,25,138,109,69, 19,203,42,127,243,91,89,209>>, <<80,173,251,9,181,195,163,185,49,240,227,167, 126,49,159,95,118,198,197,199,80,109,167, 144,126,133,243,15,58,35,163,41>>, undefined}, undefined,undefined,undefined,undefined,true, undefined,undefined}, {connection_state, {security_parameters, <<0,0>>, 0,0,0,0,0,0,0,0,0,0,undefined,undefined, undefined,undefined}, undefined,undefined,undefined,5,true,undefined, undefined}, {connection_state, {security_parameters, <<0,57>>, 0,7,1,16,256,32,unknown,2,20,0,undefined, <<80,173,251,9,182,167,195,207,85,233,230,8, 168,220,102,65,112,98,206,125,25,138,109,69, 19,203,42,127,243,91,89,209>>, <<80,173,251,9,181,195,163,185,49,240,227,167, 126,49,159,95,118,198,197,199,80,109,167, 144,126,133,243,15,58,35,163,41>>, undefined}, undefined,undefined,undefined,undefined,true, undefined,undefined}}, [],<<>>,<<>>, {{<<74,235,27,194,251,55,161,227,190,40,7,141,30,30,195, 73,80,72,0,0,0,0,0,0,141,253,46,225,175,139,230,151, 57,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,10,0,0,0>>, <<124,237,16,106,151,175,31,162,73,226,133,96,82,170, 172,146,62,65,50,112,80,72,0,0,0,0,0,0,141,253,46, 225,175,139,230,151,57,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0>>}, {<<254,34,90,191,186,108,88,132,227,38,96,111,102,221,16, 176,176,47,0,0,0,0,0,0,194,101,158,183,125,65,112,84, 154,138,247,42,54,110,227,200,226,77,200,16,226,112, 64,93,223,163,2,160,174,68,70,242,182,160,122,43,217, 29,58,168,255,227,13,0,0,4,1,1,0,0,14,0,0,0,0,0,0,0,0, 0,0,0,0,0,54,0,0,0>>, <<58,140,204,97,184,192,94,67,73,81,149,252,253,209, 248,42,177,107,91,42,176,47,0,0,0,0,0,0,194,101,158, 183,125,65,112,84,154,138,247,42,54,110,227,200,226, 77,200,16,226,112,64,93,223,163,2,160,174,68,70,242, 182,160,122,43,217,29,58,168,255,227,13,0,0,4,1,1,0, 0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,54,0,0,0>>}}, [],282641, {session, <<40,81,21,171,116,215,2,75,239,85,93,101,222,58,221, 16,169,9,131,231,253,81,71,239,191,101,119,219,34, 105,114,1>>, <<48,130,3,6,48,130,1,238,2,9,0,144,207,233,174,127, 216,70,81,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0, 48,69,49,11,48,9,6,3,85,4,6,19,2,67,90,49,22,48,20, 6,3,85,4,10,12,13,83,111,101,109,115,97,116,117,32, 67,97,98,117,49,12,48,10,6,3,85,4,11,12,3,73,67,84, 49,16,48,14,6,3,85,4,3,12,7,105,99,116,46,99,111, 109,48,30,23,13,49,50,49,49,50,50,49,48,49,52,49,55, 90,23,13,49,55,49,49,50,49,49,48,49,52,49,55,90,48, 69,49,11,48,9,6,3,85,4,6,19,2,67,90,49,22,48,20,6,3, 85,4,10,12,13,83,111,101,109,115,97,116,117,32,67, 97,98,117,49,12,48,10,6,3,85,4,11,12,3,73,67,84,49, 16,48,14,6,3,85,4,3,12,7,105,99,116,46,99,111,109, 48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5, 0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,190,0,28,89, 0,189,127,83,155,81,235,193,186,105,224,229,114,20, 147,7,203,135,145,175,179,74,115,137,217,179,46,49, 33,83,30,86,32,155,97,177,70,12,87,5,33,124,3,131, 208,19,118,215,95,145,193,207,211,149,0,158,20,3, 133,178,174,238,7,147,205,225,11,50,58,113,4,187, 200,107,194,118,228,153,119,142,202,212,232,111,238, 143,149,0,240,149,144,31,155,235,119,242,167,31,204, 20,13,173,83,39,18,200,244,150,207,229,103,83,58, 216,250,208,252,232,175,56,73,248,44,55,38,176,9, 123,154,211,195,62,97,197,194,234,18,186,40,237,125, 123,63,242,164,23,146,164,198,225,0,94,178,101,232, 183,87,153,207,90,128,63,109,177,132,144,205,127,41, 152,134,149,79,59,224,25,165,83,178,126,96,220,209, 53,165,13,126,95,193,235,94,92,31,201,65,68,116,232, 5,42,84,173,157,4,255,232,77,52,164,103,201,255,162, 250,59,47,45,164,81,61,234,176,62,195,186,173,243, 27,172,129,174,40,187,164,7,169,184,96,68,31,244, 150,24,140,5,247,39,14,70,200,149,63,2,3,1,0,1,48, 13,6,9,42,134,72,134,247,13,1,1,5,5,0,3,130,1,1,0, 95,48,235,37,237,45,7,232,113,142,18,0,146,119,212, 239,43,122,106,160,11,238,184,163,22,75,111,96,224, 116,174,142,137,245,152,220,76,169,91,137,205,60,47, 35,144,44,252,197,149,211,209,121,242,142,122,62,35, 219,37,230,226,96,249,121,68,16,156,28,79,92,174, 101,210,57,156,142,31,129,133,111,65,211,82,16,162, 250,88,35,66,67,62,160,73,110,206,248,0,88,149,217, 191,73,198,117,59,154,45,98,15,156,120,161,84,206, 43,95,242,200,197,1,200,152,131,135,103,253,194,147, 184,115,50,153,45,109,165,189,147,143,194,55,53,12, 52,27,166,133,81,220,200,95,201,0,224,66,152,210,9, 206,187,117,137,123,231,110,173,63,140,33,218,91, 222,194,37,220,146,190,252,10,137,153,167,212,35,77, 107,147,118,84,189,187,130,130,71,245,49,67,101,165, 235,226,224,210,221,240,237,193,53,125,149,159,50, 249,194,176,97,76,224,35,41,249,121,147,23,72,47, 104,178,59,134,201,135,119,189,144,209,144,63,169, 95,86,78,104,79,44,150,79,141,253,46,225,175,139, 230,151,57,6>>, <<48,130,3,54,48,130,2,30,2,9,0,140,204,151,61,246, 240,165,67,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0, 48,93,49,11,48,9,6,3,85,4,6,19,2,67,90,49,39,48,37, 6,3,85,4,10,19,30,82,101,112,117,116,97,116,105,111, 110,32,83,101,114,118,105,99,101,32,68,101,118,101, 108,111,112,109,101,110,116,49,37,48,35,6,3,85,4,3, 19,28,114,101,112,117,116,97,116,105,111,110,45,115, 101,114,118,105,99,101,46,107,101,114,105,111,46,99, 111,109,48,30,23,13,49,50,48,52,48,51,49,53,50,51, 50,55,90,23,13,49,55,48,52,48,50,49,53,50,51,50,55, 90,48,93,49,11,48,9,6,3,85,4,6,19,2,67,90,49,39,48, 37,6,3,85,4,10,19,30,82,101,112,117,116,97,116,105, 111,110,32,83,101,114,118,105,99,101,32,68,101,118, 101,108,111,112,109,101,110,116,49,37,48,35,6,3,85, 4,3,19,28,114,101,112,117,116,97,116,105,111,110,45, 115,101,114,118,105,99,101,46,107,101,114,105,111, 46,99,111,109,48,130,1,34,48,13,6,9,42,134,72,134, 247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1, 0,192,14,209,47,35,12,52,111,245,93,138,117,89,37, 130,184,25,108,243,65,169,208,204,66,122,25,192,194, 226,86,105,37,222,108,131,213,4,139,199,248,161,59, 13,46,125,207,2,199,57,238,131,38,248,28,139,159, 211,81,31,186,202,57,81,143,111,8,122,164,73,41,11, 141,15,83,3,9,25,95,113,95,196,37,150,2,121,248,182, 104,215,240,24,222,66,173,79,125,100,36,187,231,69, 248,20,181,125,39,202,203,193,164,129,95,249,43,99, 3,37,85,200,139,131,12,248,253,89,41,91,142,220,183, 106,47,88,173,175,69,210,89,209,146,97,163,84,153, 107,141,220,76,26,223,247,133,189,234,31,107,176, 129,188,57,164,200,21,91,97,77,105,97,223,236,67, 253,16,128,222,157,234,177,180,47,21,85,131,170,177, 28,238,121,144,92,162,226,2,173,143,181,212,6,172, 148,162,33,100,151,2,91,48,114,135,239,237,111,36, 236,7,8,41,143,3,117,25,15,207,2,79,77,6,126,34,43, 249,147,215,252,97,30,188,15,208,245,195,111,180, 103,104,175,210,13,226,147,46,156,176,119,146,105,2, 3,1,0,1,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0,3, 130,1,1,0,74,14,242,251,17,1,83,137,202,112,234,245, 203,168,159,226,56,164,149,123,50,233,229,88,0,156, 11,0,45,18,250,63,199,38,58,241,62,147,201,162,36, 231,92,72,211,94,244,14,11,205,254,48,95,14,76,204, 149,242,115,80,59,217,248,183,21,114,70,30,51,191, 147,204,247,234,160,80,38,41,119,75,46,227,250,35, 33,24,99,49,182,20,50,255,75,63,209,134,204,68,215, 163,240,89,103,251,242,184,232,33,106,248,81,70,132, 164,142,166,20,112,248,14,66,234,151,21,243,179,22, 144,184,243,240,150,203,228,207,165,155,6,46,157, 227,41,184,122,191,228,99,176,126,245,254,120,84, 159,214,194,167,141,102,73,31,112,183,166,246,102, 66,48,241,174,52,201,190,31,63,109,171,247,83,147, 42,253,196,217,208,128,223,199,226,123,176,180,70, 228,147,208,5,23,182,3,94,114,39,21,150,31,129,137, 92,132,177,71,128,126,44,184,106,224,119,159,219, 192,239,100,163,0,58,205,242,221,178,117,27,149,189, 12,240,147,217,61,4,234,76,231,132,117,189,32,209, 115,85,22,18,239,192,240>>, 0, <<0,57>>, undefined,false,undefined}, 294932,ssl_session_cache, {3,1}, undefined,false,dhe_rsa, {{1,2,840,113549,1,1,1}, {'RSAPublicKey', 23985332548066223260322774259983152247797545948725977981875025710391659706585537937762959847062338790405599724727995315638420544358206480001280868527351317937548968876345931793589896941602423200065683725877315198229678655238870730302517002323138774678006366072941089637364098826231863208669397304033591358850613302169833622263116162988138227035449809879884230462587875848694948534737421208621472209080883099703159964364087058652885206739036200595109009813390823243309991477889022926642506234188064656504587631372428472973627488535282906583541347813283001630133822872906001289445314889618418076221729617745551234209087, 65537}, 'NULL'}, {'RSAPrivateKey','two-prime', 24245061150388932126267388211561744501091175463407888595224551795663243174179988206545263128427895384819161106685261774299926886043886449727365149760320167454881950274766434421391227835510145242902399427836428837752665263535539327909106678269499287402480269087683223401095638029356908814821392014964348552872878386913883155024136808504734817452104655112897489194364101268365556518013584741158156036753091620252122206747573951286458946943600837100506515889843196447909183388855876119846269544345680287986326246932374547999824620904250547635320124126286130214850019238265403675412304909021441994637469225051132486193769, 65537, 17328576366714496692349218475330937854580034940285470950591470934901841303717973474263189804212750777733407470562344122709047946491015536135000243830556128046052236642207219658092169355373769219262268513958316114396029626154205985299761446462633567621642404814626392226234352822575140238263100590093306842930006045435892856121601423729512197996242068235270905851036153226021734054606688010693704177209978560595698319274376708915898529303563327262255759966796798795075686111639483078123875727747288297150915376929152726694642421456339054268945476553274267673852919202129038846069271873486039976781207205533522013452901, 175370494815195674207106911731501626457371590465889564240336423322818657338712687959781189374639152154813531306121219213930531469102050716841885921299604376592875157055568786704961285756158968740499753148009889247438281864458144963953290691240618002674486253789360979786944138116053414853181637891019175023947, 138250514580221862655892174736393256109561741620998730071324163294133331805750724515526687394456291120722335476788733177943715853063937025485775099007036433458977246157028955416570452620946072552127788423550793775405053948011855722670612242672683268700825660765387097861823041722523099578698965460097679657627, 142026097972310688682979178892246827377686719495362230673056380430625800035239858799660442303559022228189923060312340067421103929903114940371087128780655231274599719790063153991676842131832299691331078598101421818164307921296069428060253852454141036512977896548882667244027756452807590319170371129342718366281, 65422024332459841410915727224312434986737847214429003703281753455925004490467174563987200454159832713230111084450752735822031215207773913535717886773963118709481076873642964956194202467818187406490060612777221529161190443408939706229819758029936161438862111743243512305853456718199015628335001843447355527747, 96692327788712893502227594737656137616777825297927354007039082535604854560178523094918225407406512660518516707411647582424617277816228673283401730456439499912365000393053010166088811818218189984574138829734660366829219694139224814835276610527380177578913321283217512483858915039007177988094558316513780160433, asn1_NOVALUE}, {'DHParameter', 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 2,asn1_NOVALUE}, {<<0,0,0,128,42,92,72,253,178,119,231,149,208,224,184,195, 2,12,214,157,94,48,216,139,94,54,195,90,237,248,61,35, 73,227,11,233,89,182,207,43,216,239,223,47,78,186,249, 223,191,42,199,139,246,10,26,246,64,161,131,210,59,8, 207,143,77,241,200,231,165,114,131,173,49,12,174,86, 243,21,240,218,153,61,142,225,144,44,97,205,94,146,14, 123,173,160,147,174,179,19,134,160,75,147,215,243,34, 67,171,218,101,134,50,112,3,248,40,18,46,190,50,53,69, 80,243,194,54,162,75,122,225,69,191,217>>, <<0,0,0,128,108,57,203,135,98,244,98,181,102,201,31,96, 95,187,67,232,64,61,39,6,38,213,166,214,127,108,94, 230,39,199,145,16,194,86,68,250,69,141,221,241,87,166, 81,101,78,204,176,32,74,30,152,23,114,104,225,230,194, 189,126,121,214,84,227,4,147,94,63,105,129,185,189, 175,250,36,16,110,165,122,184,49,73,89,226,148,192,79, 96,248,191,190,116,209,246,242,56,130,10,65,97,89,221, 234,85,120,34,240,170,224,133,195,255,196,58,212,96, 233,34,160,182,220,123,171,219,109,43,188,240,120>>}, undefined,#Ref<0.0.0.8310>, {<0.1801.0>,#Ref<0.0.0.8318>}, 0,<<>>,true, {false,first}, false, {[],[]}, false} ** Reason for termination = ** {decrypt_failed,[{crypto,rsa_public_decrypt, [<<86,79,97,119,56,220,212,141,121,171,170,45,99, 158,180,65,155,20,158,110,113,113,205,252,0,175, 202,212,69,250,27,118,17,89,131,102,246,150,72, 74,115,26,88,155,52,193,129,163,57,97,69,40,47, 216,77,120,59,73,214,173,46,24,203,163,109,116, 172,240,129,40,245,230,84,7,159,230,152,230,36, 205,202,234,29,112,180,231,160,46,98,96,88,177, 133,184,13,64,25,48,209,188,28,118,125,14,8,183, 220,40,146,11,129,37,29,242,175,117,238,84,105, 81,222,97,253,29,199,106,161,91,229,86,118,121, 76,223,9,82,229,222,144,242,18,65,15,104,222, 218,238,207,154,43,36,22,28,223,32,79,18,163, 141,43,34,33,141,55,126,216,34,213,0,88,132,249, 70,199,94,9,22,201,100,153,222,54,196,13,138, 254,175,18,94,5,81,36,49,239,200,164,3,35,227, 215,180,129,206,9,231,115,68,246,85,247,189,90, 107,57,31,76,117,158,41,167,185,217,186,39,171, 4,182,91,66,171,123,32,129,175,90,243,217,41,18, 16,80,217,104,104,98,184,34,233,98,98,157,190, 14,136,137,128>>, [<<0,0,0,3,1,0,1>>, <<0,0,1,1,0,190,0,28,89,0,189,127,83,155,81,235, 193,186,105,224,229,114,20,147,7,203,135,145, 175,179,74,115,137,217,179,46,49,33,83,30,86, 32,155,97,177,70,12,87,5,33,124,3,131,208,19, 118,215,95,145,193,207,211,149,0,158,20,3,133, 178,174,238,7,147,205,225,11,50,58,113,4,187, 200,107,194,118,228,153,119,142,202,212,232, 111,238,143,149,0,240,149,144,31,155,235,119, 242,167,31,204,20,13,173,83,39,18,200,244,150, 207,229,103,83,58,216,250,208,252,232,175,56, 73,248,44,55,38,176,9,123,154,211,195,62,97, 197,194,234,18,186,40,237,125,123,63,242,164, 23,146,164,198,225,0,94,178,101,232,183,87, 153,207,90,128,63,109,177,132,144,205,127,41, 152,134,149,79,59,224,25,165,83,178,126,96, 220,209,53,165,13,126,95,193,235,94,92,31,201, 65,68,116,232,5,42,84,173,157,4,255,232,77,52, 164,103,201,255,162,250,59,47,45,164,81,61, 234,176,62,195,186,173,243,27,172,129,174,40, 187,164,7,169,184,96,68,31,244,150,24,140,5, 247,39,14,70,200,149,63>>], rsa_pkcs1_padding]}, {ssl_handshake,certificate_verify,5}, {ssl_connection,cipher,2}, {ssl_connection,next_state,3}, {ssl_connection,certify,2}, {ssl_connection,next_state,3}, {gen_fsm,handle_msg,7}, {proc_lib,init_p_do_apply,3}]} I am attaching the Makefile which generates the certificates/keys using OpenSSL: # Generation of license manager certificates. $(LM_CERT_DIR)/Cooking-service-ca.crt: openssl genrsa -out $(LM_CERT_DIR)/Cooking-service-ca.key 2048 openssl req -subj '/C=CZ/O=Cooking Service Development/OU=Certificate Authority/CN=Cooking-service-ca.com' -new -key $(LM_CERT_DIR)/Cooking-service-ca.key \ -out $(LM_CERT_DIR)/Cooking-service-ca.csr openssl x509 -req -days 1825 -in $(LM_CERT_DIR)/Cooking-service-ca.csr -signkey $(LM_CERT_DIR)/Cooking-service-ca.key -out $(LM_CERT_DIR)/Cooking-service-ca.crt $(LM_CERT_DIR)/Manager-client.key: openssl genrsa -out $(LM_CERT_DIR)/Manager-client.key 2048 # Erlang SSL_LM_CLIENTCERT_PATH = Manager-client.crt $(LM_CERT_DIR)/Manager-client.crt: $(LM_CERT_DIR)/Manager-client.key $(LM_CERT_DIR)/Cooking-service-ca.crt openssl req -subj '/C=CZ/O=Soemsatu Cabu/OU=ICT/CN=ict.com' -new -key $(LM_CERT_DIR)/Manager-client.key -out $(LM_CERT_DIR)/Manager-client.csr openssl x509 -req -days 1825 -in $(LM_CERT_DIR)/Manager-client.csr -signkey $(LM_CERT_DIR)/Manager-client.key -out $(LM_CERT_DIR)/Manager-client-tmp.crt openssl x509 -days 1825 -in $(LM_CERT_DIR)/Manager-client-tmp.crt -signkey $(LM_CERT_DIR)/Cooking-service-ca.key -out $(LM_CERT_DIR)/Manager-client.crt rm -f Manager-client-tmp.crt ---------- P?vodn? zpr?va ---------- Od: Ingela Andin Datum: 21. 11. 2012 P?edm?t: Re: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client Hello! 2012/11/20, Jan.Evangelista@REDACTED : > Hello. > > I am writing a client-server application which communicates over SSL. > > When the SSL connection is successfully established, the server attempts to > retrieve the client certificate with ssl:peercert/1 - but on server the > function always returns no_peercert error. The client gives PEM certificate > and key paths when it requests connection upgrade to SSL: > > SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, > ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], > SslConnectResult = ssl:connect(Socket, SslOptions), > ?assertMatch({ok, _}, SslConnectResult), > .... > > In an attempt to find what is wrong, I tried to reverse the client and > server roles - and the peer certificate can be retrieved successfully on > client. In this case the connection is upgraded to SSL with exactly the same > SslOptions on server. The peer certificate can be retrieved successfully on > client: > ... > ?assertMatch({ok, _}, ssl:peercert(SslSocket)), > > and the server code contains basically > > SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, > ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], > {ok, SslSocket} = ssl:ssl_accept(Socket, SslOptions, infinity), > ... > > Is the failing ssl:peercert/1 on server a bug/missing implementation, or am > I missing something? The Erlang distribution is R14B04. > > Thanks, Jan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > Well we have a reported issue that is similar to what you describe, but we have not been able to reproduce it yet. However in your case it proably depends on that you have not specified that the server should verify the client {verify, verify_peer} , by default the server will not request a client certificate. Regards Ingela Erlang/OTP team - Ericsson AB From mrkhoza@REDACTED Thu Nov 22 14:54:47 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Thu, 22 Nov 2012 15:54:47 +0200 Subject: [erlang-questions] OTP Question Message-ID: Hi Erlang Developers, May someone help me understand the following: - Is the behavior process in OTP a child process? and - Are callback functions executed in the parent or child process? Kindest Regards Lucky Khoza -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Thu Nov 22 15:18:36 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Thu, 22 Nov 2012 15:18:36 +0100 Subject: [erlang-questions] OTP Question In-Reply-To: References: Message-ID: <50AE343C.9060408@volny.cz> Hello. I assume you are referring to an attribute such as this: -module(example). -behaviour(gen_server). %% <-- ... The module 'example' is a callback MODULE (i.e. a code). It supplies application-specific logic to the generic gen_server process. There is only one process, the gen_server. It calls functions from your callback module for specific events, such as initialization, termination, receiving of a message, code change and such. You only implement the application-specific portion and don't need to know details of the underlying gen_server implementation. For example gen_server:call/X as implemented by the gen_server contains logic that: * detects a call to a nonexistent process, * monitors the gen_server process being called during the entire call request to detect unexpected gen_server termination or a network failure. With the above in mind... > - Is the behavior process in OTP a child process? and No. gen_server module and an application-specific behavior module together implement ONE process. > - Are callback functions executed in the parent or child process? They are executed in the gen_server process, see above. HTH, Ladislav Lenart On 22.11.2012 14:54, Lucky Khoza wrote: > Hi Erlang Developers, > > May someone help me understand the following: > > - Is the behavior process in OTP a child process? and > - Are callback functions executed in the parent or child process? > > Kindest Regards > Lucky Khoza > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From norton@REDACTED Thu Nov 22 15:21:27 2012 From: norton@REDACTED (Joseph Wayne Norton) Date: Thu, 22 Nov 2012 23:21:27 +0900 Subject: [erlang-questions] OTP Question In-Reply-To: References: Message-ID: Lucky - Good question. Based on my experience, the generic part and the specific part (i.e. callback functions) of an OTP behaviour are executed in the *same* process by *convention*. This is a matter of convention and is a design choice that can be decided by the author of the behaviour's generic part. regards, Joe N. p.s. http://www.erlang.org/doc/design_principles/des_princ.html#id69556 On Nov 22, 2012, at 10:54 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > May someone help me understand the following: > > - Is the behavior process in OTP a child process? and > - Are callback functions executed in the parent or child process? > > Kindest Regards > Lucky Khoza > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From brisa.jimenez.f@REDACTED Thu Nov 22 20:09:18 2012 From: brisa.jimenez.f@REDACTED (=?ISO-8859-1?Q?Brisa_Jim=E9nez?=) Date: Thu, 22 Nov 2012 13:09:18 -0600 Subject: [erlang-questions] Encode and decode binary data on port driver: undefined symbol ei_decode_version Message-ID: Hi everyone! I want to send and receive binary data through Erlang port, and use ei to encode and decode data, but when I try to test code below the next error occurs: Erlang R14B03 (erts-5.8.4) [source] [rq:1] [async-threads:0] [kernel-poll:false] Eshell V5.8.4 (abort with ^G) 1> erl_drv:start(). ** exception exit: {error,"undefined symbol: ei_decode_version"} in function erl_drv:start/0 Can anybody give me an example of how do it what I'm want? I appreciate any advice. Thanks. === -module(erl_drv). -export([start/0, stop/0, init/1]). -export([foz/1, baz/1]). -define(C_LIBRARY, "library"). start() -> case erl_ddll:load_driver("priv", ?C_LIBRARY) of ok -> ok; {error, already_loaded} -> ok; {error, Reason}-> exit({error, erl_ddll:format_error(Reason)}) end, spawn(?MODULE, init, [?C_LIBRARY]). init(?C_LIBRARY) -> register(erl_drv, self()), Port = open_port({spawn, ?C_LIBRARY}, [binary]), loop(Port). stop() -> erl_drv ! stop. foz(Arg)-> call_port({foz, Arg}). baz(Arg)-> call_port({baz, Arg}). call_port(Msg) -> erl_drv ! {call, self(), Msg}, receive {erl_drv, Res} -> Res end. loop(Port) -> receive {call, Caller, {Command, Data}}-> case Command of foz-> port_control(Port, 3, encode(Data)); baz-> port_control(Port, 4, encode(Data)) end, receive {Port, {data, Data}} -> Caller ! {erl_drv, decode(Data)} end, loop(Port); stop -> Port ! {self(), close}, receive {Port, closed} -> exit(normal) end; {'EXIT', Port, Reason} -> io:format("~p ~n", [Reason]), exit(port_terminated) end. encode(Msg)-> term_to_binary(Msg). decode(RetVal)-> binary_to_term(RetVal). === /* port_driver.c*/ #include #include "erl_driver.h" #include "ei.h" #include "erl_interface.h" double foz(double); double baz(double); typedef size_t ErlDrvSizeT; typedef ssize_t ErlDrvSSizeT; typedef struct { ErlDrvPort port; } ptr_port; static ErlDrvData start(ErlDrvPort port, char *buff) { ptr_port* ptr_port1 = (ptr_port*)driver_alloc(sizeof(ptr_port)); set_port_control_flags(port , PORT_CONTROL_FLAG_BINARY); ptr_port1->port = port; return (ErlDrvData)ptr_port1; } static void stop(ErlDrvData handle) { driver_free((char*)handle); } static ErlDrvSSizeT control(ErlDrvData handle, unsigned int command, char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen) { ptr_port *ptr_port1 = (ptr_port*)handle; double arg, res; int version, index = 0; if (ei_decode_version(buf, &index, &version)) return((ErlDrvSSizeT) ERL_DRV_ERROR_GENERAL); if (ei_decode_double(buf, &index, &arg)) return((ErlDrvSSizeT) ERL_DRV_ERROR_BADARG); switch (command) { case 3: res = foz(arg); break; case 4: res = baz(arg); break; default: return((ErlDrvSSizeT) ERL_DRV_ERROR_BADARG); } index = 0; if (ei_encode_version(*rbuf, &index) || ei_encode_double(*rbuf, &index, res)) return((ErlDrvSSizeT) ERL_DRV_ERROR_ERRNO); else return((ErlDrvSSizeT) index); } ErlDrvEntry driver_entry = { NULL, //* F_PTR init, N/A start, //* L_PTR start, called when port is opened stop, //* F_PTR stop, called when port is closed NULL, //* F_PTR output, called when erlang has sent NULL, //* F_PTR ready_input, called when input descriptor ready NULL, //* F_PTR ready_output, called when output descriptor ready "library", //* char *driver_name, the argument to open_port NULL, //* F_PTR finish, called when unloaded control, //* F_PTR control, port_command callback NULL, //* F_PTR timeout, reserved NULL //* F_PTR outputv, reserved }; DRIVER_INIT(library) /* must match name in driver_entry */ { return &driver_entry; } === /*library.c*/ double foz(double x) { return x/1.0; } double baz(double y) { return y/2.0; } === # Makefile ERL_ROOT=/usr/local/lib/erlang all: compile_c compile compile_c: @mkdir -p priv gcc -o priv/library.so -I$(ERL_ROOT)/usr/include/ -I$(ERL_ROOT)/lib/erl_interface-3.7.4/include/ -fpic -shared c_src/*.c compile: @mkdir -p ebin erlc -o ebin/ src/erl_drv.erl clean: @rm -rf ebin priv test: erl -pa ebin/ .PHONY: c_src -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Thu Nov 22 20:00:15 2012 From: freza@REDACTED (Jachym Holecek) Date: Thu, 22 Nov 2012 14:00:15 -0500 Subject: [erlang-questions] Encode and decode binary data on port driver: undefined symbol ei_decode_version In-Reply-To: References: Message-ID: <20121122190015.GA18572@circlewave.net> # Brisa Jim?nez 2012-11-22: > I want to send and receive binary data through Erlang port, and use ei to > encode and decode data, but when I try to test code below the next error > occurs: > > Erlang R14B03 (erts-5.8.4) [source] [rq:1] [async-threads:0] > [kernel-poll:false] > > Eshell V5.8.4 (abort with ^G) > 1> erl_drv:start(). > ** exception exit: {error,"undefined symbol: ei_decode_version"} > in function erl_drv:start/0 > > [...] > > # Makefile > > ERL_ROOT=/usr/local/lib/erlang > > all: compile_c compile > > compile_c: > @mkdir -p priv > gcc -o priv/library.so -I$(ERL_ROOT)/usr/include/ > -I$(ERL_ROOT)/lib/erl_interface-3.7.4/include/ -fpic -shared c_src/*.c You're not linking against ei so runtime linker complains about unresolved symbols when you attempt to load your driver. BTW Your Makefile doesn't look completely right either, I don't see why not use filenames as source/target names allowing make to work as intended, but even if there were a reason you should declare your targets as .PHONY (how exactly is that done depends on make dialect at hand). BR, -- Jachym From ward@REDACTED Fri Nov 23 09:57:05 2012 From: ward@REDACTED (Ward Bekker (TTY)) Date: Fri, 23 Nov 2012 09:57:05 +0100 Subject: [erlang-questions] Understanding binary heap garbage collection Message-ID: <473E85B5-97D5-4ACA-B199-A3B83583BC8F@tty.nl> Hi, After an operation with binaries, and manual requesting a garbage collect, the binary heap does not shrink to it's former size. See my test sequence below. About 1.5 MB is added to the binary heap, and never garbage collected. What can be the cause? /W ========= Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] [dtrace] Eshell V5.9.2 (abort with ^G) 1> erlang:memory(). [{total,9654968}, {processes,1123090}, {processes_used,1123090}, {system,8531878}, {atom,194289}, {atom_used,176885}, {binary,1319320}, {code,3892513}, {ets,298400}] 2> lists:foldl(fun(_I, Acc) -> <> end, <<"abc">>, lists:seq(0,21)). <<"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab"?>> 3> erlang:memory(). [{total,22340920}, {processes,1127984}, {processes_used,1127970}, {system,21212936}, {atom,202481}, {atom_used,186083}, {binary,13901920}, {code,3972848}, {ets,302504}] 4> erlang:garbage_collect(). true 5> erlang:memory(). [{total,22314232}, {processes,1100552}, {processes_used,1100538}, {system,21213680}, {atom,202481}, {atom_used,186083}, {binary,13902664}, {code,3972848}, {ets,302504}] 6> -------------- next part -------------- An HTML attachment was scrubbed... URL: From YurinVV@REDACTED Fri Nov 23 10:10:53 2012 From: YurinVV@REDACTED (Slava Yurin) Date: Fri, 23 Nov 2012 16:10:53 +0700 Subject: [erlang-questions] Understanding binary heap garbage collection In-Reply-To: <473E85B5-97D5-4ACA-B199-A3B83583BC8F@tty.nl> References: <473E85B5-97D5-4ACA-B199-A3B83583BC8F@tty.nl> Message-ID: <1663121353661853@web27d.yandex.ru> An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Fri Nov 23 10:15:17 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 23 Nov 2012 10:15:17 +0100 Subject: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client In-Reply-To: References: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Message-ID: Hi! 2012/11/22, Jan.Evangelista@REDACTED : > Hello Ingela! > >> you have not >> specified that the server should verify the client {verify, >> verify_peer} , by default the server will >> not request a client certificate > > Thanks for your reply, it helped! I can now retrieve the certificate and > validate it when the client needs to enter a privileged role. > > I had to work around a problem - when the client certificate is signed by a > CA, the server crashes at SSL connection time. When the client > certificate is only self-signed everything seems to work right including > ssl:peercert/1. > > The server uses the following SSL options and the nul verification fun fron > the SSL manual: > > SslOptions = [{certfile, ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}, > {verify, verify_peer}, {verify_fun, {verify_fun_none(), []}}], Why do you not validate the certificate in the veryify_fun as part of the path_validation? And why do you specify a verify_fun that accepts all stadnard certificates path errors that is not very safe! fun(_,{bad_cert, _} = Reason, _) -> {fail, Reason}; (_,{extension, _}, UserState) -> {unknown, UserState}; (_, valid, UserState) -> {valid, UserState}; (PeerCert, valid_peer, UserState) -> {valid, UserState} end, []} > The client uses following SSL options: > > SslOptions = [{certfile, ?SSL_LM_CLIENTCERT_PATH}, {keyfile, > ?SSL_LM_CLIENTKEY_PATH}], > I will look in to reproducing your problem. So far I have spoted a missing try clause, e.i. we could generate an decrypt faild error message here instead of this crash. > The crash looks as follows: > > =ERROR REPORT==== 22-Nov-2012::11:14:33 === > ** State machine <0.1813.0> terminating > ** Last message in was {tcp,#Port<0.7011>, > <<22,3,1,0,134,16,0,0,130,0,128,124,165,185,225, > > 252,236,46,20,10,57,92,171,44,24,67,237,105,105, > > 128,153,53,52,65,236,144,79,246,189,81,211,105, > > 88,87,179,197,9,197,132,36,31,157,38,240,241,76, > > 214,15,188,32,114,131,114,197,104,78,246,89,142, > > 110,183,91,237,202,20,29,182,215,97,199,75,199, > > 86,132,197,29,141,105,6,51,167,226,66,140,11,62, > > 67,79,41,72,103,243,214,47,27,97,176,109,211,15, > > 192,44,112,127,12,169,78,43,238,119,86,164,119, > > 235,122,165,209,66,162,67,173,146,105,53,161,79, > > 183,91,94,22,3,1,1,6,15,0,1,2,1,0,86,79,97,119, > > 56,220,212,141,121,171,170,45,99,158,180,65,155, > > 20,158,110,113,113,205,252,0,175,202,212,69,250, > 27,118,17,89,131,102,246,150,72,74,115,26,88, > > 155,52,193,129,163,57,97,69,40,47,216,77,120,59, > > 73,214,173,46,24,203,163,109,116,172,240,129,40, > > 245,230,84,7,159,230,152,230,36,205,202,234,29, > 112,180,231,160,46,98,96,88,177,133,184,13,64, > > 25,48,209,188,28,118,125,14,8,183,220,40,146,11, > > 129,37,29,242,175,117,238,84,105,81,222,97,253, > 29,199,106,161,91,229,86,118,121,76,223,9,82, > 229,222,144,242,18,65,15,104,222,218,238,207, > 154,43,36,22,28,223,32,79,18,163,141,43,34,33, > > 141,55,126,216,34,213,0,88,132,249,70,199,94,9, > > 22,201,100,153,222,54,196,13,138,254,175,18,94, > > 5,81,36,49,239,200,164,3,35,227,215,180,129,206, > > 9,231,115,68,246,85,247,189,90,107,57,31,76,117, > 158,41,167,185,217,186,39,171,4,182,91,66,171, > 123,32,129,175,90,243,217,41,18,16,80,217,104, > > 104,98,184,34,233,98,98,157,190,14,136,137,128, > > 20,3,1,0,1,1,22,3,1,0,48,236,59,196,85,219,154, > > 221,159,242,33,94,39,156,30,135,226,130,11,229, > > 89,17,239,94,183,150,153,48,119,185,238,182,42, > 98,81,64,172,239,201,40,122,109,54,11,64,208, > 244,135,97>>} > ** When State == certify > ** Data == {state,server, > {#Ref<0.0.0.8307>,<0.1801.0>}, > gen_tcp,tcp,tcp_closed,tcp_error,"localhost",8045, > #Port<0.7011>, > {ssl_options,[],verify_peer, > {#Fun,[]}, > false,false,undefined,1,"../cert/server.crt", > undefined,"../cert/server.key",undefined,undefined, > undefined,[],undefined,undefined, > [<<0,57>>, > <<0,56>>, > <<0,53>>, > <<0,22>>, > <<0,19>>, > <<0,10>>, > <<0,51>>, > <<0,50>>, > <<0,47>>, > <<0,5>>, > <<0,4>>, > <<0,21>>, > <<0,9>>], > #Fun,true,18446744073709551900, > false,[],undefined}, > {socket_options,list,line,0,0,false}, > {connection_states, > {connection_state, > {security_parameters, > <<0,0>>, > 0,0,0,0,0,0,0,0,0,0,undefined,undefined, > undefined,undefined}, > undefined,undefined,undefined,2,true,undefined, > undefined}, > {connection_state, > {security_parameters, > <<0,57>>, > 0,7,1,16,256,32,unknown,2,20,0,undefined, > > <<80,173,251,9,182,167,195,207,85,233,230,8, > > 168,220,102,65,112,98,206,125,25,138,109,69, > 19,203,42,127,243,91,89,209>>, > > <<80,173,251,9,181,195,163,185,49,240,227,167, > 126,49,159,95,118,198,197,199,80,109,167, > 144,126,133,243,15,58,35,163,41>>, > undefined}, > undefined,undefined,undefined,undefined,true, > undefined,undefined}, > {connection_state, > {security_parameters, > <<0,0>>, > 0,0,0,0,0,0,0,0,0,0,undefined,undefined, > undefined,undefined}, > undefined,undefined,undefined,5,true,undefined, > undefined}, > {connection_state, > {security_parameters, > <<0,57>>, > 0,7,1,16,256,32,unknown,2,20,0,undefined, > > <<80,173,251,9,182,167,195,207,85,233,230,8, > > 168,220,102,65,112,98,206,125,25,138,109,69, > 19,203,42,127,243,91,89,209>>, > > <<80,173,251,9,181,195,163,185,49,240,227,167, > 126,49,159,95,118,198,197,199,80,109,167, > 144,126,133,243,15,58,35,163,41>>, > undefined}, > undefined,undefined,undefined,undefined,true, > undefined,undefined}}, > [],<<>>,<<>>, > > {{<<74,235,27,194,251,55,161,227,190,40,7,141,30,30,195, > > 73,80,72,0,0,0,0,0,0,141,253,46,225,175,139,230,151, > > 57,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,10,0,0,0>>, > <<124,237,16,106,151,175,31,162,73,226,133,96,82,170, > 172,146,62,65,50,112,80,72,0,0,0,0,0,0,141,253,46, > > 225,175,139,230,151,57,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, > 0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0>>}, > > {<<254,34,90,191,186,108,88,132,227,38,96,111,102,221,16, > > 176,176,47,0,0,0,0,0,0,194,101,158,183,125,65,112,84, > > 154,138,247,42,54,110,227,200,226,77,200,16,226,112, > > 64,93,223,163,2,160,174,68,70,242,182,160,122,43,217, > > 29,58,168,255,227,13,0,0,4,1,1,0,0,14,0,0,0,0,0,0,0,0, > 0,0,0,0,0,54,0,0,0>>, > <<58,140,204,97,184,192,94,67,73,81,149,252,253,209, > > 248,42,177,107,91,42,176,47,0,0,0,0,0,0,194,101,158, > > 183,125,65,112,84,154,138,247,42,54,110,227,200,226, > > 77,200,16,226,112,64,93,223,163,2,160,174,68,70,242, > > 182,160,122,43,217,29,58,168,255,227,13,0,0,4,1,1,0, > 0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,54,0,0,0>>}}, > [],282641, > {session, > > <<40,81,21,171,116,215,2,75,239,85,93,101,222,58,221, > > 16,169,9,131,231,253,81,71,239,191,101,119,219,34, > 105,114,1>>, > > <<48,130,3,6,48,130,1,238,2,9,0,144,207,233,174,127, > > 216,70,81,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0, > > 48,69,49,11,48,9,6,3,85,4,6,19,2,67,90,49,22,48,20, > > 6,3,85,4,10,12,13,83,111,101,109,115,97,116,117,32, > > 67,97,98,117,49,12,48,10,6,3,85,4,11,12,3,73,67,84, > 49,16,48,14,6,3,85,4,3,12,7,105,99,116,46,99,111, > > 109,48,30,23,13,49,50,49,49,50,50,49,48,49,52,49,55, > > 90,23,13,49,55,49,49,50,49,49,48,49,52,49,55,90,48, > > 69,49,11,48,9,6,3,85,4,6,19,2,67,90,49,22,48,20,6,3, > > 85,4,10,12,13,83,111,101,109,115,97,116,117,32,67, > > 97,98,117,49,12,48,10,6,3,85,4,11,12,3,73,67,84,49, > > 16,48,14,6,3,85,4,3,12,7,105,99,116,46,99,111,109, > > 48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5, > > 0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,190,0,28,89, > > 0,189,127,83,155,81,235,193,186,105,224,229,114,20, > > 147,7,203,135,145,175,179,74,115,137,217,179,46,49, > > 33,83,30,86,32,155,97,177,70,12,87,5,33,124,3,131, > 208,19,118,215,95,145,193,207,211,149,0,158,20,3, > 133,178,174,238,7,147,205,225,11,50,58,113,4,187, > > 200,107,194,118,228,153,119,142,202,212,232,111,238, > > 143,149,0,240,149,144,31,155,235,119,242,167,31,204, > 20,13,173,83,39,18,200,244,150,207,229,103,83,58, > 216,250,208,252,232,175,56,73,248,44,55,38,176,9, > > 123,154,211,195,62,97,197,194,234,18,186,40,237,125, > > 123,63,242,164,23,146,164,198,225,0,94,178,101,232, > > 183,87,153,207,90,128,63,109,177,132,144,205,127,41, > > 152,134,149,79,59,224,25,165,83,178,126,96,220,209, > > 53,165,13,126,95,193,235,94,92,31,201,65,68,116,232, > > 5,42,84,173,157,4,255,232,77,52,164,103,201,255,162, > > 250,59,47,45,164,81,61,234,176,62,195,186,173,243, > 27,172,129,174,40,187,164,7,169,184,96,68,31,244, > > 150,24,140,5,247,39,14,70,200,149,63,2,3,1,0,1,48, > > 13,6,9,42,134,72,134,247,13,1,1,5,5,0,3,130,1,1,0, > > 95,48,235,37,237,45,7,232,113,142,18,0,146,119,212, > > 239,43,122,106,160,11,238,184,163,22,75,111,96,224, > > 116,174,142,137,245,152,220,76,169,91,137,205,60,47, > > 35,144,44,252,197,149,211,209,121,242,142,122,62,35, > 219,37,230,226,96,249,121,68,16,156,28,79,92,174, > > 101,210,57,156,142,31,129,133,111,65,211,82,16,162, > > 250,88,35,66,67,62,160,73,110,206,248,0,88,149,217, > > 191,73,198,117,59,154,45,98,15,156,120,161,84,206, > > 43,95,242,200,197,1,200,152,131,135,103,253,194,147, > > 184,115,50,153,45,109,165,189,147,143,194,55,53,12, > > 52,27,166,133,81,220,200,95,201,0,224,66,152,210,9, > 206,187,117,137,123,231,110,173,63,140,33,218,91, > > 222,194,37,220,146,190,252,10,137,153,167,212,35,77, > > 107,147,118,84,189,187,130,130,71,245,49,67,101,165, > > 235,226,224,210,221,240,237,193,53,125,149,159,50, > 249,194,176,97,76,224,35,41,249,121,147,23,72,47, > > 104,178,59,134,201,135,119,189,144,209,144,63,169, > 95,86,78,104,79,44,150,79,141,253,46,225,175,139, > 230,151,57,6>>, > <<48,130,3,54,48,130,2,30,2,9,0,140,204,151,61,246, > > 240,165,67,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0, > > 48,93,49,11,48,9,6,3,85,4,6,19,2,67,90,49,39,48,37, > > 6,3,85,4,10,19,30,82,101,112,117,116,97,116,105,111, > > 110,32,83,101,114,118,105,99,101,32,68,101,118,101, > > 108,111,112,109,101,110,116,49,37,48,35,6,3,85,4,3, > > 19,28,114,101,112,117,116,97,116,105,111,110,45,115, > > 101,114,118,105,99,101,46,107,101,114,105,111,46,99, > > 111,109,48,30,23,13,49,50,48,52,48,51,49,53,50,51, > > 50,55,90,23,13,49,55,48,52,48,50,49,53,50,51,50,55, > > 90,48,93,49,11,48,9,6,3,85,4,6,19,2,67,90,49,39,48, > > 37,6,3,85,4,10,19,30,82,101,112,117,116,97,116,105, > > 111,110,32,83,101,114,118,105,99,101,32,68,101,118, > > 101,108,111,112,109,101,110,116,49,37,48,35,6,3,85, > > 4,3,19,28,114,101,112,117,116,97,116,105,111,110,45, > > 115,101,114,118,105,99,101,46,107,101,114,105,111, > > 46,99,111,109,48,130,1,34,48,13,6,9,42,134,72,134, > > 247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1, > > 0,192,14,209,47,35,12,52,111,245,93,138,117,89,37, > > 130,184,25,108,243,65,169,208,204,66,122,25,192,194, > > 226,86,105,37,222,108,131,213,4,139,199,248,161,59, > 13,46,125,207,2,199,57,238,131,38,248,28,139,159, > > 211,81,31,186,202,57,81,143,111,8,122,164,73,41,11, > > 141,15,83,3,9,25,95,113,95,196,37,150,2,121,248,182, > > 104,215,240,24,222,66,173,79,125,100,36,187,231,69, > > 248,20,181,125,39,202,203,193,164,129,95,249,43,99, > > 3,37,85,200,139,131,12,248,253,89,41,91,142,220,183, > > 106,47,88,173,175,69,210,89,209,146,97,163,84,153, > 107,141,220,76,26,223,247,133,189,234,31,107,176, > 129,188,57,164,200,21,91,97,77,105,97,223,236,67, > > 253,16,128,222,157,234,177,180,47,21,85,131,170,177, > > 28,238,121,144,92,162,226,2,173,143,181,212,6,172, > > 148,162,33,100,151,2,91,48,114,135,239,237,111,36, > > 236,7,8,41,143,3,117,25,15,207,2,79,77,6,126,34,43, > 249,147,215,252,97,30,188,15,208,245,195,111,180, > > 103,104,175,210,13,226,147,46,156,176,119,146,105,2, > > 3,1,0,1,48,13,6,9,42,134,72,134,247,13,1,1,5,5,0,3, > > 130,1,1,0,74,14,242,251,17,1,83,137,202,112,234,245, > > 203,168,159,226,56,164,149,123,50,233,229,88,0,156, > > 11,0,45,18,250,63,199,38,58,241,62,147,201,162,36, > > 231,92,72,211,94,244,14,11,205,254,48,95,14,76,204, > > 149,242,115,80,59,217,248,183,21,114,70,30,51,191, > > 147,204,247,234,160,80,38,41,119,75,46,227,250,35, > > 33,24,99,49,182,20,50,255,75,63,209,134,204,68,215, > > 163,240,89,103,251,242,184,232,33,106,248,81,70,132, > > 164,142,166,20,112,248,14,66,234,151,21,243,179,22, > 144,184,243,240,150,203,228,207,165,155,6,46,157, > 227,41,184,122,191,228,99,176,126,245,254,120,84, > > 159,214,194,167,141,102,73,31,112,183,166,246,102, > > 66,48,241,174,52,201,190,31,63,109,171,247,83,147, > > 42,253,196,217,208,128,223,199,226,123,176,180,70, > > 228,147,208,5,23,182,3,94,114,39,21,150,31,129,137, > 92,132,177,71,128,126,44,184,106,224,119,159,219, > > 192,239,100,163,0,58,205,242,221,178,117,27,149,189, > > 12,240,147,217,61,4,234,76,231,132,117,189,32,209, > 115,85,22,18,239,192,240>>, > 0, > <<0,57>>, > undefined,false,undefined}, > 294932,ssl_session_cache, > {3,1}, > undefined,false,dhe_rsa, > {{1,2,840,113549,1,1,1}, > {'RSAPublicKey', > > 23985332548066223260322774259983152247797545948725977981875025710391659706585537937762959847062338790405599724727995315638420544358206480001280868527351317937548968876345931793589896941602423200065683725877315198229678655238870730302517002323138774678006366072941089637364098826231863208669397304033591358850613302169833622263116162988138227035449809879884230462587875848694948534737421208621472209080883099703159964364087058652885206739036200595109009813390823243309991477889022926642506234188064656504587631372428472973627488535282906583541347813283001630133822872906001289445314889618418076221729617745551234209087, > 65537}, > 'NULL'}, > {'RSAPrivateKey','two-prime', > > 24245061150388932126267388211561744501091175463407888595224551795663243174179988206545263128427895384819161106685261774299926886043886449727365149760320167454881950274766434421391227835510145242902399427836428837752665263535539327909106678269499287402480269087683223401095638029356908814821392014964348552872878386913883155024136808504734817452104655112897489194364101268365556518013584741158156036753091620252122206747573951286458946943600837100506515889843196447909183388855876119846269544345680287986326246932374547999824620904250547635320124126286130214850019238265403675412304909021441994637469225051132486193769, > 65537, > > 17328576366714496692349218475330937854580034940285470950591470934901841303717973474263189804212750777733407470562344122709047946491015536135000243830556128046052236642207219658092169355373769219262268513958316114396029626154205985299761446462633567621642404814626392226234352822575140238263100590093306842930006045435892856121601423729512197996242068235270905851036153226021734054606688010693704177209978560595698319274376708915898529303563327262255759966796798795075686111639483078123875727747288297150915376929152726694642421456339054268945476553274267673852919202129038846069271873486039976781207205533522013452901, > > 175370494815195674207106911731501626457371590465889564240336423322818657338712687959781189374639152154813531306121219213930531469102050716841885921299604376592875157055568786704961285756158968740499753148009889247438281864458144963953290691240618002674486253789360979786944138116053414853181637891019175023947, > > 138250514580221862655892174736393256109561741620998730071324163294133331805750724515526687394456291120722335476788733177943715853063937025485775099007036433458977246157028955416570452620946072552127788423550793775405053948011855722670612242672683268700825660765387097861823041722523099578698965460097679657627, > > 142026097972310688682979178892246827377686719495362230673056380430625800035239858799660442303559022228189923060312340067421103929903114940371087128780655231274599719790063153991676842131832299691331078598101421818164307921296069428060253852454141036512977896548882667244027756452807590319170371129342718366281, > > 65422024332459841410915727224312434986737847214429003703281753455925004490467174563987200454159832713230111084450752735822031215207773913535717886773963118709481076873642964956194202467818187406490060612777221529161190443408939706229819758029936161438862111743243512305853456718199015628335001843447355527747, > > 96692327788712893502227594737656137616777825297927354007039082535604854560178523094918225407406512660518516707411647582424617277816228673283401730456439499912365000393053010166088811818218189984574138829734660366829219694139224814835276610527380177578913321283217512483858915039007177988094558316513780160433, > asn1_NOVALUE}, > {'DHParameter', > > 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, > 2,asn1_NOVALUE}, > > {<<0,0,0,128,42,92,72,253,178,119,231,149,208,224,184,195, > > 2,12,214,157,94,48,216,139,94,54,195,90,237,248,61,35, > > 73,227,11,233,89,182,207,43,216,239,223,47,78,186,249, > > 223,191,42,199,139,246,10,26,246,64,161,131,210,59,8, > 207,143,77,241,200,231,165,114,131,173,49,12,174,86, > > 243,21,240,218,153,61,142,225,144,44,97,205,94,146,14, > > 123,173,160,147,174,179,19,134,160,75,147,215,243,34, > > 67,171,218,101,134,50,112,3,248,40,18,46,190,50,53,69, > 80,243,194,54,162,75,122,225,69,191,217>>, > > <<0,0,0,128,108,57,203,135,98,244,98,181,102,201,31,96, > 95,187,67,232,64,61,39,6,38,213,166,214,127,108,94, > > 230,39,199,145,16,194,86,68,250,69,141,221,241,87,166, > > 81,101,78,204,176,32,74,30,152,23,114,104,225,230,194, > 189,126,121,214,84,227,4,147,94,63,105,129,185,189, > > 175,250,36,16,110,165,122,184,49,73,89,226,148,192,79, > > 96,248,191,190,116,209,246,242,56,130,10,65,97,89,221, > 234,85,120,34,240,170,224,133,195,255,196,58,212,96, > > 233,34,160,182,220,123,171,219,109,43,188,240,120>>}, > undefined,#Ref<0.0.0.8310>, > {<0.1801.0>,#Ref<0.0.0.8318>}, > 0,<<>>,true, > {false,first}, > false, > {[],[]}, > false} > ** Reason for termination = > ** {decrypt_failed,[{crypto,rsa_public_decrypt, > > [<<86,79,97,119,56,220,212,141,121,171,170,45,99, > > 158,180,65,155,20,158,110,113,113,205,252,0,175, > > 202,212,69,250,27,118,17,89,131,102,246,150,72, > > 74,115,26,88,155,52,193,129,163,57,97,69,40,47, > > 216,77,120,59,73,214,173,46,24,203,163,109,116, > > 172,240,129,40,245,230,84,7,159,230,152,230,36, > > 205,202,234,29,112,180,231,160,46,98,96,88,177, > > 133,184,13,64,25,48,209,188,28,118,125,14,8,183, > > 220,40,146,11,129,37,29,242,175,117,238,84,105, > > 81,222,97,253,29,199,106,161,91,229,86,118,121, > 76,223,9,82,229,222,144,242,18,65,15,104,222, > 218,238,207,154,43,36,22,28,223,32,79,18,163, > > 141,43,34,33,141,55,126,216,34,213,0,88,132,249, > 70,199,94,9,22,201,100,153,222,54,196,13,138, > > 254,175,18,94,5,81,36,49,239,200,164,3,35,227, > > 215,180,129,206,9,231,115,68,246,85,247,189,90, > > 107,57,31,76,117,158,41,167,185,217,186,39,171, > > 4,182,91,66,171,123,32,129,175,90,243,217,41,18, > > 16,80,217,104,104,98,184,34,233,98,98,157,190, > 14,136,137,128>>, > [<<0,0,0,3,1,0,1>>, > > <<0,0,1,1,0,190,0,28,89,0,189,127,83,155,81,235, > > 193,186,105,224,229,114,20,147,7,203,135,145, > > 175,179,74,115,137,217,179,46,49,33,83,30,86, > > 32,155,97,177,70,12,87,5,33,124,3,131,208,19, > > 118,215,95,145,193,207,211,149,0,158,20,3,133, > > 178,174,238,7,147,205,225,11,50,58,113,4,187, > 200,107,194,118,228,153,119,142,202,212,232, > > 111,238,143,149,0,240,149,144,31,155,235,119, > > 242,167,31,204,20,13,173,83,39,18,200,244,150, > > 207,229,103,83,58,216,250,208,252,232,175,56, > 73,248,44,55,38,176,9,123,154,211,195,62,97, > > 197,194,234,18,186,40,237,125,123,63,242,164, > 23,146,164,198,225,0,94,178,101,232,183,87, > > 153,207,90,128,63,109,177,132,144,205,127,41, > 152,134,149,79,59,224,25,165,83,178,126,96, > > 220,209,53,165,13,126,95,193,235,94,92,31,201, > > 65,68,116,232,5,42,84,173,157,4,255,232,77,52, > 164,103,201,255,162,250,59,47,45,164,81,61, > > 234,176,62,195,186,173,243,27,172,129,174,40, > 187,164,7,169,184,96,68,31,244,150,24,140,5, > 247,39,14,70,200,149,63>>], > rsa_pkcs1_padding]}, > {ssl_handshake,certificate_verify,5}, > {ssl_connection,cipher,2}, > {ssl_connection,next_state,3}, > {ssl_connection,certify,2}, > {ssl_connection,next_state,3}, > {gen_fsm,handle_msg,7}, > {proc_lib,init_p_do_apply,3}]} > > I am attaching the Makefile which generates the certificates/keys using > OpenSSL: > > # Generation of license manager certificates. > $(LM_CERT_DIR)/Cooking-service-ca.crt: > openssl genrsa -out $(LM_CERT_DIR)/Cooking-service-ca.key 2048 > openssl req -subj '/C=CZ/O=Cooking Service Development/OU=Certificate > Authority/CN=Cooking-service-ca.com' -new -key > $(LM_CERT_DIR)/Cooking-service-ca.key \ > -out $(LM_CERT_DIR)/Cooking-service-ca.csr > openssl x509 -req -days 1825 -in $(LM_CERT_DIR)/Cooking-service-ca.csr > -signkey $(LM_CERT_DIR)/Cooking-service-ca.key -out > $(LM_CERT_DIR)/Cooking-service-ca.crt > > $(LM_CERT_DIR)/Manager-client.key: > openssl genrsa -out $(LM_CERT_DIR)/Manager-client.key 2048 > > # Erlang SSL_LM_CLIENTCERT_PATH = Manager-client.crt > $(LM_CERT_DIR)/Manager-client.crt: $(LM_CERT_DIR)/Manager-client.key > $(LM_CERT_DIR)/Cooking-service-ca.crt > openssl req -subj '/C=CZ/O=Soemsatu Cabu/OU=ICT/CN=ict.com' -new -key > $(LM_CERT_DIR)/Manager-client.key -out $(LM_CERT_DIR)/Manager-client.csr > openssl x509 -req -days 1825 -in $(LM_CERT_DIR)/Manager-client.csr -signkey > $(LM_CERT_DIR)/Manager-client.key -out $(LM_CERT_DIR)/Manager-client-tmp.crt > openssl x509 -days 1825 -in $(LM_CERT_DIR)/Manager-client-tmp.crt -signkey > $(LM_CERT_DIR)/Cooking-service-ca.key -out $(LM_CERT_DIR)/Manager-client.crt > rm -f Manager-client-tmp.crt > > ---------- P?vodn? zpr?va ---------- > Od: Ingela Andin > Datum: 21. 11. 2012 > P?edm?t: Re: [erlang-questions] ssl:peercert returns no_peercert on server, > but works on client > Hello! > > 2012/11/20, Jan.Evangelista@REDACTED : >> Hello. >> >> I am writing a client-server application which communicates over SSL. >> >> When the SSL connection is successfully established, the server attempts >> to >> retrieve the client certificate with ssl:peercert/1 - but on server the >> function always returns no_peercert error. The client gives PEM >> certificate >> and key paths when it requests connection upgrade to SSL: >> >> SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, >> ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], >> SslConnectResult = ssl:connect(Socket, SslOptions), >> ?assertMatch({ok, _}, SslConnectResult), >> .... >> >> In an attempt to find what is wrong, I tried to reverse the client and >> server roles - and the peer certificate can be retrieved successfully on >> client. In this case the connection is upgraded to SSL with exactly the >> same >> SslOptions on server. The peer certificate can be retrieved successfully >> on >> client: >> ... >> ?assertMatch({ok, _}, ssl:peercert(SslSocket)), >> >> and the server code contains basically >> >> SslOptions = [{cacertfile, ?SSL_CACERT_PATH}, {certfile, >> ?SSL_CERT_PATH}, {keyfile, ?SSL_KEY_PATH}], >> {ok, SslSocket} = ssl:ssl_accept(Socket, SslOptions, infinity), >> ... >> >> Is the failing ssl:peercert/1 on server a bug/missing implementation, or >> am >> I missing something? The Erlang distribution is R14B04. >> >> Thanks, Jan >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > Well we have a reported issue that is similar to what you describe, > but we have not been able to reproduce it yet. However in your case > it proably depends on that you have not > specified that the server should verify the client {verify, > verify_peer} , by default the server will > not request a client certificate. > > Regards Ingela Erlang/OTP team - Ericsson AB From ingela.andin@REDACTED Fri Nov 23 10:25:39 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 23 Nov 2012 10:25:39 +0100 Subject: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client In-Reply-To: References: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Message-ID: Hello again! I hit the send button by accident before I was finished ... [..] > Why do you not validate the certificate in the veryify_fun as part of > the path_validation? > And why do you specify a verify_fun that accepts all standard > certificates path errors > that is not very safe! > > fun(_,{bad_cert, _} = Reason, _) -> > {fail, Reason}; > (_,{extension, _}, UserState) -> > {unknown, UserState}; > (_, valid, UserState) -> > {valid, UserState}; > (PeerCert, valid_peer, UserState) -> %% Here you can do verifications of the peer cert > {valid, UserState} > end, []} Regards Ingela Erlang/OTP team - Ericsson AB From ward@REDACTED Fri Nov 23 10:42:17 2012 From: ward@REDACTED (Ward Bekker (TTY)) Date: Fri, 23 Nov 2012 10:42:17 +0100 Subject: [erlang-questions] Understanding binary heap garbage collection In-Reply-To: <1663121353661853@web27d.yandex.ru> References: <473E85B5-97D5-4ACA-B199-A3B83583BC8F@tty.nl> <1663121353661853@web27d.yandex.ru> Message-ID: Yes, this is the solution. Thx! On 23 nov. 2012, at 10:10, Slava Yurin wrote: > Hi, Ward. > > Because erlang shell save history for you. Garbage collect not affect to constructed binary. > > try: > spawn(fun() -> lists:foldl(fun(_I, Acc) -> <> end, <<"abc">>, lists:seq(0,21)) end). > > And you will see that no such big increase in binary heap. > > 23.11.2012, 15:57, "Ward Bekker (TTY)" : >> Hi, >> After an operation with binaries, and manual requesting a garbage collect, the binary heap does not shrink to it's former size. See my test sequence below. About 1.5 MB is added to the binary heap, and never garbage collected. What can be the cause? >> /W >> ========= >> Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] [dtrace] >> >> Eshell V5.9.2 (abort with ^G) >> 1> erlang:memory(). >> [{total,9654968}, >> {processes,1123090}, >> {processes_used,1123090}, >> {system,8531878}, >> {atom,194289}, >> {atom_used,176885}, >> {binary,1319320}, >> {code,3892513}, >> {ets,298400}] >> >> 2> lists:foldl(fun(_I, Acc) -> <> end, <<"abc">>, lists:seq(0,21)). >> <<"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab"?>> >> >> 3> erlang:memory(). >> [{total,22340920}, >> {processes,1127984}, >> {processes_used,1127970}, >> {system,21212936}, >> {atom,202481}, >> {atom_used,186083}, >> {binary,13901920}, >> {code,3972848}, >> {ets,302504}] >> >> 4> erlang:garbage_collect(). >> true >> >> 5> erlang:memory(). >> [{total,22314232}, >> {processes,1100552}, >> {processes_used,1100538}, >> {system,21213680}, >> {atom,202481}, >> {atom_used,186083}, >> {binary,13902664}, >> {code,3972848}, >> {ets,302504}] >> 6> >> , >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From paulperegud@REDACTED Fri Nov 23 12:32:08 2012 From: paulperegud@REDACTED (Paul Peregud) Date: Fri, 23 Nov 2012 12:32:08 +0100 Subject: [erlang-questions] PropEr and determinism of statem scenario execution Message-ID: Hi everyone! This is a PropEr-related question. I am developing a distributed algorithm for broadcasting messages, with very specific requirements (which are not really relevant to the problem, but prohibits use of e.g. Paxos in my case). Situation is following: I want to test a distributed algorithm. It's goal - synchronization of state consisting of sequence of broadcasted messages. Configuration is following - there are N actors, each actor implements publish/2 that adds new entry to cache and broadcasts. Actors are communicating, trying to achieve consistent state of cache among all of them. Actors are unreliable - they can be added and they may crash. My test case is a sequence of commands from following set: [actor_up, actor_down, publish]. My "system under test" is a process that starts actors, shuts them down and publishes new messages. It also collects reports that actors provide and provides that reports as a material for postcondition that checks cache consistency. The problem - I don't have a control over schedulers. That leads to scenarios that MAY OR MAY NOT fail. And that causes problems with shrinking. As a result after a night of crunching scenarios on a fast machine I get a test case of 70 steps that is impossible to debug, because it is too large. When I repeat this test case using proper:check/2, it fails very seldom. I've tried to tackle the problem in following way. I have introduced an execution token. An actor is waiting in selective receive for the token, when it gets it, it takes one message from it's queue and processes it. After that token is returned to proper tester process and can be passed to another actor. This approach is not good enough, because every generated scenario passes. I can think of one reason only - if actors A and B perform and they both send 2 messages (upon receiving the execution token) to actor C then actors C queue may look only like that: [A1, A2, B1, B2]. In real life scenario queue [A1, B1, A2, B2] is also possible. I understand that I can modify actors even more and introduce more fine-grained control over their actions - execution token will be returned after one single message sent. But this approach feels like an ugly hack. Is there a more general way to deal with this problem? Is it possible to achieve fine-grained concurrent simulation using Proper/Quickcheck? Any ideas are welcome! As far as I understand McErlang solves this problem in a more low level way, but I have never heard it used for practical problems. Did anyone used it to test non-academic systems? Any success stories here? How hard is it to use? Best regards, Paul Peregud +48602112091 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dm.klionsky@REDACTED Fri Nov 23 13:46:42 2012 From: dm.klionsky@REDACTED (Dmitry Klionsky) Date: Fri, 23 Nov 2012 15:46:42 +0300 Subject: [erlang-questions] Dot before call in EUNIT Message-ID: <50AF7032.2090403@gmail.com> Hi everybody! I was looking inside eunit.hrl and found a number of defines like this one: -define(assertMatch(Guard, Expr), ((fun () -> case (Expr) of Guard -> ok; __V -> .erlang:error({assertMatch_failed, [{module, ?MODULE}, {line, ?LINE}, {expression, (??Expr)}, {pattern, (??Guard)}, {value, __V}]}) end end)())). -endif. What is interesting for me is the DOT before the call. I've never seen it before. I've googled, but found nothing. Then I grepped: /opt/otp-r15b01/lib/erlang/lib $ grep -E ' \.[a-z]+:[a-z]+' ./*/*/*.{e,h}rl ./eunit-2.2.2/include/eunit.hrl: .erlang:process_info(.erlang:group_leader(), ./eunit-2.2.2/include/eunit.hrl: __V -> .erlang:error({assertion_failed, ./eunit-2.2.2/include/eunit.hrl: __V -> .erlang:error({assertMatch_failed, ./eunit-2.2.2/include/eunit.hrl: Guard -> .erlang:error({assertNotMatch_failed, ./eunit-2.2.2/include/eunit.hrl: __V -> .erlang:error({assertEqual_failed, ./eunit-2.2.2/include/eunit.hrl: __X -> .erlang:error({assertNotEqual_failed, ./eunit-2.2.2/include/eunit.hrl: __V -> .erlang:error({assertException_failed, ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertException_failed, ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace()}}]}) ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertNotException_failed, ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace() ./eunit-2.2.2/include/eunit.hrl: {__N, _} -> .erlang:error({command_failed, ./eunit-2.2.2/include/eunit.hrl: {__N, _} -> .erlang:error({assertCmd_failed, ./eunit-2.2.2/include/eunit.hrl: {_, __T} -> .erlang:error({assertCmdOutput_failed, ./eunit-2.2.2/include/eunit.hrl: .io:fwrite(user, <<"~s:~w:~w: ~s\n">>, So only EUNIT uses this notation. It seems like a historical artifact left from ancient times. My question is mainly to erlang veterans. What this DOT is/was about? Best regards, Dmitry Klionsky From Jan.Evangelista@REDACTED Fri Nov 23 14:06:41 2012 From: Jan.Evangelista@REDACTED (Jan.Evangelista@REDACTED) Date: Fri, 23 Nov 2012 14:06:41 +0100 (CET) Subject: [erlang-questions] =?utf-8?q?ssl=3Apeercert_returns_no=5Fpeercert?= =?utf-8?q?_on_server=2C_but_works_on_client?= References: <1H}5.2jUMw.6HPcWqo0vWp.1GgzfE@seznam.cz> Message-ID: <3Qy.2jULQ.4uhNVG4j1Hu.1GhtJX@seznam.cz> ---------- P?vodn? zpr?va ---------- > Od: Ingela Andin > Datum: 23. 11. 2012 > P?edm?t: Re: Re: [erlang-questions] ssl:peercert returns no_peercert on server, but works on client > Hi! > > 2012/11/22, Jan.Evangelista@REDACTED : > ... > Why do you not validate the certificate in the veryify_fun as part of > the path_validation? I need a client certificate validation only when the client needs to enter a privileged role. The client issues a specific command which enables a privileged extension of the protocol on server. Non-privileged clients may connect with any certificate (no validation is required) or without a any certificate. When I do certificate validation in the verify_fun, I have no way to tell the server which role it is permitted to enter. > And why do you specify a verify_fun that accepts all stadnard > certificates path errors > that is not very safe! Ah, do you mean that the connection would be established even if CertificateVerify.signature does not match? That would be my big mistake! What if the verify_fun allowed only {bad_cert, selfsigned_peer}? fun (_,{bad_cert, selfsigned_peer}, UserState) -> {valid, UserState}; (_,{bad_cert, _} = Reason, _) -> {fail, Reason}; (_,{extension, _}, UserState) -> {unknown, UserState}; (_, valid, UserState) -> {valid, UserState}; (_, valid_peer, UserState) -> {valid, UserState} end. Jan From carlsson.richard@REDACTED Fri Nov 23 14:39:57 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 23 Nov 2012 14:39:57 +0100 Subject: [erlang-questions] Dot before call in EUNIT In-Reply-To: <50AF7032.2090403@gmail.com> References: <50AF7032.2090403@gmail.com> Message-ID: <50AF7CAD.2050601@gmail.com> Hi! This artefact is just so that the eunit header file will work also in modules that use "packages" (experimental, now deprecated, so eunit.hrl can be updated when packages support is removed from OTP). /Richard On 2012-11-23 13:46, Dmitry Klionsky wrote: > Hi everybody! > > I was looking inside eunit.hrl and found a number of defines like this one: > > -define(assertMatch(Guard, Expr), > ((fun () -> > case (Expr) of > Guard -> ok; > __V -> .erlang:error({assertMatch_failed, > [{module, ?MODULE}, > {line, ?LINE}, > {expression, (??Expr)}, > {pattern, (??Guard)}, > {value, __V}]}) > end > end)())). > -endif. > > What is interesting for me is the DOT before the call. I've never seen > it before. I've googled, but found nothing. > > Then I grepped: > /opt/otp-r15b01/lib/erlang/lib $ grep -E ' \.[a-z]+:[a-z]+' ./*/*/*.{e,h}rl > > ./eunit-2.2.2/include/eunit.hrl: > .erlang:process_info(.erlang:group_leader(), > ./eunit-2.2.2/include/eunit.hrl: __V -> > .erlang:error({assertion_failed, > ./eunit-2.2.2/include/eunit.hrl: __V -> > .erlang:error({assertMatch_failed, > ./eunit-2.2.2/include/eunit.hrl: Guard -> > .erlang:error({assertNotMatch_failed, > ./eunit-2.2.2/include/eunit.hrl: __V -> > .erlang:error({assertEqual_failed, > ./eunit-2.2.2/include/eunit.hrl: __X -> > .erlang:error({assertNotEqual_failed, > ./eunit-2.2.2/include/eunit.hrl: __V -> > .erlang:error({assertException_failed, > ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertException_failed, > ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace()}}]}) > ./eunit-2.2.2/include/eunit.hrl: .erlang:error({assertNotException_failed, > ./eunit-2.2.2/include/eunit.hrl: .erlang:get_stacktrace() > ./eunit-2.2.2/include/eunit.hrl: {__N, _} -> > .erlang:error({command_failed, > ./eunit-2.2.2/include/eunit.hrl: {__N, _} -> > .erlang:error({assertCmd_failed, > ./eunit-2.2.2/include/eunit.hrl: {_, __T} -> > .erlang:error({assertCmdOutput_failed, > ./eunit-2.2.2/include/eunit.hrl: .io:fwrite(user, <<"~s:~w:~w: > ~s\n">>, > > So only EUNIT uses this notation. It seems like a historical artifact > left from ancient times. > My question is mainly to erlang veterans. What this DOT is/was about? > > Best regards, > Dmitry Klionsky > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From eriksoe@REDACTED Fri Nov 23 17:22:05 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Fri, 23 Nov 2012 17:22:05 +0100 Subject: [erlang-questions] PropEr and determinism of statem scenario execution In-Reply-To: References: Message-ID: Don't know if it's usable with Proper, but Quviq has a tool called "PULSE" for that kind of test. Afaik it does something like the token thing, except that it's for each message sent. It's somewhat ungoogleable, but Basho uses it. Den 23/11/2012 12.32 skrev "Paul Peregud" : > Hi everyone! > > This is a PropEr-related question. I am developing a distributed algorithm > for broadcasting messages, with very specific requirements (which are not > really relevant to the problem, but prohibits use of e.g. Paxos in my case). > > Situation is following: I want to test a distributed algorithm. It's goal > - synchronization of state consisting of sequence of broadcasted messages. > Configuration is following - there are N actors, each actor implements > publish/2 that adds new entry to cache and broadcasts. Actors are > communicating, trying to achieve consistent state of cache among all of > them. Actors are unreliable - they can be added and they may crash. > > My test case is a sequence of commands from following set: [actor_up, > actor_down, publish]. My "system under test" is a process that starts > actors, shuts them down and publishes new messages. It also collects > reports that actors provide and provides that reports as a material for > postcondition that checks cache consistency. > > The problem - I don't have a control over schedulers. That leads to > scenarios that MAY OR MAY NOT fail. And that causes problems with > shrinking. As a result after a night of crunching scenarios on a fast > machine I get a test case of 70 steps that is impossible to debug, because > it is too large. When I repeat this test case using proper:check/2, it > fails very seldom. > > I've tried to tackle the problem in following way. > I have introduced an execution token. An actor is waiting in selective > receive for the token, when it gets it, it takes one message from it's > queue and processes it. After that token is returned to proper tester > process and can be passed to another actor. > > This approach is not good enough, because every generated scenario passes. > I can think of one reason only - if actors A and B perform and they both > send 2 messages (upon receiving the execution token) to actor C then actors > C queue may look only like that: [A1, A2, B1, B2]. In real life scenario > queue [A1, B1, A2, B2] is also possible. > > I understand that I can modify actors even more and introduce more > fine-grained control over their actions - execution token will be returned > after one single message sent. But this approach feels like an ugly hack. > Is there a more general way to deal with this problem? Is it possible to > achieve fine-grained concurrent simulation using Proper/Quickcheck? > > Any ideas are welcome! > > As far as I understand McErlang solves this problem in a more low level > way, but I have never heard it used for practical problems. Did anyone used > it to test non-academic systems? Any success stories here? How hard is it > to use? > > Best regards, > Paul Peregud > +48602112091 > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus@REDACTED Fri Nov 23 17:48:29 2012 From: magnus@REDACTED (Magnus Henoch) Date: Fri, 23 Nov 2012 16:48:29 +0000 Subject: [erlang-questions] PropEr and determinism of statem scenario execution In-Reply-To: (Paul Peregud's message of "Fri, 23 Nov 2012 12:32:08 +0100") References: Message-ID: Paul Peregud writes: > The problem - I don't have a control over schedulers. That leads to > scenarios that MAY OR MAY NOT fail. And that causes problems with > shrinking. As a result after a night of crunching scenarios on a fast > machine I get a test case of 70 steps that is impossible to debug, because > it is too large. When I repeat this test case using proper:check/2, it > fails very seldom. Have a look at this presentation: http://www.erlang-factory.com/conference/London2010/speakers/JohnHughes Solutions 1 and 2 should be usable with PropEr (require failing test cases to fail consistently, and shrink commands to sleeps), though solution 3 would be specific to Quviq Quickcheck. Regards, Magnus From brisa.jimenez.f@REDACTED Sat Nov 24 00:47:05 2012 From: brisa.jimenez.f@REDACTED (=?ISO-8859-1?Q?Brisa_Jim=E9nez?=) Date: Fri, 23 Nov 2012 17:47:05 -0600 Subject: [erlang-questions] driver_entry struct Message-ID: Could anybody explain me what is the meaning of a dot in a driver_entry struct? Example: .extended_marker = ERL_DRV_EXTENDED_MARKER Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Nov 24 01:09:44 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 24 Nov 2012 03:09:44 +0300 Subject: [erlang-questions] Why does having SNDBUF too low break HTTP? In-Reply-To: References: Message-ID: Nobody have replied to you yet. It is a very strange issue. Show your full reply headers. Do you have Content-Length in them? On Wednesday, November 21, 2012, Alec Mocatta wrote: > I've got a simple http server running, with gen_tcp options as follows: > > [ > binary, > {active, false}, > {packet, http_bin}, > {reuseaddr, true}, > {keepalive, true}, > {delay_send, false}, > {nodelay, true} > ] > > With one response in particular that sends a single 300000 byte http chunk > with a single gen_tcp:send call, I'm seeing some clients failing to receive > it, or only receiving the first 150000 - 250000 bytes. > > Firefox, Chrome and Cocoa's NSURLConnection all have problems while > receiving the response, with Firefox and NSURLConnection truncating the > response, and Chrome not accepting it at all and giving an error. Curl and > wget however receive the response fine. > > tcpick -C -yP "tcp port 80" shows the connection being closed before all > the data's sent, printing the data truncated at the same place as Firefox, > followed by: > 1 FIN-WAIT-2 x.108.161.x:65438 > 10.144.11.241:http > 1 TIME-WAIT x.108.161.x:65438 > 10.144.11.241:http > 1 CLOSED x.108.161.x:65438 > 10.144.11.241:http > > Setting sndbuf to 512000 however seems to solve the problem, at least for > the 300000 byte chunk size I'm sending. > > Why would sndbuf affect the validity of the TCP/HTTP stream? Someone > suggested this looks like the return value of write(2) isn't being checked, > or EAGAIN isn't being dealt with correctly? gen_tcp:send is returning ok, > however. > > Erlang version: Erlang R15B02 (erts-5.9.2) [source] [64-bit] > [async-threads:0] [hipe] [kernel-poll:true] > > Any ideas what could be causing this? > > Thanks, > > Alec -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Sat Nov 24 01:17:20 2012 From: freza@REDACTED (Jachym Holecek) Date: Fri, 23 Nov 2012 19:17:20 -0500 Subject: [erlang-questions] driver_entry struct In-Reply-To: References: Message-ID: <20121124001720.GA27754@circlewave.net> # Brisa Jim?nez 2012-11-23: > Could anybody explain me what is the meaning of a dot in a driver_entry > struct? > > Example: > > .extended_marker = ERL_DRV_EXTENDED_MARKER C99 designated initializers. Just a nicer way to initialize struct instance. BR, -- Jachym From dmkolesnikov@REDACTED Sat Nov 24 09:52:04 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 24 Nov 2012 10:52:04 +0200 Subject: [erlang-questions] Why does having SNDBUF too low break HTTP? In-Reply-To: References: Message-ID: <71B7B7E2-65D8-44ED-A00D-E27047C73DE7@gmail.com> Hello, Could you please share HTTP headers for request and response? - Dmitry On Nov 24, 2012, at 2:09 AM, Max Lapshin wrote: > Nobody have replied to you yet. > > It is a very strange issue. Show your full reply headers. Do you have Content-Length in them? > > On Wednesday, November 21, 2012, Alec Mocatta wrote: > I've got a simple http server running, with gen_tcp options as follows: > > [ > binary, > {active, false}, > {packet, http_bin}, > {reuseaddr, true}, > {keepalive, true}, > {delay_send, false}, > {nodelay, true} > ] > > With one response in particular that sends a single 300000 byte http chunk with a single gen_tcp:send call, I'm seeing some clients failing to receive it, or only receiving the first 150000 - 250000 bytes. > > Firefox, Chrome and Cocoa's NSURLConnection all have problems while receiving the response, with Firefox and NSURLConnection truncating the response, and Chrome not accepting it at all and giving an error. Curl and wget however receive the response fine. > > tcpick -C -yP "tcp port 80" shows the connection being closed before all the data's sent, printing the data truncated at the same place as Firefox, followed by: > 1 FIN-WAIT-2 x.108.161.x:65438 > 10.144.11.241:http > 1 TIME-WAIT x.108.161.x:65438 > 10.144.11.241:http > 1 CLOSED x.108.161.x:65438 > 10.144.11.241:http > > Setting sndbuf to 512000 however seems to solve the problem, at least for the 300000 byte chunk size I'm sending. > > Why would sndbuf affect the validity of the TCP/HTTP stream? Someone suggested this looks like the return value of write(2) isn't being checked, or EAGAIN isn't being dealt with correctly? gen_tcp:send is returning ok, however. > > Erlang version: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:true] > > Any ideas what could be causing this? > > Thanks, > > Alec > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From tajgur@REDACTED Sat Nov 24 17:53:13 2012 From: tajgur@REDACTED (tgrk) Date: Sat, 24 Nov 2012 17:53:13 +0100 Subject: [erlang-questions] Cowboy long-lived HTTP handler Message-ID: Hello, has anyone played with Cowboy loop_handler behaviour? I am trying to handle JSON-RPC using long-lived HTTP connection. Problem is that I unable to do any reply from init/3 without crash. There is a test for cowboy_loop_handler but it does only timeout check, no response. Regards, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From alec@REDACTED Sat Nov 24 19:47:23 2012 From: alec@REDACTED (Alec Mocatta) Date: Sat, 24 Nov 2012 18:47:23 +0000 Subject: [erlang-questions] Why does having SNDBUF too low break HTTP? In-Reply-To: <71B7B7E2-65D8-44ED-A00D-E27047C73DE7@gmail.com> References: <71B7B7E2-65D8-44ED-A00D-E27047C73DE7@gmail.com> Message-ID: Headers as reported by tcpick, with address, host, referrer and cookie asterisked: 1 SYN-SENT x.108.161.x:62793 > 10.144.11.241:http 1 SYN-RECEIVED x.108.161.x:62793 > 10.144.11.241:http 1 ESTABLISHED x.108.161.x:62793 > 10.144.11.241:http GET /1/****** HTTP/1.1 Host: ****.*******.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20100101 Firefox/16.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Referer: http://****.*******.com/******* Cookie: ****** HTTP/1.1 200 OK Transfer-Encoding: chunked Date: Sat, 24 Nov 2012 18:45:49 GMT 5d4dd jsonpCallback([... Thanks, Alec On Sat, Nov 24, 2012 at 8:52 AM, Dmitry Kolesnikov wrote: > Hello, > > Could you please share HTTP headers for request and response? > > - Dmitry > > On Nov 24, 2012, at 2:09 AM, Max Lapshin wrote: > > Nobody have replied to you yet. > > It is a very strange issue. Show your full reply headers. Do you have > Content-Length in them? > > On Wednesday, November 21, 2012, Alec Mocatta wrote: > >> I've got a simple http server running, with gen_tcp options as follows: >> >> [ >> binary, >> {active, false}, >> {packet, http_bin}, >> {reuseaddr, true}, >> {keepalive, true}, >> {delay_send, false}, >> {nodelay, true} >> ] >> >> With one response in particular that sends a single 300000 byte http >> chunk with a single gen_tcp:send call, I'm seeing some clients failing to >> receive it, or only receiving the first 150000 - 250000 bytes. >> >> Firefox, Chrome and Cocoa's NSURLConnection all have problems while >> receiving the response, with Firefox and NSURLConnection truncating the >> response, and Chrome not accepting it at all and giving an error. Curl and >> wget however receive the response fine. >> >> tcpick -C -yP "tcp port 80" shows the connection being closed before all >> the data's sent, printing the data truncated at the same place as Firefox, >> followed by: >> 1 FIN-WAIT-2 x.108.161.x:65438 > 10.144.11.241:http >> 1 TIME-WAIT x.108.161.x:65438 > 10.144.11.241:http >> 1 CLOSED x.108.161.x:65438 > 10.144.11.241:http >> >> Setting sndbuf to 512000 however seems to solve the problem, at least for >> the 300000 byte chunk size I'm sending. >> >> Why would sndbuf affect the validity of the TCP/HTTP stream? Someone >> suggested this looks like the return value of write(2) isn't being checked, >> or EAGAIN isn't being dealt with correctly? gen_tcp:send is returning ok, >> however. >> >> Erlang version: Erlang R15B02 (erts-5.9.2) [source] [64-bit] >> [async-threads:0] [hipe] [kernel-poll:true] >> >> Any ideas what could be causing this? >> >> Thanks, >> >> Alec > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sat Nov 24 19:50:39 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 24 Nov 2012 19:50:39 +0100 Subject: [erlang-questions] Cowboy long-lived HTTP handler In-Reply-To: References: Message-ID: <50B116FF.1020508@ninenines.eu> Please post the crash message. On 11/24/2012 05:53 PM, tgrk wrote: > Hello, > > has anyone played with Cowboy loop_handler behaviour? I am trying to > handle JSON-RPC using long-lived HTTP connection. Problem is that I > unable to do any reply from init/3 without crash. There is a test for > cowboy_loop_handler but it does only timeout check, no response. > > Regards, > Martin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From tajgur@REDACTED Sun Nov 25 12:14:09 2012 From: tajgur@REDACTED (tgrk) Date: Sun, 25 Nov 2012 12:14:09 +0100 Subject: [erlang-questions] Cowboy long-lived HTTP handler In-Reply-To: <50B116FF.1020508@ninenines.eu> References: <50B116FF.1020508@ninenines.eu> Message-ID: Because I do not have any problems using cowboy_http_handler, I assume that my implementation of cowboy_loop_handler is not correct. Here is what I am trying to do in init/3 and info/3: ---------------------------------------------------------------------------------------- ... init({_Transport, http}, Req, Opts) -> io:format("handler:init ~p, ~p~n", [Req, Opts]), % erlang:send_after(1000, self(), error_timeout), {ok, Req3} = cowboy_req:reply(200, Req), {loop, Req3, undefined, 5000, hibernate}. info(error_timeout, Req, State) -> io:format("handler:info: error_timeout ~p, ~p~n", [Req, State]), {ok, Req2} = cowboy_req:reply(500, Req), {ok, Req2, State}; info(Any, Req, State) -> io:format("handler:info: any=~p, ~p, ~p~n", [Any, Req, State]), {ok, Req2} = cowboy_req:reply(200, Req), {loop, Req2, State, hibernate}. ... Error message with stacktrace: ---------------------------------------------------------------------------------------- =ERROR REPORT==== 25-Nov-2012::12:02:07 === ** Handler test_handler terminating in info/3 for the reason error:function_clause ** Handler state was undefined ** Request was [{socket,#Port<0.58013>}, {transport,ranch_tcp}, {connection,keepalive}, {pid,<0.402.0>}, {method,<<"POST">>}, {version,{1,1}}, {peer,undefined}, {host,<<"127.0.0.1">>}, {host_info,undefined}, {port,8080}, {path,<<"/rpc/checkout/">>}, {path_info,undefined}, {qs,<<>>}, {qs_vals,undefined}, {fragment,<<>>}, {bindings,[]}, {headers,[{<<"content-type">>,<<"application/json">>}, {<<"content-length">>,<<"71">>}, {<<"te">>,<<>>}, {<<"host">>,<<"127.0.0.1:8080">>}, {<<"connection">>,<<"keep-alive">>}]}, {p_headers,[{<<"connection">>,[<<"keep-alive">>]}]}, {cookies,undefined}, {meta,[]}, {body_state,waiting}, {multipart,undefined}, {buffer,<<"{\"jsonrpc\":\"2.0\",\"method\":\"foo\",\"params\":{\"param1\":\"val1\"},\"id\":0}">>}, {resp_state,done}, {resp_headers,[]}, {resp_body,<<>>}, {onresponse,undefined}] ** Stacktrace: [{cowboy_req,reply, [200, [{<<"Content-Type">>,<<"application/json">>}], <<"{message: \"hello world\"}">>, {http_req,#Port<0.57251>,ranch_tcp,keepalive,<0.401.0>, <<"POST">>, {1,1}, undefined,<<"127.0.0.1">>,undefined,8080, <<"/rpc/checkout/">>,undefined,<<>>,undefined,<<>>, [], [{<<"content-type">>,<<"application/json">>}, {<<"content-length">>,<<"71">>}, {<<"te">>,<<>>}, {<<"host">>,<<"127.0.0.1:8080">>}, {<<"connection">>,<<"keep-alive">>}], [{<<"connection">>,[<<"keep-alive">>]}], undefined,[],waiting,undefined, <<"{\"jsonrpc\":\"2.0\",\"method\":\"foo\",\"params\":{\"param1\":\"val1\"},\"id\":0}">>, done,[],<<>>,undefined}], [{file,"src/cowboy_req.erl"},{line,873}]}, {test_handler,info,3, [{file,"src/test_handler.erl"},{line,49}]}, {cowboy_protocol,handler_call,5, [{file,"src/cowboy_protocol.erl"},{line,569}]}] test/test_handler_test.erl:49:<0.396.0>: Resp = {ok,{{"HTTP/1.1",200,"OK"}, [{"connection","keep-alive"}, {"date","Sun, 25 Nov 2012 11:02:07 GMT"}, {"server","Cowboy"}, {"content-length","0"}], []}} =ERROR REPORT==== 25-Nov-2012::12:02:07 === Received unexpected tcp data on #Port<0.58012> Data: <<"HTTP/1.1 500 Internal Server Error\r\nconnection: close\r\nserver: Cowboy\r\ndate: Sun, 25 Nov 2012 11:02:07 GMT\r\ncontent-length: 0\r\n\r\n">> MFA: undefined Request: undefined Session: {session,{{"127.0.0.1",8080},<0.399.0>}, false,http,#Port<0.58012>,ip_comm,1,keep_alive,true} Status: keep_alive StatusLine: undefined Profile: httpc_manager Regards, Martin On Sat, Nov 24, 2012 at 7:50 PM, Lo?c Hoguin wrote: > Please post the crash message. > > > On 11/24/2012 05:53 PM, tgrk wrote: > >> Hello, >> >> has anyone played with Cowboy loop_handler behaviour? I am trying to >> handle JSON-RPC using long-lived HTTP connection. Problem is that I >> unable to do any reply from init/3 without crash. There is a test for >> cowboy_loop_handler but it does only timeout check, no response. >> >> Regards, >> Martin >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sun Nov 25 13:45:13 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Sun, 25 Nov 2012 13:45:13 +0100 Subject: [erlang-questions] Cowboy long-lived HTTP handler In-Reply-To: References: <50B116FF.1020508@ninenines.eu> Message-ID: <50B212D9.3020904@ninenines.eu> HTTP is a request/response protocol, you can reply more than once to the same request. You can either send nothing until you receive some message, reply and stop looping; OR initiate streaming in init/3 and then stream data in info/3. On 11/25/2012 12:14 PM, tgrk wrote: > Because I do not have any problems using cowboy_http_handler, I assume > that my implementation of cowboy_loop_handler is not correct. > > Here is what I am trying to do in init/3 and info/3: > ---------------------------------------------------------------------------------------- > ... > init({_Transport, http}, Req, Opts) -> > io:format("handler:init ~p, ~p~n", [Req, Opts]), > % erlang:send_after(1000, self(), error_timeout), > {ok, Req3} = cowboy_req:reply(200, Req), > {loop, Req3, undefined, 5000, hibernate}. > > info(error_timeout, Req, State) -> > io:format("handler:info: error_timeout ~p, ~p~n", [Req, State]), > {ok, Req2} = cowboy_req:reply(500, Req), > {ok, Req2, State}; > info(Any, Req, State) -> > io:format("handler:info: any=~p, ~p, ~p~n", [Any, Req, State]), > {ok, Req2} = cowboy_req:reply(200, Req), > {loop, Req2, State, hibernate}. > ... > > Error message with stacktrace: > ---------------------------------------------------------------------------------------- > =ERROR REPORT==== 25-Nov-2012::12:02:07 === > ** Handler test_handler terminating in info/3 > for the reason error:function_clause > ** Handler state was undefined > ** Request was [{socket,#Port<0.58013>}, > {transport,ranch_tcp}, > {connection,keepalive}, > {pid,<0.402.0>}, > {method,<<"POST">>}, > {version,{1,1}}, > {peer,undefined}, > {host,<<"127.0.0.1">>}, > {host_info,undefined}, > {port,8080}, > {path,<<"/rpc/checkout/">>}, > {path_info,undefined}, > {qs,<<>>}, > {qs_vals,undefined}, > {fragment,<<>>}, > {bindings,[]}, > {headers,[{<<"content-type">>,<<"application/json">>}, > {<<"content-length">>,<<"71">>}, > {<<"te">>,<<>>}, > {<<"host">>,<<"127.0.0.1:8080 > ">>}, > {<<"connection">>,<<"keep-alive">>}]}, > {p_headers,[{<<"connection">>,[<<"keep-alive">>]}]}, > {cookies,undefined}, > {meta,[]}, > {body_state,waiting}, > {multipart,undefined}, > > {buffer,<<"{\"jsonrpc\":\"2.0\",\"method\":\"foo\",\"params\":{\"param1\":\"val1\"},\"id\":0}">>}, > {resp_state,done}, > {resp_headers,[]}, > {resp_body,<<>>}, > {onresponse,undefined}] > ** Stacktrace: [{cowboy_req,reply, > [200, > [{<<"Content-Type">>,<<"application/json">>}], > <<"{message: \"hello world\"}">>, > > {http_req,#Port<0.57251>,ranch_tcp,keepalive,<0.401.0>, > <<"POST">>, > {1,1}, > undefined,<<"127.0.0.1">>,undefined,8080, > > <<"/rpc/checkout/">>,undefined,<<>>,undefined,<<>>, > [], > [{<<"content-type">>,<<"application/json">>}, > {<<"content-length">>,<<"71">>}, > {<<"te">>,<<>>}, > {<<"host">>,<<"127.0.0.1:8080 > ">>}, > {<<"connection">>,<<"keep-alive">>}], > [{<<"connection">>,[<<"keep-alive">>]}], > undefined,[],waiting,undefined, > > <<"{\"jsonrpc\":\"2.0\",\"method\":\"foo\",\"params\":{\"param1\":\"val1\"},\"id\":0}">>, > done,[],<<>>,undefined}], > [{file,"src/cowboy_req.erl"},{line,873}]}, > {test_handler,info,3, > [{file,"src/test_handler.erl"},{line,49}]}, > {cowboy_protocol,handler_call,5, > [{file,"src/cowboy_protocol.erl"},{line,569}]}] > > test/test_handler_test.erl:49:<0.396.0>: Resp = {ok,{{"HTTP/1.1",200,"OK"}, > [{"connection","keep-alive"}, > {"date","Sun, 25 Nov 2012 11:02:07 GMT"}, > {"server","Cowboy"}, > {"content-length","0"}], > []}} > > =ERROR REPORT==== 25-Nov-2012::12:02:07 === > Received unexpected tcp data on #Port<0.58012> > Data: <<"HTTP/1.1 500 Internal Server Error\r\nconnection: > close\r\nserver: Cowboy\r\ndate: Sun, 25 Nov 2012 11:02:07 > GMT\r\ncontent-length: 0\r\n\r\n">> > MFA: undefined > Request: undefined > Session: {session,{{"127.0.0.1",8080},<0.399.0>}, > > false,http,#Port<0.58012>,ip_comm,1,keep_alive,true} > Status: keep_alive > StatusLine: undefined > Profile: httpc_manager > > > Regards, > Martin > > > On Sat, Nov 24, 2012 at 7:50 PM, Lo?c Hoguin > wrote: > > Please post the crash message. > > > On 11/24/2012 05:53 PM, tgrk wrote: > > Hello, > > has anyone played with Cowboy loop_handler behaviour? I am > trying to > handle JSON-RPC using long-lived HTTP connection. Problem is that I > unable to do any reply from init/3 without crash. There is a > test for > cowboy_loop_handler but it does only timeout check, no response. > > Regards, > Martin > > > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/__listinfo/erlang-questions > > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > http://ninenines.eu > > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From for-friends@REDACTED Sun Nov 25 14:26:10 2012 From: for-friends@REDACTED (=?utf-8?B?0JrQvtC90YHRgtCw0L3RgtC40L0=?=) Date: Sun, 25 Nov 2012 17:26:10 +0400 Subject: [erlang-questions] Novice core review request Message-ID: <801240B09CEE46FCBC3BC69C47D1F635@bravo> Hello, I?m Erlang novice and would be glad if someone could review my first application. I?d like to hear common advices about interprocesses communication and code style. I started a thread on Stackoverflow http://codereview.stackexchange.com/questions/18998/erlang-novice-erlang-otp-common-advices . To not duplicate there are more details can be found there. The code itself is here: https://bitbucket.org/ktyurin/erlarena Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Sun Nov 25 17:05:38 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Sun, 25 Nov 2012 16:05:38 +0000 Subject: [erlang-questions] Novice core review request In-Reply-To: <801240B09CEE46FCBC3BC69C47D1F635@bravo> References: <801240B09CEE46FCBC3BC69C47D1F635@bravo> Message-ID: On Sun, Nov 25, 2012 at 1:26 PM, ?????????? wrote: > Hello, > > I?m Erlang novice and would be glad if someone could review my first > application. I?d like to hear common advices about interprocesses > communication and code style. I started a thread on Stackoverflow > http://codereview.stackexchange.com/questions/18998/erlang-novice-erlang-otp-common-advices > . To not duplicate there are more details can be found there. > > The code itself is here: https://bitbucket.org/ktyurin/erlarena First of all your application needs a README. Purpose of the program, briefly what it does and how it works. Then it needs -spec for publicly exported functions, i.e. at least the ones that you are expecting to be used by external callers (if any). Ideally, for all exported functions. Once you have these, run dialyzer (it's simple and it's worth it!), and you will (probably) be overwhelmed by the number of bugs it will find for you. :) A hint for type specs: arena_map.erl: -type map() :: [{something_i_did_not_immediatly_recognize}]. -export_type([map/0]). -record(state, { % Internal room state name :: string(), % Room name. Log file will have the same name ++ ".txt" map :: arena:map(), % Reference to room map, process which stores information about creature locations moves_performed :: non_neg_integer() = 0, % Number of moves performed from start creatures = [arena_creature:creature()] % List of creatures currently located in the room }). Note: my map() type is obviously wrong. But you get the idea. A small notice about arena_map:create_string/1. Instead of folding and appending to the end of the list, you could use an iolist - very convenient Erlang feature for IO data construction. This blog post[1] looks like a good introduction (didn't read it fully). You should also decide which of the types must be public, private, and opaque. In most cases you do not want to allow external applications mangle with your type internals. Once you make a decision, put appropriate type specifications and commentary in source files. Public types are normally exported in .erl, and well documented. Private types are exported only when they have to be referenced from other modules, but they are "small enough" so you do not want to make accessors for them. Read about -opaque in [2] and use it. :) [1]: http://dev.af83.com/2012/01/16/erlang-iolist.html [2]: http://www.erlang.org/doc/reference_manual/typespec.html A side note: when somebody is going to make another poll for erlangers, please include a question which asks about line length restrictions. P.S. Konstantin, there are some people allergic to lines with many characters (like me). If you want *everyone* be happy reading your code, stick to some safe neat and cozy value. Regards, Motiejus Jak?tys From chandrashekhar.mullaparthi@REDACTED Mon Nov 26 01:02:23 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 26 Nov 2012 00:02:23 +0000 Subject: [erlang-questions] Performance tuning an erlang system Message-ID: Hi, I've recently worked on improving the performance of an erlang system we've developed which I've written up here --> http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ Hopefully it will be of some use to someone. cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Nov 26 05:11:41 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 26 Nov 2012 07:11:41 +0300 Subject: [erlang-questions] Performance tuning an erlang system In-Reply-To: References: Message-ID: Chandru, have I understood properly: you are working at Orange and you are migrating your own charging subsystem from external many-mega-bucks system to your own solution? On Monday, November 26, 2012, Chandru wrote: > Hi, > > I've recently worked on improving the performance of an erlang system > we've developed which I've written up here --> > http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ > > Hopefully it will be of some use to someone. > > cheers > Chandru > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Mon Nov 26 08:27:24 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 26 Nov 2012 07:27:24 +0000 Subject: [erlang-questions] Performance tuning an erlang system In-Reply-To: References: Message-ID: Max, I work for EE which owns the Orange, T-Mobile and EE brands in the UK. And yes, we are migrating an online charging mediator to an in-house solution. cheers Chandru On 26 November 2012 04:11, Max Lapshin wrote: > Chandru, have I understood properly: you are working at Orange and you are > migrating your own charging subsystem from external many-mega-bucks system > to your own solution? > > > On Monday, November 26, 2012, Chandru wrote: > >> Hi, >> >> I've recently worked on improving the performance of an erlang system >> we've developed which I've written up here --> >> http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ >> >> Hopefully it will be of some use to someone. >> >> cheers >> Chandru >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Mon Nov 26 09:09:03 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Mon, 26 Nov 2012 10:09:03 +0200 Subject: [erlang-questions] Funs Message-ID: Morning Erlang Developers, I would like to ask about: when do we use funs or anonymous functions in Erlang?, I know what it is, but I can't really figure out when to use it and I saw an example of it being used with Mnesia transactions. May someone help in this regard please. Kindest Regards Lucky Khoza -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Mon Nov 26 09:18:09 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 26 Nov 2012 09:18:09 +0100 Subject: [erlang-questions] Funs In-Reply-To: References: Message-ID: <1353917889.6103.5.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Here are two reasons to use anonymous functions. 1) You do not want to create a real function. 2) You want to capture some variables into a function. Erlang shell ex: Variable = 42. Add_variable = fun (N) -> N + Variable end. Add_variable( 2 ). bengt On Mon, 2012-11-26 at 10:09 +0200, Lucky Khoza wrote: > Morning Erlang Developers, > > I would like to ask about: when do we use funs or anonymous functions > in Erlang?, I know what it is, but I can't really figure out when to > use it and I saw an example of it being used with Mnesia > transactions. > > May someone help in this regard please. > > Kindest Regards > Lucky Khoza > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jeremy@REDACTED Mon Nov 26 09:25:50 2012 From: jeremy@REDACTED (Jeremy Ong) Date: Mon, 26 Nov 2012 00:25:50 -0800 Subject: [erlang-questions] Funs In-Reply-To: References: Message-ID: Anonymous functions or lambdas are a basic building box in any functional programmer's toolbox. Examples of functions that take other anonymous functions in the standard library are lists:map, lists:foldl, lists:filter, and their analogs in the orddict library, sets library, etc. Of course, any of those parameters can be named functions as well but if the function is simple enough, an anonymous function is preferred for brevity (example, lists:map(fun(Elem) -> Elem * 2 end, List) doubles the value of all elements in List). You can also accept a function as a parameter for any of your functions too. For example: every_other(Fun, List) -> {_, Res} = lists:foldl(fun(Elem, {Idx, Acc}) -> case Idx rem 2 of 0 -> {Idx + 1, Acc ++ [Elem]}; 1 -> {Idx + 1, Acc ++ [Fun(Elem)]} end, List), Res. This returns a list with Fun applied to every other element. On Mon, Nov 26, 2012 at 12:09 AM, Lucky Khoza wrote: > Morning Erlang Developers, > > I would like to ask about: when do we use funs or anonymous functions in > Erlang?, I know what it is, but I can't really figure out when to use it > and I saw an example of it being used with Mnesia transactions. > > May someone help in this regard please. > > Kindest Regards > Lucky Khoza > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy@REDACTED Mon Nov 26 09:27:34 2012 From: jeremy@REDACTED (Jeremy Ong) Date: Mon, 26 Nov 2012 00:27:34 -0800 Subject: [erlang-questions] Funs In-Reply-To: References: Message-ID: Er note also that the "every_other" function is probably best implemented as a list comprehension but I did it using foldr to illustrate the use of anonymous functions in a fold. You should probably indent it nicer too haha. On Mon, Nov 26, 2012 at 12:25 AM, Jeremy Ong wrote: > Anonymous functions or lambdas are a basic building box in any functional > programmer's toolbox. Examples of functions that take other anonymous > functions in the standard library are lists:map, lists:foldl, lists:filter, > and their analogs in the orddict library, sets library, etc. Of course, any > of those parameters can be named functions as well but if the function is > simple enough, an anonymous function is preferred for brevity (example, > lists:map(fun(Elem) -> Elem * 2 end, List) doubles the value of all > elements in List). > > You can also accept a function as a parameter for any of your functions > too. For example: > > every_other(Fun, List) -> > {_, Res} = lists:foldl(fun(Elem, {Idx, Acc}) -> case Idx rem 2 of 0 -> > {Idx + 1, Acc ++ [Elem]}; 1 -> {Idx + 1, Acc ++ [Fun(Elem)]} end, List), > Res. > > This returns a list with Fun applied to every other element. > > > On Mon, Nov 26, 2012 at 12:09 AM, Lucky Khoza wrote: > >> Morning Erlang Developers, >> >> I would like to ask about: when do we use funs or anonymous functions in >> Erlang?, I know what it is, but I can't really figure out when to use it >> and I saw an example of it being used with Mnesia transactions. >> >> May someone help in this regard please. >> >> Kindest Regards >> Lucky Khoza >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand@REDACTED Mon Nov 26 09:27:49 2012 From: tjarvstrand@REDACTED (=?ISO-8859-1?Q?Thomas_J=E4rvstrand?=) Date: Mon, 26 Nov 2012 09:27:49 +0100 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite Message-ID: Using Emacs for your Erlang development? Of course you are! The Erlang Development Tool Suite for Emacs will make your life a lot easier: The Erlang Development Tool Suite (EDTS) is a package of useful development tools for working with the Erlang programming language in Emacs. It bundles a number of useful external packages, together with specialized Erlang plugins for them, and its own features to create a complete and efficient development environment that is easy to set up. Currently EDTS provides: - A snazzy erlang shell wrapper with syntax highlighting and auto-completion. - In-buffer flymake-like compilation - In-buffer xref checks - Rudimentary project support - Code navigation. - Auto-completion, using auto-complete-mode - Auto-highlighting, using auto-highlight-mode - Convenient access to Erlang documentation - In-buffer running of unit tests In the works: - Dialyzer integration - A nice interface to the erlang debugger Find it at: https://github.com/tjarvstrand/edts Special thanks to the people who have helped me turn this into what it is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager group of beta-testers at the Klarna Engineering Department. Feedback, feature requests and patches would all be highly appreciated. Regards Thomas J?rvstrand -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Nov 26 09:56:35 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 26 Nov 2012 11:56:35 +0300 Subject: [erlang-questions] Performance tuning an erlang system In-Reply-To: References: Message-ID: It is a wonderful story! Usually such big guys love software, that is buggy, slow, costs several megabuck and is written in Java by thousands of low-cost developers, but your story is like a fairy tale about good world, where operator can switch to a 20K LOC simple working software written by small couple of engineers! Thank you for this story. Also I want to mention what you've told about OTP patch. It is a good argument in discussion: monolithic distribution vs many packages. If eldap was a project on github, you could just fork it. But currently it is not very convenient to compile and launch tests in single subfolder in otp/lib/... But I think it should be a separate topic On Mon, Nov 26, 2012 at 11:27 AM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > Max, I work for EE which owns the Orange, T-Mobile and EE brands in the > UK. And yes, we are migrating an online charging mediator to an in-house > solution. > > cheers > Chandru > > > > On 26 November 2012 04:11, Max Lapshin wrote: > >> Chandru, have I understood properly: you are working at Orange and you >> are migrating your own charging subsystem from external many-mega-bucks >> system to your own solution? >> >> >> On Monday, November 26, 2012, Chandru wrote: >> >>> Hi, >>> >>> I've recently worked on improving the performance of an erlang system >>> we've developed which I've written up here --> >>> http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ >>> >>> Hopefully it will be of some use to someone. >>> >>> cheers >>> Chandru >>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Mon Nov 26 10:12:53 2012 From: bourinov@REDACTED (Max Bourinov) Date: Mon, 26 Nov 2012 13:12:53 +0400 Subject: [erlang-questions] Performance tuning an erlang system In-Reply-To: References: Message-ID: Thank you for sharing your story! Best regards, Max On Mon, Nov 26, 2012 at 4:02 AM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > Hi, > > I've recently worked on improving the performance of an erlang system > we've developed which I've written up here --> > http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ > > Hopefully it will be of some use to someone. > > cheers > Chandru > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Mon Nov 26 11:14:05 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 26 Nov 2012 10:14:05 +0000 Subject: [erlang-questions] Performance tuning an erlang system In-Reply-To: References: Message-ID: Max, Yes, different operators have different cultures. Some like to just buy stuff off the shelf, and some have the bravado to roll their own. We've been doing it in this organisation for the past 12 years now, and having our own internal dev team enables a lot of stuff. We still buy a lot of kit from vendors, and I probably wouldn't want to do all of that myself, but Erlang is perfect in integrating systems together. Regarding patches, yes, it would be great if each of the OTP libraries could be forked on its own. It would be a bit less daunting to supply patches. Chandru On 26 November 2012 08:56, Max Lapshin wrote: > It is a wonderful story! Usually such big guys love software, that is > buggy, slow, costs several megabuck and is written in Java by thousands of > low-cost developers, but your story is like a fairy tale about good world, > where operator can switch to a 20K LOC simple working software written by > small couple of engineers! > > Thank you for this story. > > Also I want to mention what you've told about OTP patch. It is a good > argument in discussion: monolithic distribution vs many packages. If eldap > was a project on github, you could just fork it. But currently it is not > very convenient to compile and launch tests in single subfolder in > otp/lib/... > But I think it should be a separate topic > > > On Mon, Nov 26, 2012 at 11:27 AM, Chandru < > chandrashekhar.mullaparthi@REDACTED> wrote: > >> Max, I work for EE which owns the Orange, T-Mobile and EE brands in the >> UK. And yes, we are migrating an online charging mediator to an in-house >> solution. >> >> cheers >> Chandru >> >> >> >> On 26 November 2012 04:11, Max Lapshin wrote: >> >>> Chandru, have I understood properly: you are working at Orange and you >>> are migrating your own charging subsystem from external many-mega-bucks >>> system to your own solution? >>> >>> >>> On Monday, November 26, 2012, Chandru wrote: >>> >>>> Hi, >>>> >>>> I've recently worked on improving the performance of an erlang system >>>> we've developed which I've written up here --> >>>> http://chandrusoft.wordpress.com/2012/11/25/performance-tuning-of-dmc/ >>>> >>>> Hopefully it will be of some use to someone. >>>> >>>> cheers >>>> Chandru >>>> >>>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand@REDACTED Mon Nov 26 16:16:36 2012 From: tjarvstrand@REDACTED (=?ISO-8859-1?Q?Thomas_J=E4rvstrand?=) Date: Mon, 26 Nov 2012 16:16:36 +0100 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: My pleasure :) I had a look at Wrangler only last week and unfortunately it's very tightly integrated with Distel. It's definitely something I would like to have in there but I think it will take a bit of work and I'll probably need the wrangier devs on board to try and disentangle the dependencies. Next things will be to integrate with Dialyzer and the Erlang debugger, after that I may get a chance to have a more serious look at wrangler. Thomas 2012/11/26 Son Tran-Nguyen > Hi, > > Thank you so much to make this package! It's really easy to get everything > for Erlang development in one spot. > > Is there any plan to integrate Wrangler as well? > > Sincerely, > > > Son Tran-Nguyen > > > > On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand wrote: > >> Using Emacs for your Erlang development? Of course you are! >> >> The Erlang Development Tool Suite for Emacs will make your life a lot >> easier: >> >> The Erlang Development Tool Suite (EDTS) is a package of useful development >> tools for working with the Erlang programming language in Emacs. It bundles a >> number of useful external packages, together with specialized Erlang plugins for >> them, and its own features to create a complete and efficient development >> environment that is easy to set up. >> >> Currently EDTS provides: >> - A snazzy erlang shell wrapper with syntax highlighting and auto-completion. >> - In-buffer flymake-like compilation >> - In-buffer xref checks >> - Rudimentary project support >> - Code navigation. >> - Auto-completion, using auto-complete-mode >> - Auto-highlighting, using auto-highlight-mode >> - Convenient access to Erlang documentation >> - In-buffer running of unit tests >> >> In the works: >> - Dialyzer integration >> - A nice interface to the erlang debugger >> >> Find it at: >> https://github.com/tjarvstrand/edts >> >> Special thanks to the people who have helped me turn this into what it >> is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager >> group of beta-testers at the Klarna Engineering Department. >> >> Feedback, feature requests and patches would all be highly appreciated. >> >> Regards >> Thomas J?rvstrand >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Nov 26 16:29:54 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 26 Nov 2012 16:29:54 +0100 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: Thanks a lot for your work! Having a look at Distel/Wrangler and other IDE-based-on-Emacs solutions, I have a thought that it is better to have an IDE split into multiple small modules, which have a as small dependency graph as possible. With new packaging mechanisms in Emacs 24 it is definitely possible to make it easy for users to track dependencies. With features separated into small packages it would be easier for uses to integrate features of EDTS into their setup. IMVHO :) On Mon, Nov 26, 2012 at 4:16 PM, Thomas J?rvstrand wrote: > My pleasure :) > > I had a look at Wrangler only last week and unfortunately it's very tightly > integrated with Distel. It's definitely something I would like to have in > there but I think it will take a bit of work and I'll probably need the > wrangier devs on board to try and disentangle the dependencies. > > Next things will be to integrate with Dialyzer and the Erlang debugger, > after that I may get a chance to have a more serious look at wrangler. > > Thomas > > 2012/11/26 Son Tran-Nguyen >> >> Hi, >> >> Thank you so much to make this package! It's really easy to get everything >> for Erlang development in one spot. >> >> Is there any plan to integrate Wrangler as well? >> >> Sincerely, >> >> >> Son Tran-Nguyen >> >> >> >> On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand >> wrote: >>> >>> Using Emacs for your Erlang development? Of course you are! >>> >>> The Erlang Development Tool Suite for Emacs will make your life a lot >>> easier: >>> >>> The Erlang Development Tool Suite (EDTS) is a package of useful >>> development >>> tools for working with the Erlang programming language in Emacs. It >>> bundles a >>> number of useful external packages, together with specialized Erlang >>> plugins for >>> them, and its own features to create a complete and efficient development >>> environment that is easy to set up. >>> >>> Currently EDTS provides: >>> - A snazzy erlang shell wrapper with syntax highlighting and >>> auto-completion. >>> - In-buffer flymake-like compilation >>> - In-buffer xref checks >>> - Rudimentary project support >>> - Code navigation. >>> - Auto-completion, using auto-complete-mode >>> - Auto-highlighting, using auto-highlight-mode >>> - Convenient access to Erlang documentation >>> - In-buffer running of unit tests >>> >>> In the works: >>> - Dialyzer integration >>> - A nice interface to the erlang debugger >>> >>> Find it at: >>> https://github.com/tjarvstrand/edts >>> >>> Special thanks to the people who have helped me turn this into what it >>> is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager >>> group of beta-testers at the Klarna Engineering Department. >>> >>> Feedback, feature requests and patches would all be highly appreciated. >>> >>> Regards >>> Thomas J?rvstrand >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From bourinov@REDACTED Mon Nov 26 16:30:11 2012 From: bourinov@REDACTED (Max Bourinov) Date: Mon, 26 Nov 2012 19:30:11 +0400 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: Hi Thomas, You pack is so great that I think I have to start using emacs. Best regards, Max On Mon, Nov 26, 2012 at 7:16 PM, Thomas J?rvstrand wrote: > My pleasure :) > > I had a look at Wrangler only last week and unfortunately it's very > tightly integrated with Distel. It's definitely something I would like to > have in there but I think it will take a bit of work and I'll probably need > the wrangier devs on board to try and disentangle the dependencies. > > Next things will be to integrate with Dialyzer and the Erlang debugger, > after that I may get a chance to have a more serious look at wrangler. > > Thomas > > 2012/11/26 Son Tran-Nguyen > >> Hi, >> >> Thank you so much to make this package! It's really easy to get >> everything for Erlang development in one spot. >> >> Is there any plan to integrate Wrangler as well? >> >> Sincerely, >> >> >> Son Tran-Nguyen >> >> >> >> On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand > > wrote: >> >>> Using Emacs for your Erlang development? Of course you are! >>> >>> The Erlang Development Tool Suite for Emacs will make your life a lot >>> easier: >>> >>> The Erlang Development Tool Suite (EDTS) is a package of useful development >>> tools for working with the Erlang programming language in Emacs. It bundles a >>> number of useful external packages, together with specialized Erlang plugins for >>> them, and its own features to create a complete and efficient development >>> environment that is easy to set up. >>> >>> Currently EDTS provides: >>> - A snazzy erlang shell wrapper with syntax highlighting and auto-completion. >>> - In-buffer flymake-like compilation >>> - In-buffer xref checks >>> - Rudimentary project support >>> - Code navigation. >>> - Auto-completion, using auto-complete-mode >>> - Auto-highlighting, using auto-highlight-mode >>> - Convenient access to Erlang documentation >>> - In-buffer running of unit tests >>> >>> In the works: >>> - Dialyzer integration >>> - A nice interface to the erlang debugger >>> >>> Find it at: >>> https://github.com/tjarvstrand/edts >>> >>> Special thanks to the people who have helped me turn this into what it >>> is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager >>> group of beta-testers at the Klarna Engineering Department. >>> >>> Feedback, feature requests and patches would all be highly appreciated. >>> >>> Regards >>> Thomas J?rvstrand >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvstrand@REDACTED Mon Nov 26 16:59:39 2012 From: tjarvstrand@REDACTED (=?ISO-8859-1?Q?Thomas_J=E4rvstrand?=) Date: Mon, 26 Nov 2012 16:59:39 +0100 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: Agreed. A small and understandable dependency tree is a healthy goal for most software projects. When I started EDTS I had an idea that it would only be a small wrapper to bind together a toolset, but obviously the glue code has grown substantially since then :P I've thought about it and most things in EDTS could actually pretty easily be split out into their own subprojects. That said it would take some work and such a move would most likeiy force some improvements of the code so hopefully I'll get around to it before it's too late :) T 2012/11/26 Gleb Peregud > Thanks a lot for your work! > > Having a look at Distel/Wrangler and other IDE-based-on-Emacs > solutions, I have a thought that it is better to have an IDE split > into multiple small modules, which have a as small dependency graph as > possible. With new packaging mechanisms in Emacs 24 it is definitely > possible to make it easy for users to track dependencies. With > features separated into small packages it would be easier for uses to > integrate features of EDTS into their setup. IMVHO :) > > On Mon, Nov 26, 2012 at 4:16 PM, Thomas J?rvstrand > wrote: > > My pleasure :) > > > > I had a look at Wrangler only last week and unfortunately it's very > tightly > > integrated with Distel. It's definitely something I would like to have in > > there but I think it will take a bit of work and I'll probably need the > > wrangier devs on board to try and disentangle the dependencies. > > > > Next things will be to integrate with Dialyzer and the Erlang debugger, > > after that I may get a chance to have a more serious look at wrangler. > > > > Thomas > > > > 2012/11/26 Son Tran-Nguyen > >> > >> Hi, > >> > >> Thank you so much to make this package! It's really easy to get > everything > >> for Erlang development in one spot. > >> > >> Is there any plan to integrate Wrangler as well? > >> > >> Sincerely, > >> > >> > >> Son Tran-Nguyen > >> > >> > >> > >> On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand < > tjarvstrand@REDACTED> > >> wrote: > >>> > >>> Using Emacs for your Erlang development? Of course you are! > >>> > >>> The Erlang Development Tool Suite for Emacs will make your life a lot > >>> easier: > >>> > >>> The Erlang Development Tool Suite (EDTS) is a package of useful > >>> development > >>> tools for working with the Erlang programming language in Emacs. It > >>> bundles a > >>> number of useful external packages, together with specialized Erlang > >>> plugins for > >>> them, and its own features to create a complete and efficient > development > >>> environment that is easy to set up. > >>> > >>> Currently EDTS provides: > >>> - A snazzy erlang shell wrapper with syntax highlighting and > >>> auto-completion. > >>> - In-buffer flymake-like compilation > >>> - In-buffer xref checks > >>> - Rudimentary project support > >>> - Code navigation. > >>> - Auto-completion, using auto-complete-mode > >>> - Auto-highlighting, using auto-highlight-mode > >>> - Convenient access to Erlang documentation > >>> - In-buffer running of unit tests > >>> > >>> In the works: > >>> - Dialyzer integration > >>> - A nice interface to the erlang debugger > >>> > >>> Find it at: > >>> https://github.com/tjarvstrand/edts > >>> > >>> Special thanks to the people who have helped me turn this into what it > >>> is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager > >>> group of beta-testers at the Klarna Engineering Department. > >>> > >>> Feedback, feature requests and patches would all be highly appreciated. > >>> > >>> Regards > >>> Thomas J?rvstrand > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >>> > >> > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brisa.jimenez.f@REDACTED Mon Nov 26 18:25:00 2012 From: brisa.jimenez.f@REDACTED (=?ISO-8859-1?Q?Brisa_Jim=E9nez?=) Date: Mon, 26 Nov 2012 11:25:00 -0600 Subject: [erlang-questions] erlang:port_call and ei library Message-ID: Hi everyone! I have doubts about port_call and driver_init structure in a port driver. This way I open the port: Port = open_port({spawn, ?C_LIBRARY}, [binary]), Erlang function: foz(Arg)-> call_port({1, Arg}). C function: double foz(double x) { return x/1.0; } I use next BIF to port calls: erlang:port_call(Port, Command, encode(Data)), where Command is an integer and Data is a float for example... And for encode: encode(Msg)-> term_to_binary(Msg). This is my driver structure: ErlDrvEntry driver_entry = { NULL, // called at system start up for statically // linked drivers, and after loading for // dynamically loaded drivers start, stop, // called when port is closed, and when the emulator is halted. NULL, //called when we have output from erlang to the port NULL, //ready_input - called when we have input from one of the driver's handles NULL, //ready_output - called when output is possible to one of the driver's handles "library", //driver_name - name supplied as command in open_port XXX ? NULL, // finish - called before unloading the driver - // DYNAMIC DRIVERS ONLY NULL, //handle - Reserved -- Used by emulator internally NULL, // control - "ioctl" for drivers - invoked by port_control/3 NULL, //timeout - Handling of timeout in driver NULL, //outputv - called when we have output from erlang to the port NULL, // ready_async - called when the port is about to be // closed, and there is data in the // driver queue that needs to be flushed // before 'stop' can be called call, // call - Works mostly like 'control', a synchronous call into the driver. NULL, // event - Called when an event selected by driver_event() has occurred .extended_marker = ERL_DRV_EXTENDED_MARKER, .major_version = ERL_DRV_EXTENDED_MAJOR_VERSION, .minor_version = ERL_DRV_EXTENDED_MINOR_VERSION, 0, // ERL_DRV_FLAGs NULL, // handle2 - Reserved -- Used by emulator internally NULL, // process_exit - Called when a process monitor fires NULL, // stop_select - Called to close an event object }; And my call function: ErlDrvSSizeT call(ErlDrvData handle, unsigned int command, char *buf, ErlDrvSizeT len, char **rbuf, ErlDrvSizeT rlen, unsigned int *flags) { ptr_port *ptr_port1 = (ptr_port*)handle; double arg, res; int version, index = 0; if (ei_decode_version(buf, &index, &version)) return (ErlDrvSSizeT)1; if (ei_decode_double(buf, &index, &arg)) return (ErlDrvSSizeT)2; switch (command) { case 1: res = foz(arg); break; case 2: res = baz(arg); break; default: return (ErlDrvSSizeT)3; } index = 0; if (ei_encode_version(*rbuf, &index) || ei_encode_double(*rbuf, &index, res)) return (ErlDrvSSizeT)4; return (ErlDrvSSizeT)index; } My erlang version is: Erlang R14B03 (erts-5.8.4) My erts version doesn't have ErlDrvSizeT and ErlDrvSSizeT types, so, I include these types in my port_driver.c file: typedef size_t ErlDrvSizeT; typedef ssize_t ErlDrvSSizeT; When I compile code the next warning is showed: c_src/port_driver.c:78:5: warning: initialization from incompatible pointer type [enabled by default] c_src/port_driver.c:78:5: warning: (near initialization for ?driver_entry.flush?) [enabled by default] 78 line refers to call in driver_entry structure. If I ignore the warning happens the next: 1> erl_drv:start(). <0.34.0> 2> erl_drv:foz(4.0). =ERROR REPORT==== 26-Nov-2012::11:13:45 === Error in process <0.34.0> with exit value: {badarg,[{erlang,port_call,[erl_port,1,<<33 bytes>>]},{erl_drv,loop,1}]} I couldn't change the erlang version, and I read that terms send to c call function are decoded and encoded with ei library. Does anybody give me an advice? Thank you very much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Mon Nov 26 19:02:34 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 26 Nov 2012 13:02:34 -0500 Subject: [erlang-questions] erlang:port_call and ei library In-Reply-To: References: Message-ID: For pre-R15 versions of Erlang you should typedef both the ErlDrvSizeT and ErlDrvSSizeT types to int, rather than the size_t and ssize_t typedefs you currently have. Another problem with your code is that the return value of the control function should be the size of the binary you're returning. If you want port_call to throw a badarg, just return a value less than 0. For success your final return value should be index+1, which is the length of the encoded binary, not index. --steve On Mon, Nov 26, 2012 at 12:25 PM, Brisa Jim?nez wrote: > Hi everyone! > > I have doubts about port_call and driver_init structure in a port driver. > > This way I open the port: > Port = open_port({spawn, ?C_LIBRARY}, [binary]), > > Erlang function: > foz(Arg)-> > call_port({1, Arg}). > > C function: > double foz(double x) { > return x/1.0; > } > > I use next BIF to port calls: > erlang:port_call(Port, Command, encode(Data)), > where Command is an integer and Data is a float for example... > > And for encode: > encode(Msg)-> > term_to_binary(Msg). > > This is my driver structure: > ErlDrvEntry driver_entry = { > NULL, // called at system start up for statically > // linked drivers, and after loading for > // dynamically loaded drivers > start, > stop, // called when port is closed, and when the emulator is halted. > NULL, //called when we have output from erlang to the port > NULL, //ready_input - called when we have input from one of the > driver's handles > NULL, //ready_output - called when output is possible to one of the > driver's handles > "library", //driver_name - name supplied as command in open_port XXX ? > NULL, // finish - called before unloading the driver - > // DYNAMIC DRIVERS ONLY > NULL, //handle - Reserved -- Used by emulator internally > NULL, // control - "ioctl" for drivers - invoked by port_control/3 > NULL, //timeout - Handling of timeout in driver > NULL, //outputv - called when we have output from erlang to the port > NULL, // ready_async - called when the port is about to be > // closed, and there is data in the > // driver queue that needs to be flushed > // before 'stop' can be called > call, // call - Works mostly like 'control', a synchronous call into > the driver. > NULL, // event - Called when an event selected by driver_event() has > occurred > .extended_marker = ERL_DRV_EXTENDED_MARKER, > .major_version = ERL_DRV_EXTENDED_MAJOR_VERSION, > .minor_version = ERL_DRV_EXTENDED_MINOR_VERSION, > 0, // ERL_DRV_FLAGs > NULL, // handle2 - Reserved -- Used by emulator internally > NULL, // process_exit - Called when a process monitor fires > NULL, // stop_select - Called to close an event object > }; > > And my call function: > ErlDrvSSizeT call(ErlDrvData handle, unsigned int command, > char *buf, ErlDrvSizeT len, > char **rbuf, ErlDrvSizeT rlen, unsigned int *flags) > { > ptr_port *ptr_port1 = (ptr_port*)handle; > double arg, res; > int version, index = 0; > > if (ei_decode_version(buf, &index, &version)) return (ErlDrvSSizeT)1; > if (ei_decode_double(buf, &index, &arg)) return (ErlDrvSSizeT)2; > > switch (command) { > case 1: > res = foz(arg); > break; > case 2: > res = baz(arg); > break; > default: > return (ErlDrvSSizeT)3; > } > index = 0; > if (ei_encode_version(*rbuf, &index) || > ei_encode_double(*rbuf, &index, res)) return (ErlDrvSSizeT)4; > return (ErlDrvSSizeT)index; > > } > > My erlang version is: > Erlang R14B03 (erts-5.8.4) > > My erts version doesn't have ErlDrvSizeT and ErlDrvSSizeT types, so, I > include these types in my port_driver.c file: > typedef size_t ErlDrvSizeT; > typedef ssize_t ErlDrvSSizeT; > > When I compile code the next warning is showed: > c_src/port_driver.c:78:5: warning: initialization from incompatible > pointer type [enabled by default] > c_src/port_driver.c:78:5: warning: (near initialization for > ?driver_entry.flush?) [enabled by default] > > 78 line refers to call in driver_entry structure. > > If I ignore the warning happens the next: > 1> erl_drv:start(). > <0.34.0> > 2> erl_drv:foz(4.0). > > =ERROR REPORT==== 26-Nov-2012::11:13:45 === > Error in process <0.34.0> with exit value: > {badarg,[{erlang,port_call,[erl_port,1,<<33 bytes>>]},{erl_drv,loop,1}]} > > I couldn't change the erlang version, and I read that terms send to c call > function are decoded and encoded with ei library. > > Does anybody give me an advice? > > Thank you very much. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acidbriggs@REDACTED Mon Nov 26 21:28:58 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Mon, 26 Nov 2012 15:28:58 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX Message-ID: Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. I know that the problem was reported to Apple but we know how that is. Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? Thanks for your time, Briggs The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: Greetings, Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a kernel panic using the following steps: 1. Start new terminal window 2. erl +K true -s crypto 3. Cmd-W (close the terminal window without stopping erlang) Alternatively, if you're running SL 10.6.2 and Erlang R13B03: 1. Start new terminal window 2. erl +K true -s crypto 3. Cmd-Q (quit the terminal app without stopping erlang) This appears to work with either 32 or 64 bit builds of Erlang. Thanks, D. From f355@REDACTED Mon Nov 26 21:47:48 2012 From: f355@REDACTED (Konstantin Tcepliaev) Date: Tue, 27 Nov 2012 00:47:48 +0400 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: <300551353962868@web21h.yandex.ru> An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Nov 26 21:51:11 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 26 Nov 2012 23:51:11 +0300 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: Message-ID: How erlang be guilty in killing kernel of unix OS? It isn't DOS What is the exact mechanism of this Mac failure (and it is definitely Mac failure, not erlang failure). On Tue, Nov 27, 2012 at 12:28 AM, wrote: > Back in March of 2010 it was reported that it was possible to initiate a > kernel panic on OS X 10.6.2 with Erlang. > > Does anyone know if there is a fix for this? This is still happening in OS > X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs > when working in Emacs and killing an Erlang shell in a buffer in a > non-clean way. > > I know that the problem was reported to Apple but we know how that is. > > Perhaps someone has some sort of patch that can be applied to Erlang that > can stop it from exploiting this flaw? > > Thanks for your time, > > > Briggs > > > > > The original thread ( > http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) > stated: > > > Greetings, > > Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a > kernel panic using the following steps: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-W (close the terminal window without stopping erlang) > > Alternatively, if you're running SL 10.6.2 and Erlang R13B03: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-Q (quit the terminal app without stopping erlang) > > This appears to work with either 32 or 64 bit builds of Erlang. > > > Thanks, > > D. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acidbriggs@REDACTED Mon Nov 26 22:02:40 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Mon, 26 Nov 2012 16:02:40 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: Message-ID: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> Don't get me wrong, I have no doubts that it's an OS X bug. But, getting that fixed via Apple is next to impossible. I am not sure of the mechanism as to why it crashes the OS, but it does. It is reproducible. I was just hoping someone might know how to patch Erlang to help avoid the OS X bug as it's really irritating. If anyone is curious you can see that the process that caused the panic was named "beam.smp": Interval Since Last Panic Report: 2399141 sec Panics Since Last Report: 1 Anonymous UUID: 1C24E5B9-05B7-8082-2863-4E5C3ECA6AEC Thu Nov 15 11:44:13 2012 panic(cpu 2 caller 0xffffff8006d1fdca): "negative open count (c, 16, 3)"@/SourceCache/xnu/xnu-2050.18.24/bsd/miscfs/specfs/spec_vnops.c:1813 Backtrace (CPU 2), Frame : Return Address 0xffffff80f7e1bbe0 : 0xffffff8006c1d626 0xffffff80f7e1bc50 : 0xffffff8006d1fdca 0xffffff80f7e1bc90 : 0xffffff8006d24c56 0xffffff80f7e1bce0 : 0xffffff8006d11c96 0xffffff80f7e1bd20 : 0xffffff8006d094af 0xffffff80f7e1bd50 : 0xffffff8006d08645 0xffffff80f7e1bda0 : 0xffffff8006f4c56c 0xffffff80f7e1be10 : 0xffffff8006f4cae6 0xffffff80f7e1be50 : 0xffffff8006f5697b 0xffffff80f7e1bec0 : 0xffffff8006c39cc9 0xffffff80f7e1bef0 : 0xffffff8006c3c7c8 0xffffff80f7e1bf20 : 0xffffff8006c3c63e 0xffffff80f7e1bf50 : 0xffffff8006c1b70d 0xffffff80f7e1bf90 : 0xffffff8006cb8163 0xffffff80f7e1bfb0 : 0xffffff8006cce4bc BSD process name corresponding to current thread: beam.smp Mac OS version: 12C60 On Nov 26, 2012, at 3:51 PM, Max Lapshin wrote: > How erlang be guilty in killing kernel of unix OS? It isn't DOS > What is the exact mechanism of this Mac failure (and it is definitely Mac failure, not erlang failure). > > > On Tue, Nov 27, 2012 at 12:28 AM, wrote: > Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. > > Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. > > I know that the problem was reported to Apple but we know how that is. > > Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? > > Thanks for your time, > > > Briggs > > > > > The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: > > > Greetings, > > Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a > kernel panic using the following steps: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-W (close the terminal window without stopping erlang) > > Alternatively, if you're running SL 10.6.2 and Erlang R13B03: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-Q (quit the terminal app without stopping erlang) > > This appears to work with either 32 or 64 bit builds of Erlang. > > > Thanks, > > D. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From f355@REDACTED Mon Nov 26 22:20:19 2012 From: f355@REDACTED (Konstantin Tcepliaev) Date: Tue, 27 Nov 2012 01:20:19 +0400 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> References: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> Message-ID: <316021353964819@web7f.yandex.ru> An HTML attachment was scrubbed... URL: From acidbriggs@REDACTED Mon Nov 26 22:29:55 2012 From: acidbriggs@REDACTED (Briggs) Date: Mon, 26 Nov 2012 16:29:55 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <316021353964819@web7f.yandex.ru> References: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> <316021353964819@web7f.yandex.ru> Message-ID: All built using MacPorts. 3 separate machines. All built from source. On Nov 26, 2012, at 4:20 PM, Konstantin Tcepliaev wrote: > Hello, > > Just curious: how did you obtain the binaries for Erlang VM? Homebrew/MacPorts/ESL build/compiled by yourself from source/whatever? > I mean, I've been using Erlang R14B04 to R15B02, from Homebrew and built by myself, on OSX 10.6 to 10.8.2, and never had any such problems. > > -- > Konstantin > 27.11.2012, 01:02, "acidbriggs@REDACTED" : >> Don't get me wrong, I have no doubts that it's an OS X bug. But, getting that fixed via Apple is next to impossible. I am not sure of the mechanism as to why it crashes the OS, but it does. It is reproducible. I was just hoping someone might know how to patch Erlang to help avoid the OS X bug as it's really irritating. >> If anyone is curious you can see that the process that caused the panic was named "beam.smp": >> Interval Since Last Panic Report: 2399141 sec >> Panics Since Last Report: 1 >> Anonymous UUID: 1C24E5B9-05B7-8082-2863-4E5C3ECA6AEC >> Thu Nov 15 11:44:13 2012 >> panic(cpu 2 caller 0xffffff8006d1fdca): "negative open count (c, 16, 3)"@/SourceCache/xnu/xnu-2050.18.24/bsd/miscfs/specfs/spec_vnops.c:1813 >> Backtrace (CPU 2), Frame : Return Address >> 0xffffff80f7e1bbe0 : 0xffffff8006c1d626 >> 0xffffff80f7e1bc50 : 0xffffff8006d1fdca >> 0xffffff80f7e1bc90 : 0xffffff8006d24c56 >> 0xffffff80f7e1bce0 : 0xffffff8006d11c96 >> 0xffffff80f7e1bd20 : 0xffffff8006d094af >> 0xffffff80f7e1bd50 : 0xffffff8006d08645 >> 0xffffff80f7e1bda0 : 0xffffff8006f4c56c >> 0xffffff80f7e1be10 : 0xffffff8006f4cae6 >> 0xffffff80f7e1be50 : 0xffffff8006f5697b >> 0xffffff80f7e1bec0 : 0xffffff8006c39cc9 >> 0xffffff80f7e1bef0 : 0xffffff8006c3c7c8 >> 0xffffff80f7e1bf20 : 0xffffff8006c3c63e >> 0xffffff80f7e1bf50 : 0xffffff8006c1b70d >> 0xffffff80f7e1bf90 : 0xffffff8006cb8163 >> 0xffffff80f7e1bfb0 : 0xffffff8006cce4bc >> BSD process name corresponding to current thread: beam.smp >> Mac OS version: >> 12C60 >> On Nov 26, 2012, at 3:51 PM, Max Lapshin wrote: >> >>> How erlang be guilty in killing kernel of unix OS? It isn't DOS >>> What is the exact mechanism of this Mac failure (and it is definitely Mac failure, not erlang failure). >>> >>> >>> On Tue, Nov 27, 2012 at 12:28 AM, wrote: >>> Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. >>> >>> Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. >>> >>> I know that the problem was reported to Apple but we know how that is. >>> >>> Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? >>> >>> Thanks for your time, >>> >>> >>> Briggs >>> >>> >>> >>> >>> The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: >>> >>> >>> Greetings, >>> >>> Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a >>> kernel panic using the following steps: >>> >>> 1. Start new terminal window >>> 2. erl +K true -s crypto >>> 3. Cmd-W (close the terminal window without stopping erlang) >>> >>> Alternatively, if you're running SL 10.6.2 and Erlang R13B03: >>> >>> 1. Start new terminal window >>> 2. erl +K true -s crypto >>> 3. Cmd-Q (quit the terminal app without stopping erlang) >>> >>> This appears to work with either 32 or 64 bit builds of Erlang. >>> >>> >>> Thanks, >>> >>> D. >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> , >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Nov 26 22:31:20 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 26 Nov 2012 22:31:20 +0100 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> <316021353964819@web7f.yandex.ru> Message-ID: <50B3DFA8.50804@ninenines.eu> Someone confirmed it on IRC. This is the new Alt+F4! On 11/26/2012 10:29 PM, Briggs wrote: > All built using MacPorts. 3 separate machines. All built from source. > > On Nov 26, 2012, at 4:20 PM, Konstantin Tcepliaev > wrote: > >> Hello, >> Just curious: how did you obtain the binaries for Erlang VM? >> Homebrew/MacPorts/ESL build/compiled by yourself from source/whatever? >> I mean, I've been using Erlang R14B04 to R15B02, from Homebrew and >> built by myself, on OSX 10.6 to 10.8.2, and never had any such problems. >> -- >> Konstantin >> 27.11.2012, 01:02, "acidbriggs@REDACTED >> " > >: >>> Don't get me wrong, I have no doubts that it's an OS X bug. But, >>> getting that fixed via Apple is next to impossible. I am not sure of >>> the mechanism as to why it crashes the OS, but it does. It is >>> reproducible. I was just hoping someone might know how to patch >>> Erlang to help avoid the OS X bug as it's really irritating. >>> If anyone is curious you can see that the process that caused the >>> panic was named "beam.smp": >>> Interval Since Last Panic Report: 2399141 sec >>> Panics Since Last Report: 1 >>> Anonymous UUID: 1C24E5B9-05B7-8082-2863-4E5C3ECA6AEC >>> Thu Nov 15 11:44:13 2012 >>> panic(cpu 2 caller 0xffffff8006d1fdca): "negative open count (c, 16, >>> 3)"@/SourceCache/xnu/xnu-2050.18.24/bsd/miscfs/specfs/spec_vnops.c:1813 >>> Backtrace (CPU 2), Frame : Return Address >>> 0xffffff80f7e1bbe0 : 0xffffff8006c1d626 >>> 0xffffff80f7e1bc50 : 0xffffff8006d1fdca >>> 0xffffff80f7e1bc90 : 0xffffff8006d24c56 >>> 0xffffff80f7e1bce0 : 0xffffff8006d11c96 >>> 0xffffff80f7e1bd20 : 0xffffff8006d094af >>> 0xffffff80f7e1bd50 : 0xffffff8006d08645 >>> 0xffffff80f7e1bda0 : 0xffffff8006f4c56c >>> 0xffffff80f7e1be10 : 0xffffff8006f4cae6 >>> 0xffffff80f7e1be50 : 0xffffff8006f5697b >>> 0xffffff80f7e1bec0 : 0xffffff8006c39cc9 >>> 0xffffff80f7e1bef0 : 0xffffff8006c3c7c8 >>> 0xffffff80f7e1bf20 : 0xffffff8006c3c63e >>> 0xffffff80f7e1bf50 : 0xffffff8006c1b70d >>> 0xffffff80f7e1bf90 : 0xffffff8006cb8163 >>> 0xffffff80f7e1bfb0 : 0xffffff8006cce4bc >>> BSD process name corresponding to current thread: beam.smp >>> Mac OS version: >>> 12C60 >>> On Nov 26, 2012, at 3:51 PM, Max Lapshin >> > wrote: >>> >>>> How erlang be guilty in killing kernel of unix OS? It isn't DOS >>>> What is the exact mechanism of this Mac failure (and it is >>>> definitely Mac failure, not erlang failure). >>>> >>>> >>>> On Tue, Nov 27, 2012 at 12:28 AM, >>> > wrote: >>>> >>>> Back in March of 2010 it was reported that it was possible to >>>> initiate a kernel panic on OS X 10.6.2 with Erlang. >>>> >>>> Does anyone know if there is a fix for this? This is still >>>> happening in OS X 10.8.2 with Erlang R15B02. I've had it happen >>>> on all three of my Macs when working in Emacs and killing an >>>> Erlang shell in a buffer in a non-clean way. >>>> >>>> I know that the problem was reported to Apple but we know how >>>> that is. >>>> >>>> Perhaps someone has some sort of patch that can be applied to >>>> Erlang that can stop it from exploiting this flaw? >>>> >>>> Thanks for your time, >>>> >>>> >>>> Briggs >>>> >>>> >>>> >>>> >>>> The original thread >>>> (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) >>>> stated: >>>> >>>> >>>> Greetings, >>>> >>>> Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a >>>> kernel panic using the following steps: >>>> >>>> 1. Start new terminal window >>>> 2. erl +K true -s crypto >>>> 3. Cmd-W (close the terminal window without stopping erlang) >>>> >>>> Alternatively, if you're running SL 10.6.2 and Erlang R13B03: >>>> >>>> 1. Start new terminal window >>>> 2. erl +K true -s crypto >>>> 3. Cmd-Q (quit the terminal app without stopping erlang) >>>> >>>> This appears to work with either 32 or 64 bit builds of Erlang. >>>> >>>> >>>> Thanks, >>>> >>>> D. >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> , >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From a.zhuravlev@REDACTED Mon Nov 26 22:57:18 2012 From: a.zhuravlev@REDACTED (Alexander Zhuravlev) Date: Tue, 27 Nov 2012 01:57:18 +0400 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> References: <17C79EC0-3736-47F4-8D78-311DCAA2A2D8@gmail.com> Message-ID: <20121126215718.GA37959@zmac> On Mon, Nov 26, 2012 at 04:02:40PM -0500, acidbriggs@REDACTED wrote: > Don't get me wrong, I have no doubts that it's an OS X bug. But, getting that fixed via Apple is next to impossible. I am not sure of the mechanism as to why it crashes the OS, but it does. It is reproducible. I was just hoping someone might know how to patch Erlang to help avoid the OS X bug as it's really irritating. > > If anyone is curious you can see that the process that caused the panic was named "beam.smp": > > Interval Since Last Panic Report: 2399141 sec > Panics Since Last Report: 1 > Anonymous UUID: 1C24E5B9-05B7-8082-2863-4E5C3ECA6AEC > > Thu Nov 15 11:44:13 2012 > panic(cpu 2 caller 0xffffff8006d1fdca): "negative open count (c, 16, 3)"@/SourceCache/xnu/xnu-2050.18.24/bsd/miscfs/specfs/spec_vnops.c:1813 > Backtrace (CPU 2), Frame : Return Address > 0xffffff80f7e1bbe0 : 0xffffff8006c1d626 > 0xffffff80f7e1bc50 : 0xffffff8006d1fdca > 0xffffff80f7e1bc90 : 0xffffff8006d24c56 > 0xffffff80f7e1bce0 : 0xffffff8006d11c96 > 0xffffff80f7e1bd20 : 0xffffff8006d094af > 0xffffff80f7e1bd50 : 0xffffff8006d08645 > 0xffffff80f7e1bda0 : 0xffffff8006f4c56c > 0xffffff80f7e1be10 : 0xffffff8006f4cae6 > 0xffffff80f7e1be50 : 0xffffff8006f5697b > 0xffffff80f7e1bec0 : 0xffffff8006c39cc9 > 0xffffff80f7e1bef0 : 0xffffff8006c3c7c8 > 0xffffff80f7e1bf20 : 0xffffff8006c3c63e > 0xffffff80f7e1bf50 : 0xffffff8006c1b70d > 0xffffff80f7e1bf90 : 0xffffff8006cb8163 > 0xffffff80f7e1bfb0 : 0xffffff8006cce4bc > > BSD process name corresponding to current thread: beam.smp > > Mac OS version: > 12C60 Judging by information from http://fxr.watson.org/fxr/source/bsd/miscfs/specfs/spec_vnops.c?v=xnu-2050.18.24#L1813 I believe the only possible clue we can give is that the issue has something to do with TTY management and cases when erlang is opened in a controlling terminal (which is then closed). Maybe this can be prevented somehow. ps. Most probably (c, 16, 3) is a reference to /dev/ttyS003 device. > On Nov 26, 2012, at 3:51 PM, Max Lapshin wrote: > > > How erlang be guilty in killing kernel of unix OS? It isn't DOS > > What is the exact mechanism of this Mac failure (and it is definitely Mac failure, not erlang failure). > > > > > > On Tue, Nov 27, 2012 at 12:28 AM, wrote: > > Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. > > > > Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. > > > > I know that the problem was reported to Apple but we know how that is. > > > > Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? > > > > Thanks for your time, > > > > > > Briggs > > > > > > > > > > The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: > > > > > > Greetings, > > > > Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a > > kernel panic using the following steps: > > > > 1. Start new terminal window > > 2. erl +K true -s crypto > > 3. Cmd-W (close the terminal window without stopping erlang) > > > > Alternatively, if you're running SL 10.6.2 and Erlang R13B03: > > > > 1. Start new terminal window > > 2. erl +K true -s crypto > > 3. Cmd-Q (quit the terminal app without stopping erlang) > > > > This appears to work with either 32 or 64 bit builds of Erlang. > > > > > > Thanks, > > > > D. > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Alexander Zhuravlev From torben.lehoff@REDACTED Mon Nov 26 23:05:28 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 26 Nov 2012 23:05:28 +0100 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: References: Message-ID: <50B3E7A8.6070106@gmail.com> Hi Thomas, I'm sure that you will find Simon and Huiqing very open to your needs regarding Wrangler integration. I have just tried out edts and it works brilliantly - especially the shell is a charm! But, alas, I am a Wrangler man, so I have uncommented the edts code and now I eagerly await the integration with Wrangler!!! Cheers, ___ /orben On 2012-11-26 16:16, Thomas J?rvstrand wrote: > My pleasure :) > > I had a look at Wrangler only last week and unfortunately it's very > tightly integrated with Distel. It's definitely something I would like > to have in there but I think it will take a bit of work and I'll > probably need the wrangier devs on board to try and disentangle the > dependencies. > > Next things will be to integrate with Dialyzer and the Erlang > debugger, after that I may get a chance to have a more serious look at > wrangler. > > Thomas > > 2012/11/26 Son Tran-Nguyen > > > Hi, > > Thank you so much to make this package! It's really easy to get > everything for Erlang development in one spot. > > Is there any plan to integrate Wrangler as well? > > Sincerely, > > > Son Tran-Nguyen > > > > On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand > > wrote: > > Using Emacs for your Erlang development? Of course you are! > > The Erlang Development Tool Suite for Emacs will make your > life a lot easier: > > The Erlang Development Tool Suite (EDTS) is a package of useful development > tools for working with the Erlang programming language in Emacs. It bundles a > number of useful external packages, together with specialized Erlang plugins for > them, and its own features to create a complete and efficient development > environment that is easy to set up. > > Currently EDTS provides: > - A snazzy erlang shell wrapper with syntax highlighting and auto-completion. > - In-buffer flymake-like compilation > - In-buffer xref checks > - Rudimentary project support > - Code navigation. > - Auto-completion, using auto-complete-mode > - Auto-highlighting, using auto-highlight-mode > - Convenient access to Erlang documentation > - In-buffer running of unit tests > > In the works: > - Dialyzer integration > - A nice interface to the erlang debugger > > Find it at: > https://github.com/tjarvstrand/edts > > Special thanks to the people who have helped me turn this into > what it is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus > N?sman and my eager group of beta-testers at the Klarna > Engineering Department. > > Feedback, feature requests and patches would all be highly > appreciated. > > Regards > Thomas J?rvstrand > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- http://www.linkedin.com/in/torbenhoffmann -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson@REDACTED Mon Nov 26 23:12:04 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Mon, 26 Nov 2012 22:12:04 +0000 Subject: [erlang-questions] [ANN] The Erlang Development Tool Suite In-Reply-To: <50B3E7A8.6070106@gmail.com> References: <50B3E7A8.6070106@gmail.com> Message-ID: <00C355E7-ECFC-4258-AB0D-0CABD3E29059@kent.ac.uk> Torben, Thomas, We're very keen to integrate with EDTS; more in due course when we've worked out what's needed ? Simon On 26 Nov 2012, at 22:05, Torben Hoffmann wrote: > Hi Thomas, > > I'm sure that you will find Simon and Huiqing very open to your needs regarding Wrangler integration. > > I have just tried out edts and it works brilliantly - especially the shell is a charm! > > But, alas, I am a Wrangler man, so I have uncommented the edts code and now I eagerly await the integration with Wrangler!!! > > Cheers, > ___ > /orben > > On 2012-11-26 16:16, Thomas J?rvstrand wrote: >> My pleasure :) >> >> I had a look at Wrangler only last week and unfortunately it's very tightly integrated with Distel. It's definitely something I would like to have in there but I think it will take a bit of work and I'll probably need the wrangier devs on board to try and disentangle the dependencies. >> >> Next things will be to integrate with Dialyzer and the Erlang debugger, after that I may get a chance to have a more serious look at wrangler. >> >> Thomas >> >> 2012/11/26 Son Tran-Nguyen >> Hi, >> >> Thank you so much to make this package! It's really easy to get everything for Erlang development in one spot. >> >> Is there any plan to integrate Wrangler as well? >> >> Sincerely, >> >> >> Son Tran-Nguyen >> >> >> >> On Mon, Nov 26, 2012 at 2:27 AM, Thomas J?rvstrand wrote: >> Using Emacs for your Erlang development? Of course you are! >> >> The Erlang Development Tool Suite for Emacs will make your life a lot easier: >> The Erlang Development Tool Suite (EDTS) is a package of useful development >> tools for working with the Erlang programming language in Emacs. It bundles a >> number of useful external packages, together with specialized Erlang plugins for >> them, and its own features to create a complete and efficient development >> environment that is easy to set up. >> >> Currently EDTS provides: >> - A snazzy erlang shell wrapper with syntax highlighting and auto-completion. >> - In-buffer flymake-like compilation >> - In-buffer xref checks >> - Rudimentary project support >> - Code navigation. >> - Auto-completion, using auto-complete-mode >> - Auto-highlighting, using auto-highlight-mode >> - Convenient access to Erlang documentation >> - In-buffer running of unit tests >> >> In the works: >> - Dialyzer integration >> - A nice interface to the erlang debugger >> Find it at: >> https://github.com/tjarvstrand/edts >> >> Special thanks to the people who have helped me turn this into what it is: Samuel Rivas, Jo?o Neves, H?kan Nilsson, Markus N?sman and my eager group of beta-testers at the Klarna Engineering Department. >> >> Feedback, feature requests and patches would all be highly appreciated. >> >> Regards >> Thomas J?rvstrand >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- > http://www.linkedin.com/in/torbenhoffmann > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Nov 27 00:21:04 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 27 Nov 2012 12:21:04 +1300 Subject: [erlang-questions] Funs In-Reply-To: References: Message-ID: On 26/11/2012, at 9:09 PM, Lucky Khoza wrote: > I would like to ask about: when do we use funs or anonymous functions in Erlang?, I know what it is, but I can't really figure out when to use it and I saw an example of it being used with Mnesia transactions. You define an interface that allows funs when you want to define something that has "call-backs" to support user-defined behaviour. Such interfaces are nothing new. Programming languages have been supporting 'procedures as parameters' since the late 1950s. (The Algol committee got the idea from Fortran, which of course got it from mathematical integration, which goes back to Newton, or possibly Leibnitz. Late 17th century anyway.) Lisp was to some extent influenced by the lambda calculus (1932) which is today foundational for languages such as Haskell, Clean, ML, and trace of which can still be discerned in F#. In 1961 Lisp allowed anonymous functions, though it was some time before people figured out how to implement them correctly. The Algol-family programming language Euler allowed anonymous functions in 1966. Smalltalk (which is sort of a hybrid between the Lisp family and the Algol family, and the second major OO language) uses anonymous functions (there called "blocks") _heavily_ (in a code-base I just checked, about one every 3 lines, though admittedly most are inlined). You write a fun when you want to pass something to such an interface and there is no existing named function that does the job and either no need to define or (say because it captures a variable) no possibility of defining a suitable named function. The basic idea is FACTORING. If you know much about object-oriented programming, you may have heard of the "Template Method" design pattern. This is a method with a bunch of steps split out into separate small methods so that they can be overridden by a subclass. For example, we might have Array methods: total |r| r := self initialForTotal. self do: [:each | r := self update: r toInclude: each]. ^r initialForTotal ^0 update: r toInclude: each ^r + each Array subclass: #MyArrayOfSets methods: initialForTotal ^Set new "empty" update: r toInclude: each ^r copyWith: each "r U {each}" That's not what Smalltalk actually does. It does use the idea of a method with pluggable parts, but those pluggable parts are *parameters*. Collection methods: inject: initial into: updater |r| r := initial. self do: [:each | r := updater value: r value: each]. ^r sum ^self inject: 0 into: [:r :each | r + each] asSet ^self inject: Set new into: [:r :each | r copyWith: each] Here the basic method supplies the generic "iterate over a collection 'adding' a result into an accumulator" behaviour, and the caller supplies what 'adding' means as an anonymous function. For an Erlang example, suppose we wanted to know how many elements of a matrix (represented as a list of lists) were negative. The following code is written for clarity. lists:foldl/3 is the Erlang analogue of Smalltalk's #inject:into:. It supplies the "iterate over a collection 'adding' a result into an accumulator" behaviour and the function argument supplies what 'adding' means in any particular case. count(F, Xs) -> sum(fun (X) -> case F(X) of false -> 0 ; true -> 1 end, Xs). sum(F, Xs) -> lists:foldl(fun (S, X) -> S + X end, 0, Xs). matrix_negative_element_count(Xss) -> sum(fun (Xs) -> count(fun (X) -> X < 0 end, Xs), Xss). For another example, even C does this one: sorting. When you want to sort an array in C, you call qsort(array, sizeof array/sizeof array[0], sizeof array[0], comparison_function); If you only have one place in your program that wants to use this comparison function, why rip it bleeding out of the place where it is used and put it at top level where it might be called accidentally? And if the comparison function needs to refer to something in its context, you are in deep deep trouble. In Erlang, suppose you have a list of {Sender,Timestamp,Content} triples that you want sorted into ascending order by Timestamp. lists:sort(fun ({_,T1,_}, {_,T2,_}) -> T1 =< T2 end, Triples) does the job. By now, even C++ has anonymous functions, not to mention Objective C[++]. See http://en.wikipedia.org/wiki/Anonymous_function I lists:dropwhile From marc@REDACTED Mon Nov 26 22:13:36 2012 From: marc@REDACTED (Marc Worrell) Date: Mon, 26 Nov 2012 22:13:36 +0100 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: Message-ID: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> With me that crash was reproducible when I killed the terminal where the beam.smp was running. Guess a SIGHUP to beam.smp might be enough (didn't try it?) - Marc On 26 nov. 2012, at 21:28, acidbriggs@REDACTED wrote: > Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. > > Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. > > I know that the problem was reported to Apple but we know how that is. > > Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? > > Thanks for your time, > > > Briggs > > > > > The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: > > > Greetings, > > Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a > kernel panic using the following steps: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-W (close the terminal window without stopping erlang) > > Alternatively, if you're running SL 10.6.2 and Erlang R13B03: > > 1. Start new terminal window > 2. erl +K true -s crypto > 3. Cmd-Q (quit the terminal app without stopping erlang) > > This appears to work with either 32 or 64 bit builds of Erlang. > > > Thanks, > > D. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrkhoza@REDACTED Tue Nov 27 07:47:01 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Tue, 27 Nov 2012 08:47:01 +0200 Subject: [erlang-questions] ETS In Erlang Message-ID: Hi Erlang Developers, I would like to ask about this tuple {keypos,pos} when creating set collection in Erlang Term Storage collection. What is the effect of this tuple in the collection? What does it do on the collection's rows? Thanks for your help in advance Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Tue Nov 27 08:18:19 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 27 Nov 2012 08:18:19 +0100 Subject: [erlang-questions] ETS In Erlang In-Reply-To: References: Message-ID: >From the documentation of ets: {keypos,Pos} Specfies which element inthe stored tuples should be used as key. By default, it is the first element, i.e. Pos=1.However, this is not always appropriate. In particular, we do not want the first element to be the key if we want to store Erlang records in a table. Note that any tuple stored in the table must have at least Pos number of elements. http://erlang.org/doc/man/ets The keypos option does not change the tuples that are stored in the table, it just tell which element that should be used as key for the table in question. /Kenneth Erlang/OTP Ericsson Den 27 nov 2012 07:47 skrev "Lucky Khoza" : > Hi Erlang Developers, > > I would like to ask about this tuple {keypos,pos} when creating set > collection in Erlang Term Storage collection. > > What is the effect of this tuple in the collection? What does it do on the > collection's rows? > > Thanks for your help in advance > > Kindest Regards > Lucky > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Tue Nov 27 09:34:14 2012 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Tue, 27 Nov 2012 08:34:14 +0000 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? Message-ID: <20121127083414.GA4397@precise.local> Hello, I just wrote sets:to_list(SomeSet), and stopped for a second. So does this[1] really mean that these are equivalent, supported, and both right ways to do the same work? set:to_list(SomeSet) SomeSet:to_list() Is there an underlying message somewhere "if you can, you not necessarily should?" (I am aware that dialyzer will not understand me until R16, but this doesn't concern me now). Answer "go to hell" is also good. That way I will learn that some people do hate it and will, and I don't mind programming in subset of Erlang for the sake of common good (the same way I appreciate my colleagues keeping 80 character line limit just for me). [1]: http://www.erlang.org/news/35 Regards, Motiejus From gleber.p@REDACTED Tue Nov 27 09:50:30 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 27 Nov 2012 09:50:30 +0100 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: <20121127083414.GA4397@precise.local> References: <20121127083414.GA4397@precise.local> Message-ID: As far as I know module tuples are here to stay and will be supported part of language. On Tue, Nov 27, 2012 at 9:34 AM, Motiejus Jak?tys wrote: > Hello, > > I just wrote sets:to_list(SomeSet), and stopped for a second. So does > this[1] really mean that these are equivalent, supported, and both right > ways to do the same work? > > set:to_list(SomeSet) > SomeSet:to_list() > > Is there an underlying message somewhere "if you can, you not > necessarily should?" > > (I am aware that dialyzer will not understand me until R16, but this > doesn't concern me now). > > Answer "go to hell" is also good. That way I will learn that some people > do hate it and will, and I don't mind programming in subset of Erlang > for the sake of common good (the same way I appreciate my colleagues > keeping 80 character line limit just for me). > > [1]: http://www.erlang.org/news/35 > > Regards, > Motiejus > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrkhoza@REDACTED Tue Nov 27 10:00:20 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Tue, 27 Nov 2012 11:00:20 +0200 Subject: [erlang-questions] ETS In Erlang In-Reply-To: References: Message-ID: Hi Kenneth, I'm coming from T-SQL background, so does it mean that {keypos,pos} denotes an example of a primary key if you understand what I mean. On Tue, Nov 27, 2012 at 9:18 AM, Kenneth Lundin wrote: > From the documentation of ets: > > {keypos,Pos} Specfies which element inthe stored tuples should be used as > key. By default, it is the first element, i.e. Pos=1.However, this is not > always appropriate. In particular, we do not want the first element to be > the key if we want to store Erlang records in a table. > > Note that any tuple stored in the table must have at least Pos number of > elements. > > http://erlang.org/doc/man/ets > > The keypos option does not change the tuples that are stored in the table, > it just > tell which element that should be used as key for the table in question. > > /Kenneth Erlang/OTP Ericsson > Den 27 nov 2012 07:47 skrev "Lucky Khoza" : > >> Hi Erlang Developers, >> >> I would like to ask about this tuple {keypos,pos} when creating set >> collection in Erlang Term Storage collection. >> >> What is the effect of this tuple in the collection? What does it do on >> the collection's rows? >> >> Thanks for your help in advance >> >> Kindest Regards >> Lucky >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Tue Nov 27 10:34:48 2012 From: essen@REDACTED (=?windows-1252?Q?Lo=EFc_Hoguin?=) Date: Tue, 27 Nov 2012 10:34:48 +0100 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: <20121127083414.GA4397@precise.local> References: <20121127083414.GA4397@precise.local> Message-ID: <50B48938.9050307@ninenines.eu> On 11/27/2012 09:34 AM, Motiejus Jak?tys wrote: > Hello, > > I just wrote sets:to_list(SomeSet), and stopped for a second. So does > this[1] really mean that these are equivalent, supported, and both right > ways to do the same work? > > set:to_list(SomeSet) > SomeSet:to_list() > > Is there an underlying message somewhere "if you can, you not > necessarily should?" > > (I am aware that dialyzer will not understand me until R16, but this > doesn't concern me now). > > Answer "go to hell" is also good. That way I will learn that some people > do hate it and will, and I don't mind programming in subset of Erlang > for the sake of common good (the same way I appreciate my colleagues > keeping 80 character line limit just for me). I still don't like it. It looks like you call a /0 function when it's in fact a /1. How do you distinguish this? SomeSet:to_list() %% SomeSet = set SomeSet:to_list() %% SomeSet = {set, [stuff]} It's fine until you mess up somewhere. Another case, if you mistakenly save {ok, SomeSet} to some variable, you end up calling the module ok with a function of arity different of what you intended. That'll do wonder for error messages readability. This syntax makes no sense. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From pablo.vb80@REDACTED Tue Nov 27 10:56:08 2012 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Tue, 27 Nov 2012 10:56:08 +0100 Subject: [erlang-questions] Problem with debugger:start() Message-ID: Hi everyone, I'm not sure if it's a bug or I'm doing something wrong. When I start the debbuger, a window is showed but when I put the mouse over it, the window disappears and error messege is showed. pablo@REDACTED:~$ erl Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [kernel-poll:false] Eshell V5.9.1 (abort with ^G) 1> debugger:start(). {ok,<0.34.0>} 2> =ERROR REPORT==== 27-Nov-2012::10:47:55 === Error in process <0.34.0> with exit value: {badarith,[{dbg_ui_mon_win,handle_event,2,[{file,"dbg_ui_mon_win.erl"},{line,464}]},{dbg_ui_mon,loop,1,[{file,"dbg_ui_mon.erl"},{line,230}]}]} I'm using an Ubuntu 12.10 (32-bits) If it's a bug, I'll notify to the proper list. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Tue Nov 27 11:16:51 2012 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 27 Nov 2012 11:16:51 +0100 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: <20121127083414.GA4397@precise.local> References: <20121127083414.GA4397@precise.local> Message-ID: <1306A190-4A76-434C-8840-1ADF59B95C63@feuerlabs.com> I think this feature should only be used in places where it was so intended in the first place. Thus, not, for example, with the 'sets' API, since it only works accidentally - not by design. BR, Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 27 nov 2012 kl. 09:34 skrev Motiejus Jak?tys : > Hello, > > I just wrote sets:to_list(SomeSet), and stopped for a second. So does > this[1] really mean that these are equivalent, supported, and both right > ways to do the same work? > > set:to_list(SomeSet) > SomeSet:to_list() > > Is there an underlying message somewhere "if you can, you not > necessarily should?" > > (I am aware that dialyzer will not understand me until R16, but this > doesn't concern me now). > > Answer "go to hell" is also good. That way I will learn that some people > do hate it and will, and I don't mind programming in subset of Erlang > for the sake of common good (the same way I appreciate my colleagues > keeping 80 character line limit just for me). > > [1]: http://www.erlang.org/news/35 > > Regards, > Motiejus > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From desired.mta@REDACTED Tue Nov 27 12:25:03 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Tue, 27 Nov 2012 11:25:03 +0000 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: <1306A190-4A76-434C-8840-1ADF59B95C63@feuerlabs.com> References: <20121127083414.GA4397@precise.local> <1306A190-4A76-434C-8840-1ADF59B95C63@feuerlabs.com> Message-ID: On Tue, Nov 27, 2012 at 10:16 AM, Ulf Wiger wrote: > I think this feature should only be used in places where it was so intended in the first place. Thus, not, for example, with the 'sets' API, since it only works accidentally - not by design. This is the answer I will stick to. That means "very rarely". Thanks all for the suggestions. Besides, like Yogish said, even my example is incorrect: sets:new() returns {set, _} rather than {sets, _}, which means it does not work (I should have written "dict" for the example). Lo?c, in case of {ok, Var}: I hope Dialyzer will be smart enough to figure it out shall mistake be made. -- Motiejus Jak?tys From essen@REDACTED Tue Nov 27 12:29:06 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Tue, 27 Nov 2012 12:29:06 +0100 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: References: <20121127083414.GA4397@precise.local> <1306A190-4A76-434C-8840-1ADF59B95C63@feuerlabs.com> Message-ID: <50B4A402.6030805@ninenines.eu> On 11/27/2012 12:25 PM, Motiejus Jak?tys wrote: > Lo?c, in case of {ok, Var}: I hope Dialyzer will be smart enough to > figure it out shall mistake be made. Sometimes it will, sometimes it won't. Dialyzer is smart enough that everything it tells you is right. But that doesn't mean it told you everything wrong with your code. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From acidbriggs@REDACTED Tue Nov 27 15:16:06 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Tue, 27 Nov 2012 09:16:06 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> Message-ID: Which Terminal application are you using? I have seen other references to this panic while using iTerm2 and tmux. Perhaps this problem just appears for me when using Erlang, but perhaps it's the terminal application itself. I am using iTerm2 at the moment. I haven't tried with OS X's native Terminal yet (and I am also not all that keen on trying to crash my current machine as I really don't want to corrupt HFS+). I will try this evening with a Mac that can be used for such experiments. On Nov 26, 2012, at 4:13 PM, Marc Worrell wrote: > With me that crash was reproducible when I killed the terminal where the beam.smp was running. > Guess a SIGHUP to beam.smp might be enough (didn't try it?) > > - Marc > > On 26 nov. 2012, at 21:28, acidbriggs@REDACTED wrote: > >> Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. >> >> Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. >> >> I know that the problem was reported to Apple but we know how that is. >> >> Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? >> >> Thanks for your time, >> >> >> Briggs >> >> >> >> >> The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: >> >> >> Greetings, >> >> Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a >> kernel panic using the following steps: >> >> 1. Start new terminal window >> 2. erl +K true -s crypto >> 3. Cmd-W (close the terminal window without stopping erlang) >> >> Alternatively, if you're running SL 10.6.2 and Erlang R13B03: >> >> 1. Start new terminal window >> 2. erl +K true -s crypto >> 3. Cmd-Q (quit the terminal app without stopping erlang) >> >> This appears to work with either 32 or 64 bit builds of Erlang. >> >> >> Thanks, >> >> D. >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From g@REDACTED Tue Nov 27 15:35:45 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 27 Nov 2012 08:35:45 -0600 Subject: [erlang-questions] ETS In Erlang In-Reply-To: References: Message-ID: It denotes the position of the "primary key" that's used when you store a tuple. I find it help to experiment with code, especially using the shell. If you're confused about behavior, spend some time tinkering -- there's no substitute for it. 1> T1 = ets:new(t1, []). %% keypos defaults to 1 16400 2> ets:insert(T1, {foo, "Foo"}). true 3> ets:lookup(T1, foo). [{foo,"Foo"}] 4> ets:lookup(T1, "Foo"). [] 5> T2 =ets:new(t2, [{keypos, 2}]). 20497 6> 6> ets:insert(T2, {foo, "Foo"}). true 7> ets:lookup(T2, foo). [] 8> ets:lookup(T2, "Foo"). [{foo,"Foo"}] Garrett On Tue, Nov 27, 2012 at 3:00 AM, Lucky Khoza wrote: > Hi Kenneth, > > I'm coming from T-SQL background, so does it mean that {keypos,pos} denotes > an example of a primary key if you understand what I mean. > > > On Tue, Nov 27, 2012 at 9:18 AM, Kenneth Lundin > wrote: >> >> From the documentation of ets: >> >> {keypos,Pos} Specfies which element inthe stored tuples should be used as >> key. By default, it is the first element, i.e. Pos=1.However, this is not >> always appropriate. In particular, we do not want the first element to be >> the key if we want to store Erlang records in a table. >> >> Note that any tuple stored in the table must have at least Pos number of >> elements. >> >> http://erlang.org/doc/man/ets >> >> The keypos option does not change the tuples that are stored in the table, >> it just >> tell which element that should be used as key for the table in question. >> >> /Kenneth Erlang/OTP Ericsson >> >> Den 27 nov 2012 07:47 skrev "Lucky Khoza" : >>> >>> Hi Erlang Developers, >>> >>> I would like to ask about this tuple {keypos,pos} when creating set >>> collection in Erlang Term Storage collection. >>> >>> What is the effect of this tuple in the collection? What does it do on >>> the collection's rows? >>> >>> Thanks for your help in advance >>> >>> Kindest Regards >>> Lucky >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From marc@REDACTED Tue Nov 27 15:51:55 2012 From: marc@REDACTED (Marc Worrell) Date: Tue, 27 Nov 2012 15:51:55 +0100 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> Message-ID: I am using the default OS X Terminal.app Didn't test this with OS X 10.7+, with 10.6.x and earlier it was a sure kernel panic. - Marc On 27 nov. 2012, at 15:16, acidbriggs@REDACTED wrote: > Which Terminal application are you using? I have seen other references to this panic while using iTerm2 and tmux. Perhaps this problem just appears for me when using Erlang, but perhaps it's the terminal application itself. I am using iTerm2 at the moment. I haven't tried with OS X's native Terminal yet (and I am also not all that keen on trying to crash my current machine as I really don't want to corrupt HFS+). I will try this evening with a Mac that can be used for such experiments. > > > On Nov 26, 2012, at 4:13 PM, Marc Worrell wrote: > >> With me that crash was reproducible when I killed the terminal where the beam.smp was running. >> Guess a SIGHUP to beam.smp might be enough (didn't try it?) >> >> - Marc >> >> On 26 nov. 2012, at 21:28, acidbriggs@REDACTED wrote: >> >>> Back in March of 2010 it was reported that it was possible to initiate a kernel panic on OS X 10.6.2 with Erlang. >>> >>> Does anyone know if there is a fix for this? This is still happening in OS X 10.8.2 with Erlang R15B02. I've had it happen on all three of my Macs when working in Emacs and killing an Erlang shell in a buffer in a non-clean way. >>> >>> I know that the problem was reported to Apple but we know how that is. >>> >>> Perhaps someone has some sort of patch that can be applied to Erlang that can stop it from exploiting this flaw? >>> >>> Thanks for your time, >>> >>> >>> Briggs >>> >>> >>> >>> >>> The original thread (http://erlang.org/pipermail/erlang-questions/2010-March/050112.html) stated: >>> >>> >>> Greetings, >>> >>> Using Snow Leopard 10.6.2 and Erlang R13B04 it's possible to cause a >>> kernel panic using the following steps: >>> >>> 1. Start new terminal window >>> 2. erl +K true -s crypto >>> 3. Cmd-W (close the terminal window without stopping erlang) >>> >>> Alternatively, if you're running SL 10.6.2 and Erlang R13B03: >>> >>> 1. Start new terminal window >>> 2. erl +K true -s crypto >>> 3. Cmd-Q (quit the terminal app without stopping erlang) >>> >>> This appears to work with either 32 or 64 bit builds of Erlang. >>> >>> >>> Thanks, >>> >>> D. >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> > From norton@REDACTED Tue Nov 27 17:41:17 2012 From: norton@REDACTED (=?utf-8?B?44OO44O844OI44OzIOOCuOODp+ODvOOCu+ODlSDjgqbjgqfjgqQg?= =?utf-8?B?44Oz?=) Date: Wed, 28 Nov 2012 01:41:17 +0900 Subject: [erlang-questions] [ANN] UBF - Universal Binary Format 2.0 Message-ID: <59C921B3-E7FD-47D4-854F-87D8E7EB317B@lovely.email.ne.jp> UBF is a framework that permits Erlang and the outside world to talk with each other. The documentation and the corresponding open-source code repositories are based on Joe Armstrong?s original UBF site and code with an MIT license file added to the distribution. Since then, a large number of enhancements and improvements have been added. What's New in UBF 2.0 - The syntax for UBF(b) has been modified to align closer (but not identical) with Erlang's native type and spec declarations defined by EEP8. A subset of EEP8 types are now available as UBF(b) builtin types. - The UBF(b) builtin types +proplist()+ and +string()+ have been renamed to +ubfproplist()+ and +ubfstring()+, respectively. - An Erlang "header" file corresponding to each UBF(b) contract is automatically created in an application's ebin directory. This file contains Erlang type, spec, and record declarations that can be included by a UBF(b) contract's implementation module or by other Erlang modules. - The API and internal implementation of UBF's contract parser, contract manager, contract driver, and contract plugin handler has changed (in some places). For further information and instructions to download, please see the https://github.com/ubf/ubf repository on GitHub. For detailed documentation, please see the http://ubf.github.com/ubf/ubf-user-guide.en.html documentation on GitHub. regards, Joe N. From acidbriggs@REDACTED Tue Nov 27 17:55:03 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Tue, 27 Nov 2012 11:55:03 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> Message-ID: <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> I just had it happen in Terminal. So, it's not iTerm only. Blah. I am surprised many others aren't seeing this. Or, everyone else just properly exists their terminal sessions cleanly. I was just testing out EDTS, got an error in my erlang buffer in emacs, closed it and voila panic. I am not sure where to go from here or how to avoid this problem. Well, other than use Linux in a VM or something. Anyway, perhaps there will be a fix someday. Kernel's and the like are not my area of expertise. If there was a way to reproduce this with say a C program perhaps Apple would be more inclined to fix it. Thanks for your input, Briggs. On Nov 27, 2012, at 9:51 AM, Marc Worrell wrote: > I am using the default OS X Terminal.app > > Didn't test this with OS X 10.7+, with 10.6.x and earlier it was a sure kernel panic. > > - Marc > > On 27 nov. 2012, at 15:16, acidbriggs@REDACTED wrote: From essen@REDACTED Tue Nov 27 17:56:32 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 27 Nov 2012 17:56:32 +0100 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> Message-ID: <50B4F0C0.1020006@ninenines.eu> Is it doing it with kernel polling disabled? On 11/27/2012 05:55 PM, acidbriggs@REDACTED wrote: > I just had it happen in Terminal. So, it's not iTerm only. Blah. I am surprised many others aren't seeing this. Or, everyone else just properly exists their terminal sessions cleanly. I was just testing out EDTS, got an error in my erlang buffer in emacs, closed it and voila panic. > > I am not sure where to go from here or how to avoid this problem. Well, other than use Linux in a VM or something. Anyway, perhaps there will be a fix someday. Kernel's and the like are not my area of expertise. If there was a way to reproduce this with say a C program perhaps Apple would be more inclined to fix it. > > Thanks for your input, > > Briggs. > > On Nov 27, 2012, at 9:51 AM, Marc Worrell wrote: > >> I am using the default OS X Terminal.app >> >> Didn't test this with OS X 10.7+, with 10.6.x and earlier it was a sure kernel panic. >> >> - Marc >> >> On 27 nov. 2012, at 15:16, acidbriggs@REDACTED wrote: > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From bob@REDACTED Tue Nov 27 18:02:23 2012 From: bob@REDACTED (Bob Ippolito) Date: Tue, 27 Nov 2012 12:02:23 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> Message-ID: I believe Apple fixed it years ago, but you'll have to upgrade your OS to 10.7 or 10.8 to get that fix. On Tue, Nov 27, 2012 at 11:55 AM, wrote: > I just had it happen in Terminal. So, it's not iTerm only. Blah. I am > surprised many others aren't seeing this. Or, everyone else just properly > exists their terminal sessions cleanly. I was just testing out EDTS, got an > error in my erlang buffer in emacs, closed it and voila panic. > > I am not sure where to go from here or how to avoid this problem. Well, > other than use Linux in a VM or something. Anyway, perhaps there will be a > fix someday. Kernel's and the like are not my area of expertise. If there > was a way to reproduce this with say a C program perhaps Apple would be > more inclined to fix it. > > Thanks for your input, > > Briggs. > > On Nov 27, 2012, at 9:51 AM, Marc Worrell wrote: > > > I am using the default OS X Terminal.app > > > > Didn't test this with OS X 10.7+, with 10.6.x and earlier it was a sure > kernel panic. > > > > - Marc > > > > On 27 nov. 2012, at 15:16, acidbriggs@REDACTED wrote: > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acidbriggs@REDACTED Tue Nov 27 18:06:36 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Tue, 27 Nov 2012 12:06:36 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <50B4F0C0.1020006@ninenines.eu> References: <9C6D5642-C4A9-47A5-BCE9-81A17171CE0E@worrell.nl> <39A18033-EC89-412E-AAF4-4D73F42FEC58@gmail.com> <50B4F0C0.1020006@ninenines.eu> Message-ID: On Nov 27, 2012, at 11:56 AM, Lo?c Hoguin wrote: > Is it doing it with kernel polling disabled? Correct: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] On Nov 27, 2012, at 12:02 PM, Bob Ippolito wrote: > I believe Apple fixed it years ago, but you'll have to upgrade your OS to 10.7 or 10.8 to get that fix I am running 10.8.2 From jeraymond@REDACTED Tue Nov 27 18:47:52 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Tue, 27 Nov 2012 12:47:52 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster Message-ID: Hi, I'm using the gen_leader behaviour from [1] in a 3 node Erlang cluster. I'm running into a situation where if I down one of the nodes and bring it back up, when it rejoins the cluster the other nodes still see it as being down as reported by gen_leader:down/1. However the cycled node itself sees the other two nodes as being up. If I cycle the other two nodes, then all three will agree again on all of the nodes being available. This doesn't happen all every time I down a node, but quite often. Another (related?) issue I sometimes see is that gen_leader:down/1 sometimes reports the same node as being down multiple times in the returned list. The node that is being misreported as being down is still able to make requests to the leader and when I cycle the other nodes leader election appears to behave normally. Any ideas on the misreporting of the downed node? The misreporting of the downed node makes me think that the leader election may not be working correctly and that the cluster is in an invalid or inconsistent state. [1]: https://github.com/abecciu/gen_leader_revival -- Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Nov 27 22:23:48 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 28 Nov 2012 10:23:48 +1300 Subject: [erlang-questions] tuple modules, or Set:to_list() is official? In-Reply-To: <20121127083414.GA4397@precise.local> References: <20121127083414.GA4397@precise.local> Message-ID: <7640F3D5-243A-4FAD-BF93-245F700467A0@cs.otago.ac.nz> On 27/11/2012, at 9:34 PM, Motiejus Jak?tys wrote: > Hello, > > I just wrote sets:to_list(SomeSet), and stopped for a second. So does > this[1] really mean that these are equivalent, supported, and both right > ways to do the same work? > > set:to_list(SomeSet) > SomeSet:to_list() _Please_ don't use SomeSet:to_list(). When you write set:to_list(Some_Set) it is crystal clear what's happening and if due to a bug somewhere Some_Set happens not to be a well-formed set the error will be caught. If you were to write Some_Set:to_list(), *I* would not know what was going to happen without tediously tracing through the code to find out what kind of value Some_Set was; the *compiler* would not know without similar tracing; cross-referencing wouldn't help nearly so much; and above all an error might not be noticed as quickly at run time or even at all. Erlang is not an object-oriented language, by design. Verbosity is a price that should only be paid if it buys you something worth having. I suggest that easier understanding, better type checking, and better navigation are worth having. From andrew@REDACTED Wed Nov 28 05:35:06 2012 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 27 Nov 2012 23:35:06 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster In-Reply-To: References: Message-ID: <20121128043506.GD24714@hijacked.us> On Tue, Nov 27, 2012 at 12:47:52PM -0500, Jeremy Raymond wrote: > Hi, > > I'm using the gen_leader behaviour from [1] in a 3 node Erlang cluster. I'm > running into a situation where if I down one of the nodes and bring it back > up, when it rejoins the cluster the other nodes still see it as being down > as reported by gen_leader:down/1. However the cycled node itself sees the > other two nodes as being up. If I cycle the other two nodes, then all three > will agree again on all of the nodes being available. This doesn't happen > all every time I down a node, but quite often. Another (related?) issue I > sometimes see is that gen_leader:down/1 sometimes reports the same node as > being down multiple times in the returned list. > Would you mind trying the branch at https://github.com/Vagabond/gen_leader_revival/tree/netsplit-tolerance This branch contains a bunch of work I did to work around these kinds of issues that Basho was seeing with gen_leader. Anfrew From andrew@REDACTED Wed Nov 28 07:47:46 2012 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 28 Nov 2012 01:47:46 -0500 Subject: [erlang-questions] error_logger heap overflow In-Reply-To: <1353410937.92586.YahooMailNeo@web120706.mail.ne1.yahoo.com> References: <1353404860.96882.YahooMailNeo@web120706.mail.ne1.yahoo.com> <1353410937.92586.YahooMailNeo@web120706.mail.ne1.yahoo.com> Message-ID: <20121128064746.GE24714@hijacked.us> On Tue, Nov 20, 2012 at 03:28:57AM -0800, Bogdan Andu wrote: > I used that, lager, but it is hard to read error messages, and the errors are duplicated across all log files. > > One cannot say to lager: commit notice messages to /var/log/notice_log, because all error messages with higher prority get written there, too. I decided to tinker around this week in relation to this issue and came up with this: https://github.com/basho/lager/pull/95 Does that address your concern on that front? > I like how error_logger prints the errors and I am used to it. > > Please give me an advice of how to overcome this situation. > One thing you could do would be to fork the stdlib (or SASL) error_logger gen_event handlers to use lager_format instead of io_lib (lager_format is a fork of io_lib with size based truncation added to avoid the OOM issues). The only downside to this is that lager_format currently lacks the line-wrapping support ~p and friends have in io_lib, so stacktraces, for example, end up on one big line rather than being line wrapped nicely. Also, with regard to lager and formatting OTP errors, lager will try to rewrite common OTP errors into more 'friendly' log messages, but it will also write a truncated version of the original log format to the 'crash.log', if more information is required. Finally, if you could give me more information on what makes lager's messages 'hard to read', I'd appreciate it. Maybe some improvements can be made. Hope that helps, Andrew From mrkhoza@REDACTED Wed Nov 28 11:23:14 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Wed, 28 Nov 2012 12:23:14 +0200 Subject: [erlang-questions] Supervision Tree Message-ID: Hi Erlang Developers, I'm actually trying to understand and compile the following module code, and i don't understand why the init/1 function takes an argument which it doesn't use at all, so when i try to compile the module it complains about the argument _Args because it's unused. May someone help me understand the use of this argument? -module(ch_sup). -behaviour(supervisor). -export([start_link/0]). -export([init/1]). start_link() -> supervisor:start_link(ch_sup, []). init(_Args) -> {ok, {{one_for_one, 1, 60}, [{ch3, {ch3, start_link, []}, permanent, brutal_kill, worker, [ch3]}]}}. Thanks for a lot for your help, i really appreciate it. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Nov 28 11:34:35 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Nov 2012 11:34:35 +0100 Subject: [erlang-questions] Supervision Tree In-Reply-To: References: Message-ID: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, First let me mention that I prefer to never mix call back code that runs in a special process (in this case the supervision process) with code used by other processes. So, start_link/0 is better off in another module. Secondly, if you have a variable with _ first in the name the compiler should not complain about it not being used. What is your compile command? Last, _Args is the [] from supervisor:start_link/2 ebngt On Wed, 2012-11-28 at 12:23 +0200, Lucky Khoza wrote: > Hi Erlang Developers, > > I'm actually trying to understand and compile the following module > code, and i don't understand why the init/1 function takes an argument > which it doesn't use at all, so when i try to compile the module it > complains about the argument _Args because it's unused. > > May someone help me understand the use of this argument? > > -module(ch_sup). > -behaviour(supervisor). > > -export([start_link/0]). > -export([init/1]). > > start_link() -> > supervisor:start_link(ch_sup, []). > > init(_Args) -> > {ok, {{one_for_one, 1, 60}, > [{ch3, {ch3, start_link, []}, > permanent, brutal_kill, worker, [ch3]}]}}. > > > Thanks for a lot for your help, i really appreciate it. > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Wed Nov 28 12:29:59 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Nov 2012 12:29:59 +0100 Subject: [erlang-questions] disconnect from a remote node Message-ID: Hi all, Maybe I'm missing something obvious, but can I disconnect from another node once connected to it? There is no net_adm:disconnect/1... I managed to connect together ~250 nodes that were independent and now each consumes ~2% cpu just for managing the distribution. They will be restarted clean in their due time, but it would feel better if I could restore the quiet sooner than that. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Wed Nov 28 12:38:00 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Wed, 28 Nov 2012 11:38:00 +0000 Subject: [erlang-questions] disconnect from a remote node In-Reply-To: References: Message-ID: On Wed, Nov 28, 2012 at 11:29 AM, Vlad Dumitrescu wrote: > Hi all, > > Maybe I'm missing something obvious, but can I disconnect from another node > once connected to it? There is no net_adm:disconnect/1... erlang:disconnect_node/1 -- Motiejus Jak?tys From vladdu55@REDACTED Wed Nov 28 12:41:16 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 28 Nov 2012 12:41:16 +0100 Subject: [erlang-questions] disconnect from a remote node In-Reply-To: References: Message-ID: Thanks a lot, I always use net_* and ti didn't occur to me to chack the erlang module... regards, Vlad On Wed, Nov 28, 2012 at 12:38 PM, Motiejus Jak?tys wrote: > On Wed, Nov 28, 2012 at 11:29 AM, Vlad Dumitrescu > wrote: > > Hi all, > > > > Maybe I'm missing something obvious, but can I disconnect from another > node > > once connected to it? There is no net_adm:disconnect/1... > > erlang:disconnect_node/1 > > -- > Motiejus Jak?tys > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed Nov 28 13:23:30 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 28 Nov 2012 07:23:30 -0500 Subject: [erlang-questions] Supervision Tree In-Reply-To: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: <20121128122327.GA860@ferdmbp.local.tld> I'm not sure I'm understanding you right. Do you advocate never wrapping function calls to special processes (i.e. all OTP behaviours) in a functional interface, and basically just letting people use whatever to call them? I don't know why, but I'm somewhat cringing at the idea of code that makes things like the registration it uses (local, global, via), stats logging calls, any modification it wraps around the data, and so on, a burden on all the callers rather than keeping it unique in one place. Not using wrapper functions makes it harder to test (and mock), change the interface or implementation (supervisor -> supervisor_bridge, or using a protected ETS table for quick reads rather than messaging the process), document (no EDoc goes there), and type check (no restrictive type specs possible to declare). Maybe you instead meant that you would have something like 'myapp_serv.erl' only doing raw gen_server callbacks, and then another module 'myapp_api' that does the wrapping, in which case that sounds much better as a compromise and wouldn't have me frothing at the mouth if I ended up maintaining that code base (in which case, disregard the two paragraphs before this one) :) Regards, Fred. On 11/28, Bengt Kleberg wrote: > Greetings, > > First let me mention that I prefer to never mix call back code that runs > in a special process (in this case the supervision process) with code > used by other processes. So, start_link/0 is better off in another > module. > > Secondly, if you have a variable with _ first in the name the compiler > should not complain about it not being used. What is your compile > command? > > Last, _Args is the [] from supervisor:start_link/2 > > > ebngt > > On Wed, 2012-11-28 at 12:23 +0200, Lucky Khoza wrote: > > Hi Erlang Developers, > > > > I'm actually trying to understand and compile the following module > > code, and i don't understand why the init/1 function takes an argument > > which it doesn't use at all, so when i try to compile the module it > > complains about the argument _Args because it's unused. > > > > May someone help me understand the use of this argument? > > > > -module(ch_sup). > > -behaviour(supervisor). > > > > -export([start_link/0]). > > -export([init/1]). > > > > start_link() -> > > supervisor:start_link(ch_sup, []). > > > > init(_Args) -> > > {ok, {{one_for_one, 1, 60}, > > [{ch3, {ch3, start_link, []}, > > permanent, brutal_kill, worker, [ch3]}]}}. > > > > > > Thanks for a lot for your help, i really appreciate it. > > Kindest Regards > > Lucky > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From yashgt@REDACTED Wed Nov 28 13:29:08 2012 From: yashgt@REDACTED (Yash Ganthe) Date: Wed, 28 Nov 2012 04:29:08 -0800 (PST) Subject: [erlang-questions] Problems Building Erlang on AIX 5.3 In-Reply-To: <170543c70905191115k51bf226dg847908f5cb0a60e5@mail.gmail.com> References: <170543c70905191115k51bf226dg847908f5cb0a60e5@mail.gmail.com> Message-ID: <45fdffeb-cae4-411c-87ec-a36256d88787@googlegroups.com> Did you succeed in building Erlang for AIX with any of the compilers? On Tuesday, May 19, 2009 2:15:39 PM UTC-4, Michael Mabin wrote: > > Hi everyone. I'm getting compiler syntax errors when I execute make (GNU > make) to build erlang on AIX 5.3. > > Like: > > "beam/beam_emu.c", line 1117.32: 1506-221 (S) Initializer must be a valid > constant expression. > > I'm using AIX's xlc compiler. Is there anyone that has had success with > building Erlang on AIX 5.3 who can offer some tips or warnings about doing > this on AIX and using the xlc compiler? > > Thanks. > > Michael > > -- > | _ | * | _ | > | _ | _ | * | > | * | * | * | > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Wed Nov 28 13:42:55 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 28 Nov 2012 13:42:55 +0100 Subject: [erlang-questions] Supervision Tree In-Reply-To: <20121128122327.GA860@ferdmbp.local.tld> References: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> <20121128122327.GA860@ferdmbp.local.tld> Message-ID: <1354106575.10780.17.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Yes, I use 2 modules. One for the interface and one for the call back functions. Actually, make that 2 or 3. If the 2 modules need to share functions I do not want to have a circular dependency. bengt On Wed, 2012-11-28 at 07:23 -0500, Fred Hebert wrote: > I'm not sure I'm understanding you right. Do you advocate never wrapping > function calls to special processes (i.e. all OTP behaviours) in a > functional interface, and basically just letting people use whatever to > call them? > > I don't know why, but I'm somewhat cringing at the idea of code that > makes things like the registration it uses (local, global, via), stats > logging calls, any modification it wraps around the data, and so on, a > burden on all the callers rather than keeping it unique in one place. > > Not using wrapper functions makes it harder to test (and mock), change > the interface or implementation (supervisor -> supervisor_bridge, or > using a protected ETS table for quick reads rather than messaging the > process), document (no EDoc goes there), and type check (no restrictive > type specs possible to declare). > > Maybe you instead meant that you would have something like > 'myapp_serv.erl' only doing raw gen_server callbacks, and then another > module 'myapp_api' that does the wrapping, in which case that sounds > much better as a compromise and wouldn't have me frothing at the mouth > if I ended up maintaining that code base (in which case, disregard the > two paragraphs before this one) :) > > Regards, > Fred. > > On 11/28, Bengt Kleberg wrote: > > Greetings, > > > > First let me mention that I prefer to never mix call back code that runs > > in a special process (in this case the supervision process) with code > > used by other processes. So, start_link/0 is better off in another > > module. > > > > Secondly, if you have a variable with _ first in the name the compiler > > should not complain about it not being used. What is your compile > > command? > > > > Last, _Args is the [] from supervisor:start_link/2 > > > > > > ebngt > > > > On Wed, 2012-11-28 at 12:23 +0200, Lucky Khoza wrote: > > > Hi Erlang Developers, > > > > > > I'm actually trying to understand and compile the following module > > > code, and i don't understand why the init/1 function takes an argument > > > which it doesn't use at all, so when i try to compile the module it > > > complains about the argument _Args because it's unused. > > > > > > May someone help me understand the use of this argument? > > > > > > -module(ch_sup). > > > -behaviour(supervisor). > > > > > > -export([start_link/0]). > > > -export([init/1]). > > > > > > start_link() -> > > > supervisor:start_link(ch_sup, []). > > > > > > init(_Args) -> > > > {ok, {{one_for_one, 1, 60}, > > > [{ch3, {ch3, start_link, []}, > > > permanent, brutal_kill, worker, [ch3]}]}}. > > > > > > > > > Thanks for a lot for your help, i really appreciate it. > > > Kindest Regards > > > Lucky > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions From send2philip@REDACTED Wed Nov 28 15:06:19 2012 From: send2philip@REDACTED (Philip Clarke) Date: Wed, 28 Nov 2012 14:06:19 +0000 Subject: [erlang-questions] swapping tables in mnesia Message-ID: Hi, Is it possible to swap or replace tables in mnesia ? For example, say I have a file which is read and parsed by some erlang process and then stored in a mnesia table. When it is ready, the table data is used by some other processes. Then at some later time, I get a new version of the file. I don't want to delete the existing table and load it up from the new file (the system would not be able to function during the load time). I would like for example to load up to a table called e.g. temp and when that has finished, replace my existing table with the temp table. One option I considered is to just keep loading up to new tables e.g. version1, version2, version3 etc. and then have another table which keeps the name of the table to use. I'm interested to hear if anyone has a better solution. Thanks Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Wed Nov 28 16:08:21 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 28 Nov 2012 16:08:21 +0100 Subject: [erlang-questions] Erlang/OTP R15B03 has been released Message-ID: Erlang/OTP R15B03 has been released. This is the third service release for R15B This release mainly contains a number of bug fixes as well as smaller user contributions (but as usual there are some new functionality as well). One thing worth to mention is a bugfix regarding the use of the "-heart" in combination with the Erlang crash dump function. To solve the problem that heart quite often will kill the Erlang VM before the crashdump is completed we have been forced to introduce a small potential incompatibility. The incompatibility is that the environment variable ERL_CRASH_DUMP_SECONDS must be set in order to get any Erlang crash dump at all. See the readme file and the documentation for more details. You can find the README file with more detailed info at http://www.erlang.org/download/otp_src_R15B03.readme You can download the full source distribution from http://www.erlang.org/download/otp_src_R15B03.tar.gz http://www.erlang.org/download/otp_src_R15B02.readme (this file) Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README that is part of the distribution. You can also find this release at the official Erlang/OTP Git-repository at Github here: https://github.com/erlang/otp/tree/OTP_R15B03 (i.e. on the maint branch tag= OTP_R15B02) The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R15B03.exe http://www.erlang.org/download/otp_win64_R15B03.exe On-line documentation can be found at http://www.erlang.org/doc/. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R15B03.tar.gz http://www.erlang.org/download/otp_doc_man_R15B03.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The Erlang/OTP Team at Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Wed Nov 28 16:21:57 2012 From: g@REDACTED (Garrett Smith) Date: Wed, 28 Nov 2012 09:21:57 -0600 Subject: [erlang-questions] Supervision Tree In-Reply-To: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: On Wed, Nov 28, 2012 at 4:34 AM, Bengt Kleberg wrote: > Greetings, > > First let me mention that I prefer to never mix call back code that runs > in a special process (in this case the supervision process) with code > used by other processes. So, start_link/0 is better off in another > module. I would disagree with this in general and especially for someone starting out in Erlang. There might be cases where separating the client and server implementations into two modules makes sense, but it's not typical. There are a couple things I like to do to clarify the two very distinct layers in a gen_server/service module: - Provide separate export attributes: one for the client facing API and another for the process callbacks - Separate the two types of functions within the module at top and bottom and denote them with clear comment banners E.g. %%% ============================== %%% Public API %%% ============================== ... %%% ============================== %%% Callbacks %%% ============================== ... Certainly this is a matter of usability, so devs should use whatever works best for a particular case. But it's far more common to see a single module for this. Garrett From g@REDACTED Wed Nov 28 16:29:37 2012 From: g@REDACTED (Garrett Smith) Date: Wed, 28 Nov 2012 09:29:37 -0600 Subject: [erlang-questions] Supervision Tree In-Reply-To: References: Message-ID: On Wed, Nov 28, 2012 at 4:23 AM, Lucky Khoza wrote: > Hi Erlang Developers, > > I'm actually trying to understand and compile the following module code, and > i don't understand why the init/1 function takes an argument which it > doesn't use at all, so when i try to compile the module it complains about > the argument _Args because it's unused. > > May someone help me understand the use of this argument? > > -module(ch_sup). > -behaviour(supervisor). > > -export([start_link/0]). > -export([init/1]). > > start_link() -> > supervisor:start_link(ch_sup, []). > > init(_Args) -> > {ok, {{one_for_one, 1, 60}, > [{ch3, {ch3, start_link, []}, > permanent, brutal_kill, worker, [ch3]}]}}. > As Bengt pointed out, the leading underscore for the arg will tell the compiler to not complain. It doesn't change the meaning of the variable, however -- it will still be bound to the value used in the function call, you can use it expressions, etc. As for why it takes an argument in the first place, the function is a callback that's part of a "behavior" contract. This is an important pattern in Erlang -- anytime you declare that a module implements a behavior, you're stating that it exports a list of functions with specific arities (argument count). If you don't export what's expected of the behavior, the compiler will complain. If you don't happen to use an argument, in a behavior callback or any function, add an underscore to the name, as you have, and all will be well. Garrett From mononcqc@REDACTED Wed Nov 28 16:50:55 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 28 Nov 2012 10:50:55 -0500 Subject: [erlang-questions] Erlang/OTP R15B03 has been released In-Reply-To: References: Message-ID: <20121128155052.GA1182@ferdmbp.local> Thanks for the work on this release! I'm hijacking the thread a bit to let people know I've just updated erlang-history, my 'patch' to add persistent shell history support to Erlang, to support R15B03. The source is available at https://github.com/ferd/erlang-history Thanks again, Fred. On 11/28, Kenneth Lundin wrote: > Erlang/OTP R15B03 has been released. This is the third service release for > R15B > > This release mainly contains a number of bug fixes as well as smaller user > contributions (but as > usual there are some new functionality as well). > > One thing worth to mention is a bugfix regarding the use of the "-heart" > in combination with the Erlang crash dump function. > To solve the problem that heart quite often will kill the Erlang VM before > the crashdump is completed we have been forced to > introduce a small potential incompatibility. The incompatibility is that > the environment > variable ERL_CRASH_DUMP_SECONDS must be set in order to get any Erlang > crash dump at all. > See the readme file and the documentation for more details. > > You can find the README file with more detailed info at > http://www.erlang.org/download/otp_src_R15B03.readme > > You can download the full source distribution from > > http://www.erlang.org/download/otp_src_R15B03.tar.gz > http://www.erlang.org/download/otp_src_R15B02.readme (this file) > > Note: To unpack the TAR archive you need a GNU TAR compatible program. > > For installation instructions please read the README that is part of > the distribution. > > You can also find this release at the official Erlang/OTP Git-repository at > Github here: > https://github.com/erlang/otp/tree/OTP_R15B03 (i.e. on the maint branch > tag= OTP_R15B02) > > The Windows binary distribution can be downloaded from > > http://www.erlang.org/download/otp_win32_R15B03.exe > http://www.erlang.org/download/otp_win64_R15B03.exe > > > On-line documentation can be found at http://www.erlang.org/doc/. > You can also download the complete HTML documentation or the Unix manual > files > > http://www.erlang.org/download/otp_doc_html_R15B03.tar.gz > http://www.erlang.org/download/otp_doc_man_R15B03.tar.gz > > We also want to thank those that sent us patches, suggestions and bug > reports, > > The Erlang/OTP Team at Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From avalormaquedano@REDACTED Wed Nov 28 17:29:23 2012 From: avalormaquedano@REDACTED (=?ISO-8859-1?B?wWx2YXJv?=) Date: Wed, 28 Nov 2012 17:29:23 +0100 Subject: [erlang-questions] Anonymous functions or callback module - Performance Message-ID: Hi Erlangers, I have a question regarding the pros and cons of using anonymous functions instead of functions stored in a callback module. Let me introduce my program: I need to handle lists of functions e.g.: FList = [F1,F2,F3] where I must then use them in the following way ( given some term X): Result1 = F1(X), [... some other computations] Result2 = F2(Result1), [... some other computations] Result3 = F3(Result2), Now, I am defining FList = F1...F3 as FList = [F1 = fun callback_module:fun_1/1 end... F1 = fun callback_module:fun_3/1]. The problem is the following: If I recompile and load the code for the callback module (hot code swapping) the output of some functions (e.g. Result2 from F2) may not be suitable for consequent ones (e.g. F3), as these latter ones are using the updated version of the code. A possible solution can be defining the list of functions as: FList = [F1 = fun (X) -> X+1 end, ..., F3 = fun(X) -> X *2 end] (of course these functions do not invoke any code that could be hot swapped) My question is: Shall I expect a big decrease of the performance if I use the second alternative? The list of functions can be quite big (maybe few hundreds of functions). I must say that the callback module is always the same for the functions appearing in the same list of functions (so all these would be loaded if the module is loaded, right?). I hope I have made my problem clear. Any help will be much appreciated. Cheers, ?lvaro -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.majadas@REDACTED Wed Nov 28 17:45:22 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Wed, 28 Nov 2012 17:45:22 +0100 Subject: [erlang-questions] [ANN] Kucumberl, an erlang implementation of cucumber Message-ID: Hi, list. We've just released Kucumberl, a Cucumber[1] implementation for erlang. It's a tool for running automated acceptance tests written in a Behavior Driven Development (BDD) style. This code is released under an apache 2.0 license. All comments, code or issues are welcome. https://github.com/openshine/kucumberl Happy hacking Roberto [1] http://cukes.info/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mharrell-keyword-erlang.a034fe@REDACTED Wed Nov 28 19:38:20 2012 From: mharrell-keyword-erlang.a034fe@REDACTED (Matthew Harrell) Date: Wed, 28 Nov 2012 13:38:20 -0500 Subject: [erlang-questions] erl_parse.yrl structs? Message-ID: <20121128183820.GA20048@bittwiddlers.com> While we were mucking around in stdlib/erl_parse.yrl we noticed a commented out Nonterminal called struct: struct -> atom tuple : {struct, .... Is this just a relic from the past from before records came to life? From cbenac@REDACTED Wed Nov 28 20:10:34 2012 From: cbenac@REDACTED (Clara Benac Earle) Date: Wed, 28 Nov 2012 20:10:34 +0100 Subject: [erlang-questions] PropEr and determinism of statem scenario execution In-Reply-To: References: Message-ID: <50B661AA.5060203@fi.upm.es> Hi Paul, McErlang does give you control over schedulers thus it might help you to solve your problem. If you want to give McErlang a try we are more than happy to help you with it. Please contact us either on the mcerlang-questions mailing list or just send me an email. Looking forward to hearing from you, Clara (co-creator of McErlang) On 11/23/2012 12:32 PM, Paul Peregud wrote: > Hi everyone! > > This is a PropEr-related question. I am developing a distributed > algorithm for broadcasting messages, with very specific requirements > (which are not really relevant to the problem, but prohibits use of > e.g. Paxos in my case). > > Situation is following: I want to test a distributed algorithm. It's > goal - synchronization of state consisting of sequence of broadcasted > messages. Configuration is following - there are N actors, each actor > implements publish/2 that adds new entry to cache and broadcasts. > Actors are communicating, trying to achieve consistent state of cache > among all of them. Actors are unreliable - they can be added and they > may crash. > > My test case is a sequence of commands from following set: [actor_up, > actor_down, publish]. My "system under test" is a process that starts > actors, shuts them down and publishes new messages. It also collects > reports that actors provide and provides that reports as a material > for postcondition that checks cache consistency. > > The problem - I don't have a control over schedulers. That leads to > scenarios that MAY OR MAY NOT fail. And that causes problems with > shrinking. As a result after a night of crunching scenarios on a fast > machine I get a test case of 70 steps that is impossible to debug, > because it is too large. When I repeat this test case using > proper:check/2, it fails very seldom. > > I've tried to tackle the problem in following way. > I have introduced an execution token. An actor is waiting in selective > receive for the token, when it gets it, it takes one message from it's > queue and processes it. After that token is returned to proper tester > process and can be passed to another actor. > > This approach is not good enough, because every generated scenario > passes. I can think of one reason only - if actors A and B perform and > they both send 2 messages (upon receiving the execution token) to > actor C then actors C queue may look only like that: [A1, A2, B1, B2]. > In real life scenario queue [A1, B1, A2, B2] is also possible. > > I understand that I can modify actors even more and introduce more > fine-grained control over their actions - execution token will be > returned after one single message sent. But this approach feels like > an ugly hack. Is there a more general way to deal with this problem? > Is it possible to achieve fine-grained concurrent simulation using > Proper/Quickcheck? > > Any ideas are welcome! > > As far as I understand McErlang solves this problem in a more low > level way, but I have never heard it used for practical problems. Did > anyone used it to test non-academic systems? Any success stories here? > How hard is it to use? > > Best regards, > Paul Peregud > +48602112091 > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.goertzen@REDACTED Wed Nov 28 21:36:21 2012 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Wed, 28 Nov 2012 14:36:21 -0600 Subject: [erlang-questions] Anonymous functions or callback module - Performance In-Reply-To: References: Message-ID: Take a look at http://www.erlang.org/doc/efficiency_guide/functions.htmlfor the cost of various calls. Now the document only talks about the relative cost of various calls. Perhaps call cost pales in comparison to the cost of executing your functions. Benchmarking is the only way to find out for sure if call cost is relevant for you. This code... FList = [F1 = fun callback_module:fun_1/1 end... F1 = fun callback_module:fun_3/1]. ... has led me to another question for the mailing list: Will these funs automatically use a new version of loaded module or are they permanently fixed to the old version? Dan. On Wed, Nov 28, 2012 at 10:29 AM, ?lvaro wrote: > Hi Erlangers, > > I have a question regarding the pros and cons of using anonymous functions > instead of functions stored in a callback module. > > Let me introduce my program: > > I need to handle lists of functions e.g.: FList = [F1,F2,F3] where I must > then use them in the following way ( given some term X): > > Result1 = F1(X), > [... some other computations] > Result2 = F2(Result1), > [... some other computations] > Result3 = F3(Result2), > > Now, I am defining FList = F1...F3 as > FList = [F1 = fun callback_module:fun_1/1 end... F1 = fun > callback_module:fun_3/1]. > > The problem is the following: > > If I recompile and load the code for the callback module (hot code > swapping) the output of some functions (e.g. Result2 from F2) may not be > suitable for consequent ones (e.g. F3), as these latter ones are using the > updated version of the code. > > A possible solution can be defining the list of functions as: > FList = [F1 = fun (X) -> X+1 end, ..., F3 = fun(X) -> X *2 end] > (of course these functions do not invoke any code that could be hot > swapped) > > > My question is: > > Shall I expect a big decrease of the performance if I use the second > alternative? The list of functions can be quite big (maybe few hundreds of > functions). > > I must say that the callback module is always the same for the functions > appearing in the same list of functions (so all these would be loaded if > the module is loaded, right?). > > > > I hope I have made my problem clear. > Any help will be much appreciated. > Cheers, > ?lvaro > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Wed Nov 28 22:03:09 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Wed, 28 Nov 2012 22:03:09 +0100 Subject: [erlang-questions] Anonymous functions or callback module - Performance In-Reply-To: References: Message-ID: <50B67C0D.3020605@gmail.com> On 2012-11-28 21:36, Daniel Goertzen wrote: > This code... > > FList = [F1 = fun callback_module:fun_1/1 end... F1 = fun > callback_module:fun_3/1]. > > ... has led me to another question for the mailing list: Will these > funs automatically use a new version of loaded module or are they > permanently fixed to the old version? > > Dan. Yes, those symbolic funs using the "fun foo:bar/1" notation always use the latest version of the module when you apply them. They are not tied to any particular module version. (However, funs that use the syntax "fun foo/1", are tied to that version of the module, just as if they had been written "fun (X) -> foo(X) end", since the function foo(X) isn't necessarily exported.) /Richard From dmkolesnikov@REDACTED Wed Nov 28 22:10:40 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 28 Nov 2012 23:10:40 +0200 Subject: [erlang-questions] -spec tuple variable size Message-ID: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> Hello, I am trying to make a -spec for tuple of variable size but same time I'd like to restrict the type of its elements. Looking into http://www.erlang.org/doc/reference_manual/typespec.html, there is a construction Tuple :: tuple() | {} | {TList} TList :: Type | Type, TList but compiler fails syntax error before: ',' -- CLIP -- -type value() :: string() | binary() | number() | boolean() | undefined. -type entity() :: [{atom(), value()}] | {field()}. -type field() :: value() | value(), field(). -- CLIP -- Do you have any advices on the issue? Thanks in advanced! - Dmitry From desired.mta@REDACTED Wed Nov 28 22:50:03 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Wed, 28 Nov 2012 21:50:03 +0000 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> Message-ID: On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov wrote: > but compiler fails syntax error before: ',' > > -- CLIP -- > -type value() :: string() | binary() | number() | boolean() | undefined. > -type entity() :: [{atom(), value()}] | {field()}. These should be fine. > -type field() :: value() | value(), field(). Maybe you meant -type field() :: value() | {value(), field()}. ? In general, if you want to define tuples of different sizes in -spec, you use the "|" operator to define as many variants as you like. Likely I don't understand what you are trying to define. -- Motiejus Jak?tys From dmkolesnikov@REDACTED Wed Nov 28 23:10:01 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 00:10:01 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> Message-ID: <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> Hello, Thanks for response! Let me explain better what I am trying to achieve. "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." I am looking for similar definition but for tuples. My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) - Dmitry On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: > On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov > wrote: >> but compiler fails syntax error before: ',' >> >> -- CLIP -- >> -type value() :: string() | binary() | number() | boolean() | undefined. >> -type entity() :: [{atom(), value()}] | {field()}. > > These should be fine. > >> -type field() :: value() | value(), field(). > > Maybe you meant > -type field() :: value() | {value(), field()}. > > ? > > In general, if you want to define tuples of different sizes in -spec, > you use the "|" operator to define as many variants as you like. > > Likely I don't understand what you are trying to define. > > -- > Motiejus Jak?tys From chandrashekhar.mullaparthi@REDACTED Wed Nov 28 23:19:32 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 28 Nov 2012 22:19:32 +0000 Subject: [erlang-questions] swapping tables in mnesia In-Reply-To: References: Message-ID: -record(my_data, {a, b, c}). -record(sys_state, {key, value}). mnesia:create_table(my_data_1, [{record_info(fields, my_data), {record_name, my_data}, blah, blah]). mnesia:create_table(my_data_2, [{record_info(fields, my_data), {record_name, my_data}, blah, blah]). mnesia:create_table(sys_state, [{record_info(fields, sys_state), blah, blah}]). mnesia:dirty_write(#sys_state{key = active_table, value = my_data_1}). active_table() -> case mnesia:dirty_read(sys_state, active_table) of [] -> my_data_1; [#sys_state{value= V}] -> V end. standby_table() -> case active_table() of my_data_1 -> my_data_2; my_data_2 -> my_data_1 end. swap_tables() -> mnesia:dirty_write(#sys_state{key = active_table, value = standby_table()}). upload_new_data() -> write_data_to_standby_table(), swap_tables(). read_data_from_table() -> mnesia:dirty_read(active_table(), blah). cheers Chandru On 28 November 2012 14:06, Philip Clarke wrote: > Hi, > > Is it possible to swap or replace tables in mnesia ? > > For example, say I have a file which is read and parsed by some erlang > process and then stored in a mnesia table. When it is ready, the table > data is used by some other processes. > > Then at some later time, I get a new version of the file. I don't want to > delete the existing table and load it up from the new file (the system > would not be able to function during the load time). > > I would like for example to load up to a table called e.g. temp and when > that has finished, replace my existing table with the temp table. > > One option I considered is to just keep loading up to new tables e.g. > version1, version2, version3 etc. and then have another table which keeps > the name of the table to use. I'm interested to hear if anyone has a > better solution. > > Thanks > Philip > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Thu Nov 29 01:01:32 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 28 Nov 2012 18:01:32 -0600 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: Message of "Tue\, 27 Nov 2012 12\:06\:36 EST." Message-ID: <18745.1354147292@snookles.snookles.com> acidbriggs@REDACTED wrote: a> On Nov 27, 2012, at 11:56 AM, Lo?c Hoguin wrote: >> Is it doing it with kernel polling disabled? a> Correct: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] a> [async-threads:0] [hipe] [kernel-poll:false] Howdy. It's been several months since I've seen this kernel panic, but it has indeed happened to me while using Terminal.app and closing a window while Riak was running inside. Riak typically uses +K true, FWIW. Lion was the last time. I haven't been running Mountain Lion long enough + an Erlang VM running in a Terminal.app window + closing that window. -Scott From fritchie@REDACTED Thu Nov 29 01:24:30 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 28 Nov 2012 18:24:30 -0600 Subject: [erlang-questions] PropEr and determinism of statem scenario execution In-Reply-To: Message of "Fri, 23 Nov 2012 12:32:08 +0100." Message-ID: <20056.1354148670@snookles.snookles.com> Paul Peregud wrote: pp> Hi everyone! This is a PropEr-related question. [...] pp> The problem - I don't have a control over schedulers. That leads to pp> scenarios that MAY OR MAY NOT fail. And that causes problems with pp> shrinking. As a result after a night of crunching scenarios on a pp> fast machine I get a test case of 70 steps that is impossible to pp> debug, because it is too large. When I repeat this test case using pp> proper:check/2, it fails very seldom. Just guessing here, but it sounds like you're describing a situation where there's a side-effect that your model isn't accounting for. That thing is usually time, either using erlang:now() or os:timestamp() or erlang:time() or something like that. State that happens to be lying around in the file system that affects your code is also a fun source of nondeterminism. You can try something like this (untested): L = [begin {_, Before, _} = now(), Res = (catch true = proper:check(Property, CounterExample)), {_, After, _} = now(), {After - Before, Res} end || _ <- lists:seq(1,400)]. FailL = [Secs || {Secs, Res} <- L, Res /= true]. ... and then see how many items in FailL cross a wall-clock-second-tick boundary. It helps if the normal execution time is less than 1 second. :-) The only real solution is find all sources of nondeterminism, wall-clock or whatever source, and stamp them out. -Scott From ok@REDACTED Thu Nov 29 01:30:02 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 29 Nov 2012 13:30:02 +1300 Subject: [erlang-questions] Supervision Tree In-Reply-To: References: Message-ID: <93DB7B8B-4725-4990-AF4B-7EEF3FEE911F@cs.otago.ac.nz> (1) When I paste your code into a file and compile it with erlc, there are no complaints. (2) Your start_link() calls supervisor:start_link(ch_sup, []) which calls ch_sup:init([]) ^^arg1 ^^arg2 If you called supervisor:start_link(robots, [gort,r2d2]) it would call back to robots:init([gort,r2d2]). This is explained in the documentation for the supervisor: module http://www.erlang.org/doc/man/supervisor.html#start_link-2 which says Module is the name of the callback module. Args is an arbitrary term which is passed as the argument to Module:init/1. For a non-trivial example, I looked in the OTP sources and found snmpm_supervisor.erl, which has start_link(Type, Opts) -> ?d("start_link -> entry with" "~n Opts: ~p", [Opts]), SupName = {local, ?MODULE}, supervisor:start_link(SupName, ?MODULE, [Type, Opts]). ... init([Opts]) when is_list(Opts) -> %% OTP-5963: Due to the addition init([normal, Opts]); %% OTP-5963: of server_sup init([Type, Opts]) -> ?d("init -> entry with" "~n Type: ~p" "~n Opts: ~p", [Type, Opts]), Restart = get_restart(Opts), Flags = {one_for_all, 0, 3600}, Config = worker_spec(snmpm_config, [Opts], Restart, [gen_server]), MiscSup = sup_spec(snmpm_misc_sup, [], Restart), ServerSup = sup_spec(snmpm_server_sup, [Type, Opts], Restart), Sups = [Config, MiscSup, ServerSup], {ok, {Flags, Sups}}. From jws@REDACTED Thu Nov 29 01:38:50 2012 From: jws@REDACTED (Jeff Schultz) Date: Thu, 29 Nov 2012 11:38:50 +1100 Subject: [erlang-questions] Anonymous functions or callback module - Performance In-Reply-To: References: Message-ID: <20121129003850.GA19625@mulga.csse.unimelb.edu.au> On Wed, Nov 28, 2012 at 05:29:23PM +0100, lvaro wrote: > A possible solution can be defining the list of functions as: > FList = [F1 = fun (X) -> X+1 end, ..., F3 = fun(X) -> X *2 end] > (of course these functions do not invoke any code that could be hot swapped) Just beware of reloading the module they are defined in. After the second reload, they'll be purged anyway and calling them will fail. I'm not sure that I understand your problem correctly, but if you must gather a collection of functions to call in a pipeline, and you want to ensure that they all "stick together" for each use of the pipeline, even during arbitrary code-reloads, then you probably must put them in a unique module or modules for each version of the pipeline. You'll have to manage the module name generation and cleaning up old modules manually though. Jeff Schultz From YurinVV@REDACTED Thu Nov 29 05:05:30 2012 From: YurinVV@REDACTED (Slava Yurin) Date: Thu, 29 Nov 2012 11:05:30 +0700 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> Message-ID: <420701354161930@web30h.yandex.ru> An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Thu Nov 29 07:20:17 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Thu, 29 Nov 2012 08:20:17 +0200 Subject: [erlang-questions] GenObjects Message-ID: Hi Erlang Developers, Where can I learn about GenObjects? The website names. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Thu Nov 29 07:37:01 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 29 Nov 2012 19:37:01 +1300 Subject: [erlang-questions] GenObjects In-Reply-To: References: Message-ID: On 29/11/2012, at 7:20 PM, Lucky Khoza wrote: > Hi Erlang Developers, > > Where can I learn about GenObjects? The website names. You aren't talking about http://www.generativeobjects.com/ are you? Or http://www.ohloh.net/p/genobjects? Or otp_src_R15B03/lib/stdlib/test/select_SUITE.erl? How did you get to hear of about GenObjects? Try asking there. From mrkhoza@REDACTED Thu Nov 29 07:48:17 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Thu, 29 Nov 2012 08:48:17 +0200 Subject: [erlang-questions] GenObjects In-Reply-To: References: Message-ID: Hi Richard, I got to hear about GenObjects from other Erlang Developer, so He mentioned something like it is being used to manipulate records. Regards Lucky On Thu, Nov 29, 2012 at 8:37 AM, Richard O'Keefe wrote: > > On 29/11/2012, at 7:20 PM, Lucky Khoza wrote: > > > Hi Erlang Developers, > > > > Where can I learn about GenObjects? The website names. > > You aren't talking about http://www.generativeobjects.com/ > are you? Or http://www.ohloh.net/p/genobjects? > Or otp_src_R15B03/lib/stdlib/test/select_SUITE.erl? > > How did you get to hear of about GenObjects? > Try asking there. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Nov 29 09:12:58 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 29 Nov 2012 09:12:58 +0100 Subject: [erlang-questions] Supervision Tree In-Reply-To: References: <1354098875.10780.12.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: <1354176779.4722.9.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, It is especially for beginners that I have found benefits with separating the interface and the callbacks into two modules. It helps them to mentally separate the the two very distinct parts(*) in any Erlang/OTP behaviour. Experienced Erlang programmers handle the one module mash-up much better. bengt (*) 1: Interface to server that runs in the callers process 2: Server callbacks that runs in the servers process On Wed, 2012-11-28 at 09:21 -0600, Garrett Smith wrote: > On Wed, Nov 28, 2012 at 4:34 AM, Bengt Kleberg > wrote: > > Greetings, > > > > First let me mention that I prefer to never mix call back code that runs > > in a special process (in this case the supervision process) with code > > used by other processes. So, start_link/0 is better off in another > > module. > > I would disagree with this in general and especially for someone > starting out in Erlang. There might be cases where separating the > client and server implementations into two modules makes sense, but > it's not typical. > > There are a couple things I like to do to clarify the two very > distinct layers in a gen_server/service module: > > - Provide separate export attributes: one for the client facing API > and another for the process callbacks > > - Separate the two types of functions within the module at top and > bottom and denote them with clear comment banners > > E.g. > > %%% ============================== > %%% Public API > %%% ============================== > > ... > > %%% ============================== > %%% Callbacks > %%% ============================== > > ... > > Certainly this is a matter of usability, so devs should use whatever > works best for a particular case. But it's far more common to see a > single module for this. > > Garrett From avalormaquedano@REDACTED Thu Nov 29 11:42:36 2012 From: avalormaquedano@REDACTED (=?ISO-8859-1?B?wWx2YXJv?=) Date: Thu, 29 Nov 2012 11:42:36 +0100 Subject: [erlang-questions] Anonymous functions or callback module - Performance In-Reply-To: <20121129003850.GA19625@mulga.csse.unimelb.edu.au> References: <20121129003850.GA19625@mulga.csse.unimelb.edu.au> Message-ID: Thanks a lot for your answers. > Just beware of reloading the module they are defined in. After the > second reload, they'll be purged anyway and calling them will fail. > I didn't know that the second reload purges the fun definitions. That forces me to make further changes to my implementation, as module reloading is to be expected with some frequence and the time lapse between the execution of the first and last functions can be big enough to allow two or more reloads. Cheers, ?lvaro > I'm not sure that I understand your problem correctly, but if you > must gather a collection of functions to call in a pipeline, and you > >> >> want to ensure that they all "stick together" for each use of the > pipeline, even during arbitrary code-reloads, then you probably must > put them in a unique module or modules for each version of the > pipeline. You'll have to manage the module name generation and > cleaning up old modules manually though. > > > Jeff Schultz > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.majadas@REDACTED Thu Nov 29 12:29:42 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Thu, 29 Nov 2012 12:29:42 +0100 Subject: [erlang-questions] [ANN] Kucumberl, an erlang implementation of cucumber In-Reply-To: References: Message-ID: Thanks! What do you mean with "examples with guard clauses" ? Roberto 2012/11/29 Tom Janssens > Looks great! I would consider adding examples with guard clauses as well, > as that might be the killer feature of erlang step definitions! > > Op woensdag 28 november 2012 17:45:22 UTC+1 schreef Roberto Majadas Lopez > het volgende: > >> Hi, list. >> >> We've just released Kucumberl, a Cucumber[1] implementation for erlang. >> It's a tool for running automated acceptance tests written in a Behavior >> Driven Development (BDD) style. >> >> This code is released under an apache 2.0 license. All comments, code or >> issues are welcome. >> >> https://github.com/openshine/**kucumberl >> >> Happy hacking >> >> Roberto >> >> [1] http://cukes.info/ >> > -- Roberto Majadas OpenShine S.L email : roberto.majadas@REDACTED tlf : +34 663 273 501 www.openshine.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Thu Nov 29 12:43:40 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Thu, 29 Nov 2012 13:43:40 +0200 Subject: [erlang-questions] Erlang Different Versions Message-ID: Hi Erlang Developers, I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, and I have already installed version of Erlang R15B02 (erts-5.9.2) using homebrew, however my question is: how possible is that to install different versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same UNIX OS? And how do I go about doing that? or Should I create new folder for each version in order to switch amongst them because we have systems that are written with different versions of Erlang. Your help is much appreciated. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.gafiyatullin@REDACTED Thu Nov 29 12:51:22 2012 From: r.gafiyatullin@REDACTED (Roman Gafiyatullin) Date: Thu, 29 Nov 2012 14:51:22 +0300 Subject: [erlang-questions] Erlang Different Versions In-Reply-To: References: Message-ID: <688B2BC8E95945BC8E83BC94C075D807@me.com> I usually build OTP from sources running `./configure --prefix=/opt/otp-r15b02` makes it installed into the named location. I also put something like the following into my ~/.bashrc or ~/.profile: PATH_NO_OTP=$PATH function use-15b01() { export PATH="/opt/otp-r15b01/bin:${PATH_NO_OTP}" } function use-15b02() { export PATH="/opt/otp-r15b02/bin:${PATH_NO_OTP}" } And switch the version of OTP to use executing one of the declared functions. -- Roman Gafiyatullin +375-33-6025080 On Thursday, November 29, 2012 at 2:43 pm, Lucky Khoza wrote: > Hi Erlang Developers, > > I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, and I have already installed version of Erlang R15B02 (erts-5.9.2) using homebrew, however my question is: how possible is that to install different versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same UNIX OS? And how do I go about doing that? or Should I create new folder for each version in order to switch amongst them because we have systems that are written with different versions of Erlang. > > Your help is much appreciated. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Nov 29 12:57:57 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 29 Nov 2012 12:57:57 +0100 Subject: [erlang-questions] Erlang Different Versions In-Reply-To: <688B2BC8E95945BC8E83BC94C075D807@me.com> References: <688B2BC8E95945BC8E83BC94C075D807@me.com> Message-ID: I find "kerl" [1] the best tool for installing and managing multiple Erlang installations. 1: https://github.com/spawngrid/kerl On Thu, Nov 29, 2012 at 12:51 PM, Roman Gafiyatullin wrote: > I usually build OTP from sources running `./configure > --prefix=/opt/otp-r15b02` makes it installed into the named location. > > I also put something like the following into my ~/.bashrc or ~/.profile: > > PATH_NO_OTP=$PATH > > function use-15b01() { > export PATH="/opt/otp-r15b01/bin:${PATH_NO_OTP}" > } > > function use-15b02() { > export PATH="/opt/otp-r15b02/bin:${PATH_NO_OTP}" > } > > And switch the version of OTP to use executing one of the declared > functions. > -- > Roman Gafiyatullin > +375-33-6025080 > > On Thursday, November 29, 2012 at 2:43 pm, Lucky Khoza wrote: > > Hi Erlang Developers, > > I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, > and I have already installed version of Erlang R15B02 (erts-5.9.2) using > homebrew, however my question is: how possible is that to install different > versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same > UNIX OS? And how do I go about doing that? or Should I create new folder for > each version in order to switch amongst them because we have systems that > are written with different versions of Erlang. > > Your help is much appreciated. > > Kindest Regards > Lucky > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From xapwing@REDACTED Thu Nov 29 13:00:06 2012 From: xapwing@REDACTED (Arie van Wingerden) Date: Thu, 29 Nov 2012 13:00:06 +0100 Subject: [erlang-questions] Problem with R15B03 installer for Windows Message-ID: Hi, during the install on my 32 bits Windows 8, the installer tries to install VCredist X64, which of course fails. Also the BIN directory is missing after installation! Regards, /Arie -------------- next part -------------- An HTML attachment was scrubbed... URL: From dch@REDACTED Thu Nov 29 13:06:16 2012 From: dch@REDACTED (Dave Cottlehuber) Date: Thu, 29 Nov 2012 13:06:16 +0100 Subject: [erlang-questions] Problem with R15B03 installer for Windows In-Reply-To: References: Message-ID: On 29 November 2012 13:00, Arie van Wingerden wrote: > Hi, > during the install on my 32 bits Windows 8, the installer tries to install > VCredist X64, which of course fails. > > Also the BIN directory is missing after installation! That's because the vcredist isn't installed, so install.exe and other bits don't get to run. As a workaround you could install the appropriate vcredist x86 prior. Has the OTP team switched to using mingw for builds now, or are you still using the cygwin suite? A+ Dave From fly@REDACTED Thu Nov 29 13:29:34 2012 From: fly@REDACTED (Fred Youhanaie) Date: Thu, 29 Nov 2012 12:29:34 +0000 Subject: [erlang-questions] Erlang Different Versions In-Reply-To: References: Message-ID: <50B7552E.9080905@anydata.co.uk> Hi I have been using modules[1] for a number of years now, for erlang/otp and other packages. Initial configuration of modules is a little involved, but it pays dividends once you're up and running. It works fine for Linux, I think Mac OS X should be OK too. Once modules is installed and configured, you need to tell it about the various packages. You need to install the various versions of the packages somewhere away from default paths, say, /opt/erlang-R15B02 and /opt/erlang-R15B03. Once you have told modules about the versions, a sequence like the following is all you need during the normal course of your work: $ module add erlang/R15B02 # R15B02 is in PATH and MANPATH $ module rm erlang/R15B02 # R15B02 is out of the way $ module add erlang/R15B03 # R15B03 $ module switch erlang/R15B02 # back to R15B02. R15B03 is out See the web site for examples etc. Cheers Fred [1] http://modules.sourceforge.net/ On 29/11/12 11:43, Lucky Khoza wrote: > Hi Erlang Developers, > > I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, > and I have already installed version of Erlang R15B02 (erts-5.9.2) using > homebrew, however my question is: how possible is that to install different > versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same > UNIX OS? And how do I go about doing that? or Should I create new folder > for each version in order to switch amongst them because we have systems > that are written with different versions of Erlang. > > Your help is much appreciated. > > Kindest Regards > Lucky > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Thu Nov 29 14:33:50 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 29 Nov 2012 13:33:50 +0000 Subject: [erlang-questions] Erlang Different Versions In-Reply-To: <50B7552E.9080905@anydata.co.uk> References: <50B7552E.9080905@anydata.co.uk> Message-ID: I've used kerl to do this sometimes, and others just a simple shell script: https://github.com/hyperthunk/evm On 29 Nov 2012, at 12:29, Fred Youhanaie wrote: > Hi > > I have been using modules[1] for a number of years now, for erlang/otp and other packages. Initial configuration of modules is a little involved, but it pays dividends once you're up and running. It works fine for Linux, I think Mac OS X should be OK too. > > Once modules is installed and configured, you need to tell it about the various packages. > > You need to install the various versions of the packages somewhere away from default paths, say, /opt/erlang-R15B02 and /opt/erlang-R15B03. > Once you have told modules about the versions, a sequence like the following is all you need during the normal course of your work: > > $ module add erlang/R15B02 # R15B02 is in PATH and MANPATH > $ module rm erlang/R15B02 # R15B02 is out of the way > $ module add erlang/R15B03 # R15B03 > $ module switch erlang/R15B02 # back to R15B02. R15B03 is out > > See the web site for examples etc. > > Cheers > Fred > > [1] http://modules.sourceforge.net/ > > On 29/11/12 11:43, Lucky Khoza wrote: >> Hi Erlang Developers, >> >> I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, >> and I have already installed version of Erlang R15B02 (erts-5.9.2) using >> homebrew, however my question is: how possible is that to install different >> versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same >> UNIX OS? And how do I go about doing that? or Should I create new folder >> for each version in order to switch amongst them because we have systems >> that are written with different versions of Erlang. >> >> Your help is much appreciated. >> >> Kindest Regards >> Lucky >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From acidbriggs@REDACTED Thu Nov 29 14:44:51 2012 From: acidbriggs@REDACTED (acidbriggs@REDACTED) Date: Thu, 29 Nov 2012 08:44:51 -0500 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: <18745.1354147292@snookles.snookles.com> References: <18745.1354147292@snookles.snookles.com> Message-ID: I have decided to just avoid the problem by using a windowed version of GNU Emacs instead of being a purist and using a terminal application. I am very new to Erlang (and I find it wonderful) and have finally become an emacs convert after all these wasted years using other tools. I wanted to really learn emacs without any help from a mouse so I opted for the terminal. If I can easily avoid this problem by using the windowed version of GNU emacs then so be it. I hope Apple will fix the bug in the kernel as this is just an open security/stability issue if it can be easily exploited (which it seems it can). Anyway, my guess is most people aren't coding in the terminal and that would reduce the risk of the panic. On Nov 28, 2012, at 7:01 PM, Scott Lystig Fritchie wrote: > acidbriggs@REDACTED wrote: > > a> On Nov 27, 2012, at 11:56 AM, Lo?c Hoguin wrote: > >>> Is it doing it with kernel polling disabled? > > a> Correct: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] > a> [async-threads:0] [hipe] [kernel-poll:false] > > Howdy. It's been several months since I've seen this kernel panic, but > it has indeed happened to me while using Terminal.app and closing a > window while Riak was running inside. Riak typically uses +K true, > FWIW. Lion was the last time. I haven't been running Mountain Lion > long enough + an Erlang VM running in a Terminal.app window + closing > that window. > > -Scott From dch@REDACTED Thu Nov 29 14:52:15 2012 From: dch@REDACTED (Dave Cottlehuber) Date: Thu, 29 Nov 2012 14:52:15 +0100 Subject: [erlang-questions] Problem with R15B03 installer for Windows In-Reply-To: References: Message-ID: On 29 November 2012 13:21, Arie van Wingerden wrote: > Dave, > > i already had installed VCredist X86 before installation. > But to be sure I: > - uninstalled Erlang R15B03 > - installed VCredist X86 sp1 > - installed Erlang R15B03 again > > Same results: > - it tries to install VCredist X64 > - bin directory is missing after installation of Erlang yuck! What happens if you run Install.exe manually? IIRC that's the bit that will set up bin. Has install.ini & erl.ini been updated with anything? A+ Dave From max.lapshin@REDACTED Thu Nov 29 14:56:00 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 29 Nov 2012 16:56:00 +0300 Subject: [erlang-questions] Erlang initiated kernel panic on OSX In-Reply-To: References: <18745.1354147292@snookles.snookles.com> Message-ID: It is a wrong guess. Most people have never met this bug, because they use keyboard in Terminal and close it with Ctrl+D after exiting Erlang with Ctrl+C On Thu, Nov 29, 2012 at 5:44 PM, wrote: > I have decided to just avoid the problem by using a windowed version of > GNU Emacs instead of being a purist and using a terminal application. I am > very new to Erlang (and I find it wonderful) and have finally become an > emacs convert after all these wasted years using other tools. I wanted to > really learn emacs without any help from a mouse so I opted for the > terminal. If I can easily avoid this problem by using the windowed version > of GNU emacs then so be it. I hope Apple will fix the bug in the kernel as > this is just an open security/stability issue if it can be easily exploited > (which it seems it can). > > Anyway, my guess is most people aren't coding in the terminal and that > would reduce the risk of the panic. > > > On Nov 28, 2012, at 7:01 PM, Scott Lystig Fritchie > wrote: > > > acidbriggs@REDACTED wrote: > > > > a> On Nov 27, 2012, at 11:56 AM, Lo?c Hoguin wrote: > > > >>> Is it doing it with kernel polling disabled? > > > > a> Correct: Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] > > a> [async-threads:0] [hipe] [kernel-poll:false] > > > > Howdy. It's been several months since I've seen this kernel panic, but > > it has indeed happened to me while using Terminal.app and closing a > > window while Riak was running inside. Riak typically uses +K true, > > FWIW. Lion was the last time. I haven't been running Mountain Lion > > long enough + an Erlang VM running in a Terminal.app window + closing > > that window. > > > > -Scott > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Thu Nov 29 16:30:37 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 17:30:37 +0200 Subject: [erlang-questions] Erlang Different Versions In-Reply-To: References: <50B7552E.9080905@anydata.co.uk> Message-ID: I am using symbolic links lrwxr-xr-x 1 root wheel 11B Nov 23 23:11 otp -> otp_R15B02/ drwxr-xr-x 4 root wheel 136B Nov 23 23:10 otp_R15B02 drwxr-xr-x 4 root wheel 136B May 15 21:43 otp_R15B drwxr-xr-x 4 root wheel 136B Apr 10 19:25 otp_R14B02 otp is manually configured, complied and installed - Dmitry On Nov 29, 2012, at 3:33 PM, Tim Watson wrote: > I've used kerl to do this sometimes, and others just a simple shell script: https://github.com/hyperthunk/evm > > On 29 Nov 2012, at 12:29, Fred Youhanaie wrote: > >> Hi >> >> I have been using modules[1] for a number of years now, for erlang/otp and other packages. Initial configuration of modules is a little involved, but it pays dividends once you're up and running. It works fine for Linux, I think Mac OS X should be OK too. >> >> Once modules is installed and configured, you need to tell it about the various packages. >> >> You need to install the various versions of the packages somewhere away from default paths, say, /opt/erlang-R15B02 and /opt/erlang-R15B03. >> Once you have told modules about the versions, a sequence like the following is all you need during the normal course of your work: >> >> $ module add erlang/R15B02 # R15B02 is in PATH and MANPATH >> $ module rm erlang/R15B02 # R15B02 is out of the way >> $ module add erlang/R15B03 # R15B03 >> $ module switch erlang/R15B02 # back to R15B02. R15B03 is out >> >> See the web site for examples etc. >> >> Cheers >> Fred >> >> [1] http://modules.sourceforge.net/ >> >> On 29/11/12 11:43, Lucky Khoza wrote: >>> Hi Erlang Developers, >>> >>> I'm actually using Software Mac OS X Lion 10.7.5 (11G63) to run UNIX OS, >>> and I have already installed version of Erlang R15B02 (erts-5.9.2) using >>> homebrew, however my question is: how possible is that to install different >>> versions [R12N-5-1, R13B04-0, R14A-0, R14A-0, R14B01-1] of Erlang in same >>> UNIX OS? And how do I go about doing that? or Should I create new folder >>> for each version in order to switch amongst them because we have systems >>> that are written with different versions of Erlang. >>> >>> Your help is much appreciated. >>> >>> Kindest Regards >>> Lucky >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Thu Nov 29 16:41:54 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 17:41:54 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <420701354161930@web30h.yandex.ru> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <420701354161930@web30h.yandex.ru> Message-ID: Hello, No this do not work! here is my snippet -- CLIP -- -type entity() :: tuple(integer()). -spec create(atom(), entity()) -> ok. create(abc, {1, 1}) test.erl:237: The call test:create('abc',{1,1}) will never return since the success typing is (any(),{integer()}) -> 'ok' -- CLIP -- - Dmitry On Nov 29, 2012, at 6:05 AM, Slava Yurin wrote: > Hi, Dmitry. > > May be "tuple(Type)" help you? > > -type my_tuple() :: tuple(integer()). % {1}, {1,1}, {1, ...} > > 29.11.2012, 05:10, "Dmitry Kolesnikov" : >> Hello, >> >> Thanks for response! >> Let me explain better what I am trying to achieve. >> "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." >> I am looking for similar definition but for tuples. >> >> My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) >> >> - Dmitry >> >> On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: >> >> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >> wrote: >> but compiler fails syntax error before: ',' >> >> -- CLIP -- >> -type value() :: string() | binary() | number() | boolean() | undefined. >> -type entity() :: [{atom(), value()}] | {field()}. >> These should be fine. >> -type field() :: value() | value(), field(). >> Maybe you meant >> -type field() :: value() | {value(), field()}. >> >> ? >> >> In general, if you want to define tuples of different sizes in -spec, >> you use the "|" operator to define as many variants as you like. >> >> Likely I don't understand what you are trying to define. >> >> -- >> Motiejus Jak?tys >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Thu Nov 29 16:52:29 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 29 Nov 2012 16:52:29 +0100 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <420701354161930@web30h.yandex.ru> Message-ID: Hello! Are you really sure you need to use tuples? How do you match on the tuples if you don't know their length? How do you access the elements in the tuple? 2012/11/29 Dmitry Kolesnikov : > Hello, > > No this do not work! > here is my snippet > > -- CLIP -- > -type entity() :: tuple(integer()). > > -spec create(atom(), entity()) -> ok. > create(abc, {1, 1}) > > test.erl:237: The call test:create('abc',{1,1}) will never return since the > success typing is (any(),{integer()}) -> 'ok' > > -- CLIP -- > > - Dmitry > > > On Nov 29, 2012, at 6:05 AM, Slava Yurin wrote: > > Hi, Dmitry. > > May be "tuple(Type)" help you? > > -type my_tuple() :: tuple(integer()). % {1}, {1,1}, {1, ...} > > 29.11.2012, 05:10, "Dmitry Kolesnikov" : > > Hello, > > Thanks for response! > Let me explain better what I am trying to achieve. > "The shorthand [T,...] stands for the set of non-empty proper lists whose > elements are of type T." > I am looking for similar definition but for tuples. > > My application serialises tuples into disk. The size of tuple is unbound but > tuple elements a fixed to string, binary, number, boolean or undefined. I > cannot use " "|" operator to define as many variants as you like" because > number of variants is unlimited. Well practically, I do have a hard limit of > 4096 elements per tuple but I am lazy to type in 4096 variants :-) > > - Dmitry > > On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys > wrote: > > On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov > wrote: > > but compiler fails syntax error before: ',' > > -- CLIP -- > -type value() :: string() | binary() | number() | boolean() | > undefined. > -type entity() :: [{atom(), value()}] | {field()}. > > These should be fine. > > -type field() :: value() | value(), field(). > > Maybe you meant > -type field() :: value() | {value(), field()}. > > ? > > In general, if you want to define tuples of different sizes in -spec, > you use the "|" operator to define as many variants as you like. > > Likely I don't understand what you are trying to define. > > -- > Motiejus Jak?tys > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From siraaj@REDACTED Thu Nov 29 17:03:07 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Thu, 29 Nov 2012 11:03:07 -0500 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> Message-ID: I don't know all the technicalities of Erlang's type specs, but in general - variable growth is antithetical to the concept of a tuple. You'll still need to accumulate the elements in some list before you convert it to a tuple, so why not just spec that list? On Nov 28, 2012, at 5:10 PM, Dmitry Kolesnikov wrote: > Hello, > > Thanks for response! > Let me explain better what I am trying to achieve. > "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." > I am looking for similar definition but for tuples. > > My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) > > - Dmitry > > On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: > >> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >> wrote: >>> but compiler fails syntax error before: ',' >>> >>> -- CLIP -- >>> -type value() :: string() | binary() | number() | boolean() | undefined. >>> -type entity() :: [{atom(), value()}] | {field()}. >> >> These should be fine. >> >>> -type field() :: value() | value(), field(). >> >> Maybe you meant >> -type field() :: value() | {value(), field()}. >> >> ? >> >> In general, if you want to define tuples of different sizes in -spec, >> you use the "|" operator to define as many variants as you like. >> >> Likely I don't understand what you are trying to define. -- Siraaj Khandkar .o. ..o ooo From dmkolesnikov@REDACTED Thu Nov 29 17:08:35 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 18:08:35 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> Message-ID: Hello, Yes, you are right that tuples are converted into list during the serialisation process. You cannot avoid it but api offered to client uses tuples. - Dmitry On Nov 29, 2012, at 6:03 PM, Siraaj Khandkar wrote: > I don't know all the technicalities of Erlang's type specs, but in general - > variable growth is antithetical to the concept of a tuple. > > You'll still need to accumulate the elements in some list before you convert > it to a tuple, so why not just spec that list? > > > On Nov 28, 2012, at 5:10 PM, Dmitry Kolesnikov wrote: > >> Hello, >> >> Thanks for response! >> Let me explain better what I am trying to achieve. >> "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." >> I am looking for similar definition but for tuples. >> >> My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) >> >> - Dmitry >> >> On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: >> >>> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >>> wrote: >>>> but compiler fails syntax error before: ',' >>>> >>>> -- CLIP -- >>>> -type value() :: string() | binary() | number() | boolean() | undefined. >>>> -type entity() :: [{atom(), value()}] | {field()}. >>> >>> These should be fine. >>> >>>> -type field() :: value() | value(), field(). >>> >>> Maybe you meant >>> -type field() :: value() | {value(), field()}. >>> >>> ? >>> >>> In general, if you want to define tuples of different sizes in -spec, >>> you use the "|" operator to define as many variants as you like. >>> >>> Likely I don't understand what you are trying to define. > > -- > Siraaj Khandkar > .o. > ..o > ooo > From siraaj@REDACTED Thu Nov 29 17:24:03 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Thu, 29 Nov 2012 11:24:03 -0500 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> Message-ID: <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> Hmmm, IDK, that just seems wrong to me. If what you're offering clients is a variable number of elements, then, semantically, you're offering them a list. If a client wants to optimize lookups, it should be left up to the client app to convert it to a tuple. If you think about it, you're asking for a static guarantee for something that is only known at runtime, which is not possible. Alternatively, I guess you can write a template that expands to 4096 elements :) On Nov 29, 2012, at 11:08 AM, Dmitry Kolesnikov wrote: > Hello, > > Yes, you are right that tuples are converted into list during the serialisation process. You cannot avoid it but api offered to client uses tuples. > > - Dmitry > > On Nov 29, 2012, at 6:03 PM, Siraaj Khandkar wrote: > >> I don't know all the technicalities of Erlang's type specs, but in general - >> variable growth is antithetical to the concept of a tuple. >> >> You'll still need to accumulate the elements in some list before you convert >> it to a tuple, so why not just spec that list? >> >> >> On Nov 28, 2012, at 5:10 PM, Dmitry Kolesnikov wrote: >> >>> Hello, >>> >>> Thanks for response! >>> Let me explain better what I am trying to achieve. >>> "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." >>> I am looking for similar definition but for tuples. >>> >>> My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) >>> >>> - Dmitry >>> >>> On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: >>> >>>> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >>>> wrote: >>>>> but compiler fails syntax error before: ',' >>>>> >>>>> -- CLIP -- >>>>> -type value() :: string() | binary() | number() | boolean() | undefined. >>>>> -type entity() :: [{atom(), value()}] | {field()}. >>>> >>>> These should be fine. >>>> >>>>> -type field() :: value() | value(), field(). >>>> >>>> Maybe you meant >>>> -type field() :: value() | {value(), field()}. >>>> >>>> ? >>>> >>>> In general, if you want to define tuples of different sizes in -spec, >>>> you use the "|" operator to define as many variants as you like. >>>> >>>> Likely I don't understand what you are trying to define. -- Siraaj Khandkar .o. ..o ooo From jeraymond@REDACTED Thu Nov 29 17:24:49 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Thu, 29 Nov 2012 11:24:49 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster In-Reply-To: <20121128043506.GD24714@hijacked.us> References: <20121128043506.GD24714@hijacked.us> Message-ID: I gave that branch a try. I'm still seeing misreported downed nodes. I should see correct gen_leader:down/1 and gen_leader:alive/1 lists on all nodes correct? -- Jeremy On Tue, Nov 27, 2012 at 11:35 PM, Andrew Thompson wrote: > On Tue, Nov 27, 2012 at 12:47:52PM -0500, Jeremy Raymond wrote: > > Hi, > > > > I'm using the gen_leader behaviour from [1] in a 3 node Erlang cluster. > I'm > > running into a situation where if I down one of the nodes and bring it > back > > up, when it rejoins the cluster the other nodes still see it as being > down > > as reported by gen_leader:down/1. However the cycled node itself sees the > > other two nodes as being up. If I cycle the other two nodes, then all > three > > will agree again on all of the nodes being available. This doesn't happen > > all every time I down a node, but quite often. Another (related?) issue I > > sometimes see is that gen_leader:down/1 sometimes reports the same node > as > > being down multiple times in the returned list. > > > > Would you mind trying the branch at > > https://github.com/Vagabond/gen_leader_revival/tree/netsplit-tolerance > > This branch contains a bunch of work I did to work around these kinds > of issues that Basho was seeing with gen_leader. > > Anfrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xapwing@REDACTED Thu Nov 29 17:39:59 2012 From: xapwing@REDACTED (Arie van Wingerden) Date: Thu, 29 Nov 2012 17:39:59 +0100 Subject: [erlang-questions] Errors in download page for Windows R15B03 Message-ID: Hi, in download page there is an entry "R15B03 Windows Binary File (92.5 MB)" pointing to otp_win64_r15b03.exe (should be the 32 bit version). There is also this entry "R15B02 Windows 64 Bit Binary File" pointing to otp_win64_r15b03.exe (the text should read R15B03) Hope it can be fixed :-) Regards, /Arie -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Thu Nov 29 17:43:34 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Thu, 29 Nov 2012 17:43:34 +0100 Subject: [erlang-questions] Fwd:SSL accept timeout broken in R15B03? Message-ID: Fwd from erlang-bugs: Hi Steve! There is a missing function clause to handle the ssl:ssl_accept-timeout so alas it was treated as a canceled timeout. I failed to realize that we needed a special test case for the accept case when I solved the problem with client side timeouts for ssl:recv. The client side timeout is a problem for accept/connect too and is solved by the same mechanism with the only difference being the following clause: index 87cf49d..102dd4a 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1001,6 +1001,10 @@ handle_info({cancel_start_or_recv, RecvFrom}, connection = StateName, #state{sta gen_fsm:reply(RecvFrom, {error, timeout}), {next_state, StateName, State#state{start_or_recv_from = undefined}, get_timeout(State)}; +handle_info({cancel_start_or_recv, RecvFrom}, StateName, State) when connection =/= StateName-> + gen_fsm:reply(RecvFrom, {error, timeout}), + {next_state, StateName, State#state{start_or_recv_from = undefined}, get_timeout(State)}; + handle_info({cancel_start_or_recv, _RecvFrom}, StateName, State) -> {next_state, StateName, State, get_timeout(State)}; Thank you for reporting this and I will make your your test into a test case. Regards Ingela Erlang/OTP team - Ericsson AB Steve Vinoski wrote: > > > On Wed, Nov 28, 2012 at 1:27 PM, Steve Vinoski > wrote: > > In trying to verify Yaws under R15B03 I noticed it was failing its > SSL accept timeout test, which works fine under previous Erlang/OTP > versions. > > Compile this module and run its start/0 function to reproduce the > problem: > > https://gist.github.com/4163038 > > The test does an SSL accept with a timeout, then does a TCP connect > from a client which of course won't complete the handshake and > should cause the timeout to kick in. Unfortunately the timeout > doesn't occur. > > > Running a git bisect in the otp repo shows commit 8a789189 to be the culprit. > > --steve > > ------------------------------------------------------------------------ > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs From dmkolesnikov@REDACTED Thu Nov 29 17:46:28 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 18:46:28 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> Message-ID: <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Hello, Thanks for your comment, appreciate it. Unfortunately, you have missed my use-case. I do offer an api to store a tuple. The storage do not concern the tuple cardinality, in similar fashion like ets/dets does. One of my current limitation is that tuple elements MUST be a particular data type. I simply want to validate that client writes tuples with supported data types. I am also fine with generic tuple() data type but it is less error prone. - Dmitry On Nov 29, 2012, at 6:24 PM, Siraaj Khandkar wrote: > Hmmm, IDK, that just seems wrong to me. If what you're offering clients is a > variable number of elements, then, semantically, you're offering them a list. > If a client wants to optimize lookups, it should be left up to the client app > to convert it to a tuple. > > If you think about it, you're asking for a static guarantee for something that > is only known at runtime, which is not possible. > > Alternatively, I guess you can write a template that expands to 4096 elements :) > > > On Nov 29, 2012, at 11:08 AM, Dmitry Kolesnikov wrote: > >> Hello, >> >> Yes, you are right that tuples are converted into list during the serialisation process. You cannot avoid it but api offered to client uses tuples. >> >> - Dmitry >> >> On Nov 29, 2012, at 6:03 PM, Siraaj Khandkar wrote: >> >>> I don't know all the technicalities of Erlang's type specs, but in general - >>> variable growth is antithetical to the concept of a tuple. >>> >>> You'll still need to accumulate the elements in some list before you convert >>> it to a tuple, so why not just spec that list? >>> >>> >>> On Nov 28, 2012, at 5:10 PM, Dmitry Kolesnikov wrote: >>> >>>> Hello, >>>> >>>> Thanks for response! >>>> Let me explain better what I am trying to achieve. >>>> "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." >>>> I am looking for similar definition but for tuples. >>>> >>>> My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) >>>> >>>> - Dmitry >>>> >>>> On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: >>>> >>>>> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >>>>> wrote: >>>>>> but compiler fails syntax error before: ',' >>>>>> >>>>>> -- CLIP -- >>>>>> -type value() :: string() | binary() | number() | boolean() | undefined. >>>>>> -type entity() :: [{atom(), value()}] | {field()}. >>>>> >>>>> These should be fine. >>>>> >>>>>> -type field() :: value() | value(), field(). >>>>> >>>>> Maybe you meant >>>>> -type field() :: value() | {value(), field()}. >>>>> >>>>> ? >>>>> >>>>> In general, if you want to define tuples of different sizes in -spec, >>>>> you use the "|" operator to define as many variants as you like. >>>>> >>>>> Likely I don't understand what you are trying to define. > > -- > Siraaj Khandkar > .o. > ..o > ooo > From desired.mta@REDACTED Thu Nov 29 17:58:30 2012 From: desired.mta@REDACTED (=?UTF-8?Q?Motiejus_Jak=C5=A1tys?=) Date: Thu, 29 Nov 2012 16:58:30 +0000 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Message-ID: On Thu, Nov 29, 2012 at 4:46 PM, Dmitry Kolesnikov wrote: > Hello, > > I do offer an api to store a tuple. The storage do not concern the tuple cardinality, in similar fashion like ets/dets does. One of my current limitation is that tuple elements MUST be a particular data type. I simply want to validate that client writes tuples with supported data types. I am also fine with generic tuple() data type but it is less error prone. > If you really need that, you could write a parse_transform, which would create 4096 reincarnations of correct tuples. However, I think[1] it will still be reduced to tuple() by dialyzer during checking time (please correct me if not). [1]: http://erlang.org/pipermail/erlang-questions/2012-August/068855.html Unfortunately, patch for dialyzer to replace SET_LIMIT to a run-time argument, in this case 4096, still did not reach the top of my todo list. -- Motiejus Jak?tys From siraaj@REDACTED Thu Nov 29 17:58:56 2012 From: siraaj@REDACTED (Siraaj Khandkar) Date: Thu, 29 Nov 2012 11:58:56 -0500 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Message-ID: <7A183DBA-F54C-4FB7-8EA8-DC8E8A92B63E@khandkar.net> Conceptually, it sounds like the same thing: you know individual element type, but not the number of elements - it is a list. Given the constraints, I don't think you have much choice but to check elements prior to their entry into the tuple. Otherwise you have to do runtime checks. Or that template. May be you can offer an API to store the list but retrieve it as a tuple? On Nov 29, 2012, at 11:46 AM, Dmitry Kolesnikov wrote: > Hello, > > Thanks for your comment, appreciate it. > Unfortunately, you have missed my use-case. > > I do offer an api to store a tuple. The storage do not concern the tuple cardinality, in similar fashion like ets/dets does. One of my current limitation is that tuple elements MUST be a particular data type. I simply want to validate that client writes tuples with supported data types. I am also fine with generic tuple() data type but it is less error prone. > > - Dmitry > > On Nov 29, 2012, at 6:24 PM, Siraaj Khandkar wrote: > >> Hmmm, IDK, that just seems wrong to me. If what you're offering clients is a >> variable number of elements, then, semantically, you're offering them a list. >> If a client wants to optimize lookups, it should be left up to the client app >> to convert it to a tuple. >> >> If you think about it, you're asking for a static guarantee for something that >> is only known at runtime, which is not possible. >> >> Alternatively, I guess you can write a template that expands to 4096 elements :) >> >> >> On Nov 29, 2012, at 11:08 AM, Dmitry Kolesnikov wrote: >> >>> Hello, >>> >>> Yes, you are right that tuples are converted into list during the serialisation process. You cannot avoid it but api offered to client uses tuples. >>> >>> - Dmitry >>> >>> On Nov 29, 2012, at 6:03 PM, Siraaj Khandkar wrote: >>> >>>> I don't know all the technicalities of Erlang's type specs, but in general - >>>> variable growth is antithetical to the concept of a tuple. >>>> >>>> You'll still need to accumulate the elements in some list before you convert >>>> it to a tuple, so why not just spec that list? >>>> >>>> >>>> On Nov 28, 2012, at 5:10 PM, Dmitry Kolesnikov wrote: >>>> >>>>> Hello, >>>>> >>>>> Thanks for response! >>>>> Let me explain better what I am trying to achieve. >>>>> "The shorthand [T,...] stands for the set of non-empty proper lists whose elements are of type T." >>>>> I am looking for similar definition but for tuples. >>>>> >>>>> My application serialises tuples into disk. The size of tuple is unbound but tuple elements a fixed to string, binary, number, boolean or undefined. I cannot use " "|" operator to define as many variants as you like" because number of variants is unlimited. Well practically, I do have a hard limit of 4096 elements per tuple but I am lazy to type in 4096 variants :-) >>>>> >>>>> - Dmitry >>>>> >>>>> On Nov 28, 2012, at 11:50 PM, Motiejus Jak?tys wrote: >>>>> >>>>>> On Wed, Nov 28, 2012 at 9:10 PM, Dmitry Kolesnikov >>>>>> wrote: >>>>>>> but compiler fails syntax error before: ',' >>>>>>> >>>>>>> -- CLIP -- >>>>>>> -type value() :: string() | binary() | number() | boolean() | undefined. >>>>>>> -type entity() :: [{atom(), value()}] | {field()}. >>>>>> >>>>>> These should be fine. >>>>>> >>>>>>> -type field() :: value() | value(), field(). >>>>>> >>>>>> Maybe you meant >>>>>> -type field() :: value() | {value(), field()}. >>>>>> >>>>>> ? >>>>>> >>>>>> In general, if you want to define tuples of different sizes in -spec, >>>>>> you use the "|" operator to define as many variants as you like. >>>>>> >>>>>> Likely I don't understand what you are trying to define. >> >> -- >> Siraaj Khandkar >> .o. >> ..o >> ooo >> > -- Siraaj Khandkar ------------------------------------------------------------------------------- .o. ..o ooo From karol.urbanski@REDACTED Thu Nov 29 18:06:25 2012 From: karol.urbanski@REDACTED (Karol =?utf-8?B?VXJiYcWEc2tp?=) Date: Thu, 29 Nov 2012 18:06:25 +0100 Subject: [erlang-questions] R15B03 binary packages for CentOS, Debian, Fedora, Mac and Ubuntu Message-ID: <20121129170625.GA3557@dex.krakow> Hello, You can find our Erlang R15B03 packages for CentOS 6, Mac OS X Snow Leopard and Lion, Debian 6, Ubuntu 12.04 and 12.10 and Fedora 17i at http://www.erlang-solutions.com/downloads/download-erlang-otp (and we are still working on expanding the list). Best regards, Karol Urbanski From dmkolesnikov@REDACTED Thu Nov 29 18:25:06 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 29 Nov 2012 19:25:06 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Message-ID: <766650FD-944F-47A3-861D-26B24FC09B23@gmail.com> Thanks! I'll continue with a -spec entity() :: tuple() and handle type validation at run-time - Dmitry On Nov 29, 2012, at 6:58 PM, Motiejus Jak?tys wrote: > On Thu, Nov 29, 2012 at 4:46 PM, Dmitry Kolesnikov > wrote: >> Hello, >> >> I do offer an api to store a tuple. The storage do not concern the tuple cardinality, in similar fashion like ets/dets does. One of my current limitation is that tuple elements MUST be a particular data type. I simply want to validate that client writes tuples with supported data types. I am also fine with generic tuple() data type but it is less error prone. >> > > If you really need that, you could write a parse_transform, which > would create 4096 reincarnations of correct tuples. However, I > think[1] it will still be reduced to tuple() by dialyzer during > checking time (please correct me if not). > > [1]: http://erlang.org/pipermail/erlang-questions/2012-August/068855.html > Unfortunately, patch for dialyzer to replace SET_LIMIT to a run-time > argument, in this case 4096, still did not reach the top of my todo > list. > > -- > Motiejus Jak?tys From andrew@REDACTED Thu Nov 29 19:16:06 2012 From: andrew@REDACTED (Andrew Thompson) Date: Thu, 29 Nov 2012 13:16:06 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster In-Reply-To: References: <20121128043506.GD24714@hijacked.us> Message-ID: <20121129181606.GG24714@hijacked.us> On Thu, Nov 29, 2012 at 11:24:49AM -0500, Jeremy Raymond wrote: > I gave that branch a try. I'm still seeing misreported downed nodes. I > should see correct gen_leader:down/1 and gen_leader:alive/1 lists on all > nodes correct? > I'd certainly hope so, although I admit my testing was more focused on ensuring that leader election was working, and I didn't look at the output of down/1 and alive/1. If you give me steps to reproduce what you're seeing, I'd be happy to take a look. Andrew From wallentin.dahlberg@REDACTED Thu Nov 29 21:42:30 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Thu, 29 Nov 2012 21:42:30 +0100 Subject: [erlang-questions] Increase quality by tagging release candidates? Message-ID: Hi there! I'm curious; would pushing and tagging release candidates to GitHub for user testing be worthwhile? We already do this for major-versions, i.e. R14A, R15A and soonish R16A, and we get some useful information from this. I want to encourage people to test our otp HEAD at GitHub when nearing a release. Especially those we say are release-candidates, i.e. R*A-releases. I also think we should start tagging those as release candidates, i.e. R15A-RC1, R15A-RC2, etc, further making the point of a release candidate so we don't have users taking a release candidate for production .. or include it in a distro. Now, should we also do this for maint-releases also? At Erlang/OTP we have *extensive* testing on a multitude of operating systems, architectures and configurations. We can however, always test even more. =) Normally we have "code-freeze" a couple of weeks before a release and then a stabilization phase to iron out, hopefully, the last few glitches. I'm thinking, at code-freeze - push what we have, tag it and notify you via this or other medias that we have a src-state that contains more signal than noise and we wish that you test it against your product and your testcases. Hopefully, you could get information back to us by saying *thumbs up* or more importantly saying "I'm concerned about this behavior here .." if you encounter something worrisome. The window to do changes are small at that point and we would certainly only correct things that are apparent bugs - correcting one thing runs the risk of creating even bigger, unforeseen, problems. Ultimately some sort of risk/reward decision will be taken by us. Is this of intrest? Should we start tagging release-candidates? Would you be interested to test release candidates on your products and let us know problems before a release? I think it would lead to even better product quality. Regards, Bj?rn-Egil -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Thu Nov 29 22:13:51 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Thu, 29 Nov 2012 22:13:51 +0100 Subject: [erlang-questions] Increase quality by tagging release candidates? In-Reply-To: References: Message-ID: <50B7D00F.70703@ninenines.eu> On 11/29/2012 09:42 PM, Bj?rn-Egil Dahlberg wrote: > Hi there! > > I'm curious; would pushing and tagging release candidates to GitHub for > user testing be worthwhile? > > We already do this for major-versions, i.e. R14A, R15A and soonish R16A, > and we get some useful information from this. I want to encourage people > to test our otp HEAD at GitHub when nearing a release. Especially those > we say are release-candidates, i.e. R*A-releases. I also think we should > start tagging those as release candidates, i.e. R15A-RC1, R15A-RC2, etc, > further making the point of a release candidate so we don't have users > taking a release candidate for production .. or include it in a distro. > > Now, should we also do this for maint-releases also? At Erlang/OTP we > have *extensive* testing on a multitude of operating systems, > architectures and configurations. We can however, always test even more. =) > > Normally we have "code-freeze" a couple of weeks before a release and > then a stabilization phase to iron out, hopefully, the last few glitches. > > I'm thinking, at code-freeze - push what we have, tag it and notify you > via this or other medias that we have a src-state that contains more > signal than noise and we wish that you test it against your product and > your testcases. Hopefully, you could get information back to us by > saying *thumbs up* or more importantly saying "I'm concerned about > this behavior here .." if you encounter something worrisome. > > The window to do changes are small at that point and we would certainly > only correct things that are apparent bugs - correcting one thing runs > the risk of creating even bigger, unforeseen, problems. Ultimately some > sort of risk/reward decision will be taken by us. > > Is this of intrest? Should we start tagging release-candidates? Would > you be interested to test release candidates on your products and let us > know problems before a release? > > I think it would lead to even better product quality. Me too, for all the reasons you mentioned. Tag when it's code freeze, inform people about it, and the concerned citizens will test the code against their projects. Everybody wins. -- Lo?c Hoguin Erlang Cowboy Nine Nines http://ninenines.eu From carlsson.richard@REDACTED Thu Nov 29 23:02:05 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Thu, 29 Nov 2012 23:02:05 +0100 Subject: [erlang-questions] erl_parse.yrl structs? In-Reply-To: <20121128183820.GA20048@bittwiddlers.com> References: <20121128183820.GA20048@bittwiddlers.com> Message-ID: <50B7DB5D.8000102@gmail.com> On 2012-11-28 19:38, Matthew Harrell wrote: > > While we were mucking around in stdlib/erl_parse.yrl we noticed a commented > out Nonterminal called struct: > > struct -> atom tuple : {struct, .... > > Is this just a relic from the past from before records came to life? Since nobody has answered: As far as I know, "structs" were an internal experiment at Ericsson, one of the earliest attempts at something-to-replace-records, and they were never shown in public. (I've never seen a working implementation, only discussed it with the OTP guys, probably more than 10 years ago.) /Richard From mharrell-keyword-erlang.a034fe@REDACTED Thu Nov 29 23:05:09 2012 From: mharrell-keyword-erlang.a034fe@REDACTED (Matthew Harrell) Date: Thu, 29 Nov 2012 17:05:09 -0500 Subject: [erlang-questions] erl_parse.yrl structs? In-Reply-To: <50B7DB5D.8000102@gmail.com> References: <20121128183820.GA20048@bittwiddlers.com> <50B7DB5D.8000102@gmail.com> Message-ID: <20121129220509.GA10462@bittwiddlers.com> : Since nobody has answered: As far as I know, "structs" were an : internal experiment at Ericsson, one of the earliest attempts at : something-to-replace-records, and they were never shown in public. : (I've never seen a working implementation, only discussed it with : the OTP guys, probably more than 10 years ago.) Figured it was probably a relic in there. We were just a little surprised to see them still in there in some form Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From vinoski@REDACTED Thu Nov 29 23:06:03 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 29 Nov 2012 17:06:03 -0500 Subject: [erlang-questions] Increase quality by tagging release candidates? In-Reply-To: <50B7D00F.70703@ninenines.eu> References: <50B7D00F.70703@ninenines.eu> Message-ID: On Thu, Nov 29, 2012 at 4:13 PM, Lo?c Hoguin wrote: > On 11/29/2012 09:42 PM, Bj?rn-Egil Dahlberg wrote: > >> Hi there! >> >> I'm curious; would pushing and tagging release candidates to GitHub for >> user testing be worthwhile? >> >> We already do this for major-versions, i.e. R14A, R15A and soonish R16A, >> and we get some useful information from this. I want to encourage people >> to test our otp HEAD at GitHub when nearing a release. Especially those >> we say are release-candidates, i.e. R*A-releases. I also think we should >> start tagging those as release candidates, i.e. R15A-RC1, R15A-RC2, etc, >> further making the point of a release candidate so we don't have users >> taking a release candidate for production .. or include it in a distro. >> >> Now, should we also do this for maint-releases also? At Erlang/OTP we >> have *extensive* testing on a multitude of operating systems, >> architectures and configurations. We can however, always test even more. >> =) >> >> Normally we have "code-freeze" a couple of weeks before a release and >> then a stabilization phase to iron out, hopefully, the last few glitches. >> >> I'm thinking, at code-freeze - push what we have, tag it and notify you >> via this or other medias that we have a src-state that contains more >> signal than noise and we wish that you test it against your product and >> your testcases. Hopefully, you could get information back to us by >> saying *thumbs up* or more importantly saying "I'm concerned about >> this behavior here .." if you encounter something worrisome. >> >> The window to do changes are small at that point and we would certainly >> only correct things that are apparent bugs - correcting one thing runs >> the risk of creating even bigger, unforeseen, problems. Ultimately some >> sort of risk/reward decision will be taken by us. >> >> Is this of intrest? Should we start tagging release-candidates? Would >> you be interested to test release candidates on your products and let us >> know problems before a release? >> >> I think it would lead to even better product quality. >> > > Me too, for all the reasons you mentioned. Tag when it's code freeze, > inform people about it, and the concerned citizens will test the code > against their projects. Everybody wins. +1, I think this would be good. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Thu Nov 29 23:09:48 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Thu, 29 Nov 2012 23:09:48 +0100 Subject: [erlang-questions] erl_parse.yrl structs? In-Reply-To: <20121129220509.GA10462@bittwiddlers.com> References: <20121128183820.GA20048@bittwiddlers.com> <50B7DB5D.8000102@gmail.com> <20121129220509.GA10462@bittwiddlers.com> Message-ID: <50B7DD2C.5010603@gmail.com> On 2012-11-29 23:05, Matthew Harrell wrote: > : Since nobody has answered: As far as I know, "structs" were an > : internal experiment at Ericsson, one of the earliest attempts at > : something-to-replace-records, and they were never shown in public. > : (I've never seen a working implementation, only discussed it with > : the OTP guys, probably more than 10 years ago.) > > Figured it was probably a relic in there. We were just a little > surprised to see them still in there in some form Feel free to submit a patch that cleans it out. Nowadays, there's no need for that kind of commented-out old crap in the sources. Version control is there for those who might want to dig it out again. /Richard From mharrell-keyword-erlang.a034fe@REDACTED Thu Nov 29 23:14:14 2012 From: mharrell-keyword-erlang.a034fe@REDACTED (Matthew Harrell) Date: Thu, 29 Nov 2012 17:14:14 -0500 Subject: [erlang-questions] erl_parse.yrl structs? In-Reply-To: <50B7DD2C.5010603@gmail.com> References: <20121128183820.GA20048@bittwiddlers.com> <50B7DB5D.8000102@gmail.com> <20121129220509.GA10462@bittwiddlers.com> <50B7DD2C.5010603@gmail.com> Message-ID: <20121129221414.GB12074@bittwiddlers.com> : : Feel free to submit a patch that cleans it out. Nowadays, there's no : need for that kind of commented-out old crap in the sources. Version : control is there for those who might want to dig it out again. : Once we finish what we're working on at this point we may well do that Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From yrashk@REDACTED Thu Nov 29 23:32:46 2012 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Thu, 29 Nov 2012 14:32:46 -0800 (PST) Subject: [erlang-questions] Increase quality by tagging release candidates? In-Reply-To: References: Message-ID: It's a great idea. If the OTP team also had an ability to expose their issue tracking system in some way, it would have been a heavenly combination! On Thursday, November 29, 2012 12:42:30 PM UTC-8, Bj?rn-Egil Dahlberg wrote: > > Hi there! > > I'm curious; would pushing and tagging release candidates to GitHub for > user testing be worthwhile? > > We already do this for major-versions, i.e. R14A, R15A and soonish R16A, > and we get some useful information from this. I want to encourage people to > test our otp HEAD at GitHub when nearing a release. Especially those we say > are release-candidates, i.e. R*A-releases. I also think we should start > tagging those as release candidates, i.e. R15A-RC1, R15A-RC2, etc, further > making the point of a release candidate so we don't have users taking a > release candidate for production .. or include it in a distro. > > Now, should we also do this for maint-releases also? At Erlang/OTP we have > *extensive* testing on a multitude of operating systems, architectures and > configurations. We can however, always test even more. =) > > Normally we have "code-freeze" a couple of weeks before a release and then > a stabilization phase to iron out, hopefully, the last few glitches. > > I'm thinking, at code-freeze - push what we have, tag it and notify you > via this or other medias that we have a src-state that contains more signal > than noise and we wish that you test it against your product and your > testcases. Hopefully, you could get information back to us by saying > *thumbs up* or more importantly saying "I'm concerned about this behavior > here .." if you encounter something worrisome. > > The window to do changes are small at that point and we would certainly > only correct things that are apparent bugs - correcting one thing runs the > risk of creating even bigger, unforeseen, problems. Ultimately some sort of > risk/reward decision will be taken by us. > > Is this of intrest? Should we start tagging release-candidates? Would you > be interested to test release candidates on your products and let us know > problems before a release? > > I think it would lead to even better product quality. > > Regards, > Bj?rn-Egil > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dch@REDACTED Fri Nov 30 00:48:38 2012 From: dch@REDACTED (Dave Cottlehuber) Date: Fri, 30 Nov 2012 00:48:38 +0100 Subject: [erlang-questions] Increase quality by tagging release candidates? In-Reply-To: References: Message-ID: On 29 November 2012 23:32, Yurii Rashkovskii wrote: > It's a great idea. If the OTP team also had an ability to expose their issue > tracking system in some way, it would have been a heavenly combination! +1 to that also. > On Thursday, November 29, 2012 12:42:30 PM UTC-8, Bj?rn-Egil Dahlberg wrote: >> >> Hi there! >> >> I'm curious; would pushing and tagging release candidates to GitHub for >> user testing be worthwhile? Yes please! A+ Dave From ok@REDACTED Fri Nov 30 01:26:30 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 30 Nov 2012 13:26:30 +1300 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Message-ID: On 30/11/2012, at 5:46 AM, Dmitry Kolesnikov wrote: > Hello, > > Thanks for your comment, appreciate it. > Unfortunately, you have missed my use-case. > > I do offer an api to store a tuple. Let me put it this way: why do YOU care whether all the elements of the tuple have the same type? Since the client's calls to your code might not be type checked, you cannot rely on type checking to guarantee whatever property it is you need, so you are going to need a run-time check anyway, aren't you? From jeraymond@REDACTED Fri Nov 30 03:06:15 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Thu, 29 Nov 2012 21:06:15 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster In-Reply-To: <20121129181606.GG24714@hijacked.us> References: <20121128043506.GD24714@hijacked.us> <20121129181606.GG24714@hijacked.us> Message-ID: <325120964094030764@unknownmsgid> I just have 3 nodes with 3 different gen_leader based modules. I stop and start the app on one of the nodes a few times and that usually does it. I'll see if I can reproduce this in a simple test and post back to the list. Might not get to it for a few days though. -- Jeremy On 2012-11-29, at 1:16 PM, Andrew Thompson wrote: > On Thu, Nov 29, 2012 at 11:24:49AM -0500, Jeremy Raymond wrote: >> I gave that branch a try. I'm still seeing misreported downed nodes. I >> should see correct gen_leader:down/1 and gen_leader:alive/1 lists on all >> nodes correct? > I'd certainly hope so, although I admit my testing was more focused on > ensuring that leader election was working, and I didn't look at the > output of down/1 and alive/1. > > If you give me steps to reproduce what you're seeing, I'd be happy to > take a look. > > Andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2324 bytes Desc: not available URL: From jeraymond@REDACTED Fri Nov 30 03:12:33 2012 From: jeraymond@REDACTED (Jeremy Raymond) Date: Thu, 29 Nov 2012 21:12:33 -0500 Subject: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster In-Reply-To: <1176976580335789264@unknownmsgid> References: <33189ACA-BE5C-497F-B435-FA20D7085AB4@erlang.geek.nz> <1176976580335789264@unknownmsgid> Message-ID: <7295017946158239514@unknownmsgid> + list -- Jeremy On 2012-11-29, at 9:10 PM, Jeremy Raymond wrote: > Interesting. The API looks a bit different though, not a drop in > replacement for gen_leader. I'll give it a go if gen_leader isn't able > to be sorted out. > > -- > Jeremy > > On 2012-11-29, at 8:21 PM, Geoff Cant wrote: > >> Hi there - are your tests for this stuff automated? I have an alternative gen_leader implementation ( https://github.com/ngmoco/gl_async_bully ) and I would like to compare it to the original to see how it stacks up. >> >> Cheers, >> -Geoff >> >> Begin forwarded message: >> >>> From: Jeremy Raymond >>> Subject: Re: [erlang-questions] gen_leader discrepancies in reporting of downed nodes across a cluster >>> Date: 30 November 2012 05:24:49 AM >>> To: Erlang >>> Return-Path: >>> Delivered-To: nem@REDACTED >>> Delivered-To: erlang-questions@REDACTED >>> >>> I gave that branch a try. I'm still seeing misreported downed nodes. I >>> should see correct gen_leader:down/1 and gen_leader:alive/1 lists on all >>> nodes correct? >>> >>> -- >>> Jeremy >>> >>> >>> On Tue, Nov 27, 2012 at 11:35 PM, Andrew Thompson wrote: >>> >>>> On Tue, Nov 27, 2012 at 12:47:52PM -0500, Jeremy Raymond wrote: >>>>> Hi, >>>>> >>>>> I'm using the gen_leader behaviour from [1] in a 3 node Erlang cluster. >>>> I'm >>>>> running into a situation where if I down one of the nodes and bring it >>>> back >>>>> up, when it rejoins the cluster the other nodes still see it as being >>>> down >>>>> as reported by gen_leader:down/1. However the cycled node itself sees the >>>>> other two nodes as being up. If I cycle the other two nodes, then all >>>> three >>>>> will agree again on all of the nodes being available. This doesn't happen >>>>> all every time I down a node, but quite often. Another (related?) issue I >>>>> sometimes see is that gen_leader:down/1 sometimes reports the same node >>>> as >>>>> being down multiple times in the returned list. >>>> >>>> Would you mind trying the branch at >>>> >>>> https://github.com/Vagabond/gen_leader_revival/tree/netsplit-tolerance >>>> >>>> This branch contains a bunch of work I did to work around these kinds >>>> of issues that Basho was seeing with gen_leader. >>>> >>>> Anfrew >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> -- >> Geoff Cant > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2324 bytes Desc: not available URL: From vinoski@REDACTED Fri Nov 30 05:08:47 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 29 Nov 2012 23:08:47 -0500 Subject: [erlang-questions] [erlang-bugs] SSL accept timeout broken in R15B03? In-Reply-To: <50B735E6.4070406@ericsson.com> References: <50B735E6.4070406@ericsson.com> Message-ID: On Thu, Nov 29, 2012 at 5:16 AM, Ingela Anderton Andin < Ingela.Anderton.Andin@REDACTED> wrote: > Hi Steve! > > There is a missing function clause to handle the ssl:ssl_accept-timeout so > alas it was treated as a canceled timeout. I failed to realize that > we needed a special test case for the accept case when I solved the > problem with client side timeouts for ssl:recv. The client side timeout > is a problem for accept/connect too and is solved by the same mechanism > with the only difference being the following clause: > > > index 87cf49d..102dd4a 100644 > --- a/lib/ssl/src/ssl_connection.**erl > +++ b/lib/ssl/src/ssl_connection.**erl > @@ -1001,6 +1001,10 @@ handle_info({cancel_start_or_**recv, RecvFrom}, > connection = StateName, #state{sta > gen_fsm:reply(RecvFrom, {error, timeout}), > {next_state, StateName, State#state{start_or_recv_from = undefined}, > get_timeout(State)}; > > +handle_info({cancel_start_or_**recv, RecvFrom}, StateName, State) when > connection =/= StateName-> > + gen_fsm:reply(RecvFrom, {error, timeout}), > + {next_state, StateName, State#state{start_or_recv_from = undefined}, > get_timeout(State)}; > + > handle_info({cancel_start_or_**recv, _RecvFrom}, StateName, State) -> > {next_state, StateName, State, get_timeout(State)}; > > Thank you for reporting this and I will make your your test into a test > case. > Thanks -- I verified that this patch fixes the problem I saw. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From 7stud@REDACTED Fri Nov 30 07:20:47 2012 From: 7stud@REDACTED (7stud) Date: Fri, 30 Nov 2012 01:20:47 -0500 Subject: [erlang-questions] bit syntax Message-ID: <20121130012047.29724@web006.roc2.bluetie.com> Hi, I have a couple of questions about the bit syntax. 1) I can read the first byte of a binary to get the length of the next value: 1> X = <<16, 256:16>>. <<16,1,0>> 2> <> = X. <<16,1,0>> 3> Length. 16 4> Value. 256 And (2*8) is a legal Size: 5> f(). ok 6> X = <<2, 256:16>>. <<2,1,0>> 7> <> = X. <<2,1,0>> 8> Length. 2 9> Value. 256 So why does Size = Length*8 fail when Length=2? 10> f(Length). ok 11> f(Value). ok 12> <> = X. * 1: illegal bit size 2) What is going on here: 73> f(). ok 74> <<"1234">>. <<"1234">> 75> "1234" == [49, 50, 51, 52]. true 76> << [49, 50, 51, 52] >>. ** exception error: bad argument 77> X = "1234". "1234" 78> <>. ** exception error: bad argument In line 74, I can use a string while constructing a binary, but in 76 I can't use the equivalent list. And in line 77, when I bind the string to a variable, I can't use the variable to construct a binary. Thanks. From naikvin@REDACTED Fri Nov 30 09:25:38 2012 From: naikvin@REDACTED (Vineet Naik) Date: Fri, 30 Nov 2012 13:55:38 +0530 Subject: [erlang-questions] Is using gen_server behaviour appropriate for this usecase? Message-ID: Hello, I am an Erlang newbie and trying to write a simple chat bot as an XMPP external component. I am using exmpp library and following along these tutorials[1] So far I have one module `bot_server` that uses the gen_server interface. Inside it's `handle_info` callback, incoming messages from various client will be received. To handle and reply to the these messages, I am thinking of spawning a "bot" process per client. It will stay alive as long as the client is available ie. when the client sends "unavailable" presence, it will die. I also need to keep a list of all the alive bot processes in the bot_server's state. My question is, would it be appropriate to implement the bot as a gen_server too considering that it needs to handle two calls, one for handling incoming message (asynchronous) and second for killing itself (synchronous)? In general, when should one use gen_server and when should one write a simple loop function? [1] exmpp tutorials: http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ Thanks, Vineet From dm.klionsky@REDACTED Fri Nov 30 09:26:25 2012 From: dm.klionsky@REDACTED (Dmitry Klionsky) Date: Fri, 30 Nov 2012 11:26:25 +0300 Subject: [erlang-questions] bit syntax In-Reply-To: <20121130012047.29724@web006.roc2.bluetie.com> References: <20121130012047.29724@web006.roc2.bluetie.com> Message-ID: <50B86DB1.2020802@gmail.com> Hi! All below comes from http://www.erlang.org/doc/programming_examples/bit_syntax.html ... Value:Size ... The Size part of the segment multiplied by the unit in the TypeSpecifierList (described below) gives the number of bits for the segment. In construction, Size is any expression that evaluates to an integer. In matching, Size must be a constant expression or a variable. ... And (2*8) is a legal Size: 7> <> = X. <<2,1,0>> This works because (2*8) really evaluates at compile time and it equals to <> = X. 12> <> = X. * 1: illegal bit size The expression (Length*8) is supported when constructing a binary. This is definitely a pattern matching, so as stated above: the Size must be a constant expression or a variable. Not an expression to be evaluated at runtime. As a workaround you can do this > <> = X. > ValueLen = Length*8. > <> = Rest. 76> << [49, 50, 51, 52] >>. ** exception error: bad argument 77> X = "1234". "1234" 78> <>. ** exception error: bad argument The only way you can do this is list_to_binary([49, 50, 51, 52]). and list_to_binary("1234"). BR, Dmitry On 11/30/2012 09:20 AM, 7stud wrote: > Hi, > > I have a couple of questions about the bit syntax. > > 1) I can read the first byte of a binary to get the length of the next value: > > 1> X = <<16, 256:16>>. > <<16,1,0>> > > 2> <> = X. > <<16,1,0>> > > 3> Length. > 16 > > 4> Value. > 256 > > > > And (2*8) is a legal Size: > > 5> f(). > ok > > 6> X = <<2, 256:16>>. > <<2,1,0>> > > 7> <> = X. > <<2,1,0>> > > 8> Length. > 2 > > 9> Value. > 256 > > > So why does Size = Length*8 fail when Length=2? > > 10> f(Length). > ok > > 11> f(Value). > ok > > 12> <> = X. > * 1: illegal bit size > > > > > 2) What is going on here: > > > 73> f(). > ok > > 74> <<"1234">>. > <<"1234">> > > 75> "1234" == [49, 50, 51, 52]. > true > > 76> << [49, 50, 51, 52] >>. > ** exception error: bad argument > > 77> X = "1234". > "1234" > > 78> <>. > ** exception error: bad argument > > In line 74, I can use a string while constructing a binary, but in 76 I can't use the equivalent list. And in line 77, when I bind the string to a variable, I can't use the variable to construct a binary. > > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Best regards, Dmitry Klionsky From r.gafiyatullin@REDACTED Fri Nov 30 09:36:35 2012 From: r.gafiyatullin@REDACTED (Roman Gafiyatullin) Date: Fri, 30 Nov 2012 11:36:35 +0300 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: References: Message-ID: <66F9B3537D2A4156BAA2B634075E5E42@me.com> Hi, In most of the cases one shall not use "simple loop functions": raw process cannot participate properly in the supervision tree. If you need some new tricky specific model of behaving - better implement it over gen_server. For instance supervisor is a gen_server :) If you need something more low level - use 'gen' module (see how gen_fsm is implemented). -- Regards RG ( +375 33 602 5080, UTC+3 ) On Friday, November 30, 2012 at 11:25 am, Vineet Naik wrote: > Hello, > > I am an Erlang newbie and trying to write a simple chat bot as an > XMPP external component. I am using exmpp library and following > along these tutorials[1] > > So far I have one module `bot_server` that uses the gen_server > interface. Inside it's `handle_info` callback, incoming messages > from various client will be received. To handle and reply to the > these messages, I am thinking of spawning a "bot" process per > client. It will stay alive as long as the client is available > ie. when the client sends "unavailable" presence, it will die. I > also need to keep a list of all the alive bot processes in the > bot_server's state. > > My question is, would it be appropriate to implement the bot as a > gen_server too considering that it needs to handle two calls, one > for handling incoming message (asynchronous) and second for > killing itself (synchronous)? > > In general, when should one use gen_server and when should > one write a simple loop function? > > [1] exmpp tutorials: > http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ > > Thanks, > Vineet > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrkhoza@REDACTED Fri Nov 30 10:06:00 2012 From: mrkhoza@REDACTED (Lucky Khoza) Date: Fri, 30 Nov 2012 11:06:00 +0200 Subject: [erlang-questions] Homebrew Message-ID: Hi Erlang Developers, I'm trying to install Erlang version R14B01 using homebrew: Kk-MacBook:~ lk$ brew install R14B01 and I'm actually getting this Error: No available formula for r14b01. May someone help. Kindest Regards Lucky -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Fri Nov 30 10:06:10 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Fri, 30 Nov 2012 10:06:10 +0100 Subject: [erlang-questions] bit syntax In-Reply-To: <50B86DB1.2020802@gmail.com> References: <20121130012047.29724@web006.roc2.bluetie.com> <50B86DB1.2020802@gmail.com> Message-ID: 2012/11/30 Dmitry Klionsky > Hi! > > All below comes from http://www.erlang.org/doc/**programming_examples/bit_ > **syntax.html > > ... > Value:Size > ... > The Size part of the segment multiplied by the unit in the > TypeSpecifierList (described below) gives the number of bits for the > segment. In construction, Size is any > expression that evaluates to an integer. In matching, Size must be a > constant expression or a variable. > ... > > > > And (2*8) is a legal Size: > > 7> <> = X. > <<2,1,0>> > > This works because (2*8) really evaluates at compile time and it equals to > > <> = X. > > > > > 12> <> = X. > * 1: illegal bit size > > The expression (Length*8) is supported when constructing a binary. This is > definitely a pattern matching, so as stated above: the Size must be a > constant expression or a variable. Not an expression to be evaluated at > runtime. > > As a workaround you can do this > > > <> = X. > > ValueLen = Length*8. > > <> = Rest. Or this: 2> <> = X. <<2,1,0>> 3> {Length,Value}. {2,256} Multiplication of a length by a constant is a special case which is supported through the 'unit' qualifier. > > > 76> << [49, 50, 51, 52] >>. > ** exception error: bad argument > > 77> X = "1234". > "1234" > > 78> <>. > ** exception error: bad argument > > The only way you can do this is > > list_to_binary([49, 50, 51, 52]). > and > list_to_binary("1234"). > It is a common source of confusion. The types of the items in bit syntax are always determined at compile-time, not at runtime. And for items without any qualifiers, the type is "8-bit integer" (i.e., a byte). The thing is that <<"ABC">> is *syntactic sugar* for <<65,66,67>>; this (literal strings) is a special case, and it is a *syntactic* special case. The runtime makes no decisions based on type, in particular, it does not dynamically treat <> differently depending on whether X is bound to an integer or list value.[1] /Erik [1] Well, it does - it generates a type exception in the case of non-integers, which I suppose counts as a difference... but not in the way you intended. BR, > Dmitry > > > > On 11/30/2012 09:20 AM, 7stud wrote: > >> Hi, >> >> I have a couple of questions about the bit syntax. >> >> 1) I can read the first byte of a binary to get the length of the next >> value: >> >> 1> X = <<16, 256:16>>. >> <<16,1,0>> >> >> 2> <> = X. >> <<16,1,0>> >> >> 3> Length. >> 16 >> >> 4> Value. >> 256 >> >> >> >> And (2*8) is a legal Size: >> >> 5> f(). >> ok >> >> 6> X = <<2, 256:16>>. >> <<2,1,0>> >> >> 7> <> = X. >> <<2,1,0>> >> >> 8> Length. >> 2 >> >> 9> Value. >> 256 >> >> >> So why does Size = Length*8 fail when Length=2? >> >> 10> f(Length). >> ok >> >> 11> f(Value). >> ok >> >> 12> <> = X. >> * 1: illegal bit size >> >> >> >> >> 2) What is going on here: >> >> >> 73> f(). >> ok >> >> 74> <<"1234">>. >> <<"1234">> >> >> 75> "1234" == [49, 50, 51, 52]. >> true >> >> 76> << [49, 50, 51, 52] >>. >> ** exception error: bad argument >> >> 77> X = "1234". >> "1234" >> >> 78> <>. >> ** exception error: bad argument >> >> In line 74, I can use a string while constructing a binary, but in 76 I >> can't use the equivalent list. And in line 77, when I bind the string to a >> variable, I can't use the variable to construct a binary. >> >> Thanks. >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > > -- > Best regards, > Dmitry Klionsky > > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From naikvin@REDACTED Fri Nov 30 10:49:27 2012 From: naikvin@REDACTED (Vineet Naik) Date: Fri, 30 Nov 2012 15:19:27 +0530 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: <66F9B3537D2A4156BAA2B634075E5E42@me.com> References: <66F9B3537D2A4156BAA2B634075E5E42@me.com> Message-ID: Hi Roman, Thanks for replying. I think gen_server pretty much fits my case. But I would like to know whether it's fine to use gen_server if the model is not strictly based on client-server message passing. Does Erlang have any thing like "abuse of the gen_server" anti-pattern :-) ? Regards, Vineet On Fri, Nov 30, 2012 at 2:06 PM, Roman Gafiyatullin wrote: > Hi, > > In most of the cases one shall not use "simple loop functions": raw process > cannot participate properly in the supervision tree. > > If you need some new tricky specific model of behaving - better implement it > over gen_server. > For instance supervisor is a gen_server :) > > If you need something more low level - use 'gen' module (see how gen_fsm is > implemented). > > -- > Regards > RG ( +375 33 602 5080, UTC+3 ) > > On Friday, November 30, 2012 at 11:25 am, Vineet Naik wrote: > > Hello, > > I am an Erlang newbie and trying to write a simple chat bot as an > XMPP external component. I am using exmpp library and following > along these tutorials[1] > > So far I have one module `bot_server` that uses the gen_server > interface. Inside it's `handle_info` callback, incoming messages > from various client will be received. To handle and reply to the > these messages, I am thinking of spawning a "bot" process per > client. It will stay alive as long as the client is available > ie. when the client sends "unavailable" presence, it will die. I > also need to keep a list of all the alive bot processes in the > bot_server's state. > > My question is, would it be appropriate to implement the bot as a > gen_server too considering that it needs to handle two calls, one > for handling incoming message (asynchronous) and second for > killing itself (synchronous)? > > In general, when should one use gen_server and when should > one write a simple loop function? > > [1] exmpp tutorials: > http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ > > Thanks, > Vineet > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Vineet Naik From wataru@REDACTED Fri Nov 30 11:01:21 2012 From: wataru@REDACTED (=?ISO-8859-15?Q?Gregor_F=E9ng?=) Date: Fri, 30 Nov 2012 11:01:21 +0100 Subject: [erlang-questions] Multiple SNMP agents Message-ID: <50B883F1.7080407@gmx.de> Hi all, I have the task to implement a system for our testing department, which need a snmp mock for simulating many snmp devices. What I want to know, is it possible to create multiple snmp agent instances, each one on a different ip and/or port in erlang? I'm unfortunaly a very beginner in erlang/OTP and I read and test the introduction to the snmp system of erlang/OPT on trapexit (http://www.trapexit.org/SNMP_Quick_Start). With this and the information from the erlang documentation I tried to run more than one agent, for example with multiple -config on erl command line, but only the last one is used. So, is it possible and when, how? Thank you From attila.r.nohl@REDACTED Fri Nov 30 11:26:44 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Fri, 30 Nov 2012 11:26:44 +0100 Subject: [erlang-questions] Multiple SNMP agents In-Reply-To: <50B883F1.7080407@gmx.de> References: <50B883F1.7080407@gmx.de> Message-ID: Hello! It is possible, but you have to create an implementation of the snmp_net_if behaviour that handles the multiple sockets. You'll still have one agent, so you have to use the Extra arguments (or fields in the records) to somehow identify the agent instance. You'll probably need the snmpa:current_net_if_data() function to get this extra value in the agent. 2012/11/30 Gregor F?ng : > Hi all, > > I have the task to implement a system for our testing department, which need > a snmp mock for simulating many snmp devices. What I want to know, is it > possible to create multiple snmp agent instances, each one on a different ip > and/or port in erlang? I'm unfortunaly a very beginner in erlang/OTP and I > read and test the introduction to the snmp system of erlang/OPT on trapexit > (http://www.trapexit.org/SNMP_Quick_Start). With this and the information > from the erlang documentation I tried to run more than one agent, for > example with multiple -config on erl command line, but only the last one is > used. > So, is it possible and when, how? > > Thank you > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From r.gafiyatullin@REDACTED Fri Nov 30 11:43:49 2012 From: r.gafiyatullin@REDACTED (Roman Gafiyatullin) Date: Fri, 30 Nov 2012 13:43:49 +0300 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: References: <66F9B3537D2A4156BAA2B634075E5E42@me.com> Message-ID: <97A678D37742424BBB6CFA12BDF96C5E@me.com> Vineet, Using standard OTP behaviours for handling processes is not a bad practice. It helps to always have unified predictable behaviour of the processes you spawn. I will just enumerate several examples hoping those would be helpful for you: * process A queries process B for something: [in A] {ok, Result} = gen_server:call( B, {request, Something}, CallTimeout ). * procerss A asks B to do something but does not expect any response on this action: [in A] ok = gen_server:cast( B, {ack, ID} ). * process A queries B for some results. Yet the query cannot be satisfied but will be once some event will be reported to B [in A] it_occurred = gen_server:call( B, i_will_wait_for_a_while, infinity ). [in B] handle_call( i_will_wait_for_a_while, From, State = #s{ reply_queue = Q } ) -> {no_reply, State #s{reply_queue = queue:in( From , Q )} }; ? handle_cast( the_event_i_told_you_about, State = #s{ reply_queue = Q }) -> {ReplyTo, NewQ} = queue:out( Q ), _Ignored = gen_server:reply( ReplyTo, it_occured ), {no_reply, State #s{ reply_queue = NewQ }}; ... In this very case it's probably better to think about employing gen_fsm behaviour - to handle the states like probably 'starving', 'caught_up', 'lagging' etc? * Say we are handling some named resources each with one process. A client code if wants to interact with the resource needs to get the pid of the process owning the resource. A client code knows the name of the resource only. resource_owner.erl: maybe_start_resource_owner( ResourceName ) -> case catch supervisor:start_link( resource_owners_sup , { ResourceName }) of { ok, Pid } -> ok; ignore -> ok end. init({ ResourceName }) -> case catch gproc:add_local_name( {resource_owner, ResourceName} ) of true -> {ok, #s{ resource_name = ResourceName }}; _ -> ignore end. client_code.erl: get_owner_pid_by_resource_name( ResourceName ) -> ok = resource_owner:maybe_start_resource_owner( ResourceName ), {ResourceOwnerPid, _} = gproc:await( {n, l, {resource_owner, ResourceName} } ), {ok, ResourceOwnerPid}. The main moral here - use the standard behaviours when spawning your processes. The OTP team has solved most of the potential problems for you already :) -- RG On Friday, November 30, 2012 at 12:49 pm, Vineet Naik wrote: > Hi Roman, > > Thanks for replying. > > I think gen_server pretty much fits my case. But I would like to > know whether it's fine to use gen_server if the model is not > strictly based on client-server message passing. Does Erlang have > any thing like "abuse of the gen_server" anti-pattern :-) ? > > Regards, > Vineet > > > On Fri, Nov 30, 2012 at 2:06 PM, Roman Gafiyatullin > wrote: > > Hi, > > > > In most of the cases one shall not use "simple loop functions": raw process > > cannot participate properly in the supervision tree. > > > > If you need some new tricky specific model of behaving - better implement it > > over gen_server. > > For instance supervisor is a gen_server :) > > > > If you need something more low level - use 'gen' module (see how gen_fsm is > > implemented). > > > > -- > > Regards > > RG ( +375 33 602 5080, UTC+3 ) > > > > On Friday, November 30, 2012 at 11:25 am, Vineet Naik wrote: > > > > Hello, > > > > I am an Erlang newbie and trying to write a simple chat bot as an > > XMPP external component. I am using exmpp library and following > > along these tutorials[1] > > > > So far I have one module `bot_server` that uses the gen_server > > interface. Inside it's `handle_info` callback, incoming messages > > from various client will be received. To handle and reply to the > > these messages, I am thinking of spawning a "bot" process per > > client. It will stay alive as long as the client is available > > ie. when the client sends "unavailable" presence, it will die. I > > also need to keep a list of all the alive bot processes in the > > bot_server's state. > > > > My question is, would it be appropriate to implement the bot as a > > gen_server too considering that it needs to handle two calls, one > > for handling incoming message (asynchronous) and second for > > killing itself (synchronous)? > > > > In general, when should one use gen_server and when should > > one write a simple loop function? > > > > [1] exmpp tutorials: > > http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ > > > > Thanks, > > Vineet > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > -- > Vineet Naik > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Nov 30 11:56:53 2012 From: freza@REDACTED (Jachym Holecek) Date: Fri, 30 Nov 2012 05:56:53 -0500 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: <97A678D37742424BBB6CFA12BDF96C5E@me.com> References: <66F9B3537D2A4156BAA2B634075E5E42@me.com> <97A678D37742424BBB6CFA12BDF96C5E@me.com> Message-ID: <20121130105653.GA19707@circlewave.net> # Roman Gafiyatullin 2012-11-30: > The main moral here - use the standard behaviours when spawning your processes. > The OTP team has solved most of the potential problems for you already :) The OTP has provided behaviours capturing generic patterns that one encouters quite often in practice. When the problem at hand fits one such pattern and nothing in the implementation of the behaviour is playing against desired operational characteristics that you're working towards, great, standard behaviour is a good fit. In other cases though you'll want to create your own generic behaviour. In other cases you'll want to proc_lib:spawn_link/X your own thing. In other cases you'll want to erlang:spawn_link/X your own thing. In some cases you'll want a short-lived one-off process. In other cases you'll want a hand-written control loop. Sometimes you want to put these under supervisor, other times you don't. Repeat the above for non-linking ways of spawning processes. Erlang provides concurrency primitives as part of the base language, OTP libraries provide various degrees of elaboration on top of those primitives. There is a wealth of tools available -- this is not a result OTP designer's indecisiveness, it is intentional. They are all legitimate tools and each solves a different problem. Differences between them may be subtle and not apparent at first, it's good to play around and try different approaches. Just my 2p, really... BR, -- Jachym From jesper.louis.andersen@REDACTED Fri Nov 30 12:54:42 2012 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 30 Nov 2012 12:54:42 +0100 Subject: [erlang-questions] Homebrew In-Reply-To: References: Message-ID: <27C2C170-54F2-4DE3-B555-B1781614891A@erlang-solutions.com> The problem is you are using homebrew incorrectly. Homebrew does not per se understand about old versions of Erlang, it only knows about the latest version. So your invocation must be brew install erlang There is another thread which talks about running multiple versions of Erlang/OTP next to each other. It mentions 'kerl' as a tool to handle the task of having multiple Erlang versions on the same machine and being able to switch between these. There are other tools as well to do it. Or you can use a shell script to alter your PATH to include the correct wanted Erlang/OTP version. I believe there were some hints in the other thread as well. Actually getting this installed is out of the scope of this mailing list though, I think. Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen On Nov 30, 2012, at 10:06 AM, Lucky Khoza wrote: > I'm trying to install Erlang version R14B01 using homebrew: Kk-MacBook:~ lk$ brew install R14B01 and I'm actually getting this > Error: No available formula for r14b01. From roberto.majadas@REDACTED Fri Nov 30 13:08:10 2012 From: roberto.majadas@REDACTED (Roberto Majadas Lopez) Date: Fri, 30 Nov 2012 13:08:10 +0100 Subject: [erlang-questions] [ANN] Kucumberl, an erlang implementation of cucumber In-Reply-To: <42e9d467-101a-41d8-8c8c-6ed07cf0210b@googlegroups.com> References: <42e9d467-101a-41d8-8c8c-6ed07cf0210b@googlegroups.com> Message-ID: 2012/11/29 Tom Janssens > You could probably add guard classes to your step definitions like this: > given("a (.*)",[blah]) when blah > 10 .. > Not sure if it would provide any actual use or not... So maybe you should > ignore that part ;) > this behavour should be already in kucumberl, but there isn't any example. regards Roberto > > Nevertheless, great approach! > > > > Op donderdag 29 november 2012 12:29:42 UTC+1 schreef Roberto Majadas Lopez > het volgende: >> >> Thanks! >> >> What do you mean with "examples with guard clauses" ? >> >> Roberto >> >> >> 2012/11/29 Tom Janssens >> >> Looks great! I would consider adding examples with guard clauses as well, >>> as that might be the killer feature of erlang step definitions! >>> >>> Op woensdag 28 november 2012 17:45:22 UTC+1 schreef Roberto Majadas >>> Lopez het volgende: >>> >>>> Hi, list. >>>> >>>> We've just released Kucumberl, a Cucumber[1] implementation for erlang. >>>> It's a tool for running automated acceptance tests written in a Behavior >>>> Driven Development (BDD) style. >>>> >>>> This code is released under an apache 2.0 license. All comments, code >>>> or issues are welcome. >>>> >>>> https://github.com/openshine/**k**ucumberl >>>> >>>> Happy hacking >>>> >>>> Roberto >>>> >>>> [1] http://cukes.info/ >>>> >>> >> >> >> -- >> Roberto Majadas >> OpenShine S.L >> >> email : roberto...@REDACTED >> tlf : +34 663 273 501 >> >> www.openshine.com >> >> -- Roberto Majadas OpenShine S.L email : roberto.majadas@REDACTED tlf : +34 663 273 501 www.openshine.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From avalormaquedano@REDACTED Fri Nov 30 13:57:18 2012 From: avalormaquedano@REDACTED (=?ISO-8859-1?B?wWx2YXJv?=) Date: Fri, 30 Nov 2012 13:57:18 +0100 Subject: [erlang-questions] Problem with io monitor - a bug? Message-ID: Dear all, Every time I run this simple code, my program gets stuck: > Pid = spawn (moduleName,myread,["hello"]). where: myread(Prompt)-> try Result = io:read(Prompt), io:format("Res: ~p~n",[Result]), catch A:B-> io:format("Read error: ~p:~p~n",[A,B]), false end. if I check the status of the process: > erlang:process_info(Pid). [{current_function,{io,wait_io_mon_reply,2}}, {initial_call,{default_environment,myread,1}}, {status,waiting}, {message_queue_len,0}, {messages,[]}, {links,[]}, {dictionary,[]}, {trap_exit,false}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.25.0>}, {total_heap_size,233}, {heap_size,233}, {stack_size,7}, {reductions,28}, {garbage_collection,[{min_bin_vheap_size,46368}, {min_heap_size,233}, {fullsweep_after,65535}, {minor_gcs,0}]}, {suspending,[]}] It seems to be stuck in the function io:wait_io_mon_reply/2 (surfing through io.erl I found that this function waits for a response from the process managing the io ). This process is not answering, hence my code stops working. I've checked that the "group_leader()" once I spawn the reading process is the same used by my shell. Any ideas on how to deal with it? Regards, ?lvaro -------------- next part -------------- An HTML attachment was scrubbed... URL: From avalormaquedano@REDACTED Fri Nov 30 14:03:34 2012 From: avalormaquedano@REDACTED (=?ISO-8859-1?B?wWx2YXJv?=) Date: Fri, 30 Nov 2012 14:03:34 +0100 Subject: [erlang-questions] Problem with io monitor - a bug? In-Reply-To: References: Message-ID: SMALL UPDATE: If I "put the shell process to sleep": > timer:sleep(5000). The prompt from the io:read appears. It seems that the shell process "greedily" locks the io monitor... 2012/11/30 ?lvaro > Dear all, > > Every time I run this simple code, my program gets stuck: > > > Pid = spawn (moduleName,myread,["hello"]). > > where: > > myread(Prompt)-> > try > Result = io:read(Prompt), > io:format("Res: ~p~n",[Result]), > catch > A:B-> > io:format("Read error: ~p:~p~n",[A,B]), > false > end. > > > if I check the status of the process: > > > erlang:process_info(Pid). > > [{current_function,{io,wait_io_mon_reply,2}}, > {initial_call,{default_environment,myread,1}}, > {status,waiting}, > {message_queue_len,0}, > {messages,[]}, > {links,[]}, > {dictionary,[]}, > {trap_exit,false}, > {error_handler,error_handler}, > {priority,normal}, > {group_leader,<0.25.0>}, > {total_heap_size,233}, > {heap_size,233}, > {stack_size,7}, > {reductions,28}, > {garbage_collection,[{min_bin_vheap_size,46368}, > {min_heap_size,233}, > {fullsweep_after,65535}, > {minor_gcs,0}]}, > {suspending,[]}] > > > It seems to be stuck in the function io:wait_io_mon_reply/2 (surfing > through io.erl I found that this function waits for a response from the > process managing the io ). This process is not answering, hence my code > stops working. > I've checked that the "group_leader()" once I spawn the reading process is > the same used by my shell. > > Any ideas on how to deal with it? > > Regards, > ?lvaro > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri Nov 30 14:48:54 2012 From: g@REDACTED (Garrett Smith) Date: Fri, 30 Nov 2012 07:48:54 -0600 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: <66F9B3537D2A4156BAA2B634075E5E42@me.com> References: <66F9B3537D2A4156BAA2B634075E5E42@me.com> Message-ID: Roman is spot on correct. There's a school of thought that says new developers should learn core Erlang and master it before tackling OTP. IMHO this is wrong. OTP *is* core Erlang at this point.[1] Just use OTP, right away. If the many moving parts of the standard OTP behaviors seems like a steep learning curve, take a look at e2: http://e2project.org e2 is a veneer on top of OTP that, at least in my opinion (I wrote it for this reason :) makes canonical development a lot easier. You might start by reading/following the tutorial: http://e2project.org/tutorial.html The tutorial has more to do with general application development in Erlang than it does in with the specifics of the e2 library. Garrett [1] There's a long history of Erlang that separates the core from OTP. I understand how books, tutorials, teaching philosophies, and common wisdom would treat OTP as an advanced topic. But as a relative newcomer to Erlang, not having any historical context, etc. I found this treatment unhelpful in my own learning. IMO "gen_server" (e2 calls these "services" and "tasks" depending on the scenario) is a starting point, after one has learned the basics of the language itself. On Fri, Nov 30, 2012 at 2:36 AM, Roman Gafiyatullin wrote: > Hi, > > In most of the cases one shall not use "simple loop functions": raw process > cannot participate properly in the supervision tree. > > If you need some new tricky specific model of behaving - better implement it > over gen_server. > For instance supervisor is a gen_server :) > > If you need something more low level - use 'gen' module (see how gen_fsm is > implemented). > > -- > Regards > RG ( +375 33 602 5080, UTC+3 ) > > On Friday, November 30, 2012 at 11:25 am, Vineet Naik wrote: > > Hello, > > I am an Erlang newbie and trying to write a simple chat bot as an > XMPP external component. I am using exmpp library and following > along these tutorials[1] > > So far I have one module `bot_server` that uses the gen_server > interface. Inside it's `handle_info` callback, incoming messages > from various client will be received. To handle and reply to the > these messages, I am thinking of spawning a "bot" process per > client. It will stay alive as long as the client is available > ie. when the client sends "unavailable" presence, it will die. I > also need to keep a list of all the alive bot processes in the > bot_server's state. > > My question is, would it be appropriate to implement the bot as a > gen_server too considering that it needs to handle two calls, one > for handling incoming message (asynchronous) and second for > killing itself (synchronous)? > > In general, when should one use gen_server and when should > one write a simple loop function? > > [1] exmpp tutorials: > http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ > > Thanks, > Vineet > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From daniel.goertzen@REDACTED Fri Nov 30 16:05:25 2012 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Fri, 30 Nov 2012 09:05:25 -0600 Subject: [erlang-questions] Multiple SNMP agents In-Reply-To: <50B883F1.7080407@gmx.de> References: <50B883F1.7080407@gmx.de> Message-ID: Just run an new emulator instance for each simulated snmp device. A number of years ago I did something similar with many instances of a simple tcp server. I want to say I had 700 nodes running, but my memory is a bit fuzzy on that. A ps listing showed pages and pages of beams, the computer was sluggish, but it worked. :) Dan. On Fri, Nov 30, 2012 at 4:01 AM, Gregor F?ng wrote: > Hi all, > > I have the task to implement a system for our testing department, which > need a snmp mock for simulating many snmp devices. What I want to know, is > it possible to create multiple snmp agent instances, each one on a > different ip and/or port in erlang? I'm unfortunaly a very beginner in > erlang/OTP and I read and test the introduction to the snmp system of > erlang/OPT on trapexit (http://www.trapexit.org/SNMP_**Quick_Start). > With this and the information from the erlang documentation I tried to run > more than one agent, for example with multiple -config on erl command line, > but only the last one is used. > So, is it possible and when, how? > > Thank you > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From naikvin@REDACTED Fri Nov 30 17:44:26 2012 From: naikvin@REDACTED (Vineet Naik) Date: Fri, 30 Nov 2012 22:14:26 +0530 Subject: [erlang-questions] Is using gen_server behaviour appropriate for his usecase? In-Reply-To: References: <66F9B3537D2A4156BAA2B634075E5E42@me.com> Message-ID: @Roman Thanks for the detailed explanation, those examples were really helpful @Jachym Thanks for replying. I am only half way through "Learn you some Erlang" and picking up patterns from whatever I learnt so far from there. At this moment I don't mind frameworks making decisions for me. But I totally understand your point.. @Garret Thanks, I will give e2 a try. On Fri, Nov 30, 2012 at 7:18 PM, Garrett Smith wrote: > Roman is spot on correct. > > There's a school of thought that says new developers should learn core > Erlang and master it before tackling OTP. IMHO this is wrong. OTP *is* > core Erlang at this point.[1] > > Just use OTP, right away. If the many moving parts of the standard OTP > behaviors seems like a steep learning curve, take a look at e2: > > http://e2project.org > > e2 is a veneer on top of OTP that, at least in my opinion (I wrote it > for this reason :) makes canonical development a lot easier. You might > start by reading/following the tutorial: > > http://e2project.org/tutorial.html > > The tutorial has more to do with general application development in > Erlang than it does in with the specifics of the e2 library. > > Garrett > > [1] There's a long history of Erlang that separates the core from OTP. > I understand how books, tutorials, teaching philosophies, and common > wisdom would treat OTP as an advanced topic. But as a relative > newcomer to Erlang, not having any historical context, etc. I found > this treatment unhelpful in my own learning. IMO "gen_server" (e2 > calls these "services" and "tasks" depending on the scenario) is a > starting point, after one has learned the basics of the language > itself. > > On Fri, Nov 30, 2012 at 2:36 AM, Roman Gafiyatullin > wrote: >> Hi, >> >> In most of the cases one shall not use "simple loop functions": raw process >> cannot participate properly in the supervision tree. >> >> If you need some new tricky specific model of behaving - better implement it >> over gen_server. >> For instance supervisor is a gen_server :) >> >> If you need something more low level - use 'gen' module (see how gen_fsm is >> implemented). >> >> -- >> Regards >> RG ( +375 33 602 5080, UTC+3 ) >> >> On Friday, November 30, 2012 at 11:25 am, Vineet Naik wrote: >> >> Hello, >> >> I am an Erlang newbie and trying to write a simple chat bot as an >> XMPP external component. I am using exmpp library and following >> along these tutorials[1] >> >> So far I have one module `bot_server` that uses the gen_server >> interface. Inside it's `handle_info` callback, incoming messages >> from various client will be received. To handle and reply to the >> these messages, I am thinking of spawning a "bot" process per >> client. It will stay alive as long as the client is available >> ie. when the client sends "unavailable" presence, it will die. I >> also need to keep a list of all the alive bot processes in the >> bot_server's state. >> >> My question is, would it be appropriate to implement the bot as a >> gen_server too considering that it needs to handle two calls, one >> for handling incoming message (asynchronous) and second for >> killing itself (synchronous)? >> >> In general, when should one use gen_server and when should >> one write a simple loop function? >> >> [1] exmpp tutorials: >> http://blog.process-one.net/scalable_xmpp_bots_with_erlang_and_exmpp_part_i/ >> >> Thanks, >> Vineet >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -- Vineet Naik -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan353hehe@REDACTED Fri Nov 30 22:04:18 2012 From: dan353hehe@REDACTED (Daniel Barney) Date: Fri, 30 Nov 2012 14:04:18 -0700 Subject: [erlang-questions] using bundled certificates in the ssl:ssl_accept upgrade function Message-ID: Hello, I am using erlang on a server that has quite a few ips, and I need to serve out a different certificate based on which ip the client connects to. So i am upgrading a tcp socket based on the ip that the client is connecting to. Unfortunatly i have only managed to get this to work with certificates that don't have another certificates bundled with them. Am i just doing this wrong? so here is how I tried the first time, this establishes the encrypted connection, but it doesn't serve the bundled certificates. just the first one. {ok,BundleFileData} = file:read_file("/mnt/ssl/mycert.bundle.crt"), [{_,TheCert,_} | _] = public_key:pem_decode(CertFIleData), %% notice how I only grab the first one, which is why it can only serve the first one in the chain Certs = [{cert,TheCert},{keyfile = "/mnt/ssl/mycert.key"}], {ok,SslSocket} = ssl:ssl_accept(Socket,[{active,false},{verify, verify_none}] ++ Certs) %% Socket is opened somewhere else I tried to verify the connection with the following command: openssl s_client -showcerts -connect 127.0.0.1:4430 but the cert is never trusted because only it is served and never the bundled certs.and I expect that the cert will not be trusted because I am only giving it the first one. and I get this: CONNECTED(00000003) depth=0 %% removed because it is not my cert verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 %% removed because it is not my cert verify error:num=27:certificate not trusted verify return:1 depth=0 %% removed because it is not my cert verify error:num=21:unable to verify the first certificate verify return:1 --- Certificate chain 0 %% removed because it is not my cert i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA %% some more stuff removed Verify return code: 21 (unable to verify the first certificate) and when I switch to just trying to load the file from the disk, which returns an ecertfile error Certs = [{certfile,"/mnt/ssl/mycert.bundle.crt"},{keyfile = "/mnt/ssl/mycert.key"}], {error,ecertfile} = ssl:ssl_accept(Socket,[{active,false},{verify, verify_none}] ++ Certs) %% Socket is opened somewhere else I've checked and the file does exist at the path, and I have used the same cert bundle in a Node.js project before so I know its not the certificate. So my question is am I doing this completely wrong? I can't manage to find anything on the manual page for ssl to indicate that bundled certs wouldn't work in erlang, and I can't imagine that erlang does not support bundled certificates. So i have to be doing this wrong. any help would be much appreciated on figuring this out. Daniel From dmkolesnikov@REDACTED Fri Nov 30 23:03:41 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 1 Dec 2012 00:03:41 +0200 Subject: [erlang-questions] -spec tuple variable size In-Reply-To: References: <757B8B50-CCFC-4CCB-8976-2ABFE587DFBE@gmail.com> <5A969370-3E73-46B2-8427-5298281E10DF@gmail.com> <2ADC11CB-DA02-490E-BFDA-689EB841D8B5@khandkar.net> <79F1C2F0-9178-4701-A7D6-5A2D1725FAAC@gmail.com> Message-ID: <618AC0AF-1EBB-433E-B40F-978AB2745B95@gmail.com> Hello, On Nov 30, 2012, at 2:26 AM, "Richard O'Keefe" wrote: > Let me put it this way: > why do YOU care whether all the elements of the tuple have > the same type? One of my current limitation is that tuple elements MUST be a _particular_ data type. I simply want to validate that client writes tuples with supported data types. E.g. I do not have a support for nested tuples yet. > > Since the client's calls to your code might not be type checked, > you cannot rely on type checking to guarantee whatever property > it is you need, so you are going to need a run-time check anyway, > aren't you? > Yes, run-time check exists. - Dmitry